Skip to content

Commit 56c923c

Browse files
Adapt site resolution/lookup to pass visitor unsigned claims in addition to token (#3202)
Co-authored-by: taranvohra <[email protected]>
1 parent 7d7806d commit 56c923c

File tree

12 files changed

+393
-81
lines changed

12 files changed

+393
-81
lines changed

bun.lock

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"name": "@gitbook/cache-tags",
2727
"version": "0.3.1",
2828
"dependencies": {
29-
"@gitbook/api": "^0.111.0",
29+
"@gitbook/api": "^0.115.0",
3030
"assert-never": "^1.2.1",
3131
},
3232
"devDependencies": {
@@ -51,7 +51,7 @@
5151
"name": "gitbook",
5252
"version": "0.11.1",
5353
"dependencies": {
54-
"@gitbook/api": "*",
54+
"@gitbook/api": "^0.115.0",
5555
"@gitbook/cache-do": "workspace:*",
5656
"@gitbook/cache-tags": "workspace:*",
5757
"@gitbook/colors": "workspace:*",
@@ -143,7 +143,7 @@
143143
"name": "gitbook-v2",
144144
"version": "0.2.5",
145145
"dependencies": {
146-
"@gitbook/api": "*",
146+
"@gitbook/api": "^0.115.0",
147147
"@gitbook/cache-tags": "workspace:*",
148148
"@sindresorhus/fnv1a": "^3.1.0",
149149
"assert-never": "^1.2.1",
@@ -202,7 +202,7 @@
202202
"name": "@gitbook/react-contentkit",
203203
"version": "0.7.0",
204204
"dependencies": {
205-
"@gitbook/api": "*",
205+
"@gitbook/api": "^0.115.0",
206206
"@gitbook/icons": "workspace:*",
207207
"classnames": "^2.5.1",
208208
},
@@ -260,7 +260,7 @@
260260
},
261261
"overrides": {
262262
"@codemirror/state": "6.4.1",
263-
"@gitbook/api": "0.113.0",
263+
"@gitbook/api": "^0.115.0",
264264
"react": "^19.0.0",
265265
"react-dom": "^19.0.0",
266266
},
@@ -625,7 +625,7 @@
625625

626626
"@fortawesome/fontawesome-svg-core": ["@fortawesome/[email protected]", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "6.6.0" } }, "sha512-KHwPkCk6oRT4HADE7smhfsKudt9N/9lm6EJ5BVg0tD1yPA5hht837fB87F8pn15D8JfTqQOjhKTktwmLMiD7Kg=="],
627627

628-
"@gitbook/api": ["@gitbook/api@0.113.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-PWMeAkdm4bHSl3b5OmtcmskZ6qRkkDhauCPybo8sGnjS03O14YAUtubAQiNCKX/uwbs+yiQ8KRPyeIwn+g42yw=="],
628+
"@gitbook/api": ["@gitbook/api@0.115.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-Lyj+1WVNnE/Zuuqa/1ZdnUQfUiNE6es89RFK6CJ+Tb36TFwls6mbHKXCZsBwSYyoMYTVK39WQ3Nob6Nw6+TWCA=="],
629629

630630
"@gitbook/cache-do": ["@gitbook/cache-do@workspace:packages/cache-do"],
631631

@@ -4077,7 +4077,7 @@
40774077

40784078
"gaxios/node-fetch": ["[email protected]", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="],
40794079

4080-
"gitbook-v2/next": ["[email protected]", "", { "dependencies": { "@next/env": "15.4.0-canary.7", "@swc/counter": "0.1.3", "@swc/helpers": "0.5.15", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "15.4.0-canary.7", "@next/swc-darwin-x64": "15.4.0-canary.7", "@next/swc-linux-arm64-gnu": "15.4.0-canary.7", "@next/swc-linux-arm64-musl": "15.4.0-canary.7", "@next/swc-linux-x64-gnu": "15.4.0-canary.7", "@next/swc-linux-x64-musl": "15.4.0-canary.7", "@next/swc-win32-arm64-msvc": "15.4.0-canary.7", "@next/swc-win32-x64-msvc": "15.4.0-canary.7", "sharp": "^0.34.1" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.41.2", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-ZYjT0iu+4osz8XIlr31MuoXaNQKRU75UcwEgNBt93gftoh6tzV2Mebz6sOGeVReYuYUvYlLJJksMBTNcFcPbSA=="],
4080+
"gitbook-v2/next": ["[email protected]", "", { "dependencies": { "@next/env": "15.4.0-canary.26", "@swc/helpers": "0.5.15", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "15.4.0-canary.26", "@next/swc-darwin-x64": "15.4.0-canary.26", "@next/swc-linux-arm64-gnu": "15.4.0-canary.26", "@next/swc-linux-arm64-musl": "15.4.0-canary.26", "@next/swc-linux-x64-gnu": "15.4.0-canary.26", "@next/swc-linux-x64-musl": "15.4.0-canary.26", "@next/swc-win32-arm64-msvc": "15.4.0-canary.26", "@next/swc-win32-x64-msvc": "15.4.0-canary.26", "sharp": "^0.34.1" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.41.2", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-0lq0x+H4ewc6vXth3S9shrcK3eYl+4wLXQqdboVwBbJe0ykB3+QbGdXFIEICCZsmbAOaii0ag0tzqD3y/vr3bw=="],
40814081

40824082
"global-dirs/ini": ["[email protected]", "", {}, "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ=="],
40834083

@@ -4969,23 +4969,23 @@
49694969

49704970
"gaxios/https-proxy-agent/debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ=="],
49714971

4972-
"gitbook-v2/next/@next/env": ["@next/[email protected].7", "", {}, "sha512-q8S7f2lQti3Y3gcAPzE8Pj8y0EwiWHVyyilMzoLbDPXGVfxlQhXLRiFdy2cDkKN4DyjGZWDeehEtw4huvJAa3Q=="],
4972+
"gitbook-v2/next/@next/env": ["@next/[email protected].26", "", {}, "sha512-+WeMYRfTZWaosbIAjuNESPVjynDz/NKukoR7mF/u3Wuwr40KgScpxD0IuU0T7XbPfprnaInSKAylufFvrXRh+A=="],
49734973

4974-
"gitbook-v2/next/@next/swc-darwin-arm64": ["@next/[email protected].7", "", { "os": "darwin", "cpu": "arm64" }, "sha512-+TMxUu5CAWNe+UFRc47BZAXQxCRqZfVbGyCldddiog4MorvL7kBxSd1qlmrwI73fRRKtXkHIH1TaeItyxzC9rQ=="],
4974+
"gitbook-v2/next/@next/swc-darwin-arm64": ["@next/[email protected].26", "", { "os": "darwin", "cpu": "arm64" }, "sha512-HxtmV8Uoai8Z4wAU1tFWzASogAS+xVVP5Z5frbFu0yQ+1ocb9xQTjNqhiD5xPSAU8pNGWasCod8tlTCBzJzHQg=="],
49754975

4976-
"gitbook-v2/next/@next/swc-darwin-x64": ["@next/[email protected].7", "", { "os": "darwin", "cpu": "x64" }, "sha512-veXp8lg/X/7O+pG9BDQ3OizFz3B40v29jsvEWj+ULY/W8Z6+dCSd5XPP2M8fG/gKKKA0D6L0CnnM2Mj0RRSUJw=="],
4976+
"gitbook-v2/next/@next/swc-darwin-x64": ["@next/[email protected].26", "", { "os": "darwin", "cpu": "x64" }, "sha512-1MLiD1Bj6xSi5MkkQ8IK7A13KZJG9bzoWqdXT/tveVCinmYrl/zY7z/9dgvG+84gAE6uN4BGjp6f3IxRsvYDBA=="],
49774977

4978-
"gitbook-v2/next/@next/swc-linux-arm64-gnu": ["@next/[email protected].7", "", { "os": "linux", "cpu": "arm64" }, "sha512-KxNGfW7BO0Z5B9rJyl9p7YVjNrxAhu06mH6h1PSdouZG7YMYpdRCconVXeuBI0PEu6g3ywNrOVxZUk1V6G5u0Q=="],
4978+
"gitbook-v2/next/@next/swc-linux-arm64-gnu": ["@next/[email protected].26", "", { "os": "linux", "cpu": "arm64" }, "sha512-cIVgFgOdMDbnPixR/u3ICW60/HlnDbACCb2O+p9+DJj7s1dsN63Cs9qxc9pDJb7tgL0BFPhYcmGeJfd/bZ4h7w=="],
49794979

4980-
"gitbook-v2/next/@next/swc-linux-arm64-musl": ["@next/[email protected].7", "", { "os": "linux", "cpu": "arm64" }, "sha512-THgXgmP/cC4DsNwvC6uqB90CebB7Ep1KyZajQL3fYKT5V4SWr46yngKLyoyJVeAYWJH908MrWddf7Ya/Zq7cyg=="],
4980+
"gitbook-v2/next/@next/swc-linux-arm64-musl": ["@next/[email protected].26", "", { "os": "linux", "cpu": "arm64" }, "sha512-o4YS6E3FD2DpZBDvUai9bPMLcpcNZ3THc2BzysSbZeARPiAQuKoudwPJoCpi2t7vajrvczpxBwTPG2uL05ypEA=="],
49814981

4982-
"gitbook-v2/next/@next/swc-linux-x64-gnu": ["@next/[email protected].7", "", { "os": "linux", "cpu": "x64" }, "sha512-kpLB3Jj7fProynQYj2ahFyZlJs0xwm71VzCVrNRu6u7qJGXn6dK5h7+hro8y/y1iqjXWgCLSdxWSHahhWK8XdQ=="],
4982+
"gitbook-v2/next/@next/swc-linux-x64-gnu": ["@next/[email protected].26", "", { "os": "linux", "cpu": "x64" }, "sha512-M2/MFrQcPI7Ul5Fq5AOeoARrT0B9SrGiy7BLnPuE7Iai1+xkhfSsxIMF5JeDm/GfJnzcwA2oSvrOg0e7KKdaCA=="],
49834983

4984-
"gitbook-v2/next/@next/swc-linux-x64-musl": ["@next/[email protected].7", "", { "os": "linux", "cpu": "x64" }, "sha512-rnGAKvl4cWPVV9D+SybWOGijm0VmKXyqQ+IN0A6WDgdlYZAZP0ZnJv/rq7DSvuOh19AXS8UpQc88SelXV/3j3Q=="],
4984+
"gitbook-v2/next/@next/swc-linux-x64-musl": ["@next/[email protected].26", "", { "os": "linux", "cpu": "x64" }, "sha512-p5JpQ7k/1LyBzNZglqA8JJm7GRmadPkTyHoWaqMxhiVdcQHGbjwsiNjjAtMNjetNOXxj8ebxjiBsAt+34Ak1IQ=="],
49854985

4986-
"gitbook-v2/next/@next/swc-win32-arm64-msvc": ["@next/[email protected].7", "", { "os": "win32", "cpu": "arm64" }, "sha512-/PRbn//EuR3UGiquk050gqvjxLliEgGBy1Cx9KkpAT7szaHOBj1mDDQmxMTEhRex4i3YfKGJXWn5mLMCveya6Q=="],
4986+
"gitbook-v2/next/@next/swc-win32-arm64-msvc": ["@next/[email protected].26", "", { "os": "win32", "cpu": "arm64" }, "sha512-FlXIBNOSwnGxxN+HekUfz4Y0n4gPGzqcY3wa3p+5JhzFT7r0oCxMxOdRbs7w8jF5b6uSkWVIQXWFL43F6+8J4g=="],
49874987

4988-
"gitbook-v2/next/@next/swc-win32-x64-msvc": ["@next/[email protected].7", "", { "os": "win32", "cpu": "x64" }, "sha512-7a92XL+DlrbWyycCpQjjQMHOrsA0p+VvS7iA2dyi89Xsq0qtOPzFH0Gb56fsjh6M6BQGFhboOSzjmpjlkMTilQ=="],
4988+
"gitbook-v2/next/@next/swc-win32-x64-msvc": ["@next/[email protected].26", "", { "os": "win32", "cpu": "x64" }, "sha512-h9CKrDiEeBof+8IgHStYATYrKVuUt8ggy6429kViWlDbuY6gkuIplf3IRlfpdWAB32I1e4qqUVl/s2xRMgQdqg=="],
49894989

49904990
"gitbook-v2/next/postcss": ["[email protected]", "", { "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } }, "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ=="],
49914991

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"packageManager": "[email protected]",
1111
"overrides": {
1212
"@codemirror/state": "6.4.1",
13-
"@gitbook/api": "0.113.0",
13+
"@gitbook/api": "^0.115.0",
1414
"react": "^19.0.0",
1515
"react-dom": "^19.0.0"
1616
},

packages/cache-tags/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"version": "0.3.1",
1212
"dependencies": {
13-
"@gitbook/api": "^0.111.0",
13+
"@gitbook/api": "^0.115.0",
1414
"assert-never": "^1.2.1"
1515
},
1616
"devDependencies": {

packages/gitbook-v2/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
"version": "0.2.5",
44
"private": true,
55
"dependencies": {
6+
"@gitbook/api": "^0.115.0",
7+
"@gitbook/cache-tags": "workspace:*",
8+
"@sindresorhus/fnv1a": "^3.1.0",
9+
"assert-never": "^1.2.1",
10+
"jwt-decode": "^4.0.0",
611
"next": "canary",
712
"react": "^19.0.0",
813
"react-dom": "^19.0.0",
9-
"@gitbook/api": "*",
10-
"@gitbook/cache-tags": "workspace:*",
11-
"@sindresorhus/fnv1a": "^3.1.0",
12-
"server-only": "^0.0.1",
13-
"warn-once": "^0.1.1",
1414
"rison": "^0.1.1",
15-
"jwt-decode": "^4.0.0",
16-
"assert-never": "^1.2.1"
15+
"server-only": "^0.0.1",
16+
"warn-once": "^0.1.1"
1717
},
1818
"devDependencies": {
1919
"gitbook": "*",

packages/gitbook-v2/src/lib/data/lookup.ts

Lines changed: 81 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,102 @@
11
import { race, tryCatch } from '@/lib/async';
22
import { joinPath, joinPathWithBaseURL } from '@/lib/paths';
33
import { trace } from '@/lib/tracing';
4-
import type { PublishedSiteContentLookup } from '@gitbook/api';
4+
import type { GitBookAPI, PublishedSiteContentLookup, SiteVisitorPayload } from '@gitbook/api';
55
import { apiClient } from './api';
66
import { getExposableError } from './errors';
77
import type { DataFetcherResponse } from './types';
88
import { getURLLookupAlternatives, stripURLSearch } from './urls';
99

10+
interface LookupPublishedContentByUrlInput {
11+
url: string;
12+
redirectOnError: boolean;
13+
apiToken: string | null;
14+
visitorPayload: SiteVisitorPayload;
15+
}
16+
17+
/**
18+
* Lookup a content by its URL using the GitBook resolvePublishedContentByUrl API endpoint.
19+
* To optimize caching, we try multiple lookup alternatives and return the first one that matches.
20+
*/
21+
export async function resolvePublishedContentByUrl(input: LookupPublishedContentByUrlInput) {
22+
return lookupPublishedContentByUrl({
23+
url: input.url,
24+
fetchLookupAPIResult: ({ url, signal }) => {
25+
const api = apiClient({ apiToken: input.apiToken });
26+
return trace(
27+
{
28+
operation: 'resolvePublishedContentByUrl',
29+
name: url,
30+
},
31+
() =>
32+
tryCatch(
33+
api.urls.resolvePublishedContentByUrl(
34+
{
35+
url,
36+
...(input.visitorPayload ? { visitor: input.visitorPayload } : {}),
37+
redirectOnError: input.redirectOnError,
38+
},
39+
{ signal }
40+
)
41+
)
42+
);
43+
},
44+
});
45+
}
46+
1047
/**
11-
* Lookup a content by its URL using the GitBook API.
48+
* Lookup a content by its URL using the GitBook getPublishedContentByUrl API endpoint.
1249
* To optimize caching, we try multiple lookup alternatives and return the first one that matches.
50+
*
51+
* @deprecated use resolvePublishedContentByUrl.
52+
*
1353
*/
14-
export async function getPublishedContentByURL(input: {
54+
export async function getPublishedContentByURL(input: LookupPublishedContentByUrlInput) {
55+
return lookupPublishedContentByUrl({
56+
url: input.url,
57+
fetchLookupAPIResult: ({ url, signal }) => {
58+
const api = apiClient({ apiToken: input.apiToken });
59+
return trace(
60+
{
61+
operation: 'getPublishedContentByURL',
62+
name: url,
63+
},
64+
() =>
65+
tryCatch(
66+
api.urls.getPublishedContentByUrl(
67+
{
68+
url,
69+
visitorAuthToken: input.visitorPayload.jwtToken ?? undefined,
70+
redirectOnError: input.redirectOnError,
71+
// @ts-expect-error - cacheVersion is not a real query param
72+
cacheVersion: 'v2',
73+
},
74+
{ signal }
75+
)
76+
)
77+
);
78+
},
79+
});
80+
}
81+
82+
type TryCatch<T> = ReturnType<typeof tryCatch<T>>;
83+
84+
async function lookupPublishedContentByUrl(input: {
1585
url: string;
16-
visitorAuthToken: string | null;
17-
redirectOnError: boolean;
18-
apiToken: string | null;
86+
fetchLookupAPIResult: (args: {
87+
url: string;
88+
signal: AbortSignal;
89+
}) => TryCatch<Awaited<ReturnType<GitBookAPI['urls']['resolvePublishedContentByUrl']>>>;
1990
}): Promise<DataFetcherResponse<PublishedSiteContentLookup>> {
2091
const lookupURL = new URL(input.url);
2192
const url = stripURLSearch(lookupURL);
2293
const lookup = getURLLookupAlternatives(url);
2394

2495
const result = await race(lookup.urls, async (alternative, { signal }) => {
25-
const api = await apiClient({ apiToken: input.apiToken });
26-
27-
const callResult = await trace(
28-
{
29-
operation: 'getPublishedContentByURL',
30-
name: alternative.url,
31-
},
32-
() =>
33-
tryCatch(
34-
api.urls.getPublishedContentByUrl(
35-
{
36-
url: alternative.url,
37-
visitorAuthToken: input.visitorAuthToken ?? undefined,
38-
redirectOnError: input.redirectOnError,
39-
40-
// As this endpoint is cached by our API, we version the request
41-
// to void getting stale data with missing properties.
42-
// this could be improved by ensuring our API cache layer is versioned
43-
// or invalidated when needed
44-
// @ts-expect-error - cacheVersion is not a real query param
45-
cacheVersion: 'v2',
46-
},
47-
{
48-
signal,
49-
}
50-
)
51-
)
52-
);
96+
const callResult = await input.fetchLookupAPIResult({
97+
url: alternative.url,
98+
signal,
99+
});
53100

54101
if (callResult.error) {
55102
if (alternative.primary) {

packages/gitbook-v2/src/middleware.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ import {
1010
type ResponseCookies,
1111
getPathScopedCookieName,
1212
getResponseCookiesForVisitorAuth,
13-
getVisitorToken,
13+
getVisitorPayload,
1414
normalizeVisitorAuthURL,
15-
} from '@/lib/visitor-token';
15+
} from '@/lib/visitors';
1616
import { serveResizedImage } from '@/routes/image';
1717
import {
1818
DataFetcherError,
1919
getPublishedContentByURL,
2020
getVisitorAuthBasePath,
2121
normalizeURL,
22+
resolvePublishedContentByUrl,
2223
throwIfDataError,
2324
} from '@v2/lib/data';
2425
import { isGitBookAssetsHostURL, isGitBookHostURL } from '@v2/lib/env';
@@ -33,6 +34,15 @@ export const config = {
3334

3435
type URLWithMode = { url: URL; mode: 'url' | 'url-host' };
3536

37+
/**
38+
* Temporary list of hosts to test adaptive content using the new resolution API.
39+
*/
40+
const ADAPTIVE_CONTENT_HOSTS = [
41+
'docs.gitbook.com',
42+
'adaptive-docs.gitbook-staging.com',
43+
'enriched-content-playground.gitbook-staging.io',
44+
];
45+
3646
export async function middleware(request: NextRequest) {
3747
try {
3848
const requestURL = new URL(request.url);
@@ -85,17 +95,22 @@ async function serveSiteRoutes(requestURL: URL, request: NextRequest) {
8595
//
8696
// Detect and extract the visitor authentication token from the request
8797
//
88-
// @ts-ignore - request typing
89-
const visitorToken = getVisitorToken({
98+
const { visitorToken, unsignedClaims } = getVisitorPayload({
9099
cookies: request.cookies.getAll(),
91100
url: siteRequestURL,
92101
});
93102

94103
const withAPIToken = async (apiToken: string | null) => {
104+
const resolve = ADAPTIVE_CONTENT_HOSTS.includes(siteRequestURL.hostname)
105+
? resolvePublishedContentByUrl
106+
: getPublishedContentByURL;
95107
const siteURLData = await throwIfDataError(
96-
getPublishedContentByURL({
108+
resolve({
97109
url: siteRequestURL.toString(),
98-
visitorAuthToken: visitorToken?.token ?? null,
110+
visitorPayload: {
111+
jwtToken: visitorToken?.token ?? undefined,
112+
unsignedClaims,
113+
},
99114
// When the visitor auth token is pulled from the cookie, set redirectOnError when calling getPublishedContentByUrl to allow
100115
// redirecting when the token is invalid as we could be dealing with stale token stored in the cookie.
101116
// For example when the VA backend signature has changed but the token stored in the cookie is not yet expired.

packages/gitbook/e2e/internal.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
VISITOR_TOKEN_COOKIE,
1313
getVisitorAuthCookieName,
1414
getVisitorAuthCookieValue,
15-
} from '@/lib/visitor-token';
15+
} from '@/lib/visitors';
1616

1717
import { getSiteAPIToken } from '../tests/utils';
1818
import {

packages/gitbook/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"clean": "rm -rf ./.next && rm -rf ./public/~gitbook/static/icons && rm -rf ./public/~gitbook/static/math"
1717
},
1818
"dependencies": {
19-
"@gitbook/api": "*",
19+
"@gitbook/api": "^0.115.0",
2020
"@gitbook/cache-do": "workspace:*",
2121
"@gitbook/cache-tags": "workspace:*",
2222
"@gitbook/colors": "workspace:*",

0 commit comments

Comments
 (0)