import { Plans, AddOns, PlanPricing } from '@automattic/data-stores'; import type { UrlFriendlyTermType, PlanSlug, FeatureList, FeatureObject, FeatureGroupMap, Feature } from '@automattic/calypso-products'; import type { MinimalRequestCartProduct } from '@automattic/shopping-cart'; import type { TranslateResult } from 'i18n-calypso'; /****************** * Grid Plan Types: ******************/ export type TransformedFeatureObject = FeatureObject & { availableForCurrentPlan: boolean; availableOnlyForAnnualPlans: boolean; isHighlighted?: boolean; /** * When true, extra bottom margin on the last feature row for pricing experiment variants. */ isExperimentLastFeature?: boolean; /** * Badge text to display after the feature title (e.g. pricing differentiators pills). */ badgeText?: TranslateResult; }; export interface PlanFeaturesForGridPlan { wpcomFeatures: TransformedFeatureObject[]; jetpackFeatures: TransformedFeatureObject[]; storageFeature?: FeatureObject; comparisonGridFeatureLabels?: Record; } export interface GridPlan { planSlug: PlanSlug; freeTrialPlanSlug?: PlanSlug; isVisible: boolean; features: PlanFeaturesForGridPlan; tagline: TranslateResult; planTitle: TranslateResult; availableForPurchase: boolean; pricing: Plans.PricingMetaForGridPlan; productNameShort?: string | null; billingTimeframe?: TranslateResult | null; current?: boolean; isMonthlyPlan?: boolean; cartItemForPlan?: { product_slug: string; } | null; highlightLabel?: React.ReactNode | null; titleBadge?: React.ReactNode | null; } /*********************** * Grid Component Types: ***********************/ export type GridSize = 'small' | 'smedium' | 'medium' | 'large' | 'xlarge'; export type PlansIntent = 'plans-affiliate' | 'plans-ai-assembler-free-trial' | 'plans-ai-assembler-paid-only' | 'plans-blog-onboarding' | 'plans-newsletter' | 'plans-new-hosted-site' | 'plans-new-hosted-site-business-only' | 'plans-plugins' | 'plans-jetpack-app' | 'plans-jetpack-app-site-creation' | 'plans-import' | 'plans-woocommerce' | 'plans-p2' | 'plans-default-wpcom' | 'plans-business-trial' | 'plans-student' | 'plans-videopress' | 'plans-guided-segment-developer-or-agency' | 'plans-guided-segment-merchant' | 'plans-guided-segment-blogger' | 'plans-guided-segment-nonprofit' | 'plans-guided-segment-consumer-or-business' | 'plans-site-selected-legacy' | 'plans-playground' | 'plans-playground-premium' | 'plans-upgrade' | 'plans-upgrade-or-downgrade' | 'plans-wordpress-hosting' | 'plans-website-builder' | 'plans-woo-hosted' | 'plans-woo-hosting-solutions' | 'plans-migration' | 'default'; export interface PlanActionOverrides { loggedInFreePlan?: { text?: TranslateResult; status?: 'blocked' | 'enabled'; }; currentPlan?: { text?: TranslateResult; }; trialAlreadyUsed?: { postButtonText?: TranslateResult; }; } export type DataResponse = { isLoading: boolean; result?: T; }; export interface CommonGridProps { /** * Site id may not be used in ComparisonGrid, but need to be investigated further */ siteId?: number | null; isInSignup: boolean; isInAdmin: boolean; isInSiteDashboard: boolean; onStorageAddOnClick?: (addOnSlug: AddOns.StorageAddOnSlug) => void; currentSitePlanSlug?: PlanSlug | null; hideUnavailableFeatures?: boolean; planActionOverrides?: PlanActionOverrides; selectedFeature?: string; showUpgradeableStorage: boolean; stickyRowOffset: number; showRefundPeriod?: boolean; planTypeSelectorProps?: PlanTypeSelectorProps; gridContainerRef?: React.MutableRefObject; gridSize?: GridSize; } export interface FeaturesGridProps extends CommonGridProps { bottomGridPlan?: GridPlan; gridPlans: GridPlan[]; currentPlanManageHref?: string; generatedWPComSubdomain: DataResponse<{ domain_name: string; }>; gridPlanForSpotlight?: GridPlan; isCustomDomainAllowedOnFreePlan: boolean; paidDomainName?: string; showLegacyStorageFeature: boolean; enableShowAllFeaturesButton?: boolean; } export interface ComparisonGridProps extends CommonGridProps { selectedPlan?: string; intervalType: SupportedUrlFriendlyTermType; /** Called when the number of visible plans in the grid changes (e.g. for narrowing the container). */ onVisiblePlansCountChange?: (count: number) => void; } export type UseActionCallback = ({ planSlug, cartItemForPlan, selectedStorageAddOn, availableForPurchase, }: { planSlug: PlanSlug; cartItemForPlan?: MinimalRequestCartProduct | null; selectedStorageAddOn?: AddOns.AddOnMeta | null; availableForPurchase?: boolean; }) => () => Promise | void; export interface GridAction { primary: { text: TranslateResult; ariaLabel?: TranslateResult; callback: () => Promise | void; status?: 'disabled' | 'blocked' | 'enabled'; variant?: 'primary' | 'secondary'; }; postButtonText?: TranslateResult; } export type UseAction = ({ availableForPurchase, billingPeriod, cartItemForPlan, currentPlanBillingPeriod, isFreeTrialAction, isLargeCurrency, isStuck, planSlug, planTitle, priceString, selectedStorageAddOn, pricing, isMonthlyPlan, }: { availableForPurchase?: boolean; billingPeriod?: PlanPricing['billPeriod']; cartItemForPlan?: MinimalRequestCartProduct | null; currentPlanBillingPeriod?: PlanPricing['billPeriod']; isFreeTrialAction?: boolean; isLargeCurrency?: boolean; isStuck?: boolean; planSlug: PlanSlug; planTitle?: TranslateResult; priceString?: string; selectedStorageAddOn?: AddOns.AddOnMeta | null; pricing?: Plans.PricingMetaForGridPlan | null; isMonthlyPlan?: boolean; }) => GridAction; export type GridContextProps = { gridPlans: GridPlan[]; allFeaturesList: FeatureList; intent?: PlansIntent; siteId?: number | null; useCheckPlanAvailabilityForPurchase: Plans.UseCheckPlanAvailabilityForPurchase; useAction: UseAction; recordTracksEvent?: (eventName: string, eventProperties: Record) => void; children: React.ReactNode; coupon?: string; enableFeatureTooltips?: boolean; featureGroupMap: Partial; hideUnsupportedFeatures?: boolean; enterpriseFeaturesList?: string[]; /** * India Automattic for Agencies test: when true, the Enterprise plan card is presented as A4A. * This affects Enterprise branding (logo/copy) and layout (e.g. hides Enterprise client logos * in the price cell and shows A4A-specific billing text instead). */ isEnterpriseA4AIndia?: boolean; /** * `enableCategorisedFeatures` is no longer exact, and probably best to rename. * It is only used for showing "Everything in [previous] plus". */ enableCategorisedFeatures?: boolean; /** * Display the plan storage limit as a badge like "50GB" or as plain text like "50GB storage" */ enableStorageAsBadge?: boolean; /** * Reduce the vertical spacing between each feature group */ enableReducedFeatureGroupSpacing?: boolean; /** * Display only the client logos for the enterprise plan */ enableLogosOnlyForEnterprisePlan?: boolean; /** * Hide the titles for feature groups in the features grid */ hideFeatureGroupTitles?: boolean; /** * Enable the display of the term savings in plan prices. * Prices will display crossed out with the savings from shorter term accentuated in a label. * This carries lower precedence than promo/coupon and introductory pricing, irrespective of whether set or not. */ enableTermSavingsPriceDisplay?: boolean; /** * Determine if storage add-on products should be combined with plan costs when * calculating prices. */ reflectStorageSelectionInPlanPrices?: boolean; /** * Enable simplified billing description */ showSimplifiedBillingDescription?: boolean; /** * If, and how to present increased renewal pricing (null or the assigned variant name) */ showBillingDescriptionForIncreasedRenewalPrice?: string | null; /** * When true, the user is in the rolled-out pricing differentiation cohort. * Used to display cohort-specific feature titles in the comparison grid. */ isExperimentVariant?: boolean; /** * Display availability checkmarks next to features in the features grid. */ showFeatureCheckmarks?: boolean; }; export type ComparisonGridExternalProps = Omit & Omit & { className?: string; onUpgradeClick?: (cartItems?: MinimalRequestCartProduct[] | null, clickedPlanSlug?: PlanSlug) => void; }; export type FeaturesGridExternalProps = Omit & Omit & { className?: string; onUpgradeClick?: (cartItems?: MinimalRequestCartProduct[] | null, clickedPlanSlug?: PlanSlug) => void; featureGroupMap?: Partial; }; /************************ * PlanTypeSelector Types: ************************/ export type PlanTypeSelectorProps = { kind: 'interval'; siteId?: number | null; basePlansPath?: string | null; intervalType: UrlFriendlyTermType; customerType: string; enableStickyBehavior?: boolean; stickyPlanTypeSelectorOffset?: number; onPlanIntervalUpdate: (interval: SupportedUrlFriendlyTermType) => void; layoutClassName?: string; siteSlug?: string | null; selectedPlan?: string; selectedFeature?: string; showPlanTypeSelectorDropdown?: boolean; isInSignup: boolean; plans: PlanSlug[]; eligibleForWpcomMonthlyPlans?: boolean; hideDiscount?: boolean; redirectTo?: string | null; isStepperUpgradeFlow: boolean; currentSitePlanSlug?: PlanSlug | null; useCheckPlanAvailabilityForPurchase: Plans.UseCheckPlanAvailabilityForPurchase; recordTracksEvent?: (eventName: string, eventProperties: Record) => void; /** * Whether to render the selector along with a title if passed. */ title?: TranslateResult; /** * Coupon code for use in pricing hook usage. */ coupon?: string; displayedIntervals: UrlFriendlyTermType[]; intent?: PlansIntent | null; }; export type IntervalTypeProps = Pick; export type SupportedUrlFriendlyTermType = Extract; export type HiddenPlans = { hideFreePlan?: boolean; hidePersonalPlan?: boolean; hidePremiumPlan?: boolean; hideBusinessPlan?: boolean; hideEcommercePlan?: boolean; hideEnterprisePlan?: boolean; }; //# sourceMappingURL=types.d.ts.map