import { getPlanClass, FEATURE_GROUP_ESSENTIAL_FEATURES, FEATURE_GROUP_PAYMENT_TRANSACTION_FEES, getPlans, FEATURE_AI_WRITER_DESIGNER, FEATURE_AI_WRITER_DESIGNER_LIMITED, FEATURE_GUIDED_WEBSITE_BUILDER, FEATURE_GUIDED_WEBSITE_BUILDER_LIMITED, FEATURE_REALTIME_BACKUPS_JP, } from '@automattic/calypso-products'; import { Gridicon, JetpackLogo } from '@automattic/components'; import { AddOns } from '@automattic/data-stores'; import { css } from '@emotion/react'; import styled from '@emotion/styled'; import { useRef, useMemo } from '@wordpress/element'; import { Icon, chevronRightSmall } from '@wordpress/icons'; import clsx from 'clsx'; import { useTranslate } from 'i18n-calypso'; import { useState, useCallback, useEffect, ChangeEvent, Dispatch, SetStateAction, forwardRef, } from 'react'; import { useInView } from 'react-intersection-observer'; import { plansGridMediumLarge } from '../../css-mixins'; import PlansGridContextProvider, { usePlansGridContext } from '../../grid-context'; import useGridSize from '../../hooks/use-grid-size'; import useHighlightAdjacencyMatrix from '../../hooks/use-highlight-adjacency-matrix'; import { useManageTooltipToggle } from '../../hooks/use-manage-tooltip-toggle'; import { useVisibleGridPlans } from '../../hooks/use-visible-grid-plans'; import filterUnusedFeaturesObject from '../../lib/filter-unused-features-object'; import getPlanFeaturesObject from '../../lib/get-plan-features-object'; import PlanTypeSelector from '../plan-type-selector'; import { Plans2023Tooltip } from '../plans-2023-tooltip'; import PopularBadge from '../popular-badge'; import ActionButton from '../shared/action-button'; import BillingTimeframe from '../shared/billing-timeframe'; import HeaderPrice from '../shared/header-price'; import HeaderPriceContextProvider from '../shared/header-price/header-price-context'; import { PlanStorage } from '../shared/storage'; import { StickyContainer } from '../sticky-container'; import type { GridPlan, ComparisonGridExternalProps, ComparisonGridProps, PlanActionOverrides, TransformedFeatureObject, PlanTypeSelectorProps, GridSize, } from '../../types'; import type { FeatureObject, Feature, FeatureGroup, PlanSlug, FeatureGroupMap, } from '@automattic/calypso-products'; import './style.scss'; // Plans Differentiators Experiment: treat feature variants (e.g., _LIMITED) as the same row const FEATURE_ALIASES: Record< string, string[] > = { [ FEATURE_AI_WRITER_DESIGNER ]: [ FEATURE_AI_WRITER_DESIGNER_LIMITED ], [ FEATURE_GUIDED_WEBSITE_BUILDER ]: [ FEATURE_GUIDED_WEBSITE_BUILDER_LIMITED ], }; // Finds a matching feature, checking both the base slug and any aliases const findFeatureWithAlias = ( featureSlug: string | undefined, planFeatures: { getSlug: () => string }[] ) => { if ( ! featureSlug ) { return undefined; } const slugsToCheck = [ featureSlug, ...( FEATURE_ALIASES[ featureSlug ] ?? [] ) ]; return planFeatures.find( ( f ) => slugsToCheck.includes( f.getSlug() ) ); }; const featureGroupRowTitleCellMaxWidth = 450; const rowCellMaxWidth = 290; const JetpackIconContainer = styled.div` padding-inline-start: 3px; display: inline-block; vertical-align: middle; line-height: 1; `; const TitlePreventOrphans = styled.span` white-space: nowrap; `; const Title = styled.div< { isHiddenInMobile?: boolean } >` font-weight: 500; font-size: 20px; padding: 14px; flex: 1; display: flex; align-items: center; column-gap: 5px; border: solid 1px #e0e0e0; border-left: none; border-right: none; .gridicon { transform: ${ ( props ) => props.isHiddenInMobile ? 'rotateZ( 180deg )' : 'rotateZ( 0deg )' }; flex-shrink: 0; } ${ plansGridMediumLarge( css` padding-inline-start: 0; border: none; padding: 0; max-width: 290px; .gridicon { display: none; } ` ) } `; const StickyGrid = styled( StickyContainer )< { visiblePlans: number } >` display: grid; margin: 0 auto; background: #fff; ${ ( props ) => props.visiblePlans && css` max-width: ${ rowCellMaxWidth * props.visiblePlans + featureGroupRowTitleCellMaxWidth }px; ` } ${ plansGridMediumLarge( css` border-radius: 5px; ` ) } `; const Grid = styled.div< { visiblePlans: number; as?: string } >` display: ${ ( props ) => ( props.as === 'tbody' ? 'table-row-group' : 'grid' ) }; margin: 0 auto; background: #fff; ${ ( props ) => props.visiblePlans && css` max-width: ${ rowCellMaxWidth * props.visiblePlans + featureGroupRowTitleCellMaxWidth }px; ` } ${ plansGridMediumLarge( css` border-radius: 5px; ` ) } `; const Row = styled.div< { isHiddenInMobile?: boolean; className?: string; isHighlighted?: boolean; } >` justify-content: space-between; margin-bottom: -1px; align-items: stretch; display: ${ ( props ) => ( props.isHiddenInMobile ? 'none' : 'flex' ) }; ${ plansGridMediumLarge( css` display: flex; align-items: center; margin: 0 20px; padding: 12px 0; border-bottom: 1px solid #eee; ` ) } ${ ( props ) => props.isHighlighted && css` ${ plansGridMediumLarge( css` background-color: #fafafa; border-top: 1px solid #eee; font-weight: bold; margin: -1px 0 0; padding: 12px 20px; color: #3a434a; ` ) } ` }; `; const PlanRow = styled( Row )` &:last-of-type { display: ${ ( props ) => ( props.isHiddenInMobile ? 'none' : 'flex' ) }; } ${ plansGridMediumLarge( css` border-bottom: none; align-items: stretch; &:last-of-type { display: flex; padding-top: 0; padding-bottom: 0; } ` ) } `; const TitleRow = styled( Row )` cursor: pointer; display: flex; ${ plansGridMediumLarge( css` cursor: default; border-bottom: none; padding: 20px 0 10px; pointer-events: none; ` ) } `; const Cell = styled.div< { textAlign?: 'start' | 'center' | 'end' } >` text-align: ${ ( props ) => props.textAlign ?? 'start' }; display: flex; flex: 1; justify-content: flex-start; flex-direction: column; align-items: center; padding: 33px 20px 0; border-right: solid 1px #e0e0e0; max-width: ${ rowCellMaxWidth }px; .gridicon { fill: currentColor; } img { max-width: 100%; } &.title-is-subtitle { padding-top: 0; } &:last-of-type { border-right: none; } ${ Row }:last-of-type & { padding-bottom: 24px; ${ plansGridMediumLarge( css` padding-bottom: 0px; ` ) } } ${ plansGridMediumLarge( css` padding: 0 14px; border-right: none; justify-content: center; &:first-of-type:not( .popular-plan-parent-class ) { padding-inline-start: 0; } &:last-of-type { padding-inline-end: 0; border-right: none; } &.is-stuck { padding-bottom: 16px; } ` ) } `; const RowTitleCell = styled.td< { isPlaceholderHeaderCell?: boolean; isFeatureGroupRowTitleCell?: boolean; } >` display: none; font-size: 14px; padding-right: 10px; ${ plansGridMediumLarge( css` display: block; flex: 1; min-width: 290px; ` ) } max-width: ${ ( props ) => { if ( props.isPlaceholderHeaderCell || props.isFeatureGroupRowTitleCell ) { return `${ featureGroupRowTitleCellMaxWidth }px`; } return `${ rowCellMaxWidth }px`; } }; `; const RowHeaderCell = styled.th< { isPlaceholderHeaderCell?: boolean; isFeatureGroupRowTitleCell?: boolean; } >` display: none; font-size: 14px; padding-right: 10px; ${ plansGridMediumLarge( css` display: block; flex: 1; min-width: 290px; ` ) } max-width: ${ ( props ) => { if ( props.isPlaceholderHeaderCell || props.isFeatureGroupRowTitleCell ) { return `${ featureGroupRowTitleCellMaxWidth }px`; } return `${ rowCellMaxWidth }px`; } }; `; const PlanSelector = styled.header` position: relative; .plan-comparison-grid__title { &.is-select-trigger { display: flex; } } .plan-comparison-grid__title-select { appearance: none; -moz-appearance: none; -webkit-appearance: none; background: 0 0; border: none; font-size: inherit; color: inherit; font-family: inherit; opacity: 0; width: 100%; position: absolute; top: 0; left: 0; cursor: pointer; height: 30px; &:focus ~ .plan-comparison-grid__title { outline: thin dotted; } } .plan-comparison-grid__title-icon { position: relative; top: -2px; left: -2px; width: 1px; height: 1px; overflow: visible; svg { fill: var( --color-link ); transform: rotate( 90deg ); } } `; const FeatureFootnotes = styled.div` ol { margin: 2em 0 0 1em; } ol li { font-size: 11px; padding-left: 1em; } `; const FeatureFootnote = styled.span` position: relative; font-size: 50%; font-weight: 600; sup { position: absolute; top: -10px; left: 0; } `; type ComparisonGridHeaderProps = { displayedGridPlans: GridPlan[]; visibleGridPlans: GridPlan[]; isInSignup: boolean; isFooter?: boolean; onPlanChange: ( currentPlan: PlanSlug, event: ChangeEvent< HTMLSelectElement > ) => void; currentSitePlanSlug?: string | null; planActionOverrides?: PlanActionOverrides; selectedPlan?: string; showRefundPeriod?: boolean; isStuck: boolean; isHiddenInMobile?: boolean; planTypeSelectorProps?: PlanTypeSelectorProps; }; type ComparisonGridHeaderCellProps = Omit< ComparisonGridHeaderProps, 'planTypeSelectorProps' > & { allVisible: boolean; isLastInRow: boolean; planSlug: PlanSlug; }; type PlanFeatureFootnotes = { footnoteList: string[]; footnotesByFeature: Record< Feature, number >; }; const ComparisonGridHeaderCell = ( { planSlug, allVisible, isLastInRow, isFooter, isInSignup, visibleGridPlans, onPlanChange, displayedGridPlans, currentSitePlanSlug, planActionOverrides, showRefundPeriod, isStuck, }: ComparisonGridHeaderCellProps ) => { const { gridPlansIndex, showBillingDescriptionForIncreasedRenewalPrice } = usePlansGridContext(); const gridPlan = gridPlansIndex[ planSlug ]; const highlightAdjacencyMatrix = useHighlightAdjacencyMatrix( { renderedGridPlans: visibleGridPlans, } ); if ( ! gridPlan ) { return null; } const headerClasses = clsx( 'plan-comparison-grid__header-cell', getPlanClass( planSlug ), { 'popular-plan-parent-class': gridPlan.highlightLabel, 'is-last-in-row': isLastInRow, 'plan-is-footer': isFooter, 'is-left-of-highlight': highlightAdjacencyMatrix[ planSlug ]?.leftOfHighlight, 'is-right-of-highlight': highlightAdjacencyMatrix[ planSlug ]?.rightOfHighlight, 'is-only-highlight': highlightAdjacencyMatrix[ planSlug ]?.isOnlyHighlight, 'is-current-plan': gridPlan.current, 'is-stuck': isStuck, } ); const popularBadgeClasses = clsx( { 'is-current-plan': gridPlan.current, 'popular-badge-is-stuck': isStuck, } ); const showPlanSelect = ! allVisible && ! gridPlan.current; return (

