Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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' },
}));
Expand Down Expand Up @@ -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;
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
fetchManagedInfo,
accountCreationTarget,
type AccountCreationTarget,
isHostedDistribution,
} from '../../helpers/managedServer';
import {
ensureVaultBackup,
Expand Down Expand Up @@ -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,
);
Expand Down Expand Up @@ -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');
}
Expand Down
Loading