import React, { useState, useEffect } from 'react'; import { __ } from '@wordpress/i18n'; const ChatBubbleDefault = ({ onClick, settings }) => { const [showWave, setShowWave] = useState(true); const [playSound, setPlaySound] = useState(true); useEffect(() => { // Start waving animation after a delay const timer = setTimeout(() => { setShowWave(true); if (settings.soundEnabled) { setPlaySound(true); } }, 2000); return () => clearTimeout(timer); }, [settings.soundEnabled]); useEffect(() => { if (playSound && settings.soundEnabled) { const audio = new Audio(settings.soundUrl || '/notification.mp3'); audio.volume = 0.5; audio.play().catch(e => console.log('Audio play failed:', e)); setPlaySound(false); } }, [playSound, settings.soundEnabled, settings.soundUrl]); return (