diff --git a/app/layout.tsx b/app/layout.tsx index 4c8ce0d..76438d4 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,7 +1,7 @@ import type { Metadata } from "next"; import { Space_Grotesk, Inter } from "next/font/google"; import { Analytics } from "@vercel/analytics/next"; -import { ChatwootWidget } from "@/components/chatwoot"; +import { ChatWidget } from "@/components/chatwidget"; import "./globals.css"; const spaceGrotesk = Space_Grotesk({ @@ -41,7 +41,7 @@ export default function RootLayout({ > {children} - + ); diff --git a/components/chatwoot.tsx b/components/chatwoot.tsx deleted file mode 100644 index e43b6d3..0000000 --- a/components/chatwoot.tsx +++ /dev/null @@ -1,42 +0,0 @@ -'use client' - -import { useEffect } from 'react' - -export function ChatwootWidget() { - useEffect(() => { - const chatwootToken = process.env.NEXT_PUBLIC_CHATWOOT_ACCOUNT_TOKEN - - if (!chatwootToken) { - console.warn('[v0] Chatwoot account token not configured') - return - } - - // Load Chatwoot widget script - const script = document.createElement('script') - script.src = 'https://app.chatwoot.com/packs/js/sdk.js' - script.async = true - - script.onload = () => { - // Initialize Chatwoot after script loads - if ((window as any).chatwootSDK) { - ;(window as any).chatwootSDK.run({ - websiteToken: chatwootToken, - baseUrl: 'https://app.chatwoot.com' - }) - } - } - - script.onerror = () => { - console.error('[v0] Failed to load Chatwoot widget') - } - - document.body.appendChild(script) - - return () => { - // Cleanup is handled by Chatwoot itself - // Don't remove the script as it manages its own lifecycle - } - }, []) - - return null -}