inkeep-script.tsx 829 B

123456789101112131415161718192021222324252627282930313233343536
  1. "use client";
  2. declare global {
  3. interface Window {
  4. Inkeep: any;
  5. }
  6. }
  7. import Script from "next/script";
  8. import { settings } from "../inkeep-settings";
  9. export function InkeepScript() {
  10. return (
  11. <Script
  12. id="inkeep-script"
  13. src="https://unpkg.com/@inkeep/uikit-js@0.3.14/dist/embed.js"
  14. type="module"
  15. strategy="afterInteractive"
  16. onReady={() => {
  17. const config = {
  18. colorModeSync: {
  19. observedElement: document.documentElement,
  20. isDarkModeCallback: (el: any) => {
  21. return el.classList.contains("dark");
  22. },
  23. colorModeAttribute: "class",
  24. },
  25. properties: settings,
  26. };
  27. window.Inkeep().embed({
  28. componentType: "ChatButton",
  29. ...config,
  30. });
  31. }}
  32. />
  33. );
  34. }