strapi-plugin-navigation 2.5.3 → 3.0.0-beta.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/README.md +41 -63
- package/admin/api/client.js +107 -0
- package/admin/api/index.js +1 -0
- package/admin/api/validators.js +248 -0
- package/admin/components/ConfirmationDialog/index.js +21 -0
- package/admin/components/Initializer.js +10 -0
- package/admin/components/RestartAlert/index.js +7 -0
- package/admin/components/TextArrayInput/index.js +18 -0
- package/admin/components/icons/index.js +1 -0
- package/admin/components/icons/navigation.js +9 -0
- package/admin/components/icons/pluginIcon.js +9 -0
- package/admin/index.js +48 -0
- package/admin/pages/App.js +10 -0
- package/admin/pages/HomePage/components/AdditionalFieldInput/index.js +58 -0
- package/admin/pages/HomePage/components/CollapseButton/index.js +15 -0
- package/admin/{src → pages/HomePage}/components/DragButton/index.js +9 -16
- package/admin/pages/HomePage/components/I18nCopyNavigationItems/index.js +9 -0
- package/admin/pages/HomePage/components/NavigationContentHeader/index.js +5 -0
- package/admin/pages/HomePage/components/NavigationHeader/hooks.js +14 -0
- package/admin/pages/HomePage/components/NavigationHeader/index.js +29 -0
- package/admin/pages/HomePage/components/NavigationHeader/styles.js +11 -0
- package/admin/pages/HomePage/components/NavigationItemForm/index.js +277 -0
- package/admin/pages/HomePage/components/NavigationItemForm/types.js +1 -0
- package/admin/pages/HomePage/components/NavigationItemForm/utils/form.js +105 -0
- package/admin/pages/HomePage/components/NavigationItemForm/utils/hooks.js +12 -0
- package/admin/pages/HomePage/components/NavigationItemForm/utils/properties.js +51 -0
- package/admin/pages/HomePage/components/NavigationItemList/Wrapper.js +21 -0
- package/admin/pages/HomePage/components/NavigationItemList/index.js +6 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/ItemCardBadge/index.js +20 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/ItemCardHeader/Wrapper.js +14 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/ItemCardHeader/icons.js +6 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/ItemCardHeader/index.js +19 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/ItemCardRemovedOverlay/index.js +11 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/Wrapper.js +38 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/index.js +165 -0
- package/admin/pages/HomePage/components/NavigationItemPopup/NavigationItemPopupFooter.js +11 -0
- package/admin/pages/HomePage/components/NavigationItemPopup/NavigationItemPopupHeader.js +12 -0
- package/admin/pages/HomePage/components/NavigationItemPopup/index.js +34 -0
- package/admin/pages/HomePage/components/NavigationManager/AllNavigations/icons.js +5 -0
- package/admin/pages/HomePage/components/NavigationManager/AllNavigations/index.js +79 -0
- package/admin/pages/HomePage/components/NavigationManager/DeletionConfirm/index.js +25 -0
- package/admin/pages/HomePage/components/NavigationManager/ErrorDetails/index.js +29 -0
- package/admin/pages/HomePage/components/NavigationManager/Footer/index.js +6 -0
- package/admin/pages/HomePage/components/NavigationManager/Form/hooks.js +19 -0
- package/admin/pages/HomePage/components/NavigationManager/Form/index.js +26 -0
- package/admin/pages/HomePage/components/NavigationManager/NavigationUpdate/index.js +32 -0
- package/admin/pages/HomePage/components/NavigationManager/NewNavigation/index.js +35 -0
- package/admin/pages/HomePage/components/NavigationManager/PurgeCacheConfirm/index.js +25 -0
- package/admin/pages/HomePage/components/NavigationManager/index.js +236 -0
- package/admin/pages/HomePage/components/NavigationManager/types.js +1 -0
- package/admin/pages/HomePage/components/Search/index.js +58 -0
- package/admin/pages/HomePage/components/index.js +1 -0
- package/admin/pages/HomePage/hooks/index.js +165 -0
- package/admin/pages/HomePage/index.js +231 -0
- package/admin/pages/HomePage/utils/index.js +16 -0
- package/admin/pages/HomePage/utils/parsers.js +187 -0
- package/admin/pages/SettingsPage/common/const.js +1 -0
- package/admin/pages/SettingsPage/common/index.js +1 -0
- package/admin/pages/SettingsPage/components/CustomFieldForm/hooks/index.js +10 -0
- package/admin/pages/SettingsPage/components/CustomFieldForm/index.js +36 -0
- package/admin/pages/SettingsPage/components/CustomFieldModal/index.js +16 -0
- package/admin/pages/SettingsPage/components/CustomFieldTable/index.js +45 -0
- package/admin/pages/SettingsPage/hooks/index.js +111 -0
- package/admin/pages/SettingsPage/index.js +189 -0
- package/admin/pages/SettingsPage/types.js +1 -0
- package/admin/pages/SettingsPage/utils/index.js +25 -0
- package/admin/pluginId.js +1 -0
- package/admin/schemas/config.js +53 -0
- package/admin/schemas/content-type.js +14 -0
- package/admin/schemas/index.js +2 -0
- package/admin/{src/translations → translations}/en.json +7 -9
- package/admin/translations/index.js +15 -0
- package/admin/types.js +1 -0
- package/admin/utils/constants.js +1 -0
- package/admin/utils/getTranslation.js +4 -0
- package/admin/utils/permissions.js +16 -0
- package/admin/utils/prefixPluginTranslations.js +3 -0
- package/package.json +13 -11
- package/server/app-errors.js +20 -0
- package/server/bootstrap.js +13 -0
- package/server/cache/index.js +34 -15
- package/server/config/index.js +7 -5
- package/server/config/{setupStrategy.js → setup.js} +30 -26
- package/server/content-types/audience/index.js +0 -1
- package/server/content-types/audience/schema.js +0 -1
- package/server/content-types/index.js +4 -7
- package/server/content-types/navigation/index.js +0 -1
- package/server/content-types/navigation/lifecycles.js +1 -2
- package/server/content-types/navigation/schema.js +29 -32
- package/server/content-types/navigation-item/index.js +0 -1
- package/server/content-types/navigation-item/lifecycles.js +1 -2
- package/server/content-types/navigation-item/schema.js +51 -58
- package/server/controllers/admin.js +119 -158
- package/server/controllers/client.js +71 -60
- package/server/controllers/index.js +1 -3
- package/server/controllers/utils.js +22 -0
- package/{admin/src/hooks/useNavigationManager.js → server/controllers/validators.js} +23 -16
- package/server/destroy.js +3 -2
- package/{types/i18n.js → server/dtos/config.js} +0 -1
- package/server/{navigation → dtos}/index.js +3 -2
- package/server/dtos/navigation-item.js +2 -0
- package/{admin/src/pages/SettingsPage/types.js → server/dtos/navigation.js} +0 -1
- package/server/graphql/config.js +14 -16
- package/server/graphql/index.js +1 -2
- package/server/graphql/queries/index.js +8 -4
- package/server/graphql/queries/render-navigation-child.js +19 -8
- package/server/graphql/queries/render-navigation.js +30 -14
- package/server/graphql/resolvers-config.js +4 -2
- package/server/graphql/{setupStrategy.js → setup.js} +4 -5
- package/server/graphql/types/content-types-name-fields.js +10 -9
- package/server/graphql/types/content-types.js +15 -15
- package/server/graphql/types/create-navigation-item.js +16 -16
- package/server/graphql/types/create-navigation-related.js +7 -7
- package/server/graphql/types/create-navigation.js +6 -6
- package/server/graphql/types/index.js +35 -15
- package/server/graphql/types/navigation-config.js +8 -8
- package/server/graphql/types/navigation-details.js +2 -2
- package/server/graphql/types/navigation-item-additional-field-media.js +10 -10
- package/server/graphql/types/navigation-item-related-data.js +6 -6
- package/server/graphql/types/navigation-item-related.js +3 -3
- package/server/graphql/types/navigation-item.js +30 -27
- package/server/graphql/types/navigation-render-type.js +4 -5
- package/server/graphql/types/navigation.js +8 -8
- package/server/i18n/index.js +29 -20
- package/server/index.js +15 -8
- package/server/middlewares/index.js +3 -0
- package/server/permissions/index.js +10 -0
- package/{permissions.js → server/permissions/permissions.js} +0 -1
- package/server/permissions/setup.js +32 -0
- package/server/permissions.js +39 -0
- package/server/policies/index.js +3 -0
- package/server/register.js +6 -0
- package/server/repositories/audience.js +12 -0
- package/server/repositories/generic.js +20 -0
- package/server/repositories/index.js +11 -0
- package/server/repositories/navigation-item.js +51 -0
- package/server/repositories/navigation.js +65 -0
- package/server/routes/admin.js +86 -79
- package/server/routes/client.js +0 -1
- package/server/routes/index.js +0 -1
- package/server/schemas/config.js +68 -0
- package/server/schemas/content-type.js +140 -0
- package/{admin/src/pages/SettingsPage/common → server/schemas}/index.js +3 -2
- package/server/schemas/navigation.js +107 -0
- package/server/services/admin/admin.js +483 -0
- package/server/{content-types/navigations-items-related → services/admin}/index.js +2 -5
- package/{admin/src/pages/View/components/NavigationItemForm → server/services/admin}/types.js +0 -1
- package/server/services/admin/utils.js +84 -0
- package/server/services/client/client.js +397 -0
- package/server/services/client/index.js +7 -0
- package/{admin/src/pages/View/components/NavigationManager → server/services/client}/types.js +0 -1
- package/server/services/client/utils.js +88 -0
- package/server/services/common/common.js +307 -0
- package/server/services/common/index.js +7 -0
- package/{admin/src/components/AdditionalFieldInput → server/services/common}/types.js +0 -1
- package/server/services/common/utils.js +24 -0
- package/server/services/index.js +4 -6
- package/server/types.js +2 -0
- package/server/utils/constants.js +35 -0
- package/server/utils/functions.js +71 -299
- package/server/utils/index.js +1 -2
- package/strapi-admin.js +5 -8
- package/strapi-server.js +3 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/admin/src/components/AdditionalFieldInput/index.d.ts +0 -5
- package/admin/src/components/AdditionalFieldInput/index.js +0 -99
- package/admin/src/components/AdditionalFieldInput/types.d.ts +0 -15
- package/admin/src/components/Alert/styles.d.ts +0 -2
- package/admin/src/components/Alert/styles.js +0 -14
- package/admin/src/components/CollapseButton/index.d.ts +0 -7
- package/admin/src/components/CollapseButton/index.js +0 -30
- package/admin/src/components/ConfirmationDialog/index.d.ts +0 -28
- package/admin/src/components/ConfirmationDialog/index.js +0 -34
- package/admin/src/components/DragButton/index.d.ts +0 -6
- package/admin/src/components/EmptyView/index.d.ts +0 -3
- package/admin/src/components/EmptyView/index.js +0 -30
- package/admin/src/components/Item/ItemCardBadge/index.d.ts +0 -3
- package/admin/src/components/Item/ItemCardBadge/index.js +0 -26
- package/admin/src/components/Item/ItemCardHeader/Wrapper.d.ts +0 -3
- package/admin/src/components/Item/ItemCardHeader/Wrapper.js +0 -21
- package/admin/src/components/Item/ItemCardHeader/icons.d.ts +0 -5
- package/admin/src/components/Item/ItemCardHeader/icons.js +0 -13
- package/admin/src/components/Item/ItemCardHeader/index.d.ts +0 -17
- package/admin/src/components/Item/ItemCardHeader/index.js +0 -38
- package/admin/src/components/Item/ItemCardRemovedOverlay/index.d.ts +0 -2
- package/admin/src/components/Item/ItemCardRemovedOverlay/index.js +0 -18
- package/admin/src/components/Item/Wrapper.d.ts +0 -3
- package/admin/src/components/Item/Wrapper.js +0 -43
- package/admin/src/components/Item/index.d.ts +0 -31
- package/admin/src/components/Item/index.js +0 -188
- package/admin/src/components/NavigationItemList/Wrapper.d.ts +0 -3
- package/admin/src/components/NavigationItemList/Wrapper.js +0 -26
- package/admin/src/components/NavigationItemList/index.d.ts +0 -36
- package/admin/src/components/NavigationItemList/index.js +0 -32
- package/admin/src/components/RestartAlert/index.d.ts +0 -3
- package/admin/src/components/RestartAlert/index.js +0 -13
- package/admin/src/components/Search/index.d.ts +0 -12
- package/admin/src/components/Search/index.js +0 -97
- package/admin/src/components/TextArrayInput/index.d.ts +0 -15
- package/admin/src/components/TextArrayInput/index.js +0 -45
- package/admin/src/components/icons/navigation.d.ts +0 -6
- package/admin/src/components/icons/navigation.js +0 -12
- package/admin/src/contexts/DataManagerContext.d.ts +0 -3
- package/admin/src/contexts/DataManagerContext.js +0 -6
- package/admin/src/hooks/useAllContentTypes.d.ts +0 -3
- package/admin/src/hooks/useAllContentTypes.js +0 -8
- package/admin/src/hooks/useDataManager.d.ts +0 -3
- package/admin/src/hooks/useDataManager.js +0 -10
- package/admin/src/hooks/useI18nCopyNavigationItemsModal.d.ts +0 -9
- package/admin/src/hooks/useI18nCopyNavigationItemsModal.js +0 -51
- package/admin/src/hooks/useNavigationConfig.d.ts +0 -10
- package/admin/src/hooks/useNavigationConfig.js +0 -54
- package/admin/src/hooks/useNavigationManager.d.ts +0 -6
- package/admin/src/index.d.ts +0 -14
- package/admin/src/index.js +0 -87
- package/admin/src/pages/App/index.d.ts +0 -3
- package/admin/src/pages/App/index.js +0 -43
- package/admin/src/pages/DataManagerProvider/actions.d.ts +0 -21
- package/admin/src/pages/DataManagerProvider/actions.js +0 -24
- package/admin/src/pages/DataManagerProvider/index.d.ts +0 -12
- package/admin/src/pages/DataManagerProvider/index.js +0 -382
- package/admin/src/pages/DataManagerProvider/init.d.ts +0 -3
- package/admin/src/pages/DataManagerProvider/init.js +0 -7
- package/admin/src/pages/DataManagerProvider/reducer.d.ts +0 -20
- package/admin/src/pages/DataManagerProvider/reducer.js +0 -132
- package/admin/src/pages/NoAccessPage/index.d.ts +0 -3
- package/admin/src/pages/NoAccessPage/index.js +0 -31
- package/admin/src/pages/SettingsPage/common/const.d.ts +0 -2
- package/admin/src/pages/SettingsPage/common/const.js +0 -5
- package/admin/src/pages/SettingsPage/common/index.d.ts +0 -2
- package/admin/src/pages/SettingsPage/components/CustomFieldForm/index.d.ts +0 -12
- package/admin/src/pages/SettingsPage/components/CustomFieldForm/index.js +0 -129
- package/admin/src/pages/SettingsPage/components/CustomFieldModal/index.d.ts +0 -12
- package/admin/src/pages/SettingsPage/components/CustomFieldModal/index.js +0 -20
- package/admin/src/pages/SettingsPage/components/CustomFieldTable/index.d.ts +0 -11
- package/admin/src/pages/SettingsPage/components/CustomFieldTable/index.js +0 -105
- package/admin/src/pages/SettingsPage/components/DisableI18nModal/index.d.ts +0 -23
- package/admin/src/pages/SettingsPage/components/DisableI18nModal/index.js +0 -86
- package/admin/src/pages/SettingsPage/index.d.ts +0 -3
- package/admin/src/pages/SettingsPage/index.js +0 -321
- package/admin/src/pages/SettingsPage/types.d.ts +0 -35
- package/admin/src/pages/SettingsPage/utils/form.d.ts +0 -20
- package/admin/src/pages/SettingsPage/utils/form.js +0 -37
- package/admin/src/pages/SettingsPage/utils/functions.d.ts +0 -3
- package/admin/src/pages/SettingsPage/utils/functions.js +0 -26
- package/admin/src/pages/View/components/I18nCopyNavigationItems/index.d.ts +0 -14
- package/admin/src/pages/View/components/I18nCopyNavigationItems/index.js +0 -15
- package/admin/src/pages/View/components/NavigationContentHeader/index.d.ts +0 -6
- package/admin/src/pages/View/components/NavigationContentHeader/index.js +0 -14
- package/admin/src/pages/View/components/NavigationHeader/index.d.ts +0 -14
- package/admin/src/pages/View/components/NavigationHeader/index.js +0 -92
- package/admin/src/pages/View/components/NavigationHeader/styles.d.ts +0 -2
- package/admin/src/pages/View/components/NavigationHeader/styles.js +0 -18
- package/admin/src/pages/View/components/NavigationItemForm/index.d.ts +0 -5
- package/admin/src/pages/View/components/NavigationItemForm/index.js +0 -470
- package/admin/src/pages/View/components/NavigationItemForm/types.d.ts +0 -99
- package/admin/src/pages/View/components/NavigationItemForm/utils/form.d.ts +0 -28
- package/admin/src/pages/View/components/NavigationItemForm/utils/form.js +0 -123
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupFooter.d.ts +0 -25
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupFooter.js +0 -31
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupHeader.d.ts +0 -5
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupHeader.js +0 -20
- package/admin/src/pages/View/components/NavigationItemPopup/index.d.ts +0 -33
- package/admin/src/pages/View/components/NavigationItemPopup/index.js +0 -90
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/icons.d.ts +0 -4
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/icons.js +0 -12
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/index.d.ts +0 -8
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/index.js +0 -151
- package/admin/src/pages/View/components/NavigationManager/DeletionConfirm/index.d.ts +0 -8
- package/admin/src/pages/View/components/NavigationManager/DeletionConfirm/index.js +0 -34
- package/admin/src/pages/View/components/NavigationManager/ErrorDetails/index.d.ts +0 -8
- package/admin/src/pages/View/components/NavigationManager/ErrorDetails/index.js +0 -53
- package/admin/src/pages/View/components/NavigationManager/Footer/index.d.ts +0 -24
- package/admin/src/pages/View/components/NavigationManager/Footer/index.js +0 -13
- package/admin/src/pages/View/components/NavigationManager/Form/index.d.ts +0 -19
- package/admin/src/pages/View/components/NavigationManager/Form/index.js +0 -103
- package/admin/src/pages/View/components/NavigationManager/NavigationUpdate/index.d.ts +0 -8
- package/admin/src/pages/View/components/NavigationManager/NavigationUpdate/index.js +0 -59
- package/admin/src/pages/View/components/NavigationManager/NewNavigation/index.d.ts +0 -9
- package/admin/src/pages/View/components/NavigationManager/NewNavigation/index.js +0 -62
- package/admin/src/pages/View/components/NavigationManager/PurgeCacheConfirm/index.d.ts +0 -8
- package/admin/src/pages/View/components/NavigationManager/PurgeCacheConfirm/index.js +0 -34
- package/admin/src/pages/View/components/NavigationManager/index.d.ts +0 -10
- package/admin/src/pages/View/components/NavigationManager/index.js +0 -203
- package/admin/src/pages/View/components/NavigationManager/types.d.ts +0 -44
- package/admin/src/pages/View/index.d.ts +0 -4
- package/admin/src/pages/View/index.js +0 -269
- package/admin/src/pages/View/utils/form.d.ts +0 -2
- package/admin/src/pages/View/utils/form.js +0 -16
- package/admin/src/pages/View/utils/index.d.ts +0 -2
- package/admin/src/pages/View/utils/index.js +0 -11
- package/admin/src/pages/View/utils/parsers.d.ts +0 -51
- package/admin/src/pages/View/utils/parsers.js +0 -272
- package/admin/src/pages/View/utils/types.d.ts +0 -3
- package/admin/src/pages/View/utils/types.js +0 -3
- package/admin/src/permissions.d.ts +0 -16
- package/admin/src/permissions.js +0 -13
- package/admin/src/pluginId.d.ts +0 -3
- package/admin/src/pluginId.js +0 -5
- package/admin/src/translations/index.d.ts +0 -15
- package/admin/src/translations/index.js +0 -21
- package/admin/src/utils/api.d.ts +0 -9
- package/admin/src/utils/api.js +0 -20
- package/admin/src/utils/enums.d.ts +0 -25
- package/admin/src/utils/enums.js +0 -30
- package/admin/src/utils/functions.d.ts +0 -16
- package/admin/src/utils/functions.js +0 -46
- package/admin/src/utils/index.d.ts +0 -4
- package/admin/src/utils/index.js +0 -20
- package/permissions.d.ts +0 -10
- package/server/bootstrap/index.d.ts +0 -4
- package/server/bootstrap/index.js +0 -50
- package/server/cache/index.d.ts +0 -2
- package/server/cache/serviceEnhancers.d.ts +0 -3
- package/server/cache/serviceEnhancers.js +0 -16
- package/server/cache/setupStrategy.d.ts +0 -3
- package/server/cache/setupStrategy.js +0 -38
- package/server/cache/types.d.ts +0 -11
- package/server/cache/types.js +0 -3
- package/server/cache/utils.d.ts +0 -11
- package/server/cache/utils.js +0 -19
- package/server/config/index.d.ts +0 -5
- package/server/config/setupStrategy.d.ts +0 -3
- package/server/content-types/audience/index.d.ts +0 -27
- package/server/content-types/audience/schema.d.ts +0 -25
- package/server/content-types/index.d.ts +0 -244
- package/server/content-types/navigation/index.d.ts +0 -59
- package/server/content-types/navigation/lifecycles.d.ts +0 -3
- package/server/content-types/navigation/schema.d.ts +0 -56
- package/server/content-types/navigation-item/index.d.ts +0 -111
- package/server/content-types/navigation-item/lifecycles.d.ts +0 -3
- package/server/content-types/navigation-item/schema.d.ts +0 -108
- package/server/content-types/navigations-items-related/index.d.ts +0 -51
- package/server/content-types/navigations-items-related/schema.d.ts +0 -49
- package/server/content-types/navigations-items-related/schema.js +0 -50
- package/server/controllers/admin.d.ts +0 -4
- package/server/controllers/client.d.ts +0 -4
- package/server/controllers/index.d.ts +0 -4
- package/server/destroy.d.ts +0 -3
- package/server/graphql/config.d.ts +0 -4
- package/server/graphql/index.d.ts +0 -2
- package/server/graphql/queries/index.d.ts +0 -3
- package/server/graphql/queries/render-navigation-child.d.ts +0 -15
- package/server/graphql/queries/render-navigation.d.ts +0 -21
- package/server/graphql/resolvers-config.d.ts +0 -10
- package/server/graphql/setupStrategy.d.ts +0 -3
- package/server/graphql/types/content-types-name-fields.d.ts +0 -6
- package/server/graphql/types/content-types.d.ts +0 -5
- package/server/graphql/types/create-navigation-item.d.ts +0 -5
- package/server/graphql/types/create-navigation-related.d.ts +0 -5
- package/server/graphql/types/create-navigation.d.ts +0 -5
- package/server/graphql/types/index.d.ts +0 -3
- package/server/graphql/types/navigation-config.d.ts +0 -5
- package/server/graphql/types/navigation-details.d.ts +0 -5
- package/server/graphql/types/navigation-item-additional-field-media.d.ts +0 -5
- package/server/graphql/types/navigation-item-related-data.d.ts +0 -5
- package/server/graphql/types/navigation-item-related.d.ts +0 -7
- package/server/graphql/types/navigation-item.d.ts +0 -6
- package/server/graphql/types/navigation-render-type.d.ts +0 -5
- package/server/graphql/types/navigation.d.ts +0 -5
- package/server/i18n/constant.d.ts +0 -2
- package/server/i18n/constant.js +0 -5
- package/server/i18n/errors.d.ts +0 -7
- package/server/i18n/errors.js +0 -14
- package/server/i18n/graphQLEnhancers.d.ts +0 -10
- package/server/i18n/graphQLEnhancers.js +0 -10
- package/server/i18n/index.d.ts +0 -8
- package/server/i18n/navigationSetupStrategy.d.ts +0 -3
- package/server/i18n/navigationSetupStrategy.js +0 -147
- package/server/i18n/serviceEnhancers.d.ts +0 -13
- package/server/i18n/serviceEnhancers.js +0 -156
- package/server/i18n/types.d.ts +0 -60
- package/server/i18n/types.js +0 -3
- package/server/i18n/utils.d.ts +0 -13
- package/server/i18n/utils.js +0 -33
- package/server/index.d.ts +0 -262
- package/server/navigation/index.d.ts +0 -2
- package/server/navigation/setupStrategy.d.ts +0 -3
- package/server/navigation/setupStrategy.js +0 -39
- package/server/register/index.d.ts +0 -3
- package/server/register/index.js +0 -4
- package/server/routes/admin.d.ts +0 -4
- package/server/routes/client.d.ts +0 -4
- package/server/routes/index.d.ts +0 -6
- package/server/services/admin.d.ts +0 -5
- package/server/services/admin.js +0 -347
- package/server/services/client.d.ts +0 -5
- package/server/services/client.js +0 -335
- package/server/services/common.d.ts +0 -5
- package/server/services/common.js +0 -385
- package/server/services/index.d.ts +0 -7
- package/server/utils/constant.d.ts +0 -27
- package/server/utils/constant.js +0 -43
- package/server/utils/functions.d.ts +0 -157
- package/server/utils/index.d.ts +0 -3
- package/strapi-admin.d.ts +0 -3
- package/strapi-server.d.ts +0 -262
- package/types/bootstrap.d.ts +0 -16
- package/types/bootstrap.js +0 -3
- package/types/config.d.ts +0 -27
- package/types/config.js +0 -3
- package/types/contentTypes.d.ts +0 -112
- package/types/contentTypes.js +0 -3
- package/types/controllers.d.ts +0 -65
- package/types/controllers.js +0 -5
- package/types/graphQL.d.ts +0 -3
- package/types/graphQL.js +0 -3
- package/types/i18n.d.ts +0 -9
- package/types/index.d.ts +0 -10
- package/types/index.js +0 -26
- package/types/lifecycle.d.ts +0 -22
- package/types/lifecycle.js +0 -3
- package/types/services.d.ts +0 -106
- package/types/services.js +0 -3
- package/types/utils.d.ts +0 -72
- package/types/utils.js +0 -41
- package/utils/InvalidParamNavigationError.d.ts +0 -4
- package/utils/InvalidParamNavigationError.js +0 -8
- package/utils/NavigationError.d.ts +0 -5
- package/utils/NavigationError.js +0 -11
- /package/admin/{src/translations → translations}/ca.json +0 -0
- /package/admin/{src/translations → translations}/fr.json +0 -0
package/README.md
CHANGED
|
@@ -2,28 +2,24 @@
|
|
|
2
2
|
<img style="width: 150px; height: auto;" src="public/assets/logo.png" alt="Logo - Strapi Navigation plugin" />
|
|
3
3
|
</div>
|
|
4
4
|
<div align="center">
|
|
5
|
-
<h1>Strapi
|
|
5
|
+
<h1>Strapi v5 - Navigation plugin - Beta</h1>
|
|
6
6
|
<p>Create consumable navigation with a simple and straightforward visual builder</p>
|
|
7
7
|
<a href="https://www.npmjs.org/package/strapi-plugin-navigation">
|
|
8
|
-
<img alt="GitHub package.json version" src="https://img.shields.io/github/package-json/v/VirtusLab-Open-Source/strapi-plugin-navigation?label=npm&logo=npm">
|
|
8
|
+
<img alt="GitHub package.json version" src="https://img.shields.io/github/package-json/v/VirtusLab-Open-Source/strapi-plugin-navigation/v5?label=npm&logo=npm">
|
|
9
9
|
</a>
|
|
10
10
|
<a href="https://www.npmjs.org/package/strapi-plugin-navigation">
|
|
11
11
|
<img src="https://img.shields.io/npm/dm/strapi-plugin-navigation.svg" alt="Monthly download on NPM" />
|
|
12
12
|
</a>
|
|
13
13
|
<a href="https://circleci.com/gh/VirtusLab/strapi-plugin-navigation">
|
|
14
|
-
<img src="https://circleci.com/gh/VirtusLab-Open-Source/strapi-plugin-navigation.svg?style=shield" alt="CircleCI" />
|
|
14
|
+
<img src="https://circleci.com/gh/VirtusLab-Open-Source/strapi-plugin-navigation/tree/v5.svg?style=shield" alt="CircleCI" />
|
|
15
15
|
</a>
|
|
16
16
|
<a href="https://codecov.io/gh/VirtusLab/strapi-plugin-navigation">
|
|
17
|
-
<img src="https://codecov.io/gh/VirtusLab/strapi-plugin-navigation/coverage.svg?branch=
|
|
18
|
-
</a>
|
|
19
|
-
<a href="https://sharing.clickup.com/tl/xhcmx-43/strapiv-4-navigation-roadmap">
|
|
20
|
-
<img src="https://img.shields.io/website?down_message=roadmap&label=product&up_message=roadmap&url=https%3A%2F%2Fsharing.clickup.com%2Ftl%2Fxhcmx-43%2Fstrapiv-4-navigation-roadmap" />
|
|
21
|
-
</a>
|
|
22
|
-
<a href="https://sharing.clickup.com/b/6-169004201-2/strapiv-4-navigation-board">
|
|
23
|
-
<img src="https://img.shields.io/website?down_message=board&label=product&up_color=blue&up_message=board&url=https%3A%2F%2Fsharing.clickup.com%2Fb%2F6-169004201-2%2Fstrapiv-4-navigation-board" />
|
|
17
|
+
<img src="https://codecov.io/gh/VirtusLab/strapi-plugin-navigation/coverage.svg?branch=v5" alt="codecov.io" />
|
|
24
18
|
</a>
|
|
25
19
|
</div>
|
|
26
20
|
|
|
21
|
+
## ⚠️ This is the beta version for Strapi v5
|
|
22
|
+
|
|
27
23
|
---
|
|
28
24
|
|
|
29
25
|
<div style="margin: 20px 0" align="center">
|
|
@@ -36,27 +32,34 @@ Strapi Navigation Plugin provides a website navigation / menu builder feature fo
|
|
|
36
32
|
- Tree (nested)
|
|
37
33
|
- RFR (ready for handling by Redux First Router)
|
|
38
34
|
|
|
35
|
+
|
|
39
36
|
### Table of Contents
|
|
40
|
-
1. [
|
|
41
|
-
2. [
|
|
42
|
-
3. [
|
|
43
|
-
4. [
|
|
37
|
+
1. [💎 Versions](#-versions)
|
|
38
|
+
2. [✨ Features](#-features)
|
|
39
|
+
3. [⏳ Installation](#-installation)
|
|
40
|
+
4. [🖐 Requirements](#-requirements)
|
|
41
|
+
5. [🔧 Basic Configuration](#-configuration)
|
|
44
42
|
- [Settings page](#in-v203-and-newer)
|
|
45
43
|
- [Plugin file](#in-v202-and-older--default-configuration-state-for-v203-and-newer)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
6. [🔧 GraphQL Configuration](#-gql-configuration)
|
|
45
|
+
7. [🌍 i18n Internationalization](#-i18n-internationalization)
|
|
46
|
+
8. [👤 RBAC](#-rbac)
|
|
47
|
+
9. [🔐 Authorization strategy](#-authorization-strategy)
|
|
48
|
+
10. [🕸️ Public API specification](#%EF%B8%8F-public-api-specification)
|
|
51
49
|
- [REST API](#rest-api)
|
|
52
50
|
- [GraphQL API](#graphql-api)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
11. [🔌 Extensions](#-extensions)
|
|
52
|
+
12. [🌿 Model lifecycle hooks](#model-life-cycle-hooks)
|
|
53
|
+
13. [🧹 REST Cache](#rest-cache)
|
|
54
|
+
14. [🧩 Examples](#-examples)
|
|
55
|
+
15. [💬 FAQ](#-faq)
|
|
56
|
+
16. [🤝 Contributing](#-contributing)
|
|
57
|
+
17. [👨💻 Community support](#-community-support)
|
|
58
|
+
|
|
59
|
+
## 💎 Versions
|
|
60
|
+
- **Strapi v5** - (current) [v3.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-navigation/tree/v5)
|
|
61
|
+
- **Strapi v4** - [v2.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-navigation)
|
|
62
|
+
- **Strapi v3** - [v1.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-navigation/tree/strapi-v3)
|
|
60
63
|
|
|
61
64
|
## ✨ Features
|
|
62
65
|
|
|
@@ -72,12 +75,12 @@ Strapi Navigation Plugin provides a website navigation / menu builder feature fo
|
|
|
72
75
|
|
|
73
76
|
## ⚙️ Versions
|
|
74
77
|
|
|
75
|
-
- **Strapi
|
|
76
|
-
- **Strapi
|
|
78
|
+
- **Strapi v5** - (current) - [v3.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-navigation)
|
|
79
|
+
- **Strapi v4** - [v2.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-navigation/tree/strapi-v4)
|
|
77
80
|
|
|
78
81
|
## ⏳ Installation
|
|
79
82
|
|
|
80
|
-
### Via Strapi
|
|
83
|
+
### Via Strapi Marketplace
|
|
81
84
|
|
|
82
85
|
As a ✅ **verified** plugin by Strapi team we're available on the [**Strapi Marketplace**](https://market.strapi.io/plugins/strapi-plugin-navigation) as well as **In-App Marketplace** where you can follow the installation instructions.
|
|
83
86
|
|
|
@@ -90,7 +93,7 @@ As a ✅ **verified** plugin by Strapi team we're available on the [**Strapi Mar
|
|
|
90
93
|
It's recommended to use **yarn** to install this plugin within your Strapi project. [You can install yarn with these docs](https://yarnpkg.com/lang/en/docs/install/).
|
|
91
94
|
|
|
92
95
|
```bash
|
|
93
|
-
yarn add strapi-plugin-navigation@
|
|
96
|
+
yarn add strapi-plugin-navigation@beta
|
|
94
97
|
```
|
|
95
98
|
|
|
96
99
|
After successful installation you've to re-build your Strapi instance. To archive that simply use:
|
|
@@ -100,12 +103,6 @@ yarn build
|
|
|
100
103
|
yarn develop
|
|
101
104
|
```
|
|
102
105
|
|
|
103
|
-
or just run Strapi in the development mode with `--watch-admin` option:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
yarn develop --watch-admin
|
|
107
|
-
```
|
|
108
|
-
|
|
109
106
|
The **UI Navigation** plugin should appear in the **Plugins** section of Strapi sidebar after you run app again.
|
|
110
107
|
|
|
111
108
|
You can manage your multiple navigation containers by going to the **Navigation** manage view by clicking "Manage" button.
|
|
@@ -124,20 +121,18 @@ Complete installation requirements are exact same as for Strapi itself and can b
|
|
|
124
121
|
|
|
125
122
|
**Supported Strapi versions**:
|
|
126
123
|
|
|
127
|
-
- Strapi
|
|
128
|
-
- Strapi
|
|
124
|
+
- Strapi v5.0.0-rc.22 (recently tested)
|
|
125
|
+
- Strapi v5.x
|
|
129
126
|
|
|
130
|
-
> This plugin is designed for **Strapi
|
|
127
|
+
> This plugin is designed for **Strapi v5** and is not working with v4.x. To get version for **Strapi v4** install version [v4.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-navigation/tree/strapi-v4).
|
|
131
128
|
|
|
132
129
|
**We recommend always using the latest version of Strapi to start your new projects**.
|
|
133
130
|
|
|
134
131
|
## 🔧 Configuration
|
|
135
132
|
|
|
136
|
-
To start your journey with **Navigation plugin** you must first setup it using the dedicated Settings page
|
|
133
|
+
To start your journey with **Navigation plugin** you must first setup it using the dedicated Settings page or for any version, put your configuration in `config/plugins.js`. Anyway we're recommending the click-through option where your configuration is going to be properly validated.
|
|
137
134
|
|
|
138
|
-
###
|
|
139
|
-
|
|
140
|
-
Version `2.0.3` introduces the intuitive **Settings** page which you can easily access via `Strapi Settings -> Section: Navigation Plugin -> Configuration`.
|
|
135
|
+
### Settings page
|
|
141
136
|
|
|
142
137
|
On the dedicated page, you will be able to set up all crucial properties which drive the plugin and customize each individual collection for which **Navigation plugin** should be enabled.
|
|
143
138
|
|
|
@@ -148,15 +143,10 @@ On the dedicated page, you will be able to set up all crucial properties which d
|
|
|
148
143
|
> *Note*
|
|
149
144
|
> The default configuration for your plugin is fetched from `config/plugins.js` or, if the file is not there, directly from the plugin itself. If you would like to customize the default state to which you might revert, please follow the next section.
|
|
150
145
|
|
|
151
|
-
###
|
|
146
|
+
### File
|
|
152
147
|
|
|
153
148
|
Config for this plugin is stored as a part of the `config/plugins.js` or `config/<env>/plugins.js` file. You can use the following snippet to make sure that the config structure is correct. If you've got already configurations for other plugins stores by this way, you can use the `navigation` along with them.
|
|
154
149
|
|
|
155
|
-
> *Note v2.0.3 and newer only*
|
|
156
|
-
> Changing this file will not automatically change plugin configuration. To synchronize plugin's config with plugins.js file, it is necessary to restore configuration through the settings page
|
|
157
|
-
|
|
158
|
-
> *Note for newer than v2.2.0*
|
|
159
|
-
> `slugify` as been removed. **THIS A BREAKING CHANGE**
|
|
160
150
|
|
|
161
151
|
```js
|
|
162
152
|
module.exports = ({ env }) => ({
|
|
@@ -194,7 +184,7 @@ Config for this plugin is stored as a part of the `config/plugins.js` or `config
|
|
|
194
184
|
### Additional Fields
|
|
195
185
|
It is advised to configure additional fields through the plugin's Settings Page. There you can find the table of custom fields and toggle input for the audience field. When enabled, the audience field can be customized through the content manager. Custom fields can be added, edited, toggled, and removed with the use of the table provided on the Settings Page. When removing custom fields be advised that their values in navigation items will be lost. Disabling the custom fields will not affect the data and can be done with no consequence of loosing information.
|
|
196
186
|
|
|
197
|
-
Creating configuration for additional fields with the `config.js` file should be done with caution. Config object contains the `additionalFields` property of type `Array<CustomField | 'audience'>`, where CustomField is of type `{ type: 'string' | 'boolean' | { "name": string, "url": string, "mime": string, "width": number, "height": number, "previewUrl": string }, name: string, label: string }`. When creating custom fields be advised that the `name` property has to be unique. When editing a custom field it is advised not to edit its `name` and `type` properties. After config has been restored the custom fields that are not present in `config.js` file will be deleted and their values in navigation items will be lost.
|
|
187
|
+
Creating configuration for additional fields with the `config.(js|ts)` file should be done with caution. Config object contains the `additionalFields` property of type `Array<CustomField | 'audience'>`, where CustomField is of type `{ type: 'string' | 'boolean' | { "name": string, "url": string, "mime": string, "width": number, "height": number, "previewUrl": string }, name: string, label: string }`. When creating custom fields be advised that the `name` property has to be unique. When editing a custom field it is advised not to edit its `name` and `type` properties. After config has been restored the custom fields that are not present in `config.js` file will be deleted and their values in navigation items will be lost.
|
|
198
188
|
|
|
199
189
|
## 🔧 GQL Configuration
|
|
200
190
|
Using navigation with GraphQL requires both plugins to be installed and working. You can find installation guide for GraphQL plugin **[here](https://docs.strapi.io/developer-docs/latest/plugins/graphql.html#graphql)**. To properly configure GQL to work with navigation you should provide `gql` prop. This should contain union types that will be used to define GQL response format for your data while fetching:
|
|
@@ -227,15 +217,7 @@ where `Page` and `UploadFile` are your type names for the **Content Types** you'
|
|
|
227
217
|
|
|
228
218
|
## 🌍 i18n Internationalization
|
|
229
219
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
This feature is **opt-in**.
|
|
233
|
-
|
|
234
|
-
In order to use this functionality setting **default locale** is required. (See: Settings -> Internationalization)
|
|
235
|
-
|
|
236
|
-
Once feature is enabled a restart is required. On server startup missing navigations for other locales will be created. From then you can manage navigation's localizations just like before.
|
|
237
|
-
|
|
238
|
-
If you want go back to _pre-i18n_ way you can disable it in settings. Already created navigations will not be removed unless you make a choice for plugin to do so(this will require a restart).
|
|
220
|
+
On server startup missing navigations for other locales will be created. From then you can manage navigation's localizations just like before.
|
|
239
221
|
|
|
240
222
|
If your newly created navigation localization is empty you can copy contents of one version's to the empty one. If related item is localized and locale version exists localization will be used as a related item. Otherwise plugin will fallback to an original item.
|
|
241
223
|
|
|
@@ -375,10 +357,6 @@ Plugin supports both **REST API** and **GraphQL API** exposed by Strapi.
|
|
|
375
357
|
|
|
376
358
|
### REST API
|
|
377
359
|
|
|
378
|
-
> **Important!**
|
|
379
|
-
> Version `v2.0.13` introduced breaking change!
|
|
380
|
-
> All responses have changed their structure. Related field will now be of type ContentType instead of Array\<ContentType\>
|
|
381
|
-
|
|
382
360
|
`GET <host>/api/navigation/?locale=<locale>&orderBy=<orderBy>&orderDirection=<orderDirection>`
|
|
383
361
|
|
|
384
362
|
NOTE: All params are optional
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { once } from 'lodash';
|
|
2
|
+
import { strapiContentTypeSchema } from '../schemas';
|
|
3
|
+
import { configFromServerSchema, i18nCopyItemDetails, localeSchema, navigationSchema, slugifyResult, strapiContentTypeItemSchema, } from './validators';
|
|
4
|
+
const URL_PREFIX = 'navigation';
|
|
5
|
+
export const getApiClient = once((fetch) => ({
|
|
6
|
+
getIndexPrefix() {
|
|
7
|
+
return [URL_PREFIX];
|
|
8
|
+
},
|
|
9
|
+
readAll() {
|
|
10
|
+
return fetch.get(`/${URL_PREFIX}`).then(({ data }) => navigationSchema.array().parse(data));
|
|
11
|
+
},
|
|
12
|
+
readAllIndex() {
|
|
13
|
+
return [URL_PREFIX, 'navigations'];
|
|
14
|
+
},
|
|
15
|
+
delete(id) {
|
|
16
|
+
return fetch.del(`/${URL_PREFIX}/${id}`);
|
|
17
|
+
},
|
|
18
|
+
create(body) {
|
|
19
|
+
return fetch.post(`/${URL_PREFIX}/`, body);
|
|
20
|
+
},
|
|
21
|
+
update(body) {
|
|
22
|
+
return fetch.put(`/${URL_PREFIX}/${body.id}`, body);
|
|
23
|
+
},
|
|
24
|
+
purge({ id, withLangVersions }) {
|
|
25
|
+
return fetch.del(`/${URL_PREFIX}/cache/purge/${id ?? ''}?clearLocalisations=${!!withLangVersions}`);
|
|
26
|
+
},
|
|
27
|
+
slugify(query) {
|
|
28
|
+
const queryParams = new URLSearchParams();
|
|
29
|
+
queryParams.append('q', query);
|
|
30
|
+
return fetch
|
|
31
|
+
.get(`/${URL_PREFIX}/slug?${queryParams.toString()}`)
|
|
32
|
+
.then(({ data }) => slugifyResult.parse(data))
|
|
33
|
+
.then(({ slug }) => slug);
|
|
34
|
+
},
|
|
35
|
+
readConfig() {
|
|
36
|
+
return fetch
|
|
37
|
+
.get(`/${URL_PREFIX}/config`)
|
|
38
|
+
.then(({ data }) => configFromServerSchema.parse(data));
|
|
39
|
+
},
|
|
40
|
+
readConfigIndex() {
|
|
41
|
+
return [URL_PREFIX, 'config'];
|
|
42
|
+
},
|
|
43
|
+
readNavigationItemFromLocale({ source, structureId, target, }) {
|
|
44
|
+
return fetch.get(`/${URL_PREFIX}/i18n/item/read/${source}/${target}?path=${structureId}`);
|
|
45
|
+
},
|
|
46
|
+
updateConfig(body) {
|
|
47
|
+
return fetch.put(`/${URL_PREFIX}/config`, body).then(() => { });
|
|
48
|
+
},
|
|
49
|
+
restart() {
|
|
50
|
+
return fetch.get(`/${URL_PREFIX}/settings/restart`).then(() => { });
|
|
51
|
+
},
|
|
52
|
+
restoreConfig() {
|
|
53
|
+
return fetch.del(`/${URL_PREFIX}/config`).then(() => { });
|
|
54
|
+
},
|
|
55
|
+
readSettingsConfig() {
|
|
56
|
+
return fetch.get(`/${URL_PREFIX}/settings/config`).then(({ data }) => {
|
|
57
|
+
const fromServer = configFromServerSchema.parse(data);
|
|
58
|
+
return {
|
|
59
|
+
...fromServer,
|
|
60
|
+
contentTypes: fromServer.contentTypes.map(({ uid }) => uid),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
readSettingsConfigIndex() {
|
|
65
|
+
return [URL_PREFIX, 'config'];
|
|
66
|
+
},
|
|
67
|
+
readContentType() {
|
|
68
|
+
return fetch
|
|
69
|
+
.get(`/content-manager/content-types`)
|
|
70
|
+
.then(({ data }) => strapiContentTypeSchema.array().parse(data.data));
|
|
71
|
+
},
|
|
72
|
+
readContentTypeIndex() {
|
|
73
|
+
return [URL_PREFIX, 'content-manager', 'content-types'];
|
|
74
|
+
},
|
|
75
|
+
readContentTypeItems({ uid, locale, query }) {
|
|
76
|
+
const queryParams = new URLSearchParams();
|
|
77
|
+
queryParams.append('_publicationState', 'preview');
|
|
78
|
+
if (query) {
|
|
79
|
+
queryParams.append('_q', query);
|
|
80
|
+
}
|
|
81
|
+
if (locale) {
|
|
82
|
+
queryParams.append('localeCode', locale);
|
|
83
|
+
}
|
|
84
|
+
return fetch
|
|
85
|
+
.get(`/${URL_PREFIX}/content-type-items/${uid}?${queryParams.toString()}`)
|
|
86
|
+
.then(({ data }) => strapiContentTypeItemSchema.array().parse(data));
|
|
87
|
+
},
|
|
88
|
+
readContentTypeItemsIndex({ uid, locale, query, }) {
|
|
89
|
+
return [URL_PREFIX, 'content-manager', 'content-type-items', uid, locale, query];
|
|
90
|
+
},
|
|
91
|
+
readLocale() {
|
|
92
|
+
return fetch
|
|
93
|
+
.get(`/${URL_PREFIX}/settings/locale`)
|
|
94
|
+
.then((data) => localeSchema.parse(data.data));
|
|
95
|
+
},
|
|
96
|
+
readLocaleIndex() {
|
|
97
|
+
return [URL_PREFIX, 'locale'];
|
|
98
|
+
},
|
|
99
|
+
copyNavigationLocale({ source, target }) {
|
|
100
|
+
return fetch.put(`/${URL_PREFIX}/i18n/copy/${source}/${target}`);
|
|
101
|
+
},
|
|
102
|
+
copyNavigationItemLocale({ source, structureId = '', target, }) {
|
|
103
|
+
return fetch
|
|
104
|
+
.get(`/${URL_PREFIX}/i18n/item/read/${source}/${target}?path=${structureId}`)
|
|
105
|
+
.then((data) => i18nCopyItemDetails.parse(data.data));
|
|
106
|
+
},
|
|
107
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './client';
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export const audienceDBSchema = z.object({
|
|
3
|
+
id: z.number(),
|
|
4
|
+
name: z.string(),
|
|
5
|
+
key: z.string(),
|
|
6
|
+
});
|
|
7
|
+
export const navigationItemTypeSchema = z.enum(['INTERNAL', 'EXTERNAL']);
|
|
8
|
+
const navigationItemBaseSchema = z.object({
|
|
9
|
+
id: z.number(),
|
|
10
|
+
title: z.string(),
|
|
11
|
+
type: navigationItemTypeSchema,
|
|
12
|
+
path: z.string(),
|
|
13
|
+
externalPath: z.string().or(z.null()).optional(),
|
|
14
|
+
uiRouterKey: z.string(),
|
|
15
|
+
menuAttached: z.boolean(),
|
|
16
|
+
order: z.number().int(),
|
|
17
|
+
collapsed: z.boolean(),
|
|
18
|
+
autoSync: z.boolean().or(z.null()).optional(),
|
|
19
|
+
related: z.string().or(z.null()).optional(),
|
|
20
|
+
additionalFields: z.record(z.string(), z.unknown()).or(z.null()).optional(),
|
|
21
|
+
audience: z.array(audienceDBSchema).or(z.null()).optional(),
|
|
22
|
+
viewId: z.number().optional(),
|
|
23
|
+
viewParentId: z.number().optional(),
|
|
24
|
+
structureId: z.string().optional(),
|
|
25
|
+
removed: z.boolean().optional(),
|
|
26
|
+
isSearchActive: z.boolean().optional(),
|
|
27
|
+
updated: z.boolean().optional(),
|
|
28
|
+
});
|
|
29
|
+
export const navigationItemSchema = navigationItemBaseSchema.extend({
|
|
30
|
+
items: z.lazy(() => navigationItemSchema.array().or(z.null())).optional(),
|
|
31
|
+
});
|
|
32
|
+
export const navigationSchema = z.object({
|
|
33
|
+
id: z.number(),
|
|
34
|
+
documentId: z.string(),
|
|
35
|
+
name: z.string(),
|
|
36
|
+
slug: z.string(),
|
|
37
|
+
localeCode: z.string(),
|
|
38
|
+
visible: z.boolean(),
|
|
39
|
+
items: z.array(navigationItemSchema),
|
|
40
|
+
});
|
|
41
|
+
const navigationCustomFieldBase = z.object({
|
|
42
|
+
name: z.string(),
|
|
43
|
+
label: z.string(),
|
|
44
|
+
required: z.boolean().optional(),
|
|
45
|
+
enabled: z.boolean().optional(),
|
|
46
|
+
});
|
|
47
|
+
const navigationItemCustomFieldSelect = navigationCustomFieldBase.extend({
|
|
48
|
+
type: z.literal('select'),
|
|
49
|
+
multi: z.boolean(),
|
|
50
|
+
options: z.array(z.string()),
|
|
51
|
+
});
|
|
52
|
+
const navigationItemCustomFieldPrimitive = navigationCustomFieldBase.extend({
|
|
53
|
+
type: z.enum(['boolean', 'string']),
|
|
54
|
+
multi: z.literal(false).optional(),
|
|
55
|
+
options: z.array(z.string()).max(0).optional(),
|
|
56
|
+
});
|
|
57
|
+
const navigationItemCustomFieldMedia = navigationCustomFieldBase.extend({
|
|
58
|
+
type: z.literal('media'),
|
|
59
|
+
multi: z.literal(false).optional(),
|
|
60
|
+
options: z.array(z.string()).max(0).optional(),
|
|
61
|
+
});
|
|
62
|
+
export const navigationItemCustomField = navigationItemCustomFieldPrimitive
|
|
63
|
+
.or(navigationItemCustomFieldMedia)
|
|
64
|
+
.or(navigationItemCustomFieldSelect);
|
|
65
|
+
export const navigationItemAdditionalField = z.union([
|
|
66
|
+
z.literal('audience'),
|
|
67
|
+
navigationItemCustomField,
|
|
68
|
+
]);
|
|
69
|
+
export const configContentTypeSchema = z.object({
|
|
70
|
+
uid: z.string(),
|
|
71
|
+
name: z.string(),
|
|
72
|
+
draftAndPublish: z.boolean(),
|
|
73
|
+
isSingle: z.boolean(),
|
|
74
|
+
description: z.string(),
|
|
75
|
+
collectionName: z.string(),
|
|
76
|
+
contentTypeName: z.string(),
|
|
77
|
+
label: z.string(),
|
|
78
|
+
labelSingular: z.string(),
|
|
79
|
+
endpoint: z.string(),
|
|
80
|
+
available: z.boolean(),
|
|
81
|
+
visible: z.boolean(),
|
|
82
|
+
});
|
|
83
|
+
export const configSchema = z.object({
|
|
84
|
+
additionalFields: z.array(navigationItemAdditionalField),
|
|
85
|
+
allowedLevels: z.number(),
|
|
86
|
+
availableAudience: z
|
|
87
|
+
.object({
|
|
88
|
+
id: z.number(),
|
|
89
|
+
name: z.string(),
|
|
90
|
+
key: z.string(),
|
|
91
|
+
})
|
|
92
|
+
.array(),
|
|
93
|
+
contentTypes: z.array(z.string()),
|
|
94
|
+
contentTypesNameFields: z.record(z.string(), z.array(z.string())),
|
|
95
|
+
contentTypesPopulate: z.record(z.string(), z.array(z.string())),
|
|
96
|
+
gql: z.object({
|
|
97
|
+
navigationItemRelated: z.array(z.string()),
|
|
98
|
+
}),
|
|
99
|
+
pathDefaultFields: z.record(z.string(), z.string().array()),
|
|
100
|
+
cascadeMenuAttached: z.boolean(),
|
|
101
|
+
preferCustomContentTypes: z.boolean(),
|
|
102
|
+
allowedContentTypes: z.string().array(),
|
|
103
|
+
restrictedContentTypes: z.string().array(),
|
|
104
|
+
isCacheEnabled: z.boolean().optional(),
|
|
105
|
+
isCachePluginEnabled: z.boolean().optional(),
|
|
106
|
+
});
|
|
107
|
+
export const configFromServerSchema = configSchema
|
|
108
|
+
.omit({
|
|
109
|
+
contentTypes: true,
|
|
110
|
+
})
|
|
111
|
+
.extend({
|
|
112
|
+
contentTypes: configContentTypeSchema.array(),
|
|
113
|
+
});
|
|
114
|
+
export const localeSchema = z.object({
|
|
115
|
+
defaultLocale: z.string(),
|
|
116
|
+
restLocale: z.string().array(),
|
|
117
|
+
});
|
|
118
|
+
export const contentType = z.enum(['collectionType', 'singleType']);
|
|
119
|
+
export const contentTypeInfo = z.object({
|
|
120
|
+
singularName: z.string(),
|
|
121
|
+
pluralName: z.string(),
|
|
122
|
+
displayName: z.string(),
|
|
123
|
+
description: z.string().optional(),
|
|
124
|
+
name: z.string().optional(),
|
|
125
|
+
});
|
|
126
|
+
export const contentTypeAttributeValidator = z.object({
|
|
127
|
+
required: z.boolean().optional(),
|
|
128
|
+
max: z.number().optional(),
|
|
129
|
+
min: z.number().optional(),
|
|
130
|
+
minLength: z.number().optional(),
|
|
131
|
+
maxLength: z.number().optional(),
|
|
132
|
+
private: z.boolean().optional(),
|
|
133
|
+
configurable: z.boolean().optional(),
|
|
134
|
+
default: z.any().optional(),
|
|
135
|
+
});
|
|
136
|
+
export const contentTypeFieldTypeSchema = z.enum([
|
|
137
|
+
'string',
|
|
138
|
+
'text',
|
|
139
|
+
'richtext',
|
|
140
|
+
'blocks',
|
|
141
|
+
'email',
|
|
142
|
+
'password',
|
|
143
|
+
'date',
|
|
144
|
+
'time',
|
|
145
|
+
'datetime',
|
|
146
|
+
'timestamp',
|
|
147
|
+
'boolean',
|
|
148
|
+
'integer',
|
|
149
|
+
'biginteger',
|
|
150
|
+
'float',
|
|
151
|
+
'decimal',
|
|
152
|
+
'json',
|
|
153
|
+
'relation',
|
|
154
|
+
]);
|
|
155
|
+
export const simpleContentTypeAttribute = contentTypeAttributeValidator.extend({
|
|
156
|
+
type: contentTypeFieldTypeSchema,
|
|
157
|
+
});
|
|
158
|
+
export const contentTypeEnumerationAttribute = contentTypeAttributeValidator.extend({
|
|
159
|
+
type: z.literal('enumeration'),
|
|
160
|
+
enum: z.string().array(),
|
|
161
|
+
});
|
|
162
|
+
export const contentTypeComponentAttribute = z.object({
|
|
163
|
+
type: z.literal('component'),
|
|
164
|
+
component: z.string(),
|
|
165
|
+
repeatable: z.boolean().optional(),
|
|
166
|
+
});
|
|
167
|
+
export const contentTypeDynamicZoneAttribute = z.object({
|
|
168
|
+
type: z.literal('dynamiczone'),
|
|
169
|
+
components: z.string().array(),
|
|
170
|
+
});
|
|
171
|
+
export const contentTypeMediaAttribute = z.object({
|
|
172
|
+
media: z.literal('media'),
|
|
173
|
+
allowedTypes: z.enum(['images', 'videos', 'files']).array(),
|
|
174
|
+
required: z.boolean().optional(),
|
|
175
|
+
});
|
|
176
|
+
export const contentTypeRelationType = z.enum([
|
|
177
|
+
'oneToOne',
|
|
178
|
+
'oneToMany',
|
|
179
|
+
'manyToOne',
|
|
180
|
+
'manyToMany',
|
|
181
|
+
'morphToMany',
|
|
182
|
+
'manyToMorph',
|
|
183
|
+
]);
|
|
184
|
+
export const contentTypeRelationAttribute = z.object({
|
|
185
|
+
type: z.literal('relation'),
|
|
186
|
+
relation: contentTypeRelationType,
|
|
187
|
+
target: z.string(),
|
|
188
|
+
mappedBy: z.string().optional(),
|
|
189
|
+
inversedBy: z.string().optional(),
|
|
190
|
+
});
|
|
191
|
+
export const contentTypeAttributes = z.record(z.string(), z.union([
|
|
192
|
+
simpleContentTypeAttribute,
|
|
193
|
+
contentTypeEnumerationAttribute,
|
|
194
|
+
contentTypeComponentAttribute,
|
|
195
|
+
contentTypeDynamicZoneAttribute,
|
|
196
|
+
contentTypeRelationAttribute,
|
|
197
|
+
contentTypeMediaAttribute,
|
|
198
|
+
]));
|
|
199
|
+
export const contentTypeFullSchema = z.object({
|
|
200
|
+
kind: contentType,
|
|
201
|
+
collectionName: z.string(),
|
|
202
|
+
info: contentTypeInfo,
|
|
203
|
+
options: z
|
|
204
|
+
.object({
|
|
205
|
+
draftAndPublish: z.boolean().optional(),
|
|
206
|
+
hidden: z.boolean().optional(),
|
|
207
|
+
templateName: z.string().optional(),
|
|
208
|
+
})
|
|
209
|
+
.optional(),
|
|
210
|
+
attributes: contentTypeAttributes,
|
|
211
|
+
actions: z.record(z.string(), z.any()).optional(),
|
|
212
|
+
lifecycles: z.record(z.string(), z.any()).optional(),
|
|
213
|
+
uid: z.string(),
|
|
214
|
+
apiName: z.string().optional(),
|
|
215
|
+
// TODO?: remove
|
|
216
|
+
associations: z
|
|
217
|
+
.object({
|
|
218
|
+
model: z.string(),
|
|
219
|
+
alias: z.string(),
|
|
220
|
+
})
|
|
221
|
+
.array()
|
|
222
|
+
.optional(),
|
|
223
|
+
modelName: z.string().optional(),
|
|
224
|
+
plugin: z.string().optional(),
|
|
225
|
+
pluginOptions: z.record(z.string(), z.any()).optional(),
|
|
226
|
+
isSingle: z.boolean().optional(),
|
|
227
|
+
});
|
|
228
|
+
export const contentTypeSchema = contentTypeFullSchema.pick({
|
|
229
|
+
info: true,
|
|
230
|
+
kind: true,
|
|
231
|
+
attributes: true,
|
|
232
|
+
options: true,
|
|
233
|
+
});
|
|
234
|
+
export const strapiContentTypeItemSchema = z
|
|
235
|
+
.object({
|
|
236
|
+
id: z.number(),
|
|
237
|
+
locale: z.string().optional(),
|
|
238
|
+
})
|
|
239
|
+
.and(z.record(z.string(), z.any()));
|
|
240
|
+
export const slugifyResult = z.object({ slug: z.string() });
|
|
241
|
+
export const i18nCopyItemDetails = z.object({
|
|
242
|
+
externalPath: z.string().or(z.null()).optional(),
|
|
243
|
+
path: z.string().or(z.null()).optional(),
|
|
244
|
+
related: z.string().or(z.null()).optional(),
|
|
245
|
+
title: z.string(),
|
|
246
|
+
type: navigationItemTypeSchema,
|
|
247
|
+
uiRouterKey: z.string(),
|
|
248
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Entity Details
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
import { Button, Dialog, Flex, Typography } from '@strapi/design-system';
|
|
8
|
+
import { Check, WarningCircle } from '@strapi/icons';
|
|
9
|
+
import { useIntl } from 'react-intl';
|
|
10
|
+
import { getTrad } from '../../translations';
|
|
11
|
+
const DEFAULT_ICON = _jsx(WarningCircle, {});
|
|
12
|
+
export const ConfirmationDialog = ({ isVisible = false, isActionAsync = false, children, onConfirm, onCancel, header, labelCancel, labelConfirm, iconConfirm, mainIcon = DEFAULT_ICON, }) => {
|
|
13
|
+
const { formatMessage } = useIntl();
|
|
14
|
+
return isVisible ? (_jsx(Dialog.Root, { open: isVisible, onOpenChange: (isOpen) => {
|
|
15
|
+
if (!isOpen && isVisible) {
|
|
16
|
+
onCancel?.(undefined);
|
|
17
|
+
}
|
|
18
|
+
}, title: header || formatMessage(getTrad('components.confirmation.dialog.header', 'Confirmation')), children: _jsxs(Dialog.Content, { children: [_jsx(Dialog.Body, { icon: mainIcon, children: _jsx(Flex, { justifyContent: "center", children: _jsx(Typography, { id: "dialog-confirm-description", children: children || formatMessage(getTrad('components.confirmation.dialog.description')) }) }) }), _jsxs(Dialog.Footer, { children: [_jsx(Dialog.Cancel, { children: _jsx(Button, { fullWidth: true, onClick: onCancel, variant: "tertiary", disabled: isActionAsync, children: labelCancel ||
|
|
19
|
+
formatMessage(getTrad('components.confirmation.dialog.button.cancel', 'Cancel')) }) }), _jsx(Button, { fullWidth: true, onClick: onConfirm, variant: "danger-light", startIcon: iconConfirm || _jsx(Check, {}), disabled: isActionAsync, children: labelConfirm ||
|
|
20
|
+
formatMessage(getTrad('components.confirmation.dialog.button.confirm', 'Confirm')) })] })] }) })) : null;
|
|
21
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { PLUGIN_ID } from '../pluginId';
|
|
3
|
+
const Initializer = ({ setPlugin }) => {
|
|
4
|
+
const ref = useRef(setPlugin);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
ref.current?.(PLUGIN_ID);
|
|
7
|
+
}, []);
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
export { Initializer };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextInput } from '@strapi/design-system';
|
|
3
|
+
import { isArray } from 'lodash';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
const TextArrayInput = ({ onChange, initialValue, ...props }) => {
|
|
6
|
+
const [value, setValue] = useState(isArray(initialValue) ? initialValue.reduce((acc, cur) => `${acc}${cur}; `, '') : '');
|
|
7
|
+
const handleOnChange = ({ target: { value } }) => {
|
|
8
|
+
const newValue = value;
|
|
9
|
+
const valuesArray = newValue
|
|
10
|
+
.split(';')
|
|
11
|
+
.map((v) => v.trim())
|
|
12
|
+
.filter((v) => !!v.length);
|
|
13
|
+
setValue(value);
|
|
14
|
+
onChange(valuesArray);
|
|
15
|
+
};
|
|
16
|
+
return _jsx(TextInput, { ...props, onChange: handleOnChange, value: value });
|
|
17
|
+
};
|
|
18
|
+
export default TextArrayInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './navigation';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
const initSize = 92;
|
|
4
|
+
const NavigationIconSvg = styled.svg `
|
|
5
|
+
path {
|
|
6
|
+
fill: ${({ theme }) => theme.colors.neutral500};
|
|
7
|
+
}
|
|
8
|
+
`;
|
|
9
|
+
export const NavigationIcon = ({ width = 24, height = 24 }) => (_jsx(NavigationIconSvg, { viewBox: `0px 0px ${width}px ${height}px`, xmlns: "http://www.w3.org/2000/svg", height: height, width: width, children: _jsx("g", { style: { transform: `scale(${width / initSize})` }, children: _jsx("path", { d: "M78,23.5H14c-3.6,0-6.5-2.9-6.5-6.5s2.9-6.5,6.5-6.5h64c3.6,0,6.5,2.9,6.5,6.5S81.6,23.5,78,23.5z M84.5,46\n c0-3.6-2.9-6.5-6.5-6.5H14c-3.6,0-6.5,2.9-6.5,6.5s2.9,6.5,6.5,6.5h64C81.6,52.5,84.5,49.6,84.5,46z M84.5,75c0-3.6-2.9-6.5-6.5-6.5\n H14c-3.6,0-6.5,2.9-6.5,6.5s2.9,6.5,6.5,6.5h64C81.6,81.5,84.5,78.6,84.5,75z" }) }) }));
|