@beinformed/ui 1.25.0 → 1.25.1-beta.1
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 +12 -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} +4 -6
- 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} +4 -6
- package/lib/redux/_modularui/{reducer.js.flow → ModularUIReducer.js.flow} +14 -8
- 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 +6 -4
- 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} +14 -8
- 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 +6 -4
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","names":["connectTab","modularui","match","url","propName"],"sources":["../../../src/redux/connectors/Tab.js"],"sourcesContent":["// @flow\nimport modularui from \"../_modularui/
|
|
1
|
+
{"version":3,"file":"Tab.js","names":["connectTab","modularui","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;AAIA;AACA;AACO,MAAMA,UAA8B,GAAG,IAAAC,2BAAS,EACrD,KAAK,EACL;EAAA,IAAC;IAAEC;EAAM,CAAC;EAAA,OAAKA,KAAK,CAACC,GAAG;AAAA,GACxB;EACEC,QAAQ,EAAE;AACZ,CAAC,CACF;AAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { Reducer } from "redux";
|
|
3
3
|
import type { ReduxAction, ModalsState } from "../types";
|
|
4
4
|
|
|
5
|
-
const showModal = (state, modalKey) => [
|
|
5
|
+
const showModal = (state: ModalsState, modalKey: string) => [
|
|
6
6
|
...state.modals.map((modal) => ({
|
|
7
7
|
...modal,
|
|
8
8
|
visible: false,
|
|
@@ -13,7 +13,7 @@ const showModal = (state, modalKey) => [
|
|
|
13
13
|
},
|
|
14
14
|
];
|
|
15
15
|
|
|
16
|
-
const closeModal = (state, modalKey) =>
|
|
16
|
+
const closeModal = (state: ModalsState, modalKey: string) =>
|
|
17
17
|
state.modals
|
|
18
18
|
.filter((modal) => modal.key !== modalKey)
|
|
19
19
|
.map((modal, idx, arr) => ({
|
|
@@ -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,6BAAAD,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,+DAAAD,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;AAAC,eAEaW,aAAa;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;AAAC,eAEaI,wBAAwB;AAAA"}
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.createReducer = void 0;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
8
|
+
var _RouterReducer = require("../_router/RouterReducer");
|
|
9
|
+
var _ModularUIReducer = require("../_modularui/ModularUIReducer");
|
|
10
|
+
var _I18nReducer = require("../_i18n/I18nReducer");
|
|
11
11
|
var _ModalsReducer = _interopRequireDefault(require("./ModalsReducer"));
|
|
12
12
|
var _AuthReducer = _interopRequireDefault(require("./AuthReducer"));
|
|
13
13
|
var _ErrorReducer = _interopRequireDefault(require("./ErrorReducer"));
|
|
@@ -17,9 +17,9 @@ var _PreferencesReducer = _interopRequireDefault(require("./PreferencesReducer")
|
|
|
17
17
|
/**
|
|
18
18
|
*/
|
|
19
19
|
const createReducer = () => ({
|
|
20
|
-
router:
|
|
21
|
-
modularui:
|
|
22
|
-
i18n:
|
|
20
|
+
router: _RouterReducer.RouterReducer,
|
|
21
|
+
modularui: _ModularUIReducer.ModularUIReducer,
|
|
22
|
+
i18n: _I18nReducer.I18nReducer,
|
|
23
23
|
auth: _AuthReducer.default,
|
|
24
24
|
error: _ErrorReducer.default,
|
|
25
25
|
modals: _ModalsReducer.default,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import { RouterReducer } from "../_router/
|
|
3
|
-
import { ModularUIReducer } from "../_modularui/
|
|
4
|
-
import { I18nReducer } from "../_i18n/
|
|
2
|
+
import { RouterReducer } from "../_router/RouterReducer";
|
|
3
|
+
import { ModularUIReducer } from "../_modularui/ModularUIReducer";
|
|
4
|
+
import { I18nReducer } from "../_i18n/I18nReducer";
|
|
5
5
|
|
|
6
6
|
import ModalsReducer from "./ModalsReducer";
|
|
7
7
|
import AuthReducer from "./AuthReducer";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createReducer.js","names":["createReducer","router","RouterReducer","modularui","ModularUIReducer","i18n","I18nReducer","auth","AuthReducer","error","ErrorReducer","modals","ModalsReducer","notification","NotificationReducer","progressindicator","ProgressIndicatorReducer","preferences","PreferencesReducer"],"sources":["../../../src/redux/reducers/createReducer.js"],"sourcesContent":["// @flow\nimport { RouterReducer } from \"../_router/
|
|
1
|
+
{"version":3,"file":"createReducer.js","names":["createReducer","router","RouterReducer","modularui","ModularUIReducer","i18n","I18nReducer","auth","AuthReducer","error","ErrorReducer","modals","ModalsReducer","notification","NotificationReducer","progressindicator","ProgressIndicatorReducer","preferences","PreferencesReducer"],"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;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AA4BA;AACA;AACO,MAAMA,aAAa,GAAG,OAAiB;EAC5CC,MAAM,EAAEC,4BAAa;EACrBC,SAAS,EAAEC,kCAAgB;EAC3BC,IAAI,EAAEC,wBAAW;EACjBC,IAAI,EAAEC,oBAAW;EACjBC,KAAK,EAAEC,qBAAY;EACnBC,MAAM,EAAEC,sBAAa;EACrBC,YAAY,EAAEC,4BAAmB;EACjCC,iBAAiB,EAAEC,iCAAwB;EAC3CC,WAAW,EAAEC;AACf,CAAC,CAAC;AAAC"}
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _redux = require("redux");
|
|
9
9
|
var _reduxThunk = _interopRequireDefault(require("redux-thunk"));
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _RouterMiddleware = require("../_router/RouterMiddleware");
|
|
11
|
+
var _ModularUIMiddleware = require("../_modularui/ModularUIMiddleware");
|
|
12
12
|
var _createReducer = require("../reducers/createReducer");
|
|
13
|
-
var
|
|
13
|
+
var _RouterActions = require("../_router/RouterActions");
|
|
14
14
|
/**
|
|
15
15
|
*/
|
|
16
16
|
const configureStore = (history, customReducers, initialState) => {
|
|
@@ -22,11 +22,11 @@ const configureStore = (history, customReducers, initialState) => {
|
|
|
22
22
|
...customReducers,
|
|
23
23
|
...(0, _createReducer.createReducer)()
|
|
24
24
|
});
|
|
25
|
-
const middleware = (0, _redux.applyMiddleware)(
|
|
25
|
+
const middleware = (0, _redux.applyMiddleware)(_ModularUIMiddleware.modularUIMiddleware, (0, _RouterMiddleware.routerMiddleware)(history), _reduxThunk.default);
|
|
26
26
|
const enhancers = composeEnhancers(middleware);
|
|
27
27
|
const store = (0, _redux.createStore)(combinedReducers, initialState, enhancers);
|
|
28
28
|
if (!initialState) {
|
|
29
|
-
store.dispatch((0,
|
|
29
|
+
store.dispatch((0, _RouterActions.locationChange)(history.location, "PUSH"));
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
32
|
history,
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
} from "redux";
|
|
8
8
|
import thunk from "redux-thunk";
|
|
9
9
|
|
|
10
|
-
import { routerMiddleware } from "../_router/
|
|
11
|
-
import {
|
|
10
|
+
import { routerMiddleware } from "../_router/RouterMiddleware";
|
|
11
|
+
import { modularUIMiddleware } from "../_modularui/ModularUIMiddleware";
|
|
12
12
|
|
|
13
13
|
import { createReducer } from "../reducers/createReducer";
|
|
14
|
-
import { locationChange } from "../_router/
|
|
14
|
+
import { locationChange } from "../_router/RouterActions";
|
|
15
15
|
|
|
16
16
|
import type { RouterHistory } from "react-router";
|
|
17
17
|
import type { ReduxAction, ReduxState, ReduxStore } from "../types";
|
|
@@ -36,7 +36,7 @@ const configureStore = (
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
const middleware = applyMiddleware(
|
|
39
|
-
|
|
39
|
+
modularUIMiddleware,
|
|
40
40
|
routerMiddleware(history),
|
|
41
41
|
thunk
|
|
42
42
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configureStore.js","names":["configureStore","history","customReducers","initialState","composeEnhancers","compose","process","env","NODE_ENV","window","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","combinedReducers","combineReducers","createReducer","middleware","applyMiddleware","
|
|
1
|
+
{"version":3,"file":"configureStore.js","names":["configureStore","history","customReducers","initialState","composeEnhancers","compose","process","env","NODE_ENV","window","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","combinedReducers","combineReducers","createReducer","middleware","applyMiddleware","modularUIMiddleware","routerMiddleware","thunk","enhancers","store","createReduxStore","dispatch","locationChange","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;AAMA;AAEA;AACA;AAEA;AACA;AAMA;AACA;AACA,MAAMA,cAAc,GAAG,CACrBC,OAAsB,EACtBC,cAAuB,EACvBC,YAAiC,KACiB;EAClD,IAAIC,gBAAgB,GAAGC,cAAO;EAE9B,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IAC1EL,gBAAgB,GAAGK,MAAM,CAACC,oCAAoC,IAAIL,cAAO;EAC3E;EAEA,MAAMM,gBAAkD,GAAG,IAAAC,sBAAe,EAAC;IACzE,GAAGV,cAAc;IACjB,GAAG,IAAAW,4BAAa;EAClB,CAAC,CAAC;EAEF,MAAMC,UAAU,GAAG,IAAAC,sBAAe,EAChCC,wCAAmB,EACnB,IAAAC,kCAAgB,EAAChB,OAAO,CAAC,EACzBiB,mBAAK,CACN;EAED,MAAMC,SAAS,GAAGf,gBAAgB,CAACU,UAAU,CAAC;EAE9C,MAAMM,KAAiB,GAAG,IAAAC,kBAAgB,EACxCV,gBAAgB,EAChBR,YAAY,EACZgB,SAAS,CACV;EAED,IAAI,CAAChB,YAAY,EAAE;IACjBiB,KAAK,CAACE,QAAQ,CAAC,IAAAC,6BAAc,EAACtB,OAAO,CAACuB,QAAQ,EAAE,MAAM,CAAC,CAAC;EAC1D;EACA,OAAO;IAAEvB,OAAO;IAAEmB;EAAM,CAAC;AAC3B,CAAC;AAAC,eAEapB,cAAc;AAAA"}
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default =
|
|
7
|
+
exports.default = void 0;
|
|
8
8
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
9
9
|
var _objects = require("../helpers/objects");
|
|
10
10
|
var _Constants = require("../../constants/Constants");
|
|
@@ -70,7 +70,7 @@ const browserFetch = args => {
|
|
|
70
70
|
/**
|
|
71
71
|
* Request data from server, uses server datafetcher or xhr in browser.
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
const universalFetch = args => {
|
|
74
74
|
// Set locale as Accept-Language header
|
|
75
75
|
if (args.locale) {
|
|
76
76
|
args.headers = {
|
|
@@ -86,5 +86,7 @@ function universalFetch(args) {
|
|
|
86
86
|
return (0, _serverFetch.default)(args);
|
|
87
87
|
}
|
|
88
88
|
return browserFetch(args);
|
|
89
|
-
}
|
|
89
|
+
};
|
|
90
|
+
var _default = universalFetch;
|
|
91
|
+
exports.default = _default;
|
|
90
92
|
//# sourceMappingURL=universalFetch.js.map
|
|
@@ -8,7 +8,7 @@ import Cache from "../browser/Cache";
|
|
|
8
8
|
|
|
9
9
|
import type { RequestOptions } from "./types";
|
|
10
10
|
|
|
11
|
-
type CachedResponse =
|
|
11
|
+
type CachedResponse = any;
|
|
12
12
|
|
|
13
13
|
const IS_FETCHING = "is-fetching";
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ const IS_FETCHING = "is-fetching";
|
|
|
16
16
|
* Checks each x ms if a cache item is set after fetching the item.
|
|
17
17
|
* @private
|
|
18
18
|
*/
|
|
19
|
-
const waitForCachedItem = (cacheKey) => {
|
|
19
|
+
const waitForCachedItem = (cacheKey: string) => {
|
|
20
20
|
let TIMEOUT = 3000;
|
|
21
21
|
const CHECK_TIMEOUT = 100;
|
|
22
22
|
|
|
@@ -44,7 +44,7 @@ const waitForCachedItem = (cacheKey) => {
|
|
|
44
44
|
/**
|
|
45
45
|
* @private
|
|
46
46
|
*/
|
|
47
|
-
const browserFetch = (args) => {
|
|
47
|
+
const browserFetch = (args: RequestOptions) => {
|
|
48
48
|
if (USE_CACHE && args.cache) {
|
|
49
49
|
const cacheKey = Cache.createResourceKey(args);
|
|
50
50
|
|
|
@@ -77,9 +77,9 @@ const browserFetch = (args) => {
|
|
|
77
77
|
/**
|
|
78
78
|
* Request data from server, uses server datafetcher or xhr in browser.
|
|
79
79
|
*/
|
|
80
|
-
|
|
80
|
+
const universalFetch = (
|
|
81
81
|
args: RequestOptions
|
|
82
|
-
): Promise<CachedResponse> | Promise
|
|
82
|
+
): Promise<CachedResponse> | Promise<any> => {
|
|
83
83
|
// Set locale as Accept-Language header
|
|
84
84
|
if (args.locale) {
|
|
85
85
|
args.headers = {
|
|
@@ -97,4 +97,6 @@ export default function universalFetch(
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
return browserFetch(args);
|
|
100
|
-
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default universalFetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universalFetch.js","names":["IS_FETCHING","waitForCachedItem","cacheKey","TIMEOUT","CHECK_TIMEOUT","resolve","reject","check","Cache","getItem","cachedItem","Error","setTimeout","browserFetch","args","USE_CACHE","cache","createResourceKey","hasItem","cacheItem","isPlainObject","addItem","xhr","then","response","universalFetch","locale","headers","includeContext","url","IS_SYNC","serverFetch"],"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":["IS_FETCHING","waitForCachedItem","cacheKey","TIMEOUT","CHECK_TIMEOUT","resolve","reject","check","Cache","getItem","cachedItem","Error","setTimeout","browserFetch","args","USE_CACHE","cache","createResourceKey","hasItem","cacheItem","isPlainObject","addItem","xhr","then","response","universalFetch","locale","headers","includeContext","url","IS_SYNC","serverFetch"],"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_SYNC) {\n return serverFetch(args);\n }\n\n return browserFetch(args);\n};\n\nexport default universalFetch;\n"],"mappings":";;;;;;;;AACA;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mlhttp(xmlhttp) {
|
|
54
|
+
set xmlhttp(xmlhttp: XMLHttpRequest) {
|
|
55
55
|
this._xmlhttp = xmlhttp;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
*/
|
|
60
|
-
get options() {
|
|
60
|
+
get options(): RequestOptions {
|
|
61
61
|
return this._options;
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -69,20 +69,20 @@ class XHR {
|
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
*/
|
|
72
|
-
get attempts() {
|
|
72
|
+
get attempts(): number {
|
|
73
73
|
return this._attempts;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
*/
|
|
78
|
-
set attempts(attempts) {
|
|
78
|
+
set attempts(attempts: number) {
|
|
79
79
|
this._attempts = attempts;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* Create and fix url when params or both querystring and params exist.
|
|
84
84
|
*/
|
|
85
|
-
get url() {
|
|
85
|
+
get url(): string {
|
|
86
86
|
const { url } = this.options;
|
|
87
87
|
if (this.params !== "") {
|
|
88
88
|
if (url.includes("?")) {
|
|
@@ -99,31 +99,31 @@ class XHR {
|
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
*/
|
|
102
|
-
get params() {
|
|
102
|
+
get params(): string {
|
|
103
103
|
return this.options.params || "";
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
*/
|
|
108
|
-
get data() {
|
|
108
|
+
get data(): string | { [key: string]: string } | null {
|
|
109
109
|
return this.options.data || null;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
113
|
*/
|
|
114
|
-
get method() {
|
|
114
|
+
get method(): $Keys<typeof HTTP_METHODS> {
|
|
115
115
|
return this.options.method || HTTP_METHODS.GET;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
*/
|
|
120
|
-
get timeout() {
|
|
120
|
+
get timeout(): number {
|
|
121
121
|
return this.options.timeout || getSetting("XHR_TIMEOUT_MS", 300000);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
*/
|
|
126
|
-
get responseType() {
|
|
126
|
+
get responseType(): string {
|
|
127
127
|
return this.options.responseType || "json";
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -141,13 +141,13 @@ class XHR {
|
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
*/
|
|
144
|
-
get events() {
|
|
144
|
+
get events(): { [eventName: string]: () => void } {
|
|
145
145
|
return this.options.events || {};
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
149
|
*/
|
|
150
|
-
get headers() {
|
|
150
|
+
get headers(): { [string]: string } {
|
|
151
151
|
const baseHeaders = {
|
|
152
152
|
Accept: JSON_TYPE,
|
|
153
153
|
"Content-Type": JSON_TYPE,
|
|
@@ -171,13 +171,13 @@ class XHR {
|
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
173
|
*/
|
|
174
|
-
timeoutHandler(reject) {
|
|
174
|
+
timeoutHandler(reject: Function): any {
|
|
175
175
|
return reject(new TimeoutException(this.url, this.method));
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
179
|
*/
|
|
180
|
-
errorHandler(reject, responseJSON = null) {
|
|
180
|
+
errorHandler(reject: Function, responseJSON: any = null): any {
|
|
181
181
|
const { status } = this.xmlhttp;
|
|
182
182
|
const { isReload } = this.options;
|
|
183
183
|
|
|
@@ -200,7 +200,7 @@ class XHR {
|
|
|
200
200
|
|
|
201
201
|
/**
|
|
202
202
|
*/
|
|
203
|
-
getResponse() {
|
|
203
|
+
getResponse(): any {
|
|
204
204
|
const { responseType, response } = this.xmlhttp;
|
|
205
205
|
|
|
206
206
|
if (
|
|
@@ -223,7 +223,7 @@ class XHR {
|
|
|
223
223
|
|
|
224
224
|
/**
|
|
225
225
|
*/
|
|
226
|
-
responseHandler(resolve, reject) {
|
|
226
|
+
responseHandler(resolve: Function, reject: Function): any {
|
|
227
227
|
const { status } = this.xmlhttp;
|
|
228
228
|
|
|
229
229
|
let response = null;
|
|
@@ -245,7 +245,7 @@ class XHR {
|
|
|
245
245
|
|
|
246
246
|
/**
|
|
247
247
|
*/
|
|
248
|
-
setEventListeners(resolve, reject) {
|
|
248
|
+
setEventListeners(resolve: Function, reject: Function) {
|
|
249
249
|
if (this.options.onProgress) {
|
|
250
250
|
["load", "loadend", "loadstart", "progress"].forEach((eventType) => {
|
|
251
251
|
this.xmlhttp.addEventListener(eventType, this.onProgress);
|
|
@@ -289,7 +289,7 @@ class XHR {
|
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
291
|
*/
|
|
292
|
-
getResponseHeader(headerName) {
|
|
292
|
+
getResponseHeader(headerName: string): string | null {
|
|
293
293
|
return this.xmlhttp.getResponseHeader(headerName);
|
|
294
294
|
}
|
|
295
295
|
|
|
@@ -323,7 +323,7 @@ class XHR {
|
|
|
323
323
|
|
|
324
324
|
/**
|
|
325
325
|
*/
|
|
326
|
-
setXMLHttpRequest() {
|
|
326
|
+
setXMLHttpRequest(): Promise<any> {
|
|
327
327
|
return new Promise((resolve, reject) => {
|
|
328
328
|
this.xmlhttp = new XMLHttpRequest();
|
|
329
329
|
|
|
@@ -343,7 +343,7 @@ class XHR {
|
|
|
343
343
|
|
|
344
344
|
/**
|
|
345
345
|
*/
|
|
346
|
-
async fetch() {
|
|
346
|
+
async fetch(): Promise<any> {
|
|
347
347
|
try {
|
|
348
348
|
return await this.setXMLHttpRequest();
|
|
349
349
|
} catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhr.js","names":["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","HTTP_METHODS","GET","timeout","getSetting","responseType","onProgress","events","headers","baseHeaders","Accept","timeoutHandler","reject","TimeoutException","errorHandler","responseJSON","status","isReload","NetworkException","NotFoundException","UnauthorizedException","FetchException","getResponse","response","getResponseHeader","isPlainObject","JSON","parse","error","JsonParseException","responseHandler","resolve","has","setEventListeners","forEach","eventType","addEventListener","eventName","openConnection","open","setBasicAuthentication","Cache","hasItem","withCredentials","basicToken","getItem","setRequestHeader","headerName","setCustomHeaders","setOtherOptions","sendData","send","stringData","setXMLHttpRequest","XMLHttpRequest","fetch","err","validateInputArguments","args","IllegalArgumentException","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;AAEA;AAUA;AAEA;AAEA;AAIA,MAAMA,kBAAkB,GAAG,CAAC;AAC5B,MAAMC,YAAY,GAAG,GAAG;AACxB,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,gBAAgB,GAAG,GAAG;AAC5B,MAAMC,cAAc,GAAG,GAAG;AAE1B,MAAMC,SAAS,GAAG,kBAAkB;;AAEpC;AACA;A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,IAAI,IAAI,EAAE;IAChB,MAAM,IAAIC,oCAAwB,CAChC,kEAAkE,CACnE;EACH;EAEA,IAAI,CAAC,IAAAlC,sBAAa,EAACiC,IAAI,CAAC,EAAE;IACxB,MAAM,IAAIC,oCAAwB,CAC/B,0DAAyDD,IAAI,CAACE,QAAQ,EAAG,EAAC,CAC5E;EACH;EAEA,IAAI,CAAC,IAAA5B,YAAG,EAAC0B,IAAI,EAAE,KAAK,CAAC,EAAE;IACrB,MAAM,IAAIC,oCAAwB,CAC/B,wDAAuD,wBACtDD,IAAI,CACJ,EAAC,CACJ;EACH;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA,MAAMG,GAAG,GAAIH,IAAoB,IAAmB;EAClDD,sBAAsB,CAACC,IAAI,CAAC;EAE5B,OAAO,IAAIvE,GAAG,CAACuE,IAAI,CAAC,CAACH,KAAK,EAAE;AAC9B,CAAC;AAAC,eAEaM,GAAG;AAAA"}
|
|
1
|
+
{"version":3,"file":"xhr.js","names":["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","HTTP_METHODS","GET","timeout","getSetting","responseType","onProgress","events","headers","baseHeaders","Accept","timeoutHandler","reject","TimeoutException","errorHandler","responseJSON","status","isReload","NetworkException","NotFoundException","UnauthorizedException","FetchException","getResponse","response","getResponseHeader","isPlainObject","JSON","parse","error","JsonParseException","responseHandler","resolve","has","setEventListeners","forEach","eventType","addEventListener","eventName","openConnection","open","setBasicAuthentication","Cache","hasItem","withCredentials","basicToken","getItem","setRequestHeader","headerName","setCustomHeaders","setOtherOptions","sendData","send","stringData","setXMLHttpRequest","XMLHttpRequest","fetch","err","validateInputArguments","args","IllegalArgumentException","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;AAEA;AAUA;AAEA;AAEA;AAIA,MAAMA,kBAAkB,GAAG,CAAC;AAC5B,MAAMC,YAAY,GAAG,GAAG;AACxB,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,gBAAgB,GAAG,GAAG;AAC5B,MAAMC,cAAc,GAAG,GAAG;AAE1B,MAAMC,SAAS,GAAG,kBAAkB;;AAEpC;AACA;AACA;AACA,MAAMC,GAAG,CAAC;EAKR;AACF;EACEC,WAAW,CAACC,OAAuB,EAAE;IAAA;IAAA;IAAA;IACnC,IAAI,CAACC,QAAQ,GAAGD,OAAO;IACvB,IAAI,CAACE,SAAS,GAAG,CAAC;EACpB;;EAEA;AACF;EACE,IAAIC,OAAO,GAAmB;IAC5B,OAAO,IAAI,CAACC,QAAQ;EACtB;;EAEA;AACF;EACE,IAAID,OAAO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AAA5B,YAAG,EAAC0B,IAAI,EAAE,KAAK,CAAC,EAAE;IACrB,MAAM,IAAIC,oCAAwB,CAC/B,wDAAuD,wBACtDD,IAAI,CACJ,EAAC,CACJ;EACH;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA,MAAMG,GAAG,GAAIH,IAAoB,IAAmB;EAClDD,sBAAsB,CAACC,IAAI,CAAC;EAE5B,OAAO,IAAIvE,GAAG,CAACuE,IAAI,CAAC,CAACH,KAAK,EAAE;AAC9B,CAAC;AAAC,eAEaM,GAAG;AAAA"}
|
|
@@ -4,11 +4,11 @@ import _isPlainObject from "lodash/isPlainObject";
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const isPlainObject = (value: any): boolean => _isPlainObject(value);
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
const has = (obj: any, propName: string): boolean => {
|
|
12
12
|
if (!isPlainObject(obj)) {
|
|
13
13
|
return false;
|
|
14
14
|
}
|
|
@@ -20,7 +20,7 @@ export const has = (obj: any, propName: string): boolean => {
|
|
|
20
20
|
* Retrieve property of an object
|
|
21
21
|
* When path is only one deep better use optional chaining
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
const get = (obj: Object, path: string, defaultValue?: any): any =>
|
|
24
24
|
String(path)
|
|
25
25
|
.split(".")
|
|
26
26
|
.reduce((acc, v) => {
|
|
@@ -29,3 +29,5 @@ export const get = (obj: { ... }, path: string, defaultValue?: any): any =>
|
|
|
29
29
|
}
|
|
30
30
|
return defaultValue;
|
|
31
31
|
}, obj);
|
|
32
|
+
|
|
33
|
+
export { get, has, isPlainObject };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objects.js","names":["isPlainObject","value","_isPlainObject","has","obj","propName","_has","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":["isPlainObject","value","_isPlainObject","has","obj","propName","_has","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;AACA;AAEA;AACA;AACA,MAAMA,aAAa,GAAIC,KAAU,IAAc,IAAAC,uBAAc,EAACD,KAAK,CAAC;;AAEpE;AACA;AADA;AAEA,MAAME,GAAG,GAAG,CAACC,GAAQ,EAAEC,QAAgB,KAAc;EACnD,IAAI,CAACL,aAAa,CAACI,GAAG,CAAC,EAAE;IACvB,OAAO,KAAK;EACd;EAEA,OAAO,IAAAE,aAAI,EAACF,GAAG,EAAEC,QAAQ,CAAC;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AAHA;AAIA,MAAME,GAAG,GAAG,CAACH,GAAW,EAAEI,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,EAAEL,GAAG,CAAC;AAAC"}
|
|
@@ -11,7 +11,7 @@ type removeUnwantedHtmlOptions = {
|
|
|
11
11
|
* Translates html entities to their correct decimal equivalent
|
|
12
12
|
* When path is only one deep better use optional chaining
|
|
13
13
|
*/
|
|
14
|
-
const properEntityEncoding = (html) => {
|
|
14
|
+
const properEntityEncoding = (html: string) => {
|
|
15
15
|
const escapedGt = html.replace(/</g, "[");
|
|
16
16
|
const escapedLt = escapedGt.replace(/>/g, "]");
|
|
17
17
|
|