import React, { Suspense, lazy } from 'react'; import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; import { Helmet, HelmetProvider } from 'react-helmet-async'; import { Toaster } from '@/components/ui/toaster'; import { SupabaseAuthProvider } from '@/contexts/SupabaseAuthContext'; import { TenantProvider } from '@/contexts/TenantContext'; import ScrollToTop from '@/components/common/ScrollToTop'; import LoadingSpinner from '@/components/common/LoadingSpinner'; // Layout Components const PublicLayout = lazy(() => import('@/components/layout/PublicLayout')); const DashboardLayout = lazy(() => import('@/components/layout/DashboardLayout')); const AdminLayout = lazy(() => import('@/components/layout/AdminLayout')); const ProtectedRoute = lazy(() => import('@/components/auth/ProtectedRoute')); // Public Pages const LandingPage = lazy(() => import('@/pages/LandingPage.jsx')); const AboutPage = lazy(() => import('@/pages/AboutPage.jsx')); const ContactPage = lazy(() => import('@/pages/ContactPage.jsx')); const FAQPage = lazy(() => import('@/pages/FAQPage.jsx')); const AddressesPage = lazy(() => import('@/pages/AddressesPage.jsx')); const PricingPage = lazy(() => import('@/pages/PricingPage.jsx')); const LoginPage = lazy(() => import('@/pages/LoginPage.jsx')); const SignupPage = lazy(() => import('@/pages/SignupPage.jsx')); const TermsPage = lazy(() => import('@/pages/legal/TermsPage.jsx')); const PrivacyPage = lazy(() => import('@/pages/legal/PrivacyPage.jsx')); const RefundPage = lazy(() => import('@/pages/legal/RefundPage.jsx')); const BusinessSetupPage = lazy(() => import('@/pages/services/BusinessSetupPage.jsx')); const MailServicePage = lazy(() => import('@/pages/services/MailServicePage.jsx')); const PhoneServicePage = lazy(() => import('@/pages/services/PhoneServicePage.jsx')); const BlogPage = lazy(() => import('@/pages/blog/BlogPage.jsx')); const BlogPostPage = lazy(() => import('@/pages/blog/BlogPostPage.jsx')); // Subscription & Checkout const SubscribePage = lazy(() => import('@/pages/SubscribePage.jsx')); const CheckoutCallbackPage = lazy(() => import('@/pages/CheckoutCallbackPage.jsx')); // Protected Pages const DashboardPage = lazy(() => import('@/pages/dashboard/DashboardPage.jsx')); const BillingPage = lazy(() => import('@/pages/dashboard/BillingPage.jsx')); const MailPage = lazy(() => import('@/pages/dashboard/MailPage.jsx')); const PhonePage = lazy(() => import('@/pages/dashboard/PhonePage.jsx')); const SMSPage = lazy(() => import('@/pages/dashboard/SMSPage.jsx')); const MyDetailsPage = lazy(() => import('@/pages/dashboard/MyDetailsPage.jsx')); const TeamPage = lazy(() => import('@/pages/dashboard/TeamPage.jsx')); const SettingsPage = lazy(() => import('@/pages/dashboard/SettingsPage.jsx')); // Admin Pages const AdminDashboard = lazy(() => import('@/pages/admin/AdminDashboard.jsx')); const AdminTenants = lazy(() => import('@/pages/admin/AdminTenants.jsx')); const AdminUsers = lazy(() => import('@/pages/admin/AdminUsers.jsx')); const AdminKYC = lazy(() => import('@/pages/admin/AdminKYC.jsx')); const PageLoader = () => (