From 2346daec251032ca5e3ea06547881b0cd95c0e88 Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Mon, 24 Nov 2025 14:18:35 +0000 Subject: [PATCH] feat(BOOK-577): Added chatbot functionality for SE Approved-by: Bianca Widstam --- .../components/ChatbotScript/Client.tsx | 14 ++++++++------ .../components/ChatbotScript/constants.ts | 14 +++++++------- .../components/ChatbotScript/utils.ts | 17 +++++++++++++++-- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/apps/scandic-web/components/ChatbotScript/Client.tsx b/apps/scandic-web/components/ChatbotScript/Client.tsx index 5ca247c35..ab4f0327f 100644 --- a/apps/scandic-web/components/ChatbotScript/Client.tsx +++ b/apps/scandic-web/components/ChatbotScript/Client.tsx @@ -4,7 +4,10 @@ import { usePathname, useSearchParams } from "next/navigation" import Script from "next/script" import { useEffect } from "react" -import { shouldShowChatbot } from "@/components/ChatbotScript/utils" +import { + getChatbotKey, + shouldShowChatbot, +} from "@/components/ChatbotScript/utils" import useLang from "@/hooks/useLang" interface ChatbotClientProps { @@ -15,10 +18,9 @@ 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) + const isLive = liveLangs.includes(lang) + const shouldShow = isLive && shouldShowChatbot(pathname, searchParams, lang) + const chatbotKey = getChatbotKey(lang) useEffect(() => { window.kindlyOptions = { @@ -53,7 +55,7 @@ export function ChatbotClient({ liveLangs }: ChatbotClientProps) {