{ gridPlan.planTitle } { showPlanSelect && ( ) }

{ showPlanSelect && ( ) }
); }; const PlanTypeSelectorWrapper = styled.div` display: none; ${ plansGridMediumLarge( css` display: block; ` ) } `; const ComparisonGridHeader = forwardRef< HTMLDivElement, ComparisonGridHeaderProps >( ( { displayedGridPlans, visibleGridPlans, isInSignup, isFooter, onPlanChange, currentSitePlanSlug, planActionOverrides, selectedPlan, isHiddenInMobile, showRefundPeriod, isStuck, planTypeSelectorProps, }, ref ) => { const translate = useTranslate(); const allVisible = visibleGridPlans.length === displayedGridPlans.length; const { coupon } = usePlansGridContext(); return ( { isStuck && planTypeSelectorProps && ( ) } { visibleGridPlans.map( ( { planSlug }, index ) => ( ) ) } ); } ); ComparisonGridHeader.displayName = 'ComparisonGridHeader'; const ComparisonGridFeatureGroupRowCell: React.FunctionComponent< { feature?: FeatureObject; allJetpackFeatures: Set< string >; visibleGridPlans: GridPlan[]; planSlug: PlanSlug; isStorageFeature: boolean; intervalType: string; setActiveTooltipId: Dispatch< SetStateAction< string > >; showUpgradeableStorage: boolean; activeTooltipId: string; onStorageAddOnClick?: ( addOnSlug: AddOns.StorageAddOnSlug ) => void; } > = ( { feature, visibleGridPlans, planSlug, isStorageFeature, intervalType, activeTooltipId, setActiveTooltipId, showUpgradeableStorage, onStorageAddOnClick, } ) => { const { gridPlansIndex, enableFeatureTooltips, hideUnsupportedFeatures } = usePlansGridContext(); const gridPlan = gridPlansIndex[ planSlug ]; const translate = useTranslate(); const highlightAdjacencyMatrix = useHighlightAdjacencyMatrix( { renderedGridPlans: visibleGridPlans, } ); if ( ! gridPlan ) { return null; } const featureSlug = feature?.getSlug(); let comparisonGridTitle = featureSlug === FEATURE_REALTIME_BACKUPS_JP ? translate( 'Real-time backups', { textOnly: true } ) : feature?.getAlternativeTitle?.() || feature?.getTitle(); if ( featureSlug === FEATURE_GUIDED_WEBSITE_BUILDER ) { // Use the short title for the guided website builder in the comparison grid. comparisonGridTitle = translate( 'Guided website builder', { textOnly: true } ); } const planFeatures = [ ...gridPlan.features.wpcomFeatures, ...gridPlan.features.jetpackFeatures, ].filter( ( feature ) => 'monthly' === intervalType ? ! feature.availableOnlyForAnnualPlans : true ); const matchingFeature = findFeatureWithAlias( featureSlug, planFeatures ); const hasFeature = isStorageFeature || !! matchingFeature; const featureLabelSlug = matchingFeature?.getSlug() ?? featureSlug; const featureLabel = featureLabelSlug ? gridPlan?.features?.comparisonGridFeatureLabels?.[ featureLabelSlug ] : undefined; const cellClasses = clsx( 'plan-comparison-grid__feature-group-row-cell', 'plan-comparison-grid__plan', getPlanClass( planSlug ), { 'popular-plan-parent-class': gridPlan.highlightLabel, 'has-feature': hasFeature, 'has-feature-label': !! featureLabel, 'hide-unsupported-feature': hideUnsupportedFeatures && ! hasFeature && ! featureLabel, 'title-is-subtitle': 'live-chat-support' === featureSlug, 'is-left-of-highlight': highlightAdjacencyMatrix[ planSlug ]?.leftOfHighlight, 'is-right-of-highlight': highlightAdjacencyMatrix[ planSlug ]?.rightOfHighlight, 'is-only-highlight': highlightAdjacencyMatrix[ planSlug ]?.isOnlyHighlight, } ); const planPaymentTransactionFees = gridPlan.features.wpcomFeatures?.find( ( feature ) => feature?.getFeatureGroup?.() === FEATURE_GROUP_PAYMENT_TRANSACTION_FEES ); return ( { isStorageFeature ? ( <> { translate( 'Storage' ) } ) : ( <> { FEATURE_GROUP_PAYMENT_TRANSACTION_FEES === featureSlug ? ( <> { planPaymentTransactionFees ? ( <> { comparisonGridTitle } { planPaymentTransactionFees?.getAlternativeTitle?.() } ) : ( ) } ) : ( <> { feature?.getIcon && ( { /** Note: this approach may not work if the icon is not a string or ReactElement. */ } { feature.getIcon() as React.ReactNode } ) } { comparisonGridTitle } { feature?.getCompareTitle && ( { feature.getCompareTitle() } ) } { featureLabel && ( { featureLabel } ) } { hasFeature && feature?.getCompareSubtitle && ( { feature.getCompareSubtitle() } ) } { hasFeature && ! featureLabel && ( ) } { ! hasFeature && ! featureLabel && ( ) } ) } ) } ); }; const ComparisonGridFeatureGroupRow: React.FunctionComponent< { feature?: FeatureObject | TransformedFeatureObject; featureGroupSlug: string; isHiddenInMobile: boolean; allJetpackFeatures: Set< string >; visibleGridPlans: GridPlan[]; planFeatureFootnotes: PlanFeatureFootnotes; isStorageFeature: boolean; isHighlighted: boolean; intervalType: string; setActiveTooltipId: Dispatch< SetStateAction< string > >; showUpgradeableStorage: boolean; activeTooltipId: string; onStorageAddOnClick?: ( addOnSlug: AddOns.StorageAddOnSlug ) => void; } > = ( { feature, featureGroupSlug, isHiddenInMobile, allJetpackFeatures, visibleGridPlans, planFeatureFootnotes, isStorageFeature, isHighlighted, intervalType, activeTooltipId, setActiveTooltipId, showUpgradeableStorage, onStorageAddOnClick, } ) => { const translate = useTranslate(); const rowClasses = clsx( 'plan-comparison-grid__feature-group-row', { 'is-storage-feature': isStorageFeature, } ); const featureSlug = feature?.getSlug() ?? ''; const footnote = planFeatureFootnotes?.footnotesByFeature?.[ featureSlug ]; const tooltipId = `${ featureGroupSlug }-${ feature?.getSlug() }-comparison-grid`; let title = featureSlug === FEATURE_REALTIME_BACKUPS_JP ? // Always display the short title for backups in comparison grid. translate( 'Real-time backups', { textOnly: true } ) : feature?.getTitle?.(); if ( featureSlug === FEATURE_GUIDED_WEBSITE_BUILDER ) { // Use the short title for the guided website builder in the comparison grid. title = translate( 'Guided website builder', { textOnly: true } ); } const headerAriaLabel: string = typeof title === 'string' ? title : ''; const { enableFeatureTooltips } = usePlansGridContext(); return ( { isStorageFeature ? ( { translate( 'Storage' ) } ) : ( <> { feature && ( <> { typeof title === 'string' ? ( <> { title.split( ' ' ).slice( 0, -1 ).join( ' ' ) } { title.includes( ' ' ) ? ' ' : null } { title.split( ' ' ).slice( -1 ) } { footnote && ( { footnote } ) } { allJetpackFeatures.has( feature.getSlug() ) ? ( <> { '\u00A0' } ) : null } ) : ( <> { feature.getTitle() } { footnote && ( { footnote } ) } ) } ) } ) } { visibleGridPlans.map( ( { planSlug } ) => ( ) ) } ); }; const FeatureGroup = ( { featureGroup, selectedFeature, intervalType, activeTooltipId, setActiveTooltipId, showUpgradeableStorage, onStorageAddOnClick, featureGroupMap, visibleGridPlans, planFeatureFootnotes, plansLength, }: { featureGroup: FeatureGroup; selectedFeature?: string; intervalType: string; activeTooltipId: string; setActiveTooltipId: Dispatch< SetStateAction< string > >; showUpgradeableStorage: boolean; onStorageAddOnClick?: ( addOnSlug: AddOns.StorageAddOnSlug ) => void; featureGroupMap: Partial< FeatureGroupMap >; visibleGridPlans: GridPlan[]; planFeatureFootnotes: { footnoteList: string[]; footnotesByFeature: Record< string, number >; }; plansLength: number; } ) => { const { allFeaturesList, isExperimentVariant } = usePlansGridContext(); const [ firstSetOfFeatures ] = Object.keys( featureGroupMap ); const [ visibleFeatureGroups, setVisibleFeatureGroups ] = useState< string[] >( [ firstSetOfFeatures, ] ); const features = featureGroup.getFeatures(); const featureObjects = filterUnusedFeaturesObject( visibleGridPlans, getPlanFeaturesObject( allFeaturesList, features, isExperimentVariant ) ); const isHiddenInMobile = ! visibleFeatureGroups.includes( featureGroup.slug ); const allJetpackFeatures = useMemo( () => { const allPlans = getPlans(); const jetpackFeatures = new Set( Object.values( allPlans ) .map( ( { get2023PricingGridSignupJetpackFeatures, get2023PlanComparisonJetpackFeatureOverride, } ) => { const jetpackFeatures = get2023PricingGridSignupJetpackFeatures?.(); const additionalJetpackFeatures = get2023PlanComparisonJetpackFeatureOverride?.(); return [ ...( jetpackFeatures ? jetpackFeatures : [] ), ...( additionalJetpackFeatures ? additionalJetpackFeatures : [] ), ]; } ) .flat() ); return jetpackFeatures; }, [] ); const handleFeatureGroupToggle = useCallback( () => { const index = visibleFeatureGroups.indexOf( featureGroup.slug ); const newVisibleFeatureGroups = [ ...visibleFeatureGroups ]; if ( index === -1 ) { newVisibleFeatureGroups.push( featureGroup.slug ); } else { newVisibleFeatureGroups.splice( index, 1 ); } setVisibleFeatureGroups( newVisibleFeatureGroups ); }, [ featureGroup, setVisibleFeatureGroups, visibleFeatureGroups ] ); // Skip non Jetpack feature groups without any available features. if ( featureGroup.slug !== FEATURE_GROUP_ESSENTIAL_FEATURES && ! featureObjects.length ) { return null; } return ( <Gridicon icon="chevron-up" size={ 12 } color="#1E1E1E" /> <span>{ featureGroup.getTitle() }</span> { featureObjects.map( ( feature ) => ( ) ) } { featureGroup.slug === FEATURE_GROUP_ESSENTIAL_FEATURES ? ( ) : null } ); }; const ComparisonGrid = ( { intervalType, isInSignup, currentSitePlanSlug, planActionOverrides, selectedPlan, selectedFeature, showUpgradeableStorage, stickyRowOffset, onStorageAddOnClick, showRefundPeriod, planTypeSelectorProps, gridSize, siteId, onVisiblePlansCountChange, }: ComparisonGridProps ) => { const { gridPlans, featureGroupMap } = usePlansGridContext(); const [ activeTooltipId, setActiveTooltipId ] = useManageTooltipToggle(); const { visibleGridPlans, setVisibleGridPlans } = useVisibleGridPlans( { gridSize, currentSitePlanSlug, siteId, intervalType, } ); useEffect( () => { onVisiblePlansCountChange?.( visibleGridPlans.length ); }, [ visibleGridPlans.length, onVisiblePlansCountChange ] ); const planFeatureFootnotes = useMemo( () => { // This is the main list of all footnotes. It is displayed at the bottom of the comparison grid. const footnoteList: string[] = []; // This is a map of features to the index of the footnote in the main list of footnotes. const footnotesByFeature: Record< Feature, number > = {}; Object.values( featureGroupMap ).map( ( featureGroup ) => { const footnotes = featureGroup?.getFootnotes?.(); if ( ! footnotes ) { return; } Object.keys( footnotes ).map( ( footnote ) => { const footnoteFeatures = footnotes[ footnote ]; // First we add the footnote to the main list of footnotes. footnoteList.push( footnote ); // Then we add each feature that has this footnote to the map of footnotes by feature. const currentFootnoteIndex = footnoteList.length; footnoteFeatures.map( ( feature ) => { footnotesByFeature[ feature ] = currentFootnoteIndex; } ); } ); } ); return { footnoteList, footnotesByFeature, }; }, [ featureGroupMap ] ); const onPlanChange = useCallback( ( currentPlan: PlanSlug, event: ChangeEvent< HTMLSelectElement > ) => { const newPlanSlug = event.currentTarget.value; const newPlan = gridPlans.find( ( plan ) => plan.planSlug === newPlanSlug ); if ( newPlan ) { setVisibleGridPlans( ( previousGridPlans ) => previousGridPlans.map( ( plan ) => ( plan.planSlug === currentPlan ? newPlan : plan ) ) ); } }, [ gridPlans, setVisibleGridPlans ] ); // 100px is the padding of the footer row const [ bottomHeaderRef, isBottomHeaderInView ] = useInView( { rootMargin: '-100px' } ); /** * Search for "any" plan with a highlight label, not just the visible ones. * This will keep the grid static while user interacts (selects different plans to compare). * Some padding is applied in the stylesheet to cover the badges/labels. */ const hasHighlightedPlan = gridPlans.some( ( { highlightLabel } ) => !! highlightLabel ); const classes = clsx( 'plans-grid-next-comparison-grid', { 'has-highlighted-plan': hasHighlightedPlan, } ); return ( { ( isStuck: boolean ) => ( ) } { Object.values( featureGroupMap ).map( ( featureGroup: FeatureGroup ) => ( ) ) } { planFeatureFootnotes?.footnoteList && ( ) }
    { planFeatureFootnotes?.footnoteList?.map( ( footnote, index ) => { return
  1. { footnote }
  2. ; } ) }
); }; // TODO // Now that everything under is functional component, we can deprecate this wrapper and only keep ComparisonGrid instead. // More details can be found in https://github.com/Automattic/wp-calypso/issues/87047 const WrappedComparisonGrid = ( { siteId, intent, gridPlans, useCheckPlanAvailabilityForPurchase, useAction, recordTracksEvent, allFeaturesList, intervalType, isInSiteDashboard, isInSignup, currentSitePlanSlug, selectedPlan, selectedFeature, showUpgradeableStorage, onStorageAddOnClick, stickyRowOffset, coupon, className, hideUnsupportedFeatures, enableFeatureTooltips, featureGroupMap, enableTermSavingsPriceDisplay, reflectStorageSelectionInPlanPrices, showSimplifiedBillingDescription, showBillingDescriptionForIncreasedRenewalPrice, isExperimentVariant, ...otherProps }: ComparisonGridExternalProps ) => { const gridContainerRef = useRef< HTMLDivElement >( null ); const gridBreakpoints = useMemo( () => { // we want to fit up to the Commerce plan in this breakpoint const xlargeBreakpoint = isInSiteDashboard ? 1114 : 1180; return new Map< GridSize, number >( [ [ 'small', 0 ], [ 'smedium', 686 ], [ 'medium', 835 ], [ 'large', 1005 ], [ 'xlarge', xlargeBreakpoint ], ] ); }, [ isInSiteDashboard ] ); // TODO: this will be deprecated along side removing the wrapper component const gridSize = useGridSize( { containerRef: gridContainerRef, containerBreakpoints: gridBreakpoints, } ); const classNames = clsx( 'plans-grid-next', className, { 'is-small': 'small' === gridSize, 'is-smedium': 'smedium' === gridSize, 'is-medium': 'medium' === gridSize, 'is-large': 'large' === gridSize, 'is-xlarge': 'xlarge' === gridSize, 'is-visible': true, } ); return (
); }; export default WrappedComparisonGrid;