From 5ddd90a2446b02fd6cf04ddf2b5d0757efffb40d Mon Sep 17 00:00:00 2001 From: Sag Date: Wed, 17 Jan 2024 16:08:15 +0100 Subject: [PATCH] Updated Portal settings to render paid plans options only when relevant (#19507) fixes PROD-300 - hides "Prices available at signup" and "Price preselected at signup" options in Portal settings, if no paid tier is active/visible --- .../settings/membership/portal/SignupOptions.tsx | 12 +++++++----- 1 file changed, 7 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 eb2e4faa37..f56499ca7e 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 @@ -99,15 +99,15 @@ const SignupOptions: React.FC<{ }); } - const paidActiveTiersResult = getPaidActiveTiers(localTiers) || []; + const paidActiveTiers = getPaidActiveTiers(localTiers) || []; const defaultPlanOptions: SelectOption[] = [ {value: 'yearly', label: 'Yearly'}, {value: 'monthly', label: 'Monthly'} ]; - if (paidActiveTiersResult.length > 0 && isStripeEnabled) { - paidActiveTiersResult.forEach((tier) => { + if (isStripeEnabled && paidActiveTiers.length > 0) { + paidActiveTiers.forEach((tier) => { tiersCheckboxes.push({ checked: (tier.visibility === 'public'), label: tier.name, @@ -117,6 +117,8 @@ const SignupOptions: React.FC<{ }); } + const arePaidTiersVisible = isStripeEnabled && paidActiveTiers.length > 0 && paidActiveTiers.some(tier => tier.visibility === 'public'); + return
- {isStripeEnabled && localTiers.some(tier => tier.visibility === 'public') && ( + {arePaidTiersVisible && ( <> - {(hasPortalImprovements && (portalPlans.includes('yearly') && portalPlans.includes('monthly'))) && + {(hasPortalImprovements && portalPlans.includes('yearly') && portalPlans.includes('monthly')) &&