Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
4574206
First version
zenoachtig Nov 12, 2025
22a4e04
Update assistant and embedded assistant
zenoachtig Nov 17, 2025
46930f1
Typecheck
zenoachtig Nov 17, 2025
69a68fc
Merge branch 'main' into update-assistant-styling
zenoachtig Nov 17, 2025
3e6612a
Tweaks
zenoachtig Nov 17, 2025
57ccf4d
Update AIChatMessages.tsx
zenoachtig Nov 17, 2025
ab605a6
Merge branch 'main' into update-assistant-styling
zenoachtig Nov 19, 2025
2aff815
Update AiChatFollowupSuggestions.tsx
zenoachtig Nov 19, 2025
4e84fc3
Update AiChatFollowupSuggestions.tsx
zenoachtig Nov 19, 2025
cae7fd8
Merge branch 'main' into update-embed-frame
zenoachtig Nov 19, 2025
1bba367
Add container query for height calculation of default styles
zenoachtig Nov 19, 2025
ad8c9e2
Merge branch 'update-assistant-styling' into update-embed-frame
zenoachtig Nov 19, 2025
a77455a
Update Embed frame
zenoachtig Nov 24, 2025
e068cac
Merge branch 'main' into update-embed-frame
zenoachtig Nov 25, 2025
08dc09e
Temporarily override bunfile with new API to get through CI
zenoachtig Nov 25, 2025
950dd7e
Format
zenoachtig Nov 25, 2025
dbed6f1
Remove unnecessary translation
zenoachtig Nov 25, 2025
7880a3b
Upgrade to API properly
zenoachtig Nov 25, 2025
c46b987
Fix type error in Updates block
zenoachtig Nov 25, 2025
2a85537
Changeset
zenoachtig Nov 25, 2025
85f6fc5
Remove example actions
zenoachtig Nov 25, 2025
f6d7872
Fix section tabs not linking correctly
zenoachtig Nov 25, 2025
0e1c39c
Update EmbeddableIframeAPI.tsx
zenoachtig Nov 25, 2025
dd7080e
Improve button icon rendering
zenoachtig Nov 26, 2025
462011d
Update useAI.tsx
zenoachtig Nov 26, 2025
f4c8eee
Update embed docs
zenoachtig Nov 26, 2025
2e63128
Fix open in new tab button
zenoachtig Nov 26, 2025
71c7f1f
Merge branch 'main' into update-embed-frame
zenoachtig Nov 27, 2025
be4ceae
Merge branch 'main' into update-embed-frame
zenoachtig Nov 27, 2025
f5ba352
Add event listener to AIChatController
zenoachtig Nov 27, 2025
c83ae7e
Add e2e tests for embed frame
zenoachtig Nov 27, 2025
ba15081
Merge branch 'main' into update-embed-frame
zenoachtig Nov 28, 2025
37d0846
Merge branch 'main' into update-embed-frame
zenoachtig Nov 28, 2025
3c66cba
Merge branch 'main' into update-embed-frame
zenoachtig Nov 28, 2025
f883678
Review
zenoachtig Dec 2, 2025
ac0da20
Add back deprecated buttons prop
zenoachtig Dec 2, 2025
15124fa
Update README.md
zenoachtig Dec 2, 2025
8ee4794
Merge branch 'main' into update-embed-frame
zenoachtig Dec 2, 2025
ea61a93
Review
zenoachtig Dec 2, 2025
d2725f5
Review
zenoachtig Dec 4, 2025
7dc7701
Merge branch 'main' into update-embed-frame
zenoachtig Dec 4, 2025
0593045
Fix route misconfig
zenoachtig Dec 4, 2025
cc7fbbe
Merge branch 'update-embed-frame' into embed-frame-e2e
zenoachtig Dec 4, 2025
ed71485
Merge branch 'main' into embed-frame-e2e
zenoachtig Dec 4, 2025
20726c4
Update util.ts
zenoachtig Dec 4, 2025
2d22f0a
Update internal.spec.ts
zenoachtig Dec 4, 2025
12a433b
Update internal.spec.ts
zenoachtig Dec 4, 2025
b7bc5ba
Update internal.spec.ts
zenoachtig Dec 4, 2025
d7b41a7
Update internal.spec.ts
zenoachtig Dec 4, 2025
dc5e88e
Update internal.spec.ts
zenoachtig Dec 4, 2025
27e9c5e
Add timeouts?
zenoachtig Dec 4, 2025
9699dcd
Merge branch 'main' into embed-frame-e2e
zenoachtig Dec 5, 2025
641e137
Try increasing timeout
zenoachtig Dec 5, 2025
985f280
Update internal.spec.ts
zenoachtig Dec 6, 2025
feb67f7
Revert "Update internal.spec.ts"
zenoachtig Dec 6, 2025
9c9aad1
Update internal.spec.ts
zenoachtig Dec 6, 2025
54ed8fc
Merge branch 'main' into embed-frame-e2e
zenoachtig Dec 6, 2025
e38f6a1
Update internal.spec.ts
zenoachtig Dec 6, 2025
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
1 change: 1 addition & 0 deletions packages/embed/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './client';
export * from './standalone';
356 changes: 354 additions & 2 deletions packages/gitbook/e2e/internal.spec.ts

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/gitbook/e2e/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ export async function waitForIcons(page: Page) {
*/
async function waitForTOCScrolling(page: Page) {
const viewport = await page.viewportSize();
if (viewport && viewport.width >= 1024) {
if (viewport && viewport.width >= 1024 && !page.url().includes('~gitbook/embed/demo')) {
// The embed demo is an iframe, which means the viewport only a fraction of the main document. So there is no open TOC to scroll to.
const toc = page.getByTestId('table-of-contents');
await expect(toc).toBeVisible();
await page.evaluate(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ function ToolCallSummary(props: { toolCall: AIToolCall; context: GitBookSiteCont
const { toolCall, context } = props;

return (
<div className="mt-2 flex origin-top-left animate-blur-in-slow items-start gap-2 text-sm text-tint-subtle">
<div
data-testid="ai-chat-tool-summary"
className="mt-2 flex origin-top-left animate-blur-in-slow items-start gap-2 text-sm text-tint-subtle"
>
<Icon
icon={getIconForToolCall(toolCall)}
className="mt-1 size-3 shrink-0 text-tint-subtle/8"
Expand Down
6 changes: 3 additions & 3 deletions packages/gitbook/src/components/AIChat/AIChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export function AIChat() {

return (
<div
data-testid="ai-chat"
className={tcls(
'ai-chat inset-y-0 right-0 z-40 mx-auto flex max-w-3xl scroll-mt-36 px-4 py-4 transition-[width,opacity,margin,display] transition-discrete duration-300 sm:px-6 lg:fixed lg:w-80 lg:p-0 xl:w-96',
chat.opened
Expand All @@ -79,7 +78,7 @@ export function AIChat() {
)}
>
<EmbeddableFrame className="relative shrink-0 border-tint-subtle border-l to-tint-base transition-all duration-300 max-lg:circular-corners:rounded-3xl max-lg:rounded-corners:rounded-md max-lg:border lg:w-80 xl:w-96">
<EmbeddableFrameMain>
<EmbeddableFrameMain data-testid="ai-chat">
<EmbeddableFrameHeader>
<AIChatDynamicIcon trademark={config.trademark} />
<EmbeddableFrameHeaderMain>
Expand Down Expand Up @@ -237,13 +236,14 @@ export function AIChatBody(props: {
<h5
className="animate-blur-in-slow font-bold text-lg text-tint-strong [@container(min-height:400px)]:text-center"
style={{ animationDelay: '.5s' }}
data-testid="ai-chat-time-greeting"
data-testid="ai-chat-greeting-title"
>
{timeGreeting}
</h5>
<p
className="animate-blur-in-slow text-tint [@container(min-height:400px)]:text-center"
style={{ animationDelay: '.6s' }}
data-testid="ai-chat-greeting-subtitle"
>
{t(language, 'ai_chat_assistant_description')}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ export default function AIChatSuggestedQuestions(props: {
} = props;

return (
<div className="flex flex-col items-start gap-2 self-start">
<div
className="flex flex-col items-start gap-2 self-start"
data-testid="ai-chat-suggested-questions"
>
{suggestions.map((question, index) => (
<Button
data-testid="ai-chat-suggested-question"
key={question}
variant="blank"
size="medium"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function AIChatToolConfirmations(props: {
style={{ animationDelay: `${0.5 + index * 0.1}s` }}
>
<Button
data-testid="ai-chat-tool-confirmation"
onClick={() => {
tool.confirm();
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function EmbeddableAIChat(props: EmbeddableAIChatProps) {
/>
<EmbeddableIframeButtons />
</EmbeddableFrameSidebar>
<EmbeddableFrameMain>
<EmbeddableFrameMain data-testid="ai-chat">
<EmbeddableFrameHeader>
{!tabsRef.current ? (
<AIChatDynamicIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function EmbeddableDocsPage(props: EmbeddableDocsPageProps) {
/>
<EmbeddableIframeButtons />
</EmbeddableFrameSidebar>
<EmbeddableFrameMain>
<EmbeddableFrameMain data-testid="embed-docs-page">
<div className="relative flex not-hydrated:animate-blur-in-slow flex-col">
<EmbeddableFrameHeader>
<HeaderMobileMenu className="-ml-2 page-no-toc:hidden" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export function EmbeddableDocsPageControlButtons(props: { href: string }) {
return (
<Button
icon="arrow-up-right-from-square"
data-testid="embed-docs-page-open-in-new-tab"
label={tString(language, 'open_in_new_tab')}
href={href}
target="_blank"
Expand Down
10 changes: 7 additions & 3 deletions packages/gitbook/src/components/Embeddable/EmbeddableFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ export const EmbeddableFrame = React.forwardRef<HTMLDivElement, EmbeddableFrameP
}
);

export function EmbeddableFrameMain(props: { children: React.ReactNode }) {
const { children } = props;
export function EmbeddableFrameMain(props: React.ComponentProps<'div'>) {
const { children, ...rest } = props;

return <div className="flex flex-1 flex-col overflow-hidden">{children}</div>;
return (
<div className="flex flex-1 flex-col overflow-hidden" {...rest}>
{children}
</div>
);
}

export function EmbeddableFrameHeader(props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export function EmbeddableIframeButtons() {
)}
{actions.map((action, index) => (
<Button
data-testid="embed-action"
key={action.label}
size="default"
variant="blank"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export function HeaderMobileMenu(props: ButtonProps) {

return (
<Button
data-testid="toc-button"
icon="bars"
iconOnly
variant="blank"
Expand Down
Loading