@automattic/calypso-products
Version:
This module contains information about the various products sold within calypso, such as product slugs, plan intervals, etc.
20 lines • 832 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getProductYearlyVariant = getProductYearlyVariant;
const constants_1 = require("./constants");
const products_list_1 = require("./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
*/
function getProductYearlyVariant(productSlug) {
const product = products_list_1.PRODUCTS_LIST[productSlug];
if (product) {
return Object.values(products_list_1.PRODUCTS_LIST)
.filter(({ type }) => type === product.type)
.find(({ term }) => constants_1.TERM_ANNUALLY === term)?.product_slug;
}
return undefined;
}
//# sourceMappingURL=get-product-yearly-variant.js.map