Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore(setup): remove setup, superceeded by new onboarding (#5220)

teo7deeedb0072b
diff --git a/apps/web/src/features/setup/ConnectorRow.tsx b/apps/web/src/features/setup/ConnectorRow.tsx
new file mode 100644
index 0000000000..be6ab2351d
--- /dev/null
+++ b/apps/web/src/features/setup/ConnectorRow.tsx
@@ -0,0 +1,72 @@
+import type { FeaturedMcpServer } from '@core/component/AI/constant/mcpServers';
+import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';
+import SpinnerIcon from '@phosphor/spinner-gap.svg';
+import { cn, Layer } from '@ui';
+import { Match, Switch } from 'solid-js';
+import { StatusDot } from '../settings/integration-ui';
+import { createConnectorConnect } from './useConnectorConnect';
+
+/**
+ * One connector in the onboarding flow: brand icon, name, and an explicit
+ * trailing status. Clicking an unconnected row starts OAuth in a popup.
+ */
+export function ConnectorRow(props: {
+ server: FeaturedMcpServer;
+ connected: boolean;
+ authenticated: boolean;
+}) {
+ const { connect, busy } = createConnectorConnect({
+ server: props.server,
+ connected: () => props.connected,
+ authenticated: () => props.authenticated,
+ });
+
+ return (
+ <Layer depth={2}>
+ <button
+ type="button"
+ title={
+ props.authenticated
+ ? `${props.server.server_name} is connected`
+ : props.server.tagline
+ }
+ onClick={() => void connect()}
+ class={cn(
+ 'group flex h-11 w-full items-center gap-2.5 rounded-xl border border-ink/[0.05] bg-surface px-3.5 text-sm',
+ 'cursor-default outline-none focus-visible:ring-1 focus-visible:ring-accent/50',
+ !props.authenticated && 'hover:border-ink/10'
+ )}
+ >
+ <span class="flex size-4 shrink-0 items-center justify-center [&_svg]:size-4">
+ <props.server.icon />
+ </span>
+ <span class="min-w-0 truncate font-medium text-ink">
+ {props.server.server_name}
+ </span>
+ <span class="ml-auto shrink-0">
+ <Switch
+ fallback={
+ <span class="flex items-center gap-1 text-xs font-medium text-ink-muted group-hover:text-ink">
+ Connect
+ <ArrowUpRightIcon class="size-3 shrink-0" />
+ </span>
+ }
+ >
+ <Match when={props.authenticated}>
+ <span class="flex items-center gap-1.5 text-xs text-ink-muted">
+ <StatusDot state="connected" />
+ Connected
+ </span>
+ </Match>
+ <Match when={busy()}>
+ <span class="flex items-center gap-1.5 text-xs text-ink-muted">
+ <SpinnerIcon class="size-3 shrink-0 animate-spin" />
+ Connecting…
+ </span>
+ </Match>
+ </Switch>
+ </span>
+ </button>
+ </Layer>
+ );
+}
diff --git a/apps/web/src/features/setup/ConnectorsSection.tsx b/apps/web/src/features/setup/ConnectorsSection.tsx
deleted file mode 100644
index d4fffbd1ca..0000000000
--- a/apps/web/src/features/setup/ConnectorsSection.tsx
+++ /dev/null
@@ -1,140 +0,0 @@
-import {
- FEATURED_MCP_SERVERS,
- type FeaturedMcpServer,
-} from '@core/component/AI/constant/mcpServers';
-import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';
-import SpinnerIcon from '@phosphor/spinner-gap.svg';
-import { useMcpServersQuery } from '@queries/mcp-servers';
-import { cn, Layer } from '@ui';
-import { createMemo, For, Match, Switch } from 'solid-js';
-import { StatusDot } from '../settings/integration-ui';
-import { createConnectorConnect } from './useConnectorConnect';
-
-/** The connectors onboarding leads with (the ones the builder acts on). */
-const SETUP_CONNECTOR_NAMES = ['Linear', 'GitHub', 'Notion', 'Slack'];
-
-/**
- * One connector as its own small card (same chrome as the import panel's
- * source cards): brand icon, name, and an explicit trailing status — a
- * green dot + "Connected" once OAuth has completed, a quiet "Connect"
- * affordance until then (the tagline survives as the hover title).
- * Clicking an unconnected card kicks off add + OAuth in a popup; the server
- * reconciles the moment OAuth completes, and the polled servers query flips
- * the card when the user returns. Also used by the onboarding flow's
- * connector steps.
- */
-export function ConnectorRow(props: {
- server: FeaturedMcpServer;
- connected: boolean;
- authenticated: boolean;
-}) {
- const { connect, busy } = createConnectorConnect({
- server: props.server,
- connected: () => props.connected,
- authenticated: () => props.authenticated,
- });
-
- return (
- <Layer depth={2}>
- <button
- type="button"
- title={
- props.authenticated
- ? `${props.server.server_name} is connected`
- : props.server.tagline
- }
- onClick={() => void connect()}
- class={cn(
- 'group flex h-11 w-full items-center gap-2.5 rounded-xl border border-ink/[0.05] bg-surface px-3.5 text-sm',
- 'cursor-default outline-none focus-visible:ring-1 focus-visible:ring-accent/50',
- !props.authenticated && 'hover:border-ink/10'
- )}
- >
- <span class="flex size-4 shrink-0 items-center justify-center [&_svg]:size-4">
- <props.server.icon />
- </span>
- <span class="min-w-0 truncate font-medium text-ink">
- {props.server.server_name}
- </span>
- <span class="ml-auto shrink-0">
- <Switch
- fallback={
- <span class="flex items-center gap-1 text-xs font-medium text-ink-muted group-hover:text-ink">
- Connect
- <ArrowUpRightIcon class="size-3 shrink-0" />
- </span>
- }
- >
- <Match when={props.authenticated}>
- <span class="flex items-center gap-1.5 text-xs text-ink-muted">
- <StatusDot state="connected" />
- Connected
- </span>
- </Match>
- <Match when={busy()}>
- <span class="flex items-center gap-1.5 text-xs text-ink-muted">
- <SpinnerIcon class="size-3 shrink-0 animate-spin" />
- Connecting…
- </span>
- </Match>
- </Switch>
- </span>
- </button>
- </Layer>
- );
-}
-
-/**
- * The tools half of "connect your work": the core connectors as a column of
- * one-line rows — connected ones read "Connected" with a status dot, the
- * rest are one-click OAuth. Connected tools feed the workspace builder on
- * the right.
- */
-export function ConnectorsSection() {
- // Poll: OAuth completes in a popup, and if this window never blurs (or
- // regains focus) no focus-refetch would ever flip the card. neverSuspend
- // keeps the polling query from re-suspending the page's boundary.
- const serversQuery = useMcpServersQuery({
- refetchInterval: 4_000,
- neverSuspend: true,
- });
-
- const featured = SETUP_CONNECTOR_NAMES.flatMap(
- (name) =>
- FEATURED_MCP_SERVERS.find((server) => server.server_name === name) ?? []
- );
-
- const serverByUrl = createMemo(() => {
- const map = new Map<string, { authenticated: boolean }>();
- for (const server of serversQuery.data ?? []) {
- map.set(server.url, { authenticated: server.authenticated });
- }
- return map;
- });
-
- return (
- <section class="flex flex-col gap-3">
- <div class="flex flex-col gap-1">
- <h2 class="text-[15px] font-semibold text-ink">Bring your tools</h2>
- <p class="text-sm text-ink-muted">
- Macro AI works with everything you create in Macro and everything in
- your connected tools. Connect a few integrations, and we'll optionally
- pull in a couple of items from each to get you started.
- </p>
- </div>
- <div class="flex flex-col gap-2">
- <For each={featured}>
- {(server) => (
- <ConnectorRow
- server={server}
- connected={serverByUrl().has(server.url)}
- authenticated={
- serverByUrl().get(server.url)?.authenticated ?? false
- }
- />
- )}
- </For>
- </div>
- </section>
- );
-}
diff --git a/apps/web/src/features/setup/ImportPanel.tsx b/apps/web/src/features/setup/ImportPanel.tsx
deleted file mode 100644
index b8be4c935b..0000000000
--- a/apps/web/src/features/setup/ImportPanel.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-import {
- type ImportEntity,
- type ImportRun,
- type ImportSource,
- useImportQuery,
- useRetryGatherMutation,
-} from '@queries/import';
-import { createMemo, For, Show } from 'solid-js';
-import { SourceImportCard } from './SourceImportCard';
-import {
- type SkippedSources,
- SOURCE_SECTIONS,
- type SourceSection,
-} from './selection';
-
-/** The `(gather run, ledger rows)` slice one source's card renders from. */
-interface SourceSlice {
- run?: ImportRun;
- entities: ImportEntity[];
-}
-
-/**
- * The import side of `/setup`: one card per connected source, rendered from
- * the import aggregate. Pills stream in live (gateway pushes + polling);
- * whether a section imports is a single toggle per card. Skip state lives
- * in the page (SetupPage), so the footer's "Continue to Macro" imports
- * exactly the sections still toggled on.
- */
-export function ImportPanel(props: {
- skipped: SkippedSources;
- onToggleSource: (source: ImportSource, skipped: boolean) => void;
-}) {
- const importQuery = useImportQuery();
- const retryGather = useRetryGatherMutation();
-
- const bySource = createMemo(() => {
- const state = importQuery.data;
- const map = new Map<ImportSource, SourceSlice>();
- for (const { source } of SOURCE_SECTIONS) {
- map.set(source, {
- run: state?.runs.find((run) => run.source === source),
- entities: (state?.entities ?? []).filter(
- (entity) => entity.source === source && entity.status !== 'discarded'
- ),
- });
- }
- return map;
- });
-
- const sliceFor = (definition: SourceSection): SourceSlice =>
- bySource().get(definition.source) ?? { entities: [] };
-
- const isVisible = (slice: SourceSlice) =>
- slice.run !== undefined || slice.entities.length > 0;
-
- const anyVisible = createMemo(() =>
- SOURCE_SECTIONS.some((definition) => isVisible(sliceFor(definition)))
- );
-
- return (
- <div class="flex flex-1 flex-col gap-7 overflow-y-auto p-8">
- <header>
- <h2 class="text-lg font-semibold">Workspace setup</h2>
- </header>
-
- <Show
- when={anyVisible()}
- fallback={
- <p class="text-sm text-ink-extra-muted">
- Connect a tool on the left to see what you can bring over.
- </p>
- }
- >
- <div class="flex flex-col gap-4">
- {/* Iterate the static definitions (stable row identity across
- refetches); visibility is decided per row. */}
- <For each={SOURCE_SECTIONS}>
- {(definition) => (
- <Show when={isVisible(sliceFor(definition))}>
- <SourceImportCard
- definition={definition}
- run={sliceFor(definition).run}
- entities={sliceFor(definition).entities}
- skipped={props.skipped[definition.source] === true}
- onToggleSkipped={(skipped) =>
- props.onToggleSource(definition.source, skipped)
- }
- onRetryGather={() => retryGather.mutate(definition.source)}
- />
- </Show>
- )}
- </For>
- </div>
- </Show>
- </div>
- );
-}
diff --git a/apps/web/src/features/setup/SetupPage.tsx b/apps/web/src/features/setup/SetupPage.tsx
deleted file mode 100644
index d418f64572..0000000000
--- a/apps/web/src/features/setup/SetupPage.tsx
+++ /dev/null
@@ -1,137 +0,0 @@
-import LogoIcon from '@icon/macro-logo.svg';
-import { useUserInfoQuery } from '@queries/auth/user-info';
-import { usePrimaryEmailLinkId } from '@queries/email/link';
-import { useImportQuery } from '@queries/import';
-import { useOnboardingQuery } from '@queries/onboarding';
-import { useNavigate } from '@solidjs/router';
-import { Button, Layer } from '@ui';
-import { createEffect, Suspense } from 'solid-js';
-import { createStore } from 'solid-js/store';
-import { ConnectorsSection } from './ConnectorsSection';
-import { createSetupFinish } from './createSetupFinish';
-import { ImportPanel } from './ImportPanel';
-import type { SkippedSources } from './selection';
-
-/**
- * The split-screen onboarding page (`/setup`): connect tools on the left,
- * pick what to bring over on the right. Everything is orchestrated
- * server-side — reads of an active onboarding start due gather runs,
- * connector OAuth completions hook in instantly, and `POST /import/run`
- * copies accepted items in — so this page only renders state and decides
- * when the user is done (the finish workflow lives in createSetupFinish).
- */
-export function SetupPage() {
- // The page owns its Suspense boundary: /setup renders under the app's
- // root <Suspense>, so any query suspending here would otherwise blank the
- // ENTIRE app. The polling queries carry placeholderData so they can never
- // re-suspend; this boundary contains genuine first-load waits from the
- // rest (user info).
- return (
- <Suspense
- fallback={
- <div class="flex h-full w-full items-center justify-center bg-surface">
- <LogoIcon class="size-8 animate-pulse text-accent" />
- </div>
- }
- >
- <SetupPageContent />
- </Suspense>
- );
-}
-
-function SetupPageContent() {
- const navigate = useNavigate();
- const userInfoQuery = useUserInfoQuery();
- const onboardingQuery = useOnboardingQuery();
- const importQuery = useImportQuery();
- // The user's own primary inbox link — present once email is connected
- // (drives the welcome copy: inbox processing vs plain setup).
- const emailConnected = usePrimaryEmailLinkId();
-
- // Per-source skip set (sections import by default; each card's toggle
- // flips its whole source off). Lives here so the footer's "Continue to
- // Macro" imports exactly the sections still toggled on. Keyed by source
- // so re-gathers and refetches keep the user's picks.
- const [skippedSources, setSkippedSources] = createStore<SkippedSources>({});
-
- const setupFinish = createSetupFinish({
- entities: () => importQuery.data?.entities,
- skippedSources,
- });
-
- // Redirect out when there is nothing to set up (unauthenticated, or the
- // flow was already completed elsewhere).
- createEffect(() => {
- if (userInfoQuery.data?.authenticated === false) {
- navigate('/login', { replace: true });
- return;
- }
- if (onboardingQuery.data?.row.status === 'completed') {
- navigate(setupFinish.afterSetupTarget(), { replace: true });
- }
- });
-
- return (
- // Same chrome as fullscreen settings: the left rail sits directly on the
- // page surface and the right pane is the subtly-raised, bordered card in
- // a tight gutter.
- <div class="flex h-full w-full overflow-hidden bg-surface font-sans text-ink">
- {/* Left: connect your work */}
- <div class="flex w-[40%] min-w-[380px] max-w-[520px] flex-col">
- <div class="flex flex-1 flex-col overflow-y-auto">
- <header class="px-8 pt-12">
- <LogoIcon class="size-8 text-accent" />
- <h1 class="mt-6 text-2xl/tight font-semibold">Welcome to Macro</h1>
- <p class="mt-1.5 text-sm text-ink-muted">
- {emailConnected()
- ? "While we process your inbox, let's bring in your tasks, documents, contacts, and channels, and set up your team."
- : 'Set up Macro by bringing in your tasks, documents, and channels, then invite your team.'}
- </p>
- </header>
-
- <div class="flex flex-col gap-8 px-8 pb-8 pt-9">
- <ConnectorsSection />
- </div>
- </div>
-
- <footer class="flex items-center justify-between px-8 py-5">
- <Button
- variant="active"
- depth={3}
- disabled={setupFinish.finishing()}
- onClick={() => void setupFinish.finish(false)}
- >
- {setupFinish.finishing()
- ? 'Setting up your workspace…'
- : setupFinish.selectedCount() > 0
- ? `Import ${setupFinish.selectedCount()} & continue`
- : 'Continue to Macro'}
- </Button>
- <button
- type="button"
- class="text-xs text-ink-extra-muted transition-colors hover:text-ink-muted"
- disabled={setupFinish.finishing()}
- onClick={() => void setupFinish.finish(true)}
- >
- Set up later
- </button>
- </footer>
- </div>
-
- {/* Right: what to bring over, in the settings content card
- (Layer-raised, rounded, inner border). */}
- <div class="min-w-0 flex-1 py-2 pr-2 pl-0">
- <Layer depth={1}>
- <div class="relative flex size-full flex-col overflow-hidden rounded-xl border border-ink/[0.06] bg-surface shadow-menu">
- <ImportPanel
- skipped={skippedSources}
- onToggleSource={(source, skipped) =>
- setSkippedSources(source, skipped)
- }
- />
- </div>
- </Layer>
- </div>
- </div>
- );
-}
diff --git a/apps/web/src/features/setup/SourceImportCard.tsx b/apps/web/src/features/setup/SourceImportCard.tsx
deleted file mode 100644
index 7bc7eff25f..0000000000
--- a/apps/web/src/features/setup/SourceImportCard.tsx
+++ /dev/null
@@ -1,157 +0,0 @@
-import { FEATURED_MCP_SERVERS } from '@core/component/AI/constant/mcpServers';
-import SpinnerIcon from '@phosphor/spinner-gap.svg';
-import type { ImportEntity, ImportRun } from '@queries/import';
-import { ToggleSwitch } from '@ui';
-import { createMemo, For, Match, Show, Switch } from 'solid-js';
-import { ImportEntityPill } from './ImportEntityPill';
-import { FailureNote, ImportCard, PillGrid, SkeletonPills } from './primitives';
-import type { SourceSection } from './selection';
-
-/** Row counts by status — derived once per entities change, read many times. */
-interface StatusCounts {
- staged: number;
- importing: number;
- imported: number;
-}
-
-/**
- * One source's card on the import panel: connector-first header with the
- * section import toggle, a status blurb (gathering / importing / found /
- * failed-with-retry), and the pill cloud. Purely presentational over the
- * `(run, entities)` slice its parent derives — skip state and mutations
- * stay with the owners.
- */
-export function SourceImportCard(props: {
- definition: SourceSection;
- run: ImportRun | undefined;
- entities: ImportEntity[];
- skipped: boolean;
- onToggleSkipped: (skipped: boolean) => void;
- onRetryGather: () => void;
-}) {
- const server = createMemo(() =>
- FEATURED_MCP_SERVERS.find(
- (candidate) => candidate.server_name === props.definition.serverName
- )
- );
- const serverIcon = () => {
- const found = server();
- return found ? <found.icon /> : undefined;
- };
- const counts = createMemo<StatusCounts>(() => {
- const tally: StatusCounts = { staged: 0, importing: 0, imported: 0 };
- for (const entity of props.entities) {
- if (entity.status === 'staged') tally.staged += 1;
- else if (entity.status === 'importing') tally.importing += 1;
- else if (entity.status === 'imported') tally.imported += 1;
- }
- return tally;
- });
- const gathering = () => props.run?.status === 'running';
- // Skipping a section collapses its staged pills entirely;
- // importing/imported rows stay visible regardless.
- const visiblePills = createMemo(() =>
- props.skipped
- ? props.entities.filter((entity) => entity.status !== 'staged')
- : props.entities
- );
-
- return (
- <ImportCard
- icon={serverIcon()}
- title={props.definition.serverName}
- count={props.entities.length || undefined}
- connected
- actions={
- <Show when={counts().staged > 0}>
- <ToggleSwitch
- size="sm"
- class="flex-row-reverse"
- checked={!props.skipped}
- onChange={(checked) => props.onToggleSkipped(!checked)}
- label={props.skipped ? 'Skipped' : 'Import all'}
- labelClass="text-xs text-ink-muted select-none"
- />
- </Show>
- }
- status={
- <SectionStatus
- definition={props.definition}
- run={props.run}
- counts={counts()}
- skipped={props.skipped}
- onRetryGather={props.onRetryGather}
- />
- }
- >
- <Show when={visiblePills().length > 0 || gathering()}>
- <PillGrid>
- <For each={visiblePills()}>
- {(entity) => (
- <ImportEntityPill entity={entity} icon={serverIcon()} />
- )}
- </For>
- <Show when={gathering()}>
- <SkeletonPills count={visiblePills().length > 0 ? 3 : 6} />
- </Show>
- </PillGrid>
- </Show>
- </ImportCard>
- );
-}
-
-/**
- * The card's status blurb, continuing the well's "Connected —" lead-in
- * (lowercase starts). Failure always surfaces with a retry — even when
- * earlier/teammate imports left entities in the section, since a silent
- * failure just looks like a thin result.
- */
-function SectionStatus(props: {
- definition: SourceSection;
- run: ImportRun | undefined;
- counts: StatusCounts;
- skipped: boolean;
- onRetryGather: () => void;
-}) {
- return (
- <Switch>
- <Match when={props.run?.status === 'failed'}>
- <FailureNote
- message={`we couldn't look through your ${props.definition.serverName}.`}
- onRetry={() => props.onRetryGather()}
- />
- </Match>
- <Match when={props.run?.status === 'running'}>
- <span class="flex items-center gap-1.5">
- looking through your {props.definition.serverName} for{' '}
- {props.definition.noun} worth importing…
- <SpinnerIcon class="size-3 shrink-0 animate-spin" />
- </span>
- </Match>
- <Match when={props.counts.importing > 0}>
- <span class="flex items-center gap-1.5">
- importing {props.counts.importing} {props.definition.noun} into your
- workspace…
- <SpinnerIcon class="size-3 shrink-0 animate-spin" />
- </span>
- </Match>
- <Match when={props.counts.staged > 0}>
- <span>
- <Show
- when={!props.skipped}
- fallback={<>suggested imports skipped for now.</>}
- >
- here are some{' '}
- <span class="font-medium text-ink">{props.definition.noun}</span> we
- pulled in to start your workspace. You can always ask Macro AI to
- bring in more later.
- </Show>
- </span>
- </Match>
- <Match when={true}>
- {props.counts.imported} {props.definition.noun} from{' '}
- {props.definition.serverName} are in your workspace.
- </Match>
- </Switch>
- );
-}
diff --git a/apps/web/src/features/setup/createSetupFinish.ts b/apps/web/src/features/setup/createSetupFinish.ts
deleted file mode 100644
index b8ffbf6bd5..0000000000
--- a/apps/web/src/features/setup/createSetupFinish.ts
+++ /dev/null
@@ -1,145 +0,0 @@
-import { toast } from '@core/component/Toast/Toast';
-import { authKeys } from '@queries/auth/keys';
-import { useCompleteTutorialMutation } from '@queries/auth/tutorial';
-import { useUserInfoQuery } from '@queries/auth/user-info';
-import { queryClient } from '@queries/client';
-import {
- fetchImportState,
- type ImportEntity,
- useRunImportMutation,
-} from '@queries/import';
-import { useCompleteOnboardingMutation } from '@queries/onboarding';
-import { useNavigate, useSearchParams } from '@solidjs/router';
-import { type Accessor, createMemo, createSignal } from 'solid-js';
-import { type SkippedSources, stagedSelection } from './selection';
-
-/**
- * How long "Continue to Macro" holds for in-flight imports before letting
- * the user through anyway (imports keep landing server-side; the ledger is
- * never lost to navigation).
- */
-const FINISH_IMPORT_WAIT_MS = 90_000;
-const FINISH_POLL_INTERVAL_MS = 1_500;
-
-function sleep(ms: number): Promise<void> {
- return new Promise((resolve) => setTimeout(resolve, ms));
-}
-
-/**
- * The "leave /setup" workflow, as a composable primitive: derives the
- * current selection, and `finish()` imports it (holding while rows land),
- * completes onboarding + the legacy tutorial, and navigates into the app —
- * to the deep link the redirect preserved (`?next=`), or home.
- *
- * `skippedSources` is read reactively (pass the store proxy itself).
- */
-export function createSetupFinish(options: {
- entities: Accessor<ImportEntity[] | undefined>;
- skippedSources: SkippedSources;
-}) {
- const navigate = useNavigate();
- const [searchParams] = useSearchParams();
- const userInfoQuery = useUserInfoQuery();
- const completeOnboarding = useCompleteOnboardingMutation();
- const completeTutorial = useCompleteTutorialMutation();
- const runImport = useRunImportMutation();
- const [finishing, setFinishing] = createSignal(false);
-
- const selection = createMemo(() =>
- stagedSelection(options.entities(), options.skippedSources)
- );
- const selectedCount = createMemo(() => selection().importIds.length);
-
- // Where to land after setup. Same-app relative paths only.
- const afterSetupTarget = () => {
- const next = searchParams.next;
- return typeof next === 'string' &&
- next.startsWith('/') &&
- !next.startsWith('//')
- ? next
- : '/';
- };
-
- /**
- * Import the current selection and hold until the rows settle (the pills
- * animate importing → "in Macro" live while this waits). Returns how many
- * accepted items had NOT landed as imported when the wait ended — failed
- * rows fall back to `staged` with an error, and a capped wait counts the
- * stragglers too.
- */
- const runSelectedImports = async (): Promise<number> => {
- const { importIds, discardIds } = selection();
- if (importIds.length === 0 && discardIds.length === 0) return 0;
- await runImport.mutateAsync({ importIds, discardIds });
- if (importIds.length === 0) return 0;
-
- const accepted = new Set(importIds);
- const deadline = Date.now() + FINISH_IMPORT_WAIT_MS;
- while (Date.now() < deadline) {
- // Through the shared cache, so concurrent subscribers stay in sync;
- // a single failed poll is not fatal (the next tick retries).
- const entities = await fetchImportState().then(
- (state) => state.entities,
- () => undefined
- );
- if (entities) {
- const inFlight = entities.some(
- (entity) => accepted.has(entity.id) && entity.status === 'importing'
- );
- if (!inFlight) {
- return entities.filter(
- (entity) => accepted.has(entity.id) && entity.status !== 'imported'
- ).length;
- }
- }
- await sleep(FINISH_POLL_INTERVAL_MS);
- }
- return 0; // Timed out waiting — imports continue server-side.
- };
-
- // Import whatever is still selected (holding while the pills land), then
- // mark the flow completed server-side (which removes leftover
- // onboarding-staged candidates) and the legacy tutorial done (suppressing
- // the old modal), then land in the app.
- const finish = async (skipped: boolean) => {
- if (finishing()) return;
- setFinishing(true);
- try {
- if (!skipped) {
- // A hard failure here means the import request never took: don't
- // complete onboarding over the user's dropped selection. (A settle
- // timeout is different — runSelectedImports resolves 0 for it and
- // the imports keep landing server-side.)
- try {
- const failed = await runSelectedImports();
- if (failed > 0) {
- toast.failure(`${failed} items failed to import`);
- }
- } catch {
- toast.failure('Importing failed — please try again');
- return;
- }
- }
- await Promise.allSettled([
- completeOnboarding.mutateAsync({ skipped }),
- completeTutorial.mutateAsync(),
- ]);
- // NewOnboardingRedirect keys off userInfo.tutorialComplete: navigating
- // before the cache reflects the PATCH would bounce straight back here.
- // Refetch and verify — if the PATCH failed (allSettled hides it) or
- // the refetch missed, stay put and let the user retry.
- await queryClient
- .refetchQueries({ queryKey: authKeys.userInfo.queryKey })
- .catch(() => {});
- if (userInfoQuery.data?.tutorialComplete !== true) {
- toast.failure("Couldn't finish setup — please try again");
- return;
- }
- navigate(afterSetupTarget(), { replace: true });
- } finally {
- setFinishing(false);
- }
- };
-
- return { finishing, finish, selectedCount, afterSetupTarget };
-}
diff --git a/apps/web/src/features/setup/flow/ConnectorStep.tsx b/apps/web/src/features/setup/flow/ConnectorStep.tsx
index 5f337a6a4e..bb6babee81 100644
--- a/apps/web/src/features/setup/flow/ConnectorStep.tsx
+++ b/apps/web/src/features/setup/flow/ConnectorStep.tsx
@@ -4,7 +4,7 @@ import SpinnerIcon from '@phosphor/spinner-gap.svg';
import { useMcpServersQuery } from '@queries/mcp-servers';
import { Layer } from '@ui';
import { createEffect, createMemo, Show } from 'solid-js';
-import { ConnectorRow } from '../ConnectorsSection';
+import { ConnectorRow } from '../ConnectorRow';
import { ContinueButton, FeatureList, SkipButton } from './shared';
/** One connector per page. OAuth runs in a popup; the polled servers query
diff --git a/apps/web/src/features/setup/primitives.tsx b/apps/web/src/features/setup/primitives.tsx
index ed76325385..f3ecaf9125 100644
--- a/apps/web/src/features/setup/primitives.tsx
+++ b/apps/web/src/features/setup/primitives.tsx
@@ -4,9 +4,8 @@ import { For, type JSX, Show } from 'solid-js';
import { StatusDot } from '../settings/integration-ui';
/*
- * Building blocks for the /setup import panel: one bordered card per
+ * Building blocks for the onboarding summary: one bordered card per
* connected source, whose body is a cloud of narrow, content-fit pills.
- * Selection happens per-card (a section-level toggle), never per-pill.
*/
/**
@@ -25,7 +24,7 @@ export function ImportCard(props: {
count?: number;
/** Lead the status well with the green dot + "Connected —". */
connected?: boolean;
- /** Right-aligned header controls (the section import toggle). */
+ /** Optional right-aligned header controls. */
actions?: JSX.Element;
/**
* Status blurb rendered in the well after the "Connected —" lead-in, so
@@ -85,9 +84,8 @@ export function PillGrid(props: { children: JSX.Element }) {
* like an inline @ mention: entity icon, optional muted identifier, the name
* with the mention underline, then trailing status. Width hugs the content
* (name truncated past a cap) so a section reads as a compact cloud instead
- * of a full-width list. Pills are display-only — whether they import is
- * decided by the card's section toggle — except imported ones, which open
- * the entity they became.
+ * of a full-width list. Pills are display-only except imported ones, which
+ * open the entity they became.
*/
export function ItemPill(props: {
icon?: JSX.Element;
diff --git a/apps/web/src/features/setup/selection.ts b/apps/web/src/features/setup/selection.ts
index 2a9446615e..2ba693cecb 100644
--- a/apps/web/src/features/setup/selection.ts
+++ b/apps/web/src/features/setup/selection.ts
@@ -1,14 +1,9 @@
-import type { ImportEntity, ImportSource } from '@queries/import';
+import type { ImportSource } from '@queries/import';
/*
- * Pure selection logic for the /setup import panel: which sources exist,
- * and how the per-source skip set maps onto the accept/decline id lists
- * `POST /import/run` takes. No Solid primitives here.
+ * Import-source display metadata shared by onboarding summary cards.
*/
-/** Per-source skip set: sections import by default; `true` skips one. */
-export type SkippedSources = Partial<Record<ImportSource, boolean>>;
-
/** Display order, connector identity, and item noun for one source. */
export interface SourceSection {
source: ImportSource;
@@ -23,24 +18,3 @@ export const SOURCE_SECTIONS: SourceSection[] = [
{ source: 'notion', serverName: 'Notion', noun: 'documents' },
{ source: 'slack', serverName: 'Slack', noun: 'channels' },
];
-
-/**
- * Split the user's staged rows into accept/decline id lists from the skip
- * set. What "Continue to Macro" sends to `POST /import/run`.
- */
-export function stagedSelection(
- entities: ImportEntity[] | undefined,
- skippedSources: SkippedSources
-): { importIds: string[]; discardIds: string[] } {
- const staged = (entities ?? []).filter(
- (entity) => entity.status === 'staged'
- );
- return {
- importIds: staged
- .filter((entity) => !skippedSources[entity.source])
- .map((entity) => entity.id),
- discardIds: staged
- .filter((entity) => skippedSources[entity.source])
- .map((entity) => entity.id),
- };
-}
diff --git a/apps/web/src/features/setup/useConnectorConnect.ts b/apps/web/src/features/setup/useConnectorConnect.ts
index c5ef8323b8..4c0ff58548 100644
--- a/apps/web/src/features/setup/useConnectorConnect.ts
+++ b/apps/web/src/features/setup/useConnectorConnect.ts
@@ -8,12 +8,13 @@ import type { StartAuthResponse } from '@service-cognition/generated/schemas';
import { type Accessor, createSignal } from 'solid-js';
/**
- * The connect-a-tool workflow shared by the setup surfaces: add the MCP
- * server if needed, then run OAuth in a popup. The popup opens synchronously,
- * while the click's transient activation is still live — opening after the
- * awaited mutations gets rejected by strict popup blockers. The OAuth URL is
- * assigned once it's known; severing `opener` keeps the provider page from
- * reaching back into the app (reverse tabnabbing).
+ * The connect-a-tool workflow used by onboarding's connector steps: add the
+ * MCP server if needed, then run OAuth in a popup. The popup opens
+ * synchronously, while the click's transient activation is still live —
+ * opening after the awaited mutations gets rejected by strict popup
+ * blockers. The OAuth URL is assigned once it's known; severing `opener`
+ * keeps the provider page from reaching back into the app (reverse
+ * tabnabbing).
*
* Completion is observed, not returned: the server reconciles the moment
* OAuth completes, and the caller's polled servers query flips the state.
diff --git a/apps/web/src/routes/Root.tsx b/apps/web/src/routes/Root.tsx
index e4a6ba8099..a203202cd6 100644
--- a/apps/web/src/routes/Root.tsx
+++ b/apps/web/src/routes/Root.tsx
@@ -581,8 +581,8 @@ function InitialInteractiveOnboardingModal() {
const modalOpen = () =>
open() &&
- // The new split-screen onboarding replaces this modal on desktop; the
- // Layout redirect sends first-time users to /setup instead.
+ // Onboarding-v4 replaces this modal on desktop; the Layout redirect
+ // sends first-time users to /onboarding instead.
(!ENABLE_ONBOARDING_V4 || isMobile()) &&
!isNativeMobilePlatform() &&
userInfoQuery.data?.authenticated === true &&