{t('auto.components.billing.askAdmin2', 'Ask an owner or admin to change the plan.')}
diff --git a/src/renderer/src/components/billing/PlanStatusBadge.tsx b/src/renderer/src/components/billing/PlanStatusBadge.tsx
index 1e4ef4ff3ca..0ecb5be6ff0 100644
--- a/src/renderer/src/components/billing/PlanStatusBadge.tsx
+++ b/src/renderer/src/components/billing/PlanStatusBadge.tsx
@@ -32,6 +32,10 @@ export function planHealth(entitlement: OrcaBillingEntitlement, t: Translate): P
dot: 'warning'
}
}
+ if (entitlement.reason === 'trial_used_up') {
+ // Still the trial; the dot says it's used up and the line below says what to do.
+ return { label: t('auto.components.billing.statusTrial', 'Trial'), dot: 'warning' }
+ }
if (entitlement.cancelAtPeriodEnd) {
return { label: t('auto.components.billing.health.ending', 'Ending'), dot: 'warning' }
}
diff --git a/src/renderer/src/components/billing/TrialPlanSummary.tsx b/src/renderer/src/components/billing/TrialPlanSummary.tsx
new file mode 100644
index 00000000000..c70346e1ed0
--- /dev/null
+++ b/src/renderer/src/components/billing/TrialPlanSummary.tsx
@@ -0,0 +1,67 @@
+// The team's one-time trial (spec T1) in Plan & billing and on the plans page: a "Trial" badge,
+// the hours bar, and the one-time-allowance line. Never "Hours reset every month" here.
+import { Cloud } from 'lucide-react'
+import { Button } from '@/components/ui/button'
+import { Progress } from '@/components/ui/progress'
+import { useTranslate } from '@/i18n/use-translate'
+import type { OrcaBillingEntitlement } from '../../../../shared/orca-billing'
+import { includedUsagePercent } from './plan-billing-format'
+import { denyReasonCopy } from './plan-billing-copy'
+import {
+ includedUsageTone,
+ sandboxHoursLeftLine,
+ trialHoursUsedLine
+} from './plan-billing-usage-copy'
+import { PlanStatusBadge } from './PlanStatusBadge'
+
+export function TrialPlanSummary({
+ entitlement,
+ onChoosePlan
+}: {
+ entitlement: OrcaBillingEntitlement
+ /** Shown to owners and admins; omitted where the plan cards are already on screen. */
+ onChoosePlan?: () => void
+}): React.JSX.Element {
+ const t = useTranslate()
+ const usedUp = entitlement.trial?.exhausted === true
+ return (
+
+ {usedUp
+ ? denyReasonCopy('trial_used_up', t, entitlement.canManageBilling)
+ : t(
+ 'auto.components.billing.trialOneTime',
+ 'Trial hours are a one-time allowance and don’t reset. When they’re used up, choose a plan to keep going. No card needed until then.'
+ )}
+
+ )
+}
diff --git a/src/renderer/src/components/billing/claim-trial.ts b/src/renderer/src/components/billing/claim-trial.ts
new file mode 100644
index 00000000000..71bc4f2b6c7
--- /dev/null
+++ b/src/renderer/src/components/billing/claim-trial.ts
@@ -0,0 +1,19 @@
+// Starts the team's one-time Orca Cloud trial (spec N11/B1): the first time anyone on a team that
+// never had a plan or a trial picks Orca Cloud. Billing grants it at most once per team, user,
+// email and GitHub identity; the answer lands in the shared billing cache so every surface agrees.
+import type { OrcaBillingTrialClaimResult } from '../../../../shared/orca-billing'
+import { getBillingGeneration, recordBillingStatusIfCurrent } from './billing-summary-store'
+
+export async function claimOrcaCloudTrial(): Promise {
+ const generation = getBillingGeneration()
+ const result = await window.api.orcaProfiles
+ .billingClaimTrial()
+ .catch((error: unknown): OrcaBillingTrialClaimResult => ({
+ status: 'failed',
+ error: error instanceof Error ? error.message : String(error)
+ }))
+ if (result.status === 'ok') {
+ recordBillingStatusIfCurrent(generation, { status: 'ok', entitlement: result.entitlement })
+ }
+ return result
+}
diff --git a/src/renderer/src/components/billing/plan-billing-copy.ts b/src/renderer/src/components/billing/plan-billing-copy.ts
index 8dc87f0e4f5..d72d947c013 100644
--- a/src/renderer/src/components/billing/plan-billing-copy.ts
+++ b/src/renderer/src/components/billing/plan-billing-copy.ts
@@ -65,6 +65,26 @@ export function denyReasonCopy(
'auto.components.billing.reasonCapMember4',
'Spend cap reached. Running sandboxes go to sleep and new ones can’t start. Nothing is deleted, and your files are safe. Ask an owner or admin to raise the spend cap.'
)
+ case 'trial_used_up':
+ return canManage
+ ? t(
+ 'auto.components.billing.reasonTrialUsedUp2',
+ 'Your trial is used up. Running sandboxes go to sleep and new ones can’t start. Nothing is deleted, and your files are safe. Choose a plan to keep using Orca Cloud.'
+ )
+ : t(
+ 'auto.components.billing.reasonTrialUsedUpMember2',
+ 'Your team’s trial is used up. Running sandboxes go to sleep and new ones can’t start. Nothing is deleted, and your files are safe. Ask an owner or admin to choose a plan.'
+ )
+ case 'trial_unavailable':
+ return canManage
+ ? t(
+ 'auto.components.billing.reasonTrialUnavailable',
+ 'This account or team already used its trial. Choose a plan to use Orca Cloud.'
+ )
+ : t(
+ 'auto.components.billing.reasonTrialUnavailableMember',
+ 'This account or team already used its trial. Ask an owner or admin to choose a plan.'
+ )
}
}
@@ -73,6 +93,7 @@ export function statusLabel(status: string, t: Translate): string {
case 'active':
return t('auto.components.billing.statusActive', 'Active')
case 'trialing':
+ case 'trial':
return t('auto.components.billing.statusTrial', 'Trial')
case 'past_due':
return t('auto.components.billing.paymentFailed', 'Payment failed')
diff --git a/src/renderer/src/components/billing/plan-billing-fixtures.ts b/src/renderer/src/components/billing/plan-billing-fixtures.ts
index 696ede6ee78..ade923245df 100644
--- a/src/renderer/src/components/billing/plan-billing-fixtures.ts
+++ b/src/renderer/src/components/billing/plan-billing-fixtures.ts
@@ -48,3 +48,43 @@ export const sampleTeam: OrcaBillingEntitlement = {
canManageBilling: true,
offers: sampleOffers
}
+
+/** A team on its one-time trial: 2 sandbox hours, 0.6 used, no plan, no card. */
+export const sampleTrial: OrcaBillingEntitlement = {
+ ...sampleTeam,
+ plan: null,
+ planLabel: null,
+ status: 'trial',
+ interval: null,
+ seats: 0,
+ period: null,
+ usageWindow: null,
+ trial: {
+ includedSeconds: 2 * HOUR,
+ usedSeconds: 0.6 * HOUR,
+ remainingSeconds: 1.4 * HOUR,
+ exhausted: false,
+ grantedAt: Date.UTC(2026, 10, 10)
+ },
+ includedSeconds: 2 * HOUR,
+ usedSeconds: 0.6 * HOUR,
+ remainingIncludedSeconds: 1.4 * HOUR,
+ offers: { ...sampleOffers, trial: null }
+}
+
+/** The same team once its trial hours are used up. */
+export const sampleTrialUsedUp: OrcaBillingEntitlement = {
+ ...sampleTrial,
+ trial: {
+ includedSeconds: 2 * HOUR,
+ usedSeconds: 2 * HOUR,
+ remainingSeconds: 0,
+ exhausted: true,
+ grantedAt: Date.UTC(2026, 10, 10)
+ },
+ usedSeconds: 2 * HOUR,
+ remainingIncludedSeconds: 0,
+ usageWarningPercent: 100,
+ canStartSandbox: false,
+ reason: 'trial_used_up'
+}
diff --git a/src/renderer/src/components/billing/plan-billing-usage-copy.test.ts b/src/renderer/src/components/billing/plan-billing-usage-copy.test.ts
index 47749e67ede..7b66557ecdb 100644
--- a/src/renderer/src/components/billing/plan-billing-usage-copy.test.ts
+++ b/src/renderer/src/components/billing/plan-billing-usage-copy.test.ts
@@ -1,9 +1,14 @@
import { describe, expect, it } from 'vitest'
import { translate } from '@/i18n/i18n'
import type { OrcaBillingEntitlement } from '../../../../shared/orca-billing'
-import { sampleTeam } from './plan-billing-fixtures'
+import { sampleTeam, sampleTrial, sampleTrialUsedUp } from './plan-billing-fixtures'
+import { denyReasonCopy, statusLabel } from './plan-billing-copy'
+import { planHealth } from './PlanStatusBadge'
import {
+ accountMenuTrialRow,
accountMenuUsageLines,
+ trialHoursLeftHint,
+ trialHoursUsedLine,
includedUsageTone,
sandboxHoursCount,
sandboxHoursLeftLine,
@@ -132,3 +137,54 @@ describe('sandbox hours copy', () => {
expect(accountMenuUsageLines({ status: 'failed', error: 'offline' }, t, 'en')).toBeNull()
})
})
+
+describe('trial copy (spec T1, glossary "Trial")', () => {
+ it('counts the one-time trial hours without "this month"', () => {
+ expect(trialHoursUsedLine(sampleTrial, t)).toBe('0.6 of 2 sandbox hours used')
+ expect(trialHoursLeftHint(sampleTrial, t)).toBe('Trial · 1.4 sandbox hours left')
+ expect(trialHoursLeftHint({ ...sampleTrial, remainingIncludedSeconds: HOUR }, t)).toBe(
+ 'Trial · 1 sandbox hour left'
+ )
+ })
+
+ it('shows the account menu row to every member, Choose plan to owners and admins only', () => {
+ expect(accountMenuTrialRow({ status: 'ok', entitlement: sampleTrial }, t)).toEqual({
+ label: 'Trial · 1.4 sandbox hours left',
+ usedUp: false,
+ canChoosePlan: true
+ })
+ expect(
+ accountMenuTrialRow(
+ { status: 'ok', entitlement: { ...sampleTrial, canManageBilling: false } },
+ t
+ )
+ ).toMatchObject({ canChoosePlan: false })
+ expect(accountMenuTrialRow({ status: 'ok', entitlement: sampleTrialUsedUp }, t)).toMatchObject({
+ label: 'Your trial is used up',
+ usedUp: true
+ })
+ // Gone once a plan starts, and never for a team without a trial.
+ expect(accountMenuTrialRow({ status: 'ok', entitlement: sampleTeam }, t)).toBeNull()
+ expect(accountMenuTrialRow({ status: 'failed', error: 'x' }, t)).toBeNull()
+ // The plan's hours line stays off during a trial.
+ expect(accountMenuUsageLines({ status: 'ok', entitlement: sampleTrial }, t)).toBeNull()
+ })
+
+ it('labels the trial "Trial" and says what to do when it is used up or unavailable', () => {
+ expect(statusLabel('trial', t)).toBe('Trial')
+ expect(planHealth(sampleTrial, t)).toEqual({ label: 'Trial', dot: null })
+ expect(planHealth(sampleTrialUsedUp, t)).toEqual({ label: 'Trial', dot: 'warning' })
+ expect(denyReasonCopy('trial_used_up', t, true)).toBe(
+ 'Your trial is used up. Running sandboxes go to sleep and new ones can’t start. Nothing is deleted, and your files are safe. Choose a plan to keep using Orca Cloud.'
+ )
+ expect(denyReasonCopy('trial_used_up', t, false)).toBe(
+ 'Your team’s trial is used up. Running sandboxes go to sleep and new ones can’t start. Nothing is deleted, and your files are safe. Ask an owner or admin to choose a plan.'
+ )
+ expect(denyReasonCopy('trial_unavailable', t, true)).toBe(
+ 'This account or team already used its trial. Choose a plan to use Orca Cloud.'
+ )
+ expect(denyReasonCopy('trial_unavailable', t, false)).toBe(
+ 'This account or team already used its trial. Ask an owner or admin to choose a plan.'
+ )
+ })
+})
diff --git a/src/renderer/src/components/billing/plan-billing-usage-copy.ts b/src/renderer/src/components/billing/plan-billing-usage-copy.ts
index c19c5b7ee7f..54b3ca26c95 100644
--- a/src/renderer/src/components/billing/plan-billing-usage-copy.ts
+++ b/src/renderer/src/components/billing/plan-billing-usage-copy.ts
@@ -1,9 +1,10 @@
// Sandbox-hours lines shared by Plan & billing, the plans page and the account menu, so every
// surface counts, pluralizes and warns the same way.
import type { Translate } from '@/i18n/use-translate'
-import type {
- OrcaBillingEntitlement,
- OrcaBillingStatusResult
+import {
+ isOrcaCloudTrial,
+ type OrcaBillingEntitlement,
+ type OrcaBillingStatusResult
} from '../../../../shared/orca-billing'
import { usageAlertSentence } from '../../../../shared/orca-billing-usage-alerts'
import { includedUsagePercent } from './plan-billing-format'
@@ -82,3 +83,42 @@ export function accountMenuUsageLines(
warning: usageWarningLine(result.entitlement, t, locale)
}
}
+
+/** "0.6 of 2 sandbox hours used": the trial's hours never reset, so no "this month". */
+export function trialHoursUsedLine(entitlement: OrcaBillingEntitlement, t: Translate): string {
+ return t('auto.components.billing.trialHoursUsed', '{{used}} of {{count}} sandbox hours used', {
+ used: String(sandboxHoursCount(Math.min(entitlement.usedSeconds, entitlement.includedSeconds))),
+ count: sandboxHoursCount(entitlement.includedSeconds),
+ defaultValue_one: '{{used}} of {{count}} sandbox hour used'
+ })
+}
+
+/** "Trial · 1.4 sandbox hours left" (glossary hint), for the account menu and the composer. */
+export function trialHoursLeftHint(entitlement: OrcaBillingEntitlement, t: Translate): string {
+ return t('auto.components.billing.trialHoursLeft', 'Trial · {{count}} sandbox hours left', {
+ count: sandboxHoursCount(entitlement.remainingIncludedSeconds),
+ defaultValue_one: 'Trial · {{count}} sandbox hour left'
+ })
+}
+
+/**
+ * The account menu's trial row (spec T1): every member sees it while the team is on its trial;
+ * owners and admins also get Choose plan. Gone once a plan starts (the entitlement has no trial).
+ */
+export function accountMenuTrialRow(
+ result: OrcaBillingStatusResult | null,
+ t: Translate
+): { label: string; usedUp: boolean; canChoosePlan: boolean } | null {
+ if (result?.status !== 'ok' || !isOrcaCloudTrial(result.entitlement)) {
+ return null
+ }
+ const entitlement = result.entitlement
+ const usedUp = entitlement.trial?.exhausted === true
+ return {
+ label: usedUp
+ ? t('auto.components.billing.trialUsedUpTitle', 'Your trial is used up')
+ : trialHoursLeftHint(entitlement, t),
+ usedUp,
+ canChoosePlan: entitlement.canManageBilling
+ }
+}
diff --git a/src/renderer/src/components/billing/plans/PlansView.fixture.tsx b/src/renderer/src/components/billing/plans/PlansView.fixture.tsx
index c496a5b2947..d6b234599d4 100644
--- a/src/renderer/src/components/billing/plans/PlansView.fixture.tsx
+++ b/src/renderer/src/components/billing/plans/PlansView.fixture.tsx
@@ -1,6 +1,6 @@
import { defineFixture } from '../../../component-fixtures/component-fixture'
import type { OrcaBillingEntitlement } from '../../../../../shared/orca-billing'
-import { sampleTeam } from '../plan-billing-fixtures'
+import { sampleTeam, sampleTrial, sampleTrialUsedUp } from '../plan-billing-fixtures'
import { Dialog } from '@/components/ui/dialog'
import { PlansDialogContent } from './PlansDialogContent'
import type { PlansViewProps } from './PlansView'
@@ -125,3 +125,14 @@ export const currentPlanUsageWarning = defineFixture({
/>
)
})
+
+/** Spec T1: the plans page during the trial; the strip replaces the value props. */
+export const trialStrip = defineFixture({
+ width,
+ render: () =>
+})
+
+export const trialUsedUpStrip = defineFixture({
+ width,
+ render: () =>
+})
diff --git a/src/renderer/src/components/billing/plans/PlansView.tsx b/src/renderer/src/components/billing/plans/PlansView.tsx
index 13b5b709022..4a013f4efc8 100644
--- a/src/renderer/src/components/billing/plans/PlansView.tsx
+++ b/src/renderer/src/components/billing/plans/PlansView.tsx
@@ -5,6 +5,7 @@ import { Skeleton } from '@/components/ui/skeleton'
import { Progress } from '@/components/ui/progress'
import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
import {
+ isOrcaCloudTrial,
ORCA_BILLING_MAX_SEATS,
type OrcaBillingEntitlement,
type OrcaBillingInterval,
@@ -21,6 +22,7 @@ import {
sandboxHoursLeftLine,
usageWarningLine
} from '../plan-billing-usage-copy'
+import { TrialPlanSummary } from '../TrialPlanSummary'
import { EnterprisePlanCard } from './EnterprisePlanCard'
import { PlansIntervalToggle } from './PlansIntervalToggle'
import { TeamPlanCard, type TeamPlanCardMode } from './TeamPlanCard'
@@ -285,6 +287,11 @@ export function PlansView(props: PlansViewProps): React.JSX.Element {
/>
>
+ ) : isOrcaCloudTrial(entitlement) ? (
+ // The trial's strip: the plan cards right below are the way out of it (spec T1).
+
+
+
) : (
)}
diff --git a/src/renderer/src/components/sidebar/account-menu/SidebarAccountMenu.tsx b/src/renderer/src/components/sidebar/account-menu/SidebarAccountMenu.tsx
index b7e1597a75f..0be718f3e6f 100644
--- a/src/renderer/src/components/sidebar/account-menu/SidebarAccountMenu.tsx
+++ b/src/renderer/src/components/sidebar/account-menu/SidebarAccountMenu.tsx
@@ -18,6 +18,7 @@ import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
import { cn } from '@/lib/utils'
import { useBillingState } from '../../billing/billing-summary-store'
import { accountMenuUsageLines } from '../../billing/plan-billing-usage-copy'
+import { AccountMenuTrialRow } from '../../billing/AccountMenuTrialRow'
import { SidebarTeamSubmenu } from './SidebarTeamSubmenu'
import { useSetupGuideProgress } from '../../setup-guide/use-setup-guide-progress'
import { getAccountMenuIdentity, type AccountMenuIdentity } from './account-menu-identity'
@@ -71,7 +72,8 @@ export function SidebarAccountMenu(): React.JSX.Element {
const identity = getAccountMenuIdentity(authStatus)
// The team is named once, on the switcher below; the header carries the plan's hours instead.
- const usage = accountMenuUsageLines(useBillingState().result, t, locale)
+ const billingResult = useBillingState().result
+ const usage = accountMenuUsageLines(billingResult, t, locale)
const visibleItems = selectVisibleAccountMenuItems(registeredItems, authStatus)
// Freeze the item list while the menu is open: a billing answer arriving mid-read must not
// swap rows under the pointer (e.g. Upgrade replacing Plan & billing).
@@ -211,6 +213,7 @@ export function SidebarAccountMenu(): React.JSX.Element {
+ {identity.signedIn ? : null}
>
) : null}
diff --git a/src/renderer/src/i18n/en-runtime-required.json b/src/renderer/src/i18n/en-runtime-required.json
index 022b4961979..5ea645e29d3 100644
--- a/src/renderer/src/i18n/en-runtime-required.json
+++ b/src/renderer/src/i18n/en-runtime-required.json
@@ -247,7 +247,11 @@
},
"teamUsedAllOverageOff": "Your team has used all of this month’s sandbox hours. Running sandboxes go to sleep and new ones can’t start. Turn on overage to keep going.",
"teamUsedAllOverageOn": "Your team has used all of this month’s sandbox hours. Overage is on, up to your {{cap}} spend cap.",
- "teamUsedPercent": "Your team has used {{percent}}% of this month’s sandbox hours."
+ "teamUsedPercent": "Your team has used {{percent}}% of this month’s sandbox hours.",
+ "trialHoursLeft_one": "Trial · {{count}} sandbox hour left",
+ "trialHoursLeft_other": "Trial · {{count}} sandbox hours left",
+ "trialHoursUsed_one": "{{used}} of {{count}} sandbox hour used",
+ "trialHoursUsed_other": "{{used}} of {{count}} sandbox hours used"
},
"browser-pane": {
"markup": {
diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json
index 4bbdb126632..fb9af10ad44 100644
--- a/src/renderer/src/i18n/locales/en.json
+++ b/src/renderer/src/i18n/locales/en.json
@@ -20738,7 +20738,21 @@
"teamUsedAllOverageOff": "Your team has used all of this month’s sandbox hours. Running sandboxes go to sleep and new ones can’t start. Turn on overage to keep going.",
"teamUsedAllOverageOn": "Your team has used all of this month’s sandbox hours. Overage is on, up to your {{cap}} spend cap.",
"teamUsedPercent": "Your team has used {{percent}}% of this month’s sandbox hours.",
- "usageAlertsNote": "Owners and admins are alerted in Orca at 75%, 90% and 100% of your team’s sandbox hours."
+ "usageAlertsNote": "Owners and admins are alerted in Orca at 75%, 90% and 100% of your team’s sandbox hours.",
+ "choosePlan": "Choose plan",
+ "reasonTrialUnavailable": "This account or team already used its trial. Choose a plan to use Orca Cloud.",
+ "reasonTrialUnavailableMember": "This account or team already used its trial. Ask an owner or admin to choose a plan.",
+ "reasonTrialUsedUp2": "Your trial is used up. Running sandboxes go to sleep and new ones can’t start. Nothing is deleted, and your files are safe. Choose a plan to keep using Orca Cloud.",
+ "reasonTrialUsedUpMember2": "Your team’s trial is used up. Running sandboxes go to sleep and new ones can’t start. Nothing is deleted, and your files are safe. Ask an owner or admin to choose a plan.",
+ "trialHoursLeft_one": "Trial · {{count}} sandbox hour left",
+ "trialHoursLeft_other": "Trial · {{count}} sandbox hours left",
+ "trialHoursUsed_one": "{{used}} of {{count}} sandbox hour used",
+ "trialHoursUsed_other": "{{used}} of {{count}} sandbox hours used",
+ "trialHoursUsedLabel": "Trial sandbox hours used",
+ "trialOneTime": "Trial hours are a one-time allowance and don’t reset. When they’re used up, choose a plan to keep going. No card needed until then.",
+ "trialProduct": "Orca Cloud",
+ "trialRowChoosePlan": "{{trial}}. Choose plan",
+ "trialUsedUpTitle": "Your trial is used up"
},
"ports": {
"RuntimePortAutoForwarder": {
diff --git a/src/renderer/src/web/preload-api/web-orca-profiles-api.ts b/src/renderer/src/web/preload-api/web-orca-profiles-api.ts
index 94e8cb2fe87..33e3bdf3c72 100644
--- a/src/renderer/src/web/preload-api/web-orca-profiles-api.ts
+++ b/src/renderer/src/web/preload-api/web-orca-profiles-api.ts
@@ -82,7 +82,8 @@ export function createWebOrcaProfilesApi(): Partial {
cloudSetupLink: async () => ({ status: 'unconfigured' }),
billingOpenPortal: async () => ({ status: 'unconfigured' }),
billingTeamPlans: async () => ({ status: 'unconfigured' }),
- billingSetOverage: async () => ({ status: 'unconfigured' })
+ billingSetOverage: async () => ({ status: 'unconfigured' }),
+ billingClaimTrial: async () => ({ status: 'unconfigured' })
}
}
}
diff --git a/src/shared/orca-billing-denial.test.ts b/src/shared/orca-billing-denial.test.ts
index 3202b13ede2..c6295fea0b0 100644
--- a/src/shared/orca-billing-denial.test.ts
+++ b/src/shared/orca-billing-denial.test.ts
@@ -15,6 +15,11 @@ describe('classifyEntitlementDenial', () => {
expect(classifyEntitlementDenial('machine_size_not_in_plan')).toBe('machineSize')
})
+ it('treats both trial reasons as needing a plan', () => {
+ expect(classifyEntitlementDenial('trial_used_up')).toBe('plan')
+ expect(classifyEntitlementDenial('trial_unavailable')).toBe('plan')
+ })
+
it('falls back to other for unknown or missing reasons', () => {
expect(classifyEntitlementDenial('something_new')).toBe('other')
expect(classifyEntitlementDenial(undefined)).toBe('other')
diff --git a/src/shared/orca-billing.ts b/src/shared/orca-billing.ts
index 41c4ebc21cc..5085876a7ce 100644
--- a/src/shared/orca-billing.ts
+++ b/src/shared/orca-billing.ts
@@ -15,6 +15,10 @@ export type OrcaBillingDenyReason =
| 'payment_grace_expired'
| 'included_hours_exhausted'
| 'overage_cap_reached'
+ /** The team's one-time trial hours are used up (no plan yet). */
+ | 'trial_used_up'
+ /** The team never had a plan and can't get a trial (one was already used by this account or team). */
+ | 'trial_unavailable'
/**
* What a plan refusal means, whatever surface shows it. Billing's account reasons plus the control
@@ -34,11 +38,14 @@ export type OrcaEntitlementDenialKind =
export function classifyEntitlementDenial(
reason: string | null | undefined
): OrcaEntitlementDenialKind {
- // 'no plan' is the hosted provider's older log line for a missing plan.
+ // 'no plan' is the hosted provider's older log line for a missing plan. Both trial reasons are
+ // fixed by choosing a plan, so they read as "needs a plan" everywhere.
switch (reason) {
case 'no_subscription':
case 'subscription_inactive':
case 'no plan':
+ case 'trial_used_up':
+ case 'trial_unavailable':
return 'plan'
case 'included_hours_exhausted':
return 'hours'
@@ -81,6 +88,17 @@ export type OrcaBillingOffers = {
maxSpendCapCents: number | null
}
enterprise: { label: string; priceLabel: string; contactUrl: string }
+ /** The one-time trial this caller could still start for the team; null when none is on offer. */
+ trial?: { includedSeconds: number } | null
+}
+
+/** The team's one-time trial (no card, no Stripe). Hours don't reset; a plan ends it. */
+export type OrcaBillingTrial = {
+ includedSeconds: number
+ usedSeconds: number
+ remainingSeconds: number
+ exhausted: boolean
+ grantedAt: number
}
export type OrcaBillingEntitlement = {
@@ -96,6 +114,11 @@ export type OrcaBillingEntitlement = {
/** Monthly window the hours count against (a slice of the year on annual plans). */
usageWindow: { start: number; end: number } | null
cancelAtPeriodEnd: boolean
+ /**
+ * The trial while it is the team's plan (status 'trial'); null otherwise. During a trial,
+ * includedSeconds/usedSeconds/remainingIncludedSeconds mirror it and concurrency is 1.
+ */
+ trial?: OrcaBillingTrial | null
includedSeconds: number
usedSeconds: number
remainingIncludedSeconds: number
@@ -175,6 +198,23 @@ export type OrcaBillingTeamPlansResult =
/** At most this many teams per lookup (the billing Worker's bound). */
export const ORCA_BILLING_TEAM_PLANS_MAX_ORGS = 10
+/** The team is on its one-time trial (used up or not), with no plan. */
+export function isOrcaCloudTrial(
+ entitlement: Pick | null | undefined
+): boolean {
+ return entitlement?.trial != null && entitlement.status === 'trial'
+}
+
+export type OrcaBillingTrialClaimResult =
+ | { status: 'ok'; entitlement: OrcaBillingEntitlement }
+ | { status: 'unconfigured' }
+ | { status: 'signed-out' }
+ /** The trial can't be granted (abuse limits, already used, or the team had a plan). */
+ | { status: 'unavailable' }
+ /** A personal account: setup creates a team first (O1). */
+ | { status: 'team-required' }
+ | { status: 'failed'; error: string }
+
export function isOrcaBillingPlanId(value: unknown): value is OrcaBillingPlanId {
return ORCA_BILLING_PLAN_IDS.some((plan) => plan === value)
}
From 3d111a3908120ee486c104def99f852a62c64d04 Mon Sep 17 00:00:00 2001
From: Neil
Date: Tue, 10 Nov 2026 06:13:34 -0800
Subject: [PATCH 2/2] test(billing): pass the locale to accountMenuUsageLines
(usage-alerts signature)
---
.../src/components/billing/plan-billing-usage-copy.test.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/renderer/src/components/billing/plan-billing-usage-copy.test.ts b/src/renderer/src/components/billing/plan-billing-usage-copy.test.ts
index 7b66557ecdb..b3201d77bca 100644
--- a/src/renderer/src/components/billing/plan-billing-usage-copy.test.ts
+++ b/src/renderer/src/components/billing/plan-billing-usage-copy.test.ts
@@ -167,7 +167,7 @@ describe('trial copy (spec T1, glossary "Trial")', () => {
expect(accountMenuTrialRow({ status: 'ok', entitlement: sampleTeam }, t)).toBeNull()
expect(accountMenuTrialRow({ status: 'failed', error: 'x' }, t)).toBeNull()
// The plan's hours line stays off during a trial.
- expect(accountMenuUsageLines({ status: 'ok', entitlement: sampleTrial }, t)).toBeNull()
+ expect(accountMenuUsageLines({ status: 'ok', entitlement: sampleTrial }, t, 'en-US')).toBeNull()
})
it('labels the trial "Trial" and says what to do when it is used up or unavailable', () => {