From 9f154dbcd227c964e8cc0405c4dbe3197f3ff008 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Fri, 7 May 2021 22:53:44 +0530 Subject: [PATCH] Added free price details handling refs https://github.com/TryGhost/Team/issues/637 Since we allow setting custom name and description for free price now, this wires up the values for free membership price settings to API --- ghost/portal/src/components/common/PlansSection.js | 8 ++++++-- ghost/portal/src/utils/fixtures.js | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ghost/portal/src/components/common/PlansSection.js b/ghost/portal/src/components/common/PlansSection.js index 52542ea683..8f4c2fc7e8 100644 --- a/ghost/portal/src/components/common/PlansSection.js +++ b/ghost/portal/src/components/common/PlansSection.js @@ -1,4 +1,5 @@ -import React from 'react'; +import React, { useContext } from 'react'; +import AppContext from '../../AppContext'; import {isCookiesDisabled, formatNumber, hasOnlyFreePlan} from '../../utils/helpers'; export const PlanSectionStyles = ` @@ -345,6 +346,8 @@ function PriceLabel({currencySymbol, price}) { } function PlanOptions({plans, selectedPlan, onPlanSelect, changePlan}) { + const {site} = useContext(AppContext); + const {free_price_name: freePriceName, free_price_description: freePriceDescription} = site; return plans.map(({name, currency_symbol: currencySymbol, price, description, id}) => { const isChecked = selectedPlan === id; const classes = (isChecked ? 'gh-portal-plan-section checked' : 'gh-portal-plan-section'); @@ -352,7 +355,8 @@ function PlanOptions({plans, selectedPlan, onPlanSelect, changePlan}) { let displayName = name; switch (name) { case 'Free': - planDetails.feature = 'Free preview'; + displayName = freePriceName || name; + planDetails.feature = freePriceDescription || 'Free preview'; break; default: planDetails.feature = description || 'Full access'; diff --git a/ghost/portal/src/utils/fixtures.js b/ghost/portal/src/utils/fixtures.js index 2a823f9436..4f219f2762 100644 --- a/ghost/portal/src/utils/fixtures.js +++ b/ghost/portal/src/utils/fixtures.js @@ -110,6 +110,8 @@ export const site = { prices: prices, allow_self_signup: true, members_signup_access: 'all', + free_price_name: 'Free', + free_price_description: 'Free Preview', is_stripe_configured: true, portal_button: true, portal_name: true,