feat(onboarding): branch question on the journey done screen (#1468)

* feat(onboarding): branch question on the journey done screen

Second slice of the approved activation concept: the moment the company
exists, the done screen asks "Var fanns bokföringen innan?" with
provider chips (real logos), SIE file, and new-business options, plus a
quiet look-around escape. Choices persist initial_setup_path
(fire-and-forget) and deep-link into the existing flows: providers jump
straight to the migration wizard's connect step (sieViaApi providers
only; Visma/Bokio land on the provider list where the SIE-first gate
lives), the SIE chip opens the upload step, new business lands on Hem
with step one checked off.

mode='add' keeps the plain "Öppna Accounted" button: the concept's own
guard, and it avoids writing the path onto the previous company if
setActiveCompany silently failed. Routing lives in a pure helper with
tests; anonymous onboarding_branch_chosen funnel event follows the
guarded capture pattern.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(onboarding): review triage: single-choice latch, preselect reset

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix: restore package-lock.json to main (worktree npm install mutated it)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-08-08 15:27:17 +02:00
committed by GitHub
co-authored by Claude Fable 5 Jakob Wennberg
parent 44cff5e5e4
commit c7dd78b0a3
9 changed files with 252 additions and 9 deletions
+21 -2
View File
@@ -1968,6 +1968,7 @@ type ImportMode = null | 'psd2' | 'stripe' | 'woocommerce' | 'bank' | 'sie' | 'c
export default function ImportPage() {
const { isSandbox } = useCompany()
const [mode, setMode] = useState<ImportMode>(null)
const [initialProvider, setInitialProvider] = useState<string | null>(null)
const [view, setView] = useState<'import' | 'export'>('import')
const [sieDialogOpen, setSieDialogOpen] = useState(false)
const [cloudOpen, setCloudOpen] = useState(false)
@@ -2003,6 +2004,12 @@ export default function ImportPage() {
if (modeParam && allowedModes.includes(modeParam)) {
setMode(modeParam as ImportMode)
}
// Deep link from the onboarding branch question: preselect the old
// system so the wizard can jump straight to its connect step. Cleared
// for every other mode so a stale preselect can't survive re-entry.
setInitialProvider(
modeParam === 'migration' && !isSandbox ? searchParams.get('provider') : null
)
}
const viewParam = searchParams.get('view')
if (viewParam === 'export' || viewParam === 'import') {
@@ -2236,7 +2243,17 @@ export default function ImportPage() {
)}
{mode !== null && (
<Button variant="ghost" size="sm" onClick={() => setMode(null)}>
<Button
variant="ghost"
size="sm"
onClick={() => {
setMode(null)
// Mode is client state (not URL-synced), so the deep-linked
// preselect must be cleared here too or a re-entered migration
// mode would auto-jump again.
setInitialProvider(null)
}}
>
<ArrowLeft className="mr-2 h-4 w-4" />
{t('back_to_choices')}
</Button>
@@ -2294,7 +2311,9 @@ export default function ImportPage() {
{mode === 'bank' && <BankFileImportWizard />}
{mode === 'sie' && <SIEImportWizard />}
{mode === 'csv_data' && <CSVDataImportWizard />}
{mode === 'migration' && <MigrationWizard userId={userId} />}
{mode === 'migration' && (
<MigrationWizard userId={userId} initialProvider={initialProvider ?? undefined} />
)}
</div>
)
}