@beinformed/ui 1.25.0 → 1.25.1-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.
- package/CHANGELOG.md +6 -0
- package/esm/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useAuthentication.js +1 -1
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/hooks/useModelCatalog.js +0 -1
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/hooks/useModels.js +1 -1
- package/esm/hooks/useModels.js.map +1 -1
- package/esm/hooks/useModularUI.js +1 -1
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +4 -1
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/hooks/useRouter.js +1 -1
- package/esm/hooks/useRouter.js.map +1 -1
- package/esm/models/attributes/AttributeCollection.js.map +1 -1
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/esm/models/attributes/NumberAttributeModel.js +5 -2
- package/esm/models/attributes/NumberAttributeModel.js.map +1 -1
- package/esm/models/attributes/_createAttribute.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/filters/FilterCollection.js.map +1 -1
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/links/LinkModel.js +3 -1
- package/esm/models/links/LinkModel.js.map +1 -1
- package/esm/models/links/normalizeLinkJSON.js.map +1 -1
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/parameter/Parameter.js +1 -1
- package/esm/models/parameter/Parameter.js.map +1 -1
- package/esm/models/types.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/react-client/client.js +1 -1
- package/esm/react-client/client.js.map +1 -1
- package/esm/react-client/rehydrate.js.map +1 -1
- package/esm/react-server/createSSRComplete.js.map +1 -1
- package/esm/react-server/renderSSRComplete.js +4 -2
- package/esm/react-server/renderSSRComplete.js.map +1 -1
- package/esm/react-server/serverUtil.js +18 -9
- package/esm/react-server/serverUtil.js.map +1 -1
- package/esm/react-theme/ThemeProvider.js +1 -1
- package/esm/react-theme/ThemeProvider.js.map +1 -1
- package/esm/react-theme/createTheme.js +8 -3
- package/esm/react-theme/createTheme.js.map +1 -1
- package/esm/react-theme/utils/contrast.js +3 -1
- package/esm/react-theme/utils/contrast.js.map +1 -1
- package/esm/react-theme/utils/corners.js +3 -1
- package/esm/react-theme/utils/corners.js.map +1 -1
- package/esm/react-theme/utils/spacers.js +9 -3
- package/esm/react-theme/utils/spacers.js.map +1 -1
- package/esm/redux/_i18n/{actions.js → I18nActions.js} +1 -1
- package/esm/redux/_i18n/I18nActions.js.map +1 -0
- package/esm/redux/_i18n/{reducer.js → I18nReducer.js} +1 -1
- package/esm/redux/_i18n/I18nReducer.js.map +1 -0
- package/esm/redux/_i18n/index.js +2 -2
- package/esm/redux/_i18n/index.js.map +1 -1
- package/esm/redux/_modularui/{actions.js → ModularUIActions.js} +1 -1
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -0
- package/esm/redux/_modularui/{connector.js → ModularUIConnector.js} +5 -5
- package/esm/redux/_modularui/ModularUIConnector.js.map +1 -0
- package/esm/redux/_modularui/{middleware.js → ModularUIMiddleware.js} +2 -2
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -0
- package/esm/redux/_modularui/{reducer.js → ModularUIReducer.js} +1 -1
- package/esm/redux/_modularui/ModularUIReducer.js.map +1 -0
- package/esm/redux/_modularui/{selectors.js → ModularUISelectors.js} +1 -1
- package/esm/redux/_modularui/ModularUISelectors.js.map +1 -0
- package/esm/redux/_modularui/{modularuiUtils.js → ModularUIUtils.js} +1 -1
- package/esm/redux/_modularui/{modularuiUtils.js.map → ModularUIUtils.js.map} +1 -1
- package/esm/redux/_modularui/index.js +6 -6
- package/esm/redux/_modularui/index.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/_modularui/withModularUI.js +1 -1
- package/esm/redux/_modularui/withModularUI.js.map +1 -1
- package/esm/redux/_router/{actions.js → RouterActions.js} +1 -1
- package/esm/redux/_router/RouterActions.js.map +1 -0
- package/esm/redux/_router/{connectors.js → RouterConnectors.js} +2 -2
- package/esm/redux/_router/RouterConnectors.js.map +1 -0
- package/esm/redux/_router/{middleware.js → RouterMiddleware.js} +1 -1
- package/esm/redux/_router/RouterMiddleware.js.map +1 -0
- package/esm/redux/_router/{reducer.js → RouterReducer.js} +1 -1
- package/esm/redux/_router/RouterReducer.js.map +1 -0
- package/esm/redux/_router/index.js +4 -4
- package/esm/redux/_router/index.js.map +1 -1
- package/esm/redux/actions/Application.js +2 -2
- package/esm/redux/actions/Application.js.map +1 -1
- package/esm/redux/actions/Authorization.js +3 -3
- package/esm/redux/actions/Authorization.js.map +1 -1
- package/esm/redux/actions/Error.js +1 -1
- package/esm/redux/actions/Error.js.map +1 -1
- package/esm/redux/actions/Form.js +2 -2
- package/esm/redux/actions/Form.js.map +1 -1
- package/esm/redux/actions/FormAttributeSet.js +1 -1
- package/esm/redux/actions/FormAttributeSet.js.map +1 -1
- package/esm/redux/actions/FormAttributeSetRepeatable.js +1 -1
- package/esm/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/esm/redux/actions/FormAutosave.js +1 -1
- package/esm/redux/actions/FormAutosave.js.map +1 -1
- package/esm/redux/actions/FormAutosubmit.js +1 -1
- package/esm/redux/actions/FormAutosubmit.js.map +1 -1
- package/esm/redux/actions/FormValidations.js +1 -1
- package/esm/redux/actions/FormValidations.js.map +1 -1
- package/esm/redux/actions/Notification.js.map +1 -1
- package/esm/redux/actions/Preferences.js +1 -1
- package/esm/redux/actions/Preferences.js.map +1 -1
- package/esm/redux/actions/SignIn.js +1 -1
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/redux/actions/SignOut.js +1 -1
- package/esm/redux/actions/SignOut.js.map +1 -1
- package/esm/redux/connectors/Application.js +1 -1
- package/esm/redux/connectors/Application.js.map +1 -1
- package/esm/redux/connectors/Breadcrumb.js +1 -1
- package/esm/redux/connectors/Breadcrumb.js.map +1 -1
- package/esm/redux/connectors/CaseView.js +1 -1
- package/esm/redux/connectors/CaseView.js.map +1 -1
- package/esm/redux/connectors/ConceptDetail.js +1 -1
- package/esm/redux/connectors/ConceptDetail.js.map +1 -1
- package/esm/redux/connectors/ContentBrowser.js +1 -1
- package/esm/redux/connectors/ContentBrowser.js.map +1 -1
- package/esm/redux/connectors/ContentDetail.js +1 -1
- package/esm/redux/connectors/ContentDetail.js.map +1 -1
- package/esm/redux/connectors/ContentDetailSection.js +1 -1
- package/esm/redux/connectors/ContentDetailSection.js.map +1 -1
- package/esm/redux/connectors/Form.js +1 -1
- package/esm/redux/connectors/Form.js.map +1 -1
- package/esm/redux/connectors/ListDetail.js +1 -1
- package/esm/redux/connectors/ListDetail.js.map +1 -1
- package/esm/redux/connectors/ModelCatalog.js +1 -1
- package/esm/redux/connectors/ModelCatalog.js.map +1 -1
- package/esm/redux/connectors/PanelRenderer.js +1 -1
- package/esm/redux/connectors/PanelRenderer.js.map +1 -1
- package/esm/redux/connectors/Preferences.js.map +1 -1
- package/esm/redux/connectors/QuickSearch.js +2 -2
- package/esm/redux/connectors/QuickSearch.js.map +1 -1
- package/esm/redux/connectors/SignIn.js +1 -1
- package/esm/redux/connectors/SignIn.js.map +1 -1
- package/esm/redux/connectors/SignOut.js.map +1 -1
- package/esm/redux/connectors/Tab.js +1 -1
- package/esm/redux/connectors/Tab.js.map +1 -1
- package/esm/redux/reducers/ModalsReducer.js.map +1 -1
- package/esm/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
- package/esm/redux/reducers/createReducer.js +3 -3
- package/esm/redux/reducers/createReducer.js.map +1 -1
- package/esm/redux/store/configureStore.js +4 -4
- package/esm/redux/store/configureStore.js.map +1 -1
- package/esm/utils/fetch/universalFetch.js +3 -2
- package/esm/utils/fetch/universalFetch.js.map +1 -1
- package/esm/utils/fetch/xhr.js.map +1 -1
- package/esm/utils/helpers/objects.js +4 -3
- package/esm/utils/helpers/objects.js.map +1 -1
- package/esm/utils/helpers/sanitizeHtml.js.map +1 -1
- package/esm/utils/number/parseNumbers.js.map +1 -1
- package/lib/builder/mergeLayoutHintConfigurations.js.flow +1 -1
- package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/lib/constants/Settings.js.flow +1 -1
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/useAuthentication.js +3 -3
- package/lib/hooks/useAuthentication.js.flow +1 -1
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useModelCatalog.js.flow +2 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/hooks/useModels.js +2 -2
- package/lib/hooks/useModels.js.flow +1 -1
- package/lib/hooks/useModels.js.map +1 -1
- package/lib/hooks/useModularUI.js +3 -3
- package/lib/hooks/useModularUI.js.flow +4 -1
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +4 -1
- package/lib/hooks/useModularUIBasic.js.flow +1 -1
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useRouter.js +6 -6
- package/lib/hooks/useRouter.js.flow +7 -1
- package/lib/hooks/useRouter.js.map +1 -1
- package/lib/models/attributes/AttributeCollection.js.flow +8 -6
- package/lib/models/attributes/AttributeCollection.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js.flow +18 -16
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.flow +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/NumberAttributeModel.js +5 -2
- package/lib/models/attributes/NumberAttributeModel.js.flow +7 -3
- package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
- package/lib/models/attributes/_createAttribute.js.flow +1 -1
- package/lib/models/attributes/_createAttribute.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js.flow +1 -1
- package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/DependentAttribute.js.flow +1 -1
- package/lib/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
- package/lib/models/base/ResourceModel.js.flow +1 -1
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js.flow +4 -1
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/filters/FilterCollection.js.flow +1 -1
- package/lib/models/filters/FilterCollection.js.map +1 -1
- package/lib/models/form/FormModel.js.flow +2 -2
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/links/LinkModel.js +3 -1
- package/lib/models/links/LinkModel.js.flow +4 -2
- package/lib/models/links/LinkModel.js.map +1 -1
- package/lib/models/links/normalizeLinkJSON.js.flow +1 -1
- package/lib/models/links/normalizeLinkJSON.js.map +1 -1
- package/lib/models/list/ListModel.js.flow +1 -1
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/parameter/Parameter.js +1 -1
- package/lib/models/parameter/Parameter.js.flow +1 -1
- package/lib/models/parameter/Parameter.js.map +1 -1
- package/lib/models/types.js.flow +6 -6
- package/lib/models/types.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js.flow +6 -6
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/react-client/client.js +2 -2
- package/lib/react-client/client.js.flow +8 -8
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-client/rehydrate.js.flow +2 -2
- package/lib/react-client/rehydrate.js.map +1 -1
- package/lib/react-server/createSSRComplete.js.flow +3 -3
- package/lib/react-server/createSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRComplete.js +4 -2
- package/lib/react-server/renderSSRComplete.js.flow +2 -2
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/serverUtil.js +19 -10
- package/lib/react-server/serverUtil.js.flow +20 -11
- package/lib/react-server/serverUtil.js.map +1 -1
- package/lib/react-theme/ThemeProvider.js +1 -1
- package/lib/react-theme/ThemeProvider.js.flow +1 -1
- package/lib/react-theme/ThemeProvider.js.map +1 -1
- package/lib/react-theme/__tests__/ThemeProvider.spec.js.flow +2 -0
- package/lib/react-theme/__tests__/createTheme.spec.js.flow +3 -0
- package/lib/react-theme/createTheme.js +8 -3
- package/lib/react-theme/createTheme.js.flow +7 -5
- package/lib/react-theme/createTheme.js.map +1 -1
- package/lib/react-theme/utils/contrast.js +3 -1
- package/lib/react-theme/utils/contrast.js.flow +1 -1
- package/lib/react-theme/utils/contrast.js.map +1 -1
- package/lib/react-theme/utils/corners.js +3 -1
- package/lib/react-theme/utils/corners.js.flow +1 -1
- package/lib/react-theme/utils/corners.js.map +1 -1
- package/lib/react-theme/utils/spacers.js +9 -3
- package/lib/react-theme/utils/spacers.js.flow +3 -3
- package/lib/react-theme/utils/spacers.js.map +1 -1
- package/lib/redux/_i18n/{actions.js → I18nActions.js} +1 -1
- package/lib/redux/_i18n/{actions.js.flow → I18nActions.js.flow} +0 -0
- package/lib/redux/_i18n/I18nActions.js.map +1 -0
- package/lib/redux/_i18n/{reducer.js → I18nReducer.js} +1 -1
- package/{src/redux/_i18n/reducer.js → lib/redux/_i18n/I18nReducer.js.flow} +5 -2
- package/lib/redux/_i18n/I18nReducer.js.map +1 -0
- package/lib/redux/_i18n/__tests__/actions.spec.js.flow +1 -1
- package/lib/redux/_i18n/__tests__/reducer.spec.js.flow +1 -1
- package/lib/redux/_i18n/index.js +8 -8
- package/lib/redux/_i18n/index.js.flow +2 -2
- package/lib/redux/_i18n/index.js.map +1 -1
- package/lib/redux/_modularui/{actions.js → ModularUIActions.js} +1 -1
- package/lib/redux/_modularui/{actions.js.flow → ModularUIActions.js.flow} +1 -1
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -0
- package/lib/redux/_modularui/{connector.js → ModularUIConnector.js} +11 -11
- package/{src/redux/_modularui/connector.js → lib/redux/_modularui/ModularUIConnector.js.flow} +8 -4
- package/lib/redux/_modularui/ModularUIConnector.js.map +1 -0
- package/lib/redux/_modularui/{middleware.js → ModularUIMiddleware.js} +4 -4
- package/lib/redux/_modularui/{middleware.js.flow → ModularUIMiddleware.js.flow} +20 -5
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -0
- package/lib/redux/_modularui/{reducer.js → ModularUIReducer.js} +1 -1
- package/lib/redux/_modularui/{reducer.js.flow → ModularUIReducer.js.flow} +12 -5
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -0
- package/lib/redux/_modularui/{selectors.js → ModularUISelectors.js} +1 -1
- package/lib/redux/_modularui/{selectors.js.flow → ModularUISelectors.js.flow} +3 -2
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -0
- package/lib/redux/_modularui/{modularuiUtils.js → ModularUIUtils.js} +1 -1
- package/lib/redux/_modularui/{modularuiUtils.js.flow → ModularUIUtils.js.flow} +0 -0
- package/lib/redux/_modularui/{modularuiUtils.js.map → ModularUIUtils.js.map} +1 -1
- package/lib/redux/_modularui/__tests__/actions.spec.js.flow +1 -1
- package/lib/redux/_modularui/__tests__/reducer.spec.js.flow +2 -2
- package/lib/redux/_modularui/__tests__/selectors.spec.js.flow +1 -1
- package/lib/redux/_modularui/index.js +22 -22
- package/lib/redux/_modularui/index.js.flow +6 -6
- package/lib/redux/_modularui/index.js.map +1 -1
- package/lib/redux/_modularui/types.js.flow +10 -4
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js +2 -2
- package/lib/redux/_modularui/withModularUI.js.flow +1 -1
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/redux/_router/{actions.js → RouterActions.js} +1 -1
- package/lib/redux/_router/{actions.js.flow → RouterActions.js.flow} +0 -0
- package/lib/redux/_router/RouterActions.js.map +1 -0
- package/lib/redux/_router/{connectors.js → RouterConnectors.js} +7 -7
- package/lib/redux/_router/{connectors.js.flow → RouterConnectors.js.flow} +1 -1
- package/lib/redux/_router/RouterConnectors.js.map +1 -0
- package/lib/redux/_router/{middleware.js → RouterMiddleware.js} +1 -1
- package/lib/redux/_router/{middleware.js.flow → RouterMiddleware.js.flow} +0 -0
- package/lib/redux/_router/RouterMiddleware.js.map +1 -0
- package/lib/redux/_router/{reducer.js → RouterReducer.js} +1 -1
- package/lib/redux/_router/{reducer.js.flow → RouterReducer.js.flow} +0 -0
- package/lib/redux/_router/RouterReducer.js.map +1 -0
- package/lib/redux/_router/__tests__/actions.spec.js.flow +1 -1
- package/lib/redux/_router/__tests__/middleware.spec.js.flow +2 -2
- package/lib/redux/_router/__tests__/reducer.spec.js.flow +1 -1
- package/lib/redux/_router/index.js +16 -16
- package/lib/redux/_router/index.js.flow +4 -4
- package/lib/redux/_router/index.js.map +1 -1
- package/lib/redux/actions/Application.js +5 -5
- package/lib/redux/actions/Application.js.flow +5 -2
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/actions/Authorization.js +6 -6
- package/lib/redux/actions/Authorization.js.flow +3 -3
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/Error.js +2 -2
- package/lib/redux/actions/Error.js.flow +2 -2
- package/lib/redux/actions/Error.js.map +1 -1
- package/lib/redux/actions/Form.js +5 -5
- package/lib/redux/actions/Form.js.flow +2 -2
- package/lib/redux/actions/Form.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js +2 -2
- package/lib/redux/actions/FormAttributeSet.js.flow +1 -1
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/redux/actions/FormAttributeSetRepeatable.js +4 -4
- package/lib/redux/actions/FormAttributeSetRepeatable.js.flow +1 -1
- package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/lib/redux/actions/FormAutosave.js +2 -2
- package/lib/redux/actions/FormAutosave.js.flow +1 -1
- package/lib/redux/actions/FormAutosave.js.map +1 -1
- package/lib/redux/actions/FormAutosubmit.js +2 -2
- package/lib/redux/actions/FormAutosubmit.js.flow +1 -1
- package/lib/redux/actions/FormAutosubmit.js.map +1 -1
- package/lib/redux/actions/FormValidations.js +2 -2
- package/lib/redux/actions/FormValidations.js.flow +5 -3
- package/lib/redux/actions/FormValidations.js.map +1 -1
- package/lib/redux/actions/Notification.js.flow +1 -1
- package/lib/redux/actions/Notification.js.map +1 -1
- package/lib/redux/actions/Preferences.js +1 -1
- package/lib/redux/actions/Preferences.js.flow +3 -3
- package/lib/redux/actions/Preferences.js.map +1 -1
- package/lib/redux/actions/SignIn.js +2 -2
- package/lib/redux/actions/SignIn.js.flow +1 -1
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/SignOut.js +2 -2
- package/lib/redux/actions/SignOut.js.flow +1 -1
- package/lib/redux/actions/SignOut.js.map +1 -1
- package/lib/redux/connectors/Application.js +2 -2
- package/lib/redux/connectors/Application.js.flow +1 -1
- package/lib/redux/connectors/Application.js.map +1 -1
- package/lib/redux/connectors/Breadcrumb.js +2 -2
- package/lib/redux/connectors/Breadcrumb.js.flow +1 -1
- package/lib/redux/connectors/Breadcrumb.js.map +1 -1
- package/lib/redux/connectors/CaseView.js +2 -2
- package/lib/redux/connectors/CaseView.js.flow +1 -1
- package/lib/redux/connectors/CaseView.js.map +1 -1
- package/lib/redux/connectors/ConceptDetail.js +2 -2
- package/lib/redux/connectors/ConceptDetail.js.flow +1 -1
- package/lib/redux/connectors/ConceptDetail.js.map +1 -1
- package/lib/redux/connectors/ContentBrowser.js +2 -2
- package/lib/redux/connectors/ContentBrowser.js.flow +1 -1
- package/lib/redux/connectors/ContentBrowser.js.map +1 -1
- package/lib/redux/connectors/ContentDetail.js +2 -2
- package/lib/redux/connectors/ContentDetail.js.flow +1 -1
- package/lib/redux/connectors/ContentDetail.js.map +1 -1
- package/lib/redux/connectors/ContentDetailSection.js +2 -2
- package/lib/redux/connectors/ContentDetailSection.js.flow +1 -1
- package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
- package/lib/redux/connectors/Form.js +2 -2
- package/lib/redux/connectors/Form.js.flow +1 -1
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/ListDetail.js +2 -2
- package/lib/redux/connectors/ListDetail.js.flow +1 -1
- package/lib/redux/connectors/ListDetail.js.map +1 -1
- package/lib/redux/connectors/ModelCatalog.js +2 -2
- package/lib/redux/connectors/ModelCatalog.js.flow +1 -1
- package/lib/redux/connectors/ModelCatalog.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js +2 -2
- package/lib/redux/connectors/PanelRenderer.js.flow +1 -1
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/redux/connectors/Preferences.js.flow +5 -2
- package/lib/redux/connectors/Preferences.js.map +1 -1
- package/lib/redux/connectors/QuickSearch.js +4 -4
- package/lib/redux/connectors/QuickSearch.js.flow +2 -2
- package/lib/redux/connectors/QuickSearch.js.map +1 -1
- package/lib/redux/connectors/SignIn.js +2 -2
- package/lib/redux/connectors/SignIn.js.flow +1 -1
- package/lib/redux/connectors/SignIn.js.map +1 -1
- package/lib/redux/connectors/SignOut.js.flow +2 -2
- package/lib/redux/connectors/SignOut.js.map +1 -1
- package/lib/redux/connectors/Tab.js +2 -2
- package/lib/redux/connectors/Tab.js.flow +1 -1
- package/lib/redux/connectors/Tab.js.map +1 -1
- package/lib/redux/reducers/ModalsReducer.js.flow +2 -2
- package/lib/redux/reducers/ModalsReducer.js.map +1 -1
- package/lib/redux/reducers/ProgressIndicatorReducer.js.flow +1 -1
- package/lib/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
- package/lib/redux/reducers/createReducer.js +6 -6
- package/lib/redux/reducers/createReducer.js.flow +3 -3
- package/lib/redux/reducers/createReducer.js.map +1 -1
- package/lib/redux/store/configureStore.js +5 -5
- package/lib/redux/store/configureStore.js.flow +4 -4
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/utils/fetch/universalFetch.js +5 -3
- package/lib/utils/fetch/universalFetch.js.flow +8 -6
- package/lib/utils/fetch/universalFetch.js.map +1 -1
- package/lib/utils/fetch/xhr.js.flow +21 -21
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/objects.js.flow +5 -3
- package/lib/utils/helpers/objects.js.map +1 -1
- package/lib/utils/helpers/sanitizeHtml.js.flow +1 -1
- package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
- package/lib/utils/number/parseNumbers.js.flow +8 -2
- package/lib/utils/number/parseNumbers.js.map +1 -1
- package/package.json +8 -8
- package/src/builder/mergeLayoutHintConfigurations.js +1 -1
- package/src/constants/Settings.js +1 -1
- package/src/hooks/useAuthentication.js +1 -1
- package/src/hooks/useModelCatalog.js +2 -1
- package/src/hooks/useModels.js +1 -1
- package/src/hooks/useModularUI.js +4 -1
- package/src/hooks/useModularUIBasic.js +1 -1
- package/src/hooks/useRouter.js +7 -1
- package/src/models/attributes/AttributeCollection.js +8 -6
- package/src/models/attributes/AttributeModel.js +18 -16
- package/src/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/src/models/attributes/NumberAttributeModel.js +7 -3
- package/src/models/attributes/_createAttribute.js +1 -1
- package/src/models/attributes/layouthint-rules/BaseLayoutHintRule.js +1 -1
- package/src/models/attributes/layouthint-rules/DependentAttribute.js +1 -1
- package/src/models/base/ResourceModel.js +1 -1
- package/src/models/content/ContentTOCModel.js +4 -1
- package/src/models/filters/FilterCollection.js +1 -1
- package/src/models/form/FormModel.js +2 -2
- package/src/models/links/LinkModel.js +4 -2
- package/src/models/links/normalizeLinkJSON.js +1 -1
- package/src/models/list/ListModel.js +1 -1
- package/src/models/parameter/Parameter.js +1 -1
- package/src/models/types.js +6 -6
- package/src/modularui/ModularUIRequest.js +6 -6
- package/src/react-client/client.js +8 -8
- package/src/react-client/rehydrate.js +2 -2
- package/src/react-server/createSSRComplete.js +3 -3
- package/src/react-server/renderSSRComplete.js +2 -2
- package/src/react-server/serverUtil.js +20 -11
- package/src/react-theme/ThemeProvider.js +1 -1
- package/src/react-theme/__tests__/ThemeProvider.spec.js +2 -0
- package/src/react-theme/__tests__/createTheme.spec.js +3 -0
- package/src/react-theme/createTheme.js +7 -5
- package/src/react-theme/utils/contrast.js +1 -1
- package/src/react-theme/utils/corners.js +1 -1
- package/src/react-theme/utils/spacers.js +3 -3
- package/src/redux/_i18n/{actions.js → I18nActions.js} +0 -0
- package/{lib/redux/_i18n/reducer.js.flow → src/redux/_i18n/I18nReducer.js} +5 -2
- package/src/redux/_i18n/__tests__/actions.spec.js +1 -1
- package/src/redux/_i18n/__tests__/reducer.spec.js +1 -1
- package/src/redux/_i18n/index.js +2 -2
- package/src/redux/_modularui/{actions.js → ModularUIActions.js} +1 -1
- package/{lib/redux/_modularui/connector.js.flow → src/redux/_modularui/ModularUIConnector.js} +8 -4
- package/src/redux/_modularui/{middleware.js → ModularUIMiddleware.js} +20 -5
- package/src/redux/_modularui/{reducer.js → ModularUIReducer.js} +12 -5
- package/src/redux/_modularui/{selectors.js → ModularUISelectors.js} +3 -2
- package/src/redux/_modularui/{modularuiUtils.js → ModularUIUtils.js} +0 -0
- package/src/redux/_modularui/__tests__/actions.spec.js +1 -1
- package/src/redux/_modularui/__tests__/reducer.spec.js +2 -2
- package/src/redux/_modularui/__tests__/selectors.spec.js +1 -1
- package/src/redux/_modularui/index.js +6 -6
- package/src/redux/_modularui/types.js +10 -4
- package/src/redux/_modularui/withModularUI.js +1 -1
- package/src/redux/_router/{actions.js → RouterActions.js} +0 -0
- package/src/redux/_router/{connectors.js → RouterConnectors.js} +1 -1
- package/src/redux/_router/{middleware.js → RouterMiddleware.js} +0 -0
- package/src/redux/_router/{reducer.js → RouterReducer.js} +0 -0
- package/src/redux/_router/__tests__/actions.spec.js +1 -1
- package/src/redux/_router/__tests__/middleware.spec.js +2 -2
- package/src/redux/_router/__tests__/reducer.spec.js +1 -1
- package/src/redux/_router/index.js +4 -4
- package/src/redux/actions/Application.js +5 -2
- package/src/redux/actions/Authorization.js +3 -3
- package/src/redux/actions/Error.js +2 -2
- package/src/redux/actions/Form.js +2 -2
- package/src/redux/actions/FormAttributeSet.js +1 -1
- package/src/redux/actions/FormAttributeSetRepeatable.js +1 -1
- package/src/redux/actions/FormAutosave.js +1 -1
- package/src/redux/actions/FormAutosubmit.js +1 -1
- package/src/redux/actions/FormValidations.js +5 -3
- package/src/redux/actions/Notification.js +1 -1
- package/src/redux/actions/Preferences.js +3 -3
- package/src/redux/actions/SignIn.js +1 -1
- package/src/redux/actions/SignOut.js +1 -1
- package/src/redux/connectors/Application.js +1 -1
- package/src/redux/connectors/Breadcrumb.js +1 -1
- package/src/redux/connectors/CaseView.js +1 -1
- package/src/redux/connectors/ConceptDetail.js +1 -1
- package/src/redux/connectors/ContentBrowser.js +1 -1
- package/src/redux/connectors/ContentDetail.js +1 -1
- package/src/redux/connectors/ContentDetailSection.js +1 -1
- package/src/redux/connectors/Form.js +1 -1
- package/src/redux/connectors/ListDetail.js +1 -1
- package/src/redux/connectors/ModelCatalog.js +1 -1
- package/src/redux/connectors/PanelRenderer.js +1 -1
- package/src/redux/connectors/Preferences.js +5 -2
- package/src/redux/connectors/QuickSearch.js +2 -2
- package/src/redux/connectors/SignIn.js +1 -1
- package/src/redux/connectors/SignOut.js +2 -2
- package/src/redux/connectors/Tab.js +1 -1
- package/src/redux/reducers/ModalsReducer.js +2 -2
- package/src/redux/reducers/ProgressIndicatorReducer.js +1 -1
- package/src/redux/reducers/createReducer.js +3 -3
- package/src/redux/store/configureStore.js +4 -4
- package/src/utils/fetch/universalFetch.js +8 -6
- package/src/utils/fetch/xhr.js +21 -21
- package/src/utils/helpers/objects.js +5 -3
- package/src/utils/helpers/sanitizeHtml.js +1 -1
- package/src/utils/number/parseNumbers.js +8 -2
- package/types/models/concepts/ConceptDetailModel.d.ts +3 -3
- package/types/models/concepts/ConceptRelationModel.d.ts +2 -1
- package/types/models/types.d.ts +17 -3
- package/types/redux/_modularui/types.d.ts +3 -1
- package/types/utils/fetch/universalFetch.d.ts +3 -3
- package/types/utils/helpers/objects.d.ts +10 -2
- package/esm/redux/_i18n/actions.js.map +0 -1
- package/esm/redux/_i18n/reducer.js.map +0 -1
- package/esm/redux/_modularui/actions.js.map +0 -1
- package/esm/redux/_modularui/connector.js.map +0 -1
- package/esm/redux/_modularui/middleware.js.map +0 -1
- package/esm/redux/_modularui/reducer.js.map +0 -1
- package/esm/redux/_modularui/selectors.js.map +0 -1
- package/esm/redux/_router/actions.js.map +0 -1
- package/esm/redux/_router/connectors.js.map +0 -1
- package/esm/redux/_router/middleware.js.map +0 -1
- package/esm/redux/_router/reducer.js.map +0 -1
- package/lib/redux/_i18n/actions.js.map +0 -1
- package/lib/redux/_i18n/reducer.js.map +0 -1
- package/lib/redux/_modularui/actions.js.map +0 -1
- package/lib/redux/_modularui/connector.js.map +0 -1
- package/lib/redux/_modularui/middleware.js.map +0 -1
- package/lib/redux/_modularui/reducer.js.map +0 -1
- package/lib/redux/_modularui/selectors.js.map +0 -1
- package/lib/redux/_router/actions.js.map +0 -1
- package/lib/redux/_router/connectors.js.map +0 -1
- package/lib/redux/_router/middleware.js.map +0 -1
- package/lib/redux/_router/reducer.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { connect } from "react-redux";
|
|
2
2
|
import { login } from "../actions/SignIn";
|
|
3
|
-
import { getApplication } from "../_modularui/
|
|
3
|
+
import { getApplication } from "../_modularui/ModularUISelectors";
|
|
4
4
|
const mapStateToProps = state => {
|
|
5
5
|
const application = getApplication(state);
|
|
6
6
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignIn.js","names":["connect","login","getApplication","mapStateToProps","state","application","isAuthenticated","isLoggedIn","errorMessage","auth","error","mapDispatchToProps","onSubmit","connectSignIn"],"sources":["../../../src/redux/connectors/SignIn.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { login } from \"../actions/SignIn\";\n\nimport { getApplication } from \"../_modularui/
|
|
1
|
+
{"version":3,"file":"SignIn.js","names":["connect","login","getApplication","mapStateToProps","state","application","isAuthenticated","isLoggedIn","errorMessage","auth","error","mapDispatchToProps","onSubmit","connectSignIn"],"sources":["../../../src/redux/connectors/SignIn.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { login } from \"../actions/SignIn\";\n\nimport { getApplication } from \"../_modularui/ModularUISelectors\";\n\nimport type { ReduxState, ThunkAction } from \"../types\";\nimport type { ComponentType } from \"react\";\n\ntype StateProps = {\n isAuthenticated: boolean,\n errorMessage: ?string,\n};\n\ntype DispatchProps = {\n onSubmit: (username: string, password: string) => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (state: ReduxState): StateProps => {\n const application = getApplication(state);\n\n return {\n isAuthenticated: application?.isLoggedIn ?? false,\n errorMessage: state.auth.error,\n };\n};\n\nconst mapDispatchToProps: DispatchProps = {\n onSubmit: login,\n};\n\n/**\n */\nexport const connectSignIn: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _\n>(mapStateToProps, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,KAAK,QAAQ,mBAAmB;AAEzC,SAASC,cAAc,QAAQ,kCAAkC;AAmBjE,MAAMC,eAAe,GAAIC,KAAiB,IAAiB;EACzD,MAAMC,WAAW,GAAGH,cAAc,CAACE,KAAK,CAAC;EAEzC,OAAO;IACLE,eAAe,EAAED,WAAW,EAAEE,UAAU,IAAI,KAAK;IACjDC,YAAY,EAAEJ,KAAK,CAACK,IAAI,CAACC;EAC3B,CAAC;AACH,CAAC;AAED,MAAMC,kBAAiC,GAAG;EACxCC,QAAQ,EAAEX;AACZ,CAAC;;AAED;AACA;AACA,OAAO,MAAMY,aAAiC,GAAGb,OAAO,CAOtDG,eAAe,EAAEQ,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignOut.js","names":["connect","logout","getApplication","mapStateToProps","state","isAuthenticated","isLoggedIn","mapDispatchToProps","doLogout","connectSignOut"],"sources":["../../../src/redux/connectors/SignOut.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { logout } from \"../actions/SignOut\";\n\nimport type { ThunkAction } from \"../types\";\nimport type { ComponentType } from \"react\";\nimport { getApplication } from \"../_modularui\";\n\ntype StateProps = {\n isAuthenticated: boolean,\n};\n\ntype DispatchProps = {\n doLogout: () => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (state): StateProps => ({\n isAuthenticated: getApplication(state)?.isLoggedIn ?? false,\n});\n\nconst mapDispatchToProps = { doLogout: logout };\n\n/**\n */\nexport const connectSignOut: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _\n>(mapStateToProps, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,MAAM,QAAQ,oBAAoB;AAI3C,SAASC,cAAc,QAAQ,eAAe;AAe9C,MAAMC,eAAe,GAAIC,
|
|
1
|
+
{"version":3,"file":"SignOut.js","names":["connect","logout","getApplication","mapStateToProps","state","isAuthenticated","isLoggedIn","mapDispatchToProps","doLogout","connectSignOut"],"sources":["../../../src/redux/connectors/SignOut.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { logout } from \"../actions/SignOut\";\n\nimport type { ReduxState, ThunkAction } from \"../types\";\nimport type { ComponentType } from \"react\";\nimport { getApplication } from \"../_modularui\";\n\ntype StateProps = {\n isAuthenticated: boolean,\n};\n\ntype DispatchProps = {\n doLogout: () => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (state: ReduxState): StateProps => ({\n isAuthenticated: getApplication(state)?.isLoggedIn ?? false,\n});\n\nconst mapDispatchToProps = { doLogout: logout };\n\n/**\n */\nexport const connectSignOut: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _\n>(mapStateToProps, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,MAAM,QAAQ,oBAAoB;AAI3C,SAASC,cAAc,QAAQ,eAAe;AAe9C,MAAMC,eAAe,GAAIC,KAAiB,KAAkB;EAC1DC,eAAe,EAAEH,cAAc,CAACE,KAAK,CAAC,EAAEE,UAAU,IAAI;AACxD,CAAC,CAAC;AAEF,MAAMC,kBAAkB,GAAG;EAAEC,QAAQ,EAAEP;AAAO,CAAC;;AAE/C;AACA;AACA,OAAO,MAAMQ,cAAkC,GAAGT,OAAO,CAOvDG,eAAe,EAAEI,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","names":["modularui","connectTab","match","url","propName"],"sources":["../../../src/redux/connectors/Tab.js"],"sourcesContent":["// @flow\nimport modularui from \"../_modularui/
|
|
1
|
+
{"version":3,"file":"Tab.js","names":["modularui","connectTab","match","url","propName"],"sources":["../../../src/redux/connectors/Tab.js"],"sourcesContent":["// @flow\nimport modularui from \"../_modularui/ModularUIConnector\";\n\nimport type { ModularUIConnector } from \"../_modularui/types\";\n\n/**\n */\nexport const connectTab: ModularUIConnector = modularui(\n \"Tab\",\n ({ match }) => match.url,\n {\n propName: \"tab\",\n }\n);\n"],"mappings":"AACA,OAAOA,SAAS,MAAM,kCAAkC;AAIxD;AACA;AACA,OAAO,MAAMC,UAA8B,GAAGD,SAAS,CACrD,KAAK,EACL;EAAA,IAAC;IAAEE;EAAM,CAAC;EAAA,OAAKA,KAAK,CAACC,GAAG;AAAA,GACxB;EACEC,QAAQ,EAAE;AACZ,CAAC,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalsReducer.js","names":["showModal","state","modalKey","modals","modal","visible","key","closeModal","idx","arr","length","initialState","ModalsReducer","action","type","payload"],"sources":["../../../src/redux/reducers/ModalsReducer.js"],"sourcesContent":["// @flow\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ModalsState } from \"../types\";\n\nconst showModal = (state, modalKey) => [\n ...state.modals.map((modal) => ({\n ...modal,\n visible: false,\n })),\n {\n key: modalKey,\n visible: true,\n },\n];\n\nconst closeModal = (state, modalKey) =>\n state.modals\n .filter((modal) => modal.key !== modalKey)\n .map((modal, idx, arr) => ({\n ...modal,\n visible: arr.length === idx + 1,\n }));\n\n// REDUCER\nconst initialState: ModalsState = {\n modals: [],\n};\n\n/**\n * Modals reducer\n */\nconst ModalsReducer: Reducer<ModalsState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"SHOW_MODAL\":\n return {\n ...state,\n modals: showModal(state, action.payload),\n };\n\n case \"CLOSE_MODAL\":\n return {\n ...state,\n modals: closeModal(state, action.payload),\n };\n\n default:\n return state;\n }\n};\n\nexport default ModalsReducer;\n"],"mappings":";;AAIA,MAAMA,SAAS,GAAG,CAACC,
|
|
1
|
+
{"version":3,"file":"ModalsReducer.js","names":["showModal","state","modalKey","modals","modal","visible","key","closeModal","idx","arr","length","initialState","ModalsReducer","action","type","payload"],"sources":["../../../src/redux/reducers/ModalsReducer.js"],"sourcesContent":["// @flow\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ModalsState } from \"../types\";\n\nconst showModal = (state: ModalsState, modalKey: string) => [\n ...state.modals.map((modal) => ({\n ...modal,\n visible: false,\n })),\n {\n key: modalKey,\n visible: true,\n },\n];\n\nconst closeModal = (state: ModalsState, modalKey: string) =>\n state.modals\n .filter((modal) => modal.key !== modalKey)\n .map((modal, idx, arr) => ({\n ...modal,\n visible: arr.length === idx + 1,\n }));\n\n// REDUCER\nconst initialState: ModalsState = {\n modals: [],\n};\n\n/**\n * Modals reducer\n */\nconst ModalsReducer: Reducer<ModalsState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"SHOW_MODAL\":\n return {\n ...state,\n modals: showModal(state, action.payload),\n };\n\n case \"CLOSE_MODAL\":\n return {\n ...state,\n modals: closeModal(state, action.payload),\n };\n\n default:\n return state;\n }\n};\n\nexport default ModalsReducer;\n"],"mappings":";;AAIA,MAAMA,SAAS,GAAG,CAACC,KAAkB,EAAEC,QAAgB;EAAA;EAAA,OAAK,CAC1D,GAAG,gCAAAD,KAAK,CAACE,MAAM,iBAAMC,KAAK,KAAM;IAC9B,GAAGA,KAAK;IACRC,OAAO,EAAE;EACX,CAAC,CAAC,CAAC,EACH;IACEC,GAAG,EAAEJ,QAAQ;IACbG,OAAO,EAAE;EACX,CAAC,CACF;AAAA;AAED,MAAME,UAAU,GAAG,CAACN,KAAkB,EAAEC,QAAgB;EAAA;EAAA,OACtD,qEAAAD,KAAK,CAACE,MAAM,kBACDC,KAAK,IAAKA,KAAK,CAACE,GAAG,KAAKJ,QAAQ,CAAC,kBACrC,CAACE,KAAK,EAAEI,GAAG,EAAEC,GAAG,MAAM;IACzB,GAAGL,KAAK;IACRC,OAAO,EAAEI,GAAG,CAACC,MAAM,KAAKF,GAAG,GAAG;EAChC,CAAC,CAAC,CAAC;AAAA;;AAEP;AACA,MAAMG,YAAyB,GAAG;EAChCR,MAAM,EAAE;AACV,CAAC;;AAED;AACA;AACA;AACA,MAAMS,aAAgD,GAAG,YAGpD;EAAA,IAFHX,KAAK,uEAAGU,YAAY;EAAA,IACpBE,MAAM;EAEN,IAAI,CAACA,MAAM,EAAE;IACX,OAAOZ,KAAK;EACd;EAEA,QAAQY,MAAM,CAACC,IAAI;IACjB,KAAK,YAAY;MACf,OAAO;QACL,GAAGb,KAAK;QACRE,MAAM,EAAEH,SAAS,CAACC,KAAK,EAAEY,MAAM,CAACE,OAAO;MACzC,CAAC;IAEH,KAAK,aAAa;MAChB,OAAO;QACL,GAAGd,KAAK;QACRE,MAAM,EAAEI,UAAU,CAACN,KAAK,EAAEY,MAAM,CAACE,OAAO;MAC1C,CAAC;IAEH;MACE,OAAOd,KAAK;EAAC;AAEnB,CAAC;AAED,eAAeW,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressIndicatorReducer.js","names":["initialState","count","timestamp","percentComplete","finishProgress","state","isFinalFinish","Date","now","progressIndicatorReducer","action","type","payload"],"sources":["../../../src/redux/reducers/ProgressIndicatorReducer.js"],"sourcesContent":["// @flow\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ProgressIndicatorState } from \"../types\";\n\n// REDUCER\nconst initialState: ProgressIndicatorState = {\n count: 0,\n timestamp: 0,\n percentComplete: 0,\n};\n\nconst finishProgress = (state) => {\n const isFinalFinish = state.count - 1 === 0;\n return {\n ...state,\n count: state.count <= 0 ? 0 : state.count - 1,\n timestamp: isFinalFinish ? Date.now() : state.timestamp,\n percentComplete: isFinalFinish ? 0 : state.percentComplete,\n };\n};\n\n/**\n * Keep state for the progress indicator\n */\nconst progressIndicatorReducer: Reducer<ProgressIndicatorState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"UPDATE_PROGRESS\":\n return {\n ...state,\n percentComplete: action.payload?.percentComplete,\n };\n\n case \"FINISH_PROGRESS\":\n return finishProgress(state);\n\n case \"START_PROGRESS\":\n return {\n ...state,\n count: state.count + 1,\n };\n\n case \"RESET_PROGRESS\":\n return {\n ...state,\n count: 0,\n };\n\n default:\n return state;\n }\n};\n\nexport default progressIndicatorReducer;\n"],"mappings":"AAIA;AACA,MAAMA,YAAoC,GAAG;EAC3CC,KAAK,EAAE,CAAC;EACRC,SAAS,EAAE,CAAC;EACZC,eAAe,EAAE;AACnB,CAAC;AAED,MAAMC,cAAc,GAAIC,
|
|
1
|
+
{"version":3,"file":"ProgressIndicatorReducer.js","names":["initialState","count","timestamp","percentComplete","finishProgress","state","isFinalFinish","Date","now","progressIndicatorReducer","action","type","payload"],"sources":["../../../src/redux/reducers/ProgressIndicatorReducer.js"],"sourcesContent":["// @flow\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction, ProgressIndicatorState } from \"../types\";\n\n// REDUCER\nconst initialState: ProgressIndicatorState = {\n count: 0,\n timestamp: 0,\n percentComplete: 0,\n};\n\nconst finishProgress = (state: ProgressIndicatorState) => {\n const isFinalFinish = state.count - 1 === 0;\n return {\n ...state,\n count: state.count <= 0 ? 0 : state.count - 1,\n timestamp: isFinalFinish ? Date.now() : state.timestamp,\n percentComplete: isFinalFinish ? 0 : state.percentComplete,\n };\n};\n\n/**\n * Keep state for the progress indicator\n */\nconst progressIndicatorReducer: Reducer<ProgressIndicatorState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"UPDATE_PROGRESS\":\n return {\n ...state,\n percentComplete: action.payload?.percentComplete,\n };\n\n case \"FINISH_PROGRESS\":\n return finishProgress(state);\n\n case \"START_PROGRESS\":\n return {\n ...state,\n count: state.count + 1,\n };\n\n case \"RESET_PROGRESS\":\n return {\n ...state,\n count: 0,\n };\n\n default:\n return state;\n }\n};\n\nexport default progressIndicatorReducer;\n"],"mappings":"AAIA;AACA,MAAMA,YAAoC,GAAG;EAC3CC,KAAK,EAAE,CAAC;EACRC,SAAS,EAAE,CAAC;EACZC,eAAe,EAAE;AACnB,CAAC;AAED,MAAMC,cAAc,GAAIC,KAA6B,IAAK;EACxD,MAAMC,aAAa,GAAGD,KAAK,CAACJ,KAAK,GAAG,CAAC,KAAK,CAAC;EAC3C,OAAO;IACL,GAAGI,KAAK;IACRJ,KAAK,EAAEI,KAAK,CAACJ,KAAK,IAAI,CAAC,GAAG,CAAC,GAAGI,KAAK,CAACJ,KAAK,GAAG,CAAC;IAC7CC,SAAS,EAAEI,aAAa,GAAGC,IAAI,CAACC,GAAG,EAAE,GAAGH,KAAK,CAACH,SAAS;IACvDC,eAAe,EAAEG,aAAa,GAAG,CAAC,GAAGD,KAAK,CAACF;EAC7C,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA,MAAMM,wBAAsE,GAAG,YAG1E;EAAA,IAFHJ,KAAK,uEAAGL,YAAY;EAAA,IACpBU,MAAM;EAEN,IAAI,CAACA,MAAM,EAAE;IACX,OAAOL,KAAK;EACd;EAEA,QAAQK,MAAM,CAACC,IAAI;IACjB,KAAK,iBAAiB;MACpB,OAAO;QACL,GAAGN,KAAK;QACRF,eAAe,EAAEO,MAAM,CAACE,OAAO,EAAET;MACnC,CAAC;IAEH,KAAK,iBAAiB;MACpB,OAAOC,cAAc,CAACC,KAAK,CAAC;IAE9B,KAAK,gBAAgB;MACnB,OAAO;QACL,GAAGA,KAAK;QACRJ,KAAK,EAAEI,KAAK,CAACJ,KAAK,GAAG;MACvB,CAAC;IAEH,KAAK,gBAAgB;MACnB,OAAO;QACL,GAAGI,KAAK;QACRJ,KAAK,EAAE;MACT,CAAC;IAEH;MACE,OAAOI,KAAK;EAAC;AAEnB,CAAC;AAED,eAAeI,wBAAwB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RouterReducer } from "../_router/
|
|
2
|
-
import { ModularUIReducer } from "../_modularui/
|
|
3
|
-
import { I18nReducer } from "../_i18n/
|
|
1
|
+
import { RouterReducer } from "../_router/RouterReducer";
|
|
2
|
+
import { ModularUIReducer } from "../_modularui/ModularUIReducer";
|
|
3
|
+
import { I18nReducer } from "../_i18n/I18nReducer";
|
|
4
4
|
import ModalsReducer from "./ModalsReducer";
|
|
5
5
|
import AuthReducer from "./AuthReducer";
|
|
6
6
|
import ErrorReducer from "./ErrorReducer";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createReducer.js","names":["RouterReducer","ModularUIReducer","I18nReducer","ModalsReducer","AuthReducer","ErrorReducer","NotificationReducer","ProgressIndicatorReducer","PreferencesReducer","createReducer","router","modularui","i18n","auth","error","modals","notification","progressindicator","preferences"],"sources":["../../../src/redux/reducers/createReducer.js"],"sourcesContent":["// @flow\nimport { RouterReducer } from \"../_router/
|
|
1
|
+
{"version":3,"file":"createReducer.js","names":["RouterReducer","ModularUIReducer","I18nReducer","ModalsReducer","AuthReducer","ErrorReducer","NotificationReducer","ProgressIndicatorReducer","PreferencesReducer","createReducer","router","modularui","i18n","auth","error","modals","notification","progressindicator","preferences"],"sources":["../../../src/redux/reducers/createReducer.js"],"sourcesContent":["// @flow\nimport { RouterReducer } from \"../_router/RouterReducer\";\nimport { ModularUIReducer } from \"../_modularui/ModularUIReducer\";\nimport { I18nReducer } from \"../_i18n/I18nReducer\";\n\nimport ModalsReducer from \"./ModalsReducer\";\nimport AuthReducer from \"./AuthReducer\";\nimport ErrorReducer from \"./ErrorReducer\";\nimport NotificationReducer from \"./NotificationReducer\";\nimport ProgressIndicatorReducer from \"./ProgressIndicatorReducer\";\nimport PreferencesReducer from \"./PreferencesReducer\";\n\nimport type { Reducer } from \"redux\";\nimport type {\n ReduxAction,\n ProgressIndicatorState,\n PreferencesState,\n NotificationState,\n ModalsState,\n ErrorState,\n AuthState,\n} from \"../types\";\nimport type { RouterState } from \"../_router/types\";\nimport type { ModularUIState } from \"../_modularui/types\";\nimport type { I18nState } from \"../_i18n/types\";\n\ntype Reducers = {\n auth: Reducer<AuthState, ReduxAction>,\n error: Reducer<ErrorState, ReduxAction>,\n i18n: Reducer<I18nState, ReduxAction>,\n modals: Reducer<ModalsState, ReduxAction>,\n modularui: Reducer<ModularUIState, ReduxAction>,\n notification: Reducer<NotificationState, ReduxAction>,\n preferences: Reducer<PreferencesState, ReduxAction>,\n progressindicator: Reducer<ProgressIndicatorState, ReduxAction>,\n router: Reducer<RouterState, ReduxAction>,\n};\n\n/**\n */\nexport const createReducer = (): Reducers => ({\n router: RouterReducer,\n modularui: ModularUIReducer,\n i18n: I18nReducer,\n auth: AuthReducer,\n error: ErrorReducer,\n modals: ModalsReducer,\n notification: NotificationReducer,\n progressindicator: ProgressIndicatorReducer,\n preferences: PreferencesReducer,\n});\n"],"mappings":"AACA,SAASA,aAAa,QAAQ,0BAA0B;AACxD,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,WAAW,QAAQ,sBAAsB;AAElD,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,OAAOC,wBAAwB,MAAM,4BAA4B;AACjE,OAAOC,kBAAkB,MAAM,sBAAsB;AA4BrD;AACA;AACA,OAAO,MAAMC,aAAa,GAAG,OAAiB;EAC5CC,MAAM,EAAEV,aAAa;EACrBW,SAAS,EAAEV,gBAAgB;EAC3BW,IAAI,EAAEV,WAAW;EACjBW,IAAI,EAAET,WAAW;EACjBU,KAAK,EAAET,YAAY;EACnBU,MAAM,EAAEZ,aAAa;EACrBa,YAAY,EAAEV,mBAAmB;EACjCW,iBAAiB,EAAEV,wBAAwB;EAC3CW,WAAW,EAAEV;AACf,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { applyMiddleware, compose, combineReducers, createStore as createReduxStore } from "redux";
|
|
2
2
|
import thunk from "redux-thunk";
|
|
3
|
-
import { routerMiddleware } from "../_router/
|
|
4
|
-
import {
|
|
3
|
+
import { routerMiddleware } from "../_router/RouterMiddleware";
|
|
4
|
+
import { modularUIMiddleware } from "../_modularui/ModularUIMiddleware";
|
|
5
5
|
import { createReducer } from "../reducers/createReducer";
|
|
6
|
-
import { locationChange } from "../_router/
|
|
6
|
+
import { locationChange } from "../_router/RouterActions";
|
|
7
7
|
/**
|
|
8
8
|
*/
|
|
9
9
|
const configureStore = (history, customReducers, initialState) => {
|
|
@@ -15,7 +15,7 @@ const configureStore = (history, customReducers, initialState) => {
|
|
|
15
15
|
...customReducers,
|
|
16
16
|
...createReducer()
|
|
17
17
|
});
|
|
18
|
-
const middleware = applyMiddleware(
|
|
18
|
+
const middleware = applyMiddleware(modularUIMiddleware, routerMiddleware(history), thunk);
|
|
19
19
|
const enhancers = composeEnhancers(middleware);
|
|
20
20
|
const store = createReduxStore(combinedReducers, initialState, enhancers);
|
|
21
21
|
if (!initialState) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configureStore.js","names":["applyMiddleware","compose","combineReducers","createStore","createReduxStore","thunk","routerMiddleware","
|
|
1
|
+
{"version":3,"file":"configureStore.js","names":["applyMiddleware","compose","combineReducers","createStore","createReduxStore","thunk","routerMiddleware","modularUIMiddleware","createReducer","locationChange","configureStore","history","customReducers","initialState","composeEnhancers","process","env","NODE_ENV","window","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","combinedReducers","middleware","enhancers","store","dispatch","location"],"sources":["../../../src/redux/store/configureStore.js"],"sourcesContent":["// @flow\nimport {\n applyMiddleware,\n compose,\n combineReducers,\n createStore as createReduxStore,\n} from \"redux\";\nimport thunk from \"redux-thunk\";\n\nimport { routerMiddleware } from \"../_router/RouterMiddleware\";\nimport { modularUIMiddleware } from \"../_modularui/ModularUIMiddleware\";\n\nimport { createReducer } from \"../reducers/createReducer\";\nimport { locationChange } from \"../_router/RouterActions\";\n\nimport type { RouterHistory } from \"react-router\";\nimport type { ReduxAction, ReduxState, ReduxStore } from \"../types\";\nimport type { Reducer } from \"redux\";\n\n/**\n */\nconst configureStore = (\n history: RouterHistory,\n customReducers?: Object,\n initialState?: $Shape<ReduxState>\n): { history: RouterHistory, store: ReduxStore } => {\n let composeEnhancers = compose;\n\n if (process.env.NODE_ENV !== \"production\" && typeof window !== \"undefined\") {\n composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;\n }\n\n const combinedReducers: Reducer<ReduxState, ReduxAction> = combineReducers({\n ...customReducers,\n ...createReducer(),\n });\n\n const middleware = applyMiddleware(\n modularUIMiddleware,\n routerMiddleware(history),\n thunk\n );\n\n const enhancers = composeEnhancers(middleware);\n\n const store: ReduxStore = createReduxStore(\n combinedReducers,\n initialState,\n enhancers\n );\n\n if (!initialState) {\n store.dispatch(locationChange(history.location, \"PUSH\"));\n }\n return { history, store };\n};\n\nexport default configureStore;\n"],"mappings":"AACA,SACEA,eAAe,EACfC,OAAO,EACPC,eAAe,EACfC,WAAW,IAAIC,gBAAgB,QAC1B,OAAO;AACd,OAAOC,KAAK,MAAM,aAAa;AAE/B,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,mBAAmB,QAAQ,mCAAmC;AAEvE,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,cAAc,QAAQ,0BAA0B;AAMzD;AACA;AACA,MAAMC,cAAc,GAAG,CACrBC,OAAsB,EACtBC,cAAuB,EACvBC,YAAiC,KACiB;EAClD,IAAIC,gBAAgB,GAAGb,OAAO;EAE9B,IAAIc,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IAC1EJ,gBAAgB,GAAGI,MAAM,CAACC,oCAAoC,IAAIlB,OAAO;EAC3E;EAEA,MAAMmB,gBAAkD,GAAGlB,eAAe,CAAC;IACzE,GAAGU,cAAc;IACjB,GAAGJ,aAAa;EAClB,CAAC,CAAC;EAEF,MAAMa,UAAU,GAAGrB,eAAe,CAChCO,mBAAmB,EACnBD,gBAAgB,CAACK,OAAO,CAAC,EACzBN,KAAK,CACN;EAED,MAAMiB,SAAS,GAAGR,gBAAgB,CAACO,UAAU,CAAC;EAE9C,MAAME,KAAiB,GAAGnB,gBAAgB,CACxCgB,gBAAgB,EAChBP,YAAY,EACZS,SAAS,CACV;EAED,IAAI,CAACT,YAAY,EAAE;IACjBU,KAAK,CAACC,QAAQ,CAACf,cAAc,CAACE,OAAO,CAACc,QAAQ,EAAE,MAAM,CAAC,CAAC;EAC1D;EACA,OAAO;IAAEd,OAAO;IAAEY;EAAM,CAAC;AAC3B,CAAC;AAED,eAAeb,cAAc"}
|
|
@@ -63,7 +63,7 @@ const browserFetch = args => {
|
|
|
63
63
|
/**
|
|
64
64
|
* Request data from server, uses server datafetcher or xhr in browser.
|
|
65
65
|
*/
|
|
66
|
-
|
|
66
|
+
const universalFetch = args => {
|
|
67
67
|
// Set locale as Accept-Language header
|
|
68
68
|
if (args.locale) {
|
|
69
69
|
args.headers = {
|
|
@@ -79,5 +79,6 @@ export default function universalFetch(args) {
|
|
|
79
79
|
return serverFetch(args);
|
|
80
80
|
}
|
|
81
81
|
return browserFetch(args);
|
|
82
|
-
}
|
|
82
|
+
};
|
|
83
|
+
export default universalFetch;
|
|
83
84
|
//# sourceMappingURL=universalFetch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universalFetch.js","names":["isPlainObject","IS_SYNC","USE_CACHE","serverFetch","xhr","Cache","IS_FETCHING","waitForCachedItem","cacheKey","TIMEOUT","CHECK_TIMEOUT","resolve","reject","check","getItem","cachedItem","Error","setTimeout","browserFetch","args","cache","createResourceKey","hasItem","cacheItem","addItem","then","response","universalFetch","locale","headers","includeContext","url"],"sources":["../../../src/utils/fetch/universalFetch.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"../helpers/objects\";\n\nimport { IS_SYNC, USE_CACHE } from \"../../constants/Constants\";\nimport serverFetch from \"./serverFetch\";\nimport xhr from \"./xhr\";\nimport Cache from \"../browser/Cache\";\n\nimport type { RequestOptions } from \"./types\";\n\ntype CachedResponse =
|
|
1
|
+
{"version":3,"file":"universalFetch.js","names":["isPlainObject","IS_SYNC","USE_CACHE","serverFetch","xhr","Cache","IS_FETCHING","waitForCachedItem","cacheKey","TIMEOUT","CHECK_TIMEOUT","resolve","reject","check","getItem","cachedItem","Error","setTimeout","browserFetch","args","cache","createResourceKey","hasItem","cacheItem","addItem","then","response","universalFetch","locale","headers","includeContext","url"],"sources":["../../../src/utils/fetch/universalFetch.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"../helpers/objects\";\n\nimport { IS_SYNC, USE_CACHE } from \"../../constants/Constants\";\nimport serverFetch from \"./serverFetch\";\nimport xhr from \"./xhr\";\nimport Cache from \"../browser/Cache\";\n\nimport type { RequestOptions } from \"./types\";\n\ntype CachedResponse = any;\n\nconst IS_FETCHING = \"is-fetching\";\n\n/**\n * Checks each x ms if a cache item is set after fetching the item.\n * @private\n */\nconst waitForCachedItem = (cacheKey: string) => {\n let TIMEOUT = 3000;\n const CHECK_TIMEOUT = 100;\n\n return new Promise<CachedResponse>((resolve, reject) => {\n const check = () => {\n if (Cache.getItem(cacheKey) !== IS_FETCHING) {\n const cachedItem = Cache.getItem(cacheKey);\n if (cachedItem != null) {\n resolve(cachedItem);\n } else {\n reject(new Error(\"Empty cached item\"));\n }\n } else if (TIMEOUT <= 0) {\n reject(new Error(\"Empty cached item\"));\n } else {\n TIMEOUT = TIMEOUT - CHECK_TIMEOUT;\n setTimeout(check, CHECK_TIMEOUT);\n }\n };\n\n setTimeout(check, CHECK_TIMEOUT);\n });\n};\n\n/**\n * @private\n */\nconst browserFetch = (args: RequestOptions) => {\n if (USE_CACHE && args.cache) {\n const cacheKey = Cache.createResourceKey(args);\n\n if (Cache.hasItem(cacheKey)) {\n const cacheItem = Cache.getItem(cacheKey);\n\n if (cacheItem != null) {\n if (cacheItem === IS_FETCHING) {\n return waitForCachedItem(cacheKey);\n } else if (isPlainObject(cacheItem)) {\n return Promise.resolve(cacheItem);\n }\n }\n }\n\n Cache.addItem(cacheKey, IS_FETCHING);\n }\n\n return xhr(args).then((response) => {\n if (USE_CACHE && args.cache) {\n const cacheKey = Cache.createResourceKey(args);\n\n Cache.addItem(cacheKey, response);\n }\n\n return response;\n });\n};\n\n/**\n * Request data from server, uses server datafetcher or xhr in browser.\n */\nconst universalFetch = (\n args: RequestOptions\n): Promise<CachedResponse> | Promise<any> => {\n // Set locale as Accept-Language header\n if (args.locale) {\n args.headers = {\n \"Accept-Language\": args.locale,\n };\n }\n\n if (args.includeContext) {\n args.url = `${args.url}?includeContext=true`;\n }\n\n // server side no access to the browser cache apis, no cache available\n if (IS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
1
|
-
{"version":3,"file":"xhr.js","names":["has","isPlainObject","IllegalArgumentException","UnauthorizedException","FetchException","TimeoutException","NotFoundException","JsonParseException","NetworkException","Cache","HTTP_METHODS","getSetting","NETWORK_ERROR_CODE","SUCCESS_CODE","CLIENT_ERROR_CODE","UNAUTHORIZED_CODE","REDIRECTION_CODE","NOT_FOUND_CODE","JSON_TYPE","XHR","constructor","options","_options","_attempts","xmlhttp","_xmlhttp","attempts","url","params","aUrl","split","data","method","GET","timeout","responseType","onProgress","events","headers","baseHeaders","Accept","timeoutHandler","reject","errorHandler","responseJSON","status","isReload","getResponse","response","getResponseHeader","JSON","parse","error","responseHandler","resolve","setEventListeners","forEach","eventType","addEventListener","eventName","openConnection","open","setBasicAuthentication","hasItem","withCredentials","basicToken","getItem","setRequestHeader","headerName","setCustomHeaders","setOtherOptions","sendData","send","stringData","setXMLHttpRequest","XMLHttpRequest","fetch","err","validateInputArguments","args","toString","xhr"],"sources":["../../../src/utils/fetch/xhr.js"],"sourcesContent":["// @flow\nimport { has, isPlainObject } from \"../helpers/objects\";\n\nimport {\n IllegalArgumentException,\n UnauthorizedException,\n FetchException,\n TimeoutException,\n NotFoundException,\n JsonParseException,\n NetworkException,\n} from \"../../exceptions\";\n\nimport Cache from \"../browser/Cache\";\n\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { RequestOptions } from \"./types\";\n\nconst NETWORK_ERROR_CODE = 0;\nconst SUCCESS_CODE = 200;\nconst CLIENT_ERROR_CODE = 400;\nconst UNAUTHORIZED_CODE = 401;\nconst REDIRECTION_CODE = 300;\nconst NOT_FOUND_CODE = 404;\n\nconst JSON_TYPE = \"application/json\";\n\n/**\n * @private\n */\nclass XHR {\n _options: RequestOptions;\n _xmlhttp: XMLHttpRequest;\n _attempts: number;\n\n /**\n */\n constructor(options: RequestOptions) {\n this._options = options;\n this._attempts = 0;\n }\n\n /**\n */\n get xmlhttp() {\n return this._xmlhttp;\n }\n\n /**\n */\n set xmlhttp(xmlhttp) {\n this._xmlhttp = xmlhttp;\n }\n\n /**\n */\n get options() {\n return this._options;\n }\n\n /**\n */\n set options(options: RequestOptions) {\n this._options = options;\n }\n\n /**\n */\n get attempts() {\n return this._attempts;\n }\n\n /**\n */\n set attempts(attempts) {\n this._attempts = attempts;\n }\n\n /**\n * Create and fix url when params or both querystring and params exist.\n */\n get url() {\n const { url } = this.options;\n if (this.params !== \"\") {\n if (url.includes(\"?\")) {\n const aUrl = url.split(\"?\");\n\n return `${aUrl[0]}?${aUrl[1]}&${this.params}`;\n }\n\n return `${url}?${this.params}`;\n }\n\n return url;\n }\n\n /**\n */\n get params() {\n return this.options.params || \"\";\n }\n\n /**\n */\n get data() {\n return this.options.data || null;\n }\n\n /**\n */\n get method() {\n return this.options.method || HTTP_METHODS.GET;\n }\n\n /**\n */\n get timeout() {\n return this.options.timeout || getSetting(\"XHR_TIMEOUT_MS\", 300000);\n }\n\n /**\n */\n get responseType() {\n return this.options.responseType || \"json\";\n }\n\n /**\n */\n get onProgress(): ProgressEventHandler {\n if (this.options.onProgress) {\n return this.options.onProgress;\n }\n\n return () => {\n // do nothing\n };\n }\n\n /**\n */\n get events() {\n return this.options.events || {};\n }\n\n /**\n */\n get headers() {\n const baseHeaders = {\n Accept: JSON_TYPE,\n \"Content-Type\": JSON_TYPE,\n\n // needed for csrf, see: https://plaza.beinformed.com/amdoc/csrf-protection-in-modular-ui-services-40054554.html\n \"X-Requested-With\": \"XMLHttpRequest\",\n\n \"Accept-Language\": \"en\",\n };\n\n if (this.options.headers) {\n // $FlowFixMe[cannot-spread-indexer]\n return {\n ...baseHeaders,\n ...this.options.headers,\n };\n }\n\n return baseHeaders;\n }\n\n /**\n */\n timeoutHandler(reject) {\n return reject(new TimeoutException(this.url, this.method));\n }\n\n /**\n */\n errorHandler(reject, responseJSON = null) {\n const { status } = this.xmlhttp;\n const { isReload } = this.options;\n\n if (status === NETWORK_ERROR_CODE) {\n return reject(new NetworkException(this.url, this.method));\n }\n\n if (status === NOT_FOUND_CODE) {\n return reject(new NotFoundException(this.url, this.method, isReload));\n }\n\n if (status === UNAUTHORIZED_CODE) {\n return reject(\n new UnauthorizedException(this.url, this.method, responseJSON)\n );\n }\n\n return reject(new FetchException(responseJSON, this.xmlhttp, this.options));\n }\n\n /**\n */\n getResponse() {\n const { responseType, response } = this.xmlhttp;\n\n if (\n (responseType === \"\" || responseType === \"text\") &&\n this.getResponseHeader(\"Content-Type\") === JSON_TYPE\n ) {\n if (isPlainObject(response)) {\n return response;\n }\n\n try {\n return JSON.parse(response);\n } catch (error) {\n throw new JsonParseException(error);\n }\n }\n\n return response;\n }\n\n /**\n */\n responseHandler(resolve, reject) {\n const { status } = this.xmlhttp;\n\n let response = null;\n try {\n response = this.getResponse();\n } catch (error) {\n return reject(error);\n }\n\n if (\n (status >= SUCCESS_CODE && status < REDIRECTION_CODE) ||\n (status === CLIENT_ERROR_CODE && has(response, \"formresponse\"))\n ) {\n return resolve(response);\n }\n\n return this.errorHandler(reject, response);\n }\n\n /**\n */\n setEventListeners(resolve, reject) {\n if (this.options.onProgress) {\n [\"load\", \"loadend\", \"loadstart\", \"progress\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, this.onProgress);\n });\n }\n\n [\"abort\", \"error\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, () => this.errorHandler(reject));\n });\n\n this.xmlhttp.addEventListener(\"timeout\", () => this.timeoutHandler(reject));\n\n this.xmlhttp.addEventListener(\"load\", () =>\n this.responseHandler(resolve, reject)\n );\n\n // Set custom events\n Object.keys(this.events).forEach((eventName) => {\n this.xmlhttp.addEventListener(eventName, this.events[eventName]);\n });\n }\n\n /**\n */\n openConnection() {\n this.xmlhttp.open(this.method, this.url, true);\n }\n\n /**\n */\n setBasicAuthentication() {\n if (Cache.hasItem(\"basic\")) {\n this.xmlhttp.withCredentials = true;\n const basicToken = Cache.getItem(\"basic\");\n\n if (typeof basicToken === \"string\") {\n this.xmlhttp.setRequestHeader(\"Authorization\", `Basic ${basicToken}`);\n }\n }\n }\n\n /**\n */\n getResponseHeader(headerName) {\n return this.xmlhttp.getResponseHeader(headerName);\n }\n\n /**\n */\n setCustomHeaders() {\n Object.keys(this.headers).forEach((headerName) => {\n this.xmlhttp.setRequestHeader(headerName, this.headers[headerName]);\n });\n }\n\n /**\n */\n setOtherOptions() {\n this.xmlhttp.responseType = this.responseType;\n this.xmlhttp.timeout = this.timeout;\n }\n\n /**\n */\n sendData() {\n if (this.data == null) {\n this.xmlhttp.send();\n } else {\n const stringData = isPlainObject(this.data)\n ? JSON.stringify(this.data)\n : this.data;\n this.xmlhttp.send(stringData);\n }\n }\n\n /**\n */\n setXMLHttpRequest() {\n return new Promise((resolve, reject) => {\n this.xmlhttp = new XMLHttpRequest();\n\n this.setEventListeners(resolve, reject);\n\n this.openConnection();\n\n this.setBasicAuthentication();\n\n this.setCustomHeaders();\n\n this.setOtherOptions();\n\n this.sendData();\n });\n }\n\n /**\n */\n async fetch() {\n try {\n return await this.setXMLHttpRequest();\n } catch (err) {\n if (err instanceof NetworkException && this.attempts < 2) {\n this.attempts += 1;\n return this.fetch();\n }\n\n throw err;\n }\n }\n}\n\n/**\n */\nconst validateInputArguments = (args: RequestOptions) => {\n if (args == null) {\n throw new IllegalArgumentException(\n \"Missing request options, expecting an object as argument for xhr\"\n );\n }\n\n if (!isPlainObject(args)) {\n throw new IllegalArgumentException(\n `Expecting an object as argument for xhr, but received: ${args.toString()}`\n );\n }\n\n if (!has(args, \"url\")) {\n throw new IllegalArgumentException(\n `No url property found in arguments of xhr, received: ${JSON.stringify(\n args\n )}`\n );\n }\n\n return true;\n};\n\n/**\n */\nconst xhr = (args: RequestOptions): Promise<any> => {\n validateInputArguments(args);\n\n return new XHR(args).fetch();\n};\n\nexport default xhr;\n"],"mappings":";;;;;AACA,SAASA,GAAG,EAAEC,aAAa,QAAQ,oBAAoB;AAEvD,SACEC,wBAAwB,EACxBC,qBAAqB,EACrB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;AACF;EACE,MAAMK,KAAK,GAAG;IACZ,IAAI;MACF,OAAO,MAAM,IAAI,CAACF,iBAAiB,EAAE;IACvC,CAAC,CAAC,OAAOG,GAAG,EAAE;MACZ,IAAIA,GAAG,YAAYrE,gBAAgB,IAAI,IAAI,CAACkB,QAAQ,GAAG,CAAC,EAAE;QACxD,IAAI,CAACA,QAAQ,IAAI,CAAC;QAClB,OAAO,IAAI,CAACkD,KAAK,EAAE;MACrB;MAEA,MAAMC,GAAG;IACX;EACF;AACF;;AAEA;AACA;AACA,MAAMC,sBAAsB,GAAIC,IAAoB,IAAK;EACvD,IAAIA,IAAI,IAAI,IAAI,EAAE;IAChB,MAAM,IAAI7E,wBAAwB,CAChC,kEAAkE,CACnE;EACH;EAEA,IAAI,CAACD,aAAa,CAAC8E,IAAI,CAAC,EAAE;IACxB,MAAM,IAAI7E,wBAAwB,CAC/B,0DAAyD6E,IAAI,CAACC,QAAQ,EAAG,EAAC,CAC5E;EACH;EAEA,IAAI,CAAChF,GAAG,CAAC+E,IAAI,EAAE,KAAK,CAAC,EAAE;IACrB,MAAM,IAAI7E,wBAAwB,CAC/B,wDAAuD,gBACtD6E,IAAI,CACJ,EAAC,CACJ;EACH;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA,MAAME,GAAG,GAAIF,IAAoB,IAAmB;EAClDD,sBAAsB,CAACC,IAAI,CAAC;EAE5B,OAAO,IAAI5D,GAAG,CAAC4D,IAAI,CAAC,CAACH,KAAK,EAAE;AAC9B,CAAC;AAED,eAAeK,GAAG"}
|
|
1
|
+
{"version":3,"file":"xhr.js","names":["has","isPlainObject","IllegalArgumentException","UnauthorizedException","FetchException","TimeoutException","NotFoundException","JsonParseException","NetworkException","Cache","HTTP_METHODS","getSetting","NETWORK_ERROR_CODE","SUCCESS_CODE","CLIENT_ERROR_CODE","UNAUTHORIZED_CODE","REDIRECTION_CODE","NOT_FOUND_CODE","JSON_TYPE","XHR","constructor","options","_options","_attempts","xmlhttp","_xmlhttp","attempts","url","params","aUrl","split","data","method","GET","timeout","responseType","onProgress","events","headers","baseHeaders","Accept","timeoutHandler","reject","errorHandler","responseJSON","status","isReload","getResponse","response","getResponseHeader","JSON","parse","error","responseHandler","resolve","setEventListeners","forEach","eventType","addEventListener","eventName","openConnection","open","setBasicAuthentication","hasItem","withCredentials","basicToken","getItem","setRequestHeader","headerName","setCustomHeaders","setOtherOptions","sendData","send","stringData","setXMLHttpRequest","XMLHttpRequest","fetch","err","validateInputArguments","args","toString","xhr"],"sources":["../../../src/utils/fetch/xhr.js"],"sourcesContent":["// @flow\nimport { has, isPlainObject } from \"../helpers/objects\";\n\nimport {\n IllegalArgumentException,\n UnauthorizedException,\n FetchException,\n TimeoutException,\n NotFoundException,\n JsonParseException,\n NetworkException,\n} from \"../../exceptions\";\n\nimport Cache from \"../browser/Cache\";\n\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { RequestOptions } from \"./types\";\n\nconst NETWORK_ERROR_CODE = 0;\nconst SUCCESS_CODE = 200;\nconst CLIENT_ERROR_CODE = 400;\nconst UNAUTHORIZED_CODE = 401;\nconst REDIRECTION_CODE = 300;\nconst NOT_FOUND_CODE = 404;\n\nconst JSON_TYPE = \"application/json\";\n\n/**\n * @private\n */\nclass XHR {\n _options: RequestOptions;\n _xmlhttp: XMLHttpRequest;\n _attempts: number;\n\n /**\n */\n constructor(options: RequestOptions) {\n this._options = options;\n this._attempts = 0;\n }\n\n /**\n */\n get xmlhttp(): XMLHttpRequest {\n return this._xmlhttp;\n }\n\n /**\n */\n set xmlhttp(xmlhttp: XMLHttpRequest) {\n this._xmlhttp = xmlhttp;\n }\n\n /**\n */\n get options(): RequestOptions {\n return this._options;\n }\n\n /**\n */\n set options(options: RequestOptions) {\n this._options = options;\n }\n\n /**\n */\n get attempts(): number {\n return this._attempts;\n }\n\n /**\n */\n set attempts(attempts: number) {\n this._attempts = attempts;\n }\n\n /**\n * Create and fix url when params or both querystring and params exist.\n */\n get url(): string {\n const { url } = this.options;\n if (this.params !== \"\") {\n if (url.includes(\"?\")) {\n const aUrl = url.split(\"?\");\n\n return `${aUrl[0]}?${aUrl[1]}&${this.params}`;\n }\n\n return `${url}?${this.params}`;\n }\n\n return url;\n }\n\n /**\n */\n get params(): string {\n return this.options.params || \"\";\n }\n\n /**\n */\n get data(): string | { [key: string]: string } | null {\n return this.options.data || null;\n }\n\n /**\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this.options.method || HTTP_METHODS.GET;\n }\n\n /**\n */\n get timeout(): number {\n return this.options.timeout || getSetting(\"XHR_TIMEOUT_MS\", 300000);\n }\n\n /**\n */\n get responseType(): string {\n return this.options.responseType || \"json\";\n }\n\n /**\n */\n get onProgress(): ProgressEventHandler {\n if (this.options.onProgress) {\n return this.options.onProgress;\n }\n\n return () => {\n // do nothing\n };\n }\n\n /**\n */\n get events(): { [eventName: string]: () => void } {\n return this.options.events || {};\n }\n\n /**\n */\n get headers(): { [string]: string } {\n const baseHeaders = {\n Accept: JSON_TYPE,\n \"Content-Type\": JSON_TYPE,\n\n // needed for csrf, see: https://plaza.beinformed.com/amdoc/csrf-protection-in-modular-ui-services-40054554.html\n \"X-Requested-With\": \"XMLHttpRequest\",\n\n \"Accept-Language\": \"en\",\n };\n\n if (this.options.headers) {\n // $FlowFixMe[cannot-spread-indexer]\n return {\n ...baseHeaders,\n ...this.options.headers,\n };\n }\n\n return baseHeaders;\n }\n\n /**\n */\n timeoutHandler(reject: Function): any {\n return reject(new TimeoutException(this.url, this.method));\n }\n\n /**\n */\n errorHandler(reject: Function, responseJSON: any = null): any {\n const { status } = this.xmlhttp;\n const { isReload } = this.options;\n\n if (status === NETWORK_ERROR_CODE) {\n return reject(new NetworkException(this.url, this.method));\n }\n\n if (status === NOT_FOUND_CODE) {\n return reject(new NotFoundException(this.url, this.method, isReload));\n }\n\n if (status === UNAUTHORIZED_CODE) {\n return reject(\n new UnauthorizedException(this.url, this.method, responseJSON)\n );\n }\n\n return reject(new FetchException(responseJSON, this.xmlhttp, this.options));\n }\n\n /**\n */\n getResponse(): any {\n const { responseType, response } = this.xmlhttp;\n\n if (\n (responseType === \"\" || responseType === \"text\") &&\n this.getResponseHeader(\"Content-Type\") === JSON_TYPE\n ) {\n if (isPlainObject(response)) {\n return response;\n }\n\n try {\n return JSON.parse(response);\n } catch (error) {\n throw new JsonParseException(error);\n }\n }\n\n return response;\n }\n\n /**\n */\n responseHandler(resolve: Function, reject: Function): any {\n const { status } = this.xmlhttp;\n\n let response = null;\n try {\n response = this.getResponse();\n } catch (error) {\n return reject(error);\n }\n\n if (\n (status >= SUCCESS_CODE && status < REDIRECTION_CODE) ||\n (status === CLIENT_ERROR_CODE && has(response, \"formresponse\"))\n ) {\n return resolve(response);\n }\n\n return this.errorHandler(reject, response);\n }\n\n /**\n */\n setEventListeners(resolve: Function, reject: Function) {\n if (this.options.onProgress) {\n [\"load\", \"loadend\", \"loadstart\", \"progress\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, this.onProgress);\n });\n }\n\n [\"abort\", \"error\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, () => this.errorHandler(reject));\n });\n\n this.xmlhttp.addEventListener(\"timeout\", () => this.timeoutHandler(reject));\n\n this.xmlhttp.addEventListener(\"load\", () =>\n this.responseHandler(resolve, reject)\n );\n\n // Set custom events\n Object.keys(this.events).forEach((eventName) => {\n this.xmlhttp.addEventListener(eventName, this.events[eventName]);\n });\n }\n\n /**\n */\n openConnection() {\n this.xmlhttp.open(this.method, this.url, true);\n }\n\n /**\n */\n setBasicAuthentication() {\n if (Cache.hasItem(\"basic\")) {\n this.xmlhttp.withCredentials = true;\n const basicToken = Cache.getItem(\"basic\");\n\n if (typeof basicToken === \"string\") {\n this.xmlhttp.setRequestHeader(\"Authorization\", `Basic ${basicToken}`);\n }\n }\n }\n\n /**\n */\n getResponseHeader(headerName: string): string | null {\n return this.xmlhttp.getResponseHeader(headerName);\n }\n\n /**\n */\n setCustomHeaders() {\n Object.keys(this.headers).forEach((headerName) => {\n this.xmlhttp.setRequestHeader(headerName, this.headers[headerName]);\n });\n }\n\n /**\n */\n setOtherOptions() {\n this.xmlhttp.responseType = this.responseType;\n this.xmlhttp.timeout = this.timeout;\n }\n\n /**\n */\n sendData() {\n if (this.data == null) {\n this.xmlhttp.send();\n } else {\n const stringData = isPlainObject(this.data)\n ? JSON.stringify(this.data)\n : this.data;\n this.xmlhttp.send(stringData);\n }\n }\n\n /**\n */\n setXMLHttpRequest(): Promise<any> {\n return new Promise((resolve, reject) => {\n this.xmlhttp = new XMLHttpRequest();\n\n this.setEventListeners(resolve, reject);\n\n this.openConnection();\n\n this.setBasicAuthentication();\n\n this.setCustomHeaders();\n\n this.setOtherOptions();\n\n this.sendData();\n });\n }\n\n /**\n */\n async fetch(): Promise<any> {\n try {\n return await this.setXMLHttpRequest();\n } catch (err) {\n if (err instanceof NetworkException && this.attempts < 2) {\n this.attempts += 1;\n return this.fetch();\n }\n\n throw err;\n }\n }\n}\n\n/**\n */\nconst validateInputArguments = (args: RequestOptions) => {\n if (args == null) {\n throw new IllegalArgumentException(\n \"Missing request options, expecting an object as argument for xhr\"\n );\n }\n\n if (!isPlainObject(args)) {\n throw new IllegalArgumentException(\n `Expecting an object as argument for xhr, but received: ${args.toString()}`\n );\n }\n\n if (!has(args, \"url\")) {\n throw new IllegalArgumentException(\n `No url property found in arguments of xhr, received: ${JSON.stringify(\n args\n )}`\n );\n }\n\n return true;\n};\n\n/**\n */\nconst xhr = (args: RequestOptions): Promise<any> => {\n validateInputArguments(args);\n\n return new XHR(args).fetch();\n};\n\nexport default xhr;\n"],"mappings":";;;;;AACA,SAASA,GAAG,EAAEC,aAAa,QAAQ,oBAAoB;AAEvD,SACEC,wBAAwB,EACxBC,qBAAqB,EACrBC,cAAc,EACdC,gBAAgB,EAChBC,iBAAiB,EACjBC,kBAAkB,EAClBC,gBAAgB,QACX,kBAAkB;AAEzB,OAAOC,KAA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ACF,iBAAiB,EAAE;IACvC,CAAC,CAAC,OAAOG,GAAG,EAAE;MACZ,IAAIA,GAAG,YAAYrE,gBAAgB,IAAI,IAAI,CAACkB,QAAQ,GAAG,CAAC,EAAE;QACxD,IAAI,CAACA,QAAQ,IAAI,CAAC;QAClB,OAAO,IAAI,CAACkD,KAAK,EAAE;MACrB;MAEA,MAAMC,GAAG;IACX;EACF;AACF;;AAEA;AACA;AACA,MAAMC,sBAAsB,GAAIC,IAAoB,IAAK;EACvD,IAAIA,IAAI,IAAI,IAAI,EAAE;IAChB,MAAM,IAAI7E,wBAAwB,CAChC,kEAAkE,CACnE;EACH;EAEA,IAAI,CAACD,aAAa,CAAC8E,IAAI,CAAC,EAAE;IACxB,MAAM,IAAI7E,wBAAwB,CAC/B,0DAAyD6E,IAAI,CAACC,QAAQ,EAAG,EAAC,CAC5E;EACH;EAEA,IAAI,CAAChF,GAAG,CAAC+E,IAAI,EAAE,KAAK,CAAC,EAAE;IACrB,MAAM,IAAI7E,wBAAwB,CAC/B,wDAAuD,gBACtD6E,IAAI,CACJ,EAAC,CACJ;EACH;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA,MAAME,GAAG,GAAIF,IAAoB,IAAmB;EAClDD,sBAAsB,CAACC,IAAI,CAAC;EAE5B,OAAO,IAAI5D,GAAG,CAAC4D,IAAI,CAAC,CAACH,KAAK,EAAE;AAC9B,CAAC;AAED,eAAeK,GAAG"}
|
|
@@ -3,11 +3,11 @@ import _isPlainObject from "lodash/isPlainObject";
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
const isPlainObject = value => _isPlainObject(value);
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
const has = (obj, propName) => {
|
|
11
11
|
if (!isPlainObject(obj)) {
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
@@ -18,10 +18,11 @@ export const has = (obj, propName) => {
|
|
|
18
18
|
* Retrieve property of an object
|
|
19
19
|
* When path is only one deep better use optional chaining
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
const get = (obj, path, defaultValue) => String(path).split(".").reduce((acc, v) => {
|
|
22
22
|
if (typeof acc === "object") {
|
|
23
23
|
return acc[v] ?? defaultValue;
|
|
24
24
|
}
|
|
25
25
|
return defaultValue;
|
|
26
26
|
}, obj);
|
|
27
|
+
export { get, has, isPlainObject };
|
|
27
28
|
//# sourceMappingURL=objects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objects.js","names":["_has","_isPlainObject","isPlainObject","value","has","obj","propName","get","path","defaultValue","String","split","reduce","acc","v"],"sources":["../../../src/utils/helpers/objects.js"],"sourcesContent":["// @flow\nimport _has from \"lodash/has\";\nimport _isPlainObject from \"lodash/isPlainObject\";\n\n/**\n */\
|
|
1
|
+
{"version":3,"file":"objects.js","names":["_has","_isPlainObject","isPlainObject","value","has","obj","propName","get","path","defaultValue","String","split","reduce","acc","v"],"sources":["../../../src/utils/helpers/objects.js"],"sourcesContent":["// @flow\nimport _has from \"lodash/has\";\nimport _isPlainObject from \"lodash/isPlainObject\";\n\n/**\n */\nconst isPlainObject = (value: any): boolean => _isPlainObject(value);\n\n/**\n */\nconst has = (obj: any, propName: string): boolean => {\n if (!isPlainObject(obj)) {\n return false;\n }\n\n return _has(obj, propName);\n};\n\n/**\n * Retrieve property of an object\n * When path is only one deep better use optional chaining\n */\nconst get = (obj: Object, path: string, defaultValue?: any): any =>\n String(path)\n .split(\".\")\n .reduce((acc, v) => {\n if (typeof acc === \"object\") {\n return acc[v] ?? defaultValue;\n }\n return defaultValue;\n }, obj);\n\nexport { get, has, isPlainObject };\n"],"mappings":"AACA,OAAOA,IAAI,MAAM,YAAY;AAC7B,OAAOC,cAAc,MAAM,sBAAsB;;AAEjD;AACA;AACA,MAAMC,aAAa,GAAIC,KAAU,IAAcF,cAAc,CAACE,KAAK,CAAC;;AAEpE;AACA;AACA,MAAMC,GAAG,GAAG,CAACC,GAAQ,EAAEC,QAAgB,KAAc;EACnD,IAAI,CAACJ,aAAa,CAACG,GAAG,CAAC,EAAE;IACvB,OAAO,KAAK;EACd;EAEA,OAAOL,IAAI,CAACK,GAAG,EAAEC,QAAQ,CAAC;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,GAAG,GAAG,CAACF,GAAW,EAAEG,IAAY,EAAEC,YAAkB,KACxDC,MAAM,CAACF,IAAI,CAAC,CACTG,KAAK,CAAC,GAAG,CAAC,CACVC,MAAM,CAAC,CAACC,GAAG,EAAEC,CAAC,KAAK;EAClB,IAAI,OAAOD,GAAG,KAAK,QAAQ,EAAE;IAC3B,OAAOA,GAAG,CAACC,CAAC,CAAC,IAAIL,YAAY;EAC/B;EACA,OAAOA,YAAY;AACrB,CAAC,EAAEJ,GAAG,CAAC;AAEX,SAASE,GAAG,EAAEH,GAAG,EAAEF,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeHtml.js","names":["he","IllegalArgumentException","properEntityEncoding","html","escapedGt","replace","escapedLt","properEntities","encode","decode","decimal","unescapedGt","removeUnwantedHtml","options","allowedTags","correctEntityHtml","htmlWithoutAttributes","htmlWithCorrectBR","Array","isArray","join","pattern","regex","RegExp"],"sources":["../../../src/utils/helpers/sanitizeHtml.js"],"sourcesContent":["// @flow\nimport he from \"he\";\n\nimport { IllegalArgumentException } from \"../../exceptions\";\n\ntype removeUnwantedHtmlOptions = {\n allowedTags?: Array<string>,\n};\n\n/**\n * Translates html entities to their correct decimal equivalent\n * When path is only one deep better use optional chaining\n */\nconst properEntityEncoding = (html) => {\n const escapedGt = html.replace(/</g, \"[\");\n const escapedLt = escapedGt.replace(/>/g, \"]\");\n\n const properEntities = he.encode(he.decode(escapedLt), {\n decimal: true,\n });\n\n const unescapedGt = properEntities.replace(/\\[/g, \"<\");\n\n return unescapedGt.replace(/]/g, \">\");\n};\n\n/**\n * removes unwanted html, this might result in incorrect html, as it removes all html that we don't except,\n * like <b style=\"font-weight: 400\">bold</b> will result in bold</b>\n */\nconst removeUnwantedHtml = (\n html: string,\n options: removeUnwantedHtmlOptions = {\n allowedTags: [\"p\", \"br\", \"b\", \"i\", \"u\", \"strike\"],\n }\n): string => {\n if (typeof html !== \"string\") {\n throw new IllegalArgumentException(\"sanitizeHTML method expects a string\");\n }\n\n const correctEntityHtml = properEntityEncoding(html);\n\n // remove attributes from html elements\n const htmlWithoutAttributes = correctEntityHtml.replace(\n /<(\\w+)(.|[\\r\\n])*?>/gi,\n \"<$1>\"\n );\n\n const htmlWithCorrectBR = htmlWithoutAttributes.replace(\n /<br\\s*>/gi,\n \"<br />\"\n );\n\n // remove not allowed tags\n const allowedTags = Array.isArray(options.allowedTags)\n ? options.allowedTags.join(\"|\")\n : \"\";\n const pattern = `<(?!\\\\/?(${allowedTags})(>|\\\\s\\\\/))[^<]+?>`;\n const regex = new RegExp(pattern, \"gi\");\n\n return htmlWithCorrectBR.replace(regex, \"\");\n};\n\nexport { removeUnwantedHtml };\n"],"mappings":"AACA,OAAOA,EAAE,MAAM,IAAI;AAEnB,SAASC,wBAAwB,QAAQ,kBAAkB;AAM3D;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAIC,
|
|
1
|
+
{"version":3,"file":"sanitizeHtml.js","names":["he","IllegalArgumentException","properEntityEncoding","html","escapedGt","replace","escapedLt","properEntities","encode","decode","decimal","unescapedGt","removeUnwantedHtml","options","allowedTags","correctEntityHtml","htmlWithoutAttributes","htmlWithCorrectBR","Array","isArray","join","pattern","regex","RegExp"],"sources":["../../../src/utils/helpers/sanitizeHtml.js"],"sourcesContent":["// @flow\nimport he from \"he\";\n\nimport { IllegalArgumentException } from \"../../exceptions\";\n\ntype removeUnwantedHtmlOptions = {\n allowedTags?: Array<string>,\n};\n\n/**\n * Translates html entities to their correct decimal equivalent\n * When path is only one deep better use optional chaining\n */\nconst properEntityEncoding = (html: string) => {\n const escapedGt = html.replace(/</g, \"[\");\n const escapedLt = escapedGt.replace(/>/g, \"]\");\n\n const properEntities = he.encode(he.decode(escapedLt), {\n decimal: true,\n });\n\n const unescapedGt = properEntities.replace(/\\[/g, \"<\");\n\n return unescapedGt.replace(/]/g, \">\");\n};\n\n/**\n * removes unwanted html, this might result in incorrect html, as it removes all html that we don't except,\n * like <b style=\"font-weight: 400\">bold</b> will result in bold</b>\n */\nconst removeUnwantedHtml = (\n html: string,\n options: removeUnwantedHtmlOptions = {\n allowedTags: [\"p\", \"br\", \"b\", \"i\", \"u\", \"strike\"],\n }\n): string => {\n if (typeof html !== \"string\") {\n throw new IllegalArgumentException(\"sanitizeHTML method expects a string\");\n }\n\n const correctEntityHtml = properEntityEncoding(html);\n\n // remove attributes from html elements\n const htmlWithoutAttributes = correctEntityHtml.replace(\n /<(\\w+)(.|[\\r\\n])*?>/gi,\n \"<$1>\"\n );\n\n const htmlWithCorrectBR = htmlWithoutAttributes.replace(\n /<br\\s*>/gi,\n \"<br />\"\n );\n\n // remove not allowed tags\n const allowedTags = Array.isArray(options.allowedTags)\n ? options.allowedTags.join(\"|\")\n : \"\";\n const pattern = `<(?!\\\\/?(${allowedTags})(>|\\\\s\\\\/))[^<]+?>`;\n const regex = new RegExp(pattern, \"gi\");\n\n return htmlWithCorrectBR.replace(regex, \"\");\n};\n\nexport { removeUnwantedHtml };\n"],"mappings":"AACA,OAAOA,EAAE,MAAM,IAAI;AAEnB,SAASC,wBAAwB,QAAQ,kBAAkB;AAM3D;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAIC,IAAY,IAAK;EAC7C,MAAMC,SAAS,GAAGD,IAAI,CAACE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;EACzC,MAAMC,SAAS,GAAGF,SAAS,CAACC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;EAE9C,MAAME,cAAc,GAAGP,EAAE,CAACQ,MAAM,CAACR,EAAE,CAACS,MAAM,CAACH,SAAS,CAAC,EAAE;IACrDI,OAAO,EAAE;EACX,CAAC,CAAC;EAEF,MAAMC,WAAW,GAAGJ,cAAc,CAACF,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;EAEtD,OAAOM,WAAW,CAACN,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;AACvC,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMO,kBAAkB,GAAG,UACzBT,IAAY,EAID;EAAA,IAHXU,OAAkC,uEAAG;IACnCC,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ;EAClD,CAAC;EAED,IAAI,OAAOX,IAAI,KAAK,QAAQ,EAAE;IAC5B,MAAM,IAAIF,wBAAwB,CAAC,sCAAsC,CAAC;EAC5E;EAEA,MAAMc,iBAAiB,GAAGb,oBAAoB,CAACC,IAAI,CAAC;;EAEpD;EACA,MAAMa,qBAAqB,GAAGD,iBAAiB,CAACV,OAAO,CACrD,uBAAuB,EACvB,MAAM,CACP;EAED,MAAMY,iBAAiB,GAAGD,qBAAqB,CAACX,OAAO,CACrD,WAAW,EACX,QAAQ,CACT;;EAED;EACA,MAAMS,WAAW,GAAGI,KAAK,CAACC,OAAO,CAACN,OAAO,CAACC,WAAW,CAAC,GAClDD,OAAO,CAACC,WAAW,CAACM,IAAI,CAAC,GAAG,CAAC,GAC7B,EAAE;EACN,MAAMC,OAAO,GAAI,YAAWP,WAAY,qBAAoB;EAC5D,MAAMQ,KAAK,GAAG,IAAIC,MAAM,CAACF,OAAO,EAAE,IAAI,CAAC;EAEvC,OAAOJ,iBAAiB,CAACZ,OAAO,CAACiB,KAAK,EAAE,EAAE,CAAC;AAC7C,CAAC;AAED,SAASV,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseNumbers.js","names":["big","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
|
|
1
|
+
{"version":3,"file":"parseNumbers.js","names":["big","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 = (\n input: string | number,\n groupingSeparator?: ?string\n) => {\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 = (\n input: string | number,\n decimalSeparator?: ?string\n) => {\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,OAAOA,GAAG,MAAM,QAAQ;;AAExB;AACA;AACA;AACA,MAAMC,uBAAuB,GAAG,CAC9BC,KAAsB,EACtBC,iBAA2B,KACxB;EACH,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,IAAIC,iBAAiB,IAAI,IAAI,EAAE;IAC7B,OAAOD,KAAK;EACd;EAEA,MAAME,wBAAwB,GAAGD,iBAAiB,CAACE,OAAO,CACxD,qBAAqB,EACrB,MAAM,CACP;EAED,OAAOH,KAAK,CAACG,OAAO,CAAC,IAAIC,MAAM,CAACF,wBAAwB,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;AACrE,CAAC;;AAED;AACA;AACA;AACA,MAAMG,sBAAsB,GAAG,CAC7BL,KAAsB,EACtBM,gBAA0B,KACvB;EACH,IAAI,OAAON,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,IAAIM,gBAAgB,IAAI,IAAI,IAAIA,gBAAgB,KAAK,EAAE,EAAE;IACvD,OAAON,KAAK;EACd;EAEA,OAAOA,KAAK,CAACG,OAAO,CAACG,gBAAgB,EAAE,GAAG,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,UACpBP,KAAwB,EAGb;EAAA,IAFXC,iBAA0B,uEAAG,GAAG;EAAA,IAChCK,gBAAyB,uEAAG,GAAG;EAE/B,IAAIN,KAAK,IAAI,IAAI,IAAIA,KAAK,KAAK,EAAE,EAAE;IACjC,OAAOQ,GAAG;EACZ;EAEA,MAAMC,eAAe,GAAGV,uBAAuB,CAACC,KAAK,EAAEC,iBAAiB,CAAC;EAEzE,MAAMS,4BAA4B,GAAGL,sBAAsB,CACzDI,eAAe,EACfH,gBAAgB,CACjB;EAED,OAAOK,MAAM,CAACD,4BAA4B,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA,MAAME,mBAAmB,GAAG,UAC1BZ,KAAwB,EAGb;EAAA,IAFXC,iBAA0B,uEAAG,GAAG;EAAA,IAChCK,gBAAyB,uEAAG,GAAG;EAE/B,IAAIN,KAAK,IAAI,IAAI,IAAIA,KAAK,KAAK,EAAE,EAAE;IACjC,OAAO,KAAK;EACd;EAEA,MAAMS,eAAe,GAAGV,uBAAuB,CAACC,KAAK,EAAEC,iBAAiB,CAAC;EAEzE,MAAMS,4BAA4B,GAAGL,sBAAsB,CACzDI,eAAe,EACfH,gBAAgB,CACjB;EAED,IAAI;IACF,OAAOR,GAAG,CAACY,4BAA4B,CAAC,CAACG,OAAO,EAAE;EACpD,CAAC,CAAC,OAAOC,KAAK,EAAE;IACd,OAAO,KAAK;EACd;AACF,CAAC;AAED,SAASP,aAAa,EAAEK,mBAAmB"}
|
|
@@ -5,7 +5,7 @@ const path = require("path");
|
|
|
5
5
|
|
|
6
6
|
const { LayoutHintConfiguration } = require("../constants/LayoutHintConfig");
|
|
7
7
|
|
|
8
|
-
const readFiles = (files) => {
|
|
8
|
+
const readFiles = (files: Array<string>) => {
|
|
9
9
|
const filePromises = files.map(
|
|
10
10
|
(file) =>
|
|
11
11
|
new Promise((resolve, reject) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeLayoutHintConfigurations.js","names":["glob","require","fs","path","LayoutHintConfiguration","readFiles","files","filePromises","file","resolve","reject","readFile","err","data","JSON","parse","all","exports","mergeLayoutHintConfigurations","srcFolder","outputFolder","escapedSrcFolder","replace","then","jsons","newConfig","writeFile","join","writeErr"],"sources":["../../src/builder/mergeLayoutHintConfigurations.js"],"sourcesContent":["// @flow\nconst glob = require(\"glob\");\nconst fs = require(\"fs\");\nconst path = require(\"path\");\n\nconst { LayoutHintConfiguration } = require(\"../constants/LayoutHintConfig\");\n\nconst readFiles = (files) => {\n const filePromises = files.map(\n (file) =>\n new Promise((resolve, reject) => {\n fs.readFile(file, \"utf-8\", (err, data) => {\n if (err) {\n return reject(err);\n } else {\n return resolve(JSON.parse(data));\n }\n });\n })\n );\n\n return Promise.all(filePromises);\n};\n\n/**\n * Merge all LayoutHintConfig.json files from this library and in the srcFolder\n * together into one config file, and copies it to the outputFolder.<br/>\n * This file is consumed by Be Informed studio to give layout hint information\n */\nexports.mergeLayoutHintConfigurations = async (\n srcFolder: string,\n outputFolder: string\n): Promise<void> => {\n const escapedSrcFolder = srcFolder.replace(/\\\\/g, \"/\");\n return new Promise((resolve, reject) => {\n glob(escapedSrcFolder + \"/**/LayoutHintConfig.json\", {}, (err, files) => {\n if (err) {\n return reject(err);\n }\n\n readFiles(files).then((jsons) => {\n const newConfig = Object.assign(LayoutHintConfiguration, ...jsons);\n fs.writeFile(\n path.join(outputFolder, \"LayoutHintConfig.json\"),\n JSON.stringify(newConfig),\n\n (writeErr) => {\n if (writeErr) {\n return reject(writeErr);\n }\n\n return resolve();\n }\n );\n });\n });\n });\n};\n"],"mappings":";;;;;;;AACA,MAAMA,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC;AAC5B,MAAMC,EAAE,GAAGD,OAAO,CAAC,IAAI,CAAC;AACxB,MAAME,IAAI,GAAGF,OAAO,CAAC,MAAM,CAAC;AAE5B,MAAM;EAAEG;AAAwB,CAAC,GAAGH,OAAO,CAAC,+BAA+B,CAAC;AAE5E,MAAMI,SAAS,GAAIC,
|
|
1
|
+
{"version":3,"file":"mergeLayoutHintConfigurations.js","names":["glob","require","fs","path","LayoutHintConfiguration","readFiles","files","filePromises","file","resolve","reject","readFile","err","data","JSON","parse","all","exports","mergeLayoutHintConfigurations","srcFolder","outputFolder","escapedSrcFolder","replace","then","jsons","newConfig","writeFile","join","writeErr"],"sources":["../../src/builder/mergeLayoutHintConfigurations.js"],"sourcesContent":["// @flow\nconst glob = require(\"glob\");\nconst fs = require(\"fs\");\nconst path = require(\"path\");\n\nconst { LayoutHintConfiguration } = require(\"../constants/LayoutHintConfig\");\n\nconst readFiles = (files: Array<string>) => {\n const filePromises = files.map(\n (file) =>\n new Promise((resolve, reject) => {\n fs.readFile(file, \"utf-8\", (err, data) => {\n if (err) {\n return reject(err);\n } else {\n return resolve(JSON.parse(data));\n }\n });\n })\n );\n\n return Promise.all(filePromises);\n};\n\n/**\n * Merge all LayoutHintConfig.json files from this library and in the srcFolder\n * together into one config file, and copies it to the outputFolder.<br/>\n * This file is consumed by Be Informed studio to give layout hint information\n */\nexports.mergeLayoutHintConfigurations = async (\n srcFolder: string,\n outputFolder: string\n): Promise<void> => {\n const escapedSrcFolder = srcFolder.replace(/\\\\/g, \"/\");\n return new Promise((resolve, reject) => {\n glob(escapedSrcFolder + \"/**/LayoutHintConfig.json\", {}, (err, files) => {\n if (err) {\n return reject(err);\n }\n\n readFiles(files).then((jsons) => {\n const newConfig = Object.assign(LayoutHintConfiguration, ...jsons);\n fs.writeFile(\n path.join(outputFolder, \"LayoutHintConfig.json\"),\n JSON.stringify(newConfig),\n\n (writeErr) => {\n if (writeErr) {\n return reject(writeErr);\n }\n\n return resolve();\n }\n );\n });\n });\n });\n};\n"],"mappings":";;;;;;;AACA,MAAMA,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC;AAC5B,MAAMC,EAAE,GAAGD,OAAO,CAAC,IAAI,CAAC;AACxB,MAAME,IAAI,GAAGF,OAAO,CAAC,MAAM,CAAC;AAE5B,MAAM;EAAEG;AAAwB,CAAC,GAAGH,OAAO,CAAC,+BAA+B,CAAC;AAE5E,MAAMI,SAAS,GAAIC,KAAoB,IAAK;EAC1C,MAAMC,YAAY,GAAG,kBAAAD,KAAK,OAALA,KAAK,EACvBE,IAAI,IACH,qBAAY,CAACC,OAAO,EAAEC,MAAM,KAA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aultSettings","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","settings","setSettings","config","isPlainObject","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","loginType","LOGIN_TYPE","loginPath","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst defaultSettings = {\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n */\nexport const loginType = (): string => getSetting(LOGIN_TYPE, \"JAAS\");\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/j_security_check\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/Logoff\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n"],"mappings":";;;;;;;;AACA;AACA;AAWA,MAAMA,
|
|
1
|
+
{"version":3,"file":"Settings.js","names":["defaultSettings","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","settings","setSettings","config","isPlainObject","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","loginType","LOGIN_TYPE","loginPath","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n */\nexport const loginType = (): string => getSetting(LOGIN_TYPE, \"JAAS\");\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/j_security_check\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/Logoff\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n"],"mappings":";;;;;;;;AACA;AACA;AAWA,MAAMA,eAA4C,GAAG;EACnD;EACAC,4BAA4B,EAAE,IAAI;EAElC;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,kBAAkB,EAAE,KAAK;EAEzB;EACAC,sBAAsB,EAAE,IAAI;EAE5B;EACAC,qCAAqC,EAAE,IAAI;EAE3C;EACAC,oCAAoC,EAAE,KAAK;EAE3C;EACAC,oBAAoB,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;EAE/C;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,6BAA6B,EAAE,IAAI;EAEnC;EACAC,eAAe,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;EAE7B;EACAC,wBAAwB,EAAE,KAAK;EAE/B;EACAC,yBAAyB,EAAE,KAAK;EAEhC;EACAC,wCAAwC,EAAE,KAAK;EAE/C;EACAC,UAAU,EAAE,SAAS;EAErB;EACAC,wBAA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,MAAMC,WAAW,GAAG,MAAmCZ,QAAQ;;AAEtE;AACA;AADA;AAEO,MAAMa,mBAAmB,GAAG,MACjCT,UAAU,CAACU,sCAA2B,EAAE,IAAI,CAAC;;AAE/C;AACA;AACA;AAFA;AAGO,MAAMC,SAAS,GAAG,MAAcX,UAAU,CAACY,qBAAU,EAAE,MAAM,CAAC;;AAErE;AACA;AADA;AAEO,MAAMC,SAAS,GAAG,MACvBb,UAAU,CAACc,6BAAkB,EAAE,mBAAmB,CAAC;AACrD;AACA;AADA;AAEO,MAAMC,kBAAkB,GAAG,MAChCf,UAAU,CAACgB,iCAAsB,EAAE,YAAY,CAAC;AAClD;AACA;AADA;AAEO,MAAMC,kBAAkB,GAAG,MAChCjB,UAAU,CAACkB,iCAAsB,EAAE,YAAY,CAAC;AAClD;AACA;AADA;AAEO,MAAMC,UAAU,GAAG,MACxBnB,UAAU,CAACoB,8BAAmB,EAAE,SAAS,CAAC;AAAC;AAEtC,MAAM1C,UAAkB,GAAGmC,SAAS,EAAE;AAAC;AACvC,MAAMjC,WAAmB,GAAGuC,UAAU,EAAE;AAAC"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useLogout = exports.useLogin = void 0;
|
|
8
8
|
var _reactRedux = require("react-redux");
|
|
9
|
-
var
|
|
9
|
+
var _ModularUISelectors = require("../redux/_modularui/ModularUISelectors");
|
|
10
10
|
var _actions = require("../redux/actions");
|
|
11
11
|
var _Cache = _interopRequireDefault(require("../utils/browser/Cache"));
|
|
12
12
|
var _constants = require("../constants");
|
|
@@ -16,7 +16,7 @@ var _exceptions = require("../exceptions");
|
|
|
16
16
|
const useLogin = () => {
|
|
17
17
|
_Cache.default.setItem("isRedirectLogin", false);
|
|
18
18
|
const dispatch = (0, _reactRedux.useDispatch)();
|
|
19
|
-
const application = (0, _reactRedux.useSelector)(
|
|
19
|
+
const application = (0, _reactRedux.useSelector)(_ModularUISelectors.getApplication);
|
|
20
20
|
const auth = (0, _reactRedux.useSelector)(state => state.auth);
|
|
21
21
|
const isAuthenticated = application?.isLoggedIn ?? false;
|
|
22
22
|
return {
|
|
@@ -43,7 +43,7 @@ const useLogin = () => {
|
|
|
43
43
|
exports.useLogin = useLogin;
|
|
44
44
|
const useLogout = () => {
|
|
45
45
|
const dispatch = (0, _reactRedux.useDispatch)();
|
|
46
|
-
const application = (0, _reactRedux.useSelector)(
|
|
46
|
+
const application = (0, _reactRedux.useSelector)(_ModularUISelectors.getApplication);
|
|
47
47
|
const LOGOUT_PATH = (0, _constants.getSetting)("LOGOUT_PATH", "/signout");
|
|
48
48
|
const isAuthenticated = application?.isLoggedIn ?? false;
|
|
49
49
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import { useSelector, useDispatch } from "react-redux";
|
|
3
3
|
|
|
4
|
-
import { getApplication } from "../redux/_modularui/
|
|
4
|
+
import { getApplication } from "../redux/_modularui/ModularUISelectors";
|
|
5
5
|
import { login, logout, resetAuthErrors } from "../redux/actions";
|
|
6
6
|
|
|
7
7
|
import Cache from "../utils/browser/Cache";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthentication.js","names":["useLogin","Cache","setItem","dispatch","useDispatch","application","useSelector","getApplication","auth","state","isAuthenticated","isLoggedIn","authenticationTypes","errorMessage","error","resetErrors","resetAuthErrors","login","username","password","redirectLogin","authenticationType","getItem","IllegalStateException","authentication","redirectUri","window","location","assign","BASE","useLogout","LOGOUT_PATH","getSetting","logout","origin","url"],"sources":["../../src/hooks/useAuthentication.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\n\nimport { getApplication } from \"../redux/_modularui/
|
|
1
|
+
{"version":3,"file":"useAuthentication.js","names":["useLogin","Cache","setItem","dispatch","useDispatch","application","useSelector","getApplication","auth","state","isAuthenticated","isLoggedIn","authenticationTypes","errorMessage","error","resetErrors","resetAuthErrors","login","username","password","redirectLogin","authenticationType","getItem","IllegalStateException","authentication","redirectUri","window","location","assign","BASE","useLogout","LOGOUT_PATH","getSetting","logout","origin","url"],"sources":["../../src/hooks/useAuthentication.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\n\nimport { getApplication } from \"../redux/_modularui/ModularUISelectors\";\nimport { login, logout, resetAuthErrors } from \"../redux/actions\";\n\nimport Cache from \"../utils/browser/Cache\";\nimport { BASE, getSetting } from \"../constants\";\n\nimport type { ResetAuthErrorsAction } from \"../redux/types\";\nimport type { AuthenticationType } from \"../models/types\";\nimport { IllegalStateException } from \"../exceptions\";\ntype LoginHook = {\n isAuthenticated: boolean,\n authenticationTypes: Array<AuthenticationType>,\n errorMessage: ?string,\n resetErrors: () => ResetAuthErrorsAction,\n login: (username: string, password: string) => void,\n redirectLogin: (authenticationType: AuthenticationType) => void,\n};\ntype LogoutHook = {\n isAuthenticated: boolean,\n authenticationTypes: Array<AuthenticationType>,\n logout: () => void,\n};\n\n/**\n */\nexport const useLogin = (): LoginHook => {\n Cache.setItem(\"isRedirectLogin\", false);\n\n const dispatch = useDispatch();\n\n const application = useSelector(getApplication);\n const auth = useSelector((state) => state.auth);\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [],\n errorMessage: auth.error,\n resetErrors: () => dispatch(resetAuthErrors()),\n login: (username: string, password: string) =>\n dispatch(login(username, password)),\n redirectLogin: (authenticationType: AuthenticationType) => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n // prevent endless loop in redirects when authentication type can't be redirected\n throw new IllegalStateException(\n `Could not redirect to '${authenticationType.authentication}' using url: '${authenticationType.redirectUri}'`\n );\n }\n\n if (!isAuthenticated) {\n Cache.setItem(\"isRedirectLogin\", true);\n window.location.assign(`${BASE}${authenticationType.redirectUri}`);\n }\n },\n };\n};\n\n/**\n */\nexport const useLogout = (): LogoutHook => {\n const dispatch = useDispatch();\n const application = useSelector(getApplication);\n\n const LOGOUT_PATH = getSetting(\"LOGOUT_PATH\", \"/signout\");\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [],\n logout: () => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n const origin = window.location.origin;\n const url = `${origin}${BASE}/logout?url=${origin}${BASE}${LOGOUT_PATH}`;\n Cache.setItem(\"isRedirectLogin\", false);\n window.location.assign(url);\n } else {\n return dispatch(logout());\n }\n },\n };\n};\n"],"mappings":";;;;;;;AACA;AAEA;AACA;AAEA;AACA;AAIA;AAeA;AACA;AACO,MAAMA,QAAQ,GAAG,MAAiB;EACvCC,cAAK,CAACC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;EAEvC,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,GAAE;EAE9B,MAAMC,WAAW,GAAG,IAAAC,uBAAW,EAACC,kCAAc,CAAC;EAC/C,MAAMC,IAAI,GAAG,IAAAF,uBAAW,EAAEG,KAAK,IAAKA,KAAK,CAACD,IAAI,CAAC;EAE/C,MAAME,eAAe,GAAGL,WAAW,EAAEM,UAAU,IAAI,KAAK;EAExD,OAAO;IACLD,eAAe;IACfE,mBAAmB,EAAEP,WAAW,EAAEO,mBAAmB,IAAI,EAAE;IAC3DC,YAAY,EAAEL,IAAI,CAACM,KAAK;IACxBC,WAAW,EAAE,MAAMZ,QAAQ,CAAC,IAAAa,wBAAe,GAAE,CAAC;IAC9CC,KAAK,EAAE,CAACC,QAAgB,EAAEC,QAAgB,KACxChB,QAAQ,CAAC,IAAAc,cAAK,EAACC,QAAQ,EAAEC,QAAQ,CAAC,CAAC;IACrCC,aAAa,EAAGC,kBAAsC,IAAK;MACzD,IAAIpB,cAAK,CAACqB,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACpC;QACA,MAAM,IAAIC,iCAAqB,CAC5B,0BAAyBF,kBAAkB,CAACG,cAAe,iBAAgBH,kBAAkB,CAACI,WAAY,GAAE,CAC9G;MACH;MAEA,IAAI,CAACf,eAAe,EAAE;QACpBT,cAAK,CAACC,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC;QACtCwB,MAAM,CAACC,QAAQ,CAACC,MAAM,CAAE,GAAEC,eAAK,GAAER,kBAAkB,CAACI,WAAY,EAAC,CAAC;MACpE;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AADA;AAEO,MAAMK,SAAS,GAAG,MAAkB;EACzC,MAAM3B,QAAQ,GAAG,IAAAC,uBAAW,GAAE;EAC9B,MAAMC,WAAW,GAAG,IAAAC,uBAAW,EAACC,kCAAc,CAAC;EAE/C,MAAMwB,WAAW,GAAG,IAAAC,qBAAU,EAAC,aAAa,EAAE,UAAU,CAAC;EAEzD,MAAMtB,eAAe,GAAGL,WAAW,EAAEM,UAAU,IAAI,KAAK;EACxD,OAAO;IACLD,eAAe;IACfE,mBAAmB,EAAEP,WAAW,EAAEO,mBAAmB,IAAI,EAAE;IAC3DqB,MAAM,EAAE,MAAM;MACZ,IAAIhC,cAAK,CAACqB,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACpC,MAAMY,MAAM,GAAGR,MAAM,CAACC,QAAQ,CAACO,MAAM;QACrC,MAAMC,GAAG,GAAI,GAAED,MAAO,GAAEL,eAAK,eAAcK,MAAO,GAAEL,eAAK,GAAEE,WAAY,EAAC;QACxE9B,cAAK,CAACC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;QACvCwB,MAAM,CAACC,QAAQ,CAACC,MAAM,CAACO,GAAG,CAAC;MAC7B,CAAC,MAAM;QACL,OAAOhC,QAAQ,CAAC,IAAA8B,eAAM,GAAE,CAAC;MAC3B;IACF;EACF,CAAC;AACH,CAAC;AAAC"}
|
|
@@ -11,6 +11,7 @@ import ContentModel from "../models/content/ContentModel";
|
|
|
11
11
|
|
|
12
12
|
import { useModularUIBasic } from "./useModularUIBasic";
|
|
13
13
|
import { ContentTypeModel } from "../models";
|
|
14
|
+
import type { Location } from "react-router";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
*/
|
|
@@ -28,7 +29,7 @@ export const useConceptIndex = (href: string): ?ConceptIndexModel =>
|
|
|
28
29
|
targetModel: ConceptIndexModel,
|
|
29
30
|
});
|
|
30
31
|
|
|
31
|
-
const getHref = (context, dynamic, location) => {
|
|
32
|
+
const getHref = (context: string, dynamic: string, location?: Location) => {
|
|
32
33
|
let href = dynamic;
|
|
33
34
|
if (!href.startsWith(`/${context}/`)) {
|
|
34
35
|
href = `/${context}/${href}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModelCatalog.js","names":["useModelCatalog","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","useConceptIndex","href","ConceptIndexModel","getHref","context","dynamic","location","replace","search","useConceptDetail","concept","useLocation","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","contentSection","ContentModel","useContentType","contentType","ContentTypeModel"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\n/**\n */\nexport const useModelCatalog = (): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n });\n\n/**\n */\nexport const useConceptIndex = (href: string): ?ConceptIndexModel =>\n useModularUIBasic(\"conceptindex\", href, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n });\n\nconst getHref = (context, dynamic, location) => {\n let href = dynamic;\n if (!href.startsWith(`/${context}/`)) {\n href = `/${context}/${href}`;\n }\n\n href = href.replace(/\\/\\//g, \"/\");\n\n if (location?.search) {\n href = `${href}${location.search}`;\n }\n\n return href;\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = getHref(\"concepts\", concept, location);\n return useModularUIBasic(\"conceptdetail\", href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n });\n};\n\n/**\n */\nexport const useContentIndex = (href: string): ?ContentIndexModel =>\n useModularUIBasic(\"contentindex\", href, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n });\n\n/**\n */\nexport const useContentTOC = (content: string): ?ContentTOCModel => {\n const location = useLocation();\n const href = getHref(\"content\", content, location);\n return useModularUIBasic(\"contenttoc\", href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n });\n};\n\n/**\n */\nexport const useContent = (contentSection: string): ?ContentModel => {\n const href = getHref(\"content\", contentSection);\n return useModularUIBasic(\"content\", href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n });\n};\n\n/**\n */\nexport const useContentType = (contentType: string): ?ContentTypeModel => {\n const href = getHref(\"contenttypes\", contentType);\n return useModularUIBasic(\"contenttypes\", href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n });\n};\n"],"mappings":";;;;;;;;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;
|
|
1
|
+
{"version":3,"file":"useModelCatalog.js","names":["useModelCatalog","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","useConceptIndex","href","ConceptIndexModel","getHref","context","dynamic","location","replace","search","useConceptDetail","concept","useLocation","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","contentSection","ContentModel","useContentType","contentType","ContentTypeModel"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\nimport type { Location } from \"react-router\";\n\n/**\n */\nexport const useModelCatalog = (): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n });\n\n/**\n */\nexport const useConceptIndex = (href: string): ?ConceptIndexModel =>\n useModularUIBasic(\"conceptindex\", href, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n });\n\nconst getHref = (context: string, dynamic: string, location?: Location) => {\n let href = dynamic;\n if (!href.startsWith(`/${context}/`)) {\n href = `/${context}/${href}`;\n }\n\n href = href.replace(/\\/\\//g, \"/\");\n\n if (location?.search) {\n href = `${href}${location.search}`;\n }\n\n return href;\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = getHref(\"concepts\", concept, location);\n return useModularUIBasic(\"conceptdetail\", href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n });\n};\n\n/**\n */\nexport const useContentIndex = (href: string): ?ContentIndexModel =>\n useModularUIBasic(\"contentindex\", href, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n });\n\n/**\n */\nexport const useContentTOC = (content: string): ?ContentTOCModel => {\n const location = useLocation();\n const href = getHref(\"content\", content, location);\n return useModularUIBasic(\"contenttoc\", href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n });\n};\n\n/**\n */\nexport const useContent = (contentSection: string): ?ContentModel => {\n const href = getHref(\"content\", contentSection);\n return useModularUIBasic(\"content\", href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n });\n};\n\n/**\n */\nexport const useContentType = (contentType: string): ?ContentTypeModel => {\n const href = getHref(\"contenttypes\", contentType);\n return useModularUIBasic(\"contenttypes\", href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n });\n};\n"],"mappings":";;;;;;;;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAGA;AACA;AACO,MAAMA,eAAe,GAAG,MAC7B,IAAAC,oCAAiB,EAAC,cAAc,EAAE,eAAe,EAAE;EACjDC,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEC;AACf,CAAC,CAAC;;AAEJ;AACA;AADA;AAEO,MAAMC,eAAe,GAAIC,IAAY,IAC1C,IAAAL,oCAAiB,EAAC,cAAc,EAAEK,IAAI,EAAE;EACtCJ,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEI;AACf,CAAC,CAAC;AAAC;AAEL,MAAMC,OAAO,GAAG,CAACC,OAAe,EAAEC,OAAe,EAAEC,QAAmB,KAAK;EACzE,IAAIL,IAAI,GAAGI,OAAO;EAClB,IAAI,CAAC,yBAAAJ,IAAI,OAAJA,IAAI,EAAa,IAAGG,OAAQ,GAAE,CAAC,EAAE;IACpCH,IAAI,GAAI,IAAGG,OAAQ,IAAGH,IAAK,EAAC;EAC9B;EAEAA,IAAI,GAAGA,IAAI,CAACM,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;EAEjC,IAAID,QAAQ,EAAEE,MAAM,EAAE;IACpBP,IAAI,GAAI,GAAEA,IAAK,GAAEK,QAAQ,CAACE,MAAO,EAAC;EACpC;EAEA,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