@beinformed/ui 1.62.8 → 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 +7 -0
- 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/lib/react-server/requestInformation.js +6 -3
- package/lib/react-server/requestInformation.js.map +1 -1
- package/package.json +3 -3
- package/src/react-server/__tests__/requestInformation.spec.js +265 -0
- package/src/react-server/requestInformation.js +8 -3
- 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 -33
- 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 -33
- 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,13 @@
|
|
|
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
|
+
|
|
5
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)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -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,iBAAiB,CAAC;;EAE5D;EACA,IAAID,oBAAoB,KAAK,IAAI,EAAE;IACjC,OAAOF,OAAO,CAACI,oBAAoB,CAAC,CAAC,CAAC;EACxC;EAEA,OAAOJ,OAAO,CAACD,kBAAkB,CAACG,oBAAoB,CAAC;AACzD,CAAC","ignoreList":[]}
|
|
@@ -5,14 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.getPreferredLocale = exports.getFullRequestUrl = exports.getFullRequestHref = exports.getCookieFromRequest = void 0;
|
|
8
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
8
9
|
var _Href = _interopRequireDefault(require("../models/href/Href"));
|
|
9
10
|
/**
|
|
10
11
|
*/
|
|
11
12
|
const getFullRequestUrl = request => {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
var _context;
|
|
14
|
+
let pathInfo = request.getPathInfo() || "/";
|
|
15
|
+
let queryString = request.getQueryString();
|
|
16
|
+
pathInfo = (0, _map.default)(_context = pathInfo.split("/")).call(_context, segment => encodeURIComponent(segment)).join("/");
|
|
14
17
|
if (queryString) {
|
|
15
|
-
return `${pathInfo}?${queryString}`;
|
|
18
|
+
return `${pathInfo}?${encodeURIComponent(queryString)}`;
|
|
16
19
|
}
|
|
17
20
|
return pathInfo;
|
|
18
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestInformation.js","names":["_Href","_interopRequireDefault","require","getFullRequestUrl","request","pathInfo","getPathInfo","queryString","getQueryString","exports","getFullRequestHref","Href","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","_interopRequireDefault","require","getFullRequestUrl","request","_context","pathInfo","getPathInfo","queryString","getQueryString","_map","default","split","call","segment","encodeURIComponent","join","exports","getFullRequestHref","Href","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,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA;AACA;AACO,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,GAAG,IAAAI,IAAA,CAAAC,OAAA,EAAAN,QAAA,GAAAC,QAAQ,CAChBM,KAAK,CAAC,GAAG,CAAC,EAAAC,IAAA,CAAAR,QAAA,EACLS,OAAO,IAAKC,kBAAkB,CAACD,OAAO,CAAC,CAAC,CAC7CE,IAAI,CAAC,GAAG,CAAC;EAEZ,IAAIR,WAAW,EAAE;IACf,OAAO,GAAGF,QAAQ,IAAIS,kBAAkB,CAACP,WAAW,CAAC,EAAE;EACzD;EAEA,OAAOF,QAAQ;AACjB,CAAC;;AAED;AACA;AADAW,OAAA,CAAAd,iBAAA,GAAAA,iBAAA;AAEO,MAAMe,kBAAkB,GAAId,OAA+B,IAChE,IAAIe,aAAI,CAAChB,iBAAiB,CAACC,OAAO,CAAC,CAAC;;AAEtC;AACA;AADAa,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAEO,MAAME,oBAAoB,GAAGA,CAClChB,OAA+B,EAC/BiB,UAAkB,KACA;EAClB,OAAOjB,OAAO,CAACkB,eAAe,CAACD,UAAU,CAAC;AAC5C,CAAC;;AAED;AACA;AADAJ,OAAA,CAAAG,oBAAA,GAAAA,oBAAA;AAEO,MAAMG,kBAAkB,GAAGA,CAChCnB,OAA+B,EAC/BoB,OAAgB,KACE;EAClB,MAAMC,kBAAkB,GAAGL,oBAAoB,CAAChB,OAAO,EAAE,QAAQ,CAAC;EAClE,MAAMsB,oBAAoB,GACxBD,kBAAkB,IAAIrB,OAAO,CAACuB,SAAS,CAAC,iBAAiB,CAAC;;EAE5D;EACA,IAAID,oBAAoB,KAAK,IAAI,EAAE;IACjC,OAAOF,OAAO,CAACI,oBAAoB,CAAC,CAAC,CAAC;EACxC;EAEA,OAAOJ,OAAO,CAACD,kBAAkB,CAACG,oBAAoB,CAAC;AACzD,CAAC;AAACT,OAAA,CAAAM,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.62.
|
|
3
|
+
"version": "1.62.9",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "https://support.beinformed.com",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"watch:esm": "cross-env BABEL_ENV=esm babel --watch src --out-dir esm --ignore \"**/__tests__/**\" --ignore \"**/__mock__/**\" --ignore \"**/__mocks__/**\"",
|
|
19
19
|
"quality": "npm run lint && npm run flow && npm run test",
|
|
20
20
|
"dev": "npm run clean && npm run build:lib && npm run build:flow && npm run build:proxies && npm run build:esm",
|
|
21
|
-
"build": "npm run clean && npm run build:lib && npm run build:flow && npm run build:proxies && npm run build:esm
|
|
21
|
+
"build": "npm run clean && npm run build:lib && npm run build:flow && npm run build:proxies && npm run build:esm",
|
|
22
22
|
"build:lib": "babel src --out-dir lib --ignore \"**/__tests__/**\" --ignore \"**/__mock__/**\" --ignore \"**/__mocks__/**\" --source-maps",
|
|
23
23
|
"build:esm": "cross-env BABEL_ENV=esm babel src --out-dir esm --ignore \"**/__tests__/**\" --ignore \"**/__mock__/**\" --ignore \"**/__mocks__/**\" --source-maps",
|
|
24
24
|
"build:proxies": "node .build/proxies.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"test:ci": "jest --ci",
|
|
37
37
|
"test:changed": "jest --onlyChanged",
|
|
38
38
|
"upgrade-interactive": "npm-check -u",
|
|
39
|
-
"release": "npm run quality && commit-and-tag-version",
|
|
39
|
+
"release": "npm run quality && npm run docs&& npm run build:ts && commit-and-tag-version",
|
|
40
40
|
"beta-release": "commit-and-tag-version --prerelease beta",
|
|
41
41
|
"prepublishOnly": "npm run build",
|
|
42
42
|
"docs": "rimraf docs && node ./.build/docs.mjs",
|
|
@@ -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
|
+
});
|