import React from 'react'; import { useNavigate, useOutletContext } from 'react-router-dom'; import { Clock, ArrowRight, Check, X, CreditCard, TrendingDown, AlertTriangle } from 'lucide-react'; import { User, Business } from '../types'; /** * TrialExpired Page * Shown when a business trial has expired and they need to either upgrade or downgrade to free tier */ const TrialExpired: React.FC = () => { const navigate = useNavigate(); const { user, business } = useOutletContext<{ user: User; business: Business }>(); const isOwner = user.role === 'owner'; // Feature comparison based on tier const getTierFeatures = (tier: string | undefined) => { switch (tier) { case 'Professional': return [ { name: 'Unlimited appointments', included: true }, { name: 'Online booking portal', included: true }, { name: 'Email notifications', included: true }, { name: 'SMS reminders', included: true }, { name: 'Custom branding', included: true }, { name: 'Advanced analytics', included: true }, { name: 'Payment processing', included: true }, { name: 'Priority support', included: true }, ]; case 'Business': return [ { name: 'Everything in Professional', included: true }, { name: 'Multiple locations', included: true }, { name: 'Team management', included: true }, { name: 'API access', included: true }, { name: 'Custom domain', included: true }, { name: 'White-label options', included: true }, { name: 'Dedicated account manager', included: true }, ]; case 'Enterprise': return [ { name: 'Everything in Business', included: true }, { name: 'Unlimited users', included: true }, { name: 'Custom integrations', included: true }, { name: 'SLA guarantee', included: true }, { name: 'Custom contract terms', included: true }, { name: '24/7 phone support', included: true }, { name: 'On-premise deployment option', included: true }, ]; default: return []; } }; const freeTierFeatures = [ { name: 'Up to 50 appointments/month', included: true }, { name: 'Basic online booking', included: true }, { name: 'Email notifications', included: true }, { name: 'SMS reminders', included: false }, { name: 'Custom branding', included: false }, { name: 'Advanced analytics', included: false }, { name: 'Payment processing', included: false }, { name: 'Priority support', included: false }, ]; const paidTierFeatures = getTierFeatures(business.plan); const handleUpgrade = () => { navigate('/payments'); }; const handleDowngrade = () => { if (window.confirm('Are you sure you want to downgrade to the Free plan? You will lose access to premium features immediately.')) { // TODO: Implement downgrade to free tier API call console.log('Downgrading to free tier...'); } }; return (
{/* Main Card */}
{/* Header */}

Your 14-Day Trial Has Expired

Your trial of the {business.plan} plan ended on{' '} {business.trialEnd ? new Date(business.trialEnd).toLocaleDateString() : 'N/A'}

{/* Content */}

What happens now?

You have two options to continue using SmoothSchedule:

{/* Feature Comparison */}
{/* Free Tier Card */}

Free Plan

$0/month
    {freeTierFeatures.map((feature, idx) => (
  • {feature.included ? ( ) : ( )} {feature.name}
  • ))}
{isOwner && ( )}
{/* Paid Tier Card */}
Recommended

{business.plan} Plan

Continue where you left off

    {paidTierFeatures.slice(0, 8).map((feature, idx) => (
  • {feature.name}
  • ))} {paidTierFeatures.length > 8 && (
  • + {paidTierFeatures.length - 8} more features
  • )}
{isOwner && ( )}
{/* Important Notice */}

{isOwner ? 'Your account has limited functionality until you choose an option.' : 'Please contact your business owner to upgrade or downgrade the account.'}

{!isOwner && (

Business Owner: {business.name}

)}
{/* Footer */}

Questions? Contact our support team at{' '} support@smoothschedule.com

); }; export default TrialExpired;