docs: track code copy + AI assistant event (#14193)
* docs: track code copy + AI assistant event * add pathname to callback
This commit is contained in:
@@ -1,24 +1,17 @@
|
||||
"use client"
|
||||
|
||||
import {
|
||||
DocsTrackingEvents,
|
||||
Feedback as UiFeedback,
|
||||
FeedbackProps as UiFeedbackProps,
|
||||
} from "docs-ui"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { useMemo } from "react"
|
||||
import { basePathUrl } from "../../utils/base-path-url"
|
||||
|
||||
type FeedbackProps = Omit<UiFeedbackProps, "event" | "pathName">
|
||||
|
||||
export const Feedback = (props: FeedbackProps) => {
|
||||
const pathname = usePathname()
|
||||
|
||||
const feedbackPathname = useMemo(() => basePathUrl(pathname), [pathname])
|
||||
|
||||
return (
|
||||
<UiFeedback
|
||||
event="survey"
|
||||
pathName={feedbackPathname}
|
||||
event={DocsTrackingEvents.SURVEY}
|
||||
question="Was this page helpful?"
|
||||
{...props}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user