import { getPlanClass, isWpcomEnterpriseGridPlan } from '@automattic/calypso-products'; import { FoldableCard } from '@automattic/components'; import clsx from 'clsx'; import { useTranslate } from 'i18n-calypso'; import { usePlansGridContext } from '../../grid-context'; import { GridPlan } from '../../types'; import { PlanFeaturesItem } from '../item'; import PlanDivOrTdContainer from '../plan-div-td-container'; import { ALL_ENTERPRISE_LOGO_SLUGS } from '../shared/header-price'; import ClientLogoList from './client-logo-list'; type EnterpriseFeaturesProps = { renderedGridPlans: GridPlan[]; options?: { isTableCell?: boolean; isLogosOnly?: boolean; }; }; const EnterpriseFeatures = ( { renderedGridPlans, options }: EnterpriseFeaturesProps ) => { const { featureGroupMap, enableCategorisedFeatures, enterpriseFeaturesList, isEnterpriseA4AIndia, } = usePlansGridContext(); const translate = useTranslate(); const isTableCell = options?.isTableCell; const CardContainer = ( props: React.ComponentProps< typeof FoldableCard > ) => { const { children, className, ...otherProps } = props; return isTableCell ? (
{ children }
) : ( { children } ); }; return renderedGridPlans.map( ( { planSlug, features: { wpcomFeatures, jetpackFeatures } } ) => { const planClassName = getPlanClass( planSlug ); const shouldRenderLogos = isWpcomEnterpriseGridPlan( planSlug ); const shouldCoverFullColumn = ( wpcomFeatures.length === 0 && jetpackFeatures.length === 0 ) || enableCategorisedFeatures; const rowspanProp = isTableCell && shouldRenderLogos ? { ...( shouldCoverFullColumn && { /** * The rowSpan should be: * - the number of feature groups + 2 (1 this row + 1 row of storage) in case of feature categories, * - otherwise: 4 (1 this row + 1 row of features + 1 row of storage + 1 row for the "everything in ... plus" part) */ rowSpan: enableCategorisedFeatures ? Object.values( featureGroupMap ).length + 2 : 4, } ), } : {}; return ( { shouldRenderLogos && isEnterpriseA4AIndia && (
) } { shouldRenderLogos && ! options?.isLogosOnly && (
{ translate( 'High performance platform, with:' ) }
{ enterpriseFeaturesList?.map( ( title, index ) => ( { title } ) ) }
) }
); } ); }; export default EnterpriseFeatures;