Skip to content

Open source CapCut alternative.

TypeScript

feat(site): tour the starter project before the plans

David Le66bf203681c2
diff --git a/site/package-lock.json b/site/package-lock.json
index 1cd1fbd8..b370e988 100644
--- a/site/package-lock.json
+++ b/site/package-lock.json
@@ -101,6 +101,7 @@
"cn": "^0.2.6",
"country-flag-icons": "1.6.20",
"defuddle": "^0.18.1",
+ "driver.js": "1.9.0",
"geist": "^1.7.2",
"linkedom": "^0.18.12",
"lucide-react": "^1.23.0",
@@ -9694,6 +9695,12 @@
"url": "https://dotenvx.com"
}
},
+ "node_modules/driver.js": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/driver.js/-/driver.js-1.9.0.tgz",
+ "integrity": "sha512-+YWVdNVUrY1/2spszQshohWYY4soIjNBnMFS6lfmousT8igos2lmswhlqyuuNMhr+qbV0EjJ+L6i2FECPr6Ygg==",
+ "license": "MIT"
+ },
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
diff --git a/site/package.json b/site/package.json
index ecb8e35d..c92bd4a2 100644
--- a/site/package.json
+++ b/site/package.json
@@ -143,6 +143,7 @@
"cn": "^0.2.6",
"country-flag-icons": "1.6.20",
"defuddle": "^0.18.1",
+ "driver.js": "1.9.0",
"geist": "^1.7.2",
"linkedom": "^0.18.12",
"lucide-react": "^1.23.0",
diff --git a/site/src/app/[locale]/cut/app/(home)/onboarding/page.tsx b/site/src/app/[locale]/cut/app/(home)/onboarding/page.tsx
index 56c798e2..0c0719e1 100644
--- a/site/src/app/[locale]/cut/app/(home)/onboarding/page.tsx
+++ b/site/src/app/[locale]/cut/app/(home)/onboarding/page.tsx
@@ -1,46 +1,16 @@
"use client";
-import { Suspense, useEffect, useRef } from "react";
-import { useRouter } from "next/navigation";
+import { Suspense } from "react";
import { ProjectsHome } from "@/cut/components/ProjectsHome";
import { SessionGate } from "@/cut/components/SessionGate";
-import { cloudBackend } from "@/cut/lib/backend/cloud";
-import { CUT_APP_BASE } from "@/cut/lib/nav";
-import { starterProjectId } from "@/cut/lib/starter";
-import { useSession } from "@/lib/auth-client";
// The welcome sequence's own address. The sequence is a full-window overlay
// mounted in the app shell that reads this address itself and opens from its
-// first paint, so this route only renders what's underneath it. A signup lands
-// here, and a new account arrives with its seeded starter project — so under
-// the slides this route moves to that project's editor, and closing the last
-// slide hands over to a cut ready to explore. An account without a starter
-// (seed failed, or an older account revisiting this address) stays on the app
-// home, the same thing that's behind the sequence everywhere else.
+// first paint, so this route only renders what's underneath it. On a computer
+// the overlay opens the starter project behind the slides
+// (CutOnboarding.tsx); a phone stays on the app home.
export default function OnboardingPage() {
- const router = useRouter();
- const { data: session } = useSession();
- const userId = session?.user.id;
- const sent = useRef(false);
-
- useEffect(() => {
- if (!userId || sent.current) return;
- let cancelled = false;
- void (async () => {
- const id = starterProjectId(userId);
- // Straight to the cloud surface: the starter is always a cloud project,
- // whichever backend the connect gate picks for this browser.
- const res = await cloudBackend.fetch(`/api/cut/projects/${id}`).catch(() => null);
- if (cancelled || !res?.ok || sent.current) return;
- sent.current = true;
- router.replace(`${CUT_APP_BASE}/p/${id}`);
- })();
- return () => {
- cancelled = true;
- };
- }, [userId, router]);
-
return (
<Suspense>
<SessionGate>
diff --git a/site/src/app/[locale]/cut/app/layout.tsx b/site/src/app/[locale]/cut/app/layout.tsx
index c57462ff..453c8d29 100644
--- a/site/src/app/[locale]/cut/app/layout.tsx
+++ b/site/src/app/[locale]/cut/app/layout.tsx
@@ -6,6 +6,7 @@ import { CardHost } from "@/cut/components/CardHost";
import { ConnectGate } from "@/cut/components/ConnectGate";
import { ExportsDock } from "@/cut/components/ExportsDock";
import { CutOnboarding } from "@/cut/components/onboarding/CutOnboarding";
+import { OnboardingHost } from "@/cut/components/onboarding/OnboardingHost";
import { PhoneGate } from "@/cut/components/PhoneGate";
import { RequireSession } from "@/cut/components/RequireSession";
import { AppLoading, AppLoadingOverlay, SessionGate } from "@/cut/components/SessionGate";
@@ -24,7 +25,7 @@ import { APP_NAMESPACES } from "@/i18n/namespaces";
// it answers without raising the browser's local-network prompt, the cloud
// otherwise — and owns the banner that reports an engine this browser can no
// longer reach. CutOnboarding is the welcome sequence a new account sees before
-// any of it.
+// any of it; OnboardingHost carries it on through the starter tour and the plans.
//
// Everything the app draws reads the engine, and every engine URL carries the
// account id, so the shell has nothing true to show before the session lands:
@@ -62,6 +63,7 @@ export default function CutAppLayout({ children }: { children: ReactNode }) {
shape worth drawing before then. */}
<SessionGate>
<ExportsDock placement="window" />
+ <OnboardingHost />
</SessionGate>
</ConnectGate>
</PhoneGate>
diff --git a/site/src/cut/components/AiPanel.tsx b/site/src/cut/components/AiPanel.tsx
index 5d15d7a3..b0ae9ada 100644
--- a/site/src/cut/components/AiPanel.tsx
+++ b/site/src/cut/components/AiPanel.tsx
@@ -111,6 +111,7 @@ import { cutChatLive, dropPiSession, foldIntoCutChat, hydratePiSession, readPiSe
import { dueForRetriage, toolProgress } from "@/cut/lib/queueTriage";
import { registerQueueSink } from "@/cut/lib/chatQueue";
import { previewAt } from "@/cut/lib/playhead";
+import { onComposerFill, reportChatRunning, reportChatSent } from "@/cut/lib/onboarding";
import { resolvePlayheadTokens, syncTimes, type TimeMark } from "@/cut/lib/timeMark";
import { productionDeps } from "@/cut/lib/pi/prodDeps";
import { withChatProject } from "@/cut/lib/projectChatTools";
@@ -613,6 +614,10 @@ export function AiPanel({
useEffect(() => {
onStatusChange(projectId, chatStatus);
}, [projectId, chatStatus, onStatusChange]);
+ // The starter tour holds its last step until the reply lands.
+ useEffect(() => {
+ reportChatRunning(anyRunning);
+ }, [anyRunning]);
// The owner's chat opens once this browser's stored history has loaded
// (IndexedDB, so a beat after mount — opening before it would show an empty
// thread and save it over the real one); the cloud copy merges in behind it
@@ -1090,6 +1095,22 @@ function ChatSession({
}
micWasActive.current = mic.state !== "idle";
}, [mic.state]);
+ // The starter tour types its example message here, caret at the end, so
+ // Enter sends it.
+ useEffect(
+ () =>
+ onComposerFill((text) => {
+ setInput(text);
+ requestAnimationFrame(() => {
+ const el = composerRef.current;
+ if (el) {
+ el.focus();
+ el.setSelectionRange(el.value.length, el.value.length);
+ }
+ });
+ }),
+ [],
+ );
const [attachments, setAttachments] = useState<AssetRef[]>([]);
// Moments the composer's `@` tokens point at, in the order they were
// written. They ride with the message so the time can be re-read against
@@ -1960,6 +1981,7 @@ function ChatSession({
}
const queued = busy || requests.snapshot();
track("chat_message_sent", { provider: provider(currentModel()), attachments: all.length, queued });
+ reportChatSent();
if (queued) {
// A paused queue stays paused: parked rows fire only from the tray's
// resume button, never as a side effect of submitting something new.
@@ -2381,6 +2403,7 @@ function ChatSession({
</div>
<div
ref={composerBoxRef}
+ data-tour="chat"
className={cn(
// z above the floating stack so the box paints over its tucked
// bottom edge. Dark mode lifts the opaque fill a step above the
diff --git a/site/src/cut/components/Editor.tsx b/site/src/cut/components/Editor.tsx
index d2dc52de..0709168b 100644
--- a/site/src/cut/components/Editor.tsx
+++ b/site/src/cut/components/Editor.tsx
@@ -1,5 +1,7 @@
"use client";
+import { useQueryClient } from "@tanstack/react-query";
+
import { CHAT_RUNTIME } from "@/cut/lib/chatRuntime";
import { useHostReady } from "@/cut/lib/hostBridge";
import { useCutMode } from "@/cut/lib/backend/hooks";
@@ -58,6 +60,8 @@ import { noteProjectRevision, projectRevision } from "@/cut/lib/projectRevision"
import { readProjectThreads, writeActiveChat } from "@/cut/lib/chatThreads";
import { backTarget, useCutBase } from "@/cut/lib/nav";
import { useOnboardingCover } from "@/cut/lib/onboarding";
+import { onboardingStage } from "@/lib/onboarding/stage";
+import { onboardingQueryKey, type OnboardingState } from "@/queries/onboarding";
import { requestSidePanel } from "@/cut/lib/panelRequest";
import { reportSwallowed } from "@/cut/lib/report";
import { resolveProjectPlacement } from "@/cut/lib/residency";
@@ -80,6 +84,7 @@ import { AiPanel } from "./AiPanel";
import type { ChatStatus } from "./ChatStatusBadge";
import { EmbeddedNewProject } from "./EmbeddedNewProject";
import { ExportDialog } from "./ExportDialog";
+import { StarterTour } from "./onboarding/StarterTour";
import { Inspector, useHasInspector } from "./Inspector";
import { Lightbox } from "./Lightbox";
import { Preview } from "./Preview";
@@ -183,6 +188,7 @@ export function Editor({
return () => window.removeEventListener("resize", clamp);
}, []);
const { chatgpt } = useEnvironment();
+ const queryClient = useQueryClient();
const cutMode = useCutMode();
// ChatGPT's edits run in this editor while it is the card.
useHostCommands(projectId, chatgpt && cutMode === "cloud");
@@ -325,13 +331,20 @@ export function Editor({
});
}
if (intro.play) {
- if (!useOnboardingCover.getState().up) {
+ // The starter tour's first step is pressing play, so playback waits for
+ // the person while the tour is owed.
+ const play = () => {
+ const onboarding = queryClient.getQueryData<OnboardingState>(onboardingQueryKey);
+ if (!chatgpt && onboardingStage(onboarding) === "tour") return;
useEditor.getState().setPlaying(true);
+ };
+ if (!useOnboardingCover.getState().up) {
+ play();
} else {
const unsub = useOnboardingCover.subscribe((s) => {
if (s.up) return;
unsub();
- useEditor.getState().setPlaying(true);
+ play();
});
cleanups.push(unsub);
}
@@ -340,7 +353,7 @@ export function Editor({
alive = false;
cleanups.forEach((fn) => fn());
};
- }, [loaded, viewer, projectId]);
+ }, [loaded, viewer, projectId, chatgpt, queryClient]);
// Delayed follow of the owner's edits: poll the doc version and reload on
// change, keeping the playhead. A 401/403/404 means the share was revoked or
@@ -1318,6 +1331,7 @@ export function Editor({
onClose={() => useEditor.getState().setAiOpen(false)}
/>
)}
+ {!viewer && !chatgpt && <StarterTour projectId={projectId} />}
{exportOpen && <ExportDialog />}
{shareGone && (
<div className="fixed top-14 left-1/2 z-50 max-w-[calc(100%-2rem)] -translate-x-1/2 rounded-full bg-foreground/90 px-3.5 py-1.5 text-center text-xs font-medium text-background shadow-lg">
diff --git a/site/src/cut/components/NewProjectButton.tsx b/site/src/cut/components/NewProjectButton.tsx
index 368e5ac7..aade99c8 100644
--- a/site/src/cut/components/NewProjectButton.tsx
+++ b/site/src/cut/components/NewProjectButton.tsx
@@ -1,6 +1,6 @@
"use client";
-import { ChevronDown, Cloud, Laptop, Plus } from "lucide-react";
+import { ChevronDown, Cloud, Laptop, Lock, Plus } from "lucide-react";
import { useTranslations } from "next-intl";
import { Button } from "@/components/ui/button";
import {
@@ -18,6 +18,7 @@ import {
} from "@/components/ui/tooltip";
import { useNewProjectTarget } from "@/cut/lib/newProject";
import type { Residency } from "@/cut/lib/residency";
+import { useTourLock } from "@/cut/lib/tourLock";
import { useLabels } from "@/i18n/labels";
import { cn } from "@/lib/utils";
@@ -60,11 +61,28 @@ export function NewProjectButton({
className?: string;
}) {
const t = useTranslations("home.newProject");
+ const tTour = useTranslations("onboarding.tour");
const residencyLabel = useLabels("residency");
const { target, choices, pick } = useNewProjectTarget();
+ const lock = useTourLock();
const r = pinned ?? target;
const Icon = RESIDENCY_ICON[r];
+ // While the starter tour is owed the button takes the account back to it,
+ // and says why on hover.
+ if (lock.locked) {
+ return (
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger render={<Button className={className} onClick={lock.resume} />}>
+ <Lock data-icon="inline-start" /> <span className="truncate">{t("button")}</span>
+ </TooltipTrigger>
+ <TooltipContent>{tTour("locked")}</TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ );
+ }
+
if (!picker || pinned || choices.length < 2) {
return (
<Button className={className} onClick={() => onCreate(r)}>
diff --git a/site/src/cut/components/PlansDialog.tsx b/site/src/cut/components/PlansDialog.tsx
index 96c0b45c..48bd3534 100644
--- a/site/src/cut/components/PlansDialog.tsx
+++ b/site/src/cut/components/PlansDialog.tsx
@@ -13,6 +13,7 @@ import { useApiErrorText } from "@/app/[locale]/cut/app/(home)/settings/_compone
import { useCutPlans, type PlanCopy, type PlanFeature } from "@/app/[locale]/cut/_components/landing/cutPricingPlans";
import { Button } from "@/components/ui/button";
import { Dialog, DialogBody, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog";
+import { BLUE_FILL, BLUE_TEXT } from "@/cut/components/accent";
import { OfferSticker } from "@/cut/components/OfferSticker";
import { usePlanCheckout } from "@/cut/lib/proUpgrade";
import type { UpgradeEntry } from "@/cut/lib/upgrade";
@@ -22,12 +23,7 @@ import { planRank, RECOMMENDED_PLAN, type PaidPlan } from "@/lib/billing/plans";
import { cn } from "@/lib/utils";
import { useIntroOffer, useProSubscription, type IntroOffer } from "@/queries/billing";
-// The accent blue. The fill carries white text at 4.7:1; the light-theme text
-// shade reads on white, the dark one on the dark popover.
-const BLUE_FILL = "bg-[#0071e3] text-white hover:bg-[#0077ed]";
-const BLUE_TEXT = "text-[#0062c4] dark:text-[#4aa3ff]";
-
-export type PlansSource = "credits" | "projects" | "storage" | "plans";
+export type PlansSource = "credits" | "projects" | "storage" | "plans" | "onboarding";
export function PlansDialog({
source,
@@ -35,6 +31,7 @@ export function PlansDialog({
title,
body,
notice,
+ dismissLabel,
onClose,
}: {
// What raised it, and the button or limit that did, for analytics.
@@ -46,9 +43,11 @@ export function PlansDialog({
body?: React.ReactNode;
// A warning under the message, such as storage about to be reclaimed.
notice?: React.ReactNode;
+ // The way out as a text button at the bottom right, in place of the close
+ // button. Onboarding ends on the plans, and free is one of its answers.
+ dismissLabel?: string;
onClose: () => void;
}) {
- const t = useTranslations("billing.plans");
const tBilling = useTranslations("billing");
const apiErrorText = useApiErrorText();
const plans = useCutPlans();
@@ -99,7 +98,12 @@ export function PlansDialog({
return (
<Dialog open={ready} onOpenChange={(open) => !open && close()}>
- <DialogContent ref={popup} initialFocus={popup} className="gap-0 overflow-hidden p-0 sm:max-w-[60rem]">
+ <DialogContent
+ ref={popup}
+ initialFocus={popup}
+ showCloseButton={!dismissLabel}
+ className="gap-0 overflow-hidden p-0 sm:max-w-[60rem]"
+ >
{/* A wash of the accent behind the heading. */}
<div className="bg-gradient-to-b from-[#0071e3]/12 to-transparent px-6 pt-9 pb-7 text-center dark:from-[#0a84ff]/18 sm:px-10">
<DialogHeader className="items-center gap-2">
@@ -126,13 +130,21 @@ export function PlansDialog({
))}
</div>
</DialogBody>
- <div className="px-6 pt-5 pb-6 text-center text-xs text-muted-foreground sm:px-10">
+ <div className="flex flex-col gap-3 px-6 pt-5 pb-6 sm:px-10">
{error ? (
- <p className="mb-2 text-sm text-destructive">
+ <p className="text-center text-sm text-destructive">
{apiErrorText(error, tBilling("billingUnavailable"))}
</p>
) : null}
- {t("footer", { currency: charge.currency.toUpperCase() })}
+ {dismissLabel ? (
+ <button
+ type="button"
+ onClick={close}
+ className="self-end text-sm text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline"
+ >
+ {dismissLabel}
+ </button>
+ ) : null}
</div>
</DialogContent>
</Dialog>
@@ -195,8 +207,9 @@ function PlanColumn({
);
}
-// The monthly price, large; an open intro offer shows its discounted first
-// months beside the struck list price, and what follows them.
+// The monthly price, large, with its cadence beside it; an open intro offer
+// shows its discounted first months beside the struck list price, and what
+// follows them.
function Price({ copy, offer }: { copy: PlanCopy; offer: IntroOffer | null }) {
const t = useTranslations("billing.plans");
const locale = useLocale();
@@ -211,11 +224,11 @@ function Price({ copy, offer }: { copy: PlanCopy; offer: IntroOffer | null }) {
) : null}
<span className="text-sm text-muted-foreground">{copy.cadence}</span>
</div>
- <div className={cn("mt-1 text-xs font-medium", offer ? BLUE_TEXT : "text-muted-foreground")}>
- {offer
- ? t("introThen", { months: offer.months, price: formatMinorPrice(offer.priceMinor, offer.currency, locale) })
- : t("billedMonthly")}
- </div>
+ {offer ? (
+ <div className={cn("mt-1 text-xs font-medium", BLUE_TEXT)}>
+ {t("introThen", { months: offer.months, price: formatMinorPrice(offer.priceMinor, offer.currency, locale) })}
+ </div>
+ ) : null}
</div>
);
}
diff --git a/site/src/cut/components/SidePanel.tsx b/site/src/cut/components/SidePanel.tsx
index 55cbcea4..e58e2c35 100644
--- a/site/src/cut/components/SidePanel.tsx
+++ b/site/src/cut/components/SidePanel.tsx
@@ -114,6 +114,7 @@ import type { MediaAsset, SidePanelTab } from "@/cut/lib/types";
import { cn } from "@/lib/utils";
import { containerOfName, isStemsName } from "@/cut/lib/exportDelivery";
import { useRevealEffect } from "@/cut/lib/refReveal";
+import { reportSideTab } from "@/cut/lib/onboarding";
import { usePanelRequestEffect } from "@/cut/lib/panelRequest";
import { CopyNameLabel } from "./AssetRefs";
import { AudioCardFace, AudioPanel } from "./AudioPanel";
@@ -318,6 +319,11 @@ export function SidePanel({
// collapse the panel so the canvas gets the room.
usePanelRequestEffect(setTab);
+ // The starter tour waits on the Media tab opening.
+ useEffect(() => {
+ reportSideTab(tab);
+ }, [tab]);
+
// The Audio tab's second column; when it's absent the audio generator is the
// outermost column and takes the floating close button on its own corner.
const musicLibrary = !sharedFeatures && audioSub === "music" && STOCK_MUSIC.length > 0;
@@ -392,6 +398,7 @@ export function SidePanel({
<button
className={tileClass}
aria-pressed={tab === id}
+ data-tour={`side-${id}`}
onClick={() => {
// In the card the panel and the inspector share the room next
// to the preview, so opening one closes the other. The clip
diff --git a/site/src/cut/components/Timeline.tsx b/site/src/cut/components/Timeline.tsx
index d846732b..d3d22ea4 100644
--- a/site/src/cut/components/Timeline.tsx
+++ b/site/src/cut/components/Timeline.tsx
@@ -3633,6 +3633,7 @@ function Transport({ total }: { total: number }) {
title={tr("playPause")}
disabled={!hasClips}
onClick={toggle}
+ data-tour="play"
>
{playing ? (
<Pause className="size-4 fill-current stroke-none" />
diff --git a/site/src/cut/components/TopBar.tsx b/site/src/cut/components/TopBar.tsx
index a1e40d8e..90371a40 100644
--- a/site/src/cut/components/TopBar.tsx
+++ b/site/src/cut/components/TopBar.tsx
@@ -39,6 +39,7 @@ import { localBackend } from "@/cut/lib/backend/local";
import { clearProjectThreads } from "@/cut/lib/chatThreads";
import { retryFailedUploads } from "@/cut/lib/importQueue";
import { backTarget, projectHref, useCutBase } from "@/cut/lib/nav";
+import { useTourHoldsStarter } from "@/cut/lib/tourLock";
import { copyProjectAcross } from "@/cut/lib/projectCopy";
import { projectDuration, useEditor } from "@/cut/lib/store";
import { useEnvironment } from "@/cut/lib/environment";
@@ -106,9 +107,12 @@ export function TopBar({
}) {
const t = useTranslations("editor.topBar");
const tColor = useTranslations("inspector.colorField");
+ const tTour = useTranslations("onboarding.tour");
const describeError = useDescribeError();
const base = useCutBase();
const back = backTarget(base, from, folder);
+ // The starter tour keeps the account in its starter project until it ends.
+ const backHeld = useTourHoldsStarter(useEditor((s) => s.projectId));
// Something to render, which footage is only one way to have: a cut of
// titles and shapes over the background frame exports like any other.
const hasPicture = useEditor((s) => projectDuration(s) > 0);
@@ -494,15 +498,37 @@ export function TopBar({
// toward whichever side has slack instead of colliding with the rail.
<header ref={headerRef} className="relative flex items-center border-b border-border bg-card">
<div ref={leftRef} className="flex shrink-0 items-center gap-1 pl-2">
- <Button
- variant="ghost"
- size="icon-sm"
- aria-label={t("backTo", { tab: back.tab })}
- nativeButton={false}
- render={<Link href={back.href} />}
- >
- <ChevronLeft />
- </Button>
+ {backHeld ? (
+ // aria-disabled keeps the hover that shows why.
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t("backTo", { tab: back.tab })}
+ aria-disabled
+ className="cursor-not-allowed opacity-50 hover:bg-transparent"
+ />
+ }
+ >
+ <ChevronLeft />
+ </TooltipTrigger>
+ <TooltipContent>{tTour("backLocked")}</TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ ) : (
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t("backTo", { tab: back.tab })}
+ nativeButton={false}
+ render={<Link href={back.href} />}
+ >
+ <ChevronLeft />
+ </Button>
+ )}
{logo}
{editing ? (
<input
diff --git a/site/src/cut/components/ViewerTopBar.tsx b/site/src/cut/components/ViewerTopBar.tsx
index 762053e8..a61cab9a 100644
--- a/site/src/cut/components/ViewerTopBar.tsx
+++ b/site/src/cut/components/ViewerTopBar.tsx
@@ -12,6 +12,7 @@ import { apiFetch } from "@/cut/lib/backend";
import { projectHref, useCutBase } from "@/cut/lib/nav";
import { OperationError, operationFailure } from "@/cut/lib/operationFailure";
import { useEditor } from "@/cut/lib/store";
+import { tourHoldsProjects } from "@/cut/lib/tourLock";
import { errorFromBody } from "@/cut/lib/userError";
import { useSession } from "@/lib/auth-client";
@@ -37,6 +38,10 @@ export function ViewerTopBar({ chatStatus }: { chatStatus: ChatStatus }) {
window.location.href = authHrefFor("/sign-in", here);
return;
}
+ // A copy is a new project, and the starter tour holds those.
+ if (tourHoldsProjects()) {
+ return;
+ }
setCopying(true);
setCopyError(null);
try {
diff --git a/site/src/cut/components/accent.ts b/site/src/cut/components/accent.ts
new file mode 100644
index 00000000..930f4699
--- /dev/null
+++ b/site/src/cut/components/accent.ts
@@ -0,0 +1,7 @@
+// The accent blue the plans and the onboarding share. The fill carries white
+// text at 4.7:1; the light-theme text shade reads on white and cream, the dark
+// one on the dark background.
+export const BLUE_FILL = "bg-[#0071e3] text-white hover:bg-[#0077ed]";
+export const BLUE_TEXT = "text-[#0062c4] dark:text-[#4aa3ff]";
+// A filled mark with no text on it, such as a progress dot.
+export const BLUE_MARK = "bg-[#0071e3] dark:bg-[#0a84ff]";
diff --git a/site/src/cut/components/onboarding/CutOnboarding.tsx b/site/src/cut/components/onboarding/CutOnboarding.tsx
index f64503ed..6b7f5989 100644
--- a/site/src/cut/components/onboarding/CutOnboarding.tsx
+++ b/site/src/cut/components/onboarding/CutOnboarding.tsx
@@ -2,10 +2,12 @@
import { DonkeyMark } from "@/components/DonkeyMark";
import { useTranslations } from "next-intl";
+import { useRouter } from "next/navigation";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { ArrowLeft, ArrowRight } from "lucide-react";
import { Button } from "@/components/ui/button";
+import { BLUE_FILL, BLUE_MARK } from "@/cut/components/accent";
import { AiChatSlide } from "@/cut/components/onboarding/slides/AiChat";
import { CreditsSlide } from "@/cut/components/onboarding/slides/Credits";
import { ModesSlide } from "@/cut/components/onboarding/slides/Modes";
@@ -14,8 +16,9 @@ import { ReferralSlide } from "@/cut/components/onboarding/slides/Referral";
import { WelcomeSlide } from "@/cut/components/onboarding/slides/Welcome";
import { useEngineUser } from "@/cut/lib/backend/hooks";
import { useEnvironment, useFormFactor } from "@/cut/lib/environment";
-import { useCutBase } from "@/cut/lib/nav";
+import { projectHref, useCutBase } from "@/cut/lib/nav";
import { onOpenOnboarding, setOnboardingCover } from "@/cut/lib/onboarding";
+import { starterProjectId } from "@/cut/lib/starter";
import { track } from "@/lib/analytics";
import {
ONBOARDING_VERSION,
@@ -23,10 +26,10 @@ import {
type OnboardingRun,
type ReferralSource,
} from "@/lib/onboarding/sequence";
+import { onboardingStage } from "@/lib/onboarding/stage";
import { cn } from "@/lib/utils";
import { useProSubscription } from "@/queries/billing";
import {
- needsOnboarding,
useOnboardingState,
useSaveOnboarding,
} from "@/queries/onboarding";
@@ -75,11 +78,13 @@ export function CutOnboarding() {
const userId = useEngineUser() ?? "";
const { data: state, isPending } = useOnboardingState();
const save = useSaveOnboarding();
- // A phone ends on the plans with no free way out: the editor needs a
- // computer, so the phone's job is the account and the plan. The ChatGPT card
- // keeps the editor on a phone and sells no plans, so it keeps the free exit.
+ // The ChatGPT card has no onboarding: the sequence never opens there.
const { chatgpt } = useEnvironment();
- const exit: PlansExit = useFormFactor() === "phone" && !chatgpt ? "paywall" : "free";
+ // A phone ends on the plans with no free way out: the editor needs a
+ // computer, so the phone's job is the account and the plan. A computer's
+ // slides hand over to the starter tour, and the plans come after it.
+ const exit: PlansExit = useFormFactor() === "phone" ? "paywall" : "free";
+ const toTour = exit === "free";
const [rawStep, setStep] = useState(0);
const saved = useMemo(() => (state?.referralSources ?? []).filter(isKnownReferralSource), [state]);
const savedOther = saved.includes("other") ? (state?.referralOther ?? "") : "";
@@ -88,6 +93,9 @@ export function CutOnboarding() {
const referrals = referralDraft ?? saved;
const referralOther = otherDraft ?? savedOther;
const [dismissed, setDismissed] = useState(false);
+ const [handedOver, setHandedOver] = useState(false);
+ const openedStarter = useRef(false);
+ const router = useRouter();
const [replaying, setReplaying] = useState(false);
// Read once per mount: whether this browser can skip the wait below.
const [skipWait] = useState(() => doneHere(userId));
@@ -107,17 +115,19 @@ export function CutOnboarding() {
// sequence's address the run opens before that read answers; it is a first
// run until the read says the account already finished, which makes it the
// replay that account linked back to.
- const run: OnboardingRun | null = replaying
- ? "replay"
- : dismissed
- ? null
- : needsOnboarding(state)
- ? "first_run"
- : askedByAddress
- ? isPending
- ? "first_run"
- : "replay"
- : null;
+ const run: OnboardingRun | null = chatgpt
+ ? null
+ : replaying
+ ? "replay"
+ : dismissed
+ ? null
+ : onboardingStage(state) === "slides"
+ ? "first_run"
+ : askedByAddress
+ ? isPending
+ ? "first_run"
+ : "replay"
+ : null;
const { data: pro } = useProSubscription({ pollMs: run && exit === "paywall" ? PAYWALL_POLL_MS : undefined });
// Navigation and progress use the slides this account can see.
@@ -126,8 +136,8 @@ export function CutOnboarding() {
const slides = useMemo(
() => SLIDES.filter((slide) =>
(slide !== "credits" || signupCredits !== null) &&
- (slide !== "plans" || !isPro)),
- [signupCredits, isPro],
+ (slide !== "plans" || (!isPro && !toTour))),
+ [signupCredits, isPro, toTour],
);
const slideCount = slides.length;
const step = Math.min(rawStep, slideCount - 1);
@@ -172,10 +182,12 @@ export function CutOnboarding() {
// rather than navigating: the page underneath is already the right one, and
// routing away would tear down the overlay showing over it. Closing puts back
// the address the user arrived with.
+ const underneath = useRef<string | null>(null);
useEffect(() => {
if (!run) return;
const target = `${base}/onboarding`;
const here = window.location.pathname + window.location.search;
+ underneath.current = window.location.pathname;
const back = here.startsWith(target) ? base : here;
if (here !== target) window.history.replaceState(null, "", target);
return () => {
@@ -185,16 +197,32 @@ export function CutOnboarding() {
};
}, [run, base]);
- // An account that's already done teaches this browser to stop waiting.
+ // An account past the slides teaches this browser to stop waiting.
useEffect(() => {
- if (!state || needsOnboarding(state)) return;
+ if (!state || onboardingStage(state) === "slides") return;
localStorage.setItem(doneKey(userId), String(state.version));
}, [state, userId]);
+ // A replay is the whole run again: the account row starts over, so the
+ // slides hand over to the starter tour and the plans close it, the same as a
+ // first run. Once per open.
+ const restarted = useRef(false);
+ useEffect(() => {
+ if (run !== "replay") {
+ restarted.current = false;
+ return;
+ }
+ if (restarted.current || !state || onboardingStage(state) === "slides") return;
+ restarted.current = true;
+ save.mutate({ restart: true });
+ }, [run, state, save]);
+
useEffect(
() =>
onOpenOnboarding(() => {
setStep(0);
+ setHandedOver(false);
+ openedStarter.current = false;
setReplaying(true);
}),
[],
@@ -227,6 +255,37 @@ export function CutOnboarding() {
[commitReferrals, run, save, step, userId],
);
+ // The slides' end on a computer: the account records it and the overlay
+ // lifts onto the starter project, where the tour picks up. Subscribers take
+ // the tour too; the plans at its end show the plan they hold.
+ const leave = useCallback(
+ (skipped: boolean) => {
+ if (!run) return;
+ if (!toTour) return finish(skipped);
+ commitReferrals();
+ track("onboarding_slides_done", { source: run, skipped, step });
+ save.mutate({ slidesDone: true });
+ setHandedOver(true);
+ localStorage.setItem(doneKey(userId), String(ONBOARDING_VERSION));
+ setReplaying(false);
+ setDismissed(true);
+ },
+ [commitReferrals, finish, run, save, step, toTour, userId],
+ );
+
+ // The tour runs on the starter project, so on a computer it opens behind
+ // the slides, and lifting them reveals it loaded. A starter the server only
+ // seeds as the slides end opens then. Once per open, and never over the
+ // starter already underneath.
+ const starterReady = state?.starterReady ?? false;
+ useEffect(() => {
+ if (!toTour || !starterReady || !userId || (!run && !handedOver) || openedStarter.current) return;
+ openedStarter.current = true;
+ const href = projectHref(base, starterProjectId(userId), "projects");
+ if (underneath.current === href) return;
+ router.push(href);
+ }, [toTour, handedOver, run, starterReady, userId, router, base]);
+
const back = useCallback(() => {
commitReferrals();
setStep(Math.max(0, step - 1));
@@ -240,12 +299,13 @@ export function CutOnboarding() {
// The plans slide ends the sequence through its own two answers — Get
// Pro, or continue with free. Arrowing or Entering past it would be a
// third, silent one, so forward stops there. A subscriber never sees that
- // slide, so forward off their last one is how the sequence ends.
- if (isPro) finish(false);
+ // slide, and on a computer the tour comes next, so forward off their last
+ // one is how the sequence ends.
+ if (isPro || toTour) leave(false);
return;
}
setStep(step + 1);
- }, [commitReferrals, finish, isPro, referrals, slide, slideCount, step]);
+ }, [commitReferrals, isPro, leave, referrals, slide, slideCount, step, toTour]);
useEffect(() => {
if (!run) return;
@@ -253,7 +313,7 @@ export function CutOnboarding() {
if (event.key === "Escape") {
// Behind the paywall Escape is no way out; a subscriber has no paywall.
if (exit === "paywall" && !isPro) return;
- return finish(true);
+ return leave(true);
}
if (event.key === "ArrowLeft") return back();
if (event.key === "ArrowRight") return advance();
@@ -269,7 +329,7 @@ export function CutOnboarding() {
};
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
- }, [run, back, advance, finish, exit, isPro]);
+ }, [run, back, advance, leave, exit, isPro]);
// The landing nav's lockup, same icon box and wordmark size. Shared by the
// hold below and the open sequence, so one becoming the other repaints
@@ -294,7 +354,7 @@ export function CutOnboarding() {
// to be done pays a single cream frame here once, then the record above
// skips the hold for good.
if (!run) {
- const waiting = isPending && !skipWait;
+ const waiting = isPending && !skipWait && !chatgpt;
return waiting ? (
<div className="fixed inset-0 z-[80] flex flex-col bg-cream font-system text-foreground antialiased dark:bg-background">
<div className="flex shrink-0 items-center justify-between px-6 py-2 md:px-10 md:py-2.5">
@@ -314,9 +374,10 @@ export function CutOnboarding() {
};
const last = step === slideCount - 1;
- // A subscriber's last slide ends the sequence from the footer, where everyone
- // else finds the plans slide's own two answers.
- const done = last && isPro;
+ // A subscriber's last slide ends the sequence from the footer, and so does a
+ // computer's, where the tour comes next. A phone finds the plans slide's own
+ // answers.
+ const done = last && (isPro || toTour);
return (
<div
@@ -329,12 +390,12 @@ export function CutOnboarding() {
{lockup}
{/* A subscriber is being told about what they already pay for, so they
- get the door: the same way out Escape takes. Everyone else meets it
- at the end, where the plans slide asks its question. */}
+ get the door: the same way out Escape takes, on to the tour on a
+ computer. Everyone else meets it at the end. */}
{isPro ? (
<Button
variant="ghost"
- onClick={() => finish(true)}
+ onClick={() => leave(true)}
className="text-foreground/70"
>
{t("skip")}
@@ -385,7 +446,7 @@ export function CutOnboarding() {
key={i}
className={cn(
"size-1.5 rounded-full transition-colors",
- i === step ? "bg-coral" : "bg-foreground/20",
+ i === step ? BLUE_MARK : "bg-foreground/20",
)}
/>
))}
@@ -399,12 +460,13 @@ export function CutOnboarding() {
onClick={advance}
disabled={slide === "referral" && !referrals.length}
className={cn(
- "gap-1.5 rounded-full bg-primary px-5 text-primary-foreground hover:bg-primary/90",
+ "gap-1.5 rounded-full px-5",
+ BLUE_FILL,
last && !done && "invisible",
)}
>
{done ? (
- t("done")
+ toTour ? t("startTour") : t("done")
) : (
<>
{t("next")}
diff --git a/site/src/cut/components/onboarding/OnboardingHost.tsx b/site/src/cut/components/onboarding/OnboardingHost.tsx
new file mode 100644
index 00000000..3c66eaf0
--- /dev/null
+++ b/site/src/cut/components/onboarding/OnboardingHost.tsx
@@ -0,0 +1,81 @@
+"use client";
+
+// The app shell's part in onboarding after the slides. While the starter tour
+// is owed it holds new projects (src/cut/lib/tourLock.ts). Once the tour is
+// done, or when an account has no starter to tour, it shows the plans, and
+// showing them is what ends onboarding: closing the dialog and leaving for
+// checkout both find the account already done. A subscriber sees the plan they
+// hold marked as current. Mounted behind the phone gate and outside the
+// ChatGPT card, which has no onboarding.
+
+import { useTranslations } from "next-intl";
+import { useEffect, useState } from "react";
+
+import { PlansDialog } from "@/cut/components/PlansDialog";
+import { useEnvironment } from "@/cut/lib/environment";
+import { useOnboardingCover, useTourSignals } from "@/cut/lib/onboarding";
+import { holdNewProjects, useTourLock } from "@/cut/lib/tourLock";
+import { track } from "@/lib/analytics";
+import { TOUR_STEPS } from "@/lib/onboarding/sequence";
+import { onboardingStage } from "@/lib/onboarding/stage";
+import { useProSubscription } from "@/queries/billing";
+import { useOnboardingState, useSaveOnboarding } from "@/queries/onboarding";
+
+export function OnboardingHost() {
+ const t = useTranslations("onboarding.plans");
+ const { chatgpt } = useEnvironment();
+ const { data: state } = useOnboardingState();
+ const { mutate: saveOnboarding } = useSaveOnboarding();
+ const covered = useOnboardingCover((s) => s.up);
+ const held = useTourSignals((s) => s.hold !== null);
+ const subscription = useProSubscription();
+ const lock = useTourLock();
+
+ // New projects wait on the tour.
+ useEffect(() => (lock.locked ? holdNewProjects(lock.resume) : undefined), [lock.locked, lock.resume]);
+
+ // The plans are owed once the slides are down, the tour's last pause is
+ // over, the stage says so, and the plan is known. A billing read that fails still shows the dialog, which
+ // says the failure itself.
+ const owed =
+ !chatgpt &&
+ !covered &&
+ !held &&
+ onboardingStage(state) === "plans" &&
+ (subscription.isSuccess || subscription.isError);
+ // Latched per run, keyed by when its slides ended, so a replay shows the
+ // plans again. The dialog stays latched open through the stage flipping to
+ // done.
+ const runKey = state?.slidesDoneAt ?? null;
+ const [shownFor, setShownFor] = useState<string | null>(null);
+ const [dismissedFor, setDismissedFor] = useState<string | null>(null);
+ if (owed && runKey !== null && shownFor !== runKey) {
+ setShownFor(runKey);
+ }
+ const shown = runKey !== null && shownFor === runKey;
+ const dismissed = runKey !== null && dismissedFor === runKey;
+
+ // Ends onboarding the moment the plans are owed.
+ const subscriber = subscription.data?.isActive ?? false;
+ useEffect(() => {
+ if (!shown) {
+ return;
+ }
+ track("onboarding_completed", { source: "first_run", skipped: false, step: TOUR_STEPS.length });
+ saveOnboarding({ completed: true, skipped: false });
+ }, [shown, saveOnboarding]);
+
+ if (!shown || dismissed) {
+ return null;
+ }
+ return (
+ <PlansDialog
+ source="onboarding"
+ entry="onboarding_tour"
+ title={t("title")}
+ body={t("subtitle")}
+ dismissLabel={subscriber ? t("continue") : t("continueFree")}
+ onClose={() => setDismissedFor(runKey)}
+ />
+ );
+}
diff --git a/site/src/cut/components/onboarding/StarterTour.tsx b/site/src/cut/components/onboarding/StarterTour.tsx
new file mode 100644
index 00000000..b3e3ebb0
--- /dev/null
+++ b/site/src/cut/components/onboarding/StarterTour.tsx
@@ -0,0 +1,528 @@
+"use client";
+
+// The starter tour: once the slides lift, the account works through a few real
+// controls in its starter project, each one highlighted until it is used. The
+// editor's own state says when a step is done, so a step moves on only when the
+// person did the thing. driver.js draws the highlight and the popover, and its
+// code loads only while a tour runs. The tour has no close: the starter holds
+// the account (its back button is held) until the last step is done. An
+// account that leaves another way finds New project locked, and the lock
+// brings it back here.
+
+import "driver.js/dist/driver.css";
+import "./tour.css";
+
+import type { Driver } from "driver.js";
+import { useTranslations } from "next-intl";
+import { useEffect, useRef } from "react";
+
+import { useEngineUser } from "@/cut/lib/backend/hooks";
+import {
+ fillChatComposer,
+ holdTour,
+ releaseTour,
+ useOnboardingCover,
+ useTourSignals,
+} from "@/cut/lib/onboarding";
+import { requestSidePanel } from "@/cut/lib/panelRequest";
+import { playheadAt } from "@/cut/lib/playhead";
+import { starterProjectId } from "@/cut/lib/starter";
+import { useEditor } from "@/cut/lib/store";
+import { track } from "@/lib/analytics";
+import { TOUR_STEPS, type TourStep } from "@/lib/onboarding/sequence";
+import { nextTourStep, onboardingStage } from "@/lib/onboarding/stage";
+import { useOnboardingState, useSaveOnboarding } from "@/queries/onboarding";
+
+// How long a step waits for its control to show (the timeline mounting, a panel
+// opening) before letting the step go, so a starter that lost that control can
+// never hold the account in the tour.
+const TARGET_WAIT_MS = 4_000;
+
+// Panels slide in over 300 ms; the highlight lands once they settle.
+const SETTLE_MS = 350;
+
+// After a step the highlight clears and the tour waits this long before the
+// next one, so the person sees what their action did: playback running, the
+// clip's settings open, the Media tab showing.
+const LINGER_MS = 1_500;
+
+// What a control can scroll inside: the timeline and the app's scroll areas.
+// A control scrolled out of one has left the highlight behind.
+const SCROLLERS = "[data-tl-scroll], [data-slot='scroll-area-viewport']";
+
+// How much of a control has to show each way to count as in view: nearly all
+// of a small one, and this many px of a large one.
+const IN_VIEW_SHARE = 0.9;
+const IN_VIEW_PX = 80;
+
+// The clip step lets playback run on to the next clip and pauses there. It
+// picks one starting at least this far ahead, and stops waiting at the cap.
+const APPROACH_LEAD_S = 0.5;
+const APPROACH_CAP_MS = 10_000;
+
+// The chat step types its example message at this pace, per character.
+const TYPE_MS = 35;
+
+// The chat step waits for the assistant's reply to land. A turn that hasn't
+// started by the first bound never will; the second caps a long one.
+const REPLY_START_MS = 5_000;
+const REPLY_CAP_MS = 90_000;
+
+type StepSpec = {
+ find: () => Element | null;
+ side: "top" | "right" | "bottom" | "left";
+ // Puts the editor where the step can be done, and clears a state that would
+ // read as done before the person acts.
+ prepare: () => void;
+ done: () => boolean;
+ // How long the tour waits after the step, while its effect shows.
+ linger: () => Promise<void>;
+ // What runs before the step first shows, such as playback reaching the
+ // control.
+ approach?: (signal: AbortSignal) => Promise<void>;
+ // A message the step types into its control once it shows.
+ type?: "chat.prompt";
+};
+
+// Each step's popover body; a step whose title says it all has none.
+const BODY = {
+ play: null,
+ clip: "clip.body",
+ media: "media.body",
+ chat: "chat.body",
+} as const satisfies Record<TourStep, string | null>;
+
+const STEPS: Record<TourStep, StepSpec> = {
+ play: {
+ find: () => shown('[data-tour="play"]:not(:disabled)'),
+ side: "top",
+ prepare: () => {
+ const editor = useEditor.getState();
+ editor.setTimelineOpen(true);
+ editor.setPlaying(false);
+ },
+ done: () => useEditor.getState().playing,
+ linger: () => pause(LINGER_MS),
+ },
+ clip: {
+ find: () => aimedClip() ?? clipInView(),
+ side: "top",
+ prepare: () => {
+ const editor = useEditor.getState();
+ editor.setTimelineOpen(true);
+ // Playback scrolls the timeline under the highlight, carrying the clip
+ // away from it.
+ editor.setPlaying(false);
+ editor.select(null);
+ // The step promises the clip's settings: a folded inspector would show
+ // only its rail.
+ editor.setInspectorOpen(true);
+ },
+ done: () => useEditor.getState().selection?.kind === "clip",
+ linger: () => pause(LINGER_MS),
+ approach: (signal) => playToNextClip(signal),
+ },
+ media: {
+ find: () => shown('[data-tour="side-media"]'),
+ side: "right",
+ prepare: () => {
+ if (useTourSignals.getState().sideTab === "media") {
+ requestSidePanel(null);
+ }
+ },
+ done: () => useTourSignals.getState().sideTab === "media",
+ linger: () => pause(LINGER_MS),
+ },
+ chat: {
+ find: () => shown('[data-tour="chat"]'),
+ side: "left",
+ prepare: () => {
+ useTourSignals.setState({ chatSent: false });
+ useEditor.getState().setAiOpen(true);
+ },
+ done: () => useTourSignals.getState().chatSent,
+ type: "chat.prompt",
+ linger: async () => {
+ await replyLanded();
+ await pause(LINGER_MS);
+ },
+ },
+};
+
+export function StarterTour({ projectId }: { projectId: string }) {
+ const t = useTranslations("onboarding.tour");
+ const userId = useEngineUser();
+ const { data: state } = useOnboardingState();
+ const { mutate: saveOnboarding } = useSaveOnboarding();
+ const covered = useOnboardingCover((s) => s.up);
+ const held = useTourSignals((s) => s.hold !== null);
+ const loaded = useEditor((s) => s.loaded);
+
+ // The step on screen: the account's next one, on its own starter project,
+ // once the editor is loaded and the slides are gone.
+ const onStarter = userId !== null && projectId === starterProjectId(userId);
+ const step = onStarter && state && onboardingStage(state) === "tour" ? nextTourStep(state) : null;
+ const active = step !== null && loaded && !covered && !held;
+
+ // One driver for the run, so the highlight glides from step to step.
+ const tour = useRef<Driver | null>(null);
+
+ // The driver goes with the tour, and with the editor.
+ useEffect(() => {
+ if (active) {
+ return;
+ }
+ tour.current?.destroy();
+ tour.current = null;
+ }, [active]);
+ useEffect(
+ () => () => {
+ tour.current?.destroy();
+ tour.current = null;
+ useTourSignals.setState({ hold: null });
+ },
+ [],
+ );
+
+ // Each step: set the editor up, wait for the control, highlight it, and
+ // record the step once the editor says it happened.
+ useEffect(() => {
+ if (!active || !step) {
+ return;
+ }
+ const spec = STEPS[step];
+ const abort = new AbortController();
+ let unwatch = () => {};
+ let untrack = () => {};
+ let recorded = false;
+ let typed = false;
+
+ // The step is recorded at once, so leaving mid-pause keeps it. The
+ // highlight clears so the editor shows the action's effect, and the pause
+ // holds the next step, and the plans after the last, until it has.
+ const complete = () => {
+ if (recorded) {
+ return;
+ }
+ recorded = true;
+ unwatch();
+ untrack();
+ tour.current?.destroy();
+ tour.current = null;
+ track("onboarding_tour_step", { step });
+ const token = holdTour();
+ saveOnboarding({ tourStep: step });
+ void spec.linger().then(() => releaseTour(token));
+ };
+
+ // Sets the editor up, waits for the control, and highlights it. Runs
+ // again whenever the control leaves the highlight: scrolled away, its
+ // panel closed, or re-rendered.
+ const show = async () => {
+ if (abort.signal.aborted || recorded) {
+ return;
+ }
+ spec.prepare();
+ const [{ driver }, found] = await Promise.all([
+ import("driver.js"),
+ waitForTarget(spec.find, TARGET_WAIT_MS, abort.signal),
+ ]);
+ if (abort.signal.aborted || recorded) {
+ return;
+ }
+
+ // A control this starter doesn't have lets the step go.
+ if (!found) {
+ return complete();
+ }
+ await pause(SETTLE_MS);
+ if (abort.signal.aborted || recorded) {
+ return;
+ }
+ const target = spec.find();
+ if (!target) {
+ return complete();
+ }
+
+ tour.current ??= driver({
+ allowClose: false,
+ allowKeyboardControl: false,
+ overlayClickBehavior: "none",
+ overlayOpacity: 0.55,
+ stagePadding: 6,
+ stageRadius: 10,
+ popoverClass: "donkey-tour",
+ });
+ tour.current.highlight({
+ element: target,
+ popover: {
+ title: t(`${step}.title`),
+ description: BODY[step] ? t(BODY[step]) : undefined,
+ side: spec.side,
+ align: "center",
+ showButtons: [],
+ showProgress: true,
+ progressText: t("progress", { current: TOUR_STEPS.indexOf(step) + 1, total: TOUR_STEPS.length }),
+ },
+ });
+ if (spec.type && !typed) {
+ typed = true;
+ void typeOut(t(spec.type), abort.signal);
+ }
+ untrack();
+ untrack = followTarget(target, {
+ moved: () => tour.current?.refresh(),
+ lost: () => {
+ untrack();
+ void show();
+ },
+ });
+ };
+
+ // Doing the thing counts from the start, even before the highlight lands.
+ unwatch = watchDone(spec.done, complete);
+ void (spec.approach?.(abort.signal) ?? Promise.resolve()).then(show);
+
+ return () => {
+ abort.abort();
+ unwatch();
+ untrack();
+ };
+ }, [active, step, saveOnboarding, t]);
+
+ return null;
+}
+
+// The first match in view: a route left behind by instant navigation stays
+// mounted with display:none, and its controls must not count.
+function shown(selector: string): Element | null {
+ for (const el of document.querySelectorAll(selector)) {
+ if (inView(el)) {
+ return el;
+ }
+ }
+ return null;
+}
+
+// Whether the control shows inside its scroller and the window, by enough to
+// see and click it each way.
+function inView(el: Element, axes: "both" | "vertical" = "both"): boolean {
+ if (!el.isConnected || !el.checkVisibility()) {
+ return false;
+ }
+ const rect = el.getBoundingClientRect();
+ const frames = [new DOMRect(0, 0, window.innerWidth, window.innerHeight)];
+ const scroller = el.closest(SCROLLERS);
+ if (scroller) {
+ frames.push(scroller.getBoundingClientRect());
+ }
+ const enough = (shown: number, size: number) => shown >= Math.min(size * IN_VIEW_SHARE, IN_VIEW_PX);
+ return frames.every(
+ (frame) =>
+ enough(Math.min(rect.bottom, frame.bottom) - Math.max(rect.top, frame.top), rect.height) &&
+ (axes === "vertical" ||
+ enough(Math.min(rect.right, frame.right) - Math.max(rect.left, frame.left), rect.width)),
+ );
+}
+
+// A clip's box on the timeline, by its id. An editor left behind by instant
+// navigation keeps its own hidden copy, so the visible one is picked.
+function clipBox(id: string): Element | null {
+ const boxes = document.querySelectorAll(`[data-tl-scroll] [data-tl-sel="clip:${id}"]`);
+ return [...boxes].find((el) => el.checkVisibility()) ?? null;
+}
+
+// The clip playback is running on to, picked by playToNextClip.
+let aimedClipId: string | null = null;
+
+// The aimed clip's box on the timeline, when it is in view.
+function aimedClip(): Element | null {
+ if (!aimedClipId) {
+ return null;
+ }
+ const el = clipBox(aimedClipId);
+ return el && inView(el) ? el : null;
+}
+
+// Lets running playback reach the next clip and pause at its start, where the
+// timeline has brought it into view. Anything the person does in the meantime
+// (a click, a key, a scroll) ends the wait at once, as does the cap. Resolves
+// right away when nothing is playing or no clip lies ahead.
+function playToNextClip(signal: AbortSignal): Promise<void> {
+ aimedClipId = null;
+ const editor = useEditor.getState();
+ if (!editor.playing) {
+ return Promise.resolve();
+ }
+ // A clip on a row in view, since the timeline follows the playhead
+ // sideways, never up or down; failing that, the main row's next clip.
+ const now = playheadAt();
+ const ahead = editor.clips
+ .filter((clip) => clip.start >= now + APPROACH_LEAD_S)
+ .sort((a, b) => a.start - b.start);
+ const next =
+ ahead.find((clip) => {
+ const el = clipBox(clip.id);
+ return el !== null && inView(el, "vertical");
+ }) ?? ahead.find((clip) => clip.track === 0);
+ if (!next) {
+ return Promise.resolve();
+ }
+ aimedClipId = next.id;
+ useEditor.setState({ previewStopAt: next.start });
+
+ return new Promise((resolve) => {
+ const off = useEditor.subscribe((s) => {
+ if (!s.playing) {
+ finish();
+ }
+ });
+ const timer = window.setTimeout(finish, APPROACH_CAP_MS);
+ const listen = { capture: true, passive: true } as const;
+ window.addEventListener("pointerdown", finish, listen);
+ window.addEventListener("keydown", finish, listen);
+ window.addEventListener("wheel", finish, listen);
+ signal.addEventListener("abort", finish);
+ function finish() {
+ off();
+ window.clearTimeout(timer);
+ window.removeEventListener("pointerdown", finish, listen);
+ window.removeEventListener("keydown", finish, listen);
+ window.removeEventListener("wheel", finish, listen);
+ signal.removeEventListener("abort", finish);
+ resolve();
+ }
+ });
+}
+
+// Types `text` into the chat composer a character at a time. A key the person
+// presses takes the composer back from it.
+async function typeOut(text: string, signal: AbortSignal): Promise<void> {
+ let stopped = false;
+ const stop = () => {
+ stopped = true;
+ };
+ window.addEventListener("keydown", stop, { capture: true });
+ signal.addEventListener("abort", stop);
+ for (let i = 1; i <= text.length && !stopped; i += 1) {
+ fillChatComposer(text.slice(0, i));
+ await pause(TYPE_MS);
+ }
+ window.removeEventListener("keydown", stop, { capture: true });
+ signal.removeEventListener("abort", stop);
+}
+
+// The timeline clip in view nearest the playhead. With every clip scrolled
+// away, the first one scrolls into view.
+function clipInView(): Element | null {
+ const clips = [...document.querySelectorAll('[data-tl-scroll] [data-tl-sel^="clip:"]')].filter((el) =>
+ el.checkVisibility(),
+ );
+ const now = playheadAt();
+ const starts = new Map(useEditor.getState().clips.map((clip) => [`clip:${clip.id}`, clip.start]));
+ const away = (el: Element) => Math.abs((starts.get(el.getAttribute("data-tl-sel") ?? "") ?? Infinity) - now);
+ const seen = clips.filter((el) => inView(el)).sort((a, b) => away(a) - away(b))[0];
+ if (seen || !clips[0]) {
+ return seen ?? null;
+ }
+ clips[0].scrollIntoView({ block: "nearest", inline: "nearest" });
+ return clips[0];
+}
+
+// Keeps the highlight on its control: a scroll, a resize or a re-render
+// checks once per frame whether the control is still in view. `moved` redraws
+// the highlight where it is now; `lost` fires when it has gone.
+function followTarget(target: Element, on: { moved: () => void; lost: () => void }): () => void {
+ let frame = 0;
+ const check = () => {
+ frame = 0;
+ if (inView(target)) {
+ on.moved();
+ return;
+ }
+ on.lost();
+ };
+ const schedule = () => {
+ frame ||= window.requestAnimationFrame(check);
+ };
+ const resized = new ResizeObserver(schedule);
+ resized.observe(target);
+ const rendered = new MutationObserver(schedule);
+ rendered.observe(document.body, { childList: true, subtree: true });
+ document.addEventListener("scroll", schedule, { capture: true, passive: true });
+ window.addEventListener("resize", schedule);
+ return () => {
+ window.cancelAnimationFrame(frame);
+ resized.disconnect();
+ rendered.disconnect();
+ document.removeEventListener("scroll", schedule, { capture: true });
+ window.removeEventListener("resize", schedule);
+ };
+}
+
+// Resolves with the control once it shows, or null after `ms`.
+function waitForTarget(find: () => Element | null, ms: number, signal: AbortSignal): Promise<Element | null> {
+ return new Promise((resolve) => {
+ const hit = find();
+ if (hit) {
+ return resolve(hit);
+ }
+ const observer = new MutationObserver(() => {
+ const el = find();
+ if (el) {
+ finish(el);
+ }
+ });
+ const timer = window.setTimeout(() => finish(null), ms);
+ const finish = (el: Element | null) => {
+ observer.disconnect();
+ window.clearTimeout(timer);
+ signal.removeEventListener("abort", stop);
+ resolve(el);
+ };
+ const stop = () => finish(null);
+ signal.addEventListener("abort", stop);
+ observer.observe(document.body, { attributes: true, childList: true, subtree: true });
+ });
+}
+
+const pause = (ms: number) => new Promise<void>((resolve) => window.setTimeout(resolve, ms));
+
+// Resolves once a chat turn has started and finished, or when none starts in
+// time, or at the cap.
+function replyLanded(): Promise<void> {
+ return new Promise((resolve) => {
+ let started = useTourSignals.getState().chatRunning;
+ const timers = [
+ window.setTimeout(() => !started && finish(), REPLY_START_MS),
+ window.setTimeout(finish, REPLY_CAP_MS),
+ ];
+ const off = useTourSignals.subscribe((s) => {
+ if (s.chatRunning) {
+ started = true;
+ return;
+ }
+ if (started) {
+ finish();
+ }
+ });
+ function finish() {
+ timers.forEach((timer) => window.clearTimeout(timer));
+ off();
+ resolve();
+ }
+ });
+}
+
+// Calls `onDone` once `done` holds, checking now and on every editor or tour
+// signal change.
+function watchDone(done: () => boolean, onDone: () => void): () => void {
+ const check = () => {
+ if (done()) {
+ onDone();
+ }
+ };
+ const offs = [useEditor.subscribe(check), useTourSignals.subscribe(check)];
+ check();
+ return () => offs.forEach((off) => off());
+}
diff --git a/site/src/cut/components/onboarding/slides/Credits.tsx b/site/src/cut/components/onboarding/slides/Credits.tsx
index 453178d8..54290f8c 100644
--- a/site/src/cut/components/onboarding/slides/Credits.tsx
+++ b/site/src/cut/components/onboarding/slides/Credits.tsx
@@ -3,8 +3,10 @@
import { useFormatter, useLocale, useTranslations } from "next-intl";
import { useEffect, useRef } from "react";
+import { BLUE_TEXT } from "@/cut/components/accent";
import { burstConfetti } from "@/cut/components/onboarding/confetti";
import { creditCountLabel, creditsFromDollars } from "@/lib/credits/format-credits";
+import { cn } from "@/lib/utils";
// The signup grant already landed when the account was created, so this slide
// never grants anything — it says what's there: the credits the grant carried,
@@ -41,10 +43,10 @@ export function CreditsSlide({
className="pointer-events-none fixed inset-0 h-full w-full"
/>
<div className="relative max-w-[900px]">
- {/* One line, two sizes: the amount at display size in coral, the words
+ {/* One line, two sizes: the amount at display size in the accent blue, the words
a couple of steps down and thin beside it. */}
<h2 className="flex flex-wrap items-baseline justify-center gap-x-4 leading-[1.02] tracking-[-0.03em]">
- <span className="text-[clamp(40px,7.4vw,84px)] font-semibold text-coral tabular-nums">
+ <span className={cn("text-[clamp(40px,7.4vw,84px)] font-semibold tabular-nums", BLUE_TEXT)}>
{creditCountLabel(creditsFromDollars(credits, "down"), locale)}
</span>
<span className="text-[clamp(26px,4.4vw,52px)] font-light">
diff --git a/site/src/cut/components/onboarding/slides/Modes.tsx b/site/src/cut/components/onboarding/slides/Modes.tsx
index 99ff0680..69c755fe 100644
--- a/site/src/cut/components/onboarding/slides/Modes.tsx
+++ b/site/src/cut/components/onboarding/slides/Modes.tsx
@@ -23,7 +23,7 @@ export function ModesSlide() {
<Mode
icon={<Cloud className="size-5" />}
title={t("cloudTitle")}
- tape="coral"
+ tape="blue"
points={[t("cloudNoInstall"), t("cloudAnyBrowser"), t("cloudRendering")]}
/>
<Mode
@@ -49,7 +49,7 @@ function Mode({
}: {
icon: React.ReactNode;
points: string[];
- tape: "coral" | "yellow";
+ tape: "blue" | "yellow";
title: string;
}) {
return (
diff --git a/site/src/cut/components/onboarding/slides/Plans.tsx b/site/src/cut/components/onboarding/slides/Plans.tsx
index 7b41e357..0026ad1c 100644
--- a/site/src/cut/components/onboarding/slides/Plans.tsx
+++ b/site/src/cut/components/onboarding/slides/Plans.tsx
@@ -19,10 +19,10 @@ import { useIntroOffer, type IntroOffer } from "@/queries/billing";
import "../onboarding.css";
-// The landing's own card colors, so a plan looks the same wherever it's met.
+// The landing's card palette, with the recommended plan in the onboarding's blue.
const PLAN_CARD: Record<PaidPlan, { color: CardColor; tapeColor: CardColor }> = {
plus: { color: "cream", tapeColor: "mint" },
- pro: { color: "coral", tapeColor: "yellow" },
+ pro: { color: "blue", tapeColor: "yellow" },
max: { color: "cream", tapeColor: "pink" },
};
diff --git a/site/src/cut/components/onboarding/tour.css b/site/src/cut/components/onboarding/tour.css
new file mode 100644
index 00000000..2f4b6425
--- /dev/null
+++ b/site/src/cut/components/onboarding/tour.css
@@ -0,0 +1,208 @@
+/* The starter tour's popover, in the app's popover tokens so it follows the
+ light and dark themes, with the onboarding's accent blue on the progress and
+ around the control being taught. */
+
+/* The accent in each theme: the text shade reads on the popover, the ring
+ shade on the editor around the control. Dark follows the app: the .dark
+ class, or a dark system with no .light override. */
+:root {
+ --tour-blue: #0062c4;
+ --tour-ring: #0071e3;
+ --tour-shadow: rgb(0 0 0 / 0.18);
+ /* Light mode's glow sits on the dimmed editor, so it runs denser and wider
+ than dark mode's to read at all. */
+ --tour-glow-ring: color-mix(in oklab, var(--tour-ring) 55%, transparent);
+ --tour-glow: 0 0 56px 18px color-mix(in oklab, var(--tour-ring) 90%, transparent);
+ --tour-glow-low: 0.7;
+}
+
+.dark {
+ --tour-blue: #4aa3ff;
+ --tour-ring: #0a84ff;
+ --tour-shadow: rgb(0 0 0 / 0.5);
+ --tour-glow-ring: color-mix(in oklab, var(--tour-ring) 25%, transparent);
+ --tour-glow: 0 0 40px 10px color-mix(in oklab, var(--tour-ring) 50%, transparent);
+ --tour-glow-low: 0.45;
+}
+
+@media (prefers-color-scheme: dark) {
+ :root:not(.light) {
+ --tour-blue: #4aa3ff;
+ --tour-ring: #0a84ff;
+ --tour-shadow: rgb(0 0 0 / 0.5);
+ --tour-glow-ring: color-mix(in oklab, var(--tour-ring) 25%, transparent);
+ --tour-glow: 0 0 40px 10px color-mix(in oklab, var(--tour-ring) 50%, transparent);
+ --tour-glow-low: 0.45;
+ }
+}
+
+/* The popover glows in the accent, bobs toward the control it points at, and
+ its glow breathes at rest, so it reads against a busy editor. Both animate
+ only translate and opacity, which stay on the compositor. Scoped under the
+ body's driver-active class so the library's own fade-in rule, which comes
+ in at the same weight, never replaces them. */
+body.driver-active .driver-popover.donkey-tour {
+ font-family: var(--font-system);
+ color: var(--popover-foreground);
+ background-color: var(--popover);
+ border: 1px solid var(--tour-ring);
+ border-radius: var(--radius-lg);
+ box-shadow: 0 12px 32px var(--tour-shadow);
+ padding: 14px 16px;
+ min-width: 240px;
+ max-width: 300px;
+ animation:
+ animate-fade-in var(--driver-animation-duration, 0.4s),
+ donkey-tour-bob 1.6s ease-in-out 0.4s infinite;
+}
+
+body.driver-active .driver-popover.donkey-tour::before {
+ content: "";
+ position: absolute;
+ inset: 0;
+ z-index: -1;
+ border-radius: inherit;
+ box-shadow:
+ 0 0 0 4px var(--tour-glow-ring),
+ var(--tour-glow);
+ pointer-events: none;
+ animation: donkey-tour-breathe 2.4s ease-in-out infinite;
+}
+
+/* Which way is toward the control: the side class names where the popover
+ sits relative to it. */
+.driver-popover.donkey-tour.driver-popover-side-top {
+ --tour-bob: 0 6px;
+}
+
+.driver-popover.donkey-tour.driver-popover-side-bottom {
+ --tour-bob: 0 -6px;
+}
+
+.driver-popover.donkey-tour.driver-popover-side-left {
+ --tour-bob: 6px 0;
+}
+
+.driver-popover.donkey-tour.driver-popover-side-right {
+ --tour-bob: -6px 0;
+}
+
+@keyframes donkey-tour-bob {
+ 0%,
+ 100% {
+ translate: 0 0;
+ }
+ 50% {
+ translate: var(--tour-bob, 0 0);
+ }
+}
+
+@keyframes donkey-tour-breathe {
+ 0%,
+ 100% {
+ opacity: var(--tour-glow-low);
+ }
+ 50% {
+ opacity: 1;
+ }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ body.driver-active .driver-popover.donkey-tour,
+ body.driver-active .driver-popover.donkey-tour::before {
+ animation: none;
+ }
+}
+
+.driver-popover.donkey-tour .driver-popover-title {
+ font-size: 14px;
+ font-weight: 600;
+ line-height: 1.4;
+}
+
+.driver-popover.donkey-tour .driver-popover-description {
+ font-size: 13px;
+ line-height: 1.5;
+ color: var(--muted-foreground);
+}
+
+.driver-popover.donkey-tour .driver-popover-footer {
+ margin-top: 10px;
+}
+
+.driver-popover.donkey-tour .driver-popover-progress-text {
+ font-size: 12px;
+ font-weight: 600;
+ color: var(--tour-blue);
+}
+
+/* The arrow is a square turned 45 degrees in the popover's fill, centred on
+ the popover's border line, with the accent on its two outer sides, so the
+ border runs out to the point and back. The library names the arrow by the
+ side the popover sits on: side-left sits on the popover's right edge and
+ points right. It places the arrow along the edge itself. */
+body.driver-active .driver-popover.donkey-tour .driver-popover-arrow {
+ box-sizing: border-box;
+ width: 10px;
+ height: 10px;
+ border: 0 solid var(--tour-ring);
+ background-color: var(--popover);
+ rotate: 45deg;
+}
+
+body.driver-active .driver-popover.donkey-tour .driver-popover-arrow-side-left {
+ left: calc(100% - 4.5px);
+ border-top-width: 1px;
+ border-right-width: 1px;
+}
+
+body.driver-active .driver-popover.donkey-tour .driver-popover-arrow-side-right {
+ right: calc(100% - 4.5px);
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+}
+
+body.driver-active .driver-popover.donkey-tour .driver-popover-arrow-side-top {
+ top: calc(100% - 4.5px);
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+}
+
+body.driver-active .driver-popover.donkey-tour .driver-popover-arrow-side-bottom {
+ bottom: calc(100% - 4.5px);
+ border-top-width: 1px;
+ border-left-width: 1px;
+}
+
+/* The control being taught carries the accent ring, drawn inside its own edge:
+ the rail, the timeline and the chat panel all clip what spills past it. */
+.driver-active .driver-active-element {
+ outline: 2px solid var(--tour-ring);
+ outline-offset: -2px;
+}
+
+/* A timeline clip's thumbnails and badges (up to z-4) paint over its own
+ outline, so its ring rides a layer above them. The clip is already
+ positioned. */
+body.driver-active .tl-clip.driver-active-element {
+ outline: none;
+}
+
+body.driver-active .tl-clip.driver-active-element::after {
+ content: "";
+ position: absolute;
+ inset: 0;
+ z-index: 5;
+ border: 2px solid var(--tour-ring);
+ border-radius: inherit;
+ pointer-events: none;
+}
+
+/* Inside the control being taught, everything takes back the pointer events
+ the app gave it. The library forces auto on every descendant, which lifts
+ pass-through layers (the composer's mirror over its textarea) into the way
+ of the clicks they exist to let through. revert-layer drops the library's
+ unlayered rules and lands on the app's layered ones. */
+body.driver-active .driver-active-element * {
+ pointer-events: revert-layer;
+}
diff --git a/site/src/cut/lib/onboarding.ts b/site/src/cut/lib/onboarding.ts
index 2a8c72b2..0736859e 100644
--- a/site/src/cut/lib/onboarding.ts
+++ b/site/src/cut/lib/onboarding.ts
@@ -21,3 +21,58 @@ export function onOpenOnboarding(handler: () => void): () => void {
window.addEventListener(EVENT, handler);
return () => window.removeEventListener(EVENT, handler);
}
+
+/** What the starter tour waits on that the editor store doesn't hold: the side
+ * panel's open tab, which lives in the panel's own state, whether a chat
+ * message went out, and whether a chat turn is running. The panel and the chat
+ * report here; the tour reads. `hold` is the tour's own pause after a step,
+ * while the person watches what their action did: the next step and the plans
+ * both wait it out. It carries a token, so a pause only ends itself. */
+export const useTourSignals = create<{
+ sideTab: string | null;
+ chatSent: boolean;
+ chatRunning: boolean;
+ hold: number | null;
+}>(() => ({
+ sideTab: null,
+ chatSent: false,
+ chatRunning: false,
+ hold: null,
+}));
+
+export const reportSideTab = (sideTab: string | null) => useTourSignals.setState({ sideTab });
+
+export const reportChatSent = () => useTourSignals.setState({ chatSent: true });
+
+export const reportChatRunning = (chatRunning: boolean) => useTourSignals.setState({ chatRunning });
+
+let fillComposer: ((text: string) => void) | null = null;
+
+/** Registers the chat composer the tour types into; returns the release. */
+export function onComposerFill(handler: (text: string) => void): () => void {
+ fillComposer = handler;
+ return () => {
+ if (fillComposer === handler) {
+ fillComposer = null;
+ }
+ };
+}
+
+/** Sets the chat composer's text, as the tour types its example message. */
+export const fillChatComposer = (text: string) => fillComposer?.(text);
+
+let holdSeq = 0;
+
+/** Starts a pause; returns the token that ends it. */
+export function holdTour(): number {
+ holdSeq += 1;
+ useTourSignals.setState({ hold: holdSeq });
+ return holdSeq;
+}
+
+/** Ends the pause the token started, if it is still the one running. */
+export function releaseTour(token: number): void {
+ if (useTourSignals.getState().hold === token) {
+ useTourSignals.setState({ hold: null });
+ }
+}
diff --git a/site/src/cut/lib/projectLimit.ts b/site/src/cut/lib/projectLimit.ts
index 40c2afc0..48471fed 100644
--- a/site/src/cut/lib/projectLimit.ts
+++ b/site/src/cut/lib/projectLimit.ts
@@ -1,7 +1,7 @@
// The free project limit, checked before any new project is made: the
// projects home, the sidebar, a file dropped on the home, a duplicate, and
// the ChatGPT card all ask here first. A move keeps the count, so it never
-// asks.
+// asks. The starter tour holds new projects ahead of the limit.
import type { QueryClient } from "@tanstack/react-query";
import { track } from "@/lib/analytics";
@@ -11,10 +11,11 @@ import { fetchProSubscription, proSubscriptionQueryKey } from "@/queries/billing
import { currentEngineUser } from "./api";
import { listedProjectIds } from "./queries";
+import { tourHoldsProjects } from "./tourLock";
import { openUpgrade } from "./upgrade";
/** True when the account may make another project. When it may not, the
- * upgrade wall is already up. */
+ * upgrade wall is already up, or the account is on its way back to the tour. */
export async function newProjectAllowed(client: QueryClient): Promise<boolean> {
// Signed out, the projects are this browser's own and no plan applies.
const userId = currentEngineUser();
@@ -22,6 +23,10 @@ export async function newProjectAllowed(client: QueryClient): Promise<boolean> {
return true;
}
+ if (tourHoldsProjects()) {
+ return false;
+ }
+
const config = await client.ensureQueryData({ queryKey: accountConfigQueryKey, queryFn: fetchAccountConfig });
const limit = config.settings.freeProjectLimit.projects;
if (limit === null) {
diff --git a/site/src/cut/lib/tourLock.ts b/site/src/cut/lib/tourLock.ts
new file mode 100644
index 00000000..e86a767f
--- /dev/null
+++ b/site/src/cut/lib/tourLock.ts
@@ -0,0 +1,69 @@
+"use client";
+
+// The starter tour's hold on new projects. While an account owes the tour, the
+// onboarding host in the app shell registers here, and every way of making a
+// project asks first: newProjectAllowed for the home, the sidebar, a file drop
+// and a duplicate, and the shared view's copy. A held ask sends the account
+// back to the tour. The ChatGPT card mounts no host, so nothing holds there.
+
+import { useCallback } from "react";
+import { useRouter } from "next/navigation";
+
+import { useEngineUser } from "@/cut/lib/backend/hooks";
+import { useEnvironment } from "@/cut/lib/environment";
+import { projectHref, useCutBase } from "@/cut/lib/nav";
+import { starterProjectId } from "@/cut/lib/starter";
+import { track } from "@/lib/analytics";
+import { onboardingStage } from "@/lib/onboarding/stage";
+import { useOnboardingState } from "@/queries/onboarding";
+
+let resumeTour: (() => void) | null = null;
+
+/** Registers the host's way back to the tour; returns the release. */
+export function holdNewProjects(resume: () => void): () => void {
+ resumeTour = resume;
+ return () => {
+ if (resumeTour === resume) {
+ resumeTour = null;
+ }
+ };
+}
+
+/** True when the tour holds new projects. The account is already on its way
+ * back to the tour. */
+export function tourHoldsProjects(): boolean {
+ if (!resumeTour) {
+ return false;
+ }
+ resumeTour();
+ return true;
+}
+
+/** Whether the tour holds new projects for this account, and the way back to
+ * it: the starter project, where the tour picks up at its next step. */
+export function useTourLock(): { locked: boolean; resume: () => void } {
+ const { chatgpt } = useEnvironment();
+ const { data } = useOnboardingState();
+ const userId = useEngineUser();
+ const router = useRouter();
+ const base = useCutBase();
+ const locked = !chatgpt && onboardingStage(data) === "tour";
+
+ const resume = useCallback(() => {
+ if (!userId) {
+ return;
+ }
+ track("onboarding_tour_resumed");
+ router.push(projectHref(base, starterProjectId(userId), "projects"));
+ }, [base, router, userId]);
+
+ return { locked, resume };
+}
+
+/** Whether the tour keeps the account in this project: the starter, until
+ * the tour is done. */
+export function useTourHoldsStarter(projectId: string | null): boolean {
+ const { locked } = useTourLock();
+ const userId = useEngineUser();
+ return locked && userId !== null && projectId === starterProjectId(userId);
+}
diff --git a/site/src/cut/lib/upgrade.ts b/site/src/cut/lib/upgrade.ts
index 7d20cd65..2d6d0e9a 100644
--- a/site/src/cut/lib/upgrade.ts
+++ b/site/src/cut/lib/upgrade.ts
@@ -15,7 +15,8 @@ export type UpgradeEntry =
| "project_limit"
| "storage_pill"
| "storage_refused"
- | "render_refused";
+ | "render_refused"
+ | "onboarding_tour";
export type UpgradeRequest = { reason: UpgradeReason; entry: UpgradeEntry };
diff --git a/site/src/i18n/messages/.source-lock.json b/site/src/i18n/messages/.source-lock.json
index b193bcb4..b16ecefe 100644
--- a/site/src/i18n/messages/.source-lock.json
+++ b/site/src/i18n/messages/.source-lock.json
@@ -98,14 +98,12 @@
"plans.paidOutBody": "18f057593944",
"plans.topOutTitle": "713a8c79ed21",
"plans.bestValue": "8173c2a946f1",
- "plans.billedMonthly": "cad51bd43867",
"plans.introThen": "49e300236000",
"plans.stickerPercent": "e5544c338932",
"plans.stickerOff": "da7a68734367",
"plans.get": "36572be917c8",
"plans.upgrade": "413370c98be7",
- "plans.current": "ec5cfba8f01b",
- "plans.footer": "9f7466d09417"
+ "plans.current": "ec5cfba8f01b"
},
"de/chat": {
"panel.signInToChat": "8b2dd174b118",
@@ -2482,6 +2480,7 @@
"sequence.back": "b52b36b7269f",
"sequence.next": "bc981983e7f5",
"sequence.done": "e9b450d14bc2",
+ "sequence.startTour": "aa2f2e01b3a6",
"welcome.title": "1ff8424d8185",
"welcome.body": "81a7a12c9d27",
"referral.title": "eec24033d0d5",
@@ -2516,13 +2515,25 @@
"phoneGate.title": "7c611b86cca8",
"phoneGate.body": "368650b59762",
"plans.title": "c0c6a5e91743",
- "plans.subtitle": "e0d25a257d31",
+ "plans.subtitle": "562dc2a1b40f",
"plans.bestValue": "8173c2a946f1",
"plans.getPlan": "36572be917c8",
"plans.getProOff": "295f4fc9c6f1",
"plans.continueFree": "d7f2a5d8710f",
+ "plans.continue": "2e02623966f9",
"plans.paywallSubtitle": "9609471d3646",
- "plans.covers": "42fa1aae2a8e"
+ "plans.covers": "42fa1aae2a8e",
+ "tour.play.title": "030baee9ae8b",
+ "tour.clip.title": "b64d71a2d72b",
+ "tour.clip.body": "f0e51e7970fc",
+ "tour.media.title": "1041f7be27f8",
+ "tour.media.body": "116145079858",
+ "tour.chat.title": "10d7e23f84e5",
+ "tour.chat.body": "cfda703d1135",
+ "tour.chat.prompt": "b27d77aa0732",
+ "tour.progress": "7e20641fe8fb",
+ "tour.locked": "d503fd48a6d4",
+ "tour.backLocked": "7933631d4780"
},
"de/panels": {
"transitions.groups.fade": "5298d08bb7ae",
@@ -3119,14 +3130,12 @@
"plans.paidOutBody": "18f057593944",
"plans.topOutTitle": "713a8c79ed21",
"plans.bestValue": "8173c2a946f1",
- "plans.billedMonthly": "cad51bd43867",
"plans.introThen": "49e300236000",
"plans.stickerPercent": "e5544c338932",
"plans.stickerOff": "da7a68734367",
"plans.get": "36572be917c8",
"plans.upgrade": "413370c98be7",
- "plans.current": "ec5cfba8f01b",
- "plans.footer": "9f7466d09417"
+ "plans.current": "ec5cfba8f01b"
},
"es/chat": {
"panel.signInToChat": "8b2dd174b118",
@@ -5503,6 +5512,7 @@
"sequence.back": "b52b36b7269f",
"sequence.next": "bc981983e7f5",
"sequence.done": "e9b450d14bc2",
+ "sequence.startTour": "aa2f2e01b3a6",
"welcome.title": "1ff8424d8185",
"welcome.body": "81a7a12c9d27",
"referral.title": "eec24033d0d5",
@@ -5537,13 +5547,25 @@
"phoneGate.title": "7c611b86cca8",
"phoneGate.body": "368650b59762",
"plans.title": "c0c6a5e91743",
- "plans.subtitle": "e0d25a257d31",
+ "plans.subtitle": "562dc2a1b40f",
"plans.bestValue": "8173c2a946f1",
"plans.getPlan": "36572be917c8",
"plans.getProOff": "295f4fc9c6f1",
"plans.continueFree": "d7f2a5d8710f",
+ "plans.continue": "2e02623966f9",
"plans.paywallSubtitle": "9609471d3646",
- "plans.covers": "42fa1aae2a8e"
+ "plans.covers": "42fa1aae2a8e",
+ "tour.play.title": "030baee9ae8b",
+ "tour.clip.title": "b64d71a2d72b",
+ "tour.clip.body": "f0e51e7970fc",
+ "tour.media.title": "1041f7be27f8",
+ "tour.media.body": "116145079858",
+ "tour.chat.title": "10d7e23f84e5",
+ "tour.chat.body": "cfda703d1135",
+ "tour.chat.prompt": "b27d77aa0732",
+ "tour.progress": "7e20641fe8fb",
+ "tour.locked": "d503fd48a6d4",
+ "tour.backLocked": "7933631d4780"
},
"es/panels": {
"transitions.groups.fade": "5298d08bb7ae",
@@ -6140,14 +6162,12 @@
"plans.paidOutBody": "18f057593944",
"plans.topOutTitle": "713a8c79ed21",
"plans.bestValue": "8173c2a946f1",
- "plans.billedMonthly": "cad51bd43867",
"plans.introThen": "49e300236000",
"plans.stickerPercent": "e5544c338932",
"plans.stickerOff": "da7a68734367",
"plans.get": "36572be917c8",
"plans.upgrade": "413370c98be7",
- "plans.current": "ec5cfba8f01b",
- "plans.footer": "9f7466d09417"
+ "plans.current": "ec5cfba8f01b"
},
"fr/chat": {
"panel.signInToChat": "8b2dd174b118",
@@ -8524,6 +8544,7 @@
"sequence.back": "b52b36b7269f",
"sequence.next": "bc981983e7f5",
"sequence.done": "e9b450d14bc2",
+ "sequence.startTour": "aa2f2e01b3a6",
"welcome.title": "1ff8424d8185",
"welcome.body": "81a7a12c9d27",
"referral.title": "eec24033d0d5",
@@ -8558,13 +8579,25 @@
"phoneGate.title": "7c611b86cca8",
"phoneGate.body": "368650b59762",
"plans.title": "c0c6a5e91743",
- "plans.subtitle": "e0d25a257d31",
+ "plans.subtitle": "562dc2a1b40f",
"plans.bestValue": "8173c2a946f1",
"plans.getPlan": "36572be917c8",
"plans.getProOff": "295f4fc9c6f1",
"plans.continueFree": "d7f2a5d8710f",
+ "plans.continue": "2e02623966f9",
"plans.paywallSubtitle": "9609471d3646",
- "plans.covers": "42fa1aae2a8e"
+ "plans.covers": "42fa1aae2a8e",
+ "tour.play.title": "030baee9ae8b",
+ "tour.clip.title": "b64d71a2d72b",
+ "tour.clip.body": "f0e51e7970fc",
+ "tour.media.title": "1041f7be27f8",
+ "tour.media.body": "116145079858",
+ "tour.chat.title": "10d7e23f84e5",
+ "tour.chat.body": "cfda703d1135",
+ "tour.chat.prompt": "b27d77aa0732",
+ "tour.progress": "7e20641fe8fb",
+ "tour.locked": "d503fd48a6d4",
+ "tour.backLocked": "7933631d4780"
},
"fr/panels": {
"transitions.groups.fade": "5298d08bb7ae",
@@ -9161,14 +9194,12 @@
"plans.paidOutBody": "18f057593944",
"plans.topOutTitle": "713a8c79ed21",
"plans.bestValue": "8173c2a946f1",
- "plans.billedMonthly": "cad51bd43867",
"plans.introThen": "49e300236000",
"plans.stickerPercent": "e5544c338932",
"plans.stickerOff": "da7a68734367",
"plans.get": "36572be917c8",
"plans.upgrade": "413370c98be7",
- "plans.current": "ec5cfba8f01b",
- "plans.footer": "9f7466d09417"
+ "plans.current": "ec5cfba8f01b"
},
"ja/chat": {
"panel.signInToChat": "8b2dd174b118",
@@ -11545,6 +11576,7 @@
"sequence.back": "b52b36b7269f",
"sequence.next": "bc981983e7f5",
"sequence.done": "e9b450d14bc2",
+ "sequence.startTour": "aa2f2e01b3a6",
"welcome.title": "1ff8424d8185",
"welcome.body": "81a7a12c9d27",
"referral.title": "eec24033d0d5",
@@ -11579,13 +11611,25 @@
"phoneGate.title": "7c611b86cca8",
"phoneGate.body": "368650b59762",
"plans.title": "c0c6a5e91743",
- "plans.subtitle": "e0d25a257d31",
+ "plans.subtitle": "562dc2a1b40f",
"plans.bestValue": "8173c2a946f1",
"plans.getPlan": "36572be917c8",
"plans.getProOff": "295f4fc9c6f1",
"plans.continueFree": "d7f2a5d8710f",
+ "plans.continue": "2e02623966f9",
"plans.paywallSubtitle": "9609471d3646",
- "plans.covers": "42fa1aae2a8e"
+ "plans.covers": "42fa1aae2a8e",
+ "tour.play.title": "030baee9ae8b",
+ "tour.clip.title": "b64d71a2d72b",
+ "tour.clip.body": "f0e51e7970fc",
+ "tour.media.title": "1041f7be27f8",
+ "tour.media.body": "116145079858",
+ "tour.chat.title": "10d7e23f84e5",
+ "tour.chat.body": "cfda703d1135",
+ "tour.chat.prompt": "b27d77aa0732",
+ "tour.progress": "7e20641fe8fb",
+ "tour.locked": "d503fd48a6d4",
+ "tour.backLocked": "7933631d4780"
},
"ja/panels": {
"transitions.groups.fade": "5298d08bb7ae",
@@ -12182,14 +12226,12 @@
"plans.paidOutBody": "18f057593944",
"plans.topOutTitle": "713a8c79ed21",
"plans.bestValue": "8173c2a946f1",
- "plans.billedMonthly": "cad51bd43867",
"plans.introThen": "49e300236000",
"plans.stickerPercent": "e5544c338932",
"plans.stickerOff": "da7a68734367",
"plans.get": "36572be917c8",
"plans.upgrade": "413370c98be7",
- "plans.current": "ec5cfba8f01b",
- "plans.footer": "9f7466d09417"
+ "plans.current": "ec5cfba8f01b"
},
"ko/chat": {
"panel.signInToChat": "8b2dd174b118",
@@ -14566,6 +14608,7 @@
"sequence.back": "b52b36b7269f",
"sequence.next": "bc981983e7f5",
"sequence.done": "e9b450d14bc2",
+ "sequence.startTour": "aa2f2e01b3a6",
"welcome.title": "1ff8424d8185",
"welcome.body": "81a7a12c9d27",
"referral.title": "eec24033d0d5",
@@ -14600,13 +14643,25 @@
"phoneGate.title": "7c611b86cca8",
"phoneGate.body": "368650b59762",
"plans.title": "c0c6a5e91743",
- "plans.subtitle": "e0d25a257d31",
+ "plans.subtitle": "562dc2a1b40f",
"plans.bestValue": "8173c2a946f1",
"plans.getPlan": "36572be917c8",
"plans.getProOff": "295f4fc9c6f1",
"plans.continueFree": "d7f2a5d8710f",
+ "plans.continue": "2e02623966f9",
"plans.paywallSubtitle": "9609471d3646",
- "plans.covers": "42fa1aae2a8e"
+ "plans.covers": "42fa1aae2a8e",
+ "tour.play.title": "030baee9ae8b",
+ "tour.clip.title": "b64d71a2d72b",
+ "tour.clip.body": "f0e51e7970fc",
+ "tour.media.title": "1041f7be27f8",
+ "tour.media.body": "116145079858",
+ "tour.chat.title": "10d7e23f84e5",
+ "tour.chat.body": "cfda703d1135",
+ "tour.chat.prompt": "b27d77aa0732",
+ "tour.progress": "7e20641fe8fb",
+ "tour.locked": "d503fd48a6d4",
+ "tour.backLocked": "7933631d4780"
},
"ko/panels": {
"transitions.groups.fade": "5298d08bb7ae",
@@ -15203,14 +15258,12 @@
"plans.paidOutBody": "18f057593944",
"plans.topOutTitle": "713a8c79ed21",
"plans.bestValue": "8173c2a946f1",
- "plans.billedMonthly": "cad51bd43867",
"plans.introThen": "49e300236000",
"plans.stickerPercent": "e5544c338932",
"plans.stickerOff": "da7a68734367",
"plans.get": "36572be917c8",
"plans.upgrade": "413370c98be7",
- "plans.current": "ec5cfba8f01b",
- "plans.footer": "9f7466d09417"
+ "plans.current": "ec5cfba8f01b"
},
"pt-BR/chat": {
"panel.signInToChat": "8b2dd174b118",
@@ -17587,6 +17640,7 @@
"sequence.back": "b52b36b7269f",
"sequence.next": "bc981983e7f5",
"sequence.done": "e9b450d14bc2",
+ "sequence.startTour": "aa2f2e01b3a6",
"welcome.title": "1ff8424d8185",
"welcome.body": "81a7a12c9d27",
"referral.title": "eec24033d0d5",
@@ -17621,13 +17675,25 @@
"phoneGate.title": "7c611b86cca8",
"phoneGate.body": "368650b59762",
"plans.title": "c0c6a5e91743",
- "plans.subtitle": "e0d25a257d31",
+ "plans.subtitle": "562dc2a1b40f",
"plans.bestValue": "8173c2a946f1",
"plans.getPlan": "36572be917c8",
"plans.getProOff": "295f4fc9c6f1",
"plans.continueFree": "d7f2a5d8710f",
+ "plans.continue": "2e02623966f9",
"plans.paywallSubtitle": "9609471d3646",
- "plans.covers": "42fa1aae2a8e"
+ "plans.covers": "42fa1aae2a8e",
+ "tour.play.title": "030baee9ae8b",
+ "tour.clip.title": "b64d71a2d72b",
+ "tour.clip.body": "f0e51e7970fc",
+ "tour.media.title": "1041f7be27f8",
+ "tour.media.body": "116145079858",
+ "tour.chat.title": "10d7e23f84e5",
+ "tour.chat.body": "cfda703d1135",
+ "tour.chat.prompt": "b27d77aa0732",
+ "tour.progress": "7e20641fe8fb",
+ "tour.locked": "d503fd48a6d4",
+ "tour.backLocked": "7933631d4780"
},
"pt-BR/panels": {
"transitions.groups.fade": "5298d08bb7ae",
@@ -18224,14 +18290,12 @@
"plans.paidOutBody": "18f057593944",
"plans.topOutTitle": "713a8c79ed21",
"plans.bestValue": "8173c2a946f1",
- "plans.billedMonthly": "cad51bd43867",
"plans.introThen": "49e300236000",
"plans.stickerPercent": "e5544c338932",
"plans.stickerOff": "da7a68734367",
"plans.get": "36572be917c8",
"plans.upgrade": "413370c98be7",
- "plans.current": "ec5cfba8f01b",
- "plans.footer": "9f7466d09417"
+ "plans.current": "ec5cfba8f01b"
},
"zh-CN/chat": {
"panel.signInToChat": "8b2dd174b118",
@@ -20608,6 +20672,7 @@
"sequence.back": "b52b36b7269f",
"sequence.next": "bc981983e7f5",
"sequence.done": "e9b450d14bc2",
+ "sequence.startTour": "aa2f2e01b3a6",
"welcome.title": "1ff8424d8185",
"welcome.body": "81a7a12c9d27",
"referral.title": "eec24033d0d5",
@@ -20642,13 +20707,25 @@
"phoneGate.title": "7c611b86cca8",
"phoneGate.body": "368650b59762",
"plans.title": "c0c6a5e91743",
- "plans.subtitle": "e0d25a257d31",
+ "plans.subtitle": "562dc2a1b40f",
"plans.bestValue": "8173c2a946f1",
"plans.getPlan": "36572be917c8",
"plans.getProOff": "295f4fc9c6f1",
"plans.continueFree": "d7f2a5d8710f",
+ "plans.continue": "2e02623966f9",
"plans.paywallSubtitle": "9609471d3646",
- "plans.covers": "42fa1aae2a8e"
+ "plans.covers": "42fa1aae2a8e",
+ "tour.play.title": "030baee9ae8b",
+ "tour.clip.title": "b64d71a2d72b",
+ "tour.clip.body": "f0e51e7970fc",
+ "tour.media.title": "1041f7be27f8",
+ "tour.media.body": "116145079858",
+ "tour.chat.title": "10d7e23f84e5",
+ "tour.chat.body": "cfda703d1135",
+ "tour.chat.prompt": "b27d77aa0732",
+ "tour.progress": "7e20641fe8fb",
+ "tour.locked": "d503fd48a6d4",
+ "tour.backLocked": "7933631d4780"
},
"zh-CN/panels": {
"transitions.groups.fade": "5298d08bb7ae",
diff --git a/site/src/i18n/messages/de/billing.json b/site/src/i18n/messages/de/billing.json
index 56af6378..705312ff 100644
--- a/site/src/i18n/messages/de/billing.json
+++ b/site/src/i18n/messages/de/billing.json
@@ -74,13 +74,11 @@
"paidOutBody": "Deine {plan}-Credits werden am {date} aufgeladen.",
"topOutTitle": "Deine {plan}-Credits werden am {date} aufgeladen",
"bestValue": "Bestes Angebot",
- "billedMonthly": "Monatliche Abrechnung",
"introThen": "{months, plural, one {Erster Monat, danach {price}/Monat} other {Erste # Monate, danach {price}/Monat}}",
"stickerPercent": "{percent}%",
"stickerOff": "Rabatt",
"get": "{plan} holen",
"upgrade": "Upgrade auf {plan}",
- "current": "Aktueller Plan",
- "footer": "Preise in {currency}. Abos verlängern sich monatlich, bis du kündigst. Beim Upgrade zahlst du heute die Differenz."
+ "current": "Aktueller Plan"
}
}
diff --git a/site/src/i18n/messages/de/onboarding.json b/site/src/i18n/messages/de/onboarding.json
index 63a606cd..fc42df69 100644
--- a/site/src/i18n/messages/de/onboarding.json
+++ b/site/src/i18n/messages/de/onboarding.json
@@ -4,7 +4,8 @@
"skip": "Überspringen",
"back": "Zurück",
"next": "Weiter",
- "done": "Fertig"
+ "done": "Fertig",
+ "startTour": "Bearbeitung starten"
},
"welcome": {
"title": "Videos schneiden per Chat.",
@@ -55,12 +56,34 @@
},
"plans": {
"title": "Einfache Preise",
- "subtitle": "Der Editor ist kostenlos. Zahle nur für KI-generierte Medien.",
+ "subtitle": "Der Editor ist kostenlos. Zahle nur für KI-generierte Medien und Speicher.",
"bestValue": "Bester Wert",
"getPlan": "Hol dir {plan}",
"getProOff": "{percent} % Rabatt auf Pro sichern",
"continueFree": "Kostenlos weitermachen",
+ "continue": "Weiter",
"paywallSubtitle": "Wähle einen Plan, um loszulegen. Du bearbeitest auf einem Computer: Melde dich dort mit diesem Account an.",
"covers": "{months, plural, one {Für deinen ersten Monat, danach {price}/Monat} other {Pro Monat für deine ersten # Monate, danach {price}/Monat}}"
+ },
+ "tour": {
+ "play": {
+ "title": "Klicke auf Play zum Ansehen"
+ },
+ "clip": {
+ "title": "Wähle einen Clip aus",
+ "body": "Klicke auf einen Clip in der Timeline. Seine Einstellungen öffnen sich neben der Vorschau."
+ },
+ "media": {
+ "title": "Medien öffnen",
+ "body": "Importierte Dateien landen hier. Ziehe eine auf die Timeline, um sie zu verwenden."
+ },
+ "chat": {
+ "title": "Frag den Assistenten",
+ "body": "Drücke Enter zum Senden. Der Assistent bearbeitet das Projekt für dich.",
+ "prompt": "Mach den Titel „August Recap“ größer"
+ },
+ "progress": "{current} von {total}",
+ "locked": "Schließe die Tour ab, um dein eigenes Projekt zu starten",
+ "backLocked": "Beende die Tour, um dieses Projekt zu verlassen"
}
}
diff --git a/site/src/i18n/messages/en/billing.json b/site/src/i18n/messages/en/billing.json
index e6d94889..157ac50d 100644
--- a/site/src/i18n/messages/en/billing.json
+++ b/site/src/i18n/messages/en/billing.json
@@ -74,13 +74,11 @@
"paidOutBody": "Your {plan} credits refill on {date}.",
"topOutTitle": "Your {plan} credits refill on {date}",
"bestValue": "Best value",
- "billedMonthly": "Billed monthly",
"introThen": "{months, plural, one {First month, then {price}/month} other {First # months, then {price}/month}}",
"stickerPercent": "{percent}%",
"stickerOff": "off",
"get": "Get {plan}",
"upgrade": "Upgrade to {plan}",
- "current": "Current plan",
- "footer": "Prices in {currency}. Plans renew monthly until you cancel. Moving up a plan charges the difference today."
+ "current": "Current plan"
}
}
diff --git a/site/src/i18n/messages/en/onboarding.json b/site/src/i18n/messages/en/onboarding.json
index 0356715c..32c9bb6e 100644
--- a/site/src/i18n/messages/en/onboarding.json
+++ b/site/src/i18n/messages/en/onboarding.json
@@ -4,7 +4,8 @@
"skip": "Skip",
"back": "Back",
"next": "Next",
- "done": "Done"
+ "done": "Done",
+ "startTour": "Start editing"
},
"welcome": {
"title": "Edit videos by chatting.",
@@ -55,12 +56,34 @@
},
"plans": {
"title": "Simple pricing",
- "subtitle": "The editor is free. Pay only for AI generated media.",
+ "subtitle": "The editor is free. Pay only for AI generated media and storage.",
"bestValue": "Best value",
"getPlan": "Get {plan}",
"getProOff": "Get {percent}% off Pro",
"continueFree": "Continue with free",
+ "continue": "Continue",
"paywallSubtitle": "Pick a plan to start. You edit on a computer: sign in there with this account.",
"covers": "{months, plural, one {For your first month, then {price}/month} other {Per month for your first # months, then {price}/month}}"
+ },
+ "tour": {
+ "play": {
+ "title": "Click play to watch"
+ },
+ "clip": {
+ "title": "Select a clip",
+ "body": "Click a clip on the timeline. Its settings open beside the preview."
+ },
+ "media": {
+ "title": "Open Media",
+ "body": "Files you import land here. Drag one onto the timeline to use it."
+ },
+ "chat": {
+ "title": "Ask the assistant",
+ "body": "Press Enter to send it. The assistant edits the project for you.",
+ "prompt": "Make the August Recap title bigger"
+ },
+ "progress": "{current} of {total}",
+ "locked": "Finish the tour to start your own project",
+ "backLocked": "Finish the tour to leave this project"
}
}
diff --git a/site/src/i18n/messages/es/billing.json b/site/src/i18n/messages/es/billing.json
index 768c098d..0dfc8344 100644
--- a/site/src/i18n/messages/es/billing.json
+++ b/site/src/i18n/messages/es/billing.json
@@ -74,13 +74,11 @@
"paidOutBody": "Tus créditos de {plan} se recargan el {date}.",
"topOutTitle": "Tus créditos de {plan} se recargan el {date}",
"bestValue": "Mejor valor",
- "billedMonthly": "Facturación mensual",
"introThen": "{months, plural, one {Primer mes, luego {price}/mes} other {Primeros # meses, luego {price}/mes}}",
"stickerPercent": "{percent} %",
"stickerOff": "de descuento",
"get": "Obtener {plan}",
"upgrade": "Mejorar a {plan}",
- "current": "Plan actual",
- "footer": "Precios en {currency}. Los planes se renuevan mensualmente hasta que canceles. Si pasas a un plan superior, se cobra la diferencia hoy."
+ "current": "Plan actual"
}
}
diff --git a/site/src/i18n/messages/es/onboarding.json b/site/src/i18n/messages/es/onboarding.json
index b3862bcb..01521ac3 100644
--- a/site/src/i18n/messages/es/onboarding.json
+++ b/site/src/i18n/messages/es/onboarding.json
@@ -4,7 +4,8 @@
"skip": "Omitir",
"back": "Atrás",
"next": "Siguiente",
- "done": "Listo"
+ "done": "Listo",
+ "startTour": "Empieza a editar"
},
"welcome": {
"title": "Edita videos chateando.",
@@ -55,12 +56,34 @@
},
"plans": {
"title": "Precios simples",
- "subtitle": "El editor es gratis. Paga solo por multimedia generada por IA.",
+ "subtitle": "El editor es gratis. Paga solo por la multimedia generada por IA y el almacenamiento.",
"bestValue": "Mejor opción",
"getPlan": "Obtén {plan}",
"getProOff": "Obtén {percent}% de descuento en Pro",
"continueFree": "Continuar gratis",
+ "continue": "Continuar",
"paywallSubtitle": "Elige un plan para comenzar. Editas en una computadora: inicia sesión ahí con esta cuenta.",
"covers": "{months, plural, one {Durante tu primer mes, luego {price}/mes} other {Al mes durante tus primeros # meses, luego {price}/mes}}"
+ },
+ "tour": {
+ "play": {
+ "title": "Haz clic en reproducir para ver"
+ },
+ "clip": {
+ "title": "Selecciona un clip",
+ "body": "Haz clic en un clip en la línea de tiempo. Sus ajustes se abrirán junto a la vista previa."
+ },
+ "media": {
+ "title": "Abre Multimedia",
+ "body": "Los archivos que importes aparecerán aquí. Arrastra uno a la línea de tiempo para usarlo."
+ },
+ "chat": {
+ "title": "Pregúntale al asistente",
+ "body": "Presiona Enter para enviarlo. El asistente edita el proyecto por ti.",
+ "prompt": "Haz más grande el título Resumen de agosto"
+ },
+ "progress": "{current} de {total}",
+ "locked": "Completa el recorrido para empezar tu propio proyecto",
+ "backLocked": "Termina el recorrido para salir de este proyecto"
}
}
diff --git a/site/src/i18n/messages/fr/billing.json b/site/src/i18n/messages/fr/billing.json
index 0720a092..3111b75a 100644
--- a/site/src/i18n/messages/fr/billing.json
+++ b/site/src/i18n/messages/fr/billing.json
@@ -74,13 +74,11 @@
"paidOutBody": "Vos crédits {plan} seront renouvelés le {date}.",
"topOutTitle": "Vos crédits {plan} seront renouvelés le {date}",
"bestValue": "Meilleure offre",
- "billedMonthly": "Facturé mensuellement",
"introThen": "{months, plural, one {Premier mois, puis {price}/mois} other {# premiers mois, puis {price}/mois}}",
"stickerPercent": "{percent} %",
"stickerOff": "de réduction",
"get": "Obtenir {plan}",
"upgrade": "Passer à {plan}",
- "current": "Forfait actuel",
- "footer": "Prix en {currency}. Les forfaits se renouvellent chaque mois jusqu’à votre résiliation. Passer à un forfait supérieur facture la différence aujourd’hui."
+ "current": "Forfait actuel"
}
}
diff --git a/site/src/i18n/messages/fr/onboarding.json b/site/src/i18n/messages/fr/onboarding.json
index 18a30d54..74f405ea 100644
--- a/site/src/i18n/messages/fr/onboarding.json
+++ b/site/src/i18n/messages/fr/onboarding.json
@@ -4,7 +4,8 @@
"skip": "Passer",
"back": "Retour",
"next": "Suivant",
- "done": "Terminé"
+ "done": "Terminé",
+ "startTour": "Commencer le montage"
},
"welcome": {
"title": "Montez vos vidéos en discutant.",
@@ -55,12 +56,34 @@
},
"plans": {
"title": "Tarifs simples",
- "subtitle": "L'éditeur est gratuit. Ne payez que pour les médias générés par IA.",
+ "subtitle": "L'éditeur est gratuit. Ne payez que pour les médias générés par l'IA et le stockage.",
"bestValue": "Meilleure offre",
"getPlan": "Obtenir {plan}",
"getProOff": "Obtenez {percent} % de réduction sur Pro",
"continueFree": "Continuer avec la version gratuite",
+ "continue": "Continuer",
"paywallSubtitle": "Choisissez un forfait pour commencer. Le montage se fait sur ordinateur : connectez-vous-y avec ce compte.",
"covers": "{months, plural, one {Pour votre premier mois, puis {price}/mois} other {Par mois pendant vos # premiers mois, puis {price}/mois}}"
+ },
+ "tour": {
+ "play": {
+ "title": "Cliquez sur Lecture pour regarder"
+ },
+ "clip": {
+ "title": "Sélectionner un clip",
+ "body": "Cliquez sur un clip sur la timeline. Ses paramètres s'affichent à côté de l'aperçu."
+ },
+ "media": {
+ "title": "Ouvrir Médias",
+ "body": "Vos fichiers importés arrivent ici. Glissez-en un sur la timeline pour l'utiliser."
+ },
+ "chat": {
+ "title": "Demander à l'assistant",
+ "body": "Appuyez sur Enter pour l'envoyer. L'assistant modifie le projet pour vous.",
+ "prompt": "Agrandir le titre Récap d'août"
+ },
+ "progress": "{current} sur {total}",
+ "locked": "Terminez la visite pour démarrer votre propre projet",
+ "backLocked": "Terminez la visite pour quitter ce projet"
}
}
diff --git a/site/src/i18n/messages/ja/billing.json b/site/src/i18n/messages/ja/billing.json
index 56978400..12b4fd65 100644
--- a/site/src/i18n/messages/ja/billing.json
+++ b/site/src/i18n/messages/ja/billing.json
@@ -74,13 +74,11 @@
"paidOutBody": "{plan}のクレジットは{date}に補充されます。",
"topOutTitle": "{plan}のクレジットは{date}に補充されます",
"bestValue": "最もお得",
- "billedMonthly": "月額請求",
"introThen": "{months, plural, other {最初の#か月、その後は{price}/月}}",
"stickerPercent": "{percent}%",
"stickerOff": "OFF",
"get": "{plan}を入手",
"upgrade": "{plan}にアップグレード",
- "current": "現在のプラン",
- "footer": "表示価格は{currency}です。プランは解約するまで毎月自動更新されます。上位プランへの変更時は、本日差額が請求されます。"
+ "current": "現在のプラン"
}
}
diff --git a/site/src/i18n/messages/ja/onboarding.json b/site/src/i18n/messages/ja/onboarding.json
index cafa30de..611aa2b5 100644
--- a/site/src/i18n/messages/ja/onboarding.json
+++ b/site/src/i18n/messages/ja/onboarding.json
@@ -4,7 +4,8 @@
"skip": "スキップ",
"back": "戻る",
"next": "次へ",
- "done": "完了"
+ "done": "完了",
+ "startTour": "編集を開始"
},
"welcome": {
"title": "チャットで動画を編集。",
@@ -55,12 +56,34 @@
},
"plans": {
"title": "シンプルな料金プラン",
- "subtitle": "エディターは無料。AI生成メディアにのみお支払いいただけます。",
+ "subtitle": "エディタは無料です。お支払いはAI生成メディアとストレージのみです。",
"bestValue": "最もお得",
"getPlan": "{plan}を入手",
"getProOff": "Proを{percent}%オフで利用",
"continueFree": "無料で続ける",
+ "continue": "続ける",
"paywallSubtitle": "プランを選んで始めましょう。編集はコンピューターで行います。そちらでこのアカウントでサインインしてください。",
"covers": "{months, plural, other {最初の#か月間の月額、以降は{price}/月}}"
+ },
+ "tour": {
+ "play": {
+ "title": "再生をクリックして視聴"
+ },
+ "clip": {
+ "title": "クリップを選択",
+ "body": "タイムライン上のクリップをクリックします。プレビューの横に設定が開きます。"
+ },
+ "media": {
+ "title": "メディアを開く",
+ "body": "インポートしたファイルはここに追加されます。タイムラインにドラッグして使用します。"
+ },
+ "chat": {
+ "title": "アシスタントに依頼",
+ "body": "Enterを押して送信します。アシスタントがプロジェクトを編集します。",
+ "prompt": "「August Recap」のタイトルを大きくして"
+ },
+ "progress": "{current} / {total}",
+ "locked": "自分のプロジェクトを開始するにはツアーを完了してください",
+ "backLocked": "このプロジェクトを離れるにはツアーを完了してください"
}
}
diff --git a/site/src/i18n/messages/ko/billing.json b/site/src/i18n/messages/ko/billing.json
index 05346098..e05e0b7b 100644
--- a/site/src/i18n/messages/ko/billing.json
+++ b/site/src/i18n/messages/ko/billing.json
@@ -74,13 +74,11 @@
"paidOutBody": "{plan} 크레딧은 {date}에 다시 충전돼요.",
"topOutTitle": "{plan} 크레딧 충전일: {date}",
"bestValue": "최고 혜택",
- "billedMonthly": "매월 청구",
"introThen": "{months, plural, other {첫 #개월 이용 후 월 {price}}}",
"stickerPercent": "{percent}%",
"stickerOff": "할인",
"get": "{plan} 선택",
"upgrade": "{plan}(으)로 업그레이드",
- "current": "현재 요금제",
- "footer": "가격은 {currency} 기준이에요. 취소할 때까지 매월 갱신돼요. 상위 플랜으로 변경하면 오늘 차액이 청구돼요."
+ "current": "현재 요금제"
}
}
diff --git a/site/src/i18n/messages/ko/onboarding.json b/site/src/i18n/messages/ko/onboarding.json
index 97f18be0..b97fe4ae 100644
--- a/site/src/i18n/messages/ko/onboarding.json
+++ b/site/src/i18n/messages/ko/onboarding.json
@@ -4,7 +4,8 @@
"skip": "건너뛰기",
"back": "뒤로",
"next": "다음",
- "done": "완료"
+ "done": "완료",
+ "startTour": "편집 시작하기"
},
"welcome": {
"title": "대화하듯 간편한 동영상 편집.",
@@ -55,12 +56,34 @@
},
"plans": {
"title": "단순한 요금제",
- "subtitle": "편집기는 무료예요. AI로 생성하는 미디어에 대해서만 결제하세요.",
+ "subtitle": "편집기는 무료예요. AI 생성 미디어와 저장 공간에 대해서만 결제하세요.",
"bestValue": "최고 혜택",
"getPlan": "{plan} 시작하기",
"getProOff": "Pro {percent}% 할인받기",
"continueFree": "무료로 계속하기",
+ "continue": "계속하기",
"paywallSubtitle": "시작할 요금제를 선택해 주세요. 편집은 컴퓨터에서 진행되니 컴퓨터에서 이 계정으로 로그인해 주세요.",
"covers": "{months, plural, other {첫 #개월 동안 적용되며, 이후 월 {price}}}"
+ },
+ "tour": {
+ "play": {
+ "title": "재생을 클릭해 시청하세요"
+ },
+ "clip": {
+ "title": "클립 선택",
+ "body": "타임라인에서 클립을 클릭해 보세요. 미리보기 옆에 설정창이 열려요."
+ },
+ "media": {
+ "title": "미디어 열기",
+ "body": "가져온 파일이 여기에 표시돼요. 타임라인으로 드래그해 사용해 보세요."
+ },
+ "chat": {
+ "title": "어시스턴트에게 물어보기",
+ "body": "Enter를 눌러 전송하세요. 어시스턴트가 프로젝트를 대신 편집해 줘요.",
+ "prompt": "August Recap 타이틀을 더 크게 키워 줘요"
+ },
+ "progress": "{total} 중 {current}",
+ "locked": "투어를 완료하고 나만의 프로젝트를 시작해 보세요",
+ "backLocked": "이 프로젝트에서 나가려면 둘러보기를 완료해 주세요"
}
}
diff --git a/site/src/i18n/messages/pt-BR/billing.json b/site/src/i18n/messages/pt-BR/billing.json
index aebedf55..a75e8921 100644
--- a/site/src/i18n/messages/pt-BR/billing.json
+++ b/site/src/i18n/messages/pt-BR/billing.json
@@ -74,13 +74,11 @@
"paidOutBody": "Seus créditos do {plan} serão renovados em {date}.",
"topOutTitle": "Seus créditos do {plan} serão renovados em {date}",
"bestValue": "Melhor custo-benefício",
- "billedMonthly": "Cobrado mensalmente",
"introThen": "{months, plural, one {Primeiro mês, depois {price}/mês} other {Primeiros # meses, depois {price}/mês}}",
"stickerPercent": "{percent}%",
"stickerOff": "OFF",
"get": "Obter {plan}",
"upgrade": "Fazer upgrade para o {plan}",
- "current": "Plano atual",
- "footer": "Preços em {currency}. Os planos renovam mensalmente até você cancelar. Ao mudar para um plano superior, a diferença é cobrada hoje."
+ "current": "Plano atual"
}
}
diff --git a/site/src/i18n/messages/pt-BR/onboarding.json b/site/src/i18n/messages/pt-BR/onboarding.json
index ea3095ce..215b38a7 100644
--- a/site/src/i18n/messages/pt-BR/onboarding.json
+++ b/site/src/i18n/messages/pt-BR/onboarding.json
@@ -4,7 +4,8 @@
"skip": "Pular",
"back": "Voltar",
"next": "Avançar",
- "done": "Concluir"
+ "done": "Concluir",
+ "startTour": "Começar a editar"
},
"welcome": {
"title": "Edite vídeos pelo chat.",
@@ -55,12 +56,34 @@
},
"plans": {
"title": "Preços simples",
- "subtitle": "O editor é grátis. Pague apenas por mídias geradas por IA.",
+ "subtitle": "O editor é gratuito. Pague apenas por mídia gerada por IA e armazenamento.",
"bestValue": "Melhor custo-benefício",
"getPlan": "Obter {plan}",
"getProOff": "Garanta {percent}% de desconto no Pro",
"continueFree": "Continuar grátis",
+ "continue": "Continuar",
"paywallSubtitle": "Escolha um plano para começar. Você edita no computador: entre lá com esta conta.",
"covers": "{months, plural, one {No seu primeiro mês, depois {price}/mês} other {Por mês nos seus primeiros # meses, depois {price}/mês}}"
+ },
+ "tour": {
+ "play": {
+ "title": "Clique em reproduzir para assistir"
+ },
+ "clip": {
+ "title": "Selecione um clipe",
+ "body": "Clique em um clipe na linha do tempo. As configurações dele abrem ao lado da prévia."
+ },
+ "media": {
+ "title": "Abrir Mídia",
+ "body": "Os arquivos importados ficam aqui. Arraste um para a linha do tempo para usá-lo."
+ },
+ "chat": {
+ "title": "Pergunte ao assistente",
+ "body": "Pressione Enter para enviar. O assistente edita o projeto para você.",
+ "prompt": "Aumente o título Retrospectiva de Agosto"
+ },
+ "progress": "{current} de {total}",
+ "locked": "Conclua o tour para iniciar seu próprio projeto",
+ "backLocked": "Conclua o tour para sair deste projeto"
}
}
diff --git a/site/src/i18n/messages/zh-CN/billing.json b/site/src/i18n/messages/zh-CN/billing.json
index 19e15279..948f7b8d 100644
--- a/site/src/i18n/messages/zh-CN/billing.json
+++ b/site/src/i18n/messages/zh-CN/billing.json
@@ -74,13 +74,11 @@
"paidOutBody": "你的 {plan} 积分将于 {date} 充值补满。",
"topOutTitle": "你的 {plan} 积分将于 {date} 充值补满",
"bestValue": "超值推荐",
- "billedMonthly": "按月计费",
"introThen": "{months, plural, other {前 # 个月,之后 {price}/月}}",
"stickerPercent": "{percent}%",
"stickerOff": "优惠",
"get": "获取 {plan}",
"upgrade": "升级到 {plan}",
- "current": "当前方案",
- "footer": "价格以 {currency} 结算。方案按月自动续订,直至取消。升级方案今日收取差价。"
+ "current": "当前方案"
}
}
diff --git a/site/src/i18n/messages/zh-CN/onboarding.json b/site/src/i18n/messages/zh-CN/onboarding.json
index 0a5c2236..e96ec8af 100644
--- a/site/src/i18n/messages/zh-CN/onboarding.json
+++ b/site/src/i18n/messages/zh-CN/onboarding.json
@@ -4,7 +4,8 @@
"skip": "跳过",
"back": "上一步",
"next": "下一步",
- "done": "完成"
+ "done": "完成",
+ "startTour": "开始剪辑"
},
"welcome": {
"title": "通过对话剪辑视频。",
@@ -55,12 +56,34 @@
},
"plans": {
"title": "简单明了的定价",
- "subtitle": "编辑器完全免费,仅为 AI 生成的媒体内容付费。",
+ "subtitle": "编辑器免费。仅需为 AI 生成的媒体和存储空间付费。",
"bestValue": "最超值",
"getPlan": "获取 {plan}",
"getProOff": "立享 {percent}% 优惠升级 Pro",
"continueFree": "继续使用免费版",
+ "continue": "继续",
"paywallSubtitle": "选择方案以开始。剪辑需在电脑上进行:使用此账号在电脑端登录即可。",
"covers": "{months, plural, other {前 # 个月每月此价格,之后 {price}/月}}"
+ },
+ "tour": {
+ "play": {
+ "title": "点击播放以观看"
+ },
+ "clip": {
+ "title": "选择片段",
+ "body": "在时间线上点击一个片段,其设置会显示在预览旁边。"
+ },
+ "media": {
+ "title": "打开“媒体”",
+ "body": "导入的文件会保存在这里。将其拖到时间线上即可使用。"
+ },
+ "chat": {
+ "title": "咨询助手",
+ "body": "按 Enter 发送。助手会为你编辑项目。",
+ "prompt": "把“八月回顾”标题调大"
+ },
+ "progress": "{current} / {total}",
+ "locked": "完成导览以开始你自己的项目",
+ "backLocked": "完成导览即可离开此项目"
}
}
diff --git a/site/src/lib/analytics.ts b/site/src/lib/analytics.ts
index 29b2b328..281723a1 100644
--- a/site/src/lib/analytics.ts
+++ b/site/src/lib/analytics.ts
@@ -10,10 +10,12 @@ import type { UpgradeEntry } from "@/cut/lib/upgrade";
import type {
OnboardingRun,
ReferralSource,
+ TourStep,
} from "@/lib/onboarding/sequence";
-// What the plans modal opened for: a limit hit, or the plans asked for.
-type PlansReason = "projects" | "credits" | "storage" | "plans";
+// What the plans modal opened for: a limit hit, the plans asked for, or the
+// end of onboarding.
+type PlansReason = "projects" | "credits" | "storage" | "plans" | "onboarding";
type AuthMode = "sign-in" | "sign-up";
type AuthMethod = "google" | "email";
@@ -59,6 +61,12 @@ export type AnalyticsEvents = {
referralOther?: string;
};
onboarding_completed: { source: OnboardingRun; skipped: boolean; step: number };
+ // The slides ended on a computer and handed over to the starter tour.
+ onboarding_slides_done: { source: OnboardingRun; skipped: boolean; step: number };
+ // A starter tour step done, and a locked project button sending the
+ // account back to the tour.
+ onboarding_tour_step: { step: TourStep };
+ onboarding_tour_resumed: void;
// The sequence's plans slide came up; intro as on the plans modal.
// exit is "paywall" on a phone, where the slide has no free way on.
onboarding_plans_shown: { source: OnboardingRun; intro: number; exit: "free" | "paywall" };