import { cn } from 'ui' import { formatCurrency } from '@/lib/helpers' export interface ChargeBreakdownProps { subtotal: number subtotalLabel?: string total: number tax?: { amount: number; percentage: number } taxStatus?: 'calculated' | 'failed' | 'not_applicable' isFetching: boolean } export const ChargeBreakdown = ({ subtotal, subtotalLabel = 'Subtotal', total, tax, taxStatus, isFetching, }: ChargeBreakdownProps) => { return (
{total !== subtotal && (
{subtotalLabel}
{formatCurrency(subtotal)}
)} {taxStatus === 'calculated' && tax && tax.amount > 0 && (
Tax ({tax.percentage}%)
{formatCurrency(tax.amount)}
)} {taxStatus === 'failed' && (
Tax could not be estimated and may be applied separately
)}
Total due today
{formatCurrency(total)}
) }