@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
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Users } from 'lucide-react';
|
|
3
|
+
import { Button, IconButton, MenuPanel, buttonClasses, useDismissableMenu } from '../../../shared/components';
|
|
4
|
+
import { useAdmin } from '../../admin/state/admin.context';
|
|
5
|
+
import { fetchAdmins, type AdminContact } from '../../access/api';
|
|
6
|
+
import { useInviteDialog } from '../state/invite-dialog.context';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* An email to one admin asking them to invite someone: the person only has
|
|
10
|
+
* to fill in who. The workspace's address is in it so the admin knows which
|
|
11
|
+
* workspace is meant.
|
|
12
|
+
*/
|
|
13
|
+
function inviteRequestMailto(admin: AdminContact, origin: string): string {
|
|
14
|
+
const first = admin.name.split(/\s+/)[0] || admin.name;
|
|
15
|
+
const subject = 'Please invite someone to Hexis';
|
|
16
|
+
const body = `Hi ${first},\n\nCould you invite ... to our workspace at ${origin}?\n\nThanks`;
|
|
17
|
+
return `mailto:${admin.email}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The toolbar's Invite button, shown to everyone signed in. An admin's click
|
|
22
|
+
* opens the Invite dialog — the same one as the "Get set up" column's invite
|
|
23
|
+
* step. Anyone else's opens a popover under the button saying only admins
|
|
24
|
+
* add people, and listing the admins, each with an Email button: a person
|
|
25
|
+
* who wants a colleague in learns how to get them in. The popover creates
|
|
26
|
+
* nothing, and closes like the profile menu (a click outside, or Escape,
|
|
27
|
+
* which hands focus back to the button).
|
|
28
|
+
*
|
|
29
|
+
* `compact` is the toolbar's narrow layout, where every control shares one
|
|
30
|
+
* row with the essentials: the button sheds its word and keeps the icon, so
|
|
31
|
+
* it cannot push the profile menu off-screen. Its name stays "Invite" either
|
|
32
|
+
* way — the label carries it where the word is gone.
|
|
33
|
+
*
|
|
34
|
+
* Renders nothing outside an invite provider: the toolbar is mounted bare in
|
|
35
|
+
* tests and by hosts, and a button with nothing to open is a dead control.
|
|
36
|
+
*/
|
|
37
|
+
export function InviteButton({ compact = false }: { compact?: boolean }) {
|
|
38
|
+
const { isAdmin, isAdminLoading = false } = useAdmin();
|
|
39
|
+
const invite = useInviteDialog();
|
|
40
|
+
const [asking, setAsking] = useState(false);
|
|
41
|
+
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
42
|
+
const panelRef = useDismissableMenu<HTMLDivElement>({
|
|
43
|
+
open: asking,
|
|
44
|
+
onClose: () => setAsking(false),
|
|
45
|
+
returnFocusTo: triggerRef,
|
|
46
|
+
});
|
|
47
|
+
if (!invite) return null;
|
|
48
|
+
|
|
49
|
+
// While the admin check is still out the button is disabled, visibly,
|
|
50
|
+
// rather than showing an admin the ask-an-admin popover or answering a
|
|
51
|
+
// click with nothing.
|
|
52
|
+
const onClick = isAdmin ? () => invite.open() : () => setAsking((a) => !a);
|
|
53
|
+
const expanded = isAdmin || isAdminLoading ? undefined : asking;
|
|
54
|
+
const trigger = compact ? (
|
|
55
|
+
<IconButton
|
|
56
|
+
ref={triggerRef}
|
|
57
|
+
aria-label="Invite"
|
|
58
|
+
title="Invite"
|
|
59
|
+
aria-expanded={expanded}
|
|
60
|
+
disabled={isAdminLoading}
|
|
61
|
+
onClick={onClick}
|
|
62
|
+
>
|
|
63
|
+
<Users size={16} aria-hidden />
|
|
64
|
+
</IconButton>
|
|
65
|
+
) : (
|
|
66
|
+
<Button
|
|
67
|
+
ref={triggerRef}
|
|
68
|
+
size="sm"
|
|
69
|
+
leadingIcon={<Users size={14} aria-hidden />}
|
|
70
|
+
aria-expanded={expanded}
|
|
71
|
+
disabled={isAdminLoading}
|
|
72
|
+
onClick={onClick}
|
|
73
|
+
>
|
|
74
|
+
Invite
|
|
75
|
+
</Button>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<div className="relative">
|
|
80
|
+
{trigger}
|
|
81
|
+
{asking && !isAdmin && (
|
|
82
|
+
<div ref={panelRef} className="absolute right-0 top-[calc(100%+5px)] z-40">
|
|
83
|
+
<AskAnAdmin />
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The popover's body. Reads the admins as it opens; when they cannot be
|
|
92
|
+
* read it keeps its two lines and lists nobody — the person still learns
|
|
93
|
+
* that only admins invite.
|
|
94
|
+
*/
|
|
95
|
+
function AskAnAdmin() {
|
|
96
|
+
const [admins, setAdmins] = useState<AdminContact[] | null>(null);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
let cancelled = false;
|
|
99
|
+
fetchAdmins().then(
|
|
100
|
+
(list) => {
|
|
101
|
+
if (!cancelled) setAdmins(list);
|
|
102
|
+
},
|
|
103
|
+
() => {
|
|
104
|
+
if (!cancelled) setAdmins([]);
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
return () => {
|
|
108
|
+
cancelled = true;
|
|
109
|
+
};
|
|
110
|
+
}, []);
|
|
111
|
+
const origin = window.location.origin;
|
|
112
|
+
return (
|
|
113
|
+
// Never wider than the window: on a narrow toolbar the panel hangs off
|
|
114
|
+
// the button's right edge, and a fixed width would run off screen.
|
|
115
|
+
<MenuPanel role="group" aria-label="Ask an admin to invite people" className="w-80 max-w-[calc(100vw-1rem)] p-3">
|
|
116
|
+
<p className="text-strong font-semibold text-ink">Ask an admin to invite people</p>
|
|
117
|
+
<p className="mt-1 text-ui text-ink-muted">Only admins can add people to this workspace.</p>
|
|
118
|
+
{admins && admins.length > 0 && (
|
|
119
|
+
<ul aria-label="Admins" className="mt-3 max-h-64 overflow-y-auto border-t border-line pt-1.5">
|
|
120
|
+
{admins.map((admin) => (
|
|
121
|
+
<li key={admin.email} className="flex items-center gap-3 py-1.5">
|
|
122
|
+
<div className="min-w-0 flex-1">
|
|
123
|
+
<p className="truncate text-ui font-medium text-ink">{admin.name}</p>
|
|
124
|
+
<p className="truncate text-detail text-ink-muted">{admin.email}</p>
|
|
125
|
+
</div>
|
|
126
|
+
<a
|
|
127
|
+
href={inviteRequestMailto(admin, origin)}
|
|
128
|
+
aria-label={`Email ${admin.name}`}
|
|
129
|
+
className={buttonClasses({ variant: 'outline', size: 'sm' })}
|
|
130
|
+
>
|
|
131
|
+
Email
|
|
132
|
+
</a>
|
|
133
|
+
</li>
|
|
134
|
+
))}
|
|
135
|
+
</ul>
|
|
136
|
+
)}
|
|
137
|
+
</MenuPanel>
|
|
138
|
+
);
|
|
139
|
+
}
|