UNPKG

@automattic/calypso-products

Version:

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

21 lines 850 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPlanSlugForTermVariant = getPlanSlugForTermVariant; const plans_list_1 = require("./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 */ function getPlanSlugForTermVariant(slug, planTerm) { const plan = plans_list_1.PLANS_LIST[slug]; if (plan) { return Object.values(plans_list_1.PLANS_LIST) .filter(({ type }) => type === plan.type) .find(({ term }) => term === planTerm) ?.getStoreSlug(); } return undefined; } //# sourceMappingURL=get-plan-term-variant.js.map