diff --git a/public/js/brevo.js b/public/js/brevo.js new file mode 100644 index 00000000..cfc6a671 --- /dev/null +++ b/public/js/brevo.js @@ -0,0 +1,12 @@ +(function (d, w, c) { + w.BrevoConversationsID = "6366d410f90cc11a765868a8"; + w[c] = + w[c] || + function () { + (w[c].q = w[c].q || []).push(arguments); + }; + var s = d.createElement("script"); + s.async = true; + s.src = "https://conversations-widget.brevo.com/brevo-conversations.js"; + if (d.head) d.head.appendChild(s); +})(document, window, "BrevoConversations"); diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 8e5ffd01..daba58c3 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -3,7 +3,6 @@ import "./geist.gen.css"; import { GeistProvider, myTheme } from "@/components/Geist"; import Script from "next/script"; -import { Crisp } from "@/components/Crisp"; export const metadata = { title: { @@ -29,7 +28,6 @@ export default function RootLayout({ {children} - + ); diff --git a/src/components/Crisp.tsx b/src/components/Crisp.tsx deleted file mode 100644 index 32d896bc..00000000 --- a/src/components/Crisp.tsx +++ /dev/null @@ -1,50 +0,0 @@ -"use client"; - -/* eslint-disable @typescript-eslint/ban-ts-comment */ - -import { createClient } from "@/supabase/client"; -import { sentryException } from "@/util/sentry"; -import { usePathname } from "next/navigation"; -import { useEffect } from "react"; - -export function Crisp() { - const supabase = createClient(); - const pathname = usePathname(); - const lang = pathname?.split("/")[1]; - - useEffect(() => { - // @ts-expect-error - window.CRISP_RUNTIME_CONFIG = { - locale: lang || "en", - }; - - // @ts-ignore - window.$crisp = []; - // @ts-ignore - window.CRISP_WEBSITE_ID = process.env.NEXT_PUBLIC_CRISP_WEBSITE_ID; - (() => { - const d = document; - const s = d.createElement("script"); - s.src = "https://client.crisp.chat/l.js"; - // @ts-ignore - s.async = 1; - d.getElementsByTagName("body")[0].appendChild(s); - })(); - }, [lang]); - - useEffect(() => { - supabase.auth - .getUser() - .then(({ data: { user } }) => { - if (!user?.email) { - return; - } - - // @ts-expect-error - window.$crisp.push(["set", "user:email", user?.email]); - }) - .catch(sentryException); - }, [supabase]); - - return null; -}