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(settings): new billing page and paywall view (#4293)

dev-rb60bcfa661d90
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index 342f7cac87..83aaf81121 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -1051,7 +1051,7 @@ export const AppSidebar = (props: AppSidebarProps) => {
}}
primaryAction={{
label: 'Upgrade',
- onClick: () => openSettingsTab('Account'),
+ onClick: () => openSettingsTab('Billing'),
}}
secondaryAction={{
label: 'Later',
diff --git a/js/app/packages/app/component/paywall/Paywall.tsx b/js/app/packages/app/component/paywall/Paywall.tsx
index 021fa5fb06..ea1ec5d2bb 100644
--- a/js/app/packages/app/component/paywall/Paywall.tsx
+++ b/js/app/packages/app/component/paywall/Paywall.tsx
@@ -67,7 +67,7 @@ export function Paywall() {
ref={paywallContentEl}
tabIndex={-1}
>
- <div class="overflow-y-auto p-6 sm:p-8">
+ <div class="overflow-y-auto">
<PaywallComponent cb={hidePaywall} errorKey={paywallKey()} />
</div>
</div>
diff --git a/js/app/packages/app/component/paywall/PaywallComponent.tsx b/js/app/packages/app/component/paywall/PaywallComponent.tsx
index 2e34569471..8b6ceb6501 100644
--- a/js/app/packages/app/component/paywall/PaywallComponent.tsx
+++ b/js/app/packages/app/component/paywall/PaywallComponent.tsx
@@ -1,16 +1,14 @@
import { useAnalytics } from '@app/component/analytics-context';
-import {
- PLAN_FEATURES,
- PLANS,
- type PlanTier,
-} from '@app/component/paywall/plans';
-import SubscriptionTier from '@app/component/paywall/SubscriptionTier';
import { useHasPaidAccess } from '@core/auth';
import { type PaywallKey, PaywallMessages } from '@core/constant/PaywallState';
-import IconX from '@phosphor/x.svg';
+import { useUserId } from '@core/context/user';
+import { plural } from '@core/util/string';
+import ArrowSquareOutIcon from '@phosphor/arrow-square-out.svg';
+import CheckIcon from '@phosphor/check.svg';
+import { useCurrentTeamQuery } from '@queries/team/teams';
import { stripeServiceClient } from '@service-stripe/client';
-import { Button, cn } from '@ui';
-import { createMemo, createSignal, For, Show } from 'solid-js';
+import { Button, Tooltip } from '@ui';
+import { createMemo, For, Show } from 'solid-js';
export interface PaywallProps {
cb: () => Promise<void> | void;
@@ -21,23 +19,48 @@ export interface PaywallProps {
hideCloseButton?: boolean;
}
+const PAYWALL_PREMIUM_FEATURES = [
+ 'All agents',
+ 'All models',
+ 'No watermark',
+ 'MCP access',
+ 'AI projections',
+ 'Multiple email inboxes',
+ 'Calls',
+ 'Teams',
+ '1 TB storage',
+];
+
+const PremiumFeatures = () => (
+ <ul class="grid grid-cols-1 gap-x-4 gap-y-3 text-sm text-ink-muted sm:grid-cols-3">
+ <For each={PAYWALL_PREMIUM_FEATURES}>
+ {(label) => (
+ <li class="flex items-center gap-2">
+ <CheckIcon class="size-3 text-success" />
+ <span class="text-ink-muted text-xs">{label}</span>
+ </li>
+ )}
+ </For>
+ </ul>
+);
+
const PaywallComponent = (props: PaywallProps) => {
const analytics = useAnalytics();
const hasPaid = useHasPaidAccess();
+ const userId = useUserId();
- const currentTier = createMemo<PlanTier>(() =>
- hasPaid() ? 'premium' : 'free'
- );
+ const team = useCurrentTeamQuery();
- // `userSelectedTier` is only set when the user explicitly clicks a plan card. Until
- // then the UI reflects `currentTier`. This avoids mirroring derived state into a signal
- // via `createEffect` and sidesteps the briefly-wrong-card window before permissions resolve.
- const [userSelectedTier, setUserSelectedTier] = createSignal<PlanTier | null>(
- null
- );
- const selectedTier = createMemo<PlanTier>(
- () => userSelectedTier() ?? currentTier()
- );
+ const teamRole = createMemo(() => {
+ const uid = userId();
+ const currentTeam = team.data;
+
+ if (!currentTeam) return;
+
+ return currentTeam.team.owner_id === uid ? 'owner' : 'member';
+ });
+
+ const upgradeDisabled = createMemo(() => teamRole() === 'member');
const handleCheckout = async () => {
try {
@@ -68,122 +91,111 @@ const PaywallComponent = (props: PaywallProps) => {
};
const handleContinue = () => {
- const tier = selectedTier();
- // Paid users go to the Stripe portal regardless of selection — that's where
- // they cancel (downgrade to free) or manage billing on premium.
+ if (upgradeDisabled()) return;
+
if (hasPaid()) {
manageSubscription();
return;
}
- if (tier === 'free') {
- props.handleGuest?.();
- return;
- }
handleCheckout();
};
- const ctaLabel = () => {
- if (hasPaid()) {
- return selectedTier() === 'free' ? 'Downgrade' : 'Manage Subscription';
- }
- if (selectedTier() === 'free') return 'Continue with Free';
- return 'Get Premium';
- };
+ const ctaLabel = () => (hasPaid() ? 'Manage Subscription' : 'Upgrade now');
+ const paywallMetadata = () =>
+ props.errorKey ? PaywallMessages[props.errorKey] : undefined;
return (
- <div class="relative space-y-2 w-full">
- <Show when={!props.hideCloseButton}>
- <button
- onClick={props.cb}
- class="absolute -top-2 -right-2 sm:-top-3 sm:-right-3 text-ink-extra-muted hover:text-ink transition-colors z-10"
- >
- <IconX class="size-5 sm:size-6" />
- </button>
- </Show>
- <Show when={!hasPaid()}>
- <div class="relative w-full text-center">
- <div class="space-y-6 sm:space-y-8">
- <div class="text-center">
- <h2 class="mb-2 font-semibold text-ink text-xl sm:text-2xl">
- Choose your plan
- </h2>
- <Show when={props.errorKey}>
- <p class="mb-4 text-failure-ink text-sm sm:text-base">
- {PaywallMessages[props.errorKey as PaywallKey]}
- </p>
- </Show>
+ <section class="relative flex w-full flex-col gap-6">
+ <div class="grid grid-cols-1 gap-6 sm:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)] p-6 sm:px-8 sm:pt-8 sm:pb-4">
+ <section class="flex flex-col gap-4">
+ <div class="flex flex-col gap-2">
+ <h2 class="text-2xl text-ink font-semibold">
+ Unlock Premium features
+ </h2>
+ <p class="text-sm text-ink-extra-muted">
+ {paywallMetadata()?.description ??
+ 'Upgrade your workspace with more AI power, team collaboration, and room to grow.'}
+ </p>
+ <Show when={paywallMetadata()?.learnMoreUrl}>
+ {(learnMoreUrl) => (
+ <a
+ class="mt-16 inline-flex items-center gap-1 self-start text-xs text-ink-extra-muted hover:text-accent"
+ href={learnMoreUrl()}
+ target="_blank"
+ rel="noopener"
+ >
+ Learn more about{' '}
+ {paywallMetadata()!.learnMoreSubject ?? 'Premium'}
+ <ArrowSquareOutIcon class="size-4" />
+ </a>
+ )}
+ </Show>
+ </div>
+ </section>
+
+ <section class="h-full flex flex-col gap-3">
+ <div class="flex flex-1 flex-col gap-4 rounded-lg bg-active p-4">
+ <div class="flex flex-col">
+ <h3 class="text-sm text-ink">Premium features</h3>
</div>
+ <PremiumFeatures />
</div>
+ </section>
+ </div>
+
+ <div class="border-t border-t-edge px-8 py-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
+ <div class="flex items-baseline gap-1.5 text-xs text-ink/60">
+ <span class="text-ink font-semibold text-xl leading-6">$40</span>
+ <span>per seat / per month</span>
+
+ <Show when={teamRole() === 'owner' && team.data}>
+ {(team) => (
+ <span class="text-ink-extra-muted text-xs">
+ • {team().members.length}{' '}
+ {plural('user', team().members.length)}
+ </span>
+ )}
+ </Show>
</div>
- </Show>
-
- <div class="w-full @container">
- <div class="gap-2 grid grid-cols-1 @[400px]:grid-cols-2">
- <For each={PLANS}>
- {(plan) => (
- <button
- onClick={() => setUserSelectedTier(plan.tier)}
- class={cn(
- selectedTier() === plan.tier
- ? 'border-accent bg-active'
- : 'border-edge hover:border-edge',
- 'p-4 sm:p-5 border flex flex-col transition-all relative text-left rounded-sm'
- )}
+ <div class="flex flex-col justify-end gap-2 sm:flex-row">
+ <Button
+ variant="ghost"
+ depth={3}
+ class="rounded-full sm:w-auto px-3 py-1.5"
+ onClick={props.cb}
+ >
+ Dismiss
+ </Button>
+ <Show
+ when={upgradeDisabled()}
+ fallback={
+ <Button
+ variant={hasPaid() ? 'base' : 'cta'}
+ class="rounded-full sm:w-auto px-3 py-1.5"
+ onClick={handleContinue}
>
- <div class="flex flex-col gap-3 w-full">
- <div class="flex justify-between items-start">
- <div class="flex items-center gap-2">
- <div class="font-semibold text-ink text-base sm:text-lg">
- {plan.name}
- </div>
- <Show when={currentTier() === plan.tier}>
- <span class="text-xs text-ink/60 px-1.5 py-0.5 border border-edge-muted rounded">
- Current
- </span>
- </Show>
- </div>
- <SubscriptionTier
- class="w-7 shrink-0"
- tier={plan.tier === 'premium' ? 'premium' : undefined}
- />
- </div>
- <div 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>
- </div>
- <div class="text-sm text-ink/60 flex flex-col gap-1">
- <For each={PLAN_FEATURES}>
- {(feature) => (
- <span>
- {feature.label}: {feature.values[plan.tier]}
- </span>
- )}
- </For>
- </div>
- </div>
- </button>
- )}
- </For>
+ {ctaLabel()}
+ </Button>
+ }
+ >
+ <Tooltip
+ label="Your subscription is managed by your team owner. Contact them to make changes."
+ placement="top"
+ >
+ <span>
+ <Button
+ variant={hasPaid() ? 'base' : 'cta'}
+ class="rounded-full sm:w-auto px-3 py-1.5"
+ disabled
+ >
+ {ctaLabel()}
+ </Button>
+ </span>
+ </Tooltip>
+ </Show>
</div>
</div>
-
- <div class="w-full">
- <Button
- onClick={handleContinue}
- variant="base"
- size="lg"
- depth={3}
- class="w-full"
- disabled={
- !hasPaid() && selectedTier() === 'free' && !props.handleGuest
- }
- >
- {ctaLabel()}
- </Button>
- </div>
- </div>
+ </section>
);
};
diff --git a/js/app/packages/app/component/settings/Account.tsx b/js/app/packages/app/component/settings/Account.tsx
index 0a887f6f08..6e1c2542a7 100644
--- a/js/app/packages/app/component/settings/Account.tsx
+++ b/js/app/packages/app/component/settings/Account.tsx
@@ -11,14 +11,12 @@ import {
blockNameToFileExtensions,
blockNameToMimeTypes,
} from '@core/constant/allBlocks';
-import { ShowFeatureFlag, useFeatureFlag } from '@app/lib/analytics/posthog';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
import {
DISABLE_AUTO_UPDATE_UI_FLAG,
ENABLE_AUTO_UPDATE_UI_OVERRIDE,
ENABLE_PROFILE_PICTURES,
- ENABLE_NEW_PRICING_OVERRIDE,
} from '@core/constant/featureFlags';
-import { useUserTeamsQuery } from '@queries/team';
import {
type ProfilePictureItem,
useProfilePictureUrl,
@@ -43,12 +41,6 @@ import {
Show,
Switch,
} from 'solid-js';
-import { usePermissions } from '@core/context/user';
-import { PERMISSION_IDS } from '@core/constant/permissions';
-import { useSettingsState } from '@core/constant/SettingsState';
-import PaywallComponent from '../paywall/PaywallComponent';
-import PaywallTeamOwnerView from '../paywall/PaywallTeamOwnerView';
-import UsersThreeIcon from '@phosphor/users-three.svg';
import {
type SupportedNotificationSettings,
useNotificationSettings,
@@ -305,8 +297,6 @@ export function Account() {
const email = useEmail();
const userId = useUserId();
const logout = useLogout();
- const permissions = usePermissions();
- const { toggleSettings } = useSettingsState();
const disableAutoUpdateUIFlag = useFeatureFlag(DISABLE_AUTO_UPDATE_UI_FLAG);
const autoUpdateUIEnabled = createMemo(
() => ENABLE_AUTO_UPDATE_UI_OVERRIDE ?? !disableAutoUpdateUIFlag().enabled
@@ -314,27 +304,6 @@ export function Account() {
const [showDeleteModal, setShowDeleteModal] = createSignal<boolean>(false);
const [showDeleteConfirmModal, setShowDeleteConfirmModal] = createSignal<boolean>(false);
- const userTeamsQuery = useUserTeamsQuery();
- const ownedTeam = createMemo(() => {
- const teams = userTeamsQuery.data;
- const uid = userId();
- if (!teams || !uid) return undefined;
- return teams.find((t) => t.owner_id === uid);
- });
- const isNonOwnerTeamMember = createMemo(() => {
- const teams = userTeamsQuery.data;
- const uid = userId();
- if (!teams || !uid) return false;
- // Only a "non-owner member" if they own no team at all but belong to one.
- const ownsAnyTeam = teams.some((t) => t.owner_id === uid);
- return !ownsAnyTeam && teams.some((t) => t.owner_id !== uid);
- });
-
- const newPricingFlag = useFeatureFlag('enable-new-pricing', {
- enabledOverride: ENABLE_NEW_PRICING_OVERRIDE,
- });
- const newPricingEnabled = () => newPricingFlag().enabled;
-
const userName = useUserName();
const [updatedFirstName, setUpdatedFirstName] = createSignal<
string | undefined
@@ -375,49 +344,10 @@ export function Account() {
<Panel.Header class="px-6">
<div class="flex items-center gap-2">
<div class="text-sm font-semibold">Account</div>
- <TeamSubscriptionPill show={isNonOwnerTeamMember()} />
</div>
</Panel.Header>
<Panel.Body scroll class="text-ink">
- <Show
- when={
- permissions()?.includes(
- PERMISSION_IDS.WRITE_STRIPE_SUBSCRIPTION
- ) &&
- // Team members get the header pill instead of a card here, so
- // skip this billing block rather than leaving it empty.
- !(newPricingEnabled() && isNonOwnerTeamMember())
- }
- >
- <div class="px-4 py-2 w-full border-b border-edge-muted">
- <ShowFeatureFlag
- key="enable-new-pricing"
- enabledOverride={ENABLE_NEW_PRICING_OVERRIDE}
- fallback={
- <PaywallComponent
- hideCloseButton
- cb={() => {}}
- handleGuest={() => toggleSettings()}
- />
- }
- >
- <Switch
- fallback={
- <PaywallComponent
- hideCloseButton
- cb={() => {}}
- handleGuest={() => toggleSettings()}
- />
- }
- >
- <Match when={ownedTeam()}>
- {(team) => <PaywallTeamOwnerView team={team()} />}
- </Match>
- </Switch>
- </ShowFeatureFlag>
- </div>
- </Show>
<div class="grid settings-row-dividers">
<Show when={ENABLE_PROFILE_PICTURES}>
<Show when={userId()} keyed>
@@ -566,33 +496,6 @@ function Row(props: { label: string; children?: any }) {
);
}
-/**
- * Team members can't manage their subscription (the owner does), so instead of
- * a full billing card we show a compact, informational pill next to the Account
- * header with the explanation in a hover tooltip. Gated to the new-pricing
- * rollout, matching where the team-member card used to appear.
- */
-function TeamSubscriptionPill(props: { show: boolean }) {
- return (
- <Show when={props.show}>
- <ShowFeatureFlag
- key="enable-new-pricing"
- enabledOverride={ENABLE_NEW_PRICING_OVERRIDE}
- >
- <Tooltip
- label="Your subscription is managed by your team owner. Contact them to make changes."
- placement="bottom"
- >
- <span class="inline-flex items-center gap-1.5 rounded-full border border-edge-muted px-2 py-0.5 text-xs font-medium text-ink-muted">
- <UsersThreeIcon class="size-3.5 shrink-0 text-accent" />
- Team Subscription
- </span>
- </Tooltip>
- </ShowFeatureFlag>
- </Show>
- );
-}
-
type SaveStatus = 'idle' | 'saving' | 'saved' | 'error';
function NameInput(props: {
diff --git a/js/app/packages/app/component/settings/Billing.tsx b/js/app/packages/app/component/settings/Billing.tsx
new file mode 100644
index 0000000000..afdcda4df3
--- /dev/null
+++ b/js/app/packages/app/component/settings/Billing.tsx
@@ -0,0 +1,200 @@
+import { useAnalytics } from '@app/component/analytics-context';
+import type { PlanTier } from '@app/component/paywall/plans';
+import { useHasPaidAccess } from '@core/auth';
+import CheckIcon from '@phosphor/check.svg';
+import ArrowSquareOutIcon from '@phosphor/arrow-square-out.svg';
+import { stripeServiceClient } from '@service-stripe/client';
+import { Button, Layer, Surface } from '@ui';
+import { createMemo, For, Match, Show, Switch } from 'solid-js';
+import { usePermissions, useUserId } from '@core/context/user';
+import { PERMISSION_IDS } from '@core/constant/permissions';
+import { useCurrentTeamQuery } from '@queries/team/teams';
+import { plural } from '@core/util/string';
+
+const BILLING_PLAN_FEATURES: Record<PlanTier, string[]> = {
+ free: ['Access to Haiku', '5 GB storage'],
+ premium: [
+ 'All agents',
+ 'All models',
+ 'No watermark',
+ 'MCP access',
+ 'AI projections',
+ 'Multiple email inboxes',
+ 'Calls',
+ 'Teams',
+ '1 TB storage',
+ ],
+};
+
+const PlanFeatures = (props: { tier: PlanTier }) => (
+ <For each={BILLING_PLAN_FEATURES[props.tier]}>
+ {(label) => (
+ <li class="flex items-center gap-2">
+ <CheckIcon class="size-3 text-success" />
+ <span class="text-ink-muted text-xs">{label}</span>
+ </li>
+ )}
+ </For>
+);
+
+export const Billing = () => {
+ const permissions = usePermissions();
+ const analytics = useAnalytics();
+ const hasPaid = useHasPaidAccess();
+
+ const userId = useUserId();
+
+ const team = useCurrentTeamQuery();
+
+ const canManageSubscription = createMemo(() => {
+ return permissions()?.includes(PERMISSION_IDS.WRITE_STRIPE_SUBSCRIPTION);
+ });
+
+ const userTeam = createMemo(() => {
+ const currentTeam = team.data;
+ const uid = userId();
+ if (!currentTeam || !uid) return;
+
+ return currentTeam.team;
+ });
+
+ const teamRole = createMemo(() => {
+ const uid = userId();
+ const team = userTeam();
+
+ if (!team) return;
+
+ return team.owner_id === uid ? 'owner' : 'member';
+ });
+
+ const handleCheckout = async () => {
+ try {
+ const url = await stripeServiceClient.createCheckoutSessionV2({});
+ analytics.track('subscription_start', {
+ type: 'premium',
+ });
+ window.location.href = url;
+ } catch (error) {
+ console.error(error);
+ }
+ };
+
+ const handleManage = async () => {
+ try {
+ const url = await stripeServiceClient.createPortalSession();
+ window.location.href = url;
+ } catch (error) {
+ console.error(error);
+ }
+ };
+
+ return (
+ <section class="p-8 flex flex-col gap-8">
+ <header class="flex flex-col">
+ <h1 class="text-2xl text-ink font-semibold">Billing</h1>
+ <p class="text-ink-extra-muted text-sm">
+ For questions about billing,{' '}
+ <a
+ class="text-ink inline-flex items-center hover:text-accent"
+ href="https://cal.com/team/macro/macro-demo-call"
+ target="_blank"
+ rel="noopener"
+ >
+ contact us
+ <ArrowSquareOutIcon class="size-4 inline mx-1" />
+ </a>
+ </p>
+ </header>
+
+ <Surface class="flex flex-col rounded-lg p-4" depth={2}>
+ <section class="flex flex-col gap-4">
+ <header class="flex items-center gap-2">
+ <div class="flex flex-col gap-1">
+ <div class="flex items-center gap-2">
+ <h1 class="text-lg font-medium text-ink">
+ <Show when={!hasPaid()} fallback={'Premium plan'}>
+ Free plan
+ </Show>
+ </h1>
+
+ <Layer depth={3}>
+ <span class="text-xs text-ink-muted px-1.5 py-0.25 border border-edge-muted rounded-md bg-active">
+ Current
+ </span>
+ </Layer>
+ </div>
+ <Switch>
+ <Match when={teamRole() === 'member'}>
+ <p class="text-ink-extra-muted text-xs">
+ Your subscription is managed by your team owner. Contact
+ them to make changes.
+ </p>
+ </Match>
+ <Match when={hasPaid() && teamRole() === 'owner' && team.data}>
+ {(team) => (
+ <p class="text-ink-extra-muted text-xs">
+ {team().members.length}{' '}
+ {plural('user', team().members.length)} • $40 per seat/per
+ month
+ </p>
+ )}
+ </Match>
+ </Switch>
+ </div>
+
+ <Show
+ when={
+ canManageSubscription() &&
+ hasPaid() &&
+ (!teamRole() || teamRole() === 'owner')
+ }
+ >
+ <Button
+ class="ml-auto rounded-full bg-active"
+ size="sm"
+ depth={2}
+ variant="base"
+ onClick={handleManage}
+ >
+ Manage
+ </Button>
+ </Show>
+ </header>
+ <ul class="border-t border-t-edge-muted pt-4 flex flex-wrap gap-4 text-sm text-ink-muted">
+ <PlanFeatures tier={hasPaid() ? 'premium' : 'free'} />
+ </ul>
+ </section>
+ </Surface>
+ <Show
+ when={
+ !hasPaid() &&
+ canManageSubscription() &&
+ (!teamRole() || teamRole() === 'owner')
+ }
+ >
+ <Surface class="flex flex-col rounded-lg p-4" depth={2}>
+ <section class="flex flex-col gap-4">
+ <header class="flex items-center gap-2">
+ <div class="flex flex-col">
+ <h1 class="text-lg font-medium text-ink">Premium</h1>
+ <p class="text-ink-extra-muted text-xs">$40 per seat / month</p>
+ </div>
+
+ <Button
+ class="ml-auto rounded-full py-1.5 px-3"
+ depth={2}
+ variant="cta"
+ onClick={handleCheckout}
+ >
+ Upgrade now
+ </Button>
+ </header>
+ <ul class="border-t border-t-edge-muted pt-4 flex flex-wrap gap-4 text-sm text-ink-muted">
+ <PlanFeatures tier="premium" />
+ </ul>
+ </section>
+ </Surface>
+ </Show>
+ </section>
+ );
+};
diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsx
index 460ae6a209..885c0c1819 100644
--- a/js/app/packages/app/component/settings/Settings.tsx
+++ b/js/app/packages/app/component/settings/Settings.tsx
@@ -26,6 +26,7 @@ import {
SplitHeaderLeft,
SplitHeaderRight,
} from '../split-layout/components/SplitHeader';
+import { Billing } from '@app/component/settings/Billing';
/** Where the settings panel is mounted, which determines its header chrome. */
export type SettingsVariant = 'split' | 'modal';
@@ -263,6 +264,11 @@ export function SettingsPanel(props: SettingsPanelProps) {
<Account />
</Suspense>
</Show>
+ <Show when={isCurrentTab('Billing')}>
+ <Suspense>
+ <Billing />
+ </Suspense>
+ </Show>
<Show when={isCurrentTab('Appearance')}>
<Appearance />
</Show>
diff --git a/js/app/packages/app/component/settings/Team.tsx b/js/app/packages/app/component/settings/Team.tsx
index c436236407..c9e848e4b1 100644
--- a/js/app/packages/app/component/settings/Team.tsx
+++ b/js/app/packages/app/component/settings/Team.tsx
@@ -55,7 +55,7 @@ import type { TeamMember } from '@service-auth/generated/schemas/teamMember';
import type { TeamInviteDetails } from '@service-auth/generated/schemas/teamInviteDetails';
import { formatRelativeTimestamp } from '@entity';
import { useHasPaidAccess } from '@core/auth/license';
-import { usePaywallState } from '@core/constant/PaywallState';
+import { PaywallKey, usePaywallState } from '@core/constant/PaywallState';
import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { z } from 'zod';
import { getTeamSlugError, normalizeTeamSlugInput } from './teamSlug';
@@ -729,7 +729,7 @@ function EmptyTeamState() {
<Button
variant="active"
class="rounded-xs"
- onClick={() => showPaywall()}
+ onClick={() => showPaywall(PaywallKey.TEAMS)}
>
Upgrade
</Button>
diff --git a/js/app/packages/core/constant/PaywallState.tsx b/js/app/packages/core/constant/PaywallState.tsx
index 53e1103025..bd89a007b0 100644
--- a/js/app/packages/core/constant/PaywallState.tsx
+++ b/js/app/packages/core/constant/PaywallState.tsx
@@ -13,25 +13,84 @@ export enum PaywallKey {
SAVED_PROMPT = 'SAVED_PROMPT',
REMOVE_SIGNATURE = 'REMOVE_SIGNATURE',
MULTI_INBOX = 'MULTI_INBOX',
+ TEAMS = 'TEAMS',
}
-export const PaywallMessages: Record<PaywallKey, string> = {
- [PaywallKey.PROJECT_LIMIT]:
- 'You have reached the folder limit of your current plan. Please upgrade to continue.',
- [PaywallKey.FILE_LIMIT]:
- 'You have reached the file limit of your current plan. Please upgrade to continue.',
- [PaywallKey.CHAT_LIMIT]:
- 'You have reached the chat limit of your current plan. Please upgrade to continue.',
- [PaywallKey.IMAGE_LIMIT]: `You've reached your ${DAILY_LIMIT} daily limit for AI image processing. Please upgrade to continue.`,
- [PaywallKey.MODEL_LIMIT]: `You have reached the ${DAILY_LIMIT} daily uses of smart models. Please upgrade to continue.`,
- [PaywallKey.O1_LIMIT]: 'Upgrade your plan to use smart models.',
- [PaywallKey.CANVAS_CLIKED]:
- 'Upgrade your plan to have AI generate canvases (diagrams, whiteboards, drawings).',
- [PaywallKey.SAVED_PROMPT]:
- 'Saved prompts are a paid feature. Please upgrade to continue.',
- [PaywallKey.REMOVE_SIGNATURE]:
- 'Upgrade your plan to remove the Macro signature.',
- [PaywallKey.MULTI_INBOX]: 'Upgrade your plan to connect more than one inbox.',
+export type PaywallMessageMetadata = {
+ title: string;
+ description: string;
+ learnMoreUrl?: string;
+ learnMoreSubject?: string;
+};
+
+export const PaywallMessages: Record<PaywallKey, PaywallMessageMetadata> = {
+ [PaywallKey.PROJECT_LIMIT]: {
+ title: 'Folder limit reached',
+ description:
+ 'Upgrade to create more folders and keep organizing your workspace.',
+ learnMoreUrl: 'https://docs.macro.com/product/folders',
+ learnMoreSubject: 'folders',
+ },
+ [PaywallKey.FILE_LIMIT]: {
+ title: 'File limit reached',
+ description: 'Upgrade for more storage and room for all of your documents.',
+ },
+ [PaywallKey.CHAT_LIMIT]: {
+ title: 'Chat limit reached',
+ description: 'Upgrade to keep creating agent chats with premium AI access.',
+ learnMoreUrl: 'https://docs.macro.com/product/agents',
+ learnMoreSubject: 'agents',
+ },
+ [PaywallKey.IMAGE_LIMIT]: {
+ title: 'Image processing limit reached',
+ description: `You’ve used ${DAILY_LIMIT} AI image processing requests today. Upgrade for higher limits.`,
+ learnMoreUrl: 'https://docs.macro.com/product/agents',
+ learnMoreSubject: 'agents',
+ },
+ [PaywallKey.MODEL_LIMIT]: {
+ title: 'Smart model limit reached',
+ description: `You’ve used ${DAILY_LIMIT} smart model requests today. Upgrade for access to all models.`,
+ learnMoreUrl: 'https://docs.macro.com/product/agents',
+ learnMoreSubject: 'agents',
+ },
+ [PaywallKey.O1_LIMIT]: {
+ title: 'Smart models are premium',
+ description: 'Upgrade to use Macro’s most capable AI models.',
+ learnMoreUrl: 'https://docs.macro.com/product/agents',
+ learnMoreSubject: 'agents',
+ },
+ [PaywallKey.CANVAS_CLIKED]: {
+ title: 'AI canvases are premium',
+ description:
+ 'Upgrade to generate diagrams, whiteboards, and visual drafts with AI.',
+ learnMoreUrl: 'https://docs.macro.com/product/canvas',
+ learnMoreSubject: 'canvases',
+ },
+ [PaywallKey.SAVED_PROMPT]: {
+ title: 'Saved prompts are premium',
+ description: 'Upgrade to save reusable prompts for faster workflows.',
+ learnMoreUrl: 'https://docs.macro.com/product/snippets',
+ learnMoreSubject: 'saved prompts',
+ },
+ [PaywallKey.REMOVE_SIGNATURE]: {
+ title: 'Remove the Macro signature',
+ description: 'Upgrade to send emails without the Macro signature.',
+ learnMoreUrl: 'https://docs.macro.com/product/email',
+ learnMoreSubject: 'email',
+ },
+ [PaywallKey.MULTI_INBOX]: {
+ title: 'Connect more inboxes',
+ description: 'Upgrade to manage multiple email inboxes from one workspace.',
+ learnMoreUrl: 'https://docs.macro.com/product/inbox',
+ learnMoreSubject: 'multiple inboxes',
+ },
+ [PaywallKey.TEAMS]: {
+ title: 'Collaborate with your team',
+ description:
+ 'Upgrade to create a team, invite members, and manage access together.',
+ learnMoreUrl: 'https://docs.macro.com/account/teams',
+ learnMoreSubject: 'teams',
+ },
};
const [paywallOpen, setPaywallOpen] = createSignal(false);
diff --git a/js/app/packages/core/constant/SettingsState.tsx b/js/app/packages/core/constant/SettingsState.tsx
index ba13fd71c7..266b7d0cc8 100644
--- a/js/app/packages/core/constant/SettingsState.tsx
+++ b/js/app/packages/core/constant/SettingsState.tsx
@@ -7,6 +7,7 @@ import { createMemo, createSignal } from 'solid-js';
export type SettingsTab =
| 'Account'
+ | 'Billing'
| 'Subscription'
| 'Organization'
| 'Appearance'
diff --git a/js/app/packages/core/constant/settingsTabsConfig.tsx b/js/app/packages/core/constant/settingsTabsConfig.tsx
index 63d0c64c33..6277f59b60 100644
--- a/js/app/packages/core/constant/settingsTabsConfig.tsx
+++ b/js/app/packages/core/constant/settingsTabsConfig.tsx
@@ -1,5 +1,6 @@
import { useFeatureFlag } from '@app/lib/analytics/posthog';
import BugIcon from '@phosphor/bug.svg';
+import CreditCardIcon from '@phosphor/credit-card.svg';
import DeviceMobileIcon from '@phosphor/device-mobile-speaker.svg';
import EnvelopeIcon from '@phosphor/envelope.svg';
import GithubLogoIcon from '@phosphor/github-logo.svg';
@@ -45,6 +46,7 @@ export const SETTINGS_TAB_GROUPS: SettingsTabGroup[] = [
label: 'General',
items: [
{ tab: 'Account', label: 'Account', icon: UserIconPhosphor },
+ { tab: 'Billing', label: 'Billing', icon: CreditCardIcon },
{ tab: 'Appearance', label: 'Appearance', icon: PaintBucketIcon },
{ tab: 'Mobile App', label: 'Mobile App', icon: DeviceMobileIcon },
{ tab: 'Shortcuts', label: 'Shortcuts', icon: KeyboardIcon },
@@ -94,6 +96,7 @@ export const useSettingsTabAvailable = () => {
switch (tab) {
case 'Appearance':
case 'Account':
+ case 'Billing':
return true;
case 'Team':
return teamsFlag().enabled;