Ver Fonte

fix: auto-open chatbot widget when SSO token present in URL

When Dealer Portal redirects to /chat/?sso_token=<jwt>, the widget
now opens automatically instead of waiting for user to click it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tony T há 5 dias atrás
pai
commit
80e70c64f3
1 ficheiros alterados com 8 adições e 0 exclusões
  1. 8 0
      client/src/components/ChatbotWidgetLive.tsx

+ 8 - 0
client/src/components/ChatbotWidgetLive.tsx

@@ -88,6 +88,14 @@ export default function ChatbotWidgetLive() {
     }
   }, [localMessages, isTyping]);
 
+  // Auto-open widget when redirected from Dealer Portal with SSO token
+  useEffect(() => {
+    if (ssoToken && !isOpen) {
+      handleOpen();
+    }
+  // eslint-disable-next-line react-hooks/exhaustive-deps
+  }, [ssoToken]);
+
   const handleScroll = () => {
     const el = scrollContainerRef.current;
     if (!el) return;