import React from 'react'; import { Card } from '../ui/card'; import { Tag, ShieldCheck } from 'lucide-react'; interface OrderSummaryProps { subtotal: number; taxRate?: number; discount?: { code: string; amount: number; type: 'percent' | 'fixed' }; currency?: string; onCheckout?: () => void; loading?: boolean; } export const OrderSummary: React.FC = ({ subtotal, taxRate = 0.08, discount, currency = 'USD', onCheckout, loading = false, }) => { const discountAmount = discount ? discount.type === 'percent' ? subtotal * (discount.amount / 100) : discount.amount : 0; const taxableAmount = Math.max(0, subtotal - discountAmount); const taxAmount = taxableAmount * taxRate; const total = taxableAmount + taxAmount; const formatPrice = (amount: number) => { return new Intl.NumberFormat('en-US', { style: 'currency', currency, }).format(amount); }; return (

Order Summary

Subtotal {formatPrice(subtotal)}
{discount && (
Discount ({discount.code}) -{formatPrice(discountAmount)}
)}
Estimated Tax ({(taxRate * 100).toFixed(0)}%) {formatPrice(taxAmount)}
Total {formatPrice(total)}
{onCheckout && ( )}

Secure Checkout

Transactions are encrypted. Downloads are available immediately after payment.

); };