@automattic/calypso-products
Version:
This module contains information about the various products sold within calypso, such as product slugs, plan intervals, etc.
13 lines (10 loc) • 481 B
text/typescript
import { JETPACK_MONTHLY_PLANS, PLAN_MONTHLY_PERIOD, WPCOM_MONTHLY_PLANS } from './constants';
export function isMonthlyProduct( product: { bill_period: string | number } ): boolean {
return parseInt( String( product.bill_period ), 10 ) === PLAN_MONTHLY_PERIOD;
}
export function isMonthly( plan: string ): boolean {
return (
( WPCOM_MONTHLY_PLANS as ReadonlyArray< string > ).includes( plan ) ||
( JETPACK_MONTHLY_PLANS as ReadonlyArray< string > ).includes( plan )
);
}