@strapi/admin 4.3.4 → 4.4.0-alpha.0
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/admin/src/StrapiApp.js +27 -35
- package/admin/src/components/AuthenticatedApp/index.js +15 -12
- package/admin/src/components/AuthenticatedApp/utils/api.js +1 -1
- package/admin/src/components/AutoReloadOverlayBlockerProvider/index.js +8 -6
- package/admin/src/components/ConfigurationsProvider/index.js +21 -12
- package/admin/src/components/ConfigurationsProvider/reducer.js +1 -1
- package/admin/src/components/GuidedTour/Homepage/components/Stepper.js +1 -1
- package/admin/src/components/GuidedTour/Homepage/index.js +2 -2
- package/admin/src/components/GuidedTour/Modal/components/Content.js +6 -6
- package/admin/src/components/GuidedTour/Modal/components/Modal.js +1 -1
- package/admin/src/components/GuidedTour/Modal/index.js +2 -4
- package/admin/src/components/GuidedTour/Modal/reducer.js +1 -1
- package/admin/src/components/GuidedTour/index.js +4 -4
- package/admin/src/components/GuidedTour/init.js +2 -2
- package/admin/src/components/GuidedTour/reducer.js +1 -1
- package/admin/src/components/GuidedTour/utils/isGuidedTourCompleted.js +1 -1
- package/admin/src/components/GuidedTour/utils/persistStateToLocaleStorage.js +4 -4
- package/admin/src/components/LanguageProvider/index.js +1 -1
- package/admin/src/components/LanguageProvider/init.js +1 -1
- package/admin/src/components/LeftMenu/index.js +6 -6
- package/admin/src/components/Notifications/Notification/index.js +3 -4
- package/admin/src/components/Notifications/index.js +2 -2
- package/admin/src/components/Notifications/reducer.js +2 -2
- package/admin/src/components/PluginsInitializer/index.js +4 -2
- package/admin/src/components/PluginsInitializer/init.js +1 -1
- package/admin/src/components/PluginsInitializer/reducer.js +1 -1
- package/admin/src/components/PrivateRoute/index.js +1 -1
- package/admin/src/components/Providers/index.js +14 -10
- package/admin/src/components/RBACProvider/actions.js +1 -1
- package/admin/src/components/RBACProvider/index.js +1 -1
- package/admin/src/components/RBACProvider/reducer.js +2 -2
- package/admin/src/components/ThemeToggleProvider/index.js +1 -1
- package/admin/src/components/UpgradePlanModal/index.js +1 -1
- package/admin/src/content-manager/components/AttributeFilter/Filters.js +1 -1
- package/admin/src/content-manager/components/AttributeFilter/hooks/useAllowedAttributes.js +1 -1
- package/admin/src/content-manager/components/AttributeFilter/index.js +1 -1
- package/admin/src/content-manager/components/Block/index.js +1 -1
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +7 -12
- package/admin/src/content-manager/components/DragLayer/index.js +1 -1
- package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +1 -1
- package/admin/src/content-manager/components/DynamicTable/CellContent/RepeatableComponent/index.js +1 -1
- package/admin/src/content-manager/components/DynamicTable/TableRows/index.js +4 -4
- package/admin/src/content-manager/components/DynamicTable/index.js +25 -4
- package/admin/src/content-manager/components/DynamicZone/components/AddComponentButton/index.js +18 -20
- package/admin/src/content-manager/components/DynamicZone/components/Component/index.js +1 -1
- package/admin/src/content-manager/components/DynamicZone/components/ComponentPicker/Category/ComponentCard/index.js +1 -1
- package/admin/src/content-manager/components/DynamicZone/components/ComponentPicker/index.js +3 -3
- package/admin/src/content-manager/components/DynamicZone/index.js +10 -10
- package/admin/src/content-manager/components/DynamicZone/utils/connect.js +1 -1
- package/admin/src/content-manager/components/DynamicZone/utils/select.js +1 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +6 -6
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +1 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +4 -4
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +18 -18
- package/admin/src/content-manager/components/FieldComponent/utils/connect.js +1 -1
- package/admin/src/content-manager/components/FieldComponent/utils/select.js +6 -6
- package/admin/src/content-manager/components/FieldTypeIcon/index.js +31 -1
- package/admin/src/content-manager/components/FormTitle/index.js +1 -1
- package/admin/src/content-manager/components/InjectionZoneList/index.js +1 -1
- package/admin/src/content-manager/components/InputJSON/index.js +5 -6
- package/admin/src/content-manager/components/InputJSON/jsonlint.js +13 -13
- package/admin/src/content-manager/components/InputUID/index.js +1 -1
- package/admin/src/content-manager/components/InputUID/regex.js +1 -1
- package/admin/src/content-manager/components/Inputs/index.js +62 -15
- package/admin/src/content-manager/components/Inputs/utils/connect.js +1 -1
- package/admin/src/content-manager/components/Inputs/utils/generateOptions.js +1 -1
- package/admin/src/content-manager/components/Inputs/utils/getStep.js +1 -5
- package/admin/src/content-manager/components/LayoutDndProvider/index.js +6 -6
- package/admin/src/content-manager/components/NonRepeatableComponent/index.js +4 -4
- package/admin/src/content-manager/components/PreviewWysiwyg/utils/mdRenderer.js +1 -1
- package/admin/src/content-manager/components/PreviewWysiwyg/utils/satinizeHtml.js +1 -1
- package/admin/src/content-manager/components/RepeatableComponent/AccordionGroupCustom/index.js +1 -1
- package/admin/src/content-manager/components/RepeatableComponent/DraggedItem/index.js +9 -15
- package/admin/src/content-manager/components/RepeatableComponent/DraggedItem/utils/connect.js +1 -1
- package/admin/src/content-manager/components/RepeatableComponent/index.js +5 -5
- package/admin/src/content-manager/components/RepeatableComponent/utils/connect.js +1 -1
- package/admin/src/content-manager/components/RepeatableComponent/utils/getComponentErrorKeys.js +2 -2
- package/admin/src/content-manager/components/SectionTitle/index.js +1 -1
- package/admin/src/content-manager/components/SelectMany/ListItem.js +1 -1
- package/admin/src/content-manager/components/SelectMany/index.js +1 -1
- package/admin/src/content-manager/components/SelectOne/SingleValue.js +1 -1
- package/admin/src/content-manager/components/SelectWrapper/Option.js +1 -1
- package/admin/src/content-manager/components/SelectWrapper/index.js +16 -26
- package/admin/src/content-manager/components/SelectWrapper/utils/connect.js +1 -1
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +6 -11
- package/admin/src/content-manager/components/SingleTypeFormWrapper/utils/getRequestUrl.js +1 -1
- package/admin/src/content-manager/components/Wysiwyg/Editor.js +1 -1
- package/admin/src/content-manager/components/Wysiwyg/EditorLayout.js +1 -1
- package/admin/src/content-manager/components/Wysiwyg/WysiwygFooter.js +1 -1
- package/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +4 -4
- package/admin/src/content-manager/components/Wysiwyg/index.js +5 -5
- package/admin/src/content-manager/components/Wysiwyg/utils/utils.js +4 -4
- package/admin/src/content-manager/hooks/useContentTypeLayout/index.js +1 -1
- package/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js +3 -3
- package/admin/src/content-manager/hooks/useFetchContentTypeLayout/reducer.js +1 -1
- package/admin/src/content-manager/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +7 -7
- package/admin/src/content-manager/hooks/useFindRedirectionLink/index.js +1 -1
- package/admin/src/content-manager/hooks/useFindRedirectionLink/selectors.js +1 -1
- package/admin/src/content-manager/hooks/useSyncRbac/reducer.js +1 -1
- package/admin/src/content-manager/hooks/useSyncRbac/selectors.js +2 -2
- package/admin/src/content-manager/pages/App/LeftMenu/index.js +8 -8
- package/admin/src/content-manager/pages/App/index.js +3 -3
- package/admin/src/content-manager/pages/App/reducer.js +1 -1
- package/admin/src/content-manager/pages/App/selectors.js +4 -4
- package/admin/src/content-manager/pages/App/useModels.js +1 -1
- package/admin/src/content-manager/pages/App/utils/generateModelsLinks.js +2 -2
- package/admin/src/content-manager/pages/CollectionTypeRecursivePath/index.js +1 -1
- package/admin/src/content-manager/pages/ComponentSetttingsView/index.js +2 -2
- package/admin/src/content-manager/pages/EditSettingsView/components/ComponentFieldList.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/DisplayedFieldButton.js +5 -5
- package/admin/src/content-manager/pages/EditSettingsView/components/DisplayedFields.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/DynamicZoneList.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/FormModal.js +7 -2
- package/admin/src/content-manager/pages/EditSettingsView/components/GenericInput.js +3 -3
- package/admin/src/content-manager/pages/EditSettingsView/components/ModalForm.js +36 -5
- package/admin/src/content-manager/pages/EditSettingsView/components/RelationalFieldButton.js +3 -3
- package/admin/src/content-manager/pages/EditSettingsView/components/RelationalFields.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/index.js +23 -22
- package/admin/src/content-manager/pages/EditSettingsView/reducer.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/utils/createPossibleMainFieldsForModelsAndComponents.js +2 -2
- package/admin/src/content-manager/pages/EditSettingsView/utils/getInputProps.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/utils/layout.js +12 -12
- package/admin/src/content-manager/pages/EditView/DeleteLink/index.js +1 -1
- package/admin/src/content-manager/pages/EditView/DeleteLink/utils/connect.js +1 -1
- package/admin/src/content-manager/pages/EditView/DraftAndPublishBadge/utils/connect.js +1 -1
- package/admin/src/content-manager/pages/EditView/Header/index.js +4 -4
- package/admin/src/content-manager/pages/EditView/Header/utils/connect.js +1 -1
- package/admin/src/content-manager/pages/EditView/Header/utils/getDraftRelations.js +3 -3
- package/admin/src/content-manager/pages/EditView/Informations/utils/getUnits.js +1 -1
- package/admin/src/content-manager/pages/EditView/index.js +98 -94
- package/admin/src/content-manager/pages/EditView/utils/createAttributesLayout.js +2 -2
- package/admin/src/content-manager/pages/EditView/utils/getFieldsActionMatchingPermissions.js +1 -1
- package/admin/src/content-manager/pages/EditViewLayoutManager/Permissions.js +1 -1
- package/admin/src/content-manager/pages/EditViewLayoutManager/reducer.js +1 -1
- package/admin/src/content-manager/pages/EditViewLayoutManager/selectors.js +1 -1
- package/admin/src/content-manager/pages/ListSettingsView/components/DraggableCard.js +6 -6
- package/admin/src/content-manager/pages/ListSettingsView/components/EditFieldForm.js +4 -3
- package/admin/src/content-manager/pages/ListSettingsView/components/Settings.js +9 -9
- package/admin/src/content-manager/pages/ListSettingsView/components/SortDisplayedFields.js +2 -2
- package/admin/src/content-manager/pages/ListSettingsView/index.js +9 -9
- package/admin/src/content-manager/pages/ListSettingsView/reducer.js +1 -1
- package/admin/src/content-manager/pages/ListSettingsView/utils/ellipsisCardTitle.js +1 -1
- package/admin/src/content-manager/pages/ListView/FieldPicker/index.js +8 -7
- package/admin/src/content-manager/pages/ListView/FieldPicker/utils/getAllAllowedHeader.js +1 -1
- package/admin/src/content-manager/pages/ListView/actions.js +1 -1
- package/admin/src/content-manager/pages/ListView/index.js +3 -3
- package/admin/src/content-manager/pages/ListView/reducer.js +2 -2
- package/admin/src/content-manager/pages/ListView/selectors.js +3 -3
- package/admin/src/content-manager/pages/ListView/utils/createPluginsFilter.js +1 -1
- package/admin/src/content-manager/pages/ListViewLayoutManager/Permissions.js +2 -2
- package/admin/src/content-manager/sharedReducers/crudReducer/actions.js +3 -3
- package/admin/src/content-manager/sharedReducers/crudReducer/reducer.js +1 -1
- package/admin/src/content-manager/sharedReducers/crudReducer/selectors.js +1 -1
- package/admin/src/content-manager/utils/checkIfAttributeIsDisplayable.js +1 -1
- package/admin/src/content-manager/utils/formatLayoutToApi.js +2 -2
- package/admin/src/content-manager/utils/generatePermissionsObject.js +3 -2
- package/admin/src/content-manager/utils/getFieldName.js +2 -2
- package/admin/src/content-manager/utils/getMaxTempKey.js +2 -2
- package/admin/src/content-manager/utils/getRequestUrl.js +1 -1
- package/admin/src/content-manager/utils/getTrad.js +1 -1
- package/admin/src/content-manager/utils/mergeMetasWithSchema.js +2 -2
- package/admin/src/content-manager/utils/removeKeyInObject.js +1 -1
- package/admin/src/content-manager/utils/removePasswordFieldsFromData.js +2 -2
- package/admin/src/core/apis/CustomFields.js +80 -0
- package/admin/src/core/apis/Plugin.js +1 -1
- package/admin/src/core/apis/index.js +1 -0
- package/admin/src/core/store/configureStore.js +1 -1
- package/admin/src/core/store/createReducer.js +1 -1
- package/admin/src/core/utils/axiosInstance.js +4 -4
- package/admin/src/core/utils/createHook.js +2 -2
- package/admin/src/hooks/useFetchEnabledPlugins/index.js +3 -3
- package/admin/src/hooks/useFetchMarketplacePlugins/index.js +3 -3
- package/admin/src/hooks/useFetchMarketplacePlugins/utils/api.js +1 -1
- package/admin/src/hooks/useFetchMarketplaceProviders/index.js +3 -3
- package/admin/src/hooks/useFetchPermissionsLayout/index.js +1 -1
- package/admin/src/hooks/useFetchPermissionsLayout/reducer.js +1 -1
- package/admin/src/hooks/useFetchRole/index.js +4 -4
- package/admin/src/hooks/useFetchRole/reducer.js +1 -1
- package/admin/src/hooks/useMenu/reducer.js +1 -1
- package/admin/src/hooks/useMenu/utils/getGeneralLinks.js +3 -1
- package/admin/src/hooks/useModels/index.js +1 -1
- package/admin/src/hooks/useModels/reducer.js +3 -3
- package/admin/src/hooks/useRolesList/reducer.js +1 -1
- package/admin/src/hooks/useSettingsForm/index.js +2 -2
- package/admin/src/hooks/useSettingsForm/reducer.js +1 -1
- package/admin/src/hooks/useSettingsMenu/index.js +2 -2
- package/admin/src/hooks/useSettingsMenu/init.js +1 -1
- package/admin/src/hooks/useSettingsMenu/reducer.js +3 -3
- package/admin/src/hooks/useSettingsMenu/utils/formatLinks.js +3 -3
- package/admin/src/hooks/useSettingsMenu/utils/sortLinks.js +1 -1
- package/admin/src/index.js +1 -1
- package/admin/src/layouts/UnauthenticatedLayout/LocaleToggle/index.js +1 -1
- package/admin/src/pages/Admin/Onboarding/index.js +2 -2
- package/admin/src/pages/Admin/index.js +2 -2
- package/admin/src/pages/App/index.js +13 -5
- package/admin/src/pages/App/reducer.js +1 -1
- package/admin/src/pages/AuthPage/components/ForgotPassword/index.js +1 -1
- package/admin/src/pages/AuthPage/components/Login/BaseLogin.js +4 -4
- package/admin/src/pages/AuthPage/components/Login/index.js +2 -2
- package/admin/src/pages/AuthPage/components/Register/index.js +6 -6
- package/admin/src/pages/AuthPage/components/ResetPassword/index.js +5 -5
- package/admin/src/pages/AuthPage/init.js +1 -1
- package/admin/src/pages/AuthPage/reducer.js +1 -1
- package/admin/src/pages/AuthPage/utils/forms.js +2 -8
- package/admin/src/pages/HomePage/ContentBlocks.js +1 -1
- package/admin/src/pages/HomePage/SocialLinks.js +1 -1
- package/admin/src/pages/HomePage/index.js +3 -3
- package/admin/src/pages/InstalledPluginsPage/Plugins.js +1 -1
- package/admin/src/pages/MarketplacePage/components/NpmPackagesGrid/index.js +2 -2
- package/admin/src/pages/MarketplacePage/index.js +6 -10
- package/admin/src/pages/ProfilePage/index.js +20 -23
- package/admin/src/pages/ProfilePage/utils/api.js +1 -1
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +4 -4
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/index.js +8 -6
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +25 -13
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/utils/tableHeaders.js +16 -4
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/reducer.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/reducer.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromComputerForm.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromUrlForm.js +2 -2
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/reducer.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +4 -4
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/getFormData.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/parseFileMetadatas.js +4 -4
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/ActionRow/index.js +4 -4
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/Collapse/index.js +5 -8
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/Collapse/utils/generateCheckboxesActions.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/index.js +3 -3
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/getRowLabelCheckboxeState.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/Header/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/index.js +8 -12
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/utils/generateHeadersFromActions.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/utils/activeStyle.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/utils/getAvailableActions.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapses/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Curve/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/GlobalActions/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/GlobalActions/utils/findDisplayedActions.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/GlobalActions/utils/getRowLabelCheckboxesState.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/index.js +9 -8
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/reducer.js +4 -4
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/createDefaultCTFormFromLayout.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/findMatchingPermissions.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/formatContentTypesPermissionToAPI.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/formatLayoutForSettingsAndPlugins.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/formatPermissionsToAPI.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/formatSettingsPermissionsToAPI.js +4 -4
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/updateConditionsToFalse.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/PluginsAndSettings/SubCategory/index.js +5 -8
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/PluginsAndSettings/SubCategory/utils/formatActions.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/PluginsAndSettings/SubCategory/utils/getConditionsButtonState.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/PluginsAndSettings/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/RoleForm/index.js +67 -69
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/RowLabelWithCheckbox/index.js +4 -3
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/utils/createArrayOfValues.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/utils/getCheckboxState.js +3 -3
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/utils/removeConditionKeyFromData.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js +58 -60
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +6 -10
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +3 -3
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/DynamicTable/TableRows/index.js +4 -4
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/Filters/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +8 -8
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/schema.js +2 -8
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +17 -11
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/tableHeaders.js +46 -14
- package/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Users/utils/validations/users/profile.js +1 -5
- package/admin/src/pages/SettingsPage/pages/Users/utils/validations/users/roles.js +1 -4
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/EventRow.js +5 -5
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +4 -4
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/utils/formatValue.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/HeadersInput/Combobox.js +4 -4
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/TriggerContainer/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/utils/fieldsRegex.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/utils/schema.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +9 -9
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/reducer.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/utils/formatData.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +6 -6
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/reducer.js +4 -4
- package/admin/src/pages/SettingsPage/utils/createSectionsRoutes.js +3 -3
- package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +12 -12
- package/admin/src/pages/SettingsPage/utils/getSectionsToDisplay.js +2 -2
- package/admin/src/pages/UseCasePage/index.js +2 -2
- package/admin/src/shared/components/InjectionZone/index.js +1 -1
- package/admin/src/shared/hooks/useInjectionZone/index.js +1 -1
- package/admin/src/translations/ca.json +4 -4
- package/admin/src/translations/de.json +4 -4
- package/admin/src/translations/dk.json +4 -4
- package/admin/src/translations/en.json +16 -15
- package/admin/src/translations/es.json +163 -6
- package/admin/src/translations/fr.json +4 -4
- package/admin/src/translations/gu.json +4 -4
- package/admin/src/translations/he.json +3 -3
- package/admin/src/translations/hi.json +4 -4
- package/admin/src/translations/hu.json +4 -4
- package/admin/src/translations/id.json +4 -4
- package/admin/src/translations/it.json +4 -4
- package/admin/src/translations/ja.json +4 -4
- package/admin/src/translations/ko.json +4 -4
- package/admin/src/translations/ml.json +4 -4
- package/admin/src/translations/nl.json +4 -4
- package/admin/src/translations/no.json +3 -3
- package/admin/src/translations/pl.json +4 -4
- package/admin/src/translations/pt-BR.json +177 -24
- package/admin/src/translations/ru.json +4 -4
- package/admin/src/translations/sa.json +4 -4
- package/admin/src/translations/sk.json +4 -4
- package/admin/src/translations/sv.json +665 -11
- package/admin/src/translations/th.json +3 -3
- package/admin/src/translations/zh-Hans.json +12 -15
- package/admin/src/translations/zh.json +4 -4
- package/admin/src/utils/getAttributesToDisplay.js +1 -1
- package/admin/src/utils/getExistingActions.js +2 -2
- package/admin/src/utils/getFullName.js +1 -1
- package/admin/src/utils/getRequestUrl.js +1 -1
- package/admin/src/utils/makeUniqueRoutes.js +2 -2
- package/admin/src/utils/sortLinks.js +1 -1
- package/build/{1669.0551026a.chunk.js → 1669.4ce92b2f.chunk.js} +1 -1
- package/build/524.2437fb56.chunk.js +644 -0
- package/build/{6925.fb35248e.chunk.js → 6925.f5c8b6fc.chunk.js} +4 -4
- package/build/{7866.29d1f169.chunk.js → 7866.22e3c9f8.chunk.js} +1 -1
- package/build/8773.4e36117f.chunk.js +325 -0
- package/build/Admin-authenticatedApp.aaa66872.chunk.js +80 -0
- package/build/Admin_InternalErrorPage.12e24216.chunk.js +1 -0
- package/build/{Admin_marketplace.0b758aac.chunk.js → Admin_marketplace.2d181ad7.chunk.js} +1 -1
- package/build/Admin_pluginsPage.4d59785a.chunk.js +1 -0
- package/build/Admin_profilePage.8617313a.chunk.js +15 -0
- package/build/Admin_settingsPage.e58753c8.chunk.js +178 -0
- package/build/admin-app.1f9e13f8.chunk.js +112 -0
- package/build/admin-edit-roles-page.554ba3fa.chunk.js +1 -0
- package/build/admin-edit-users.5bebf473.chunk.js +10 -0
- package/build/admin-users.1d0aa7a0.chunk.js +11 -0
- package/build/{api-tokens-create-page.442e3be0.chunk.js → api-tokens-create-page.b4a9987d.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.5f34eec7.chunk.js → api-tokens-edit-page.6f5b4e26.chunk.js} +1 -1
- package/build/api-tokens-list-page.06938769.chunk.js +15 -0
- package/build/ca-json.d16c1d28.chunk.js +1 -0
- package/build/content-manager.86f7594d.chunk.js +1178 -0
- package/build/content-type-builder-list-view.9b874fd4.chunk.js +194 -0
- package/build/content-type-builder-translation-en-json.f985c9c4.chunk.js +1 -0
- package/build/content-type-builder-translation-pt-BR-json.d6c7fcc1.chunk.js +1 -0
- package/build/content-type-builder.47ab07ad.chunk.js +145 -0
- package/build/de-json.a9b514dc.chunk.js +1 -0
- package/build/dk-json.09e8d145.chunk.js +1 -0
- package/build/en-json.1bf20384.chunk.js +1 -0
- package/build/es-json.bb1fc425.chunk.js +1 -0
- package/build/fr-json.a3cf2e0b.chunk.js +1 -0
- package/build/gu-json.d8311297.chunk.js +1 -0
- package/build/he-json.3b825d80.chunk.js +1 -0
- package/build/hi-json.0edb8d29.chunk.js +1 -0
- package/build/hu-json.7855529a.chunk.js +1 -0
- package/build/i18n-settings-page.bf1304b0.chunk.js +101 -0
- package/build/i18n-translation-fr-json.b401aa34.chunk.js +1 -0
- package/build/id-json.df9618f2.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/it-json.a21bf078.chunk.js +1 -0
- package/build/ja-json.7b0d9067.chunk.js +1 -0
- package/build/ko-json.983c1f8f.chunk.js +1 -0
- package/build/main.7db3414f.js +9321 -0
- package/build/ml-json.8dd021c8.chunk.js +1 -0
- package/build/nl-json.29d2eb37.chunk.js +1 -0
- package/build/no-json.40386397.chunk.js +1 -0
- package/build/pl-json.1f04f00c.chunk.js +1 -0
- package/build/pt-BR-json.b4bc8efe.chunk.js +1 -0
- package/build/ru-json.7ab40ccf.chunk.js +1 -0
- package/build/{runtime~main.3dfda620.js → runtime~main.c1c5510b.js} +2 -2
- package/build/sa-json.c5a9f4ea.chunk.js +1 -0
- package/build/sk-json.e4c24c4e.chunk.js +1 -0
- package/build/sv-json.c3f471ae.chunk.js +1 -0
- package/build/th-json.a59ffb32.chunk.js +1 -0
- package/build/upload-translation-es-json.0f90db48.chunk.js +1 -0
- package/build/{upload-translation-th-json.64dd70ce.chunk.js → upload-translation-th-json.9e1fda51.chunk.js} +1 -1
- package/build/upload.7084cea6.chunk.js +7 -0
- package/build/{users-advanced-settings-page.f38654fc.chunk.js → users-advanced-settings-page.f11c8af4.chunk.js} +1 -1
- package/build/{users-email-settings-page.899e7fbd.chunk.js → users-email-settings-page.73c41236.chunk.js} +1 -1
- package/build/{users-providers-settings-page.a0b0fe39.chunk.js → users-providers-settings-page.f8e78537.chunk.js} +1 -1
- package/build/users-roles-settings-page.cafb4fe5.chunk.js +30 -0
- package/build/{webhook-edit-page.3417d93c.chunk.js → webhook-edit-page.9aba79b2.chunk.js} +3 -3
- package/build/zh-Hans-json.77a42bc5.chunk.js +1 -0
- package/build/zh-json.451a0271.chunk.js +1 -0
- package/ee/admin/hooks/useAuthProviders/reducer.js +1 -1
- package/ee/admin/pages/AuthPage/components/Login/index.js +2 -2
- package/ee/admin/pages/AuthPage/components/Providers/SSOProviders.js +3 -3
- package/ee/admin/pages/SettingsPage/SingleSignOn/index.js +3 -3
- package/ee/admin/pages/SettingsPage/pages/Roles/CreatePage/index.js +11 -9
- package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +8 -8
- package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/reducer.js +1 -1
- package/ee/admin/pages/SettingsPage/utils/customRoutes.js +1 -1
- package/ee/server/controllers/authentication/middlewares.js +1 -1
- package/ee/server/controllers/authentication/utils.js +1 -1
- package/ee/server/controllers/role.js +4 -4
- package/ee/server/services/passport/provider-registry.js +1 -1
- package/ee/server/services/passport/sso.js +1 -1
- package/ee/server/services/passport.js +1 -1
- package/ee/server/services/role.js +1 -1
- package/ee/server/validation/authentication.js +1 -1
- package/ee/server/validation/role.js +3 -6
- package/ee/server/validation/user.js +1 -1
- package/env.js +2 -2
- package/index.js +2 -2
- package/jest.config.front.js +3 -1
- package/package.json +24 -15
- package/scripts/build.js +2 -2
- package/scripts/create-dev-plugins-file.js +5 -7
- package/scripts/create-plugins-file.js +2 -2
- package/server/config/admin-conditions.js +3 -3
- package/server/controllers/admin.js +1 -1
- package/server/controllers/authentication.js +1 -1
- package/server/controllers/formatters/format-actions-by-sections.js +8 -5
- package/server/controllers/role.js +1 -1
- package/server/controllers/user.js +1 -1
- package/server/controllers/webhooks.js +6 -16
- package/server/domain/action/index.js +3 -3
- package/server/domain/action/provider.js +2 -2
- package/server/domain/condition/index.js +2 -2
- package/server/domain/condition/provider.js +1 -1
- package/server/domain/permission/index.js +3 -3
- package/server/domain/user.js +2 -2
- package/server/policies/hasPermissions.js +5 -5
- package/server/policies/isAuthenticatedAdmin.js +1 -1
- package/server/routes/serve-admin-panel.js +1 -1
- package/server/services/action.js +1 -1
- package/server/services/api-token.js +5 -5
- package/server/services/auth.js +2 -2
- package/server/services/condition.js +1 -1
- package/server/services/content-type.js +5 -3
- package/server/services/passport/local-strategy.js +2 -2
- package/server/services/passport.js +2 -4
- package/server/services/permission/engine-hooks.js +1 -1
- package/server/services/permission/engine.js +9 -9
- package/server/services/permission/permissions-manager/query-builers.js +5 -5
- package/server/services/permission/permissions-manager/sanitize.js +6 -10
- package/server/services/permission/queries.js +12 -13
- package/server/services/permission/sections-builder/handlers.js +21 -19
- package/server/services/permission/sections-builder/section.js +2 -2
- package/server/services/permission/sections-builder/utils.js +5 -5
- package/server/services/project-settings.js +9 -12
- package/server/services/role.js +15 -13
- package/server/services/token.js +2 -2
- package/server/services/user.js +11 -11
- package/server/strategies/admin.js +1 -1
- package/server/strategies/api-token.js +3 -3
- package/server/utils/index.js +1 -1
- package/server/validation/action-provider.js +6 -12
- package/server/validation/api-tokens.js +4 -16
- package/server/validation/authentication/renew-token.js +1 -5
- package/server/validation/common-functions/check-fields-are-correctly-nested.js +5 -3
- package/server/validation/common-functions/check-fields-dont-have-duplicates.js +3 -2
- package/server/validation/common-validators.js +74 -71
- package/server/validation/permission.js +13 -13
- package/server/validation/policies/hasPermissions.js +2 -6
- package/server/validation/user.js +1 -5
- package/utils/create-cache-dir.js +3 -3
- package/utils/get-custom-app-config-file.js +3 -3
- package/utils/get-plugins-path.js +3 -2
- package/utils/should-build-admin.js +4 -4
- package/webpack.config.js +2 -7
- package/build/611.aa894d27.chunk.js +0 -158
- package/build/8773.c190837d.chunk.js +0 -330
- package/build/Admin-authenticatedApp.380e5e99.chunk.js +0 -80
- package/build/Admin_InternalErrorPage.25c53284.chunk.js +0 -1
- package/build/Admin_pluginsPage.0992c2b5.chunk.js +0 -1
- package/build/Admin_profilePage.35ce8e94.chunk.js +0 -15
- package/build/Admin_settingsPage.76ee4c17.chunk.js +0 -178
- package/build/admin-app.93ff2e38.chunk.js +0 -112
- package/build/admin-edit-roles-page.358d98c1.chunk.js +0 -1
- package/build/admin-edit-users.7d9cf406.chunk.js +0 -10
- package/build/admin-users.bb3a8eb6.chunk.js +0 -11
- package/build/api-tokens-list-page.5ea3f6ce.chunk.js +0 -15
- package/build/ca-json.0097e443.chunk.js +0 -1
- package/build/content-manager.55791f82.chunk.js +0 -1178
- package/build/content-type-builder-list-view.4a704844.chunk.js +0 -194
- package/build/content-type-builder-translation-en-json.201bfb78.chunk.js +0 -1
- package/build/content-type-builder-translation-pt-BR-json.5739a2aa.chunk.js +0 -1
- package/build/content-type-builder.f48a28f9.chunk.js +0 -142
- package/build/de-json.0b92acd2.chunk.js +0 -1
- package/build/dk-json.9f1bc016.chunk.js +0 -1
- package/build/en-json.6d70e9ff.chunk.js +0 -1
- package/build/es-json.2a5a9fc1.chunk.js +0 -1
- package/build/fr-json.84064a0b.chunk.js +0 -1
- package/build/gu-json.dafa6f0d.chunk.js +0 -1
- package/build/he-json.d40da459.chunk.js +0 -1
- package/build/hi-json.b4ae16d1.chunk.js +0 -1
- package/build/hu-json.c81ce352.chunk.js +0 -1
- package/build/i18n-settings-page.9d426e96.chunk.js +0 -101
- package/build/i18n-translation-fr-json.0839d68d.chunk.js +0 -1
- package/build/id-json.fad45d17.chunk.js +0 -1
- package/build/it-json.12df4cdf.chunk.js +0 -1
- package/build/ja-json.850237e9.chunk.js +0 -1
- package/build/ko-json.2f3d256e.chunk.js +0 -1
- package/build/main.66ef8611.js +0 -9317
- package/build/ml-json.dc946c7f.chunk.js +0 -1
- package/build/nl-json.465b173f.chunk.js +0 -1
- package/build/no-json.e8749dd4.chunk.js +0 -1
- package/build/pl-json.4d11f53d.chunk.js +0 -1
- package/build/pt-BR-json.6301d49b.chunk.js +0 -1
- package/build/ru-json.28147733.chunk.js +0 -1
- package/build/sa-json.be504091.chunk.js +0 -1
- package/build/sk-json.5b33afc2.chunk.js +0 -1
- package/build/sv-json.cdcac02d.chunk.js +0 -1
- package/build/th-json.3aadaec6.chunk.js +0 -1
- package/build/upload-translation-es-json.6b1813b6.chunk.js +0 -1
- package/build/upload.0af4feca.chunk.js +0 -7
- package/build/users-roles-settings-page.1206751f.chunk.js +0 -30
- package/build/zh-Hans-json.eac1d90a.chunk.js +0 -1
- package/build/zh-json.96bf6019.chunk.js +0 -1
package/admin/src/StrapiApp.js
CHANGED
|
@@ -8,7 +8,7 @@ import invariant from 'invariant';
|
|
|
8
8
|
import { Helmet } from 'react-helmet';
|
|
9
9
|
import { basename, createHook } from './core/utils';
|
|
10
10
|
import configureStore from './core/store/configureStore';
|
|
11
|
-
import { Plugin } from './core/apis';
|
|
11
|
+
import { customFields, Plugin } from './core/apis';
|
|
12
12
|
import App from './pages/App';
|
|
13
13
|
import AuthLogo from './assets/images/logo_strapi_auth_v4.png';
|
|
14
14
|
import MenuLogo from './assets/images/logo_strapi_menu.png';
|
|
@@ -47,6 +47,7 @@ class StrapiApp {
|
|
|
47
47
|
this.admin = {
|
|
48
48
|
injectionZones,
|
|
49
49
|
};
|
|
50
|
+
this.customFields = customFields;
|
|
50
51
|
|
|
51
52
|
this.menu = [];
|
|
52
53
|
this.settings = {
|
|
@@ -61,15 +62,15 @@ class StrapiApp {
|
|
|
61
62
|
};
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
addComponents = components => {
|
|
65
|
+
addComponents = (components) => {
|
|
65
66
|
if (Array.isArray(components)) {
|
|
66
|
-
components.map(compo => this.library.components.add(compo));
|
|
67
|
+
components.map((compo) => this.library.components.add(compo));
|
|
67
68
|
} else {
|
|
68
69
|
this.library.components.add(components);
|
|
69
70
|
}
|
|
70
71
|
};
|
|
71
72
|
|
|
72
|
-
addCorePluginMenuLink = link => {
|
|
73
|
+
addCorePluginMenuLink = (link) => {
|
|
73
74
|
const stringifiedLink = JSON.stringify(link);
|
|
74
75
|
|
|
75
76
|
invariant(link.to, `link.to should be defined for ${stringifiedLink}`);
|
|
@@ -89,15 +90,15 @@ class StrapiApp {
|
|
|
89
90
|
this.menu.push(link);
|
|
90
91
|
};
|
|
91
92
|
|
|
92
|
-
addFields = fields => {
|
|
93
|
+
addFields = (fields) => {
|
|
93
94
|
if (Array.isArray(fields)) {
|
|
94
|
-
fields.map(field => this.library.fields.add(field));
|
|
95
|
+
fields.map((field) => this.library.fields.add(field));
|
|
95
96
|
} else {
|
|
96
97
|
this.library.fields.add(fields);
|
|
97
98
|
}
|
|
98
99
|
};
|
|
99
100
|
|
|
100
|
-
addMenuLink = link => {
|
|
101
|
+
addMenuLink = (link) => {
|
|
101
102
|
const stringifiedLink = JSON.stringify(link);
|
|
102
103
|
|
|
103
104
|
invariant(link.to, `link.to should be defined for ${stringifiedLink}`);
|
|
@@ -121,14 +122,14 @@ class StrapiApp {
|
|
|
121
122
|
this.menu.push(link);
|
|
122
123
|
};
|
|
123
124
|
|
|
124
|
-
addMiddlewares = middlewares => {
|
|
125
|
-
middlewares.forEach(middleware => {
|
|
125
|
+
addMiddlewares = (middlewares) => {
|
|
126
|
+
middlewares.forEach((middleware) => {
|
|
126
127
|
this.middlewares.add(middleware);
|
|
127
128
|
});
|
|
128
129
|
};
|
|
129
130
|
|
|
130
|
-
addReducers = reducers => {
|
|
131
|
-
Object.keys(reducers).forEach(reducerName => {
|
|
131
|
+
addReducers = (reducers) => {
|
|
132
|
+
Object.keys(reducers).forEach((reducerName) => {
|
|
132
133
|
this.reducers.add(reducerName, reducers[reducerName]);
|
|
133
134
|
});
|
|
134
135
|
};
|
|
@@ -156,13 +157,13 @@ class StrapiApp {
|
|
|
156
157
|
invariant(this.settings[sectionId], 'The section does not exist');
|
|
157
158
|
invariant(Array.isArray(links), 'TypeError expected links to be an array');
|
|
158
159
|
|
|
159
|
-
links.forEach(link => {
|
|
160
|
+
links.forEach((link) => {
|
|
160
161
|
this.addSettingsLink(sectionId, link);
|
|
161
162
|
});
|
|
162
163
|
};
|
|
163
164
|
|
|
164
165
|
async bootstrap() {
|
|
165
|
-
Object.keys(this.appPlugins).forEach(plugin => {
|
|
166
|
+
Object.keys(this.appPlugins).forEach((plugin) => {
|
|
166
167
|
const bootstrap = this.appPlugins[plugin].bootstrap;
|
|
167
168
|
|
|
168
169
|
if (bootstrap) {
|
|
@@ -208,7 +209,7 @@ class StrapiApp {
|
|
|
208
209
|
if (this.customConfigurations?.locales) {
|
|
209
210
|
this.configurations.locales = [
|
|
210
211
|
'en',
|
|
211
|
-
...this.customConfigurations.locales?.filter(loc => loc !== 'en'),
|
|
212
|
+
...(this.customConfigurations.locales?.filter((loc) => loc !== 'en') || []),
|
|
212
213
|
];
|
|
213
214
|
}
|
|
214
215
|
|
|
@@ -237,7 +238,7 @@ class StrapiApp {
|
|
|
237
238
|
}
|
|
238
239
|
};
|
|
239
240
|
|
|
240
|
-
createHook = name => {
|
|
241
|
+
createHook = (name) => {
|
|
241
242
|
this.hooksDict[name] = createHook();
|
|
242
243
|
};
|
|
243
244
|
|
|
@@ -253,7 +254,7 @@ class StrapiApp {
|
|
|
253
254
|
|
|
254
255
|
this.settings[section.id] = { ...section, links: [] };
|
|
255
256
|
|
|
256
|
-
links.forEach(link => {
|
|
257
|
+
links.forEach((link) => {
|
|
257
258
|
this.addSettingsLink(section.id, link);
|
|
258
259
|
});
|
|
259
260
|
};
|
|
@@ -274,23 +275,13 @@ class StrapiApp {
|
|
|
274
275
|
}
|
|
275
276
|
};
|
|
276
277
|
|
|
277
|
-
getPlugin = pluginId => {
|
|
278
|
+
getPlugin = (pluginId) => {
|
|
278
279
|
return this.plugins[pluginId];
|
|
279
280
|
};
|
|
280
281
|
|
|
281
282
|
async initialize() {
|
|
282
|
-
Object.keys(this.appPlugins).forEach(plugin => {
|
|
283
|
-
this.appPlugins[plugin].register(
|
|
284
|
-
addComponents: this.addComponents,
|
|
285
|
-
addCorePluginMenuLink: this.addCorePluginMenuLink,
|
|
286
|
-
addFields: this.addFields,
|
|
287
|
-
addMenuLink: this.addMenuLink,
|
|
288
|
-
addMiddlewares: this.addMiddlewares,
|
|
289
|
-
addReducers: this.addReducers,
|
|
290
|
-
createHook: this.createHook,
|
|
291
|
-
createSettingSection: this.createSettingSection,
|
|
292
|
-
registerPlugin: this.registerPlugin,
|
|
293
|
-
});
|
|
283
|
+
Object.keys(this.appPlugins).forEach((plugin) => {
|
|
284
|
+
this.appPlugins[plugin].register(this);
|
|
294
285
|
});
|
|
295
286
|
}
|
|
296
287
|
|
|
@@ -319,7 +310,7 @@ class StrapiApp {
|
|
|
319
310
|
* @returns {Object} The imported admin translations
|
|
320
311
|
*/
|
|
321
312
|
async loadAdminTrads() {
|
|
322
|
-
const arrayOfPromises = this.configurations.locales.map(locale => {
|
|
313
|
+
const arrayOfPromises = this.configurations.locales.map((locale) => {
|
|
323
314
|
return import(/* webpackChunkName: "[request]" */ `./translations/${locale}.json`)
|
|
324
315
|
.then(({ default: data }) => {
|
|
325
316
|
return { data, locale };
|
|
@@ -350,7 +341,7 @@ class StrapiApp {
|
|
|
350
341
|
const adminTranslations = await this.loadAdminTrads();
|
|
351
342
|
|
|
352
343
|
const arrayOfPromises = Object.keys(this.appPlugins)
|
|
353
|
-
.map(plugin => {
|
|
344
|
+
.map((plugin) => {
|
|
354
345
|
const registerTrads = this.appPlugins[plugin].registerTrads;
|
|
355
346
|
|
|
356
347
|
if (registerTrads) {
|
|
@@ -359,7 +350,7 @@ class StrapiApp {
|
|
|
359
350
|
|
|
360
351
|
return null;
|
|
361
352
|
})
|
|
362
|
-
.filter(a => a);
|
|
353
|
+
.filter((a) => a);
|
|
363
354
|
|
|
364
355
|
const pluginsTrads = await Promise.all(arrayOfPromises);
|
|
365
356
|
const mergedTrads = pluginsTrads.reduce((acc, currentPluginTrads) => {
|
|
@@ -369,7 +360,7 @@ class StrapiApp {
|
|
|
369
360
|
return acc1;
|
|
370
361
|
}, {});
|
|
371
362
|
|
|
372
|
-
Object.keys(pluginTrads).forEach(locale => {
|
|
363
|
+
Object.keys(pluginTrads).forEach((locale) => {
|
|
373
364
|
acc[locale] = { ...acc[locale], ...pluginTrads[locale] };
|
|
374
365
|
});
|
|
375
366
|
|
|
@@ -399,7 +390,7 @@ class StrapiApp {
|
|
|
399
390
|
this.hooksDict[name].register(fn);
|
|
400
391
|
};
|
|
401
392
|
|
|
402
|
-
registerPlugin = pluginConf => {
|
|
393
|
+
registerPlugin = (pluginConf) => {
|
|
403
394
|
const plugin = Plugin(pluginConf);
|
|
404
395
|
|
|
405
396
|
this.plugins[plugin.pluginId] = plugin;
|
|
@@ -414,7 +405,7 @@ class StrapiApp {
|
|
|
414
405
|
: this.hooksDict[name].runWaterfall(initialValue, store);
|
|
415
406
|
};
|
|
416
407
|
|
|
417
|
-
runHookParallel = name => this.hooksDict[name].runParallel();
|
|
408
|
+
runHookParallel = (name) => this.hooksDict[name].runParallel();
|
|
418
409
|
|
|
419
410
|
render() {
|
|
420
411
|
const store = this.createStore();
|
|
@@ -430,6 +421,7 @@ class StrapiApp {
|
|
|
430
421
|
authLogo={this.configurations.authLogo}
|
|
431
422
|
components={components}
|
|
432
423
|
fields={fields}
|
|
424
|
+
customFields={this.customFields}
|
|
433
425
|
localeNames={localeNames}
|
|
434
426
|
getAdminInjectedComponents={this.getAdminInjectedComponents}
|
|
435
427
|
getPlugin={this.getPlugin}
|
|
@@ -56,9 +56,10 @@ const AuthenticatedApp = () => {
|
|
|
56
56
|
},
|
|
57
57
|
]);
|
|
58
58
|
|
|
59
|
-
const shouldUpdateStrapi = useMemo(
|
|
60
|
-
tag_name,
|
|
61
|
-
|
|
59
|
+
const shouldUpdateStrapi = useMemo(
|
|
60
|
+
() => checkLatestStrapiVersion(strapiVersion, tag_name),
|
|
61
|
+
[tag_name]
|
|
62
|
+
);
|
|
62
63
|
|
|
63
64
|
useEffect(() => {
|
|
64
65
|
if (userRoles) {
|
|
@@ -77,6 +78,16 @@ const AuthenticatedApp = () => {
|
|
|
77
78
|
|
|
78
79
|
const shouldShowLoader = isLoading || shouldShowNotDependentQueriesLoader;
|
|
79
80
|
|
|
81
|
+
const appInfosValue = useMemo(() => {
|
|
82
|
+
return {
|
|
83
|
+
...appInfos,
|
|
84
|
+
latestStrapiReleaseTag: tag_name,
|
|
85
|
+
setUserDisplayName,
|
|
86
|
+
shouldUpdateStrapi,
|
|
87
|
+
userDisplayName,
|
|
88
|
+
};
|
|
89
|
+
}, [appInfos, tag_name, shouldUpdateStrapi, userDisplayName]);
|
|
90
|
+
|
|
80
91
|
if (shouldShowLoader) {
|
|
81
92
|
return <LoadingIndicatorPage />;
|
|
82
93
|
}
|
|
@@ -87,15 +98,7 @@ const AuthenticatedApp = () => {
|
|
|
87
98
|
}
|
|
88
99
|
|
|
89
100
|
return (
|
|
90
|
-
<AppInfosContext.Provider
|
|
91
|
-
value={{
|
|
92
|
-
...appInfos,
|
|
93
|
-
latestStrapiReleaseTag: tag_name,
|
|
94
|
-
setUserDisplayName,
|
|
95
|
-
shouldUpdateStrapi,
|
|
96
|
-
userDisplayName,
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
101
|
+
<AppInfosContext.Provider value={appInfosValue}>
|
|
99
102
|
<RBACProvider permissions={permissions} refetchPermissions={refetch}>
|
|
100
103
|
<PluginsInitializer />
|
|
101
104
|
</RBACProvider>
|
|
@@ -6,7 +6,7 @@ import packageJSON from '../../../../../package.json';
|
|
|
6
6
|
const strapiVersion = packageJSON.version;
|
|
7
7
|
const showUpdateNotif = !JSON.parse(localStorage.getItem('STRAPI_UPDATE_NOTIF'));
|
|
8
8
|
|
|
9
|
-
const fetchStrapiLatestRelease = async toggleNotification => {
|
|
9
|
+
const fetchStrapiLatestRelease = async (toggleNotification) => {
|
|
10
10
|
try {
|
|
11
11
|
const {
|
|
12
12
|
data: { tag_name },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { AutoReloadOverlayBockerContext } from '@strapi/helper-plugin';
|
|
4
4
|
import Blocker from './Blocker';
|
|
@@ -13,7 +13,7 @@ const AutoReloadOverlayBlockerProvider = ({ children }) => {
|
|
|
13
13
|
const lockAppWithAutoreload = (config = undefined) => {
|
|
14
14
|
setIsOpen(true);
|
|
15
15
|
setConfig(config);
|
|
16
|
-
setState(prev => ({ ...prev, start: Date.now() }));
|
|
16
|
+
setState((prev) => ({ ...prev, start: Date.now() }));
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const unlockAppWithAutoreload = () => {
|
|
@@ -36,7 +36,7 @@ const AutoReloadOverlayBlockerProvider = ({ children }) => {
|
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
setState(prev => ({ ...prev, elapsed: Math.round(Date.now() - prev.start) / 1000 }));
|
|
39
|
+
setState((prev) => ({ ...prev, elapsed: Math.round(Date.now() - prev.start) / 1000 }));
|
|
40
40
|
|
|
41
41
|
return null;
|
|
42
42
|
}, 1000);
|
|
@@ -75,10 +75,12 @@ const AutoReloadOverlayBlockerProvider = ({ children }) => {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
const autoReloadValue = useMemo(() => {
|
|
79
|
+
return { lockApp: lockApp.current, unlockApp: unlockApp.current };
|
|
80
|
+
}, [lockApp, unlockApp]);
|
|
81
|
+
|
|
78
82
|
return (
|
|
79
|
-
<AutoReloadOverlayBockerContext.Provider
|
|
80
|
-
value={{ lockApp: lockApp.current, unlockApp: unlockApp.current }}
|
|
81
|
-
>
|
|
83
|
+
<AutoReloadOverlayBockerContext.Provider value={autoReloadValue}>
|
|
82
84
|
<Blocker
|
|
83
85
|
displayedIcon={displayedIcon}
|
|
84
86
|
isOpen={isOpen}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useReducer, useRef } from 'react';
|
|
1
|
+
import React, { useMemo, useReducer, useRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { ConfigurationsContext } from '../../contexts';
|
|
4
4
|
import reducer, { initialState } from './reducer';
|
|
@@ -23,18 +23,27 @@ const ConfigurationsProvider = ({
|
|
|
23
23
|
|
|
24
24
|
const updateProjectSettingsRef = useRef(updateProjectSettings);
|
|
25
25
|
|
|
26
|
+
const configurationValue = useMemo(() => {
|
|
27
|
+
return {
|
|
28
|
+
logos: {
|
|
29
|
+
menu: { custom: menuLogo, default: defaultMenuLogo },
|
|
30
|
+
auth: { custom: null, default: authLogo },
|
|
31
|
+
},
|
|
32
|
+
updateProjectSettings: updateProjectSettingsRef.current,
|
|
33
|
+
showReleaseNotification,
|
|
34
|
+
showTutorials,
|
|
35
|
+
};
|
|
36
|
+
}, [
|
|
37
|
+
authLogo,
|
|
38
|
+
menuLogo,
|
|
39
|
+
showReleaseNotification,
|
|
40
|
+
showTutorials,
|
|
41
|
+
updateProjectSettingsRef,
|
|
42
|
+
defaultMenuLogo,
|
|
43
|
+
]);
|
|
44
|
+
|
|
26
45
|
return (
|
|
27
|
-
<ConfigurationsContext.Provider
|
|
28
|
-
value={{
|
|
29
|
-
logos: {
|
|
30
|
-
menu: { custom: menuLogo, default: defaultMenuLogo },
|
|
31
|
-
auth: { custom: null, default: authLogo },
|
|
32
|
-
},
|
|
33
|
-
updateProjectSettings: updateProjectSettingsRef.current,
|
|
34
|
-
showReleaseNotification,
|
|
35
|
-
showTutorials,
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
46
|
+
<ConfigurationsContext.Provider value={configurationValue}>
|
|
38
47
|
{children}
|
|
39
48
|
</ConfigurationsContext.Provider>
|
|
40
49
|
);
|
|
@@ -12,7 +12,7 @@ const initialState = {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
const reducer = (state = initialState, action) =>
|
|
15
|
-
produce(state, draftState => {
|
|
15
|
+
produce(state, (draftState) => {
|
|
16
16
|
switch (action.type) {
|
|
17
17
|
case 'UPDATE_PROJECT_SETTINGS': {
|
|
18
18
|
Object.assign(draftState, action.values);
|
|
@@ -19,7 +19,7 @@ const getType = (activeSectionIndex, index) => {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const StepperHomepage = ({ sections, currentSectionKey }) => {
|
|
22
|
-
const activeSectionIndex = sections.findIndex(section => section.key === currentSectionKey);
|
|
22
|
+
const activeSectionIndex = sections.findIndex((section) => section.key === currentSectionKey);
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
25
|
<Box>
|
|
@@ -29,12 +29,12 @@ const GuidedTourHomepage = () => {
|
|
|
29
29
|
),
|
|
30
30
|
}));
|
|
31
31
|
|
|
32
|
-
const enrichedSections = sections.map(section => ({
|
|
32
|
+
const enrichedSections = sections.map((section) => ({
|
|
33
33
|
isDone: Object.entries(guidedTourState[section.key]).every(([, value]) => value),
|
|
34
34
|
...section,
|
|
35
35
|
}));
|
|
36
36
|
|
|
37
|
-
const activeSection = enrichedSections.find(section => !section.isDone)?.key;
|
|
37
|
+
const activeSection = enrichedSections.find((section) => !section.isDone)?.key;
|
|
38
38
|
|
|
39
39
|
const handleSkip = () => {
|
|
40
40
|
setSkipped(true);
|
|
@@ -18,7 +18,7 @@ const Content = ({ id, defaultMessage }) => {
|
|
|
18
18
|
{formatMessage(
|
|
19
19
|
{ id, defaultMessage },
|
|
20
20
|
{
|
|
21
|
-
documentationLink: children => (
|
|
21
|
+
documentationLink: (children) => (
|
|
22
22
|
<a
|
|
23
23
|
target="_blank"
|
|
24
24
|
rel="noopener noreferrer"
|
|
@@ -27,15 +27,15 @@ const Content = ({ id, defaultMessage }) => {
|
|
|
27
27
|
{children}
|
|
28
28
|
</a>
|
|
29
29
|
),
|
|
30
|
-
b: children => <Typography fontWeight="semiBold">{children}</Typography>,
|
|
31
|
-
p: children => <Typography>{children}</Typography>,
|
|
32
|
-
light: children => <Typography textColor="neutral600">{children}</Typography>,
|
|
33
|
-
ul: children => (
|
|
30
|
+
b: (children) => <Typography fontWeight="semiBold">{children}</Typography>,
|
|
31
|
+
p: (children) => <Typography>{children}</Typography>,
|
|
32
|
+
light: (children) => <Typography textColor="neutral600">{children}</Typography>,
|
|
33
|
+
ul: (children) => (
|
|
34
34
|
<Box paddingLeft={6}>
|
|
35
35
|
<ul>{children}</ul>
|
|
36
36
|
</Box>
|
|
37
37
|
),
|
|
38
|
-
li: children => <LiStyled>{children}</LiStyled>,
|
|
38
|
+
li: (children) => <LiStyled>{children}</LiStyled>,
|
|
39
39
|
}
|
|
40
40
|
)}
|
|
41
41
|
</Stack>
|
|
@@ -16,10 +16,8 @@ const GuidedTourModal = () => {
|
|
|
16
16
|
setSkipped,
|
|
17
17
|
} = useGuidedTour();
|
|
18
18
|
const [isVisible, setIsVisible] = useState(currentStep);
|
|
19
|
-
const [
|
|
20
|
-
|
|
21
|
-
dispatch,
|
|
22
|
-
] = useReducer(reducer, initialState);
|
|
19
|
+
const [{ stepContent, sectionIndex, stepIndex, hasSectionAfter, hasStepAfter }, dispatch] =
|
|
20
|
+
useReducer(reducer, initialState);
|
|
23
21
|
const { trackUsage } = useTracking();
|
|
24
22
|
|
|
25
23
|
useEffect(() => {
|
|
@@ -15,7 +15,7 @@ const GuidedTour = ({ children }) => {
|
|
|
15
15
|
init
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
const setCurrentStep = step => {
|
|
18
|
+
const setCurrentStep = (step) => {
|
|
19
19
|
// if step is null it is intentional, we need to dispatch it
|
|
20
20
|
if (step !== null) {
|
|
21
21
|
const isStepAlreadyDone = get(guidedTourState, step);
|
|
@@ -34,7 +34,7 @@ const GuidedTour = ({ children }) => {
|
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
const setGuidedTourVisibility = value => {
|
|
37
|
+
const setGuidedTourVisibility = (value) => {
|
|
38
38
|
dispatch({
|
|
39
39
|
type: 'SET_GUIDED_TOUR_VISIBILITY',
|
|
40
40
|
value,
|
|
@@ -51,7 +51,7 @@ const GuidedTour = ({ children }) => {
|
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
const startSection = sectionName => {
|
|
54
|
+
const startSection = (sectionName) => {
|
|
55
55
|
const sectionSteps = guidedTourState[sectionName];
|
|
56
56
|
|
|
57
57
|
if (sectionSteps) {
|
|
@@ -67,7 +67,7 @@ const GuidedTour = ({ children }) => {
|
|
|
67
67
|
return null;
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
const setSkipped = value => {
|
|
70
|
+
const setSkipped = (value) => {
|
|
71
71
|
persistStateToLocaleStorage.setSkipped(value);
|
|
72
72
|
|
|
73
73
|
dispatch({
|
|
@@ -5,14 +5,14 @@ import persistStateToLocaleStorage, {
|
|
|
5
5
|
SKIPPED,
|
|
6
6
|
} from './utils/persistStateToLocaleStorage';
|
|
7
7
|
|
|
8
|
-
const init = initialState => {
|
|
8
|
+
const init = (initialState) => {
|
|
9
9
|
const copyInitialState = { ...initialState };
|
|
10
10
|
const guidedTourLocaleStorage = persistStateToLocaleStorage.get(COMPLETED_STEPS);
|
|
11
11
|
const currentStepLocaleStorage = persistStateToLocaleStorage.get(CURRENT_STEP);
|
|
12
12
|
const skippedLocaleStorage = persistStateToLocaleStorage.get(SKIPPED);
|
|
13
13
|
|
|
14
14
|
if (guidedTourLocaleStorage) {
|
|
15
|
-
guidedTourLocaleStorage.forEach(step => {
|
|
15
|
+
guidedTourLocaleStorage.forEach((step) => {
|
|
16
16
|
const [sectionName, stepName] = step.split('.');
|
|
17
17
|
set(copyInitialState, ['guidedTourState', sectionName, stepName], true);
|
|
18
18
|
});
|
|
@@ -9,7 +9,7 @@ const persistStateToLocaleStorage = {
|
|
|
9
9
|
localStorage.removeItem(CURRENT_STEP);
|
|
10
10
|
localStorage.removeItem(COMPLETED_STEPS);
|
|
11
11
|
},
|
|
12
|
-
addCompletedStep
|
|
12
|
+
addCompletedStep(completedStep) {
|
|
13
13
|
const currentSteps = parse(localStorage.getItem(COMPLETED_STEPS))?.slice() || [];
|
|
14
14
|
const isAlreadyStored = currentSteps.includes(completedStep);
|
|
15
15
|
|
|
@@ -20,13 +20,13 @@ const persistStateToLocaleStorage = {
|
|
|
20
20
|
currentSteps.push(completedStep);
|
|
21
21
|
localStorage.setItem(COMPLETED_STEPS, stringify(currentSteps));
|
|
22
22
|
},
|
|
23
|
-
addCurrentStep
|
|
23
|
+
addCurrentStep(currentStep) {
|
|
24
24
|
localStorage.setItem(CURRENT_STEP, stringify(currentStep));
|
|
25
25
|
},
|
|
26
|
-
setSkipped
|
|
26
|
+
setSkipped(value) {
|
|
27
27
|
localStorage.setItem(SKIPPED, stringify(value));
|
|
28
28
|
},
|
|
29
|
-
get
|
|
29
|
+
get(item) {
|
|
30
30
|
return parse(localStorage.getItem(item));
|
|
31
31
|
},
|
|
32
32
|
};
|
|
@@ -23,7 +23,7 @@ const LanguageProvider = ({ children, localeNames, messages }) => {
|
|
|
23
23
|
window.localStorage.setItem(localStorageKey, locale);
|
|
24
24
|
}, [locale]);
|
|
25
25
|
|
|
26
|
-
const changeLocale = locale => {
|
|
26
|
+
const changeLocale = (locale) => {
|
|
27
27
|
dispatch({
|
|
28
28
|
type: 'CHANGE_LOCALE',
|
|
29
29
|
locale,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import localStorageKey from './utils/localStorageKey';
|
|
2
2
|
|
|
3
|
-
const init = localeNames => {
|
|
3
|
+
const init = (localeNames) => {
|
|
4
4
|
const languageFromLocaleStorage = window.localStorage.getItem(localStorageKey);
|
|
5
5
|
const appLanguage = localeNames[languageFromLocaleStorage] ? languageFromLocaleStorage : 'en';
|
|
6
6
|
|
|
@@ -62,18 +62,18 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|
|
62
62
|
|
|
63
63
|
const initials = userDisplayName
|
|
64
64
|
.split(' ')
|
|
65
|
-
.map(name => name.substring(0, 1))
|
|
65
|
+
.map((name) => name.substring(0, 1))
|
|
66
66
|
.join('')
|
|
67
67
|
.substring(0, 2);
|
|
68
68
|
|
|
69
|
-
const handleToggleUserLinks = () => setUserLinksVisible(prev => !prev);
|
|
69
|
+
const handleToggleUserLinks = () => setUserLinksVisible((prev) => !prev);
|
|
70
70
|
|
|
71
71
|
const handleLogout = () => {
|
|
72
72
|
auth.clearAppStorage();
|
|
73
73
|
handleToggleUserLinks();
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
const handleBlur = e => {
|
|
76
|
+
const handleBlur = (e) => {
|
|
77
77
|
if (
|
|
78
78
|
!e.currentTarget.contains(e.relatedTarget) &&
|
|
79
79
|
e.relatedTarget?.parentElement?.id !== 'main-nav-user-button'
|
|
@@ -121,7 +121,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|
|
121
121
|
defaultMessage: 'Plugins',
|
|
122
122
|
})}
|
|
123
123
|
>
|
|
124
|
-
{pluginsSectionLinks.map(link => {
|
|
124
|
+
{pluginsSectionLinks.map((link) => {
|
|
125
125
|
const Icon = link.icon;
|
|
126
126
|
|
|
127
127
|
return (
|
|
@@ -140,7 +140,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|
|
140
140
|
defaultMessage: 'General',
|
|
141
141
|
})}
|
|
142
142
|
>
|
|
143
|
-
{generalSectionLinks.map(link => {
|
|
143
|
+
{generalSectionLinks.map((link) => {
|
|
144
144
|
const LinkIcon = link.icon;
|
|
145
145
|
|
|
146
146
|
return (
|
|
@@ -201,7 +201,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|
|
201
201
|
</LinkUserWrapper>
|
|
202
202
|
)}
|
|
203
203
|
|
|
204
|
-
<NavCondense onClick={() => setCondensed(s => !s)}>
|
|
204
|
+
<NavCondense onClick={() => setCondensed((s) => !s)}>
|
|
205
205
|
{condensed
|
|
206
206
|
? formatMessage({
|
|
207
207
|
id: 'app.components.LeftMenu.expand',
|
|
@@ -8,7 +8,8 @@ const Notification = ({ dispatch, notification }) => {
|
|
|
8
8
|
const { formatMessage } = useIntl();
|
|
9
9
|
const { message, link, type, id, onClose, timeout, blockTransition } = notification;
|
|
10
10
|
|
|
11
|
-
const formattedMessage = msg =>
|
|
11
|
+
const formattedMessage = (msg) =>
|
|
12
|
+
typeof msg === 'string' ? msg : formatMessage(msg, msg.values);
|
|
12
13
|
const handleClose = useCallback(() => {
|
|
13
14
|
if (onClose) {
|
|
14
15
|
onClose();
|
|
@@ -66,9 +67,7 @@ const Notification = ({ dispatch, notification }) => {
|
|
|
66
67
|
defaultMessage: link.label?.defaultMessage || link.label?.id || link.label,
|
|
67
68
|
})}
|
|
68
69
|
</Link>
|
|
69
|
-
) :
|
|
70
|
-
undefined
|
|
71
|
-
)
|
|
70
|
+
) : undefined
|
|
72
71
|
}
|
|
73
72
|
onClose={handleClose}
|
|
74
73
|
closeLabel="Close"
|
|
@@ -8,7 +8,7 @@ import reducer, { initialState } from './reducer';
|
|
|
8
8
|
const Notifications = ({ children }) => {
|
|
9
9
|
const [{ notifications }, dispatch] = useReducer(reducer, initialState);
|
|
10
10
|
|
|
11
|
-
const displayNotification = config => {
|
|
11
|
+
const displayNotification = (config) => {
|
|
12
12
|
dispatch({
|
|
13
13
|
type: 'SHOW_NOTIFICATION',
|
|
14
14
|
config,
|
|
@@ -26,7 +26,7 @@ const Notifications = ({ children }) => {
|
|
|
26
26
|
width={`${500 / 16}rem`}
|
|
27
27
|
zIndex={10}
|
|
28
28
|
>
|
|
29
|
-
{notifications.map(notification => {
|
|
29
|
+
{notifications.map((notification) => {
|
|
30
30
|
return (
|
|
31
31
|
<Notification key={notification.id} dispatch={dispatch} notification={notification} />
|
|
32
32
|
);
|
|
@@ -8,7 +8,7 @@ const initialState = {
|
|
|
8
8
|
|
|
9
9
|
const notificationReducer = (state = initialState, action) =>
|
|
10
10
|
// eslint-disable-next-line consistent-return
|
|
11
|
-
produce(state, draftState => {
|
|
11
|
+
produce(state, (draftState) => {
|
|
12
12
|
switch (action.type) {
|
|
13
13
|
case 'SHOW_NOTIFICATION': {
|
|
14
14
|
draftState.notifications.push({
|
|
@@ -28,7 +28,7 @@ const notificationReducer = (state = initialState, action) =>
|
|
|
28
28
|
break;
|
|
29
29
|
}
|
|
30
30
|
case 'HIDE_NOTIFICATION': {
|
|
31
|
-
const indexToRemove = state.notifications.findIndex(notif => notif.id === action.id);
|
|
31
|
+
const indexToRemove = state.notifications.findIndex((notif) => notif.id === action.id);
|
|
32
32
|
|
|
33
33
|
if (indexToRemove !== -1) {
|
|
34
34
|
draftState.notifications.splice(indexToRemove, 1);
|