'use client' import Link from 'next/link' import { useTranslations } from 'next-intl' import { ArrowRight, CheckCircle2, FileCheck, FileText, Landmark, ArrowRightLeft, MessageCircle, ShieldCheck, } from 'lucide-react' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { cn } from '@/lib/utils' import { ENABLED_EXTENSION_IDS } from '@/lib/extensions/_generated/enabled-extensions' import { getBranding } from '@/lib/branding/service' const branding = getBranding() interface NewUserChecklistProps { onFreshStart: () => void className?: string /** * Per-step completion flags. The render flips each step from CTA to a * compact "done" card when its corresponding flag is true so the user * sees their progress without having to remember what they finished. */ hasBookkeepingImported?: boolean hasBankConnected?: boolean hasSkatteverketConnected?: boolean hasAgentBuilt?: boolean } export default function NewUserChecklist({ onFreshStart, className, hasBookkeepingImported, hasBankConnected, hasSkatteverketConnected, hasAgentBuilt, }: NewUserChecklistProps) { const t = useTranslations('new_user_checklist') const hasMigration = ENABLED_EXTENSION_IDS.has('arcim-migration') const hasBanking = ENABLED_EXTENSION_IDS.has('enable-banking') const hasSkatteverket = ENABLED_EXTENSION_IDS.has('skatteverket') return (
{/* Header — centered welcome. Data-import steps lead; building the assistant is the last step so a user coming from another system brings their books in first. */}

{t('welcome', { appName: branding.appName.toLowerCase() })}

{t('intro')}

{/* Step 1: Migrate bookkeeping */}
{hasBookkeepingImported ? : '1'}

{t('step1_title')}

{hasBookkeepingImported ? (

{t('step1_done_title')}

{t('step1_done_description')}

) : (
{hasMigration && (

{t('migrate_title')}

{t('migrate_description')}

{([ { name: 'Fortnox', logo: '/logos/fortnox.svg' }, { name: 'Visma', logo: '/logos/visma.jpeg' }, { name: 'Bokio', logo: '/logos/bokio.png' }, { name: 'Björn Lundén', logo: '/logos/bjornlunden.png' }, { name: 'Briox', logo: '/logos/Briox_logo.png' }, { name: 'SIE4-fil', logo: null }, ] as const).map(provider => (
{provider.logo ? ( {provider.name} ) : ( )} {provider.name}
))}
)}

{t('sie_title')}

{t('sie_description')}

)}
{/* Step 2: Connect bank */}
{hasBankConnected ? : '2'}

{t('step2_title')}

{hasBankConnected ? (

Bank kopplad

Transaktioner synkas automatiskt.

) : (

{t('bank_title')}

{hasBanking ? t('bank_description_psd2') : t('bank_description_file')}

)}
{/* Step 3: Connect Skatteverket — only when the extension is enabled. Optional: connecting here lets Accounted submit moms + AGI and read skattekonto saldo, but the user can skip and do it later from /settings/skatteverket. The OAuth flow returns to the dashboard via return_to=/, which clears the gate via the same path the user would take naturally. */} {hasSkatteverket && (
{hasSkatteverketConnected ? : '3'}

{t('step3_title')}

{t('optional_suffix')}
{hasSkatteverketConnected ? (

{t('skatteverket_connected_title')}

{t('skatteverket_connected_description')}

) : ( // eslint-disable-next-line @next/next/no-html-link-for-pages -- /api route, not a Next page would route via Next's client // router which doesn't follow cross-origin redirects. href="/api/extensions/ext/skatteverket/authorize?return_to=/" className="group block p-4 sm:p-6 rounded-lg border border-border hover:border-primary/40 hover:bg-primary/[0.02] transition-colors duration-150" >

{t('skatteverket_connect_title')}

{t('skatteverket_connect_description', { appName: branding.appName.toLowerCase() })}

)}
)} {/* Build the assistant — always the last step, so a user migrating from another system brings their books in first. */}
{hasAgentBuilt ? : (hasSkatteverket ? '4' : '3')}

Skapa din assistent

{hasAgentBuilt ? (

Assistenten är klar

Du kan börja chatta direkt. Justera tonalitet och kunskap i Inställningar > Assistentens minne.

) : (

Bygg din bokföringsassistent

Beta

Några frågor om din verksamhet kalibrerar tonalitet, signatur och vad assistenten kan. Ju mer du delar, desto bättre förstår den dig.

)}
{/* Escape hatch — a visible secondary action, not a muted ghost link, so users with nothing to import can clearly choose to start fresh. */}
{t('or_separator')}

{t('security_note')}

) }