UNPKG

@automattic/calypso-products

Version:

This module contains information about the various products sold within calypso, such as product slugs, plan intervals, etc.

18 lines 688 B
import { PLANS_LIST } from './plans-list'; /** * Return a (monthly/yealry/2yearly/etc) variant of a plan * @param {PlanSlug} slug Slug/name of the plan to get the yearly variant from * @param {typeof TERMS_LIST[ number ]} planTerm The term to find a variant for * @returns {PlanSlug} Slug of the term-variant plan */ export function getPlanSlugForTermVariant(slug, planTerm) { const plan = PLANS_LIST[slug]; if (plan) { return Object.values(PLANS_LIST) .filter(({ type }) => type === plan.type) .find(({ term }) => term === planTerm) ?.getStoreSlug(); } return undefined; } //# sourceMappingURL=get-plan-term-variant.js.map