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): simplify logged-out sidebar and promote free trial (#15201)
Toran Bruce Richardsf40b2fe95fe2
diff --git a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/PlatformChrome.tsx b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/PlatformChrome.tsxindex c0e5e59c49..c52187b37e 100644--- a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/PlatformChrome.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/PlatformChrome.tsx@@ -54,8 +54,7 @@ export function PlatformChrome({ children }: Props) {</TopUpPromptProvider>);- // Logged-out marketplace visitors browse with the tour demo sidebar as an- // upsell — clicking a demo session takes them into /tour/chat.+ // Logged-out marketplace visitors get public navigation and a trial CTA.if (showTourSidebar) {return (<SidebarProvider style={{ "--sidebar-width": "19rem" } as CSSProperties}>diff --git a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/PlatformChrome.test.tsx b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/PlatformChrome.test.tsxindex ca4a8bc426..99ce0a5221 100644--- a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/PlatformChrome.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/PlatformChrome.test.tsx@@ -1,9 +1,4 @@-import {- fireEvent,- render,- screen,- waitFor,-} from "@/tests/integrations/test-utils";+import { render, screen, waitFor } from "@/tests/integrations/test-utils";import type { ReactNode } from "react";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";@@ -19,23 +14,6 @@ vi.mock("../usePlatformChrome", () => ({}),}));-// Mirrors the global setup-nextjs-mocks shape, but with a stable push spy so-// the tour sidebar's navigation can be asserted.-const { pushMock } = vi.hoisted(() => ({ pushMock: vi.fn() }));-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: () => ({}),-}));-vi.mock("@/components/layout/AppSidebar/AppSidebar", () => ({AppSidebar: () => <div data-testid="app-sidebar" />,}));@@ -59,12 +37,15 @@ vi.mock("../../components/GlobalSearchModal/GlobalSearchOverlay", () => ({afterEach(() => {vi.clearAllMocks();+ vi.unstubAllEnvs();});describe("PlatformChrome", () => {beforeEach(() => {+ vi.stubEnv("NEXT_PUBLIC_BEHAVE_AS", "CLOUD");showNewLayoutMock.mockReturnValue(false);showTourSidebarMock.mockReturnValue(false);+ useTourStore.setState({ isDemoComplete: false });});it("renders the classic Navbar shell when the new layout is off", () => {@@ -94,7 +75,7 @@ describe("PlatformChrome", () => {expect(screen.getByTestId("child")).toBeDefined();});- it("renders the tour upsell sidebar shell when showTourSidebar is on", async () => {+ it("renders a free-trial sidebar without demo chats when logged out", () => {showTourSidebarMock.mockReturnValue(true);render(<PlatformChrome>@@ -102,17 +83,44 @@ describe("PlatformChrome", () => {</PlatformChrome>,);- expect(screen.getByText("Try Otto")).toBeDefined();- expect(screen.getByText(/Ready to build your own/i)).toBeDefined();+ expect(screen.queryByText("Try Otto")).toBeNull();+ expect(screen.queryByText("Recent chats")).toBeNull();+ for (const label of [+ "Daily brief",+ "Call prep",+ "Competitor watch",+ "Support queue",+ ]) {+ expect(screen.queryByRole("button", { name: label })).toBeNull();+ }+ expect(screen.getByText("Your AI team starts here")).toBeDefined();+ const trialCTA = screen.getByRole("link", { name: "Start free trial" });+ expect(trialCTA.getAttribute("href")).toBe("/signup");+ expect(trialCTA.getAttribute("target")).toBeNull();+ expect(+ screen.getByRole("link", { name: "AutoGPT" }).getAttribute("href"),+ ).toBe("/marketplace");+ expect(screen.queryByText(/Start with Pro/i)).toBeNull();+ expect(screen.queryByText(/\$42\.50/)).toBeNull();expect(screen.queryByTestId("navbar")).toBeNull();expect(screen.queryByTestId("app-sidebar")).toBeNull();expect(screen.getByTestId("child")).toBeDefined();+ });++ it("keeps the marketplace free-trial card after a previous tour completes", () => {+ showTourSidebarMock.mockReturnValue(true);+ useTourStore.setState({ isDemoComplete: true });- // Clicking a demo session stores the scenario and navigates to the tour.- fireEvent.click(screen.getByRole("button", { name: "Daily brief" }));- expect(useTourStore.getState().activeScenarioId).toBe("daily-brief");- expect(pushMock).toHaveBeenCalledWith(- "/tour/chat?utm_source=platform_marketplace",+ render(+ <PlatformChrome>+ <div>Marketplace content</div>+ </PlatformChrome>,);++ expect(+ screen+ .getByRole("link", { name: "Start free trial" })+ .getAttribute("href"),+ ).toBe("/signup");});});diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/app-shell.test.tsx b/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/app-shell.test.tsxindex 323d17bfc1..3a91c1d723 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/app-shell.test.tsx+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/app-shell.test.tsx@@ -66,6 +66,7 @@ async function pressEnterToSend() {describe("Tour chat app shell", () => {beforeEach(() => {vi.useFakeTimers();+ vi.stubEnv("NEXT_PUBLIC_BEHAVE_AS", "CLOUD");// Both stores are module-level state — reset between tests.useTourStore.setState({activeScenarioId: DEFAULT_SCENARIO_ID,@@ -80,49 +81,43 @@ describe("Tour chat app shell", () => {afterEach(() => {vi.runOnlyPendingTimers();vi.useRealTimers();+ vi.unstubAllEnvs();});- test("renders the sidebar with scenarios as chat sessions and only Marketplace enabled", () => {+ test("renders a free-trial sidebar without demo chats and only Marketplace enabled", () => {render(<TourChatPage />);- // Scenario pills are replaced by sidebar chat sessions.expect(document.querySelector("[aria-pressed]")).toBeNull();- expect(screen.getByText("Recent chats")).toBeDefined();+ expect(screen.queryByText("Recent chats")).toBeNull();+ expect(screen.queryByText("Try Otto")).toBeNull();for (const label of ["Daily brief","Call prep","Competitor watch","Support queue",]) {- expect(screen.getByRole("button", { name: label })).toBeDefined();+ expect(screen.queryByRole("button", { name: label })).toBeNull();}- // The upsell card is always visible in the sidebar footer.- expect(screen.getByText(/Ready to build your own/i)).toBeDefined();- expect(screen.getByText(/Start with Pro for \$42\.50\/mo/i)).toBeDefined();+ expect(screen.getByText("Your AI team starts here")).toBeDefined();+ const trialCTA = screen.getByRole("link", { name: "Start free trial" });+ expect(trialCTA.getAttribute("href")).toBe("/signup");+ expect(trialCTA.getAttribute("target")).toBeNull();+ expect(screen.queryByText(/Start with Pro/i)).toBeNull();+ expect(screen.queryByText(/\$42\.50/)).toBeNull();// Marketplace is the only live navigation target.const marketplace = screen.getByRole("link", { name: "Marketplace" });expect(marketplace.getAttribute("href")).toBe("/marketplace");+ expect(+ screen.getByRole("link", { name: "AutoGPT" }).getAttribute("href"),+ ).toBe("/marketplace");for (const label of ["New Task", "Search", "Agents", "Build", "Files"]) {const item = screen.getByRole("button", { name: label });expect(item.getAttribute("aria-disabled")).toBe("true");}});- test("clicking a sidebar session switches the demo scenario", async () => {- render(<TourChatPage />);-- fireEvent.click(screen.getByRole("button", { name: "Daily brief" }));- // The switched-to scenario auto-plays its first turn — its prompt shows up- // as the auto-sent user message.- await advanceThroughTurn();-- expect(- screen.getByText(/pull my unread emails and calendar/i),- ).toBeDefined();- });-test("finishing the demo opens the artifact panel with the mock markdown file", async () => {// The next/dynamic ArtifactPanel chunk can't finish loading once timers// are faked. Pre-open an artifact on real timers and wait for the paneldiff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/end-card.test.tsx b/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/end-card.test.tsxindex d9d070f2c7..e6ca2ac6a3 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/end-card.test.tsx+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/end-card.test.tsx@@ -87,14 +87,13 @@ describe("Tour demo end state", () => {).toBeDefined();});- test("marks the finished scenario as watched in the sidebar", async () => {+ test("records the finished scenario for subsequent recommendations", async () => {render(<TourChatPage />);await playDemoThrough();expect(useTourStore.getState().watchedScenarioIds).toEqual([DEFAULT_SCENARIO_ID,]);- expect(screen.getByText("watched")).toBeDefined();});test("idling after the demo keeps the finished chat controls hidden", async () => {diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/main.test.tsxindex e56acc8a5e..e8fc007099 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/main.test.tsx+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/main.test.tsx@@ -55,6 +55,7 @@ async function pressEnterToSend() {describe("Tour chat scripted demo", () => {beforeEach(() => {vi.useFakeTimers();+ vi.stubEnv("NEXT_PUBLIC_BEHAVE_AS", "CLOUD");// The scenario store is module-level state — reset between tests.useTourStore.setState({activeScenarioId: DEFAULT_SCENARIO_ID,@@ -71,6 +72,7 @@ describe("Tour chat scripted demo", () => {afterEach(() => {vi.runOnlyPendingTimers();vi.useRealTimers();+ vi.unstubAllEnvs();});test("auto-types the first prompt into the bar and sends it on its own", async () => {@@ -99,24 +101,6 @@ describe("Tour chat scripted demo", () => {expect(getSendBar()).toBeDefined();});- test("clicking the active sidebar session restarts the demo with an empty bar", async () => {- render(<TourChatPage />);-- // Let the first turn auto-play so the second turn's prompt prefills.- await advanceThroughTurn();- expect(getSendBar()).toBeDefined();-- fireEvent.click(screen.getByRole("button", { name: "Competitor watch" }));- await act(async () => {- await vi.advanceTimersByTimeAsync(0);- });-- // Fresh run: transcript cleared and the bar empty/disabled again while- // the first turn re-plays on its own.- expect(screen.queryByRole("button", { name: /^Send:/i })).toBeNull();- expect(screen.queryByText(/break that down/i)).toBeNull();- });-test("plays the competitor watch demo through to the payoff and upsell", async () => {render(<TourChatPage />);@@ -156,9 +140,9 @@ describe("Tour chat scripted demo", () => {).toBeDefined();// The end card carries the upsell now — the sidebar card hides.- expect(screen.queryByText(/Ready to build your own/i)).toBeNull();- expect(screen.queryByText(/Start with Pro for \$42\.50\/mo/i)).toBeNull();- expect(screen.queryByText("Self-host free")).toBeNull();+ expect(screen.queryByText("Your AI team starts here")).toBeNull();+ expect(screen.queryByRole("link", { name: "Start free trial" })).toBeNull();+ expect(screen.queryByText("Self-host instead")).toBeNull();expect(screen.queryByText(/Replay demo/i)).toBeNull();// Completion flips the store flag that hides the sidebar card.@@ -177,46 +161,17 @@ describe("Tour chat scripted demo", () => {expect(useTourStore.getState().isDemoComplete).toBe(true);expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);- // Picking another chat example from the sidebar must close the panel —- // it belongs to the finished demo, not the new one.- fireEvent.click(screen.getByRole("button", { name: "Daily brief" }));+ fireEvent.click(+ screen.getByRole("button", { name: /Watch another scenario/i }),+ );await act(async () => {await vi.advanceTimersByTimeAsync(0);});expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);- });-- test("scenario chips switch the demo path", async () => {- render(<TourChatPage />);-- for (const label of [- "Daily brief",- "Call prep",- "Competitor watch",- "Support queue",- ]) {- expect(screen.getByRole("button", { name: label })).toBeDefined();- }-- fireEvent.click(screen.getByRole("button", { name: "Daily brief" }));- await act(async () => {- await vi.advanceTimersByTimeAsync(0);- });-- // The bar stays empty while the selected scenario's first turn auto-plays.- expect(- screen.queryByText(/pull my unread emails and calendar/i),- ).toBeNull();-- // The newly selected scenario auto-plays its first turn too.- await advanceThroughTurn();-- expect(- screen.getByText(/pull my unread emails and calendar/i),- ).toBeDefined();+ expect(useTourStore.getState().activeScenarioId).toBe("support-queue");expect(- screen.getByText(/Love it\. Here's how I'll set that up/i),+ screen.getByRole("link", { name: "Start free trial" }),).toBeDefined();});});diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/tracking.test.tsx b/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/tracking.test.tsxindex 0c61cbf539..ef05f5538d 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/tracking.test.tsx+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/tracking.test.tsx@@ -13,7 +13,12 @@ vi.mock("@/components/ui/dot-distortion-shader", () => ({DotDistortionShader: () => null,}));-import { configureCookiebot } from "@/tests/integrations/cookiebot";+import {+ configureCookiebot,+ installCookiebot,+ removeCookiebot,+} from "@/tests/integrations/cookiebot";+import { SidebarProvider } from "@/components/ui/sidebar";const { posthog } = vi.hoisted(() => ({posthog: { __loaded: true, is_capturing: () => true, capture: vi.fn() },@@ -21,6 +26,7 @@ const { posthog } = vi.hoisted(() => ({vi.mock("posthog-js", () => ({ default: posthog }));import TourChatPage from "../page";+import { TourSidebar } from "../components/TourSidebar/TourSidebar";import { DEFAULT_SCENARIO_ID } from "../script/tourScenarios";import { useTourStore } from "../tourStore";@@ -57,6 +63,7 @@ async function pressEnterToSend() {describe("Tour DataFast tracking", () => {beforeEach(() => {vi.useFakeTimers();+ vi.stubEnv("NEXT_PUBLIC_BEHAVE_AS", "CLOUD");// /tour sends DataFast events without consent, but only on the tour// itself and only when a consent banner is configured.configureCookiebot();@@ -78,6 +85,7 @@ describe("Tour DataFast tracking", () => {vi.runOnlyPendingTimers();vi.useRealTimers();vi.unstubAllEnvs();+ removeCookiebot();window.history.pushState({}, "", "/");});@@ -89,8 +97,12 @@ describe("Tour DataFast tracking", () => {["tour_scenario_start", { scenario: DEFAULT_SCENARIO_ID }],]);- // Switching scenario starts a new run but must not re-fire tour_start.- fireEvent.click(screen.getByRole("button", { name: "Daily brief" }));+ await advanceThroughTurn();+ await pressEnterToSend();++ fireEvent.click(+ screen.getByRole("button", { name: /Watch another scenario/i }),+ );await act(async () => {await vi.advanceTimersByTimeAsync(0);});@@ -98,10 +110,69 @@ describe("Tour DataFast tracking", () => {expect(eventsNamed("tour_start")).toHaveLength(1);expect(eventsNamed("tour_scenario_start")).toHaveLength(2);expect(eventsNamed("tour_scenario_start")[1][1]).toEqual({- scenario: "daily-brief",+ scenario: "support-queue",});});+ describe.each(["tour", "marketplace"] as const)("%s sidebar", (surface) => {+ test.each([+ {+ mode: "CLOUD",+ eyebrow: "Free trial",+ name: "Start free trial",+ label: "free-trial",+ },+ {+ mode: "LOCAL",+ eyebrow: "Get started",+ name: "Create account",+ label: "signup",+ },+ ])(+ "$mode CTA describes its destination and tracks its surface",+ ({ mode, eyebrow, name, label }) => {+ vi.stubEnv("NEXT_PUBLIC_BEHAVE_AS", mode);+ window.history.pushState(+ {},+ "",+ surface === "tour" ? "/tour/chat" : "/marketplace",+ );+ installCookiebot({ statistics: true });+ render(+ <SidebarProvider>+ <TourSidebar variant={surface} />+ </SidebarProvider>,+ );++ expect(screen.getByText(eyebrow)).toBeDefined();+ const signupCTA = screen.getByRole("link", { name });+ expect(signupCTA.getAttribute("href")).toBe("/signup");+ expect(signupCTA.getAttribute("target")).toBeNull();+ if (mode === "LOCAL") {+ expect(screen.queryByText(/free trial/i)).toBeNull();+ }+ fireEvent.click(signupCTA);+ fireEvent.click(+ screen.getByRole("link", { name: "Self-host instead" }),+ );++ const metadata = { placement: "sidebar-card", surface };+ expect(eventsNamed("tour_cta_click")).toEqual([+ ["tour_cta_click", { label, ...metadata }],+ ["tour_cta_click", { label: "self-host", ...metadata }],+ ]);+ expect(posthog.capture).toHaveBeenCalledWith("tour_cta_clicked", {+ label,+ ...metadata,+ });+ expect(posthog.capture).toHaveBeenCalledWith("tour_cta_clicked", {+ label: "self-host",+ ...metadata,+ });+ },+ );+ });+test("fires tour_scenario_complete when the demo plays through", async () => {render(<TourChatPage />);diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourChatContainer/TourChatContainer.tsx b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourChatContainer/TourChatContainer.tsxindex 17732ef8ad..06600c9a92 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourChatContainer/TourChatContainer.tsx+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourChatContainer/TourChatContainer.tsx@@ -34,8 +34,7 @@ export function TourChatContainer({ chat }: Props) {/><p className="mt-2 flex items-center justify-center gap-1 text-sm text-zinc-400"><Icon icon={FlashIcon} className="size-3.5 shrink-0" />- Simulated demo — pick a scenario above to watch Otto build a- different agent+ Simulated demo — sign up to put Otto to work on your own tasks.</p></div>)}diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourEndCard/useTourEndCard.ts b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourEndCard/useTourEndCard.tsindex e335ee5f28..0c28832e00 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourEndCard/useTourEndCard.ts+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourEndCard/useTourEndCard.ts@@ -7,7 +7,7 @@ import { trackTourCtaClick } from "../../tracking";import { useTourScenarioSelection } from "../../useTourScenarioSelection";/** How long the visitor can sit on the finished demo before the "Next: …"- * chip appears and the next sidebar scenario starts pulsing. */+ * chip appears. */const IDLE_NUDGE_DELAY_MS = 4000;export function useTourEndCard() {diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/TourSidebar.tsx b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/TourSidebar.tsxindex f10c1aa743..aa56cb910c 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/TourSidebar.tsx+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/TourSidebar.tsx@@ -21,13 +21,9 @@ import {SidebarMenuItem,SidebarRail,} from "@/components/ui/sidebar";-import { cn } from "@/lib/utils";import { motion, useReducedMotion } from "framer-motion";import Link from "next/link";-import { useRouter } from "next/navigation";-import { getNextTourScenario, tourScenarios } from "../../script/tourScenarios";import { useTourStore } from "../../tourStore";-import { useTourScenarioSelection } from "../../useTourScenarioSelection";import { TourSidebarHeader } from "./components/TourSidebarHeader";import { TourUpsellCard } from "./components/TourUpsellCard";import {@@ -38,16 +34,10 @@ import {Search01Icon,SparklesIcon,Store01Icon,- Tick02Icon,} from "@hugeicons/core-free-icons";import type { IconSvgElement } from "@hugeicons/react";import { Icon } from "@/components/atoms/Icon/Icon";-// Visual clone of the logged-in AppSidebar for the public tour demo. Only-// Marketplace navigates; every other destination needs an account, so those-// items render disabled. The "Recent chats" group lists the demo scenarios-// as if they were chat sessions.-function DisabledMenuItem({icon,label,@@ -69,70 +59,15 @@ function DisabledMenuItem({);}-function TourSessionsMenu({ variant }: { variant: TourSidebarVariant }) {- const router = useRouter();- const activeScenarioId = useTourStore((s) => s.activeScenarioId);- const watchedScenarioIds = useTourStore((s) => s.watchedScenarioIds);- const isDemoComplete = useTourStore((s) => s.isDemoComplete);- const isNudgeVisible = useTourStore((s) => s.isNudgeVisible);- const selectTourScenario = useTourScenarioSelection();-- // While the visitor idles on a finished demo, the scenario the nudge chip- // points at pulses in the sidebar too.- const nudgeScenarioId =- variant === "tour" && isDemoComplete && isNudgeVisible- ? getNextTourScenario(activeScenarioId, watchedScenarioIds).id- : null;-- function selectScenario(id: string) {- selectTourScenario(id);- if (variant === "marketplace")- router.push("/tour/chat?utm_source=platform_marketplace");- }-- return (- <SidebarMenu>- {tourScenarios.map((scenario) => (- <SidebarMenuItem key={scenario.id}>- <SidebarMenuButton- isActive={variant === "tour" && scenario.id === activeScenarioId}- tooltip={scenario.label}- onClick={() => selectScenario(scenario.id)}- className={cn(- "font-normal data-[active=true]:!bg-zinc-200 data-[active=true]:font-normal hover:!bg-zinc-200",- scenario.id === nudgeScenarioId &&- "animate-pulse bg-violet-50 outline-dashed outline-1 outline-violet-400",- )}- >- <Icon icon={scenario.icon} className="size-4 shrink-0" />- <span className="truncate">{scenario.label}</span>- {variant === "tour" && watchedScenarioIds.includes(scenario.id) && (- <span className="ml-auto flex shrink-0 items-center gap-0.5 text-xs text-emerald-600">- <Icon icon={Tick02Icon} className="size-3" />- watched- </span>- )}- </SidebarMenuButton>- </SidebarMenuItem>- ))}- </SidebarMenu>- );-}--type TourSidebarVariant = "tour" | "marketplace";-interface Props {- /** "marketplace" renders the sidebar as a logged-out upsell shell: the- * sessions group is honestly labelled a demo and clicking one navigates- * into /tour/chat instead of switching in place. */- variant?: TourSidebarVariant;+ variant?: "tour" | "marketplace";}export function TourSidebar({ variant = "tour" }: Props) {const reduceMotion = useReducedMotion();const itemVariants = getSidebarItemVariants(!!reduceMotion);- // Once the demo finishes, the end card in the chat carries the upsell —- // the sidebar card hides until a new scenario resets the demo.+ // In the tour, the end card replaces the sidebar upsell after completion.+ // The marketplace always shows the sidebar card.const isDemoComplete = useTourStore((s) => s.isDemoComplete);return (@@ -214,26 +149,12 @@ export function TourSidebar({ variant = "tour" }: Props) {</SidebarGroup></Collapsible></motion.div>-- <motion.div- variants={itemVariants}- className="group-data-[collapsible=icon]:hidden"- >- <SidebarGroup className="py-1">- <SidebarGroupLabel className="text-[13px] font-medium">- {variant === "marketplace" ? "Try Otto" : "Recent chats"}- </SidebarGroupLabel>- <SidebarGroupContent>- <TourSessionsMenu variant={variant} />- </SidebarGroupContent>- </SidebarGroup>- </motion.div></motion.div></SidebarContent>- {!isDemoComplete && (+ {(variant === "marketplace" || !isDemoComplete) && (<SidebarFooter className="p-3 group-data-[collapsible=icon]:hidden">- <TourUpsellCard />+ <TourUpsellCard surface={variant} /></SidebarFooter>)}diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/components/TourSidebarHeader.tsx b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/components/TourSidebarHeader.tsxindex 0a14888133..326a9d6dea 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/components/TourSidebarHeader.tsx+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/components/TourSidebarHeader.tsx@@ -7,8 +7,6 @@ import Link from "next/link";import { SidebarLeftIcon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";-// Mirror of AppSidebarHeader, with the logo pointing back at the tour-// instead of the (auth-gated) copilot home.export function TourSidebarHeader() {const { state, toggleSidebar } = useSidebar();const isCollapsed = state === "collapsed";@@ -38,7 +36,7 @@ export function TourSidebarHeader() {)}><Link- href="/tour"+ href="/marketplace"aria-label="AutoGPT"className={cn("flex items-center",diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/components/TourUpsellCard.tsx b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/components/TourUpsellCard.tsxindex 17e4d8e693..bbaa0733e5 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/components/TourUpsellCard.tsx+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/components/TourUpsellCard.tsx@@ -1,60 +1,80 @@"use client";import { Button } from "@/components/atoms/Button/Button";+import { Card } from "@/components/atoms/Card/Card";+import { Icon } from "@/components/atoms/Icon/Icon";import { Text } from "@/components/atoms/Text/Text";-import { buildTourPricingUrl, TOUR_GITHUB_URL } from "../../../constants";+import { environment } from "@/services/environment";+import {+ ArrowRight02Icon,+ GithubIcon,+ SparklesIcon,+} from "@hugeicons/core-free-icons";+import { TOUR_GITHUB_URL } from "../../../constants";import { trackTourCtaClick } from "../../../tracking";-import { GithubIcon, SparklesIcon } from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";-// Only rendered while the demo is still playing — once it completes the-// sidebar hides this card and the end card in the chat carries the upsell.-export function TourUpsellCard() {+type Props = {+ surface: "tour" | "marketplace";+};++export function TourUpsellCard({ surface }: Props) {+ const isCloud = environment.isCloud();++ function handleSignupClick() {+ trackTourCtaClick(isCloud ? "free-trial" : "signup", {+ placement: "sidebar-card",+ surface,+ });+ }++ function handleSelfHostClick() {+ trackTourCtaClick("self-host", { placement: "sidebar-card", surface });+ }+return (- <div className="relative flex flex-col rounded-xl border border-zinc-200/80 bg-white p-4 shadow-sm">- <div className="flex items-center gap-1.5">- <Icon- icon={SparklesIcon}- size={14}- className="shrink-0 text-violet-600"- />- <Text variant="body-medium" className="text-zinc-900">- Ready to build your own?+ <Card className="flex flex-col gap-4 border border-zinc-200 p-4 shadow-subtle">+ <div className="flex items-center gap-2.5">+ <span className="flex size-9 items-center justify-center rounded-medium bg-purple-100 text-purple-700">+ <Icon icon={SparklesIcon} size={18} aria-hidden />+ </span>+ <Text variant="eyebrow" tone="secondary">+ {isCloud ? "Free trial" : "Get started"}+ </Text>+ </div>+ <div className="space-y-1.5">+ <Text variant="h5" as="h2" tone="primary">+ Your AI team starts here</Text>+ <Text variant="body" tone="secondary">+ Build agents and put AI experts to work on your everyday tasks.+ </Text>+ </div>+ <div className="flex flex-col gap-1">+ <Button+ as="NextLink"+ href="/signup"+ variant="primary"+ size="small"+ onClick={handleSignupClick}+ rightIcon={<Icon icon={ArrowRight02Icon} size={16} aria-hidden />}+ className="w-full"+ >+ {isCloud ? "Start free trial" : "Create account"}+ </Button>+ <Button+ as="NextLink"+ href={TOUR_GITHUB_URL}+ target="_blank"+ rel="noopener noreferrer"+ variant="ghost"+ size="small"+ onClick={handleSelfHostClick}+ leftIcon={<Icon icon={GithubIcon} size={14} aria-hidden />}+ className="w-full text-xs text-zinc-600"+ >+ Self-host instead+ </Button></div>- <Text variant="small" className="mt-1 text-zinc-500">- Spin up agents like this in minutes, hosted for you or on your own- infrastructure.- </Text>- <Button- as="NextLink"- href={buildTourPricingUrl("sidebar_card")}- target="_blank"- rel="noopener noreferrer"- variant="primary"- size="small"- onClick={() =>- trackTourCtaClick("pricing", { placement: "sidebar-card" })- }- className="mt-3 w-full shadow-[0_0_20px_-6px_rgba(124,58,237,0.6)] transition-shadow hover:shadow-[0_0_28px_-4px_rgba(124,58,237,0.75)]"- >- Start with Pro for $42.50/mo- </Button>- <Button- as="NextLink"- href={TOUR_GITHUB_URL}- target="_blank"- rel="noopener noreferrer"- variant="ghost"- size="small"- onClick={() =>- trackTourCtaClick("self-host", { placement: "sidebar-card" })- }- className="mt-1.5 w-full text-zinc-600"- leftIcon={<Icon icon={GithubIcon} className="h-4 w-4" />}- >- Self-host free- </Button>- </div>+ </Card>);}diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/script/tourScenarios.ts b/autogpt_platform/frontend/src/app/(public)/tour/chat/script/tourScenarios.tsindex 77895f0a04..b08bb1213a 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/script/tourScenarios.ts+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/script/tourScenarios.ts@@ -50,7 +50,7 @@ export const tourScenarios: TourScenario[] = [export const DEFAULT_SCENARIO_ID = "competitor-watch";/** The scenario the end-of-demo nudge points at: the next unwatched one in- * sidebar order (wrapping around), or simply the next one once all are+ * scenario order (wrapping around), or simply the next one once all are* watched — "Watch another scenario" should always lead somewhere. */export function getNextTourScenario(activeScenarioId: string,diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/tourStore.ts b/autogpt_platform/frontend/src/app/(public)/tour/chat/tourStore.tsindex 61b0f7f0fd..26109585fc 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/tourStore.ts+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/tourStore.ts@@ -3,17 +3,17 @@ import { DEFAULT_SCENARIO_ID } from "./script/tourScenarios";interface TourState {activeScenarioId: string;- /** Bumped on every sidebar selection — re-keys the demo so clicking a+ /** Bumped on every scenario selection — re-keys the demo so clicking a* scenario (even the already-active one) always restarts it fresh. */runId: number;/** True once the active demo has played through — the end card takes over* the upsell and the sidebar card hides until a new scenario starts. */isDemoComplete: boolean;- /** Scenarios the visitor has watched to completion — the sidebar marks- * them with a check and the "next scenario" nudge skips them. */+ /** Scenarios the visitor has watched to completion — the next-scenario+ * nudge skips them. */watchedScenarioIds: string[];/** True once the visitor has idled past the end card — shows the- * "Next: …" chip and pulses the next scenario in the sidebar. */+ * "Next: …" chip. */isNudgeVisible: boolean;setActiveScenario: (id: string) => void;setDemoComplete: () => void;diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/tracking.ts b/autogpt_platform/frontend/src/app/(public)/tour/chat/tracking.tsindex d02894e871..b8b8dfddc0 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/tracking.ts+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/tracking.ts@@ -6,6 +6,8 @@ import { TourEvent } from "@/services/analytics/posthog-events";// The tour is public and pre-signup: nothing here may carry an identifier.export type TourCtaLabel =+ | "free-trial"+ | "signup"| "pricing"| "another-scenario"| "self-host"diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/useTourScenarioSelection.ts b/autogpt_platform/frontend/src/app/(public)/tour/chat/useTourScenarioSelection.tsindex 77da437cb0..93e9709e04 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/useTourScenarioSelection.ts+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/useTourScenarioSelection.ts@@ -4,7 +4,7 @@ import { useCopilotUIStore } from "@/app/(platform)/copilot/store";import { useTourStore } from "./tourStore";/** Switching scenarios always closes the previous run's artifact panel —- * shared by the sidebar sessions, the end card and the nudge chip. */+ * shared by the end card and the nudge chip. */export function useTourScenarioSelection() {const setActiveScenario = useTourStore((s) => s.setActiveScenario);const closeArtifactPanel = useCopilotUIStore((s) => s.closeArtifactPanel);diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/AppSidebar.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/AppSidebar.tsxindex bcc1c115cd..9329960483 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/AppSidebar.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/AppSidebar.tsx@@ -20,6 +20,7 @@ import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { LoadingSpinner } from "@/components/atoms/LoadingSpinner/LoadingSpinner";import { isEditableElement } from "@/lib/platform";import { cn } from "@/lib/utils";+import { useAuth } from "@/lib/auth/hooks/useAuth";import { motion, useReducedMotion } from "framer-motion";import Link, { useLinkStatus } from "next/link";import { usePathname, useRouter } from "next/navigation";@@ -232,6 +233,7 @@ function CollapsibleNavGroup({type Props = ComponentProps<typeof Sidebar>;export function AppSidebar(props: Props) {+ const { isLoggedIn } = useAuth();const reduceMotion = useReducedMotion();const itemVariants = getSidebarItemVariants(!!reduceMotion);const router = useRouter();@@ -292,19 +294,21 @@ export function AppSidebar(props: Props) {</motion.div>) : null}- <motion.div- variants={itemVariants}- className="flex min-h-0 flex-1 flex-col group-data-[collapsible=icon]:hidden"- >- <CollapsibleNavGroup label="Recent chats" scrollable>- {/* Suspense boundary: RecentChats reads useSearchParams(), which+ {isLoggedIn && (+ <motion.div+ variants={itemVariants}+ className="flex min-h-0 flex-1 flex-col group-data-[collapsible=icon]:hidden"+ >+ <CollapsibleNavGroup label="Recent chats" scrollable>+ {/* Suspense boundary: RecentChats reads useSearchParams(), whichNext.js requires to be wrapped to avoid forcing the route toclient-side rendering. */}- <Suspense fallback={null}>- <RecentChats />- </Suspense>- </CollapsibleNavGroup>- </motion.div>+ <Suspense fallback={null}>+ <RecentChats />+ </Suspense>+ </CollapsibleNavGroup>+ </motion.div>+ )}</motion.div></SidebarContent>diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/__tests__/AppSidebar.test.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/__tests__/AppSidebar.test.tsxindex 33f6e72d8a..e02494bc08 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/__tests__/AppSidebar.test.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/__tests__/AppSidebar.test.tsx@@ -16,6 +16,14 @@ import { fireEvent } from "@testing-library/react";import { AppSidebar } from "../AppSidebar";import { Flag } from "@/services/feature-flags/use-get-flag";+vi.mock("@/lib/auth/hooks/useAuth", () => ({+ useAuth: () => ({+ user: { id: "user-1", email: "[email protected]", role: "user" },+ isLoggedIn: true,+ isUserLoading: false,+ }),+}));+function dashboardWith(agents: HomeAgentStatus[]): HomeDashboardResponse {return { ...getGetHomeDashboardResponseMock200(), agents };}diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/__tests__/auth-state.test.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/__tests__/auth-state.test.tsxnew file mode 100644index 0000000000..a419a25121--- /dev/null+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/__tests__/auth-state.test.tsx@@ -0,0 +1,190 @@+import { getGetV2ListSessionsMockHandler200 } from "@/app/api/__generated__/endpoints/chat/chat.msw";+import { SidebarProvider } from "@/components/ui/sidebar";+import {+ getCurrentUser,+ serverLogout,+ validateSession,+} from "@/lib/auth/actions";+import { useAuthStore } from "@/lib/auth/hooks/useAuthStore";+import { User } from "@/lib/auth/types";+import { BackendAPIProvider } from "@/lib/autogpt-server-api/context";+import { getQueryClient } from "@/lib/react-query/queryClient";+import { server } from "@/mocks/mock-server";+import { Key } from "@/services/storage/local-storage";+import { QueryClientProvider } from "@tanstack/react-query";+import { act, render, screen, waitFor } from "@testing-library/react";+import { NuqsTestingAdapter } from "nuqs/adapters/testing";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { AppSidebar } from "../AppSidebar";++vi.mock("@/lib/auth/actions", () => ({+ getCurrentUser: vi.fn(),+ validateSession: vi.fn(),+ serverLogout: vi.fn(),+}));++vi.mock("../components/SidebarUserActions/SidebarUserActions", () => ({+ SidebarUserActions: () => null,+}));++const user: User = {+ id: "user-1",+ email: "[email protected]",+ role: "user",+ user_metadata: {},+};+const sessionsRequest = vi.fn(() => ({+ sessions: [+ {+ id: "session-1",+ title: "My real conversation",+ is_processing: false,+ created_at: "2026-06-30T00:00:00Z",+ updated_at: "2026-06-30T00:00:00Z",+ },+ ],+ total: 1,+}));++function deferred<T>() {+ let resolve!: (value: T) => void;+ const promise = new Promise<T>((done) => {+ resolve = done;+ });+ return { promise, resolve };+}++function renderSidebar() {+ return render(+ <QueryClientProvider client={getQueryClient()}>+ <BackendAPIProvider>+ <NuqsTestingAdapter>+ <SidebarProvider>+ <AppSidebar />+ </SidebarProvider>+ </NuqsTestingAdapter>+ </BackendAPIProvider>+ </QueryClientProvider>,+ );+}++function expectNoRecentChats() {+ expect(screen.queryByText("Recent chats")).toBeNull();+ expect(screen.queryByText("My real conversation")).toBeNull();+ expect(screen.queryByText(/no conversations yet/i)).toBeNull();+}++beforeEach(() => {+ vi.clearAllMocks();+ useAuthStore.setState(useAuthStore.getInitialState());+ getQueryClient().clear();+ vi.mocked(getCurrentUser).mockResolvedValue({ user: null });+ vi.mocked(validateSession).mockResolvedValue({ user: null, isValid: false });+ vi.mocked(serverLogout).mockResolvedValue({ success: true });+ server.use(getGetV2ListSessionsMockHandler200(sessionsRequest));+});++afterEach(() => {+ useAuthStore.getState().cleanup();+ getQueryClient().clear();+});++describe("AppSidebar auth state", () => {+ it("does not fetch or show chats while auth loads or after finding no user", async () => {+ const auth = deferred<Awaited<ReturnType<typeof getCurrentUser>>>();+ vi.mocked(getCurrentUser).mockReturnValue(auth.promise);+ renderSidebar();++ expect(useAuthStore.getState().isUserLoading).toBe(true);+ expectNoRecentChats();+ expect(sessionsRequest).not.toHaveBeenCalled();++ await act(async () => {+ auth.resolve({ user: null });+ await useAuthStore.getState().initializationPromise;+ });++ expect(useAuthStore.getState().isUserLoading).toBe(false);+ expectNoRecentChats();+ expect(sessionsRequest).not.toHaveBeenCalled();+ });++ it("fetches chats only after the server returns an authenticated user", async () => {+ const auth = deferred<Awaited<ReturnType<typeof getCurrentUser>>>();+ vi.mocked(getCurrentUser).mockReturnValue(auth.promise);+ renderSidebar();+ expect(sessionsRequest).not.toHaveBeenCalled();++ await act(async () => {+ auth.resolve({ user });+ await useAuthStore.getState().initializationPromise;+ });++ expect(useAuthStore.getState().isUserLoading).toBe(false);+ expect(await screen.findByText("My real conversation")).toBeDefined();+ expect(screen.getByText("Recent chats")).toBeDefined();+ expect(sessionsRequest).toHaveBeenCalledOnce();+ });++ it("removes chats when background validation rejects the session", async () => {+ vi.mocked(getCurrentUser).mockResolvedValue({ user });+ const validation = deferred<Awaited<ReturnType<typeof validateSession>>>();+ vi.mocked(validateSession).mockReturnValue(validation.promise);+ renderSidebar();+ await screen.findByText("My real conversation");++ let validating!: Promise<boolean>;+ act(() => {+ validating = useAuthStore.getState().validateSession({ force: true });+ });+ expect(useAuthStore.getState()).toMatchObject({+ user,+ isUserLoading: false,+ isValidating: true,+ });+ await act(async () => {+ validation.resolve({ user: null, isValid: false });+ await validating;+ });++ expectNoRecentChats();+ expect(sessionsRequest).toHaveBeenCalledOnce();+ });++ it("removes chats before the server finishes logging out", async () => {+ vi.mocked(getCurrentUser).mockResolvedValue({ user });+ const logout = deferred<Awaited<ReturnType<typeof serverLogout>>>();+ vi.mocked(serverLogout).mockReturnValue(logout.promise);+ renderSidebar();+ await screen.findByText("My real conversation");++ let loggingOut!: Promise<void>;+ act(() => {+ loggingOut = useAuthStore.getState().logOut();+ });+ await waitFor(() => expect(useAuthStore.getState().user).toBeNull());+ expectNoRecentChats();+ await act(async () => {+ logout.resolve({ success: true });+ await loggingOut;+ });+ expectNoRecentChats();+ expect(sessionsRequest).toHaveBeenCalledOnce();+ });++ it("removes chats when another tab logs out", async () => {+ vi.mocked(getCurrentUser).mockResolvedValue({ user });+ renderSidebar();+ await screen.findByText("My real conversation");++ act(() => {+ window.dispatchEvent(+ new StorageEvent("storage", { key: Key.LOGOUT, newValue: "1" }),+ );+ });++ expect(useAuthStore.getState().user).toBeNull();+ expectNoRecentChats();+ expect(sessionsRequest).toHaveBeenCalledOnce();+ });+});diff --git a/docs/engineering/tracking-plan.md b/docs/engineering/tracking-plan.mdindex b0dc021594..e13f64149e 100644--- a/docs/engineering/tracking-plan.md+++ b/docs/engineering/tracking-plan.md@@ -142,9 +142,15 @@ what replaced them.| `tour_started` | browser | live | — | The public `/tour` page is opened (once per tab). || `tour_scenario_started` | browser | live | `scenario` | A tour scenario starts playing. || `tour_scenario_completed` | browser | live | `scenario` | A tour scenario reaches its end. |-| `tour_cta_clicked` | browser | live | `label` (`pricing`, `another-scenario`, `self-host`, `share`), `placement` where the CTA has one | A tour call to action is clicked. |+| `tour_cta_clicked` | browser | live | `label` (`free-trial`, `signup`, `pricing`, `another-scenario`, `self-host`, `share`), `placement` where the CTA has one, `surface` (`tour`, `marketplace`) on sidebar-card clicks | A tour or logged-out marketplace call to action is clicked. || `signup_completed` | backend | live | `signup_method` (the auth provider, e.g. `email`, `google`: from the user's first Better Auth account row, where `credential` is reported as `email`, else from a Supabase token's `app_metadata.provider`; omitted when neither has it) | The user row is created (`data/user.py`), whichever request creates it. |+Sidebar CTA clicks retain the tour event names for compatibility. Filter+`surface` to distinguish the marketplace from the tour; older sidebar events+do not carry this property. For tour-only sidebar reports after deployment,+require `surface = tour`. The signup CTA uses `free-trial` in cloud mode and+`signup` on self-hosted installations, where creating an account starts no trial.+The tour funnel also goes to DataFast (`tour_start`, `tour_scenario_start`,`tour_scenario_complete`, `tour_cta_click`); the PostHog events mirror it withthe same properties and nothing identifying in them: `/tour` is public and