Skip to content

Commit 679aaeb

Browse files
mayoalexanderclaude
andcommitted
fix(desktop): always show Upgrade in the title bar and Settings > Account
The button only showed when the server reported paid === false. Admins are reported paid, licence holders are paid, and a slow or failed plan lookup is null, so almost nobody saw it, including new users and anyone testing checkout. It opens the plans dialog, which is useful to every account, so show it always. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent b8341bd commit 679aaeb

3 files changed

Lines changed: 29 additions & 27 deletions

File tree

‎packages/app/src/components/settings-v2/account.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { usePlatform } from "@/context/platform"
44
import { useServer } from "@/context/server"
55
import { SettingsListV2 } from "./parts/list"
66
import { SettingsRowV2 } from "./parts/row"
7+
import { TITLEBAR_UPGRADE_URL } from "../titlebar-iris-pills"
78
import "./settings-v2.css"
89

910
/**
@@ -279,8 +280,8 @@ export const SettingsAccountV2: Component = () => {
279280

280281
const meter = () => meterView(me()?.allowance)
281282
const upgradeUrl = () => {
282-
const p = me()?.plan
283-
return p?.measured && p.paid === false ? (p.upgradeUrl ?? me()?.allowance.upgradeUrl ?? null) : null
283+
// Always offered, like the title bar's Upgrade (see planBadge): every account can move up a plan.
284+
return me()?.plan?.upgradeUrl ?? me()?.allowance.upgradeUrl ?? TITLEBAR_UPGRADE_URL
284285
}
285286

286287
return (

‎packages/app/src/components/titlebar-iris-pills.test.ts‎

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,25 @@ describe("inboxLabel", () => {
6868

6969

7070
describe("planBadge", () => {
71-
test("only an account we KNOW has not paid sees Upgrade", () => {
72-
expect(planBadge({ measured: true, plan: "free", paid: false, upgradeUrl: "https://x.test/plans" })).toEqual({
73-
text: "Upgrade",
74-
url: "https://x.test/plans",
75-
})
76-
expect(planBadge({ measured: true, plan: "free", paid: false, upgradeUrl: null })?.url).toBe(TITLEBAR_UPGRADE_URL)
71+
test("everyone sees Upgrade — unpaid, paid, admin, unknown, unmeasured, still loading", () => {
72+
// It used to key on paid === false, which hid it from admins, licence holders, and anyone
73+
// whose plan lookup was slow or failed — new users included.
74+
for (const state of [
75+
undefined,
76+
{ measured: false, plan: null, upgradeUrl: null },
77+
{ measured: true, plan: "free", paid: false, upgradeUrl: null },
78+
{ measured: true, plan: "free", paid: true, upgradeUrl: null },
79+
{ measured: true, plan: "pro", paid: true, upgradeUrl: null },
80+
{ measured: true, plan: null, paid: null, upgradeUrl: null },
81+
{ measured: true, plan: "free", upgradeUrl: null },
82+
]) {
83+
expect(planBadge(state)).toEqual({ text: "Upgrade", url: TITLEBAR_UPGRADE_URL })
84+
}
7785
})
7886

79-
test("a paying customer whose plan name maps to free is NOT told to upgrade", () => {
80-
// The bug this keys on `paid` to avoid: "IRIS Solo" normalises to the free tier server-side.
81-
expect(planBadge({ measured: true, plan: "free", paid: true, upgradeUrl: null })).toBeNull()
82-
expect(planBadge({ measured: true, plan: "pro", paid: true, upgradeUrl: null })).toBeNull()
83-
})
84-
85-
test("unknown, unmeasured, or a server too old to report paid shows nothing", () => {
86-
expect(planBadge(undefined)).toBeNull()
87-
expect(planBadge({ measured: false, plan: "free", paid: false, upgradeUrl: null })).toBeNull()
88-
expect(planBadge({ measured: true, plan: "free", paid: null, upgradeUrl: null })).toBeNull()
89-
expect(planBadge({ measured: true, plan: "free", upgradeUrl: null })).toBeNull()
87+
test("the server's upgrade URL wins over the built-in one", () => {
88+
expect(planBadge({ measured: true, plan: "free", paid: true, upgradeUrl: "https://x.test/plans" }).url).toBe(
89+
"https://x.test/plans",
90+
)
9091
})
9192
})

‎packages/app/src/components/titlebar-iris-pills.tsx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,16 @@ interface PlanState {
120120
export const TITLEBAR_UPGRADE_URL = "https://web.heyiris.io/pricing?source=desktop-titlebar"
121121

122122
/**
123-
* Whether to show Upgrade — ONLY to someone we KNOW has not paid.
123+
* Upgrade is ALWAYS shown — paid, unpaid, unknown, admin, or before the plan has loaded.
124124
*
125-
* Keyed on `paid`, never on `plan`. Checkout writes the plan name as the package's own name
126-
* ("IRIS Solo", "Creator Plan") and the server's tier mapping turns every one of those into
127-
* `free`, so a tier-keyed button told paying customers to upgrade. Paid, unknown, unmeasured,
128-
* or a server too old to report `paid`: nothing at all.
125+
* It used to show only when the server said `paid === false` (ad53aa7c). In practice that hid
126+
* it from nearly everyone: admins are reported paid, any account with a licence seat is paid, and
127+
* a slow or failed plan lookup is null — so new users, and the people testing checkout, had no
128+
* way in. The button opens the plans dialog, which is useful to a paying customer too (moving up
129+
* a tier), so there is no one it is wrong to show it to. `state` only chooses the URL.
129130
*/
130-
export function planBadge(state: PlanState | undefined): { text: string; url: string } | null {
131-
if (!state?.measured || state.paid !== false) return null
132-
return { text: "Upgrade", url: state.upgradeUrl || TITLEBAR_UPGRADE_URL }
131+
export function planBadge(state: PlanState | undefined): { text: string; url: string } {
132+
return { text: "Upgrade", url: state?.upgradeUrl || TITLEBAR_UPGRADE_URL }
133133
}
134134

135135
export function TitlebarIrisPills() {

0 commit comments

Comments
 (0)