diff --git a/apps/admin-x-settings/src/components/Sidebar.tsx b/apps/admin-x-settings/src/components/Sidebar.tsx index 9d60c1e050..0529266a0c 100644 --- a/apps/admin-x-settings/src/components/Sidebar.tsx +++ b/apps/admin-x-settings/src/components/Sidebar.tsx @@ -4,6 +4,7 @@ import clsx from 'clsx'; import useFeatureFlag from '../hooks/useFeatureFlag'; import {Button, Icon, SettingNavItem, SettingNavItemProps, SettingNavSection, TextField, useFocusContext} from '@tryghost/admin-x-design-system'; import {searchKeywords as advancedSearchKeywords} from './settings/advanced/AdvancedSettings'; +import {checkStripeEnabled} from '@tryghost/admin-x-framework/api/settings'; import {searchKeywords as emailSearchKeywords} from './settings/email/EmailSettings'; import {searchKeywords as generalSearchKeywords} from './settings/general/GeneralSettings'; import {getSettingValues} from '@tryghost/admin-x-framework/api/settings'; @@ -35,7 +36,7 @@ const Sidebar: React.FC = () => { const {updateRoute} = useRouting(); const searchInputRef = useRef(null); const {isAnyTextFieldFocused} = useFocusContext(); - const hasOffers = useFeatureFlag('adminXOffers'); + const hasOffersLabs = useFeatureFlag('adminXOffers'); // Focus in on search field when pressing "/" useEffect(() => { @@ -67,6 +68,7 @@ const Sidebar: React.FC = () => { const {settings, config} = useGlobalData(); const [newslettersEnabled] = getSettingValues(settings, ['editor_default_email_recipients']) as [string]; + const hasStripeEnabled = checkStripeEnabled(settings || [], config || {}); const handleSectionClick = (e?: React.MouseEvent) => { if (e) { @@ -128,7 +130,7 @@ const Sidebar: React.FC = () => { {hasRecommendations && } - {hasOffers && } + {hasOffersLabs && hasStripeEnabled && } {hasTipsAndDonations && } diff --git a/apps/admin-x-settings/src/components/settings/growth/GrowthSettings.tsx b/apps/admin-x-settings/src/components/settings/growth/GrowthSettings.tsx index c1e7f48ec1..7b704ff768 100644 --- a/apps/admin-x-settings/src/components/settings/growth/GrowthSettings.tsx +++ b/apps/admin-x-settings/src/components/settings/growth/GrowthSettings.tsx @@ -5,6 +5,8 @@ import Recommendations from './Recommendations'; import SearchableSection from '../../SearchableSection'; import TipsOrDonations from './TipsOrDonations'; import useFeatureFlag from '../../../hooks/useFeatureFlag'; +import {checkStripeEnabled} from '@tryghost/admin-x-framework/api/settings'; +import {useGlobalData} from '../../providers/GlobalDataProvider'; export const searchKeywords = { tips: ['growth', 'tip', 'donation', 'one time', 'payment'], @@ -16,13 +18,15 @@ export const searchKeywords = { const GrowthSettings: React.FC = () => { const hasTipsAndDonations = useFeatureFlag('tipsAndDonations'); const hasRecommendations = useFeatureFlag('recommendations'); - const hasOffers = useFeatureFlag('adminXOffers'); + const hasOffersLabs = useFeatureFlag('adminXOffers'); + const {config, settings} = useGlobalData(); + const hasStripeEnabled = checkStripeEnabled(settings || [], config || {}); return ( {hasRecommendations && } - {hasOffers && } + {hasOffersLabs && hasStripeEnabled && } {hasTipsAndDonations && } );