Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
feat(onboarding): show the dashboard being set up behind the wizard (#841)
Gökhan Geyik791ff8125b73
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/brands/new/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/brands/new/page.tsxindex cf5b83f97..c6dfe6f86 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/brands/new/page.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/brands/new/page.tsx@@ -13,7 +13,14 @@ import { bootstrapBrandVolumes } from '@/lib/actions/volumes';import { usePlanContext } from '@/components/providers/plan-provider';import { getFaviconUrl } from '@/lib/favicon';import { useBrandStore } from '@/stores/use-brand-store';-import { REGIONS, US_STATES, LANGUAGES } from '@/config/prompt-options';+import {+ REGIONS,+ US_STATES,+ LANGUAGES,+ REGION_ITEMS,+ US_STATE_ITEMS,+ LANGUAGE_ITEMS,+} from '@/config/prompt-options';import { ALL_MODELS, ALL_SCRAPERS } from '@/config/prompt-options';import { getPlan, type PlanId } from '@/config/plans';import type { Brand } from '@/types';@@ -192,6 +199,9 @@ function TopicAccordion({// ── Constants ─────────────────────────────────────────────────────────────────+// The state picker's own "no state" choice, ahead of the states themselves.+const STATE_ITEMS = [{ value: 'nationwide', label: 'Nationwide (no state)' }, ...US_STATE_ITEMS];+const TOPIC_LOADING_MESSAGES = ['Researching topics for your brand...','Analyzing your industry landscape...',@@ -778,6 +788,7 @@ export default function NewBrandPage() {<div className="space-y-2"><Label>Region</Label><Select+ items={REGION_ITEMS}value={region}onValueChange={(v) => {if (!v) return;@@ -802,6 +813,7 @@ export default function NewBrandPage() {<div className="space-y-2"><Label>State (optional)</Label><Select+ items={STATE_ITEMS}value={usState || 'nationwide'}onValueChange={(v) => setUsState(!v || v === 'nationwide' ? '' : v)}>@@ -825,7 +837,11 @@ export default function NewBrandPage() {<div className="space-y-2"><Label>Language</Label>- <Select value={language} onValueChange={(v) => v && setLanguage(v)}>+ <Select+ items={LANGUAGE_ITEMS}+ value={language}+ onValueChange={(v) => v && setLanguage(v)}+ ><SelectTrigger><SelectValue /></SelectTrigger>diff --git a/web/src/app/[locale]/(onboarding)/dashboard/onboarding/page.tsx b/web/src/app/[locale]/(onboarding)/dashboard/onboarding/page.tsxindex a86055ba1..6dcff66d2 100644--- a/web/src/app/[locale]/(onboarding)/dashboard/onboarding/page.tsx+++ b/web/src/app/[locale]/(onboarding)/dashboard/onboarding/page.tsx@@ -12,7 +12,14 @@ import { addCompetitor, getCompetitors } from '@/lib/actions/competitor';import { getFaviconUrl } from '@/lib/favicon';import { slugify } from '@/lib/slug';import { useBrandStore } from '@/stores/use-brand-store';-import { REGIONS, US_STATES, LANGUAGES } from '@/config/prompt-options';+import {+ REGIONS,+ US_STATES,+ LANGUAGES,+ REGION_ITEMS,+ US_STATE_ITEMS,+ LANGUAGE_ITEMS,+} from '@/config/prompt-options';import { ALL_MODELS, ALL_SCRAPERS } from '@/config/prompt-options';import { isCloud, PLANS, SUBSCRIBABLE_PLANS, getPlan, type PlanId } from '@/config/plans';import { setPersonProperties, track } from '@/lib/analytics';@@ -60,6 +67,8 @@ import {} from 'lucide-react';import { cn } from '@/lib/utils';import { suggestTopics, generatePromptsFromTopics, suggestCompetitors } from '@/lib/ai-brand-setup';+import { DashboardPreview } from '@/components/onboarding/dashboard-preview';+import { OnboardingFrame } from '@/components/onboarding/onboarding-frame';// ── Step indicator ─────────────────────────────────────────────────────────────@@ -203,6 +212,12 @@ function TopicAccordion({// ── Constants ─────────────────────────────────────────────────────────────────+// The state picker's own "no state" choice, ahead of the states themselves.+const STATE_ITEMS = [{ value: 'nationwide', label: 'Nationwide (no state)' }, ...US_STATE_ITEMS];++// Card width per step, matched to each step's content column; unlisted steps are forms.+const STEP_FRAME_WIDTH: Record<number, 'medium' | 'wide'> = { 3: 'wide', 4: 'wide', 6: 'medium' };+const TOPIC_LOADING_MESSAGES = ['Researching topics for your brand...','Analyzing your industry landscape...',@@ -301,6 +316,17 @@ export default function OnboardingPage() {const [organizationId, setOrganizationId] = useState<string | null>(null);const [currentPlanId, setCurrentPlanId] = useState<PlanId>('starter');+ // What the dashboard preview shows when the plan step is reached by resuming+ // (a cancelled checkout, a lapsed trial) rather than by walking the steps, so+ // the wizard state it normally reads is empty. Kept apart from that state:+ // filling the real competitor list here would have Back → Finish save them again.+ const [resumedPreview, setResumedPreview] = useState<{+ brandName: string;+ domain: string;+ topics: string[];+ competitors: { name: string; domain: string }[];+ } | null>(null);+const totalSteps = isCloud() ? 6 : 5;// Determine which scrapers/models are available based on the plan@@ -384,6 +410,7 @@ export default function OnboardingPage() {const subStatus = org?.subscription_status;if (subStatus !== 'active' && subStatus !== 'trialing') {setOrganizationId(profile.organization_id);+ void loadResumedPreview(profile.organization_id);setStep(6);setInitialLoading(false);return;@@ -925,776 +952,839 @@ export default function OnboardingPage() {: null;const excessPrompts = promptLimit !== null ? Math.max(0, totalPrompts - promptLimit) : 0;- // ── Loading state ──-- if (initialLoading) {- return (- <div className="flex min-h-svh items-center justify-center">- <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />- </div>- );+ async function loadResumedPreview(orgId: string) {+ try {+ const supabase = createClient();+ const { data: brands } = await supabase+ .from('brands')+ .select('id, name, brand_domains(domain, is_primary)')+ .eq('organization_id', orgId)+ .limit(1);+ const b = brands?.[0];+ if (!b) return;+ const domains = (b.brand_domains ?? []) as { domain: string; is_primary: boolean }[];+ const [topics, competitors] = await Promise.all([getTopics(b.id), getCompetitors(b.id)]);+ setResumedPreview({+ brandName: b.name,+ domain: (domains.find((d) => d.is_primary) ?? domains[0])?.domain ?? '',+ topics: topics.map((t) => t.name),+ competitors: competitors.map((c) => ({ name: c.name, domain: c.domain })),+ });+ } catch {+ // Decoration only — the plan step works the same with an empty preview.+ }}- // ── Step 1: Brand Info ──+ const renderStep = () => {+ // ── Loading state ──- if (step === 1) {- return (- <div className="flex min-h-svh flex-col items-center justify-center gap-6 p-6 md:p-10">- <div className="flex w-full max-w-md flex-col gap-6">- <div className="flex flex-col items-center gap-2 text-center">- <div className="flex h-12 w-12 items-center justify-center rounded-xl bg-primary text-primary-foreground">- <Globe className="h-6 w-6" />- </div>- <h1 className="text-2xl font-bold tracking-tight">Set up your brand</h1>- <p className="text-sm text-muted-foreground">- See how AI platforms talk about you. Add your first brand to get started.- </p>- </div>+ if (initialLoading) {+ return (+ <div className="flex h-64 items-center justify-center">+ <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />+ </div>+ );+ }++ // ── Step 1: Brand Info ──- <div className="space-y-4">- <div className="space-y-2">- <Label htmlFor="brandName">Brand name</Label>- <Input- id="brandName"- placeholder="e.g. Acme Corp"- value={brandName}- onChange={(e) => setBrandName(e.target.value)}- autoFocus- />+ if (step === 1) {+ return (+ <div className="flex flex-col items-center justify-center gap-6 p-6 md:p-10">+ <div className="flex w-full max-w-md flex-col gap-6">+ <div className="flex flex-col items-center gap-2 text-center">+ <div className="flex h-12 w-12 items-center justify-center rounded-xl bg-primary text-primary-foreground">+ <Globe className="h-6 w-6" />+ </div>+ <h1 className="text-2xl font-bold tracking-tight">Set up your brand</h1>+ <p className="text-sm text-muted-foreground">+ See how AI platforms talk about you. Add your first brand to get started.+ </p></div>- <div className="space-y-2">- <Label htmlFor="website">Website</Label>- <div className="flex">- <span className="inline-flex items-center rounded-l-md border border-r-0 bg-muted px-3 text-sm text-muted-foreground">- https://- </span>+ <div className="space-y-4">+ <div className="space-y-2">+ <Label htmlFor="brandName">Brand name</Label><Input- id="website"- placeholder="example.com"- value={website}- onChange={(e) => setWebsite(e.target.value)}- className="rounded-l-none"+ id="brandName"+ placeholder="e.g. Acme Corp"+ value={brandName}+ onChange={(e) => setBrandName(e.target.value)}+ autoFocus/></div>- </div>- <div className="space-y-2">- <Label htmlFor="description">- Describe your brand <span className="text-muted-foreground">(optional)</span>- </Label>- <Textarea- id="description"- placeholder="A brief description helps us generate better suggestions."- value={description}- onChange={(e) => setDescription(e.target.value)}- rows={3}- />- <ul className="text-xs text-muted-foreground space-y-1 list-disc ml-4">- <li>What industry are you in?</li>- <li>Who is your target audience?</li>- </ul>- </div>+ <div className="space-y-2">+ <Label htmlFor="website">Website</Label>+ <div className="flex">+ <span className="inline-flex items-center rounded-l-md border border-r-0 bg-muted px-3 text-sm text-muted-foreground">+ https://+ </span>+ <Input+ id="website"+ placeholder="example.com"+ value={website}+ onChange={(e) => setWebsite(e.target.value)}+ className="rounded-l-none"+ />+ </div>+ </div>- <Button- className="w-full"- disabled={!brandName.trim() || !website.trim()}- onClick={() => {- track('onboarding_step_completed', {- step: 1,- step_name: 'brand_setup',- brand_name: brandName.trim(),- brand_domain: domain,- has_description: description.trim().length > 0,- });- setPersonProperties({- company_url: domain,- });- setStep(2);- }}- >- Continue- </Button>+ <div className="space-y-2">+ <Label htmlFor="description">+ Describe your brand <span className="text-muted-foreground">(optional)</span>+ </Label>+ <Textarea+ id="description"+ placeholder="A brief description helps us generate better suggestions."+ value={description}+ onChange={(e) => setDescription(e.target.value)}+ rows={3}+ />+ <ul className="text-xs text-muted-foreground space-y-1 list-disc ml-4">+ <li>What industry are you in?</li>+ <li>Who is your target audience?</li>+ </ul>+ </div>++ <Button+ className="w-full"+ disabled={!brandName.trim() || !website.trim()}+ onClick={() => {+ track('onboarding_step_completed', {+ step: 1,+ step_name: 'brand_setup',+ brand_name: brandName.trim(),+ brand_domain: domain,+ has_description: description.trim().length > 0,+ });+ setPersonProperties({+ company_url: domain,+ });+ setStep(2);+ }}+ >+ Continue+ </Button>+ </div></div>++ <StepDots current={1} total={totalSteps} /></div>+ );+ }- <StepDots current={1} total={totalSteps} />- </div>- );- }+ // ── Step 2: Region & Language ──- // ── Step 2: Region & Language ──+ if (step === 2) {+ return (+ <div className="flex flex-col items-center justify-center gap-6 p-6 md:p-10">+ <div className="flex w-full max-w-md flex-col gap-6">+ <BrandHeader name={brandName} domain={domain} />- if (step === 2) {- return (- <div className="flex min-h-svh flex-col items-center justify-center gap-6 p-6 md:p-10">- <div className="flex w-full max-w-md flex-col gap-6">- <BrandHeader name={brandName} domain={domain} />+ <div>+ <h1 className="text-2xl font-bold tracking-tight">Select your target market</h1>+ <p className="text-sm text-muted-foreground mt-1">+ Pick the region and language your audience uses. This helps us deliver more accurate+ AI visibility data.+ </p>+ </div>- <div>- <h1 className="text-2xl font-bold tracking-tight">Select your target market</h1>- <p className="text-sm text-muted-foreground mt-1">- Pick the region and language your audience uses. This helps us deliver more accurate- AI visibility data.- </p>- </div>+ <div className="space-y-4">+ <div className="space-y-2">+ <Label>Region</Label>+ <Select+ items={REGION_ITEMS}+ value={region}+ onValueChange={(v) => {+ if (!v) return;+ setRegion(v);+ if (v !== 'US') setUsState('');+ }}+ >+ <SelectTrigger>+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {REGIONS.map((r) => (+ <SelectItem key={r.code} value={r.code}>+ {r.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>- <div className="space-y-4">- <div className="space-y-2">- <Label>Region</Label>- <Select- value={region}- onValueChange={(v) => {- if (!v) return;- setRegion(v);- if (v !== 'US') setUsState('');- }}- >- <SelectTrigger>- <SelectValue />- </SelectTrigger>- <SelectContent>- {REGIONS.map((r) => (- <SelectItem key={r.code} value={r.code}>- {r.label}- </SelectItem>- ))}- </SelectContent>- </Select>- </div>+ {region === 'US' && (+ <div className="space-y-2">+ <Label>State (optional)</Label>+ <Select+ items={STATE_ITEMS}+ value={usState || 'nationwide'}+ onValueChange={(v) => setUsState(!v || v === 'nationwide' ? '' : v)}+ >+ <SelectTrigger>+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="nationwide">Nationwide (no state)</SelectItem>+ {US_STATES.map((s) => (+ <SelectItem key={s.code} value={s.code}>+ {s.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <p className="text-xs text-muted-foreground">+ Localizes AI answers to this state. Leave empty for nationwide results.+ </p>+ </div>+ )}- {region === 'US' && (<div className="space-y-2">- <Label>State (optional)</Label>+ <Label>Language</Label><Select- value={usState || 'nationwide'}- onValueChange={(v) => setUsState(!v || v === 'nationwide' ? '' : v)}+ items={LANGUAGE_ITEMS}+ value={language}+ onValueChange={(v) => v && setLanguage(v)}><SelectTrigger><SelectValue /></SelectTrigger><SelectContent>- <SelectItem value="nationwide">Nationwide (no state)</SelectItem>- {US_STATES.map((s) => (- <SelectItem key={s.code} value={s.code}>- {s.label}+ {LANGUAGES.map((l) => (+ <SelectItem key={l.code} value={l.code}>+ {l.label}</SelectItem>))}</SelectContent></Select>- <p className="text-xs text-muted-foreground">- Localizes AI answers to this state. Leave empty for nationwide results.- </p></div>- )}- <div className="space-y-2">- <Label>Language</Label>- <Select value={language} onValueChange={(v) => v && setLanguage(v)}>- <SelectTrigger>- <SelectValue />- </SelectTrigger>- <SelectContent>- {LANGUAGES.map((l) => (- <SelectItem key={l.code} value={l.code}>- {l.label}- </SelectItem>- ))}- </SelectContent>- </Select>+ <Button className="w-full" onClick={handleCreateOrgAndBrand} disabled={isLoading}>+ {isLoading ? (+ <>+ <Loader2 className="mr-2 h-4 w-4 animate-spin" />+ Setting up...+ </>+ ) : (+ 'Continue'+ )}+ </Button></div>-- <Button className="w-full" onClick={handleCreateOrgAndBrand} disabled={isLoading}>- {isLoading ? (- <>- <Loader2 className="mr-2 h-4 w-4 animate-spin" />- Setting up...- </>- ) : (- 'Continue'- )}- </Button></div>- </div>- <div className="flex w-full max-w-md items-center justify-between">- <button- onClick={() => setStep(1)}- className="flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground"- >- <ArrowLeft className="h-3.5 w-3.5" />- Back- </button>- <StepDots current={2} total={totalSteps} />- <div className="w-12" />+ <div className="flex w-full max-w-md items-center justify-between">+ <button+ onClick={() => setStep(1)}+ className="flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground"+ >+ <ArrowLeft className="h-3.5 w-3.5" />+ Back+ </button>+ <StepDots current={2} total={totalSteps} />+ <div className="w-12" />+ </div></div>- </div>- );- }-- // ── Step 3: Topic Selection ──+ );+ }- if (step === 3) {- return (- <div className="flex min-h-svh flex-col p-6 md:p-10">- <div className="mx-auto w-full max-w-4xl flex-1">- <BrandHeader name={brandName} domain={domain} />-- <div className="grid grid-cols-1 gap-10 lg:grid-cols-5">- <div className="lg:col-span-3 space-y-6">- <div>- <h1 className="text-2xl font-bold tracking-tight">Choose topics to monitor</h1>- <div className="flex items-center gap-2 mt-3">- <span className="text-sm text-muted-foreground">Select up to 10 topics</span>- <div className="flex-1 h-1.5 rounded-full bg-muted overflow-hidden">- <div- className="h-full bg-primary rounded-full transition-all"- style={{- width: `${(selectedTopics.size / 10) * 100}%`,- }}- />+ // ── Step 3: Topic Selection ──++ if (step === 3) {+ return (+ <div className="flex flex-col p-6 md:p-10">+ <div className="mx-auto w-full max-w-4xl flex-1">+ <BrandHeader name={brandName} domain={domain} />++ <div className="grid grid-cols-1 gap-10 lg:grid-cols-5">+ <div className="lg:col-span-3 space-y-6">+ <div>+ <h1 className="text-2xl font-bold tracking-tight">Choose topics to monitor</h1>+ <div className="flex items-center gap-2 mt-3">+ <span className="text-sm text-muted-foreground">Select up to 10 topics</span>+ <div className="flex-1 h-1.5 rounded-full bg-muted overflow-hidden">+ <div+ className="h-full bg-primary rounded-full transition-all"+ style={{+ width: `${(selectedTopics.size / 10) * 100}%`,+ }}+ />+ </div></div></div>- </div>- {loadingTopics ? (- <div className="flex flex-col items-center gap-3 py-12 text-muted-foreground">- <Sparkles className="h-5 w-5 animate-pulse" />- <span key={topicLoadingMsg} className="text-sm animate-in fade-in duration-500">- {topicLoadingMsg}- </span>- </div>- ) : (- <div className="space-y-2">- {topicSuggestError && (- <div className="flex items-center justify-between gap-3 rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm">- <span>- Couldn't fetch topic suggestions right now — add your own below.- </span>- <Button variant="outline" size="sm" onClick={fetchTopicSuggestions}>- Try again- </Button>- </div>- )}- {suggestedTopics.map((topic) => {- const isSelected = selectedTopics.has(topic);- return (- <button- key={topic}- onClick={() => toggleTopic(topic)}- className={cn(- 'flex items-center gap-3 w-full rounded-lg border px-4 py-3 text-left text-sm transition-colors',- isSelected- ? 'border-primary bg-primary/5'- : 'border-border hover:border-muted-foreground/30',- )}- >- <div+ {loadingTopics ? (+ <div className="flex flex-col items-center gap-3 py-12 text-muted-foreground">+ <Sparkles className="h-5 w-5 animate-pulse" />+ <span key={topicLoadingMsg} className="text-sm animate-in fade-in duration-500">+ {topicLoadingMsg}+ </span>+ </div>+ ) : (+ <div className="space-y-2">+ {topicSuggestError && (+ <div className="flex items-center justify-between gap-3 rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm">+ <span>+ Couldn't fetch topic suggestions right now — add your own below.+ </span>+ <Button variant="outline" size="sm" onClick={fetchTopicSuggestions}>+ Try again+ </Button>+ </div>+ )}+ {suggestedTopics.map((topic) => {+ const isSelected = selectedTopics.has(topic);+ return (+ <button+ key={topic}+ onClick={() => toggleTopic(topic)}className={cn(- 'flex h-5 w-5 shrink-0 items-center justify-center rounded border',+ 'flex items-center gap-3 w-full rounded-lg border px-4 py-3 text-left text-sm transition-colors',isSelected- ? 'border-primary bg-primary text-primary-foreground'- : 'border-muted-foreground/30',+ ? 'border-primary bg-primary/5'+ : 'border-border hover:border-muted-foreground/30',)}>- {isSelected && <Check className="h-3 w-3" />}- </div>- {topic}- </button>- );- })}-- <div className="flex items-center gap-2 pt-2">- <Input- placeholder="Add custom topic..."- value={customTopic}- onChange={(e) => setCustomTopic(e.target.value)}- onKeyDown={(e) => e.key === 'Enter' && addCustomTopic()}- className="text-sm"- />- <Button- size="sm"- variant="outline"- onClick={addCustomTopic}- disabled={!customTopic.trim()}- >- <Plus className="h-4 w-4" />- </Button>+ <div+ className={cn(+ 'flex h-5 w-5 shrink-0 items-center justify-center rounded border',+ isSelected+ ? 'border-primary bg-primary text-primary-foreground'+ : 'border-muted-foreground/30',+ )}+ >+ {isSelected && <Check className="h-3 w-3" />}+ </div>+ {topic}+ </button>+ );+ })}++ <div className="flex items-center gap-2 pt-2">+ <Input+ placeholder="Add custom topic..."+ value={customTopic}+ onChange={(e) => setCustomTopic(e.target.value)}+ onKeyDown={(e) => e.key === 'Enter' && addCustomTopic()}+ className="text-sm"+ />+ <Button+ size="sm"+ variant="outline"+ onClick={addCustomTopic}+ disabled={!customTopic.trim()}+ >+ <Plus className="h-4 w-4" />+ </Button>+ </div></div>- </div>- )}-- {topicSaveError && (- <div className="rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm">- Couldn't save your topics — please try again.- </div>- )}+ )}- <Button- className="w-full"- disabled={selectedTopics.size === 0 || loadingPrompts || loadingTopics}- onClick={handleGeneratePrompts}- >- {loadingPrompts ? (- <>- <Loader2 className="mr-2 h-4 w-4 animate-spin" />- Generating prompts...- </>- ) : (- 'Looks good'+ {topicSaveError && (+ <div className="rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm">+ Couldn't save your topics — please try again.+ </div>)}- </Button>- </div>- <div className="lg:col-span-2">- <div className="rounded-xl border bg-card p-5 sticky top-10">- <h3 className="text-sm font-semibold mb-4">Topic Selection Tips</h3>- <div className="space-y-4">- <div className="flex gap-3">- <Check className="h-4 w-4 text-foreground shrink-0 mt-0.5" />- <div>- <p className="text-sm font-medium">5 prompts are created per topic</p>- <p className="text-xs text-muted-foreground mt-0.5">- You can select up to 10 topics for a total of 50 prompts. More can be added- anytime from the dashboard.- </p>+ <Button+ className="w-full"+ disabled={selectedTopics.size === 0 || loadingPrompts || loadingTopics}+ onClick={handleGeneratePrompts}+ >+ {loadingPrompts ? (+ <>+ <Loader2 className="mr-2 h-4 w-4 animate-spin" />+ Generating prompts...+ </>+ ) : (+ 'Looks good'+ )}+ </Button>+ </div>++ <div className="lg:col-span-2">+ <div className="rounded-xl border bg-card p-5 sticky top-10">+ <h3 className="text-sm font-semibold mb-4">Topic Selection Tips</h3>+ <div className="space-y-4">+ <div className="flex gap-3">+ <Check className="h-4 w-4 text-foreground shrink-0 mt-0.5" />+ <div>+ <p className="text-sm font-medium">5 prompts are created per topic</p>+ <p className="text-xs text-muted-foreground mt-0.5">+ You can select up to 10 topics for a total of 50 prompts. More can be+ added anytime from the dashboard.+ </p>+ </div></div>- </div>- <div className="flex gap-3">- <Check className="h-4 w-4 text-foreground shrink-0 mt-0.5" />- <div>- <p className="text-sm font-medium">Think like your customers</p>- <p className="text-xs text-muted-foreground mt-0.5">- Use terms your audience would search for when looking for products or- services like yours.- </p>+ <div className="flex gap-3">+ <Check className="h-4 w-4 text-foreground shrink-0 mt-0.5" />+ <div>+ <p className="text-sm font-medium">Think like your customers</p>+ <p className="text-xs text-muted-foreground mt-0.5">+ Use terms your audience would search for when looking for products or+ services like yours.+ </p>+ </div></div>- </div>- <div className="flex gap-3">- <Check className="h-4 w-4 text-foreground shrink-0 mt-0.5" />- <div>- <p className="text-sm font-medium">Keep it short</p>- <p className="text-xs text-muted-foreground mt-0.5">- Topics should be concise — we'll turn them into detailed prompts in the- next step.- </p>+ <div className="flex gap-3">+ <Check className="h-4 w-4 text-foreground shrink-0 mt-0.5" />+ <div>+ <p className="text-sm font-medium">Keep it short</p>+ <p className="text-xs text-muted-foreground mt-0.5">+ Topics should be concise — we'll turn them into detailed prompts in+ the next step.+ </p>+ </div></div></div></div></div></div></div>- </div>- <div className="flex mx-auto w-full max-w-4xl items-center justify-between mt-8">- <button- onClick={() => setStep(2)}- className="flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground"- >- <ArrowLeft className="h-3.5 w-3.5" />- Back- </button>- <StepDots current={3} total={totalSteps} />- <div className="w-12" />+ <div className="flex mx-auto w-full max-w-4xl items-center justify-between mt-8">+ <button+ onClick={() => setStep(2)}+ className="flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground"+ >+ <ArrowLeft className="h-3.5 w-3.5" />+ Back+ </button>+ <StepDots current={3} total={totalSteps} />+ <div className="w-12" />+ </div></div>- </div>- );- }-- // ── Step 4: Prompt Review ──+ );+ }- if (step === 4) {- return (- <div className="flex min-h-svh flex-col p-6 md:p-10">- <div className="mx-auto w-full max-w-4xl flex-1">- <BrandHeader name={brandName} domain={domain} />+ // ── Step 4: Prompt Review ──- <div className="mb-6">- <h1 className="text-2xl font-bold tracking-tight">Review your prompts</h1>- <p className="text-sm text-muted-foreground mt-1">- These prompts will be sent to AI platforms daily. Feel free to edit, add, or remove- any before starting.- </p>- </div>+ if (step === 4) {+ return (+ <div className="flex flex-col p-6 md:p-10">+ <div className="mx-auto w-full max-w-4xl flex-1">+ <BrandHeader name={brandName} domain={domain} />- {promptGenError && (- <div className="mb-4 rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm">- Couldn't generate prompt suggestions right now — add your own to each topic below- to continue.+ <div className="mb-6">+ <h1 className="text-2xl font-bold tracking-tight">Review your prompts</h1>+ <p className="text-sm text-muted-foreground mt-1">+ These prompts will be sent to AI platforms daily. Feel free to edit, add, or remove+ any before starting.+ </p></div>- )}- {excessPrompts > 0 && (- <div className="mb-4 rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm">- Your plan includes up to {promptLimit} prompts — remove {excessPrompts} to continue.- </div>- )}+ {promptGenError && (+ <div className="mb-4 rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm">+ Couldn't generate prompt suggestions right now — add your own to each topic+ below to continue.+ </div>+ )}- {saveError && excessPrompts === 0 && (- <div className="mb-4 rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm">- {saveError}- </div>- )}+ {excessPrompts > 0 && (+ <div className="mb-4 rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm">+ Your plan includes up to {promptLimit} prompts — remove {excessPrompts} to continue.+ </div>+ )}- <div className="mb-4">- <p className="text-sm font-medium">Your Prompt List</p>- <p className="text-xs text-muted-foreground">{totalPrompts} prompts total</p>- </div>+ {saveError && excessPrompts === 0 && (+ <div className="mb-4 rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm">+ {saveError}+ </div>+ )}- <div className="rounded-lg border">- <div className="flex items-center gap-4 px-4 py-2.5 border-b bg-muted/50 text-xs font-medium text-muted-foreground">- <span className="flex-1">Topic</span>+ <div className="mb-4">+ <p className="text-sm font-medium">Your Prompt List</p>+ <p className="text-xs text-muted-foreground">{totalPrompts} prompts total</p></div>- {topicPrompts.map((tp, idx) => (- <TopicAccordion- key={`${tp.topic}-${idx}`}- data={tp}- defaultOpen={idx === 0}- onRemoveTopic={() => removeTopic(idx)}- onAddPrompt={(p) => addPromptToTopic(idx, p)}- onRemovePrompt={(pi) => removePromptFromTopic(idx, pi)}- />- ))}- {topicPrompts.length === 0 && (- <div className="py-8 text-center text-sm text-muted-foreground">- No prompts generated yet.++ <div className="rounded-lg border">+ <div className="flex items-center gap-4 px-4 py-2.5 border-b bg-muted/50 text-xs font-medium text-muted-foreground">+ <span className="flex-1">Topic</span></div>- )}- </div>+ {topicPrompts.map((tp, idx) => (+ <TopicAccordion+ key={`${tp.topic}-${idx}`}+ data={tp}+ defaultOpen={idx === 0}+ onRemoveTopic={() => removeTopic(idx)}+ onAddPrompt={(p) => addPromptToTopic(idx, p)}+ onRemovePrompt={(pi) => removePromptFromTopic(idx, pi)}+ />+ ))}+ {topicPrompts.length === 0 && (+ <div className="py-8 text-center text-sm text-muted-foreground">+ No prompts generated yet.+ </div>+ )}+ </div>- <Button- className="mt-6 w-full"- onClick={handleSavePromptsAndContinue}- disabled={isLoading || totalPrompts === 0 || excessPrompts > 0}- >- {isLoading ? (- <>- <Loader2 className="mr-2 h-4 w-4 animate-spin" />- Saving prompts...- </>- ) : (- 'Continue'- )}- </Button>- </div>+ <Button+ className="mt-6 w-full"+ onClick={handleSavePromptsAndContinue}+ disabled={isLoading || totalPrompts === 0 || excessPrompts > 0}+ >+ {isLoading ? (+ <>+ <Loader2 className="mr-2 h-4 w-4 animate-spin" />+ Saving prompts...+ </>+ ) : (+ 'Continue'+ )}+ </Button>+ </div>- <div className="flex mx-auto w-full max-w-4xl items-center justify-between mt-8">- <button- onClick={() => setStep(3)}- className="flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground"- >- <ArrowLeft className="h-3.5 w-3.5" />- Back- </button>- <StepDots current={4} total={totalSteps} />- <div className="w-12" />+ <div className="flex mx-auto w-full max-w-4xl items-center justify-between mt-8">+ <button+ onClick={() => setStep(3)}+ className="flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground"+ >+ <ArrowLeft className="h-3.5 w-3.5" />+ Back+ </button>+ <StepDots current={4} total={totalSteps} />+ <div className="w-12" />+ </div></div>- </div>- );- }+ );+ }- // ── Step 5: Competitors ──+ // ── Step 5: Competitors ──- if (step === 5) {- const selectedCompetitorCount = suggestedCompetitors.filter((c) => c.selected).length;- const hasSelectedCompetitors = selectedCompetitorCount > 0;+ if (step === 5) {+ const selectedCompetitorCount = suggestedCompetitors.filter((c) => c.selected).length;+ const hasSelectedCompetitors = selectedCompetitorCount > 0;- return (- <div className="flex min-h-svh flex-col p-6 md:p-10">- <div className="mx-auto w-full max-w-lg flex-1">- <BrandHeader name={brandName} domain={domain} />+ return (+ <div className="flex flex-col p-6 md:p-10">+ <div className="mx-auto w-full max-w-lg flex-1">+ <BrandHeader name={brandName} domain={domain} />- <div className="mb-6">- <h1 className="text-2xl font-bold tracking-tight">Add your competitors</h1>- <p className="text-sm text-muted-foreground mt-1">- We'll track how often competitors appear alongside your brand in AI responses.- </p>- </div>-- {loadingCompetitors ? (- <div className="flex flex-col items-center gap-3 py-16 text-muted-foreground">- <Sparkles className="h-5 w-5 animate-pulse" />- <span key={competitorLoadingMsg} className="text-sm animate-in fade-in duration-500">- {competitorLoadingMsg}- </span>+ <div className="mb-6">+ <h1 className="text-2xl font-bold tracking-tight">Add your competitors</h1>+ <p className="text-sm text-muted-foreground mt-1">+ We'll track how often competitors appear alongside your brand in AI responses.+ </p></div>- ) : (- <div className="space-y-4">- {competitorSuggestError && (- <div className="flex items-center justify-between gap-3 rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm">- <span>- Couldn't fetch competitor suggestions right now — add your own below.- </span>- <Button variant="outline" size="sm" onClick={fetchCompetitorSuggestions}>- Try again- </Button>- </div>- )}- {suggestedCompetitors.length > 0 && (- <div className="space-y-2">- <p className="text-xs font-medium text-muted-foreground uppercase tracking-wider">- Suggested competitors- </p>- {suggestedCompetitors.map((c, idx) => (- <div- key={`${c.domain}-${idx}`}- className={cn(- 'flex items-center gap-3 rounded-lg border px-4 py-3 cursor-pointer transition-colors',- c.selected- ? 'border-primary/50 bg-primary/5'- : 'border-border hover:bg-muted/50',- )}- onClick={() => toggleCompetitor(idx)}- >++ {loadingCompetitors ? (+ <div className="flex flex-col items-center gap-3 py-16 text-muted-foreground">+ <Sparkles className="h-5 w-5 animate-pulse" />+ <span+ key={competitorLoadingMsg}+ className="text-sm animate-in fade-in duration-500"+ >+ {competitorLoadingMsg}+ </span>+ </div>+ ) : (+ <div className="space-y-4">+ {competitorSuggestError && (+ <div className="flex items-center justify-between gap-3 rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm">+ <span>+ Couldn't fetch competitor suggestions right now — add your own below.+ </span>+ <Button variant="outline" size="sm" onClick={fetchCompetitorSuggestions}>+ Try again+ </Button>+ </div>+ )}+ {suggestedCompetitors.length > 0 && (+ <div className="space-y-2">+ <p className="text-xs font-medium text-muted-foreground uppercase tracking-wider">+ Suggested competitors+ </p>+ {suggestedCompetitors.map((c, idx) => (<div+ key={`${c.domain}-${idx}`}className={cn(- 'flex h-5 w-5 shrink-0 items-center justify-center rounded border transition-colors',+ 'flex items-center gap-3 rounded-lg border px-4 py-3 cursor-pointer transition-colors',c.selected- ? 'bg-primary border-primary text-primary-foreground'- : 'border-muted-foreground/30',+ ? 'border-primary/50 bg-primary/5'+ : 'border-border hover:bg-muted/50',)}+ onClick={() => toggleCompetitor(idx)}>- {c.selected && <Check className="h-3 w-3" />}- </div>- {c.domain && (- /* eslint-disable-next-line @next/next/no-img-element */- <img- src={getFaviconUrl(c.domain)}- alt=""- className="h-5 w-5 rounded-sm"- onError={(e) => {- (e.target as HTMLImageElement).style.display = 'none';- }}- />- )}- <div className="flex-1 min-w-0">- <p className="text-sm font-medium truncate">{c.name}</p>+ <div+ className={cn(+ 'flex h-5 w-5 shrink-0 items-center justify-center rounded border transition-colors',+ c.selected+ ? 'bg-primary border-primary text-primary-foreground'+ : 'border-muted-foreground/30',+ )}+ >+ {c.selected && <Check className="h-3 w-3" />}+ </div>{c.domain && (- <p className="text-xs text-muted-foreground truncate">{c.domain}</p>+ /* eslint-disable-next-line @next/next/no-img-element */+ <img+ src={getFaviconUrl(c.domain)}+ alt=""+ className="h-5 w-5 rounded-sm"+ onError={(e) => {+ (e.target as HTMLImageElement).style.display = 'none';+ }}+ />)}+ <div className="flex-1 min-w-0">+ <p className="text-sm font-medium truncate">{c.name}</p>+ {c.domain && (+ <p className="text-xs text-muted-foreground truncate">{c.domain}</p>+ )}+ </div>+ <button+ onClick={(e) => {+ e.stopPropagation();+ removeCompetitor(idx);+ }}+ className="p-1 rounded hover:bg-muted text-muted-foreground hover:text-destructive"+ >+ <X className="h-3.5 w-3.5" />+ </button></div>- <button- onClick={(e) => {- e.stopPropagation();- removeCompetitor(idx);- }}- className="p-1 rounded hover:bg-muted text-muted-foreground hover:text-destructive"- >- <X className="h-3.5 w-3.5" />- </button>- </div>- ))}+ ))}+ </div>+ )}++ <div className="space-y-2">+ <p className="text-xs font-medium text-muted-foreground uppercase tracking-wider">+ Add manually+ </p>+ <div className="flex items-center gap-2">+ <Input+ placeholder="Company name"+ value={competitorName}+ onChange={(e) => setCompetitorName(e.target.value)}+ className="text-sm"+ />+ <Input+ placeholder="domain.com"+ value={competitorDomain}+ onChange={(e) => setCompetitorDomain(e.target.value)}+ onKeyDown={(e) => e.key === 'Enter' && addManualCompetitor()}+ className="text-sm"+ />+ <Button+ size="sm"+ variant="outline"+ onClick={addManualCompetitor}+ disabled={!competitorName.trim()}+ >+ <Plus className="h-4 w-4" />+ </Button>+ </div></div>- )}- <div className="space-y-2">- <p className="text-xs font-medium text-muted-foreground uppercase tracking-wider">- Add manually- </p>- <div className="flex items-center gap-2">- <Input- placeholder="Company name"- value={competitorName}- onChange={(e) => setCompetitorName(e.target.value)}- className="text-sm"- />- <Input- placeholder="domain.com"- value={competitorDomain}- onChange={(e) => setCompetitorDomain(e.target.value)}- onKeyDown={(e) => e.key === 'Enter' && addManualCompetitor()}- className="text-sm"- />+ <Button+ className="w-full"+ onClick={handleFinish}+ disabled={savingCompetitors || !hasSelectedCompetitors}+ >+ {savingCompetitors ? (+ <>+ <Loader2 className="mr-2 h-4 w-4 animate-spin" />+ Finishing setup...+ </>+ ) : hasSelectedCompetitors ? (+ `Start tracking with ${selectedCompetitorCount} competitor${selectedCompetitorCount !== 1 ? 's' : ''}`+ ) : (+ 'Add a competitor to continue'+ )}+ </Button>+ </div>+ )}+ </div>++ <div className="flex mx-auto w-full max-w-lg items-center justify-between mt-8">+ <button+ onClick={() => setStep(4)}+ className="flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground"+ >+ <ArrowLeft className="h-3.5 w-3.5" />+ Back+ </button>+ <StepDots current={5} total={totalSteps} />+ <div className="w-12" />+ </div>+ </div>+ );+ }++ // ── Step 6: Choose Plan (cloud only) ──++ if (step !== 6) return null;++ return (+ <div className="flex flex-col p-6 md:p-10">+ <div className="mx-auto w-full max-w-2xl flex-1">+ <div className="mb-8 text-center">+ <h1 className="text-2xl font-bold tracking-tight">Choose your plan</h1>+ <p className="text-sm text-muted-foreground mt-1">+ Start your 14-day free trial — your card won't be charged until the trial ends.+ Cancel anytime in Settings → Billing.+ </p>+ </div>++ {/* Plan cards */}+ <div className="grid gap-6 sm:grid-cols-2">+ {SUBSCRIBABLE_PLANS.map((planId) => {+ const plan = PLANS[planId];+ const price = plan.pricing;+ if (!price) return null;++ const loading = checkoutLoading === planId;++ return (+ <div+ key={planId}+ className={cn(+ 'relative flex flex-col rounded-2xl border bg-card p-6 shadow-sm transition-shadow hover:shadow-md',+ plan.highlighted && 'border-primary shadow-md ring-1 ring-primary/20',+ )}+ >+ {plan.highlighted && (+ <Badge className="absolute -top-3 left-1/2 -translate-x-1/2">+ Most Popular+ </Badge>+ )}++ <div className="mb-4">+ <h3 className="text-lg font-semibold">{plan.name}</h3>+ <p className="mt-1 text-sm text-muted-foreground">{plan.tagline}</p>+ </div>++ <div className="flex items-end gap-1 mb-4">+ <span className="text-4xl font-bold tracking-tight">${price.monthly}</span>+ <span className="mb-1 text-sm text-muted-foreground">/month</span>+ </div>+<Button- size="sm"- variant="outline"- onClick={addManualCompetitor}- disabled={!competitorName.trim()}+ className="w-full"+ variant={plan.highlighted ? 'default' : 'outline'}+ onClick={() => handleCheckout(planId)}+ disabled={checkoutLoading !== null}>- <Plus className="h-4 w-4" />+ {loading ? (+ <>+ <Loader2 className="mr-2 h-4 w-4 animate-spin" />+ Redirecting...+ </>+ ) : (+ 'Start Free Trial'+ )}</Button>++ <Separator className="my-5" />++ <div className="flex-1 space-y-2.5 text-sm">+ <PlanFeatureItem>+ <strong>+ {plan.limits.maxBrands === -1 ? 'Unlimited' : plan.limits.maxBrands}+ </strong>{' '}+ {plan.limits.maxBrands === 1 ? 'brand' : 'brands'}+ </PlanFeatureItem>+ <PlanFeatureItem>+ <strong>+ {plan.limits.maxPrompts === -1 ? 'Unlimited' : plan.limits.maxPrompts}+ </strong>{' '}+ prompt locations tracked+ </PlanFeatureItem>+ <PlanFeatureItem>+ <strong>{plan.limits.maxPlatforms}</strong> answer engines+ {plan.limits.allowedScrapers && plan.limits.allowedScrapers.length > 0 && (+ <span className="text-muted-foreground font-normal">+ {' '}+ (+ {plan.limits.allowedScrapers+ .map((id) => {+ const s = ALL_SCRAPERS.find((s) => s.id === id);+ return s ? s.label.replace(/\s*\(Web\)/i, '') : id;+ })+ .join(' & ')}+ )+ </span>+ )}+ </PlanFeatureItem>+ <PlanFeatureItem>+ <strong>+ {plan.limits.maxTeamMembers === -1+ ? 'Unlimited'+ : plan.limits.maxTeamMembers}+ </strong>{' '}+ team members+ </PlanFeatureItem>+ <PlanFeatureItem>+ {plan.limits.features.includes('daily_monitoring')+ ? 'Daily monitoring'+ : 'Weekly monitoring'}+ </PlanFeatureItem>+ {plan.limits.features.includes('competitor_tracking') && (+ <PlanFeatureItem>Competitor tracking</PlanFeatureItem>+ )}+ {plan.limits.features.includes('content_optimization') && (+ <PlanFeatureItem>Content optimization</PlanFeatureItem>+ )}+ {plan.limits.features.includes('advanced_analytics') && (+ <PlanFeatureItem>Advanced analytics</PlanFeatureItem>+ )}+ <PlanFeatureItem>Email support</PlanFeatureItem>+ </div></div>- </div>+ );+ })}+ </div>- <Button- className="w-full"- onClick={handleFinish}- disabled={savingCompetitors || !hasSelectedCompetitors}- >- {savingCompetitors ? (- <>- <Loader2 className="mr-2 h-4 w-4 animate-spin" />- Finishing setup...- </>- ) : hasSelectedCompetitors ? (- `Start tracking with ${selectedCompetitorCount} competitor${selectedCompetitorCount !== 1 ? 's' : ''}`- ) : (- 'Add a competitor to continue'- )}- </Button>- </div>- )}+ <p className="mt-6 text-center text-xs text-muted-foreground">+ Need more?{' '}+ <a href="mailto:[email protected]" className="underline hover:text-foreground">+ Contact sales+ </a>{' '}+ for Enterprise pricing.+ </p>+ <p className="mt-2 text-center text-xs text-muted-foreground">+ Secure payments powered by Stripe.+ </p></div>- <div className="flex mx-auto w-full max-w-lg items-center justify-between mt-8">+ <div className="flex mx-auto w-full max-w-2xl items-center justify-between mt-8"><button- onClick={() => setStep(4)}+ onClick={() => setStep(5)}className="flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground"><ArrowLeft className="h-3.5 w-3.5" />Back</button>- <StepDots current={5} total={totalSteps} />+ <StepDots current={6} total={totalSteps} /><div className="w-12" /></div></div>);- }-- // ── Step 6: Choose Plan (cloud only) ──+ };- if (step !== 6) return null;+ const previewTopics = step >= 4 ? topicPrompts.map((tp) => tp.topic) : Array.from(selectedTopics);return (- <div className="flex min-h-svh flex-col p-6 md:p-10">- <div className="mx-auto w-full max-w-2xl flex-1">- <div className="mb-8 text-center">- <h1 className="text-2xl font-bold tracking-tight">Choose your plan</h1>- <p className="text-sm text-muted-foreground mt-1">- Start your 14-day free trial — your card won't be charged until the trial ends.- Cancel anytime in Settings → Billing.- </p>- </div>-- {/* Plan cards */}- <div className="grid gap-6 sm:grid-cols-2">- {SUBSCRIBABLE_PLANS.map((planId) => {- const plan = PLANS[planId];- const price = plan.pricing;- if (!price) return null;-- const loading = checkoutLoading === planId;-- return (- <div- key={planId}- className={cn(- 'relative flex flex-col rounded-2xl border bg-card p-6 shadow-sm transition-shadow hover:shadow-md',- plan.highlighted && 'border-primary shadow-md ring-1 ring-primary/20',- )}- >- {plan.highlighted && (- <Badge className="absolute -top-3 left-1/2 -translate-x-1/2">Most Popular</Badge>- )}-- <div className="mb-4">- <h3 className="text-lg font-semibold">{plan.name}</h3>- <p className="mt-1 text-sm text-muted-foreground">{plan.tagline}</p>- </div>-- <div className="flex items-end gap-1 mb-4">- <span className="text-4xl font-bold tracking-tight">${price.monthly}</span>- <span className="mb-1 text-sm text-muted-foreground">/month</span>- </div>-- <Button- className="w-full"- variant={plan.highlighted ? 'default' : 'outline'}- onClick={() => handleCheckout(planId)}- disabled={checkoutLoading !== null}- >- {loading ? (- <>- <Loader2 className="mr-2 h-4 w-4 animate-spin" />- Redirecting...- </>- ) : (- 'Start Free Trial'- )}- </Button>-- <Separator className="my-5" />-- <div className="flex-1 space-y-2.5 text-sm">- <PlanFeatureItem>- <strong>- {plan.limits.maxBrands === -1 ? 'Unlimited' : plan.limits.maxBrands}- </strong>{' '}- {plan.limits.maxBrands === 1 ? 'brand' : 'brands'}- </PlanFeatureItem>- <PlanFeatureItem>- <strong>- {plan.limits.maxPrompts === -1 ? 'Unlimited' : plan.limits.maxPrompts}- </strong>{' '}- prompt locations tracked- </PlanFeatureItem>- <PlanFeatureItem>- <strong>{plan.limits.maxPlatforms}</strong> answer engines- {plan.limits.allowedScrapers && plan.limits.allowedScrapers.length > 0 && (- <span className="text-muted-foreground font-normal">- {' '}- (- {plan.limits.allowedScrapers- .map((id) => {- const s = ALL_SCRAPERS.find((s) => s.id === id);- return s ? s.label.replace(/\s*\(Web\)/i, '') : id;- })- .join(' & ')}- )- </span>- )}- </PlanFeatureItem>- <PlanFeatureItem>- <strong>- {plan.limits.maxTeamMembers === -1 ? 'Unlimited' : plan.limits.maxTeamMembers}- </strong>{' '}- team members- </PlanFeatureItem>- <PlanFeatureItem>- {plan.limits.features.includes('daily_monitoring')- ? 'Daily monitoring'- : 'Weekly monitoring'}- </PlanFeatureItem>- {plan.limits.features.includes('competitor_tracking') && (- <PlanFeatureItem>Competitor tracking</PlanFeatureItem>- )}- {plan.limits.features.includes('content_optimization') && (- <PlanFeatureItem>Content optimization</PlanFeatureItem>- )}- {plan.limits.features.includes('advanced_analytics') && (- <PlanFeatureItem>Advanced analytics</PlanFeatureItem>- )}- <PlanFeatureItem>Email support</PlanFeatureItem>- </div>- </div>- );- })}- </div>-- <p className="mt-6 text-center text-xs text-muted-foreground">- Need more?{' '}- <a href="mailto:[email protected]" className="underline hover:text-foreground">- Contact sales- </a>{' '}- for Enterprise pricing.- </p>- <p className="mt-2 text-center text-xs text-muted-foreground">- Secure payments powered by Stripe.- </p>- </div>-- <div className="flex mx-auto w-full max-w-2xl items-center justify-between mt-8">- <button- onClick={() => setStep(5)}- className="flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground"- >- <ArrowLeft className="h-3.5 w-3.5" />- Back- </button>- <StepDots current={6} total={totalSteps} />- <div className="w-12" />- </div>- </div>+ <OnboardingFrame+ width={initialLoading ? 'narrow' : (STEP_FRAME_WIDTH[step] ?? 'narrow')}+ preview={+ resumedPreview && !brandName ? (+ <DashboardPreview {...resumedPreview} promptCount={0} />+ ) : (+ <DashboardPreview+ brandName={brandName}+ // The website field is typed live on step 1; waiting until it is+ // submitted keeps the favicon lookup from firing on every keystroke.+ domain={step >= 2 ? domain : ''}+ topics={previewTopics}+ promptCount={step >= 4 ? totalPrompts : 0}+ competitors={suggestedCompetitors.filter((c) => c.selected)}+ />+ )+ }+ >+ {renderStep()}+ </OnboardingFrame>);}diff --git a/web/src/components/onboarding/dashboard-preview.tsx b/web/src/components/onboarding/dashboard-preview.tsxnew file mode 100644index 000000000..ca6dce942--- /dev/null+++ b/web/src/components/onboarding/dashboard-preview.tsx@@ -0,0 +1,246 @@+'use client';++import { useEffect, useState } from 'react';+import Image from 'next/image';+import { useTranslations } from 'next-intl';+import { useTheme } from 'next-themes';+import { ChevronsUpDown } from 'lucide-react';+import { dashboardNav } from '@/config/dashboard';+import { siteConfig } from '@/config/site';+import {+ getDashboardNavGroupLabel,+ getDashboardNavLabel,+ shouldShowDashboardNavItem,+} from '@/lib/dashboard-navigation';+import { getFaviconUrl } from '@/lib/favicon';+import { cn } from '@/lib/utils';++export interface DashboardPreviewCompetitor {+ name: string;+ domain: string;+}++interface DashboardPreviewProps {+ brandName: string;+ domain: string;+ topics: string[];+ promptCount: number;+ competitors: DashboardPreviewCompetitor[];+}++const LANDING_HREF = '/dashboard/insights';+const MAX_ROWS = 6;++/**+ * The dashboard a new user is being set up for, drawn behind the onboarding+ * wizard. It fills in as the wizard does — brand, topics, prompt count,+ * competitors — so the steps read as configuring a real panel rather than+ * filling in forms that lead somewhere unstated.+ *+ * Purely presentational: it renders the real navigation from dashboardNav but+ * reads no plan, brand or tracking state, because none exists yet. Metrics are+ * placeholder bars, never numbers — nothing has been measured at this point.+ */+export function DashboardPreview({+ brandName,+ domain,+ topics,+ promptCount,+ competitors,+}: DashboardPreviewProps) {+ const t = useTranslations('nav');+ const tBrands = useTranslations('brands');+ const { resolvedTheme } = useTheme();+ const [mounted, setMounted] = useState(false);+ useEffect(() => {+ // eslint-disable-next-line react-hooks/set-state-in-effect+ setMounted(true);+ }, []);+ const logoSrc = mounted && resolvedTheme === 'dark' ? '/logo_dark.svg' : '/logo_light.svg';++ const name = brandName.trim();+ const shownTopics = topics.slice(0, MAX_ROWS);+ const shownCompetitors = competitors.slice(0, MAX_ROWS - 1);++ return (+ <div className="flex h-full w-full overflow-hidden bg-background">+ <aside className="flex h-full w-60 shrink-0 flex-col border-r bg-card">+ <div className="flex h-16 items-center gap-2 border-b px-3">+ <Image src={logoSrc} alt="" width={24} height={24} className="h-6 w-6 shrink-0" />+ <span className="truncate font-semibold">{siteConfig.name}</span>+ </div>++ <div className="border-b px-2 py-2">+ <div className="flex items-center gap-2 rounded-md border px-2 py-1.5">+ <BrandMark name={name} domain={domain} />+ {name ? (+ <span className="flex-1 truncate text-sm font-medium">{name}</span>+ ) : (+ <Bar className="h-3 flex-1" />+ )}+ <ChevronsUpDown className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />+ </div>+ </div>++ <div className="flex-1 px-2 py-3">+ {dashboardNav.map((group, i) => (+ <div key={i} className="mb-4">+ {group.title && (+ <p className="mb-1 px-2 text-xs font-medium uppercase tracking-wider text-muted-foreground">+ {getDashboardNavGroupLabel(group.title, t)}+ </p>+ )}+ {!group.title && i > 0 && <div className="mb-2 h-px bg-border" />}+ <div className="space-y-0.5">+ {group.items+ .filter((item) =>+ shouldShowDashboardNavItem(item, { shoppingModeEnabled: false }),+ )+ .map((item) => (+ <div+ key={item.href}+ className={cn(+ 'flex items-center gap-3 rounded-md px-2 py-1.5 text-[13px] font-medium',+ item.href === LANDING_HREF+ ? 'bg-accent text-accent-foreground'+ : 'text-muted-foreground',+ )}+ >+ <item.icon className="h-4 w-4 shrink-0" />+ <span className="truncate">+ {getDashboardNavLabel(item.title, t, tBrands)}+ </span>+ </div>+ ))}+ </div>+ </div>+ ))}+ </div>+ </aside>++ <main className="flex-1 space-y-6 overflow-hidden p-8">+ <div className="flex items-center gap-3">+ <BrandMark name={name} domain={domain} size="lg" />+ <div className="space-y-1">+ <p className="text-2xl font-bold tracking-tight">{t('insights')}</p>+ {name ? (+ <p className="text-sm text-muted-foreground">+ {name}+ {domain && ` · ${domain}`}+ {promptCount > 0 && ` · ${promptCount} prompts`}+ </p>+ ) : (+ <Bar className="h-3 w-48" />+ )}+ </div>+ </div>++ <div className="grid grid-cols-4 gap-4">+ {Array.from({ length: 4 }, (_, i) => (+ <div key={i} className="space-y-3 rounded-xl border bg-card p-4">+ <Bar className="h-3 w-20" />+ <Bar className="h-7 w-16" />+ <Bar className="h-2 w-24" />+ </div>+ ))}+ </div>++ <div className="rounded-xl border bg-card p-5">+ <Bar className="mb-5 h-3 w-32" />+ <div className="flex h-40 items-end gap-2">+ {[38, 45, 42, 55, 52, 60, 58, 66, 63, 70, 68, 74].map((h, i) => (+ <div key={i} className="flex-1 rounded-t bg-muted" style={{ height: `${h}%` }} />+ ))}+ </div>+ </div>++ <div className="grid grid-cols-2 gap-4">+ <PreviewList title={t('topics')} empty={shownTopics.length === 0}>+ {shownTopics.map((topic) => (+ <Row key={topic} label={topic} />+ ))}+ </PreviewList>++ <PreviewList title="Competitors" empty={!name}>+ {name && <Row label={name} icon={<BrandMark name={name} domain={domain} />} strong />}+ {shownCompetitors.map((c) => (+ <Row+ key={`${c.name}-${c.domain}`}+ label={c.name}+ icon={<BrandMark name={c.name} domain={c.domain} />}+ />+ ))}+ </PreviewList>+ </div>+ </main>+ </div>+ );+}++function Bar({ className }: { className?: string }) {+ return <div className={cn('rounded-md bg-muted', className)} />;+}++function BrandMark({+ name,+ domain,+ size = 'sm',+}: {+ name: string;+ domain: string;+ size?: 'sm' | 'lg';+}) {+ const box = size === 'lg' ? 'h-10 w-10 rounded-lg' : 'h-5 w-5 rounded';+ if (domain) {+ return (+ /* eslint-disable-next-line @next/next/no-img-element */+ <img src={getFaviconUrl(domain, 64)} alt="" className={cn(box, 'shrink-0')} />+ );+ }+ return (+ <div+ className={cn(+ box,+ 'flex shrink-0 items-center justify-center bg-muted text-[10px] font-semibold text-muted-foreground',+ )}+ >+ {name.charAt(0).toUpperCase()}+ </div>+ );+}++function PreviewList({+ title,+ empty,+ children,+}: {+ title: string;+ empty: boolean;+ children: React.ReactNode;+}) {+ return (+ <div className="rounded-xl border bg-card p-5">+ <p className="mb-4 text-sm font-medium">{title}</p>+ <div className="space-y-3">+ {empty+ ? Array.from({ length: 4 }, (_, i) => (+ <div key={i} className="flex items-center gap-3">+ <Bar className="h-3 flex-1" />+ <Bar className="h-2 w-24" />+ </div>+ ))+ : children}+ </div>+ </div>+ );+}++function Row({ label, icon, strong }: { label: string; icon?: React.ReactNode; strong?: boolean }) {+ return (+ <div className="flex items-center gap-3 duration-500 animate-in fade-in">+ {icon}+ <span className={cn('flex-1 truncate text-sm', strong && 'font-medium')}>{label}</span>+ <Bar className="h-2 w-24" />+ </div>+ );+}diff --git a/web/src/components/onboarding/onboarding-frame.tsx b/web/src/components/onboarding/onboarding-frame.tsxnew file mode 100644index 000000000..5cdd71aaa--- /dev/null+++ b/web/src/components/onboarding/onboarding-frame.tsx@@ -0,0 +1,44 @@+import { cn } from '@/lib/utils';++/**+ * Onboarding's page shell: the wizard step sits in a card over a blurred+ * preview of the dashboard it is setting up. Below md the preview is dropped+ * and the step fills the screen as a plain page — a blurred sidebar has no+ * room to read as a dashboard on a phone.+ */+export function OnboardingFrame({+ preview,+ width,+ children,+}: {+ preview: React.ReactNode;+ /** Sized to the step's own content column, so no step floats in empty card. */+ width: 'narrow' | 'medium' | 'wide';+ children: React.ReactNode;+}) {+ return (+ <div className="relative min-h-svh">+ <div+ aria-hidden+ inert+ className="pointer-events-none fixed inset-0 hidden select-none overflow-hidden md:block"+ >+ <div className="h-full w-full scale-[1.02] blur-[3px]">{preview}</div>+ <div className="absolute inset-0 bg-background/50" />+ </div>++ <div className="relative flex min-h-svh flex-col md:p-8">+ <div+ className={cn(+ 'm-auto w-full bg-background md:rounded-2xl md:border md:shadow-2xl',+ width === 'wide' && 'md:max-w-5xl',+ width === 'medium' && 'md:max-w-3xl',+ width === 'narrow' && 'md:max-w-xl',+ )}+ >+ {children}+ </div>+ </div>+ </div>+ );+}diff --git a/web/src/config/prompt-options.ts b/web/src/config/prompt-options.tsindex 79af33735..b3cd5d2c2 100644--- a/web/src/config/prompt-options.ts+++ b/web/src/config/prompt-options.ts@@ -21,6 +21,9 @@ export const REGIONS = [export type RegionCode = (typeof REGIONS)[number]['code'];+/** `items` for a Select over REGIONS — without it the trigger shows the raw code. */+export const REGION_ITEMS = REGIONS.map((r) => ({ value: r.code, label: r.label }));+/*** US states for optional state-level geo-targeting (#554). Static on purpose:* the UI must not depend on the scraping provider's states endpoint. Codes are@@ -83,6 +86,8 @@ export const US_STATES = [export type UsStateCode = (typeof US_STATES)[number]['code'];+export const US_STATE_ITEMS = US_STATES.map((s) => ({ value: s.code, label: s.label }));+export const LANGUAGES = [{ code: 'en', label: 'English (en)' },{ code: 'de', label: 'German (de)' },@@ -101,6 +106,8 @@ export const LANGUAGES = [export type LanguageCode = (typeof LANGUAGES)[number]['code'];+export const LANGUAGE_ITEMS = LANGUAGES.map((l) => ({ value: l.code, label: l.label }));+export const MODEL_GROUPS = [{provider: 'Claude',