Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
refactor(fe): Extract shared plan grid and update pricing tiers (#2469)
Evan Hutnik4bb1f273415e
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.tsxindex 88d8cd11f4..6071134692 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@@ -1,41 +1,9 @@-import { onMount, For, createSignal } from 'solid-js';+import { onMount, createSignal } from 'solid-js';import type { LessonContentProps, LessonDefinition } from '../types';import { stripeServiceClient } from '@service-stripe/client';import { useAnalytics } from '@app/component/analytics-context';import { toast } from '@core/component/Toast/Toast';-import { isTouchDevice } from '@core/mobile/isTouchDevice';--const PLANS: {- tier: string;- name: string;- price: number;- description: string;- calls: string;- popular?: boolean;-}[] = [- {- tier: 'haiku',- name: 'Haiku',- price: 20,- description: "Access to Anthropic's fast, lightweight model",- calls: '1,000',- },- {- tier: 'sonnet',- name: 'Sonnet',- price: 60,- description: "Access to Anthropic's balanced frontier model",- calls: '5,000',- popular: true,- },- {- tier: 'opus',- name: 'Opus',- price: 120,- description: "Access to Anthropic's most capable model",- calls: 'Unlimited',- },-];+import { PlanGrid } from '@app/component/paywall/PlanGrid';function ChoosePlanContent(props: LessonContentProps) {onMount(() => props.onComplete());@@ -71,77 +39,28 @@ function ChoosePlanDemo() {return (<div class="h-full w-full flex items-center justify-center px-8">- <div- class="w-full max-w-2xl items-start"- classList={{- 'flex flex-col gap-3': isTouchDevice(),- 'flex gap-4': !isTouchDevice(),- }}- >- <For each={PLANS}>- {(plan) => (- <div class="flex-1 flex flex-col">- {/* Badge row — always reserves the same height so cards align */}- <div class="h-5 flex items-end justify-start">- {plan.popular && (- <span class="bg-accent text-panel text-[10px] font-semibold px-2 py-0.5 rounded-sm rounded-b-none translate-x-[-1px]">- Most popular- </span>- )}- </div>-- {/* Card */}- <div- class="border bg-panel flex flex-col overflow-hidden"- style={{- 'border-radius': plan.popular ? '0 2px 2px 2px' : '2px',- }}- classList={{- 'border-accent ring-1 ring-accent': !!plan.popular,- 'border-edge-muted': !plan.popular,- }}- >- <div class="p-4 flex flex-col gap-3 flex-1">- <div>- <h3 class="text-xl font-semibold text-ink">{plan.name}</h3>- <p class="text-sm text-ink/50 mt-0.5">{plan.description}</p>- </div>- <div class="flex items-baseline gap-0.5">- <span class="text-4xl font-bold text-ink">- ${plan.price}- </span>- <span class="text-base text-ink/40">/mo</span>- </div>- <div class="text-sm text-ink/60">- <span class="font-semibold text-ink">{plan.calls}</span> AI- tool calls- </div>- <div class="mt-auto pt-2">- <button- type="button"- onClick={(e) => {- e.stopPropagation();- handleCheckout(plan.tier);- }}- disabled={loading() !== null}- class="w-full py-2 rounded-xs text-base font-semibold"- classList={{- 'bg-accent text-panel': !!plan.popular,- 'bg-ink/8 text-ink hover:bg-ink/12': !plan.popular,- 'opacity-60': loading() !== null,- }}- >- {loading() === plan.tier- ? 'Loading...'- : `Get ${plan.name}`}- </button>- </div>- </div>- </div>- </div>- )}- </For>- </div>+ <PlanGrid+ footer={(plan) => (+ <div class="mt-auto pt-2">+ <button+ type="button"+ onClick={(e) => {+ e.stopPropagation();+ handleCheckout(plan.tier);+ }}+ disabled={loading() !== null}+ class="w-full py-2 rounded-xs text-base font-semibold"+ classList={{+ 'bg-accent text-panel': !!plan.highlighted,+ 'bg-ink/8 text-ink hover:bg-ink/12': !plan.highlighted,+ 'opacity-60': loading() !== null,+ }}+ >+ {loading() === plan.tier ? 'Loading...' : `Get ${plan.name}`}+ </button>+ </div>+ )}+ /></div>);}diff --git a/js/app/packages/app/component/paywall/PaywallComponent.tsx b/js/app/packages/app/component/paywall/PaywallComponent.tsxindex 2abe09904a..3a4c6c4409 100644--- a/js/app/packages/app/component/paywall/PaywallComponent.tsx+++ b/js/app/packages/app/component/paywall/PaywallComponent.tsx@@ -4,31 +4,7 @@ import IconX from '@icon/regular/x.svg';import { stripeServiceClient } from '@service-stripe/client';import { createSignal, For, Show } from 'solid-js';import { useAnalytics } from '@app/component/analytics-context';--const PLANS = [- {- tier: 'haiku' as const,- name: 'Haiku',- price: 20,- description: "Access to Anthropic's fast, lightweight model",- calls: '1,000',- },- {- tier: 'sonnet' as const,- name: 'Sonnet',- price: 60,- description: "Access to Anthropic's balanced frontier model",- calls: '5,000',- popular: true,- },- {- tier: 'opus' as const,- name: 'Opus',- price: 120,- description: "Access to Anthropic's most capable model",- calls: 'Unlimited',- },-];+import { PLANS, type PlanTier } from './plans';interface PaywallComponent {cb: () => Promise<void> | void;@@ -42,10 +18,10 @@ interface PaywallComponent {const PaywallComponent = (props: PaywallComponent) => {const analytics = useAnalytics();- const [selectedTier, setSelectedTier] = createSignal<string>('sonnet');+ const [selectedTier, setSelectedTier] = createSignal<PlanTier>('sonnet');const hasPaid = useHasPaidAccess();- const handleCheckout = async (tier: string) => {+ const handleCheckout = async (tier: PlanTier) => {try {await props.cb();const url = await stripeServiceClient.createCheckoutSession(@@ -129,9 +105,6 @@ const PaywallComponent = (props: PaywallComponent) => {<div class="font-semibold text-ink text-base sm:text-lg">{plan.name}</div>- <p class="text-sm text-ink/50 mt-0.5">- {plan.description}- </p></div>{selectedTier() === plan.tier && (<div class="bg-accent w-3 sm:w-4 h-3 sm:h-4 shrink-0"></div>@@ -143,15 +116,11 @@ const PaywallComponent = (props: PaywallComponent) => {</span><span class="text-base text-ink/40">/mo</span></div>- <div class="text-sm text-ink/60">- <span class="font-semibold text-ink">{plan.calls}</span> AI- tool calls- </div>- <Show when={plan.popular}>- <span class="text-[10px] font-semibold text-accent">- Most popular- </span>- </Show>+ <ul class="text-sm text-ink/60 flex flex-col gap-1 list-disc list-inside">+ <For each={plan.features}>+ {(feature) => <li>{feature}</li>}+ </For>+ </ul></div></button>)}diff --git a/js/app/packages/app/component/paywall/PlanGrid.tsx b/js/app/packages/app/component/paywall/PlanGrid.tsxnew file mode 100644index 0000000000..ebbb2c2c0c--- /dev/null+++ b/js/app/packages/app/component/paywall/PlanGrid.tsx@@ -0,0 +1,59 @@+import { For, type JSX } from 'solid-js';+import { isTouchDevice } from '@core/mobile/isTouchDevice';+import { PLANS, type Plan, type PlanTier } from './plans';++interface PlanGridProps {+ /** The currently highlighted tier — shows accent border. */+ highlightedTier?: () => PlanTier | undefined;+ /** Render a footer (e.g. button) below the features for each plan card. */+ 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': isTouchDevice(),+ 'flex gap-4': !isTouchDevice(),+ }}+ >+ <For each={PLANS}>+ {(plan) => {+ const isHighlighted = () =>+ plan.highlighted || props.highlightedTier?.() === plan.tier;++ return (+ <div class="flex-1 flex flex-col">+ <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">+ <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}+ </span>+ <span class="text-base text-ink/40">/mo</span>+ </div>+ <ul class="text-sm text-ink/60 flex flex-col gap-1 list-disc list-inside">+ <For each={plan.features}>+ {(feature) => <li>{feature}</li>}+ </For>+ </ul>+ {props.footer?.(plan)}+ </div>+ </div>+ </div>+ );+ }}+ </For>+ </div>+ );+}diff --git a/js/app/packages/app/component/paywall/plans.ts b/js/app/packages/app/component/paywall/plans.tsnew file mode 100644index 0000000000..67cf710899--- /dev/null+++ b/js/app/packages/app/component/paywall/plans.ts@@ -0,0 +1,26 @@+export const PLANS = [+ {+ 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];