feat(support-chat): delegate blog consultation CTA clicks to open support chat modal
Deploy Canina / deploy (push) Successful in 2m38s

This commit is contained in:
devops committed 2026-10-19 06:32:11 +00:00
1 parent 0b5f2a88cc
commit 529110a693
1 file changed
+13
+13
View File
@@ -124,6 +124,19 @@ export default function ClientLayout({ children }: { children: React.ReactNode }
}, [pathname]);
// Global listener for Smart Advisor / Consultation CTA to trigger Support Chat
useEffect(() => {
const handleGlobalClick = (e: MouseEvent) => {
const target = (e.target as HTMLElement)?.closest('button');
if (target && target.innerText && target.innerText.includes('مشاوره هوشمند دارویی')) {
window.dispatchEvent(new CustomEvent('canina:open-support-chat'));
}
};
document.addEventListener('click', handleGlobalClick);
return () => document.removeEventListener('click', handleGlobalClick);
}, []);
// Check Maintenance Mode (Admin / Partner bypass)
const isMaintenanceMode = getText('MAINTENANCE_MODE', 'false') === 'true' || getText('maintenance_mode', 'false') === 'true';
const isAdmin = role === 'User_Partner' || (typeof window !== 'undefined' && Boolean(localStorage.getItem('adminToken')));