| 4 | import { useEffect, useState } from "react"; |
| 5 | |
| 6 | export function InkeepBubble() { |
| 7 | // color mode sync target |
| 8 | const [syncTarget, setSyncTarget] = useState<HTMLElement | null>(null); |
| 9 | |
| 10 | // document is not available in the server |
| 11 | useEffect(() => { |
| 12 | setSyncTarget(document.documentElement); |
| 13 | }, []); |
| 14 | |
| 15 | const config = { |
| 16 | baseSettings: { |
| 17 | apiKey: process.env.NEXT_PUBLIC_INKEEP_KEY!, // required |
| 18 | primaryBrandColor: "#EE63C0", // your brand color, widget color scheme is derived from this |
| 19 | organizationDisplayName: "Zod", |
| 20 | // ...optional settings |
| 21 | colorMode: { |
| 22 | sync: { |
| 23 | target: syncTarget!, |
| 24 | attributes: ["class"], |
| 25 | isDarkMode: (attributes: any) => !!attributes.class?.includes("dark"), |
| 26 | }, |
| 27 | }, |
| 28 | theme: { |
| 29 | styles: [ |
| 30 | { |
| 31 | key: "custom-theme", |
| 32 | type: "style", |
| 33 | |
| 34 | value: ` |
| 35 | .ikp-chat-button__container { |
| 36 | z-index: var(--ikp-z-index-overlay); |
| 37 | }`, |
| 38 | }, |
| 39 | ], |
| 40 | }, |
| 41 | }, |
| 42 | searchSettings: { |
| 43 | // optional settings |
| 44 | }, |
| 45 | aiChatSettings: { |
| 46 | // optional settings |
| 47 | |
| 48 | aiAssistantAvatar: "https://zod.dev/logo/logo.png", // use your own ai assistant avatar |
| 49 | exampleQuestions: [ |
| 50 | "How do I convert a Zod schema to a JSON Schema?", |
| 51 | "How do I define a cyclical object type?", |
| 52 | "How do I globally customize errors?", |
| 53 | ], |
| 54 | }, |
| 55 | } satisfies InkeepChatButtonProps; |
| 56 | |
| 57 | return <InkeepChatButton {...config} />; |
| 58 | } |