From 15a352ea9909e6cd1765bedc4d7ef08df58ff620 Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Thu, 11 Sep 2025 12:44:47 +0000 Subject: [PATCH] feat(BOOK-68): Added kindly chatbot Approved-by: Linus Flood --- apps/scandic-web/app/[lang]/(live)/layout.tsx | 2 ++ .../components/ChatbotScript/RouteChange.tsx | 34 +++++++++++++++++++ .../components/ChatbotScript/constants.ts | 1 + .../components/ChatbotScript/index.tsx | 25 ++++++++++++++ apps/scandic-web/env/server.ts | 5 +++ apps/scandic-web/types/window.d.ts | 6 ++++ 6 files changed, 73 insertions(+) create mode 100644 apps/scandic-web/components/ChatbotScript/RouteChange.tsx create mode 100644 apps/scandic-web/components/ChatbotScript/constants.ts create mode 100644 apps/scandic-web/components/ChatbotScript/index.tsx diff --git a/apps/scandic-web/app/[lang]/(live)/layout.tsx b/apps/scandic-web/app/[lang]/(live)/layout.tsx index 64191d25f..418595edd 100644 --- a/apps/scandic-web/app/[lang]/(live)/layout.tsx +++ b/apps/scandic-web/app/[lang]/(live)/layout.tsx @@ -17,6 +17,7 @@ import TrpcProvider from "@/lib/trpc/Provider" import { SessionRefresher } from "@/components/Auth/TokenRefresher" import { BookingFlowProviders } from "@/components/BookingFlowProviders" +import ChatbotScript from "@/components/ChatbotScript" import CookieBotConsent from "@/components/CookieBot" import Footer from "@/components/Footer" import Header from "@/components/Header" @@ -53,6 +54,7 @@ export default async function RootLayout( + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} + + + ) +} diff --git a/apps/scandic-web/env/server.ts b/apps/scandic-web/env/server.ts index b2b924c9b..45bd0ae25 100644 --- a/apps/scandic-web/env/server.ts +++ b/apps/scandic-web/env/server.ts @@ -164,6 +164,10 @@ export const env = createEnv({ .refine((s) => s === "true" || s === "false") .transform((s) => s === "true") .default("false"), + CHATBOT_LIVE_LANGS: z + .string() + .optional() + .transform((s) => s?.split(",") || []), }, emptyStringAsUndefined: true, runtimeEnv: { @@ -246,6 +250,7 @@ export const env = createEnv({ CAMPAIGN_PAGES_ENABLED: process.env.CAMPAIGN_PAGES_ENABLED, WEBVIEW_SHOW_OVERVIEW: process.env.WEBVIEW_SHOW_OVERVIEW, ENABLE_NEW_OVERVIEW_SECTION: process.env.ENABLE_NEW_OVERVIEW_SECTION, + CHATBOT_LIVE_LANGS: process.env.CHATBOT_LIVE_LANGS, }, }) diff --git a/apps/scandic-web/types/window.d.ts b/apps/scandic-web/types/window.d.ts index b6b03f0aa..58dfb4f4b 100644 --- a/apps/scandic-web/types/window.d.ts +++ b/apps/scandic-web/types/window.d.ts @@ -17,4 +17,10 @@ interface Window { } Cookiebot: { changed: boolean; consented: boolean } ApplePaySession: (() => void) | undefined + kindlyChat: { + showBubble: () => void + closeChat: () => void + showChat: () => void + hideBubble: () => void + } }