UNPKG

@automattic/calypso-products

Version:

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

17 lines 657 B
import { TERM_ANNUALLY } from './constants'; import { PRODUCTS_LIST } from './products-list'; /** * Return the yearly variant of a product * @param {ProductSlug} productSlug Slug of the product to get the yearly variant from * @returns {string} Slug of the yearly variant */ export function getProductYearlyVariant(productSlug) { const product = PRODUCTS_LIST[productSlug]; if (product) { return Object.values(PRODUCTS_LIST) .filter(({ type }) => type === product.type) .find(({ term }) => TERM_ANNUALLY === term)?.product_slug; } return undefined; } //# sourceMappingURL=get-product-yearly-variant.js.map