docs: enable and send algolia events (#12416)
This commit is contained in:
@@ -102,7 +102,7 @@ export const SearchHits = ({
|
||||
setNoResults,
|
||||
checkInternalPattern,
|
||||
}: SearchHitsProps) => {
|
||||
const { items: hits } = useHits<HitType>()
|
||||
const { items: hits, sendEvent } = useHits<HitType>()
|
||||
const { status } = useInstantSearch()
|
||||
const { setIsOpen } = useSearch()
|
||||
|
||||
@@ -182,6 +182,7 @@ export const SearchHits = ({
|
||||
className="absolute top-0 left-0 h-full w-full"
|
||||
target="_self"
|
||||
onClick={(e) => {
|
||||
sendEvent("click", item, "Search Result Clicked")
|
||||
if (checkIfInternal(item.url)) {
|
||||
e.preventDefault()
|
||||
window.location.href = item.url
|
||||
|
||||
@@ -107,6 +107,7 @@ export const Search = ({
|
||||
future={{
|
||||
preserveSharedStateOnUnmount: true,
|
||||
}}
|
||||
insights={true}
|
||||
>
|
||||
<div className={clsx("bg-medusa-bg-base flex z-[1]")}>
|
||||
{/* @ts-expect-error React v19 doesn't see this type as a React element */}
|
||||
|
||||
Reference in New Issue
Block a user