Provide current page to integration block webframes#4362
Open
gregberge wants to merge 4 commits into
Open
Conversation
Expose the current page (id, path, title) to integration block webframes via the client-only webframe state, reusing the same postMessage channel as adaptive visitor claims. The page is sourced from the block's server-side content context rather than the integration render request, so the integration render cache is unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Only expose the current page to a webframe when the integration's render output declares it can access page context (canAccessPageContext), mirroring canAccessVisitorClaims. The @gitbook/api type does not yet include the flag, so the read is temporarily annotated with @ts-expect-error. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 31a53a7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Per review (avoid another customer-specific integration scope): expose the current page to webframes unconditionally, since path/id/title are non-sensitive (no shareKey or token). Also add a @webframe.navigate action so a webframe can navigate the reader to another page within the space, resolved client-side against the space base path via the router. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gregberge
commented
Jul 3, 2026
Address review: resolve the @webframe.navigate action against the site base path (toPathInSite) rather than the current space, so a webframe can navigate to a page in any section or space of the site. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Exposes the current page and a navigation capability to integration block webframes, over the client-only webframe
state/ postMessage channel (the same channel as adaptive visitor claims):state.page— the current page as{ id, path, title }, injected unconditionally (no dedicated scope — path/id/title are non-sensitive, with no shareKey or token).@webframe.navigate— a webframe can post this action to navigate the reader to another page in the site (any section or space). Resolved client-side against the site base path via the Next.js router, so navigation stays in-site.Both are delivered client-side (never through the integration render request), so the integration render cache is unchanged.
Why
RND-11604 — integrations (e.g. harness) need the current page inside a webframe and the ability to navigate to sibling pages within the space. Docs: GitbookIO/integrations#1230.
Notes
site:page:contextscope (avoiding another customer-specific integration scope). No@gitbook/apior backend change is needed — the gitbook-x companion PR was closed.contentContext.pageresolves to the source content, sopagemay benullthere.Test plan
bun run typecheck— 27/27bun testonadaptive.test.ts— 5/5biome checkon changed files — clean🤖 Generated with Claude Code