Skip to content

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.

fix(license): explain App Store pairing before another purchase

review37480225365c
diff --git a/src/renderer/components/settings/SettingsPage.tsx b/src/renderer/components/settings/SettingsPage.tsx
index 26c6ce9a9..871a20478 100644
--- a/src/renderer/components/settings/SettingsPage.tsx
+++ b/src/renderer/components/settings/SettingsPage.tsx
@@ -116,7 +116,13 @@ export function SettingsPage({
<CommitSection isActive={active === 'commit'} />
<TmuxSection isActive={active === 'tmux'} />
<GitHubIssuesSection isActive={active === 'github-issues'} />
- <LicenseSection isActive={active === 'license'} />
+ <LicenseSection
+ isActive={active === 'license'}
+ onNavigate={(id) => {
+ setQuery('')
+ setActive(id)
+ }}
+ />
<PresenceIdentitySection isActive={active === 'presence'} />
<RemoteSection isActive={active === 'remote'} onClose={onClose} />
<TeamAccessSection isActive={active === 'team-access'} onClose={onClose} />
diff --git a/src/renderer/components/settings/sections/LicenseSection.test.tsx b/src/renderer/components/settings/sections/LicenseSection.test.tsx
index 1d9944ef0..b12ac3fa5 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>
+const onNavigate = vi.fn()
/**
* The store subscribes to `license.onChange` at IMPORT time, so the bridge has to exist before the
@@ -45,8 +46,14 @@ let writeText: Mock<(text: string) => void>
* Returns the section already mounted with `status` applied, so the mount-time `loadDetail` effect
* runs exactly as it does in the app.
*/
-async function mount(status: LicenseStatus, read: LicenseDetail = KEYGEN): Promise<void> {
+async function mount(
+ status: LicenseStatus,
+ read: LicenseDetail = KEYGEN,
+ browser = false
+): Promise<void> {
vi.resetModules()
+ if (browser) (await import('@renderer/bridge/runtime')).markBrowserRuntime()
+ onNavigate.mockClear()
detail = vi.fn(async () => read)
releaseOthers = vi.fn(async () => ({ key: null, used: 1, seats: 3, source: null, error: null }))
deactivate = vi.fn(async () => FREE)
@@ -72,7 +79,7 @@ async function mount(status: LicenseStatus, read: LicenseDetail = KEYGEN): Promi
await useEntitlement.getState().hydrate()
})
await act(async () => {
- root.render(<LicenseSection isActive />)
+ root.render(<LicenseSection isActive onNavigate={onNavigate} />)
})
await act(async () => undefined) // the mount-time detail read
}
@@ -324,3 +331,34 @@ describe('LicenseSection — activation failures', () => {
expect(text).toContain('Could not activate this key.')
})
})
+
+
+describe('LicenseSection — existing App Store purchase (#787)', () => {
+ it('offers pairing before checkout and beside the key input without promising recovery', async () => {
+ await mount(FREE)
+ const messages = [...host.querySelectorAll('p')].filter((p) =>
+ p.textContent?.includes('Already have Pro from the App Store?')
+ )
+ expect(messages).toHaveLength(2)
+ expect(messages[0].closest('details')).toBeNull()
+ expect(messages[1].closest('details')?.querySelector('input')).toBeTruthy()
+ for (const message of messages) {
+ expect(message.textContent).toContain('can unlock Pro')
+ expect(message.textContent).toContain('Some purchases cannot be linked by pairing')
+ expect(message.textContent).toContain('contact support before buying again')
+ }
+ await act(async () => click('Open Settings → Phone'))
+ expect(onNavigate).toHaveBeenCalledWith('phone')
+ expect(activate).not.toHaveBeenCalled()
+ expect(window.nodeTerminal.license.upgrade).not.toHaveBeenCalled()
+ })
+
+ it('directs browser users to the desktop app instead of unsupported browser pairing', async () => {
+ await mount(FREE, KEYGEN, true)
+ expect(screenText()).toContain('In the desktop app, open Settings → Phone')
+ expect(screenText()).toContain('Server Edition does not support this activation route')
+ expect(
+ [...host.querySelectorAll('button')].some((b) => b.textContent === 'Open Settings → Phone')
+ ).toBe(false)
+ })
+})
diff --git a/src/renderer/components/settings/sections/LicenseSection.tsx b/src/renderer/components/settings/sections/LicenseSection.tsx
index 05ad268be..9ce14b1be 100644
--- a/src/renderer/components/settings/sections/LicenseSection.tsx
+++ b/src/renderer/components/settings/sections/LicenseSection.tsx
@@ -7,6 +7,8 @@ import { ConfirmDialog } from '../../ConfirmDialog'
import { ProCompare } from './ProCompare'
import { Button } from '@renderer/ui/Button'
import { machineNoun, otherMachines, thisMachine } from '@renderer/lib/machineName'
+import { isBrowserRuntime } from '@renderer/bridge/runtime'
+import type { SettingsSectionId } from '../nav'
import { Input } from '@renderer/ui/Input'
import {
licenseSentence,
@@ -37,13 +39,38 @@ const ROWS = {
'devices',
'seats',
'release',
- 'copy key'
+ 'copy key',
+ 'app store',
+ 'iphone',
+ 'pairing'
]
}
}
const ENTRIES = Object.values(ROWS)
-export function LicenseSection({ isActive }: { isActive: boolean }): React.JSX.Element {
+// Pairing can expose an existing entitlement; it cannot repair a purchase without a linked
+// phone identity (nodeterm-ios#31). Keep the same qualification beside both purchase routes.
+function AppStorePairingHint(): React.JSX.Element {
+ return (
+ <p className="text-sm text-muted">
+ Already have Pro from the App Store? Pairing the phone with that subscription can unlock Pro
+ in the desktop app without a license key.{' '}
+ {isBrowserRuntime()
+ ? 'In the desktop app, open Settings → Phone to pair. Server Edition does not support this activation route. '
+ : 'Open Settings → Phone to pair. '}
+ Some purchases cannot be linked by pairing; if Pro stays inactive, contact support before
+ buying again.
+ </p>
+ )
+}
+
+export function LicenseSection({
+ isActive,
+ onNavigate
+}: {
+ isActive: boolean
+ onNavigate: (id: SettingsSectionId) => void
+}): React.JSX.Element {
const ent = useEntitlement()
const [licenseKey, setLicenseKey] = useState('')
const [upgrading, setUpgrading] = useState(false)
@@ -170,6 +197,10 @@ export function LicenseSection({ isActive }: { isActive: boolean }): React.JSX.E
) : (
<div className="space-y-3">
<ProCompare />
+ <AppStorePairingHint />
+ {!isBrowserRuntime() ? (
+ <Button onClick={() => onNavigate('phone')}>Open Settings → Phone</Button>
+ ) : null}
<Button
variant="primary"
onClick={() => {
@@ -182,11 +213,12 @@ export function LicenseSection({ isActive }: { isActive: boolean }): React.JSX.E
<p className="text-sm text-muted">
{upgrading
? 'Complete your purchase in the browser — Pro unlocks here automatically.'
- : 'Unlock remote access and Pro features.'}
+ : 'Unlock Pro features.'}
</p>
<details>
<summary className="cursor-pointer text-sm text-muted">Have a license key?</summary>
<div className="mt-3 space-y-2">
+ <AppStorePairingHint />
<FieldRow
label="License key"
control={