Handled named plan values in portal_plans setting

refs https://github.com/TryGhost/Team/issues/753

We reverted back to using named plan values - `monthly`, `yearly` - in `portal_plans` setting to allow us to easily handle active prices for a product. This change handles the updated values in `portal_plans` to use new values.
This commit is contained in:
Rishabh 2021-06-04 13:29:22 +05:30
parent f790cb47ef
commit 0f4be436be
2 changed files with 9 additions and 3 deletions

View File

@ -115,7 +115,7 @@ export const site = {
is_stripe_configured: true,
portal_button: true,
portal_name: true,
portal_plans: ['free', ...priceIds],
portal_plans: ['free', 'monthly', 'yearly'],
portal_button_icon: 'icon-1',
portal_button_signup_text: 'Subscribe now',
portal_button_style: 'icon-and-text',
@ -266,5 +266,5 @@ export const member = {
export const testSite = {
...site,
allow_self_signup: true,
portal_plans: ['free', ...priceIds]
portal_plans: ['free', 'monthly', 'yearly']
};

View File

@ -219,7 +219,13 @@ export function getSitePrices({site = {}, includeFree = true, pageQuery = ''} =
}).filter((price) => {
return price.amount !== 0 && price.type === 'recurring';
}).filter((price) => {
return (portalPlans || []).includes(price.price_id);
if (price.interval === 'month') {
return (portalPlans || []).includes('monthly');
}
if (price.interval === 'year') {
return (portalPlans || []).includes('yearly');
}
return false;
}).sort((a, b) => {
return a.amount - b.amount;
}).sort((a, b) => {