Merge pull request 'feat(routing): serve public landing at / and move authed index to /home' (#174) from feat/public-landing-routing-refactor into main
This commit was merged in pull request #174.
This commit is contained in:
@@ -7,7 +7,7 @@ test.describe('authentication smoke tests', () => {
|
||||
test('team admin can sign in through the login form', async ({ page }) => {
|
||||
await signIn(page)
|
||||
|
||||
await expect(page).toHaveURL(/\/$/)
|
||||
await expect(page).toHaveURL(/\/home$/)
|
||||
await expect(page.getByTestId('app-shell')).toBeVisible()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,7 +4,7 @@ test.use({ storageState: { cookies: [], origins: [] } })
|
||||
|
||||
test.describe('public route smoke tests', () => {
|
||||
test('landing page loads', async ({ page }) => {
|
||||
await page.goto('/landing')
|
||||
await page.goto('/')
|
||||
|
||||
await expect(
|
||||
page.getByRole('link', { name: 'Start Free', exact: true }),
|
||||
@@ -17,7 +17,7 @@ test.describe('public route smoke tests', () => {
|
||||
test('protected routes redirect unauthenticated users to landing', async ({ page }) => {
|
||||
await page.goto('/sessions')
|
||||
|
||||
await expect(page).toHaveURL(/\/landing$/)
|
||||
await expect(page).toHaveURL(/\/$/)
|
||||
await expect(
|
||||
page.getByRole('link', { name: 'Sign In' }),
|
||||
).toBeVisible()
|
||||
|
||||
36
frontend/public/robots.txt
Normal file
36
frontend/public/robots.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
Allow: /terms
|
||||
Allow: /policies
|
||||
Allow: /privacy
|
||||
Allow: /contact
|
||||
Allow: /contact-sales
|
||||
Allow: /pricing
|
||||
Allow: /promotions
|
||||
Allow: /templates
|
||||
Disallow: /home
|
||||
Disallow: /trees/
|
||||
Disallow: /my-trees
|
||||
Disallow: /pilot/
|
||||
Disallow: /admin/
|
||||
Disallow: /account/
|
||||
Disallow: /script-builder
|
||||
Disallow: /scripts
|
||||
Disallow: /sessions
|
||||
Disallow: /analytics
|
||||
Disallow: /escalations
|
||||
Disallow: /queue
|
||||
Disallow: /review-queue
|
||||
Disallow: /network-diagrams
|
||||
Disallow: /kb-accelerator
|
||||
Disallow: /step-library
|
||||
Disallow: /tickets
|
||||
Disallow: /shares
|
||||
Disallow: /feedback
|
||||
Disallow: /welcome
|
||||
Disallow: /flow-assist
|
||||
Disallow: /dev/
|
||||
Disallow: /flows/
|
||||
Disallow: /guides
|
||||
|
||||
Sitemap: https://resolutionflow.com/sitemap.xml
|
||||
57
frontend/public/sitemap.xml
Normal file
57
frontend/public/sitemap.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://resolutionflow.com/</loc>
|
||||
<lastmod>2026-05-13</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://resolutionflow.com/pricing</loc>
|
||||
<lastmod>2026-05-13</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.9</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://resolutionflow.com/contact-sales</loc>
|
||||
<lastmod>2026-05-13</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://resolutionflow.com/contact</loc>
|
||||
<lastmod>2026-05-13</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.7</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://resolutionflow.com/templates</loc>
|
||||
<lastmod>2026-05-13</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.7</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://resolutionflow.com/terms</loc>
|
||||
<lastmod>2026-05-13</lastmod>
|
||||
<changefreq>yearly</changefreq>
|
||||
<priority>0.4</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://resolutionflow.com/privacy</loc>
|
||||
<lastmod>2026-05-13</lastmod>
|
||||
<changefreq>yearly</changefreq>
|
||||
<priority>0.4</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://resolutionflow.com/policies</loc>
|
||||
<lastmod>2026-05-13</lastmod>
|
||||
<changefreq>yearly</changefreq>
|
||||
<priority>0.4</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://resolutionflow.com/promotions</loc>
|
||||
<lastmod>2026-05-13</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.4</priority>
|
||||
</url>
|
||||
</urlset>
|
||||
@@ -5,6 +5,8 @@ interface PageMetaProps {
|
||||
description?: string
|
||||
ogImage?: string
|
||||
ogType?: string
|
||||
/** Canonical/Open Graph URL. Defaults to `window.location.href` in the browser. */
|
||||
url?: string
|
||||
}
|
||||
|
||||
const SITE_NAME = 'ResolutionFlow'
|
||||
@@ -20,8 +22,12 @@ export function PageMeta({
|
||||
description = DEFAULT_DESCRIPTION,
|
||||
ogImage,
|
||||
ogType = 'website',
|
||||
url,
|
||||
}: PageMetaProps) {
|
||||
const fullTitle = title ? `${title} | ${SITE_NAME}` : `${SITE_NAME} — ${DEFAULT_TAGLINE}`
|
||||
const resolvedUrl =
|
||||
url ?? (typeof window !== 'undefined' ? window.location.href : undefined)
|
||||
const twitterCard = ogImage ? 'summary_large_image' : 'summary'
|
||||
|
||||
return (
|
||||
<Helmet>
|
||||
@@ -33,10 +39,11 @@ export function PageMeta({
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:type" content={ogType} />
|
||||
<meta property="og:site_name" content={SITE_NAME} />
|
||||
{resolvedUrl && <meta property="og:url" content={resolvedUrl} />}
|
||||
{ogImage && <meta property="og:image" content={ogImage} />}
|
||||
|
||||
{/* Twitter */}
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<meta name="twitter:card" content={twitterCard} />
|
||||
<meta name="twitter:title" content={fullTitle} />
|
||||
<meta name="twitter:description" content={description} />
|
||||
{ogImage && <meta name="twitter:image" content={ogImage} />}
|
||||
|
||||
@@ -79,7 +79,7 @@ export function pickNextStep(
|
||||
title: 'Run your first FlowPilot session',
|
||||
description: 'Paste a ticket or pick a flow to see ResolutionFlow in action.',
|
||||
ctaLabel: 'Start a session',
|
||||
ctaPath: '/',
|
||||
ctaPath: '/home',
|
||||
}
|
||||
}
|
||||
if (!status.connected_psa) {
|
||||
|
||||
@@ -51,7 +51,7 @@ export function buildChecklistItems(
|
||||
{
|
||||
key: 'ran_session',
|
||||
label: 'Run your first FlowPilot session',
|
||||
path: '/',
|
||||
path: '/home',
|
||||
done: status.ran_session,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ export function AppLayout() {
|
||||
}
|
||||
|
||||
const mobileNavItems = [
|
||||
{ path: '/', label: 'Dashboard', icon: LayoutGrid },
|
||||
{ path: '/home', label: 'Dashboard', icon: LayoutGrid },
|
||||
{ path: '/sessions', label: 'Session History', icon: Clock },
|
||||
{ path: '/escalations', label: 'Escalations', icon: AlertTriangle },
|
||||
{ path: '/trees', label: 'Guided Flows', icon: GitBranch },
|
||||
@@ -106,7 +106,7 @@ export function AppLayout() {
|
||||
style={{ background: 'var(--color-bg-sidebar)', borderRight: '1px solid var(--color-border-default)' }}
|
||||
>
|
||||
<div className="flex h-14 items-center justify-between px-4" style={{ borderBottom: '1px solid var(--color-border-default)' }}>
|
||||
<Link to="/" className="flex items-center gap-2.5">
|
||||
<Link to="/home" className="flex items-center gap-2.5">
|
||||
<BrandLogo size="sm" />
|
||||
<span className="text-sm font-heading font-bold text-text-heading">ResolutionFlow</span>
|
||||
</Link>
|
||||
|
||||
@@ -40,7 +40,7 @@ interface Group {
|
||||
}
|
||||
|
||||
const PAGES: PaletteItem[] = [
|
||||
{ id: 'page-dashboard', group: 'pages', title: 'Dashboard', path: '/', icon: 'page' },
|
||||
{ id: 'page-dashboard', group: 'pages', title: 'Dashboard', path: '/home', icon: 'page' },
|
||||
{ id: 'page-flows', group: 'pages', title: 'All Flows', subtitle: 'Browse your flow library', path: '/trees', icon: 'page' },
|
||||
{ id: 'page-sessions', group: 'pages', title: 'Sessions', subtitle: 'View session history', path: '/sessions', icon: 'page' },
|
||||
{ id: 'page-flowpilot', group: 'pages', title: 'FlowPilot', subtitle: 'AI troubleshooting', path: '/pilot', icon: 'page' },
|
||||
|
||||
@@ -22,7 +22,7 @@ export function ProtectedRoute({ requiredRole, children }: ProtectedRouteProps)
|
||||
}
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return <Navigate to="/landing" state={{ from: location }} replace />
|
||||
return <Navigate to="/" state={{ from: location }} replace />
|
||||
}
|
||||
|
||||
// Enforce must_change_password — redirect unless already on /change-password
|
||||
|
||||
@@ -63,7 +63,7 @@ export function TopBar() {
|
||||
>
|
||||
{/* Logo area */}
|
||||
<Link
|
||||
to="/"
|
||||
to="/home"
|
||||
className="flex items-center gap-2.5 pr-4 transition-all duration-200"
|
||||
>
|
||||
<BrandLogo size="sm" />
|
||||
|
||||
@@ -71,11 +71,11 @@ const FROZEN_NOW = new Date('2026-05-06T00:00:00Z')
|
||||
|
||||
function renderAppLayout() {
|
||||
return render(
|
||||
<MemoryRouter initialEntries={['/']}>
|
||||
<MemoryRouter initialEntries={['/home']}>
|
||||
<Routes>
|
||||
<Route element={<AppLayout />}>
|
||||
<Route
|
||||
index
|
||||
path="/home"
|
||||
element={<div data-testid="child-route-content">child route</div>}
|
||||
/>
|
||||
</Route>
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { MemoryRouter, Routes, Route, useLocation } from 'react-router-dom'
|
||||
|
||||
import { ProtectedRoute } from '../ProtectedRoute'
|
||||
import { useAuthStore } from '@/store/authStore'
|
||||
|
||||
/**
|
||||
* Probe component: surfaces the current pathname and `location.state.from` so
|
||||
* the test can assert both the redirect target and that the original
|
||||
* destination is preserved for post-login return.
|
||||
*/
|
||||
function LocationProbe() {
|
||||
const loc = useLocation()
|
||||
const from =
|
||||
(loc.state as { from?: { pathname?: string } } | null)?.from?.pathname ?? ''
|
||||
return (
|
||||
<>
|
||||
<div data-testid="probe-pathname">{loc.pathname}</div>
|
||||
<div data-testid="probe-from">{from}</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
describe('ProtectedRoute — unauthenticated redirect', () => {
|
||||
beforeEach(() => {
|
||||
useAuthStore.setState({
|
||||
user: null,
|
||||
token: null,
|
||||
isAuthenticated: false,
|
||||
isLoading: false,
|
||||
})
|
||||
})
|
||||
|
||||
it('redirects unauthenticated visits to /home → / and preserves origin in state.from', () => {
|
||||
render(
|
||||
<MemoryRouter initialEntries={['/home']}>
|
||||
<Routes>
|
||||
<Route
|
||||
path="/home"
|
||||
element={
|
||||
<ProtectedRoute>
|
||||
<div data-testid="home-content">home</div>
|
||||
</ProtectedRoute>
|
||||
}
|
||||
/>
|
||||
<Route path="/" element={<LocationProbe />} />
|
||||
</Routes>
|
||||
</MemoryRouter>,
|
||||
)
|
||||
|
||||
// The protected page should not render.
|
||||
expect(screen.queryByTestId('home-content')).not.toBeInTheDocument()
|
||||
|
||||
// We landed on / (the public landing route), not /landing.
|
||||
expect(screen.getByTestId('probe-pathname')).toHaveTextContent('/')
|
||||
expect(screen.getByTestId('probe-from')).toHaveTextContent('/home')
|
||||
})
|
||||
})
|
||||
@@ -2416,7 +2416,7 @@ export default function AssistantChatPage() {
|
||||
setShowConclude(false)
|
||||
if (activeSessionStatus === 'escalated') {
|
||||
toast.info('Session escalated. Heading back to your dashboard.')
|
||||
navigate('/')
|
||||
navigate('/home')
|
||||
}
|
||||
}}
|
||||
onConclude={handleConclude}
|
||||
|
||||
@@ -7,7 +7,7 @@ export default function ContactPage() {
|
||||
<PageMeta title="Contact" description="Contact ResolutionFlow customer service, sales, billing, or security." />
|
||||
<div className="min-h-screen bg-background text-foreground">
|
||||
<div className="mx-auto max-w-3xl px-6 py-16">
|
||||
<Link to="/landing" className="text-sm text-muted-foreground hover:text-foreground mb-8 inline-block">← Back to home</Link>
|
||||
<Link to="/" className="text-sm text-muted-foreground hover:text-foreground mb-8 inline-block">← Back to home</Link>
|
||||
<h1 className="text-3xl font-bold font-heading mb-4">Contact ResolutionFlow</h1>
|
||||
<p className="text-muted-foreground mb-10">
|
||||
We respond to customer inquiries Monday through Friday during U.S. business hours, excluding federal holidays. Email is the fastest path to a response.
|
||||
|
||||
@@ -112,10 +112,10 @@ export function OAuthCallbackPage() {
|
||||
|
||||
// Invitee path lands on the dashboard with the teammate-welcome
|
||||
// marker; new self-serve owners go to the welcome wizard; returning
|
||||
// users to /.
|
||||
let dest = '/'
|
||||
// users to /home.
|
||||
let dest = '/home'
|
||||
if (decoded?.accountInviteCode) {
|
||||
dest = '/?welcome=teammate'
|
||||
dest = '/home?welcome=teammate'
|
||||
} else if (result.is_new_user) {
|
||||
dest = '/welcome'
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ export default function PoliciesPage() {
|
||||
<PageMeta title="Customer Policies" description="ResolutionFlow customer service, billing, refunds, cancellation, legal restrictions, and promotional terms." />
|
||||
<div className="min-h-screen bg-background text-foreground">
|
||||
<div className="mx-auto max-w-3xl px-6 py-16">
|
||||
<Link to="/landing" className="text-sm text-muted-foreground hover:text-foreground mb-8 inline-block">← Back to home</Link>
|
||||
<Link to="/" className="text-sm text-muted-foreground hover:text-foreground mb-8 inline-block">← Back to home</Link>
|
||||
<h1 className="text-3xl font-bold font-heading mb-4">Customer Policies</h1>
|
||||
<p className="text-muted-foreground mb-2">Last updated: May 7, 2026</p>
|
||||
<p className="text-muted-foreground mb-2"><strong className="text-foreground">Operator:</strong> ResolutionFlow, LLC (the “Company”), operator of ResolutionFlow (“Service”).</p>
|
||||
|
||||
@@ -7,7 +7,7 @@ export default function PrivacyPage() {
|
||||
<PageMeta title="Privacy Policy" description="ResolutionFlow Privacy Policy" />
|
||||
<div className="min-h-screen bg-background text-foreground">
|
||||
<div className="mx-auto max-w-3xl px-6 py-16">
|
||||
<Link to="/landing" className="text-sm text-muted-foreground hover:text-foreground mb-8 inline-block">← Back to home</Link>
|
||||
<Link to="/" className="text-sm text-muted-foreground hover:text-foreground mb-8 inline-block">← Back to home</Link>
|
||||
<h1 className="text-3xl font-bold font-heading mb-8">Privacy Policy</h1>
|
||||
<p className="text-muted-foreground mb-6">Last updated: March 21, 2026</p>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ export default function PromotionsPage() {
|
||||
<PageMeta title="Promotions" description="Active ResolutionFlow promotional offers and their terms." />
|
||||
<div className="min-h-screen bg-background text-foreground">
|
||||
<div className="mx-auto max-w-3xl px-6 py-16">
|
||||
<Link to="/landing" className="text-sm text-muted-foreground hover:text-foreground mb-8 inline-block">← Back to home</Link>
|
||||
<Link to="/" className="text-sm text-muted-foreground hover:text-foreground mb-8 inline-block">← Back to home</Link>
|
||||
<h1 className="text-3xl font-bold font-heading mb-4">Promotions</h1>
|
||||
<p className="text-muted-foreground mb-10">Last updated: May 7, 2026</p>
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ export default function PublicTemplatesPage() {
|
||||
{/* Header */}
|
||||
<header className="sticky top-0 z-40 border-b border-border bg-background/80">
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-16 flex items-center justify-between">
|
||||
<Link to="/landing" className="flex items-center gap-2.5">
|
||||
<Link to="/" className="flex items-center gap-2.5">
|
||||
<BrandLogo size="sm" />
|
||||
<span className="font-heading text-lg font-semibold">
|
||||
<span className="text-foreground">Resolution</span>
|
||||
@@ -406,7 +406,7 @@ export default function PublicTemplatesPage() {
|
||||
<footer className="border-t border-border py-8 px-4 sm:px-6 lg:px-8">
|
||||
<div className="max-w-7xl mx-auto flex items-center justify-between">
|
||||
<Link
|
||||
to="/landing"
|
||||
to="/"
|
||||
className="text-muted-foreground text-sm hover:text-foreground transition-colors"
|
||||
>
|
||||
Powered by <span className="font-semibold">ResolutionFlow</span>
|
||||
|
||||
@@ -423,7 +423,7 @@ export default function SessionHistoryPage() {
|
||||
description="Start a FlowPilot or chat session to begin. All your sessions will appear here."
|
||||
action={
|
||||
<Link
|
||||
to="/"
|
||||
to="/home"
|
||||
className="inline-flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-semibold text-white hover:brightness-110 active:scale-[0.98] transition-all"
|
||||
>
|
||||
Start a Session
|
||||
|
||||
@@ -7,7 +7,7 @@ export default function TermsPage() {
|
||||
<PageMeta title="Terms of Service" description="ResolutionFlow Terms of Service" />
|
||||
<div className="min-h-screen bg-background text-foreground">
|
||||
<div className="mx-auto max-w-3xl px-6 py-16">
|
||||
<Link to="/landing" className="text-sm text-muted-foreground hover:text-foreground mb-8 inline-block">← Back to home</Link>
|
||||
<Link to="/" className="text-sm text-muted-foreground hover:text-foreground mb-8 inline-block">← Back to home</Link>
|
||||
<h1 className="text-3xl font-bold font-heading mb-8">Terms of Service</h1>
|
||||
<p className="text-muted-foreground mb-6">Last updated: March 21, 2026</p>
|
||||
|
||||
|
||||
@@ -20,8 +20,7 @@ const SUCCESS_REDIRECT_MS = 1200
|
||||
* "Already verified" state. No API call.
|
||||
* - Else fire `POST /auth/email/verify` exactly once (a `useRef` guard keeps
|
||||
* React 19 strict-mode double-invoke from double-firing the call). On
|
||||
* success, refresh the auth store and bounce to `/?verified=1` so the
|
||||
* dashboard surfaces a toast.
|
||||
* success, refresh the auth store and bounce to `/home`.
|
||||
* - On error, show "Invalid or expired token" + a "Resend" CTA that calls
|
||||
* `POST /auth/email/send-verification`.
|
||||
*/
|
||||
@@ -70,10 +69,9 @@ export function VerifyEmailPage() {
|
||||
if (cancelled) return
|
||||
setStatus('success')
|
||||
toast.success('Email verified')
|
||||
// Brief success state, then redirect with a query flag so the
|
||||
// dashboard can re-surface confirmation if it wants to.
|
||||
// Brief success state, then redirect to the dashboard.
|
||||
window.setTimeout(() => {
|
||||
navigate('/?verified=1', { replace: true })
|
||||
navigate('/home', { replace: true })
|
||||
}, SUCCESS_REDIRECT_MS)
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -126,7 +124,7 @@ export function VerifyEmailPage() {
|
||||
Redirecting you to the dashboard…
|
||||
</p>
|
||||
<Link
|
||||
to="/?verified=1"
|
||||
to="/home"
|
||||
replace
|
||||
className={cn(
|
||||
'mt-6 inline-flex items-center rounded-lg bg-primary px-6 py-2 text-sm font-semibold text-primary-foreground',
|
||||
@@ -149,7 +147,7 @@ export function VerifyEmailPage() {
|
||||
action needed.
|
||||
</p>
|
||||
<Link
|
||||
to="/"
|
||||
to="/home"
|
||||
className={cn(
|
||||
'mt-6 inline-flex items-center rounded-lg bg-primary px-6 py-2 text-sm font-semibold text-primary-foreground',
|
||||
'hover:brightness-110',
|
||||
@@ -181,7 +179,7 @@ export function VerifyEmailPage() {
|
||||
Resend verification email
|
||||
</button>
|
||||
<Link
|
||||
to="/"
|
||||
to="/home"
|
||||
className={cn(
|
||||
'inline-flex items-center justify-center rounded-lg border border-default bg-input px-6 py-2 text-sm font-medium text-foreground',
|
||||
'hover:border-border-hover',
|
||||
@@ -204,7 +202,7 @@ export function VerifyEmailPage() {
|
||||
Try the link in your verification email again.
|
||||
</p>
|
||||
<Link
|
||||
to="/"
|
||||
to="/home"
|
||||
className={cn(
|
||||
'mt-6 inline-flex items-center rounded-lg bg-primary px-6 py-2 text-sm font-semibold text-primary-foreground',
|
||||
'hover:brightness-110',
|
||||
|
||||
@@ -52,7 +52,7 @@ function renderPage(initialPath: string) {
|
||||
<MemoryRouter initialEntries={[initialPath]}>
|
||||
<Routes>
|
||||
<Route path="/verify-email" element={<VerifyEmailPage />} />
|
||||
<Route path="/" element={<div>dashboard</div>} />
|
||||
<Route path="/home" element={<div>dashboard</div>} />
|
||||
</Routes>
|
||||
</MemoryRouter>
|
||||
</HelmetProvider>,
|
||||
@@ -130,7 +130,7 @@ describe('VerifyEmailPage', () => {
|
||||
<MemoryRouter initialEntries={['/verify-email?token=valid-token']}>
|
||||
<Routes>
|
||||
<Route path="/verify-email" element={<VerifyEmailPage />} />
|
||||
<Route path="/" element={<div>dashboard</div>} />
|
||||
<Route path="/home" element={<div>dashboard</div>} />
|
||||
</Routes>
|
||||
</MemoryRouter>
|
||||
</HelmetProvider>,
|
||||
@@ -142,7 +142,7 @@ describe('VerifyEmailPage', () => {
|
||||
<MemoryRouter initialEntries={['/verify-email?token=valid-token']}>
|
||||
<Routes>
|
||||
<Route path="/verify-email" element={<VerifyEmailPage />} />
|
||||
<Route path="/" element={<div>dashboard</div>} />
|
||||
<Route path="/home" element={<div>dashboard</div>} />
|
||||
</Routes>
|
||||
</MemoryRouter>
|
||||
</HelmetProvider>,
|
||||
|
||||
@@ -6,8 +6,8 @@ import { PageLoader } from '@/components/common/PageLoader'
|
||||
* `/welcome` index — redirect to the next incomplete step (or `/` if done /
|
||||
* dismissed). Decision table:
|
||||
*
|
||||
* onboarding_dismissed === true → /
|
||||
* onboarding_step_completed >= 3 → /
|
||||
* onboarding_dismissed === true → /home
|
||||
* onboarding_step_completed >= 3 → /home
|
||||
* onboarding_step_completed === null/0 → /welcome/step-1
|
||||
* onboarding_step_completed === 1 → /welcome/step-2
|
||||
* onboarding_step_completed === 2 → /welcome/step-3
|
||||
@@ -19,10 +19,10 @@ export function WelcomeRouter() {
|
||||
// the page loader rather than racing past the redirect.
|
||||
if (!user) return <PageLoader />
|
||||
|
||||
if (user.onboarding_dismissed) return <Navigate to="/" replace />
|
||||
if (user.onboarding_dismissed) return <Navigate to="/home" replace />
|
||||
|
||||
const completed = user.onboarding_step_completed ?? 0
|
||||
if (completed >= 3) return <Navigate to="/" replace />
|
||||
if (completed >= 3) return <Navigate to="/home" replace />
|
||||
if (completed === 2) return <Navigate to="/welcome/step-3" replace />
|
||||
if (completed === 1) return <Navigate to="/welcome/step-2" replace />
|
||||
return <Navigate to="/welcome/step-1" replace />
|
||||
|
||||
@@ -85,7 +85,7 @@ export function WelcomeStep1() {
|
||||
try {
|
||||
await onboardingApi.dismissRest()
|
||||
await fetchUser()
|
||||
navigate('/')
|
||||
navigate('/home')
|
||||
} catch {
|
||||
setError('Could not save. Please try again.')
|
||||
setSubmitting(null)
|
||||
|
||||
@@ -90,7 +90,7 @@ export function WelcomeStep2() {
|
||||
try {
|
||||
await onboardingApi.dismissRest()
|
||||
await fetchUser()
|
||||
navigate('/')
|
||||
navigate('/home')
|
||||
} catch {
|
||||
setError('Could not save. Please try again.')
|
||||
setSubmitting(null)
|
||||
|
||||
@@ -39,7 +39,7 @@ function makeEmptyRow(): InviteRow {
|
||||
*
|
||||
* 1. POST `/accounts/me/invites/bulk` with populated rows.
|
||||
* 2. PATCH `/users/me/onboarding-step` `{step: 3, action: "complete"}`.
|
||||
* 3. Navigate to `/?welcome=true` and fire a "You're all set" toast.
|
||||
* 3. Navigate to `/home` and fire a "You're all set" toast.
|
||||
*
|
||||
* Partial-failure UX: rows in `failed[]` keep their input and show an
|
||||
* inline error. The wizard does NOT auto-advance when there are failures —
|
||||
@@ -109,7 +109,7 @@ export function WelcomeStep3() {
|
||||
await onboardingApi.updateStep({ step: 3, action: 'complete' })
|
||||
await fetchUser()
|
||||
toast.success("You're all set!")
|
||||
navigate('/?welcome=true')
|
||||
navigate('/home')
|
||||
}
|
||||
|
||||
const handleSendInvites = async () => {
|
||||
@@ -177,7 +177,7 @@ export function WelcomeStep3() {
|
||||
await onboardingApi.updateStep({ step: 3, action: 'skip' })
|
||||
await fetchUser()
|
||||
toast.success("You're all set!")
|
||||
navigate('/?welcome=true')
|
||||
navigate('/home')
|
||||
} catch {
|
||||
setError('Could not save. Please try again.')
|
||||
setSubmitting(null)
|
||||
@@ -191,7 +191,7 @@ export function WelcomeStep3() {
|
||||
try {
|
||||
await onboardingApi.dismissRest()
|
||||
await fetchUser()
|
||||
navigate('/')
|
||||
navigate('/home')
|
||||
} catch {
|
||||
setError('Could not save. Please try again.')
|
||||
setSubmitting(null)
|
||||
|
||||
@@ -39,7 +39,7 @@ function renderRouter() {
|
||||
<Route path="/welcome/step-1" element={<div>step-1</div>} />
|
||||
<Route path="/welcome/step-2" element={<div>step-2</div>} />
|
||||
<Route path="/welcome/step-3" element={<div>step-3</div>} />
|
||||
<Route path="/" element={<div>dashboard</div>} />
|
||||
<Route path="/home" element={<div>dashboard</div>} />
|
||||
</Routes>
|
||||
</MemoryRouter>,
|
||||
)
|
||||
@@ -100,7 +100,7 @@ describe('WelcomeRouter', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('redirects to / when onboarding_step_completed >= 3', async () => {
|
||||
it('redirects to /home when onboarding_step_completed >= 3', async () => {
|
||||
useAuthStore.setState({
|
||||
user: makeUser({ onboarding_step_completed: 3 }),
|
||||
})
|
||||
@@ -110,7 +110,7 @@ describe('WelcomeRouter', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('redirects to / when onboarding_dismissed is true', async () => {
|
||||
it('redirects to /home when onboarding_dismissed is true', async () => {
|
||||
useAuthStore.setState({
|
||||
user: makeUser({
|
||||
onboarding_step_completed: 1,
|
||||
|
||||
@@ -65,7 +65,7 @@ function renderPage() {
|
||||
<Routes>
|
||||
<Route path="/welcome/step-1" element={<WelcomeStep1 />} />
|
||||
<Route path="/welcome/step-2" element={<div>step-2</div>} />
|
||||
<Route path="/" element={<div>dashboard</div>} />
|
||||
<Route path="/home" element={<div>dashboard</div>} />
|
||||
</Routes>
|
||||
</MemoryRouter>,
|
||||
)
|
||||
@@ -148,7 +148,7 @@ describe('WelcomeStep1', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('Skip-the-rest dismisses and navigates to /', async () => {
|
||||
it('Skip-the-rest dismisses and navigates to /home', async () => {
|
||||
const user = userEvent.setup()
|
||||
renderPage()
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ function renderPage() {
|
||||
<Route path="/welcome/step-2" element={<WelcomeStep2 />} />
|
||||
<Route path="/welcome/step-3" element={<div>step-3</div>} />
|
||||
<Route path="/account/integrations" element={<div>integrations</div>} />
|
||||
<Route path="/" element={<div>dashboard</div>} />
|
||||
<Route path="/home" element={<div>dashboard</div>} />
|
||||
</Routes>
|
||||
</MemoryRouter>,
|
||||
)
|
||||
@@ -158,7 +158,7 @@ describe('WelcomeStep2', () => {
|
||||
expect(screen.queryByTestId('welcome-step-2-connect-now')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('Skip-the-rest dismisses and navigates to /', async () => {
|
||||
it('Skip-the-rest dismisses and navigates to /home', async () => {
|
||||
const user = userEvent.setup()
|
||||
renderPage()
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ function renderPage() {
|
||||
<MemoryRouter initialEntries={['/welcome/step-3']}>
|
||||
<Routes>
|
||||
<Route path="/welcome/step-3" element={<WelcomeStep3 />} />
|
||||
<Route path="/" element={<div>dashboard</div>} />
|
||||
<Route path="/home" element={<div>dashboard</div>} />
|
||||
</Routes>
|
||||
</MemoryRouter>,
|
||||
)
|
||||
|
||||
@@ -7,6 +7,7 @@ import { RouteError } from '@/components/common/RouteError'
|
||||
import { ErrorBoundary } from '@/components/common/ErrorBoundary'
|
||||
import { PageLoader } from '@/components/common/PageLoader'
|
||||
import { lazyWithRetry } from '@/lib/lazyWithRetry'
|
||||
import { useAuthStore } from '@/store/authStore'
|
||||
|
||||
const sentryCreateBrowserRouter = Sentry.wrapCreateBrowserRouterV7(createBrowserRouter)
|
||||
import {
|
||||
@@ -118,10 +119,27 @@ function page(Component: React.LazyExoticComponent<React.ComponentType>) {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Public `/` wrapper — sends authenticated users to /home before LandingPage
|
||||
* mounts, so they never see marketing-frame flicker.
|
||||
*/
|
||||
// eslint-disable-next-line react-refresh/only-export-components -- router.tsx exports a router instance, not a component
|
||||
function PublicLanding() {
|
||||
const isAuthed = useAuthStore((s) => s.isAuthenticated)
|
||||
if (isAuthed) return <Navigate to="/home" replace />
|
||||
return page(LandingPage)
|
||||
}
|
||||
|
||||
export const router = sentryCreateBrowserRouter([
|
||||
{
|
||||
path: '/',
|
||||
element: <PublicLanding />,
|
||||
errorElement: <RouteError />,
|
||||
},
|
||||
// Stale-bookmark redirect — keep one release, delete in a follow-up.
|
||||
{
|
||||
path: '/landing',
|
||||
element: page(LandingPage),
|
||||
element: <Navigate to="/" replace />,
|
||||
errorElement: <RouteError />,
|
||||
},
|
||||
{
|
||||
@@ -229,7 +247,6 @@ export const router = sentryCreateBrowserRouter([
|
||||
errorElement: <RouteError />,
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
element: (
|
||||
<ProtectedRoute>
|
||||
<AppLayout />
|
||||
@@ -237,56 +254,56 @@ export const router = sentryCreateBrowserRouter([
|
||||
),
|
||||
errorElement: <RouteError />,
|
||||
children: [
|
||||
{ index: true, element: page(QuickStartPage) },
|
||||
{ path: 'trees', element: page(TreeLibraryPage) },
|
||||
{ path: 'my-trees', element: page(MyTreesPage) },
|
||||
{ path: 'trees/new', element: page(TreeEditorPage) },
|
||||
{ path: 'trees/:id/edit', element: page(TreeEditorPage) },
|
||||
{ path: 'flows/new', element: page(ProceduralEditorPage) },
|
||||
{ path: 'flows/:id/edit', element: page(ProceduralEditorPage) },
|
||||
{ path: 'flows/:id/navigate', element: page(ProceduralNavigationPage) },
|
||||
{ path: 'flows/:id/maintenance', element: page(MaintenanceFlowDetailPage) },
|
||||
{ path: 'flows/:id/batches/:batchId', element: page(BatchStatusPage) },
|
||||
{ path: 'trees/:id/navigate', element: page(TreeNavigationPage) },
|
||||
{ path: 'sessions', element: page(SessionHistoryPage) },
|
||||
{ path: 'sessions/:id', element: page(SessionDetailPage) },
|
||||
{ path: 'tickets', element: page(TicketsPage) },
|
||||
{ path: 'shares', element: page(MySharesPage) },
|
||||
{ path: 'analytics', element: page(TeamAnalyticsPage) },
|
||||
{ path: 'analytics/me', element: page(MyAnalyticsPage) },
|
||||
{ path: 'feedback', element: page(FeedbackPage) },
|
||||
{ path: 'step-library', element: page(StepLibraryPage) },
|
||||
{ path: 'scripts', element: page(ScriptLibraryPage) },
|
||||
{ path: 'scripts/manage', element: page(ScriptManagePage) },
|
||||
{ path: 'script-builder', element: page(ScriptBuilderPage) },
|
||||
{ path: 'network-diagrams', element: page(NetworkDiagramsPage) },
|
||||
{ path: 'network-diagrams/new', element: page(DiagramEditorPage) },
|
||||
{ path: 'network-diagrams/:id', element: page(DiagramEditorPage) },
|
||||
{ path: 'kb-accelerator', element: page(KBAcceleratorPage) },
|
||||
{ path: '/home', element: page(QuickStartPage) },
|
||||
{ path: '/trees', element: page(TreeLibraryPage) },
|
||||
{ path: '/my-trees', element: page(MyTreesPage) },
|
||||
{ path: '/trees/new', element: page(TreeEditorPage) },
|
||||
{ path: '/trees/:id/edit', element: page(TreeEditorPage) },
|
||||
{ path: '/flows/new', element: page(ProceduralEditorPage) },
|
||||
{ path: '/flows/:id/edit', element: page(ProceduralEditorPage) },
|
||||
{ path: '/flows/:id/navigate', element: page(ProceduralNavigationPage) },
|
||||
{ path: '/flows/:id/maintenance', element: page(MaintenanceFlowDetailPage) },
|
||||
{ path: '/flows/:id/batches/:batchId', element: page(BatchStatusPage) },
|
||||
{ path: '/trees/:id/navigate', element: page(TreeNavigationPage) },
|
||||
{ path: '/sessions', element: page(SessionHistoryPage) },
|
||||
{ path: '/sessions/:id', element: page(SessionDetailPage) },
|
||||
{ path: '/tickets', element: page(TicketsPage) },
|
||||
{ path: '/shares', element: page(MySharesPage) },
|
||||
{ path: '/analytics', element: page(TeamAnalyticsPage) },
|
||||
{ path: '/analytics/me', element: page(MyAnalyticsPage) },
|
||||
{ path: '/feedback', element: page(FeedbackPage) },
|
||||
{ path: '/step-library', element: page(StepLibraryPage) },
|
||||
{ path: '/scripts', element: page(ScriptLibraryPage) },
|
||||
{ path: '/scripts/manage', element: page(ScriptManagePage) },
|
||||
{ path: '/script-builder', element: page(ScriptBuilderPage) },
|
||||
{ path: '/network-diagrams', element: page(NetworkDiagramsPage) },
|
||||
{ path: '/network-diagrams/new', element: page(DiagramEditorPage) },
|
||||
{ path: '/network-diagrams/:id', element: page(DiagramEditorPage) },
|
||||
{ path: '/kb-accelerator', element: page(KBAcceleratorPage) },
|
||||
// Phase 1 — FlowPilot migration. The unified chat-primary surface lives at
|
||||
// /pilot; /assistant permanently redirects. FlowPilotSessionPage (old
|
||||
// guided surface) is no longer mounted.
|
||||
{ path: 'pilot', element: page(AssistantChatPage) },
|
||||
{ path: 'pilot/:sessionId', element: page(AssistantChatPage) },
|
||||
{ path: 'assistant', element: <Navigate to="/pilot" replace /> },
|
||||
{ path: 'assistant/:sessionId', element: <AssistantSessionRedirect /> },
|
||||
{ path: 'flow-assist', element: page(FlowAssistPage) },
|
||||
{ path: 'escalations', element: page(EscalationQueuePage) },
|
||||
{ path: 'queue', element: page(SessionQueuePage) },
|
||||
{ path: 'review-queue', element: page(ReviewQueuePage) },
|
||||
{ path: 'analytics/flowpilot', element: page(FlowPilotAnalyticsPage) },
|
||||
{ path: 'dev/branching', element: page(DevBranchingPage) },
|
||||
{ path: 'guides', element: page(GuidesHubPage) },
|
||||
{ path: 'guides/:slug', element: page(GuideDetailPage) },
|
||||
{ path: '/pilot', element: page(AssistantChatPage) },
|
||||
{ path: '/pilot/:sessionId', element: page(AssistantChatPage) },
|
||||
{ path: '/assistant', element: <Navigate to="/pilot" replace /> },
|
||||
{ path: '/assistant/:sessionId', element: <AssistantSessionRedirect /> },
|
||||
{ path: '/flow-assist', element: page(FlowAssistPage) },
|
||||
{ path: '/escalations', element: page(EscalationQueuePage) },
|
||||
{ path: '/queue', element: page(SessionQueuePage) },
|
||||
{ path: '/review-queue', element: page(ReviewQueuePage) },
|
||||
{ path: '/analytics/flowpilot', element: page(FlowPilotAnalyticsPage) },
|
||||
{ path: '/dev/branching', element: page(DevBranchingPage) },
|
||||
{ path: '/guides', element: page(GuidesHubPage) },
|
||||
{ path: '/guides/:slug', element: page(GuideDetailPage) },
|
||||
// Welcome wizard (Phase 2). Mounted inside AppLayout so the email-
|
||||
// verification banner persists above each step.
|
||||
{ path: 'welcome', element: page(WelcomeRouter) },
|
||||
{ path: 'welcome/step-1', element: page(WelcomeStep1) },
|
||||
{ path: 'welcome/step-2', element: page(WelcomeStep2) },
|
||||
{ path: 'welcome/step-3', element: page(WelcomeStep3) },
|
||||
{ path: '/welcome', element: page(WelcomeRouter) },
|
||||
{ path: '/welcome/step-1', element: page(WelcomeStep1) },
|
||||
{ path: '/welcome/step-2', element: page(WelcomeStep2) },
|
||||
{ path: '/welcome/step-3', element: page(WelcomeStep3) },
|
||||
// Admin routes
|
||||
{
|
||||
path: 'admin',
|
||||
path: '/admin',
|
||||
element: (
|
||||
<ErrorBoundary>
|
||||
<Suspense fallback={<PageLoader />}>
|
||||
@@ -315,7 +332,7 @@ export const router = sentryCreateBrowserRouter([
|
||||
},
|
||||
// Account routes
|
||||
{
|
||||
path: 'account',
|
||||
path: '/account',
|
||||
element: (
|
||||
<ErrorBoundary>
|
||||
<Suspense fallback={<PageLoader />}>
|
||||
|
||||
Reference in New Issue
Block a user