// End of third-party imports import { useParams } from 'common' import { AnimatePresence, motion } from 'framer-motion' import { Check, ChevronsUpDown, ExternalLink } from 'lucide-react' import Link from 'next/link' import type { UseFormReturn } from 'react-hook-form' import { toast } from 'sonner' import { Button, cn, CommandGroup, CommandItem, FormControl, FormField } from 'ui' import { Admonition } from 'ui-patterns' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import ShimmeringLoader from 'ui-patterns/ShimmeringLoader' import type { ExtendedSupportCategories } from './Support.constants' import type { SupportFormValues } from './SupportForm.schema' import { NO_ORG_MARKER, NO_PROJECT_MARKER } from './SupportForm.utils' import CopyButton from '@/components/ui/CopyButton' import { OrganizationProjectSelector } from '@/components/ui/OrganizationProjectSelector' import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled' interface ProjectAndPlanProps { form: UseFormReturn orgSlug: string | null projectRef: string | null category: ExtendedSupportCategories subscriptionPlanId: string | undefined } export function ProjectAndPlanInfo({ form, orgSlug, projectRef, category: _category, subscriptionPlanId: _subscriptionPlanId, }: ProjectAndPlanProps) { const hasProjectSelected = projectRef && projectRef !== NO_PROJECT_MARKER return (
{!hasProjectSelected && ( )}
) } interface ProjectSelectorProps { form: UseFormReturn orgSlug: string | null projectRef: string | null } function ProjectSelector({ form, orgSlug, projectRef }: ProjectSelectorProps) { const { projectRef: urlProjectRef } = useParams() return ( ( { if (!urlProjectRef && (!projectRef || projectRef === NO_PROJECT_MARKER)) field.onChange(projects[0]?.ref ?? NO_PROJECT_MARKER) }} onSelect={(project) => field.onChange(project.ref)} renderTrigger={({ isLoading, project, listboxId, open }) => { return ( ) }} renderActions={(setOpen) => ( { field.onChange(NO_PROJECT_MARKER) setOpen(false) }} > {field.value === NO_PROJECT_MARKER && }

No specific project

)} />
)} /> ) } interface ProjectRefHighlightedProps { projectRef: string | null } function ProjectRefHighlighted({ projectRef }: ProjectRefHighlightedProps) { const isVisible = !!projectRef && projectRef !== NO_PROJECT_MARKER return ( {isVisible && (

Project ID:{' '} {projectRef}

toast.success('Copied project ID to clipboard')} />
)}
) } interface PlanExpectationInfoContentProps { orgSlug: string planId?: string } export const PlanExpectationInfoContent = ({ orgSlug, planId, }: PlanExpectationInfoContentProps) => { const { billingAll } = useIsFeatureEnabled(['billing:all']) const shouldShowUpgradeActions = billingAll && planId !== 'enterprise' return (
{planId === 'free' && (

Support on the Free plan is provided through the community and by the team on a best-effort basis. For a guaranteed response time, we recommend upgrading to the Pro plan. Enhanced support SLAs are available on the Enterprise plan.

)} {planId === 'pro' && (

Pro includes email support with typical 1-business-day responses; upgrade to Team for prioritized ticketing and engineering escalation, or Enterprise for enhanced SLAs.

)} {planId === 'team' && (

The Team plan includes email support with prioritized ticketing and escalation to product engineering. Low, normal, and high-severity tickets are typically handled within 1 business day. Urgent issues are handled within 1 day, 365 days a year. Enhanced support SLAs are available on the Enterprise plan.

)} {shouldShowUpgradeActions && (
)}
) }