import { StrictMode, useState, useEffect, lazy, Suspense } from 'react' import { createRoot } from 'react-dom/client' import './index.css' import Landing from './Landing.jsx' import { AuthProvider, useAuth } from './contexts/AuthContext' import { capture as captureAttribution } from './lib/attribution' import PricingPage from './components/PricingPage' import AccountPage from './components/AccountPage' import LoginModal from './components/LoginModal' const App = lazy(() => import('./App.jsx')) const Legal = lazy(() => import('./Legal.jsx')) const OAuthConsent = lazy(() => import('./components/OAuthConsent')) function PageShell({ title, children }) { return (
OpenShorts ← Back to appback
{title &&

{title}

} {children}
); } function PricingView() { const [showLogin, setShowLogin] = useState(false); return ( setShowLogin(true)} /> {showLogin && setShowLogin(false)} />} ); } function AccountView() { const { isSignedIn, loading } = useAuth(); useEffect(() => { if (!loading && !isSignedIn) window.location.hash = '#/pricing'; }, [loading, isSignedIn]); return ; } // Landing spot after an account is erased. Its own view because the session is // gone: sending the user to #/account would bounce them to pricing with no // explanation, and "openshorts_skip_landing" would send them into the app. function DeletedView() { return (

Your account is deleted

Your projects, clips and transcripts are gone, any subscription is cancelled, and your API keys no longer work. We've emailed you a confirmation with the details.

You're welcome back any time — signing up again with the same address starts a brand-new, empty account.

Back to openshorts.app
); } function Root() { const resolveView = () => { const hash = window.location.hash || ''; if (hash.startsWith('#/auth/')) return 'auth'; // AuthContext consumes then redirects if (hash.startsWith('#/oauth/authorize')) return 'oauth'; if (hash.startsWith('#/account')) return 'account'; if (hash.startsWith('#/deleted')) return 'deleted'; if (hash.startsWith('#/pricing')) return 'pricing'; if (hash === '#legal') return 'legal'; // #landing = explicit landing view (app logo); section anchors keep the landing mounted if (['#landing', '#features', '#how-it-works', '#pricing', '#comparison', '#faq'].includes(hash)) return 'landing'; if (hash === '#app' || hash.startsWith('#app?') || localStorage.getItem('openshorts_skip_landing') === '1') return 'app'; return 'landing'; }; const [view, setView] = useState(resolveView); useEffect(() => { const handleHashChange = () => setView(resolveView()); window.addEventListener('hashchange', handleHashChange); return () => window.removeEventListener('hashchange', handleHashChange); }, []); const handleLaunchApp = () => { localStorage.setItem('openshorts_skip_landing', '1'); window.location.hash = '#app'; setView('app'); }; if (view === 'legal') return ; if (view === 'pricing') return ; if (view === 'account') return ; if (view === 'oauth') return ; if (view === 'deleted') return ; if (view === 'auth') { return
Signing you in…
; } if (view === 'app') return ; return ; } // Before React mounts: AuthContext rewrites the URL on auth redirects, which // would destroy the referrer and any UTM params we still need to read. captureAttribution(); createRoot(document.getElementById('root')).render( loading…}> , )