Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

feat(frontend): introduce an expert-first onboarding wizard (#14464)

Abhimanyu Yadavdd71bda0df43
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/brain-dump.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/brain-dump.test.tsx
index e4e437b745..cef0fdee49 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/brain-dump.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/brain-dump.test.tsx
@@ -102,10 +102,6 @@ vi.mock("posthog-js", () => ({
default: { capture: vi.fn() },
}));
-vi.mock("../steps/WelcomeStep", () => ({
- WelcomeStep: () => <div data-testid="step-welcome" />,
-}));
-
vi.mock("../steps/RoleStep", () => ({
RoleStep: () => <div data-testid="step-role" />,
}));
@@ -324,11 +320,11 @@ function finalizeReturns(response: {
}
function stepDots(container: HTMLElement) {
- return container.querySelectorAll("div.h-2.rounded-full").length;
+ return container.querySelectorAll("div.h-1\\.5.rounded-full").length;
}
function progressWidth(container: HTMLElement) {
- const bar = container.querySelector<HTMLElement>("div.bg-purple-400");
+ const bar = container.querySelector<HTMLElement>("div.bg-zinc-900");
return bar?.style.width ?? null;
}
@@ -850,17 +846,15 @@ describe("onboarding step map integrity", () => {
it("keeps the step constants identical regardless of the brain-dump flag", () => {
expect(PAYWALL_FIRST_STEPS).toEqual({
subscription: 1,
- welcome: 2,
- role: 3,
- painPoints: 4,
- preparing: 5,
- });
- expect(NO_PAYWALL_STEPS).toEqual({
- welcome: 1,
role: 2,
painPoints: 3,
preparing: 4,
});
+ expect(NO_PAYWALL_STEPS).toEqual({
+ role: 1,
+ painPoints: 2,
+ preparing: 3,
+ });
});
it("renders the same screen count and progress with the flag on and off", async () => {
@@ -884,8 +878,8 @@ describe("onboarding step map integrity", () => {
const onWidth = progressWidth(on.container);
const onUrl = routerReplace.mock.calls.map((c) => c[0]);
- expect(offDots).toBe(3);
- expect(offWidth).toBe("75%");
+ expect(offDots).toBe(2);
+ expect(offWidth).toBe(`${(2 / 3) * 100}%`);
expect(onDots).toBe(offDots);
expect(onWidth).toBe(offWidth);
expect(onUrl).toEqual(offUrl);
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/page.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/page.test.tsx
index 658e1bcc63..a50dae3fb9 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/page.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/page.test.tsx
@@ -1,23 +1,20 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
+ act,
cleanup,
fireEvent,
render,
screen,
waitFor,
} from "@/tests/integrations/test-utils";
-import { server } from "@/mocks/mock-server";
import {
installGtagShim,
removeGtagShim,
} from "@/tests/integrations/gtag-shim";
-import { http, HttpResponse } from "msw";
+import type { User } from "@/lib/auth/types";
import OnboardingPage from "../page";
import { useOnboardingWizardStore } from "../store";
-vi.mock("../steps/WelcomeStep", () => ({
- WelcomeStep: () => <div data-testid="step-welcome" />,
-}));
vi.mock("../steps/RoleStep", () => ({
RoleStep: () => <div data-testid="step-role" />,
}));
@@ -31,6 +28,14 @@ vi.mock("../steps/ConnectStep/ConnectStep", () => ({
vi.mock("../steps/SubscriptionStep/SubscriptionStep", () => ({
SubscriptionStep: () => <div data-testid="step-subscription" />,
}));
+vi.mock("../steps/IntroStep/IntroStep", () => ({
+ IntroStep: ({ slide }: { slide: string }) => (
+ <div data-testid={`step-${slide}`} />
+ ),
+}));
+vi.mock("../steps/HireStep/HireStep", () => ({
+ HireStep: () => <div data-testid="step-hire" />,
+}));
vi.mock("../steps/PreparingStep", () => ({
PreparingStep: ({ onComplete }: { onComplete: () => void }) => (
<button data-testid="step-preparing" onClick={onComplete} />
@@ -50,32 +55,20 @@ vi.mock("next/navigation", () => ({
}));
let mockAuthState = { isLoggedIn: true, isUserLoading: false };
-const mockRefreshSession = vi.fn(() => Promise.resolve({ user: null }));
+let mockUser: User | null = null;
vi.mock("@/lib/auth/hooks/useAuth", () => ({
useAuth: () => ({
...mockAuthState,
- user: null,
- refreshSession: mockRefreshSession,
+ user: mockUser,
+ refreshSession: vi.fn(() => Promise.resolve({ user: null })),
}),
}));
-// The onboarding page writes preferred_name through the server route,
-// which is the only holder of the Better Auth session cookie context
-// (client-side updateUser was a silent no-op; regression caught in manual QA).
-const authUserPutBodies: unknown[] = [];
-function mockAuthUserRoute() {
- server.use(
- http.put("/api/auth/user", async ({ request }) => {
- authUserPutBodies.push(await request.json());
- return HttpResponse.json({ user: { id: "u1" } });
- }),
- );
-}
-
let mockCompletedSteps: string[] = [];
-const completeOnboardingStep = vi.hoisted(() =>
- vi.fn(() => Promise.resolve({ status: 200 })),
-);
+const { completeOnboardingStep, submitOnboardingProfile } = vi.hoisted(() => ({
+ completeOnboardingStep: vi.fn(() => Promise.resolve({ status: 200 })),
+ submitOnboardingProfile: vi.fn(() => Promise.resolve({ status: 200 })),
+}));
vi.mock("@/app/api/__generated__/endpoints/onboarding/onboarding", () => ({
getV1OnboardingState: () =>
Promise.resolve({
@@ -86,7 +79,7 @@ vi.mock("@/app/api/__generated__/endpoints/onboarding/onboarding", () => ({
Promise.resolve({ status: 200, data: false }),
patchV1UpdateOnboardingState: () => Promise.resolve({ status: 200 }),
postV1CompleteOnboardingStep: completeOnboardingStep,
- postV1SubmitOnboardingProfile: () => Promise.resolve({ status: 200 }),
+ postV1SubmitOnboardingProfile: submitOnboardingProfile,
}));
let mockSubscriptionTier: string = "NO_TIER";
@@ -111,13 +104,29 @@ vi.mock("@/app/api/helpers", () => ({
// on every other gated flag — including the brain dump, which replaces
// the pillbox step this file asserts on.
let mockFlagValue = false;
+let mockExpertTeamEnabled = false;
+let mockHireExpertsEnabled = true;
+let mockBrainDumpEnabled = false;
vi.mock("@/services/feature-flags/use-get-flag", () => ({
Flag: {
ENABLE_PLATFORM_PAYMENT: "ENABLE_PLATFORM_PAYMENT",
ONBOARDING_BRAIN_DUMP: "ONBOARDING_BRAIN_DUMP",
+ ONBOARDING_EXPERT_TEAM: "ONBOARDING_EXPERT_TEAM",
+ HIRE_EXPERTS: "HIRE_EXPERTS",
},
- useGetFlag: (flag: string) =>
- flag === "ENABLE_PLATFORM_PAYMENT" ? mockFlagValue : false,
+ useGetFlag: (flag: string) => {
+ if (flag === "ENABLE_PLATFORM_PAYMENT") return mockFlagValue;
+ if (flag === "ONBOARDING_EXPERT_TEAM") return mockExpertTeamEnabled;
+ if (flag === "HIRE_EXPERTS") return mockHireExpertsEnabled;
+ if (flag === "ONBOARDING_BRAIN_DUMP") return mockBrainDumpEnabled;
+ return false;
+ },
+}));
+
+// The brain dump step is the real one when its flag is on; the page tests
+// only care which slot it occupies.
+vi.mock("../steps/BrainDumpStep/BrainDumpStep", () => ({
+ BrainDumpStep: () => <div data-testid="step-braindump" />,
}));
vi.mock("@/services/environment", async (importOriginal) => {
@@ -141,16 +150,18 @@ let mockIsLocal = false;
beforeEach(() => {
currentSearchParams = new URLSearchParams();
mockFlagValue = false;
+ mockExpertTeamEnabled = false;
+ mockHireExpertsEnabled = true;
+ mockBrainDumpEnabled = false;
mockIsLocal = false;
mockSubscriptionTier = "NO_TIER";
mockAuthState = { isLoggedIn: true, isUserLoading: false };
- authUserPutBodies.length = 0;
- mockAuthUserRoute();
- mockRefreshSession.mockClear();
+ mockUser = null;
mockCompletedSteps = [];
routerReplace.mockClear();
completeOnboardingStep.mockReset();
completeOnboardingStep.mockResolvedValue({ status: 200 });
+ submitOnboardingProfile.mockClear();
useOnboardingWizardStore.getState().reset();
window.sessionStorage.removeItem(STEP_STORAGE_KEY);
});
@@ -163,11 +174,150 @@ afterEach(() => {
vi.unstubAllEnvs();
});
+describe("OnboardingPage — intro steps", () => {
+ it("starts on the Team step when the expert team is on", async () => {
+ mockExpertTeamEnabled = true;
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-team")).toBeDefined();
+ expect(screen.queryByTestId("step-role")).toBeNull();
+ });
+
+ it("walks Team → Meet AutoPilot → Role, tracking each as a step", async () => {
+ mockExpertTeamEnabled = true;
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-team")).toBeDefined();
+
+ act(() => useOnboardingWizardStore.getState().nextStep());
+ expect(await screen.findByTestId("step-autopilot")).toBeDefined();
+ await waitFor(() => {
+ expect(routerReplace).toHaveBeenCalledWith("/onboarding?step=2", {
+ scroll: false,
+ });
+ });
+
+ act(() => useOnboardingWizardStore.getState().nextStep());
+ expect(await screen.findByTestId("step-role")).toBeDefined();
+ expect(screen.queryByTestId("step-subscription")).toBeNull();
+ expect(window.sessionStorage.getItem(STEP_STORAGE_KEY)).toBe("3");
+ });
+
+ it("lets Back return from Role to Meet AutoPilot", async () => {
+ mockExpertTeamEnabled = true;
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
+ currentSearchParams = new URLSearchParams("step=3");
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-role")).toBeDefined();
+
+ fireEvent.click(screen.getByRole("button", { name: "Back" }));
+ expect(await screen.findByTestId("step-autopilot")).toBeDefined();
+ });
+
+ it("hides Back on the Team step", async () => {
+ mockExpertTeamEnabled = true;
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-team")).toBeDefined();
+ expect(screen.queryByRole("button", { name: "Back" })).toBeNull();
+ });
+
+ it("resumes on Meet AutoPilot when that is the highest step reached", async () => {
+ mockExpertTeamEnabled = true;
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "2");
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-autopilot")).toBeDefined();
+ expect(screen.queryByTestId("step-team")).toBeNull();
+ });
+
+ it("puts the paywall before the intro steps and Preparing last", async () => {
+ mockExpertTeamEnabled = true;
+ mockFlagValue = true;
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-subscription")).toBeDefined();
+
+ act(() => useOnboardingWizardStore.getState().nextStep());
+ expect(await screen.findByTestId("step-team")).toBeDefined();
+
+ act(() => useOnboardingWizardStore.getState().goToStep(6));
+ expect(await screen.findByTestId("step-preparing")).toBeDefined();
+ });
+
+ it("has no intro steps when the expert team flag is off", async () => {
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-role")).toBeDefined();
+ expect(screen.queryByTestId("step-team")).toBeNull();
+ });
+});
+
+describe("OnboardingPage — hire step", () => {
+ it("follows the brain dump with the hire step, then Preparing", async () => {
+ mockExpertTeamEnabled = true;
+ mockBrainDumpEnabled = true;
+ mockFlagValue = true;
+ // Paywall 1, Team 2, Meet AutoPilot 3, Role 4, Brain dump 5, Hire 6,
+ // Preparing 7.
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "5");
+ currentSearchParams = new URLSearchParams("step=5");
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-braindump")).toBeDefined();
+
+ act(() => useOnboardingWizardStore.getState().nextStep());
+ expect(await screen.findByTestId("step-hire")).toBeDefined();
+ await waitFor(() => {
+ expect(routerReplace).toHaveBeenCalledWith("/onboarding?step=6", {
+ scroll: false,
+ });
+ });
+
+ act(() => useOnboardingWizardStore.getState().nextStep());
+ expect(await screen.findByTestId("step-preparing")).toBeDefined();
+ });
+
+ it("lets Back return from the hire step to the brain dump", async () => {
+ mockExpertTeamEnabled = true;
+ mockBrainDumpEnabled = true;
+ mockFlagValue = true;
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "6");
+ currentSearchParams = new URLSearchParams("step=6");
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-hire")).toBeDefined();
+
+ fireEvent.click(screen.getByRole("button", { name: "Back" }));
+ expect(await screen.findByTestId("step-braindump")).toBeDefined();
+ });
+
+ it("has no hire step without the brain dump it reads from", async () => {
+ mockExpertTeamEnabled = true;
+ mockFlagValue = true;
+ // Paywall 1, Team 2, Meet AutoPilot 3, Role 4, Pain points 5, Preparing 6.
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "5");
+ currentSearchParams = new URLSearchParams("step=5");
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-painpoints")).toBeDefined();
+
+ act(() => useOnboardingWizardStore.getState().nextStep());
+ expect(await screen.findByTestId("step-preparing")).toBeDefined();
+ expect(screen.queryByTestId("step-hire")).toBeNull();
+ });
+
+ it("has no hire step when the expert team is off, even with the dump on", async () => {
+ mockBrainDumpEnabled = true;
+ mockFlagValue = true;
+ // Paywall 1, Role 2, Brain dump 3, Preparing 4.
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
+ currentSearchParams = new URLSearchParams("step=3");
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-braindump")).toBeDefined();
+
+ act(() => useOnboardingWizardStore.getState().nextStep());
+ expect(await screen.findByTestId("step-preparing")).toBeDefined();
+ expect(screen.queryByTestId("step-hire")).toBeNull();
+ });
+});
+
describe("OnboardingPage — flag-gated SubscriptionStep", () => {
- it("renders Welcome at step 1 by default in flag-off mode", async () => {
+ it("renders Role at step 1 by default in flag-off mode", async () => {
mockFlagValue = false;
render(<OnboardingPage />);
- expect(await screen.findByTestId("step-welcome")).toBeDefined();
+ expect(await screen.findByTestId("step-role")).toBeDefined();
expect(screen.queryByTestId("step-subscription")).toBeNull();
});
@@ -175,14 +325,14 @@ describe("OnboardingPage — flag-gated SubscriptionStep", () => {
mockFlagValue = false;
currentSearchParams = new URLSearchParams("step=5");
render(<OnboardingPage />);
- expect(await screen.findByTestId("step-welcome")).toBeDefined();
+ expect(await screen.findByTestId("step-role")).toBeDefined();
expect(screen.queryByTestId("step-preparing")).toBeNull();
});
- it("treats step 4 as Preparing when payments are gated off", async () => {
+ it("treats step 3 as Preparing when payments are gated off", async () => {
mockFlagValue = false;
- window.sessionStorage.setItem(STEP_STORAGE_KEY, "4");
- currentSearchParams = new URLSearchParams("step=4");
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
+ currentSearchParams = new URLSearchParams("step=3");
render(<OnboardingPage />);
expect(await screen.findByTestId("step-preparing")).toBeDefined();
expect(screen.queryByTestId("step-subscription")).toBeNull();
@@ -193,64 +343,65 @@ describe("OnboardingPage — flag-gated SubscriptionStep", () => {
currentSearchParams = new URLSearchParams("step=1");
render(<OnboardingPage />);
expect(await screen.findByTestId("step-subscription")).toBeDefined();
- expect(screen.queryByTestId("step-welcome")).toBeNull();
+ expect(screen.queryByTestId("step-role")).toBeNull();
expect(screen.queryByTestId("step-preparing")).toBeNull();
});
- it("renders Welcome at step 2 (after the paywall) when payments are enabled", async () => {
+ it("renders Role at step 2 when payments are enabled — after the paywall", async () => {
mockFlagValue = true;
window.sessionStorage.setItem(STEP_STORAGE_KEY, "2");
currentSearchParams = new URLSearchParams("step=2");
render(<OnboardingPage />);
- expect(await screen.findByTestId("step-welcome")).toBeDefined();
+ expect(await screen.findByTestId("step-role")).toBeDefined();
expect(screen.queryByTestId("step-subscription")).toBeNull();
+ expect(screen.queryByTestId("step-preparing")).toBeNull();
});
- it("treats step 5 as Preparing when payments are enabled", async () => {
+ it("treats step 4 as Preparing when payments are enabled", async () => {
mockFlagValue = true;
- window.sessionStorage.setItem(STEP_STORAGE_KEY, "5");
- currentSearchParams = new URLSearchParams("step=5");
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "4");
+ currentSearchParams = new URLSearchParams("step=4");
render(<OnboardingPage />);
expect(await screen.findByTestId("step-preparing")).toBeDefined();
expect(screen.queryByTestId("step-subscription")).toBeNull();
});
- it("clamps ?step=5 to the user's highest reached step (no fast-forward)", async () => {
+ it("clamps ?step=4 to the user's highest reached step (no fast-forward)", async () => {
mockFlagValue = true;
window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
- currentSearchParams = new URLSearchParams("step=5");
+ currentSearchParams = new URLSearchParams("step=4");
render(<OnboardingPage />);
- // Highest reached is 3 (RoleStep), so manually editing the URL to step=5
- // should land the user back on step 3, not let them skip ahead.
- expect(await screen.findByTestId("step-role")).toBeDefined();
+ // Highest reached is 3 (pain points), so manually editing the URL to
+ // step=4 should land the user back on step 3, not let them skip ahead.
+ expect(await screen.findByTestId("step-painpoints")).toBeDefined();
expect(screen.queryByTestId("step-preparing")).toBeNull();
});
it("resumes from the highest reached step when ?step= is omitted", async () => {
mockFlagValue = true;
- window.sessionStorage.setItem(STEP_STORAGE_KEY, "4");
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
// No step param — user navigated to /onboarding directly.
render(<OnboardingPage />);
expect(await screen.findByTestId("step-painpoints")).toBeDefined();
- expect(screen.queryByTestId("step-subscription")).toBeNull();
+ expect(screen.queryByTestId("step-preparing")).toBeNull();
});
- it("rejects decimal step values and falls back to step 1 (the paywall)", async () => {
+ it("rejects decimal step values and falls back to step 1 (paywall)", async () => {
mockFlagValue = true;
currentSearchParams = new URLSearchParams("step=2.5");
render(<OnboardingPage />);
expect(await screen.findByTestId("step-subscription")).toBeDefined();
- expect(screen.queryByTestId("step-welcome")).toBeNull();
+ expect(screen.queryByTestId("step-role")).toBeNull();
});
- it("rejects non-numeric step values and falls back to step 1 (the paywall)", async () => {
+ it("rejects non-numeric step values and falls back to step 1 (paywall)", async () => {
mockFlagValue = true;
currentSearchParams = new URLSearchParams("step=foo");
render(<OnboardingPage />);
expect(await screen.findByTestId("step-subscription")).toBeDefined();
});
- it("lets ?step=2&subscription=success land on Welcome past the paywall", async () => {
+ it("lets ?step=2&subscription=success land on Role past the paywall", async () => {
// Simulates returning from a successful Stripe checkout. The highest
// reached step before the redirect was 1 (the paywall). Without the
// success-bypass, ceiling=min(1,2)=1 would clamp the user back onto the
@@ -259,10 +410,19 @@ describe("OnboardingPage — flag-gated SubscriptionStep", () => {
window.sessionStorage.setItem(STEP_STORAGE_KEY, "1");
currentSearchParams = new URLSearchParams("step=2&subscription=success");
render(<OnboardingPage />);
- expect(await screen.findByTestId("step-welcome")).toBeDefined();
+ expect(await screen.findByTestId("step-role")).toBeDefined();
expect(screen.queryByTestId("step-subscription")).toBeNull();
});
+ it("does not let a subscription=success return skip past the step after the paywall", async () => {
+ mockFlagValue = true;
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "1");
+ currentSearchParams = new URLSearchParams("step=4&subscription=success");
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-role")).toBeDefined();
+ expect(screen.queryByTestId("step-preparing")).toBeNull();
+ });
+
it("returns to SubscriptionStep on ?step=1&subscription=cancelled", async () => {
mockFlagValue = true;
window.sessionStorage.setItem(STEP_STORAGE_KEY, "1");
@@ -276,24 +436,24 @@ describe("OnboardingPage — flag-gated SubscriptionStep", () => {
// Regression for paying users (admin-granted Pro, or accounts that
// pre-date ONBOARDING_COMPLETE) being kicked through onboarding and asked to
// pay again to escape. With ENABLE_PLATFORM_PAYMENT on and tier=PRO,
- // step 4 must render Preparing — not SubscriptionStep.
+ // step 3 must render Preparing — not SubscriptionStep.
mockFlagValue = true;
mockSubscriptionTier = "PRO";
- window.sessionStorage.setItem(STEP_STORAGE_KEY, "4");
- currentSearchParams = new URLSearchParams("step=4");
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
+ currentSearchParams = new URLSearchParams("step=3");
render(<OnboardingPage />);
expect(await screen.findByTestId("step-preparing")).toBeDefined();
expect(screen.queryByTestId("step-subscription")).toBeNull();
});
- it("clamps ?step=5 to preparingStep=4 for paid users", async () => {
- // For paid users the wizard is 3-step (preparingStep=4). A URL pointing
- // at the old 5-step preparingStep must clamp down to 4, not strand the
- // user above the ceiling.
+ it("clamps ?step=4 to preparingStep=3 for paid users", async () => {
+ // For paid users the wizard is 2-step (preparingStep=3). A URL pointing
+ // at the paywall layout's preparingStep must clamp down to 3, not strand
+ // the user above the ceiling.
mockFlagValue = true;
mockSubscriptionTier = "MAX";
- window.sessionStorage.setItem(STEP_STORAGE_KEY, "5");
- currentSearchParams = new URLSearchParams("step=5");
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "4");
+ currentSearchParams = new URLSearchParams("step=4");
render(<OnboardingPage />);
expect(await screen.findByTestId("step-preparing")).toBeDefined();
expect(screen.queryByTestId("step-subscription")).toBeNull();
@@ -305,7 +465,7 @@ describe("OnboardingPage — flag-gated SubscriptionStep", () => {
currentSearchParams = new URLSearchParams("step=1");
render(<OnboardingPage />);
expect(await screen.findByTestId("step-subscription")).toBeDefined();
- expect(screen.queryByTestId("step-preparing")).toBeNull();
+ expect(screen.queryByTestId("step-role")).toBeNull();
});
it("waits for auth before initialising (no premature step lock)", async () => {
@@ -330,35 +490,40 @@ describe("OnboardingPage — flag-gated SubscriptionStep", () => {
expect(useOnboardingWizardStore.getState().currentStep).toBe(1);
});
- it("saves the onboarding name to auth metadata on Preparing-step submit", async () => {
- // Regression for OPEN-3200: the "what should I call you?" answer was
- // only sent to the business-understanding store, so the copilot
- // greeting (which reads auth user_metadata) never used it.
+ it("submits the profile under the account's name on reaching Preparing", async () => {
+ // The wizard no longer asks for a name, so the profile carries what the
+ // account already knows.
mockFlagValue = false;
- window.sessionStorage.setItem(STEP_STORAGE_KEY, "4");
+ mockUser = {
+ id: "u1",
+ email: "[email protected]",
+ user_metadata: { name: "Reinier Bot" },
+ };
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
useOnboardingWizardStore.setState({
- name: " Reinier ",
role: "Engineering",
- painPoints: [],
+ painPoints: ["slow builds"],
});
- currentSearchParams = new URLSearchParams("step=4");
+ currentSearchParams = new URLSearchParams("step=3");
render(<OnboardingPage />);
expect(await screen.findByTestId("step-preparing")).toBeDefined();
await waitFor(() => {
- expect(authUserPutBodies).toEqual([{ preferred_name: "Reinier" }]);
- });
- await waitFor(() => {
- expect(mockRefreshSession).toHaveBeenCalled();
+ expect(submitOnboardingProfile).toHaveBeenCalledWith({
+ user_name: "Reinier",
+ user_role: "Engineering",
+ pain_points: ["slow builds"],
+ });
});
});
- it("does not touch auth metadata when the wizard has no name", async () => {
+ it("does not submit a profile when no role was chosen", async () => {
mockFlagValue = false;
- window.sessionStorage.setItem(STEP_STORAGE_KEY, "4");
- currentSearchParams = new URLSearchParams("step=4");
+ mockUser = { id: "u1", email: "[email protected]", user_metadata: {} };
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
+ currentSearchParams = new URLSearchParams("step=3");
render(<OnboardingPage />);
expect(await screen.findByTestId("step-preparing")).toBeDefined();
- expect(authUserPutBodies).toEqual([]);
+ expect(submitOnboardingProfile).not.toHaveBeenCalled();
});
it("redirects straight to /copilot when onboarding is already complete", async () => {
@@ -369,14 +534,14 @@ describe("OnboardingPage — flag-gated SubscriptionStep", () => {
expect(routerReplace).toHaveBeenCalledWith("/copilot");
});
// The wizard never renders and the resume ceiling is cleared.
- expect(screen.queryByTestId("step-welcome")).toBeNull();
+ expect(screen.queryByTestId("step-role")).toBeNull();
expect(window.sessionStorage.getItem(STEP_STORAGE_KEY)).toBeNull();
});
it("marks ONBOARDING_COMPLETE and redirects when Preparing finishes", async () => {
mockFlagValue = false;
- window.sessionStorage.setItem(STEP_STORAGE_KEY, "4");
- currentSearchParams = new URLSearchParams("step=4");
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
+ currentSearchParams = new URLSearchParams("step=3");
render(<OnboardingPage />);
fireEvent.click(await screen.findByTestId("step-preparing"));
await waitFor(() => {
@@ -396,8 +561,8 @@ describe("OnboardingPage — flag-gated SubscriptionStep", () => {
);
const gtagCalls = installGtagShim();
mockFlagValue = false;
- window.sessionStorage.setItem(STEP_STORAGE_KEY, "4");
- currentSearchParams = new URLSearchParams("step=4");
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
+ currentSearchParams = new URLSearchParams("step=3");
render(<OnboardingPage />);
fireEvent.click(await screen.findByTestId("step-preparing"));
await waitFor(() => {
@@ -422,8 +587,8 @@ describe("OnboardingPage — flag-gated SubscriptionStep", () => {
// backend never recorded the milestone, so nothing converted.
completeOnboardingStep.mockRejectedValue(new Error("500"));
mockFlagValue = false;
- window.sessionStorage.setItem(STEP_STORAGE_KEY, "4");
- currentSearchParams = new URLSearchParams("step=4");
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
+ currentSearchParams = new URLSearchParams("step=3");
render(<OnboardingPage />);
fireEvent.click(await screen.findByTestId("step-preparing"));
await waitFor(
@@ -439,56 +604,63 @@ describe("OnboardingPage — flag-gated SubscriptionStep", () => {
it("preserves form data on mount (zustand persist; no reset-on-init)", async () => {
// Regression test for the 422 caused by init's old `reset()` wiping
- // name/role on every mount. With zustand persist, refreshing mid-wizard
- // must preserve what the user already typed.
+ // the role on every mount. With zustand persist, refreshing mid-wizard
+ // must preserve what the user already chose.
mockFlagValue = true;
- window.sessionStorage.setItem(STEP_STORAGE_KEY, "4");
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
useOnboardingWizardStore.setState({
- name: "Alice",
role: "Engineering",
painPoints: ["slow builds"],
});
- currentSearchParams = new URLSearchParams("step=4");
+ currentSearchParams = new URLSearchParams("step=3");
render(<OnboardingPage />);
expect(await screen.findByTestId("step-painpoints")).toBeDefined();
const state = useOnboardingWizardStore.getState();
- expect(state.name).toBe("Alice");
expect(state.role).toBe("Engineering");
expect(state.painPoints).toEqual(["slow builds"]);
});
});
-describe("OnboardingPage — self-host leads with the connection", () => {
- it("renders ConnectStep first on a self-host install", async () => {
- // A fresh self-host install cannot answer a single message until it has
- // a model, so asking for one comes before personalising the chat.
+describe("OnboardingPage — self-host closes with the connection", () => {
+ it("renders Role first on a self-host install", async () => {
mockIsLocal = true;
currentSearchParams = new URLSearchParams("step=1");
render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-role")).toBeDefined();
+ expect(screen.queryByTestId("step-connect")).toBeNull();
+ });
+
+ it("puts ConnectStep last (step 3), after the profile", async () => {
+ mockIsLocal = true;
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
+ currentSearchParams = new URLSearchParams("step=3");
+ render(<OnboardingPage />);
expect(await screen.findByTestId("step-connect")).toBeDefined();
- expect(screen.queryByTestId("step-welcome")).toBeNull();
+ expect(screen.queryByTestId("step-painpoints")).toBeNull();
+ expect(screen.queryByTestId("step-preparing")).toBeNull();
});
- it("puts Welcome after it, the way the paywall does on cloud", async () => {
+ it("treats step 4 as Preparing on self-host", async () => {
mockIsLocal = true;
- window.sessionStorage.setItem(STEP_STORAGE_KEY, "2");
- currentSearchParams = new URLSearchParams("step=2");
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "4");
+ currentSearchParams = new URLSearchParams("step=4");
render(<OnboardingPage />);
- expect(await screen.findByTestId("step-welcome")).toBeDefined();
+ expect(await screen.findByTestId("step-preparing")).toBeDefined();
expect(screen.queryByTestId("step-connect")).toBeNull();
});
it("does not insert it on cloud", async () => {
mockIsLocal = false;
- currentSearchParams = new URLSearchParams("step=1");
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
+ currentSearchParams = new URLSearchParams("step=3");
render(<OnboardingPage />);
- expect(await screen.findByTestId("step-welcome")).toBeDefined();
+ expect(await screen.findByTestId("step-preparing")).toBeDefined();
expect(screen.queryByTestId("step-connect")).toBeNull();
});
- it("yields to the paywall rather than showing both first steps", async () => {
+ it("yields to the paywall rather than showing both model steps", async () => {
// Payments and self-host are mutually exclusive in practice; if a
- // deployment ever had both, only one step can be first.
+ // deployment ever had both, only one step can take the slot.
mockIsLocal = true;
mockFlagValue = true;
currentSearchParams = new URLSearchParams("step=1");
@@ -497,3 +669,84 @@ describe("OnboardingPage — self-host leads with the connection", () => {
expect(screen.queryByTestId("step-connect")).toBeNull();
});
});
+
+it("never offers Back into the paywall, with or without the intro", async () => {
+ mockFlagValue = true;
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "2");
+ currentSearchParams = new URLSearchParams("step=2");
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-role")).toBeDefined();
+ expect(screen.queryByRole("button", { name: "Back" })).toBeNull();
+ act(() => useOnboardingWizardStore.getState().nextStep());
+ expect(await screen.findByTestId("step-painpoints")).toBeDefined();
+ fireEvent.click(screen.getByRole("button", { name: "Back" }));
+ expect(await screen.findByTestId("step-role")).toBeDefined();
+ expect(screen.queryByRole("button", { name: "Back" })).toBeNull();
+});
+
+it("hides Back on the first intro after the paywall", async () => {
+ mockFlagValue = true;
+ mockExpertTeamEnabled = true;
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "2");
+ currentSearchParams = new URLSearchParams("step=2");
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-team")).toBeDefined();
+ expect(screen.queryByRole("button", { name: "Back" })).toBeNull();
+});
+
+it("skips both intro and hire when hiring is disabled independently of the team flag", async () => {
+ mockExpertTeamEnabled = true;
+ mockHireExpertsEnabled = false;
+ mockBrainDumpEnabled = true;
+ render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-role")).toBeDefined();
+ expect(screen.queryByTestId("step-team")).toBeNull();
+ act(() => useOnboardingWizardStore.getState().nextStep());
+ expect(await screen.findByTestId("step-braindump")).toBeDefined();
+ act(() => useOnboardingWizardStore.getState().nextStep());
+ expect(await screen.findByTestId("step-preparing")).toBeDefined();
+ expect(screen.queryByTestId("step-hire")).toBeNull();
+});
+
+it("submits the profile once if account data arrives after Preparing", async () => {
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, "3");
+ currentSearchParams = new URLSearchParams("step=3");
+ useOnboardingWizardStore.setState({
+ role: "Engineering",
+ painPoints: ["slow builds"],
+ });
+ const { rerender } = render(<OnboardingPage />);
+ expect(await screen.findByTestId("step-preparing")).toBeDefined();
+ expect(submitOnboardingProfile).not.toHaveBeenCalled();
+ mockUser = {
+ id: "u1",
+ email: "[email protected]",
+ user_metadata: { name: "Reinier Bot" },
+ };
+ rerender(<OnboardingPage />);
+ await waitFor(() =>
+ expect(submitOnboardingProfile).toHaveBeenCalledWith({
+ user_name: "Reinier",
+ user_role: "Engineering",
+ pain_points: ["slow builds"],
+ }),
+ );
+ mockUser = { ...mockUser };
+ rerender(<OnboardingPage />);
+ expect(submitOnboardingProfile).toHaveBeenCalledTimes(1);
+});
+
+it.each([1, 2])(
+ "preserves reached step %s on a checkout return when payment is disabled",
+ async (highest) => {
+ window.sessionStorage.setItem(STEP_STORAGE_KEY, String(highest));
+ currentSearchParams = new URLSearchParams("step=4&subscription=success");
+ render(<OnboardingPage />);
+ expect(
+ await screen.findByTestId(
+ highest === 1 ? "step-role" : "step-painpoints",
+ ),
+ ).toBeDefined();
+ expect(screen.queryByTestId("step-preparing")).toBeNull();
+ },
+);
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/store.test.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/store.test.ts
index 0a303d4daa..fcdc22c453 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/store.test.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/store.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect, beforeEach } from "vitest";
-import { useOnboardingWizardStore } from "../store";
+import { buildStepLayout, useOnboardingWizardStore } from "../store";
beforeEach(() => {
useOnboardingWizardStore.getState().reset();
@@ -10,7 +10,6 @@ describe("useOnboardingWizardStore", () => {
it("starts at step 1 with empty fields", () => {
const state = useOnboardingWizardStore.getState();
expect(state.currentStep).toBe(1);
- expect(state.name).toBe("");
expect(state.role).toBe("");
expect(state.otherRole).toBe("");
expect(state.painPoints).toEqual([]);
@@ -55,13 +54,6 @@ describe("useOnboardingWizardStore", () => {
});
});
- describe("setName", () => {
- it("updates the name", () => {
- useOnboardingWizardStore.getState().setName("Alice");
- expect(useOnboardingWizardStore.getState().name).toBe("Alice");
- });
- });
-
describe("setRole", () => {
it("updates the role", () => {
useOnboardingWizardStore.getState().setRole("Engineer");
@@ -143,10 +135,10 @@ describe("useOnboardingWizardStore", () => {
expect(useOnboardingWizardStore.getState().currentStep).toBe(2);
});
- it("clamps at step 5", () => {
- useOnboardingWizardStore.getState().goToStep(5);
+ it("clamps at the last step", () => {
+ useOnboardingWizardStore.getState().goToStep(7);
useOnboardingWizardStore.getState().nextStep();
- expect(useOnboardingWizardStore.getState().currentStep).toBe(5);
+ expect(useOnboardingWizardStore.getState().currentStep).toBe(7);
});
});
@@ -170,24 +162,75 @@ describe("useOnboardingWizardStore", () => {
});
});
+ describe("markHired", () => {
+ it("records each hired template once", () => {
+ useOnboardingWizardStore.getState().markHired("tpl-maria");
+ useOnboardingWizardStore.getState().markHired("tpl-maria");
+ useOnboardingWizardStore.getState().markHired("tpl-max");
+ expect(useOnboardingWizardStore.getState().hiredTemplateIds).toEqual([
+ "tpl-maria",
+ "tpl-max",
+ ]);
+ });
+ });
+
describe("reset", () => {
it("resets all fields to defaults", () => {
- useOnboardingWizardStore.getState().setName("Alice");
useOnboardingWizardStore.getState().setRole("Engineer");
useOnboardingWizardStore.getState().setOtherRole("Other");
useOnboardingWizardStore.getState().togglePainPoint("slow builds");
useOnboardingWizardStore.getState().setOtherPainPoint("flaky CI");
+ useOnboardingWizardStore.getState().markHired("tpl-maria");
useOnboardingWizardStore.getState().goToStep(3);
useOnboardingWizardStore.getState().reset();
const state = useOnboardingWizardStore.getState();
expect(state.currentStep).toBe(1);
- expect(state.name).toBe("");
expect(state.role).toBe("");
expect(state.otherRole).toBe("");
expect(state.painPoints).toEqual([]);
expect(state.otherPainPoint).toBe("");
+ expect(state.hiredTemplateIds).toEqual([]);
+ });
+ });
+});
+
+describe("buildStepLayout", () => {
+ it("leads with the paywall and slots the hire step after the brain dump", () => {
+ expect(
+ buildStepLayout({ hasIntro: true, hasHire: true, hasPaywall: true }),
+ ).toEqual({
+ subscription: 1,
+ team: 2,
+ autopilot: 3,
+ role: 4,
+ painPoints: 5,
+ hire: 6,
+ preparing: 7,
+ });
+ });
+
+ it("leaves the hire step out when it is off", () => {
+ expect(buildStepLayout({ hasIntro: true, hasPaywall: true })).toEqual({
+ subscription: 1,
+ team: 2,
+ autopilot: 3,
+ role: 4,
+ painPoints: 5,
+ preparing: 6,
+ });
+ });
+
+ it("closes with the connection on self-host, never beside a paywall", () => {
+ expect(buildStepLayout({ hasConnect: true })).toEqual({
+ role: 1,
+ painPoints: 2,
+ connect: 3,
+ preparing: 4,
});
+ expect(
+ buildStepLayout({ hasPaywall: true, hasConnect: true }).connect,
+ ).toBeUndefined();
});
});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/tracking.test.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/tracking.test.ts
index 5cb887537f..e0706107e7 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/tracking.test.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/tracking.test.ts
@@ -8,19 +8,23 @@ vi.mock("@/services/analytics", () => ({
analytics: { sendDatafastEvent },
}));
-import { NO_PAYWALL_STEPS, PAYWALL_FIRST_STEPS } from "../store";
+import {
+ buildStepLayout,
+ NO_PAYWALL_STEPS,
+ PAYWALL_FIRST_STEPS,
+} from "../store";
import { onboardingStepKey, trackOnboardingStep } from "../tracking";
describe("onboardingStepKey", () => {
- // Welcome is step 2 with the paywall first and step 1 without it, so the
+ // Pain points is step 3 with the paywall and step 2 without it, so the
// number alone can't identify a step across cohorts.
it("maps the same key across both step layouts", () => {
expect(
- onboardingStepKey(PAYWALL_FIRST_STEPS, PAYWALL_FIRST_STEPS.welcome),
- ).toBe("welcome");
- expect(onboardingStepKey(NO_PAYWALL_STEPS, NO_PAYWALL_STEPS.welcome)).toBe(
- "welcome",
- );
+ onboardingStepKey(PAYWALL_FIRST_STEPS, PAYWALL_FIRST_STEPS.painPoints),
+ ).toBe("pain_points");
+ expect(
+ onboardingStepKey(NO_PAYWALL_STEPS, NO_PAYWALL_STEPS.painPoints),
+ ).toBe("pain_points");
expect(
onboardingStepKey(PAYWALL_FIRST_STEPS, PAYWALL_FIRST_STEPS.preparing),
).toBe("preparing");
@@ -29,6 +33,25 @@ describe("onboardingStepKey", () => {
).toBe("preparing");
});
+ it("names the intro steps when the layout has them", () => {
+ const steps = buildStepLayout({ hasIntro: true, hasPaywall: true });
+ expect(onboardingStepKey(steps, 1)).toBeNull();
+ expect(onboardingStepKey(steps, 2)).toBe("team");
+ expect(onboardingStepKey(steps, 3)).toBe("autopilot");
+ expect(onboardingStepKey(steps, 4)).toBe("role");
+ expect(onboardingStepKey(steps, 6)).toBe("preparing");
+ });
+
+ it("names the hire step when the layout has it", () => {
+ const steps = buildStepLayout({
+ hasIntro: true,
+ hasHire: true,
+ hasPaywall: true,
+ });
+ expect(onboardingStepKey(steps, 6)).toBe("hire");
+ expect(onboardingStepKey(steps, 7)).toBe("preparing");
+ });
+
// The paywall reports itself as `paywall_view`; reporting it again here would
// double-count the top of the funnel.
it("returns null for the subscription step", () => {
@@ -46,14 +69,10 @@ describe("trackOnboardingStep", () => {
});
it("reports one goal per step name", () => {
- trackOnboardingStep("welcome");
+ trackOnboardingStep("role");
trackOnboardingStep("pain_points");
- expect(sendDatafastEvent).toHaveBeenNthCalledWith(
- 1,
- "onboarding_welcome",
- {},
- );
+ expect(sendDatafastEvent).toHaveBeenNthCalledWith(1, "onboarding_role", {});
expect(sendDatafastEvent).toHaveBeenNthCalledWith(
2,
"onboarding_pain_points",
@@ -80,7 +99,7 @@ describe("trackOnboardingStep", () => {
throw new Error("storage blocked");
});
- trackOnboardingStep("welcome");
+ trackOnboardingStep("role");
expect(sendDatafastEvent).toHaveBeenCalledTimes(1);
});
@@ -90,6 +109,25 @@ describe("trackOnboardingStep", () => {
throw new Error("datafast unavailable");
});
- expect(() => trackOnboardingStep("welcome")).not.toThrow();
+ expect(() => trackOnboardingStep("role")).not.toThrow();
});
});
+
+it.each([false, true])(
+ "tracks the optional connection step once, with intro=%s",
+ (hasIntro) => {
+ sessionStorage.clear();
+ sendDatafastEvent.mockReset();
+ const steps = buildStepLayout({ hasIntro, hasConnect: true });
+ const key = onboardingStepKey(steps, steps.connect!);
+ expect(key).toBe("connect");
+ if (key) {
+ trackOnboardingStep(key);
+ trackOnboardingStep(key);
+ }
+ expect(sendDatafastEvent).toHaveBeenCalledExactlyOnceWith(
+ "onboarding_connect",
+ {},
+ );
+ },
+);
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/components/ProgressBar.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/components/ProgressBar.tsx
index 5239f97a2c..e2fa311f7c 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/components/ProgressBar.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/components/ProgressBar.tsx
@@ -11,9 +11,9 @@ export function ProgressBar({ currentStep, totalSteps }: Props) {
const percent = (currentStep / (totalSteps + 1)) * 100;
return (
- <div className="absolute left-0 top-0 h-[3px] w-full bg-neutral-200">
+ <div className="absolute left-0 top-0 h-0.5 w-full bg-zinc-100">
<div
- className="h-full bg-purple-400 transition-all duration-500 ease-out"
+ className="h-full bg-zinc-900 transition-all duration-500 ease-out"
style={{ width: `${percent}%` }}
/>
</div>
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/components/SelectableCard.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/components/SelectableCard.tsx
index b0db3453c1..1760a3317c 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/components/SelectableCard.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/components/SelectableCard.tsx
@@ -26,25 +26,19 @@ export function SelectableCard({
onClick={onClick}
aria-pressed={selected}
className={cn(
- "relative flex h-[9rem] w-[10.375rem] shrink-0 flex-col items-center justify-center gap-3 rounded-xl border-2 bg-white px-6 py-5 transition-all hover:shadow-sm md:shrink lg:gap-2 lg:px-10 lg:py-8",
+ "relative flex h-24 w-[10.375rem] shrink-0 flex-col items-center justify-center gap-2 rounded-lg border bg-white p-4 transition-colors hover:bg-zinc-50 md:shrink",
className,
- selected
- ? "border-purple-500 bg-purple-50 shadow-sm"
- : "border-transparent",
+ selected ? "border-zinc-400 bg-zinc-50" : "border-zinc-100",
)}
>
{selected && (
- <span className="absolute right-2 top-2 flex h-5 w-5 items-center justify-center rounded-full bg-purple-500">
- <Icon icon={Tick02Icon} size={12} className="text-white" />
+ <span className="absolute right-2 top-2 flex size-4 items-center justify-center rounded-full bg-zinc-900">
+ <Icon icon={Tick02Icon} size={10} className="text-white" />
</span>
)}
- <Text
- variant="lead"
- as="span"
- className={selected ? "text-neutral-900" : "text-purple-600"}
- >
+ <span className="flex items-center justify-center text-zinc-500">
{icon}
- </Text>
+ </span>
<Text variant="body-medium" as="span" className="whitespace-nowrap">
{label}
</Text>
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/components/StepIndicator.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/components/StepIndicator.tsx
index 211f78222f..fde4c256f3 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/components/StepIndicator.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/components/StepIndicator.tsx
@@ -12,8 +12,8 @@ export function StepIndicator({ totalSteps, currentStep }: Props) {
<div
key={i}
className={cn(
- "h-2 rounded-full transition-all",
- i + 1 === currentStep ? "w-6 bg-foreground" : "w-2 bg-gray-300",
+ "h-1.5 rounded-full transition-all",
+ i + 1 === currentStep ? "w-4 bg-zinc-900" : "w-1.5 bg-zinc-300",
)}
/>
))}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/helpers.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/helpers.ts
index 59cb24e867..7cb2930ae6 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/helpers.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/helpers.ts
@@ -1,10 +1,9 @@
-// Shared resolution of the wizard's "Other" / "Something else" sentinels into
-// real values. Both `useSubscriptionStep` (pre-Stripe-redirect) and
-// `useOnboardingPage` (Preparing-step submit) post the profile, and label or
-// mapping changes must stay in sync across the two.
+import type { User } from "@/lib/auth/types";
+
+// Resolution of the wizard's "Other" / "Something else" sentinels into real
+// values for the Preparing-step profile submit.
interface ProfileSource {
- name: string;
role: string;
otherRole: string;
painPoints: string[];
@@ -12,11 +11,20 @@ interface ProfileSource {
}
interface NormalizedProfile {
- name: string;
role: string;
painPoints: string[];
}
+// The wizard no longer asks for a name; the profile carries whatever the
+// account already knows — the same precedence the copilot greeting uses.
+export function accountDisplayName(user: User | null | undefined): string {
+ const preferred = user?.user_metadata.preferred_name?.trim();
+ if (preferred) return preferred;
+ const name = user?.user_metadata.name?.trim();
+ if (name) return name.split(" ")[0];
+ return user?.email.split("@")[0] ?? "";
+}
+
export function normalizeOnboardingProfile(
state: ProfileSource,
): NormalizedProfile {
@@ -29,7 +37,6 @@ export function normalizeOnboardingProfile(
: [],
);
return {
- name: state.name,
role: resolvedRole,
painPoints: resolvedPainPoints,
};
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/page.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/page.tsx
index ad16cd9479..599d0206b5 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/page.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/page.tsx
@@ -1,5 +1,4 @@
"use client";
-import Link from "next/link";
import { ProgressBar } from "./components/ProgressBar";
import { StepIndicator } from "./components/StepIndicator";
import { BrainDumpStep } from "./steps/BrainDumpStep/BrainDumpStep";
@@ -8,15 +7,12 @@ import { PreparingStep } from "./steps/PreparingStep";
import { RoleStep } from "./steps/RoleStep";
import { ConnectStep } from "./steps/ConnectStep/ConnectStep";
import { SubscriptionStep } from "./steps/SubscriptionStep/SubscriptionStep";
-import { WelcomeStep } from "./steps/WelcomeStep";
-import {
- PAYWALL_FIRST_STEPS,
- SELF_HOST_STEPS,
- useOnboardingWizardStore,
-} from "./store";
+import { IntroStep } from "./steps/IntroStep/IntroStep";
+import { HireStep } from "./steps/HireStep/HireStep";
+import { useOnboardingWizardStore } from "./store";
import { useOnboardingPage } from "./useOnboardingPage";
import { ArrowLeft01Icon, Logout03Icon } from "@hugeicons/core-free-icons";
-import { Icon } from "@/components/atoms/Icon/Icon";
+import { Button } from "@/components/atoms/Button/Button";
import { Text } from "@/components/atoms/Text/Text";
import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
@@ -46,13 +42,13 @@ export default function OnboardingPage() {
// ProgressBar + StepIndicator track only the user-interactive steps.
// PreparingStep is a transition view that hides both indicators.
const showDots = currentStep <= totalSteps;
- // Back is hidden on Welcome (the first profile step): going back from there
- // when payments are on would return the user to the paywall they already
- // paid through and let them re-trigger checkout. Also hidden while the
- // current step is mid-flight (brain dump processing) — there is nothing
- // coherent to go back to.
+ // Back is hidden on the first content step (never back into the paywall)
+ // and while the current step is mid-flight (brain dump processing) — there
+ // is nothing coherent to go back to. Read from the layout so it tracks
+ // buildStepLayout rather than a hardcoded position.
+ const firstContentStep = steps.team ?? steps.role;
const showBack =
- currentStep > steps.welcome && currentStep <= totalSteps && !isStepBusy;
+ currentStep > firstContentStep && currentStep <= totalSteps && !isStepBusy;
const showProgressBar = currentStep <= totalSteps;
const showLogout = currentStep <= totalSteps;
@@ -70,27 +66,31 @@ export default function OnboardingPage() {
)}
{showBack && (
- <button
+ <Button
type="button"
+ variant="ghost"
+ size="xs"
onClick={prevStep}
- className="text-md absolute left-6 top-6 flex items-center gap-1 text-zinc-500 transition-colors duration-200 hover:text-zinc-900"
+ leadingIcon={ArrowLeft01Icon}
+ className="absolute left-6 top-6 text-zinc-500 hover:text-zinc-900"
>
- <Icon icon={ArrowLeft01Icon} size={16} />
Back
- </button>
+ </Button>
)}
- <div className="flex flex-1 items-center pb-8 pt-16">
- {isPaymentEnabled &&
- currentStep === PAYWALL_FIRST_STEPS.subscription && (
- <SubscriptionStep />
- )}
- {isSelfHostConnectEnabled &&
- currentStep === SELF_HOST_STEPS.connect && <ConnectStep />}
- {currentStep === steps.welcome && <WelcomeStep />}
+ <div className="flex w-full min-w-0 flex-1 items-center justify-center pb-8 pt-16">
+ {currentStep === steps.team && <IntroStep slide="team" />}
+ {currentStep === steps.autopilot && <IntroStep slide="autopilot" />}
{currentStep === steps.role && <RoleStep />}
{currentStep === steps.painPoints &&
(isBrainDumpEnabled ? <BrainDumpStep /> : <PainPointsStep />)}
+ {currentStep === steps.hire && <HireStep />}
+ {isSelfHostConnectEnabled && currentStep === steps.connect && (
+ <ConnectStep />
+ )}
+ {isPaymentEnabled && currentStep === steps.subscription && (
+ <SubscriptionStep />
+ )}
{currentStep === preparingStep && (
<PreparingStep
onComplete={handlePreparingComplete}
@@ -106,13 +106,16 @@ export default function OnboardingPage() {
)}
{showLogout && (
- <Link
+ <Button
+ as="NextLink"
href="/logout"
- className="text-md absolute bottom-6 left-6 flex items-center gap-1 text-zinc-500 transition-colors duration-200 hover:text-zinc-900"
+ variant="ghost"
+ size="xs"
+ leadingIcon={Logout03Icon}
+ className="absolute bottom-6 left-6 text-zinc-500 hover:text-zinc-900"
>
- <Icon icon={Logout03Icon} size={16} />
Log out
- </Link>
+ </Button>
)}
</div>
);
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/ConnectStep.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/ConnectStep.tsx
index d48063badb..de6cfe3493 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/ConnectStep.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/ConnectStep.tsx
@@ -1,100 +1,73 @@
"use client";
-import { LinkSquare01Icon } from "@hugeicons/core-free-icons";
-import Link from "next/link";
-
-import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";
import { Button } from "@/components/atoms/Button/Button";
import { FadeIn } from "@/components/atoms/FadeIn/FadeIn";
-import { Icon } from "@/components/atoms/Icon/Icon";
import { Text } from "@/components/atoms/Text/Text";
-
+import { BotAvatar } from "@/components/molecules/BotAvatar/BotAvatar";
+import { AUTOPILOT_AVATAR } from "@/components/molecules/BotAvatar/helpers";
+import { ProviderBox } from "./components/ProviderBox";
import { useConnectStep } from "./useConnectStep";
+// Subscriptions the experts could run on. Only ChatGPT has an adapter and
+// provider approval today; the rest are named so the user knows what is
+// coming, without claiming they work yet.
+const UPCOMING = [
+ { name: "Grok", logoSrc: "/integrations/xai.webp" },
+ { name: "GitHub Copilot", logoSrc: "/integrations/github.png" },
+];
+
/**
- * The first thing a self-host install asks for: a model to run on.
- *
- * A fresh install has no way to answer a single message until someone
- * configures a provider, and the honest shape of that ask is not "paste an
- * API key" — most people setting this up already pay for a subscription that
- * can do the work. So the zero-config path leads and API keys become the
- * advanced one.
+ * The last thing a self-host install asks for: a model to run on.
*
- * Deliberately skippable. A user who wants API keys, or who has already
- * configured them, should not have to link an account to get past a wizard.
+ * The zero-config path (link the ChatGPT plan you already pay for) leads;
+ * API keys are the advanced path and live in Settings. Deliberately
+ * skippable so a user with keys is not blocked by a wizard.
*/
export function ConnectStep() {
- const { connect, isConnecting, skip, isAlreadyLinked, models } =
- useConnectStep();
+ const { connect, isConnecting, skip, isAlreadyLinked } = useConnectStep();
return (
<FadeIn>
- <div className="flex w-full max-w-lg flex-col items-center gap-8 px-4">
- <div className="flex flex-col items-center gap-3 text-center">
- <AutoGPTLogo
- className="relative right-[3rem] h-24 w-[12rem]"
- hideText
+ <div className="flex w-full max-w-2xl flex-col items-center gap-8 px-4">
+ <div className="flex flex-col items-center gap-4 text-center">
+ <BotAvatar
+ config={AUTOPILOT_AVATAR}
+ status="idle"
+ size={120}
+ trackPointer
+ showBadge={false}
/>
- <Text variant="h3">Power your agents in one sign-in</Text>
- <Text variant="lead" as="span" className="!text-zinc-500">
- {isAlreadyLinked
- ? "Your ChatGPT plan is connected. Agents will run on it instead of spending AutoGPT credits."
- : "Connect the ChatGPT plan you already have and AutoGPT runs with no API keys and no billing setup."}
- {models && !isAlreadyLinked ? ` You get ${models}.` : ""}
+ <Text variant="h4" as="h1">
+ Already paying for an AI subscription?
+ </Text>
+ <Text variant="large" as="p" tone="muted" className="max-w-md">
+ Add it and your experts run on it. No API keys, no billing setup.
</Text>
</div>
- <div className="flex w-full flex-col items-center gap-4">
- {isAlreadyLinked ? (
- <Button variant="primary" size="large" onClick={skip}>
- Continue
- </Button>
- ) : (
- <Button
- variant="primary"
- size="large"
- onClick={connect}
- loading={isConnecting}
- rightIcon={<Icon icon={LinkSquare01Icon} size={18} />}
- >
- Sign in with ChatGPT
- </Button>
- )}
-
- {!isAlreadyLinked && (
- <>
- <Text
- variant="small"
- as="span"
- className="uppercase tracking-[0.08em] !text-zinc-400"
- >
- or configure manually
- </Text>
- <Button variant="secondary" size="large" onClick={skip}>
- Skip for now
- </Button>
- <Text variant="small" as="span" className="!text-zinc-400">
- You can add API keys in Settings &rarr; Integrations at any
- time.
- </Text>
- </>
- )}
+ <div
+ className="grid w-full grid-cols-1 gap-3 sm:grid-cols-3"
+ aria-label="Subscriptions"
+ >
+ <ProviderBox
+ name="ChatGPT"
+ logoSrc="/integrations/openai.png"
+ state={isAlreadyLinked ? "connected" : "available"}
+ isBusy={isConnecting}
+ onClick={connect}
+ />
+ {UPCOMING.map((provider) => (
+ <ProviderBox
+ key={provider.name}
+ {...provider}
+ state="coming-soon"
+ />
+ ))}
</div>
- {/* Named here rather than discovered later: someone arriving with a
- Claude subscription will look for it, and the answer is a policy
- they cannot change, not a missing feature. */}
- <Text variant="small" as="span" className="text-center !text-zinc-400">
- Claude subscriptions can&apos;t be linked — Anthropic blocks
- third-party subscription access. Anthropic models work via{" "}
- <Link
- href="/settings/integrations"
- className="underline underline-offset-2"
- >
- API key
- </Link>
- .
- </Text>
+ <Button size="small" onClick={skip} className="h-10 w-56 rounded-xl">
+ Next
+ </Button>
</div>
</FadeIn>
);
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/__tests__/ConnectStep.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/__tests__/ConnectStep.test.tsx
index 4f0b5b4153..4ce6c5ac67 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/__tests__/ConnectStep.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/__tests__/ConnectStep.test.tsx
@@ -1,3 +1,4 @@
+import { getGetV2ListChatConnectionsQueryKey } from "@/app/api/__generated__/endpoints/chat/chat";
import {
getGetV2ListChatConnectionsMockHandler200,
getGetV2ListProviderModelTiersMockHandler200,
@@ -5,7 +6,8 @@ import {
import type { AIConnectionOffer } from "@/app/api/__generated__/models/aIConnectionOffer";
import type { ProviderTiers } from "@/app/api/__generated__/models/providerTiers";
import { server } from "@/mocks/mock-server";
-import { render, screen } from "@/tests/integrations/test-utils";
+import { render, screen, waitFor } from "@/tests/integrations/test-utils";
+import { type QueryClient, useQueryClient } from "@tanstack/react-query";
import userEvent from "@testing-library/user-event";
import { beforeEach, describe, expect, it, vi } from "vitest";
@@ -14,10 +16,14 @@ import { ConnectStep } from "../ConnectStep";
import { hasLinkedSubscription, linkedModelsSentence } from "../helpers";
const connect = vi.fn();
+let onConnected: (() => void) | undefined;
vi.mock(
"@/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useOAuthConnect",
() => ({
- useOAuthConnect: () => ({ connect, isPending: false }),
+ useOAuthConnect: ({ onSuccess }: { onSuccess?: () => void }) => {
+ onConnected = onSuccess;
+ return { connect, isPending: false };
+ },
}),
);
@@ -88,72 +94,96 @@ function mockOffers(
);
}
+// Exposes the test QueryClient so a test can wait for a query to settle.
+let queryClient: QueryClient | null = null;
+function QueryClientProbe() {
+ queryClient = useQueryClient();
+ return null;
+}
+
describe("ConnectStep", () => {
beforeEach(() => {
connect.mockClear();
- useOnboardingWizardStore.setState({ currentStep: 1 });
+ useOnboardingWizardStore.setState({ currentStep: 3 });
});
- it("leads with the zero-config path", async () => {
+ it("offers ChatGPT as a box and names the rest as coming soon", async () => {
mockOffers([offer()]);
render(<ConnectStep />);
expect(
- await screen.findByRole("button", { name: /Sign in with ChatGPT/ }),
+ await screen.findByRole("button", { name: /ChatGPT/ }),
).toBeDefined();
- expect(screen.getByRole("button", { name: /Skip for now/ })).toBeDefined();
+ expect(screen.getByRole("button", { name: "Next" })).toBeDefined();
+ // Upcoming providers are shown, not clickable: each needs its own
+ // adapter and approval before it can become a real box.
+ expect(screen.getByText("Grok")).toBeDefined();
+ expect(screen.getByText("GitHub Copilot")).toBeDefined();
+ expect(screen.getAllByText("Coming soon")).toHaveLength(2);
+ expect(screen.queryByRole("button", { name: /Grok/ })).toBeNull();
});
- it("can be skipped, because API keys are a legitimate answer", async () => {
- // A wizard that cannot be passed without linking an account would make
- // the advanced path a dead end rather than an alternative. The control
- // is named for what it does -- it skips the step; it cannot add a key --
- // and the line beside it says where keys actually live.
+ it("starts the ChatGPT sign-in from its box", async () => {
mockOffers([offer()]);
render(<ConnectStep />);
await userEvent.click(
- await screen.findByRole("button", { name: /Skip for now/ }),
+ await screen.findByRole("button", { name: /ChatGPT/ }),
);
- expect(useOnboardingWizardStore.getState().currentStep).toBe(2);
- expect(connect).not.toHaveBeenCalled();
+ expect(connect).toHaveBeenCalledTimes(1);
});
- it("stops asking once a subscription is linked", async () => {
- mockOffers([offer(), chatgpt()]);
+ it("can be passed with Next, because API keys are a legitimate answer", async () => {
+ // A wizard that cannot be passed without linking an account would make
+ // the advanced path a dead end rather than an alternative. The control
+ // is named for what it does -- it skips the step; it cannot add a key --
+ // and the line beside it says where keys actually live.
+ mockOffers([offer()]);
render(<ConnectStep />);
+ await userEvent.click(await screen.findByRole("button", { name: "Next" }));
- expect(
- await screen.findByText(/Your ChatGPT plan is connected/),
- ).toBeDefined();
- expect(screen.queryByRole("button", { name: /Sign in with ChatGPT/ })).toBe(
- null,
- );
+ expect(useOnboardingWizardStore.getState().currentStep).toBe(4);
+ expect(connect).not.toHaveBeenCalled();
});
- it("says a Claude subscription cannot be linked, rather than leaving it to be discovered", async () => {
+ it("stays on the step after a successful sign-in and shows it linked", async () => {
mockOffers([offer()]);
- render(<ConnectStep />);
+ render(
+ <>
+ <QueryClientProbe />
+ <ConnectStep />
+ </>,
+ );
+ await screen.findByRole("button", { name: /ChatGPT/ });
+ // The click can only come after the page has settled: a refetch asked
+ // for while the first request is still in flight is folded into it.
+ await waitFor(() =>
+ expect(
+ queryClient?.getQueryState(getGetV2ListChatConnectionsQueryKey())
+ ?.fetchStatus,
+ ).toBe("idle"),
+ );
- expect(
- await screen.findByText(/Claude subscriptions can't be linked/),
- ).toBeDefined();
+ // The sign-in lands; the server now lists the ChatGPT connection.
+ mockOffers([offer(), chatgpt()]);
+ onConnected?.();
+
+ expect(await screen.findByText("Connected")).toBeDefined();
+ expect(useOnboardingWizardStore.getState().currentStep).toBe(3);
});
- it("names what you get, from the catalog", async () => {
- mockOffers([offer()], [chatgptTiers()]);
+ it("stops asking once a subscription is linked", async () => {
+ mockOffers([offer(), chatgpt()]);
render(<ConnectStep />);
- expect(
- await screen.findByText(
- /GPT-5\.6 Terra \(Balanced\) and GPT-5\.6 Sol \(Advanced\)/,
- ),
- ).toBeDefined();
+ expect(await screen.findByText("Connected")).toBeDefined();
+ expect(screen.queryByRole("button", { name: /ChatGPT/ })).toBeNull();
+ expect(screen.getByRole("button", { name: "Next" })).toBeDefined();
});
});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/components/ProviderBox.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/components/ProviderBox.tsx
new file mode 100644
index 0000000000..422bf13a86
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/components/ProviderBox.tsx
@@ -0,0 +1,104 @@
+"use client";
+
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { cn } from "@/lib/utils";
+import {
+ CheckmarkCircle02Icon,
+ Loading03Icon,
+} from "@hugeicons/core-free-icons";
+import Image from "next/image";
+
+interface Props {
+ name: string;
+ logoSrc: string;
+ state: "available" | "connected" | "coming-soon";
+ isBusy?: boolean;
+ onClick?: () => void;
+}
+
+const FRAME =
+ "flex w-full flex-col items-center gap-3 rounded-2xl border bg-white px-4 py-6 text-center";
+
+// One subscription the experts could run on. Available ones are a button
+// that starts the sign-in; connected and coming-soon ones just say so.
+export function ProviderBox({
+ name,
+ logoSrc,
+ state,
+ isBusy = false,
+ onClick,
+}: Props) {
+ const body = (
+ <>
+ <span className="relative flex h-12 w-12 items-center justify-center">
+ <Image
+ src={logoSrc}
+ alt=""
+ width={48}
+ height={48}
+ className={cn("rounded-xl", state === "coming-soon" && "opacity-50")}
+ />
+ {isBusy && (
+ <Icon
+ icon={Loading03Icon}
+ size={20}
+ className="absolute -bottom-1 -right-1 rounded-full bg-white text-zinc-500 motion-safe:animate-spin"
+ />
+ )}
+ </span>
+ <span className="flex flex-col items-center gap-1">
+ <Text
+ variant="body-medium"
+ as="span"
+ className={state === "coming-soon" ? "text-zinc-500" : "text-black"}
+ >
+ {name}
+ </Text>
+ {state === "connected" && (
+ <span className="inline-flex items-center gap-1 rounded-[10px] bg-emerald-50 px-2 py-[2px] text-[13px] font-medium leading-[20px] text-emerald-700">
+ <Icon icon={CheckmarkCircle02Icon} size={13} />
+ Connected
+ </span>
+ )}
+ {state === "coming-soon" && (
+ <span className="inline-flex items-center rounded-[10px] bg-zinc-100 px-2 py-[2px] text-[13px] font-medium leading-[20px] text-zinc-500">
+ Coming soon
+ </span>
+ )}
+ </span>
+ </>
+ );
+
+ if (state !== "available") {
+ return (
+ <div
+ className={cn(
+ FRAME,
+ state === "coming-soon"
+ ? "border-dashed border-zinc-200"
+ : "border-zinc-200",
+ )}
+ >
+ {body}
+ </div>
+ );
+ }
+
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ aria-busy={isBusy}
+ disabled={isBusy}
+ className={cn(
+ FRAME,
+ "border-zinc-200 transition-colors hover:border-zinc-300 hover:bg-zinc-50",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-purple-400",
+ isBusy && "cursor-progress",
+ )}
+ >
+ {body}
+ </button>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/useConnectStep.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/useConnectStep.ts
index 25009614f0..49ea37635a 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/useConnectStep.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/ConnectStep/useConnectStep.ts
@@ -1,16 +1,18 @@
"use client";
import {
+ getGetV2ListChatConnectionsQueryKey,
useGetV2ListChatConnections,
- useGetV2ListProviderModelTiers,
} from "@/app/api/__generated__/endpoints/chat/chat";
+import { useQueryClient } from "@tanstack/react-query";
import { useOAuthConnect } from "@/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useOAuthConnect";
import { useOnboardingWizardStore } from "../../store";
-import { hasLinkedSubscription, linkedModelsSentence } from "./helpers";
+import { hasLinkedSubscription } from "./helpers";
export function useConnectStep() {
const nextStep = useOnboardingWizardStore((s) => s.nextStep);
+ const queryClient = useQueryClient();
const connectionsQuery = useGetV2ListChatConnections({
query: { refetchOnWindowFocus: false },
@@ -20,19 +22,14 @@ export function useConnectStep() {
? connectionsQuery.data.data.offers
: undefined;
- // What ChatGPT's tiers resolve to, which the connections list cannot answer
- // for a connection the user has not made yet.
- const tiersQuery = useGetV2ListProviderModelTiers({
- query: { refetchOnWindowFocus: false },
- });
- const providers =
- tiersQuery.data?.status === 200
- ? tiersQuery.data.data.providers
- : undefined;
-
+ // A successful sign-in does not move the wizard on: the box turns to
+ // "Connected" and the user goes on with Next when they are ready.
const { connect, isPending } = useOAuthConnect({
provider: "codex",
- onSuccess: nextStep,
+ onSuccess: () =>
+ void queryClient.invalidateQueries({
+ queryKey: getGetV2ListChatConnectionsQueryKey(),
+ }),
});
return {
@@ -40,6 +37,5 @@ export function useConnectStep() {
isConnecting: isPending,
skip: nextStep,
isAlreadyLinked: hasLinkedSubscription(offers),
- models: linkedModelsSentence(providers),
};
}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/HireStep.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/HireStep.tsx
new file mode 100644
index 0000000000..69a8682a25
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/HireStep.tsx
@@ -0,0 +1,153 @@
+"use client";
+
+import { Button } from "@/components/atoms/Button/Button";
+import { FadeIn } from "@/components/atoms/FadeIn/FadeIn";
+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
+import { Text } from "@/components/atoms/Text/Text";
+import { BotAvatar } from "@/components/molecules/BotAvatar/BotAvatar";
+import { AUTOPILOT_AVATAR } from "@/components/molecules/BotAvatar/helpers";
+import { cn } from "@/lib/utils";
+import { useRef } from "react";
+import {
+ EXPERT_CARD_CLASS,
+ RecommendedExpertCard,
+} from "./components/RecommendedExpertCard";
+import { continueLabel, hireDiagnosis, hireTitle, raiseNote } from "./helpers";
+import { useHireStep } from "./useHireStep";
+import { useScrollEdges } from "./useScrollEdges";
+
+const SKELETON_CARDS = 3;
+// Three across at the container's max width, two on tablets, one on phones.
+const CARD_WIDTH_CLASS = "w-full sm:w-[calc(50%-0.375rem)] lg:w-72";
+const EDGE_FADE_CLASS =
+ "pointer-events-none absolute inset-x-0 z-10 h-16 from-gray-100 via-gray-100/70 to-transparent transition-opacity duration-200";
+
+// AutoPilot's first act as Head of AI: right after the brain dump, before the
+// user is asked to pay for anything, it proposes the experts that take the
+// problems it heard off the user's plate. Hiring here is one click per card;
+// the voice pick waits for the expert's own page.
+export function HireStep() {
+ const step = useHireStep();
+ const note = raiseNote(step.raiseRole);
+ const diagnosis = hireDiagnosis(step.team, step.isPending);
+ const isHiring = step.hiringTemplateId !== null;
+ const gridRef = useRef<HTMLDivElement>(null);
+ const { hiddenAbove, hiddenBelow } = useScrollEdges(gridRef);
+
+ return (
+ <FadeIn>
+ <div className="flex w-full flex-col items-center gap-8 px-4">
+ <div className="mx-auto flex w-full max-w-lg flex-col items-center gap-4 px-4 text-center">
+ <BotAvatar
+ config={AUTOPILOT_AVATAR}
+ status={step.isPending ? "working" : "idle"}
+ size={120}
+ trackPointer
+ showBadge={false}
+ />
+ <Text variant="h4" as="h1">
+ {hireTitle(step.team, step.isPending)}
+ </Text>
+ {diagnosis ? (
+ <Text
+ variant="body"
+ tone="muted"
+ className="max-w-lg text-center"
+ data-testid="hire-step-diagnosis"
+ >
+ {diagnosis}
+ </Text>
+ ) : null}
+ </div>
+
+ {/* The roster can run to sixteen cards: the row wraps and scrolls
+ inside a fixed height with no scrollbar, and a fade appears only on
+ the edge that actually has cards hidden behind it. Wrapping flex
+ rather than a grid so a short last row sits centered under the
+ full ones instead of hugging the left. */}
+ <div className="relative w-full max-w-4xl">
+ <div
+ aria-hidden
+ className={cn(
+ EDGE_FADE_CLASS,
+ "top-0 bg-gradient-to-b",
+ hiddenAbove ? "opacity-100" : "opacity-0",
+ )}
+ />
+ <div
+ aria-hidden
+ className={cn(
+ EDGE_FADE_CLASS,
+ "bottom-0 bg-gradient-to-t",
+ hiddenBelow ? "opacity-100" : "opacity-0",
+ )}
+ />
+ <div
+ ref={gridRef}
+ className="flex max-h-[26rem] w-full flex-wrap justify-center gap-3 overflow-y-auto scrollbar-none"
+ data-testid="hire-step-grid"
+ >
+ {step.isPending
+ ? Array.from({ length: SKELETON_CARDS }, (_, i) => (
+ <div
+ key={i}
+ className={cn(
+ EXPERT_CARD_CLASS,
+ CARD_WIDTH_CLASS,
+ "border-zinc-200",
+ )}
+ data-testid="hire-step-pending"
+ >
+ <div className="flex items-center gap-3">
+ <Skeleton className="size-10 rounded-full" />
+ <div className="flex flex-col gap-2">
+ <Skeleton className="h-3 w-24" />
+ <Skeleton className="h-3 w-16" />
+ </div>
+ </div>
+ <Skeleton className="h-3 w-56" />
+ <Skeleton className="h-7 w-14 rounded-full" />
+ </div>
+ ))
+ : step.experts.map((expert, index) => (
+ <div key={expert.template_id} className={CARD_WIDTH_CLASS}>
+ <RecommendedExpertCard
+ expert={expert}
+ isHired={step.hiredTemplateIds.includes(
+ expert.template_id,
+ )}
+ isHiringThis={
+ step.hiringTemplateId === expert.template_id
+ }
+ disabled={isHiring}
+ onHire={() => step.hire(expert, index)}
+ />
+ </div>
+ ))}
+ </div>
+ </div>
+
+ {note ? (
+ <Text
+ variant="small"
+ tone="muted"
+ className="max-w-lg text-center"
+ data-testid="hire-step-raise-note"
+ >
+ {note}
+ </Text>
+ ) : null}
+
+ <Button
+ type="button"
+ size="small"
+ onClick={step.handleContinue}
+ disabled={isHiring}
+ className="h-10 w-56 rounded-xl"
+ >
+ {continueLabel(step.hiredTemplateIds.length)}
+ </Button>
+ </div>
+ </FadeIn>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/__tests__/HireStep.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/__tests__/HireStep.test.tsx
new file mode 100644
index 0000000000..8b04ca46e6
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/__tests__/HireStep.test.tsx
@@ -0,0 +1,316 @@
+import { getGetBrainDumpRecommendedExpertsMockHandler200 } from "@/app/api/__generated__/endpoints/brain-dump/brain-dump.msw";
+import { getHireExpertMockHandler200 } from "@/app/api/__generated__/endpoints/experts/experts.msw";
+import type { ExpertRecommendations } from "@/app/api/__generated__/models/expertRecommendations";
+import { server } from "@/mocks/mock-server";
+import { render, screen, waitFor } from "@/tests/integrations/test-utils";
+import userEvent from "@testing-library/user-event";
+import { http, HttpResponse } from "msw";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { useOnboardingWizardStore } from "../../../store";
+import { HireStep } from "../HireStep";
+
+const { capture, toast } = vi.hoisted(() => ({
+ capture: vi.fn(),
+ toast: vi.fn(),
+}));
+vi.mock("posthog-js", () => ({ default: { capture } }));
+// Spread the real module: OnboardingProvider in test-utils calls useToast.
+vi.mock("@/components/molecules/Toast/use-toast", async (importOriginal) => ({
+ ...(await importOriginal<
+ typeof import("@/components/molecules/Toast/use-toast")
+ >()),
+ toast,
+}));
+
+const TEAM: ExpertRecommendations = {
+ diagnosis: "You have a marketing problem and a support problem.",
+ source: "llm",
+ experts: [
+ {
+ template_id: "tpl-maria",
+ name: "Maria",
+ role: "Marketing",
+ avatar_url: null,
+ reason: "Your LinkedIn posts eat a day a week.",
+ workflow_names: [
+ "Weekly LinkedIn post",
+ "Content calendar",
+ "Newsletter draft",
+ "Never shown",
+ ],
+ },
+ {
+ template_id: "tpl-max",
+ name: "Max",
+ role: "Sales",
+ avatar_url: null,
+ reason: "Cold outreach never gets sent.",
+ workflow_names: [],
+ },
+ ],
+ raise_suggestion: {
+ role: "support",
+ reason: "Nobody on the roster handles support tickets.",
+ },
+};
+
+const FALLBACK_TEAM: ExpertRecommendations = {
+ ...TEAM,
+ source: "fallback",
+ raise_suggestion: null,
+};
+
+const EMPTY_TEAM: ExpertRecommendations = {
+ diagnosis: "Hard to say what eats your week yet.",
+ source: "fallback",
+ experts: [],
+ raise_suggestion: null,
+};
+
+function mockTeam(team: ExpertRecommendations | null, ready = true) {
+ server.use(getGetBrainDumpRecommendedExpertsMockHandler200({ ready, team }));
+}
+
+beforeEach(() => {
+ capture.mockReset();
+ toast.mockReset();
+ useOnboardingWizardStore.getState().reset();
+ useOnboardingWizardStore.getState().goToStep(5);
+});
+
+describe("HireStep — the team", () => {
+ it("renders AutoPilot's read, a card per expert and a Hire button each", async () => {
+ mockTeam(TEAM);
+ render(<HireStep />);
+
+ expect(
+ await screen.findByText("Based on what you told me, here's who I'd hire"),
+ ).toBeDefined();
+ expect(screen.getAllByTestId("hire-step-expert")).toHaveLength(2);
+ expect(screen.getByText("Maria")).toBeDefined();
+ expect(
+ screen.getByText("Your LinkedIn posts eat a day a week."),
+ ).toBeDefined();
+ // The card is name, role and reason; workflow names stay off it.
+ expect(screen.queryByText("Weekly LinkedIn post")).toBeNull();
+ expect(screen.getAllByRole("button", { name: "Hire" })).toHaveLength(2);
+ expect(
+ screen.getByRole("button", { name: "I'll add members later" }),
+ ).toBeDefined();
+ });
+
+ it("says the team came from the wizard answers when the dump was not read", async () => {
+ mockTeam(FALLBACK_TEAM);
+ render(<HireStep />);
+
+ expect(
+ await screen.findByText("Based on your role, here's who I'd hire first"),
+ ).toBeDefined();
+ expect(screen.queryByTestId("hire-step-raise-note")).toBeNull();
+ });
+
+ it("reports every card it showed exactly once across polls", async () => {
+ mockTeam(TEAM);
+ render(<HireStep />);
+ await screen.findAllByTestId("hire-step-expert");
+
+ expect(capture).toHaveBeenCalledWith("expert_recommended", {
+ template_id: "tpl-maria",
+ position: 0,
+ source: "llm",
+ });
+ expect(
+ capture.mock.calls.filter(([event]) => event === "expert_recommended"),
+ ).toHaveLength(2);
+ });
+
+ it("names the gap the roster cannot fill without leaving the wizard", async () => {
+ mockTeam(TEAM);
+ render(<HireStep />);
+
+ expect(await screen.findByTestId("hire-step-raise-note")).toBeDefined();
+ expect(screen.queryByRole("link")).toBeNull();
+ });
+
+ it("still offers the way forward with no experts to hire", async () => {
+ mockTeam(EMPTY_TEAM);
+ render(<HireStep />);
+
+ expect(
+ await screen.findByText("Here's my read on your team"),
+ ).toBeDefined();
+ expect(screen.getByTestId("hire-step-diagnosis").textContent).toBe(
+ "Hard to say what eats your week yet.",
+ );
+ expect(screen.queryAllByTestId("hire-step-expert")).toHaveLength(0);
+ expect(
+ screen.getByRole("button", { name: "I'll add members later" }),
+ ).toBeDefined();
+ });
+});
+
+describe("HireStep — hiring", () => {
+ it("hires the clicked template, marks the card and remembers it in the store", async () => {
+ mockTeam(TEAM);
+ const hires: unknown[] = [];
+ server.use(
+ http.post("*/api/experts", async ({ request }) => {
+ hires.push(await request.json());
+ return HttpResponse.json({
+ expert: { id: "exp-1", name: "Maria" },
+ failed_preloads: [],
+ });
+ }),
+ );
+ render(<HireStep />);
+
+ await userEvent.click(
+ (await screen.findAllByRole("button", { name: "Hire" }))[0],
+ );
+
+ await waitFor(() => {
+ expect(screen.getByText("Hired")).toBeDefined();
+ });
+ expect(hires).toEqual([{ template_id: "tpl-maria" }]);
+ expect(useOnboardingWizardStore.getState().hiredTemplateIds).toEqual([
+ "tpl-maria",
+ ]);
+ // One hire down, one still open.
+ expect(screen.getAllByRole("button", { name: "Hire" })).toHaveLength(1);
+ expect(screen.getByRole("button", { name: "Next" })).toBeDefined();
+ expect(capture).toHaveBeenCalledWith("hire_started", {
+ template_id: "tpl-maria",
+ source: "onboarding_hire_step",
+ });
+ expect(capture).toHaveBeenCalledWith("onboarding_expert_hired", {
+ template_id: "tpl-maria",
+ position: 0,
+ });
+ });
+
+ it("shows templates hired on an earlier visit as hired", async () => {
+ mockTeam(TEAM);
+ useOnboardingWizardStore.getState().markHired("tpl-max");
+ render(<HireStep />);
+
+ await screen.findAllByTestId("hire-step-expert");
+ expect(screen.getByText("Hired")).toBeDefined();
+ expect(screen.getAllByRole("button", { name: "Hire" })).toHaveLength(1);
+ });
+
+ it("keeps the card open and says so when the hire fails", async () => {
+ mockTeam(TEAM);
+ server.use(
+ http.post("*/api/experts", () =>
+ HttpResponse.json({ detail: "nope" }, { status: 503 }),
+ ),
+ );
+ render(<HireStep />);
+
+ await userEvent.click(
+ (await screen.findAllByRole("button", { name: "Hire" }))[0],
+ );
+
+ await waitFor(() => {
+ expect(toast).toHaveBeenCalledWith(
+ expect.objectContaining({
+ title: "Couldn't hire Maria",
+ variant: "destructive",
+ }),
+ );
+ });
+ expect(screen.getAllByRole("button", { name: "Hire" })).toHaveLength(2);
+ expect(useOnboardingWizardStore.getState().hiredTemplateIds).toEqual([]);
+ });
+
+ it("advances the wizard and reports how many were hired", async () => {
+ mockTeam(TEAM);
+ server.use(getHireExpertMockHandler200());
+ render(<HireStep />);
+
+ await userEvent.click(
+ (await screen.findAllByRole("button", { name: "Hire" }))[0],
+ );
+ await screen.findByRole("button", { name: "Next" });
+ await userEvent.click(screen.getByRole("button", { name: "Next" }));
+
+ expect(useOnboardingWizardStore.getState().currentStep).toBe(6);
+ expect(capture).toHaveBeenCalledWith("hire_step_continued", {
+ hired: 1,
+ recommended: 2,
+ });
+ });
+});
+
+describe("HireStep — while the job is still running", () => {
+ it("shows skeleton cards and the way out, then the team when it lands", async () => {
+ let ready = false;
+ server.use(
+ http.get("*/api/onboarding/brain-dump/recommended-experts", () =>
+ HttpResponse.json(
+ ready ? { ready: true, team: TEAM } : { ready: false },
+ ),
+ ),
+ );
+ render(<HireStep />);
+
+ expect(await screen.findAllByTestId("hire-step-pending")).not.toHaveLength(
+ 0,
+ );
+ expect(screen.getByText("Thinking about who you'd need…")).toBeDefined();
+ expect(
+ screen.getByRole("button", { name: "I'll add members later" }),
+ ).toBeDefined();
+
+ ready = true;
+ expect(
+ await screen.findByText("Maria", {}, { timeout: 5_000 }),
+ ).toBeDefined();
+ expect(screen.queryAllByTestId("hire-step-pending")).toHaveLength(0);
+ });
+});
+
+it.each([408, 429, 503])(
+ "recovers team recommendations after a transient %s response",
+ async (status) => {
+ let calls = 0;
+ server.use(
+ http.get("*/api/onboarding/brain-dump/recommended-experts", () => {
+ calls += 1;
+ return calls === 1
+ ? HttpResponse.json({ detail: "try again" }, { status })
+ : HttpResponse.json({ ready: true, team: TEAM });
+ }),
+ );
+ render(<HireStep />);
+ await waitFor(() => expect(calls).toBe(1));
+ expect(screen.queryAllByTestId("hire-step-pending")).not.toHaveLength(0);
+ expect(
+ await screen.findByText("Maria", {}, { timeout: 5000 }),
+ ).toBeDefined();
+ expect(calls).toBe(2);
+ },
+);
+
+it("stops waiting after the deadline if transient errors persist", async () => {
+ let calls = 0;
+ server.use(
+ http.get("*/api/onboarding/brain-dump/recommended-experts", () => {
+ calls += 1;
+ return HttpResponse.json({ detail: "unavailable" }, { status: 503 });
+ }),
+ );
+ render(<HireStep />);
+ expect(
+ await screen.findByText(
+ "Nothing to hire yet — you can add members later",
+ {},
+ { timeout: 22000 },
+ ),
+ ).toBeDefined();
+ expect(screen.queryByTestId("hire-step-diagnosis")).toBeNull();
+ expect(calls).toBeGreaterThan(1);
+ const stoppedAt = calls;
+ await new Promise((resolve) => setTimeout(resolve, 3000));
+ expect(calls).toBe(stoppedAt);
+}, 26000);
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/components/RecommendedExpertCard.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/components/RecommendedExpertCard.tsx
new file mode 100644
index 0000000000..7c004f0a37
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/components/RecommendedExpertCard.tsx
@@ -0,0 +1,85 @@
+"use client";
+
+import type { RecommendedExpert } from "@/app/api/__generated__/models/recommendedExpert";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { ExpertAvatar } from "@/components/molecules/ExpertAvatar/ExpertAvatar";
+import { cn } from "@/lib/utils";
+import { Tick02Icon } from "@hugeicons/core-free-icons";
+
+interface Props {
+ expert: RecommendedExpert;
+ isHired: boolean;
+ isHiringThis: boolean;
+ disabled: boolean;
+ onHire: () => void;
+}
+
+export const EXPERT_CARD_CLASS =
+ "flex h-full flex-col gap-2 rounded-2xl border bg-white p-4 text-left transition-colors";
+
+export function RecommendedExpertCard({
+ expert,
+ isHired,
+ isHiringThis,
+ disabled,
+ onHire,
+}: Props) {
+ return (
+ <div
+ className={cn(
+ EXPERT_CARD_CLASS,
+ isHired ? "border-zinc-900" : "border-zinc-200",
+ )}
+ data-testid="hire-step-expert"
+ data-hired={isHired || undefined}
+ >
+ <div className="flex items-center gap-3">
+ <ExpertAvatar
+ name={expert.name}
+ avatarUrl={expert.avatar_url ?? null}
+ size={40}
+ />
+ <div className="min-w-0">
+ <Text variant="body-medium" tone="primary" className="truncate">
+ {expert.name}
+ </Text>
+ <Text variant="small" tone="muted" className="truncate">
+ {expert.role}
+ </Text>
+ </div>
+ </div>
+ {expert.reason ? (
+ <Text
+ variant="body"
+ tone="secondary"
+ className="line-clamp-2 text-pretty"
+ >
+ {expert.reason}
+ </Text>
+ ) : null}
+ {isHired ? (
+ <Text
+ variant="small"
+ as="span"
+ className="mt-auto inline-flex items-center gap-1 self-start pt-1 text-zinc-900"
+ >
+ <Icon icon={Tick02Icon} size={14} />
+ Hired
+ </Text>
+ ) : (
+ <Button
+ variant="primary"
+ size="xs"
+ className="mt-auto self-start rounded-full"
+ disabled={disabled}
+ loading={isHiringThis}
+ onClick={onHire}
+ >
+ Hire
+ </Button>
+ )}
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/helpers.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/helpers.ts
new file mode 100644
index 0000000000..299ce6d17b
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/helpers.ts
@@ -0,0 +1,47 @@
+import type { ExpertRecommendations } from "@/app/api/__generated__/models/expertRecommendations";
+
+export const HIRE_TITLE_LLM = "Based on what you told me, here's who I'd hire";
+export const HIRE_TITLE_FALLBACK =
+ "Based on your role, here's who I'd hire first";
+export const HIRE_TITLE_EMPTY = "Here's my read on your team";
+// No experts and no diagnosis to show: the title must not promise a read
+// that never renders.
+export const HIRE_TITLE_EMPTY_NO_READ =
+ "Nothing to hire yet — you can add members later";
+export const HIRE_TITLE_PENDING = "Thinking about who you'd need…";
+
+export const RECOMMENDATIONS_POLL_MS = 2_500;
+// A job the backend never finished (process restart mid-run) must not strand
+// the user on this step: past this ceiling the step shows what it has, or the
+// way out, rather than a skeleton forever.
+export const RECOMMENDATIONS_MAX_WAIT_MS = 20_000;
+
+export function hireTitle(
+ team: ExpertRecommendations | null,
+ isPending: boolean,
+): string {
+ if (isPending) return HIRE_TITLE_PENDING;
+ if ((team?.experts?.length ?? 0) === 0) {
+ return team?.diagnosis ? HIRE_TITLE_EMPTY : HIRE_TITLE_EMPTY_NO_READ;
+ }
+ return team?.source === "llm" ? HIRE_TITLE_LLM : HIRE_TITLE_FALLBACK;
+}
+
+// The diagnosis is the "read" the empty-state title promises; with cards on
+// screen the cards themselves are the read, so it stays out of the way.
+export function hireDiagnosis(
+ team: ExpertRecommendations | null,
+ isPending: boolean,
+): string | null {
+ if (isPending || (team?.experts?.length ?? 0) > 0) return null;
+ return team?.diagnosis?.trim() || null;
+}
+
+export function continueLabel(hiredCount: number): string {
+ return hiredCount > 0 ? "Next" : "I'll add members later";
+}
+
+export function raiseNote(role: string | null | undefined): string | null {
+ if (!role) return null;
+ return `Nobody on the roster covers ${role} yet — you can raise your own ${role} once you're set up.`;
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/useHireStep.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/useHireStep.ts
new file mode 100644
index 0000000000..7697761c53
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/useHireStep.ts
@@ -0,0 +1,126 @@
+import { useGetBrainDumpRecommendedExperts } from "@/app/api/__generated__/endpoints/brain-dump/brain-dump";
+import { useHireExpert } from "@/app/api/__generated__/endpoints/experts/experts";
+import type { ExpertRecommendations } from "@/app/api/__generated__/models/expertRecommendations";
+import type { RecommendedExpert } from "@/app/api/__generated__/models/recommendedExpert";
+import { toast } from "@/components/molecules/Toast/use-toast";
+import { invalidateExpertRosterQueries } from "@/services/experts/invalidate-experts";
+import { trackBrainDump } from "@/services/onboarding/brain-dump-analytics";
+import { useQueryClient } from "@tanstack/react-query";
+import { useEffect, useRef, useState } from "react";
+import { useOnboardingWizardStore } from "../../store";
+import {
+ RECOMMENDATIONS_MAX_WAIT_MS,
+ RECOMMENDATIONS_POLL_MS,
+} from "./helpers";
+
+export function useHireStep() {
+ const nextStep = useOnboardingWizardStore((s) => s.nextStep);
+ const hiredTemplateIds = useOnboardingWizardStore((s) => s.hiredTemplateIds);
+ const markHired = useOnboardingWizardStore((s) => s.markHired);
+ const queryClient = useQueryClient();
+ const [hiringTemplateId, setHiringTemplateId] = useState<string | null>(null);
+ const [gaveUpWaiting, setGaveUpWaiting] = useState(false);
+ const reportedIds = useRef(new Set<string>());
+ const waitStartedAt = useRef<number | null>(null);
+
+ const { data } = useGetBrainDumpRecommendedExperts({
+ query: {
+ refetchInterval: (query) => {
+ if (gaveUpWaiting) return false;
+ const response = query.state.data;
+ if (response && (response.status !== 200 || response.data.ready)) {
+ return false;
+ }
+ return RECOMMENDATIONS_POLL_MS;
+ },
+ },
+ });
+
+ const answered = data !== undefined;
+ const isReadyPerServer = data?.status !== 200 || data.data.ready;
+ const isPending = !gaveUpWaiting && (!answered || !isReadyPerServer);
+ const team: ExpertRecommendations | null =
+ data?.status === 200 ? (data.data.team ?? null) : null;
+
+ // The ceiling is absolute from the first pending render: a pending flip
+ // (transient error, then a fresh poll) re-arms the timer with what is left
+ // of the original budget rather than a full new one.
+ useEffect(() => {
+ if (!isPending) return;
+ waitStartedAt.current ??= Date.now();
+ const remaining = Math.max(
+ 0,
+ RECOMMENDATIONS_MAX_WAIT_MS - (Date.now() - waitStartedAt.current),
+ );
+ const timer = setTimeout(() => setGaveUpWaiting(true), remaining);
+ return () => clearTimeout(timer);
+ }, [isPending]);
+
+ // A poll hands back a new object for the same team; the impression for
+ // each card is reported once, not once per poll.
+ useEffect(() => {
+ if (isPending) return;
+ (team?.experts ?? []).forEach((expert, position) => {
+ if (reportedIds.current.has(expert.template_id)) return;
+ reportedIds.current.add(expert.template_id);
+ trackBrainDump("expert_recommended", {
+ template_id: expert.template_id,
+ position,
+ source: team?.source ?? null,
+ });
+ });
+ }, [team, isPending]);
+
+ const { mutateAsync: hireExpert } = useHireExpert();
+
+ async function hire(expert: RecommendedExpert, position: number) {
+ if (hiringTemplateId !== null) return;
+ trackBrainDump("expert_recommendation_clicked", {
+ template_id: expert.template_id,
+ position,
+ });
+ trackBrainDump("hire_started", {
+ template_id: expert.template_id,
+ source: "onboarding_hire_step",
+ });
+ setHiringTemplateId(expert.template_id);
+ try {
+ await hireExpert({ data: { template_id: expert.template_id } });
+ markHired(expert.template_id);
+ trackBrainDump("onboarding_expert_hired", {
+ template_id: expert.template_id,
+ position,
+ });
+ // Best effort: the roster is not on screen here, and a failed
+ // invalidation must not read as a failed hire.
+ await invalidateExpertRosterQueries(queryClient).catch(() => undefined);
+ } catch {
+ toast({
+ title: `Couldn't hire ${expert.name}`,
+ description: "Something went wrong. Please try again.",
+ variant: "destructive",
+ });
+ } finally {
+ setHiringTemplateId(null);
+ }
+ }
+
+ function handleContinue() {
+ trackBrainDump("hire_step_continued", {
+ hired: hiredTemplateIds.length,
+ recommended: team?.experts?.length ?? 0,
+ });
+ nextStep();
+ }
+
+ return {
+ team,
+ isPending,
+ experts: team?.experts ?? [],
+ raiseRole: team?.raise_suggestion?.role ?? null,
+ hiredTemplateIds,
+ hiringTemplateId,
+ hire,
+ handleContinue,
+ };
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/useScrollEdges.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/useScrollEdges.ts
new file mode 100644
index 0000000000..12ffe79044
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/HireStep/useScrollEdges.ts
@@ -0,0 +1,41 @@
+import { useEffect, useState, type RefObject } from "react";
+
+// Whether a scroll container has content hidden above or below its viewport.
+// Re-measured on scroll and on resize (the grid reflows across breakpoints),
+// so a container that fits entirely reports neither edge as hidden.
+export function useScrollEdges(ref: RefObject<HTMLElement | null>) {
+ const [edges, setEdges] = useState({
+ hiddenAbove: false,
+ hiddenBelow: false,
+ });
+
+ useEffect(() => {
+ const el = ref.current;
+ if (!el) return;
+
+ function measure() {
+ if (!el) return;
+ const hiddenAbove = el.scrollTop > 1;
+ const hiddenBelow = el.scrollTop + el.clientHeight < el.scrollHeight - 1;
+ setEdges((prev) =>
+ prev.hiddenAbove === hiddenAbove && prev.hiddenBelow === hiddenBelow
+ ? prev
+ : { hiddenAbove, hiddenBelow },
+ );
+ }
+
+ measure();
+ el.addEventListener("scroll", measure, { passive: true });
+ const observer =
+ typeof ResizeObserver === "undefined"
+ ? null
+ : new ResizeObserver(measure);
+ observer?.observe(el);
+ return () => {
+ el.removeEventListener("scroll", measure);
+ observer?.disconnect();
+ };
+ }, [ref]);
+
+ return edges;
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/IntroStep.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/IntroStep.tsx
new file mode 100644
index 0000000000..38d2b2203e
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/IntroStep.tsx
@@ -0,0 +1,61 @@
+"use client";
+
+import { Button } from "@/components/atoms/Button/Button";
+import { FadeIn } from "@/components/atoms/FadeIn/FadeIn";
+import { Text } from "@/components/atoms/Text/Text";
+import { useOnboardingWizardStore } from "../../store";
+import { AutopilotScene } from "./components/AutopilotScene";
+import { TeamScene } from "./components/TeamScene";
+import { INTRO_SLIDES, type IntroSlideId } from "./helpers";
+
+interface Props {
+ slide: IntroSlideId;
+}
+
+const SCENES: Record<IntroSlideId, () => React.JSX.Element> = {
+ team: TeamScene,
+ autopilot: AutopilotScene,
+};
+
+// One intro slide as a wizard step of its own, so it has a URL, a dot, a
+// place in the funnel and a Back button like every other step.
+export function IntroStep({ slide }: Props) {
+ const nextStep = useOnboardingWizardStore((s) => s.nextStep);
+ const { title, body } = INTRO_SLIDES[slide];
+ const Scene = SCENES[slide];
+
+ return (
+ <FadeIn className="flex w-full max-w-lg flex-col items-center gap-8 px-4">
+ <Text variant="h4" as="h1" className="text-center leading-tight">
+ {title}
+ </Text>
+
+ <div
+ data-testid="intro-stage"
+ className="relative h-[340px] w-full overflow-hidden"
+ >
+ <Scene />
+ </div>
+
+ {body && (
+ <Text
+ variant="large"
+ as="p"
+ tone="muted"
+ className="max-w-md text-center"
+ >
+ {body}
+ </Text>
+ )}
+
+ <Button
+ type="button"
+ size="small"
+ onClick={nextStep}
+ className="h-10 w-56 rounded-xl"
+ >
+ Next
+ </Button>
+ </FadeIn>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/__tests__/IntroStep.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/__tests__/IntroStep.test.tsx
new file mode 100644
index 0000000000..6afc07d4ff
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/__tests__/IntroStep.test.tsx
@@ -0,0 +1,25 @@
+import { beforeEach, describe, expect, it } from "vitest";
+import { fireEvent, render, screen } from "@/tests/integrations/test-utils";
+import { useOnboardingWizardStore } from "../../../store";
+import { IntroStep } from "../IntroStep";
+import { INTRO_SLIDES } from "../helpers";
+
+beforeEach(() => useOnboardingWizardStore.getState().reset());
+
+describe("IntroStep", () => {
+ it("shows the team slide and advances the wizard on Next", () => {
+ render(<IntroStep slide="team" />);
+ expect(
+ screen.getByRole("heading", { name: INTRO_SLIDES.team.title }),
+ ).toBeDefined();
+ fireEvent.click(screen.getByRole("button", { name: "Next" }));
+ expect(useOnboardingWizardStore.getState().currentStep).toBe(2);
+ });
+
+ it("shows the AutoPilot slide", () => {
+ render(<IntroStep slide="autopilot" />);
+ expect(
+ screen.getByRole("heading", { name: INTRO_SLIDES.autopilot.title }),
+ ).toBeDefined();
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/components/AutopilotScene.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/components/AutopilotScene.tsx
new file mode 100644
index 0000000000..99853c549c
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/components/AutopilotScene.tsx
@@ -0,0 +1,72 @@
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { BotAvatar } from "@/components/molecules/BotAvatar/BotAvatar";
+import { AUTOPILOT_AVATAR } from "@/components/molecules/BotAvatar/helpers";
+import { ArrowRight01Icon } from "@hugeicons/core-free-icons";
+import { motion } from "framer-motion";
+
+const POINTS = [
+ "I manage everything for you.",
+ "When an expert gets stuck, I step in.",
+ "I delegate tasks across the team.",
+ "I hire new experts when you need them.",
+];
+
+const EASE = [0.22, 1, 0.36, 1] as const;
+
+function reveal(i: number) {
+ return { delay: 0.25 + i * 0.15, duration: 0.5, ease: EASE };
+}
+
+export function AutopilotScene() {
+ return (
+ <div className="flex h-full flex-col items-center justify-start gap-4">
+ <motion.div
+ initial={{ opacity: 0, y: 12, scale: 0.9 }}
+ animate={{ opacity: 1, y: 0, scale: 1 }}
+ transition={{ duration: 0.6, ease: EASE }}
+ >
+ <BotAvatar
+ config={AUTOPILOT_AVATAR}
+ status="done"
+ expression="big"
+ size={120}
+ trackPointer
+ showBadge={false}
+ />
+ </motion.div>
+
+ <div className="flex flex-col items-center gap-3">
+ <ul className="flex flex-col items-center gap-2">
+ {POINTS.map((point, i) => (
+ <motion.li
+ key={point}
+ initial={{ opacity: 0, x: -8 }}
+ animate={{ opacity: 1, x: 0 }}
+ transition={reveal(i)}
+ className="flex items-center gap-1.5"
+ >
+ <Icon
+ icon={ArrowRight01Icon}
+ size={16}
+ className="shrink-0 text-purple-500"
+ />
+ <Text variant="body" as="span">
+ {point}
+ </Text>
+ </motion.li>
+ ))}
+ </ul>
+ <motion.div
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
+ transition={reveal(POINTS.length)}
+ >
+ <Text variant="body" as="p" tone="muted">
+ and more…
+ </Text>
+ </motion.div>
+ </div>
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/components/TeamScene.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/components/TeamScene.tsx
new file mode 100644
index 0000000000..ea98c4174b
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/components/TeamScene.tsx
@@ -0,0 +1,192 @@
+import { BotAvatar } from "@/components/molecules/BotAvatar/BotAvatar";
+import {
+ AUTOPILOT_AVATAR,
+ type AvatarConfig,
+ type AvatarStatus,
+} from "@/components/molecules/BotAvatar/helpers";
+import { motion } from "framer-motion";
+import { facing } from "../helpers";
+
+interface Member {
+ name: string;
+ config: AvatarConfig;
+ status: AvatarStatus;
+ size: number;
+ x: number;
+ y: number;
+ parent?: string;
+}
+
+const WIDTH = 420;
+const HEIGHT = 340;
+const CORNER = 10;
+
+const TEAM: Member[] = [
+ {
+ name: "AutoPilot",
+ config: AUTOPILOT_AVATAR,
+ status: "idle",
+ size: 104,
+ x: 210,
+ y: 56,
+ },
+ {
+ name: "Ops",
+ config: { shape: "squircle", color: "mint", accessory: "headset" },
+ status: "working",
+ size: 84,
+ x: 105,
+ y: 176,
+ parent: "AutoPilot",
+ },
+ {
+ name: "Research",
+ config: { shape: "round", color: "sky", accessory: "glasses" },
+ status: "thinking",
+ size: 84,
+ x: 210,
+ y: 176,
+ parent: "AutoPilot",
+ },
+ {
+ name: "Marketing",
+ config: { shape: "bean", color: "coral", accessory: "bow" },
+ status: "done",
+ size: 84,
+ x: 315,
+ y: 176,
+ parent: "AutoPilot",
+ },
+ {
+ name: "Finance",
+ config: { shape: "wide", color: "amber", accessory: "badge" },
+ status: "idle",
+ size: 72,
+ x: 52,
+ y: 298,
+ parent: "Ops",
+ },
+ {
+ name: "Support",
+ config: { shape: "dome", color: "plum", accessory: "flower" },
+ status: "working",
+ size: 72,
+ x: 158,
+ y: 298,
+ parent: "Ops",
+ },
+ {
+ name: "Sales",
+ config: { shape: "round", color: "indigo", accessory: "star" },
+ status: "idle",
+ size: 72,
+ x: 262,
+ y: 298,
+ parent: "Marketing",
+ },
+ {
+ name: "Design",
+ config: { shape: "squircle", color: "butter", accessory: "headband" },
+ status: "thinking",
+ size: 72,
+ x: 368,
+ y: 298,
+ parent: "Marketing",
+ },
+];
+
+const BY_NAME = Object.fromEntries(TEAM.map((m) => [m.name, m]));
+const PARENTS = TEAM.filter((m) => TEAM.some((c) => c.parent === m.name));
+
+function depth(member: Member): number {
+ return member.parent ? depth(BY_NAME[member.parent]) + 1 : 0;
+}
+
+function yawToward(member: Member): number {
+ return ((WIDTH / 2 - member.x) / WIDTH) * 40;
+}
+
+function branch(parent: Member): string {
+ const kids = TEAM.filter((c) => c.parent === parent.name);
+ const stemStart = parent.y + parent.size / 2;
+ const kidTop = Math.min(...kids.map((k) => k.y - k.size / 2));
+ const bus = (stemStart + kidTop) / 2;
+ const stem = `M ${parent.x} ${stemStart} V ${bus}`;
+ const left = Math.min(...kids.map((k) => k.x));
+ const right = Math.max(...kids.map((k) => k.x));
+ const drops = kids
+ .filter((k) => k.x !== left && k.x !== right)
+ .map((k) => `M ${k.x} ${bus} V ${k.y - k.size / 2}`)
+ .join(" ");
+ const rail = [
+ `M ${left} ${kidTop} V ${bus + CORNER}`,
+ `Q ${left} ${bus} ${left + CORNER} ${bus}`,
+ `H ${right - CORNER}`,
+ `Q ${right} ${bus} ${right} ${bus + CORNER}`,
+ `V ${kidTop}`,
+ ].join(" ");
+ return `${stem} ${rail} ${drops}`;
+}
+
+const EASE = [0.22, 1, 0.36, 1] as const;
+
+export function TeamScene() {
+ return (
+ <div className="flex h-full items-center justify-center">
+ <svg
+ role="img"
+ aria-label="AutoPilot and your team of AI experts"
+ viewBox={`0 0 ${WIDTH} ${HEIGHT}`}
+ className="h-auto w-full max-w-[420px]"
+ >
+ {PARENTS.map((p) => (
+ <motion.path
+ key={p.name}
+ d={branch(p)}
+ fill="none"
+ className="stroke-zinc-300"
+ strokeWidth={2}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ initial={{ pathLength: 0, opacity: 0 }}
+ animate={{ pathLength: 1, opacity: 1 }}
+ transition={{
+ delay: 0.25 + depth(p) * 0.3,
+ duration: 0.7,
+ ease: EASE,
+ }}
+ />
+ ))}
+ {TEAM.map((member) => (
+ <foreignObject
+ key={member.name}
+ x={member.x - member.size / 2}
+ y={member.y - member.size / 2}
+ width={member.size}
+ height={member.size}
+ overflow="visible"
+ >
+ <motion.div
+ initial={{ opacity: 0, y: 10, scale: 0.8 }}
+ animate={{ opacity: 1, y: 0, scale: 1 }}
+ transition={{
+ delay: 0.1 + depth(member) * 0.3,
+ duration: 0.6,
+ ease: EASE,
+ }}
+ >
+ <BotAvatar
+ config={member.config}
+ status={member.status}
+ size={member.size}
+ poseOffset={facing(yawToward(member))}
+ trackPointer={member.name === "AutoPilot"}
+ showBadge={false}
+ />
+ </motion.div>
+ </foreignObject>
+ ))}
+ </svg>
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/helpers.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/helpers.ts
new file mode 100644
index 0000000000..17bd119cca
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/IntroStep/helpers.ts
@@ -0,0 +1,23 @@
+import type { Pose } from "@/components/molecules/BotAvatar/projection";
+
+export type IntroSlideId = "team" | "autopilot";
+
+export interface IntroSlide {
+ title: string;
+ body?: string;
+}
+
+export const INTRO_SLIDES: Record<IntroSlideId, IntroSlide> = {
+ team: {
+ title: "Your own team of AI experts.",
+ body: "Go beyond chat. Get experts that research, create, and handle work for you.",
+ },
+ autopilot: { title: "Meet AutoPilot, your Head of AI." },
+};
+
+export function facing(yawDeg: number, pitchDeg = 0): Partial<Pose> {
+ return {
+ yaw: (yawDeg * Math.PI) / 180,
+ pitch: (pitchDeg * Math.PI) / 180,
+ };
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/PainPointsStep.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/PainPointsStep.tsx
index 78fdd9421c..e4d8cefac7 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/PainPointsStep.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/PainPointsStep.tsx
@@ -9,49 +9,66 @@ import { ReactNode } from "react";
import { FadeIn } from "@/components/atoms/FadeIn/FadeIn";
import { SelectableCard } from "../components/SelectableCard";
import { usePainPointsStep } from "./usePainPointsStep";
-import { Emoji } from "@/components/atoms/Emoji/Emoji";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import {
+ Analytics01Icon,
+ Calendar03Icon,
+ CustomerSupportIcon,
+ Database01Icon,
+ Mail01Icon,
+ Megaphone01Icon,
+ MicroscopeIcon,
+ MoreHorizontalIcon,
+ UserSearch01Icon,
+} from "@hugeicons/core-free-icons";
+
+const ICON_SIZE = 20;
const ALL_PAIN_POINTS: { id: string; label: string; icon: ReactNode }[] = [
{
id: "Finding leads",
label: "Finding leads",
- icon: <Emoji text="🔍" size={32} />,
+ icon: <Icon icon={UserSearch01Icon} size={ICON_SIZE} />,
},
{
id: "Email & outreach",
label: "Email & outreach",
- icon: <Emoji text="📧" size={32} />,
+ icon: <Icon icon={Mail01Icon} size={ICON_SIZE} />,
},
{
id: "Reports & data",
label: "Reports & data",
- icon: <Emoji text="📊" size={32} />,
+ icon: <Icon icon={Analytics01Icon} size={ICON_SIZE} />,
},
{
id: "Customer support",
label: "Customer support",
- icon: <Emoji text="💬" size={32} />,
+ icon: <Icon icon={CustomerSupportIcon} size={ICON_SIZE} />,
},
{
id: "Social media",
label: "Social media",
- icon: <Emoji text="📱" size={32} />,
+ icon: <Icon icon={Megaphone01Icon} size={ICON_SIZE} />,
},
{
id: "CRM & data entry",
label: "CRM & data entry",
- icon: <Emoji text="📝" size={32} />,
+ icon: <Icon icon={Database01Icon} size={ICON_SIZE} />,
},
{
id: "Scheduling",
label: "Scheduling",
- icon: <Emoji text="🗓️" size={32} />,
+ icon: <Icon icon={Calendar03Icon} size={ICON_SIZE} />,
+ },
+ {
+ id: "Research",
+ label: "Research",
+ icon: <Icon icon={MicroscopeIcon} size={ICON_SIZE} />,
},
- { id: "Research", label: "Research", icon: <Emoji text="🔬" size={32} /> },
{
id: "Something else",
label: "Something else",
- icon: <Emoji text="🚩" size={32} />,
+ icon: <Icon icon={MoreHorizontalIcon} size={ICON_SIZE} />,
},
];
@@ -84,15 +101,10 @@ export function PainPointsStep() {
return (
<FadeIn>
- <div className="flex w-full flex-col items-center gap-12 px-4">
+ <div className="flex w-full flex-col items-center gap-8 px-4">
<div className="flex max-w-lg flex-col items-center gap-2 px-4 text-center">
- <Text
- variant="h3"
- className="!text-[1.5rem] !leading-[2rem] md:!text-[1.75rem] md:!leading-[2.5rem]"
- >
- What&apos;s eating your time?
- </Text>
- <Text variant="lead" className="!text-zinc-500">
+ <Text variant="h4">What&apos;s eating your time?</Text>
+ <Text variant="body" tone="muted">
Pick the tasks you&apos;d love to hand off to AutoPilot
</Text>
</div>
@@ -106,15 +118,15 @@ export function PainPointsStep() {
label={p.label}
selected={painPoints.includes(p.id)}
onClick={() => togglePainPoint(p.id)}
- className="p-8"
/>
))}
</div>
<Text
variant="small"
+ tone={atLimit && canContinue ? undefined : "muted"}
className={cn(
"transition-colors",
- atLimit && canContinue ? "!text-green-600" : "!text-zinc-500",
+ atLimit && canContinue && "text-green-600",
shaking && "animate-shake",
)}
>
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/PreparingStep.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/PreparingStep.tsx
index b04509c62d..3d6f9c64ff 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/PreparingStep.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/PreparingStep.tsx
@@ -1,8 +1,9 @@
"use client";
-import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";
import { Icon } from "@/components/atoms/Icon/Icon";
import { Text } from "@/components/atoms/Text/Text";
+import { BotAvatar } from "@/components/molecules/BotAvatar/BotAvatar";
+import { AUTOPILOT_AVATAR } from "@/components/molecules/BotAvatar/helpers";
import { TypingText } from "@/components/molecules/TypingText/TypingText";
import { cn } from "@/lib/utils";
import { Tick02Icon } from "@hugeicons/core-free-icons";
@@ -25,11 +26,14 @@ export function PreparingStep({
return (
<div className="flex w-full max-w-md flex-col items-center gap-8 px-4">
<div className="flex flex-col items-center gap-4">
- <AutoGPTLogo
- className="relative right-[3rem] h-24 w-[12rem]"
- hideText
+ <BotAvatar
+ config={AUTOPILOT_AVATAR}
+ status="working"
+ size={120}
+ trackPointer
+ showBadge={false}
/>
- <Text variant="h3" className="text-center">
+ <Text variant="h4" className="text-center">
<TypingText
text="Preparing your workspace..."
active={started}
@@ -39,33 +43,29 @@ export function PreparingStep({
</Text>
</div>
- <div className="h-2 w-full overflow-hidden rounded-full bg-gray-200">
+ <div className="h-0.5 w-full overflow-hidden bg-zinc-100">
<div
- className="h-full rounded-full bg-purple-500 transition-all duration-100 ease-linear"
+ className="h-full bg-zinc-900 transition-all duration-100 ease-linear"
style={{ width: `${progress}%` }}
/>
</div>
- <ul className="flex flex-col gap-3">
+ <ul className="flex flex-col gap-2">
{checklist.map((item, i) => (
- <li key={item} className="flex items-center gap-3">
- <div
+ <li key={item} className="flex items-center gap-2">
+ <Icon
+ icon={Tick02Icon}
+ size={16}
className={cn(
- "flex h-6 w-6 items-center justify-center rounded-full transition-colors",
- i < completedItems
- ? "bg-neutral-900 text-white"
- : "bg-gray-200 text-gray-400",
+ "shrink-0 transition-colors",
+ i < completedItems ? "text-zinc-900" : "text-zinc-300",
)}
- >
- <Icon icon={Tick02Icon} size={14} />
- </div>
+ />
<Text
variant="body"
as="span"
- className={cn(
- "transition-colors",
- i < completedItems ? "!text-black" : "!text-zinc-500",
- )}
+ tone={i < completedItems ? "primary" : "muted"}
+ className="transition-colors"
>
{item}
</Text>
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/RoleStep.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/RoleStep.tsx
index 9bb6af42cd..2dfda2474c 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/RoleStep.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/RoleStep.tsx
@@ -3,98 +3,97 @@
import { Button } from "@/components/atoms/Button/Button";
import { Input } from "@/components/atoms/Input/Input";
import { Text } from "@/components/atoms/Text/Text";
+import { BotAvatar } from "@/components/molecules/BotAvatar/BotAvatar";
+import { AUTOPILOT_AVATAR } from "@/components/molecules/BotAvatar/helpers";
import { FadeIn } from "@/components/atoms/FadeIn/FadeIn";
+import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
import { SelectableCard } from "../components/SelectableCard";
import { useOnboardingWizardStore } from "../store";
-import { Emoji } from "@/components/atoms/Emoji/Emoji";
-import { useEffect, useRef } from "react";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import {
+ ChartLineData01Icon,
+ CodeIcon,
+ CubeIcon,
+ Flag01Icon,
+ Megaphone01Icon,
+ Settings02Icon,
+ Target01Icon,
+ UserGroupIcon,
+} from "@hugeicons/core-free-icons";
-const IMG_SIZE = 42;
+const ICON_SIZE = 20;
const ROLES = [
{
id: "Founder/CEO",
label: "Founder / CEO",
- icon: <Emoji text="🎯" size={IMG_SIZE} />,
+ icon: <Icon icon={Target01Icon} size={ICON_SIZE} />,
},
{
id: "Operations",
label: "Operations",
- icon: <Emoji text="⚙️" size={IMG_SIZE} />,
+ icon: <Icon icon={Settings02Icon} size={ICON_SIZE} />,
},
{
id: "Sales/BD",
label: "Sales / BD",
- icon: <Emoji text="📈" size={IMG_SIZE} />,
+ icon: <Icon icon={ChartLineData01Icon} size={ICON_SIZE} />,
},
{
id: "Marketing",
label: "Marketing",
- icon: <Emoji text="📢" size={IMG_SIZE} />,
+ icon: <Icon icon={Megaphone01Icon} size={ICON_SIZE} />,
},
{
id: "Product/PM",
label: "Product / PM",
- icon: <Emoji text="🔨" size={IMG_SIZE} />,
+ icon: <Icon icon={CubeIcon} size={ICON_SIZE} />,
},
{
id: "Engineering",
label: "Engineering",
- icon: <Emoji text="💻" size={IMG_SIZE} />,
+ icon: <Icon icon={CodeIcon} size={ICON_SIZE} />,
},
{
id: "HR/People",
label: "HR / People",
- icon: <Emoji text="👤" size={IMG_SIZE} />,
+ icon: <Icon icon={UserGroupIcon} size={ICON_SIZE} />,
+ },
+ {
+ id: "Other",
+ label: "Other",
+ icon: <Icon icon={Flag01Icon} size={ICON_SIZE} />,
},
- { id: "Other", label: "Other", icon: <Emoji text="🚩" size={IMG_SIZE} /> },
] as const;
export function RoleStep() {
- const name = useOnboardingWizardStore((s) => s.name);
const role = useOnboardingWizardStore((s) => s.role);
const otherRole = useOnboardingWizardStore((s) => s.otherRole);
const setRole = useOnboardingWizardStore((s) => s.setRole);
const setOtherRole = useOnboardingWizardStore((s) => s.setOtherRole);
const nextStep = useOnboardingWizardStore((s) => s.nextStep);
- const autoAdvanceTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
+ const reduceMotion = useReducedMotion();
const isOther = role === "Other";
+ const canContinue = isOther ? Boolean(otherRole.trim()) : Boolean(role);
- useEffect(() => {
- return () => {
- if (autoAdvanceTimer.current) clearTimeout(autoAdvanceTimer.current);
- };
- }, []);
-
- function handleRoleSelect(id: string) {
- if (autoAdvanceTimer.current) clearTimeout(autoAdvanceTimer.current);
- setRole(id);
- if (id !== "Other") {
- autoAdvanceTimer.current = setTimeout(nextStep, 350);
- }
- }
-
- function handleOtherContinue() {
- if (otherRole.trim()) {
- nextStep();
- }
+ function handleNext() {
+ if (canContinue) nextStep();
}
return (
<FadeIn>
- <div className="flex w-full flex-col items-center gap-12 px-4">
- <div className="mx-auto flex w-full max-w-lg flex-col items-center gap-2 px-4 text-center">
- <Text
- variant="h3"
- className="!text-[1.5rem] !leading-[2rem] md:!text-[1.75rem] md:!leading-[2.5rem]"
- >
- What best describes you, {name}?
- </Text>
- <Text variant="lead" className="!text-zinc-500">
- So AutoPilot knows how to help you best
- </Text>
+ <div className="flex w-full flex-col items-center gap-8 px-4">
+ <div className="mx-auto flex w-full max-w-lg flex-col items-center gap-4 px-4 text-center">
+ <BotAvatar
+ config={AUTOPILOT_AVATAR}
+ status="idle"
+ size={120}
+ trackPointer
+ showBadge={false}
+ />
+ <Text variant="h4">What best describes you?</Text>
</div>
<div className="flex w-full max-w-[100vw] flex-nowrap gap-4 overflow-x-auto px-8 scrollbar-none md:grid md:grid-cols-4 md:overflow-hidden md:px-0">
@@ -104,35 +103,49 @@ export function RoleStep() {
icon={r.icon}
label={r.label}
selected={role === r.id}
- onClick={() => handleRoleSelect(r.id)}
- className="p-8"
+ onClick={() => setRole(r.id)}
+ className="h-28 w-[11.5rem]"
/>
))}
</div>
- {isOther && (
- <>
- <div className="-mb-5 w-full px-8 md:px-0">
- <Input
- id="other-role"
- label="Other role"
- hideLabel
- placeholder="Describe your role..."
- value={otherRole}
- onChange={(e) => setOtherRole(e.target.value)}
- autoFocus
- />
- </div>
-
- <Button
- onClick={handleOtherContinue}
- disabled={!otherRole.trim()}
- className="w-full max-w-xs"
+ <AnimatePresence initial={false}>
+ {isOther && (
+ <motion.div
+ key="other-role"
+ initial={{ opacity: 0, height: 0, y: reduceMotion ? 0 : -8 }}
+ animate={{ opacity: 1, height: "auto", y: 0 }}
+ exit={{ opacity: 0, height: 0, y: reduceMotion ? 0 : -8 }}
+ transition={{
+ duration: reduceMotion ? 0.15 : 0.24,
+ ease: [0.22, 1, 0.36, 1],
+ }}
+ className="-my-1 w-full max-w-lg overflow-hidden"
>
- Continue
- </Button>
- </>
- )}
+ <div className="w-full px-8 py-1 md:px-0">
+ <Input
+ id="other-role"
+ label="Other role"
+ hideLabel
+ placeholder="Describe your role..."
+ value={otherRole}
+ onChange={(e) => setOtherRole(e.target.value)}
+ autoFocus
+ />
+ </div>
+ </motion.div>
+ )}
+ </AnimatePresence>
+
+ <Button
+ type="button"
+ size="small"
+ onClick={handleNext}
+ disabled={!canContinue}
+ className="h-10 w-56 rounded-xl"
+ >
+ Next
+ </Button>
</div>
</FadeIn>
);
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/useSubscriptionStep.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/useSubscriptionStep.ts
index 3ddf58c87d..9240e90eb9 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/useSubscriptionStep.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/useSubscriptionStep.ts
@@ -8,7 +8,7 @@ import {
import { environment } from "@/services/environment";
import { useState } from "react";
import { useSearchParams } from "next/navigation";
-import { PAYWALL_FIRST_STEPS, useOnboardingWizardStore } from "../../store";
+import { useOnboardingWizardStore } from "../../store";
import { COUNTRIES } from "@/components/molecules/PlanCard/countries";
import {
PLAN_KEYS,
@@ -41,6 +41,8 @@ export function useSubscriptionStep() {
const setSelectedPlan = useOnboardingWizardStore((s) => s.setSelectedPlan);
const nextStep = useOnboardingWizardStore((s) => s.nextStep);
const selectedPlan = useOnboardingWizardStore((s) => s.selectedPlan);
+ const steps = useOnboardingWizardStore((s) => s.steps);
+ const currentStep = useOnboardingWizardStore((s) => s.currentStep);
const { mutateAsync: updateTier, isPending: isUpdatingTier } =
useUpdateSubscriptionTier();
@@ -95,16 +97,17 @@ export function useSubscriptionStep() {
try {
// The paywall is the first step, so there's no profile to submit yet —
- // name / role / pain points are collected after payment. On a successful
- // checkout Stripe returns the user to Welcome to begin onboarding; on
- // cancel, back to this paywall. Stripe fills {CHECKOUT_SESSION_ID}; plan
- // and cycle let the return page report the subscription to Google Ads.
+ // role and pain points are collected after payment. On a successful
+ // checkout Stripe returns the user to the step after the paywall to
+ // begin onboarding; on cancel, back to this paywall. Stripe fills
+ // {CHECKOUT_SESSION_ID}; plan and cycle let the return page report the
+ // subscription to Google Ads.
const baseUrl = `${window.location.origin}/onboarding`;
const result = await updateTier({
data: {
tier,
- success_url: `${baseUrl}?step=${PAYWALL_FIRST_STEPS.welcome}&subscription=success&session_id={CHECKOUT_SESSION_ID}&plan=${planKey}&cycle=${cycle}`,
- cancel_url: `${baseUrl}?step=${PAYWALL_FIRST_STEPS.subscription}&subscription=cancelled`,
+ success_url: `${baseUrl}?step=${(steps.subscription ?? currentStep) + 1}&subscription=success&session_id={CHECKOUT_SESSION_ID}&plan=${planKey}&cycle=${cycle}`,
+ cancel_url: `${baseUrl}?step=${steps.subscription ?? currentStep}&subscription=cancelled`,
billing_cycle: cycle,
},
});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/WelcomeStep.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/WelcomeStep.tsx
deleted file mode 100644
index 06ce9b57b7..0000000000
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/WelcomeStep.tsx
+++ /dev/null
@@ -1,63 +0,0 @@
-"use client";
-
-import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";
-import { Button } from "@/components/atoms/Button/Button";
-import { Input } from "@/components/atoms/Input/Input";
-import { Text } from "@/components/atoms/Text/Text";
-import { FadeIn } from "@/components/atoms/FadeIn/FadeIn";
-import { useOnboardingWizardStore } from "../store";
-
-export function WelcomeStep() {
- const name = useOnboardingWizardStore((s) => s.name);
- const setName = useOnboardingWizardStore((s) => s.setName);
- const nextStep = useOnboardingWizardStore((s) => s.nextStep);
-
- function handleSubmit(e: React.FormEvent) {
- e.preventDefault();
- if (name.trim()) {
- nextStep();
- }
- }
-
- return (
- <FadeIn>
- <form
- onSubmit={handleSubmit}
- className="flex w-full max-w-lg flex-col items-center gap-4 px-4 md:gap-8"
- >
- <div className="mb-8 flex flex-col items-center gap-3 text-center md:mb-0">
- <AutoGPTLogo
- className="relative right-[3rem] h-24 w-[12rem]"
- hideText
- />
- <Text variant="h3">Welcome to AutoGPT</Text>
- <Text variant="lead" as="span" className="!text-zinc-500">
- Let&apos;s personalize your experience so{" "}
- <span className="bg-gradient-to-r from-purple-500 to-indigo-500 bg-clip-text text-transparent">
- AutoPilot
- </span>{" "}
- can start saving you time
- </Text>
- </div>
-
- <Input
- id="first-name"
- label="What should I call you?"
- placeholder="e.g. John"
- value={name}
- onChange={(e) => setName(e.target.value)}
- className="w-full"
- autoFocus
- />
-
- <Button
- type="submit"
- disabled={!name.trim()}
- className="w-full max-w-xs"
- >
- Continue
- </Button>
- </form>
- </FadeIn>
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx
index 43bd29c4a6..74fac15fe4 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx
@@ -34,9 +34,8 @@ afterEach(cleanup);
beforeEach(() => {
useOnboardingWizardStore.getState().reset();
- useOnboardingWizardStore.getState().setName("Alice");
useOnboardingWizardStore.getState().setRole("Founder/CEO");
- useOnboardingWizardStore.getState().goToStep(3);
+ useOnboardingWizardStore.getState().goToStep(2);
});
describe("PainPointsStep", () => {
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/RoleStep.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/RoleStep.test.tsx
index 0cafccab98..15b9207205 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/RoleStep.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/RoleStep.test.tsx
@@ -26,8 +26,7 @@ afterEach(() => {
beforeEach(() => {
vi.useFakeTimers();
useOnboardingWizardStore.getState().reset();
- useOnboardingWizardStore.getState().setName("Alice");
- useOnboardingWizardStore.getState().goToStep(2);
+ useOnboardingWizardStore.getState().goToStep(1);
});
describe("RoleStep", () => {
@@ -44,71 +43,62 @@ describe("RoleStep", () => {
expect(screen.getByText("Other")).toBeDefined();
});
- test("displays the user name in the heading", () => {
+ test("asks what best describes the user", () => {
render(<RoleStep />);
expect(
- screen.getAllByText(/what best describes you, alice/i).length,
- ).toBeGreaterThan(0);
+ screen.getByRole("heading", { name: "What best describes you?" }),
+ ).toBeDefined();
});
- test("selecting a non-Other role auto-advances after delay", () => {
+ test("selecting a role does not advance on its own", () => {
render(<RoleStep />);
fireEvent.click(screen.getByRole("button", { name: /engineering/i }));
expect(useOnboardingWizardStore.getState().role).toBe("Engineering");
- expect(useOnboardingWizardStore.getState().currentStep).toBe(2);
-
- vi.advanceTimersByTime(350);
-
- expect(useOnboardingWizardStore.getState().currentStep).toBe(3);
+ vi.advanceTimersByTime(1000);
+ expect(useOnboardingWizardStore.getState().currentStep).toBe(1);
});
- test("selecting 'Other' does not auto-advance", () => {
+ test("Next is disabled until a role is chosen, then advances", () => {
render(<RoleStep />);
- fireEvent.click(screen.getByRole("button", { name: /\bother\b/i }));
+ const next = screen.getByRole("button", { name: "Next" });
+ expect(next.hasAttribute("disabled")).toBe(true);
- vi.advanceTimersByTime(500);
+ fireEvent.click(screen.getByRole("button", { name: /engineering/i }));
+ expect(next.hasAttribute("disabled")).toBe(false);
+ fireEvent.click(next);
expect(useOnboardingWizardStore.getState().currentStep).toBe(2);
});
- test("selecting 'Other' shows text input and Continue button", () => {
+ test("selecting 'Other' shows the text input", () => {
render(<RoleStep />);
fireEvent.click(screen.getByRole("button", { name: /\bother\b/i }));
expect(screen.getByPlaceholderText(/describe your role/i)).toBeDefined();
- expect(screen.getByRole("button", { name: /continue/i })).toBeDefined();
});
- test("Continue button is disabled when Other input is empty", () => {
+ test("Next stays disabled for Other until the role is described", () => {
render(<RoleStep />);
fireEvent.click(screen.getByRole("button", { name: /\bother\b/i }));
+ const next = screen.getByRole("button", { name: "Next" });
+ expect(next.hasAttribute("disabled")).toBe(true);
- const continueBtn = screen.getByRole("button", { name: /continue/i });
- expect(continueBtn.hasAttribute("disabled")).toBe(true);
- });
-
- test("Continue button advances when Other role text is filled", () => {
- render(<RoleStep />);
-
- fireEvent.click(screen.getByRole("button", { name: /\bother\b/i }));
fireEvent.change(screen.getByPlaceholderText(/describe your role/i), {
target: { value: "Designer" },
});
+ expect(next.hasAttribute("disabled")).toBe(false);
- const continueBtn = screen.getByRole("button", { name: /continue/i });
- expect(continueBtn.hasAttribute("disabled")).toBe(false);
-
- fireEvent.click(continueBtn);
- expect(useOnboardingWizardStore.getState().currentStep).toBe(3);
+ fireEvent.click(next);
+ expect(useOnboardingWizardStore.getState().currentStep).toBe(2);
});
- test("switching from Other to a regular role cancels Other and auto-advances", () => {
+ test("switching from Other to a regular role hides the input and keeps the step", () => {
render(<RoleStep />);
fireEvent.click(screen.getByRole("button", { name: /\bother\b/i }));
@@ -117,7 +107,7 @@ describe("RoleStep", () => {
fireEvent.click(screen.getByRole("button", { name: /marketing/i }));
expect(useOnboardingWizardStore.getState().role).toBe("Marketing");
- vi.advanceTimersByTime(350);
- expect(useOnboardingWizardStore.getState().currentStep).toBe(3);
+ vi.advanceTimersByTime(1000);
+ expect(useOnboardingWizardStore.getState().currentStep).toBe(1);
});
});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsx
index 1d7f46cda3..75e944d18c 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsx
@@ -50,8 +50,8 @@ afterEach(() => {
beforeEach(() => {
postHog.variant = undefined;
useOnboardingWizardStore.getState().reset();
- // The paywall is the first step.
- useOnboardingWizardStore.getState().goToStep(1);
+ // The paywall is the last interactive step (step 3), before Preparing.
+ useOnboardingWizardStore.getState().goToStep(3);
// Default tests to cloud mode so they exercise the Stripe Checkout path.
// The local-bypass test below opts back into LOCAL.
vi.spyOn(environment, "isLocal").mockReturnValue(false);
@@ -198,7 +198,7 @@ describe("SubscriptionStep", () => {
expect(screen.queryByText(/Charged today/i)).toBeNull();
});
- test("selecting Pro persists selectedPlan and redirects to Stripe Checkout (Welcome on success, paywall on cancel)", async () => {
+ test("selecting Pro persists selectedPlan and redirects to Stripe Checkout (Role on success, paywall on cancel)", async () => {
let capturedTierBody: {
tier?: string;
success_url?: string;
@@ -228,8 +228,8 @@ describe("SubscriptionStep", () => {
expect(useOnboardingWizardStore.getState().selectedPlan).toBe("PRO");
expect(capturedTierBody!.tier).toBe("PRO");
- // Success returns to Welcome (step 2) to begin onboarding; cancel returns
- // to the paywall (step 1).
+ // Success moves on to the step after the paywall (step 2) to begin
+ // onboarding; cancel returns to the paywall (step 1).
expect(capturedTierBody!.success_url).toContain(
"/onboarding?step=2&subscription=success",
);
@@ -241,8 +241,8 @@ describe("SubscriptionStep", () => {
expect(capturedTierBody!.success_url).toContain(
"&session_id={CHECKOUT_SESSION_ID}&plan=PRO&cycle=monthly",
);
- // Paywall-first: no profile data exists yet, so nothing is POSTed here —
- // the Preparing step submits the profile at the end of onboarding.
+ // Nothing is POSTed here — the profile is collected after payment and
+ // the Preparing step submits it.
expect(profileCalled).toBe(false);
});
@@ -286,9 +286,7 @@ describe("SubscriptionStep", () => {
fireEvent.click(screen.getByRole("button", { name: /Get Pro/i }));
await waitFor(() => {
- expect(useOnboardingWizardStore.getState().currentStep).toBeGreaterThan(
- 1,
- );
+ expect(useOnboardingWizardStore.getState().currentStep).toBe(4);
});
expect(gtagCalls.filter((call) => call[1] === "conversion")).toEqual([]);
});
@@ -378,7 +376,7 @@ describe("SubscriptionStep", () => {
);
const state = useOnboardingWizardStore.getState();
expect(state.selectedPlan).toBeNull();
- expect(state.currentStep).toBe(1);
+ expect(state.currentStep).toBe(3);
} finally {
openSpy.mockRestore();
}
@@ -408,14 +406,13 @@ describe("SubscriptionStep", () => {
});
// Local short-circuit: no Stripe Checkout, no profile POST (the Preparing
// step handles submission via useOnboardingPage). Advances from the
- // paywall (step 1) to Welcome (step 2).
+ // paywall (step 3) to Preparing (step 4).
expect(stripeCalled).toBe(false);
expect(profileCalledSync).toBe(false);
- expect(useOnboardingWizardStore.getState().currentStep).toBe(2);
+ expect(useOnboardingWizardStore.getState().currentStep).toBe(4);
});
test("clicking a plan keeps the request in flight: clicked card spins, others lock", async () => {
- useOnboardingWizardStore.getState().setName("Ada");
useOnboardingWizardStore.getState().setRole("Engineer");
let resolveTier: (value: unknown) => void = () => undefined;
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/usePreparingStep.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/usePreparingStep.ts
index f8984b65b5..c9bd7e5369 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/usePreparingStep.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/usePreparingStep.ts
@@ -51,7 +51,9 @@ export function usePreparingStep({
// Only a user who actually dumped gets the honest copy; a skip would
// make "Reading your brain dump" a lie.
const isDumpPath = isBrainDumpEnabled && peekIntroPath() === "A";
- const checklist = isDumpPath ? BRAIN_DUMP_CHECKLIST : GENERIC_CHECKLIST;
+ const checklist: readonly string[] = isDumpPath
+ ? BRAIN_DUMP_CHECKLIST
+ : GENERIC_CHECKLIST;
const duration = isDumpPath ? BRAIN_DUMP_DURATION_MS : GENERIC_DURATION_MS;
const stepInterval = duration / checklist.length;
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/store.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/store.ts
index 2310104a1d..b497a3b350 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/store.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/store.ts
@@ -2,42 +2,87 @@ import { create } from "zustand";
import { createJSONStorage, persist } from "zustand/middleware";
export const MAX_PAIN_POINT_SELECTIONS = 3;
-export type Step = 1 | 2 | 3 | 4 | 5;
+export type Step = 1 | 2 | 3 | 4 | 5 | 6 | 7;
+export const MAX_STEP: Step = 7;
-// Wizard step layouts. With payments enabled the paywall is the FIRST step so
-// the user pays before personalising; the profile-collection steps shift down
-// by one. Centralised here so page rendering, the page hook's URL clamping and
-// the SubscriptionStep's Stripe success/cancel return URLs can't drift apart.
+// Every step the wizard can show, numbered for one deployment. Optional
+// steps are absent rather than zero so `currentStep === steps.team` can
+// never match by accident.
+export interface StepLayout {
+ team?: number;
+ autopilot?: number;
+ role: number;
+ painPoints: number;
+ hire?: number;
+ subscription?: number;
+ connect?: number;
+ preparing: number;
+}
+
+// Builds the layout for a deployment: the paywall comes FIRST on cloud so
+// nobody without a plan gets into the wizard, the two intro steps (team, meet
+// AutoPilot) follow when the expert team is on, then the profile steps, then
+// AutoPilot's hire recommendations right after the brain dump they are read
+// from. Self-host has no paywall and instead closes with the "connect a plan
+// you already pay for" step, right before Preparing. Numbering is derived, so
+// nothing can drift.
+export function buildStepLayout({
+ hasIntro = false,
+ hasHire = false,
+ hasPaywall = false,
+ hasConnect = false,
+}: {
+ hasIntro?: boolean;
+ hasHire?: boolean;
+ hasPaywall?: boolean;
+ hasConnect?: boolean;
+}): StepLayout {
+ const order: (keyof StepLayout)[] = [
+ ...(hasPaywall ? (["subscription"] as const) : []),
+ ...(hasIntro ? (["team", "autopilot"] as const) : []),
+ "role",
+ "painPoints",
+ ...(hasHire ? (["hire"] as const) : []),
+ ...(!hasPaywall && hasConnect ? (["connect"] as const) : []),
+ "preparing",
+ ];
+ const layout: Partial<Record<keyof StepLayout, number>> = {};
+ order.forEach((key, index) => {
+ layout[key] = index + 1;
+ });
+ return layout as StepLayout;
+}
+
+// The three layouts without the intro steps, spelled out for tests and for
+// the store's default.
export const PAYWALL_FIRST_STEPS = {
subscription: 1,
- welcome: 2,
- role: 3,
- painPoints: 4,
- preparing: 5,
-} as const;
-
-export const NO_PAYWALL_STEPS = {
- welcome: 1,
role: 2,
painPoints: 3,
preparing: 4,
} as const;
-// Self-host has no paywall, but it has the same question in a different
-// currency: a chat needs a model behind it before personalising the chat is
-// worth anything. On cloud the user pays us first; on self-host they connect
-// a plan they already pay for. Same slot, same reason.
+export const NO_PAYWALL_STEPS = {
+ role: 1,
+ painPoints: 2,
+ preparing: 3,
+} as const;
+
+// Self-host has no paywall; it asks for a model at the end instead — link
+// the ChatGPT plan you already pay for — once the profile is in.
export const SELF_HOST_STEPS = {
- connect: 1,
- welcome: 2,
- role: 3,
- painPoints: 4,
- preparing: 5,
+ role: 1,
+ painPoints: 2,
+ connect: 3,
+ preparing: 4,
} as const;
interface OnboardingWizardState {
currentStep: Step;
- name: string;
+ // The numbering in force for this session, set by the page hook once the
+ // flags resolve; steps that need to name another step (the paywall's
+ // Stripe return URLs) read it from here.
+ steps: StepLayout;
role: string;
otherRole: string;
painPoints: string[];
@@ -46,12 +91,15 @@ interface OnboardingWizardState {
selectedBilling: "monthly" | "yearly";
hasUserSelectedBilling: boolean;
selectedCountryCode: string;
+ /** Templates hired from the recommendation step, so a Back/forward trip
+ * through the wizard keeps showing them as hired. */
+ hiredTemplateIds: string[];
/** True while the current step is mid-flight (e.g. the brain dump is
* being processed) — navigation away must be blocked. Transient, never
* persisted. */
isStepBusy: boolean;
setStepBusy(busy: boolean): void;
- setName(name: string): void;
+ setSteps(steps: StepLayout): void;
setRole(role: string): void;
setOtherRole(otherRole: string): void;
togglePainPoint(painPoint: string): void;
@@ -60,6 +108,7 @@ interface OnboardingWizardState {
setSelectedBilling(billing: "monthly" | "yearly"): void;
applyPricingExperimentBilling(billing: "monthly" | "yearly"): void;
setSelectedCountryCode(code: string): void;
+ markHired(templateId: string): void;
nextStep(): void;
prevStep(): void;
goToStep(step: Step): void;
@@ -70,7 +119,7 @@ export const useOnboardingWizardStore = create<OnboardingWizardState>()(
persist(
(set) => ({
currentStep: 1,
- name: "",
+ steps: PAYWALL_FIRST_STEPS,
role: "",
otherRole: "",
painPoints: [],
@@ -79,12 +128,13 @@ export const useOnboardingWizardStore = create<OnboardingWizardState>()(
selectedBilling: "monthly",
hasUserSelectedBilling: false,
selectedCountryCode: "US",
+ hiredTemplateIds: [],
isStepBusy: false,
setStepBusy(busy) {
set({ isStepBusy: busy });
},
- setName(name) {
- set({ name });
+ setSteps(steps) {
+ set({ steps });
},
setRole(role) {
set({ role });
@@ -121,9 +171,16 @@ export const useOnboardingWizardStore = create<OnboardingWizardState>()(
setSelectedCountryCode(code) {
set({ selectedCountryCode: code });
},
+ markHired(templateId) {
+ set((state) =>
+ state.hiredTemplateIds.includes(templateId)
+ ? state
+ : { hiredTemplateIds: [...state.hiredTemplateIds, templateId] },
+ );
+ },
nextStep() {
set((state) => ({
- currentStep: Math.min(5, state.currentStep + 1) as Step,
+ currentStep: Math.min(MAX_STEP, state.currentStep + 1) as Step,
}));
},
prevStep() {
@@ -137,7 +194,6 @@ export const useOnboardingWizardStore = create<OnboardingWizardState>()(
reset() {
set({
currentStep: 1,
- name: "",
role: "",
otherRole: "",
painPoints: [],
@@ -146,6 +202,7 @@ export const useOnboardingWizardStore = create<OnboardingWizardState>()(
selectedBilling: "monthly",
hasUserSelectedBilling: false,
selectedCountryCode: "US",
+ hiredTemplateIds: [],
});
},
}),
@@ -171,7 +228,6 @@ export const useOnboardingWizardStore = create<OnboardingWizardState>()(
// in-memory state anyway, so persisting it serves no purpose and
// would resurface a stale "selected" plan after cancel-and-return.
partialize: (state) => ({
- name: state.name,
role: state.role,
otherRole: state.otherRole,
painPoints: state.painPoints,
@@ -179,6 +235,7 @@ export const useOnboardingWizardStore = create<OnboardingWizardState>()(
selectedBilling: state.selectedBilling,
hasUserSelectedBilling: state.hasUserSelectedBilling,
selectedCountryCode: state.selectedCountryCode,
+ hiredTemplateIds: state.hiredTemplateIds,
}),
},
),
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/tracking.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/tracking.ts
index e3e75d6dc7..2e4f8b5e30 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/tracking.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/tracking.ts
@@ -1,36 +1,35 @@
import { analytics } from "@/services/analytics";
-import type { Step } from "./store";
+import type { StepLayout } from "./store";
export type OnboardingStepKey =
- | "welcome"
+ | "team"
+ | "autopilot"
| "role"
| "pain_points"
+ | "connect"
+ | "hire"
| "preparing";
const SENT_KEY_PREFIX = "onboarding_step_sent_";
-interface StepLayout {
- welcome: number;
- role: number;
- painPoints: number;
- preparing: number;
-}
-
/**
* Maps a wizard step number to a stable key.
*
- * Step numbers differ between the paywall-first and no-paywall layouts, so the
- * number alone is meaningless across cohorts — Welcome is 2 for one and 1 for
- * the other. Keying by name keeps a single funnel readable for both. The
- * subscription step returns null: it is reported as `paywall_view` instead.
+ * Step numbers differ between layouts, so the number alone is meaningless
+ * across cohorts — Preparing is 4 without a paywall and 5 with one. Keying by
+ * name keeps a single funnel readable for all. The subscription step returns
+ * null: it is reported as `paywall_view` instead.
*/
export function onboardingStepKey(
steps: StepLayout,
- step: Step,
+ step: number,
): OnboardingStepKey | null {
- if (step === steps.welcome) return "welcome";
+ if (step === steps.team) return "team";
+ if (step === steps.autopilot) return "autopilot";
if (step === steps.role) return "role";
if (step === steps.painPoints) return "pain_points";
+ if (step === steps.connect) return "connect";
+ if (step === steps.hire) return "hire";
if (step === steps.preparing) return "preparing";
return null;
}
@@ -38,7 +37,7 @@ export function onboardingStepKey(
/**
* Reports that the user reached a wizard step, at most once per tab.
*
- * The wizard's five steps share the `/onboarding` URL and the backend records
+ * The wizard's steps share the `/onboarding` URL and the backend records
* only ONBOARDING_COMPLETE, so without this nothing distinguishes "abandoned on
* Role" from "abandoned on Preparing" — the drop between signup and copilot is
* a single opaque number.
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/useOnboardingPage.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/useOnboardingPage.ts
index 690d4a7fef..3ea72f8c76 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/useOnboardingPage.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/useOnboardingPage.ts
@@ -14,14 +14,8 @@ import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
import { useLDClient } from "launchdarkly-react-client-sdk";
import { useRouter, useSearchParams } from "next/navigation";
import { useEffect, useRef, useState } from "react";
-import { normalizeOnboardingProfile } from "./helpers";
-import {
- NO_PAYWALL_STEPS,
- PAYWALL_FIRST_STEPS,
- SELF_HOST_STEPS,
- Step,
- useOnboardingWizardStore,
-} from "./store";
+import { accountDisplayName, normalizeOnboardingProfile } from "./helpers";
+import { buildStepLayout, Step, useOnboardingWizardStore } from "./store";
import { onboardingStepKey, trackOnboardingStep } from "./tracking";
const LD_INIT_TIMEOUT_SECONDS = 5;
@@ -59,10 +53,11 @@ function clearHighestStep() {
export function useOnboardingPage() {
const router = useRouter();
const searchParams = useSearchParams();
- const { isLoggedIn, isUserLoading, refreshSession, user } = useAuth();
+ const { isLoggedIn, isUserLoading, user } = useAuth();
const trialConfirmation = useTrialCheckoutReturn();
const currentStep = useOnboardingWizardStore((s) => s.currentStep);
const goToStep = useOnboardingWizardStore((s) => s.goToStep);
+ const setSteps = useOnboardingWizardStore((s) => s.setSteps);
// Wait for LaunchDarkly before initialising the wizard from the URL.
// Without this, the init effect runs against the default flag value
@@ -108,6 +103,19 @@ export function useOnboardingPage() {
}
const isBrainDumpEnabled = brainDumpEnabledSnapshot.current ?? false;
+ // Child of HIRE_EXPERTS: adds the two intro steps up front and makes the
+ // preparing screen wait on the team job. Snapshotted like the others so the
+ // numbering can't shift under a user mid-wizard.
+ const isExpertTeamFlagOn = useGetFlag(Flag.ONBOARDING_EXPERT_TEAM);
+ const isHireExpertsFlagOn = useGetFlag(Flag.HIRE_EXPERTS);
+ const expertTeamSnapshot = useRef<boolean | null>(null);
+ if (expertTeamSnapshot.current === null && areFlagsReady) {
+ expertTeamSnapshot.current = Boolean(
+ isExpertTeamFlagOn && isHireExpertsFlagOn,
+ );
+ }
+ const isExpertTeamEnabled = expertTeamSnapshot.current ?? false;
+
// Skip the paywall for users already on a paid tier (admin grants or
// pre-ONBOARDING_COMPLETE accounts) so they aren't asked to pay again to escape.
const { data: tier, isLoading: isTierLoading } = useGetSubscriptionStatus({
@@ -129,13 +137,18 @@ export function useOnboardingPage() {
// mutually exclusive in practice; the check is ordered anyway so a
// deployment that somehow had both still only inserts one first step.
const isSelfHostConnectEnabled = !isPaymentEnabled && environment.isLocal();
- const steps = isPaymentEnabled
- ? PAYWALL_FIRST_STEPS
- : isSelfHostConnectEnabled
- ? SELF_HOST_STEPS
- : NO_PAYWALL_STEPS;
- const preparingStep: Step = steps.preparing;
- const totalSteps = isPaymentEnabled || isSelfHostConnectEnabled ? 4 : 3;
+ // The recommendations are read off the brain dump, and the endpoint that
+ // serves them lives behind the same flag — no dump, no hire step.
+ const isHireStepEnabled = isExpertTeamEnabled && isBrainDumpEnabled;
+ const steps = buildStepLayout({
+ hasIntro: isExpertTeamEnabled,
+ hasHire: isHireStepEnabled,
+ hasPaywall: isPaymentEnabled,
+ hasConnect: isSelfHostConnectEnabled,
+ });
+ const preparingStep = steps.preparing as Step;
+ // Every step before Preparing is one the user acts on and gets a dot for.
+ const totalSteps = steps.preparing - 1;
// Wait for auth too — without !isUserLoading, LD can resolve while
// isLoggedIn is transiently false, the tier query stays disabled
@@ -166,17 +179,18 @@ export function useOnboardingPage() {
if (!isReady || hasInitialized.current) return;
hasInitialized.current = true;
const urlStep = parseStepParam(searchParams.get("step"), preparingStep);
- // The paywall is the first step, so a successful Stripe checkout return is
- // a trusted intent to advance past it onto Welcome and start the actual
- // onboarding — without this, the highestStep ceiling (capped at the
- // subscription step before redirect) would clamp the user back onto the
- // paywall they just paid through.
+ // The paywall is the first step, so a successful Stripe checkout return
+ // is a trusted intent to advance past it onto the step after it and start
+ // the actual onboarding — without this, the highestStep ceiling (capped
+ // at the subscription step before redirect) would clamp the user back
+ // onto the paywall they just paid through.
const isSubscriptionSuccess =
searchParams.get("subscription") === "success" ||
trialConfirmation.active;
- const ceiling = isSubscriptionSuccess
- ? steps.welcome
- : (Math.min(readHighestStep(), preparingStep) as Step);
+ const ceiling =
+ isSubscriptionSuccess && steps.subscription !== undefined
+ ? (Math.min(steps.subscription + 1, preparingStep) as Step)
+ : (Math.min(readHighestStep(), preparingStep) as Step);
const target = (
urlStep === null ? ceiling : Math.min(urlStep, ceiling)
) as Step;
@@ -187,10 +201,31 @@ export function useOnboardingPage() {
searchParams,
goToStep,
preparingStep,
- steps,
+ steps.subscription,
trialConfirmation.active,
]);
+ // Publish the numbering so steps that must name another step (the
+ // paywall's Stripe return URLs) agree with the page.
+ useEffect(() => {
+ if (!isReady) return;
+ setSteps(
+ buildStepLayout({
+ hasIntro: isExpertTeamEnabled,
+ hasHire: isHireStepEnabled,
+ hasPaywall: isPaymentEnabled,
+ hasConnect: isSelfHostConnectEnabled,
+ }),
+ );
+ }, [
+ isReady,
+ setSteps,
+ isExpertTeamEnabled,
+ isHireStepEnabled,
+ isPaymentEnabled,
+ isSelfHostConnectEnabled,
+ ]);
+
// Report the step the wizard is actually showing. `isOnboardingStateLoading`
// is the same gate the page renders on — it also covers the window holding
// the ONBOARDING_COMPLETE check that redirects finished users to /copilot —
@@ -198,11 +233,11 @@ export function useOnboardingPage() {
// at Preparing never reports the store's default of Welcome on the way past.
// Repeat visits to a step are dropped by `trackOnboardingStep` itself, so
// going back and forward reports nothing new.
+ const stepKey = onboardingStepKey(steps, currentStep);
useEffect(() => {
if (isOnboardingStateLoading || !isStepSettled) return;
- const key = onboardingStepKey(steps, currentStep);
- if (key) trackOnboardingStep(key);
- }, [isOnboardingStateLoading, isStepSettled, currentStep, steps]);
+ if (stepKey) trackOnboardingStep(stepKey);
+ }, [isOnboardingStateLoading, isStepSettled, stepKey]);
// Sync store → URL when step changes; record the new ceiling.
useEffect(() => {
@@ -246,42 +281,25 @@ export function useOnboardingPage() {
// Submit profile when entering the Preparing step
useEffect(() => {
if (currentStep !== preparingStep || hasSubmitted.current) return;
- hasSubmitted.current = true;
-
- const { name, role, painPoints } = normalizeOnboardingProfile(
+ const { role, painPoints } = normalizeOnboardingProfile(
useOnboardingWizardStore.getState(),
);
+ const userName = accountDisplayName(user);
- // The paywall now runs first (before any profile data is collected), so
- // the profile is only ever submitted here, once, on reaching Preparing.
- // Guard against an empty name so a stray Preparing visit can't blank a
+ // The profile is only ever submitted here, once, on reaching Preparing.
+ // Guard against an empty role so a stray Preparing visit can't blank a
// previously-saved profile.
- const trimmedName = name.trim();
- if (!trimmedName) return;
+ if (!role.trim() || !userName) return;
+ hasSubmitted.current = true;
postV1SubmitOnboardingProfile({
- user_name: trimmedName,
+ user_name: userName,
user_role: role,
pain_points: painPoints,
}).catch(() => {
// Best effort — profile data is non-critical for accessing copilot
});
-
- // Also store the chosen name in auth user_metadata so the copilot
- // greeting (getGreetingName) uses it; refresh the cached session user
- // so the new name shows up right after onboarding without a reload.
- // Goes through the server route because the browser Supabase client has
- // no session (persistSession: false) and can't call auth.updateUser.
- fetch("/api/auth/user", {
- method: "PUT",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ preferred_name: trimmedName }),
- })
- .then((res) => (res.ok ? refreshSession() : undefined))
- .catch(() => {
- // Best effort — the greeting falls back to existing metadata
- });
- }, [currentStep, preparingStep, refreshSession]);
+ }, [currentStep, preparingStep, user]);
async function handlePreparingComplete() {
for (let attempt = 0; attempt < 3; attempt++) {
@@ -314,6 +332,7 @@ export function useOnboardingPage() {
isPaymentEnabled,
isSelfHostConnectEnabled,
isBrainDumpEnabled,
+ isExpertTeamEnabled,
steps,
preparingStep,
totalSteps,
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertHireActions.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertHireActions.tsx
index 08e80400d3..0698cc9732 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertHireActions.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertHireActions.tsx
@@ -2,6 +2,7 @@ import { Expert } from "@/app/api/__generated__/models/expert";
import { Badge } from "@/components/atoms/Badge/Badge";
import { Button } from "@/components/atoms/Button/Button";
import { Icon } from "@/components/atoms/Icon/Icon";
+import { markHireStarted } from "@/services/experts/hire-timing";
import { CheckmarkCircle02Icon } from "@hugeicons/core-free-icons";
// Sized and shaped like the small button beside it so the pair reads as one row.
@@ -64,11 +65,18 @@ export function ExpertHireActions({
);
}
+ // The clock starts on the click, not on the request: the hire flow finishes
+ // in a dialog, and sometimes on another page entirely.
+ function handleHire() {
+ markHireStarted(expert.id);
+ onHire();
+ }
+
return (
<Button
variant="primary"
size="small"
- onClick={onHire}
+ onClick={handleHire}
loading={isHiring}
className="w-full sm:w-auto"
>
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPage.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPage.tsx
index d74cc7741d..71d3004f9a 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPage.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPage.tsx
@@ -17,7 +17,7 @@ import { ExpertPageHeader } from "./ExpertPageHeader";
import { ExpertSkills } from "./ExpertSkills";
import { ExpertWorkflowList } from "./ExpertWorkflowList";
import { useExpertPage } from "../useExpertPage";
-import { useHireFlow } from "../useHireFlow";
+import { useHireFlow } from "@/services/experts/useHireFlow";
const MAIN_CLASS =
"mx-auto flex w-full max-w-[760px] flex-col px-6 pb-24 pt-8 md:px-8";
@@ -49,6 +49,7 @@ export function ExpertPage() {
const {
hire,
isHiring,
+ isVoicePickOpen,
hireResult,
pickVoice,
skipVoice,
@@ -131,14 +132,14 @@ export function ExpertPage() {
<Dialog
styling={{ width: "640px" }}
controlled={{
- isOpen: hireResult !== null,
+ isOpen: isVoicePickOpen,
set: (open) => {
if (!open) dismissVoicePick();
},
}}
>
<Dialog.Content>
- {hireResult ? (
+ {isVoicePickOpen && hireResult ? (
<VoicePicker
name={hireResult.expert.name}
samples={expert.voice_samples ?? []}
diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/role-prefill.test.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/role-prefill.test.tsx
new file mode 100644
index 0000000000..dc0418abb3
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/role-prefill.test.tsx
@@ -0,0 +1,111 @@
+import { render, screen } from "@/tests/integrations/test-utils";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { draftWithPrefilledRole, EMPTY_DRAFT, saveDraft } from "../helpers";
+import RaisePage from "../page";
+
+const { searchParams } = vi.hoisted(() => ({
+ searchParams: { current: new URLSearchParams() },
+}));
+
+vi.mock("@/services/feature-flags/use-get-flag", async (importActual) => {
+ const actual =
+ await importActual<
+ typeof import("@/services/feature-flags/use-get-flag")
+ >();
+ return {
+ ...actual,
+ useFlagStatus: (flag: string) =>
+ flag === "hire-experts"
+ ? { enabled: true, ready: true }
+ : actual.useFlagStatus(flag as never),
+ };
+});
+
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ isLoggedIn: true, user: { id: "user-1" } }),
+}));
+
+vi.mock("next/navigation", () => ({
+ useRouter: () => ({ push: vi.fn() }),
+ usePathname: () => "/raise",
+ useSearchParams: () => searchParams.current,
+ useParams: () => ({}),
+ notFound: () => {
+ throw new Error("NEXT_NOT_FOUND");
+ },
+}));
+
+// The conversation types its questions in; reduced motion reveals each
+// beat immediately so the name step is queryable.
+function mockReducedMotion() {
+ vi.spyOn(window, "matchMedia").mockImplementation(
+ (query) =>
+ ({
+ matches: query.includes("prefers-reduced-motion"),
+ media: query,
+ onchange: null,
+ addListener: vi.fn(),
+ removeListener: vi.fn(),
+ addEventListener: vi.fn(),
+ removeEventListener: vi.fn(),
+ dispatchEvent: vi.fn(),
+ }) as unknown as MediaQueryList,
+ );
+}
+
+beforeEach(() => {
+ window.sessionStorage.clear();
+ mockReducedMotion();
+ searchParams.current = new URLSearchParams();
+});
+
+afterEach(() => {
+ vi.clearAllMocks();
+});
+
+describe("/raise?role= — the greeting page's raise door", () => {
+ it("opens on the name question with the role already answered", async () => {
+ searchParams.current = new URLSearchParams("role=support");
+
+ render(<RaisePage />);
+
+ expect(
+ await screen.findByRole(
+ "group",
+ { name: "Suggested names" },
+ { timeout: 5000 },
+ ),
+ ).toBeDefined();
+ // Support's name suggestions, so the role really did land in the draft.
+ expect(screen.getByRole("button", { name: "Remy" })).toBeDefined();
+ });
+
+ it("leaves a draft in progress alone", () => {
+ const inProgress = {
+ ...EMPTY_DRAFT,
+ hasStarted: true,
+ role: "marketer",
+ name: "Nova",
+ step: "color" as const,
+ };
+ saveDraft(inProgress);
+
+ expect(draftWithPrefilledRole(inProgress, "support")).toEqual(inProgress);
+ });
+
+ it("ignores a role the wizard cannot use", () => {
+ expect(draftWithPrefilledRole(EMPTY_DRAFT, "")).toEqual(EMPTY_DRAFT);
+ expect(draftWithPrefilledRole(EMPTY_DRAFT, "x".repeat(101))).toEqual(
+ EMPTY_DRAFT,
+ );
+ });
+
+ it("keeps a free-text role the wizard would have accepted by hand", () => {
+ expect(draftWithPrefilledRole(EMPTY_DRAFT, " Chief of staff ")).toEqual({
+ ...EMPTY_DRAFT,
+ hasStarted: true,
+ role: "Chief of staff",
+ step: "name",
+ });
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/raise/helpers.ts
index 1f0614186b..ee50fb0947 100644
--- a/autogpt_platform/frontend/src/app/(platform)/raise/helpers.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/raise/helpers.ts
@@ -4,6 +4,11 @@ import {
buildVoicePreferences,
type VoicePickResult,
} from "@/components/organisms/VoicePicker/helpers";
+import {
+ findRoleOption,
+ isValidCustomRole,
+ normalizeCustomRole,
+} from "./components/RoleStep/helpers";
export type RaiseStep =
| "role"
@@ -178,6 +183,32 @@ export function assembledKit(draft: RaiseDraft): RaiseKit | null {
};
}
+/** Every field still at its initial value — an untouched wizard, safe to
+ * seed from a link without overwriting work in progress. */
+export function isEmptyDraft(draft: RaiseDraft): boolean {
+ return (Object.keys(EMPTY_DRAFT) as (keyof RaiseDraft)[]).every(
+ (key) => draft[key] === EMPTY_DRAFT[key],
+ );
+}
+
+/** `/raise?role=…` from the greeting page's raise door: answers the role
+ * beat exactly as `pickRole` would, so the flow opens on the name
+ * question instead of asking again for something already chosen. */
+export function draftWithPrefilledRole(
+ draft: RaiseDraft,
+ role: string | null,
+): RaiseDraft {
+ if (!role || !isEmptyDraft(draft)) return draft;
+ const preset = findRoleOption(role);
+ if (!preset && !isValidCustomRole(role)) return draft;
+ return {
+ ...draft,
+ hasStarted: true,
+ role: preset ? preset.id : normalizeCustomRole(role),
+ step: "name",
+ };
+}
+
export function previousStep(step: RaiseStep): RaiseStep {
const index = STEP_ORDER.indexOf(step);
return STEP_ORDER[Math.max(index - 1, 0)];
diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/useRaisePage.ts b/autogpt_platform/frontend/src/app/(platform)/raise/useRaisePage.ts
index a8d7f763ab..ad505b7fde 100644
--- a/autogpt_platform/frontend/src/app/(platform)/raise/useRaisePage.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/raise/useRaisePage.ts
@@ -1,4 +1,5 @@
import type { VoicePickResult } from "@/components/organisms/VoicePicker/helpers";
+import { useSearchParams } from "next/navigation";
import { useState } from "react";
import {
beatTriggers,
@@ -10,6 +11,7 @@ import {
import {
assembledKit,
clearDraft,
+ draftWithPrefilledRole,
EMPTY_DRAFT,
loadDraft,
resolveVoicePreferences,
@@ -25,7 +27,12 @@ import { useFlowProgress } from "./useFlowProgress";
import { useRaiseSubmission } from "./useRaiseSubmission";
export function useRaisePage() {
- const [draft, setDraft] = useState<RaiseDraft>(loadDraft);
+ const searchParams = useSearchParams();
+ // Seeded in the initialiser rather than an effect: an effect would render
+ // the role question first and then snatch it away.
+ const [draft, setDraft] = useState<RaiseDraft>(() =>
+ draftWithPrefilledRole(loadDraft(), searchParams.get("role")),
+ );
const progress = useFlowProgress(beatTriggers(draft));
const { finish: submitRaise, isSubmitting } = useRaiseSubmission();
diff --git a/autogpt_platform/frontend/src/components/organisms/VoicePicker/VoicePicker.tsx b/autogpt_platform/frontend/src/components/organisms/VoicePicker/VoicePicker.tsx
index ab73d700c7..5f19c9cf1a 100644
--- a/autogpt_platform/frontend/src/components/organisms/VoicePicker/VoicePicker.tsx
+++ b/autogpt_platform/frontend/src/components/organisms/VoicePicker/VoicePicker.tsx
@@ -2,14 +2,15 @@
import type { VoiceSample } from "@/app/api/__generated__/models/voiceSample";
import { Button } from "@/components/atoms/Button/Button";
+import { cn } from "@/lib/utils";
import { useId } from "react";
import { CustomVoiceOption } from "./components/CustomVoiceOption";
import { SampleCard } from "./components/SampleCard";
import type { VoicePickResult } from "./helpers";
-import type { SelectableCardColors } from "./styles";
+import type { SelectableCardColors } from "./helpers";
import { useVoicePicker } from "./useVoicePicker";
-type Props = {
+interface Props {
name?: string;
samples: VoiceSample[];
onPick: (result: VoicePickResult) => void;
@@ -21,7 +22,9 @@ type Props = {
labelClassName?: string;
// Overrides the card's selected/hover/focus treatment to match that colour.
cardColors?: SelectableCardColors;
-};
+ // Dense layout for a small dialog: tighter spacing, smaller type.
+ compact?: boolean;
+}
export function VoicePicker({
name,
@@ -32,6 +35,7 @@ export function VoicePicker({
hideHeader = false,
labelClassName,
cardColors,
+ compact = false,
}: Props) {
const choiceGroupName = useId();
const customTextareaId = useId();
@@ -46,22 +50,34 @@ export function VoicePicker({
} = useVoicePicker({ onPick });
return (
- <div className="flex flex-col gap-6">
+ <div className={cn("flex flex-col", compact ? "gap-4" : "gap-6")}>
{hideHeader ? null : (
- <header className="flex flex-col gap-1.5">
- <h2 className="text-2xl font-semibold tracking-[-0.02em] text-foreground">
+ <header className={cn("flex flex-col", compact ? "gap-1" : "gap-1.5")}>
+ <h2
+ className={cn(
+ "text-foreground",
+ compact
+ ? "text-base font-medium"
+ : "text-2xl font-semibold tracking-[-0.02em]",
+ )}
+ >
{name
? `How should ${name} write?`
: "How should this expert write?"}
</h2>
- <p className="text-base text-muted-foreground">
+ <p
+ className={cn(
+ "text-muted-foreground",
+ compact ? "text-sm" : "text-base",
+ )}
+ >
Pick the voice that feels right. You can fine-tune it anytime in the
Soul editor.
</p>
</header>
)}
- <fieldset className="flex flex-col gap-3">
+ <fieldset className={cn("flex flex-col", compact ? "gap-2" : "gap-3")}>
<legend className="sr-only">Writing voice</legend>
{samples.slice(0, 2).map((sample, index) => {
const choice = index === 0 ? "a" : "b";
@@ -74,6 +90,7 @@ export function VoicePicker({
isSelected={selected === choice}
labelClassName={labelClassName}
colors={cardColors}
+ compact={compact}
onSelect={() => selectSample(choice)}
/>
);
@@ -86,17 +103,24 @@ export function VoicePicker({
isSelected={selected === "custom"}
labelClassName={labelClassName}
colors={cardColors}
+ compact={compact}
onFocus={focusCustom}
onChange={changeCustom}
/>
</fieldset>
<footer className="flex items-center justify-between gap-3">
- <Button variant="ghost" onClick={onSkip} disabled={isSubmitting}>
+ <Button
+ variant="ghost"
+ size={compact ? "small" : undefined}
+ onClick={onSkip}
+ disabled={isSubmitting}
+ >
Skip for now
</Button>
<Button
variant="primary"
+ size={compact ? "small" : undefined}
onClick={submit}
disabled={!canSubmit}
loading={isSubmitting}
diff --git a/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/CustomVoiceOption.tsx b/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/CustomVoiceOption.tsx
index c0f372a277..4609ef7b1a 100644
--- a/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/CustomVoiceOption.tsx
+++ b/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/CustomVoiceOption.tsx
@@ -1,19 +1,20 @@
import { cn } from "@/lib/utils";
-import { selectableCardClassName, type SelectableCardColors } from "../styles";
+import { selectableCardClassName, type SelectableCardColors } from "../helpers";
const MAX_CUSTOM_VOICE_SAMPLE_CHARACTERS = 2_000;
const CUSTOM_VOICE_TEXTAREA_ROWS = 3;
-type Props = {
+interface Props {
choiceGroupName: string;
textareaId: string;
customText: string;
isSelected: boolean;
labelClassName?: string;
colors?: SelectableCardColors;
+ compact?: boolean;
onFocus: () => void;
onChange: (value: string) => void;
-};
+}
export function CustomVoiceOption({
choiceGroupName,
@@ -22,13 +23,16 @@ export function CustomVoiceOption({
isSelected,
labelClassName,
colors,
+ compact = false,
onFocus,
onChange,
}: Props) {
const characterCountId = `${textareaId}-character-count`;
return (
- <div className={selectableCardClassName(isSelected, false, colors)}>
+ <div
+ className={selectableCardClassName(isSelected, false, colors, compact)}
+ >
<label
htmlFor={`${textareaId}-choice`}
className={cn(
@@ -55,12 +59,13 @@ export function CustomVoiceOption({
value={customText}
onFocus={onFocus}
onChange={(event) => onChange(event.target.value)}
- rows={CUSTOM_VOICE_TEXTAREA_ROWS}
+ rows={compact ? 2 : CUSTOM_VOICE_TEXTAREA_ROWS}
maxLength={MAX_CUSTOM_VOICE_SAMPLE_CHARACTERS}
aria-describedby={characterCountId}
placeholder="Paste a few sentences written the way you'd like this expert to sound."
className={cn(
- "w-full resize-none rounded-xl border bg-background px-4 py-2.5 text-sm leading-relaxed text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",
+ "w-full resize-none border bg-background text-sm leading-relaxed text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",
+ compact ? "rounded-md px-3 py-2" : "rounded-xl px-4 py-2.5",
isSelected ? "border-ring" : "border-input focus:border-ring",
)}
/>
diff --git a/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/SampleCard.tsx b/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/SampleCard.tsx
index 8702aa47ac..73fd697aab 100644
--- a/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/SampleCard.tsx
+++ b/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/SampleCard.tsx
@@ -2,17 +2,18 @@ import type { VoiceSample } from "@/app/api/__generated__/models/voiceSample";
import { Icon } from "@/components/atoms/Icon/Icon";
import { cn } from "@/lib/utils";
import { CheckmarkCircle02Icon } from "@hugeicons/core-free-icons";
-import { selectableCardClassName, type SelectableCardColors } from "../styles";
+import { selectableCardClassName, type SelectableCardColors } from "../helpers";
-type Props = {
+interface Props {
sample: VoiceSample;
choice: "a" | "b";
choiceGroupName: string;
isSelected: boolean;
labelClassName?: string;
colors?: SelectableCardColors;
+ compact?: boolean;
onSelect: () => void;
-};
+}
export function SampleCard({
sample,
@@ -21,13 +22,14 @@ export function SampleCard({
isSelected,
labelClassName,
colors,
+ compact = false,
onSelect,
}: Props) {
return (
<label
className={cn(
"block w-full text-left",
- selectableCardClassName(isSelected, true, colors),
+ selectableCardClassName(isSelected, true, colors, compact),
)}
>
<input
@@ -39,7 +41,12 @@ export function SampleCard({
aria-label={sample.label}
className="sr-only"
/>
- <div className="mb-2 flex items-center justify-between gap-3">
+ <div
+ className={cn(
+ "flex items-center justify-between gap-3",
+ compact ? "mb-1" : "mb-2",
+ )}
+ >
<span
className={cn(
"text-xs font-semibold uppercase tracking-[0.12em]",
@@ -56,7 +63,14 @@ export function SampleCard({
/>
) : null}
</div>
- <p className="whitespace-pre-line text-[15px] leading-relaxed text-muted-foreground">
+ <p
+ className={cn(
+ "whitespace-pre-line text-muted-foreground",
+ compact
+ ? "line-clamp-3 text-sm leading-normal"
+ : "text-[15px] leading-relaxed",
+ )}
+ >
{sample.text}
</p>
</label>
diff --git a/autogpt_platform/frontend/src/components/organisms/VoicePicker/helpers.ts b/autogpt_platform/frontend/src/components/organisms/VoicePicker/helpers.ts
index 445f32b629..98ec39c8fb 100644
--- a/autogpt_platform/frontend/src/components/organisms/VoicePicker/helpers.ts
+++ b/autogpt_platform/frontend/src/components/organisms/VoicePicker/helpers.ts
@@ -28,3 +28,39 @@ export function buildVoicePreferences(
if (!sample) return null;
return `Preferred writing style: ${sample.label}.\n\nExample to match:\n\n${sample.text}`;
}
+
+import { cn } from "@/lib/utils";
+
+const SELECTABLE_CARD_CLASS_NAME =
+ "border border-border bg-background transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring";
+const CARD_DENSITY = {
+ regular: "rounded-2xl p-5",
+ compact: "rounded-lg p-3",
+};
+
+export interface SelectableCardColors {
+ /** Border, fill and ring once the option is chosen. */
+ selected?: string;
+ /** Hover border and focus ring; defaults lean on neutral tokens. */
+ interactive?: string;
+}
+
+export function selectableCardClassName(
+ isSelected: boolean,
+ interactive = false,
+ colors: SelectableCardColors = {},
+ compact = false,
+) {
+ return cn(
+ SELECTABLE_CARD_CLASS_NAME,
+ compact ? CARD_DENSITY.compact : CARD_DENSITY.regular,
+ colors.interactive ?? "focus-within:ring-ring",
+ isSelected
+ ? (colors.selected ?? "border-accent bg-accent/5 ring-2 ring-accent/20")
+ : interactive &&
+ cn(
+ "cursor-pointer",
+ colors.interactive ? null : "hover:border-foreground/30",
+ ),
+ );
+}
diff --git a/autogpt_platform/frontend/src/components/organisms/VoicePicker/styles.ts b/autogpt_platform/frontend/src/components/organisms/VoicePicker/styles.ts
deleted file mode 100644
index b23bffb91d..0000000000
--- a/autogpt_platform/frontend/src/components/organisms/VoicePicker/styles.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { cn } from "@/lib/utils";
-
-const SELECTABLE_CARD_CLASS_NAME =
- "rounded-2xl border border-border bg-background p-5 transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring";
-
-export interface SelectableCardColors {
- /** Border, fill and ring once the option is chosen. */
- selected?: string;
- /** Hover border and focus ring; defaults lean on neutral tokens. */
- interactive?: string;
-}
-
-export function selectableCardClassName(
- isSelected: boolean,
- interactive = false,
- colors: SelectableCardColors = {},
-) {
- return cn(
- SELECTABLE_CARD_CLASS_NAME,
- colors.interactive ?? "focus-within:ring-ring",
- isSelected
- ? (colors.selected ?? "border-accent bg-accent/5 ring-2 ring-accent/20")
- : interactive &&
- cn(
- "cursor-pointer",
- colors.interactive ? null : "hover:border-foreground/30",
- ),
- );
-}
diff --git a/autogpt_platform/frontend/src/playwright/auth-happy-path.spec.ts b/autogpt_platform/frontend/src/playwright/auth-happy-path.spec.ts
index 29a8338680..3677ee006e 100644
--- a/autogpt_platform/frontend/src/playwright/auth-happy-path.spec.ts
+++ b/autogpt_platform/frontend/src/playwright/auth-happy-path.spec.ts
@@ -4,7 +4,7 @@ import { BuildPage } from "./pages/build.page";
import { LoginPage } from "./pages/login.page";
import {
completeOnboardingWizard,
- dismissConnectStepIfPresent,
+ advanceToRoleStep,
skipOnboardingIfPresent,
} from "./utils/onboarding";
import { signupTestUser } from "./utils/signup";
@@ -16,9 +16,8 @@ test("auth happy path: user can sign up with a fresh account", async ({
await signupTestUser(page, undefined, undefined, false);
await expect(page).toHaveURL(/\/onboarding/);
- // A self-host build opens on the connect step; Welcome is behind it.
- await dismissConnectStepIfPresent(page);
- await expect(page.getByText("Welcome to AutoGPT")).toBeVisible();
+ await advanceToRoleStep(page);
+ await expect(page.getByText("What best describes you")).toBeVisible();
});
test("auth happy path: user can sign up, enter the app, and log out", async ({
@@ -28,9 +27,8 @@ test("auth happy path: user can sign up, enter the app, and log out", async ({
await signupTestUser(page, undefined, undefined, false);
await expect(page).toHaveURL(/\/onboarding/);
- // A self-host build opens on the connect step; Welcome is behind it.
- await dismissConnectStepIfPresent(page);
- await expect(page.getByText("Welcome to AutoGPT")).toBeVisible();
+ await advanceToRoleStep(page);
+ await expect(page.getByText("What best describes you")).toBeVisible();
await skipOnboardingIfPresent(page, "/marketplace");
await expect(page).toHaveURL(/\/marketplace/);
@@ -88,7 +86,6 @@ test("auth happy path: user can complete onboarding and land in the app", async
await expect(page).toHaveURL(/\/onboarding/);
await completeOnboardingWizard(page, {
- name: "Smoke User",
role: "Engineering",
painPoints: ["Research", "Reports & data"],
});
diff --git a/autogpt_platform/frontend/src/playwright/utils/onboarding.ts b/autogpt_platform/frontend/src/playwright/utils/onboarding.ts
index 9c31b6ca76..9cb585110a 100644
--- a/autogpt_platform/frontend/src/playwright/utils/onboarding.ts
+++ b/autogpt_platform/frontend/src/playwright/utils/onboarding.ts
@@ -44,122 +44,78 @@ export async function skipOnboardingIfPresent(
await page.waitForLoadState("domcontentloaded", { timeout: 10000 });
}
-/**
- * Dismiss the self-host connect step if this build shows it.
- *
- * It is the first onboarding screen when payment is off and the deployment is
- * local -- which is exactly how the e2e stack is built -- so on those runs it
- * sits in front of the Welcome step every other assertion starts from. It is
- * genuinely optional: skipping leaves the account on the platform connection,
- * which is what the rest of the wizard expects.
- *
- * Races the two headers rather than waiting on a timeout, so the helper works
- * in both configurations without flaking on a slow render.
- */
-export async function dismissConnectStepIfPresent(page: Page) {
- const connectHeader = page.getByText("Power your agents in one sign-in");
- const welcomeHeader = page.getByText("Welcome to AutoGPT");
-
- const shown = await Promise.race([
- connectHeader
- .waitFor({ state: "visible", timeout: 10000 })
- .then(() => "connect" as const),
- welcomeHeader
- .waitFor({ state: "visible", timeout: 10000 })
- .then(() => "welcome" as const),
- ]);
-
- if (shown !== "connect") return;
-
- // Several different buttons advance past this step. Which one renders
- // depends on whether the account already has a linked plan ("Continue" when
- // it does), and on where in this stack the suite is running -- a later PR
- // renames the opt-out from "Add API keys instead" to "Skip for now". Match
- // by what the button does rather than what this commit happens to call it,
- // so the helper holds at every point in the stack instead of only at the
- // tip.
- const skipButton = page.getByRole("button", {
- name: /^(Skip for now|Add API keys instead|Continue)$/,
+export async function advanceToRoleStep(
+ page: Page,
+ plan: "pro" | "max" = "pro",
+) {
+ const role = page.getByText("What best describes you");
+ const subscription = page.getByText(/choose the plan that.s right/i);
+ const team = page.getByRole("heading", {
+ name: "Your own team of AI experts.",
});
- await skipButton.first().waitFor({ state: "visible", timeout: 15000 });
- await skipButton.first().click();
- await expect(welcomeHeader).toBeVisible({ timeout: 10000 });
+ const autopilot = page.getByRole("heading", {
+ name: "Meet AutoPilot, your Head of AI.",
+ });
+
+ for (let step = 0; step < 4; step++) {
+ await expect(
+ role.or(subscription).or(team).or(autopilot).first(),
+ ).toBeVisible({ timeout: 10000 });
+ if (await role.isVisible()) return;
+ if (await subscription.isVisible()) {
+ await page
+ .getByRole("button", {
+ name: plan === "max" ? "Upgrade to Max" : "Get Pro",
+ })
+ .click();
+ await expect(subscription).toBeHidden({ timeout: 10000 });
+ } else {
+ const current = (await team.isVisible()) ? team : autopilot;
+ await page.getByRole("button", { name: "Next", exact: true }).click();
+ await expect(current).toBeHidden({ timeout: 10000 });
+ }
+ }
+ await expect(role).toBeVisible({ timeout: 10000 });
}
-/**
- * Walk through the onboarding wizard in the browser. The Subscription step
- * is gated behind ENABLE_PLATFORM_PAYMENT and only walked when present.
- * Returns the data that was entered so tests can verify it was submitted.
- */
export async function completeOnboardingWizard(
page: Page,
options?: {
- name?: string;
role?: string;
painPoints?: string[];
plan?: "pro" | "max";
},
) {
- const name = options?.name ?? "TestUser";
const role = options?.role ?? "Engineering";
const painPoints = options?.painPoints ?? ["Research", "Reports & data"];
const plan = options?.plan ?? "pro";
- // Step 0: the self-host connect step, when this build shows it.
- await dismissConnectStepIfPresent(page);
-
- // Step 1: Welcome — enter name
- await expect(page.getByText("Welcome to AutoGPT")).toBeVisible({
- timeout: 10000,
- });
- await page.getByLabel("What should I call you?").fill(name);
- await page.getByRole("button", { name: "Continue" }).click();
-
- // Step 2: Role — select a role (auto-advances after selection)
- await expect(page.getByText("What best describes you")).toBeVisible({
- timeout: 5000,
- });
+ await advanceToRoleStep(page, plan);
await page.getByText(role, { exact: false }).click();
-
- // Step 3: Pain points — select tasks
+ await page.getByRole("button", { name: "Next", exact: true }).click();
await expect(page.getByText("What's eating your time?")).toBeVisible({
timeout: 5000,
});
for (const point of painPoints) {
await page.getByText(point, { exact: true }).click();
}
- await page.getByRole("button", { name: "Continue" }).click();
+ await page.getByRole("button", { name: "Continue", exact: true }).click();
- // Subscription step (only when ENABLE_PLATFORM_PAYMENT is on) — pick a
- // plan to advance. The "Team" CTA opens an external intake form and does
- // not advance, so we don't exercise it here. Race the Subscription header
- // against the Preparing header so the helper works in both flag states
- // without a fixed timeout that flakes under slow renders.
- const subscriptionHeader = page.getByText(/choose the plan that.s right/i);
- const preparingHeader = page.getByText("Preparing your workspace...", {
+ const connect = page.getByRole("heading", {
+ name: "Already paying for an AI subscription?",
+ });
+ const preparing = page.getByText("Preparing your workspace...", {
exact: false,
});
- const nextState = await Promise.race([
- subscriptionHeader
- .waitFor({ state: "visible", timeout: 10000 })
- .then(() => "subscription" as const),
- preparingHeader
- .waitFor({ state: "visible", timeout: 10000 })
- .then(() => "preparing" as const),
- ]);
-
- if (nextState === "subscription") {
- const planCta = plan === "max" ? "Upgrade to Max" : "Get Pro";
- await page.getByRole("button", { name: planCta }).click();
+ await expect(connect.or(preparing).first()).toBeVisible({ timeout: 10000 });
+ if (await connect.isVisible()) {
+ await page.getByRole("button", { name: "Next", exact: true }).click();
}
- // Final step: Preparing — require the real transition state to appear first,
- // then wait for the app shell on /copilot rather than racing the redirect.
- await expect(preparingHeader).toBeVisible({ timeout: 10000 });
+ await expect(preparing).toBeVisible({ timeout: 10000 });
await page.waitForURL(/\/copilot/, { timeout: 30000 });
await expect(page.getByTestId("profile-popout-menu-trigger")).toBeVisible({
timeout: 15000,
});
-
- return { name, role, painPoints, plan };
+ return { role, painPoints, plan };
}
diff --git a/autogpt_platform/frontend/src/services/experts/__tests__/hire-timing.test.ts b/autogpt_platform/frontend/src/services/experts/__tests__/hire-timing.test.ts
new file mode 100644
index 0000000000..b8948e5327
--- /dev/null
+++ b/autogpt_platform/frontend/src/services/experts/__tests__/hire-timing.test.ts
@@ -0,0 +1,53 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { markHireStarted, takeHireElapsedMs } from "../hire-timing";
+
+afterEach(() => {
+ vi.restoreAllMocks();
+ window.sessionStorage.clear();
+});
+
+describe("hire timing", () => {
+ it("reports the span between the hire click and the finish", () => {
+ vi.spyOn(Date, "now").mockReturnValue(1_000);
+ markHireStarted("template-maria");
+
+ vi.spyOn(Date, "now").mockReturnValue(4_500);
+ expect(takeHireElapsedMs("template-maria")).toBe(3_500);
+ });
+
+ it("stores the mark per template", () => {
+ markHireStarted("template-maria");
+
+ expect(takeHireElapsedMs("template-max")).toBeNull();
+ expect(takeHireElapsedMs("template-maria")).not.toBeNull();
+ });
+
+ it("clears the mark so a second finish cannot report a stale span", () => {
+ markHireStarted("template-maria");
+
+ expect(takeHireElapsedMs("template-maria")).not.toBeNull();
+ expect(takeHireElapsedMs("template-maria")).toBeNull();
+ });
+
+ it("returns null when the flow was never started", () => {
+ expect(takeHireElapsedMs("template-never")).toBeNull();
+ });
+
+ it("ignores a corrupted mark", () => {
+ window.sessionStorage.setItem("autogpt:hire-started:template-maria", "abc");
+
+ expect(takeHireElapsedMs("template-maria")).toBeNull();
+ });
+
+ it("survives a storage that refuses reads and writes", () => {
+ vi.spyOn(window.sessionStorage, "setItem").mockImplementation(() => {
+ throw new Error("blocked");
+ });
+ vi.spyOn(window.sessionStorage, "getItem").mockImplementation(() => {
+ throw new Error("blocked");
+ });
+
+ expect(() => markHireStarted("template-maria")).not.toThrow();
+ expect(takeHireElapsedMs("template-maria")).toBeNull();
+ });
+});
diff --git a/autogpt_platform/frontend/src/services/experts/__tests__/useHireFlow.test.tsx b/autogpt_platform/frontend/src/services/experts/__tests__/useHireFlow.test.tsx
new file mode 100644
index 0000000000..e572f02db0
--- /dev/null
+++ b/autogpt_platform/frontend/src/services/experts/__tests__/useHireFlow.test.tsx
@@ -0,0 +1,235 @@
+import {
+ getHireExpertMockHandler,
+ getUpdateExpertSoulMockHandler,
+} from "@/app/api/__generated__/endpoints/experts/experts.msw";
+import type { Expert } from "@/app/api/__generated__/models/expert";
+import { Toaster } from "@/components/molecules/Toast/toaster";
+import { server } from "@/mocks/mock-server";
+import { markHireStarted } from "@/services/experts/hire-timing";
+import { useHireFlow } from "@/services/experts/useHireFlow";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { act, renderHook, screen, waitFor } from "@testing-library/react";
+import { HttpResponse, http } from "msw";
+import { type ReactNode, useState } from "react";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+
+const captureMock = vi.hoisted(() => vi.fn());
+const pushMock = vi.hoisted(() => vi.fn());
+
+vi.mock("posthog-js", () => ({ default: { capture: captureMock } }));
+
+vi.mock("next/navigation", () => ({
+ useRouter: () => ({
+ push: pushMock,
+ replace: vi.fn(),
+ prefetch: vi.fn(),
+ back: vi.fn(),
+ forward: vi.fn(),
+ refresh: vi.fn(),
+ }),
+ usePathname: () => "/marketplace",
+ useSearchParams: () => new URLSearchParams(),
+ useParams: () => ({}),
+}));
+
+const mariaTemplate: Expert = {
+ id: "template-maria",
+ name: "Maria",
+ avatar_url: null,
+ role: "Marketing Strategist",
+ bio: "A senior marketing strategist.",
+ skills: [],
+ tagline: "Grows your brand while you sleep",
+ identity: "You are Maria, a senior marketing strategist.",
+ voice_preferences: "Warm, concise, and direct.",
+ boundaries: "Never invent customer evidence.",
+ protected_soul_rules: [],
+ is_template: true,
+ source_template_id: null,
+ is_archived: false,
+ workflows: [],
+ voice_samples: [
+ { label: "Punchy and bold", text: "Stop guessing what your buyers want." },
+ {
+ label: "Warm and story-led",
+ text: "Every campaign starts with a person.",
+ },
+ ],
+};
+
+const hiredMaria: Expert = {
+ ...mariaTemplate,
+ id: "expert-maria",
+ is_template: false,
+ source_template_id: "template-maria",
+};
+
+interface Props {
+ children: ReactNode;
+}
+
+function Wrapper({ children }: Props) {
+ const [queryClient] = useState(
+ () =>
+ new QueryClient({
+ defaultOptions: {
+ queries: { retry: false },
+ mutations: { retry: false },
+ },
+ }),
+ );
+ return (
+ <QueryClientProvider client={queryClient}>
+ {children}
+ <Toaster />
+ </QueryClientProvider>
+ );
+}
+
+function renderHireFlow(expert: Expert = mariaTemplate) {
+ return renderHook(() => useHireFlow(expert), { wrapper: Wrapper });
+}
+
+function capturedEvent(name: string) {
+ return captureMock.mock.calls.find((call) => call[0] === name);
+}
+
+afterEach(() => {
+ vi.useRealTimers();
+});
+
+describe("useHireFlow", () => {
+ beforeEach(() => {
+ captureMock.mockReset();
+ pushMock.mockReset();
+ window.sessionStorage.clear();
+ server.use(
+ getHireExpertMockHandler({ expert: hiredMaria, failed_preloads: [] }),
+ getUpdateExpertSoulMockHandler(hiredMaria),
+ );
+ });
+
+ test("walks hire → voice pick → saved voice and hands off to the thread", async () => {
+ vi.useFakeTimers({ toFake: ["Date"] });
+ markHireStarted("template-maria");
+ vi.advanceTimersByTime(1500);
+ const { result } = renderHireFlow();
+
+ await act(async () => {
+ await result.current.hire();
+ });
+ expect(result.current.isVoicePickOpen).toBe(true);
+ expect(result.current.hireResult?.expert.id).toBe("expert-maria");
+
+ await act(async () => {
+ await result.current.pickVoice({ choice: "a" });
+ });
+
+ expect(result.current.isVoicePickOpen).toBe(false);
+ expect(pushMock).toHaveBeenCalledWith(
+ "/copilot?expertId=expert-maria&kickoff=1",
+ );
+ const completed = capturedEvent("hire_flow_completed")?.[1] as {
+ voice_picked: boolean;
+ elapsed_ms: number | null;
+ };
+ expect(completed.voice_picked).toBe(true);
+ expect(completed.elapsed_ms).toBeGreaterThanOrEqual(1500);
+ // The mark is consumed, so a second finish cannot report a stale span.
+ expect(
+ window.sessionStorage.getItem("autogpt:hire-started:template-maria"),
+ ).toBeNull();
+ vi.useRealTimers();
+ });
+
+ test("skipping the voice pick still celebrates the hire", async () => {
+ const { result } = renderHireFlow();
+
+ await act(async () => {
+ await result.current.hire();
+ });
+ await act(async () => {
+ result.current.skipVoice();
+ });
+
+ expect(result.current.isVoicePickOpen).toBe(false);
+ expect(pushMock).toHaveBeenCalledWith(
+ "/copilot?expertId=expert-maria&kickoff=1",
+ );
+ expect(capturedEvent("hire_flow_completed")?.[1]).toMatchObject({
+ voice_picked: false,
+ elapsed_ms: null,
+ });
+ });
+
+ test("finishes straight away when the persona ships no writing samples", async () => {
+ const { result } = renderHireFlow({ ...mariaTemplate, voice_samples: [] });
+
+ await act(async () => {
+ await result.current.hire();
+ });
+
+ expect(result.current.isVoicePickOpen).toBe(false);
+ expect(pushMock).toHaveBeenCalledWith(
+ "/copilot?expertId=expert-maria&kickoff=1",
+ );
+ });
+
+ test("reports a dismissed voice pick as abandoned, and still celebrates", async () => {
+ const { result } = renderHireFlow();
+
+ await act(async () => {
+ await result.current.hire();
+ });
+ await act(async () => {
+ result.current.dismissVoicePick();
+ });
+
+ expect(capturedEvent("hire_flow_abandoned")?.[1]).toMatchObject({
+ template_id: "template-maria",
+ stage: "voice",
+ });
+ expect(pushMock).toHaveBeenCalledWith(
+ "/copilot?expertId=expert-maria&kickoff=1",
+ );
+ });
+
+ test("keeps the picker open when saving the voice fails", async () => {
+ server.use(
+ http.patch("/api/proxy/api/experts/:expertId/soul", () =>
+ HttpResponse.json({ detail: "boom" }, { status: 500 }),
+ ),
+ );
+ const { result } = renderHireFlow();
+
+ await act(async () => {
+ await result.current.hire();
+ });
+ await act(async () => {
+ await result.current.pickVoice({ choice: "a" });
+ });
+
+ expect(await screen.findByText("Couldn't save the voice")).toBeDefined();
+ expect(result.current.isVoicePickOpen).toBe(true);
+ expect(pushMock).not.toHaveBeenCalled();
+ });
+
+ test("says so and stays put when the hire itself fails", async () => {
+ server.use(
+ http.post("/api/proxy/api/experts", () =>
+ HttpResponse.json({ detail: "boom" }, { status: 503 }),
+ ),
+ );
+ const { result } = renderHireFlow();
+
+ await act(async () => {
+ await result.current.hire();
+ });
+
+ await waitFor(() =>
+ expect(screen.getByText("Couldn't hire Maria")).toBeDefined(),
+ );
+ expect(result.current.isVoicePickOpen).toBe(false);
+ expect(pushMock).not.toHaveBeenCalled();
+ });
+});
diff --git a/autogpt_platform/frontend/src/services/experts/experts-analytics.ts b/autogpt_platform/frontend/src/services/experts/experts-analytics.ts
new file mode 100644
index 0000000000..c8728a4bce
--- /dev/null
+++ b/autogpt_platform/frontend/src/services/experts/experts-analytics.ts
@@ -0,0 +1,22 @@
+// Hire-funnel events. The backend `hire_completed` record stays the
+// source-of-truth count; these answer how long the flow took and where people
+// drop out of it. Capture is best-effort — a blocked analytics host must
+// never interrupt a hire.
+
+import posthog from "posthog-js";
+
+type ExpertsEvent =
+ | "hire_started"
+ | "hire_flow_completed"
+ | "hire_flow_abandoned";
+
+export function trackExperts(
+ event: ExpertsEvent,
+ properties?: Record<string, unknown>,
+) {
+ try {
+ posthog.capture(event, properties);
+ } catch {
+ // Analytics is never worth a broken hire.
+ }
+}
diff --git a/autogpt_platform/frontend/src/services/experts/hire-timing.ts b/autogpt_platform/frontend/src/services/experts/hire-timing.ts
new file mode 100644
index 0000000000..1b80c9e874
--- /dev/null
+++ b/autogpt_platform/frontend/src/services/experts/hire-timing.ts
@@ -0,0 +1,41 @@
+// How long a hire actually took, measured from the click that opened the flow
+// to the moment it finishes. sessionStorage rather than component state
+// because the flow can start on the marketplace profile sheet and finish
+// inside the copilot dialog, and the two never share a React tree.
+
+const KEY_PREFIX = "autogpt:hire-started:";
+
+function storage() {
+ if (typeof window === "undefined") return null;
+ try {
+ return window.sessionStorage;
+ } catch {
+ return null;
+ }
+}
+
+export function markHireStarted(templateId: string) {
+ try {
+ storage()?.setItem(`${KEY_PREFIX}${templateId}`, String(Date.now()));
+ } catch {
+ // Private-mode and in-app browsers can refuse writes; a missing timing
+ // is never worth breaking a hire over.
+ }
+}
+
+/** Reads the mark and clears it, so a second finish cannot report a stale span. */
+export function takeHireElapsedMs(templateId: string): number | null {
+ const store = storage();
+ if (!store) return null;
+ const key = `${KEY_PREFIX}${templateId}`;
+ try {
+ const raw = store.getItem(key);
+ store.removeItem(key);
+ if (!raw) return null;
+ const startedAt = Number(raw);
+ if (!Number.isFinite(startedAt)) return null;
+ return Math.max(0, Date.now() - startedAt);
+ } catch {
+ return null;
+ }
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useHireFlow.tsx b/autogpt_platform/frontend/src/services/experts/useHireFlow.tsx
similarity index 83%
rename from autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useHireFlow.tsx
rename to autogpt_platform/frontend/src/services/experts/useHireFlow.tsx
index 53a8bc3c7e..587e06f16f 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useHireFlow.tsx
+++ b/autogpt_platform/frontend/src/services/experts/useHireFlow.tsx
@@ -11,6 +11,8 @@ import {
buildVoicePreferences,
type VoicePickResult,
} from "@/components/organisms/VoicePicker/helpers";
+import { trackExperts } from "@/services/experts/experts-analytics";
+import { takeHireElapsedMs } from "@/services/experts/hire-timing";
import { invalidateExpertRosterQueries } from "@/services/experts/invalidate-experts";
import { useQueryClient } from "@tanstack/react-query";
import { useRouter } from "next/navigation";
@@ -43,10 +45,10 @@ function celebrate(result: HireResult) {
export function useHireFlow(expert: Expert | null) {
const queryClient = useQueryClient();
const router = useRouter();
- // Set once a hire succeeds for a persona with writing samples: it opens
- // the voice pick before the hire is celebrated.
const [hireResult, setHireResult] = useState<HireResult | null>(null);
+ const [isVoicePickOpen, setIsVoicePickOpen] = useState(false);
const pendingCelebrationRef = useRef<HireResult | null>(null);
+ const voicePickedRef = useRef(false);
const { mutateAsync: hireExpert, isPending: isHiring } = useHireExpert();
const { mutateAsync: updateSoul, isPending: isSavingVoice } =
@@ -56,7 +58,14 @@ export function useHireFlow(expert: Expert | null) {
const completedHire = pendingCelebrationRef.current;
pendingCelebrationRef.current = null;
setHireResult(null);
+ setIsVoicePickOpen(false);
if (completedHire) {
+ trackExperts("hire_flow_completed", {
+ template_id: expert?.id ?? null,
+ expert_id: completedHire.expert.id,
+ elapsed_ms: expert ? takeHireElapsedMs(expert.id) : null,
+ voice_picked: voicePickedRef.current,
+ });
celebrate(completedHire);
// Hiring isn't installing: hand the user straight to the expert's
// thread with kickoff=1 so it introduces itself and starts its job.
@@ -66,13 +75,15 @@ export function useHireFlow(expert: Expert | null) {
async function hire() {
if (!expert || !expert.is_template) return;
+ voicePickedRef.current = false;
try {
const response = await hireExpert({ data: { template_id: expert.id } });
const result = response.data as HireResult;
await invalidateExpertRosterQueries(queryClient);
pendingCelebrationRef.current = result;
+ setHireResult(result);
if ((expert.voice_samples ?? []).length > 0) {
- setHireResult(result);
+ setIsVoicePickOpen(true);
return;
}
finish();
@@ -127,16 +138,28 @@ export function useHireFlow(expert: Expert | null) {
});
return;
}
+ voicePickedRef.current = true;
+ finish();
+ }
+
+ function dismiss() {
+ if (isVoicePickOpen) {
+ trackExperts("hire_flow_abandoned", {
+ template_id: expert?.id ?? null,
+ stage: "voice",
+ });
+ }
finish();
}
return {
hire,
isHiring,
+ isVoicePickOpen,
hireResult,
pickVoice,
skipVoice: finish,
- dismissVoicePick: finish,
+ dismissVoicePick: dismiss,
isSavingVoice,
};
}
diff --git a/autogpt_platform/frontend/src/services/onboarding/brain-dump-analytics.ts b/autogpt_platform/frontend/src/services/onboarding/brain-dump-analytics.ts
index ce37d1c97d..f89ca971e5 100644
--- a/autogpt_platform/frontend/src/services/onboarding/brain-dump-analytics.ts
+++ b/autogpt_platform/frontend/src/services/onboarding/brain-dump-analytics.ts
@@ -43,7 +43,20 @@ type BrainDumpEvent =
// prompts rendered beneath it are personalised from the same dump, so
// this covers both a suggestion click and a typed reply.
| "intro_followup_sent"
- | "later_dump_completed";
+ | "later_dump_completed"
+ // The team AutoPilot proposed on the greeting page: one event per card
+ // shown, then the doors out of it — hire, raise your own, talk it
+ // through, or skip straight to the builder.
+ | "expert_recommended"
+ | "expert_recommendation_clicked"
+ | "hire_started"
+ | "raise_door_clicked"
+ | "intro_start_with_autopilot"
+ // The wizard's hire step: a hire that landed from a card, and the step
+ // being left — with how many of the proposed experts were hired, so the
+ // funnel can tell "hired a team" from "skipped past it".
+ | "onboarding_expert_hired"
+ | "hire_step_continued";
export function trackBrainDump(
event: BrainDumpEvent,