@automattic/calypso-products
Version:
This module contains information about the various products sold within calypso, such as product slugs, plan intervals, etc.
18 lines • 743 B
JavaScript
import { PLANS_LIST } from './plans-list';
/**
* Return all the variants requested related to a given plan
* @param {PlanSlug} slug Slug/name of the plan to get the variants from
* @param {typeof TERMS_LIST[ number ][]} planTerms The terms to find a variant for
* @returns {PlanSlug[]} Slugs of the term-variant plan
*/
export function getPlanMultipleTermsVariantSlugs(slug, planTerms) {
const plan = PLANS_LIST[slug];
if (plan) {
return Object.values(PLANS_LIST)
.filter(({ type }) => type === plan.type)
.filter(({ term }) => planTerms.includes(term))
.map(({ getStoreSlug }) => getStoreSlug());
}
return [];
}
//# sourceMappingURL=get-plan-multiple-terms-variant-slugs.js.map