"use client"; import { useFillRemainingHeight } from "@calcom/lib/hooks/useFillRemainingHeight"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import useMediaQuery from "@calcom/lib/hooks/useMediaQuery"; import { Icon } from "@calcom/ui/components/icon"; import { OrgBadge, TeamBadge } from "@calcom/web/modules/billing/components/PlanBadge"; import { UpgradePlanDialog } from "@calcom/web/modules/billing/components/UpgradePlanDialog"; import { Badge } from "@coss/ui/components/badge"; import { Button } from "@coss/ui/components/button"; import { Dialog, DialogDescription, DialogFooter, DialogHeader, DialogPopup, DialogTitle, } from "@coss/ui/components/dialog"; import Image from "next/image"; import Link from "next/link"; import posthog from "posthog-js"; import { useState } from "react"; import type { UpgradeTarget } from "./types"; export type { UpgradeTarget }; export type FullScreenUpgradeBannerProps = { tracking: string; name: string; title: string; subtitle: string; features?: string[]; target: UpgradeTarget; learnMoreButton?: { text: string; href?: string; onClick?: () => void; }; extraOffset?: | number | { mobile?: number; tablet?: number; desktop?: number; }; image: { src: string; width: number; height: number; }; youtubeId?: string; }; function useResponsiveOffset( extraOffset?: | number | { mobile?: number; tablet?: number; desktop?: number; } ) { const isMobile = useMediaQuery("(max-width: 639px)"); const isTablet = useMediaQuery("(max-width: 767px)"); if (isMobile) { return typeof extraOffset === "number" ? extraOffset : (extraOffset?.mobile ?? 74); } else if (isTablet) { return typeof extraOffset === "number" ? extraOffset : (extraOffset?.tablet ?? 85); } else { return typeof extraOffset === "number" ? extraOffset : (extraOffset?.desktop ?? 24); } } function BannerImage({ image, name, youtubeId, tracking, target, onPlayVideo, }: { image: { src: string; width: number; height: number }; name: string; youtubeId?: string; tracking: string; target: UpgradeTarget; onPlayVideo: () => void; }): JSX.Element { const { t } = useLocale(); return ( <> {name} {youtubeId && ( )} ); } export function FullScreenUpgradeBanner({ tracking, name, title, subtitle, features, target, learnMoreButton, extraOffset, image, youtubeId, }: FullScreenUpgradeBannerProps): JSX.Element { const [videoOpen, setVideoOpen] = useState(false); const [showFeatures, setShowFeatures] = useState(false); const deviceSpecificOffset = useResponsiveOffset(extraOffset); const { t } = useLocale(); const ref = useFillRemainingHeight(deviceSpecificOffset); const bannerImageProps = { image, name, youtubeId, tracking, target, onPlayVideo: () => setVideoOpen(true), }; return (
{/* Left Content */}
{name}

{title}

{subtitle}

{/* Features List */} {features && ( <>
    {features.map((feature) => (
  • {feature}
  • ))}
{showFeatures ? ( <>
    {features.map((feature) => (
  • {feature}
  • ))}
) : ( )}
)}
{/* Image - mobile only, hidden when features are expanded */}

{t("available_on")}

{target === "team" && } {(target === "team" || target === "organization") && }
{/* Buttons */}
{learnMoreButton && (learnMoreButton.href ? ( ) : ( ))}
{/* Right Content - Image */}
{youtubeId && ( {name} {t("available_on_plan", { plan: target === "organization" ? t("organization") : t("team") })}