@bevel-software/platform-core-frontend 0.26.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/core/CoreAppShell.tsx +87 -25
- package/src/core/ProductName.tsx +49 -0
- package/src/core/__tests__/ProductName.test.tsx +46 -0
- package/src/core/__tests__/ShellRoutes.test.tsx +22 -0
- package/src/core/__tests__/core-contributions.test.ts +16 -0
- package/src/core/core-contributions.ts +17 -0
- package/src/core/maker-url.ts +30 -0
- package/src/core/registry.ts +78 -1
- package/src/index.css +23 -5
- package/src/index.ts +5 -0
- package/src/lib/__tests__/latest-request.test.ts +48 -0
- package/src/lib/latest-request.ts +45 -0
- package/src/modules/access/__tests__/ManageAccessDialog.no-sso-invite.test.tsx +222 -0
- package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +1 -1
- package/src/modules/access/api.ts +19 -3
- package/src/modules/access/components/ManageAccessDialog.tsx +61 -8
- package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +16 -1
- package/src/modules/admin/__tests__/RolesCorruptedBanner.test.tsx +70 -0
- package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +284 -39
- package/src/modules/admin/components/AdminRolesPage.tsx +13 -14
- package/src/modules/admin/components/RolesCorruptedBanner.tsx +9 -4
- package/src/modules/admin/components/UserAccountsPage.tsx +91 -107
- package/src/modules/admin/services/roles.api.ts +14 -1
- package/src/modules/auth/__tests__/LoginScreen.test.tsx +80 -5
- package/src/modules/auth/__tests__/sso-strict-probe.test.ts +66 -0
- package/src/modules/auth/components/LoginScreen.tsx +101 -73
- package/src/modules/auth/services/account.api.ts +59 -3
- package/src/modules/auth/services/sso.ts +30 -10
- package/src/modules/auth/state/use-sign-in-methods.ts +41 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.sync-banner.test.tsx +176 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +68 -0
- package/src/modules/change-requests/__tests__/ChangeRequestLink.test.tsx +182 -0
- package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +1 -1
- package/src/modules/change-requests/__tests__/readFileOnBranch.test.ts +79 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +6 -1
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +45 -15
- package/src/modules/change-requests/components/ChangeRequestLink.tsx +151 -0
- package/src/modules/change-requests/components/CrFileTree.tsx +2 -1
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +4 -2
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +6 -3
- package/src/modules/change-requests/services/change-requests.api.ts +15 -2
- package/src/modules/change-requests/utils/readFailure.ts +22 -0
- package/src/modules/embed/__tests__/EmbedLinkPage.test.tsx +74 -0
- package/src/modules/embed/__tests__/EmbedView.test.tsx +473 -0
- package/src/modules/embed/__tests__/embed-config.test.ts +128 -0
- package/src/modules/embed/__tests__/embed-host.test.ts +111 -0
- package/src/modules/embed/__tests__/mcp-app-view.test.ts +295 -0
- package/src/modules/embed/__tests__/mount.test.tsx +157 -0
- package/src/modules/embed/components/EmbedLinkPage.tsx +109 -0
- package/src/modules/embed/components/EmbedView.tsx +545 -0
- package/src/modules/embed/embed-config.ts +132 -0
- package/src/modules/embed/embed-host.ts +120 -0
- package/src/modules/embed/mount.tsx +80 -0
- package/src/modules/embed/services/embed-token.ts +22 -0
- package/src/modules/embed/services/embed.api.ts +158 -0
- package/src/modules/git/__tests__/BranchSwitcher.test.tsx +202 -4
- package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +59 -1
- package/src/modules/git/__tests__/PullNeededBanner.test.tsx +39 -22
- package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +7 -2
- package/src/modules/git/branch-delete-menu-item.tsx +24 -0
- package/src/modules/git/components/BranchSwitcher.tsx +29 -5
- package/src/modules/git/components/GitSyncFailedBanner.tsx +53 -15
- package/src/modules/git/components/HistoryVersionPreview.tsx +5 -3
- package/src/modules/git/components/PullNeededBanner.tsx +15 -49
- package/src/modules/git/hooks/useAutoPullUpdates.ts +9 -5
- package/src/modules/git/index.ts +15 -0
- package/src/modules/git/services/__tests__/error-messages.test.ts +67 -0
- package/src/modules/git/services/__tests__/pull-failure.test.ts +36 -0
- package/src/modules/git/services/error-messages.ts +58 -1
- package/src/modules/git/services/pull-failure.ts +68 -0
- package/src/modules/git/state/branch-delete-confirm.ts +46 -0
- package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +1 -0
- package/src/modules/layout/__tests__/breakpoints.test.ts +7 -1
- package/src/modules/layout/breakpoints.ts +8 -0
- package/src/modules/library/__tests__/PluginExtras.test.tsx +9 -9
- package/src/modules/library/__tests__/PluginPage.test.tsx +8 -1
- package/src/modules/library/__tests__/SkillsTree.test.tsx +13 -4
- package/src/modules/library/components/LibraryPage.tsx +22 -0
- package/src/modules/library/components/PluginExtras.tsx +23 -6
- package/src/modules/library/components/PluginPage.tsx +6 -1
- package/src/modules/library/routes/LibraryRoutes.tsx +8 -7
- package/src/modules/library/services/plugins.api.ts +4 -1
- package/src/modules/library/state/plugins-revision.ts +28 -0
- package/src/modules/onboarding/__tests__/InviteButton.test.tsx +214 -0
- package/src/modules/onboarding/__tests__/agent-connection-api.test.ts +55 -0
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +87 -82
- package/src/modules/onboarding/__tests__/first-page-prompt.test.ts +164 -0
- package/src/modules/onboarding/__tests__/get-started-column.test.tsx +1458 -0
- package/src/modules/onboarding/__tests__/invite-dialog.test.tsx +811 -0
- package/src/modules/onboarding/__tests__/invite-emails.test.ts +247 -0
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +226 -193
- package/src/modules/onboarding/__tests__/starter-pack-card.test.tsx +136 -0
- package/src/modules/onboarding/components/CreatorWelcomePage.tsx +7 -11
- package/src/modules/onboarding/components/EmailChipsInput.tsx +138 -0
- package/src/modules/onboarding/components/GetStartedColumn.tsx +670 -0
- package/src/modules/onboarding/components/InviteButton.tsx +139 -0
- package/src/modules/onboarding/components/InviteDialog.tsx +741 -0
- package/src/modules/onboarding/components/RootLanding.tsx +8 -24
- package/src/modules/onboarding/components/StarterPackCard.tsx +98 -0
- package/src/modules/onboarding/components/WelcomePage.tsx +65 -154
- package/src/modules/onboarding/first-page-prompt.ts +123 -0
- package/src/modules/onboarding/invite-emails.ts +313 -0
- package/src/modules/onboarding/services/agent-connection.api.ts +53 -0
- package/src/modules/onboarding/services/starter-packs.api.ts +83 -0
- package/src/modules/onboarding/state/agent-connection.ts +167 -0
- package/src/modules/onboarding/state/invite-dialog.context.ts +35 -0
- package/src/modules/onboarding/state/invite-dialog.tsx +39 -0
- package/src/modules/onboarding/state/onboarding.ts +133 -59
- package/src/modules/onboarding/state/starter-packs.ts +169 -0
- package/src/modules/settings/settings-nav-items.tsx +8 -3
- package/src/modules/setup/__tests__/setup.first-run-storage.test.tsx +389 -0
- package/src/modules/setup/__tests__/setup.github.test.tsx +5 -5
- package/src/modules/setup/__tests__/setup.kept-draft.test.tsx +1 -1
- package/src/modules/setup/__tests__/setup.repository-change.test.tsx +1 -1
- package/src/modules/setup/__tests__/setup.repository.test.tsx +21 -21
- package/src/modules/setup/__tests__/setup.test.tsx +56 -15
- package/src/modules/setup/__tests__/useConnectionProbe.test.tsx +123 -0
- package/src/modules/setup/components/FirstRunStorage.tsx +560 -0
- package/src/modules/setup/components/SetupGate.tsx +46 -1
- package/src/modules/setup/components/SetupScreen.tsx +81 -84
- package/src/modules/setup/hooks/useConnectionProbe.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +3 -3
- package/src/modules/setup/utils/suggested-branch.ts +27 -0
- package/src/modules/toolbar/commands/__tests__/actions.test.tsx +210 -0
- package/src/modules/toolbar/commands/actions.tsx +330 -0
- package/src/modules/toolbar/commands/command-menu.ts +44 -0
- package/src/modules/toolbar/commands/useCommandActions.ts +71 -0
- package/src/modules/toolbar/commands/useCommandShortcuts.ts +121 -0
- package/src/modules/toolbar/components/AppSwitcher.tsx +125 -22
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +1 -1
- package/src/modules/toolbar/components/ProfileMenu.tsx +9 -4
- package/src/modules/toolbar/components/SearchPalette.tsx +540 -0
- package/src/modules/toolbar/components/Toolbar.tsx +10 -0
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +230 -52
- package/src/modules/toolbar/components/__tests__/ProfileMenu.test.tsx +64 -0
- package/src/modules/toolbar/components/__tests__/SearchPalette.test.tsx +864 -0
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +57 -2
- package/src/modules/toolbar/search/__tests__/rank.test.ts +93 -0
- package/src/modules/toolbar/search/__tests__/sources.test.ts +131 -0
- package/src/modules/toolbar/search/rank.ts +111 -0
- package/src/modules/toolbar/search/sources.ts +169 -0
- package/src/modules/workflow/hooks/useFileLock.ts +10 -7
- package/src/modules/workflow/services/__tests__/lock.api.test.ts +41 -0
- package/src/modules/workflow/services/lock.api.ts +17 -2
- package/src/modules/workspace/__tests__/useWorkspaceState.test.ts +49 -1
- package/src/modules/workspace/components/EditorTabs.tsx +39 -15
- package/src/modules/workspace/components/FileExplorer.tsx +39 -6
- package/src/modules/workspace/components/FilePaneCard.tsx +6 -2
- package/src/modules/workspace/components/FileRoute.tsx +12 -7
- package/src/modules/workspace/components/FileViewer.tsx +271 -74
- package/src/modules/workspace/components/KbPageHeader.tsx +13 -6
- package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +88 -21
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +92 -4
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +23 -3
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +330 -6
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +17 -2
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +11 -16
- package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +6 -0
- package/src/modules/workspace/components/renderers/EmailRenderer.tsx +23 -21
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +13 -29
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +9 -2
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +8 -0
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +14 -19
- package/src/modules/workspace/components/renderers/PptxRenderer.tsx +11 -17
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +35 -7
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -17
- package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.links.test.tsx +73 -0
- package/src/modules/workspace/components/renderers/__tests__/ToolRenderer.scaffold.test.tsx +64 -0
- package/src/modules/workspace/components/renderers/__tests__/ToolRenderer.surface.test.tsx +82 -0
- package/src/modules/workspace/components/renderers/__tests__/bridgeHarness.ts +99 -0
- package/src/modules/workspace/components/renderers/__tests__/htmlSandbox.test.ts +129 -35
- package/src/modules/workspace/components/renderers/__tests__/htmlViewsGuide.test.ts +149 -0
- package/src/modules/workspace/components/renderers/__tests__/kbMarkdownLinkPolicy.test.tsx +100 -0
- package/src/modules/workspace/components/renderers/htmlSandbox.ts +76 -20
- package/src/modules/workspace/components/renderers/index.ts +26 -0
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +51 -1
- package/src/modules/workspace/components/renderers/rendererRawRead.ts +53 -0
- package/src/modules/workspace/components/renderers/rendererSurface.ts +109 -0
- package/src/modules/workspace/components/renderers/rendererWorkspace.ts +8 -2
- package/src/modules/workspace/hooks/__tests__/useCreatePage.test.ts +137 -0
- package/src/modules/workspace/hooks/__tests__/useKnowledgeWriteTarget.test.ts +302 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +126 -21
- package/src/modules/workspace/hooks/useCreatePage.ts +206 -0
- package/src/modules/workspace/hooks/useKnowledgeWriteTarget.ts +238 -0
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +24 -7
- package/src/modules/workspace/hooks/useWorkspaceState.ts +42 -8
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +10 -0
- package/src/modules/workspace/routing/__tests__/md-links-parity.test.tsx +113 -0
- package/src/modules/workspace/routing/kb-routes.ts +66 -12
- package/src/modules/workspace/state/editable-page.ts +42 -0
- package/src/modules/workspace/state/workspace.context.ts +13 -4
- package/src/modules/workspace/utils/__tests__/display-file-name.test.ts +60 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +75 -0
- package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +16 -0
- package/src/modules/workspace/utils/display-file-name.ts +102 -0
- package/src/modules/workspace/utils/fileTree.ts +49 -14
- package/src/modules/workspace/utils/treeConfirm.ts +15 -0
- package/src/shared/__tests__/no-builtin-confirm.test.ts +102 -0
- package/src/shared/components/ConfirmProvider.tsx +156 -0
- package/src/shared/components/Dialog.tsx +7 -0
- package/src/shared/components/__tests__/ConfirmProvider.test.tsx +198 -0
- package/src/shared/components/confirm-context.ts +94 -0
- package/src/shared/components/index.ts +3 -0
- package/src/modules/onboarding/components/WelcomeRoute.tsx +0 -57
- package/src/modules/onboarding/welcome-state.ts +0 -36
|
@@ -7,7 +7,7 @@ import { LibraryPage } from '../components/LibraryPage';
|
|
|
7
7
|
import { PluginPage } from '../components/PluginPage';
|
|
8
8
|
import { PersonalPluginPage } from '../components/PersonalPluginPage';
|
|
9
9
|
import { TeamRoute } from '../components/TeamRoute';
|
|
10
|
-
import {
|
|
10
|
+
import { WelcomePage } from '../../onboarding/components/WelcomePage';
|
|
11
11
|
import { WorkspaceItemRoute } from './WorkspaceItemRoute';
|
|
12
12
|
import { decodePluginSegment, LIBRARY_ROOT, pathForPlugin, urlForLibraryItem, urlForSkillFile } from './library-paths';
|
|
13
13
|
|
|
@@ -33,9 +33,10 @@ export function LibraryRoutes() {
|
|
|
33
33
|
<Routes>
|
|
34
34
|
<Route element={<LibraryLayout />}>
|
|
35
35
|
{/* The Library OPENS on Everything: plugins, skills and tools, the
|
|
36
|
-
whole catalog with the library-wide search
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
whole catalog with the library-wide search — or, for an admin
|
|
37
|
+
whose catalog is still empty, the creator welcome in its place
|
|
38
|
+
(see `LibraryPage`). `everything` is the same page at the URL
|
|
39
|
+
it used to have, so older links still land. */}
|
|
39
40
|
<Route index element={<LibraryPage filter={{ kind: 'all' }} />} />
|
|
40
41
|
<Route path="everything" element={<Navigate to={LIBRARY_ROOT} replace />} />
|
|
41
42
|
|
|
@@ -46,9 +47,9 @@ export function LibraryRoutes() {
|
|
|
46
47
|
|
|
47
48
|
{/* The connect-your-agent welcome — inside the layout, so the
|
|
48
49
|
sidebar (and the pill's selected state) is on screen with it.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<Route path="welcome" element={<
|
|
50
|
+
Never reached automatically (see `RootLanding`): opened from
|
|
51
|
+
the pill, the Get set up list and by URL. */}
|
|
52
|
+
<Route path="welcome" element={<WelcomePage />} />
|
|
52
53
|
|
|
53
54
|
<Route path="owned" element={<LibraryPage filter={{ kind: 'owned' }} />} />
|
|
54
55
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { authFetch } from '../../../lib/api';
|
|
2
2
|
import { handleApiResponse } from '../../git/services/git.api';
|
|
3
|
+
import { notePluginCreated } from '../state/plugins-revision';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Plugin enumeration + join requests — the browser half of the backend's
|
|
@@ -141,7 +142,9 @@ export async function createPlugin(
|
|
|
141
142
|
const body = (await res.json().catch(() => ({}))) as { error?: string };
|
|
142
143
|
throw new Error(body.error ?? "Couldn't create that plugin.");
|
|
143
144
|
}
|
|
144
|
-
|
|
145
|
+
const created = (await res.json()) as { folder: string; name: string; displayName: string };
|
|
146
|
+
notePluginCreated();
|
|
147
|
+
return created;
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
/**
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useSyncExternalStore } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* How many plugins this tab has created — a signal for readers OUTSIDE the
|
|
5
|
+
* Library's provider (the Get set up column sits beside both apps) that need
|
|
6
|
+
* to hear "a plugin now exists" without asking `GET /api/plugins` on every
|
|
7
|
+
* navigation. Bumped by `createPlugin` once the server has made it.
|
|
8
|
+
*/
|
|
9
|
+
let revision = 0;
|
|
10
|
+
const listeners = new Set<() => void>();
|
|
11
|
+
|
|
12
|
+
function subscribe(listener: () => void): () => void {
|
|
13
|
+
listeners.add(listener);
|
|
14
|
+
return () => listeners.delete(listener);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const snapshot = () => revision;
|
|
18
|
+
|
|
19
|
+
/** A plugin was just created in this tab. */
|
|
20
|
+
export function notePluginCreated(): void {
|
|
21
|
+
revision++;
|
|
22
|
+
listeners.forEach((l) => l());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The current count, re-rendering the caller whenever it moves. */
|
|
26
|
+
export function usePluginsRevision(): number {
|
|
27
|
+
return useSyncExternalStore(subscribe, snapshot, snapshot);
|
|
28
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { render, screen, waitFor, within } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { AuthContext } from '../../auth/state/auth.context';
|
|
5
|
+
import { authValue } from '../../library/__tests__/auth-harness';
|
|
6
|
+
import { AdminContext, type AdminContextValue } from '../../admin/state/admin.context';
|
|
7
|
+
import type { AdminContact } from '../../access/api';
|
|
8
|
+
import { InviteButton } from '../components/InviteButton';
|
|
9
|
+
import { InviteDialogContext, type InviteDialogController } from '../state/invite-dialog.context';
|
|
10
|
+
import { InviteDialogProvider } from '../state/invite-dialog';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The top bar's Invite, for everyone signed in: an admin's click opens the
|
|
14
|
+
* Invite dialog; anyone else's opens a popover that says to ask an admin and
|
|
15
|
+
* lists the admins, each with an Email button carrying a prefilled request.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const { fetchAdminsMock } = vi.hoisted(() => ({
|
|
19
|
+
fetchAdminsMock: vi.fn<() => Promise<AdminContact[]>>(),
|
|
20
|
+
}));
|
|
21
|
+
vi.mock('../../access/api', async (importOriginal) => ({
|
|
22
|
+
...(await importOriginal<typeof import('../../access/api')>()),
|
|
23
|
+
fetchAdmins: fetchAdminsMock,
|
|
24
|
+
}));
|
|
25
|
+
vi.mock('../../../lib/api', () => ({ authFetch: vi.fn() }));
|
|
26
|
+
// The dialog asks how people sign in; this file is about the button.
|
|
27
|
+
vi.mock('../../auth/services/sso', async (importOriginal) => ({
|
|
28
|
+
...(await importOriginal<typeof import('../../auth/services/sso')>()),
|
|
29
|
+
fetchLoginProvidersStrict: vi.fn(async () => ({ password: true, sso: [] })),
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
const ADMINS: AdminContact[] = [
|
|
33
|
+
{ name: 'Dana Admin', email: 'dana@acme.com' },
|
|
34
|
+
{ name: 'Sam Ortiz', email: 'sam.ortiz@acme.com' },
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
function adminValue(isAdmin: boolean, isAdminLoading = false): AdminContextValue {
|
|
38
|
+
return {
|
|
39
|
+
isAdmin,
|
|
40
|
+
isAdminLoading,
|
|
41
|
+
unreadCount: 0,
|
|
42
|
+
lastSeen: null,
|
|
43
|
+
markSeen: () => {},
|
|
44
|
+
refresh: () => {},
|
|
45
|
+
rolesConfigCorrupted: false,
|
|
46
|
+
rolesConfigErrors: [],
|
|
47
|
+
runRolesRecovery: async () => {},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** With a stub controller, so a test can tell whether the dialog was asked for. */
|
|
52
|
+
function mountWithController(isAdmin: boolean, compact = false, isAdminLoading = false) {
|
|
53
|
+
const invite: InviteDialogController = { open: vi.fn(), invitedRevision: 0 };
|
|
54
|
+
render(
|
|
55
|
+
<AuthContext.Provider value={authValue()}>
|
|
56
|
+
<AdminContext.Provider value={adminValue(isAdmin, isAdminLoading)}>
|
|
57
|
+
<InviteDialogContext.Provider value={invite}>
|
|
58
|
+
<div>
|
|
59
|
+
<p>Elsewhere on the page</p>
|
|
60
|
+
<InviteButton compact={compact} />
|
|
61
|
+
</div>
|
|
62
|
+
</InviteDialogContext.Provider>
|
|
63
|
+
</AdminContext.Provider>
|
|
64
|
+
</AuthContext.Provider>,
|
|
65
|
+
);
|
|
66
|
+
return invite;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function popover() {
|
|
70
|
+
return screen.queryByRole('group', { name: 'Ask an admin to invite people' });
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
beforeEach(() => {
|
|
74
|
+
fetchAdminsMock.mockReset().mockResolvedValue(ADMINS);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
describe('InviteButton while the admin check is still out', () => {
|
|
78
|
+
it('is visibly disabled, so a click opens nothing: no ask-an-admin popover for someone who may be an admin', async () => {
|
|
79
|
+
const invite = mountWithController(false, false, true);
|
|
80
|
+
expect(screen.getByRole('button', { name: 'Invite' })).toBeDisabled();
|
|
81
|
+
await userEvent.click(screen.getByRole('button', { name: 'Invite' }));
|
|
82
|
+
expect(popover()).toBeNull();
|
|
83
|
+
expect(fetchAdminsMock).not.toHaveBeenCalled();
|
|
84
|
+
expect(invite.open).not.toHaveBeenCalled();
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('InviteButton for an admin', () => {
|
|
89
|
+
it('opens the Invite dialog, and no popover', async () => {
|
|
90
|
+
render(
|
|
91
|
+
<AuthContext.Provider value={authValue()}>
|
|
92
|
+
<AdminContext.Provider value={adminValue(true)}>
|
|
93
|
+
<InviteDialogProvider>
|
|
94
|
+
<InviteButton />
|
|
95
|
+
</InviteDialogProvider>
|
|
96
|
+
</AdminContext.Provider>
|
|
97
|
+
</AuthContext.Provider>,
|
|
98
|
+
);
|
|
99
|
+
await userEvent.click(screen.getByRole('button', { name: 'Invite' }));
|
|
100
|
+
expect(screen.getByRole('dialog', { name: 'Invite your team' })).toBeInTheDocument();
|
|
101
|
+
expect(popover()).not.toBeInTheDocument();
|
|
102
|
+
expect(fetchAdminsMock).not.toHaveBeenCalled();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('drops its word on a compact toolbar but keeps its name, and still opens the dialog', async () => {
|
|
106
|
+
const invite = mountWithController(true, true);
|
|
107
|
+
const button = screen.getByRole('button', { name: 'Invite' });
|
|
108
|
+
// Exactly empty: the word is the accessible name, never on screen.
|
|
109
|
+
expect(button.textContent).toBe('');
|
|
110
|
+
await userEvent.click(button);
|
|
111
|
+
expect(invite.open).toHaveBeenCalledTimes(1);
|
|
112
|
+
expect(popover()).not.toBeInTheDocument();
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
describe('InviteButton for anyone else', () => {
|
|
117
|
+
it('is shown, and opens a popover saying to ask an admin — not the dialog', async () => {
|
|
118
|
+
const invite = mountWithController(false);
|
|
119
|
+
const button = screen.getByRole('button', { name: 'Invite' });
|
|
120
|
+
expect(button).toHaveAttribute('aria-expanded', 'false');
|
|
121
|
+
await userEvent.click(button);
|
|
122
|
+
expect(button).toHaveAttribute('aria-expanded', 'true');
|
|
123
|
+
const panel = popover()!;
|
|
124
|
+
expect(within(panel).getByText('Ask an admin to invite people')).toBeInTheDocument();
|
|
125
|
+
expect(within(panel).getByText('Only admins can add people to this workspace.')).toBeInTheDocument();
|
|
126
|
+
expect(invite.open).not.toHaveBeenCalled();
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('lists every admin with name, email and an Email button carrying the request', async () => {
|
|
130
|
+
mountWithController(false);
|
|
131
|
+
await userEvent.click(screen.getByRole('button', { name: 'Invite' }));
|
|
132
|
+
const list = await screen.findByRole('list', { name: 'Admins' });
|
|
133
|
+
const rows = within(list).getAllByRole('listitem');
|
|
134
|
+
expect(rows).toHaveLength(2);
|
|
135
|
+
expect(within(rows[0]).getByText('Dana Admin')).toBeInTheDocument();
|
|
136
|
+
expect(within(rows[0]).getByText('dana@acme.com')).toBeInTheDocument();
|
|
137
|
+
expect(within(rows[1]).getByText('Sam Ortiz')).toBeInTheDocument();
|
|
138
|
+
expect(within(rows[1]).getByText('sam.ortiz@acme.com')).toBeInTheDocument();
|
|
139
|
+
|
|
140
|
+
const email = within(rows[0]).getByRole('link', { name: 'Email Dana Admin' });
|
|
141
|
+
expect(email).toHaveTextContent('Email');
|
|
142
|
+
const href = email.getAttribute('href')!;
|
|
143
|
+
expect(href.startsWith('mailto:dana@acme.com?')).toBe(true);
|
|
144
|
+
const params = new URLSearchParams(href.slice(href.indexOf('?') + 1));
|
|
145
|
+
expect(params.get('subject')).toBe('Please invite someone to Hexis');
|
|
146
|
+
expect(params.get('body')).toBe(
|
|
147
|
+
`Hi Dana,\n\nCould you invite ... to our workspace at ${window.location.origin}?\n\nThanks`,
|
|
148
|
+
);
|
|
149
|
+
expect(within(rows[1]).getByRole('link', { name: 'Email Sam Ortiz' }).getAttribute('href')).toMatch(
|
|
150
|
+
/^mailto:sam\.ortiz@acme\.com\?.*Hi%20Sam%2C/,
|
|
151
|
+
);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('keeps its two lines and lists nobody when the admins cannot be read', async () => {
|
|
155
|
+
fetchAdminsMock.mockRejectedValue(new Error('down'));
|
|
156
|
+
mountWithController(false);
|
|
157
|
+
await userEvent.click(screen.getByRole('button', { name: 'Invite' }));
|
|
158
|
+
await waitFor(() => expect(fetchAdminsMock).toHaveBeenCalled());
|
|
159
|
+
const panel = popover()!;
|
|
160
|
+
expect(within(panel).getByText('Ask an admin to invite people')).toBeInTheDocument();
|
|
161
|
+
expect(within(panel).getByText('Only admins can add people to this workspace.')).toBeInTheDocument();
|
|
162
|
+
expect(within(panel).queryByRole('list')).not.toBeInTheDocument();
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('closes on Escape and hands focus back to the button', async () => {
|
|
166
|
+
mountWithController(false);
|
|
167
|
+
const button = screen.getByRole('button', { name: 'Invite' });
|
|
168
|
+
await userEvent.click(button);
|
|
169
|
+
await screen.findByRole('list', { name: 'Admins' });
|
|
170
|
+
await userEvent.keyboard('{Escape}');
|
|
171
|
+
expect(popover()).not.toBeInTheDocument();
|
|
172
|
+
expect(button).toHaveFocus();
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('closes on a click outside', async () => {
|
|
176
|
+
mountWithController(false);
|
|
177
|
+
await userEvent.click(screen.getByRole('button', { name: 'Invite' }));
|
|
178
|
+
expect(popover()).toBeInTheDocument();
|
|
179
|
+
await userEvent.click(screen.getByText('Elsewhere on the page'));
|
|
180
|
+
expect(popover()).not.toBeInTheDocument();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('toggles closed on a second click of the button', async () => {
|
|
184
|
+
mountWithController(false);
|
|
185
|
+
const button = screen.getByRole('button', { name: 'Invite' });
|
|
186
|
+
await userEvent.click(button);
|
|
187
|
+
await userEvent.click(button);
|
|
188
|
+
expect(popover()).not.toBeInTheDocument();
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('the compact icon opens the same popover', async () => {
|
|
192
|
+
const invite = mountWithController(false, true);
|
|
193
|
+
await userEvent.click(screen.getByRole('button', { name: 'Invite' }));
|
|
194
|
+
expect(popover()).toBeInTheDocument();
|
|
195
|
+
expect(await screen.findByRole('list', { name: 'Admins' })).toBeInTheDocument();
|
|
196
|
+
expect(invite.open).not.toHaveBeenCalled();
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
describe('InviteButton outside a provider', () => {
|
|
201
|
+
it('renders nothing, for an admin or anyone else', () => {
|
|
202
|
+
render(
|
|
203
|
+
<AuthContext.Provider value={authValue()}>
|
|
204
|
+
<AdminContext.Provider value={adminValue(true)}>
|
|
205
|
+
<InviteButton />
|
|
206
|
+
</AdminContext.Provider>
|
|
207
|
+
<AdminContext.Provider value={adminValue(false)}>
|
|
208
|
+
<InviteButton compact />
|
|
209
|
+
</AdminContext.Provider>
|
|
210
|
+
</AuthContext.Provider>,
|
|
211
|
+
);
|
|
212
|
+
expect(screen.queryByRole('button', { name: 'Invite' })).not.toBeInTheDocument();
|
|
213
|
+
});
|
|
214
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { fetchAgentConnection } from '../services/agent-connection.api';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET /api/onboarding/agent-connection`, read field by field: the two
|
|
6
|
+
* documented shapes come through, and anything else is a failure — never a
|
|
7
|
+
* quiet "not connected", and never a stray value steering the first-page
|
|
8
|
+
* step's links.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const { authFetchMock } = vi.hoisted(() => ({ authFetchMock: vi.fn() }));
|
|
12
|
+
vi.mock('../../../lib/api', () => ({ authFetch: authFetchMock }));
|
|
13
|
+
|
|
14
|
+
function answer(body: unknown, status = 200) {
|
|
15
|
+
authFetchMock.mockResolvedValueOnce({ ok: status < 400, status, json: async () => body } as Response);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
authFetchMock.mockReset();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe('fetchAgentConnection', () => {
|
|
23
|
+
it('reads "not yet"', async () => {
|
|
24
|
+
answer({ connected: false });
|
|
25
|
+
await expect(fetchAgentConnection()).resolves.toEqual({ connected: false });
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('reads "connected", with when, as what and through which kind of credential', async () => {
|
|
29
|
+
answer({ connected: true, at: '2026-10-07T12:00:00.000Z', client: 'Claude', kind: 'agent' });
|
|
30
|
+
await expect(fetchAgentConnection()).resolves.toEqual({
|
|
31
|
+
connected: true,
|
|
32
|
+
at: '2026-10-07T12:00:00.000Z',
|
|
33
|
+
client: 'Claude',
|
|
34
|
+
kind: 'agent',
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('throws on a refusal', async () => {
|
|
39
|
+
answer({ error: 'nope' }, 401);
|
|
40
|
+
await expect(fetchAgentConnection()).rejects.toThrow('agent-connection: 401');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it.each([
|
|
44
|
+
['null', null],
|
|
45
|
+
['an array', []],
|
|
46
|
+
['no connected flag', { client: 'Claude' }],
|
|
47
|
+
['a connected flag that is not a boolean', { connected: 'yes' }],
|
|
48
|
+
['a non-string time', { connected: true, at: 1700000000000 }],
|
|
49
|
+
['a non-string client', { connected: true, client: { name: 'Claude' } }],
|
|
50
|
+
['an unknown kind', { connected: true, client: 'Claude', kind: 'oauth' }],
|
|
51
|
+
])('throws on a malformed body: %s', async (_label, body) => {
|
|
52
|
+
answer(body);
|
|
53
|
+
await expect(fetchAgentConnection()).rejects.toThrow('agent-connection: malformed body');
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { render,
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
|
|
5
5
|
import type { ReactNode } from 'react';
|
|
@@ -9,11 +9,20 @@ import { authValue } from '../../library/__tests__/auth-harness';
|
|
|
9
9
|
import { LibraryContext } from '../../library/state/library-context';
|
|
10
10
|
import type { LibraryContextValue } from '../../library/state/library-data';
|
|
11
11
|
import { LibraryToastProvider } from '../../library/state/toast';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import { LibraryPage } from '../../library/components/LibraryPage';
|
|
13
|
+
import { LIBRARY_ROOT } from '../../library/routes/library-paths';
|
|
14
|
+
import type { LibraryFilter } from '../../library/utils/status';
|
|
15
|
+
import { WorkspaceContext } from '../../workspace/state/workspace.context';
|
|
16
|
+
import { makeWorkspaceFixture } from '../../workspace/__tests__/testFixtures';
|
|
15
17
|
import { resetOnboardingForTests } from '../state/onboarding';
|
|
16
18
|
|
|
19
|
+
/**
|
|
20
|
+
* The creator welcome: Skills & Tools' empty state for an admin. The page the
|
|
21
|
+
* Library opens on (Everything) offers a first plugin and a first skill in
|
|
22
|
+
* place of an empty gallery — only for an admin, only once both indexes have
|
|
23
|
+
* answered empty, and only there.
|
|
24
|
+
*/
|
|
25
|
+
|
|
17
26
|
const serviceMocks = vi.hoisted(() => ({
|
|
18
27
|
createPlugin: vi.fn(),
|
|
19
28
|
createEmptySkill: vi.fn(),
|
|
@@ -21,7 +30,8 @@ const serviceMocks = vi.hoisted(() => ({
|
|
|
21
30
|
|
|
22
31
|
vi.mock('../../library/services/plugins.api', async (importOriginal) => {
|
|
23
32
|
const actual = await importOriginal<typeof import('../../library/services/plugins.api')>();
|
|
24
|
-
|
|
33
|
+
// The gallery asks for join requests to show; nobody is asking here.
|
|
34
|
+
return { ...actual, createPlugin: serviceMocks.createPlugin, listJoinRequests: vi.fn().mockResolvedValue([]) };
|
|
25
35
|
});
|
|
26
36
|
|
|
27
37
|
vi.mock('../../library/services/library.api', async (importOriginal) => {
|
|
@@ -91,18 +101,19 @@ function providers(
|
|
|
91
101
|
})}
|
|
92
102
|
>
|
|
93
103
|
<AdminContext.Provider value={admin(options.admin)}>
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
|
|
104
|
+
<WorkspaceContext.Provider value={makeWorkspaceFixture()}>
|
|
105
|
+
<LibraryContext.Provider value={library(options.library)}>
|
|
106
|
+
<LibraryToastProvider>{children}</LibraryToastProvider>
|
|
107
|
+
</LibraryContext.Provider>
|
|
108
|
+
</WorkspaceContext.Provider>
|
|
97
109
|
</AdminContext.Provider>
|
|
98
110
|
</AuthContext.Provider>
|
|
99
111
|
);
|
|
100
112
|
}
|
|
101
113
|
|
|
102
114
|
interface WelcomeOptions {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
routeState?: Record<string, unknown>;
|
|
115
|
+
/** The Library view on screen; Everything, the page it opens on, unless said. */
|
|
116
|
+
filter?: LibraryFilter;
|
|
106
117
|
admin?: Partial<AdminContextValue>;
|
|
107
118
|
library?: Partial<LibraryContextValue>;
|
|
108
119
|
}
|
|
@@ -113,16 +124,12 @@ interface WelcomeOptions {
|
|
|
113
124
|
* hand-assembling a second copy that can drift from this one.
|
|
114
125
|
*/
|
|
115
126
|
function welcomeUi(options: WelcomeOptions = {}) {
|
|
116
|
-
const entry = options.greeted === false
|
|
117
|
-
? WELCOME_PATH
|
|
118
|
-
: { pathname: WELCOME_PATH, state: options.routeState ?? { greeting: true } };
|
|
119
|
-
|
|
120
127
|
return (
|
|
121
|
-
<MemoryRouter initialEntries={[
|
|
128
|
+
<MemoryRouter initialEntries={[LIBRARY_ROOT]}>
|
|
122
129
|
{providers(
|
|
123
130
|
<>
|
|
124
131
|
<Routes>
|
|
125
|
-
<Route path={
|
|
132
|
+
<Route path={LIBRARY_ROOT} element={<LibraryPage filter={options.filter ?? { kind: 'all' }} />} />
|
|
126
133
|
<Route path="/skills-and-tools/plugins/:plugin" element={<div>plugin page</div>} />
|
|
127
134
|
<Route path="/skills-and-tools/skills/:skill" element={<div>skill page</div>} />
|
|
128
135
|
</Routes>
|
|
@@ -138,9 +145,23 @@ function renderWelcome(options: WelcomeOptions = {}) {
|
|
|
138
145
|
return render(welcomeUi(options));
|
|
139
146
|
}
|
|
140
147
|
|
|
148
|
+
const ROADMAP_SKILL: LibraryContextValue['items'][number] = {
|
|
149
|
+
kind: 'skill',
|
|
150
|
+
id: 'roadmap',
|
|
151
|
+
name: 'roadmap',
|
|
152
|
+
description: 'Keeps the roadmap current.',
|
|
153
|
+
owned: true,
|
|
154
|
+
canWrite: true,
|
|
155
|
+
status: { state: 'ok', text: 'Ready' },
|
|
156
|
+
plugin: null,
|
|
157
|
+
path: 'Skills/roadmap',
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const isCreatorWelcome = () => screen.queryByText(/Build the shared library/) !== null;
|
|
161
|
+
const isGallery = () => screen.queryByRole('heading', { name: 'Everything', level: 1 }) !== null;
|
|
162
|
+
|
|
141
163
|
beforeEach(() => {
|
|
142
164
|
resetOnboardingForTests();
|
|
143
|
-
setSidebarCollapsed(false, true);
|
|
144
165
|
serviceMocks.createPlugin.mockReset();
|
|
145
166
|
serviceMocks.createPlugin.mockResolvedValue({ folder: 'Design', name: 'design' });
|
|
146
167
|
serviceMocks.createEmptySkill.mockReset();
|
|
@@ -152,92 +173,76 @@ beforeEach(() => {
|
|
|
152
173
|
});
|
|
153
174
|
});
|
|
154
175
|
|
|
155
|
-
describe('creator welcome
|
|
156
|
-
it('welcomes an admin to build a truly empty library', () => {
|
|
176
|
+
describe('creator welcome: the empty state of Skills & Tools', () => {
|
|
177
|
+
it('welcomes an admin to build a truly empty library, in place of the gallery', () => {
|
|
157
178
|
renderWelcome();
|
|
158
179
|
|
|
159
180
|
expect(screen.getByRole('heading', { name: 'Welcome, Juan' })).toBeInTheDocument();
|
|
160
181
|
expect(screen.getByText(/Build the shared library/)).toBeInTheDocument();
|
|
161
182
|
expect(screen.getByRole('button', { name: 'Create a plugin' })).toBeInTheDocument();
|
|
162
183
|
expect(screen.getByRole('button', { name: 'Create a skill' })).toBeInTheDocument();
|
|
163
|
-
expect(
|
|
184
|
+
expect(isGallery()).toBe(false);
|
|
164
185
|
});
|
|
165
186
|
|
|
166
|
-
it('keeps the
|
|
187
|
+
it('keeps the gallery for members, whose job is not the shared structure', () => {
|
|
167
188
|
renderWelcome({ admin: { isAdmin: false } });
|
|
168
189
|
|
|
169
|
-
expect(
|
|
170
|
-
expect(
|
|
190
|
+
expect(isGallery()).toBe(true);
|
|
191
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
171
192
|
});
|
|
172
193
|
|
|
173
|
-
it('keeps the
|
|
174
|
-
renderWelcome({
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
+
it('keeps the gallery once the catalog holds anything — a skill, or a plugin', () => {
|
|
195
|
+
const { rerender } = renderWelcome({ library: { items: [ROADMAP_SKILL] } });
|
|
196
|
+
expect(isGallery()).toBe(true);
|
|
197
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
198
|
+
|
|
199
|
+
rerender(
|
|
200
|
+
welcomeUi({
|
|
201
|
+
library: {
|
|
202
|
+
pluginSummaries: [
|
|
203
|
+
{
|
|
204
|
+
name: 'GTM',
|
|
205
|
+
folders: ['Plugins/GTM'],
|
|
206
|
+
canRead: true,
|
|
207
|
+
canWrite: true,
|
|
208
|
+
isOwner: true,
|
|
209
|
+
skillCount: 0,
|
|
210
|
+
toolCount: 0,
|
|
211
|
+
owners: { roles: [], users: [] },
|
|
212
|
+
writers: { roles: [], users: [] },
|
|
213
|
+
readers: { roles: [], users: [], restricted: false },
|
|
214
|
+
hasRequested: false,
|
|
215
|
+
requestNumber: null,
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
}),
|
|
220
|
+
);
|
|
221
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
194
222
|
});
|
|
195
223
|
|
|
196
|
-
it('does not mistake loading or failed
|
|
197
|
-
// While the ADMIN verdict is unknown the hold says nothing about a
|
|
198
|
-
// library — the reader may be headed for the agent welcome, where theirs
|
|
199
|
-
// is beside the point.
|
|
224
|
+
it('does not mistake an unsettled admin verdict, or loading or failed indexes, for an empty library', () => {
|
|
200
225
|
const { rerender } = renderWelcome({ admin: { isAdminLoading: true } });
|
|
201
|
-
expect(
|
|
226
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
202
227
|
|
|
203
|
-
rerender(welcomeUi({ library: {
|
|
228
|
+
rerender(welcomeUi({ library: { loading: true } }));
|
|
229
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
204
230
|
|
|
205
|
-
|
|
206
|
-
|
|
231
|
+
rerender(welcomeUi({ library: { pluginsLoading: true } }));
|
|
232
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
207
233
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
expect(screen.getByText('Preparing your library…')).toBeInTheDocument();
|
|
211
|
-
});
|
|
234
|
+
rerender(welcomeUi({ library: { pluginsError: "Couldn't load plugins." } }));
|
|
235
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
212
236
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
// admin would otherwise be routed to the creator page — and lose the page
|
|
216
|
-
// their SSO round-trip was carrying them to.
|
|
217
|
-
renderWelcome({
|
|
218
|
-
routeState: {
|
|
219
|
-
greeting: true,
|
|
220
|
-
returnTo: '/workspace/main/knowledge-base/KnowledgeBase/Start here.md',
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
expect(screen.getByRole('radiogroup', { name: 'Your agent' })).toBeInTheDocument();
|
|
224
|
-
expect(screen.getByRole('button', { name: /Continue to your link/ })).toBeInTheDocument();
|
|
225
|
-
expect(screen.queryByText(/Build the shared library/)).toBeNull();
|
|
237
|
+
rerender(welcomeUi({ library: { error: "Couldn't load the library." } }));
|
|
238
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
226
239
|
});
|
|
227
240
|
|
|
228
|
-
it('
|
|
229
|
-
renderWelcome({
|
|
241
|
+
it('is the empty state of Everything alone, not of every view', () => {
|
|
242
|
+
renderWelcome({ filter: { kind: 'owned' } });
|
|
230
243
|
|
|
231
|
-
expect(screen.getByRole('
|
|
232
|
-
expect(
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it('collapses the sidebar before the creator welcome is shown', () => {
|
|
236
|
-
renderWelcome();
|
|
237
|
-
expect(renderHook(() => useSidebar()).result.current).toMatchObject({
|
|
238
|
-
collapsed: true,
|
|
239
|
-
instant: true,
|
|
240
|
-
});
|
|
244
|
+
expect(screen.getByRole('heading', { name: 'Owned by me', level: 1 })).toBeInTheDocument();
|
|
245
|
+
expect(isCreatorWelcome()).toBe(false);
|
|
241
246
|
});
|
|
242
247
|
});
|
|
243
248
|
|