import { useState } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Check, Phone, Headphones, Plus, Minus, X } from 'lucide-react'; import { Card, Button, Input } from '@/components/ui'; import { ExpandableInfo } from '@/components/pricing/ExpandableInfo'; import { voipTiers, voipHardware } from '@/lib/pricing-data'; import { formatCurrency } from '@/lib/utils'; import type { VoIPSelection, VoIPTierId, HardwareSelection } from '@/types/quote'; export interface Step4VoIPProps { voipSelection: VoIPSelection; onSetVoIPEnabled: (enabled: boolean) => void; onSetVoIPTier: (tierId: VoIPTierId) => void; onSetVoIPUserCount: (count: number) => void; onAddHardware: (hardwareId: string, quantity: number, isRental: boolean) => void; onRemoveHardware: (hardwareId: string) => void; onUpdateHardwareQuantity: (hardwareId: string, quantity: number) => void; getVoIPMonthly: () => number; getVoIPOneTime: () => number; } export function Step4VoIP({ voipSelection, onSetVoIPEnabled, onSetVoIPTier, onSetVoIPUserCount, onAddHardware, onRemoveHardware, onUpdateHardwareQuantity, getVoIPMonthly, getVoIPOneTime, }: Step4VoIPProps) { const [showHardware, setShowHardware] = useState(false); const getHardwareSelection = (hardwareId: string): HardwareSelection | undefined => { return voipSelection.hardware.find((h) => h.hardwareId === hardwareId); }; const handleHardwareToggle = (hardwareId: string, isRental: boolean) => { const existing = getHardwareSelection(hardwareId); if (existing) { onRemoveHardware(hardwareId); } else { onAddHardware(hardwareId, 1, isRental); } }; const handleQuantityChange = (hardwareId: string, delta: number) => { const existing = getHardwareSelection(hardwareId); if (existing) { const newQuantity = Math.max(1, existing.quantity + delta); onUpdateHardwareQuantity(hardwareId, newQuantity); } }; return ( {/* Service Explainer */}

VoIP (Voice over IP) replaces traditional phone lines with a modern cloud-based phone system. Your calls travel over the internet, which means lower costs, more features, and the flexibility to take calls from your desk phone, computer, or mobile app — anywhere with an internet connection.

Every plan includes unlimited local and long-distance calling, auto-attendant (press 1 for sales, etc.), voicemail-to-email, call forwarding, and the ability to keep your existing phone numbers. Higher tiers add call recording, analytics, CRM integrations, and video conferencing. We can also provide desk phones and headsets as a purchase or monthly rental.

{/* VoIP Toggle */}

Do you need business phones?

Modern VoIP phone system with advanced features

{voipSelection.enabled && ( {/* User Count */}
onSetVoIPUserCount(parseInt(e.target.value, 10) || 1)} className="w-full sm:w-24" />
{/* Tier Selection */}
{voipTiers.map((tier, index) => { const isSelected = voipSelection.tierId === tier.id; const monthlyPrice = tier.pricePerUser * voipSelection.userCount; return ( onSetVoIPTier(tier.id)} > {tier.recommended && (
Popular
)}

{tier.name}

{tier.description}

{formatCurrency(monthlyPrice)} /mo

{formatCurrency(tier.pricePerUser)}/user

    {tier.features.slice(0, 3).map((feature, idx) => (
  • {feature}
  • ))}
); })}
{/* Hardware Section */}
{showHardware && ( {voipHardware.map((hardware) => { const selection = getHardwareSelection(hardware.id); const isSelected = !!selection; return (

{hardware.name}

{hardware.description}

Buy: {formatCurrency(hardware.oneTimePrice)} Rent: {formatCurrency(hardware.monthlyRental)}/mo
{isSelected ? (
{selection.quantity}
) : (
)}
); })}
)}
{/* Info */}
  • Unlimited local and long-distance calling
  • Mobile apps for iOS and Android - take calls anywhere
  • Auto-attendant and professional voicemail
  • Keep your existing phone numbers
{/* Totals */}
VoIP Monthly Total {formatCurrency(getVoIPMonthly())} /mo
{getVoIPOneTime() > 0 && (
Hardware Purchase (One-Time) {formatCurrency(getVoIPOneTime())}
)}
)}
{!voipSelection.enabled && (

You can always add VoIP services later.

)}
); }