feat(support-chat): delegate blog consultation CTA clicks to open support chat modal
Deploy Canina / deploy (push) Successful in 2m38s
Deploy Canina / deploy (push) Successful in 2m38s
This commit is contained in:
1 parent
0b5f2a88cc
commit
529110a693
1 file changed
+13
@@ -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')));
|
||||
|
||||
Reference in new issue
Block a user