Skip to content

armgit / macro

Public Imported from GitHub
0

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

feat(onboarding): pricing table, free tier, and desktop launch step (#2692)

Evan Hutnik15d4fdaf6817
diff --git a/js/app/packages/app/component/interactive-onboarding/InteractiveOnboarding.tsx b/js/app/packages/app/component/interactive-onboarding/InteractiveOnboarding.tsx
index 89d4e0ad0b..2ff949630f 100644
--- a/js/app/packages/app/component/interactive-onboarding/InteractiveOnboarding.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/InteractiveOnboarding.tsx
@@ -19,7 +19,7 @@ import { resetSandbox } from './sandbox/sandbox-store';
import { commandKOpen, setCommandKOpen } from './lessons/command-k';
import { createOnboardingState } from './create-onboarding-state';
import { LESSONS } from './lessons';
-import { ContinueButton, SkipButton } from './components-lib';
+import { ContinueButton } from './components-lib';
import { OnboardingProgress } from './OnboardingProgress';
import { ClippedPanel } from '@core/component/ClippedPanel';
import { PcNoiseGrid } from '@core/component/PcNoiseGrid';
@@ -27,7 +27,6 @@ import { useAnalytics } from '@app/component/analytics-context';
import { useHasPaidAccess } from '@core/auth/license';
import { useIsAuthenticated } from '@core/auth';
import { fetchToken } from '@core/util/fetchWithToken';
-import { isMobile } from '@core/mobile/isMobile';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
import MobileWebWelcome from './MobileWebWelcome';
@@ -106,7 +105,6 @@ function InteractiveOnboardingInner() {
if (l.id === 'choose-plan' && (hasPaid() || tutorialCompleted()))
return false;
if (l.id === 'about-us' && isAuthenticated()) return false;
- if (l.id === 'launch' && !isMobile()) return false;
return true;
});
const lessons = isTouch
@@ -114,7 +112,6 @@ function InteractiveOnboardingInner() {
(l) =>
l.id === 'welcome' ||
l.id === 'about-us' ||
- l.id === 'email-invite' ||
l.id === 'choose-plan' ||
l.id === 'launch'
)
@@ -194,6 +191,25 @@ function InteractiveOnboardingInner() {
}
};
+ // Programmatic advance for lessons that progress on their own interaction
+ // (e.g. clicking a plan card) rather than the Continue button.
+ const advanceLesson = () => {
+ const current = state.currentLesson();
+ if (!current) return;
+ analytics.track(
+ `onboarding_step_${current.definition.id.replaceAll('-', '_')}`,
+ {
+ id: current.definition.id,
+ index: current.index,
+ state: 'completed',
+ }
+ );
+ state.completeLesson(current.definition.id);
+ setReadyToContinue(false);
+ setContinueLabel(undefined);
+ setLessonKey((k) => k + 1);
+ };
+
const handleContinue = () => {
const current = state.currentLesson();
if (!current || !readyToContinue()) return;
@@ -230,26 +246,6 @@ function InteractiveOnboardingInner() {
setLessonKey((k) => k + 1);
};
- const handleSkip = () => {
- const current = state.currentLesson();
-
- if (!current) return;
-
- analytics.track(
- `onboarding_step_${current.definition.id.replaceAll('-', '_')}`,
- {
- id: current.definition.id,
- index: current.index,
- state: 'skipped',
- }
- );
-
- state.skipLesson(current.definition.id);
- setReadyToContinue(false);
- setContinueLabel(undefined);
- setLessonKey((k) => k + 1);
- };
-
// cmd+enter hotkey to continue
let shellRef: HTMLDivElement | undefined;
const [attachHotkeys, scopeId] = useHotkeyDOMScope('onboarding-shell');
@@ -296,18 +292,6 @@ function InteractiveOnboardingInner() {
},
});
- const skipReg = registerHotkey({
- scopeId,
- hotkey: 'escape',
- description: 'Skip',
- runWithInputFocused: true,
- keyDownHandler: () => {
- if (!state.currentLesson()?.definition.skippable) return false;
- handleSkip();
- return true;
- },
- });
-
// Block global cmd+k during the entire tutorial.
// On the command-k lesson slide this opens/closes the sandbox command menu.
const cmdkReg = registerHotkey({
@@ -346,7 +330,6 @@ function InteractiveOnboardingInner() {
CommandState.close = origClose;
});
onCleanup(() => reg.dispose());
- onCleanup(() => skipReg.dispose());
onCleanup(() => cmdkReg.dispose());
onCleanup(() => resetSandbox());
@@ -360,25 +343,16 @@ function InteractiveOnboardingInner() {
})
);
- // Mark tutorial complete on the backend once the email-invite lesson is
- // completed or skipped — before the paywall step. On touch devices there is
- // no email-invite step, so we complete after the about-us lesson instead.
+ // Mark tutorial complete on the backend the moment the user lands on the
+ // Launch screen — the semantic end of the onboarding experience. Guarded so
+ // the effect fires the mutation at most once.
+ let tutorialMarkedComplete = false;
createEffect(() => {
- if (testMode) return;
- if (isTouch) {
- const aboutUs = state
- .lessons()
- .find((l) => l.definition.id === 'about-us');
- if (aboutUs && (aboutUs.completed || aboutUs.skipped)) {
- completeTutorial.mutate(undefined);
- }
- } else {
- const invite = state
- .lessons()
- .find((l) => l.definition.id === 'email-invite');
- if (invite && (invite.completed || invite.skipped)) {
- completeTutorial.mutate(undefined);
- }
+ if (testMode || tutorialMarkedComplete) return;
+ const current = state.currentLesson();
+ if (current?.definition.id === 'launch') {
+ tutorialMarkedComplete = true;
+ completeTutorial.mutate(undefined);
}
});
@@ -542,23 +516,18 @@ function InteractiveOnboardingInner() {
<Dynamic
component={lesson().definition.content}
onComplete={handleLessonComplete}
+ advance={advanceLesson}
isActive={true}
scopeId={scopeId}
/>
</div>
- {/* Show demo inline on touch — skip email-invite's MockAppChrome */}
- <Show
- when={
- lesson().definition.id !== 'email-invite'
- ? lesson().definition.demo
- : undefined
- }
- >
+ <Show when={lesson().definition.demo}>
{(Demo) => (
<div class="w-full">
<Dynamic
component={Demo()}
onComplete={handleLessonComplete}
+ advance={advanceLesson}
isActive={true}
scopeId={scopeId}
/>
@@ -576,9 +545,6 @@ function InteractiveOnboardingInner() {
disabled={!readyToContinue()}
centered={lesson().definition.centeredButton}
/>
- <Show when={lesson().definition.skippable}>
- <SkipButton onClick={handleSkip} />
- </Show>
<Show when={lesson().definition.secondaryAction}>
{(Action) => <Dynamic component={Action()} />}
</Show>
@@ -613,6 +579,7 @@ function InteractiveOnboardingInner() {
<Dynamic
component={lesson().definition.content}
onComplete={handleLessonComplete}
+ advance={advanceLesson}
isActive={true}
scopeId={scopeId}
/>
@@ -628,9 +595,6 @@ function InteractiveOnboardingInner() {
disabled={!readyToContinue()}
centered={lesson().definition.centeredButton}
/>
- <Show when={lesson().definition.skippable}>
- <SkipButton onClick={handleSkip} />
- </Show>
<Show when={lesson().definition.secondaryAction}>
{(Action) => <Dynamic component={Action()} />}
</Show>
@@ -669,6 +633,7 @@ function InteractiveOnboardingInner() {
<Dynamic
component={Demo()}
onComplete={handleLessonComplete}
+ advance={advanceLesson}
isActive={true}
scopeId={scopeId}
/>
diff --git a/js/app/packages/app/component/interactive-onboarding/components-lib.tsx b/js/app/packages/app/component/interactive-onboarding/components-lib.tsx
index 9cd89562a1..ea4ba09680 100644
--- a/js/app/packages/app/component/interactive-onboarding/components-lib.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/components-lib.tsx
@@ -1,7 +1,40 @@
-import { createSignal, For, onCleanup, onMount, Show } from 'solid-js';
+import {
+ createSignal,
+ For,
+ onCleanup,
+ onMount,
+ Show,
+ type Component,
+ type JSX,
+} from 'solid-js';
+import { Dynamic } from 'solid-js/web';
import CheckIcon from '@icon/bold/check-bold.svg';
import { cn } from '@ui/utils/classname';
+interface CalloutShellProps {
+ leader: string;
+ label: string;
+ completed?: boolean;
+ children: JSX.Element;
+}
+
+function CalloutShell(props: CalloutShellProps) {
+ return (
+ <div class="flex items-center gap-3 rounded-xs bg-hover/50 px-4 py-3 border border-edge-muted bracket-never">
+ <span class="text-sm text-muted">{props.leader}</span>
+ <div class="flex items-center gap-2.5 bracket-never">
+ {props.children}
+ </div>
+ <span class="text-sm text-muted">{props.label}</span>
+ <Show when={props.completed}>
+ <div class="bg-accent text-panel size-5 rounded xs flex items-center justify-center ml-auto">
+ <CheckIcon class="size-4" />
+ </div>
+ </Show>
+ </div>
+ );
+}
+
const DISPLAY_TO_EVENT_KEY: Record<string, string> = {
'↓': 'arrowdown',
'↑': 'arrowup',
@@ -11,6 +44,7 @@ const DISPLAY_TO_EVENT_KEY: Record<string, string> = {
enter: 'enter',
cmd: 'meta',
'⌘': 'meta',
+ ctrl: 'control',
};
function displayToEventKey(display: string): string {
@@ -74,7 +108,7 @@ export function HotkeyCallout(props: HotkeyCalloutProps) {
});
return (
- <div class="flex items-center gap-3 rounded-xs bg-hover/50 px-4 py-3 border border-edge-muted bracket-never">
+ <CalloutShell leader="Type" label={props.label} completed={props.completed}>
<style>{`
@keyframes hotkey-pulse {
0% { outline: 2px solid rgb(from var(--color-edge) r g b / 0.3); outline-offset: 0px; }
@@ -84,67 +118,86 @@ export function HotkeyCallout(props: HotkeyCalloutProps) {
animation: hotkey-pulse 1.4s cubic-bezier(0.2, 0.8, 0.4, 1);
}
`}</style>
- <div class="flex items-center gap-1.5 bracket-never">
- <For each={props.keys}>
- {(key, i) => {
- let keyRef: HTMLSpanElement | undefined;
+ <For each={props.keys}>
+ {(key, i) => {
+ let keyRef: HTMLSpanElement | undefined;
- const isPressed = () => pressedKeys().has(key);
+ const isPressed = () => pressedKeys().has(key);
- onMount(() => {
- const onKeyDown = (e: KeyboardEvent) => {
- const pressed = e.key.toLowerCase();
- if (displayToEventKey(key) !== pressed) return;
- if (!keyRef) return;
- keyRef.classList.remove('hotkey-pulsing');
- void keyRef.offsetWidth; // reflow to restart animation
- keyRef.classList.add('hotkey-pulsing');
- };
- const onAnimationEnd = () => {
- keyRef?.classList.remove('hotkey-pulsing');
- };
- document.addEventListener('keydown', onKeyDown, {
+ onMount(() => {
+ const onKeyDown = (e: KeyboardEvent) => {
+ const pressed = e.key.toLowerCase();
+ if (displayToEventKey(key) !== pressed) return;
+ if (!keyRef) return;
+ keyRef.classList.remove('hotkey-pulsing');
+ void keyRef.offsetWidth; // reflow to restart animation
+ keyRef.classList.add('hotkey-pulsing');
+ };
+ const onAnimationEnd = () => {
+ keyRef?.classList.remove('hotkey-pulsing');
+ };
+ document.addEventListener('keydown', onKeyDown, {
+ capture: true,
+ });
+ keyRef?.addEventListener('animationend', onAnimationEnd);
+ onCleanup(() => {
+ document.removeEventListener('keydown', onKeyDown, {
capture: true,
});
- keyRef?.addEventListener('animationend', onAnimationEnd);
- onCleanup(() => {
- document.removeEventListener('keydown', onKeyDown, {
- capture: true,
- });
- keyRef?.removeEventListener('animationend', onAnimationEnd);
- });
+ keyRef?.removeEventListener('animationend', onAnimationEnd);
});
+ });
- return (
- <>
- {i() > 0 && props.separator && (
- <span class="text-ink-extra-muted/70 text-sm">
- {props.separator}
- </span>
+ return (
+ <>
+ {i() > 0 && props.separator && (
+ <span class="text-sm text-muted">{props.separator}</span>
+ )}
+ <span
+ ref={keyRef}
+ class={cn(
+ 'inline-grid place-items-center rounded-sm border px-2.5 py-1 text-base',
+ isPressed() || props.completed
+ ? 'bg-ink/20 border-edge text-ink'
+ : 'bg-ink/10 border-edge text-ink'
)}
- <span
- ref={keyRef}
- class={cn(
- 'inline-grid place-items-center rounded-sm border px-2.5 py-1 text-base',
- isPressed() || props.completed
- ? 'bg-ink/10 border-edge text-ink'
- : 'bg-transparent border-edge-muted text-ink'
- )}
- >
- {key}
- </span>
- </>
- );
- }}
- </For>
- </div>
- <span class="text-sm text-muted">{props.label}</span>
- <Show when={props.completed}>
- <div class="bg-accent text-panel size-5 rounded xs flex items-center justify-center ml-auto">
- <CheckIcon class="size-4" />
- </div>
- </Show>
- </div>
+ >
+ {key}
+ </span>
+ </>
+ );
+ }}
+ </For>
+ </CalloutShell>
+ );
+}
+
+interface ClickCalloutProps {
+ icon: Component<Record<string, unknown>>;
+ label: string;
+ completed?: boolean;
+}
+
+export function ClickCallout(props: ClickCalloutProps) {
+ return (
+ <CalloutShell
+ leader="Click"
+ label={props.label}
+ completed={props.completed}
+ >
+ <span
+ class={cn(
+ 'inline-grid place-items-center rounded-sm border aspect-square h-[34px]',
+ props.completed
+ ? 'bg-ink/20 border-edge text-ink'
+ : 'bg-ink/10 border-edge text-ink'
+ )}
+ >
+ <span class="size-3.5 inline-grid place-items-center">
+ <Dynamic component={props.icon} />
+ </span>
+ </span>
+ </CalloutShell>
);
}
@@ -187,20 +240,3 @@ export function ContinueButton(props: ContinueButtonProps) {
</button>
);
}
-
-interface SkipButtonProps {
- onClick: () => void;
-}
-
-export function SkipButton(props: SkipButtonProps) {
- return (
- <button
- type="button"
- class="w-full px-4 py-2.5 text-lg rounded-xs flex items-center gap-2 bg-transparent text-ink/40 hover:bg-hover/60 bracket-never focus:bg-hover/50"
- onClick={props.onClick}
- >
- Skip
- <span class="opacity-50">(esc)</span>
- </button>
- );
-}
diff --git a/js/app/packages/app/component/interactive-onboarding/components/MockAppChrome.tsx b/js/app/packages/app/component/interactive-onboarding/components/MockAppChrome.tsx
index f43b285b30..30d86d8546 100644
--- a/js/app/packages/app/component/interactive-onboarding/components/MockAppChrome.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/components/MockAppChrome.tsx
@@ -1,4 +1,11 @@
-import { For, Show, type JSX, onMount, onCleanup } from 'solid-js';
+import {
+ For,
+ Show,
+ type JSX,
+ onMount,
+ onCleanup,
+ createSignal,
+} from 'solid-js';
import MacroIcon from '@macro-icons/macro-logo.svg';
import { Dynamic } from 'solid-js/web';
import { cn } from '@ui/utils/classname';
@@ -13,6 +20,9 @@ import { AnimatedTaskIcon } from '@macro-icons/wide/animating/task';
import { AnimatedChannelIcon } from '@macro-icons/wide/animating/channel';
import { AnimatedStarIcon } from '@macro-icons/wide/animating/star';
import { AnimatedFolderIcon } from '@macro-icons/wide/animating/folder';
+import { AnimatedCommandIcon } from '@macro-icons/wide/animating/command';
+import { AnimatedGearIcon } from '@macro-icons/wide/animating/gear';
+import { AnimatedPlusIcon } from '@macro-icons/wide/animating/plus';
import { registerHotkey, createHotkeyGroup } from '@core/hotkey/hotkeys';
import { GO_TO_COMMAND_SCOPE, GO_TO_LEADER_KEY } from '@app/constants/hotkeys';
import type { ValidHotkey } from '@core/hotkey/types';
@@ -20,16 +30,10 @@ import { Tooltip } from '@core/component/Tooltip';
export const MOCK_SIDEBAR_LINKS = [
{
- id: 'channels',
- label: 'Channels',
- icon: AnimatedChannelIcon,
- hotkey: 'c',
- },
- {
- id: 'documents',
- label: 'Documents',
- icon: AnimatedFileMdIcon,
- hotkey: 'd',
+ id: 'agents',
+ label: 'Agents',
+ icon: AnimatedStarIcon,
+ hotkey: 'a',
},
{
id: 'mail',
@@ -37,6 +41,12 @@ export const MOCK_SIDEBAR_LINKS = [
icon: AnimatedEmailIcon,
hotkey: 'e',
},
+ {
+ id: 'documents',
+ label: 'Documents',
+ icon: AnimatedFileMdIcon,
+ hotkey: 'd',
+ },
{
id: 'tasks',
label: 'Tasks',
@@ -44,10 +54,10 @@ export const MOCK_SIDEBAR_LINKS = [
hotkey: 't',
},
{
- id: 'agents',
- label: 'Agents',
- icon: AnimatedStarIcon,
- hotkey: 'a',
+ id: 'channels',
+ label: 'Channels',
+ icon: AnimatedChannelIcon,
+ hotkey: 'c',
},
{
id: 'folders',
@@ -66,6 +76,16 @@ interface MockAppChromeProps {
children?: JSX.Element;
/** Called whenever the sidebar filter changes (click or hotkey). */
onFilterChange?: (filter: SandboxSidebarFilter) => void;
+ /** When set, highlights that sidebar icon in accent color until activated. */
+ highlightId?: SandboxSidebarFilter;
+ /** Called when the command menu button at the bottom of the sidebar is clicked. If omitted, the button is inert. */
+ onCommandClick?: () => void;
+ /** When true, glows the command menu button until it's clicked for the first time. */
+ highlightCommand?: boolean;
+ /** Called when the create (+) button at the top of the sidebar is clicked. If omitted, the button is inert. */
+ onCreateClick?: () => void;
+ /** When true, glows the create button until it's clicked for the first time. */
+ highlightCreate?: boolean;
}
export function MockAppChrome(props: MockAppChromeProps) {
@@ -76,11 +96,35 @@ export function MockAppChrome(props: MockAppChromeProps) {
return match?.label ?? 'All Items';
};
+ // Tracks which highlight ids have been activated at least once so the glow
+ // turns off permanently after the user interacts with that specific target.
+ // Stored as a Set of ids so the component supports `highlightId` changing
+ // between sidebar items — not just latching a single boolean.
+ const [activatedHighlights, setActivatedHighlights] = createSignal<
+ ReadonlySet<SandboxSidebarFilter>
+ >(new Set());
+
const setFilter = (filter: SandboxSidebarFilter) => {
setSidebarFilter(filter);
+ if (filter !== null && filter === props.highlightId) {
+ setActivatedHighlights((prev) => {
+ if (prev.has(filter)) return prev;
+ const next = new Set(prev);
+ next.add(filter);
+ return next;
+ });
+ }
props.onFilterChange?.(filter);
};
+ const [commandActivated, setCommandActivated] = createSignal(false);
+ const isCommandHighlighted = () =>
+ !!props.highlightCommand && !commandActivated();
+
+ const [createActivated, setCreateActivated] = createSignal(false);
+ const isCreateHighlighted = () =>
+ !!props.highlightCreate && !createActivated();
+
const group = createHotkeyGroup();
onMount(() => {
@@ -111,9 +155,34 @@ export function MockAppChrome(props: MockAppChromeProps) {
return (
<div class="size-full p-4 bg-panel">
+ <style>{`
+ @keyframes sidebar-glow-pulse {
+ 0%, 100% { box-shadow: 0 0 0 0 rgb(from var(--color-accent) r g b / 0.5), 0 0 8px 2px rgb(from var(--color-accent) r g b / 0.35); }
+ 50% { box-shadow: 0 0 0 2px rgb(from var(--color-accent) r g b / 0.15), 0 0 14px 4px rgb(from var(--color-accent) r g b / 0.55); }
+ }
+ .sidebar-glow { animation: sidebar-glow-pulse 1.8s ease-in-out infinite; border-radius: 4px; }
+ `}</style>
<div class="flex size-full bg-page rounded-sm border border-edge-muted">
<div class="px-2 shrink-0 bg-surface-secondary/50 flex flex-col items-center py-3 gap-1">
- <MacroIcon class="size-5 text-accent mb-4" />
+ <MacroIcon class="size-5 text-accent mb-3" />
+ <button
+ type="button"
+ class={cn(
+ 'size-6 text-ink rounded-xs p-1 transition-colors cursor-default',
+ isCreateHighlighted()
+ ? 'opacity-100 hover:bg-ink/10 sidebar-glow'
+ : 'opacity-50 hover:opacity-80 hover:bg-ink/10'
+ )}
+ onClick={(e) => {
+ e.preventDefault();
+ setCreateActivated(true);
+ props.onCreateClick?.();
+ }}
+ title="Create"
+ >
+ <AnimatedPlusIcon />
+ </button>
+ <hr class="border-ink/5 w-full my-1" />
<button
type="button"
class={cn(
@@ -145,6 +214,18 @@ export function MockAppChrome(props: MockAppChromeProps) {
<For each={MOCK_SIDEBAR_LINKS}>
{(link) => {
const isActive = () => sidebarFilter() === link.id;
+ const isHighlighted = () =>
+ props.highlightId === link.id &&
+ !activatedHighlights().has(link.id);
+ const stateClass = () => {
+ if (isActive()) {
+ return 'opacity-100 bg-ink/10 text-ink hover:bg-ink/10';
+ }
+ if (isHighlighted()) {
+ return 'opacity-100 text-ink hover:bg-ink/10 sidebar-glow';
+ }
+ return 'text-ink opacity-50 hover:opacity-80 hover:bg-ink/10';
+ };
return (
<Tooltip
tooltip={
@@ -166,10 +247,8 @@ export function MockAppChrome(props: MockAppChromeProps) {
<button
type="button"
class={cn(
- 'size-6 text-ink rounded-xs p-1 transition-colors cursor-default hover:bg-ink/10',
- isActive()
- ? 'opacity-100 bg-ink/10 text-ink'
- : 'opacity-50 hover:opacity-80'
+ 'size-6 rounded-xs p-1 transition-colors cursor-default',
+ stateClass()
)}
onClick={(e) => {
e.preventDefault();
@@ -184,6 +263,34 @@ export function MockAppChrome(props: MockAppChromeProps) {
);
}}
</For>
+
+ <div class="mt-auto flex flex-col items-center gap-1">
+ <button
+ type="button"
+ class={cn(
+ 'size-6 text-ink rounded-xs p-1 transition-colors cursor-default',
+ isCommandHighlighted()
+ ? 'opacity-100 hover:bg-ink/10 sidebar-glow'
+ : 'opacity-50 hover:opacity-80 hover:bg-ink/10'
+ )}
+ onClick={(e) => {
+ e.preventDefault();
+ setCommandActivated(true);
+ props.onCommandClick?.();
+ }}
+ title="Command Menu"
+ >
+ <AnimatedCommandIcon />
+ </button>
+ <button
+ type="button"
+ class="size-6 text-ink rounded-xs p-1 transition-colors cursor-default opacity-50 hover:opacity-80 hover:bg-ink/10"
+ onClick={(e) => e.preventDefault()}
+ title="Settings"
+ >
+ <AnimatedGearIcon />
+ </button>
+ </div>
</div>
{/* Main area */}
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/choose-plan.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/choose-plan.tsx
index f11d910279..c461450760 100644
--- a/js/app/packages/app/component/interactive-onboarding/lessons/choose-plan.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/lessons/choose-plan.tsx
@@ -4,6 +4,7 @@ import { stripeServiceClient } from '@service-stripe/client';
import { useAnalytics } from '@app/component/analytics-context';
import { toast } from '@core/component/Toast/Toast';
import { PlanGrid } from '@app/component/paywall/PlanGrid';
+import { ROUTER_BASE_CONCAT } from '@app/constants/routerBase';
function ChoosePlanContent(props: LessonContentProps) {
onMount(() => props.onComplete());
@@ -15,20 +16,33 @@ function ChoosePlanContent(props: LessonContentProps) {
);
}
-function ChoosePlanDemo() {
+function ChoosePlanDemo(props: LessonContentProps) {
const analytics = useAnalytics();
const [loading, setLoading] = createSignal<string | null>(null);
const handleCheckout = async (tier: string) => {
if (loading()) return;
+ if (tier === 'free') {
+ analytics.track('subscription_start', { type: tier });
+ // Advance to the launch step rather than leaving onboarding.
+ props.advance();
+ return;
+ }
setLoading(tier);
try {
- const url = await stripeServiceClient.createCheckoutSession(
- '',
- undefined,
- tier
- );
+ // Return to the onboarding (not /app) on success so the launch step renders.
+ // `subscriptionSuccess` triggers the `completeOnParam` hook on this lesson, which
+ // pre-marks choose-plan complete in the state machine — the user lands on launch.
+ const successUrl = `${window.location.origin}${ROUTER_BASE_CONCAT}welcome?subscriptionSuccess=true&type=${tier}`;
+ const url = await stripeServiceClient.createCheckoutSession({
+ tier,
+ successUrl,
+ });
analytics.track('subscription_start', { type: tier });
+ // Fire the lesson's completion analytics before leaving so the paid path
+ // has parity with the free branch. `advance()` also bumps the state machine,
+ // but we're redirecting immediately — on return, `completeOnParam` takes over.
+ props.advance();
window.location.href = url;
} catch (error) {
console.error('Checkout error:', error);
@@ -55,7 +69,11 @@ function ChoosePlanDemo() {
'opacity-60': loading() !== null,
}}
>
- {loading() === plan.tier ? 'Loading...' : `Get ${plan.name}`}
+ {loading() === plan.tier
+ ? 'Loading...'
+ : plan.tier === 'free'
+ ? 'Start free'
+ : 'Subscribe'}
</button>
)}
/>
@@ -70,4 +88,5 @@ export const choosePlanLesson: LessonDefinition = {
demo: ChoosePlanDemo,
order: 80,
hideContinue: true,
+ completeOnParam: 'subscriptionSuccess',
};
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx
index d1c383e0d7..c16a65e030 100644
--- a/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx
@@ -15,9 +15,10 @@ import {
onCleanup,
onMount,
} from 'solid-js';
-import { Hotkey } from '@core/component/Hotkey';
-import { HotkeyCallout } from '../components-lib';
+import { ClickCallout, HotkeyCallout } from '../components-lib';
import { MockAppChrome } from '../components/MockAppChrome';
+import { AnimatedCommandIcon } from '@macro-icons/wide/animating/command';
+import { IS_MAC } from '@core/constant/isMac';
import { OnboardingEntityList } from '../OnboardingEntityList';
import type { LessonContentProps, LessonDefinition } from '../types';
@@ -44,34 +45,27 @@ function CommandKContent(_props: LessonContentProps) {
return (
<div class="flex flex-col gap-3 onboarding-stagger">
<p>
- The Command Menu is another way to quickly find items in your workspace.
- Search for documents, tasks, channels, and more — and navigate to them
- instantly.
+ The Command Menu allows you to search for documents, tasks, channels,
+ and more — and navigate to them instantly.
</p>
- <HotkeyCallout
- keys={['⌘', 'K']}
- label="to open the command menu"
+ <div class="mt-2">
+ <HotkeyCallout
+ keys={[IS_MAC ? '⌘' : 'Ctrl', 'K']}
+ separator="+"
+ label=""
+ completed={completed()}
+ />
+ </div>
+ <div class="flex items-center gap-3 text-sm text-ink/40">
+ <div class="h-px w-8 bg-edge-muted" />
+ or
+ <div class="h-px flex-1 bg-edge-muted" />
+ </div>
+ <ClickCallout
+ icon={AnimatedCommandIcon}
+ label="in the sidebar"
completed={completed()}
/>
- <p class="flex flex-wrap items-center gap-x-1 gap-y-1 text-sm text-fg-muted">
- <strong>Tip:</strong> Search and use
- <span class="flex border border-edge-muted text-[0.625rem] rounded-xs items-center px-1.5 py-0.25 font-normal">
- <Hotkey shortcut="ctrl+j" class="space-x-1" />
- </span>
- /
- <span class="flex border border-edge-muted text-[0.625rem] rounded-xs items-center px-1.5 py-0.25 font-normal">
- <Hotkey shortcut="ctrl+k" class="space-x-1" />
- </span>
- or
- <span class="flex border border-edge-muted text-[0.625rem] rounded-xs items-center px-1.5 py-0.25 font-normal">
- <Hotkey shortcut="arrowup" class="space-x-1" />
- </span>
- /
- <span class="flex border border-edge-muted text-[0.625rem] rounded-xs items-center px-1.5 py-0.25 font-normal">
- <Hotkey shortcut="arrowdown" class="space-x-1" />
- </span>
- to move the cursor.
- </p>
</div>
);
}
@@ -154,7 +148,10 @@ function CommandKDemo(props: LessonContentProps) {
return (
<>
{/* Entity list visible behind the modal */}
- <MockAppChrome>
+ <MockAppChrome
+ onCommandClick={() => setCommandKOpen((v) => !v)}
+ highlightCommand
+ >
<OnboardingEntityList soup={soup} />
</MockAppChrome>
@@ -192,6 +189,5 @@ export const commandKLesson: LessonDefinition = {
title: 'Command Menu',
content: CommandKContent,
demo: CommandKDemo,
- skippable: true,
order: 40,
};
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/create-entity.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/create-entity.tsx
index 582d1dd79b..8888d7e839 100644
--- a/js/app/packages/app/component/interactive-onboarding/lessons/create-entity.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/lessons/create-entity.tsx
@@ -18,7 +18,8 @@ import {
import { useListNavigation } from '../use-list-navigation';
import { OnboardingEntityList } from '../OnboardingEntityList';
import { MockAppChrome } from '../components/MockAppChrome';
-import { HotkeyCallout } from '../components-lib';
+import { ClickCallout, HotkeyCallout } from '../components-lib';
+import { AnimatedPlusIcon } from '@macro-icons/wide/animating/plus';
import type { LessonContentProps, LessonDefinition } from '../types';
import {
filteredSandboxEntities,
@@ -93,11 +94,19 @@ function CreateEntityContent(props: LessonContentProps) {
>
<p>
The <strong>Create Launcher</strong> lets you create Macro Editor
- quickly, from anywhere. Press <strong>C</strong> to open the Launcher.
+ quickly, from anywhere.
</p>
- <HotkeyCallout
- keys={['C']}
- label="to open the Create menu"
+ <div class="mt-2">
+ <HotkeyCallout keys={['C']} label="" completed={completed()} />
+ </div>
+ <div class="flex items-center gap-3 text-sm text-ink/40">
+ <div class="h-px w-8 bg-edge-muted" />
+ or
+ <div class="h-px flex-1 bg-edge-muted" />
+ </div>
+ <ClickCallout
+ icon={AnimatedPlusIcon}
+ label="in the sidebar"
completed={completed()}
/>
</div>
@@ -145,7 +154,10 @@ function CreateEntityDemo(props: LessonContentProps) {
return (
<div class="flex flex-col h-full relative">
- <MockAppChrome>
+ <MockAppChrome
+ onCreateClick={() => setLauncherOpen((v) => !v)}
+ highlightCreate
+ >
<Show when={sharedSoup()}>
{(s) => <OnboardingEntityList soup={s()} />}
</Show>
@@ -180,5 +192,4 @@ export const createEntityLesson: LessonDefinition = {
content: CreateEntityContent,
demo: CreateEntityDemo,
order: 45,
- skippable: true,
};
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/email-invite.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/email-invite.tsx
deleted file mode 100644
index fa3af31a05..0000000000
--- a/js/app/packages/app/component/interactive-onboarding/lessons/email-invite.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-import { createSignal, onCleanup, onMount } from 'solid-js';
-import type { LessonContentProps, LessonDefinition } from '../types';
-import { MockAppChrome } from '../components/MockAppChrome';
-import { authServiceClient } from '@service-auth/client';
-import { contactsClient } from '@service-contacts/client';
-import { isOk } from '@core/util/maybeResult';
-
-function parseEmails(raw: string): string[] {
- return raw
- .split(/[,\n\s]/)
- .map((s) => s.trim())
- .filter((s) => s.includes('@'));
-}
-
-function EmailInviteContent(props: LessonContentProps) {
- const [value, setValue] = createSignal('');
- let textareaRef: HTMLTextAreaElement | undefined;
-
- // setTimeout defers onComplete to a new macrotask, safely after the shell's
- // handleContinue has finished calling setReadyToContinue(false). Then the
- // double-rAF focuses the textarea after the shell's own rAF focuses the button.
- onMount(() => {
- setTimeout(() => {
- props.onComplete('Send Invites');
- requestAnimationFrame(() =>
- requestAnimationFrame(() => textareaRef?.focus())
- );
- });
- });
-
- onCleanup(() => {
- const emails = parseEmails(value());
- if (!emails.length) return;
- for (const email of emails) {
- authServiceClient.sendReferralInvite(email).then((result) => {
- if (isOk(result)) {
- contactsClient.addContact(`macro|${email.toLowerCase()}`);
- }
- });
- }
- });
-
- return (
- <div class="flex flex-col gap-3 onboarding-stagger">
- <p>
- Invite friends and teammates to Macro. You'll get $100 in credits for
- each person who signs up.
- </p>
- <div class="flex flex-col gap-2">
- <textarea
- ref={textareaRef}
- value={value()}
- onInput={(e) => setValue(e.currentTarget.value)}
- rows={4}
- class="w-full px-3 py-2 text-sm border border-edge-muted rounded-xs bg-panel text-ink placeholder:text-ink/30 outline-none focus:border-accent/50 resize-none leading-relaxed"
- />
- <p class="text-xs text-ink/40">
- Separate addresses with a new line or comma.
- </p>
- </div>
- </div>
- );
-}
-
-function EmailInviteDemo() {
- return <MockAppChrome />;
-}
-
-export const emailInviteLesson: LessonDefinition = {
- id: 'email-invite',
- title: 'Invite Your Team',
- content: EmailInviteContent,
- demo: EmailInviteDemo,
- order: 70,
- skippable: true,
-};
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/index.ts b/js/app/packages/app/component/interactive-onboarding/lessons/index.ts
index 7145d2c76b..c57d224382 100644
--- a/js/app/packages/app/component/interactive-onboarding/lessons/index.ts
+++ b/js/app/packages/app/component/interactive-onboarding/lessons/index.ts
@@ -1,26 +1,22 @@
import type { LessonDefinition } from '../types';
import { welcomeLesson } from './welcome';
import { sidebarNavLesson } from './sidebar-nav';
-import { navigateListLesson } from './navigate-list';
import { commandKLesson } from './command-k';
import { createEntityLesson } from './create-entity';
import { markdownMentionsLesson } from './markdown-mentions';
// import { composersPreviewLesson } from './composers-preview';
import { aboutUsLesson } from './about-us';
-import { emailInviteLesson } from './email-invite';
import { choosePlanLesson } from './choose-plan';
import { launchLesson } from './launch';
export const LESSONS: LessonDefinition[] = [
welcomeLesson,
sidebarNavLesson,
- navigateListLesson,
commandKLesson,
createEntityLesson,
markdownMentionsLesson,
// composersPreviewLesson,
aboutUsLesson,
- emailInviteLesson,
choosePlanLesson,
launchLesson,
];
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/markdown-mentions.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/markdown-mentions.tsx
index d9c61a23bb..d2486e8184 100644
--- a/js/app/packages/app/component/interactive-onboarding/lessons/markdown-mentions.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/lessons/markdown-mentions.tsx
@@ -82,5 +82,4 @@ export const markdownMentionsLesson: LessonDefinition = {
content: MarkdownMentionsContent,
demo: MarkdownMentionsDemo,
order: 50,
- skippable: true,
};
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/navigate-list.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/navigate-list.tsx
deleted file mode 100644
index ba23dca55c..0000000000
--- a/js/app/packages/app/component/interactive-onboarding/lessons/navigate-list.tsx
+++ /dev/null
@@ -1,168 +0,0 @@
-import { createSoupState } from '@app/component/next-soup/create-soup-state';
-import type { SoupState } from '@app/component/next-soup/create-soup-state';
-import {
- filteredSandboxEntities,
- removeSandboxEntity,
- setSidebarFilter,
- sidebarFilter,
-} from '../sandbox/sandbox-store';
-import {
- createEffect,
- createSignal,
- onCleanup,
- onMount,
- Show,
- untrack,
-} from 'solid-js';
-import { OnboardingEntityList } from '../OnboardingEntityList';
-import { HotkeyCallout } from '../components-lib';
-import type { LessonContentProps, LessonDefinition } from '../types';
-import { useListNavigation } from '../use-list-navigation';
-import { MockAppChrome } from '../components/MockAppChrome';
-import { createHotkeyGroup, registerHotkey } from '@core/hotkey/hotkeys';
-
-const [sharedSoup, setSharedSoup] = createSignal<SoupState | undefined>();
-const [removingIds, setRemovingIds] = createSignal<Set<string>>(new Set());
-
-const REMOVE_ANIMATION_MS = 180;
-
-function NavigateListContent(props: LessonContentProps) {
- const previousFilter = sidebarFilter();
- setSidebarFilter('mail');
-
- const soup = createSoupState({
- initialData: filteredSandboxEntities(),
- wrapNavigation: true,
- });
-
- setSharedSoup(soup);
-
- createEffect(() => {
- soup.setData(filteredSandboxEntities());
- });
-
- const [hasHitNext, setHasHitNext] = createSignal(false);
- const [hasHitPrev, setHasHitPrev] = createSignal(false);
- const [hasMarkedDone, setHasMarkedDone] = createSignal(false);
-
- const hasNavigated = () => hasHitNext() && hasHitPrev();
-
- useListNavigation(soup, props.scopeId, (direction) => {
- if (direction === 'down') setHasHitNext(true);
- if (direction === 'up') setHasHitPrev(true);
- });
-
- // Auto-select the first item as soon as the list has data (handles the case
- // where the filter starts as 'empty' and only populates after a sidebar click).
- let focusInitialized = false;
- createEffect(() => {
- const data = soup.data();
- if (!focusInitialized && data.length > 0) {
- focusInitialized = true;
- untrack(() => soup.navigate.toFirst());
- }
- });
-
- const group = createHotkeyGroup();
-
- onMount(() => {
- registerHotkey({
- scopeId: props.scopeId,
- hotkey: 'e',
- description: 'Mark done',
- keyDownHandler: () => {
- if (!hasNavigated()) return false;
- const focused = soup.focus.item();
- if (!focused) return false;
- const currentIndex = soup.focus.index();
- const data = soup.items.data();
-
- // Select the next item by id *before* removing so focus never resets
- const nextItem = data[currentIndex + 1] ?? data[currentIndex - 1];
- if (nextItem) soup.focus.set(nextItem.id);
-
- // Animate the row away, then remove from the store
- setRemovingIds(new Set<string>([focused.id]));
- setTimeout(() => {
- removeSandboxEntity(focused.id);
- setRemovingIds(new Set<string>());
- }, REMOVE_ANIMATION_MS);
-
- if (!hasMarkedDone()) {
- setHasMarkedDone(true);
- props.onComplete();
- }
- return true;
- },
- }).withGroup(group);
- });
-
- onCleanup(() => {
- group.dispose();
- setSharedSoup(undefined);
- setRemovingIds(new Set<string>());
- setSidebarFilter(previousFilter);
- });
-
- return (
- <div class="flex flex-col gap-4 onboarding-stagger">
- <p>
- Macro uses fast, familiar keys for navigating lists.{' '}
- <strong class="text-ink/90 font-medium">J</strong> and{' '}
- <strong class="text-ink/90 font-medium">K</strong> — or the arrow keys —
- move you through items without reaching for the mouse.
- </p>
-
- <div class="flex flex-col gap-2">
- <HotkeyCallout
- keys={['J', '↓']}
- separator="or"
- label="Move to next item"
- completed={hasHitNext()}
- />
- <HotkeyCallout
- keys={['K', '↑']}
- separator="or"
- label="Move back up"
- completed={hasHitPrev()}
- />
- </div>
-
- <Show when={hasNavigated()}>
- <p>
- In certain views, you can mark items as done to indicate their
- completeness — keeping your list focused on what still needs
- attention.
- </p>
- <HotkeyCallout
- keys={['E']}
- label="Mark item done"
- completed={hasMarkedDone()}
- />
- </Show>
- </div>
- );
-}
-
-function NavigateListDemo() {
- return (
- <MockAppChrome>
- <Show when={sharedSoup()}>
- {(soup) => (
- <div class="h-full overflow-y-auto">
- <OnboardingEntityList soup={soup()} removingIds={removingIds} />
- </div>
- )}
- </Show>
- </MockAppChrome>
- );
-}
-
-export const navigateListLesson: LessonDefinition = {
- id: 'navigate-list',
- title: 'The List View',
- content: NavigateListContent,
- demo: NavigateListDemo,
- order: 20,
- skippable: true,
-};
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/sidebar-nav.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/sidebar-nav.tsx
index 1cbd6853a4..b9c2680291 100644
--- a/js/app/packages/app/component/interactive-onboarding/lessons/sidebar-nav.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/lessons/sidebar-nav.tsx
@@ -5,8 +5,9 @@ import {
} from '../sandbox/sandbox-store';
import { createEffect, createSignal } from 'solid-js';
import { OnboardingEntityList } from '../OnboardingEntityList';
-import { HotkeyCallout } from '../components-lib';
+import { ClickCallout, HotkeyCallout } from '../components-lib';
import { MockAppChrome } from '../components/MockAppChrome';
+import { AnimatedEmailIcon } from '@macro-icons/wide/animating/email';
import type { LessonContentProps, LessonDefinition } from '../types';
function SidebarNavContent(props: LessonContentProps) {
@@ -20,19 +21,28 @@ function SidebarNavContent(props: LessonContentProps) {
return (
<div class="flex flex-col gap-3 onboarding-stagger">
+ <p>Use the sidebar to quickly jump between views.</p>
<p>
- Use the sidebar to quickly jump between views. Try navigating to{' '}
- <strong>Emails</strong>.
+ Try navigating to <strong>Emails</strong>.
</p>
- <HotkeyCallout
- keys={['G', 'E']}
- separator="then"
- label="Go to Emails"
+ <div class="mt-2">
+ <HotkeyCallout
+ keys={['G', 'E']}
+ separator="then"
+ label=""
+ completed={done()}
+ />
+ </div>
+ <div class="flex items-center gap-3 text-sm text-ink/40">
+ <div class="h-px w-8 bg-edge-muted" />
+ or
+ <div class="h-px flex-1 bg-edge-muted" />
+ </div>
+ <ClickCallout
+ icon={AnimatedEmailIcon}
+ label="in the sidebar"
completed={done()}
/>
- <p class="text-sm text-ink/50">
- Or click the email icon in the sidebar on the right.
- </p>
</div>
);
}
@@ -48,7 +58,7 @@ function SidebarNavDemo() {
});
return (
- <MockAppChrome>
+ <MockAppChrome highlightId="mail">
<OnboardingEntityList soup={soup} />
</MockAppChrome>
);
@@ -60,5 +70,4 @@ export const sidebarNavLesson: LessonDefinition = {
content: SidebarNavContent,
demo: SidebarNavDemo,
order: 5,
- skippable: true,
};
diff --git a/js/app/packages/app/component/interactive-onboarding/types.ts b/js/app/packages/app/component/interactive-onboarding/types.ts
index bea52410a8..723c188f91 100644
--- a/js/app/packages/app/component/interactive-onboarding/types.ts
+++ b/js/app/packages/app/component/interactive-onboarding/types.ts
@@ -10,9 +10,7 @@ export interface LessonDefinition {
/** Optional component rendered in the right demo panel. When omitted the Macro logo is shown. */
demo?: Component<LessonContentProps>;
order?: number;
- /** Whether the user can skip this lesson. Defaults to false. */
- skippable?: boolean;
- /** Hide the continue/skip buttons entirely — the lesson drives its own advancement. */
+ /** Hide the continue button entirely — the lesson drives its own advancement. */
hideContinue?: boolean;
/** Called instead of the default complete-and-advance flow. On web, redirects externally (returns void). On native mobile, performs auth inline and returns true to advance. */
onContinue?: () => void | Promise<boolean>;
@@ -33,6 +31,8 @@ export interface LessonContentProps {
isActive: boolean;
/** Hotkey scope ID from the shell — register all lesson hotkeys into this scope */
scopeId: string;
+ /** Programmatically mark the current lesson complete and advance to the next one. */
+ advance: () => void;
}
export interface LessonState {
diff --git a/js/app/packages/app/component/paywall/PaywallComponent.tsx b/js/app/packages/app/component/paywall/PaywallComponent.tsx
index a6392dba89..f8153c795e 100644
--- a/js/app/packages/app/component/paywall/PaywallComponent.tsx
+++ b/js/app/packages/app/component/paywall/PaywallComponent.tsx
@@ -8,7 +8,15 @@ import { stripeServiceClient } from '@service-stripe/client';
import { createMemo, createSignal, For, Show } from 'solid-js';
import { match } from 'ts-pattern';
import { useAnalytics } from '@app/component/analytics-context';
-import { PLANS, type PlanTier } from './plans';
+import { PLANS, PLAN_FEATURES, type PaidPlanTier } from './plans';
+
+// Paid-only plans for the billing paywall — Stripe has no product for the
+// 'free' tier, so it must be excluded here. Filtered once at module scope so
+// the component doesn't re-filter on every render.
+const PAID_PLANS = PLANS.filter(
+ (p): p is Extract<(typeof PLANS)[number], { tier: PaidPlanTier }> =>
+ p.tier !== 'free'
+);
interface PaywallComponent {
cb: () => Promise<void> | void;
@@ -27,7 +35,7 @@ const PaywallComponent = (props: PaywallComponent) => {
// Tier a paying user is currently subscribed to, derived from RBAC permissions
// (sub_opus grants write:opus; sub_sonnet grants write:sonnet + write:haiku;
// sub_haiku grants write:haiku — so check highest-to-lowest).
- const currentTier = createMemo((): PlanTier | undefined => {
+ const currentTier = createMemo((): PaidPlanTier | undefined => {
if (!hasPaid()) return undefined;
const perms = permissions();
if (perms.includes('write:opus')) return 'opus';
@@ -40,23 +48,23 @@ const PaywallComponent = (props: PaywallComponent) => {
// then the UI derives its selection from `currentTier` (falling back to 'sonnet' for
// non-paying users). This avoids mirroring derived state into a signal via `createEffect`
// and also sidesteps the briefly-wrong-card window before permissions resolve.
- const [userSelectedTier, setUserSelectedTier] = createSignal<PlanTier | null>(
- null
- );
- const selectedTier = createMemo<PlanTier>(
+ const [userSelectedTier, setUserSelectedTier] =
+ createSignal<PaidPlanTier | null>(null);
+ const selectedTier = createMemo<PaidPlanTier>(
() => userSelectedTier() ?? currentTier() ?? 'sonnet'
);
const [updating, setUpdating] = createSignal(false);
- const handleCheckout = async (tier: PlanTier) => {
+ const handleCheckout = async (tier: PaidPlanTier) => {
try {
await props.cb();
- const url = await stripeServiceClient.createCheckoutSession(
- props.customType ? props.customType : (props.errorKey ?? undefined),
- undefined,
- tier
- );
+ const url = await stripeServiceClient.createCheckoutSession({
+ type: props.customType
+ ? props.customType
+ : (props.errorKey ?? undefined),
+ tier,
+ });
analytics.track('subscription_start', {
type: tier,
customType: props.customType,
@@ -155,7 +163,7 @@ const PaywallComponent = (props: PaywallComponent) => {
<div class="mx-auto mt-6 w-full max-w-2xl">
<div class="gap-3 sm:gap-4 grid grid-cols-1 sm:grid-cols-3">
- <For each={PLANS}>
+ <For each={PAID_PLANS}>
{(plan) => (
<button
onClick={() => setUserSelectedTier(plan.tier)}
@@ -185,8 +193,12 @@ const PaywallComponent = (props: PaywallComponent) => {
<span class="text-base text-ink/40">/mo</span>
</div>
<div class="text-sm text-ink/60 flex flex-col gap-1">
- <For each={plan.features}>
- {(feature) => <span>{feature}</span>}
+ <For each={PLAN_FEATURES}>
+ {(feature) => (
+ <span>
+ {feature.label}: {feature.values[plan.tier]}
+ </span>
+ )}
</For>
</div>
</div>
diff --git a/js/app/packages/app/component/paywall/PlanGrid.tsx b/js/app/packages/app/component/paywall/PlanGrid.tsx
index 76ffe96e4c..9715f181b9 100644
--- a/js/app/packages/app/component/paywall/PlanGrid.tsx
+++ b/js/app/packages/app/component/paywall/PlanGrid.tsx
@@ -1,69 +1,101 @@
-import { For, type JSX } from 'solid-js';
-import { isMobile } from '@core/mobile/isMobile';
-import { PLANS, type Plan, type PlanTier } from './plans';
+import { For, Show, type JSX } from 'solid-js';
+import { PLANS, PLAN_FEATURES, type Plan, type PlanTier } from './plans';
interface PlanGridProps {
- /** The currently highlighted tier — shows accent border. */
+ /** The currently highlighted tier — shows accent styling. */
highlightedTier?: () => PlanTier | undefined;
- /** Render a footer (e.g. button) below the features for each plan card. */
+ /** Render a footer (e.g. button) below the feature rows for each plan column. */
footer?: (plan: Plan) => JSX.Element;
}
export function PlanGrid(props: PlanGridProps) {
- return (
- <div
- class="w-full max-w-2xl items-start"
- classList={{
- 'flex flex-col gap-3': isMobile(),
- 'flex gap-4': !isMobile(),
- }}
- >
- <For each={PLANS}>
- {(plan) => {
- const isHighlighted = () =>
- plan.highlighted || props.highlightedTier?.() === plan.tier;
+ const isHighlighted = (plan: Plan) =>
+ plan.highlighted || props.highlightedTier?.() === plan.tier;
- return (
- <div class="flex-1 flex flex-col w-full">
- <div
- class="border bg-panel rounded-xs flex flex-col overflow-hidden w-full"
- classList={{
- 'border-accent ring-1 ring-accent': isHighlighted(),
- 'border-edge-muted': !isHighlighted(),
- }}
- >
- <div
- class="p-4 flex flex-col gap-3 flex-1 w-full"
+ return (
+ <div class="w-full overflow-x-auto">
+ <table class="w-full min-w-[640px] text-sm border-separate border-spacing-0 table-fixed">
+ <thead>
+ <tr>
+ <th class="px-4 py-4 w-40" aria-hidden="true" />
+ <For each={PLANS}>
+ {(plan) => (
+ <th
+ scope="col"
+ class="px-4 py-4 text-left align-top"
classList={{
- 'items-center text-center': isMobile(),
+ 'bg-accent/5 border-t border-l border-r border-accent':
+ isHighlighted(plan),
}}
>
- <div>
- <h3 class="text-xl font-semibold text-ink">{plan.name}</h3>
- </div>
- <div class="flex items-baseline gap-0.5">
- <span class="text-4xl font-bold text-ink">
- ${plan.price}
+ <div class="flex flex-col gap-2">
+ <span class="text-xl font-semibold text-ink">
+ {plan.name}
+ </span>
+ <span class="flex items-baseline gap-0.5">
+ <span class="text-3xl font-bold text-ink">
+ ${plan.price}
+ </span>
+ <span class="text-base text-ink/40">/mo</span>
</span>
- <span class="text-base text-ink/40">/mo</span>
</div>
- <ul
- class="text-sm text-ink/60 flex flex-col gap-1"
- classList={{
- 'list-disc list-inside': !isMobile(),
- }}
- >
- <For each={plan.features}>
- {(feature) => <li>{feature}</li>}
- </For>
- </ul>
- <div class="mt-auto pt-2 w-full">{props.footer?.(plan)}</div>
- </div>
- </div>
- </div>
- );
- }}
- </For>
+ </th>
+ )}
+ </For>
+ </tr>
+ </thead>
+ <tbody>
+ <For each={PLAN_FEATURES}>
+ {(feature) => (
+ <tr>
+ <th
+ scope="row"
+ class="px-4 py-3 text-left font-normal text-ink/60 border-t border-edge-muted"
+ >
+ {feature.label}
+ </th>
+ <For each={PLANS}>
+ {(plan) => (
+ <td
+ class="px-4 py-3 text-ink"
+ classList={{
+ 'bg-accent/5 border-l border-r border-accent':
+ isHighlighted(plan),
+ 'border-t border-edge-muted': !isHighlighted(plan),
+ }}
+ >
+ {feature.values[plan.tier]}
+ </td>
+ )}
+ </For>
+ </tr>
+ )}
+ </For>
+ </tbody>
+ <Show when={props.footer}>
+ {(footerRender) => (
+ <tfoot>
+ <tr>
+ <td class="px-4 py-4 border-t border-edge-muted" />
+ <For each={PLANS}>
+ {(plan) => (
+ <td
+ class="px-4 py-4 align-bottom"
+ classList={{
+ 'bg-accent/5 border-l border-r border-b border-accent':
+ isHighlighted(plan),
+ 'border-t border-edge-muted': !isHighlighted(plan),
+ }}
+ >
+ {footerRender()(plan)}
+ </td>
+ )}
+ </For>
+ </tr>
+ </tfoot>
+ )}
+ </Show>
+ </table>
</div>
);
}
diff --git a/js/app/packages/app/component/paywall/plans.ts b/js/app/packages/app/component/paywall/plans.ts
index 67cf710899..a380454103 100644
--- a/js/app/packages/app/component/paywall/plans.ts
+++ b/js/app/packages/app/component/paywall/plans.ts
@@ -1,26 +1,66 @@
export const PLANS = [
+ {
+ tier: 'free' as const,
+ name: 'Level 0',
+ price: 0,
+ highlighted: false,
+ },
{
tier: 'haiku' as const,
name: 'Level 1',
price: 20,
- features: ['Haiku agent', '1,000 AI tool calls', '25 GB storage'],
highlighted: false,
},
{
tier: 'sonnet' as const,
name: 'Level 2',
price: 60,
- features: ['Sonnet agent', '5,000 AI tool calls', '100 GB storage'],
highlighted: false,
},
{
tier: 'opus' as const,
name: 'Level 3',
price: 120,
- features: ['Opus agent', 'Unlimited AI tool calls', '1 TB storage'],
highlighted: true,
},
] as const;
export type PlanTier = (typeof PLANS)[number]['tier'];
export type Plan = (typeof PLANS)[number];
+/** Tiers that correspond to real Stripe products. Excludes 'free'. */
+export type PaidPlanTier = Exclude<PlanTier, 'free'>;
+
+export interface PlanFeature {
+ label: string;
+ values: Record<PlanTier, string>;
+}
+
+export const PLAN_FEATURES: PlanFeature[] = [
+ {
+ label: 'AI Agent',
+ values: {
+ free: '—',
+ haiku: 'Haiku',
+ sonnet: 'Sonnet',
+ opus: 'Opus',
+ },
+ },
+ {
+ label: 'AI tool calls',
+ values: {
+ free: '—',
+ haiku: '1,000/month',
+ sonnet: '5,000/month',
+ opus: 'Unlimited',
+ },
+ },
+ {
+ label: 'Storage',
+ values: {
+ free: '5 GB',
+ haiku: '25 GB',
+ sonnet: '100 GB',
+ opus: '1 TB',
+ },
+ },
+];
diff --git a/js/app/packages/service-clients/service-stripe/client.ts b/js/app/packages/service-clients/service-stripe/client.ts
index c2a8ca1f50..49f66213d6 100644
--- a/js/app/packages/service-clients/service-stripe/client.ts
+++ b/js/app/packages/service-clients/service-stripe/client.ts
@@ -44,15 +44,22 @@ export const stripeServiceClient = {
* @returns The URL of the checkout session
*/
createCheckoutSession: async (
- type: string = '',
- discount?: string,
- tier?: string
+ args: {
+ type?: string;
+ discount?: string;
+ tier?: string;
+ /** Override the default success URL. Useful for flows (e.g. onboarding) that want the user returned to a specific page. */
+ successUrl?: string;
+ } = {}
) => {
+ const { type = '', discount, tier, successUrl } = args;
const gaClientId = await getGaClientId();
const { fbp, fbc } = getMetaIds();
const result = await authServiceClient.createCheckoutSession({
- successUrl: `${window.location.origin}/app/?subscriptionSuccess=true${type ? `&type=${type}` : ''}`,
+ successUrl:
+ successUrl ??
+ `${window.location.origin}/app/?subscriptionSuccess=true${type ? `&type=${type}` : ''}`,
cancelUrl: `${window.location.origin}/app?subscriptionCancel=true${tier ? `&tier=${tier}` : ''}`,
discount: discount ?? null,
metadata: {