@beinformed/ui 1.28.3 → 1.28.4
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/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/esm/constants/LayoutHints.js.map +1 -1
- package/esm/constants/Settings.js.map +1 -1
- package/esm/exceptions/ConfigurationException.js.map +1 -1
- package/esm/exceptions/FetchException.js.map +1 -1
- package/esm/exceptions/IllegalArgumentException.js.map +1 -1
- package/esm/exceptions/IllegalReturnException.js.map +1 -1
- package/esm/exceptions/IllegalStateException.js.map +1 -1
- package/esm/exceptions/JsonParseException.js.map +1 -1
- package/esm/exceptions/MissingPropertyException.js.map +1 -1
- package/esm/exceptions/NetworkException.js.map +1 -1
- package/esm/exceptions/NotAllowedUriException.js.map +1 -1
- package/esm/exceptions/NotFoundException.js.map +1 -1
- package/esm/exceptions/ServerRequestException.js.map +1 -1
- package/esm/exceptions/ThemePropertyException.js.map +1 -1
- package/esm/exceptions/TimeoutException.js.map +1 -1
- package/esm/exceptions/UnauthorizedException.js.map +1 -1
- package/esm/exceptions/UnsupportedOperationException.js.map +1 -1
- package/esm/hooks/useAllFormsOnModel.js.map +1 -1
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/hooks/useContent.js.map +1 -1
- package/esm/hooks/useDeepCompareEffect.js.map +1 -1
- package/esm/hooks/useForm.js.map +1 -1
- package/esm/hooks/useI18n.js.map +1 -1
- package/esm/hooks/useModal.js.map +1 -1
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/hooks/useModels.js.map +1 -1
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/hooks/useModularUIModel.js.map +1 -1
- package/esm/hooks/useModularUIRequest.js.map +1 -1
- package/esm/hooks/useNotification.js.map +1 -1
- package/esm/hooks/useProgressIndicator.js.map +1 -1
- package/esm/hooks/useRouter.js.map +1 -1
- package/esm/i18n/Locale.js.map +1 -1
- package/esm/i18n/Locales.js.map +1 -1
- package/esm/i18n/Message.js.map +1 -1
- package/esm/i18n/withMessage.js.map +1 -1
- package/esm/models/actions/ActionCollection.js.map +1 -1
- package/esm/models/actions/ActionModel.js.map +1 -1
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/attributes/AttributeCollection.js.map +1 -1
- package/esm/models/attributes/AttributeContent.js.map +1 -1
- package/esm/models/attributes/AttributeDataHelper.js.map +1 -1
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/AttributeSetModel.js.map +1 -1
- package/esm/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/esm/models/attributes/CaptchaAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/models/attributes/HelptextAttributeModel.js.map +1 -1
- package/esm/models/attributes/LabelAttributeModel.js.map +1 -1
- package/esm/models/attributes/MemoAttributeModel.js.map +1 -1
- package/esm/models/attributes/MoneyAttributeModel.js.map +1 -1
- package/esm/models/attributes/NumberAttributeModel.js.map +1 -1
- package/esm/models/attributes/PasswordAttributeModel.js.map +1 -1
- package/esm/models/attributes/StringAttributeModel.js.map +1 -1
- package/esm/models/attributes/UploadAttributeModel.js.map +1 -1
- package/esm/models/attributes/XMLAttributeModel.js.map +1 -1
- package/esm/models/attributes/_createAttribute.js.map +1 -1
- package/esm/models/attributes/input-constraints/BSNConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
- package/esm/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
- package/esm/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/DateTimeDateFormatConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/DateTimeTimeFormatConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/FileExtensionConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/FileSizeConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/IBANConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/MandatoryConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/MandatoryRangeConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/PasswordConfirmConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/PasswordLowerAndUpperCaseConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/PasswordMinNumericCharactersConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/PasswordMinSpecialCharactersConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/RangeConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/RegexConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/StringLengthConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/XMLConstraint.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/LayoutHintRuleCollection.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/RemainingTotalUploadSize.js.map +1 -1
- package/esm/models/base/BaseCollection.js.map +1 -1
- package/esm/models/base/BaseModel.js.map +1 -1
- package/esm/models/base/ResourceCollection.js.map +1 -1
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/ConceptRelationCollection.js.map +1 -1
- package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
- package/esm/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/content/ContentModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/content/ContentTypeModel.js.map +1 -1
- package/esm/models/content/SectionModel.js.map +1 -1
- package/esm/models/content/SubSectionModel.js.map +1 -1
- package/esm/models/contentconfiguration/ContentConfiguration.js.map +1 -1
- package/esm/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
- package/esm/models/contentconfiguration/ContentConfigurationEndResults.js.map +1 -1
- package/esm/models/contentconfiguration/ContentConfigurationQuestions.js.map +1 -1
- package/esm/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
- package/esm/models/detail/DetailModel.js.map +1 -1
- package/esm/models/error/ErrorCollection.js.map +1 -1
- package/esm/models/error/ErrorModel.js.map +1 -1
- package/esm/models/error/ErrorResponse.js.map +1 -1
- package/esm/models/filters/AssignmentFilterModel.js.map +1 -1
- package/esm/models/filters/BaseFilterModel.js.map +1 -1
- package/esm/models/filters/ConceptIndexFilterModel.js.map +1 -1
- package/esm/models/filters/FilterCollection.js.map +1 -1
- package/esm/models/filters/RangeFilterModel.js.map +1 -1
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/form/FormObjectModel.js.map +1 -1
- package/esm/models/grouping/GroupingModel.js.map +1 -1
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/href/ListHref.js.map +1 -1
- package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/esm/models/links/LinkCollection.js.map +1 -1
- package/esm/models/links/LinkModel.js.map +1 -1
- package/esm/models/links/normalizeLinkJSON.js.map +1 -1
- package/esm/models/list/ListDetailModel.js.map +1 -1
- package/esm/models/list/ListHeaderModel.js.map +1 -1
- package/esm/models/list/ListItemCollection.js.map +1 -1
- package/esm/models/list/ListItemModel.js.map +1 -1
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/lookup/LookupOptionCollection.js.map +1 -1
- package/esm/models/lookup/LookupOptionsModel.js.map +1 -1
- package/esm/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/esm/models/paging/PagesizeModel.js.map +1 -1
- package/esm/models/paging/PagingModel.js.map +1 -1
- package/esm/models/panels/GroupingPanelModel.js.map +1 -1
- package/esm/models/parameter/Parameter.js.map +1 -1
- package/esm/models/process/ProcessStatusSettingsModel.js.map +1 -1
- package/esm/models/resolveModel.js.map +1 -1
- package/esm/models/search/CaseSearchModel.js.map +1 -1
- package/esm/models/sorting/SortOptionModel.js.map +1 -1
- package/esm/models/sorting/SortingModel.js.map +1 -1
- package/esm/models/tab/TabModel.js.map +1 -1
- package/esm/models/taskgroup/TaskGroupCollection.js.map +1 -1
- package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/esm/models/user/UserModel.js.map +1 -1
- package/esm/models/user/UserProfileModel.js.map +1 -1
- package/esm/models/user/UserServicesModel.js.map +1 -1
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/modularui/CaptchaRequest.js.map +1 -1
- package/esm/modularui/ModularUIError.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/ModularUIResponse.js.map +1 -1
- package/esm/modularui/UploadRequest.js.map +1 -1
- package/esm/react/ErrorBoundary.js.map +1 -1
- package/esm/react/ErrorBoundaryFallback.js.map +1 -1
- package/esm/react/utils.js.map +1 -1
- package/esm/react-client/Init.js.map +1 -1
- package/esm/react-client/client.js +6 -5
- package/esm/react-client/client.js.map +1 -1
- package/esm/react-client/contextPath.js.map +1 -1
- package/esm/react-client/rehydrate.js.map +1 -1
- package/esm/react-server/contextPath.js.map +1 -1
- package/esm/react-server/createSSRComplete.js.map +1 -1
- package/esm/react-server/htmlpage.js.map +1 -1
- package/esm/react-server/renderSSRComplete.js.map +1 -1
- package/esm/react-server/renderSSRMinimal.js.map +1 -1
- package/esm/react-server/requestInformation.js.map +1 -1
- package/esm/react-server/serverNoSSR.js.map +1 -1
- package/esm/react-server/serverSSR.js.map +1 -1
- package/esm/react-server/serverUtil.js.map +1 -1
- package/esm/react-theme/ThemeProvider.js.map +1 -1
- package/esm/react-theme/createTheme.js.map +1 -1
- package/esm/react-theme/useTheme.js.map +1 -1
- package/esm/react-theme/utils/background.js.map +1 -1
- package/esm/react-theme/utils/colors.js.map +1 -1
- package/esm/react-theme/utils/contrast.js.map +1 -1
- package/esm/react-theme/utils/corners.js.map +1 -1
- package/esm/react-theme/utils/spacers.js.map +1 -1
- package/esm/react-theme/utils/themeProps.js.map +1 -1
- package/esm/redux/_i18n/I18nActions.js.map +1 -1
- package/esm/redux/_i18n/I18nReducer.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/esm/redux/_modularui/ModularUIUtils.js.map +1 -1
- package/esm/redux/_modularui/withModularUI.js.map +1 -1
- package/esm/redux/_router/RouterActions.js.map +1 -1
- package/esm/redux/_router/RouterReducer.js.map +1 -1
- package/esm/redux/actions/Application.js.map +1 -1
- package/esm/redux/actions/Error.js.map +1 -1
- package/esm/redux/actions/FormAttributeSet.js.map +1 -1
- package/esm/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/esm/redux/actions/FormAutosave.js.map +1 -1
- package/esm/redux/actions/FormAutosubmit.js.map +1 -1
- package/esm/redux/actions/FormValidations.js.map +1 -1
- package/esm/redux/actions/Notification.js.map +1 -1
- package/esm/redux/actions/Preferences.js.map +1 -1
- package/esm/redux/actions/ProgressIndicator.js.map +1 -1
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/redux/actions/SignOut.js.map +1 -1
- package/esm/redux/connectors/CaseView.js.map +1 -1
- package/esm/redux/connectors/ConceptDetail.js.map +1 -1
- package/esm/redux/connectors/ContentBrowser.js.map +1 -1
- package/esm/redux/connectors/ContentDetail.js.map +1 -1
- package/esm/redux/connectors/ContentDetailSection.js.map +1 -1
- package/esm/redux/connectors/Form.js.map +1 -1
- package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
- package/esm/redux/connectors/ListDetail.js.map +1 -1
- package/esm/redux/connectors/Modal.js.map +1 -1
- package/esm/redux/connectors/ModelCatalog.js.map +1 -1
- package/esm/redux/connectors/PanelRenderer.js.map +1 -1
- package/esm/redux/connectors/Preferences.js.map +1 -1
- package/esm/redux/connectors/QuickSearch.js.map +1 -1
- package/esm/redux/connectors/Tab.js.map +1 -1
- package/esm/redux/reducers/AuthReducer.js.map +1 -1
- package/esm/redux/reducers/ErrorReducer.js.map +1 -1
- package/esm/redux/reducers/ModalsReducer.js.map +1 -1
- package/esm/redux/reducers/NotificationReducer.js.map +1 -1
- package/esm/redux/reducers/PreferencesReducer.js.map +1 -1
- package/esm/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
- package/esm/redux/reducers/createReducer.js.map +1 -1
- package/esm/redux/store/beforeRenderHooks.js.map +1 -1
- package/esm/redux/store/configureStore.js.map +1 -1
- package/esm/utils/browser/Cache.js.map +1 -1
- package/esm/utils/browser/Cookies.js.map +1 -1
- package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
- package/esm/utils/fetch/serverFetch.js.map +1 -1
- package/esm/utils/fetch/universalFetch.js.map +1 -1
- package/esm/utils/fetch/xhr.js.map +1 -1
- package/esm/utils/helpers/checkResource.js.map +1 -1
- package/esm/utils/helpers/createUUID.js.map +1 -1
- package/esm/utils/helpers/objects.js.map +1 -1
- package/esm/utils/helpers/repositoryResource.js.map +1 -1
- package/esm/utils/helpers/sanitizeHtml.js.map +1 -1
- package/esm/utils/number/DecimalFormat.js.map +1 -1
- package/esm/utils/number/formatValue.js.map +1 -1
- package/esm/utils/number/parseNumbers.js.map +1 -1
- package/lib/builder/index.js.map +1 -1
- package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/lib/constants/Constants.js.map +1 -1
- package/lib/constants/LayoutHintConfig.js.map +1 -1
- package/lib/constants/LayoutHints.js.map +1 -1
- package/lib/constants/Settings.js.map +1 -1
- package/lib/constants/index.js.map +1 -1
- package/lib/exceptions/ConfigurationException.js.map +1 -1
- package/lib/exceptions/FetchException.js.map +1 -1
- package/lib/exceptions/IllegalArgumentException.js.map +1 -1
- package/lib/exceptions/IllegalReturnException.js.map +1 -1
- package/lib/exceptions/IllegalStateException.js.map +1 -1
- package/lib/exceptions/JsonParseException.js.map +1 -1
- package/lib/exceptions/MissingPropertyException.js.map +1 -1
- package/lib/exceptions/NetworkException.js.map +1 -1
- package/lib/exceptions/NotAllowedUriException.js.map +1 -1
- package/lib/exceptions/NotFoundException.js.map +1 -1
- package/lib/exceptions/ServerRequestException.js.map +1 -1
- package/lib/exceptions/ThemePropertyException.js.map +1 -1
- package/lib/exceptions/TimeoutException.js.map +1 -1
- package/lib/exceptions/UnauthorizedException.js.map +1 -1
- package/lib/exceptions/UnsupportedOperationException.js.map +1 -1
- package/lib/exceptions/index.js.map +1 -1
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useAllFormsOnModel.js.map +1 -1
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useContent.js.map +1 -1
- package/lib/hooks/useDeepCompareEffect.js.map +1 -1
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/hooks/useI18n.js.map +1 -1
- package/lib/hooks/useModal.js.map +1 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/hooks/useModels.js.map +1 -1
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useModularUIModel.js.map +1 -1
- package/lib/hooks/useModularUIRequest.js.map +1 -1
- package/lib/hooks/useNotification.js.map +1 -1
- package/lib/hooks/usePreference.js.map +1 -1
- package/lib/hooks/useProgressIndicator.js.map +1 -1
- package/lib/hooks/useRouter.js.map +1 -1
- package/lib/i18n/Locale.js.map +1 -1
- package/lib/i18n/Locales.js.map +1 -1
- package/lib/i18n/Message.js.map +1 -1
- package/lib/i18n/index.js.map +1 -1
- package/lib/i18n/languages.js.map +1 -1
- package/lib/i18n/translations/beinformed_error_messages_en.nl.js.map +1 -1
- package/lib/i18n/translations/beinformed_error_messages_nl.nl.js.map +1 -1
- package/lib/i18n/withMessage.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/models/actions/ActionCollection.js.map +1 -1
- package/lib/models/actions/ActionModel.js.map +1 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/attributes/AttributeCollection.js.map +1 -1
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/AttributeSetModel.js.map +1 -1
- package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/lib/models/attributes/CaptchaAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
- package/lib/models/attributes/LabelAttributeModel.js.map +1 -1
- package/lib/models/attributes/MemoAttributeModel.js.map +1 -1
- package/lib/models/attributes/MoneyAttributeModel.js.map +1 -1
- package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
- package/lib/models/attributes/PasswordAttributeModel.js.map +1 -1
- package/lib/models/attributes/StringAttributeModel.js.map +1 -1
- package/lib/models/attributes/UploadAttributeModel.js.map +1 -1
- package/lib/models/attributes/XMLAttributeModel.js.map +1 -1
- package/lib/models/attributes/_createAttribute.js.map +1 -1
- package/lib/models/attributes/input-constraints/BSNConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateTimeDateFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateTimeTimeFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/FileExtensionConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/FileSizeConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/IBANConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/MandatoryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/MandatoryRangeConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/PasswordConfirmConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/PasswordLowerAndUpperCaseConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/PasswordMinNumericCharactersConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/PasswordMinSpecialCharactersConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/RangeConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/RegexConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/StringLengthConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/XMLConstraint.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/LayoutHintRuleCollection.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/RemainingTotalUploadSize.js.map +1 -1
- package/lib/models/base/BaseCollection.js.map +1 -1
- package/lib/models/base/BaseModel.js.map +1 -1
- package/lib/models/base/ResourceCollection.js.map +1 -1
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/ConceptRelationCollection.js.map +1 -1
- package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
- package/lib/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/ContentModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/content/ContentTypeModel.js.map +1 -1
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/content/SubSectionModel.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfiguration.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationEndResults.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationQuestions.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/error/ErrorCollection.js.map +1 -1
- package/lib/models/error/ErrorModel.js.map +1 -1
- package/lib/models/error/ErrorResponse.js.map +1 -1
- package/lib/models/filters/AssignmentFilterModel.js.map +1 -1
- package/lib/models/filters/BaseFilterModel.js.map +1 -1
- package/lib/models/filters/ConceptIndexFilterModel.js.map +1 -1
- package/lib/models/filters/FilterCollection.js.map +1 -1
- package/lib/models/filters/FilterModel.js.map +1 -1
- package/lib/models/filters/RangeFilterModel.js.map +1 -1
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/grouping/GroupingModel.js.map +1 -1
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/ListHref.js.map +1 -1
- package/lib/models/index.js.map +1 -1
- package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/lib/models/links/LinkCollection.js.map +1 -1
- package/lib/models/links/LinkModel.js.map +1 -1
- package/lib/models/links/normalizeLinkJSON.js.map +1 -1
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/models/list/ListHeaderModel.js.map +1 -1
- package/lib/models/list/ListItemCollection.js.map +1 -1
- package/lib/models/list/ListItemModel.js.map +1 -1
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/lookup/LookupOptionCollection.js.map +1 -1
- package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
- package/lib/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/lib/models/paging/PagesizeModel.js.map +1 -1
- package/lib/models/paging/PagingModel.js.map +1 -1
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/parameter/Parameter.js.map +1 -1
- package/lib/models/process/ProcessStatusSettingsModel.js.map +1 -1
- package/lib/models/resolveModel.js.map +1 -1
- package/lib/models/search/CaseSearchModel.js.map +1 -1
- package/lib/models/sorting/SortOptionModel.js.map +1 -1
- package/lib/models/sorting/SortingModel.js.map +1 -1
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/taskgroup/TaskGroupCollection.js.map +1 -1
- package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/lib/models/user/UserModel.js.map +1 -1
- package/lib/models/user/UserProfileModel.js.map +1 -1
- package/lib/models/user/UserServicesModel.js.map +1 -1
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/CaptchaRequest.js.map +1 -1
- package/lib/modularui/ModularUIError.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/ModularUIResponse.js.map +1 -1
- package/lib/modularui/UploadRequest.js.map +1 -1
- package/lib/modularui/index.js.map +1 -1
- package/lib/react/ErrorBoundary.js.map +1 -1
- package/lib/react/ErrorBoundaryFallback.js.map +1 -1
- package/lib/react/index.js.map +1 -1
- package/lib/react/utils.js.map +1 -1
- package/lib/react-client/Init.js.map +1 -1
- package/lib/react-client/client.js +6 -5
- package/lib/react-client/client.js.flow +14 -7
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-client/contextPath.js.map +1 -1
- package/lib/react-client/index.js.map +1 -1
- package/lib/react-client/rehydrate.js.map +1 -1
- package/lib/react-server/contextPath.js.map +1 -1
- package/lib/react-server/createSSRComplete.js.map +1 -1
- package/lib/react-server/htmlpage.js.map +1 -1
- package/lib/react-server/index.js.map +1 -1
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRMinimal.js.map +1 -1
- package/lib/react-server/requestInformation.js.map +1 -1
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/react-server/serverSSR.js.map +1 -1
- package/lib/react-server/serverUtil.js.map +1 -1
- package/lib/react-theme/ThemeProvider.js.map +1 -1
- package/lib/react-theme/createTheme.js.map +1 -1
- package/lib/react-theme/index.js.map +1 -1
- package/lib/react-theme/useTheme.js.map +1 -1
- package/lib/react-theme/utils/background.js.map +1 -1
- package/lib/react-theme/utils/colors.js.map +1 -1
- package/lib/react-theme/utils/contrast.js.map +1 -1
- package/lib/react-theme/utils/corners.js.map +1 -1
- package/lib/react-theme/utils/spacers.js.map +1 -1
- package/lib/react-theme/utils/themeProps.js.map +1 -1
- package/lib/redux/_i18n/I18nActions.js.map +1 -1
- package/lib/redux/_i18n/I18nReducer.js.map +1 -1
- package/lib/redux/_i18n/index.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/lib/redux/_modularui/ModularUIUtils.js.map +1 -1
- package/lib/redux/_modularui/index.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/redux/_router/RouterActions.js.map +1 -1
- package/lib/redux/_router/RouterConnectors.js.map +1 -1
- package/lib/redux/_router/RouterMiddleware.js.map +1 -1
- package/lib/redux/_router/RouterReducer.js.map +1 -1
- package/lib/redux/_router/index.js.map +1 -1
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/Error.js.map +1 -1
- package/lib/redux/actions/Form.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/lib/redux/actions/FormAutosave.js.map +1 -1
- package/lib/redux/actions/FormAutosubmit.js.map +1 -1
- package/lib/redux/actions/FormValidations.js.map +1 -1
- package/lib/redux/actions/Modals.js.map +1 -1
- package/lib/redux/actions/Notification.js.map +1 -1
- package/lib/redux/actions/Preferences.js.map +1 -1
- package/lib/redux/actions/ProgressIndicator.js.map +1 -1
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/SignOut.js.map +1 -1
- package/lib/redux/actions/index.js.map +1 -1
- package/lib/redux/connectors/Application.js.map +1 -1
- package/lib/redux/connectors/Breadcrumb.js.map +1 -1
- package/lib/redux/connectors/CaseView.js.map +1 -1
- package/lib/redux/connectors/ConceptDetail.js.map +1 -1
- package/lib/redux/connectors/ContentBrowser.js.map +1 -1
- package/lib/redux/connectors/ContentDetail.js.map +1 -1
- package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
- package/lib/redux/connectors/ListDetail.js.map +1 -1
- package/lib/redux/connectors/Modal.js.map +1 -1
- package/lib/redux/connectors/ModelCatalog.js.map +1 -1
- package/lib/redux/connectors/Notification.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/redux/connectors/Preferences.js.map +1 -1
- package/lib/redux/connectors/Progress.js.map +1 -1
- package/lib/redux/connectors/ProgressIndicator.js.map +1 -1
- package/lib/redux/connectors/QuickSearch.js.map +1 -1
- package/lib/redux/connectors/SignIn.js.map +1 -1
- package/lib/redux/connectors/SignOut.js.map +1 -1
- package/lib/redux/connectors/Tab.js.map +1 -1
- package/lib/redux/connectors/index.js.map +1 -1
- package/lib/redux/index.js.map +1 -1
- package/lib/redux/reducers/AuthReducer.js.map +1 -1
- package/lib/redux/reducers/ErrorReducer.js.map +1 -1
- package/lib/redux/reducers/ModalsReducer.js.map +1 -1
- package/lib/redux/reducers/NotificationReducer.js.map +1 -1
- package/lib/redux/reducers/PreferencesReducer.js.map +1 -1
- package/lib/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
- package/lib/redux/reducers/createReducer.js.map +1 -1
- package/lib/redux/reducers/index.js.map +1 -1
- package/lib/redux/selectors/i18n.js.map +1 -1
- package/lib/redux/selectors/index.js.map +1 -1
- package/lib/redux/store/beforeRenderHooks.js.map +1 -1
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/utils/browser/Cache.js.map +1 -1
- package/lib/utils/browser/Cookies.js.map +1 -1
- package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
- package/lib/utils/fetch/serverFetch.js.map +1 -1
- package/lib/utils/fetch/universalFetch.js.map +1 -1
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/checkResource.js.map +1 -1
- package/lib/utils/helpers/createHash.js.map +1 -1
- package/lib/utils/helpers/createUUID.js.map +1 -1
- package/lib/utils/helpers/index.js.map +1 -1
- package/lib/utils/helpers/objects.js.map +1 -1
- package/lib/utils/helpers/repositoryResource.js.map +1 -1
- package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
- package/lib/utils/helpers/text.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/number/DecimalFormat.js.map +1 -1
- package/lib/utils/number/formatValue.js.map +1 -1
- package/lib/utils/number/parseNumbers.js.map +1 -1
- package/package.json +5 -5
- package/src/react-client/client.js +14 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverUtil.js","names":["createReduxStore","requestHref","customReducers","initialState","history","createMemoryHistory","initialEntries","toString","store","configureStore","setI18n","locales","request","Array","isArray","IllegalArgumentException","mergedLocales","availableLocales","locale","code","customLocale","custLocale","deepmerge","forEach","some","push","enabledLocales","getSetting","localesInstance","Locales","preferredLocale","getPreferredLocale","dispatch","setLocales","setServerPreferencesFromArray","serverPreferences","serverPreference","name","defaultValue","type","setServerPreference","setServerPreferences","setAllContentInDataSetting","setLoginPreferences","preferencesProvider","isStudioContext","setPreference","setConfigurationTheme","configTheme","configFileLocation","getLayoutConfigFileLocation","configFilePath","dataFetcher","fetch","setThemePreference","Error","setApplication","getLocale","getState","application","ModularUIRequest","fetchSync","connectKey","initModels","key","model","e","console","info","handleErrors","state","error","shouldThrowOnServer","has","dehydrate","modularui","status","lastModification","undefined","filteredState","replace","createHead","sheet","UUID","helmetContext","style","getStyleTags","meta","helmet"],"sources":["../../src/react-server/serverUtil.js"],"sourcesContent":["// @flow\nimport { createMemoryHistory } from \"history\";\nimport { has } from \"../utils/helpers/objects\";\nimport deepmerge from \"deepmerge\";\n\nimport configureStore from \"../redux/store/configureStore\";\n\nimport { availableLocales } from \"../i18n/Locales\";\nimport Locales from \"../i18n/Locales\";\n\nimport { getPreferredLocale } from \"./requestInformation\";\nimport { setLocales } from \"../redux/_i18n/I18nActions\";\n\nimport {\n setServerPreference,\n setThemePreference,\n setPreference,\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\n\nimport { getSetting } from \"../constants/Settings\";\n\nimport { IllegalArgumentException } from \"../exceptions\";\n\nimport { initModels } from \"../redux\";\nimport { getLocale } from \"../redux/selectors/i18n\";\n\nimport ModularUIRequest from \"../modularui/ModularUIRequest\";\n\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { ReduxState, ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { RouterHistory } from \"react-router\";\n\nexport type PreferenceValue = {\n name: string,\n defaultValue?: string | null,\n type?: string,\n};\n\n/**\n */\nconst createReduxStore = (\n requestHref: Href,\n customReducers: Object,\n initialState?: $Shape<ReduxState>\n): ReduxStore => {\n // $FlowExpectedError\n const history: RouterHistory = createMemoryHistory({\n initialEntries: [requestHref.toString()],\n });\n\n const { store } = configureStore(history, customReducers, initialState);\n\n return store;\n};\n\n/**\n */\nconst setI18n = (\n store: ReduxStore,\n locales: Array<LocaleConfiguration> = [],\n request: HttpServletRequestJava\n) => {\n if (!Array.isArray(locales)) {\n throw new IllegalArgumentException(\"locales must be an array of objects\");\n }\n if (!request) {\n throw new IllegalArgumentException(\"missing request argument\");\n }\n\n const mergedLocales = availableLocales.map((locale) => {\n const code = locale.code;\n const customLocale = locales.find((custLocale) => custLocale.code === code);\n\n if (customLocale) {\n return deepmerge(locale, customLocale);\n }\n\n return locale;\n });\n\n locales.forEach((customLocale) => {\n if (!mergedLocales.some((locale) => locale.code === customLocale.code)) {\n mergedLocales.push(customLocale);\n }\n });\n\n const enabledLocales = mergedLocales.filter((locale: LocaleConfiguration) =>\n getSetting(\"ENABLED_LOCALES\").includes(locale.code)\n );\n\n const localesInstance = new Locales(enabledLocales);\n const preferredLocale = getPreferredLocale(request, localesInstance);\n store.dispatch(setLocales(localesInstance, preferredLocale ?? \"en\"));\n};\n\nconst setServerPreferencesFromArray = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>\n) => {\n serverPreferences.forEach((serverPreference) => {\n if (typeof serverPreference === \"object\") {\n const { name, defaultValue, type } = serverPreference;\n store.dispatch(setServerPreference(name, defaultValue, type));\n } else {\n store.dispatch(setServerPreference(serverPreference, null));\n }\n });\n};\n\n/**\n * Server preferences can be suplied by an array of preference names,\n * or an array of objects which has the name, an optional default value and an optional type.<br>\n * When the type is set to string, a comma separated value is not converted to an array:\n *\n * @example\n * // value becomes an array [default1, default2]\n * { name: \"prefName\", defaultValue: \"default1, default2\" }\n * // value remains a string \"default1, default2\"\n * { name: \"prefName\", defaultValue: \"default1, default2\", type: \"string\" }\n *\n * @param store\n * @param serverPreferences\n */\nconst setServerPreferences = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>\n) => {\n if (Array.isArray(serverPreferences)) {\n setServerPreferencesFromArray(store, serverPreferences);\n }\n\n store.dispatch(setAllContentInDataSetting());\n store.dispatch(setLoginPreferences());\n\n if (\n preferencesProvider &&\n preferencesProvider.isStudioContext &&\n preferencesProvider.isStudioContext()\n ) {\n store.dispatch(setPreference(\"isStudioContext\", true));\n }\n};\n\n/**\n */\nconst setConfigurationTheme = (store: ReduxStore) => {\n let configTheme = null;\n\n const configFileLocation = preferencesProvider.getLayoutConfigFileLocation();\n if (typeof configFileLocation === \"string\") {\n const configFilePath = configFileLocation.startsWith(\"/\")\n ? `/resource${configFileLocation}`\n : `/resource/${configFileLocation}`;\n\n configTheme = dataFetcher.fetch(configFilePath);\n\n if (configTheme) {\n store.dispatch(setThemePreference(configTheme));\n } else {\n throw new Error(\n `Could not read theme configuration file from: ${configFilePath}`\n );\n }\n }\n};\n\n/**\n */\nconst setApplication = (store: ReduxStore) => {\n try {\n const locale = getLocale(store.getState());\n const application = new ModularUIRequest(\"/\", {\n locale: locale,\n }).fetchSync();\n\n application.connectKey = `application(/)(${locale})`;\n\n store.dispatch(\n initModels([\n {\n key: `application(/)(${locale})`,\n model: application,\n },\n ])\n );\n } catch (e) {\n // eslint-disable-next-line no-console\n console.info(\"Could not load webapplication on server\");\n }\n};\n\n/**\n */\nconst handleErrors = (store: ReduxStore) => {\n const state = store.getState();\n\n if (\n state.error &&\n (state.error.shouldThrowOnServer ||\n !has(state.error, \"shouldThrowOnServer\"))\n ) {\n throw state.error;\n }\n};\n\n/**\n */\nconst dehydrate = (store: ReduxStore): string => {\n const state = store.getState();\n\n const modularui: {\n [key: string]: { status: string, lastModification: number, model: ?Object },\n } = {};\n\n for (const key in state.modularui) {\n const { status, model, lastModification } = state.modularui[key];\n\n if (model) {\n modularui[key] = {\n status,\n lastModification,\n model: model.dehydrate(),\n };\n } else {\n modularui[key] = {\n status,\n lastModification,\n model: undefined,\n };\n }\n }\n\n const filteredState = {\n ...state,\n modularui,\n };\n\n return JSON.stringify(filteredState).replace(/</g, \"\\\\u003c\");\n};\n\n/**\n */\nconst createHead = (\n sheet: any,\n UUID: string,\n helmetContext?: Object\n): Object => {\n const style = sheet.getStyleTags();\n const meta = helmetContext ? [...helmetContext.helmet.meta] : [];\n\n if (helmetContext) {\n return {\n ...helmetContext.helmet,\n style,\n meta,\n };\n }\n\n return {\n style,\n meta,\n };\n};\n\nexport {\n createReduxStore,\n setI18n,\n setApplication,\n setServerPreferences,\n setConfigurationTheme,\n createH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T,KAAK;IACRK;EACF,CAAC;EAED,OAAO,wBAAeI,aAAa,CAAC,CAACC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;AAC/D,CAAC;;AAED;AACA;AADA;AAEA,MAAMC,UAAU,GAAG,CACjBC,KAAU,EACVC,IAAY,EACZC,aAAsB,KACX;EACX,MAAMC,KAAK,GAAGH,KAAK,CAACI,YAAY,EAAE;EAClC,MAAMC,IAAI,GAAGH,aAAa,GAAG,CAAC,GAAGA,aAAa,CAACI,MAAM,CAACD,IAAI,CAAC,GAAG,EAAE;EAEhE,IAAIH,aAAa,EAAE;IACjB,OAAO;MACL,GAAGA,aAAa,CAACI,MAAM;MACvBH,KAAK;MACLE;IACF,CAAC;EACH;EAEA,OAAO;IACLF,KAAK;IACLE;EACF,CAAC;AACH,CAAC;AAAC"}
|
|
1
|
+
{"version":3,"file":"serverUtil.js","names":["_history","require","_objects","_deepmerge","_interopRequireDefault","_configureStore","_Locales","_interopRequireWildcard","_requestInformation","_I18nActions","_Preferences","_Settings","_exceptions","_redux","_i18n","_ModularUIRequest","_getRequireWildcardCache","nodeInterop","_WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","_Object$getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","createReduxStore","requestHref","customReducers","initialState","history","createMemoryHistory","initialEntries","toString","store","configureStore","exports","setI18n","locales","arguments","length","undefined","request","Array","isArray","IllegalArgumentException","mergedLocales","_map","availableLocales","locale","code","customLocale","_find","custLocale","deepmerge","forEach","some","push","enabledLocales","_filter","_context","_includes","getSetting","localesInstance","Locales","preferredLocale","getPreferredLocale","dispatch","setLocales","setServerPreferencesFromArray","serverPreferences","serverPreference","name","defaultValue","type","setServerPreference","setServerPreferences","setAllContentInDataSetting","setLoginPreferences","preferencesProvider","isStudioContext","setPreference","setConfigurationTheme","configTheme","configFileLocation","getLayoutConfigFileLocation","configFilePath","_startsWith","dataFetcher","fetch","setThemePreference","Error","setApplication","getLocale","getState","application","ModularUIRequest","fetchSync","connectKey","initModels","model","e","console","info","handleErrors","state","error","shouldThrowOnServer","dehydrate","modularui","status","lastModification","filteredState","_stringify","replace","createHead","sheet","UUID","helmetContext","style","getStyleTags","meta","helmet"],"sources":["../../src/react-server/serverUtil.js"],"sourcesContent":["// @flow\nimport { createMemoryHistory } from \"history\";\nimport { has } from \"../utils/helpers/objects\";\nimport deepmerge from \"deepmerge\";\n\nimport configureStore from \"../redux/store/configureStore\";\n\nimport { availableLocales } from \"../i18n/Locales\";\nimport Locales from \"../i18n/Locales\";\n\nimport { getPreferredLocale } from \"./requestInformation\";\nimport { setLocales } from \"../redux/_i18n/I18nActions\";\n\nimport {\n setServerPreference,\n setThemePreference,\n setPreference,\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\n\nimport { getSetting } from \"../constants/Settings\";\n\nimport { IllegalArgumentException } from \"../exceptions\";\n\nimport { initModels } from \"../redux\";\nimport { getLocale } from \"../redux/selectors/i18n\";\n\nimport ModularUIRequest from \"../modularui/ModularUIRequest\";\n\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { ReduxState, ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { RouterHistory } from \"react-router\";\n\nexport type PreferenceValue = {\n name: string,\n defaultValue?: string | null,\n type?: string,\n};\n\n/**\n */\nconst createReduxStore = (\n requestHref: Href,\n customReducers: Object,\n initialState?: $Shape<ReduxState>\n): ReduxStore => {\n // $FlowExpectedError\n const history: RouterHistory = createMemoryHistory({\n initialEntries: [requestHref.toString()],\n });\n\n const { store } = configureStore(history, customReducers, initialState);\n\n return store;\n};\n\n/**\n */\nconst setI18n = (\n store: ReduxStore,\n locales: Array<LocaleConfiguration> = [],\n request: HttpServletRequestJava\n) => {\n if (!Array.isArray(locales)) {\n throw new IllegalArgumentException(\"locales must be an array of objects\");\n }\n if (!request) {\n throw new IllegalArgumentException(\"missing request argument\");\n }\n\n const mergedLocales = availableLocales.map((locale) => {\n const code = locale.code;\n const customLocale = locales.find((custLocale) => custLocale.code === code);\n\n if (customLocale) {\n return deepmerge(locale, customLocale);\n }\n\n return locale;\n });\n\n locales.forEach((customLocale) => {\n if (!mergedLocales.some((locale) => locale.code === customLocale.code)) {\n mergedLocales.push(customLocale);\n }\n });\n\n const enabledLocales = mergedLocales.filter((locale: LocaleConfiguration) =>\n getSetting(\"ENABLED_LOCALES\").includes(locale.code)\n );\n\n const localesInstance = new Locales(enabledLocales);\n const preferredLocale = getPreferredLocale(request, localesInstance);\n store.dispatch(setLocales(localesInstance, preferredLocale ?? \"en\"));\n};\n\nconst setServerPreferencesFromArray = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>\n) => {\n serverPreferences.forEach((serverPreference) => {\n if (typeof serverPreference === \"object\") {\n const { name, defaultValue, type } = serverPreference;\n store.dispatch(setServerPreference(name, defaultValue, type));\n } else {\n store.dispatch(setServerPreference(serverPreference, null));\n }\n });\n};\n\n/**\n * Server preferences can be suplied by an array of preference names,\n * or an array of objects which has the name, an optional default value and an optional type.<br>\n * When the type is set to string, a comma separated value is not converted to an array:\n *\n * @example\n * // value becomes an array [default1, default2]\n * { name: \"prefName\", defaultValue: \"default1, default2\" }\n * // value remains a string \"default1, default2\"\n * { name: \"prefName\", defaultValue: \"default1, default2\", type: \"string\" }\n *\n * @param store\n * @param serverPreferences\n */\nconst setServerPreferences = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>\n) => {\n if (Array.isArray(serverPreferences)) {\n setServerPreferencesFromArray(store, serverPreferences);\n }\n\n store.dispatch(setAllContentInDataSetting());\n store.dispatch(setLoginPreferences());\n\n if (\n preferencesProvider &&\n preferencesProvider.isStudioContext &&\n preferencesProvider.isStudioContext()\n ) {\n store.dispatch(setPreference(\"isStudioContext\", true));\n }\n};\n\n/**\n */\nconst setConfigurationTheme = (store: ReduxStore) => {\n let configTheme = null;\n\n const configFileLocation = preferencesProvider.getLayoutConfigFileLocation();\n if (typeof configFileLocation === \"string\") {\n const configFilePath = configFileLocation.startsWith(\"/\")\n ? `/resource${configFileLocation}`\n : `/resource/${configFileLocation}`;\n\n configTheme = dataFetcher.fetch(configFilePath);\n\n if (configTheme) {\n store.dispatch(setThemePreference(configTheme));\n } else {\n throw new Error(\n `Could not read theme configuration file from: ${configFilePath}`\n );\n }\n }\n};\n\n/**\n */\nconst setApplication = (store: ReduxStore) => {\n try {\n const locale = getLocale(store.getState());\n const application = new ModularUIRequest(\"/\", {\n locale: locale,\n }).fetchSync();\n\n application.connectKey = `application(/)(${locale})`;\n\n store.dispatch(\n initModels([\n {\n key: `application(/)(${locale})`,\n model: application,\n },\n ])\n );\n } catch (e) {\n // eslint-disable-next-line no-console\n console.info(\"Could not load webapplication on server\");\n }\n};\n\n/**\n */\nconst handleErrors = (store: ReduxStore) => {\n const state = store.getState();\n\n if (\n state.error &&\n (state.error.shouldThrowOnServer ||\n !has(state.error, \"shouldThrowOnServer\"))\n ) {\n throw state.error;\n }\n};\n\n/**\n */\nconst dehydrate = (store: ReduxStore): string => {\n const state = store.getState();\n\n const modularui: {\n [key: string]: { status: string, lastModification: number, model: ?Object },\n } = {};\n\n for (const key in state.modularui) {\n const { status, model, lastModification } = state.modularui[key];\n\n if (model) {\n modularui[key] = {\n status,\n lastModification,\n model: model.dehydrate(),\n };\n } else {\n modularui[key] = {\n status,\n lastModification,\n model: undefined,\n };\n }\n }\n\n const filteredState = {\n ...state,\n modularui,\n };\n\n return JSON.stringify(filteredState).replace(/</g, \"\\\\u003c\");\n};\n\n/**\n */\nconst createHead = (\n sheet: any,\n UUID: string,\n helmetContext?: Object\n): Object => {\n const style = sheet.getStyleTags();\n const meta = helmetContext ? [...helmetContext.helmet.meta] : [];\n\n if (helmetContext) {\n return {\n ...helmetContext.helmet,\n style,\n meta,\n };\n }\n\n return {\n style,\n meta,\n };\n};\n\nexport {\n createReduxStore,\n setI18n,\n setApplication,\n setServerPreferences,\n setConf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ACI,MAAM,CAACD,IAAI,CAAC,GAAG,EAAE;EAEhE,IAAIH,aAAa,EAAE;IACjB,OAAO;MACL,GAAGA,aAAa,CAACI,MAAM;MACvBH,KAAK;MACLE;IACF,CAAC;EACH;EAEA,OAAO;IACLF,KAAK;IACLE;EACF,CAAC;AACH,CAAC;AAACrF,OAAA,CAAA+E,UAAA,GAAAA,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","names":["ThemeProvider","theme","children","storedTheme","useSelector","preferences","finalTheme","createTheme","displayName"],"sources":["../../src/react-theme/ThemeProvider.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport createTheme from \"./createTheme\";\n\nimport type { Node } from \"react\";\nimport type { Theme } from \"./types\";\n\nexport type Props = {\n +theme?: Theme | Array<Theme>,\n +children: Node,\n};\n\n/**\n */\nconst ThemeProvider = ({ theme, children }: Props): Node => {\n const storedTheme = useSelector(({ preferences }) => preferences.theme);\n const finalTheme = createTheme(storedTheme, theme);\n\n return <SCThemeProvider theme={finalTheme}>{children}</SCThemeProvider>;\n};\nThemeProvider.displayName = \"BI.ThemeProvider\";\n\nexport default ThemeProvider;\n"],"mappings":";;;;;;;AACA;AACA;AAEA;AAAwC;AAUxC;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","names":["_reactRedux","require","_styledComponents","_createTheme","_interopRequireDefault","_jsxRuntime","ThemeProvider","_ref","theme","children","storedTheme","useSelector","_ref2","preferences","finalTheme","createTheme","jsx","displayName","_default","exports","default"],"sources":["../../src/react-theme/ThemeProvider.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport createTheme from \"./createTheme\";\n\nimport type { Node } from \"react\";\nimport type { Theme } from \"./types\";\n\nexport type Props = {\n +theme?: Theme | Array<Theme>,\n +children: Node,\n};\n\n/**\n */\nconst ThemeProvider = ({ theme, children }: Props): Node => {\n const storedTheme = useSelector(({ preferences }) => preferences.theme);\n const finalTheme = createTheme(storedTheme, theme);\n\n return <SCThemeProvider theme={finalTheme}>{children}</SCThemeProvider>;\n};\nThemeProvider.displayName = \"BI.ThemeProvider\";\n\nexport default ThemeProvider;\n"],"mappings":";;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAwC,IAAAI,WAAA,GAAAJ,OAAA;AAUxC;AACA;AACA,MAAMK,aAAa,GAAGC,IAAA,IAAsC;EAAA,IAArC;IAAEC,KAAK;IAAEC;EAAgB,CAAC,GAAAF,IAAA;EAC/C,MAAMG,WAAW,GAAG,IAAAC,uBAAW,EAACC,KAAA;IAAA,IAAC;MAAEC;IAAY,CAAC,GAAAD,KAAA;IAAA,OAAKC,WAAW,CAACL,KAAK;EAAA,EAAC;EACvE,MAAMM,UAAU,GAAG,IAAAC,oBAAW,EAACL,WAAW,EAAEF,KAAK,CAAC;EAElD,oBAAO,IAAAH,WAAA,CAAAW,GAAA,EAACd,iBAAA,CAAAI,aAAe;IAACE,KAAK,EAAEM,UAAW;IAAAL,QAAA,EAAEA;EAAQ,EAAmB;AACzE,CAAC;AACDH,aAAa,CAACW,WAAW,GAAG,kBAAkB;AAAC,IAAAC,QAAA,GAEhCZ,aAAa;AAAAa,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTheme.js","names":["replacePlaceholders","inputTheme","possibleKeys","key","join","re","RegExp","forEach","value","replace","match","capture","generateTheme","storedTheme","generatedTheme","settings","themeElements","element","isPlainObject","createTheme","themeConfigs","customTheme","flattenDeep","setSettings"],"sources":["../../src/react-theme/createTheme.js"],"sourcesContent":["// @flow\nimport flattenDeep from \"lodash/flattenDeep\";\n\nimport { isPlainObject } from \"../utils/helpers/objects\";\n\nimport { setSettings } from \"../constants/Settings\";\n\nimport type { Theme } from \"./types\";\n\nconst replacePlaceholders = (inputTheme: Theme) => {\n const possibleKeys = Object.keys(inputTheme)\n .map((key) => `\\\\b${key}\\\\b`)\n .join(\"|\");\n\n const re = new RegExp(`\\\\$(${possibleKeys})`, \"g\");\n Object.entries(inputTheme).forEach(([key, value]) => {\n if (key !== \"settings\" && typeof value === \"string\") {\n inputTheme[key] = value.replace(\n re,\n // $FlowIssue[incompatible-call]\n (match, capture) => inputTheme[capture]\n );\n }\n });\n\n return inputTheme;\n};\n\nconst generateTheme = (storedTheme: Theme, ...themeElements: Array<Theme>) => {\n let generatedTheme = { settings: {} };\n for (const element of themeElements) {\n if (typeof element === \"function\") {\n generatedTheme = element(replacePlaceholders(generatedTheme));\n } else if (isPlainObject(element)) {\n // $FlowFixMe[cannot-spread-indexer]\n generatedTheme = { ...generatedTheme, ...element, ...storedTheme };\n }\n }\n\n // final - replace any assignments inside the theme\n return replacePlaceholders(generatedTheme);\n};\n\n/**\n * Create a theme from multiple theme configuration objects.\n * Properties are overwriten by iterating the configuration objects from left to right.\n *\n * The first argument represents a stored theme part, this is optional. The stored theme part will overwrite every part in the collection of theme parts.\n * Thus a stored configuration is leading as it can be configured by a modeller through the repository.\n *\n * Placeholders can be used, they are replaced before calling a function theme part or at the end of the theme creation.\n *\n * Both objects and function can be used, where a function receives the previous objects as input arguments.\n * For example using the method createTheme(ThemeObject, ThemeObject2, ThemeFunction, ThemeFunction2), will be handled as:\n *\n * ThemeFunction2(ThemeFunction1({ ...ThemeObject, ...ThemeObject2 }))\n *\n * @example\n * Example where the primary color of the default theme is overwritten with a primary color of the custom theme,\n * but the button bg still uses the yiq function of the default theme:\n *\n * const DefaultTheme = {\n * PRIMARY_COLOR: \"#0000ff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * BUTTON_COLOR: \"$PRIMARY_COLOR\"\n * }\n *\n * const createDefaultTheme = (input) => ({\n * ...input,\n * BUTTON_BG: getContrastYIQ(input.BUTTON_COLOR)\n * })\n *\n * const CustomTheme = {\n * PRIMARY_COLOR: \"#ff0000\"\n * }\n *\n * createTheme(null, DefaultTheme, CustomTheme, createDefaultTheme);\n *\n * // Result:\n * {\n * PRIMARY_COLOR: \"#ff0000\",\n * BUTTON_COLOR: \"#ff0000\",\n * BUTTON_BG: \"#fff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * }\n */\nconst createTheme = (\n storedTheme: Theme,\n ...themeConfigs: Array<Theme | Array<Theme> | void>\n):\n | any\n | {}\n | {\n INPUT_FOCUS_BORDER_COLOR?: string,\n LINK_HOVER_COLOR?: string,\n PAGING_HOVER_COLOR?: string,\n settings?: { [settingName: string]: string },\n } => {\n const customTheme = generateTheme(storedTheme, ...flattenDeep(themeConfigs));\n\n if (customTheme) {\n setSettings(customTheme.settings);\n }\n\n return customTheme;\n};\n\nexport default createTheme;\n"],"mappings":";;;;;;;;;;AACA;AAEA;AAEA;AAIA,
|
|
1
|
+
{"version":3,"file":"createTheme.js","names":["_flattenDeep","_interopRequireDefault","require","_objects","_Settings","replacePlaceholders","inputTheme","_context","possibleKeys","_map","default","_keys","call","key","join","re","RegExp","_entries","forEach","_ref","value","replace","match","capture","generateTheme","storedTheme","generatedTheme","settings","_len","arguments","length","themeElements","Array","_key","element","isPlainObject","createTheme","_len2","themeConfigs","_key2","customTheme","flattenDeep","setSettings","_default","exports"],"sources":["../../src/react-theme/createTheme.js"],"sourcesContent":["// @flow\nimport flattenDeep from \"lodash/flattenDeep\";\n\nimport { isPlainObject } from \"../utils/helpers/objects\";\n\nimport { setSettings } from \"../constants/Settings\";\n\nimport type { Theme } from \"./types\";\n\nconst replacePlaceholders = (inputTheme: Theme) => {\n const possibleKeys = Object.keys(inputTheme)\n .map((key) => `\\\\b${key}\\\\b`)\n .join(\"|\");\n\n const re = new RegExp(`\\\\$(${possibleKeys})`, \"g\");\n Object.entries(inputTheme).forEach(([key, value]) => {\n if (key !== \"settings\" && typeof value === \"string\") {\n inputTheme[key] = value.replace(\n re,\n // $FlowIssue[incompatible-call]\n (match, capture) => inputTheme[capture]\n );\n }\n });\n\n return inputTheme;\n};\n\nconst generateTheme = (storedTheme: Theme, ...themeElements: Array<Theme>) => {\n let generatedTheme = { settings: {} };\n for (const element of themeElements) {\n if (typeof element === \"function\") {\n generatedTheme = element(replacePlaceholders(generatedTheme));\n } else if (isPlainObject(element)) {\n // $FlowFixMe[cannot-spread-indexer]\n generatedTheme = { ...generatedTheme, ...element, ...storedTheme };\n }\n }\n\n // final - replace any assignments inside the theme\n return replacePlaceholders(generatedTheme);\n};\n\n/**\n * Create a theme from multiple theme configuration objects.\n * Properties are overwriten by iterating the configuration objects from left to right.\n *\n * The first argument represents a stored theme part, this is optional. The stored theme part will overwrite every part in the collection of theme parts.\n * Thus a stored configuration is leading as it can be configured by a modeller through the repository.\n *\n * Placeholders can be used, they are replaced before calling a function theme part or at the end of the theme creation.\n *\n * Both objects and function can be used, where a function receives the previous objects as input arguments.\n * For example using the method createTheme(ThemeObject, ThemeObject2, ThemeFunction, ThemeFunction2), will be handled as:\n *\n * ThemeFunction2(ThemeFunction1({ ...ThemeObject, ...ThemeObject2 }))\n *\n * @example\n * Example where the primary color of the default theme is overwritten with a primary color of the custom theme,\n * but the button bg still uses the yiq function of the default theme:\n *\n * const DefaultTheme = {\n * PRIMARY_COLOR: \"#0000ff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * BUTTON_COLOR: \"$PRIMARY_COLOR\"\n * }\n *\n * const createDefaultTheme = (input) => ({\n * ...input,\n * BUTTON_BG: getContrastYIQ(input.BUTTON_COLOR)\n * })\n *\n * const CustomTheme = {\n * PRIMARY_COLOR: \"#ff0000\"\n * }\n *\n * createTheme(null, DefaultTheme, CustomTheme, createDefaultTheme);\n *\n * // Result:\n * {\n * PRIMARY_COLOR: \"#ff0000\",\n * BUTTON_COLOR: \"#ff0000\",\n * BUTTON_BG: \"#fff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * }\n */\nconst createTheme = (\n storedTheme: Theme,\n ...themeConfigs: Array<Theme | Array<Theme> | void>\n):\n | any\n | {}\n | {\n INPUT_FOCUS_BORDER_COLOR?: string,\n LINK_HOVER_COLOR?: string,\n PAGING_HOVER_COLOR?: string,\n settings?: { [settingName: string]: string },\n } => {\n const customTheme = generateTheme(storedTheme, ...flattenDeep(themeConfigs));\n\n if (customTheme) {\n setSettings(customTheme.settings);\n }\n\n return customTheme;\n};\n\nexport default createTheme;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAIA,MAAMG,mBAAmB,GAAIC,UAAiB,IAAK;EAAA,IAAAC,QAAA;EACjD,MAAMC,YAAY,GAAG,IAAAC,IAAA,CAAAC,OAAA,EAAAH,QAAA,OAAAI,KAAA,CAAAD,OAAA,EAAYJ,UAAU,CAAC,EAAAM,IAAA,CAAAL,QAAA,EACpCM,GAAG,IAAM,MAAKA,GAAI,KAAI,CAAC,CAC5BC,IAAI,CAAC,GAAG,CAAC;EAEZ,MAAMC,EAAE,GAAG,IAAIC,MAAM,CAAE,OAAMR,YAAa,GAAE,EAAE,GAAG,CAAC;EAClD,IAAAS,QAAA,CAAAP,OAAA,EAAeJ,UAAU,CAAC,CAACY,OAAO,CAACC,IAAA,IAAkB;IAAA,IAAjB,CAACN,GAAG,EAAEO,KAAK,CAAC,GAAAD,IAAA;IAC9C,IAAIN,GAAG,KAAK,UAAU,IAAI,OAAOO,KAAK,KAAK,QAAQ,EAAE;MACnDd,UAAU,CAACO,GAAG,CAAC,GAAGO,KAAK,CAACC,OAAO,CAC7BN,EAAE;MACF;MACA,CAACO,KAAK,EAAEC,OAAO,KAAKjB,UAAU,CAACiB,OAAO,CAAC,CACxC;IACH;EACF,CAAC,CAAC;EAEF,OAAOjB,UAAU;AACnB,CAAC;AAED,MAAMkB,aAAa,GAAG,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EAACH,YAAY,CAAC,CAAC;EAE5E,IAAIE,WAAW,EAAE;IACf,IAAAE,qBAAW,EAACF,WAAW,CAACb,QAAQ,CAAC;EACnC;EAEA,OAAOa,WAAW;AACpB,CAAC;AAAC,IAAAG,QAAA,GAEaP,WAAW;AAAAQ,OAAA,CAAAlC,OAAA,GAAAiC,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/react-theme/index.js"],"sourcesContent":["// @flow\nexport { default as createTheme } from \"./createTheme\";\nexport { default as ThemeProvider } from \"./ThemeProvider\";\n\nexport * from \"./useTheme\";\n\nexport * from \"./utils/themeProps\";\n\nexport * from \"./utils/background\";\nexport * from \"./utils/colors\";\nexport * from \"./utils/contrast\";\nexport * from \"./utils/corners\";\nexport * from \"./utils/spacers\";\n\nexport type * from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;AACA;AAEA;
|
|
1
|
+
{"version":3,"file":"index.js","names":["_createTheme","_interopRequireDefault","require","_ThemeProvider","_useTheme","_Object$keys","forEach","key","Object","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_themeProps","_background","_colors","_contrast","_corners","_spacers"],"sources":["../../src/react-theme/index.js"],"sourcesContent":["// @flow\nexport { default as createTheme } from \"./createTheme\";\nexport { default as ThemeProvider } from \"./ThemeProvider\";\n\nexport * from \"./useTheme\";\n\nexport * from \"./utils/themeProps\";\n\nexport * from \"./utils/background\";\nexport * from \"./utils/colors\";\nexport * from \"./utils/contrast\";\nexport * from \"./utils/corners\";\nexport * from \"./utils/spacers\";\n\nexport type * from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAAAG,YAAA,CAAAD,SAAA,EAAAE,OAAA,WAAAC,GAA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A,WAAAA,CAAA;MAAA,OAAAK,QAAA,CAAAd,GAAA;IAAA;EAAA;AAAA;AACA,IAAAe,QAAA,GAAApB,OAAA;AAAAG,YAAA,CAAAiB,QAAA,EAAAhB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAC,MAAA,CAAAC,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAL,GAAA;EAAA,IAAAA,GAAA,IAAAM,OAAA,IAAAA,OAAA,CAAAN,GAAA,MAAAe,QAAA,CAAAf,GAAA;EAAAC,MAAA,CAAAM,cAAA,CAAAD,OAAA,EAAAN,GAAA;IAAAQ,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAM,QAAA,CAAAf,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.js","names":["useTheme","useContext","ThemeContext"],"sources":["../../src/react-theme/useTheme.js"],"sourcesContent":["// @flow\nimport { useContext } from \"react\";\nimport { ThemeContext } from \"styled-components\";\n\nimport type { Theme } from \"./types\";\n\n/**\n */\nconst useTheme = (): Theme => {\n return useContext(ThemeContext);\n};\n\nexport { useTheme };\n"],"mappings":";;;;;;AACA;AACA;AAIA;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"useTheme.js","names":["_react","require","_styledComponents","useTheme","useContext","ThemeContext","exports"],"sources":["../../src/react-theme/useTheme.js"],"sourcesContent":["// @flow\nimport { useContext } from \"react\";\nimport { ThemeContext } from \"styled-components\";\n\nimport type { Theme } from \"./types\";\n\n/**\n */\nconst useTheme = (): Theme => {\n return useContext(ThemeContext);\n};\n\nexport { useTheme };\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAIA;AACA;AACA,MAAME,QAAQ,GAAGA,CAAA,KAAa;EAC5B,OAAO,IAAAC,iBAAU,EAACC,8BAAY,CAAC;AACjC,CAAC;AAACC,OAAA,CAAAH,QAAA,GAAAA,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background.js","names":["renderBackground","path","defaultValue","theme","value","getThemeProp"],"sources":["../../../src/react-theme/utils/background.js"],"sourcesContent":["// @flow\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { ThemePropValue, UtilThemeProps } from \"../types\";\n\n/**\n */\nconst renderBackground =\n (path: string, defaultValue?: string): ((UtilThemeProps) => ThemePropValue) =>\n ({ theme }: UtilThemeProps) => {\n const value = getThemeProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return `background: ${value}`;\n }\n\n return value;\n };\n\nexport { renderBackground };\n"],"mappings":";;;;;;AACA;AAIA;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"background.js","names":["_themeProps","require","renderBackground","path","defaultValue","_ref","theme","value","getThemeProp","exports"],"sources":["../../../src/react-theme/utils/background.js"],"sourcesContent":["// @flow\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { ThemePropValue, UtilThemeProps } from \"../types\";\n\n/**\n */\nconst renderBackground =\n (path: string, defaultValue?: string): ((UtilThemeProps) => ThemePropValue) =>\n ({ theme }: UtilThemeProps) => {\n const value = getThemeProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return `background: ${value}`;\n }\n\n return value;\n };\n\nexport { renderBackground };\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAIA;AACA;AACA,MAAMC,gBAAgB,GACpBA,CAACC,IAAY,EAAEC,YAAqB,KACpCC,IAAA,IAA+B;EAAA,IAA9B;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EACxB,MAAME,KAAK,GAAG,IAAAC,wBAAY,EAACF,KAAK,EAAEH,IAAI,EAAEC,YAAY,CAAC;EAErD,IAAI,OAAOG,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAQ,eAAcA,KAAM,EAAC;EAC/B;EAEA,OAAOA,KAAK;AACd,CAAC;AAACE,OAAA,CAAAP,gBAAA,GAAAA,gBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","names":["darkenColor","amount","path","defaultValue","theme","darken","getThemeProp","lightenColor","lighten","changeHSL","color","saturation","lightness","hueAdjustment","hsl","parseToHsl","hue"],"sources":["../../../src/react-theme/utils/colors.js"],"sourcesContent":["// @flow\nimport { darken, hsl, lighten, parseToHsl } from \"polished\";\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\n/*\n * Themed color x amount darkened\n */\n/**\n */\nconst darkenColor =\n (\n amount: number | string,\n path: string,\n defaultValue?: string\n ): ((UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n darken(amount, getThemeProp(theme, path, defaultValue));\n\n/*\n * Themed color x amount lightened\n */\n/**\n */\nconst lightenColor =\n (\n amount: number | string,\n path: string,\n defaultValue?: string\n ): ((UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n lighten(amount, getThemeProp(theme, path, defaultValue));\n\n/*\n * Make a color lighter or darker in the same color family\n */\n/**\n */\nconst changeHSL = (\n color: string,\n saturation?: number,\n lightness?: number,\n hueAdjustment: number = 0\n): string => hsl(parseToHsl(color).hue + hueAdjustment, saturation, lightness);\n\nexport { darkenColor, lightenColor, changeHSL };\n"],"mappings":";;;;;;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"colors.js","names":["_polished","require","_themeProps","darkenColor","amount","path","defaultValue","_ref","theme","darken","getThemeProp","exports","lightenColor","_ref2","lighten","changeHSL","color","saturation","lightness","hueAdjustment","arguments","length","undefined","hsl","parseToHsl","hue"],"sources":["../../../src/react-theme/utils/colors.js"],"sourcesContent":["// @flow\nimport { darken, hsl, lighten, parseToHsl } from \"polished\";\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\n/*\n * Themed color x amount darkened\n */\n/**\n */\nconst darkenColor =\n (\n amount: number | string,\n path: string,\n defaultValue?: string\n ): ((UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n darken(amount, getThemeProp(theme, path, defaultValue));\n\n/*\n * Themed color x amount lightened\n */\n/**\n */\nconst lightenColor =\n (\n amount: number | string,\n path: string,\n defaultValue?: string\n ): ((UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n lighten(amount, getThemeProp(theme, path, defaultValue));\n\n/*\n * Make a color lighter or darker in the same color family\n */\n/**\n */\nconst changeHSL = (\n color: string,\n saturation?: number,\n lightness?: number,\n hueAdjustment: number = 0\n): string => hsl(parseToHsl(color).hue + hueAdjustment, saturation, lightness);\n\nexport { darkenColor, lightenColor, changeHSL };\n"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA;AACA;AACA;AACA;AACA;AACA,MAAME,WAAW,GACfA,CACEC,MAAuB,EACvBC,IAAY,EACZC,YAAqB,KAEvBC,IAAA;EAAA,IAAC;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EAAA,OACxB,IAAAE,gBAAM,EAACL,MAAM,EAAE,IAAAM,wBAAY,EAACF,KAAK,EAAEH,IAAI,EAAEC,YAAY,CAAC,CAAC;AAAA;;AAE3D;AACA;AACA;AACA;AACA;AADAK,OAAA,CAAAR,WAAA,GAAAA,WAAA;AAEA,MAAMS,YAAY,GAChBA,CACER,MAAuB,EACvBC,IAAY,EACZC,YAAqB,KAEvBO,KAAA;EAAA,IAAC;IAAEL;EAAsB,CAAC,GAAAK,KAAA;EAAA,OACxB,IAAAC,iBAAO,EAACV,MAAM,EAAE,IAAAM,wBAAY,EAACF,KAAK,EAAEH,IAAI,EAAEC,YAAY,CAAC,CAAC;AAAA;;AAE5D;AACA;AACA;AACA;AACA;AADAK,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAEA,MAAMG,SAAS,GAAG,SAAAA,CAChBC,KAAa,EACbC,UAAmB,EACnBC,SAAkB;EAAA,IAClBC,aAAqB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,OACd,IAAAG,aAAG,EAAC,IAAAC,oBAAU,EAACR,KAAK,CAAC,CAACS,GAAG,GAAGN,aAAa,EAAEF,UAAU,EAAEC,SAAS,CAAC;AAAA;AAACP,OAAA,CAAAI,SAAA,GAAAA,SAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contrast.js","names":["getColorContrast","color1","color2","luminance1","getLuminance","luminance2","parseFloat","toFixed","getYIQ","color","rgb","parseToRgb","red","green","blue","getContrastYIQ","dark","light","preferredColor","yiqColor","darkColor","lightColor","getBackgroundColor","theme","bgColorProperty","defaultValue","bgColor","getProp","backgroundColor","ThemePropertyException","renderContrastColor","preferredColorProperty","standardDarkProperty","standardLightProperty","settings","getThemeStringProp"],"sources":["../../../src/react-theme/utils/contrast.js"],"sourcesContent":["// @flow\nimport { getLuminance, parseToRgb } from \"polished\";\n\nimport { getThemeStringProp, getProp } from \"./themeProps\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\n\n/**\n * calculate the contrast ratio of two colors\n */\nconst getColorContrast = (color1: string, color2: string): number => {\n const luminance1 = getLuminance(color1);\n const luminance2 = getLuminance(color2);\n return parseFloat(\n (luminance1 > luminance2\n ? (luminance1 + 0.05) / (luminance2 + 0.05)\n : (luminance2 + 0.05) / (luminance1 + 0.05)\n ).toFixed(2)\n );\n};\n\n/*\n * The YIQ equation converts the RGB color (0 to 255) into a YIQ color space.\n * YIQ is the standard formula for calculating the perceived brightness of a color,\n * and is recommended by the World Wide Web Consortium (W3C).\n */\n/**\n */\nconst getYIQ = (color: string): number => {\n const rgb = parseToRgb(color);\n\n return (rgb.red * 299 + rgb.green * 587 + rgb.blue * 114) / 1000;\n};\n\n/**\n * Get dark or light color, depending on the given color\n * When the contrast between the color and the light or dark color is too low,\n * the preferred color is returned\n */\nconst getContrastYIQ = (\n color: string,\n dark: string = \"#212529\",\n light: string = \"#fff\",\n preferredColor?: string\n): string => {\n const yiqColor = getYIQ(color);\n\n if (preferredColor && getColorContrast(color, preferredColor) >= 4.5) {\n return preferredColor;\n }\n\n const darkColor = getYIQ(dark) < 127.5 ? dark : \"#212529\";\n const lightColor = getYIQ(light) > 127.5 ? light : \"#fff\";\n\n if (yiqColor > 127.5) {\n if (getColorContrast(color, darkColor) < 3) {\n return \"#212529\";\n }\n\n return darkColor;\n }\n\n if (getColorContrast(color, lightColor) < 3) {\n return \"#fff\";\n }\n return lightColor;\n};\n\n/**\n */\nconst getBackgroundColor = (\n theme: Theme,\n bgColorProperty: string,\n defaultValue: string\n) => {\n let bgColor = getProp(theme, bgColorProperty, defaultValue);\n\n if (typeof bgColor === \"object\") {\n bgColor = bgColor?.backgroundColor ?? defaultValue;\n }\n\n if (typeof bgColor === \"string\") {\n return bgColor;\n }\n\n throw new ThemePropertyException(\n `${bgColorProperty} is not a string, but: ${typeof bgColor}`\n );\n};\n\n/**\n * Retrieve the contrast color for the given background property,\n * based on theme properties\n */\nconst renderContrastColor =\n (\n bgColorProperty: string,\n preferredColorProperty?: string,\n standardDarkProperty: string = \"YIQ_DARK_COLOR\",\n standardLightProperty: string = \"YIQ_LIGHT_COLOR\"\n ): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) => {\n const bgColor = getBackgroundColor(theme, bgColorProperty, \"#ffffff\");\n const preferredColor = getThemeStringProp(theme, preferredColorProperty);\n const darkColor = getThemeStringProp(\n theme,\n standardDarkProperty,\n \"#212529\"\n );\n const lightColor = getThemeStringProp(theme, standardLightProperty, \"#fff\");\n\n return getContrastYIQ(bgColor, darkColor, lightColor, preferredColor);\n };\n\nexport { getColorContrast, getYIQ, getContrastYIQ, renderContrastColor };\n"],"mappings":";;;;;;AACA;AAEA;AAEA;AAIA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"contrast.js","names":["_polished","require","_themeProps","_exceptions","getColorContrast","color1","color2","luminance1","getLuminance","luminance2","parseFloat","toFixed","exports","getYIQ","color","rgb","parseToRgb","red","green","blue","getContrastYIQ","dark","arguments","length","undefined","light","preferredColor","yiqColor","darkColor","lightColor","getBackgroundColor","theme","bgColorProperty","defaultValue","bgColor","getProp","backgroundColor","ThemePropertyException","renderContrastColor","preferredColorProperty","standardDarkProperty","standardLightProperty","_ref","settings","getThemeStringProp"],"sources":["../../../src/react-theme/utils/contrast.js"],"sourcesContent":["// @flow\nimport { getLuminance, parseToRgb } from \"polished\";\n\nimport { getThemeStringProp, getProp } from \"./themeProps\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\n\n/**\n * calculate the contrast ratio of two colors\n */\nconst getColorContrast = (color1: string, color2: string): number => {\n const luminance1 = getLuminance(color1);\n const luminance2 = getLuminance(color2);\n return parseFloat(\n (luminance1 > luminance2\n ? (luminance1 + 0.05) / (luminance2 + 0.05)\n : (luminance2 + 0.05) / (luminance1 + 0.05)\n ).toFixed(2)\n );\n};\n\n/*\n * The YIQ equation converts the RGB color (0 to 255) into a YIQ color space.\n * YIQ is the standard formula for calculating the perceived brightness of a color,\n * and is recommended by the World Wide Web Consortium (W3C).\n */\n/**\n */\nconst getYIQ = (color: string): number => {\n const rgb = parseToRgb(color);\n\n return (rgb.red * 299 + rgb.green * 587 + rgb.blue * 114) / 1000;\n};\n\n/**\n * Get dark or light color, depending on the given color\n * When the contrast between the color and the light or dark color is too low,\n * the preferred color is returned\n */\nconst getContrastYIQ = (\n color: string,\n dark: string = \"#212529\",\n light: string = \"#fff\",\n preferredColor?: string\n): string => {\n const yiqColor = getYIQ(color);\n\n if (preferredColor && getColorContrast(color, preferredColor) >= 4.5) {\n return preferredColor;\n }\n\n const darkColor = getYIQ(dark) < 127.5 ? dark : \"#212529\";\n const lightColor = getYIQ(light) > 127.5 ? light : \"#fff\";\n\n if (yiqColor > 127.5) {\n if (getColorContrast(color, darkColor) < 3) {\n return \"#212529\";\n }\n\n return darkColor;\n }\n\n if (getColorContrast(color, lightColor) < 3) {\n return \"#fff\";\n }\n return lightColor;\n};\n\n/**\n */\nconst getBackgroundColor = (\n theme: Theme,\n bgColorProperty: string,\n defaultValue: string\n) => {\n let bgColor = getProp(theme, bgColorProperty, defaultValue);\n\n if (typeof bgColor === \"object\") {\n bgColor = bgColor?.backgroundColor ?? defaultValue;\n }\n\n if (typeof bgColor === \"string\") {\n return bgColor;\n }\n\n throw new ThemePropertyException(\n `${bgColorProperty} is not a string, but: ${typeof bgColor}`\n );\n};\n\n/**\n * Retrieve the contrast color for the given background property,\n * based on theme properties\n */\nconst renderContrastColor =\n (\n bgColorProperty: string,\n preferredColorProperty?: string,\n standardDarkProperty: string = \"YIQ_DARK_COLOR\",\n standardLightProperty: string = \"YIQ_LIGHT_COLOR\"\n ): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) => {\n const bgColor = getBackgroundColor(theme, bgColorProperty, \"#ffffff\");\n const preferredColor = getThemeStringProp(theme, preferredColorProperty);\n const darkColor = getThemeStringProp(\n theme,\n standardDarkProperty,\n \"#212529\"\n );\n const lightColor = getThemeStringProp(theme, standardLightProperty, \"#fff\");\n\n return getContrastYIQ(bgColor, darkColor, lightColor, preferredColor);\n };\n\nexport { getColorContrast, getYIQ, getContrastYIQ, renderContrastColor };\n"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAIA;AACA;AACA;AACA,MAAMG,gBAAgB,GAAGA,CAACC,MAAc,EAAEC,MAAc,KAAa;EACnE,MAAMC,UAAU,GAAG,IAAAC,sBAAY,EAACH,MAAM,CAAC;EACvC,MAAMI,UAAU,GAAG,IAAAD,sBAAY,EAACF,MAAM,CAAC;EACvC,OAAOI,UAAU,CACf,CAACH,UAAU,GAAG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EAAEC,eAAe,EAAE,SAAS,CAAC;IACrE,MAAMN,cAAc,GAAG,IAAAkB,8BAAkB,EAACb,KAAK,EAAEQ,sBAAsB,CAAC;IACxE,MAAMX,SAAS,GAAG,IAAAgB,8BAAkB,EAClCb,KAAK,EACLS,oBAAoB,EACpB,SAAS,CACV;IACD,MAAMX,UAAU,GAAG,IAAAe,8BAAkB,EAACb,KAAK,EAAEU,qBAAqB,EAAE,MAAM,CAAC;IAE3E,OAAOrB,cAAc,CAACc,OAAO,EAAEN,SAAS,EAAEC,UAAU,EAAEH,cAAc,CAAC;EACvE,CAAC;AAAA;AAACd,OAAA,CAAA0B,mBAAA,GAAAA,mBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corners.js","names":["DEFAULT_CORNER_PROPERTY","roundedCorners","property","path","defaultValue","theme","settings","ROUNDED_CORNERS","propertyName","getThemeStringProp"],"sources":["../../../src/react-theme/utils/corners.js"],"sourcesContent":["// @flow\nimport { getThemeStringProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\nconst DEFAULT_CORNER_PROPERTY = \"border-radius\";\n\n/*\n * Border radius based on the theme setting for rounded corners\n * When ROUNDED_CORNERS is not true in the theme, no rounded corners are returned\n */\n/**\n */\nconst roundedCorners =\n (\n property: string = DEFAULT_CORNER_PROPERTY,\n path: string = \"BORDER_RADIUS\",\n defaultValue: string = \"0.25rem\"\n ): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) => {\n if (theme.ROUNDED_CORNERS) {\n const propertyName =\n property && property !== DEFAULT_CORNER_PROPERTY\n ? `border-${property}-radius`\n : DEFAULT_CORNER_PROPERTY;\n\n return `${propertyName}: ${getThemeStringProp(\n theme,\n path,\n defaultValue\n )}`;\n }\n\n return \"\";\n };\n\nexport { roundedCorners };\n"],"mappings":";;;;;;AACA;AAIA,
|
|
1
|
+
{"version":3,"file":"corners.js","names":["_themeProps","require","DEFAULT_CORNER_PROPERTY","roundedCorners","property","arguments","length","undefined","path","defaultValue","_ref","theme","settings","ROUNDED_CORNERS","propertyName","getThemeStringProp","exports"],"sources":["../../../src/react-theme/utils/corners.js"],"sourcesContent":["// @flow\nimport { getThemeStringProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\nconst DEFAULT_CORNER_PROPERTY = \"border-radius\";\n\n/*\n * Border radius based on the theme setting for rounded corners\n * When ROUNDED_CORNERS is not true in the theme, no rounded corners are returned\n */\n/**\n */\nconst roundedCorners =\n (\n property: string = DEFAULT_CORNER_PROPERTY,\n path: string = \"BORDER_RADIUS\",\n defaultValue: string = \"0.25rem\"\n ): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) => {\n if (theme.ROUNDED_CORNERS) {\n const propertyName =\n property && property !== DEFAULT_CORNER_PROPERTY\n ? `border-${property}-radius`\n : DEFAULT_CORNER_PROPERTY;\n\n return `${propertyName}: ${getThemeStringProp(\n theme,\n path,\n defaultValue\n )}`;\n }\n\n return \"\";\n };\n\nexport { roundedCorners };\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAIA,MAAMC,uBAAuB,GAAG,eAAe;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAClB,SAAAA,CAAA;EAAA,IACEC,QAAgB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGH,uBAAuB;EAAA,IAC1CM,IAAY,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BI,YAAoB,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,SAAS;EAAA,OAElCK,IAAA,IAAkD;IAAA,IAAjD;MAAEC,KAAK,GAAG;QAAEC,QAAQ,EAAE,CAAC;MAAE;IAAkB,CAAC,GAAAF,IAAA;IAC3C,IAAIC,KAAK,CAACE,eAAe,EAAE;MACzB,MAAMC,YAAY,GAChBV,QAAQ,IAAIA,QAAQ,KAAKF,uBAAuB,GAC3C,UAASE,QAAS,SAAQ,GAC3BF,uBAAuB;MAE7B,OAAQ,GAAEY,YAAa,KAAI,IAAAC,8BAAkB,EAC3CJ,KAAK,EACLH,IAAI,EACJC,YAAY,CACZ,EAAC;IACL;IAEA,OAAO,EAAE;EACX,CAAC;AAAA;AAACO,OAAA,CAAAb,cAAA,GAAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spacers.js","names":["getSize","theme","ratio","path","unit","size","Big","times","IllegalStateException","IllegalArgumentException","spacer","settings","spacers","ratios","join","gutter"],"sources":["../../../src/react-theme/utils/spacers.js"],"sourcesContent":["// @flow\nimport Big from \"big.js\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\nimport IllegalArgumentException from \"../../exceptions/IllegalArgumentException\";\nimport IllegalStateException from \"../../exceptions/IllegalStateException\";\n\n/**\n */\nconst getSize = (\n theme: Theme,\n ratio: number | string = 1,\n path: string = \"SPACER\",\n unit: string = \"rem\"\n) => {\n if (typeof ratio === \"string\") {\n return ratio;\n }\n\n if (typeof ratio === \"number\") {\n if (typeof theme[path] === \"number\") {\n const size = Big(ratio).times(theme[path]);\n return `${size}${unit}`;\n }\n throw new IllegalStateException(`Size ${path} must be a number`);\n }\n\n throw new IllegalArgumentException(\n `Ratio ${JSON.stringify(ratio)} must be a string or number`\n );\n};\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n */\n/**\n */\nconst spacer =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n getSize(theme, ratio);\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n * Ratio's can be given clockwise with shorthand,\n * spacers(0.5, 1) with a spacer of 0.8 will give \"0.4rem 1rem\";\n */\n/**\n */\nconst spacers =\n (...ratios: Array<number | \"auto\">): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n ratios.map((ratio) => getSize(theme, ratio)).join(\" \");\n\n/*\n * Render a gutter based on GUTTER property\n */\n/**\n */\nconst gutter =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n getSize(theme, ratio, \"GRID_GUTTER\", \"px\");\n\nexport { spacer, spacers, gutter };\n"],"mappings":";;;;;;;;;AACA;AAGA;AACA;AAEA;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"spacers.js","names":["_big","_interopRequireDefault","require","_IllegalArgumentException","_IllegalStateException","getSize","theme","ratio","arguments","length","undefined","path","unit","size","Big","times","IllegalStateException","IllegalArgumentException","_stringify","default","spacer","_ref","settings","exports","spacers","_len","ratios","Array","_key","_ref2","_map","call","join","gutter","_ref3"],"sources":["../../../src/react-theme/utils/spacers.js"],"sourcesContent":["// @flow\nimport Big from \"big.js\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\nimport IllegalArgumentException from \"../../exceptions/IllegalArgumentException\";\nimport IllegalStateException from \"../../exceptions/IllegalStateException\";\n\n/**\n */\nconst getSize = (\n theme: Theme,\n ratio: number | string = 1,\n path: string = \"SPACER\",\n unit: string = \"rem\"\n) => {\n if (typeof ratio === \"string\") {\n return ratio;\n }\n\n if (typeof ratio === \"number\") {\n if (typeof theme[path] === \"number\") {\n const size = Big(ratio).times(theme[path]);\n return `${size}${unit}`;\n }\n throw new IllegalStateException(`Size ${path} must be a number`);\n }\n\n throw new IllegalArgumentException(\n `Ratio ${JSON.stringify(ratio)} must be a string or number`\n );\n};\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n */\n/**\n */\nconst spacer =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n getSize(theme, ratio);\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n * Ratio's can be given clockwise with shorthand,\n * spacers(0.5, 1) with a spacer of 0.8 will give \"0.4rem 1rem\";\n */\n/**\n */\nconst spacers =\n (...ratios: Array<number | \"auto\">): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n ratios.map((ratio) => getSize(theme, ratio)).join(\" \");\n\n/*\n * Render a gutter based on GUTTER property\n */\n/**\n */\nconst gutter =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n getSize(theme, ratio, \"GRID_GUTTER\", \"px\");\n\nexport { spacer, spacers, gutter };\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,yBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,sBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA,MAAMG,OAAO,GAAG,SAAAA,CACdC,KAAY,EAIT;EAAA,IAHHC,KAAsB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,IAC1BG,IAAY,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,QAAQ;EAAA,IACvBI,IAAY,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAEpB,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,IAAI,OAAOD,KAAK,CAACK,IAAI,CAAC,KAAK,QAAQ,EAAE;MACnC,MAAME,IAAI,GAAG,IAAAC,YAAG,EAACP,KAAK,CAAC,CAACQ,KAAK,CAACT,KAAK,CAACK,IAAI,CAAC,CAAC;MAC1C,OAAQ,GAAEE,IAAK,GAAED,IAAK,EAAC;IACzB;IACA,MAAM,IAAII,8BAAqB,CAAE,QAAOL,IAAK,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AAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,OAClB0B,KAAA;IAAA,IAAC;MAAE5B,KAAK,GAAG;QAAEgB,QAAQ,EAAE,CAAC;MAAE;IAAkB,CAAC,GAAAY,KAAA;IAAA,OAC3C7B,OAAO,CAACC,KAAK,EAAEC,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC;EAAA;AAAA;AAACgB,OAAA,CAAAU,MAAA,GAAAA,MAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeProps.js","names":["getProp","theme","path","defaultValue","get","getThemeProp","value","ThemePropertyException","getThemeStringProp","toString","getThemeNumberProp","themeProp"],"sources":["../../../src/react-theme/utils/themeProps.js"],"sourcesContent":["// @flow\nimport { get } from \"../../utils/helpers/objects\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, ThemePropValue } from \"../types\";\n\n/**\n */\nexport const getProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\"\n): ?ThemePropValue => {\n return path === \"\" ? defaultValue : get(theme, path, defaultValue);\n};\n\n/**\n */\nexport const getThemeProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\"\n): ThemePropValue => {\n const value = getProp(theme, path, defaultValue);\n\n if (\n value != null &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"object\")\n ) {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, number or plain object, but: ${typeof value}`\n );\n};\n\n/**\n */\nexport const getThemeStringProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: string = \"\"\n): string => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return value;\n } else if (typeof value === \"number\") {\n return value.toString();\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, but: ${typeof value}`\n );\n};\n\n/**\n */\nexport const getThemeNumberProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: number = 0\n): number => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"number\") {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a number, but: ${typeof value}`\n );\n};\n\n/*\n * Retrieve property value from theme property of styled component\n */\n/**\n */\nexport const themeProp =\n (\n path: string,\n defaultValue?: ThemePropValue\n ): (({ theme: Theme }) => ThemePropValue) =>\n ({ theme }: { theme: Theme }) =>\n getThemeProp(theme, path, defaultValue);\n"],"mappings":";;;;;;AACA;AAEA;AAIA;AACA;AACO,
|
|
1
|
+
{"version":3,"file":"themeProps.js","names":["_objects","require","_exceptions","getProp","theme","arguments","length","undefined","path","defaultValue","get","exports","getThemeProp","value","ThemePropertyException","getThemeStringProp","toString","getThemeNumberProp","themeProp","_ref"],"sources":["../../../src/react-theme/utils/themeProps.js"],"sourcesContent":["// @flow\nimport { get } from \"../../utils/helpers/objects\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, ThemePropValue } from \"../types\";\n\n/**\n */\nexport const getProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\"\n): ?ThemePropValue => {\n return path === \"\" ? defaultValue : get(theme, path, defaultValue);\n};\n\n/**\n */\nexport const getThemeProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\"\n): ThemePropValue => {\n const value = getProp(theme, path, defaultValue);\n\n if (\n value != null &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"object\")\n ) {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, number or plain object, but: ${typeof value}`\n );\n};\n\n/**\n */\nexport const getThemeStringProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: string = \"\"\n): string => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return value;\n } else if (typeof value === \"number\") {\n return value.toString();\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, but: ${typeof value}`\n );\n};\n\n/**\n */\nexport const getThemeNumberProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: number = 0\n): number => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"number\") {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a number, but: ${typeof value}`\n );\n};\n\n/*\n * Retrieve property value from theme property of styled component\n */\n/**\n */\nexport const themeProp =\n (\n path: string,\n defaultValue?: ThemePropValue\n ): (({ theme: Theme }) => ThemePropValue) =>\n ({ theme }: { theme: Theme }) =>\n getThemeProp(theme, path, defaultValue);\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAIA;AACA;AACO,MAAME,OAAO,GAAG,SAAAA,CAAA,EAID;EAAA,IAHpBC,KAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IACzBG,IAAY,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,IACjBI,YAA4B,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAEjC,OAAOG,IAAI,KAAK,EAAE,GAAGC,YAAY,GAAG,IAAAC,YAAG,EAACN,KAAK,EAAEI,IAAI,EAAEC,YAAY,CAAC;AACpE,CAAC;;AAED;AACA;AADAE,OAAA,CAAAR,OAAA,GAAAA,OAAA;AAEO,MAAMS,YAAY,GAAG,SAAAA,CAAA,EAIP;EAAA,IAHnBR,KAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IACzBG,IAAY,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE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,MAAME,kBAAkB,GAAG,SAAAA,CAAA,EAIrB;EAAA,IAHXb,KAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IACzBG,IAAY,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,IACjBI,YAAoB,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAExB,MAAMQ,KAAK,GAAGV,OAAO,CAACC,KAAK,EAAEI,IAAI,EAAEC,YAAY,CAAC;EAEhD,IAAI,OAAOI,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,MAAM,IAAIC,kCAAsB,CAC7B,GAAEN,IAAK,0BAAyB,OAAOK,KAAM,EAAC,CAChD;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AADAF,OAAA,CAAAM,kBAAA,GAAAA,kBAAA;AAEO,MAAMC,SAAS,GACpBA,CACEV,IAAY,EACZC,YAA6B,KAE/BU,IAAA;EAAA,IAAC;IAAEf;EAAwB,CAAC,GAAAe,IAAA;EAAA,OAC1BP,YAAY,CAACR,KAAK,EAAEI,IAAI,EAAEC,YAAY,CAAC;AAAA;AAACE,OAAA,CAAAO,SAAA,GAAAA,SAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I18nActions.js","names":["receiveLocale","locale","type","payload","updateLocale","dispatch","startProgress","finishProgress","setLocales","locales"],"sources":["../../../src/redux/_i18n/I18nActions.js"],"sourcesContent":["// @flow\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport type Locales from \"../../i18n/Locales\";\nimport type { SetLocalesAction, UpdateLocaleAction } from \"./types\";\nimport type { ThunkAction } from \"../types\";\n\n/**\n * Update current locale\n */\nexport const receiveLocale = (locale: string): UpdateLocaleAction => ({\n type: \"UPDATE_LOCALE\",\n payload: locale,\n});\n\n/**\n * Change locale of application and redirect\n */\nexport const updateLocale =\n (locale: string): ThunkAction =>\n (dispatch) => {\n dispatch(startProgress());\n dispatch(receiveLocale(locale));\n\n dispatch(finishProgress());\n };\n\n/**\n */\nexport const setLocales = (\n locales: Locales,\n locale: string\n): SetLocalesAction => ({\n type: \"SET_LOCALES\",\n payload: {\n locales,\n locale,\n },\n});\n"],"mappings":";;;;;;AACA;AAMA;AACA;AACA;AACO,
|
|
1
|
+
{"version":3,"file":"I18nActions.js","names":["_ProgressIndicator","require","receiveLocale","locale","type","payload","exports","updateLocale","dispatch","startProgress","finishProgress","setLocales","locales"],"sources":["../../../src/redux/_i18n/I18nActions.js"],"sourcesContent":["// @flow\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport type Locales from \"../../i18n/Locales\";\nimport type { SetLocalesAction, UpdateLocaleAction } from \"./types\";\nimport type { ThunkAction } from \"../types\";\n\n/**\n * Update current locale\n */\nexport const receiveLocale = (locale: string): UpdateLocaleAction => ({\n type: \"UPDATE_LOCALE\",\n payload: locale,\n});\n\n/**\n * Change locale of application and redirect\n */\nexport const updateLocale =\n (locale: string): ThunkAction =>\n (dispatch) => {\n dispatch(startProgress());\n dispatch(receiveLocale(locale));\n\n dispatch(finishProgress());\n };\n\n/**\n */\nexport const setLocales = (\n locales: Locales,\n locale: string\n): SetLocalesAction => ({\n type: \"SET_LOCALES\",\n payload: {\n locales,\n locale,\n },\n});\n"],"mappings":";;;;;;AACA,IAAAA,kBAAA,GAAAC,OAAA;AAMA;AACA;AACA;AACO,MAAMC,aAAa,GAAIC,MAAc,KAA0B;EACpEC,IAAI,EAAE,eAAe;EACrBC,OAAO,EAAEF;AACX,CAAC,CAAC;;AAEF;AACA;AACA;AAFAG,OAAA,CAAAJ,aAAA,GAAAA,aAAA;AAGO,MAAMK,YAAY,GACtBJ,MAAc,IACdK,QAAQ,IAAK;EACZA,QAAQ,CAAC,IAAAC,gCAAa,GAAE,CAAC;EACzBD,QAAQ,CAACN,aAAa,CAACC,MAAM,CAAC,CAAC;EAE/BK,QAAQ,CAAC,IAAAE,iCAAc,GAAE,CAAC;AAC5B,CAAC;;AAEH;AACA;AADAJ,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAEO,MAAMI,UAAU,GAAGA,CACxBC,OAAgB,EAChBT,MAAc,MACQ;EACtBC,IAAI,EAAE,aAAa;EACnBC,OAAO,EAAE;IACPO,OAAO;IACPT;EACF;AACF,CAAC,CAAC;AAACG,OAAA,CAAAK,UAAA,GAAAA,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I18nReducer.js","names":["updateLocale","state","locale","setCookie","Cache","clear","setLocales","locales","initialState","Locales","I18nReducer","action","type","payload"],"sources":["../../../src/redux/_i18n/I18nReducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport { setCookie } from \"../../utils/browser/Cookies\";\n\nimport Locales from \"../../i18n/Locales\";\n\nimport type { Reducer } from \"redux\";\nimport type { I18nState } from \"./types\";\nimport type { ReduxAction } from \"../types\";\n\n/**\n */\nconst updateLocale = (state: I18nState, locale: string) => {\n // set locale in cookie\n setCookie(\"locale\", locale);\n\n // clear cache because of cached contributions\n Cache.clear();\n\n return {\n ...state,\n locale,\n };\n};\n\n/**\n */\nconst setLocales = (\n state: I18nState,\n { locale, locales }: { locale: string, locales: Locales }\n) => {\n // set locale in cookie\n setCookie(\"locale\", locale);\n\n if (locale) {\n return {\n ...state,\n locales,\n locale,\n };\n }\n\n return {\n ...state,\n locales,\n };\n};\n\n// REDUCER\nconst initialState: I18nState = {\n locales: new Locales(),\n locale: \"en\",\n};\n\n/**\n * Form reducer\n */\nexport const I18nReducer: Reducer<I18nState, ReduxAction> = (\n state = initialState,\n action = void 0\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"SET_LOCALES\":\n return setLocales(state, action.payload);\n\n case \"UPDATE_LOCALE\":\n return updateLocale(state, action.payload);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;AACA;AACA;AAEA;AAMA;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"I18nReducer.js","names":["_Cache","_interopRequireDefault","require","_Cookies","_Locales","updateLocale","state","locale","setCookie","Cache","clear","setLocales","_ref","locales","initialState","Locales","I18nReducer","arguments","length","undefined","action","type","payload","exports"],"sources":["../../../src/redux/_i18n/I18nReducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport { setCookie } from \"../../utils/browser/Cookies\";\n\nimport Locales from \"../../i18n/Locales\";\n\nimport type { Reducer } from \"redux\";\nimport type { I18nState } from \"./types\";\nimport type { ReduxAction } from \"../types\";\n\n/**\n */\nconst updateLocale = (state: I18nState, locale: string) => {\n // set locale in cookie\n setCookie(\"locale\", locale);\n\n // clear cache because of cached contributions\n Cache.clear();\n\n return {\n ...state,\n locale,\n };\n};\n\n/**\n */\nconst setLocales = (\n state: I18nState,\n { locale, locales }: { locale: string, locales: Locales }\n) => {\n // set locale in cookie\n setCookie(\"locale\", locale);\n\n if (locale) {\n return {\n ...state,\n locales,\n locale,\n };\n }\n\n return {\n ...state,\n locales,\n };\n};\n\n// REDUCER\nconst initialState: I18nState = {\n locales: new Locales(),\n locale: \"en\",\n};\n\n/**\n * Form reducer\n */\nexport const I18nReducer: Reducer<I18nState, ReduxAction> = (\n state = initialState,\n action = void 0\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"SET_LOCALES\":\n return setLocales(state, action.payload);\n\n case \"UPDATE_LOCALE\":\n return updateLocale(state, action.payload);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AAMA;AACA;AACA,MAAMG,YAAY,GAAGA,CAACC,KAAgB,EAAEC,MAA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"version":3,"file":"index.js","names":[],"sources":["../../../src/redux/_i18n/index.js"],"sourcesContent":["// @flow\nexport * from \"./I18nReducer\";\n\nexport * from \"./I18nActions\";\n\nexport type * from \"./types\";\n"],"mappings":";;;;;;AACA;
|
|
1
|
+
{"version":3,"file":"index.js","names":["_I18nReducer","require","_Object$keys","forEach","key","exports","Object","defineProperty","enumerable","get","_I18nActions"],"sources":["../../../src/redux/_i18n/index.js"],"sourcesContent":["// @flow\nexport * from \"./I18nReducer\";\n\nexport * from \"./I18nActions\";\n\nexport type * from \"./types\";\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,YAAA,CAAAF,YAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAJ,YAAA,CAAAI,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAM,YAAA,GAAAT,OAAA;AAAAC,YAAA,CAAAQ,YAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,YAAA,CAAAN,GAAA;EAAAE,MAAA,CAAAC,cAAA,CAAAF,OAAA,EAAAD,GAAA;IAAAI,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAN,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIActions.js","names":["setModel","key","model","connectKey","type","payload","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","modelToUpdate","clonedModel","clone","update","Error","loadModel","href","options","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","forceTargetModel","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","LOADING","startProgress","loadModelPromise","resolve","then","response","FINISHED","finishProgress","catch","handleError","reloadModel","selfhref","isReload"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const updateForm = (model: ModularUIModel): UpdateFormAction => ({\n type: \"MODULARUI/UPDATE_FORM\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n modelToUpdate: ?ModularUIModel\n): UpdateModelAction | SetModelAction => {\n if (modelToUpdate) {\n // $FlowFixMe[prop-missing]\n if (typeof modelToUpdate[\"update\"] === \"function\") {\n const clonedModel = modelToUpdate.clone();\n clonedModel.update(model);\n\n return updateModel(clonedModel);\n }\n\n throw new Error(\n `loadModel action: updateModel is set as option for ${key}, but the model is missing an update methode`\n );\n }\n\n return setModel(key, model);\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n href: href instanceof Href ? href : new Href(href),\n method: options?.method ?? HTTP_METHODS.GET,\n data: options?.data,\n locale: options?.locale ?? \"en\",\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateModel),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key);\n if (errorResponse.isChangePassword) {\n return {\n type: \"NO_ACTION\",\n };\n } else if (errorResponse.isResourceNotFoundAfterReload) {\n return removeModelByKey(key);\n }\n\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then((response) => {\n if (response?.type === \"FINISH_PROGRESS\") {\n dispatch(updateStatus(key, MODULARUI_STATUS.FINISHED));\n }\n\n return dispatch(finishProgress());\n })\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACO,
|
|
1
|
+
{"version":3,"file":"ModularUIActions.js","names":["_Constants","require","_Href","_interopRequireDefault","_ErrorResponse","_ProgressIndicator","_Error","setModel","key","model","connectKey","type","payload","exports","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","modelToUpdate","clonedModel","clone","update","Error","loadModel","href","options","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","forceTargetModel","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","LOADING","startProgress","loadModelPromise","_promise","default","resolve","then","response","FINISHED","finishProgress","catch","handleError","reloadModel","selfhref","isReload"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const updateForm = (model: ModularUIModel): UpdateFormAction => ({\n type: \"MODULARUI/UPDATE_FORM\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n modelToUpdate: ?ModularUIModel\n): UpdateModelAction | SetModelAction => {\n if (modelToUpdate) {\n // $FlowFixMe[prop-missing]\n if (typeof modelToUpdate[\"update\"] === \"function\") {\n const clonedModel = modelToUpdate.clone();\n clonedModel.update(model);\n\n return updateModel(clonedModel);\n }\n\n throw new Error(\n `loadModel action: updateModel is set as option for ${key}, but the model is missing an update methode`\n );\n }\n\n return setModel(key, model);\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n href: href instanceof Href ? href : new Href(href),\n method: options?.method ?? HTTP_METHODS.GET,\n data: options?.data,\n locale: options?.locale ?? \"en\",\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateModel),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key);\n if (errorResponse.isChangePassword) {\n return {\n type: \"NO_ACTION\",\n };\n } else if (errorResponse.isResourceNotFoundAfterReload) {\n return removeModelByKey(key);\n }\n\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then((response) => {\n if (response?.type === \"FINISH_PROGRESS\") {\n dispatch(updateStatus(key, MODULARUI_STATUS.FINISHED));\n }\n\n return dispatch(finishProgress());\n })\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAgBA;AACA;AACO,MAAMM,QAAQ,GAAGA,CACtBC,GAAW,EACXC,KAAqB,KACF;EACnB;EACAA,KAAK,CAACC,UAAU,GAAGF,GAAG;EACtB,OAAO;IACLG,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;MACPJ,GAAG;MACHC;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AADAI,OAAA,CAAAN,QAAA,GAAAA,QAAA;AAEO,MAAMO,UAAU,GACrBC,MAAqD,KAChC;EAC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,CACEzC,GAAW,EACXqB,IAAmB,EACnBC,OAAiC,KAElCoB,QAAkB,IAAK;EACtBA,QAAQ,CAAC9B,YAAY,CAACZ,GAAG,EAAEuC,2BAAgB,CAACI,OAAO,CAAC,CAAC;EACrDD,QAAQ,CAAC,IAAAE,gCAAa,GAAE,CAAC;EAEzB,MAAMC,gBAAgB,GAAGH,QAAQ,CAACtB,SAAS,CAACpB,GAAG,EAAEqB,IAAI,EAAEC,OAAO,CAAC,CAAC;EAEhE,OAAOwB,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAACH,gBAAgB,CAAC,CACrCI,IAAI,CAAEC,QAAQ,IAAK;IAClB,IAAIA,QAAQ,EAAE/C,IAAI,KAAK,iBAAiB,EAAE;MACxCuC,QAAQ,CAAC9B,YAAY,CAACZ,GAAG,EAAEuC,2BAAgB,CAACY,QAAQ,CAAC,CAAC;IACxD;IAEA,OAAOT,QAAQ,CAAC,IAAAU,iCAAc,GAAE,CAAC;EACnC,CAAC,CAAC,CACDC,KAAK,CAAEnB,KAAK,IAAKQ,QAAQ,CAAC,IAAAY,kBAAW,EAACpB,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;;AAEH;AACA;AADA7B,OAAA,CAAAoC,aAAA,GAAAA,aAAA;AAEO,MAAMc,WAAW,GAAGA,CACzBtD,KAAqB,EACrBqB,OAAiC,KAEjCmB,aAAa,CAACxC,KAAK,CAACC,UAAU,EAAED,KAAK,CAACuD,QAAQ,EAAE;EAC9C,GAAGlC,OAAO;EACVmC,QAAQ,EAAE;AACZ,CAAC,CAAC;AAACpD,OAAA,CAAAkD,WAAA,GAAAA,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIConnector.js","names":["modularUIConnector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","dispatch","useDispatch","location","useLocation","url","useUrl","displayName","getDisplayName","contextId","modelEntry","useModularUI","modelKey","model","connectKey","handleManualReload","reloadOptions","reloadModel","handleFetch","href","fetchOptions","loadModularUI","reload","state","doReload","useReload","useEffect","isReload","removeModelByKey","locale","useLocale","newProps","status","lastModification","hasModel","Boolean","fetchModularUI"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport {\n loadModularUI,\n reloadModel,\n removeModelByKey,\n} from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\n/**\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false }\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, otherOptions);\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(loadModularUI(modelKey, href, fetchOptions));\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, { ...otherOptions, isReload: true })\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(() => {\n return () => {\n if (removeOnUnmount) {\n dispatch(removeModelByKey(modelKey));\n }\n };\n }, [dispatch, modelKey]);\n\n // Create new properties object to inject modularui properties to own props\n const locale = useLocale();\n const newProps: InjectedProps = {\n modelKey,\n [propName]: modelEntry ? modelEntry.model : null,\n location,\n status: modelEntry ? modelEntry.status : null,\n lastModification: modelEntry ? modelEntry.lastModification : null,\n hasModel: Boolean(modelEntry),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(\n WrappedComponent,\n name\n )}`;\n\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":";;;;;;;AACA;AACA;AACA;AAEA;AAMA;AACA;AAEA;AACA;AACA;AAAgD;AAmBhD;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"ModularUIConnector.js","names":["_react","require","_reactRedux","_reactRouter","_ModularUIActions","_Href","_interopRequireDefault","_utils","_ModularUIUtils","_useModularUI","_useI18n","_jsxRuntime","modularUIConnector","name","resource","options","arguments","length","undefined","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","dispatch","useDispatch","location","useLocation","url","useUrl","displayName","getDisplayName","contextId","modelEntry","useModularUI","modelKey","model","connectKey","handleManualReload","reloadOptions","reloadModel","handleFetch","href","fetchOptions","loadModularUI","reload","state","doReload","useReload","useEffect","isReload","removeModelByKey","locale","useLocale","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","jsx","_default","exports","default"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport {\n loadModularUI,\n reloadModel,\n removeModelByKey,\n} from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\n/**\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false }\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, otherOptions);\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(loadModularUI(modelKey, href, fetchOptions));\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, { ...otherOptions, isReload: true })\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(() => {\n return () => {\n if (removeOnUnmount) {\n dispatch(removeModelByKey(modelKey));\n }\n };\n }, [dispatch, modelKey]);\n\n // Create new properties object to inject modularui properties to own props\n const locale = useLocale();\n const newProps: InjectedProps = {\n modelKey,\n [propName]: modelEntry ? modelEntry.model : null,\n location,\n status: modelEntry ? modelEntry.status : null,\n lastModification: modelEntry ? modelEntry.lastModification : null,\n hasModel: Boolean(modelEntry),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(\n WrappedComponent,\n name\n )}`;\n\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAH,OAAA;AAMA,IAAAI,KAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAAgD,IAAAU,WAAA,GAAAV,OAAA;AAmBhD;AACA;AACA,MAAMW,kBAAkB,GAAG,SAAAA,CACzBC,IAAY,EACZC,QAA2B,EAEmC;EAAA,IAD9DC,OAAyB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG;IAAEG,QAAQ,EAAE,MAAM;IAAEC,eAAe,EAAE;EAAM,CAAC;EAExE,MAA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P_METHODS","GET","data","locale","childmodels","isReload","targetModel","forceTargetModel","responseHandler","next","dispatch","successAction","model","successResult","then","result","catch","error","handleError","Error","finishProgress","errorHandler","errorAction","err","errorResult","handleFetch","action","startProgress","requestOptions","payload","modularuiRequest","fetch","modularUIMiddleware","api","type","getState","i18n"],"sources":["../../../src/redux/_modularui/ModularUIMiddleware.js"],"sourcesContent":["// @flow\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport type { Middleware, MiddlewareAPI } from \"redux\";\nimport type {\n ReduxAction,\n ReduxState,\n Dispatch,\n PossibleAction,\n} from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIAction, SuccessAction, ErrorAction } from \"./types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\ntype RequestOptions = {\n href: Href,\n method?: $Keys<typeof HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n isReload?: boolean,\n};\n\n/**\n * Symbol key that carries API call info interpreted by this Redux middleware.\n */\nconst createRequest = (modularui: RequestOptions): ModularUIRequest => {\n const request = new ModularUIRequest(modularui.href, {\n method: modularui.method || HTTP_METHODS.GET,\n data: modularui.data || {},\n locale: modularui.locale,\n childmodels: modularui.childmodels ?? true,\n isReload: modularui.isReload,\n });\n\n if (modularui.targetModel) {\n request.targetModel = modularui.targetModel;\n request.forceTargetModel = modularui.forceTargetModel ?? false;\n }\n\n return request;\n};\n\n/**\n */\nconst responseHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n successAction: SuccessAction,\n model: ModularUIModel\n) => {\n if (successAction) {\n const successResult = successAction(model);\n\n if (successResult instanceof Promise) {\n successResult\n .then((result) => {\n dispatch(result);\n })\n .catch((error) => {\n next(handleError(error));\n });\n } else {\n try {\n dispatch(successResult);\n } catch (error) {\n throw new Error(\n `Result of successResult is not a valid redux action: ${error}`\n );\n }\n }\n }\n\n return next(finishProgress());\n};\n\n/**\n */\nconst errorHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n errorAction: ?ErrorAction,\n err: any\n) => {\n dispatch(finishProgress());\n\n if (errorAction) {\n const errorResult = errorAction(err);\n\n if (errorResult instanceof Promise) {\n errorResult.then((result) => dispatch(result));\n } else {\n dispatch(errorResult);\n }\n }\n\n return next(handleError(err));\n};\n\n/**\n */\nconst handleFetch = (\n action: ModularUIAction,\n locale: string,\n dispatch: Dispatch,\n next: Dispatch\n) => {\n dispatch(startProgress());\n\n const { successAction, errorAction, ...requestOptions } = action.payload;\n requestOptions.locale = locale;\n\n const modularuiRequest = createRequest(requestOptions);\n\n return modularuiRequest\n .fetch()\n .then((model) => responseHandler(next, dispatch, successAction, model))\n .catch((error) => errorHandler(next, dispatch, errorAction, error));\n};\n\n/**\n */\nexport const modularUIMiddleware: Middleware<\n ReduxState,\n ReduxAction,\n Dispatch\n> =\n (api: MiddlewareAPI<ReduxState, ReduxAction, Dispatch>) =>\n (next: Dispatch) =>\n (action: PossibleAction) => {\n if (action.type === \"MODULARUI/FETCH\") {\n return handleFetch(\n // $FlowExpectedError[incompatible-exact]\n action,\n api.getState().i18n.locale,\n api.dispatch,\n next\n );\n }\n\n return next(action);\n };\n"],"mappings":";;;;;;;;AACA;AACA;AAEA;AAEA;AAyBA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"ModularUIMiddleware.js","names":["_ModularUIRequest","_interopRequireDefault","require","_Constants","_ProgressIndicator","_Error","createRequest","modularui","request","ModularUIRequest","href","method","HTTP_METHODS","GET","data","locale","childmodels","isReload","targetModel","forceTargetModel","responseHandler","next","dispatch","successAction","model","successResult","_promise","default","then","result","catch","error","handleError","Error","finishProgress","errorHandler","errorAction","err","errorResult","handleFetch","action","startProgress","requestOptions","payload","modularuiRequest","fetch","modularUIMiddleware","api","type","getState","i18n","exports"],"sources":["../../../src/redux/_modularui/ModularUIMiddleware.js"],"sourcesContent":["// @flow\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport type { Middleware, MiddlewareAPI } from \"redux\";\nimport type {\n ReduxAction,\n ReduxState,\n Dispatch,\n PossibleAction,\n} from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIAction, SuccessAction, ErrorAction } from \"./types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\ntype RequestOptions = {\n href: Href,\n method?: $Keys<typeof HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n isReload?: boolean,\n};\n\n/**\n * Symbol key that carries API call info interpreted by this Redux middleware.\n */\nconst createRequest = (modularui: RequestOptions): ModularUIRequest => {\n const request = new ModularUIRequest(modularui.href, {\n method: modularui.method || HTTP_METHODS.GET,\n data: modularui.data || {},\n locale: modularui.locale,\n childmodels: modularui.childmodels ?? true,\n isReload: modularui.isReload,\n });\n\n if (modularui.targetModel) {\n request.targetModel = modularui.targetModel;\n request.forceTargetModel = modularui.forceTargetModel ?? false;\n }\n\n return request;\n};\n\n/**\n */\nconst responseHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n successAction: SuccessAction,\n model: ModularUIModel\n) => {\n if (successAction) {\n const successResult = successAction(model);\n\n if (successResult instanceof Promise) {\n successResult\n .then((result) => {\n dispatch(result);\n })\n .catch((error) => {\n next(handleError(error));\n });\n } else {\n try {\n dispatch(successResult);\n } catch (error) {\n throw new Error(\n `Result of successResult is not a valid redux action: ${error}`\n );\n }\n }\n }\n\n return next(finishProgress());\n};\n\n/**\n */\nconst errorHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n errorAction: ?ErrorAction,\n err: any\n) => {\n dispatch(finishProgress());\n\n if (errorAction) {\n const errorResult = errorAction(err);\n\n if (errorResult instanceof Promise) {\n errorResult.then((result) => dispatch(result));\n } else {\n dispatch(errorResult);\n }\n }\n\n return next(handleError(err));\n};\n\n/**\n */\nconst handleFetch = (\n action: ModularUIAction,\n locale: string,\n dispatch: Dispatch,\n next: Dispatch\n) => {\n dispatch(startProgress());\n\n const { successAction, errorAction, ...requestOptions } = action.payload;\n requestOptions.locale = locale;\n\n const modularuiRequest = createRequest(requestOptions);\n\n return modularuiRequest\n .fetch()\n .then((model) => responseHandler(next, dispatch, successAction, model))\n .catch((error) => errorHandler(next, dispatch, errorAction, error));\n};\n\n/**\n */\nexport const modularUIMiddleware: Middleware<\n ReduxState,\n ReduxAction,\n Dispatch\n> =\n (api: MiddlewareAPI<ReduxState, ReduxAction, Dispatch>) =>\n (next: Dispatch) =>\n (action: PossibleAction) => {\n if (action.type === \"MODULARUI/FETCH\") {\n return handleFetch(\n // $FlowExpectedError[incompatible-exact]\n action,\n api.getState().i18n.locale,\n api.dispatch,\n next\n );\n }\n\n return next(action);\n };\n"],"mappings":";;;;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAyBA;AACA;AACA;AACA,MAAMI,aAAa,GAAIC,SAAyB,IAAuB;EACrE,MAAMC,OAAO,GAAG,IAAIC,yBAAgB,CAACF,SAAS,CAACG,IAAI,EAAE;IACnDC,MAAM,EAAEJ,SAAS,CAACI,MAAM,IAAIC,uBAAY,CAACC,GAAG;IAC5CC,IAAI,EAAEP,SAAS,CAACO,IAAI,IAAI,CAAC,CAAC;IAC1BC,MAAM,EAAER,SAAS,CAACQ,MAAM;IACxBC,WAAW,EAAET,SAAS,CAACS,WAAW,IAAI,IAAI;IAC1CC,QAAQ,EAAEV,SAAS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AChD,CAAC,MAAM;MACLP,QAAQ,CAACgB,WAAW,CAAC;IACvB;EACF;EAEA,OAAOjB,IAAI,CAAC,IAAAW,kBAAW,EAACK,GAAG,CAAC,CAAC;AAC/B,CAAC;;AAED;AACA;AACA,MAAME,WAAW,GAAGA,CAClBC,MAAuB,EACvBzB,MAAc,EACdO,QAAkB,EAClBD,IAAc,KACX;EACHC,QAAQ,CAAC,IAAAmB,gCAAa,GAAE,CAAC;EAEzB,MAAM;IAAElB,aAAa;IAAEa,WAAW;IAAE,GAAGM;EAAe,CAAC,GAAGF,MAAM,CAACG,OAAO;EACxED,cAAc,CAAC3B,MAAM,GAAGA,MAAM;EAE9B,MAAM6B,gBAAgB,GAAGtC,aAAa,CAACoC,cAAc,CAAC;EAEtD,OAAOE,gBAAgB,CACpBC,KAAK,EAAE,CACPjB,IAAI,CAAEJ,KAAK,IAAKJ,eAAe,CAACC,IAAI,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,KAAK,CAAC,CAAC,CACtEM,KAAK,CAAEC,KAAK,IAAKI,YAAY,CAACd,IAAI,EAAEC,QAAQ,EAAEc,WAAW,EAAEL,KAAK,CAAC,CAAC;AACvE,CAAC;;AAED;AACA;AACO,MAAMe,mBAIZ,GACEC,GAAqD,IACrD1B,IAAc,IACdmB,MAAsB,IAAK;EAC1B,IAAIA,MAAM,CAACQ,IAAI,KAAK,iBAAiB,EAAE;IACrC,OAAOT,WAAW;IAChB;IACAC,MAAM,EACNO,GAAG,CAACE,QAAQ,EAAE,CAACC,IAAI,CAACnC,MAAM,EAC1BgC,GAAG,CAACzB,QAAQ,EACZD,IAAI,CACL;EACH;EAEA,OAAOA,IAAI,CAACmB,MAAM,CAAC;AACrB,CAAC;AAACW,OAAA,CAAAL,mBAAA,GAAAA,mBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIReducer.js","names":["updateStatus","state","key","status","MODULARUI_STATUS","LOADING","lastModification","Date","now","setModel","model","IllegalArgumentException","initModularUI","models","newState","forEach","FINISHED","getModelKey","connectKey","updateModel","modelKey","Error","removeKey","resetModularUI","ApplicationModel","initialState","ModularUIReducer","action","type","payload"],"sources":["../../../src/redux/_modularui/ModularUIReducer.js"],"sourcesContent":["// @flow\nimport { IllegalArgumentException } from \"../../exceptions\";\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport { ApplicationModel } from \"../../models\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { ModularUIState } from \"./types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n */\nconst updateStatus = (\n state: ModularUIState,\n { key, status }: { key: string, status: $Keys<typeof MODULARUI_STATUS> }\n) => {\n // model should always be available when status is not loading\n if (status !== MODULARUI_STATUS.LOADING && !state[key]) {\n return state;\n }\n\n return {\n ...state,\n [key]: {\n ...state[key],\n status,\n lastModification: Date.now(),\n },\n };\n};\n\n/**\n */\nconst setModel = (\n state: ModularUIState,\n { key, model }: { key: string, model: ?ModularUIModel }\n) => {\n if (!state[key]) {\n return state;\n }\n\n if (model) {\n return {\n ...state,\n [key]: {\n ...state[key],\n model,\n lastModification: Date.now(),\n },\n };\n }\n\n throw new IllegalArgumentException(\"No model for setModel\");\n};\n\n/**\n */\nconst initModularUI = (\n state: ModularUIState,\n models: Array<{ key: string, model: ModularUIModel }>\n) => {\n const newState = Object.assign({}, state);\n\n models.forEach(({ key, model }) => {\n newState[key] = {\n status: MODULARUI_STATUS.FINISHED,\n lastModification: Date.now(),\n model,\n };\n });\n\n return newState;\n};\n\n/**\n */\nconst getModelKey = (state: ModularUIState, model: ModularUIModel) =>\n Object.keys(state).find((key) => {\n const connectKey = state[key]?.model?.connectKey ?? \"\";\n return connectKey === model.connectKey;\n });\n\n/**\n */\nconst updateModel = (state: ModularUIState, model: ModularUIModel) => {\n const modelKey = getModelKey(state, model);\n\n if (modelKey) {\n return setModel(state, { key: modelKey, model });\n }\n\n throw new Error(\n `ModularUIReducer: Cannot update model with key ${model.connectKey}`\n );\n};\n\n/**\n */\nconst removeKey = (modelKey: string, state: ModularUIState): ModularUIState => {\n const newState = Object.assign({}, state);\n delete newState[modelKey];\n return newState;\n};\n\n/**\n * Remove all but application models\n */\nconst resetModularUI = (state: ModularUIState) => {\n const newState: ModularUIState = {};\n\n for (const key in state) {\n if (state[key].model instanceof ApplicationModel) {\n newState[key] = { ...state[key] };\n }\n }\n\n return newState;\n};\n\nconst initialState: ModularUIState = {};\n\n/**\n * Modular UI Reducer\n */\nexport const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"MODULARUI/INIT\":\n return initModularUI(state, action.payload);\n\n case \"MODULARUI/RESET\":\n return resetModularUI(state);\n\n case \"MODULARUI/STATUS\":\n return updateStatus(state, action.payload);\n\n case \"MODULARUI/SET\":\n return setModel(state, action.payload);\n\n case \"MODULARUI/UPDATE\":\n case \"MODULARUI/UPDATE_FORM\":\n return updateModel(state, action.payload);\n\n case \"MODULARUI/REMOVE_KEY\":\n return removeKey(action.payload, state);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;;;;AACA;AACA;AACA;AAOA;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"ModularUIReducer.js","names":["_exceptions","require","_Constants","_models","updateStatus","state","_ref","key","status","MODULARUI_STATUS","LOADING","lastModification","Date","now","setModel","_ref2","model","IllegalArgumentException","initModularUI","models","newState","_assign","default","forEach","_ref3","FINISHED","getModelKey","_context","_find","_keys","call","connectKey","updateModel","modelKey","Error","removeKey","resetModularUI","ApplicationModel","initialState","ModularUIReducer","arguments","length","undefined","action","type","payload","exports"],"sources":["../../../src/redux/_modularui/ModularUIReducer.js"],"sourcesContent":["// @flow\nimport { IllegalArgumentException } from \"../../exceptions\";\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport { ApplicationModel } from \"../../models\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { ModularUIState } from \"./types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n */\nconst updateStatus = (\n state: ModularUIState,\n { key, status }: { key: string, status: $Keys<typeof MODULARUI_STATUS> }\n) => {\n // model should always be available when status is not loading\n if (status !== MODULARUI_STATUS.LOADING && !state[key]) {\n return state;\n }\n\n return {\n ...state,\n [key]: {\n ...state[key],\n status,\n lastModification: Date.now(),\n },\n };\n};\n\n/**\n */\nconst setModel = (\n state: ModularUIState,\n { key, model }: { key: string, model: ?ModularUIModel }\n) => {\n if (!state[key]) {\n return state;\n }\n\n if (model) {\n return {\n ...state,\n [key]: {\n ...state[key],\n model,\n lastModification: Date.now(),\n },\n };\n }\n\n throw new IllegalArgumentException(\"No model for setModel\");\n};\n\n/**\n */\nconst initModularUI = (\n state: ModularUIState,\n models: Array<{ key: string, model: ModularUIModel }>\n) => {\n const newState = Object.assign({}, state);\n\n models.forEach(({ key, model }) => {\n newState[key] = {\n status: MODULARUI_STATUS.FINISHED,\n lastModification: Date.now(),\n model,\n };\n });\n\n return newState;\n};\n\n/**\n */\nconst getModelKey = (state: ModularUIState, model: ModularUIModel) =>\n Object.keys(state).find((key) => {\n const connectKey = state[key]?.model?.connectKey ?? \"\";\n return connectKey === model.connectKey;\n });\n\n/**\n */\nconst updateModel = (state: ModularUIState, model: ModularUIModel) => {\n const modelKey = getModelKey(state, model);\n\n if (modelKey) {\n return setModel(state, { key: modelKey, model });\n }\n\n throw new Error(\n `ModularUIReducer: Cannot update model with key ${model.connectKey}`\n );\n};\n\n/**\n */\nconst removeKey = (modelKey: string, state: ModularUIState): ModularUIState => {\n const newState = Object.assign({}, state);\n delete newState[modelKey];\n return newState;\n};\n\n/**\n * Remove all but application models\n */\nconst resetModularUI = (state: ModularUIState) => {\n const newState: ModularUIState = {};\n\n for (const key in state) {\n if (state[key].model instanceof ApplicationModel) {\n newState[key] = { ...state[key] };\n }\n }\n\n return newState;\n};\n\nconst initialState: ModularUIState = {};\n\n/**\n * Modular UI Reducer\n */\nexport const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"MODULARUI/INIT\":\n return initModularUI(state, action.payload);\n\n case \"MODULARUI/RESET\":\n return resetModularUI(state);\n\n case \"MODULARUI/STATUS\":\n return updateStatus(state, action.payload);\n\n case \"MODULARUI/SET\":\n return setModel(state, action.payload);\n\n case \"MODULARUI/UPDATE\":\n case \"MODULARUI/UPDATE_FORM\":\n return updateModel(state, action.payload);\n\n case \"MODULARUI/REMOVE_KEY\":\n return removeKey(action.payload, state);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAOA;AACA;AACA,MAAMG,YAAY,GAAGA,CACnBC,KAAqB,EAAAC,IAAA,KAElB;EAAA,IADH;IAAEC,GAAG;IAAEC;EAAgE,CAAC,GAAAF,IAAA;EAExE;EACA,IAAIE,MAAM,KAAKC,2BAAgB,CAACC,OAAO,IAAI,CAACL,KAAK,CAACE,GAAG,CAAC,EAAE;IACtD,OAAOF,KAAK;EACd;EAEA,OAAO;IACL,GAAGA,KAAK;IACR,CAACE,GAAG,GAAG;MACL,GAAGF,KAAK,CAACE,GAAG,CAAC;MACbC,MAAM;MACNG,gBAAgB,EAAEC,IAAI,CAACC,GAAG;IAC5B;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,MAAMC,QAAQ,GAAGA,CACfT,KAAqB,EAAAU,KAAA,KAElB;EAAA,IADH;IAAER,GAAG;IAAES;EAA+C,CAAC,GAAAD,KAAA;EAEvD,IAAI,CAACV,KAAK,CAACE,GAAG,CAAC,EAAE;IACf,OAAOF,KAAK;EACd;EAEA,IAAIW,KAAK,EAAE;IACT,OAAO;MACL,GAAGX,KAAK;MACR,CAACE,GAAG,GAAG;QACL,GAAGF,KAAK,C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