From 545cf8c258ba1ba5a7e90b93912bfb8a14aba73e Mon Sep 17 00:00:00 2001 From: Sag Date: Tue, 5 Dec 2023 15:05:16 -0300 Subject: [PATCH] Updated logic to allow a different name for the free tier (#19229) fixes PROD-69 --- .../settings/membership/portal/SignupOptions.tsx | 2 +- .../settings/membership/tiers/TierDetailModal.tsx | 5 ++++- apps/portal/src/utils/helpers.js | 8 +++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/admin-x-settings/src/components/settings/membership/portal/SignupOptions.tsx b/apps/admin-x-settings/src/components/settings/membership/portal/SignupOptions.tsx index 3e4425ff14..2f7614467e 100644 --- a/apps/admin-x-settings/src/components/settings/membership/portal/SignupOptions.tsx +++ b/apps/admin-x-settings/src/components/settings/membership/portal/SignupOptions.tsx @@ -61,7 +61,7 @@ const SignupOptions: React.FC<{ if (localTiers) { localTiers.forEach((tier) => { - if (tier.name === 'Free') { + if (tier.type === 'free') { tiersCheckboxes.push({ checked: (portalPlans.includes('free')), disabled: isDisabled, diff --git a/apps/admin-x-settings/src/components/settings/membership/tiers/TierDetailModal.tsx b/apps/admin-x-settings/src/components/settings/membership/tiers/TierDetailModal.tsx index 8fe1b042cc..6449b3b32c 100644 --- a/apps/admin-x-settings/src/components/settings/membership/tiers/TierDetailModal.tsx +++ b/apps/admin-x-settings/src/components/settings/membership/tiers/TierDetailModal.tsx @@ -1,6 +1,7 @@ import NiceModal, {useModal} from '@ebay/nice-modal-react'; import React, {useEffect, useRef} from 'react'; import TierDetailPreview from './TierDetailPreview'; +import useFeatureFlag from '../../../../hooks/useFeatureFlag'; import useSettingGroup from '../../../../hooks/useSettingGroup'; import {Button, ButtonProps, ConfirmationModal, CurrencyField, Form, Heading, Icon, Modal, Select, SortableList, TextField, Toggle, URLTextField, showToast, useSortableIndexedList} from '@tryghost/admin-x-design-system'; import {ErrorMessages, useForm, useHandleError} from '@tryghost/admin-x-framework/hooks'; @@ -25,6 +26,8 @@ const TierDetailModalContent: React.FC<{tier?: Tier}> = ({tier}) => { const handleError = useHandleError(); const {localSettings, siteData} = useSettingGroup(); const siteTitle = getSettingValues(localSettings, ['title']) as string[]; + const hasPortalImprovements = useFeatureFlag('portalImprovements'); + const allowNameChange = !isFreeTier || hasPortalImprovements; const validators: {[key in keyof Tier]?: () => string | undefined} = { name: () => (formState.name ? undefined : 'You must specify a name'), @@ -189,7 +192,7 @@ const TierDetailModalContent: React.FC<{tier?: Tier}> = ({tier}) => {
- {!isFreeTier &&