import { InfoIcon } from 'lucide-react' import { cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui' import { type DueTodayBreakdown } from './PlanChangeSummary.utils' import { formatCurrency } from '@/lib/helpers' const TooltipLine = ({ label, amount, isCredit = false, className, }: { label: string amount: number isCredit?: boolean className?: string }) => (
{label} {isCredit ? `−${formatCurrency(amount)}` : formatCurrency(amount)}
) interface DueTodayRowProps { breakdown: DueTodayBreakdown planName: string /** Set for an org moving off a plan it has already paid for. */ currentPlanName?: string } /** * What the customer pays right now, and — behind the amount — why it differs from the * plan's sticker price. Ongoing compute is invoiced at the end of the cycle, not today. */ export const DueTodayRow = ({ breakdown, planName, currentPlanName }: DueTodayRowProps) => { const { planAmount, creditBalance, proratedCredit, tax, dueToday, isReduced } = breakdown const hasCreditsApplied = creditBalance > 0 || proratedCredit > 0 return (

Due today

{isReduced && ( {formatCurrency(planAmount)} )} {formatCurrency(dueToday)} {hasCreditsApplied && ( <>

Credits applied

{creditBalance > 0 ? "Your organization's credit balance is applied to this first payment. Next month is the regular plan price." : `Time you have already paid for on ${currentPlanName ?? 'your current plan'} is credited against this payment.`}

)}
{tax && } {creditBalance > 0 && ( )} {proratedCredit > 0 && ( )}

The plan fee is charged upfront. Compute and other usage is billed at the end of each billing cycle.

{breakdown.isTaxEstimateUnavailable && (

Tax could not be estimated and may be applied separately.

)}
) }