Track opening of search results for records and in the assistant (#4047)

This commit is contained in:
Samy Pessé
2026-02-25 11:40:39 +01:00
committed by GitHub
parent a9adbc6370
commit 0803db07ef
5 changed files with 33 additions and 11 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"gitbook": patch
---
Track opening of search results for records and in the assistant.
+2 -2
View File
@@ -347,7 +347,7 @@
"react-dom": "catalog:",
},
"catalog": {
"@gitbook/api": "0.163.0",
"@gitbook/api": "0.164.0",
"@scalar/api-client-react": "^1.3.46",
"@tsconfig/node20": "^20.1.6",
"@tsconfig/strictest": "^2.0.6",
@@ -744,7 +744,7 @@
"@fortawesome/fontawesome-svg-core": ["@fortawesome/fontawesome-svg-core@7.1.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.1.0" } }, "sha512-fNxRUk1KhjSbnbuBxlWSnBLKLBNun52ZBTcs22H/xEEzM6Ap81ZFTQ4bZBxVQGQgVY0xugKGoRcCbaKjLQ3XZA=="],
"@gitbook/api": ["@gitbook/api@0.163.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-iEIJcHuh8qUhtgdd13IK/RKHNyvHvvqY2GuEBUGsCd42P3dm8QkgM7OUoCCaFiKBpuU+OZ+UtEB8N+9yJEgL7Q=="],
"@gitbook/api": ["@gitbook/api@0.164.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-u0npCEK253qSbn118YMMi1E5dqrLQnBlXnovXOpbzQP8BF62ktrndnhtH8AhTvV4ld9UHDKjCaxxidmtuYoU9g=="],
"@gitbook/browser-types": ["@gitbook/browser-types@workspace:packages/browser-types"],
+1 -1
View File
@@ -41,7 +41,7 @@
"catalog": {
"@tsconfig/strictest": "^2.0.6",
"@tsconfig/node20": "^20.1.6",
"@gitbook/api": "0.163.0",
"@gitbook/api": "0.164.0",
"@scalar/api-client-react": "^1.3.46",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
@@ -232,6 +232,24 @@ async function DescriptionForSearchToolCall(props: {
<Link
href={result.href}
className="flex items-start gap-2 circular-corners:rounded-2xl rounded-corners:rounded-md px-3 py-2 transition-colors hover:bg-primary-hover"
insights={
result.type === 'record'
? {
type: 'search_open_result',
query: toolCall.query,
result: {
recordId: result.recordId,
},
}
: {
type: 'search_open_result',
query: toolCall.query,
result: {
spaceId: result.spaceId,
pageId: result.pageId,
},
}
}
>
{result.type === 'record' ? (
<Favicon url={result.href} className={iconClassName} />
@@ -33,14 +33,13 @@ export const SearchRecordResultItem = React.forwardRef(function SearchRecordResu
fallback={<Icon icon="memo" className="size-4" />}
/>
}
// insights={{
// type: 'search_open_result',
// query,
// result: {
// pageId: item.pageId,
// spaceId: item.spaceId,
// },
// }}
insights={{
type: 'search_open_result',
query,
result: {
recordId: item.id,
},
}}
aria-label={tString(language, 'search_page_result_title', item.title)}
{...rest}
>