@beinformed/ui 1.62.7 → 1.62.9
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 +16 -0
- package/esm/constants/Settings.js +4 -0
- package/esm/constants/Settings.js.flow +5 -1
- package/esm/constants/Settings.js.map +1 -1
- package/esm/react-client/client.js +19 -0
- package/esm/react-client/client.js.flow +23 -1
- package/esm/react-client/client.js.map +1 -1
- package/esm/react-server/__tests__/requestInformation.spec.js.flow +265 -0
- package/esm/react-server/requestInformation.js +6 -3
- package/esm/react-server/requestInformation.js.flow +8 -3
- package/esm/react-server/requestInformation.js.map +1 -1
- package/esm/react-server/serverUtil.js +2 -2
- package/esm/react-server/serverUtil.js.flow +2 -2
- package/esm/react-server/serverUtil.js.map +1 -1
- package/esm/redux/_i18n/I18nActions.js.flow +0 -1
- package/esm/redux/_i18n/I18nActions.js.map +1 -1
- package/esm/redux/_i18n/I18nReducer.js +11 -3
- package/esm/redux/_i18n/I18nReducer.js.flow +11 -3
- package/esm/redux/_i18n/I18nReducer.js.map +1 -1
- package/esm/redux/reducers/createReducer.js +2 -2
- package/esm/redux/reducers/createReducer.js.flow +1 -1
- package/esm/redux/reducers/createReducer.js.map +1 -1
- package/esm/redux/store/configureStore.js +0 -5
- package/esm/redux/store/configureStore.js.flow +0 -7
- package/esm/redux/store/configureStore.js.map +1 -1
- package/esm/utils/datetime/DateTimeUtil.js +3 -2
- package/esm/utils/datetime/DateTimeUtil.js.flow +3 -1
- package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
- package/lib/constants/Settings.js +7 -2
- package/lib/constants/Settings.js.map +1 -1
- package/lib/react-client/client.js +20 -1
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-server/requestInformation.js +6 -3
- package/lib/react-server/requestInformation.js.map +1 -1
- package/lib/react-server/serverUtil.js +1 -1
- package/lib/react-server/serverUtil.js.map +1 -1
- package/lib/redux/_i18n/I18nActions.js.map +1 -1
- package/lib/redux/_i18n/I18nReducer.js +10 -2
- package/lib/redux/_i18n/I18nReducer.js.map +1 -1
- package/lib/redux/reducers/createReducer.js +2 -2
- package/lib/redux/reducers/createReducer.js.map +1 -1
- package/lib/redux/store/configureStore.js +0 -5
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/utils/datetime/DateTimeUtil.js +2 -1
- package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
- package/package.json +10 -10
- package/src/constants/Settings.js +5 -1
- package/src/react-client/client.js +23 -1
- package/src/react-server/__tests__/requestInformation.spec.js +265 -0
- package/src/react-server/requestInformation.js +8 -3
- package/src/react-server/serverUtil.js +2 -2
- package/src/redux/_i18n/I18nActions.js +0 -1
- package/src/redux/_i18n/I18nReducer.js +11 -3
- package/src/redux/reducers/createReducer.js +1 -1
- package/src/redux/store/configureStore.js +0 -7
- package/src/utils/datetime/DateTimeUtil.js +3 -1
- package/esm/builder/index.d.ts +0 -1
- package/esm/builder/mergeLayoutHintConfigurations.d.ts +0 -1
- package/esm/constants/Constants.d.ts +0 -158
- package/esm/constants/LayoutHintConfig.d.ts +0 -267
- package/esm/constants/LayoutHints.d.ts +0 -83
- package/esm/constants/Settings.d.ts +0 -32
- package/esm/constants/index.d.ts +0 -3
- package/esm/exceptions/ConfigurationException.d.ts +0 -7
- package/esm/exceptions/FetchException.d.ts +0 -31
- package/esm/exceptions/IllegalArgumentException.d.ts +0 -7
- package/esm/exceptions/IllegalReturnException.d.ts +0 -6
- package/esm/exceptions/IllegalStateException.d.ts +0 -7
- package/esm/exceptions/JsonParseException.d.ts +0 -7
- package/esm/exceptions/MissingPropertyException.d.ts +0 -7
- package/esm/exceptions/NetworkException.d.ts +0 -9
- package/esm/exceptions/NotAllowedUriException.d.ts +0 -7
- package/esm/exceptions/NotFoundException.d.ts +0 -10
- package/esm/exceptions/ServerRequestException.d.ts +0 -7
- package/esm/exceptions/ThemePropertyException.d.ts +0 -7
- package/esm/exceptions/TimeoutException.d.ts +0 -7
- package/esm/exceptions/UnauthorizedException.d.ts +0 -11
- package/esm/exceptions/UnsupportedOperationException.d.ts +0 -7
- package/esm/exceptions/index.d.ts +0 -15
- package/esm/hooks/index.d.ts +0 -16
- package/esm/hooks/useAllFormsOnModel.d.ts +0 -7
- package/esm/hooks/useAuthentication.d.ts +0 -16
- package/esm/hooks/useContent.d.ts +0 -3
- package/esm/hooks/useDeepCompareEffect.d.ts +0 -6
- package/esm/hooks/useForm.d.ts +0 -21
- package/esm/hooks/useI18n.d.ts +0 -13
- package/esm/hooks/useModal.d.ts +0 -12
- package/esm/hooks/useModelCatalog.d.ts +0 -34
- package/esm/hooks/useModels.d.ts +0 -10
- package/esm/hooks/useModularUI.d.ts +0 -3
- package/esm/hooks/useModularUIBasic.d.ts +0 -9
- package/esm/hooks/useModularUIModel.d.ts +0 -27
- package/esm/hooks/useModularUIRequest.d.ts +0 -4
- package/esm/hooks/useNotification.d.ts +0 -8
- package/esm/hooks/usePreference.d.ts +0 -2
- package/esm/hooks/useProgressIndicator.d.ts +0 -9
- package/esm/hooks/useRouter.d.ts +0 -23
- package/esm/i18n/Locale.d.ts +0 -53
- package/esm/i18n/Locales.d.ts +0 -59
- package/esm/i18n/Message.d.ts +0 -6
- package/esm/i18n/index.d.ts +0 -5
- package/esm/i18n/languages.d.ts +0 -215
- package/esm/i18n/translations/beinformed_error_messages_en.nl.d.ts +0 -97
- package/esm/i18n/translations/beinformed_error_messages_nl.nl.d.ts +0 -97
- package/esm/i18n/types.d.ts +0 -11
- package/esm/i18n/withMessage.d.ts +0 -3
- package/esm/index.d.ts +0 -6
- package/esm/models/actions/ActionCollection.d.ts +0 -30
- package/esm/models/actions/ActionModel.d.ts +0 -82
- package/esm/models/application/ApplicationModel.d.ts +0 -48
- package/esm/models/attributes/AttributeCollection.d.ts +0 -102
- package/esm/models/attributes/AttributeContent.d.ts +0 -64
- package/esm/models/attributes/AttributeDataHelper.d.ts +0 -67
- package/esm/models/attributes/AttributeModel.d.ts +0 -398
- package/esm/models/attributes/AttributeSetModel.d.ts +0 -36
- package/esm/models/attributes/BooleanAttributeModel.d.ts +0 -69
- package/esm/models/attributes/CaptchaAttributeModel.d.ts +0 -19
- package/esm/models/attributes/ChoiceAttributeModel.d.ts +0 -85
- package/esm/models/attributes/ChoiceAttributeOptionCollection.d.ts +0 -87
- package/esm/models/attributes/ChoiceAttributeOptionModel.d.ts +0 -151
- package/esm/models/attributes/CompositeAttributeChildCollection.d.ts +0 -57
- package/esm/models/attributes/CompositeAttributeModel.d.ts +0 -42
- package/esm/models/attributes/DatetimeAttributeModel.d.ts +0 -85
- package/esm/models/attributes/HelptextAttributeModel.d.ts +0 -16
- package/esm/models/attributes/LabelAttributeModel.d.ts +0 -12
- package/esm/models/attributes/MemoAttributeModel.d.ts +0 -14
- package/esm/models/attributes/MoneyAttributeModel.d.ts +0 -14
- package/esm/models/attributes/NumberAttributeModel.d.ts +0 -49
- package/esm/models/attributes/PasswordAttributeModel.d.ts +0 -62
- package/esm/models/attributes/StringAttributeModel.d.ts +0 -65
- package/esm/models/attributes/UploadAttributeModel.d.ts +0 -60
- package/esm/models/attributes/XMLAttributeModel.d.ts +0 -10
- package/esm/models/attributes/_createAttribute.d.ts +0 -7
- package/esm/models/attributes/input-constraints/BSNConstraint.d.ts +0 -26
- package/esm/models/attributes/input-constraints/ConstraintCollection.d.ts +0 -24
- package/esm/models/attributes/input-constraints/ConstraintModel.d.ts +0 -34
- package/esm/models/attributes/input-constraints/DateBoundaryConstraint.d.ts +0 -65
- package/esm/models/attributes/input-constraints/DateTimeDateFormatConstraint.d.ts +0 -36
- package/esm/models/attributes/input-constraints/DateTimeTimeFormatConstraint.d.ts +0 -36
- package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.d.ts +0 -50
- package/esm/models/attributes/input-constraints/FileExtensionConstraint.d.ts +0 -33
- package/esm/models/attributes/input-constraints/FileSizeConstraint.d.ts +0 -42
- package/esm/models/attributes/input-constraints/IBANConstraint.d.ts +0 -23
- package/esm/models/attributes/input-constraints/MandatoryConstraint.d.ts +0 -23
- package/esm/models/attributes/input-constraints/MandatoryRangeConstraint.d.ts +0 -36
- package/esm/models/attributes/input-constraints/NumberBoundaryConstraint.d.ts +0 -61
- package/esm/models/attributes/input-constraints/NumberFormatConstraint.d.ts +0 -52
- package/esm/models/attributes/input-constraints/NumberGroupingConstraint.d.ts +0 -46
- package/esm/models/attributes/input-constraints/PasswordConfirmConstraint.d.ts +0 -36
- package/esm/models/attributes/input-constraints/PasswordLowerAndUpperCaseConstraint.d.ts +0 -23
- package/esm/models/attributes/input-constraints/PasswordMinNumericCharactersConstraint.d.ts +0 -32
- package/esm/models/attributes/input-constraints/PasswordMinSpecialCharactersConstraint.d.ts +0 -32
- package/esm/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.d.ts +0 -35
- package/esm/models/attributes/input-constraints/RangeConstraint.d.ts +0 -51
- package/esm/models/attributes/input-constraints/RegexConstraint.d.ts +0 -37
- package/esm/models/attributes/input-constraints/StringLengthConstraint.d.ts +0 -46
- package/esm/models/attributes/input-constraints/XMLConstraint.d.ts +0 -26
- package/esm/models/attributes/layouthint-rules/BaseLayoutHintRule.d.ts +0 -45
- package/esm/models/attributes/layouthint-rules/DependentAttribute.d.ts +0 -57
- package/esm/models/attributes/layouthint-rules/LayoutHintRuleCollection.d.ts +0 -27
- package/esm/models/attributes/layouthint-rules/RemainingTotalUploadSize.d.ts +0 -17
- package/esm/models/base/BaseCollection.d.ts +0 -89
- package/esm/models/base/BaseModel.d.ts +0 -78
- package/esm/models/base/ResourceCollection.d.ts +0 -20
- package/esm/models/base/ResourceModel.d.ts +0 -102
- package/esm/models/caseview/CaseViewModel.d.ts +0 -46
- package/esm/models/concepts/BusinessScenarioModel.d.ts +0 -20
- package/esm/models/concepts/ConceptDetailModel.d.ts +0 -86
- package/esm/models/concepts/ConceptIndexModel.d.ts +0 -44
- package/esm/models/concepts/ConceptLinkModel.d.ts +0 -82
- package/esm/models/concepts/ConceptRelationCollection.d.ts +0 -36
- package/esm/models/concepts/ConceptRelationModel.d.ts +0 -61
- package/esm/models/concepts/ConceptTypeDetailModel.d.ts +0 -54
- package/esm/models/concepts/SourceReferenceCollection.d.ts +0 -14
- package/esm/models/concepts/SourceReferenceModel.d.ts +0 -48
- package/esm/models/content/ContentIndexModel.d.ts +0 -41
- package/esm/models/content/ContentLinkModel.d.ts +0 -102
- package/esm/models/content/ContentModel.d.ts +0 -80
- package/esm/models/content/ContentTOCModel.d.ts +0 -56
- package/esm/models/content/ContentTypeModel.d.ts +0 -26
- package/esm/models/content/SectionModel.d.ts +0 -79
- package/esm/models/content/SubSectionModel.d.ts +0 -69
- package/esm/models/contentconfiguration/ContentConfiguration.d.ts +0 -28
- package/esm/models/contentconfiguration/ContentConfigurationElements.d.ts +0 -47
- package/esm/models/contentconfiguration/ContentConfigurationEndResults.d.ts +0 -16
- package/esm/models/contentconfiguration/ContentConfigurationQuestions.d.ts +0 -22
- package/esm/models/contentconfiguration/ContentConfigurationResults.d.ts +0 -39
- package/esm/models/detail/DetailModel.d.ts +0 -80
- package/esm/models/error/ErrorCollection.d.ts +0 -51
- package/esm/models/error/ErrorModel.d.ts +0 -41
- package/esm/models/error/ErrorResponse.d.ts +0 -156
- package/esm/models/filters/AssignmentFilterModel.d.ts +0 -35
- package/esm/models/filters/BaseFilterModel.d.ts +0 -101
- package/esm/models/filters/ConceptIndexFilterModel.d.ts +0 -6
- package/esm/models/filters/FilterCollection.d.ts +0 -49
- package/esm/models/filters/FilterModel.d.ts +0 -5
- package/esm/models/filters/RangeFilterModel.d.ts +0 -6
- package/esm/models/filters/StringFilterModel.d.ts +0 -30
- package/esm/models/form/FormModel.d.ts +0 -350
- package/esm/models/form/FormObjectModel.d.ts +0 -210
- package/esm/models/grouping/GroupingModel.d.ts +0 -86
- package/esm/models/href/Href.d.ts +0 -218
- package/esm/models/href/ListHref.d.ts +0 -64
- package/esm/models/index.d.ts +0 -96
- package/esm/models/layouthint/LayoutHintCollection.d.ts +0 -43
- package/esm/models/links/LinkCollection.d.ts +0 -71
- package/esm/models/links/LinkModel.d.ts +0 -93
- package/esm/models/links/normalizeLinkJSON.d.ts +0 -9
- package/esm/models/list/ListDetailModel.d.ts +0 -69
- package/esm/models/list/ListHeaderModel.d.ts +0 -53
- package/esm/models/list/ListItemCollection.d.ts +0 -21
- package/esm/models/list/ListItemModel.d.ts +0 -35
- package/esm/models/list/ListModel.d.ts +0 -143
- package/esm/models/lookup/LookupOptionCollection.d.ts +0 -15
- package/esm/models/lookup/LookupOptionsModel.d.ts +0 -23
- package/esm/models/modelcatalog/ModelCatalogModel.d.ts +0 -23
- package/esm/models/modelcatalog/ModelCategoryCollection.d.ts +0 -11
- package/esm/models/modelcatalog/ModelCategoryModel.d.ts +0 -39
- package/esm/models/paging/PagesizeModel.d.ts +0 -25
- package/esm/models/paging/PagingModel.d.ts +0 -49
- package/esm/models/panels/GroupingPanelModel.d.ts +0 -49
- package/esm/models/parameter/Parameter.d.ts +0 -40
- package/esm/models/process/ProcessStatusSettingsModel.d.ts +0 -38
- package/esm/models/resolveModel.d.ts +0 -7
- package/esm/models/search/CaseSearchModel.d.ts +0 -14
- package/esm/models/sorting/SortOptionModel.d.ts +0 -48
- package/esm/models/sorting/SortingModel.d.ts +0 -42
- package/esm/models/tab/TabModel.d.ts +0 -53
- package/esm/models/taskgroup/TaskGroupCollection.d.ts +0 -12
- package/esm/models/taskgroup/TaskGroupModel.d.ts +0 -25
- package/esm/models/types.d.ts +0 -171
- package/esm/models/user/UserModel.d.ts +0 -18
- package/esm/models/user/UserProfileModel.d.ts +0 -17
- package/esm/models/user/UserServicesModel.d.ts +0 -39
- package/esm/modularui/Authenticate.d.ts +0 -46
- package/esm/modularui/CaptchaRequest.d.ts +0 -54
- package/esm/modularui/ModularUIError.d.ts +0 -10
- package/esm/modularui/ModularUIRequest.d.ts +0 -207
- package/esm/modularui/ModularUIResponse.d.ts +0 -78
- package/esm/modularui/UploadRequest.d.ts +0 -41
- package/esm/modularui/index.d.ts +0 -5
- package/esm/modularui/types.d.ts +0 -2
- package/esm/react/ErrorBoundary.d.ts +0 -31
- package/esm/react/ErrorBoundaryFallback.d.ts +0 -8
- package/esm/react/index.d.ts +0 -2
- package/esm/react/utils.d.ts +0 -5
- package/esm/react-client/Init.d.ts +0 -6
- package/esm/react-client/client.d.ts +0 -25
- package/esm/react-client/contextPath.d.ts +0 -1
- package/esm/react-client/index.d.ts +0 -3
- package/esm/react-client/rehydrate.d.ts +0 -5
- package/esm/react-server/contextPath.d.ts +0 -1
- package/esm/react-server/createSSRComplete.d.ts +0 -5
- package/esm/react-server/htmlpage.d.ts +0 -11
- package/esm/react-server/index.d.ts +0 -8
- package/esm/react-server/renderSSRComplete.d.ts +0 -13
- package/esm/react-server/renderSSRMinimal.d.ts +0 -11
- package/esm/react-server/requestInformation.d.ts +0 -6
- package/esm/react-server/serverNoSSR.d.ts +0 -15
- package/esm/react-server/serverSSR.d.ts +0 -15
- package/esm/react-server/serverUtil.d.ts +0 -46
- package/esm/react-theme/ThemeProvider.d.ts +0 -8
- package/esm/react-theme/createTheme.d.ts +0 -53
- package/esm/react-theme/index.d.ts +0 -10
- package/esm/react-theme/types.d.ts +0 -13
- package/esm/react-theme/useTheme.d.ts +0 -4
- package/esm/react-theme/utils/background.d.ts +0 -4
- package/esm/react-theme/utils/colors.d.ts +0 -9
- package/esm/react-theme/utils/contrast.d.ts +0 -18
- package/esm/react-theme/utils/corners.d.ts +0 -3
- package/esm/react-theme/utils/spacers.d.ts +0 -9
- package/esm/react-theme/utils/themeProps.d.ts +0 -7
- package/esm/redux/_i18n/I18nActions.d.ts +0 -7
- package/esm/redux/_i18n/I18nReducer.d.ts +0 -7
- package/esm/redux/_i18n/index.d.ts +0 -3
- package/esm/redux/_i18n/types.d.ts +0 -13
- package/esm/redux/_modularui/ModularUIActions.d.ts +0 -26
- package/esm/redux/_modularui/ModularUIConnector.d.ts +0 -7
- package/esm/redux/_modularui/ModularUIMiddleware.d.ts +0 -7
- package/esm/redux/_modularui/ModularUIReducer.d.ts +0 -7
- package/esm/redux/_modularui/ModularUISelectors.d.ts +0 -3
- package/esm/redux/_modularui/ModularUIUtils.d.ts +0 -5
- package/esm/redux/_modularui/index.d.ts +0 -8
- package/esm/redux/_modularui/types.d.ts +0 -84
- package/esm/redux/_modularui/withModularUI.d.ts +0 -3
- package/esm/redux/_router/RouterActions.d.ts +0 -10
- package/esm/redux/_router/RouterConnectors.d.ts +0 -6
- package/esm/redux/_router/RouterMiddleware.d.ts +0 -5
- package/esm/redux/_router/RouterReducer.d.ts +0 -7
- package/esm/redux/_router/index.d.ts +0 -5
- package/esm/redux/_router/types.d.ts +0 -35
- package/esm/redux/actions/Application.d.ts +0 -4
- package/esm/redux/actions/Authorization.d.ts +0 -3
- package/esm/redux/actions/Error.d.ts +0 -7
- package/esm/redux/actions/Form.d.ts +0 -5
- package/esm/redux/actions/FormAttributeSet.d.ts +0 -6
- package/esm/redux/actions/FormAttributeSetRepeatable.d.ts +0 -6
- package/esm/redux/actions/FormAutosave.d.ts +0 -3
- package/esm/redux/actions/FormAutosubmit.d.ts +0 -4
- package/esm/redux/actions/FormAutoupdate.d.ts +0 -4
- package/esm/redux/actions/FormValidations.d.ts +0 -3
- package/esm/redux/actions/Modals.d.ts +0 -4
- package/esm/redux/actions/ModelCatalog.d.ts +0 -2
- package/esm/redux/actions/Notification.d.ts +0 -10
- package/esm/redux/actions/Preferences.d.ts +0 -11
- package/esm/redux/actions/ProgressIndicator.d.ts +0 -8
- package/esm/redux/actions/SignIn.d.ts +0 -10
- package/esm/redux/actions/SignOut.d.ts +0 -4
- package/esm/redux/actions/index.d.ts +0 -16
- package/esm/redux/connectors/Application.d.ts +0 -4
- package/esm/redux/connectors/Breadcrumb.d.ts +0 -3
- package/esm/redux/connectors/CaseView.d.ts +0 -4
- package/esm/redux/connectors/ConceptDetail.d.ts +0 -4
- package/esm/redux/connectors/ContentBrowser.d.ts +0 -4
- package/esm/redux/connectors/ContentDetail.d.ts +0 -4
- package/esm/redux/connectors/ContentDetailSection.d.ts +0 -4
- package/esm/redux/connectors/Form.d.ts +0 -16
- package/esm/redux/connectors/FormAttributeSet.d.ts +0 -5
- package/esm/redux/connectors/ListDetail.d.ts +0 -4
- package/esm/redux/connectors/Modal.d.ts +0 -4
- package/esm/redux/connectors/ModelCatalog.d.ts +0 -4
- package/esm/redux/connectors/Notification.d.ts +0 -4
- package/esm/redux/connectors/PanelRenderer.d.ts +0 -4
- package/esm/redux/connectors/Preferences.d.ts +0 -2
- package/esm/redux/connectors/Progress.d.ts +0 -3
- package/esm/redux/connectors/ProgressIndicator.d.ts +0 -3
- package/esm/redux/connectors/QuickSearch.d.ts +0 -11
- package/esm/redux/connectors/SignIn.d.ts +0 -4
- package/esm/redux/connectors/SignOut.d.ts +0 -4
- package/esm/redux/connectors/Tab.d.ts +0 -4
- package/esm/redux/connectors/index.d.ts +0 -21
- package/esm/redux/index.d.ts +0 -9
- package/esm/redux/reducers/AuthReducer.d.ts +0 -8
- package/esm/redux/reducers/ErrorReducer.d.ts +0 -8
- package/esm/redux/reducers/ModalsReducer.d.ts +0 -8
- package/esm/redux/reducers/ModelCatalogReducer.d.ts +0 -8
- package/esm/redux/reducers/NotificationReducer.d.ts +0 -8
- package/esm/redux/reducers/PreferencesReducer.d.ts +0 -8
- package/esm/redux/reducers/ProgressIndicatorReducer.d.ts +0 -8
- package/esm/redux/reducers/createReducer.d.ts +0 -14
- package/esm/redux/reducers/index.d.ts +0 -8
- package/esm/redux/selectors/i18n.d.ts +0 -4
- package/esm/redux/selectors/index.d.ts +0 -2
- package/esm/redux/selectors/modelcatalog.d.ts +0 -2
- package/esm/redux/store/beforeRenderHooks.d.ts +0 -7
- package/esm/redux/store/configureStore.d.ts +0 -9
- package/esm/redux/types.d.ts +0 -113
- package/esm/utils/browser/Cache.d.ts +0 -45
- package/esm/utils/browser/Cookies.d.ts +0 -9
- package/esm/utils/datetime/DateTimeUtil.d.ts +0 -214
- package/esm/utils/fetch/__mocks__/universalFetch.d.ts +0 -3
- package/esm/utils/fetch/serverFetch.d.ts +0 -5
- package/esm/utils/fetch/types.d.ts +0 -44
- package/esm/utils/fetch/universalFetch.d.ts +0 -7
- package/esm/utils/fetch/xhr.d.ts +0 -5
- package/esm/utils/helpers/checkResource.d.ts +0 -3
- package/esm/utils/helpers/createHash.d.ts +0 -9
- package/esm/utils/helpers/createHref.d.ts +0 -8
- package/esm/utils/helpers/createUUID.d.ts +0 -4
- package/esm/utils/helpers/index.d.ts +0 -8
- package/esm/utils/helpers/objects.d.ts +0 -11
- package/esm/utils/helpers/repositoryResource.d.ts +0 -1
- package/esm/utils/helpers/sanitizeHtml.d.ts +0 -9
- package/esm/utils/helpers/text.d.ts +0 -7
- package/esm/utils/index.d.ts +0 -11
- package/esm/utils/number/DecimalFormat.d.ts +0 -90
- package/esm/utils/number/formatValue.d.ts +0 -4
- package/esm/utils/number/parseNumbers.d.ts +0 -9
- package/lib/builder/index.d.ts +0 -1
- package/lib/builder/mergeLayoutHintConfigurations.d.ts +0 -1
- package/lib/constants/Constants.d.ts +0 -158
- package/lib/constants/LayoutHintConfig.d.ts +0 -267
- package/lib/constants/LayoutHints.d.ts +0 -83
- package/lib/constants/Settings.d.ts +0 -32
- package/lib/constants/index.d.ts +0 -3
- package/lib/exceptions/ConfigurationException.d.ts +0 -7
- package/lib/exceptions/FetchException.d.ts +0 -31
- package/lib/exceptions/IllegalArgumentException.d.ts +0 -7
- package/lib/exceptions/IllegalReturnException.d.ts +0 -6
- package/lib/exceptions/IllegalStateException.d.ts +0 -7
- package/lib/exceptions/JsonParseException.d.ts +0 -7
- package/lib/exceptions/MissingPropertyException.d.ts +0 -7
- package/lib/exceptions/NetworkException.d.ts +0 -9
- package/lib/exceptions/NotAllowedUriException.d.ts +0 -7
- package/lib/exceptions/NotFoundException.d.ts +0 -10
- package/lib/exceptions/ServerRequestException.d.ts +0 -7
- package/lib/exceptions/ThemePropertyException.d.ts +0 -7
- package/lib/exceptions/TimeoutException.d.ts +0 -7
- package/lib/exceptions/UnauthorizedException.d.ts +0 -11
- package/lib/exceptions/UnsupportedOperationException.d.ts +0 -7
- package/lib/exceptions/index.d.ts +0 -15
- package/lib/hooks/index.d.ts +0 -16
- package/lib/hooks/useAllFormsOnModel.d.ts +0 -7
- package/lib/hooks/useAuthentication.d.ts +0 -16
- package/lib/hooks/useContent.d.ts +0 -3
- package/lib/hooks/useDeepCompareEffect.d.ts +0 -6
- package/lib/hooks/useForm.d.ts +0 -21
- package/lib/hooks/useI18n.d.ts +0 -13
- package/lib/hooks/useModal.d.ts +0 -12
- package/lib/hooks/useModelCatalog.d.ts +0 -34
- package/lib/hooks/useModels.d.ts +0 -10
- package/lib/hooks/useModularUI.d.ts +0 -3
- package/lib/hooks/useModularUIBasic.d.ts +0 -9
- package/lib/hooks/useModularUIModel.d.ts +0 -27
- package/lib/hooks/useModularUIRequest.d.ts +0 -4
- package/lib/hooks/useNotification.d.ts +0 -8
- package/lib/hooks/usePreference.d.ts +0 -2
- package/lib/hooks/useProgressIndicator.d.ts +0 -9
- package/lib/hooks/useRouter.d.ts +0 -23
- package/lib/i18n/Locale.d.ts +0 -53
- package/lib/i18n/Locales.d.ts +0 -59
- package/lib/i18n/Message.d.ts +0 -6
- package/lib/i18n/index.d.ts +0 -5
- package/lib/i18n/languages.d.ts +0 -215
- package/lib/i18n/translations/beinformed_error_messages_en.nl.d.ts +0 -97
- package/lib/i18n/translations/beinformed_error_messages_nl.nl.d.ts +0 -97
- package/lib/i18n/types.d.ts +0 -11
- package/lib/i18n/withMessage.d.ts +0 -3
- package/lib/index.d.ts +0 -6
- package/lib/models/actions/ActionCollection.d.ts +0 -30
- package/lib/models/actions/ActionModel.d.ts +0 -82
- package/lib/models/application/ApplicationModel.d.ts +0 -48
- package/lib/models/attributes/AttributeCollection.d.ts +0 -102
- package/lib/models/attributes/AttributeContent.d.ts +0 -64
- package/lib/models/attributes/AttributeDataHelper.d.ts +0 -67
- package/lib/models/attributes/AttributeModel.d.ts +0 -398
- package/lib/models/attributes/AttributeSetModel.d.ts +0 -36
- package/lib/models/attributes/BooleanAttributeModel.d.ts +0 -69
- package/lib/models/attributes/CaptchaAttributeModel.d.ts +0 -19
- package/lib/models/attributes/ChoiceAttributeModel.d.ts +0 -85
- package/lib/models/attributes/ChoiceAttributeOptionCollection.d.ts +0 -87
- package/lib/models/attributes/ChoiceAttributeOptionModel.d.ts +0 -151
- package/lib/models/attributes/CompositeAttributeChildCollection.d.ts +0 -57
- package/lib/models/attributes/CompositeAttributeModel.d.ts +0 -42
- package/lib/models/attributes/DatetimeAttributeModel.d.ts +0 -85
- package/lib/models/attributes/HelptextAttributeModel.d.ts +0 -16
- package/lib/models/attributes/LabelAttributeModel.d.ts +0 -12
- package/lib/models/attributes/MemoAttributeModel.d.ts +0 -14
- package/lib/models/attributes/MoneyAttributeModel.d.ts +0 -14
- package/lib/models/attributes/NumberAttributeModel.d.ts +0 -49
- package/lib/models/attributes/PasswordAttributeModel.d.ts +0 -62
- package/lib/models/attributes/StringAttributeModel.d.ts +0 -65
- package/lib/models/attributes/UploadAttributeModel.d.ts +0 -60
- package/lib/models/attributes/XMLAttributeModel.d.ts +0 -10
- package/lib/models/attributes/_createAttribute.d.ts +0 -7
- package/lib/models/attributes/input-constraints/BSNConstraint.d.ts +0 -26
- package/lib/models/attributes/input-constraints/ConstraintCollection.d.ts +0 -24
- package/lib/models/attributes/input-constraints/ConstraintModel.d.ts +0 -34
- package/lib/models/attributes/input-constraints/DateBoundaryConstraint.d.ts +0 -65
- package/lib/models/attributes/input-constraints/DateTimeDateFormatConstraint.d.ts +0 -36
- package/lib/models/attributes/input-constraints/DateTimeTimeFormatConstraint.d.ts +0 -36
- package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.d.ts +0 -50
- package/lib/models/attributes/input-constraints/FileExtensionConstraint.d.ts +0 -33
- package/lib/models/attributes/input-constraints/FileSizeConstraint.d.ts +0 -42
- package/lib/models/attributes/input-constraints/IBANConstraint.d.ts +0 -23
- package/lib/models/attributes/input-constraints/MandatoryConstraint.d.ts +0 -23
- package/lib/models/attributes/input-constraints/MandatoryRangeConstraint.d.ts +0 -36
- package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.d.ts +0 -61
- package/lib/models/attributes/input-constraints/NumberFormatConstraint.d.ts +0 -52
- package/lib/models/attributes/input-constraints/NumberGroupingConstraint.d.ts +0 -46
- package/lib/models/attributes/input-constraints/PasswordConfirmConstraint.d.ts +0 -36
- package/lib/models/attributes/input-constraints/PasswordLowerAndUpperCaseConstraint.d.ts +0 -23
- package/lib/models/attributes/input-constraints/PasswordMinNumericCharactersConstraint.d.ts +0 -32
- package/lib/models/attributes/input-constraints/PasswordMinSpecialCharactersConstraint.d.ts +0 -32
- package/lib/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.d.ts +0 -35
- package/lib/models/attributes/input-constraints/RangeConstraint.d.ts +0 -51
- package/lib/models/attributes/input-constraints/RegexConstraint.d.ts +0 -37
- package/lib/models/attributes/input-constraints/StringLengthConstraint.d.ts +0 -46
- package/lib/models/attributes/input-constraints/XMLConstraint.d.ts +0 -26
- package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.d.ts +0 -45
- package/lib/models/attributes/layouthint-rules/DependentAttribute.d.ts +0 -57
- package/lib/models/attributes/layouthint-rules/LayoutHintRuleCollection.d.ts +0 -27
- package/lib/models/attributes/layouthint-rules/RemainingTotalUploadSize.d.ts +0 -17
- package/lib/models/base/BaseCollection.d.ts +0 -89
- package/lib/models/base/BaseModel.d.ts +0 -78
- package/lib/models/base/ResourceCollection.d.ts +0 -20
- package/lib/models/base/ResourceModel.d.ts +0 -102
- package/lib/models/caseview/CaseViewModel.d.ts +0 -46
- package/lib/models/concepts/BusinessScenarioModel.d.ts +0 -20
- package/lib/models/concepts/ConceptDetailModel.d.ts +0 -86
- package/lib/models/concepts/ConceptIndexModel.d.ts +0 -44
- package/lib/models/concepts/ConceptLinkModel.d.ts +0 -82
- package/lib/models/concepts/ConceptRelationCollection.d.ts +0 -36
- package/lib/models/concepts/ConceptRelationModel.d.ts +0 -61
- package/lib/models/concepts/ConceptTypeDetailModel.d.ts +0 -54
- package/lib/models/concepts/SourceReferenceCollection.d.ts +0 -14
- package/lib/models/concepts/SourceReferenceModel.d.ts +0 -48
- package/lib/models/content/ContentIndexModel.d.ts +0 -41
- package/lib/models/content/ContentLinkModel.d.ts +0 -102
- package/lib/models/content/ContentModel.d.ts +0 -80
- package/lib/models/content/ContentTOCModel.d.ts +0 -56
- package/lib/models/content/ContentTypeModel.d.ts +0 -26
- package/lib/models/content/SectionModel.d.ts +0 -79
- package/lib/models/content/SubSectionModel.d.ts +0 -69
- package/lib/models/contentconfiguration/ContentConfiguration.d.ts +0 -28
- package/lib/models/contentconfiguration/ContentConfigurationElements.d.ts +0 -47
- package/lib/models/contentconfiguration/ContentConfigurationEndResults.d.ts +0 -16
- package/lib/models/contentconfiguration/ContentConfigurationQuestions.d.ts +0 -22
- package/lib/models/contentconfiguration/ContentConfigurationResults.d.ts +0 -39
- package/lib/models/detail/DetailModel.d.ts +0 -80
- package/lib/models/error/ErrorCollection.d.ts +0 -51
- package/lib/models/error/ErrorModel.d.ts +0 -41
- package/lib/models/error/ErrorResponse.d.ts +0 -156
- package/lib/models/filters/AssignmentFilterModel.d.ts +0 -35
- package/lib/models/filters/BaseFilterModel.d.ts +0 -101
- package/lib/models/filters/ConceptIndexFilterModel.d.ts +0 -6
- package/lib/models/filters/FilterCollection.d.ts +0 -49
- package/lib/models/filters/FilterModel.d.ts +0 -5
- package/lib/models/filters/RangeFilterModel.d.ts +0 -6
- package/lib/models/filters/StringFilterModel.d.ts +0 -30
- package/lib/models/form/FormModel.d.ts +0 -350
- package/lib/models/form/FormObjectModel.d.ts +0 -210
- package/lib/models/grouping/GroupingModel.d.ts +0 -86
- package/lib/models/href/Href.d.ts +0 -218
- package/lib/models/href/ListHref.d.ts +0 -64
- package/lib/models/index.d.ts +0 -96
- package/lib/models/layouthint/LayoutHintCollection.d.ts +0 -43
- package/lib/models/links/LinkCollection.d.ts +0 -71
- package/lib/models/links/LinkModel.d.ts +0 -93
- package/lib/models/links/normalizeLinkJSON.d.ts +0 -9
- package/lib/models/list/ListDetailModel.d.ts +0 -69
- package/lib/models/list/ListHeaderModel.d.ts +0 -53
- package/lib/models/list/ListItemCollection.d.ts +0 -21
- package/lib/models/list/ListItemModel.d.ts +0 -35
- package/lib/models/list/ListModel.d.ts +0 -143
- package/lib/models/lookup/LookupOptionCollection.d.ts +0 -15
- package/lib/models/lookup/LookupOptionsModel.d.ts +0 -23
- package/lib/models/modelcatalog/ModelCatalogModel.d.ts +0 -23
- package/lib/models/modelcatalog/ModelCategoryCollection.d.ts +0 -11
- package/lib/models/modelcatalog/ModelCategoryModel.d.ts +0 -39
- package/lib/models/paging/PagesizeModel.d.ts +0 -25
- package/lib/models/paging/PagingModel.d.ts +0 -49
- package/lib/models/panels/GroupingPanelModel.d.ts +0 -49
- package/lib/models/parameter/Parameter.d.ts +0 -40
- package/lib/models/process/ProcessStatusSettingsModel.d.ts +0 -38
- package/lib/models/resolveModel.d.ts +0 -7
- package/lib/models/search/CaseSearchModel.d.ts +0 -14
- package/lib/models/sorting/SortOptionModel.d.ts +0 -48
- package/lib/models/sorting/SortingModel.d.ts +0 -42
- package/lib/models/tab/TabModel.d.ts +0 -53
- package/lib/models/taskgroup/TaskGroupCollection.d.ts +0 -12
- package/lib/models/taskgroup/TaskGroupModel.d.ts +0 -25
- package/lib/models/types.d.ts +0 -171
- package/lib/models/user/UserModel.d.ts +0 -18
- package/lib/models/user/UserProfileModel.d.ts +0 -17
- package/lib/models/user/UserServicesModel.d.ts +0 -39
- package/lib/modularui/Authenticate.d.ts +0 -46
- package/lib/modularui/CaptchaRequest.d.ts +0 -54
- package/lib/modularui/ModularUIError.d.ts +0 -10
- package/lib/modularui/ModularUIRequest.d.ts +0 -207
- package/lib/modularui/ModularUIResponse.d.ts +0 -78
- package/lib/modularui/UploadRequest.d.ts +0 -41
- package/lib/modularui/index.d.ts +0 -5
- package/lib/modularui/types.d.ts +0 -2
- package/lib/react/ErrorBoundary.d.ts +0 -31
- package/lib/react/ErrorBoundaryFallback.d.ts +0 -8
- package/lib/react/index.d.ts +0 -2
- package/lib/react/utils.d.ts +0 -5
- package/lib/react-client/Init.d.ts +0 -6
- package/lib/react-client/client.d.ts +0 -25
- package/lib/react-client/contextPath.d.ts +0 -1
- package/lib/react-client/index.d.ts +0 -3
- package/lib/react-client/rehydrate.d.ts +0 -5
- package/lib/react-server/contextPath.d.ts +0 -1
- package/lib/react-server/createSSRComplete.d.ts +0 -5
- package/lib/react-server/htmlpage.d.ts +0 -11
- package/lib/react-server/index.d.ts +0 -8
- package/lib/react-server/renderSSRComplete.d.ts +0 -13
- package/lib/react-server/renderSSRMinimal.d.ts +0 -11
- package/lib/react-server/requestInformation.d.ts +0 -6
- package/lib/react-server/serverNoSSR.d.ts +0 -15
- package/lib/react-server/serverSSR.d.ts +0 -15
- package/lib/react-server/serverUtil.d.ts +0 -46
- package/lib/react-theme/ThemeProvider.d.ts +0 -8
- package/lib/react-theme/createTheme.d.ts +0 -53
- package/lib/react-theme/index.d.ts +0 -10
- package/lib/react-theme/types.d.ts +0 -13
- package/lib/react-theme/useTheme.d.ts +0 -4
- package/lib/react-theme/utils/background.d.ts +0 -4
- package/lib/react-theme/utils/colors.d.ts +0 -9
- package/lib/react-theme/utils/contrast.d.ts +0 -18
- package/lib/react-theme/utils/corners.d.ts +0 -3
- package/lib/react-theme/utils/spacers.d.ts +0 -9
- package/lib/react-theme/utils/themeProps.d.ts +0 -7
- package/lib/redux/_i18n/I18nActions.d.ts +0 -7
- package/lib/redux/_i18n/I18nReducer.d.ts +0 -7
- package/lib/redux/_i18n/index.d.ts +0 -3
- package/lib/redux/_i18n/types.d.ts +0 -13
- package/lib/redux/_modularui/ModularUIActions.d.ts +0 -26
- package/lib/redux/_modularui/ModularUIConnector.d.ts +0 -7
- package/lib/redux/_modularui/ModularUIMiddleware.d.ts +0 -7
- package/lib/redux/_modularui/ModularUIReducer.d.ts +0 -7
- package/lib/redux/_modularui/ModularUISelectors.d.ts +0 -3
- package/lib/redux/_modularui/ModularUIUtils.d.ts +0 -5
- package/lib/redux/_modularui/index.d.ts +0 -8
- package/lib/redux/_modularui/types.d.ts +0 -84
- package/lib/redux/_modularui/withModularUI.d.ts +0 -3
- package/lib/redux/_router/RouterActions.d.ts +0 -10
- package/lib/redux/_router/RouterConnectors.d.ts +0 -6
- package/lib/redux/_router/RouterMiddleware.d.ts +0 -5
- package/lib/redux/_router/RouterReducer.d.ts +0 -7
- package/lib/redux/_router/index.d.ts +0 -5
- package/lib/redux/_router/types.d.ts +0 -35
- package/lib/redux/actions/Application.d.ts +0 -4
- package/lib/redux/actions/Authorization.d.ts +0 -3
- package/lib/redux/actions/Error.d.ts +0 -7
- package/lib/redux/actions/Form.d.ts +0 -5
- package/lib/redux/actions/FormAttributeSet.d.ts +0 -6
- package/lib/redux/actions/FormAttributeSetRepeatable.d.ts +0 -6
- package/lib/redux/actions/FormAutosave.d.ts +0 -3
- package/lib/redux/actions/FormAutosubmit.d.ts +0 -4
- package/lib/redux/actions/FormAutoupdate.d.ts +0 -4
- package/lib/redux/actions/FormValidations.d.ts +0 -3
- package/lib/redux/actions/Modals.d.ts +0 -4
- package/lib/redux/actions/ModelCatalog.d.ts +0 -2
- package/lib/redux/actions/Notification.d.ts +0 -10
- package/lib/redux/actions/Preferences.d.ts +0 -11
- package/lib/redux/actions/ProgressIndicator.d.ts +0 -8
- package/lib/redux/actions/SignIn.d.ts +0 -10
- package/lib/redux/actions/SignOut.d.ts +0 -4
- package/lib/redux/actions/index.d.ts +0 -16
- package/lib/redux/connectors/Application.d.ts +0 -4
- package/lib/redux/connectors/Breadcrumb.d.ts +0 -3
- package/lib/redux/connectors/CaseView.d.ts +0 -4
- package/lib/redux/connectors/ConceptDetail.d.ts +0 -4
- package/lib/redux/connectors/ContentBrowser.d.ts +0 -4
- package/lib/redux/connectors/ContentDetail.d.ts +0 -4
- package/lib/redux/connectors/ContentDetailSection.d.ts +0 -4
- package/lib/redux/connectors/Form.d.ts +0 -16
- package/lib/redux/connectors/FormAttributeSet.d.ts +0 -5
- package/lib/redux/connectors/ListDetail.d.ts +0 -4
- package/lib/redux/connectors/Modal.d.ts +0 -4
- package/lib/redux/connectors/ModelCatalog.d.ts +0 -4
- package/lib/redux/connectors/Notification.d.ts +0 -4
- package/lib/redux/connectors/PanelRenderer.d.ts +0 -4
- package/lib/redux/connectors/Preferences.d.ts +0 -2
- package/lib/redux/connectors/Progress.d.ts +0 -3
- package/lib/redux/connectors/ProgressIndicator.d.ts +0 -3
- package/lib/redux/connectors/QuickSearch.d.ts +0 -11
- package/lib/redux/connectors/SignIn.d.ts +0 -4
- package/lib/redux/connectors/SignOut.d.ts +0 -4
- package/lib/redux/connectors/Tab.d.ts +0 -4
- package/lib/redux/connectors/index.d.ts +0 -21
- package/lib/redux/index.d.ts +0 -9
- package/lib/redux/reducers/AuthReducer.d.ts +0 -8
- package/lib/redux/reducers/ErrorReducer.d.ts +0 -8
- package/lib/redux/reducers/ModalsReducer.d.ts +0 -8
- package/lib/redux/reducers/ModelCatalogReducer.d.ts +0 -8
- package/lib/redux/reducers/NotificationReducer.d.ts +0 -8
- package/lib/redux/reducers/PreferencesReducer.d.ts +0 -8
- package/lib/redux/reducers/ProgressIndicatorReducer.d.ts +0 -8
- package/lib/redux/reducers/createReducer.d.ts +0 -14
- package/lib/redux/reducers/index.d.ts +0 -8
- package/lib/redux/selectors/i18n.d.ts +0 -4
- package/lib/redux/selectors/index.d.ts +0 -2
- package/lib/redux/selectors/modelcatalog.d.ts +0 -2
- package/lib/redux/store/beforeRenderHooks.d.ts +0 -7
- package/lib/redux/store/configureStore.d.ts +0 -9
- package/lib/redux/types.d.ts +0 -113
- package/lib/utils/browser/Cache.d.ts +0 -45
- package/lib/utils/browser/Cookies.d.ts +0 -9
- package/lib/utils/datetime/DateTimeUtil.d.ts +0 -214
- package/lib/utils/fetch/__mocks__/universalFetch.d.ts +0 -3
- package/lib/utils/fetch/serverFetch.d.ts +0 -5
- package/lib/utils/fetch/types.d.ts +0 -44
- package/lib/utils/fetch/universalFetch.d.ts +0 -7
- package/lib/utils/fetch/xhr.d.ts +0 -5
- package/lib/utils/helpers/checkResource.d.ts +0 -3
- package/lib/utils/helpers/createHash.d.ts +0 -9
- package/lib/utils/helpers/createHref.d.ts +0 -8
- package/lib/utils/helpers/createUUID.d.ts +0 -4
- package/lib/utils/helpers/index.d.ts +0 -8
- package/lib/utils/helpers/objects.d.ts +0 -11
- package/lib/utils/helpers/repositoryResource.d.ts +0 -1
- package/lib/utils/helpers/sanitizeHtml.d.ts +0 -9
- package/lib/utils/helpers/text.d.ts +0 -7
- package/lib/utils/index.d.ts +0 -11
- package/lib/utils/number/DecimalFormat.d.ts +0 -90
- package/lib/utils/number/formatValue.d.ts +0 -4
- package/lib/utils/number/parseNumbers.d.ts +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.62.9](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.8...v1.62.9) (2025-06-30)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **server-request:** escape deeplink ([07c24a7](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/07c24a727806e7cfe3b2fc154886e9187ca93759))
|
|
11
|
+
|
|
12
|
+
## [1.62.8](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.7...v1.62.8) (2025-06-27)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **locale-cookie:** only set cookie when more then one locale is present ([54daf0a](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/54daf0a8192b5539faf63048cd663539bce6fc02))
|
|
18
|
+
* **locale:** handle missing locales ([58137d0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/58137d0fcfb37d54c9d717bee2159c293ad27341))
|
|
19
|
+
* **settings:** improve loading of custom settings ([4fbe043](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/4fbe04338d56610986ad96a73267270da25daabc))
|
|
20
|
+
|
|
5
21
|
## [1.62.7](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.6...v1.62.7) (2025-06-23)
|
|
6
22
|
|
|
7
23
|
|
|
@@ -144,6 +144,10 @@ export const hasAllContentInData = () => getSetting(ALL_CONTENT_IN_DATA_SETTING,
|
|
|
144
144
|
*/
|
|
145
145
|
export const isIncludeTimeOffsetInDateTimes = () => getSetting(INCLUDE_TIME_OFFSET, false);
|
|
146
146
|
|
|
147
|
+
/**
|
|
148
|
+
*/
|
|
149
|
+
export const getEnabledLocales = () => getSetting("ENABLED_LOCALES", ["en"]);
|
|
150
|
+
|
|
147
151
|
/**
|
|
148
152
|
* Login type, only available when pac4j is configured
|
|
149
153
|
*
|
|
@@ -145,7 +145,6 @@ export const getSetting = (key: string, defaultValue?: any): any => {
|
|
|
145
145
|
`Setting with name ${key} not found and no defaultValue given`,
|
|
146
146
|
);
|
|
147
147
|
}
|
|
148
|
-
|
|
149
148
|
return settings[key] ?? defaultValue;
|
|
150
149
|
};
|
|
151
150
|
|
|
@@ -210,6 +209,11 @@ export const hasAllContentInData = (): boolean =>
|
|
|
210
209
|
export const isIncludeTimeOffsetInDateTimes = (): boolean =>
|
|
211
210
|
getSetting(INCLUDE_TIME_OFFSET, false);
|
|
212
211
|
|
|
212
|
+
/**
|
|
213
|
+
*/
|
|
214
|
+
export const getEnabledLocales = (): Array<string> =>
|
|
215
|
+
getSetting("ENABLED_LOCALES", ["en"]);
|
|
216
|
+
|
|
213
217
|
/**
|
|
214
218
|
* Login type, only available when pac4j is configured
|
|
215
219
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","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","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","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","XHR_ALWAYS_WITH_CREDENTIALS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","COMPLETE_SOURCE","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","arguments","length","origin","getCaptchaPath","hasAllContentInData","isIncludeTimeOffsetInDateTimes","loginType","JAAS","loginPath","clientName","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","_startsWithInstanceProperty","call","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\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 BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\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 XHR_ALWAYS_WITH_CREDENTIALS: false,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n\n COMPLETE_SOURCE: 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 * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually override by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n */\nexport const isIncludeTimeOffsetInDateTimes = (): boolean =>\n getSetting(INCLUDE_TIME_OFFSET, false);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\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, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnB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L_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","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","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","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","XHR_ALWAYS_WITH_CREDENTIALS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","COMPLETE_SOURCE","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","arguments","length","origin","getCaptchaPath","hasAllContentInData","isIncludeTimeOffsetInDateTimes","getEnabledLocales","loginType","JAAS","loginPath","clientName","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","_startsWithInstanceProperty","call","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\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 BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\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 XHR_ALWAYS_WITH_CREDENTIALS: false,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n\n COMPLETE_SOURCE: 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 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 * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually override by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n */\nexport const isIncludeTimeOffsetInDateTimes = (): boolean =>\n getSetting(INCLUDE_TIME_OFFSET, false);\n\n/**\n */\nexport const getEnabledLocales = (): Array<string> =>\n getSetting(\"ENABLED_LOCALES\", [\"en\"]);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\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, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnBC,mBAAmB,EACnBC,UAAU,EACVC,kBAAkB,EAClBC,sBAAsB,EACtBC,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+19,8 @@ import { locationChange, replace } from "../redux/_router/RouterActions";
|
|
|
19
19
|
import { JsonParseException, FetchException } from "../exceptions";
|
|
20
20
|
import { Init } from "./Init";
|
|
21
21
|
import { handleBeforeRenderHooks } from "../redux/store/beforeRenderHooks";
|
|
22
|
+
import createTheme from "../react-theme/createTheme";
|
|
23
|
+
import { receiveLocale } from "../redux";
|
|
22
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
25
|
/*
|
|
24
26
|
* deserialize serialized data from the server to provide a smooth dehydration.
|
|
@@ -56,6 +58,20 @@ export const setUnhandledRejectionEvent = store => {
|
|
|
56
58
|
};
|
|
57
59
|
};
|
|
58
60
|
|
|
61
|
+
/**
|
|
62
|
+
*/
|
|
63
|
+
const initThemeSettings = (state, theme) => {
|
|
64
|
+
const storedTheme = state.preferences.theme;
|
|
65
|
+
// $FlowFixMe
|
|
66
|
+
createTheme(storedTheme, theme); // on theme creation, the settings are set
|
|
67
|
+
};
|
|
68
|
+
const handleLocale = store => {
|
|
69
|
+
const locale = store.getState().i18n.locale;
|
|
70
|
+
if (locale) {
|
|
71
|
+
store.dispatch(receiveLocale(locale));
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
59
75
|
/**
|
|
60
76
|
* The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link
|
|
61
77
|
* @param store
|
|
@@ -98,6 +114,7 @@ export const setModelCatalogEntryDate = store => {
|
|
|
98
114
|
export const setupClient = function () {
|
|
99
115
|
let customReducers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
100
116
|
let beforeRenderHooks = arguments.length > 1 ? arguments[1] : undefined;
|
|
117
|
+
let theme = arguments.length > 2 ? arguments[2] : undefined;
|
|
101
118
|
if (typeof window.contextPath === "undefined") {
|
|
102
119
|
throw new Error("Missing contextPath on window object");
|
|
103
120
|
}
|
|
@@ -114,6 +131,8 @@ export const setupClient = function () {
|
|
|
114
131
|
routerHistory,
|
|
115
132
|
store
|
|
116
133
|
} = configureStore(browserHistory, customReducers, rehydrate(data));
|
|
134
|
+
initThemeSettings(store.getState(), theme);
|
|
135
|
+
handleLocale(store);
|
|
117
136
|
handleRedirectURI(store);
|
|
118
137
|
setModelCatalogEntryDate(store);
|
|
119
138
|
setAllContentInDataSetting(store.getState());
|
|
@@ -43,10 +43,12 @@ import type {
|
|
|
43
43
|
ElementType,
|
|
44
44
|
} from "react";
|
|
45
45
|
import type { Theme } from "../react-theme/types";
|
|
46
|
-
import type { CustomReducers, ReduxStore } from "../redux/types";
|
|
46
|
+
import type { CustomReducers, ReduxState, ReduxStore } from "../redux/types";
|
|
47
47
|
import type { RouterHistory } from "react-router";
|
|
48
48
|
import type { BeforeRenderHook } from "../redux/store/beforeRenderHooks";
|
|
49
49
|
import type { Props as FallbackProps } from "../react/ErrorBoundaryFallback";
|
|
50
|
+
import createTheme from "../react-theme/createTheme";
|
|
51
|
+
import { receiveLocale } from "../redux";
|
|
50
52
|
|
|
51
53
|
type RenderFunction = () => ReactElement<ElementType>;
|
|
52
54
|
type MountFunction = (
|
|
@@ -104,6 +106,21 @@ export const setUnhandledRejectionEvent = (store: ReduxStore) => {
|
|
|
104
106
|
};
|
|
105
107
|
};
|
|
106
108
|
|
|
109
|
+
/**
|
|
110
|
+
*/
|
|
111
|
+
const initThemeSettings = (state: ReduxState, theme?: Theme | Array<Theme>) => {
|
|
112
|
+
const storedTheme = state.preferences.theme;
|
|
113
|
+
// $FlowFixMe
|
|
114
|
+
createTheme(storedTheme, theme); // on theme creation, the settings are set
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const handleLocale = (store: ReduxStore) => {
|
|
118
|
+
const locale = store.getState().i18n.locale;
|
|
119
|
+
if (locale) {
|
|
120
|
+
store.dispatch(receiveLocale(locale));
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
107
124
|
/**
|
|
108
125
|
* The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link
|
|
109
126
|
* @param store
|
|
@@ -151,6 +168,7 @@ export const setModelCatalogEntryDate = (store: ReduxStore) => {
|
|
|
151
168
|
export const setupClient = (
|
|
152
169
|
customReducers: CustomReducers = {},
|
|
153
170
|
beforeRenderHooks: ?Array<BeforeRenderHook>,
|
|
171
|
+
theme?: Theme | Array<Theme>,
|
|
154
172
|
): { store: ReduxStore, routerHistory: RouterHistory } => {
|
|
155
173
|
if (typeof window.contextPath === "undefined") {
|
|
156
174
|
throw new Error("Missing contextPath on window object");
|
|
@@ -171,6 +189,10 @@ export const setupClient = (
|
|
|
171
189
|
rehydrate(data),
|
|
172
190
|
);
|
|
173
191
|
|
|
192
|
+
initThemeSettings(store.getState(), theme);
|
|
193
|
+
|
|
194
|
+
handleLocale(store);
|
|
195
|
+
|
|
174
196
|
handleRedirectURI(store);
|
|
175
197
|
setModelCatalogEntryDate(store);
|
|
176
198
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["hydrateRoot","createRoot","has","setImmediate","Cache","xhr","createBrowserHistory","configureStore","rehydrate","getBasePathModularUI","getBasePathServer","getSetting","setAllContentInDataSetting","setDateTimeSettings","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","updateEntryDate","locationChange","replace","JsonParseException","FetchException","Init","handleBeforeRenderHooks","jsx","_jsx","parseDataToJSON","data","JSON","parse","error","getDataFromServer","_context","dataElement","document","querySelector","Error","_trimInstanceProperty","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","errorMessage","reason","message","toString","dispatch","handleRedirectURI","urlParams","_URLSearchParams","location","search","redirectURI","get","url","catch","e","id","LOGIN_PATH","from","pathname","modal","setModelCatalogEntryDate","entryDateFromUrl","hasItem","getItem","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","clear","browserHistory","basename","routerHistory","getState","loadOtherBrowserTabs","response","listen","action","body","className","addContentLoadedEvent","theme","render","ErrorFallbackComponent","mount","addEventListener","applicationNode","children","mountClient","element","isSSR","root","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrateRoot, createRoot } from \"react-dom/client\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport {\n getBasePathModularUI,\n getBasePathServer,\n getSetting,\n} from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setDateTimeSettings,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport { locationChange, replace } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n * The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link\n * @param store\n */\nconst handleRedirectURI = (store: ReduxStore) => {\n const urlParams = new URLSearchParams(window.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePathModularUI()}${redirectURI}` }).catch((e) => {\n if (\n e.id === \"UnauthorizedException\" ||\n e.id === \"Error.NotAuthorized\" ||\n e.id === \"Error.Authentication.Required\" ||\n e.id === \"Error.Authentication.InvalidCredentials\"\n ) {\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n store.dispatch(\n replace(LOGIN_PATH, {\n from: { pathname: redirectURI },\n modal: false,\n }),\n );\n }\n });\n }\n};\n\n/**\n */\nexport const setModelCatalogEntryDate = (store: ReduxStore) => {\n if (typeof window !== \"undefined\") {\n const entryDateFromUrl = new URLSearchParams(window.location?.search).get(\n \"entryDate\",\n );\n if (entryDateFromUrl) {\n store.dispatch(updateEntryDate(entryDateFromUrl));\n } else if (Cache.hasItem(\"ModelCatalogEntryDate\")) {\n store.dispatch(Cache.getItem(\"ModelCatalogEntryDate\"));\n }\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePathServer(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n handleRedirectURI(store);\n setModelCatalogEntryDate(store);\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n setDateTimeSettings(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrateRoot(element, applicationNode);\n } else {\n const root = createRoot(element);\n root.render(applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;AACA;AACA,SAASA,WAAW,EAAEC,UAAU,QAAQ,kBAAkB;AAE1D,SAASC,GAAG,QAAQ,0BAA0B;AAC9C,OAAOC,YAAY,MAAM,cAAc;AAEvC,OAAOC,KAAK,MAAM,wBAAwB;AAE1C,OAAOC,GAAG,MAAM,oBAAoB;AAEpC,SAASC,oBAAoB,QAAQ,SAAS;AAC9C,OAAOC,cAAc,MAAM,+BAA+B;AAE1D,OAAOC,SAAS,MAAM,aAAa;AACnC,SACEC,oBAAoB,EACpBC,iBAAiB,EACjBC,UAAU,QACL,uBAAuB;AAE9B,SACEC,0BAA0B,EAC1BC,mBAAmB,EACnBC,mBAAmB,QACd,8BAA8B;AACrC,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,eAAe,QAAQ,+BAA+B;AAE/D,SAASC,cAAc,EAAEC,OAAO,QAAQ,gCAAgC;AAExE,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,eAAe;AAElE,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,uBAAuB,QAAQ,kCAAkC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA2B3E;AACA;AACA;AACA,MAAMC,eAAe,GAAIC,IAAY,IAAK;EACx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W,GAAGA,CAClBF,eAAwB,EACxBG,OAAkC,KAC/B;EACH,MAAMC,KAAK,GAAGJ,eAAe,CAAC3D,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAI+D,KAAK,EAAE;IACTnG,WAAW,CAACkG,OAAO,EAAEH,eAAe,CAAC;EACvC,CAAC,MAAM;IACL,MAAMK,IAAI,GAAGnG,UAAU,CAACiG,OAAO,CAAC;IAChCE,IAAI,CAACT,MAAM,CAACI,eAAe,CAAC;EAC9B;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMM,MAAM,GAAGC,IAAA,IAOT;EAAA,IAPU;IACrB9B,cAAc;IACdkB,KAAK;IACLC,MAAM;IACNf,iBAAiB;IACjBgB,sBAAsB;IACtBC;EACK,CAAC,GAAAS,IAAA;EACN,MAAM;IAAE5D,KAAK;IAAEuC;EAAc,CAAC,GAAGV,WAAW,CAC1CC,cAAc,EACdI,iBACF,CAAC;EAEDa,qBAAqB,CACnB/C,KAAK,EACLuC,aAAa,EACbS,KAAK,EACLC,MAAM,EACNC,sBAAsB,EACtBC,KAAK,IAAII,WACX,CAAC;AACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"client.js","names":["hydrateRoot","createRoot","has","setImmediate","Cache","xhr","createBrowserHistory","configureStore","rehydrate","getBasePathModularUI","getBasePathServer","getSetting","setAllContentInDataSetting","setDateTimeSettings","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","updateEntryDate","locationChange","replace","JsonParseException","FetchException","Init","handleBeforeRenderHooks","createTheme","receiveLocale","jsx","_jsx","parseDataToJSON","data","JSON","parse","error","getDataFromServer","_context","dataElement","document","querySelector","Error","_trimInstanceProperty","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","errorMessage","reason","message","toString","dispatch","initThemeSettings","state","theme","storedTheme","preferences","handleLocale","locale","getState","i18n","handleRedirectURI","urlParams","_URLSearchParams","location","search","redirectURI","get","url","catch","e","id","LOGIN_PATH","from","pathname","modal","setModelCatalogEntryDate","entryDateFromUrl","hasItem","getItem","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","clear","browserHistory","basename","routerHistory","loadOtherBrowserTabs","response","listen","action","body","className","addContentLoadedEvent","render","ErrorFallbackComponent","mount","addEventListener","applicationNode","children","mountClient","element","isSSR","root","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrateRoot, createRoot } from \"react-dom/client\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport {\n getBasePathModularUI,\n getBasePathServer,\n getSetting,\n} from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setDateTimeSettings,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport { locationChange, replace } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxState, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\nimport createTheme from \"../react-theme/createTheme\";\nimport { receiveLocale } from \"../redux\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n */\nconst initThemeSettings = (state: ReduxState, theme?: Theme | Array<Theme>) => {\n const storedTheme = state.preferences.theme;\n // $FlowFixMe\n createTheme(storedTheme, theme); // on theme creation, the settings are set\n};\n\nconst handleLocale = (store: ReduxStore) => {\n const locale = store.getState().i18n.locale;\n if (locale) {\n store.dispatch(receiveLocale(locale));\n }\n};\n\n/**\n * The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link\n * @param store\n */\nconst handleRedirectURI = (store: ReduxStore) => {\n const urlParams = new URLSearchParams(window.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePathModularUI()}${redirectURI}` }).catch((e) => {\n if (\n e.id === \"UnauthorizedException\" ||\n e.id === \"Error.NotAuthorized\" ||\n e.id === \"Error.Authentication.Required\" ||\n e.id === \"Error.Authentication.InvalidCredentials\"\n ) {\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n store.dispatch(\n replace(LOGIN_PATH, {\n from: { pathname: redirectURI },\n modal: false,\n }),\n );\n }\n });\n }\n};\n\n/**\n */\nexport const setModelCatalogEntryDate = (store: ReduxStore) => {\n if (typeof window !== \"undefined\") {\n const entryDateFromUrl = new URLSearchParams(window.location?.search).get(\n \"entryDate\",\n );\n if (entryDateFromUrl) {\n store.dispatch(updateEntryDate(entryDateFromUrl));\n } else if (Cache.hasItem(\"ModelCatalogEntryDate\")) {\n store.dispatch(Cache.getItem(\"ModelCatalogEntryDate\"));\n }\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n theme?: Theme | Array<Theme>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePathServer(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n initThemeSettings(store.getState(), theme);\n\n handleLocale(store);\n\n handleRedirectURI(store);\n setModelCatalogEntryDate(store);\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n setDateTimeSettings(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrateRoot(element, applicationNode);\n } else {\n const root = createRoot(element);\n root.render(applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;AACA;AACA,SAASA,WAAW,EAAEC,UAAU,QAAQ,kBAAkB;AAE1D,SAASC,GAAG,QAAQ,0BAA0B;AAC9C,OAAOC,YAAY,MAAM,cAAc;AAEvC,OAAOC,KAAK,MAAM,wBAAwB;AAE1C,OAAOC,GAAG,MAAM,oBAAoB;AAEpC,SAASC,oBAAoB,QAAQ,SAAS;AAC9C,OAAOC,cAAc,MAAM,+BAA+B;A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,CAAC;;AAED;AACA;AACA,MAAMM,WAAW,GAAGA,CAClBF,eAAwB,EACxBG,OAAkC,KAC/B;EACH,MAAMC,KAAK,GAAGJ,eAAe,CAAClE,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAIsE,KAAK,EAAE;IACT5G,WAAW,CAAC2G,OAAO,EAAEH,eAAe,CAAC;EACvC,CAAC,MAAM;IACL,MAAMK,IAAI,GAAG5G,UAAU,CAAC0G,OAAO,CAAC;IAChCE,IAAI,CAACT,MAAM,CAACI,eAAe,CAAC;EAC9B;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMM,MAAM,GAAGC,IAAA,IAOT;EAAA,IAPU;IACrB5B,cAAc;IACd3B,KAAK;IACL4C,MAAM;IACNb,iBAAiB;IACjBc,sBAAsB;IACtBC;EACK,CAAC,GAAAS,IAAA;EACN,MAAM;IAAEnE,KAAK;IAAEgD;EAAc,CAAC,GAAGV,WAAW,CAC1CC,cAAc,EACdI,iBACF,CAAC;EAEDY,qBAAqB,CACnBvD,KAAK,EACLgD,aAAa,EACbpC,KAAK,EACL4C,MAAM,EACNC,sBAAsB,EACtBC,KAAK,IAAII,WACX,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getFullRequestUrl,
|
|
3
|
+
getFullRequestHref,
|
|
4
|
+
getCookieFromRequest,
|
|
5
|
+
getPreferredLocale,
|
|
6
|
+
} from "../requestInformation"; // Adjust path as needed
|
|
7
|
+
|
|
8
|
+
// Mock the Href class
|
|
9
|
+
const mockHref = jest.fn((url) => ({
|
|
10
|
+
url: url, // For easy inspection in tests
|
|
11
|
+
// You can add other Href methods here if they are used by your functions
|
|
12
|
+
toString: () => url,
|
|
13
|
+
}));
|
|
14
|
+
jest.mock("../../models/href/Href", () => {
|
|
15
|
+
return jest.fn().mockImplementation((url) => {
|
|
16
|
+
return new mockHref(url);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Mock the Locales class
|
|
21
|
+
const mockLocales = {
|
|
22
|
+
availableLocaleCodes: ["en-US", "es-ES", "fr-FR"],
|
|
23
|
+
getPreferredLocale: jest.fn((header) => {
|
|
24
|
+
if (header.includes("en")) return "en-US";
|
|
25
|
+
if (header.includes("es")) return "es-ES";
|
|
26
|
+
if (header.includes("fr")) return "fr-FR";
|
|
27
|
+
return mockLocales.availableLocaleCodes[0]; // Default if no match
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
jest.mock("../../i18n/Locales", () => {
|
|
31
|
+
return jest.fn().mockImplementation(() => {
|
|
32
|
+
return mockLocales;
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Helper function to create a mock HttpServletRequestJava object
|
|
37
|
+
const createMockRequest = ({
|
|
38
|
+
pathInfo = null,
|
|
39
|
+
queryString = null,
|
|
40
|
+
cookies = [],
|
|
41
|
+
headers = {},
|
|
42
|
+
} = {}) => ({
|
|
43
|
+
getPathInfo: jest.fn(() => pathInfo),
|
|
44
|
+
getQueryString: jest.fn(() => queryString),
|
|
45
|
+
getCookieByName: jest.fn((name) => {
|
|
46
|
+
const cookie = cookies.find((c) => c.name === name);
|
|
47
|
+
return cookie ? cookie.value : null;
|
|
48
|
+
}),
|
|
49
|
+
getHeader: jest.fn((name) => headers[name.toLowerCase()] || null),
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe("requestInformation", () => {
|
|
53
|
+
beforeEach(() => {
|
|
54
|
+
jest.clearAllMocks();
|
|
55
|
+
|
|
56
|
+
// Reset mock Href to its initial mock implementation
|
|
57
|
+
// This is important if you test multiple instantiations or interactions
|
|
58
|
+
// with the Href mock.
|
|
59
|
+
require("../../models/href/Href").mockClear();
|
|
60
|
+
require("../../models/href/Href").mockImplementation((url) => {
|
|
61
|
+
return new mockHref(url);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe("getFullRequestUrl", () => {
|
|
66
|
+
it("should return the path info when no query string is present", () => {
|
|
67
|
+
const request = createMockRequest({
|
|
68
|
+
pathInfo: "/some/path",
|
|
69
|
+
});
|
|
70
|
+
expect(getFullRequestUrl(request)).toBe("/some/path");
|
|
71
|
+
expect(request.getPathInfo).toHaveBeenCalledTimes(1);
|
|
72
|
+
expect(request.getQueryString).toHaveBeenCalledTimes(1);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("should return the path info with a leading slash if pathInfo is null", () => {
|
|
76
|
+
const request = createMockRequest({
|
|
77
|
+
pathInfo: null,
|
|
78
|
+
});
|
|
79
|
+
expect(getFullRequestUrl(request)).toBe("/");
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("should return the path info with a leading slash if pathInfo is an empty string", () => {
|
|
83
|
+
const request = createMockRequest({
|
|
84
|
+
pathInfo: "",
|
|
85
|
+
});
|
|
86
|
+
expect(getFullRequestUrl(request)).toBe("/");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("should return the path info with an encoded query string", () => {
|
|
90
|
+
const request = createMockRequest({
|
|
91
|
+
pathInfo: "/search",
|
|
92
|
+
queryString: "q=hello world&filter=test",
|
|
93
|
+
});
|
|
94
|
+
expect(getFullRequestUrl(request)).toBe(
|
|
95
|
+
"/search?q%3Dhello%20world%26filter%3Dtest",
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("should handle special characters in pathInfo by encoding them", () => {
|
|
100
|
+
const request = createMockRequest({
|
|
101
|
+
pathInfo: "/path with spaces/and<script>alert(1)</script>",
|
|
102
|
+
});
|
|
103
|
+
expect(getFullRequestUrl(request)).toBe(
|
|
104
|
+
"/path%20with%20spaces/and%3Cscript%3Ealert(1)%3C/script%3E",
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("should handle path info with multiple segments and special characters", () => {
|
|
109
|
+
const request = createMockRequest({
|
|
110
|
+
pathInfo: "/product/category/item with special chars & numbers/id-123",
|
|
111
|
+
});
|
|
112
|
+
expect(getFullRequestUrl(request)).toBe(
|
|
113
|
+
"/product/category/item%20with%20special%20chars%20%26%20numbers/id-123",
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it("should correctly encode both path and query string with special characters", () => {
|
|
118
|
+
const request = createMockRequest({
|
|
119
|
+
pathInfo: "/api/data",
|
|
120
|
+
queryString: "name=John Doe & email=john@example.com",
|
|
121
|
+
});
|
|
122
|
+
expect(getFullRequestUrl(request)).toBe(
|
|
123
|
+
"/api/data?name%3DJohn%20Doe%20%26%20email%3Djohn%40example.com",
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("should handle an empty query string (not null) gracefully", () => {
|
|
128
|
+
const request = createMockRequest({
|
|
129
|
+
pathInfo: "/home",
|
|
130
|
+
queryString: "",
|
|
131
|
+
});
|
|
132
|
+
expect(getFullRequestUrl(request)).toBe("/home");
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
describe("getFullRequestHref", () => {
|
|
137
|
+
it("should return an Href instance with the full request URL", () => {
|
|
138
|
+
const request = createMockRequest({
|
|
139
|
+
pathInfo: "/products",
|
|
140
|
+
queryString: "id=123",
|
|
141
|
+
});
|
|
142
|
+
const hrefInstance = getFullRequestHref(request);
|
|
143
|
+
|
|
144
|
+
// Verify that Href constructor was called with the correct URL
|
|
145
|
+
expect(require("../../models/href/Href")).toHaveBeenCalledTimes(1);
|
|
146
|
+
expect(require("../../models/href/Href")).toHaveBeenCalledWith(
|
|
147
|
+
"/products?id%3D123",
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
// Verify the returned object is an instance of the mock Href
|
|
151
|
+
expect(hrefInstance.url).toBe("/products?id%3D123");
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("should handle complex URLs and pass them to Href", () => {
|
|
155
|
+
const request = createMockRequest({
|
|
156
|
+
pathInfo: "/search/results",
|
|
157
|
+
queryString: "q=javascript%20xss¶m=value",
|
|
158
|
+
});
|
|
159
|
+
const hrefInstance = getFullRequestHref(request);
|
|
160
|
+
expect(require("../../models/href/Href")).toHaveBeenCalledWith(
|
|
161
|
+
"/search/results?q%3Djavascript%2520xss%26param%3Dvalue",
|
|
162
|
+
);
|
|
163
|
+
expect(hrefInstance.url).toBe(
|
|
164
|
+
"/search/results?q%3Djavascript%2520xss%26param%3Dvalue",
|
|
165
|
+
);
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
describe("getCookieFromRequest", () => {
|
|
170
|
+
it("should return the cookie value if found", () => {
|
|
171
|
+
const request = createMockRequest({
|
|
172
|
+
cookies: [
|
|
173
|
+
{
|
|
174
|
+
name: "session_id",
|
|
175
|
+
value: "abc123xyz",
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
});
|
|
179
|
+
expect(getCookieFromRequest(request, "session_id")).toBe("abc123xyz");
|
|
180
|
+
expect(request.getCookieByName).toHaveBeenCalledWith("session_id");
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("should return null if the cookie is not found", () => {
|
|
184
|
+
const request = createMockRequest({
|
|
185
|
+
cookies: [
|
|
186
|
+
{
|
|
187
|
+
name: "other_cookie",
|
|
188
|
+
value: "value",
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
});
|
|
192
|
+
expect(getCookieFromRequest(request, "non_existent_cookie")).toBeNull();
|
|
193
|
+
expect(request.getCookieByName).toHaveBeenCalledWith(
|
|
194
|
+
"non_existent_cookie",
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it("should handle empty cookies array", () => {
|
|
199
|
+
const request = createMockRequest({
|
|
200
|
+
cookies: [],
|
|
201
|
+
});
|
|
202
|
+
expect(getCookieFromRequest(request, "any_cookie")).toBeNull();
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
describe("getPreferredLocale", () => {
|
|
207
|
+
it("should return locale from cookie if present", () => {
|
|
208
|
+
const request = createMockRequest({
|
|
209
|
+
cookies: [
|
|
210
|
+
{
|
|
211
|
+
name: "locale",
|
|
212
|
+
value: "es-ES",
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
headers: {
|
|
216
|
+
"accept-language": "en-US,en;q=0.9",
|
|
217
|
+
},
|
|
218
|
+
});
|
|
219
|
+
const locales = mockLocales; // Using the mocked locales directly for convenience
|
|
220
|
+
expect(getPreferredLocale(request, locales)).toBe("es-ES");
|
|
221
|
+
expect(locales.getPreferredLocale).toHaveBeenCalledWith("es-ES"); // Because cookie took precedence
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it("should return the first available locale code if no cookie and no Accept-Language header", () => {
|
|
225
|
+
const request = createMockRequest({}); // No cookies, no headers
|
|
226
|
+
const locales = mockLocales;
|
|
227
|
+
expect(getPreferredLocale(request, locales)).toBe("en-US");
|
|
228
|
+
expect(locales.getPreferredLocale).not.toHaveBeenCalled();
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it("should handle null Accept-Language header correctly", () => {
|
|
232
|
+
const request = createMockRequest({
|
|
233
|
+
headers: {
|
|
234
|
+
"accept-language": null,
|
|
235
|
+
},
|
|
236
|
+
}); // Explicitly null header
|
|
237
|
+
const locales = mockLocales;
|
|
238
|
+
expect(getPreferredLocale(request, locales)).toBe("en-US");
|
|
239
|
+
expect(locales.getPreferredLocale).not.toHaveBeenCalled();
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it("should handle empty string Accept-Language header correctly", () => {
|
|
243
|
+
const request = createMockRequest({
|
|
244
|
+
headers: {
|
|
245
|
+
"accept-language": "",
|
|
246
|
+
},
|
|
247
|
+
}); // Explicitly empty header
|
|
248
|
+
const locales = mockLocales;
|
|
249
|
+
expect(getPreferredLocale(request, locales)).toBe("en-US");
|
|
250
|
+
expect(locales.getPreferredLocale).not.toHaveBeenCalled();
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("should call getCookieFromRequest and getHeader", () => {
|
|
254
|
+
const request = createMockRequest({
|
|
255
|
+
headers: {
|
|
256
|
+
"accept-language": "de-DE",
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
const locales = mockLocales;
|
|
260
|
+
getPreferredLocale(request, locales);
|
|
261
|
+
expect(request.getCookieByName).toHaveBeenCalledWith("locale");
|
|
262
|
+
expect(request.getHeader).toHaveBeenCalledWith("Accept-Language");
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
});
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
1
2
|
import Href from "../models/href/Href";
|
|
2
3
|
/**
|
|
3
4
|
*/
|
|
4
5
|
export const getFullRequestUrl = request => {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
var _context;
|
|
7
|
+
let pathInfo = request.getPathInfo() || "/";
|
|
8
|
+
let queryString = request.getQueryString();
|
|
9
|
+
pathInfo = _mapInstanceProperty(_context = pathInfo.split("/")).call(_context, segment => encodeURIComponent(segment)).join("/");
|
|
7
10
|
if (queryString) {
|
|
8
|
-
return `${pathInfo}?${queryString}`;
|
|
11
|
+
return `${pathInfo}?${encodeURIComponent(queryString)}`;
|
|
9
12
|
}
|
|
10
13
|
return pathInfo;
|
|
11
14
|
};
|
|
@@ -6,11 +6,16 @@ import type Locales from "../i18n/Locales";
|
|
|
6
6
|
/**
|
|
7
7
|
*/
|
|
8
8
|
export const getFullRequestUrl = (request: HttpServletRequestJava): string => {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
let pathInfo = request.getPathInfo() || "/";
|
|
10
|
+
let queryString = request.getQueryString();
|
|
11
|
+
|
|
12
|
+
pathInfo = pathInfo
|
|
13
|
+
.split("/")
|
|
14
|
+
.map((segment) => encodeURIComponent(segment))
|
|
15
|
+
.join("/");
|
|
11
16
|
|
|
12
17
|
if (queryString) {
|
|
13
|
-
return `${pathInfo}?${queryString}`;
|
|
18
|
+
return `${pathInfo}?${encodeURIComponent(queryString)}`;
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
return pathInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestInformation.js","names":["Href","getFullRequestUrl","request","pathInfo","getPathInfo","queryString","getQueryString","getFullRequestHref","getCookieFromRequest","cookieName","getCookieByName","getPreferredLocale","locales","languageFromCookie","acceptLanguageHeader","getHeader","availableLocaleCodes"],"sources":["../../src/react-server/requestInformation.js"],"sourcesContent":["// @flow\nimport Href from \"../models/href/Href\";\n\nimport type Locales from \"../i18n/Locales\";\n\n/**\n */\nexport const getFullRequestUrl = (request: HttpServletRequestJava): string => {\n
|
|
1
|
+
{"version":3,"file":"requestInformation.js","names":["Href","getFullRequestUrl","request","_context","pathInfo","getPathInfo","queryString","getQueryString","_mapInstanceProperty","split","call","segment","encodeURIComponent","join","getFullRequestHref","getCookieFromRequest","cookieName","getCookieByName","getPreferredLocale","locales","languageFromCookie","acceptLanguageHeader","getHeader","availableLocaleCodes"],"sources":["../../src/react-server/requestInformation.js"],"sourcesContent":["// @flow\nimport Href from \"../models/href/Href\";\n\nimport type Locales from \"../i18n/Locales\";\n\n/**\n */\nexport const getFullRequestUrl = (request: HttpServletRequestJava): string => {\n let pathInfo = request.getPathInfo() || \"/\";\n let queryString = request.getQueryString();\n\n pathInfo = pathInfo\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n\n if (queryString) {\n return `${pathInfo}?${encodeURIComponent(queryString)}`;\n }\n\n return pathInfo;\n};\n\n/**\n */\nexport const getFullRequestHref = (request: HttpServletRequestJava): Href =>\n new Href(getFullRequestUrl(request));\n\n/**\n */\nexport const getCookieFromRequest = (\n request: HttpServletRequestJava,\n cookieName: string,\n): null | string => {\n return request.getCookieByName(cookieName);\n};\n\n/**\n */\nexport const getPreferredLocale = (\n request: HttpServletRequestJava,\n locales: Locales,\n): void | string => {\n const languageFromCookie = getCookieFromRequest(request, \"locale\");\n const acceptLanguageHeader =\n languageFromCookie || request.getHeader(\"Accept-Language\");\n\n // when no accept language header or cookie present, get first locale code\n if (acceptLanguageHeader === null) {\n return locales.availableLocaleCodes[0];\n }\n\n return locales.getPreferredLocale(acceptLanguageHeader);\n};\n"],"mappings":";AACA,OAAOA,IAAI,MAAM,qBAAqB;AAItC;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAIC,OAA+B,IAAa;EAAA,IAAAC,QAAA;EAC5E,IAAIC,QAAQ,GAAGF,OAAO,CAACG,WAAW,CAAC,CAAC,IAAI,GAAG;EAC3C,IAAIC,WAAW,GAAGJ,OAAO,CAACK,cAAc,CAAC,CAAC;EAE1CH,QAAQ,GAAGI,oBAAA,CAAAL,QAAA,GAAAC,QAAQ,CAChBK,KAAK,CAAC,GAAG,CAAC,EAAAC,IAAA,CAAAP,QAAA,EACLQ,OAAO,IAAKC,kBAAkB,CAACD,OAAO,CAAC,CAAC,CAC7CE,IAAI,CAAC,GAAG,CAAC;EAEZ,IAAIP,WAAW,EAAE;IACf,OAAO,GAAGF,QAAQ,IAAIQ,kBAAkB,CAACN,WAAW,CAAC,EAAE;EACzD;EAEA,OAAOF,QAAQ;AACjB,CAAC;;AAED;AACA;AACA,OAAO,MAAMU,kBAAkB,GAAIZ,OAA+B,IAChE,IAAIF,IAAI,CAACC,iBAAiB,CAACC,OAAO,CAAC,CAAC;;AAEtC;AACA;AACA,OAAO,MAAMa,oBAAoB,GAAGA,CAClCb,OAA+B,EAC/Bc,UAAkB,KACA;EAClB,OAAOd,OAAO,CAACe,eAAe,CAACD,UAAU,CAAC;AAC5C,CAAC;;AAED;AACA;AACA,OAAO,MAAME,kBAAkB,GAAGA,CAChChB,OAA+B,EAC/BiB,OAAgB,KACE;EAClB,MAAMC,kBAAkB,GAAGL,oBAAoB,CAACb,OAAO,EAAE,QAAQ,CAAC;EAClE,MAAMmB,oBAAoB,GACxBD,kBAAkB,IAAIlB,OAAO,CAACoB,SAAS,CAAC,iB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