Updated logic to allow a different name for the free tier (#19229)
fixes PROD-69
This commit is contained in:
parent
96841a5060
commit
545cf8c258
@ -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,
|
||||
|
@ -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}) => {
|
||||
<div className='-mb-8 mt-8 flex items-start gap-8'>
|
||||
<div className='flex grow flex-col gap-8'>
|
||||
<Form marginBottom={false} title='Basic' grouped>
|
||||
{!isFreeTier && <TextField
|
||||
{allowNameChange && <TextField
|
||||
autoComplete='off'
|
||||
error={Boolean(errors.name)}
|
||||
hint={errors.name}
|
||||
|
@ -450,11 +450,13 @@ export function getFreeProductBenefits({site}) {
|
||||
}
|
||||
|
||||
export function getFreeTierTitle({site}) {
|
||||
if (hasOnlyFreeProduct({site})) {
|
||||
const freeProduct = getFreeProduct({site});
|
||||
|
||||
if (freeProduct?.name === 'Free' && hasOnlyFreeProduct({site})) {
|
||||
return 'Free membership';
|
||||
} else {
|
||||
return 'Free';
|
||||
}
|
||||
|
||||
return freeProduct?.name || 'Free';
|
||||
}
|
||||
|
||||
export function getFreeTierDescription({site}) {
|
||||
|
Loading…
Reference in New Issue
Block a user