diff --git a/packages/core/admin/admin/src/pages/Settings/components/SettingsNav.tsx b/packages/core/admin/admin/src/pages/Settings/components/SettingsNav.tsx index 68c85cee65..1a8b9fdee2 100644 --- a/packages/core/admin/admin/src/pages/Settings/components/SettingsNav.tsx +++ b/packages/core/admin/admin/src/pages/Settings/components/SettingsNav.tsx @@ -4,6 +4,7 @@ import { useIntl } from 'react-intl'; import { useLocation } from 'react-router-dom'; import { styled } from 'styled-components'; +import { useLicenseLimits } from '../../../../../ee/admin/src/hooks/useLicenseLimits'; import { SubNav } from '../../../components/SubNav'; import { useTracking } from '../../../features/Tracking'; import { SettingsMenu } from '../../../hooks/useSettingsMenu'; @@ -22,6 +23,17 @@ const SettingsNav = ({ menu }: SettingsNavProps) => { const { formatMessage } = useIntl(); const { trackUsage } = useTracking(); const { pathname } = useLocation(); + const { license } = useLicenseLimits(); + + const availableFeatureNames = license?.features.map((feature) => feature.name); + + const linksIdsToLicenseFeaturesNames = { + 'content-releases': 'cms-content-releases', + 'review-workflows': 'review-workflows', + sso: 'sso', + auditLogs: 'audit-logs', + 'auditLogs-purchase-page': 'audit-logs', + }; const filteredMenu = menu.filter( (section) => !section.links.every((link) => link.isDisplayed === false) @@ -67,7 +79,19 @@ const SettingsNav = ({ menu }: SettingsNavProps) => { endAction={ <> {link?.licenseOnly && ( - + )} {link?.hasNotification && ( ({ + useLicenseLimits: jest.fn(() => ({ + license: { + features: [], + }, + })), +})); + const menu = [ { id: 'global', diff --git a/packages/core/admin/admin/src/pages/Settings/tests/SettingsPage.test.tsx b/packages/core/admin/admin/src/pages/Settings/tests/SettingsPage.test.tsx index 888e7dddad..1046842674 100644 --- a/packages/core/admin/admin/src/pages/Settings/tests/SettingsPage.test.tsx +++ b/packages/core/admin/admin/src/pages/Settings/tests/SettingsPage.test.tsx @@ -8,6 +8,14 @@ import { Layout } from '../Layout'; jest.mock('../../../hooks/useSettingsMenu'); +jest.mock('../../../../../ee/admin/src/hooks/useLicenseLimits', () => ({ + useLicenseLimits: jest.fn(() => ({ + license: { + features: [], + }, + })), +})); + const LocationDisplay = () => { const location = useLocation(); diff --git a/packages/core/admin/ee/admin/src/constants.ts b/packages/core/admin/ee/admin/src/constants.ts index 4d9469f69b..03f99b44b7 100644 --- a/packages/core/admin/ee/admin/src/constants.ts +++ b/packages/core/admin/ee/admin/src/constants.ts @@ -72,6 +72,7 @@ export const SETTINGS_LINKS_EE = (): SettingsMenu => ({ intlLabel: { id: 'Settings.sso.title', defaultMessage: 'Single Sign-On' }, to: '/settings/single-sign-on', id: 'sso', + licenseOnly: true, }, ] : []), @@ -84,6 +85,7 @@ export const SETTINGS_LINKS_EE = (): SettingsMenu => ({ intlLabel: { id: 'global.auditLogs', defaultMessage: 'Audit Logs' }, to: '/settings/audit-logs?pageSize=50&page=1&sort=date:DESC', id: 'auditLogs', + licenseOnly: true, }, ] : []), diff --git a/packages/core/content-releases/admin/src/index.ts b/packages/core/content-releases/admin/src/index.ts index b96968c6ec..628b1b6197 100644 --- a/packages/core/content-releases/admin/src/index.ts +++ b/packages/core/content-releases/admin/src/index.ts @@ -67,6 +67,7 @@ const admin: Plugin.Config.AdminInput = { id: `${pluginId}.plugin.name`, defaultMessage: 'Releases', }, + licenseOnly: true, permissions: [], async Component() { const { ProtectedReleasesSettingsPage } = await import('./pages/ReleasesSettingsPage'); diff --git a/packages/core/review-workflows/admin/src/index.ts b/packages/core/review-workflows/admin/src/index.ts index 2aa2277211..c2101bfa28 100644 --- a/packages/core/review-workflows/admin/src/index.ts +++ b/packages/core/review-workflows/admin/src/index.ts @@ -30,6 +30,7 @@ const admin: Plugin.Config.AdminInput = { id: `${PLUGIN_ID}.plugin.name`, defaultMessage: 'Review Workflows', }, + licenseOnly: true, permissions: [], async Component() { const { Router } = await import('./router');