diff --git a/browser/data-browser/src/views/getting-started/GettingStartedFlow.test.tsx b/browser/data-browser/src/views/getting-started/GettingStartedFlow.test.tsx index 2c57d7e72f..d5e08d3a9a 100644 --- a/browser/data-browser/src/views/getting-started/GettingStartedFlow.test.tsx +++ b/browser/data-browser/src/views/getting-started/GettingStartedFlow.test.tsx @@ -15,6 +15,7 @@ import { buildTheme } from '../../styling'; const state = vi.hoisted(() => ({ portal: 'https://portal.example', + hosted: false, navigate: vi.fn(), setAgent: vi.fn(), setDrive: vi.fn(), @@ -77,6 +78,7 @@ vi.mock('../../helpers/managed/session', () => ({ })); vi.mock('../../helpers/managedServer', () => ({ fetchManagedInfo: async () => null, + isHostedDistribution: () => state.hosted, accountCreationTarget: () => state.portal ? { kind: 'portal', url: state.portal } : { kind: 'local' }, })); @@ -172,6 +174,7 @@ const show = async (query = '') => { beforeEach(() => { vi.clearAllMocks(); state.portal = 'https://portal.example'; + state.hosted = false; state.recovery.mockResolvedValue(null); state.account = null; state.hasData = true; @@ -195,6 +198,13 @@ it('keeps secret sign-in reachable when a portal is configured', async () => { expect(await screen.findByLabelText('Agent secret')).toBeTruthy(); }); +it('opens a hosted build on sign-in, without the welcome choice', async () => { + state.hosted = true; + await show(); + expect(screen.getByLabelText('Agent secret')).toBeTruthy(); + expect(screen.queryByRole('button', { name: 'Create account' })).toBeNull(); +}); + it('keeps a self-hosted welcome usable', async () => { state.portal = ''; await show(); diff --git a/browser/data-browser/src/views/getting-started/GettingStartedFlow.tsx b/browser/data-browser/src/views/getting-started/GettingStartedFlow.tsx index 80d5dc4a0d..269971886c 100644 --- a/browser/data-browser/src/views/getting-started/GettingStartedFlow.tsx +++ b/browser/data-browser/src/views/getting-started/GettingStartedFlow.tsx @@ -34,6 +34,7 @@ import { fetchManagedInfo, accountCreationTarget, type AccountCreationTarget, + isHostedDistribution, } from '../../helpers/managedServer'; import { ensureVaultBackup, @@ -216,7 +217,13 @@ export function GettingStartedFlow({ ? 'create' : inviteToken ? 'restore' - : nextDrive || returnToAgent || signInRequested + : nextDrive || + returnToAgent || + signInRequested || + // Hosted builds have no Create/Sign-in/Demo choice: creating an + // account happens in the portal, so signed-out people get the + // sign-in options directly. + (isHostedDistribution() && initialStep === 'welcome') ? 'signin' : initialStep, ); @@ -1189,6 +1196,9 @@ export function GettingStartedFlow({ window.location.assign( new URL('/dashboard', knownPortalUrl).toString(), ); + } else if (isHostedDistribution() && knownPortalUrl) { + // No welcome step in a hosted build; Back leaves for the portal. + window.location.assign(knownPortalUrl); } else { setStep('welcome'); }