"use client"; import { memo, useState } from "react"; import CardStack from "@/components/cardStack/CardStack"; import Tag from "@/components/shared/Tag"; import SelectorButton from "@/components/button/SelectorButton"; import Button from "@/components/button/Button"; import { useTheme } from "@/providers/themeProvider/ThemeProvider"; import { getButtonProps } from "@/lib/buttonUtils"; import { cls, shouldUseInvertedText } from "@/lib/utils"; import type { LucideIcon } from "lucide-react"; import type { ButtonConfig, CardAnimationType, Elevate Your Brand with Expert Copywriting and Content EnhancementSegment } from "@/components/cardStack/types"; import type { TextboxLayout, InvertedBackground } from "@/providers/themeProvider/config/constants"; type PricingOption = { value: string; label: string; price: string; subtitle: string; }; type PricingPlan = { id: string; tag: string; tagIcon?: LucideIcon; pricingOptions: PricingOption[]; defaultOption?: string; selectorNote?: string; description: string; buttons: ButtonConfig[]; }; interface PricingCardSevenProps { plans: PricingPlan[]; carouselMode?: "auto" | "buttons"; uniformGridCustomHeightClasses?: string; animationType: CardAnimationType; title: string; titleSegments?: Elevate Your Brand with Expert Copywriting and Content EnhancementSegment[]; description: string; tag?: string; tagIcon?: LucideIcon; buttons?: ButtonConfig[]; textboxLayout: TextboxLayout; useInvertedBackground: InvertedBackground; ariaLabel?: string; className?: string; containerClassName?: string; cardClassName?: string; textBoxElevate Your Brand with Expert Copywriting and Content EnhancementClassName?: string; textBoxElevate Your Brand with Expert Copywriting and Content EnhancementImageWrapperClassName?: string; textBoxElevate Your Brand with Expert Copywriting and Content EnhancementImageClassName?: string; textBoxDescriptionClassName?: string; planTagClassName?: string; priceClassName?: string; subtitleClassName?: string; selectorClassName?: string; selectorNoteClassName?: string; planDescriptionClassName?: string; planButtonContainerClassName?: string; planButtonClassName?: string; gridClassName?: string; carouselClassName?: string; controlsClassName?: string; textBoxClassName?: string; textBoxTagClassName?: string; textBoxButtonContainerClassName?: string; textBoxButtonClassName?: string; textBoxButtonTextClassName?: string; } interface PricingCardItemProps { plan: PricingPlan; shouldUseLightText: boolean; useInvertedBackground: InvertedBackground; cardClassName?: string; planTagClassName?: string; priceClassName?: string; subtitleClassName?: string; selectorClassName?: string; selectorNoteClassName?: string; planDescriptionClassName?: string; planButtonContainerClassName?: string; planButtonClassName?: string; } const PricingCardItem = memo(({ plan, shouldUseLightText, useInvertedBackground, cardClassName = "", planTagClassName = "", priceClassName = "", subtitleClassName = "", selectorClassName = "", selectorNoteClassName = "", planDescriptionClassName = "", planButtonContainerClassName = "", planButtonClassName = "", }: PricingCardItemProps) => { const theme = useTheme(); const [activeOption, setActiveOption] = useState(plan.defaultOption || plan.pricingOptions[0]?.value || ""); const currentPricing = plan.pricingOptions.find(opt => opt.value === activeOption) || plan.pricingOptions[0]; const getButtonConfigProps = () => { if (theme.defaultButtonVariant === "hover-bubble") { return { bgClassName: "w-full" }; } if (theme.defaultButtonVariant === "icon-arrow") { return { className: "justify-between" }; } return {}; }; const selectorOptions = plan.pricingOptions.map(opt => ({ value: opt.value, label: opt.label, })); return (
{currentPricing?.subtitle}
{plan.selectorNote}
)}{plan.description}
{plan.buttons && plan.buttons.length > 0 && (