Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(license): link desktop buyers to Stripe's billing page for invoices
review0cd5ddd157f7
diff --git a/src/renderer/components/settings/sections/LicenseSection.test.tsx b/src/renderer/components/settings/sections/LicenseSection.test.tsxindex b12ac3fa5..7d617e52a 100644--- a/src/renderer/components/settings/sections/LicenseSection.test.tsx+++ b/src/renderer/components/settings/sections/LicenseSection.test.tsx@@ -38,6 +38,7 @@ let releaseOthers: Mock<() => Promise<LicenseDetail>>let deactivate: Mock<() => Promise<LicenseStatus>>let activate: Mock<(key: string) => Promise<LicenseStatus>>let writeText: Mock<(text: string) => void>+let openExternal: Mock<(url: string) => void>const onNavigate = vi.fn()/**@@ -59,6 +60,7 @@ async function mount(deactivate = vi.fn(async () => FREE)activate = vi.fn(async () => FREE)writeText = vi.fn()+ openExternal = vi.fn();(window as unknown as { nodeTerminal: unknown }).nodeTerminal = {license: {getStatus: vi.fn(async () => status),@@ -71,7 +73,8 @@ async function mount(activate,upgrade: vi.fn(async () => status)},- clipboard: { writeText }+ clipboard: { writeText },+ shell: { openExternal }}const { useEntitlement } = await import('../../../state/entitlement')const { LicenseSection } = await import('./LicenseSection')@@ -362,3 +365,31 @@ describe('LicenseSection — existing App Store purchase (#787)', () => {).toBe(false)})})++describe('LicenseSection — billing & invoices', () => {+ const PORTAL = 'https://billing.stripe.com/p/login/9B65kFeraflH9ora4A7EQ00'++ it('opens the Stripe billing page for a desktop (keygen) license', async () => {+ await mount(PRO)+ await act(async () => click('Billing & invoices'))+ expect(openExternal).toHaveBeenCalledWith(PORTAL)+ expect(screenText()).toMatch(/email you used at checkout/)+ })++ it('offers it when the license read failed — a lapsed card reads back as inactive', async () => {+ await mount(PRO, { key: null, used: 0, seats: 0, source: null, error: 'inactive' })+ await act(async () => click('Billing & invoices'))+ expect(openExternal).toHaveBeenCalledWith(PORTAL)+ })++ it('does not send an App Store subscriber to Stripe', async () => {+ await mount(PRO, { key: null, used: 0, seats: 0, source: 'apple', error: null })+ expect([...host.querySelectorAll('button')].some((b) => b.textContent === 'Billing & invoices')).toBe(false)+ })++ it('is reachable without Pro — past invoices and a card that needs updating', async () => {+ await mount(FREE)+ await act(async () => click('Billing & invoices'))+ expect(openExternal).toHaveBeenCalledWith(PORTAL)+ })+})diff --git a/src/renderer/components/settings/sections/LicenseSection.tsx b/src/renderer/components/settings/sections/LicenseSection.tsxindex 5ae5a2eaf..f082ba47d 100644--- a/src/renderer/components/settings/sections/LicenseSection.tsx+++ b/src/renderer/components/settings/sections/LicenseSection.tsx@@ -7,7 +7,7 @@ import { ConfirmDialog } from '../../ConfirmDialog'import { ProCompare } from './ProCompare'import { Button } from '@renderer/ui/Button'import { machineNoun, otherMachines, thisMachine } from '@renderer/lib/machineName'-import { mobileStoreNames } from '@renderer/lib/links'+import { mobileStoreNames, STRIPE_BILLING_PORTAL_URL } from '@renderer/lib/links'import { isBrowserRuntime } from '@renderer/bridge/runtime'import type { SettingsSectionId } from '../nav'import { Input } from '@renderer/ui/Input'@@ -16,6 +16,7 @@ import {proStatusLine,canReleaseDevices,canUseKeyElsewhere,+ offersBillingPortal,releaseFailureSentence,activationErrorSentence} from '@renderer/lib/licenseCopy'@@ -45,7 +46,15 @@ const ROWS = {'iphone','google play','android',- 'pairing'+ 'pairing',+ 'billing',+ 'invoice',+ 'invoices',+ 'receipt',+ 'payment',+ 'card',+ 'cancel',+ 'stripe']}}@@ -67,6 +76,24 @@ function AppStorePairingHint(): React.JSX.Element {)}+// Invoices, payment method and cancellation for a desktop (Stripe checkout) purchase live on+// Stripe's hosted page — nodeterm keeps no billing account to show them in-app. Rendered for a+// lapsed buyer too: a failed card is how a desktop subscription stops being Pro.+function BillingPortalLink(): React.JSX.Element {+ return (+ <div className="space-y-2">+ <Button onClick={() => window.nodeTerminal.shell.openExternal(STRIPE_BILLING_PORTAL_URL)}>+ Billing & invoices+ </Button>+ <p className="text-sm text-muted">+ Bought Pro on the desktop? Sign in to Stripe with the email you used at checkout to download+ invoices, update your card or cancel. Purchases from {mobileStoreNames()} are billed by the+ store, not Stripe.+ </p>+ </div>+ )+}+export function LicenseSection({isActive,onNavigate@@ -195,6 +222,7 @@ export function LicenseSection({) : null}</>) : null}+ {offersBillingPortal(detail) ? <BillingPortalLink /> : null}<Button onClick={() => setConfirming('deactivate')}>Deactivate on this device</Button></div>) : (@@ -250,6 +278,7 @@ export function LicenseSection({) : null}</div></details>+ <BillingPortalLink /></div>)}</SearchableRow>diff --git a/src/renderer/lib/licenseCopy.test.ts b/src/renderer/lib/licenseCopy.test.tsindex dee8db69c..731afdaaa 100644--- a/src/renderer/lib/licenseCopy.test.ts+++ b/src/renderer/lib/licenseCopy.test.ts@@ -6,6 +6,7 @@ import {licenseSentence,canReleaseDevices,canUseKeyElsewhere,+ offersBillingPortal,isReleaseRefusal,releaseFailureSentence,activationErrorSentence@@ -201,6 +202,24 @@ describe('licenseSentence — before the first read', () => {})})+describe('offersBillingPortal', () => {+ it('offers the billing page for a stated keygen (Stripe) source', () => {+ expect(offersBillingPortal(keygen())).toBe(true)+ })++ it('hides it only for a STATED store source — the store bills those, not Stripe', () => {+ expect(offersBillingPortal({ key: null, used: 0, seats: 0, source: 'apple', error: null })).toBe(false)+ expect(offersBillingPortal({ key: null, used: 0, seats: 0, source: 'google', error: null })).toBe(false)+ })++ it('offers it when no source was stated — the inverse of the release gate', () => {+ // A renewal whose card failed reads back `inactive` with no source, and that buyer is the one+ // who most needs the page. An `=== 'keygen'` gate (the release rule) would hide it from them.+ expect(offersBillingPortal({ key: null, used: 0, seats: 0, source: null, error: 'inactive' })).toBe(true)+ expect(offersBillingPortal(null)).toBe(true)+ })+})+describe('canReleaseDevices', () => {it('is true only for a STATED keygen source', () => {expect(canReleaseDevices(keygen())).toBe(true)diff --git a/src/renderer/lib/licenseCopy.ts b/src/renderer/lib/licenseCopy.tsindex 102052bf0..63a7d17f5 100644--- a/src/renderer/lib/licenseCopy.ts+++ b/src/renderer/lib/licenseCopy.ts@@ -143,6 +143,19 @@ export function canReleaseDevices(detail: LicenseDetail | null): boolean {return detail?.source === 'keygen'}+/**+ * Whether to offer the Stripe billing page (invoices, payment method, cancel) beside an active Pro.+ *+ * Deliberately the INVERSE of `canReleaseDevices`: hidden only for a STATED store source, shown for+ * a null one. The release gate hides on doubt because the server can only refuse that action; this+ * link can only open a sign-in page, and the users who need it most carry a null source — a renewal+ * whose card failed reads back as `inactive`, and every error reply states no source. An App Store+ * or Play subscriber has nothing on Stripe, and their sentence already says where the term lives.+ */+export function offersBillingPortal(detail: LicenseDetail | null): boolean {+ return detail?.source !== 'apple' && detail?.source !== 'google'+}+/*** Whether to tell the user they can paste this key on another Mac.*diff --git a/src/renderer/lib/links.ts b/src/renderer/lib/links.tsindex 3642898c6..06a8b4b9c 100644--- a/src/renderer/lib/links.ts+++ b/src/renderer/lib/links.ts@@ -55,3 +55,10 @@ export function mobileStoreNames(androidPublished: boolean = ANDROID_APP_PUBLISH.map((l) => l.prose).join(' or ')}++/**+ * Stripe's hosted billing page for desktop (Stripe checkout) Pro buyers: the buyer signs in with+ * their checkout email and gets their invoices, payment method and cancellation. App Store / Play+ * purchases are billed by the store and have nothing here.+ */+export const STRIPE_BILLING_PORTAL_URL = 'https://billing.stripe.com/p/login/9B65kFeraflH9ora4A7EQ00'