Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
feat(spaces): contextual Pro and Teams limit cards behind the upsell_cards flag (#5952)
cua-agents[bot]e3d0e5291e56
diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo.ts b/apps/cua-spaces-web/src/bridge/adapters/demo.tsindex ae710cf0fd..c7d900db0b 100644--- a/apps/cua-spaces-web/src/bridge/adapters/demo.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/demo.ts@@ -72,6 +72,10 @@ export interface DemoOptions {noVault?: boolean;/** Start with no Spaces (the first-Space empty state). */noSpaces?: boolean;+ /** An account in no team (`?demo=no-team`): Share explains that sharing is for teams. */+ noTeam?: boolean;+ /** A team with no free computers (`?demo=team-full`): adding a machine to it is refused, as the control plane does at one computer per seat. Simulated: the demo has no control plane. */+ teamFull?: boolean;/** Start at the macOS Keychain prompt (the startup screen). */keychain?: boolean;/** Answer New Space's options as the SwiftUI host does (`demo/new-space.ts`). */@@ -111,7 +115,7 @@ export const DEMO_CREATE_FAILURES = {const DEMO_NOTES = "https://github.com/trycua/cua/releases/tag/cua-spaces-v0.9.3";-/** `?demo=fresh` (signed out, first run), `?demo=slow` (slow answers), `?demo=locked` (Keyvault locked), `?demo=novault` (no Keyvault yet),+/** `?demo=fresh` (signed out, first run), `?demo=no-team`, `?demo=team-full`, `?demo=slow` (slow answers), `?demo=locked` (Keyvault locked), `?demo=novault` (no Keyvault yet),* `?demo=empty` (no Spaces yet), `?demo=keychain` (the startup screen),* `?demo=mac-host` (New Space options and the Keyvault's Settings rows in the* SwiftUI host's shape), `?demo=unenrolled` (this device not enrolled),@@ -127,6 +131,8 @@ export function demoOptionsFromSearch(search: string): DemoOptions {keyvaultLocked: flags.has("locked"),noVault: flags.has("novault"),noSpaces: flags.has("empty"),+ noTeam: flags.has("no-team"),+ teamFull: flags.has("team-full"),keychain: flags.has("keychain"),macHost: flags.has("mac-host"),unenrolled: flags.has("unenrolled"),@@ -602,12 +608,13 @@ export function createDemoAdapter(options: DemoOptions = {}): DataAdapter & { re},...newSpaceDemoHandlers({ state, wait, emit, step, now }),...demoTeleportHandlers({ wait, emit, now, stepMs: step }),- ...demoShareHandlers({ wait, stepMs: step }),+ ...demoShareHandlers({ wait, stepMs: step, teamFull: options.teamFull }),...demoAgentDetailHandlers({ wait, stepMs: step, now }),...demoAgentKeysHandlers({ wait, stepMs: step, now }),...demoVolumeHandlers({ state: state.volume, now, wait, step, emit, platform: state.platform }),...createDemoSettings({ now, wait, emit, stepMs: step, platform: state.platform, unenrolled: options.unenrolled, update: options.update, experiments: state.volume.experiments, signedIn: () => Boolean(state.identity), settings: () => state.settings, setSettings: (p) => ((state.settings = { ...state.settings, ...p }), emit({ type: "settings.changed" })), addMachine: (m) => ((state.paired = [...state.paired, m]), emit({ type: "machines.changed" })) }),...demoTelemetryHandlers(ctx),+ ...(options.noTeam ? { "teams.list": () => ({ teams: [], currentTeamId: null }) } : {}),...demoRelayUsageHandlers(ctx),...demoLinksHandlers(ctx),"nudges.pending": () => risky.filter((r) => r.expiresMs > now()).map((r) => ({ ...r })),diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo/share.ts b/apps/cua-spaces-web/src/bridge/adapters/demo/share.tsindex 8d148697ef..bedf53afa0 100644--- a/apps/cua-spaces-web/src/bridge/adapters/demo/share.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/demo/share.ts@@ -13,12 +13,14 @@ export function demoShares(): Map<string, ShareEntry[]> {return new Map([["local:design-review", [{ who: "[email protected]", role: "editor", connected: true }]]]);}-export function demoShareHandlers({ wait, stepMs }: { wait(ms: number): Promise<void>; stepMs: number }): ShareHandlers {+export function demoShareHandlers({ wait, stepMs, teamFull }: { wait(ms: number): Promise<void>; stepMs: number; teamFull?: boolean }): ShareHandlers {const shares = demoShares();const list = (spaceId: string) => (shares.get(spaceId) ?? []).map((s) => ({ ...s }));return {"sharing.list": async ({ spaceId }) => list(spaceId),"sharing.share": async ({ spaceId, who, role }) => {+ // `?demo=team-full`: the owner's refusal when a team has a computer per seat.+ if (teamFull && who.startsWith("team:")) throw new Error("Your team has as many computers as it has seats. https://app.cua.ai/buy/teams");// The daemon asks for presence before the relay hears of it.await wait(stepMs);const rest = (shares.get(spaceId) ?? []).filter((s) => s.who !== who);diff --git a/apps/cua-spaces-web/src/bridge/flags.ts b/apps/cua-spaces-web/src/bridge/flags.tsnew file mode 100644index 0000000000..1781491e11--- /dev/null+++ b/apps/cua-spaces-web/src/bridge/flags.ts@@ -0,0 +1,82 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++/**+ * Feature flags for the web UI. A flag is off unless something turns it on,+ * in this order:+ *+ * 1. this device's override (`localStorage` `cua.flag.<name>` = `1` or `0`),+ * which is how a dev build or a tester forces one;+ * 2. the build's default (`VITE_CUA_FLAG_<NAME>` = `1`);+ * 3. the remote value, when a source has set one (`setRemoteFlags`: the+ * PostHog feature-flag payload, once the shells pass it in);+ * 4. off.+ *+ * A flag only decides what the UI draws. Plans and limits are enforced by the+ * relay and the control plane, never by a flag.+ */++import { useSyncExternalStore } from "react";++/** `upsell_cards`: the cards that offer Pro or Teams when a limit stops you. */+export type FlagName = "upsell_cards";++const DEFAULTS: Record<FlagName, boolean> = { upsell_cards: false };++const key = (name: FlagName) => `cua.flag.${name}`;+let remote: Partial<Record<FlagName, boolean>> = {};+const listeners = new Set<() => void>();+const notify = () => {+ for (const l of [...listeners]) l();+};++/** Takes the remote flag values (replacing the last ones). */+export function setRemoteFlags(values: Partial<Record<FlagName, boolean>>): void {+ remote = { ...values };+ notify();+}++/** Forces a flag on this device (`null` clears the override). */+export function setFlagOverride(name: FlagName, on: boolean | null): void {+ try {+ if (on === null) globalThis.localStorage?.removeItem(key(name));+ else globalThis.localStorage?.setItem(key(name), on ? "1" : "0");+ } catch {+ // Not kept.+ }+ notify();+}++function envDefault(name: FlagName): boolean | undefined {+ const v = (import.meta.env as Record<string, string | undefined>)[`VITE_CUA_FLAG_${name.toUpperCase()}`];+ return v === undefined || v === "" ? undefined : v === "1" || v === "true";+}++/** Whether a flag is on now. */+export function flagOn(name: FlagName): boolean {+ let local: string | null = null;+ try {+ local = globalThis.localStorage?.getItem(key(name)) ?? null;+ } catch {+ // No storage: no override.+ }+ if (local === "1") return true;+ if (local === "0") return false;+ return envDefault(name) ?? remote[name] ?? DEFAULTS[name];+}++const subscribe = (l: () => void) => {+ listeners.add(l);+ const onStorage = (e: StorageEvent) => {+ if (e.key === null || e.key.startsWith("cua.flag.")) l();+ };+ globalThis.addEventListener?.("storage", onStorage);+ return () => {+ listeners.delete(l);+ globalThis.removeEventListener?.("storage", onStorage);+ };+};++export function useFlag(name: FlagName): boolean {+ return useSyncExternalStore(subscribe, () => flagOn(name), () => DEFAULTS[name]);+}diff --git a/apps/cua-spaces-web/src/bridge/index.ts b/apps/cua-spaces-web/src/bridge/index.tsindex 3652016ea0..4d4fb24ee5 100644--- a/apps/cua-spaces-web/src/bridge/index.ts+++ b/apps/cua-spaces-web/src/bridge/index.ts@@ -170,12 +170,18 @@ export {resetUpsellMemory,useQuiet,useTrackPlanClick,+ useUpsellCard,+ useUpsellCardAvailable,useUpsellGate,useUpsellPrompt,+ type UpsellCard,+ type UpsellCardReason,+ type UpsellCardState,type UpsellGate,type UpsellPrompt,type UpsellSurface,} from "./upsell";+export { flagOn, setFlagOverride, setRemoteFlags, useFlag, type FlagName } from "./flags";export type { CreateReport, ReportPart, ReportSend } from "./diagnostic-report";export {FIRST_RUN_POLL_MS,diff --git a/apps/cua-spaces-web/src/bridge/upsell.ts b/apps/cua-spaces-web/src/bridge/upsell.tsindex 07626a4cab..d60fa4c75c 100644--- a/apps/cua-spaces-web/src/bridge/upsell.ts+++ b/apps/cua-spaces-web/src/bridge/upsell.ts@@ -16,11 +16,15 @@import { useCallback, useContext, useEffect, useRef, useState, useSyncExternalStore } from "react";import { BridgeContext } from "./BridgeProvider";+import { useFlag } from "./flags";import { useAgents, useSettings } from "./hooks";import type { RelayUsage } from "./ops/relay-usage";import { useRelayUsage } from "./relay-usage";+import type { CoreClient } from "./core";export type UpsellSurface = "meter" | "share" | "machine";+/** What stopped the person, for a limit card (`upsell.card`). */+export type UpsellCardReason = "hours" | "sessions" | "invite" | "seats" | "machines";export type UpsellAction = "shown" | "click" | "dismiss";/** `upsell::UpsellPrompt`. */@@ -93,14 +97,18 @@ export function useQuiet(): boolean {return (usage?.liveSessions ?? 0) > 0 || (agents.data?.runs ?? []).some((r) => r.status === "running");}-function useTrack(): (surface: UpsellSurface | "plan_card" | "account_menu", action: UpsellAction) => void {+type TrackSurface = UpsellSurface | "plan_card" | "account_menu" | `card_${UpsellCardReason}`;++/** Counts the event; false when it could not be (no store yet). */+function useTrack(): (surface: TrackSurface, action: UpsellAction) => boolean {const ctx = useContext(BridgeContext);return useCallback((surface, action) => {const store = ctx?.store;- if (!store) return;+ if (!store) return false;const signals = ctx.core.tryCall<unknown[]>("telemetry.upsell", { surface, action });if (signals?.length) void store.telemetry.track(signals);+ return true;},[ctx],);@@ -182,3 +190,73 @@ export function useUpsellPrompt(surface: "share" | "machine", usage: RelayUsage}) ?? null);}++/** `upsell::UpsellCard`. */+export interface UpsellCard {+ reason: UpsellCardReason;+ title: string;+ body: string;+ price: string;+ cta: { label: string; url: string };+ /** "Not now". */+ dismiss: string;+}++function cardFor(core: CoreClient, reason: UpsellCardReason, usage: Partial<RelayUsage> | null, accountApp: string | null): UpsellCard | null {+ return (+ core.tryCall<UpsellCard | null>("upsell.card", {+ reason,+ usage: { plan: "free", ...usage },+ ...(accountApp ? { accountApp } : {}),+ }) ?? null+ );+}++/** Whether the flag is on and the core has a card for `reason` on this plan (draws and counts nothing). */+export function useUpsellCardAvailable(reason: UpsellCardReason | null, usage: Partial<RelayUsage> | null): boolean {+ const core = useContext(BridgeContext)?.core;+ const on = useFlag("upsell_cards");+ const accountApp = useSettings().data?.accountUrl ?? null;+ return Boolean(on && core && reason && cardFor(core, reason, usage, accountApp));+}++export interface UpsellCardState {+ /** The card to draw now; null when the flag is off, there is nothing to+ * offer, the core is missing or it was closed. */+ card: UpsellCard | null;+ click(): void;+ dismiss(): void;+}++/**+ * The limit card for `reason`: what happened, what the plan gives, the price,+ * Upgrade and Not now. It is for the moment a limit stops the person, so it+ * is behind the `upsell_cards` flag (off unless turned on) and does not wait+ * for the 3-day gap. `reason` null: no limit here. `usage` carries the plan+ * (none known: Free). Events: `upsell_card_<reason>_shown | click | dismiss`,+ * `shown` once per card drawn.+ */+export function useUpsellCard(reason: UpsellCardReason | null, usage: Partial<RelayUsage> | null): UpsellCardState {+ const ctx = useContext(BridgeContext);+ const core = ctx?.core;+ const on = useFlag("upsell_cards");+ const accountApp = useSettings().data?.accountUrl ?? null;+ const track = useTrack();+ const [closed, setClosed] = useState<UpsellCardReason | null>(null);+ const shown = useRef<UpsellCardReason | null>(null);+ const card = on && core && reason && closed !== reason ? cardFor(core, reason, usage, accountApp) : null;+ const shownReason = card?.reason ?? null;+ useEffect(() => {+ if (!shownReason || shown.current === shownReason) return;+ if (track(`card_${shownReason}`, "shown")) shown.current = shownReason;+ }, [shownReason, track]);+ return {+ card,+ click: () => reason && track(`card_${reason}`, "click"),+ dismiss: () => {+ if (!reason) return;+ track(`card_${reason}`, "dismiss");+ setClosed(reason);+ },+ };+}diff --git a/apps/cua-spaces-web/src/components/__tests__/add-machine-dialog.test.tsx b/apps/cua-spaces-web/src/components/__tests__/add-machine-dialog.test.tsxindex e90437cfec..7650a82b97 100644--- a/apps/cua-spaces-web/src/components/__tests__/add-machine-dialog.test.tsx+++ b/apps/cua-spaces-web/src/components/__tests__/add-machine-dialog.test.tsx@@ -4,13 +4,16 @@import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";import { afterEach, describe, expect, it } from "vitest";-import { BridgeProvider, expiresInText, useMachines } from "@/bridge";+import { BridgeProvider, expiresInText, setFlagOverride, useMachines } from "@/bridge";import { HostError, type DataAdapter } from "@/bridge/adapter";import { createDemoAdapter, type DemoOptions } from "@/bridge/adapters/demo";import { unavailableCore } from "@/bridge/core";import { AddMachineDialog } from "@/components/add-machine-dialog";-afterEach(cleanup);+afterEach(() => {+ cleanup();+ localStorage.clear();+});/** The demo host, with some operations answered differently, recording the pairing calls. */function host(options: DemoOptions = {}, override: Record<string, (args: Record<string, unknown>) => Promise<unknown>> = {}) {@@ -41,9 +44,20 @@ function Harness({ team = null }: { team?: string | null }) {);}-async function mount(adapter: DataAdapter, team: string | null = null) {+async function mount(adapter: DataAdapter, team: string | null = null, withCards = false) {+ const none = unavailableCore("test: no core");+ // The core's `upsell.card`, as one fixed card per reason.+ const core = withCards+ ? {+ ...none,+ tryCall: (<T,>(method: string, args: Record<string, unknown> = {}) =>+ method === "upsell.card"+ ? ({ reason: args.reason, title: "Your team is out of seats", body: "Add a seat.", price: "$30 a seat a month", cta: { label: "Add seats", url: "https://app.cua.ai/billing" }, dismiss: "Not now" } as T)+ : undefined) as typeof none.tryCall,+ }+ : none;render(- <BridgeProvider adapter={adapter} core={unavailableCore("test: no core")}>+ <BridgeProvider adapter={adapter} core={core}><Harness team={team} /></BridgeProvider>,);@@ -274,4 +288,18 @@ describe("expiresInText", () => {expect(expiresInText(100, 50_000)).toBe("Expires in 50 s");expect(expiresInText(100, 200_000)).toBe("Expires in 0 s");});++ it("with the upsell cards on, an owner out of seats gets the card, and a member does not", async () => {+ setFlagOverride("upsell_cards", true);+ const org = "0f1e2d3c-0000-4000-8000-000000000001";+ const { adapter } = host({}, { "sharing.share": () => Promise.reject(new Error("Your team has no free seats. https://app.cua.ai/buy/teams")) });+ await mount(adapter, org, true);+ await waitFor(() => expect(document.querySelector('[data-upgrade-card="seats"]')).toBeTruthy(), { timeout: 3000 });+ expect(document.querySelector("[data-pairing-upgrade]")).toBeNull();+ cleanup();+ const member = host({}, { "sharing.share": () => Promise.reject(new Error("Your team has no free seats. Ask the team owner to add seats.")) });+ await mount(member.adapter, org, true);+ await waitFor(() => expect(document.querySelector('[data-pairing-team="failed"]')).toBeTruthy(), { timeout: 3000 });+ expect(document.querySelector("[data-upgrade-card]")).toBeNull();+ });});diff --git a/apps/cua-spaces-web/src/components/__tests__/share-sheet-teams.test.tsx b/apps/cua-spaces-web/src/components/__tests__/share-sheet-teams.test.tsxindex 3ebb0a3d89..acff059d5e 100644--- a/apps/cua-spaces-web/src/components/__tests__/share-sheet-teams.test.tsx+++ b/apps/cua-spaces-web/src/components/__tests__/share-sheet-teams.test.tsx@@ -4,14 +4,17 @@import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";import { afterEach, describe, expect, it } from "vitest";-import { BridgeProvider, defaultTeam, eligibleTeams, useShareSheet } from "@/bridge";+import { BridgeProvider, defaultTeam, eligibleTeams, setFlagOverride, useShareSheet } from "@/bridge";import type { DataAdapter } from "@/bridge/adapter";import { createDemoAdapter } from "@/bridge/adapters/demo";import type { CoreClient } from "@/bridge/core";import type { ShareInput, ShareSheetAction, ShareSheetState } from "@/bridge/contracts/share";import ShareSheet from "@/components/share-sheet";-afterEach(cleanup);+afterEach(() => {+ cleanup();+ localStorage.clear();+});const ACME = "0f1e2d3c-0000-4000-8000-0000000000a1";const TEAMS = {@@ -82,6 +85,19 @@ function shareCore(): CoreClient {return { status: "ready", methods: ["share.initial", "share.reduce", "share.view", "share.gate"], call, tryCall };}+/** The share core, plus the core's `upsell.card` for an invite. */+function cardCore(): CoreClient {+ const core = shareCore();+ const tryCall = core.tryCall;+ return {+ ...core,+ tryCall: (<T,>(method: string, args: Record<string, unknown> = {}) =>+ method === "upsell.card"+ ? ({ reason: args.reason, title: "Sharing is for teams", body: "Teams lets you share a Space.", price: "$30 a seat a month", cta: { label: "Start a team", url: "https://app.cua.ai/buy/teams?from=app_card_invite" }, dismiss: "Not now" } as T)+ : tryCall<T>(method, args)) as CoreClient["tryCall"],+ };+}+function host(teams: typeof TEAMS | Record<string, never> = TEAMS) {const base = createDemoAdapter({ latencyMs: 0, stepMs: 0, signedIn: true, onboarded: true });const shared: Record<string, unknown>[] = [];@@ -161,4 +177,31 @@ describe("Teams in Share and Add a machine", () => {expect((document.querySelector("[data-share-who]") as HTMLInputElement).disabled).toBe(true);expect(screen.getByText("See Teams")).toBeTruthy();});++ it("with the upsell cards on, an account with no team gets the card in place of the plain gate", async () => {+ setFlagOverride("upsell_cards", true);+ const opened: string[] = [];+ const { adapter } = host({ teams: [], currentTeamId: null } as never);+ const base = adapter.call as (o: string, a: unknown) => Promise<unknown>;+ (adapter as { call: unknown }).call = (op: string, args: Record<string, unknown>) => {+ if (op === "session.openExternal") {+ opened.push(String(args.url));+ return Promise.resolve(null);+ }+ return base(op, args);+ };+ render(+ <BridgeProvider adapter={adapter} core={cardCore()}>+ <Opener />+ <ShareSheet />+ </BridgeProvider>,+ );+ await act(() => new Promise((r) => setTimeout(r, 10)));+ fireEvent.click(screen.getByText("open"));+ await waitFor(() => expect(document.querySelector('[data-upgrade-card="invite"]')).toBeTruthy());+ expect(document.querySelector("[data-share-disabled]")).toBeNull();+ expect(document.querySelector("[data-share-action]")).toBeNull();+ fireEvent.click(screen.getByRole("button", { name: "Start a team" }));+ await waitFor(() => expect(opened).toEqual(["https://app.cua.ai/buy/teams?from=app_card_invite"]));+ });});diff --git a/apps/cua-spaces-web/src/components/add-machine-dialog.tsx b/apps/cua-spaces-web/src/components/add-machine-dialog.tsxindex 99c2efc3bb..107cce0617 100644--- a/apps/cua-spaces-web/src/components/add-machine-dialog.tsx+++ b/apps/cua-spaces-web/src/components/add-machine-dialog.tsx@@ -5,12 +5,13 @@ import { CheckIcon, ChevronRightIcon, CopyIcon, ExternalLinkIcon, LoaderCircleIcimport { useEffect, useState, type ReactNode } from "react";import { encode } from "uqr";-import { expiresInText, FINISHING_SETUP, teamName, useMachines, useTeamChoices, usePairingCode, useSession, type HostFormField, type HostSetupGuide, type Machine, type PairingHook } from "@/bridge";+import { expiresInText, FINISHING_SETUP, teamName, useFlag, useMachines, useTeamChoices, usePairingCode, useSession, type HostFormField, type HostSetupGuide, type Machine, type PairingHook } from "@/bridge";import { Button } from "@/components/ui/button";import { Dialog, DialogDescription, DialogPopup, DialogTitle } from "@/components/ui/dialog";import { Segmented } from "@/components/ui/segmented";import { Select } from "@/components/ui/select";import { toast } from "@/components/ui/toast";+import { UpgradeCard } from "@/components/upgrade-card";import { cn } from "@/lib/utils";/** Where Cua Spaces is downloaded (`teleport::flow::CUA_INSTALL_URL`). */@@ -143,6 +144,7 @@ function Notice({ children }: { children: ReactNode }) {/** The link, its QR code, the commands, and how long it lasts. */function PairingPanel({ pairing, machines }: { pairing: PairingHook; machines: Machine[] }) {+ const cards = useFlag("upsell_cards");const [shell, setShell] = useState<Shell>("sh");const { openExternal } = useSession();const { phase, code } = pairing;@@ -165,7 +167,12 @@ function PairingPanel({ pairing, machines }: { pairing: PairingHook; machines: M</div>);}+ // Only a team owner gets the checkout link, so only an owner gets the card.+ const failedText = team?.phase === "failed" ? (team.error ?? "") : "";+ const cardReason = !team?.upgradeUrl ? null : /no free seats/.test(failedText) ? "seats" : /as many computers as it has seats/.test(failedText) ? "machines" : null;+ const asCard = cards && cardReason !== null;return (+ <><div className="mt-5 flex items-center gap-2.5 rounded-lg border bg-card px-3 py-3 text-[13px]" data-pairing-added data-pairing-team={team?.phase}><CheckIcon className="size-4 shrink-0 text-success" aria-hidden /><span className="min-w-0 flex-1">@@ -176,12 +183,14 @@ function PairingPanel({ pairing, machines }: { pairing: PairingHook; machines: M? `It isn't on your team yet. ${team.error ?? "Something went wrong."}`: "It shows in your computers."}</span>- {team?.phase === "failed" && team.upgradeUrl ? (+ {team?.phase === "failed" && team.upgradeUrl && !asCard ? (<Button size="sm" data-pairing-upgrade="" onClick={() => void openExternal(team.upgradeUrl!).catch(() => {})}>Upgrade</Button>) : null}</div>+ {asCard ? <UpgradeCard reason={cardReason} className="mt-3" /> : null}+ </>);}diff --git a/apps/cua-spaces-web/src/components/share-sheet.tsx b/apps/cua-spaces-web/src/components/share-sheet.tsxindex 987cea442f..6599260ccc 100644--- a/apps/cua-spaces-web/src/components/share-sheet.tsx+++ b/apps/cua-spaces-web/src/components/share-sheet.tsx@@ -6,6 +6,7 @@ import { useEffect } from "react";import {teamName,useFeatureRecorded,+ useFlag,useSession,useShareSheet,useTeamChoices,@@ -14,6 +15,7 @@ import { Button } from "@/components/ui/button";import { Dialog, DialogPopup, DialogTitle } from "@/components/ui/dialog";import { Input } from "@/components/ui/input";import { Select } from "@/components/ui/select";+import { UpgradeCard } from "@/components/upgrade-card";import { UpsellPrompt } from "@/components/upsell-prompt";import { cn } from "@/lib/utils";@@ -32,6 +34,7 @@ export default function ShareSheet() {const choices = useTeamChoices(Boolean(session?.input.signedIn && session.input.shareable));const { openExternal } = useSession();const { hasTeam } = choices;+ const cards = useFlag("upsell_cards");useEffect(() => {sharing?.setHasTeam(hasTeam);}, [sharing, hasTeam, session?.input.spaceId]);@@ -60,12 +63,13 @@ export default function ShareSheet() {<DialogTitle className="text-[15px] font-semibold" data-share-title>{v.title}</DialogTitle>- {v.disabledReason || gate ? (+ {gate && !v.disabledReason && cards ? <UpgradeCard reason="invite" className="mt-3" /> : null}+ {(v.disabledReason || gate) && !(cards && gate && !v.disabledReason) ? (<p className="mt-1.5 text-[13px] text-muted-foreground" data-share-disabled>{v.disabledReason ?? gate?.reason}</p>) : null}- {!v.disabledReason && gate ? (+ {!v.disabledReason && gate && !cards ? (<Button size="sm" variant="outline" className="mt-2" onClick={() => void openExternal(gate.action.url).catch(() => {})} data-share-action>{gate.action.label}</Button>diff --git a/apps/cua-spaces-web/src/components/shell/relay-allowance-notice.tsx b/apps/cua-spaces-web/src/components/shell/relay-allowance-notice.tsxindex 8733a36248..29868e3e95 100644--- a/apps/cua-spaces-web/src/components/shell/relay-allowance-notice.tsx+++ b/apps/cua-spaces-web/src/components/shell/relay-allowance-notice.tsx@@ -4,8 +4,9 @@import { XIcon } from "lucide-react";import { useSyncExternalStore } from "react";-import { useRelayUsageView, useSession, useUpsellGate } from "@/bridge";+import { useRelayUsage, useRelayUsageView, useSession, useUpsellCardAvailable, useUpsellGate } from "@/bridge";import { Button } from "@/components/ui/button";+import { UpgradeCard } from "@/components/upgrade-card";const DISMISSED_KEY = "cua.relayAllowance.dismissed";@@ -47,7 +48,31 @@ export function RelayAllowanceNotice() {const { openExternal } = useSession();const dismissed = useSyncExternalStore(subscribe, readDismissed, () => null);const hidden = !notice || dismissed === notice.dismissKey;- const gate = useUpsellGate("meter", !hidden, notice?.level === "warn");+ // With the limit cards on, a used allowance is a card, not the thin line.+ const usage = useRelayUsage();+ // The session cap, when it is the one reached (the raw reasons can be empty).+ const sessionsHit = (usage?.liveSessionsLimit ?? 0) > 0 && (usage?.liveSessions ?? 0) >= (usage?.liveSessionsLimit ?? 0);+ const hoursHit = (usage?.hoursLimit ?? 0) > 0 && (usage?.hoursUsed ?? 0) >= (usage?.hoursLimit ?? 0);+ const reason = (usage?.reasons?.includes("sessions") || sessionsHit) && !hoursHit && !usage?.reasons?.includes("hours") ? "sessions" : "hours";+ // Only where there is a card to show; otherwise the notice stays as it was.+ const cardAvailable = useUpsellCardAvailable(notice?.level === "limit" ? reason : null, usage);+ const asCard = cardAvailable;+ const gate = useUpsellGate("meter", !hidden && !asCard, notice?.level === "warn");+ if (notice && !hidden && asCard) {+ const remember = () => {+ try {+ globalThis.localStorage?.setItem(DISMISSED_KEY, notice.dismissKey);+ } catch {+ // Not kept: it shows again next launch.+ }+ for (const l of [...listeners]) l();+ };+ return (+ <div className="shrink-0 border-b px-4 py-3" data-relay-allowance="limit-card">+ <UpgradeCard reason={reason} onClose={remember} className="max-w-xl" />+ </div>+ );+ }if (!notice || hidden || !gate.show) return null;const dismiss = () => {gate.dismiss();diff --git a/apps/cua-spaces-web/src/components/upgrade-card.test.tsx b/apps/cua-spaces-web/src/components/upgrade-card.test.tsxnew file mode 100644index 0000000000..3c954e3bcb--- /dev/null+++ b/apps/cua-spaces-web/src/components/upgrade-card.test.tsx@@ -0,0 +1,150 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { afterEach, beforeAll, describe, expect, it } from "vitest";++import { createDemoAdapter } from "@/bridge/adapters/demo";+import { demoRelayUsage } from "@/bridge/adapters/demo/relay-usage";+import { testCore, wasmBuilt } from "@/bridge/__tests__/testCore";+import { BridgeProvider, flagOn, resetUpsellMemory, setFlagOverride, setRemoteFlags, type CoreClient, type DataAdapter, type RelayUsage, type UpsellCardReason } from "@/bridge";++import { RelayAllowanceNotice } from "./shell/relay-allowance-notice";+import { UpgradeCard } from "./upgrade-card";++afterEach(() => {+ cleanup();+ localStorage.clear();+ setRemoteFlags({});+ resetUpsellMemory();+});++let core: CoreClient;+beforeAll(async () => {+ core = await testCore();+});++const reached: RelayUsage = { ...demoRelayUsage(), hoursUsed: 20.2, softLimitReached: true, reasons: ["hours"], liveSessions: 0 };++function host(usage: RelayUsage | null) {+ const demo = createDemoAdapter({ latencyMs: 0 });+ demo.state.relayUsage = usage;+ const opened: string[] = [];+ const features: string[] = [];+ const adapter: DataAdapter = {+ ...demo,+ call: (op, args) => {+ if (op === "session.openExternal") opened.push((args as { url: string }).url);+ if (op === "telemetry.track") for (const s of (args as { signals: { feature?: string }[] }).signals) if (s.feature) features.push(s.feature);+ return demo.call(op, args);+ },+ };+ const view = (reason?: UpsellCardReason) =>+ render(+ <BridgeProvider adapter={adapter} core={core}>+ {reason ? <UpgradeCard reason={reason} /> : <RelayAllowanceNotice />}+ </BridgeProvider>,+ );+ return { opened, features, view };+}++describe("the upsell_cards flag", () => {+ it("is off by default, and a device override or a remote value turns it on", () => {+ expect(flagOn("upsell_cards")).toBe(false);+ setRemoteFlags({ upsell_cards: true });+ expect(flagOn("upsell_cards")).toBe(true);+ setFlagOverride("upsell_cards", false);+ expect(flagOn("upsell_cards")).toBe(false);+ setFlagOverride("upsell_cards", null);+ expect(flagOn("upsell_cards")).toBe(true);+ });+});++describe.skipIf(!wasmBuilt)("<UpgradeCard>", () => {+ it("draws nothing while the flag is off", async () => {+ const { view } = host(reached);+ view("hours");+ await act(() => new Promise((r) => setTimeout(r, 20)));+ expect(document.querySelector("[data-upgrade-card]")).toBeNull();+ });++ it("flag on: says what happened, what Pro gives and the price; Upgrade opens the Pro checkout and is counted", async () => {+ setFlagOverride("upsell_cards", true);+ const { view, opened, features } = host(reached);+ view("hours");+ const card = await waitFor(() => {+ const el = document.querySelector("[data-upgrade-card]");+ expect(el).toBeTruthy();+ return el as HTMLElement;+ });+ expect(card.getAttribute("data-upgrade-card")).toBe("hours");+ expect(card.textContent).toContain("You've used this month's remote hours");+ expect(card.textContent).toContain("Pro gives you 200 hours and 5 live sessions");+ expect(card.textContent).toContain("$18 a month");+ fireEvent.click(screen.getByRole("button", { name: "Upgrade to Pro" }));+ await waitFor(() => expect(opened).toEqual(["https://app.cua.ai/buy/pro?from=app_card_hours"]));+ await waitFor(() => expect(features).toEqual(["upsell_card_hours_shown", "upsell_card_hours_click"]));+ });++ it("Not now closes it and is counted", async () => {+ setFlagOverride("upsell_cards", true);+ const { view, features } = host(reached);+ view("invite");+ fireEvent.click(await screen.findByRole("button", { name: "Not now" }));+ await waitFor(() => expect(document.querySelector("[data-upgrade-card]")).toBeNull());+ await waitFor(() => expect(features).toEqual(["upsell_card_invite_shown", "upsell_card_invite_dismiss"]));+ });++ it("a team plan has nothing to buy for an invite", async () => {+ setFlagOverride("upsell_cards", true);+ const { view } = host({ ...reached, plan: "team" });+ view("invite");+ await act(() => new Promise((r) => setTimeout(r, 20)));+ expect(document.querySelector("[data-upgrade-card]")).toBeNull();+ });+});++describe.skipIf(!wasmBuilt)("<RelayAllowanceNotice> with the cards on", () => {+ it("a used allowance is a card, and its Not now keeps it closed for the month", async () => {+ setFlagOverride("upsell_cards", true);+ const { view } = host(reached);+ view();+ const card = await waitFor(() => {+ const el = document.querySelector("[data-upgrade-card]");+ expect(el).toBeTruthy();+ return el as HTMLElement;+ });+ expect(card.textContent).toContain("Pro gives you 200 hours");+ expect(document.querySelector("[data-relay-allowance='limit']")).toBeNull();+ fireEvent.click(screen.getByRole("button", { name: "Not now" }));+ await waitFor(() => expect(document.querySelector("[data-upgrade-card]")).toBeNull());+ });++ it("a Pro account at 5 of 5 live sessions with empty reasons gets the sessions card", async () => {+ setFlagOverride("upsell_cards", true);+ const { view } = host({ ...reached, plan: "pro", hoursUsed: 10, hoursLimit: 200, liveSessions: 5, liveSessionsLimit: 5, reasons: [], softLimitReached: false });+ view();+ const card = await waitFor(() => {+ const el = document.querySelector("[data-upgrade-card]");+ expect(el).toBeTruthy();+ return el as HTMLElement;+ });+ expect(card.getAttribute("data-upgrade-card")).toBe("sessions");+ expect(card.textContent).toContain("You're using 5 of 5 live sessions");+ });++ it("a plan with no card keeps the notice and its Upgrade link", async () => {+ setFlagOverride("upsell_cards", true);+ const { view } = host({ ...reached, plan: "enterprise" });+ view();+ await screen.findByRole("status");+ expect(document.querySelector("[data-upgrade-card]")).toBeNull();+ });++ it("with the flag off the thin line is unchanged", async () => {+ const { view } = host(reached);+ view();+ await screen.findByRole("status");+ expect(document.querySelector("[data-upgrade-card]")).toBeNull();+ });+});diff --git a/apps/cua-spaces-web/src/components/upgrade-card.tsx b/apps/cua-spaces-web/src/components/upgrade-card.tsxnew file mode 100644index 0000000000..b3a5e09331--- /dev/null+++ b/apps/cua-spaces-web/src/components/upgrade-card.tsx@@ -0,0 +1,71 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import { useRelayUsage, useSession, useUpsellCard, type RelayUsage, type UpsellCardReason } from "@/bridge";+import { Button } from "@/components/ui/button";++/**+ * What a limit offers, at the moment it stops someone: what happened, the one+ * line of what Pro or Teams gives, the price, Upgrade (opens the checkout on+ * the account app) and Not now. Behind the `upsell_cards` flag; nothing is+ * drawn while it is off, there is nothing to offer, or after Not now. The+ * words and the plan each reason leads to are the app core's+ * (`upsell.card`). It never blocks anything: the relay and the control plane+ * enforce the limit.+ *+ * `onClose` runs on Not now, for a caller that keeps its own dismissal.+ * `usage` overrides the relay's answer (a plan known from elsewhere).+ */+export function UpgradeCard({+ reason,+ usage,+ onClose,+ className,+}: {+ reason: UpsellCardReason;+ usage?: Partial<RelayUsage> | null;+ onClose?: () => void;+ className?: string;+}) {+ const relay = useRelayUsage();+ const { openExternal } = useSession();+ const { card, click, dismiss } = useUpsellCard(reason, usage ?? relay);+ if (!card) return null;+ return (+ <section role="note" data-upgrade-card={card.reason} className={`rounded-lg border bg-card px-4 py-3.5 ${className ?? ""}`}>+ <h3 className="text-[13px] font-semibold" data-upgrade-title>+ {card.title}+ </h3>+ <p className="mt-1 text-xs leading-relaxed text-muted-foreground" data-upgrade-body>+ {card.body}+ </p>+ <div className="mt-3 flex items-center gap-2">+ <Button+ size="sm"+ data-upgrade-cta=""+ onClick={() => {+ click();+ void openExternal(card.cta.url).catch(() => {});+ }}+ >+ {card.cta.label}+ </Button>+ <span className="text-xs text-muted-foreground" data-upgrade-price>+ {card.price}+ </span>+ <Button+ size="sm"+ variant="ghost"+ className="ml-auto"+ data-upgrade-dismiss=""+ onClick={() => {+ dismiss();+ onClose?.();+ }}+ >+ {card.dismiss}+ </Button>+ </div>+ </section>+ );+}diff --git a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rsindex 979e9b0817..72172f94ec 100644--- a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs@@ -313,6 +313,7 @@ pub const METHODS: &[&str] = &["resources.warning","upsell.prompt","upsell.allows",+ "upsell.card","firstRun.view","firstRun.todos","firstRun.permissions",@@ -551,6 +552,17 @@ pub fn call_value(method: &str, args: Value) -> Result<Value, CoreError> {))}"upsell.allows" => out(upsell::allows(&a.get("state")?)),+ "upsell.card" => {+ let app = a+ .get::<Option<String>>("accountApp")?+ .filter(|u| u.starts_with("https://"))+ .unwrap_or_else(cua_home::env::account_app_url);+ out(upsell::card(+ &a.get::<String>("reason")?,+ &a.get("usage")?,+ &app,+ ))+ }"firstRun.view" => out(crate::first_run::view(&a.get("input")?)),"firstRun.cli" => out(crate::first_run::cli_view(&a.get("input")?)),"firstRun.todos" => out(crate::first_run::todos(&a.get("input")?)),diff --git a/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs b/libs/cua/crates/cua-spaces-app-core/src/telemetry.rsindex 795e333c5b..7eb7d1b31d 100644--- a/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs@@ -235,6 +235,13 @@ pub fn upsell(surface: &str, action: &str) -> Vec<TelemetrySignal> {matches!(action, "shown" | "click" | "dismiss")}"plan_card" | "account_menu" => action == "click",+ // The limit cards (`upsell::card`): `card_<reason>`.+ c if c+ .strip_prefix("card_")+ .is_some_and(|r| crate::upsell::CARD_REASONS.contains(&r)) =>+ {+ matches!(action, "shown" | "click" | "dismiss")+ }_ => false,};if ok {diff --git a/libs/cua/crates/cua-spaces-app-core/src/upsell.rs b/libs/cua/crates/cua-spaces-app-core/src/upsell.rsindex d47141ca54..7c86d5f0c5 100644--- a/libs/cua/crates/cua-spaces-app-core/src/upsell.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/upsell.rs@@ -122,6 +122,122 @@ pub fn prompt(}}+/// Where a limit card can show, and what it is about (`card`). The matching+/// usage events are `upsell_card_<reason>_<action>`.+pub const CARD_REASONS: [&str; 5] = ["hours", "sessions", "invite", "seats", "machines"];++/// What a Teams seat costs, as the card says it.+const TEAMS_PRICE: &str = "$30 a seat a month";++/// A card for the moment a limit stops the person: what happened, the one+/// line of what the plan gives, the price, and one button to the checkout.+/// Unlike a [`UpsellPrompt`] it answers something the person just ran into,+/// so the 3-day gap and quiet rules do not apply; "Not now" closes it for the+/// session. Nothing here enforces the limit: the relay and the control plane+/// do, and the app only says so.+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct UpsellCard {+ /// One of [`CARD_REASONS`].+ pub reason: String,+ /// What happened.+ pub title: String,+ /// What the plan gives, one or two plain sentences.+ pub body: String,+ /// "$18 a month".+ pub price: String,+ /// The button; opens the plan's checkout.+ pub cta: PlanLink,+ /// "Not now".+ pub dismiss: String,+}++/// The card for `reason` on this plan, or none when there is nothing to buy+/// for it (a plan that already has what the card would offer).+///+/// * `hours`, `sessions`: the relay's allowance is used. Free leads to Pro,+/// Pro to Teams, a team to its seats.+/// * `invite`: sharing needs a team (`sharing_needs_team`). Free and Pro lead+/// to Teams.+/// * `seats`, `machines`: a team is out of seats, or of computers (one per+/// seat). Only for someone who can add seats (the host words the error for+/// an owner), so the shell passes them only then.+pub fn card(reason: &str, usage: &RelayUsage, account_app: &str) -> Option<UpsellCard> {+ let kind = plan_kind(&usage.plan);+ let to = |label: &str, path: &str, from: &str| link(account_app, label, path, from);+ let from = format!("app_card_{reason}");+ let (title, body, price, cta) = match (reason, kind) {+ ("hours", "free") => (+ "You've used this month's remote hours".to_owned(),+ format!(+ "Free includes {} remote hours a month. Your Spaces keep working. Pro gives you {PRO_HOURS} hours and {PRO_SESSIONS} live sessions.",+ hours(usage.hours_limit.unwrap_or(20.0)),+ ),+ "$18 a month".to_owned(),+ to("Upgrade to Pro", BUY_PRO_PATH, &from),+ ),+ ("hours", "pro") => (+ "You've used this month's remote hours".to_owned(),+ "Your Spaces keep working. Teams pools remote hours across your seats.".to_owned(),+ TEAMS_PRICE.to_owned(),+ to("Upgrade to Teams", BUY_TEAMS_PATH, &from),+ ),+ ("sessions", "free") => (+ format!(+ "You're using {} of {} live sessions",+ usage.live_sessions,+ usage.live_sessions_limit.unwrap_or(2),+ ),+ format!("Close one to start another, or get Pro: {PRO_SESSIONS} live sessions at once and {PRO_HOURS} remote hours a month."),+ "$18 a month".to_owned(),+ to("Upgrade to Pro", BUY_PRO_PATH, &from),+ ),+ ("sessions", "pro") => (+ format!(+ "You're using {} of {} live sessions",+ usage.live_sessions,+ usage.live_sessions_limit.unwrap_or(PRO_SESSIONS),+ ),+ "Close one to start another, or move to Teams for a shared allowance across your seats.".to_owned(),+ TEAMS_PRICE.to_owned(),+ to("Upgrade to Teams", BUY_TEAMS_PATH, &from),+ ),+ ("hours" | "sessions", "teams") => (+ "Your team has used its remote allowance".to_owned(),+ "Your Spaces keep working. Each seat adds to the team's hours and live sessions.".to_owned(),+ TEAMS_PRICE.to_owned(),+ to("Add seats", "/billing", &from),+ ),+ ("invite", "free" | "pro") => (+ "Sharing is for teams".to_owned(),+ "Teams lets you share a Space with the people you work with, with roles and device approval.".to_owned(),+ TEAMS_PRICE.to_owned(),+ to("Start a team", BUY_TEAMS_PATH, &from),+ ),+ ("seats", "free" | "pro" | "teams") => (+ "Your team is out of seats".to_owned(),+ "A seat covers one person and one team computer. Add a seat to invite someone else.".to_owned(),+ TEAMS_PRICE.to_owned(),+ to("Add seats", "/billing", &from),+ ),+ ("machines", "free" | "pro" | "teams") => (+ "Your team has used all its computers".to_owned(),+ "A team gets one computer for each seat. Add a seat to add another computer.".to_owned(),+ TEAMS_PRICE.to_owned(),+ to("Add seats", "/billing", &from),+ ),+ _ => return None,+ };+ Some(UpsellCard {+ reason: reason.into(),+ title,+ body,+ price,+ cta,+ dismiss: "Not now".into(),+ })+}+#[cfg(test)]mod tests {use super::*;@@ -214,4 +330,68 @@ mod tests {assert!(!allows(&closed(29)));assert!(allows(&closed(30)));}++ #[test]+ fn limit_cards_say_what_happened_what_the_plan_gives_and_the_price() {+ let mut u = usage("free");+ u.hours_used = 20.0;+ let c = card("hours", &u, APP).unwrap();+ assert_eq!(c.title, "You've used this month's remote hours");+ assert_eq!(+ c.body,+ "Free includes 20 remote hours a month. Your Spaces keep working. Pro gives you 200 hours and 5 live sessions."+ );+ assert_eq!(c.price, "$18 a month");+ assert_eq!(c.cta.url, "https://app.cua.ai/buy/pro?from=app_card_hours");+ assert_eq!(c.dismiss, "Not now");++ u.live_sessions = 2;+ let s = card("sessions", &u, APP).unwrap();+ assert_eq!(s.title, "You're using 2 of 2 live sessions");+ assert_eq!(s.cta.label, "Upgrade to Pro");++ let t = card("invite", &u, APP).unwrap();+ assert_eq!(t.price, "$30 a seat a month");+ assert_eq!(+ t.cta.url,+ "https://app.cua.ai/buy/teams?from=app_card_invite"+ );+ }++ #[test]+ fn a_card_leads_each_plan_one_step_up_and_never_offers_what_it_has() {+ let pro = card("hours", &usage("pro"), APP).unwrap();+ assert_eq!(+ pro.cta.url,+ "https://app.cua.ai/buy/teams?from=app_card_hours"+ );+ assert!(card("invite", &usage("team"), APP).is_none());+ assert!(card("hours", &usage("enterprise"), APP).is_none());+ assert!(card("nonsense", &usage("free"), APP).is_none());+ let seats = card("seats", &usage("team"), APP).unwrap();+ assert_eq!(seats.cta.url, "https://app.cua.ai/billing");+ assert!(card("machines", &usage("team"), APP).is_some());+ }++ #[test]+ fn card_words_are_plain() {+ for plan in ["free", "pro", "team"] {+ for reason in CARD_REASONS {+ let Some(c) = card(reason, &usage(plan), APP) else {+ continue;+ };+ let all = format!("{} {} {}", c.title, c.body, c.price).to_lowercase();+ for bad in [+ "relay",+ "entitlement",+ "quota",+ "!",+ "hurry",+ "limited time",+ ] {+ assert!(!all.contains(bad), "{reason}/{plan}: {bad}");+ }+ }+ }+ }}diff --git a/libs/cua/crates/cua-telemetry/src/schema.rs b/libs/cua/crates/cua-telemetry/src/schema.rsindex 5cd2088872..5889d24779 100644--- a/libs/cua/crates/cua-telemetry/src/schema.rs+++ b/libs/cua/crates/cua-telemetry/src/schema.rs@@ -320,6 +320,22 @@ pub const FEATURES: &[&str] = &["upsell_machine_dismiss","upsell_plan_card_click","upsell_account_menu_click",+ // The limit cards: shown, clicked or dismissed, by what happened.+ "upsell_card_hours_shown",+ "upsell_card_hours_click",+ "upsell_card_hours_dismiss",+ "upsell_card_sessions_shown",+ "upsell_card_sessions_click",+ "upsell_card_sessions_dismiss",+ "upsell_card_invite_shown",+ "upsell_card_invite_click",+ "upsell_card_invite_dismiss",+ "upsell_card_seats_shown",+ "upsell_card_seats_click",+ "upsell_card_seats_dismiss",+ "upsell_card_machines_shown",+ "upsell_card_machines_click",+ "upsell_card_machines_dismiss",// Sign-in recovery (CUA-2285): how a sign-in ran and where it got stuck.// The reason a sign-in failed stays in `error_kind`; these add the way// (the browser, or a code to enter on any device).