"use client" import { usePathname, useSearchParams } from "next/navigation" import Script from "next/script" import { useEffect } from "react" import { shouldShowChatbot } from "@/components/ChatbotScript/utils" import useLang from "@/hooks/useLang" interface ChatbotClientProps { liveLangs: string[] } export function ChatbotClient({ liveLangs }: ChatbotClientProps) { const lang = useLang() const pathname = usePathname() const searchParams = useSearchParams() const currentLang = useLang() const isLive = liveLangs.includes(currentLang) const shouldShow = isLive && shouldShowChatbot(pathname, searchParams, currentLang) useEffect(() => { window.kindlyOptions = { position: { bottom: "130px", right: "20px", }, } }, []) useEffect(() => { if (window.kindlyChat) { if (!shouldShow) { window.kindlyChat.closeChat() window.kindlyChat.hideBubble() } else { window.kindlyChat.showBubble() } } }, [shouldShow]) return ( ) }