From f2888317b41255e6d47bbc4d332e201cb02ebbc7 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 14 Nov 2026 16:37:59 -0800 Subject: [PATCH] feat(cloud): plans dialog before the web console; billing serves each plan's card copy "Plan & billing", "Upgrade to Orca Cloud", "Choose plan" and every "Compare plans" now open an in-app plans dialog first: the team's plan and status (trial hours left, active with hours and seats, payment failed, or no plan with the trial billing offers), then billing's plan cards (Team with a monthly/annual toggle, Enterprise with contact sales). "Continue in browser" opens the console's billing page through the existing sign-in ticket. Members see the same plan info with "Ask a team admin to upgrade" (Plan & billing is back in their account menu, read-only). Read-only: no checkout, usage history or admin settings return to the desktop. Everything shown is billing's: names, Stripe prices, seat pricing, feature bullets and trial terms from GET /v1/plans, now also each plan's tagline, feature-list lead and button label (new optional catalog `marketing`, unversioned copy, plus `omitFeatures` so Enterprise stops advertising egress controls). Main's lenient parse keeps a newer or older service safe; without the catalog the entitlement's offers stand in, and with neither the dialog says plans didn't load and still offers the console. While billing loads the title is neutral, so a paying team never sees an upsell flash. Settings > Account's billing row opens the dialog ("View plans"); "Update payment method" still goes straight to the console. --- cloud/apps/billing/catalog/catalog.json | 13 + cloud/apps/billing/src/catalog.ts | 20 +- cloud/apps/billing/src/plans-api.ts | 12 +- cloud/apps/billing/test/plans-api.test.ts | 10 + src/main/billing/plan-catalog-schema.test.ts | 22 +- src/main/billing/plan-catalog-schema.ts | 21 ++ src/renderer/src/App.tsx | 2 + .../billing/AccountMenuTrialRow.tsx | 4 +- .../components/billing/plans/PlanCards.tsx | 337 ++++++++++++++++++ .../billing/plans/PlansCurrentPlan.tsx | 136 +++++++ .../billing/plans/PlansDialogHost.tsx | 45 +++ .../billing/plans/PlansDialogView.fixture.tsx | 221 ++++++++++++ .../billing/plans/PlansDialogView.tsx | 269 ++++++++++++++ .../billing/plans/plans-dialog-store.ts | 30 ++ .../components/billing/plans/plans-model.ts | 166 +++++++++ .../components/billing/plans/plans-pricing.ts | 40 +++ .../register-plan-billing-menu-item.test.ts | 11 +- .../register-plan-billing-menu-item.ts | 29 +- .../orca-cloud-run-target-access.ts | 4 +- .../run-on/OrcaCloudTrialUsedUpNotice.tsx | 9 +- .../orca-cloud/cloud-workspace-actions.ts | 4 +- .../orca-cloud/OrcaCloudConsoleLinks.tsx | 45 ++- .../account-menu/account-menu-items.ts | 3 + .../VmBuildBillingBlocker.tsx | 4 +- .../worktree-creation/VmBuildSheet.tsx | 4 +- .../vm-build-failure-toast.ts | 4 +- .../src/i18n/en-runtime-required.json | 11 + src/renderer/src/i18n/locales/en.json | 49 ++- .../src/lib/orca-cloud-session-events.ts | 4 +- src/shared/orca-billing-plans.ts | 12 + 30 files changed, 1478 insertions(+), 63 deletions(-) create mode 100644 src/renderer/src/components/billing/plans/PlanCards.tsx create mode 100644 src/renderer/src/components/billing/plans/PlansCurrentPlan.tsx create mode 100644 src/renderer/src/components/billing/plans/PlansDialogHost.tsx create mode 100644 src/renderer/src/components/billing/plans/PlansDialogView.fixture.tsx create mode 100644 src/renderer/src/components/billing/plans/PlansDialogView.tsx create mode 100644 src/renderer/src/components/billing/plans/plans-dialog-store.ts create mode 100644 src/renderer/src/components/billing/plans/plans-model.ts create mode 100644 src/renderer/src/components/billing/plans/plans-pricing.ts diff --git a/cloud/apps/billing/catalog/catalog.json b/cloud/apps/billing/catalog/catalog.json index a4d157c622d..07f319870ab 100644 --- a/cloud/apps/billing/catalog/catalog.json +++ b/cloud/apps/billing/catalog/catalog.json @@ -10,6 +10,10 @@ "public": true, "currentVersion": 2, "supportUrl": "https://orca.dev/enterprise", + "marketing": { + "tagline": "Hosted sandboxes for your whole team, billed per seat", + "ctaLabel": "Continue in browser" + }, "stripe": { "seatLookupKeys": { "month": "orca_team_seat_monthly", "year": "orca_team_seat_annual" }, "overageLookupKey": "orca_sandbox_overage_per_minute" @@ -76,6 +80,12 @@ "currentVersion": 2, "contactUrl": "https://orca.dev/enterprise", "priceLabel": "Custom", + "marketing": { + "tagline": "Your cloud, your identity provider, your terms", + "featuresLead": "Everything in Team, plus:", + "ctaLabel": "Contact sales", + "omitFeatures": ["egress_controls"] + }, "versions": [ { "version": 1, @@ -116,6 +126,9 @@ "sort": 0, "public": true, "currentVersion": 1, + "marketing": { + "tagline": "Try Orca Cloud with your team before you pick a plan" + }, "versions": [ { "version": 1, diff --git a/cloud/apps/billing/src/catalog.ts b/cloud/apps/billing/src/catalog.ts index e4543eadbef..e88334b2c1c 100644 --- a/cloud/apps/billing/src/catalog.ts +++ b/cloud/apps/billing/src/catalog.ts @@ -50,6 +50,21 @@ const VersionSchema = z }) .strict() +// How clients present the plan (desktop plans dialog, console): copy only, never terms. Not +// versioned: changing it never changes what anyone bought. +const MarketingSchema = z + .object({ + tagline: z.string().min(1).max(140).optional(), + // Heading over the feature list, e.g. "Everything in Team, plus:". + featuresLead: z.string().min(1).max(60).optional(), + // The plan card's button, e.g. "Continue in browser", "Contact sales". + ctaLabel: z.string().min(1).max(40).optional(), + // Features a version lists that clients should not advertise yet (not offered to teams). + omitFeatures: z.array(z.string().regex(/^[a-z][a-z0-9_]{0,59}$/)).max(20).optional() + }) + .strict() +export type PlanMarketing = z.infer + const PlanSchema = z .object({ id: PlanIdSchema, @@ -73,6 +88,7 @@ const PlanSchema = z .regex(/^(https:\/\/[^\s]+|mailto:[^\s@]+@[^\s@]+)$/) .optional(), priceLabel: z.string().max(40).optional(), + marketing: MarketingSchema.optional(), versions: z.array(VersionSchema).min(1) }) .strict() @@ -91,6 +107,7 @@ export type PlanConfig = { contactUrl?: string supportUrl?: string priceLabel?: string + marketing?: PlanMarketing } export type CatalogVersion = { @@ -206,7 +223,8 @@ export async function catalogStatements(file: CatalogFile, applied: readonly App ...(plan.stripe ? { stripe: plan.stripe } : {}), ...(plan.contactUrl ? { contactUrl: plan.contactUrl } : {}), ...(plan.supportUrl ? { supportUrl: plan.supportUrl } : {}), - ...(plan.priceLabel ? { priceLabel: plan.priceLabel } : {}) + ...(plan.priceLabel ? { priceLabel: plan.priceLabel } : {}), + ...(plan.marketing ? { marketing: plan.marketing } : {}) } statements.push({ sql: `INSERT INTO plans (plan_id, kind, display_name, sort, public, current_version, config_json, updated_at) diff --git a/cloud/apps/billing/src/plans-api.ts b/cloud/apps/billing/src/plans-api.ts index e7546730dd0..73476dd402e 100644 --- a/cloud/apps/billing/src/plans-api.ts +++ b/cloud/apps/billing/src/plans-api.ts @@ -72,6 +72,14 @@ export async function offersFor(env: Env, now: number) { return catalogOffers(await loadCatalog(env.BILLING_DB, now), planCatalog(env).team.idleSleepMinutes) } +function marketingView(plan: CatalogPlan) { + const marketing = plan.config.marketing + if (!marketing) { + return null + } + return { tagline: marketing.tagline ?? null, featuresLead: marketing.featuresLead ?? null, ctaLabel: marketing.ctaLabel ?? null } +} + /** GET /v1/plans: the public catalog. Prices only ever come from Stripe (no price, no checkout). */ export function plansView(catalog: Catalog) { const plans = [...catalog.plans.values()] @@ -85,7 +93,9 @@ export function plansView(catalog: Catalog) { name: plan.name, version: plan.currentVersion, entitlements: version.entitlements, - features: version.features, + features: version.features.filter((feature) => !plan.config.marketing?.omitFeatures?.includes(feature.id)), + // Additive: presentation copy (tagline, feature-list lead, button label), or null. + marketing: marketingView(plan), // "Contact us" for this plan (https: or mailto:); clients fall back to Enterprise's contact. supportUrl: plan.config.supportUrl ?? null } diff --git a/cloud/apps/billing/test/plans-api.test.ts b/cloud/apps/billing/test/plans-api.test.ts index 80cf4abaff1..afc9f921110 100644 --- a/cloud/apps/billing/test/plans-api.test.ts +++ b/cloud/apps/billing/test/plans-api.test.ts @@ -57,6 +57,16 @@ describe('GET /v1/plans', () => { expect(JSON.stringify(body)).not.toContain('price_') }) + it('serves each plan\'s presentation copy and leaves out the features it omits', async () => { + const h = await createHarness() + const body = (await h.call('GET', '/v1/plans')).body + const plan = (id: string) => body.plans.find((entry: { id: string }) => entry.id === id) + expect(plan('team').marketing).toEqual({ tagline: 'Hosted sandboxes for your whole team, billed per seat', featuresLead: null, ctaLabel: 'Continue in browser' }) + expect(plan('enterprise').marketing).toMatchObject({ featuresLead: 'Everything in Team, plus:', ctaLabel: 'Contact sales' }) + expect(plan('enterprise').features.map((feature: { id: string }) => feature.id)).not.toContain('egress_controls') + expect(plan('enterprise').marketing).not.toHaveProperty('omitFeatures') + }) + it('answers 304 to a matching ETag, and the ETag changes when a Stripe price changes', async () => { const h = await createHarness() const first = await h.call('GET', '/v1/plans') diff --git a/src/main/billing/plan-catalog-schema.test.ts b/src/main/billing/plan-catalog-schema.test.ts index 6196aa1da28..1f9d7f815f0 100644 --- a/src/main/billing/plan-catalog-schema.test.ts +++ b/src/main/billing/plan-catalog-schema.test.ts @@ -24,7 +24,8 @@ const team = { }, seats: { min: 1, max: 500 }, warnAtPercent: [75, 90, 100], - checkout: { available: true, intervals: ['month', 'year'] } + checkout: { available: true, intervals: ['month', 'year'] }, + marketing: { tagline: 'For your team', featuresLead: null, ctaLabel: 'Continue in browser' } } const enterprise = { id: 'enterprise', @@ -56,7 +57,8 @@ describe('parsePlanCatalog', () => { seats: { min: 1, max: 500 }, includedHoursPerSeat: 60, checkoutAvailable: true, - supportUrl: null + supportUrl: null, + marketing: { tagline: 'For your team', featuresLead: null, ctaLabel: 'Continue in browser' } }) expect(catalog?.plans[1]).toEqual({ kind: 'contact_sales', @@ -66,7 +68,8 @@ describe('parsePlanCatalog', () => { features: enterprise.features, contactUrl: 'https://orca.dev/enterprise', priceLabel: 'Custom', - supportUrl: null + supportUrl: null, + marketing: null }) }) @@ -97,6 +100,19 @@ describe('parsePlanCatalog', () => { expect(catalog?.plans[1]?.kind).toBe('free') }) + it('drops copy that is too long or not text, keeping the rest of the plan', () => { + const catalog = parsePlanCatalog({ + schemaVersion: 1, + catalogVersion: 'c_3', + plans: [{ ...team, marketing: { tagline: 'x'.repeat(141), ctaLabel: 7, featuresLead: ' ' } }] + }) + expect(catalog?.plans[0]?.marketing).toEqual({ + tagline: null, + featuresLead: null, + ctaLabel: null + }) + }) + it('never offers checkout without a price, and refuses a non-v1 body', () => { const catalog = parsePlanCatalog({ schemaVersion: 1, diff --git a/src/main/billing/plan-catalog-schema.ts b/src/main/billing/plan-catalog-schema.ts index 342152c85f9..f56e06addd2 100644 --- a/src/main/billing/plan-catalog-schema.ts +++ b/src/main/billing/plan-catalog-schema.ts @@ -22,6 +22,14 @@ const Feature = z.object({ text: z.string().min(1).max(200) }) +const Copy = (max: number) => z.string().trim().min(1).max(max).nullable().catch(null).optional() + +const Marketing = z + .object({ tagline: Copy(140), featuresLead: Copy(60), ctaLabel: Copy(40) }) + .nullable() + .catch(null) + .optional() + const Price = z.object({ interval: z.enum(ORCA_BILLING_INTERVALS), unitAmountCents: z.number().int().nonnegative(), @@ -35,6 +43,7 @@ const Base = z.object({ version: z.number().int().nonnegative().catch(0), features: z.array(z.unknown()).max(100).catch([]), entitlements: z.record(z.string(), z.unknown()).catch({}).optional(), + marketing: Marketing, // "Contact us" for this plan. https only: the desktop opens links through shell:openUrl, which // refuses other schemes (a mailto: from billing falls back to the Enterprise contact). supportUrl: z.string().url().startsWith('https://').max(500).nullable().catch(null).optional() @@ -71,6 +80,17 @@ function features(raw: unknown[]): OrcaPlanFeature[] { }) } +function marketing(raw: z.infer): OrcaPlanCatalogPlan['marketing'] { + if (!raw) { + return null + } + return { + tagline: raw.tagline ?? null, + featuresLead: raw.featuresLead ?? null, + ctaLabel: raw.ctaLabel ?? null + } +} + function prices(raw: unknown[]): OrcaPlanPrice[] { const seen = new Set() return raw.flatMap((entry) => { @@ -102,6 +122,7 @@ function plan(raw: unknown): OrcaPlanCatalogPlan | null { name: base.data.name, version: base.data.version, features: features(base.data.features), + marketing: marketing(base.data.marketing), supportUrl: base.data.supportUrl ?? null } if (base.data.kind === 'self_serve') { diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 2e189cf451f..80384e5a9a5 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -5,6 +5,7 @@ import { TooltipProvider } from '@/components/ui/tooltip' import { ConfirmationDialogProvider } from './components/confirmation-dialog' import { BrowserWebAuthnAccountDialog } from './components/browser-webauthn-account-dialog' import { BrowserExtensionInstallDialog } from './components/browser-extension-install-dialog' +import { PlansDialogHost } from './components/billing/plans/PlansDialogHost' import { CloudMoveToComputerDialogMount } from './components/orca-cloud/CloudMoveToComputerDialogMount' import { CloudPrimaryDeleteDialogMount } from './components/orca-cloud/CloudPrimaryDeleteDialog' import { CloudSecretsAskDialogHost } from './components/cloud-secrets-ask/CloudSecretsMissingNotice' @@ -127,6 +128,7 @@ function App(): React.JSX.Element { /> + diff --git a/src/renderer/src/components/billing/AccountMenuTrialRow.tsx b/src/renderer/src/components/billing/AccountMenuTrialRow.tsx index 2cdfcc9e83f..d4c5290c482 100644 --- a/src/renderer/src/components/billing/AccountMenuTrialRow.tsx +++ b/src/renderer/src/components/billing/AccountMenuTrialRow.tsx @@ -11,7 +11,7 @@ import { useTranslate } from '@/i18n/use-translate' import { cn } from '@/lib/class-names' import type { OrcaBillingStatusResult } from '../../../../shared/orca-billing' import { accountMenuTrialRow } from './plan-billing-usage-copy' -import { openCloudConsole } from '@/lib/orca-cloud/open-cloud-console' +import { openPlansDialog } from './plans/plans-dialog-store' export function AccountMenuTrialRow({ result @@ -35,7 +35,7 @@ export function AccountMenuTrialRow({ {row.canChoosePlan ? ( void openCloudConsole('billing')} + onSelect={() => openPlansDialog()} aria-label={t('auto.components.billing.trialRowChoosePlan', '{{trial}}. Choose plan', { trial: row.label })} diff --git a/src/renderer/src/components/billing/plans/PlanCards.tsx b/src/renderer/src/components/billing/plans/PlanCards.tsx new file mode 100644 index 00000000000..36e9f393991 --- /dev/null +++ b/src/renderer/src/components/billing/plans/PlanCards.tsx @@ -0,0 +1,337 @@ +// The plans dialog's cards: Team (per-seat prices, monthly or annual) and Enterprise (contact +// sales). Names, prices, bullets, taglines and button labels are billing's catalog; the cards only +// lay them out. Read-only: choosing seats and paying happen in the web console. +import type { ReactNode } from 'react' +import { Building2, Check, ExternalLink, Lock, Users } from 'lucide-react' +import { Badge } from '@/components/ui/badge' +import { Button } from '@/components/ui/button' +import { SettingsSegmentedControl } from '@/components/settings/form-controls/SettingsSegmentedControl' +import { useIntlLocale, useTranslate } from '@/i18n/use-translate' +import type { OrcaBillingInterval } from '../../../../../shared/orca-billing' +import { formatCents } from '../../../../../shared/orca-billing-usage-alerts' +import type { EnterprisePlanModel, TeamPlanModel } from './plans-model' +import { perSeatMonthlyCents } from './plans-pricing' + +function PlanCardShell({ + id, + title, + badge, + tagline, + price, + priceNote, + featuresLead, + features, + footer +}: { + id: string + title: ReactNode + badge?: ReactNode + tagline: string | null + price: ReactNode + priceNote: ReactNode + featuresLead?: string | null + features: string[] + footer: ReactNode +}): React.JSX.Element { + return ( +
+
+
+

+ {title} +

+ {badge} +
+ {tagline ?

{tagline}

: null} +
+
+ {price} +

{priceNote}

+
+
+ {featuresLead && features.length > 0 ? ( +

{featuresLead}

+ ) : null} +
    + {features.map((feature) => ( +
  • + + {feature} +
  • + ))} +
+
+ {/* Same footer height on both cards keeps their dividers and buttons level. */} +
+ {footer} +
+
+ ) +} + +export function PlansIntervalToggle({ + value, + savingsPercent, + onChange +}: { + value: OrcaBillingInterval + savingsPercent: number | null + onChange: (interval: OrcaBillingInterval) => void +}): React.JSX.Element { + const t = useTranslate() + const annual = t('auto.components.billing.plans.annual', 'Annual') + const save = + savingsPercent === null + ? null + : t('auto.components.billing.plans.savePercent', 'Save {{value0}}%', { + value0: String(savingsPercent) + }) + return ( +
+ + value={value} + onChange={onChange} + size="sm" + equalWidth + ariaLabel={t('auto.components.billing.plans.billingPeriod', 'Billing period')} + options={[ + { value: 'month', label: t('auto.components.billing.plans.monthly', 'Monthly') }, + { + value: 'year', + label: save ? ( + + {annual} + + {save} + + + ) : ( + annual + ), + ariaLabel: save ? `${annual}, ${save}` : undefined + } + ]} + /> +
+ ) +} + +export type TeamPlanCardMode = + /** Owner or admin, no plan yet: continue in the browser to choose seats and pay. */ + | 'choose' + /** Already on this plan; owners and admins manage it in the browser. */ + | 'current' + /** A member: the plan is shown, an owner or admin chooses it. */ + | 'member' + +export function TeamPlanCard({ + team, + interval, + seats, + mode, + opening, + onContinue +}: { + team: TeamPlanModel + interval: OrcaBillingInterval + /** Seats on the current plan, when there is one. */ + seats: number | null + mode: TeamPlanCardMode + onContinue: (() => void) | null + opening: boolean +}): React.JSX.Element { + const t = useTranslate() + const locale = useIntlLocale() + const fmt = (cents: number): string => formatCents(cents, locale, team.currency) + const monthly = perSeatMonthlyCents(team, interval) + const fullMonthly = team.monthlyPriceCentsPerSeat + const discounted = + interval === 'year' && monthly !== null && fullMonthly !== null && monthly < fullMonthly + const legacyLabel = team.legacyPriceLabels?.[interval] || null + + const price = ( + // Keyed so the figure fades in again when the period changes. +

+ {discounted && fullMonthly !== null ? ( + + {t('auto.components.billing.plans.was', 'Was')} + {fmt(fullMonthly)} + + ) : null} + {monthly === null ? ( + + {legacyLabel ?? t('auto.components.billing.plans.priceInBrowser', 'See price in browser')} + + ) : ( + <> + {fmt(monthly)} + + {t('auto.components.billing.plans.perSeatPerMonth', 'per seat per month')} + + + )} +

+ ) + + const billed = + interval === 'year' + ? team.annualPriceCentsPerSeat === null + ? t('auto.components.billing.plans.billedYearly', 'Billed yearly') + : t( + 'auto.components.billing.plans.billedYearlyAmount2', + '{{value0}} per seat, billed yearly', + { + value0: fmt(team.annualPriceCentsPerSeat) + } + ) + : t('auto.components.billing.plans.billedMonthly', 'Billed monthly') + const priceNote = + seats === null + ? billed + : t('auto.components.billing.plans.seatsBilled', '{{count}} seats · {{billed}}', { + count: seats, + billed, + defaultValue_one: '{{count}} seat · {{billed}}' + }) + + const continueButton = onContinue ? ( + + ) : null + + let footer: ReactNode + if (mode === 'member') { + footer = ( +
+ +

+ {seats === null + ? t('auto.components.billing.plans.askAdmin', 'Ask a team admin to upgrade.') + : t( + 'auto.components.billing.plans.adminsManage', + 'Your team’s owners and admins manage this plan.' + )} +

+
+ ) + } else if (mode === 'current') { + footer = ( + <> + {continueButton} +

+ {t( + 'auto.components.billing.plans.manageHint2', + 'Change seats or billing period, see invoices, or update payment.' + )} +

+ + ) + } else { + footer = ( + <> + {continueButton} +

+ {t( + 'auto.components.billing.plans.continueHint2', + 'Sign in on the web to choose seats and pay.' + )} +

+ + ) + } + + return ( + + + {team.label} + + } + badge={ + mode === 'current' || (mode === 'member' && seats !== null) ? ( + + {t('auto.components.billing.plans.currentPlan', 'Current plan')} + + ) : null + } + tagline={team.marketing?.tagline ?? null} + price={price} + priceNote={priceNote} + featuresLead={team.marketing?.featuresLead} + features={team.features} + footer={footer} + /> + ) +} + +export function EnterprisePlanCard({ + enterprise, + onContactSales +}: { + enterprise: EnterprisePlanModel + onContactSales: (url: string) => void +}): React.JSX.Element { + const t = useTranslate() + const contactUrl = enterprise.contactUrl + return ( + + + {enterprise.label} + + } + tagline={enterprise.marketing?.tagline ?? null} + price={ + enterprise.priceLabel ? ( +

{enterprise.priceLabel}

+ ) : null + } + priceNote={t('auto.components.billing.plans.entPriced2', 'Priced for your team')} + featuresLead={enterprise.marketing?.featuresLead} + features={enterprise.features} + footer={ + contactUrl ? ( + <> + +

+ {t( + 'auto.components.billing.plans.entHint', + 'Tell us about your team and where you run.' + )} +

+ + ) : null + } + /> + ) +} diff --git a/src/renderer/src/components/billing/plans/PlansCurrentPlan.tsx b/src/renderer/src/components/billing/plans/PlansCurrentPlan.tsx new file mode 100644 index 00000000000..d37f9f0fad9 --- /dev/null +++ b/src/renderer/src/components/billing/plans/PlansCurrentPlan.tsx @@ -0,0 +1,136 @@ +// The team's plan as it stands, above the plan cards: a plan with its hours and seats, the +// one-time trial, or (no plan) the trial terms billing's catalog offers. +import { Cloud, Gift } from 'lucide-react' +import { Progress } from '@/components/ui/progress' +import { useIntlLocale, useTranslate } from '@/i18n/use-translate' +import type { OrcaBillingEntitlement } from '../../../../../shared/orca-billing' +import { PlanStatusBadge } from '../PlanStatusBadge' +import { formatHours, formatHoursUsed, includedUsagePercent } from '../plan-billing-format' +import { + includedUsageTone, + sandboxHoursCount, + sandboxHoursLeftLine, + trialHoursUsedLine +} from '../plan-billing-usage-copy' +import type { TrialPlanModel } from './plans-model' + +const STRIP = 'space-y-2 rounded-xl border border-border bg-card p-4 shadow-xs' + +export function CurrentPlanStrip({ + entitlement +}: { + entitlement: OrcaBillingEntitlement +}): React.JSX.Element { + const t = useTranslate() + const locale = useIntlLocale() + const resets = entitlement.usageWindow + ? new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }).format(entitlement.usageWindow.end) + : null + return ( +
+
+ {entitlement.planLabel} + +
+ +
+ + {t( + 'auto.components.billing.sandboxHoursUsedMonth', + '{{value0}} of {{value1}} sandbox hours used this month', + { + value0: formatHoursUsed( + Math.min(entitlement.usedSeconds, entitlement.includedSeconds) + ), + value1: formatHours(entitlement.includedSeconds) + } + )} + + + {resets + ? t( + 'auto.components.billing.plans.sandboxHoursLeftResets', + '{{count}} sandbox hours left · resets {{date}}', + { + count: sandboxHoursCount(entitlement.remainingIncludedSeconds), + date: resets, + defaultValue_one: '{{count}} sandbox hour left · resets {{date}}' + } + ) + : sandboxHoursLeftLine(entitlement, t)} + +
+
+ ) +} + +export function TrialStrip({ + entitlement, + canManage +}: { + entitlement: OrcaBillingEntitlement + canManage: boolean +}): React.JSX.Element { + const t = useTranslate() + const usedUp = entitlement.trial?.exhausted === true + return ( +
+
+ + + {t('auto.components.billing.trialProduct', 'Orca Cloud')} + + +
+ +
+ {trialHoursUsedLine(entitlement, t)} + {sandboxHoursLeftLine(entitlement, t)} +
+

+ {usedUp + ? canManage + ? t( + 'auto.components.billing.plans.trialUsedUpAdmin', + 'Your trial hours are used up. Choose a plan to keep your sandboxes running.' + ) + : t( + 'auto.components.billing.plans.trialUsedUpMember', + 'Your team’s trial hours are used up. Ask a team admin to upgrade.' + ) + : t( + 'auto.components.billing.plans.trialOneTime2', + 'Trial hours are a one-time allowance and don’t reset. Choose a plan any time.' + )} +

+
+ ) +} + +/** No plan and no trial yet: the trial billing's catalog offers (its own name and terms). */ +export function TrialOfferStrip({ trial }: { trial: TrialPlanModel }): React.JSX.Element | null { + if (trial.features.length === 0) { + return null + } + return ( +
+ + + +
+

{trial.tagline ?? trial.label}

+

+ {trial.features.join(' · ')} +

+
+
+ ) +} diff --git a/src/renderer/src/components/billing/plans/PlansDialogHost.tsx b/src/renderer/src/components/billing/plans/PlansDialogHost.tsx new file mode 100644 index 00000000000..2e0a2cbe59d --- /dev/null +++ b/src/renderer/src/components/billing/plans/PlansDialogHost.tsx @@ -0,0 +1,45 @@ +import { useState } from 'react' +import { Dialog } from '@/components/ui/dialog' +import { canManageActiveTeam } from '@/lib/orca-cloud/orca-cloud-team-role' +import { openCloudConsole } from '@/lib/orca-cloud/open-cloud-console' +import { useAppStore } from '@/store/index' +import { useOrcaBillingStatus } from '../use-orca-billing-status' +import { usePlanCatalog } from '../use-plan-catalog' +import { closePlansDialog, usePlansDialogOpen } from './plans-dialog-store' +import { PlansDialogView } from './PlansDialogView' + +/** + * The plans dialog, in front of the web console: what the team has and what billing sells, read + * from billing (GET /v1/plans and the team's entitlement). "Continue in browser" opens the console's + * billing page through a sign-in ticket; choosing seats and paying happen there. + */ +export function PlansDialogHost(): React.JSX.Element { + const open = usePlansDialogOpen() + const billing = useOrcaBillingStatus(open) + const catalog = usePlanCatalog(open) + const canManage = useAppStore((state) => canManageActiveTeam(state.orcaProfileAuthStatus)) + const [opening, setOpening] = useState(false) + + return ( + (next ? undefined : closePlansDialog())}> + {open ? ( + { + setOpening(true) + void openCloudConsole('billing').finally(() => setOpening(false)) + }} + onContactSales={(url) => void window.api.shell.openUrl(url)} + onRetry={() => { + billing.refresh() + catalog.refresh() + }} + /> + ) : null} + + ) +} diff --git a/src/renderer/src/components/billing/plans/PlansDialogView.fixture.tsx b/src/renderer/src/components/billing/plans/PlansDialogView.fixture.tsx new file mode 100644 index 00000000000..027fe04fae1 --- /dev/null +++ b/src/renderer/src/components/billing/plans/PlansDialogView.fixture.tsx @@ -0,0 +1,221 @@ +import { Dialog } from '@/components/ui/dialog' +import { defineFixture } from '../../../component-fixtures/component-fixture' +import type { + OrcaBillingEntitlement, + OrcaBillingStatusResult +} from '../../../../../shared/orca-billing' +import type { + OrcaPlanCatalog, + OrcaPlanCatalogResult +} from '../../../../../shared/orca-billing-plans' +import { sampleTeam, sampleTrial } from '../plan-billing-fixtures' +import { PlansDialogView } from './PlansDialogView' + +// Shaped like billing-dev's GET /v1/plans after the desktop's parse. +const catalog: OrcaPlanCatalog = { + catalogVersion: 'c_fixture', + plans: [ + { + kind: 'trial', + id: 'trial', + name: 'Trial', + version: 1, + supportUrl: null, + marketing: { + tagline: 'Try Orca Cloud with your team before you pick a plan', + featuresLead: null, + ctaLabel: null + }, + features: [ + { id: 'trial_hours', params: { hours: 2 }, text: '2 sandbox hours to try Orca Cloud' }, + { id: 'no_card', params: {}, text: 'No card needed' } + ] + }, + { + kind: 'self_serve', + id: 'team', + name: 'Team', + version: 2, + supportUrl: 'https://orca.dev/enterprise', + marketing: { + tagline: 'Hosted sandboxes for your whole team, billed per seat', + featuresLead: null, + ctaLabel: 'Continue in browser' + }, + features: [ + { + id: 'included_hours_per_seat', + params: { hours: 60 }, + text: '60 sandbox hours per seat each month, pooled across your team' + }, + { id: 'sandbox_spec', params: {}, text: 'Every sandbox gets 8 vCPU and 16 GB' }, + { id: 'ready_in_seconds', params: {}, text: 'Ready in seconds, nothing to set up or host' }, + { + id: 'agents_keep_running', + params: {}, + text: 'Agents keep running when you close your laptop' + }, + { + id: 'idle_sleep', + params: {}, + text: 'Sandboxes sleep when idle, so you only use hours while they work' + }, + { + id: 'overage_optional', + params: {}, + text: 'Optional overage up to a monthly spend cap you set' + } + ], + prices: [ + { interval: 'month', unitAmountCents: 5000, currency: 'usd' }, + { interval: 'year', unitAmountCents: 48000, currency: 'usd' } + ], + overage: { centsPerHour: 100, defaultSpendCapCents: 2500, maxSpendCapCents: 500000 }, + seats: { min: 1, max: 500 }, + includedHoursPerSeat: 60, + checkoutAvailable: true + }, + { + kind: 'contact_sales', + id: 'enterprise', + name: 'Enterprise', + version: 2, + supportUrl: null, + contactUrl: 'https://orca.dev/enterprise', + priceLabel: 'Custom', + marketing: { + tagline: 'Your cloud, your identity provider, your terms', + featuresLead: 'Everything in Team, plus:', + ctaLabel: 'Contact sales' + }, + features: [ + { id: 'byoc', params: {}, text: 'Run sandboxes in your own cloud' }, + { id: 'sso_scim', params: {}, text: 'SSO and SCIM' }, + { id: 'mfa_enforcement', params: {}, text: 'Require multi-factor authentication' }, + { id: 'audit_log', params: {}, text: 'Team audit log' }, + { id: 'custom_limits', params: {}, text: 'Custom limits and pricing' } + ] + } + ] +} + +const live: OrcaPlanCatalogResult = { + status: 'ok', + catalog, + source: 'live', + fetchedAt: Date.UTC(2026, 10, 14) +} + +const noPlan: OrcaBillingEntitlement = { + ...sampleTeam, + plan: null, + planLabel: null, + status: 'none', + interval: null, + seats: 0, + usageWindow: null, + includedSeconds: 0, + usedSeconds: 0, + remainingIncludedSeconds: 0, + canStartSandbox: false, + reason: 'no_subscription', + offers: { ...sampleTeam.offers!, trial: { includedSeconds: 7200 } } +} + +const pastDue: OrcaBillingEntitlement = { + ...sampleTeam, + status: 'past_due', + payment: { + pastDueSince: Date.UTC(2026, 10, 12), + graceEndsAt: Date.UTC(2026, 10, 16, 17), + suspendRunning: false + }, + canStartSandbox: false, + reason: 'payment_past_due' +} + +function Frame({ + billing, + plans = live, + canManage = true +}: { + billing: OrcaBillingStatusResult | null + plans?: OrcaPlanCatalogResult | null + canManage?: boolean +}): React.JSX.Element { + return ( +
+ + {}} + onContactSales={() => {}} + onRetry={() => {}} + /> + +
+ ) +} + +const ok = (entitlement: OrcaBillingEntitlement): OrcaBillingStatusResult => ({ + status: 'ok', + entitlement +}) + +/** Owner or admin, no plan and the trial still on offer. */ +export const none = defineFixture({ width: 1280, render: () => }) + +export const trial = defineFixture({ + width: 1280, + render: () => +}) + +export const active = defineFixture({ + width: 1280, + render: () => +}) + +export const pastDuePlan = defineFixture({ + width: 1280, + render: () => +}) + +/** A member of a team with no plan: plan info and "Ask a team admin", no buttons into the console. */ +export const member = defineFixture({ + width: 1280, + render: () => +}) + +/** Offline, from main's saved copy of the catalog. */ +export const offlineSaved = defineFixture({ + width: 1280, + render: () => ( + + ) +}) + +/** The catalog can't be read: billing's entitlement offers stand in (prices only, no bullets). */ +export const fallbackOffers = defineFixture({ + width: 1280, + render: () => +}) + +/** Neither the catalog nor billing answered: no guessed prices, the console is still offered. */ +export const unavailable = defineFixture({ + width: 1280, + render: () => ( + + ) +}) + +/** Billing hasn't answered yet: a neutral title and skeleton, never an upsell. */ +export const loading = defineFixture({ + width: 1280, + render: () => +}) diff --git a/src/renderer/src/components/billing/plans/PlansDialogView.tsx b/src/renderer/src/components/billing/plans/PlansDialogView.tsx new file mode 100644 index 00000000000..a9bba97fd56 --- /dev/null +++ b/src/renderer/src/components/billing/plans/PlansDialogView.tsx @@ -0,0 +1,269 @@ +// The plans dialog: the team's plan and status, then billing's plan cards, with "Continue in +// browser" into the web console, where the person signs in, picks seats and pays. A read-only sales +// and status surface: no checkout, usage history or admin settings in the desktop. +import { useEffect, useState } from 'react' +import { ExternalLink } from 'lucide-react' +import { Button } from '@/components/ui/button' +import { DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog' +import { InlineError } from '@/components/ui/inline-error' +import { Skeleton } from '@/components/ui/skeleton' +import { useIntlLocale, useTranslate } from '@/i18n/use-translate' +import { + isOrcaCloudTrial, + type OrcaBillingInterval, + type OrcaBillingStatusResult +} from '../../../../../shared/orca-billing' +import type { OrcaPlanCatalogResult } from '../../../../../shared/orca-billing-plans' +import { PaymentIssueNotice } from '../PaymentIssueNotice' +import { isActivePlan } from '../plan-billing-format' +import { + EnterprisePlanCard, + PlansIntervalToggle, + TeamPlanCard, + type TeamPlanCardMode +} from './PlanCards' +import { CurrentPlanStrip, TrialOfferStrip, TrialStrip } from './PlansCurrentPlan' +import { resolvePlansModel } from './plans-model' +import { annualSavingsPercent, shownInterval } from './plans-pricing' + +export type PlansDialogViewProps = { + /** null while billing's first answer is on its way. */ + billing: OrcaBillingStatusResult | null + /** null while the plan catalog loads. */ + catalog: OrcaPlanCatalogResult | null + /** Owner or admin of the active team (the console's billing rule). */ + canManage: boolean + /** The console is being opened (a ticket is minted first). */ + opening: boolean + onContinue: () => void + onContactSales: (url: string) => void + onRetry: () => void +} + +function SkeletonCard(): React.JSX.Element { + return ( +
+ +
+ + +
+
+ {Array.from({ length: 4 }, (_, index) => ( + + ))} +
+
+ + +
+
+ ) +} + +function PlansSkeleton(): React.JSX.Element { + const t = useTranslate() + return ( +
+ +
+ + +
+
+ ) +} + +function useHeading(props: PlansDialogViewProps): { title: string; description: string | null } { + const t = useTranslate() + const entitlement = props.billing?.status === 'ok' ? props.billing.entitlement : null + if (!entitlement || isActivePlan(entitlement)) { + // Never an upsell before billing answers: a paying team must not see one flash by. + return { + title: entitlement + ? t('auto.components.billing.plans.titleSubscribed', 'Your Orca Cloud plan') + : t('auto.components.billing.plans.titleNeutral', 'Orca Cloud plans'), + description: null + } + } + return { + title: t('auto.components.billing.plans.title', 'Cloud sandboxes for your whole team'), + description: t( + 'auto.components.billing.plans.subtitle2', + 'Run Orca agents in hosted sandboxes that keep going when you step away.' + ) + } +} + +function PlansBody(props: PlansDialogViewProps): React.JSX.Element { + const t = useTranslate() + const locale = useIntlLocale() + const [picked, setPicked] = useState('month') + const plans = resolvePlansModel(props.catalog, props.billing) + const billing = props.billing + + if (billing === null || plans.state === 'loading') { + return + } + if (billing.status === 'signed-out' || billing.status === 'unconfigured') { + return ( +

+ {billing.status === 'signed-out' + ? t('auto.components.billing.plans.signedOut', 'Sign in to Orca to see your team’s plan.') + : t('auto.components.billing.openUnconfigured', 'Billing is unavailable in this build.')} +

+ ) + } + + const entitlement = billing.status === 'ok' ? billing.entitlement : null + const subscribed = isActivePlan(entitlement) + const trial = entitlement && isOrcaCloudTrial(entitlement) ? entitlement : null + + const status = entitlement ? ( + subscribed ? ( + <> + + + + ) : trial ? ( + + ) : plans.state === 'ready' && plans.model.trial && entitlement.offers?.trial ? ( + + ) : null + ) : null + + if (plans.state === 'unavailable') { + // Offline with nothing saved: say so, and still offer the console (it lists the plans). + return ( +
+ {status} + + {props.canManage ? ( +
+ +
+ ) : ( +

+ {t('auto.components.billing.plans.askAdmin', 'Ask a team admin to upgrade.')} +

+ )} +
+ ) + } + + const { team, enterprise, source } = plans.model + const mode: TeamPlanCardMode = !props.canManage ? 'member' : subscribed ? 'current' : 'choose' + const interval = + subscribed && entitlement?.interval + ? entitlement.interval + : shownInterval(picked, team.intervals) + const fetchedAt = props.catalog?.status === 'ok' ? props.catalog.fetchedAt : null + + return ( +
+ {status} + {!subscribed && team.intervals.length > 1 ? ( + + ) : null} +
+ + {enterprise ? ( + + ) : null} +
+ {source === 'cache' && fetchedAt ? ( +

+ {t( + 'auto.components.billing.plans.savedCopy', + 'Offline: plans as of {{date}}. Your browser shows current prices.', + { date: new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }).format(fetchedAt) } + )} +

+ ) : null} +
+ ) +} + +export function PlansDialogView(props: PlansDialogViewProps): React.JSX.Element { + const heading = useHeading(props) + const ready = props.billing !== null && props.catalog !== null + // Land on the heading once plans load, never on a button (Enter would open the browser). + useEffect(() => { + const active = document.activeElement + if ( + ready && + (!active || active === document.body || active.getAttribute('role') === 'dialog') + ) { + document.querySelector('[role="dialog"] [data-plans-heading]')?.focus() + } + }, [ready]) + const t = useTranslate() + return ( + { + event.preventDefault() + if (event.currentTarget instanceof HTMLElement) { + const heading = event.currentTarget.querySelector('[data-plans-heading]') + ;(heading ?? event.currentTarget).focus() + } + }} + > + +

+ {t('auto.components.billing.plans.eyebrow', 'Orca Cloud')} +

+ + {heading.title} + + + {heading.description ?? + t( + 'auto.components.billing.plans.subtitleSubscribed2', + 'Your plan, its sandbox hours, and what Enterprise adds.' + )} + +
+ +
+ ) +} diff --git a/src/renderer/src/components/billing/plans/plans-dialog-store.ts b/src/renderer/src/components/billing/plans/plans-dialog-store.ts new file mode 100644 index 00000000000..d78ecdbd321 --- /dev/null +++ b/src/renderer/src/components/billing/plans/plans-dialog-store.ts @@ -0,0 +1,30 @@ +// Open state for the plans dialog. Every "Plan & billing", "Upgrade", "Choose plan" and "Compare +// plans" entry point calls openPlansDialog(); PlansDialogHost renders it. +import { useSyncExternalStore } from 'react' + +let open = false +const listeners = new Set<() => void>() + +function set(next: boolean): void { + open = next + for (const listener of listeners) { + listener() + } +} + +export function openPlansDialog(): void { + set(true) +} + +export function closePlansDialog(): void { + set(false) +} + +function subscribe(listener: () => void): () => void { + listeners.add(listener) + return () => listeners.delete(listener) +} + +export function usePlansDialogOpen(): boolean { + return useSyncExternalStore(subscribe, () => open) +} diff --git a/src/renderer/src/components/billing/plans/plans-model.ts b/src/renderer/src/components/billing/plans/plans-model.ts new file mode 100644 index 00000000000..abca3d6e75a --- /dev/null +++ b/src/renderer/src/components/billing/plans/plans-model.ts @@ -0,0 +1,166 @@ +// What the plans dialog shows, from billing's plan catalog (GET /v1/plans): names, Stripe's prices, +// seat bounds, feature bullets, the trial's terms and each card's copy are billing's. A service from +// before the catalog (or a catalog that can't be read) falls back to the entitlement's `offers`, +// which are billing's numbers too. The desktop never supplies a price or a feature of its own. +import type { + OrcaBillingInterval, + OrcaBillingOffers, + OrcaBillingStatusResult +} from '../../../../../shared/orca-billing' +import { + isContactSalesPlan, + isSelfServePlan, + type OrcaPlanCatalog, + type OrcaPlanCatalogResult, + type OrcaPlanMarketing +} from '../../../../../shared/orca-billing-plans' + +export type TeamPlanModel = { + planId: string + label: string + currency: string + monthlyPriceCentsPerSeat: number | null + annualPriceCentsPerSeat: number | null + /** Intervals on sale (priced), in display order. */ + intervals: OrcaBillingInterval[] + /** Billing's feature bullets, in catalog order. */ + features: string[] + marketing: OrcaPlanMarketing | null + /** An older service's display labels, for a price it sends no cents for. */ + legacyPriceLabels: { month: string; year: string } | null +} + +export type EnterprisePlanModel = { + label: string + priceLabel: string | null + contactUrl: string | null + features: string[] + marketing: OrcaPlanMarketing | null +} + +export type TrialPlanModel = { label: string; tagline: string | null; features: string[] } + +export type PlansModel = { + team: TeamPlanModel + enterprise: EnterprisePlanModel | null + trial: TrialPlanModel | null + /** `offers`: an older service's entitlement offers stood in for the catalog. */ + source: 'live' | 'cache' | 'offers' +} + +function featureLines(features: readonly { text: string }[]): string[] { + return features.flatMap((feature) => { + const text = feature.text.trim() + return text ? [text] : [] + }) +} + +export function plansModelFromCatalog( + catalog: OrcaPlanCatalog, + source: 'live' | 'cache' +): PlansModel | null { + const team = catalog.plans.find(isSelfServePlan) + if (!team) { + return null + } + const price = (interval: OrcaBillingInterval) => + team.prices.find((entry) => entry.interval === interval) ?? null + const monthly = price('month') + const annual = price('year') + const enterprise = catalog.plans.find(isContactSalesPlan) + const trial = catalog.plans.find((plan) => plan.kind === 'trial') + return { + source, + team: { + planId: team.id, + label: team.name, + currency: (monthly ?? annual)?.currency ?? 'usd', + monthlyPriceCentsPerSeat: monthly?.unitAmountCents ?? null, + annualPriceCentsPerSeat: annual?.unitAmountCents ?? null, + intervals: [monthly, annual].flatMap((entry) => (entry ? [entry.interval] : [])), + features: featureLines(team.features), + marketing: team.marketing, + legacyPriceLabels: null + }, + enterprise: enterprise + ? { + label: enterprise.name, + priceLabel: enterprise.priceLabel, + contactUrl: enterprise.contactUrl, + features: featureLines(enterprise.features), + marketing: enterprise.marketing + } + : null, + trial: trial + ? { + label: trial.name, + tagline: trial.marketing?.tagline ?? null, + features: featureLines(trial.features) + } + : null + } +} + +/** An older billing service (no GET /v1/plans): its entitlement offers. No feature bullets. */ +export function plansModelFromOffers(offers: OrcaBillingOffers): PlansModel { + const team = offers.team + const intervals: OrcaBillingInterval[] = [] + if (team.monthlyPriceCentsPerSeat !== null || team.monthlyPriceLabel) { + intervals.push('month') + } + if (team.annualPriceCentsPerSeat !== null || team.annualPriceLabel) { + intervals.push('year') + } + return { + source: 'offers', + team: { + planId: 'team', + label: team.label, + currency: 'usd', + monthlyPriceCentsPerSeat: team.monthlyPriceCentsPerSeat, + annualPriceCentsPerSeat: team.annualPriceCentsPerSeat, + intervals, + features: [], + marketing: null, + legacyPriceLabels: { month: team.monthlyPriceLabel, year: team.annualPriceLabel } + }, + enterprise: offers.enterprise.label + ? { + label: offers.enterprise.label, + priceLabel: offers.enterprise.priceLabel || null, + contactUrl: offers.enterprise.contactUrl || null, + features: [], + marketing: null + } + : null, + trial: null + } +} + +export type PlansModelState = + | { state: 'loading' } + | { state: 'ready'; model: PlansModel } + /** Nothing from billing to show: the dialog still offers the console, never a guessed price. */ + | { state: 'unavailable' } + +/** Catalog first; the entitlement's offers only when the catalog can't be had. */ +export function resolvePlansModel( + catalog: OrcaPlanCatalogResult | null, + billing: OrcaBillingStatusResult | null +): PlansModelState { + if (catalog?.status === 'ok') { + const model = plansModelFromCatalog(catalog.catalog, catalog.source) + if (model) { + return { state: 'ready', model } + } + } + if (catalog === null) { + return { state: 'loading' } + } + const offers = billing?.status === 'ok' ? billing.entitlement.offers : null + if (offers) { + return { state: 'ready', model: plansModelFromOffers(offers) } + } + // Billing may still answer with offers; wait for it rather than flash "unavailable". + return billing === null ? { state: 'loading' } : { state: 'unavailable' } +} diff --git a/src/renderer/src/components/billing/plans/plans-pricing.ts b/src/renderer/src/components/billing/plans/plans-pricing.ts new file mode 100644 index 00000000000..3aad2350a0e --- /dev/null +++ b/src/renderer/src/components/billing/plans/plans-pricing.ts @@ -0,0 +1,40 @@ +// Price math for the plans dialog. Every number is billing's: its catalog (Stripe's prices), or an +// older service's offers. +import type { OrcaBillingInterval } from '../../../../../shared/orca-billing' + +type TeamPrices = { + monthlyPriceCentsPerSeat: number | null + annualPriceCentsPerSeat: number | null +} + +/** What one seat costs per month on this interval (annual shown as its monthly equivalent). */ +export function perSeatMonthlyCents( + team: TeamPrices, + interval: OrcaBillingInterval +): number | null { + if (interval === 'month') { + return team.monthlyPriceCentsPerSeat + } + return team.annualPriceCentsPerSeat === null + ? null + : Math.round(team.annualPriceCentsPerSeat / 12) +} + +/** Whole-percent saving of annual over twelve monthly payments, or null when not cheaper. */ +export function annualSavingsPercent(team: TeamPrices): number | null { + const monthly = team.monthlyPriceCentsPerSeat + const annual = team.annualPriceCentsPerSeat + if (monthly === null || annual === null || monthly <= 0) { + return null + } + const percent = Math.round((1 - annual / (monthly * 12)) * 100) + return percent > 0 ? percent : null +} + +/** The interval to show: the one picked when it is on sale, else the first one that is. */ +export function shownInterval( + picked: OrcaBillingInterval, + intervals: readonly OrcaBillingInterval[] +): OrcaBillingInterval { + return intervals.includes(picked) ? picked : (intervals[0] ?? picked) +} diff --git a/src/renderer/src/components/billing/register-plan-billing-menu-item.test.ts b/src/renderer/src/components/billing/register-plan-billing-menu-item.test.ts index 27f1a913503..44132ec2e0d 100644 --- a/src/renderer/src/components/billing/register-plan-billing-menu-item.test.ts +++ b/src/renderer/src/components/billing/register-plan-billing-menu-item.test.ts @@ -5,7 +5,9 @@ const auth = vi.hoisted(() => { return state }) const openCloudConsole = vi.hoisted(() => vi.fn()) +const openPlansDialog = vi.hoisted(() => vi.fn()) vi.mock('@/lib/orca-cloud/open-cloud-console', () => ({ openCloudConsole })) +vi.mock('./plans/plans-dialog-store', () => ({ openPlansDialog })) vi.mock('@/store/index', () => ({ useAppStore: { getState: () => ({ orcaProfileAuthStatus: auth.status }), @@ -41,6 +43,7 @@ afterEach(() => { vi.unstubAllGlobals() recordBillingStatus({ status: 'signed-out' }) openCloudConsole.mockReset() + openPlansDialog.mockReset() }) describe('account menu billing items', () => { @@ -57,11 +60,12 @@ describe('account menu billing items', () => { ).toEqual(['orca.team']) expect(visible()).toEqual(['orca.team', 'orca.plan-billing']) expect(visible('Admin')).toEqual(['orca.team', 'orca.plan-billing']) - // The console refuses members Plan & billing, so the menu doesn't offer it (n64 P3 #4). - expect(visible('Member')).toEqual(['orca.team']) + // Members get the read-only plans dialog (the console itself refuses them). + expect(visible('Member')).toEqual(['orca.team', 'orca.plan-billing']) const plans = getRegisteredAccountMenuItems().find((item) => item.id === 'orca.plan-billing') plans?.onSelect() - expect(openCloudConsole).toHaveBeenCalledWith('billing') + expect(openPlansDialog).toHaveBeenCalledTimes(1) + expect(openCloudConsole).not.toHaveBeenCalled() dispose() expect(getRegisteredAccountMenuItems()).toHaveLength(0) }) @@ -74,6 +78,7 @@ describe('account menu billing items', () => { entitlement: { ...sampleTeam, plan: null, planLabel: null, status: 'none' } }) expect(visible()).toEqual(['orca.upgrade', 'orca.team']) + expect(visible('Member')).toEqual(['orca.team', 'orca.plan-billing']) expect(getRegisteredAccountMenuItems().find((item) => item.id === 'orca.upgrade')?.tone).toBe( 'accent' ) diff --git a/src/renderer/src/components/billing/register-plan-billing-menu-item.ts b/src/renderer/src/components/billing/register-plan-billing-menu-item.ts index 86a66b16807..e4b5c5ca46d 100644 --- a/src/renderer/src/components/billing/register-plan-billing-menu-item.ts +++ b/src/renderer/src/components/billing/register-plan-billing-menu-item.ts @@ -9,6 +9,7 @@ import { subscribeBillingSummary } from './billing-summary-store' import { openCloudConsole } from '@/lib/orca-cloud/open-cloud-console' +import { openPlansDialog } from './plans/plans-dialog-store' /** Cloud capability flag that turns billing on per account (server-controlled rollout). */ export const BILLING_CAPABILITY = 'billing' @@ -16,22 +17,23 @@ export const BILLING_CAPABILITY = 'billing' const UPGRADE_ITEM_ID = 'orca.upgrade' /** - * Account menu: "Team" and "Plan & billing" open the web console in the browser. Accounts without - * a plan get "Upgrade to Orca Cloud" (also the console's billing page) in place of Plan & billing. + * Account menu: "Plan & billing" opens the plans dialog (status and plans, then the web console); + * "Team" opens the console. Owners and admins of a team without a plan get "Upgrade to Orca Cloud" + * (the same dialog) in place of Plan & billing; members keep Plan & billing, read-only. */ export function registerPlanBillingMenuItem(): () => void { - const registerBilling = (): (() => void) => + const registerBilling = (hideFromTeamAdmin: boolean): (() => void) => registerAccountMenuItem({ id: 'orca.plan-billing', label: () => translate('auto.components.billing.menuItem', 'Plan & billing'), icon: CreditCard, order: 11, requiredCapability: BILLING_CAPABILITY, - // The console's billing page is owners and admins only; don't offer members a dead end. - requiresTeamAdmin: true, - onSelect: () => void openCloudConsole('billing') + hideFromTeamAdmin, + onSelect: openPlansDialog }) - let disposeBilling: (() => void) | null = registerBilling() + let billingHiddenFromAdmins = false + let disposeBilling: () => void = registerBilling(false) const disposeTeam = registerAccountMenuItem({ id: 'orca.team', label: () => translate('auto.components.billing.team.menuItem', 'Team'), @@ -46,12 +48,11 @@ export function registerPlanBillingMenuItem(): () => void { const syncUpgrade = (): void => { // Only a known "no plan" shows it: never flash an upsell at a paying team while loading. const show = getBillingSummary().subscribed === false - // One entry at a time: "Upgrade to Orca Cloud" replaces "Plan & billing" until there is a plan. - if (show && disposeBilling) { + // One entry at a time for admins: "Upgrade to Orca Cloud" replaces "Plan & billing". + if (show !== billingHiddenFromAdmins) { + billingHiddenFromAdmins = show disposeBilling() - disposeBilling = null - } else if (!show && !disposeBilling) { - disposeBilling = registerBilling() + disposeBilling = registerBilling(show) } if (show && !disposeUpgrade) { disposeUpgrade = registerAccountMenuItem({ @@ -62,7 +63,7 @@ export function registerPlanBillingMenuItem(): () => void { tone: 'accent', requiredCapability: BILLING_CAPABILITY, requiresTeamAdmin: true, - onSelect: () => void openCloudConsole('billing') + onSelect: openPlansDialog }) } else if (!show && disposeUpgrade) { disposeUpgrade() @@ -104,7 +105,7 @@ export function registerPlanBillingMenuItem(): () => void { onAuth() return () => { - disposeBilling?.() + disposeBilling() disposeTeam() disposeUpgrade?.() unsubscribeSummary() diff --git a/src/renderer/src/components/new-workspace/orca-cloud-run-target-access.ts b/src/renderer/src/components/new-workspace/orca-cloud-run-target-access.ts index 5c101ec3224..36ef99fa333 100644 --- a/src/renderer/src/components/new-workspace/orca-cloud-run-target-access.ts +++ b/src/renderer/src/components/new-workspace/orca-cloud-run-target-access.ts @@ -1,5 +1,5 @@ import type { OrcaBillingStatusResult } from '../../../../shared/orca-billing' -import { openCloudConsole } from '@/lib/orca-cloud/open-cloud-console' +import { openPlansDialog } from '@/components/billing/plans/plans-dialog-store' import { useAppStore } from '@/store/index' import { sandboxHoursLeft } from '@/components/billing/plan-billing-format' import { @@ -24,7 +24,7 @@ function signInThenSelectOrcaCloud(): void { /** Plans are chosen in the web console; the row re-reads billing when the composer reopens. */ function choosePlanInBrowser(): void { - void openCloudConsole('billing') + openPlansDialog() } /** diff --git a/src/renderer/src/components/new-workspace/run-on/OrcaCloudTrialUsedUpNotice.tsx b/src/renderer/src/components/new-workspace/run-on/OrcaCloudTrialUsedUpNotice.tsx index 139599017ad..de7ba0c88fc 100644 --- a/src/renderer/src/components/new-workspace/run-on/OrcaCloudTrialUsedUpNotice.tsx +++ b/src/renderer/src/components/new-workspace/run-on/OrcaCloudTrialUsedUpNotice.tsx @@ -4,7 +4,7 @@ import React from 'react' import { Button } from '@/components/ui/button' import { InlineError } from '@/components/ui/inline-error' import { useTranslate } from '@/i18n/use-translate' -import { openCloudConsole } from '@/lib/orca-cloud/open-cloud-console' +import { openPlansDialog } from '@/components/billing/plans/plans-dialog-store' import { useOrcaCloudRunTargetAccess } from '../orca-cloud-billing-cache' export function OrcaCloudTrialUsedUpNotice({ @@ -32,12 +32,7 @@ export function OrcaCloudTrialUsedUpNotice({ }) : t('components.newWorkspace.trialUsedUp.memberTitleNoTeam', 'Your team’s trial is used up') const action = canManageBilling ? ( - ) : onAskForPlan ? ( diff --git a/src/renderer/src/components/orca-cloud/cloud-workspace-actions.ts b/src/renderer/src/components/orca-cloud/cloud-workspace-actions.ts index 8681f7745c6..1a3d053e55d 100644 --- a/src/renderer/src/components/orca-cloud/cloud-workspace-actions.ts +++ b/src/renderer/src/components/orca-cloud/cloud-workspace-actions.ts @@ -8,7 +8,7 @@ import { RotateCw } from 'lucide-react' import { toast } from 'sonner' import { translate } from '@/i18n/i18n' import { runSleepWorktree } from '@/components/sidebar/workspace-actions/sleep/sleep-worktree-flow' -import { openCloudConsole } from '@/lib/orca-cloud/open-cloud-console' +import { openPlansDialog } from '@/components/billing/plans/plans-dialog-store' import { signInAgainMessage } from '@/lib/orca-cloud/orca-sign-in-again' import { signInAgainToastAction } from '@/lib/orca-cloud/orca-sign-in-again-action' import type { ConfirmationDialogContextValue } from '@/components/confirmation-dialog-context' @@ -42,7 +42,7 @@ function failureToast(title: string, result: CloudWorkspaceResult): void { ? { action: { label: translate('auto.components.billing.comparePlans', 'Compare plans'), - onClick: () => void openCloudConsole('billing') + onClick: () => openPlansDialog() } } : {}) diff --git a/src/renderer/src/components/settings/orca-cloud/OrcaCloudConsoleLinks.tsx b/src/renderer/src/components/settings/orca-cloud/OrcaCloudConsoleLinks.tsx index 74f1f42e1ef..f904ce171aa 100644 --- a/src/renderer/src/components/settings/orca-cloud/OrcaCloudConsoleLinks.tsx +++ b/src/renderer/src/components/settings/orca-cloud/OrcaCloudConsoleLinks.tsx @@ -1,14 +1,17 @@ -// The Settings row that stands in for billing management, which lives in the Orca Cloud web -// console; team and admin are one row on the Account page (AccountTeamAdminRow). The desktop keeps -// only read-only status (the plan and its health, a failed payment) so the person knows when to go. +// The Settings row for billing, which is managed in the Orca Cloud web console; team and admin are +// one row on the Account page (AccountTeamAdminRow). The desktop keeps only read-only status (the +// plan and its health, a failed payment) and the plans dialog, which leads on to the console. +import { Button } from '@/components/ui/button' import { useTranslate } from '@/i18n/use-translate' import { openCloudConsole } from '@/lib/orca-cloud/open-cloud-console' import { PaymentIssueNotice } from '../../billing/PaymentIssueNotice' import { PlanStatusBadge } from '../../billing/PlanStatusBadge' +import { openPlansDialog } from '../../billing/plans/plans-dialog-store' import { useOrcaBillingStatus } from '../../billing/use-orca-billing-status' -import { CloudConsoleLinkRow } from './CloudConsoleLinkRow' +import { SettingsRow } from '../form-controls/SettingsFormControls' +import { SettingsGroup } from '../section-layout/SettingsGroup' -/** Plan & billing: the plan and its health here; plans, usage, invoices and payment in the console. */ +/** Plan & billing: the plan and its health here; the plans dialog, then the console, for the rest. */ export function PlanBillingConsoleLink(): React.JSX.Element { const t = useTranslate() const billing = useOrcaBillingStatus(true) @@ -23,19 +26,25 @@ export function PlanBillingConsoleLink(): React.JSX.Element { onUpdatePayment={() => void openCloudConsole('billing')} /> ) : null} - - {plan ?? t('auto.components.billing.title', 'Plan & billing')} - {entitlement?.plan ? : null} - - } - description={t( - 'settings.cloudConsole.billing.description', - 'Change your plan, see sandbox hours and invoices, and update payment.' - )} - /> + + + {plan ?? t('auto.components.billing.title', 'Plan & billing')} + {entitlement?.plan ? : null} + + } + description={t( + 'settings.cloudConsole.billing.descriptionPlans', + 'See your plan and compare plans, then change it, see invoices and update payment in your browser.' + )} + control={ + + } + /> + ) } diff --git a/src/renderer/src/components/sidebar/account-menu/account-menu-items.ts b/src/renderer/src/components/sidebar/account-menu/account-menu-items.ts index 30ee2141503..c90bb37ee3b 100644 --- a/src/renderer/src/components/sidebar/account-menu/account-menu-items.ts +++ b/src/renderer/src/components/sidebar/account-menu/account-menu-items.ts @@ -17,6 +17,8 @@ export type AccountMenuItem = { requiresSignIn?: boolean /** Show only to an owner or admin of the active team (the console refuses members). */ requiresTeamAdmin?: boolean + /** Hide from owners and admins of the active team (they get a different entry in its place). */ + hideFromTeamAdmin?: boolean /** 'accent' marks a call to action (e.g. upgrade); default rows stay neutral. */ tone?: 'accent' onSelect: () => void @@ -62,6 +64,7 @@ export function selectVisibleAccountMenuItems( .filter((item) => !item.requiredCapability || flags?.[item.requiredCapability] === true) .filter((item) => !item.requiresSignIn || authStatus?.state === 'connected') .filter((item) => !item.requiresTeamAdmin || canManageActiveTeam(authStatus)) + .filter((item) => !item.hideFromTeamAdmin || !canManageActiveTeam(authStatus)) .map((item, index) => ({ item, index })) .sort((a, b) => (a.item.order ?? 0) - (b.item.order ?? 0) || a.index - b.index) .map(({ item }) => item) diff --git a/src/renderer/src/components/worktree-creation/VmBuildBillingBlocker.tsx b/src/renderer/src/components/worktree-creation/VmBuildBillingBlocker.tsx index 50d2dfc4325..d0c711210bf 100644 --- a/src/renderer/src/components/worktree-creation/VmBuildBillingBlocker.tsx +++ b/src/renderer/src/components/worktree-creation/VmBuildBillingBlocker.tsx @@ -8,7 +8,7 @@ import type { OrcaBillingOverageResult } from '../../../../shared/orca-billing' import { overageFailureCopy } from '../billing/plan-billing-copy' -import { openCloudConsole } from '@/lib/orca-cloud/open-cloud-console' +import { openPlansDialog } from '@/components/billing/plans/plans-dialog-store' import { formatCents } from '../../../../shared/orca-billing-usage-alerts' /** The four ways billing can refuse a create (JA-21 progressive billing). */ @@ -386,7 +386,7 @@ export function VmBuildBillingBlocker({ onRaiseCap={(dollars) => void saveOverage(dollars * 100)} onComparePlans={() => { setPhase({ kind: 'browser', checking: false, stillBlocked: false }) - void openCloudConsole('billing') + openPlansDialog() }} onUpdatePayment={() => { setPhase({ kind: 'browser', checking: false, stillBlocked: false }) diff --git a/src/renderer/src/components/worktree-creation/VmBuildSheet.tsx b/src/renderer/src/components/worktree-creation/VmBuildSheet.tsx index c7229df8451..e79bd4181c7 100644 --- a/src/renderer/src/components/worktree-creation/VmBuildSheet.tsx +++ b/src/renderer/src/components/worktree-creation/VmBuildSheet.tsx @@ -11,7 +11,7 @@ import { isAwaitingVmEnvironmentCheckDecision, resolveVmEnvironmentCheckDecision } from '@/runtime/ephemeral-vm/ephemeral-vm-environment-check-decision' -import { openCloudConsole } from '@/lib/orca-cloud/open-cloud-console' +import { openPlansDialog } from '@/components/billing/plans/plans-dialog-store' import { ORCA_BILLING_OVERAGE_SECTION_ID } from '@/components/new-workspace/orca-cloud-run-target-access' import type { PendingWorktreeCreation } from '@/lib/workspace/creation/pending-worktree-creation' import { toast } from 'sonner' @@ -352,7 +352,7 @@ export function VmBuildSheet({ isBillingFailure(failure) && typedComposerPrompt(entry).trim() ? () => onReturnToComposer({ local: false }) : onDismiss, - onSeePlans: () => void openCloudConsole('billing'), + onSeePlans: () => openPlansDialog(), onCreateLocally: () => onReturnToComposer({ local: true }), onOpenBilling: () => { const store = useAppStore.getState() diff --git a/src/renderer/src/components/worktree-creation/vm-build-failure-toast.ts b/src/renderer/src/components/worktree-creation/vm-build-failure-toast.ts index 1bd9eff0291..b920020baa3 100644 --- a/src/renderer/src/components/worktree-creation/vm-build-failure-toast.ts +++ b/src/renderer/src/components/worktree-creation/vm-build-failure-toast.ts @@ -1,7 +1,7 @@ import { toast } from 'sonner' import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' -import { openCloudConsole } from '@/lib/orca-cloud/open-cloud-console' +import { openPlansDialog } from '@/components/billing/plans/plans-dialog-store' import type { PendingWorktreeCreation } from '@/lib/workspace/creation/pending-worktree-creation' import { classifyVmBuildFailure, type VmBuildFailure } from './vm-build-failure' import { getLastBillingStatus } from '@/components/billing/billing-summary-store' @@ -63,7 +63,7 @@ export function showVmBuildFailureToast( ? { action: { label: translate('auto.components.billing.comparePlans', 'Compare plans'), - onClick: () => void openCloudConsole('billing') + onClick: () => openPlansDialog() } } : {}) diff --git a/src/renderer/src/i18n/en-runtime-required.json b/src/renderer/src/i18n/en-runtime-required.json index cd05d800655..ab471752783 100644 --- a/src/renderer/src/i18n/en-runtime-required.json +++ b/src/renderer/src/i18n/en-runtime-required.json @@ -217,6 +217,12 @@ } }, "billing": { + "plans": { + "sandboxHoursLeftResets_one": "{{count}} sandbox hour left · resets {{date}}", + "sandboxHoursLeftResets_other": "{{count}} sandbox hours left · resets {{date}}", + "seatsBilled_one": "{{count}} seat · {{billed}}", + "seatsBilled_other": "{{count}} seats · {{billed}}" + }, "sandboxHoursLeftCount_one": "{{count}} sandbox hour left", "sandboxHoursLeftCount_other": "{{count}} sandbox hours left", "sandboxHoursOverIncluded_one": "{{count}} sandbox hour over the included amount this month", @@ -2665,6 +2671,11 @@ "permissionOverridesKept_one": "{{count}} agent still uses their own permission setting:", "permissionOverridesKept_other": "{{count}} agents still use their own permission setting:" }, + "cloudConsole": { + "billing": { + "description": "Change your plan, see sandbox hours and invoices, and update payment." + } + }, "diagnostics": { "errors": { "creatingDisabled": "creating review files is disabled", diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index 7a0e41694f2..f1f7b07eaa3 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -1504,7 +1504,9 @@ "cloudConsole": { "manageInBrowser": "Manage in browser", "billing": { - "description": "Change your plan, see sandbox hours and invoices, and update payment." + "description": "Change your plan, see sandbox hours and invoices, and update payment.", + "descriptionPlans": "See your plan and compare plans, then change it, see invoices and update payment in your browser.", + "viewPlans": "View plans" }, "openFailed": "Couldn’t open the browser. Try again.", "teamAdmin": { @@ -21158,7 +21160,50 @@ "overage": { "turnOn": "Turn on with a {{cap}} cap", "turnOnNoCap": "Turn on overage" - } + }, + "plans": { + "annual": "Annual", + "savePercent": "Save {{value0}}%", + "billingPeriod": "Billing period", + "monthly": "Monthly", + "was": "Was", + "priceInBrowser": "See price in browser", + "perSeatPerMonth": "per seat per month", + "billedYearly": "Billed yearly", + "billedYearlyAmount2": "{{value0}} per seat, billed yearly", + "billedMonthly": "Billed monthly", + "seatsBilled_one": "{{count}} seat · {{billed}}", + "seatsBilled_other": "{{count}} seats · {{billed}}", + "continueInBrowser": "Continue in browser", + "askAdmin": "Ask a team admin to upgrade.", + "manageHint2": "Change seats or billing period, see invoices, or update payment.", + "continueHint": "Sign in on the web to choose seats and pay. One seat per team member.", + "currentPlan": "Current plan", + "entPriced2": "Priced for your team", + "contactSales": "Contact sales", + "entHint": "Tell us about your team and where you run.", + "sandboxHoursLeftResets_one": "{{count}} sandbox hour left · resets {{date}}", + "sandboxHoursLeftResets_other": "{{count}} sandbox hours left · resets {{date}}", + "trialUsedUpAdmin": "Your trial hours are used up. Choose a plan to keep your sandboxes running.", + "trialUsedUpMember": "Your team’s trial hours are used up. Ask a team admin to upgrade.", + "trialOneTime2": "Trial hours are a one-time allowance and don’t reset. Choose a plan any time.", + "loading": "Loading plans…", + "titleSubscribed": "Your Orca Cloud plan", + "titleNeutral": "Orca Cloud plans", + "title": "Cloud sandboxes for your whole team", + "subtitle2": "Run Orca agents in hosted sandboxes that keep going when you step away.", + "signedOut": "Sign in to Orca to see your team’s plan.", + "loadFailedTitle": "Plans didn’t load", + "loadFailedConsole": "Check your connection and try again, or see plans in your browser.", + "retry": "Try again", + "savedCopy": "Offline: plans as of {{date}}. Your browser shows current prices.", + "eyebrow": "Orca Cloud", + "subtitleSubscribed2": "Your plan, its sandbox hours, and what Enterprise adds." + }, + "sandboxHoursUsedLabel": "Sandbox hours used", + "sandboxHoursUsedMonth": "{{value0}} of {{value1}} sandbox hours used this month", + "trialProduct": "Orca Cloud", + "trialHoursUsedLabel": "Trial sandbox hours used" }, "ports": { "RuntimePortAutoForwarder": { diff --git a/src/renderer/src/lib/orca-cloud-session-events.ts b/src/renderer/src/lib/orca-cloud-session-events.ts index 7a2b667936f..fa63ee5a314 100644 --- a/src/renderer/src/lib/orca-cloud-session-events.ts +++ b/src/renderer/src/lib/orca-cloud-session-events.ts @@ -20,7 +20,7 @@ import { translate } from '@/i18n/i18n' import { useAppStore } from '@/store' import { findWorktreeById } from '@/store/github/refresh/worktree-refresh' import { runSleepWorktree } from '@/components/sidebar/workspace-actions/sleep/sleep-worktree-flow' -import { openCloudConsole } from '@/lib/orca-cloud/open-cloud-console' +import { openPlansDialog } from '@/components/billing/plans/plans-dialog-store' import { activateWorktreeFromSidebar } from '@/lib/workspace/activation/sidebar-worktree-activation' import { installOrcaCloudWorkspaceStore } from '@/lib/orca-cloud/orca-cloud-workspace-store' import { installCloudPredictiveWake } from '@/lib/orca-cloud/install-cloud-predictive-wake' @@ -125,7 +125,7 @@ export function showOrcaCloudPlanUpsell(message: string): void { toast.error(message, { action: { label: translate('auto.components.billing.comparePlans', 'Compare plans'), - onClick: () => void openCloudConsole('billing') + onClick: () => openPlansDialog() } }) } diff --git a/src/shared/orca-billing-plans.ts b/src/shared/orca-billing-plans.ts index cf7cc0169e9..686e1841704 100644 --- a/src/shared/orca-billing-plans.ts +++ b/src/shared/orca-billing-plans.ts @@ -10,6 +10,15 @@ export type OrcaPlanFeature = { text: string } +/** Billing's presentation copy for a plan (English); each field null when the catalog has none. */ +export type OrcaPlanMarketing = { + tagline: string | null + /** Heading over the feature list, e.g. "Everything in Team, plus:". */ + featuresLead: string | null + /** The plan card's button label. */ + ctaLabel: string | null +} + export type OrcaPlanPrice = { interval: OrcaBillingInterval unitAmountCents: number @@ -22,6 +31,7 @@ export type OrcaSelfServePlan = { name: string version: number features: OrcaPlanFeature[] + marketing: OrcaPlanMarketing | null /** Where "Contact us" goes for this plan (https), or null: fall back to the Enterprise contact. */ supportUrl: string | null /** Only intervals Stripe has a price for; empty when none is on sale. */ @@ -43,6 +53,7 @@ export type OrcaContactSalesPlan = { name: string version: number features: OrcaPlanFeature[] + marketing: OrcaPlanMarketing | null /** Where "Contact us" goes for this plan (https), or null: fall back to the Enterprise contact. */ supportUrl: string | null contactUrl: string | null @@ -56,6 +67,7 @@ export type OrcaOtherPlan = { name: string version: number features: OrcaPlanFeature[] + marketing: OrcaPlanMarketing | null /** Where "Contact us" goes for this plan (https), or null: fall back to the Enterprise contact. */ supportUrl: string | null }