@plone/volto 19.0.0-alpha.3 → 19.0.0-alpha.30
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/.eslintignore +2 -0
- package/.eslintrc +37 -6
- package/CHANGELOG.md +534 -2
- package/README.md +23 -21
- package/babel.js +1 -9
- package/cypress/docker/prefixed-rules.yml +26 -0
- package/cypress/docker/prefixed.yml +24 -0
- package/cypress/support/commands.js +12 -6
- package/cypress/support/guillotina.js +1 -0
- package/cypress.config.js +1 -0
- package/global-test-setup.js +1 -2
- package/locales/af/LC_MESSAGES/volto.po +5500 -0
- package/locales/af.json +1 -1
- package/locales/ar/LC_MESSAGES/volto.po +5500 -0
- package/locales/ar.json +1 -1
- package/locales/bg/LC_MESSAGES/volto.po +5500 -0
- package/locales/bg.json +1 -1
- package/locales/bn/LC_MESSAGES/volto.po +5500 -0
- package/locales/bn.json +1 -1
- package/locales/ca/LC_MESSAGES/volto.po +559 -349
- package/locales/ca.json +1 -1
- package/locales/cs/LC_MESSAGES/volto.po +5500 -0
- package/locales/cs.json +1 -1
- package/locales/cy/LC_MESSAGES/volto.po +5500 -0
- package/locales/cy.json +1 -1
- package/locales/da/LC_MESSAGES/volto.po +5500 -0
- package/locales/da.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +232 -21
- package/locales/de.json +1 -1
- package/locales/el/LC_MESSAGES/volto.po +5500 -0
- package/locales/el.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +226 -11
- package/locales/en.json +1 -1
- package/locales/en_AU/LC_MESSAGES/volto.po +5500 -0
- package/locales/en_AU.json +1 -1
- package/locales/en_GB/LC_MESSAGES/volto.po +5500 -0
- package/locales/en_GB.json +1 -1
- package/locales/eo/LC_MESSAGES/volto.po +5500 -0
- package/locales/eo.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +321 -111
- package/locales/es.json +1 -1
- package/locales/et/LC_MESSAGES/volto.po +5500 -0
- package/locales/et.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +404 -194
- package/locales/eu.json +1 -1
- package/locales/fa/LC_MESSAGES/volto.po +5500 -0
- package/locales/fa.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +221 -11
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +220 -10
- package/locales/fr.json +1 -1
- package/locales/fu/LC_MESSAGES/volto.po +5500 -0
- package/locales/fu.json +1 -1
- package/locales/gl/LC_MESSAGES/volto.po +5501 -0
- package/locales/gl.json +1 -1
- package/locales/he/LC_MESSAGES/volto.po +5500 -0
- package/locales/he.json +1 -1
- package/locales/hi/LC_MESSAGES/volto.po +225 -10
- package/locales/hi.json +1 -1
- package/locales/hr/LC_MESSAGES/volto.po +5500 -0
- package/locales/hr.json +1 -1
- package/locales/hu/LC_MESSAGES/volto.po +5500 -0
- package/locales/hu.json +1 -1
- package/locales/hy/LC_MESSAGES/volto.po +5500 -0
- package/locales/hy.json +1 -1
- package/locales/id/LC_MESSAGES/volto.po +5500 -0
- package/locales/id.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +239 -24
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +264 -53
- package/locales/ja.json +1 -1
- package/locales/ka/LC_MESSAGES/volto.po +5500 -0
- package/locales/ka.json +1 -1
- package/locales/kn/LC_MESSAGES/volto.po +5500 -0
- package/locales/kn.json +1 -1
- package/locales/ko/LC_MESSAGES/volto.po +5500 -0
- package/locales/ko.json +1 -1
- package/locales/lt/LC_MESSAGES/volto.po +5500 -0
- package/locales/lt.json +1 -1
- package/locales/lv/LC_MESSAGES/volto.po +5500 -0
- package/locales/lv.json +1 -1
- package/locales/mi/LC_MESSAGES/volto.po +5500 -0
- package/locales/mi.json +1 -1
- package/locales/mk/LC_MESSAGES/volto.po +5500 -0
- package/locales/mk.json +1 -1
- package/locales/my/LC_MESSAGES/volto.po +5500 -0
- package/locales/my.json +1 -1
- package/locales/nb_NO/LC_MESSAGES/volto.po +5500 -0
- package/locales/nb_NO.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +243 -32
- package/locales/nl.json +1 -1
- package/locales/nn/LC_MESSAGES/volto.po +5500 -0
- package/locales/nn.json +1 -1
- package/locales/pl/LC_MESSAGES/volto.po +5500 -0
- package/locales/pl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +869 -659
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +229 -19
- package/locales/pt_BR.json +1 -1
- package/locales/rm/LC_MESSAGES/volto.po +5500 -0
- package/locales/rm.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +252 -42
- package/locales/ro.json +1 -1
- package/locales/ru/LC_MESSAGES/volto.po +220 -10
- package/locales/ru.json +1 -1
- package/locales/sk/LC_MESSAGES/volto.po +5500 -0
- package/locales/sk.json +1 -1
- package/locales/sl/LC_MESSAGES/volto.po +5500 -0
- package/locales/sl.json +1 -1
- package/locales/sm/LC_MESSAGES/volto.po +5500 -0
- package/locales/sm.json +1 -1
- package/locales/sq/LC_MESSAGES/volto.po +5500 -0
- package/locales/sq.json +1 -1
- package/locales/sr/LC_MESSAGES/volto.po +5500 -0
- package/locales/sr.json +1 -1
- package/locales/sr@cyrl/LC_MESSAGES/volto.po +5500 -0
- package/locales/sr@cyrl.json +1 -1
- package/locales/sr@latn/LC_MESSAGES/volto.po +5500 -0
- package/locales/sr@latn.json +1 -1
- package/locales/sv/LC_MESSAGES/volto.po +5500 -0
- package/locales/sv.json +1 -1
- package/locales/ta/LC_MESSAGES/volto.po +5501 -0
- package/locales/ta.json +1 -1
- package/locales/te/LC_MESSAGES/volto.po +5500 -0
- package/locales/te.json +1 -1
- package/locales/th/LC_MESSAGES/volto.po +5500 -0
- package/locales/th.json +1 -1
- package/locales/to/LC_MESSAGES/volto.po +5500 -0
- package/locales/to.json +1 -1
- package/locales/tr/LC_MESSAGES/volto.po +5501 -0
- package/locales/tr.json +1 -1
- package/locales/uk/LC_MESSAGES/volto.po +5500 -0
- package/locales/uk.json +1 -1
- package/locales/vi/LC_MESSAGES/volto.po +5500 -0
- package/locales/vi.json +1 -1
- package/locales/volto.pot +220 -10
- package/locales/zh_CN/LC_MESSAGES/volto.po +221 -10
- package/locales/zh_CN.json +1 -1
- package/locales/zh_Hant/LC_MESSAGES/volto.po +5500 -0
- package/locales/zh_Hant.json +1 -1
- package/locales/zh_Hant_HK/LC_MESSAGES/volto.po +5500 -0
- package/locales/zh_Hant_HK.json +1 -1
- package/package.json +72 -146
- package/razzle.config.js +32 -25
- package/src/actions/blockTypes/blockTypes.ts +24 -0
- package/src/components/manage/Actions/Actions.test.jsx +1 -5
- package/src/components/manage/Add/Add.jsx +15 -10
- package/src/components/manage/BlockChooser/BlockChooser.jsx +1 -0
- package/src/components/manage/Blocks/Block/BlocksForm.jsx +10 -7
- package/src/components/manage/Blocks/Block/BlocksForm.test.jsx +3 -14
- package/src/components/manage/Blocks/Block/EditBlockWrapper.jsx +9 -4
- package/src/components/manage/Blocks/Block/Order/Item.jsx +27 -13
- package/src/components/manage/Blocks/Block/Order/Item.test.jsx +90 -0
- package/src/components/manage/Blocks/Block/Order/Order.jsx +116 -67
- package/src/components/manage/Blocks/Block/Order/utilities.js +28 -11
- package/src/components/manage/Blocks/Block/Settings.test.jsx +1 -5
- package/src/components/manage/Blocks/Grid/View.jsx +14 -11
- package/src/components/manage/Blocks/Grid/context.js +3 -0
- package/src/components/manage/Blocks/HTML/Edit.test.jsx +1 -5
- package/src/components/manage/Blocks/Image/Edit.jsx +5 -1
- package/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +2 -5
- package/src/components/manage/Blocks/LeadImage/Edit.jsx +2 -2
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx +1 -1
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +2 -5
- package/src/components/manage/Blocks/Listing/Edit.jsx +1 -0
- package/src/components/manage/Blocks/Listing/ImageGallery.jsx +6 -4
- package/src/components/manage/Blocks/Listing/ListingBody.jsx +4 -0
- package/src/components/manage/Blocks/Maps/Edit.jsx +2 -1
- package/src/components/manage/Blocks/Maps/MapsSidebar.test.jsx +1 -5
- package/src/components/manage/Blocks/Search/SearchBlockView.jsx +21 -4
- package/src/components/manage/Blocks/Search/components/DateRangeFacet.test.jsx +1 -6
- package/src/components/manage/Blocks/Search/components/SelectFacet.jsx +22 -1
- package/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx +1 -6
- package/src/components/manage/Blocks/Search/components/SortOn.jsx +8 -2
- package/src/components/manage/Blocks/Search/components/ToggleFacet.jsx +14 -0
- package/src/components/manage/Blocks/Teaser/Data.jsx +21 -7
- package/src/components/manage/Blocks/Teaser/DefaultBody.jsx +11 -3
- package/src/components/manage/Blocks/Teaser/View.jsx +0 -1
- package/src/components/manage/Blocks/Teaser/utils.js +13 -0
- package/src/components/manage/Blocks/Teaser/utils.test.js +34 -0
- package/src/components/manage/Blocks/Title/Edit.jsx +5 -0
- package/src/components/manage/Blocks/Video/Body.jsx +69 -43
- package/src/components/manage/Blocks/Video/Body.test.jsx +122 -5
- package/src/components/manage/Blocks/Video/Edit.jsx +22 -3
- package/src/components/manage/Blocks/Video/Edit.test.jsx +6 -0
- package/src/components/manage/Blocks/Video/VideoSidebar.test.jsx +1 -5
- package/src/components/manage/Blocks/Video/View.jsx +1 -0
- package/src/components/manage/Blocks/Video/View.test.jsx +29 -15
- package/src/components/manage/Blocks/Video/schema.js +14 -1
- package/src/components/manage/Contents/Contents.jsx +697 -659
- package/src/components/manage/Contents/Contents.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsBreadcrumbs.jsx +6 -5
- package/src/components/manage/Contents/ContentsItem.jsx +1 -1
- package/src/components/manage/Contents/ContentsPropertiesModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsRenameModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsTagsModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsWorkflowModal.test.jsx +1 -5
- package/src/components/manage/Contents/DropZoneContent.jsx +338 -0
- package/src/components/manage/Contents/__mocks__/index.tsx +2 -18
- package/src/components/manage/Controlpanels/AddonsControlpanel.jsx +7 -0
- package/src/components/manage/Controlpanels/Aliases.test.jsx +1 -5
- package/src/components/manage/Controlpanels/BlockType.tsx +166 -0
- package/src/components/manage/Controlpanels/BlockTypes.tsx +145 -0
- package/src/components/manage/Controlpanels/ContentType.jsx +1 -1
- package/src/components/manage/Controlpanels/ContentType.test.jsx +1 -5
- package/src/components/manage/Controlpanels/ContentTypeSchema.jsx +1 -1
- package/src/components/manage/Controlpanels/Controlpanels.jsx +28 -5
- package/src/components/manage/Controlpanels/Controlpanels.test.jsx +10 -0
- package/src/components/manage/Controlpanels/DatabaseInformation.jsx +9 -0
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +3 -2
- package/src/components/manage/Controlpanels/ModerateComments.jsx +8 -0
- package/src/components/manage/Controlpanels/Relations/Relations.jsx +1 -1
- package/src/components/manage/Controlpanels/Rules/AddRule.test.jsx +1 -5
- package/src/components/manage/Controlpanels/Rules/EditRule.test.jsx +1 -5
- package/src/components/manage/Controlpanels/UndoControlpanel.test.jsx +1 -5
- package/src/components/manage/Controlpanels/Users/RenderUsers.jsx +156 -175
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx +3 -0
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +575 -631
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +58 -11
- package/src/components/manage/Diff/Diff.jsx +201 -298
- package/src/components/manage/Diff/Diff.test.jsx +1 -6
- package/src/components/manage/Diff/DiffField.test.jsx +1 -6
- package/src/components/manage/Display/Display.test.jsx +2 -11
- package/src/components/manage/Edit/Edit.test.jsx +1 -5
- package/src/components/manage/Form/BlockDataForm.test.jsx +1 -5
- package/src/components/manage/Form/Form.jsx +3 -3
- package/src/components/manage/Form/Form.test.jsx +1 -5
- package/src/components/manage/Form/InlineForm.jsx +2 -2
- package/src/components/manage/Form/InlineForm.test.jsx +1 -5
- package/src/components/manage/Form/ModalForm.jsx +12 -10
- package/src/components/manage/Form/ModalForm.test.jsx +27 -5
- package/src/components/manage/Form/__mocks__/index.tsx +9 -27
- package/src/components/manage/Multilingual/CompareLanguages.jsx +6 -6
- package/src/components/manage/Multilingual/CreateTranslation.jsx +16 -13
- package/src/components/manage/Multilingual/ManageTranslations.jsx +5 -5
- package/src/components/manage/Multilingual/TranslationObject.jsx +11 -8
- package/src/components/manage/Preferences/ChangePassword.test.jsx +1 -5
- package/src/components/manage/Preferences/PersonalPreferences.jsx +8 -5
- package/src/components/manage/Preferences/PersonalPreferences.test.jsx +1 -17
- package/src/components/manage/Sharing/Sharing.jsx +21 -15
- package/src/components/manage/Sidebar/ObjectBrowser.jsx +3 -0
- package/src/components/manage/Sidebar/ObjectBrowserBody.jsx +18 -2
- package/src/components/manage/Sidebar/ObjectBrowserNav.jsx +2 -1
- package/src/components/manage/Sidebar/SidebarPortal.test.tsx +42 -0
- package/src/components/manage/Sidebar/SidebarPortal.tsx +48 -0
- package/src/components/manage/TemplateChooser/TemplateChooser.jsx +2 -1
- package/src/components/manage/TemplateChooser/TemplateChooser.test.jsx +1 -0
- package/src/components/manage/Toast/Toast.jsx +32 -0
- package/src/components/manage/Toast/Toast.test.jsx +9 -5
- package/src/components/manage/Toolbar/PersonalTools.jsx +2 -1
- package/src/components/manage/Toolbar/PersonalTools.test.jsx +15 -0
- package/src/components/manage/Toolbar/Toolbar.jsx +14 -4
- package/src/components/manage/Toolbar/Types.crash.test.jsx +48 -0
- package/src/components/manage/Toolbar/Types.jsx +6 -4
- package/src/components/manage/UniversalLink/UniversalLink.test.jsx +16 -0
- package/src/components/manage/UniversalLink/UniversalLink.tsx +2 -0
- package/src/components/manage/Widgets/AlignWidget.stories.jsx +9 -0
- package/src/components/manage/Widgets/AlignWidget.test.tsx +95 -0
- package/src/components/manage/Widgets/{AlignWidget.jsx → AlignWidget.tsx} +23 -7
- package/src/components/manage/Widgets/ArrayWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/BlockAlignment.stories.tsx +104 -0
- package/src/components/manage/Widgets/BlockAlignment.test.tsx +104 -0
- package/src/components/manage/Widgets/BlockAlignment.tsx +88 -0
- package/src/components/manage/Widgets/BlockWidth.stories.tsx +69 -0
- package/src/components/manage/Widgets/BlockWidth.test.tsx +62 -0
- package/src/components/manage/Widgets/BlockWidth.tsx +101 -0
- package/src/components/manage/Widgets/ButtonsWidget.stories.jsx +61 -0
- package/src/components/manage/Widgets/ButtonsWidget.test.tsx +138 -0
- package/src/components/manage/Widgets/ButtonsWidget.tsx +195 -0
- package/src/components/manage/Widgets/CheckboxGroupWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/DatetimeWidget.jsx +102 -53
- package/src/components/manage/Widgets/DatetimeWidget.test.jsx +56 -6
- package/src/components/manage/Widgets/FileWidget.jsx +21 -8
- package/src/components/manage/Widgets/FormFieldWrapper.jsx +146 -168
- package/src/components/manage/Widgets/ImageWidget.jsx +177 -38
- package/src/components/manage/Widgets/InternalUrlWidget.jsx +2 -0
- package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +8 -0
- package/src/components/manage/Widgets/ObjectListWidget.test.jsx +2 -11
- package/src/components/manage/Widgets/ObjectWidget.test.jsx +1 -5
- package/src/components/manage/Widgets/QueryWidget.jsx +137 -9
- package/src/components/manage/Widgets/RadioGroupWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/RegistryImageWidget.jsx +1 -1
- package/src/components/manage/Widgets/RegistryImageWidget.test.jsx +4 -2
- package/src/components/manage/Widgets/SchemaWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx +1 -6
- package/src/components/manage/Widgets/SelectAutoComplete.jsx +29 -12
- package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +1 -6
- package/src/components/manage/Widgets/SelectWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/Size.stories.tsx +69 -0
- package/src/components/manage/Widgets/Size.test.tsx +59 -0
- package/src/components/manage/Widgets/Size.tsx +78 -0
- package/src/components/manage/Widgets/TimeWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/TokenWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/UrlWidget.jsx +49 -18
- package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +2 -11
- package/src/components/manage/Widgets/__mocks__/index.tsx +33 -51
- package/src/components/manage/Widgets/index.tsx +21 -0
- package/src/components/manage/Workflow/Workflow.test.jsx +2 -11
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.jsx +1 -0
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.test.jsx +30 -0
- package/src/components/theme/App/App.jsx +5 -1
- package/src/components/theme/Avatar/Avatar.jsx +2 -1
- package/src/components/theme/Comments/CommentEditModal.test.jsx +1 -5
- package/src/components/theme/Comments/Comments.test.jsx +2 -11
- package/src/components/theme/ConnectionRefused/ConnectionRefused.jsx +3 -2
- package/src/components/theme/ContactForm/ContactForm.test.jsx +1 -5
- package/src/components/theme/Image/Image.jsx +25 -13
- package/src/components/theme/Image/Image.test.jsx +247 -146
- package/src/components/theme/InjectPloneComponentsCSS/InjectPloneComponentsCSS.tsx +7 -0
- package/src/components/theme/LanguageSelector/LanguageSelector.tsx +89 -0
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.jsx +42 -12
- package/src/components/theme/PasswordReset/PasswordReset.jsx +108 -191
- package/src/components/theme/PasswordReset/RequestPasswordReset.test.jsx +1 -5
- package/src/components/theme/PreviewImage/PreviewImage.jsx +1 -1
- package/src/components/theme/Register/Register.test.jsx +1 -5
- package/src/components/theme/RequestTimeout/RequestTimeout.jsx +1 -1
- package/src/components/theme/Sitemap/Sitemap.stories.jsx +82 -0
- package/src/components/theme/SlotRenderer/SlotRenderer.tsx +12 -6
- package/src/components/theme/Unauthorized/Unauthorized.jsx +35 -25
- package/src/components/theme/Unauthorized/Unauthorized.test.jsx +28 -1
- package/src/components/theme/VideoEmbed/VideoEmbed.jsx +100 -0
- package/src/components/theme/View/EventDatesInfo.test.jsx +1 -6
- package/src/components/theme/View/EventView.stories.jsx +89 -0
- package/src/components/theme/View/EventView.test.jsx +1 -6
- package/src/components/theme/View/FileView.stories.jsx +50 -0
- package/src/components/theme/View/ImageView.jsx +2 -1
- package/src/components/theme/View/ImageView.test.jsx +3 -0
- package/src/components/theme/View/LinkView.stories.jsx +57 -0
- package/src/components/theme/View/ListingView.stories.jsx +70 -0
- package/src/components/theme/View/NewsItemView.stories.jsx +58 -0
- package/src/components/theme/View/RenderBlocks.jsx +8 -10
- package/src/components/theme/View/RenderBlocks.stories.jsx +112 -0
- package/src/components/theme/View/RenderBlocks.test.jsx +14 -4
- package/src/components/theme/View/SummaryView.stories.jsx +71 -0
- package/src/components/theme/View/TabularView.stories.jsx +66 -0
- package/src/components/theme/View/View.jsx +8 -1
- package/src/components/theme/Widgets/ImageWidget.jsx +2 -1
- package/src/components/theme/Widgets/ImageWidget.test.jsx +31 -11
- package/src/config/Blocks.jsx +3 -0
- package/src/config/ControlPanels.js +3 -0
- package/src/config/Widgets.jsx +7 -0
- package/src/config/index.js +19 -12
- package/src/config/server.js +0 -2
- package/src/config/slots.js +19 -0
- package/src/config/validation.ts +8 -0
- package/src/constants/ActionTypes.js +1 -0
- package/src/express-middleware/devproxy.js +22 -5
- package/src/express-middleware/files.js +1 -0
- package/src/express-middleware/files.test.js +59 -0
- package/src/express-middleware/images.js +1 -0
- package/src/express-middleware/images.test.js +50 -0
- package/src/helpers/Api/APIResourceWithAuth.js +8 -3
- package/src/helpers/Api/Api.js +7 -4
- package/src/helpers/AsyncConnect/ssr.js +4 -1
- package/src/helpers/AuthToken/AuthToken.js +1 -6
- package/src/helpers/Blocks/Blocks.js +113 -28
- package/src/helpers/Blocks/Blocks.test.js +100 -0
- package/src/helpers/Content/Content.js +23 -0
- package/src/helpers/Content/Content.test.js +39 -0
- package/src/helpers/Content/withClientSideContent.jsx +35 -0
- package/src/helpers/Extensions/withBlockSchemaEnhancer.jsx +4 -1
- package/src/helpers/FormValidation/FormValidation.test.js +31 -0
- package/src/helpers/FormValidation/validators.ts +52 -6
- package/src/helpers/Html/Html.jsx +13 -4
- package/src/helpers/Loadable/__mocks__/Loadable.jsx +7 -22
- package/src/helpers/MessageLabels/MessageLabels.js +10 -0
- package/src/helpers/Sitemap/Sitemap.js +4 -4
- package/src/helpers/Url/Url.js +33 -2
- package/src/helpers/Url/Url.test.js +62 -0
- package/src/helpers/Utils/Utils.jsx +17 -0
- package/src/helpers/Utils/Utils.test.jsx +39 -0
- package/src/hooks/user/useUser.js +1 -1
- package/src/internalChecks.test.ts +11 -0
- package/src/middleware/api.js +17 -8
- package/src/middleware/storeProtectLoadUtils.test.js +3 -3
- package/src/reducers/blockTypes/blockTypes.js +38 -0
- package/src/reducers/content/content.js +3 -18
- package/src/reducers/diff/diff.js +5 -1
- package/src/reducers/diff/diff.test.js +60 -4
- package/src/reducers/index.js +2 -0
- package/src/reducers/querystring/querystring.js +8 -1
- package/src/reducers/users/users.js +1 -1
- package/src/routes.js +13 -1
- package/src/server.jsx +47 -13
- package/src/start-client.jsx +9 -2
- package/src/start-server.js +9 -3
- package/test-addons-loader.js +3 -0
- package/test-setup-globals.js +56 -2
- package/theme/themes/default/elements/segment.variables +9 -16
- package/theme/themes/pastanaga/collections/form.overrides +1 -1
- package/theme/themes/pastanaga/elements/segment.variables +1 -4
- package/theme/themes/pastanaga/extras/block-types.less +17 -0
- package/theme/themes/pastanaga/extras/blocks.less +19 -0
- package/theme/themes/pastanaga/extras/contents.less +75 -0
- package/theme/themes/pastanaga/extras/main.less +20 -4
- package/theme/themes/pastanaga/extras/toolbar.less +10 -5
- package/theme/themes/pastanaga/extras/videoembed.less +22 -0
- package/theme/themes/pastanaga/extras/widgets.less +79 -0
- package/tsconfig.declarations.json +1 -1
- package/tsconfig.json +4 -5
- package/types/actions/blockTypes/blockTypes.d.ts +7 -0
- package/types/components/index.d.ts +1 -1
- package/types/components/manage/Blocks/Block/Order/Item.test.d.ts +1 -0
- package/types/components/manage/Blocks/Block/Order/utilities.d.ts +2 -1
- package/types/components/manage/Blocks/Grid/context.d.ts +1 -0
- package/types/components/manage/Blocks/Teaser/utils.d.ts +5 -0
- package/types/components/manage/Blocks/Video/Body.d.ts +4 -2
- package/types/components/manage/Blocks/Video/schema.d.ts +4 -0
- package/types/components/manage/Contents/DropZoneContent.d.ts +2 -0
- package/types/components/manage/Contents/__mocks__/index.d.ts +2 -2
- package/types/components/manage/Controlpanels/BlockType.d.ts +7 -0
- package/types/components/manage/Controlpanels/BlockTypes.d.ts +7 -0
- package/types/components/manage/Controlpanels/Relations/RelationsMatrix.d.ts +1 -1
- package/types/components/manage/Controlpanels/Users/RenderUsers.d.ts +18 -2
- package/types/components/manage/Controlpanels/Users/UsersControlpanel.d.ts +6 -2
- package/types/components/manage/Controlpanels/index.d.ts +2 -2
- package/types/components/manage/Diff/Diff.d.ts +7 -2
- package/types/components/manage/Form/__mocks__/index.d.ts +8 -8
- package/types/components/manage/Multilingual/ManageTranslations.d.ts +1 -1
- package/types/components/manage/Sidebar/ObjectBrowser.d.ts +1 -1
- package/types/components/manage/Sidebar/SidebarPortal.d.ts +7 -15
- package/types/components/manage/Toolbar/Types.crash.test.d.ts +1 -0
- package/types/components/manage/Widgets/AlignWidget.d.ts +8 -10
- package/types/components/manage/Widgets/AlignWidget.stories.d.ts +1 -0
- package/types/components/manage/Widgets/BlockAlignment.d.ts +7 -0
- package/types/components/manage/Widgets/BlockAlignment.stories.d.ts +8 -0
- package/types/components/manage/Widgets/BlockWidth.d.ts +7 -0
- package/types/components/manage/Widgets/BlockWidth.stories.d.ts +6 -0
- package/types/components/manage/Widgets/ButtonsWidget.d.ts +48 -1
- package/types/components/manage/Widgets/ButtonsWidget.stories.d.ts +3 -0
- package/types/components/manage/Widgets/FormFieldWrapper.d.ts +28 -5
- package/types/components/manage/Widgets/ImageWidget.d.ts +41 -1
- package/types/components/manage/Widgets/InternalUrlWidget.d.ts +1 -1
- package/types/components/manage/Widgets/ObjectBrowserWidget.d.ts +2 -0
- package/types/components/manage/Widgets/QueryWidget.d.ts +5 -2
- package/types/components/manage/Widgets/RecurrenceWidget/Utils.d.ts +12 -18
- package/types/components/manage/Widgets/Size.d.ts +7 -0
- package/types/components/manage/Widgets/Size.stories.d.ts +6 -0
- package/types/components/manage/Widgets/UrlWidget.d.ts +1 -1
- package/types/components/manage/Widgets/__mocks__/index.d.ts +33 -33
- package/types/components/manage/Widgets/index.d.ts +11 -6
- package/types/components/theme/ConnectionRefused/ConnectionRefused.d.ts +2 -2
- package/types/components/theme/InjectPloneComponentsCSS/InjectPloneComponentsCSS.d.ts +3 -0
- package/types/components/theme/LanguageSelector/LanguageSelector.d.ts +3 -10
- package/types/components/theme/PasswordReset/PasswordReset.d.ts +6 -2
- package/types/components/theme/Sitemap/Sitemap.stories.d.ts +13 -0
- package/types/components/theme/SlotRenderer/SlotRenderer.d.ts +4 -5
- package/types/components/theme/Unauthorized/Unauthorized.d.ts +2 -2
- package/types/components/theme/VideoEmbed/VideoEmbed.d.ts +2 -0
- package/types/components/theme/View/EventView.stories.d.ts +19 -0
- package/types/components/theme/View/FileView.stories.d.ts +18 -0
- package/types/components/theme/View/LinkView.stories.d.ts +18 -0
- package/types/components/theme/View/ListingView.stories.d.ts +24 -0
- package/types/components/theme/View/NewsItemView.stories.d.ts +23 -0
- package/types/components/theme/View/RenderBlocks.stories.d.ts +23 -0
- package/types/components/theme/View/SummaryView.stories.d.ts +23 -0
- package/types/components/theme/View/TabularView.stories.d.ts +23 -0
- package/types/config/ControlPanels.d.ts +1 -0
- package/types/config/Views.d.ts +1 -1
- package/types/config/Widgets.d.ts +6 -0
- package/types/config/slots.d.ts +7 -0
- package/types/constants/ActionTypes.d.ts +1 -0
- package/types/helpers/Blocks/Blocks.d.ts +4 -0
- package/types/helpers/Content/Content.d.ts +7 -0
- package/types/helpers/Content/withClientSideContent.d.ts +1 -0
- package/types/helpers/Extensions/withBlockSchemaEnhancer.d.ts +4 -5
- package/types/helpers/FormValidation/validators.d.ts +18 -1
- package/types/helpers/Helmet/Helmet.d.ts +1 -1
- package/types/helpers/Loadable/__mocks__/Loadable.d.ts +2 -2
- package/types/helpers/MessageLabels/MessageLabels.d.ts +105 -93
- package/types/helpers/Url/Url.d.ts +14 -0
- package/types/helpers/Url/bulkFlattenToAppURL.d.ts +5 -0
- package/types/helpers/Utils/Utils.d.ts +1 -0
- package/types/reducers/blockTypes/blockTypes.d.ts +16 -0
- package/types/reducers/index.d.ts +3 -0
- package/types/routes.d.ts +7 -5
- package/types/start-client.d.ts +0 -1
- package/vitest.config.mjs +84 -42
- package/webpack-plugins/webpack-less-plugin.js +1 -1
- package/webpack-plugins/webpack-scss-plugin.js +172 -0
- package/cypress/downloads/downloads.html +0 -0
- package/jest-addons-loader.js +0 -3
- package/jest-extender-plugin.js +0 -39
- package/jest-setup-afterenv.js +0 -2
- package/jest-svgsystem-transform.js +0 -10
- package/package-why.json +0 -34
- package/patches/patchit.sh +0 -2
- package/patches/razzle-jest.patch +0 -10
- package/src/components/manage/Contents/__mocks__/index.vitest.tsx +0 -5
- package/src/components/manage/Form/__mocks__/index.vitest.tsx +0 -73
- package/src/components/manage/Sidebar/SidebarPortal.jsx +0 -47
- package/src/components/manage/Sidebar/SidebarPortal.test.jsx +0 -26
- package/src/components/manage/Widgets/AlignWidget.test.jsx +0 -59
- package/src/components/manage/Widgets/ButtonsWidget.jsx +0 -41
- package/src/components/manage/Widgets/ButtonsWidget.test.jsx +0 -70
- package/src/components/manage/Widgets/__mocks__/index.vitest.tsx +0 -41
- package/src/components/theme/LanguageSelector/LanguageSelector.jsx +0 -79
- package/src/helpers/Loadable/__mocks__/Loadable.vitest.jsx +0 -39
- package/test-setup-globals-vitest.js +0 -46
- package/theme/themes/pastanaga/extras/utils.less +0 -63
- /package/src/components/theme/LanguageSelector/{LanguageSelector.test.jsx → LanguageSelector.test.tsx} +0 -0
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
* @module components/theme/PasswordReset/PasswordReset
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { compose } from 'redux';
|
|
10
|
-
import { Link, withRouter } from 'react-router-dom';
|
|
6
|
+
import { useState, useEffect } from 'react';
|
|
7
|
+
import { useSelector, useDispatch } from 'react-redux';
|
|
8
|
+
import { Link, useHistory, useParams } from 'react-router-dom';
|
|
11
9
|
import Helmet from '@plone/volto/helpers/Helmet/Helmet';
|
|
12
10
|
import { Container } from 'semantic-ui-react';
|
|
13
|
-
import { FormattedMessage, defineMessages,
|
|
11
|
+
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
|
|
14
12
|
|
|
15
13
|
import { Form } from '@plone/volto/components/manage/Form';
|
|
16
14
|
import { setInitialPassword } from '@plone/volto/actions/users/users';
|
|
@@ -90,220 +88,139 @@ const messages = defineMessages({
|
|
|
90
88
|
});
|
|
91
89
|
|
|
92
90
|
/**
|
|
93
|
-
* PasswordReset
|
|
94
|
-
* @
|
|
95
|
-
* @extends Component
|
|
91
|
+
* @function PasswordReset
|
|
92
|
+
* @returns {JSX.Element}
|
|
96
93
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
* @static
|
|
102
|
-
*/
|
|
103
|
-
static propTypes = {
|
|
104
|
-
loading: PropTypes.bool.isRequired,
|
|
105
|
-
loaded: PropTypes.bool.isRequired,
|
|
106
|
-
error: PropTypes.string,
|
|
107
|
-
token: PropTypes.string.isRequired,
|
|
108
|
-
setInitialPassword: PropTypes.func.isRequired,
|
|
109
|
-
};
|
|
94
|
+
function PasswordReset() {
|
|
95
|
+
const dispatch = useDispatch();
|
|
96
|
+
const history = useHistory();
|
|
97
|
+
const { token } = useParams();
|
|
110
98
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
* @static
|
|
115
|
-
*/
|
|
116
|
-
static defaultProps = {
|
|
117
|
-
error: null,
|
|
118
|
-
};
|
|
99
|
+
const loading = useSelector((state) => state.users.initial.loading);
|
|
100
|
+
const loaded = useSelector((state) => state.users.initial.loaded);
|
|
101
|
+
const error = useSelector((state) => state.users.initial.error);
|
|
119
102
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
* @param {Object} props Component properties
|
|
124
|
-
* @constructs Controlpanel
|
|
125
|
-
*/
|
|
126
|
-
constructor(props) {
|
|
127
|
-
super(props);
|
|
128
|
-
this.onCancel = this.onCancel.bind(this);
|
|
129
|
-
this.onSubmit = this.onSubmit.bind(this);
|
|
130
|
-
this.state = {
|
|
131
|
-
error: null,
|
|
132
|
-
isSuccessful: false,
|
|
133
|
-
};
|
|
103
|
+
const [localError, setLocalError] = useState(null);
|
|
104
|
+
const [isSuccessful, setIsSuccessful] = useState(false);
|
|
105
|
+
const intl = useIntl();
|
|
134
106
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
107
|
+
const identifierField = config.settings.useEmailAsLogin
|
|
108
|
+
? 'email'
|
|
109
|
+
: 'username';
|
|
138
110
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
111
|
+
const identifierTitle =
|
|
112
|
+
identifierField === 'email'
|
|
113
|
+
? intl.formatMessage(messages.emailTitle)
|
|
114
|
+
: intl.formatMessage(messages.usernameTitle);
|
|
143
115
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
116
|
+
const identifierDescription =
|
|
117
|
+
identifierField === 'email'
|
|
118
|
+
? intl.formatMessage(messages.emailDescription)
|
|
119
|
+
: intl.formatMessage(messages.usernameDescription);
|
|
149
120
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
* @param {Object} nextProps Next properties
|
|
154
|
-
* @returns {undefined}
|
|
155
|
-
*/
|
|
156
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
157
|
-
if (this.props.loading && nextProps.loaded) {
|
|
158
|
-
this.setState({ isSuccessful: true });
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (!loading && loaded) {
|
|
123
|
+
setIsSuccessful(true);
|
|
159
124
|
}
|
|
160
|
-
}
|
|
125
|
+
}, [loading, loaded]);
|
|
161
126
|
|
|
162
127
|
/**
|
|
163
128
|
* Submit handler
|
|
164
129
|
* @method onSubmit
|
|
165
130
|
* @param {object} data Form data.
|
|
166
|
-
* @param {object} event Form data.
|
|
167
131
|
* @returns {undefined}
|
|
168
132
|
*/
|
|
169
|
-
onSubmit(data) {
|
|
133
|
+
const onSubmit = (data) => {
|
|
170
134
|
if (data.password === data.passwordRepeat) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
this.props.token,
|
|
174
|
-
data.password,
|
|
175
|
-
);
|
|
176
|
-
this.setState({
|
|
177
|
-
error: null,
|
|
178
|
-
});
|
|
135
|
+
dispatch(setInitialPassword(data[identifierField], token, data.password));
|
|
136
|
+
setLocalError(null);
|
|
179
137
|
} else {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
message: this.props.intl.formatMessage(messages.passwordsDoNotMatch),
|
|
183
|
-
},
|
|
138
|
+
setLocalError({
|
|
139
|
+
message: intl.formatMessage(messages.passwordsDoNotMatch),
|
|
184
140
|
});
|
|
185
141
|
}
|
|
186
|
-
}
|
|
142
|
+
};
|
|
187
143
|
|
|
188
144
|
/**
|
|
189
145
|
* Cancel handler
|
|
190
146
|
* @method onCancel
|
|
191
147
|
* @returns {undefined}
|
|
192
148
|
*/
|
|
193
|
-
onCancel() {
|
|
194
|
-
|
|
149
|
+
const onCancel = () => {
|
|
150
|
+
history.goBack();
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
if (isSuccessful) {
|
|
154
|
+
return (
|
|
155
|
+
<Container>
|
|
156
|
+
<h1 className="documentFirstHeading">
|
|
157
|
+
<FormattedMessage {...messages.successRedirectToLoginTitle} />
|
|
158
|
+
</h1>
|
|
159
|
+
<p className="description">
|
|
160
|
+
<FormattedMessage
|
|
161
|
+
{...messages.successRedirectToLoginBody}
|
|
162
|
+
values={{
|
|
163
|
+
link: (
|
|
164
|
+
<Link to="/login">{intl.formatMessage({ id: 'Log In' })}</Link>
|
|
165
|
+
),
|
|
166
|
+
}}
|
|
167
|
+
/>
|
|
168
|
+
</p>
|
|
169
|
+
</Container>
|
|
170
|
+
);
|
|
195
171
|
}
|
|
196
172
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
render() {
|
|
203
|
-
if (this.state.isSuccessful) {
|
|
204
|
-
return (
|
|
173
|
+
if (token) {
|
|
174
|
+
const errmsg = error ? error.response?.body?.error || error : null;
|
|
175
|
+
return (
|
|
176
|
+
<div id="page-password-reset">
|
|
177
|
+
<Helmet title={intl.formatMessage(messages.passwordReset)} />
|
|
205
178
|
<Container>
|
|
206
|
-
<
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
<Link to="/login">
|
|
219
|
-
{this.props.intl.formatMessage({ id: 'Log In' })}
|
|
220
|
-
</Link>
|
|
221
|
-
),
|
|
222
|
-
}}
|
|
223
|
-
/>
|
|
224
|
-
</p>
|
|
225
|
-
</Container>
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
|
-
if (this.props.token) {
|
|
229
|
-
const errmsg = this.props.error
|
|
230
|
-
? this.props.error.response.body.error
|
|
231
|
-
: null;
|
|
232
|
-
return (
|
|
233
|
-
<div id="page-password-reset">
|
|
234
|
-
<Helmet
|
|
235
|
-
title={this.props.intl.formatMessage(messages.passwordReset)}
|
|
236
|
-
/>
|
|
237
|
-
<Container>
|
|
238
|
-
<Form
|
|
239
|
-
title={this.props.intl.formatMessage(messages.title)}
|
|
240
|
-
description={this.props.intl.formatMessage(messages.description)}
|
|
241
|
-
onSubmit={this.onSubmit}
|
|
242
|
-
onCancel={this.onCancel}
|
|
243
|
-
error={this.state.error || errmsg}
|
|
244
|
-
schema={{
|
|
245
|
-
fieldsets: [
|
|
246
|
-
{
|
|
247
|
-
id: 'default',
|
|
248
|
-
title: this.props.intl.formatMessage(messages.default),
|
|
249
|
-
fields: [
|
|
250
|
-
this.identifierField,
|
|
251
|
-
'password',
|
|
252
|
-
'passwordRepeat',
|
|
253
|
-
],
|
|
254
|
-
},
|
|
255
|
-
],
|
|
256
|
-
properties: {
|
|
257
|
-
[this.identifierField]: {
|
|
258
|
-
type: 'string',
|
|
259
|
-
title: this.identifierTitle,
|
|
260
|
-
description: this.identifierDescription,
|
|
261
|
-
},
|
|
262
|
-
password: {
|
|
263
|
-
description: this.props.intl.formatMessage(
|
|
264
|
-
messages.passwordDescription,
|
|
265
|
-
),
|
|
266
|
-
title: this.props.intl.formatMessage(
|
|
267
|
-
messages.passwordTitle,
|
|
268
|
-
),
|
|
269
|
-
type: 'string',
|
|
270
|
-
widget: 'password',
|
|
271
|
-
},
|
|
272
|
-
passwordRepeat: {
|
|
273
|
-
description: this.props.intl.formatMessage(
|
|
274
|
-
messages.passwordRepeatDescription,
|
|
275
|
-
),
|
|
276
|
-
title: this.props.intl.formatMessage(
|
|
277
|
-
messages.passwordRepeatTitle,
|
|
278
|
-
),
|
|
279
|
-
type: 'string',
|
|
280
|
-
widget: 'password',
|
|
281
|
-
},
|
|
179
|
+
<Form
|
|
180
|
+
title={intl.formatMessage(messages.title)}
|
|
181
|
+
description={intl.formatMessage(messages.description)}
|
|
182
|
+
onSubmit={onSubmit}
|
|
183
|
+
onCancel={onCancel}
|
|
184
|
+
error={localError || errmsg}
|
|
185
|
+
schema={{
|
|
186
|
+
fieldsets: [
|
|
187
|
+
{
|
|
188
|
+
id: 'default',
|
|
189
|
+
title: intl.formatMessage(messages.default),
|
|
190
|
+
fields: [identifierField, 'password', 'passwordRepeat'],
|
|
282
191
|
},
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
192
|
+
],
|
|
193
|
+
properties: {
|
|
194
|
+
[identifierField]: {
|
|
195
|
+
type: 'string',
|
|
196
|
+
title: identifierTitle,
|
|
197
|
+
description: identifierDescription,
|
|
198
|
+
},
|
|
199
|
+
password: {
|
|
200
|
+
description: intl.formatMessage(messages.passwordDescription),
|
|
201
|
+
title: intl.formatMessage(messages.passwordTitle),
|
|
202
|
+
type: 'string',
|
|
203
|
+
widget: 'password',
|
|
204
|
+
},
|
|
205
|
+
passwordRepeat: {
|
|
206
|
+
description: intl.formatMessage(
|
|
207
|
+
messages.passwordRepeatDescription,
|
|
208
|
+
),
|
|
209
|
+
title: intl.formatMessage(messages.passwordRepeatTitle),
|
|
210
|
+
type: 'string',
|
|
211
|
+
widget: 'password',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
submitLabel: intl.formatMessage(messages.setMyPassword),
|
|
215
|
+
required: [identifierField, 'password', 'passwordRepeat'],
|
|
216
|
+
}}
|
|
217
|
+
/>
|
|
218
|
+
</Container>
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
294
221
|
}
|
|
222
|
+
|
|
223
|
+
return <div />;
|
|
295
224
|
}
|
|
296
225
|
|
|
297
|
-
export default
|
|
298
|
-
withRouter,
|
|
299
|
-
injectIntl,
|
|
300
|
-
connect(
|
|
301
|
-
(state, props) => ({
|
|
302
|
-
loading: state.users.initial.loading,
|
|
303
|
-
loaded: state.users.initial.loaded,
|
|
304
|
-
error: state.users.initial.error,
|
|
305
|
-
token: props.match.params.token,
|
|
306
|
-
}),
|
|
307
|
-
{ setInitialPassword },
|
|
308
|
-
),
|
|
309
|
-
)(PasswordReset);
|
|
226
|
+
export default PasswordReset;
|
|
@@ -6,11 +6,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
6
6
|
|
|
7
7
|
import RequestPasswordReset from './RequestPasswordReset';
|
|
8
8
|
|
|
9
|
-
vi.mock('@plone/volto/components/manage/Form'
|
|
10
|
-
return await import(
|
|
11
|
-
'@plone/volto/components/manage/Form/__mocks__/index.vitest.tsx'
|
|
12
|
-
);
|
|
13
|
-
});
|
|
9
|
+
vi.mock('@plone/volto/components/manage/Form');
|
|
14
10
|
|
|
15
11
|
const mockStore = configureStore();
|
|
16
12
|
|
|
@@ -6,11 +6,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
6
6
|
|
|
7
7
|
import Register from './Register';
|
|
8
8
|
|
|
9
|
-
vi.mock('@plone/volto/components/manage/Form'
|
|
10
|
-
return await import(
|
|
11
|
-
'@plone/volto/components/manage/Form/__mocks__/index.vitest.tsx'
|
|
12
|
-
);
|
|
13
|
-
});
|
|
9
|
+
vi.mock('@plone/volto/components/manage/Form');
|
|
14
10
|
|
|
15
11
|
const mockStore = configureStore();
|
|
16
12
|
|
|
@@ -29,7 +29,7 @@ const RequestTimeout = () => (
|
|
|
29
29
|
<h1 style={{ textAlign: 'center', lineHeight: '40px' }}>
|
|
30
30
|
<FormattedMessage
|
|
31
31
|
id="No connection to the server"
|
|
32
|
-
defaultMessage="There is no connection to the server, due to a timeout
|
|
32
|
+
defaultMessage="There is no connection to the server, due to a timeout or no network connection."
|
|
33
33
|
/>
|
|
34
34
|
<br />
|
|
35
35
|
<a href={config.settings.apiPath}>{config.settings.apiPath}</a>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import SitemapComponent from './Sitemap';
|
|
3
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
4
|
+
|
|
5
|
+
const IntlSitemapComponent = injectIntl(SitemapComponent);
|
|
6
|
+
|
|
7
|
+
function StoryComponent(args) {
|
|
8
|
+
// Add mock location object
|
|
9
|
+
const mockLocation = {
|
|
10
|
+
pathname: '/sitemap',
|
|
11
|
+
search: '',
|
|
12
|
+
hash: '',
|
|
13
|
+
state: null,
|
|
14
|
+
};
|
|
15
|
+
return (
|
|
16
|
+
<Wrapper
|
|
17
|
+
customStore={{
|
|
18
|
+
navigation: {
|
|
19
|
+
url: 'http://localhost:8080/Plone/@navigation',
|
|
20
|
+
...args,
|
|
21
|
+
},
|
|
22
|
+
intl: {
|
|
23
|
+
locale: 'en',
|
|
24
|
+
messages: {},
|
|
25
|
+
},
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
29
|
+
<IntlSitemapComponent
|
|
30
|
+
location={mockLocation}
|
|
31
|
+
getNavigation={() => {}}
|
|
32
|
+
lang="en"
|
|
33
|
+
items={args.items}
|
|
34
|
+
/>
|
|
35
|
+
</Wrapper>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const Sitemap = StoryComponent.bind({});
|
|
40
|
+
Sitemap.args = {
|
|
41
|
+
items: [
|
|
42
|
+
{
|
|
43
|
+
url: 'http://localhost:8080/Plone/page-1',
|
|
44
|
+
description: '',
|
|
45
|
+
items: [
|
|
46
|
+
{
|
|
47
|
+
url: 'http://localhost:8080/Plone/page-1/page-1-2',
|
|
48
|
+
description: '',
|
|
49
|
+
title: 'Page 1-2',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
url: 'http://localhost:8080/Plone/page-1/page-1-3',
|
|
53
|
+
description: '',
|
|
54
|
+
title: 'Page 1-3',
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
title: 'Page 1-3',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
url: 'http://localhost:8080/Plone/page-2',
|
|
61
|
+
description: '',
|
|
62
|
+
title: 'Page 2',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
export default {
|
|
67
|
+
title: 'Public components/Sitemap',
|
|
68
|
+
component: Sitemap,
|
|
69
|
+
decorators: [
|
|
70
|
+
(Story) => (
|
|
71
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
72
|
+
<Story />
|
|
73
|
+
</div>
|
|
74
|
+
),
|
|
75
|
+
],
|
|
76
|
+
argTypes: {
|
|
77
|
+
items: {
|
|
78
|
+
control: 'object',
|
|
79
|
+
description: 'url,description,title of the pages mentioned',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useLocation } from 'react-router-dom';
|
|
2
2
|
import config from '@plone/volto/registry';
|
|
3
|
-
import type {
|
|
3
|
+
import type { GetSlotArgs } from '@plone/types';
|
|
4
|
+
|
|
5
|
+
export interface SlotRendererProps extends GetSlotArgs {
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
4
8
|
|
|
5
9
|
/*
|
|
6
10
|
Usage:
|
|
@@ -11,20 +15,20 @@ const SlotRenderer = ({
|
|
|
11
15
|
name,
|
|
12
16
|
content,
|
|
13
17
|
navRoot,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
navRoot?: Content;
|
|
18
|
-
}) => {
|
|
18
|
+
data,
|
|
19
|
+
...rest
|
|
20
|
+
}: SlotRendererProps) => {
|
|
19
21
|
const location = useLocation();
|
|
20
22
|
|
|
21
23
|
let slots = config.getSlot(name, {
|
|
24
|
+
...rest,
|
|
22
25
|
content,
|
|
23
26
|
location: location as any, // Since we are using an older version of history, we need to cast it to any
|
|
24
27
|
// This is to cover the use case while adding a new content and we don't have
|
|
25
28
|
// have the navRoot information in the initial content. This will be
|
|
26
29
|
// useful for SlotRenderers rendered in the `Add` route.
|
|
27
30
|
navRoot: content?.['@components']?.navroot?.navroot || navRoot,
|
|
31
|
+
data,
|
|
28
32
|
});
|
|
29
33
|
|
|
30
34
|
if (!slots) {
|
|
@@ -45,10 +49,12 @@ const SlotRenderer = ({
|
|
|
45
49
|
const SlotComponent = component;
|
|
46
50
|
return (
|
|
47
51
|
<SlotComponent
|
|
52
|
+
{...rest}
|
|
48
53
|
key={name}
|
|
49
54
|
content={content}
|
|
50
55
|
location={location}
|
|
51
56
|
navRoot={navRoot}
|
|
57
|
+
data={data}
|
|
52
58
|
/>
|
|
53
59
|
);
|
|
54
60
|
},
|
|
@@ -4,41 +4,50 @@ import { Container } from 'semantic-ui-react';
|
|
|
4
4
|
import { useSelector } from 'react-redux';
|
|
5
5
|
import { useLocation } from 'react-router-dom';
|
|
6
6
|
import { withServerErrorCode } from '@plone/volto/helpers/Utils/Utils';
|
|
7
|
-
import
|
|
7
|
+
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
|
|
8
8
|
|
|
9
9
|
const Unauthorized = () => {
|
|
10
|
+
const token = useSelector((state) => state.userSession.token);
|
|
10
11
|
const error_message = useSelector((state) => state.apierror?.message);
|
|
11
12
|
let location = useLocation();
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
15
|
<Container className="view-wrapper">
|
|
16
|
+
<BodyClass className="view-unauthorized" />
|
|
15
17
|
<h1>
|
|
16
18
|
<FormattedMessage id="Unauthorized" defaultMessage="Unauthorized" />
|
|
17
19
|
</h1>
|
|
18
20
|
<h3>{error_message}</h3>
|
|
19
21
|
<p className="description">
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
22
|
+
{token ? (
|
|
23
|
+
<FormattedMessage
|
|
24
|
+
id="You are trying to access a protected resource."
|
|
25
|
+
defaultMessage="You are trying to access a protected resource."
|
|
26
|
+
/>
|
|
27
|
+
) : (
|
|
28
|
+
<FormattedMessage
|
|
29
|
+
id="You are trying to access a protected resource, please {login} first."
|
|
30
|
+
defaultMessage="You are trying to access a protected resource, please {login} first."
|
|
31
|
+
values={{
|
|
32
|
+
login: (
|
|
33
|
+
<Link
|
|
34
|
+
to={{
|
|
35
|
+
pathname: `${location.pathname.replace(/\/$/, '')}/login`,
|
|
36
|
+
state: {
|
|
37
|
+
// This is needed to cover the use case of being logged in in
|
|
38
|
+
// another backend (eg. in development), having a token for
|
|
39
|
+
// localhost and try to use it, the login route has to know that
|
|
40
|
+
// it's the same as it comes from a logout
|
|
41
|
+
isLogout: true,
|
|
42
|
+
},
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<FormattedMessage id="log in" defaultMessage="log in" />
|
|
46
|
+
</Link>
|
|
47
|
+
),
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
)}
|
|
42
51
|
</p>
|
|
43
52
|
<p>
|
|
44
53
|
<FormattedMessage
|
|
@@ -62,5 +71,6 @@ const Unauthorized = () => {
|
|
|
62
71
|
</Container>
|
|
63
72
|
);
|
|
64
73
|
};
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
const UnauthorizedWithCode = withServerErrorCode(401)(Unauthorized);
|
|
75
|
+
UnauthorizedWithCode.displayName = 'unauthorized';
|
|
76
|
+
export default UnauthorizedWithCode;
|
|
@@ -9,8 +9,35 @@ import Unauthorized from './Unauthorized';
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
11
|
describe('Unauthorized', () => {
|
|
12
|
-
it('renders
|
|
12
|
+
it('renders an unauthorized component', () => {
|
|
13
13
|
const store = mockStore({
|
|
14
|
+
userSession: {
|
|
15
|
+
token: null,
|
|
16
|
+
},
|
|
17
|
+
intl: {
|
|
18
|
+
locale: 'en',
|
|
19
|
+
messages: {},
|
|
20
|
+
},
|
|
21
|
+
apierror: {
|
|
22
|
+
message: 'You are not authorized to access this resource',
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const component = renderer.create(
|
|
26
|
+
<Provider store={store}>
|
|
27
|
+
<MemoryRouter>
|
|
28
|
+
<Unauthorized />
|
|
29
|
+
</MemoryRouter>
|
|
30
|
+
</Provider>,
|
|
31
|
+
);
|
|
32
|
+
const json = component.toJSON();
|
|
33
|
+
expect(json).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('renders an unauthorized component for authenticated user', () => {
|
|
37
|
+
const store = mockStore({
|
|
38
|
+
userSession: {
|
|
39
|
+
token: '1234',
|
|
40
|
+
},
|
|
14
41
|
intl: {
|
|
15
42
|
locale: 'en',
|
|
16
43
|
messages: {},
|