'use client' import Link from 'next/link' import { useTranslations } from 'next-intl' import { ArrowRight, CheckCircle2, FileCheck, FileText, Landmark, ArrowRightLeft, ShieldCheck, } from 'lucide-react' 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 /** * Whether the active user already has a Skatteverket OAuth connection. * When true the Skatteverket step renders as completed instead of as a CTA. */ hasSkatteverketConnected?: boolean } export default function NewUserChecklist({ onFreshStart, className, hasSkatteverketConnected, }: 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 */}

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

{t('intro')}

{/* Step 1: Migrate bookkeeping */}
1

{t('step1_title')}

{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' }, ] as const).map(provider => (
{provider.name} {provider.name}
))}
)}

{t('sie_title')}

{t('sie_description')}

{/* Step 2: Connect bank */}
2

{t('step2_title')}

{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 gnubok 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-5 rounded-xl border border-border/60 hover:border-primary/40 hover:bg-primary/[0.02] transition-all duration-150 active:scale-[0.99]" >

{t('skatteverket_connect_title')}

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

)}
)} {/* Escape hatch */}
{t('or_separator')}

{t('security_note')}

) }