class CustomChatWidget extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = `
1

NMDX Assistant

Online
🤖
Hi! Welcome to NMDX! 👋 I'm here to help you find the perfect service for your needs. What can I assist you with today?
`; } } // Global chat functions window.toggleChat = function() { const chatWindow = document.querySelector('custom-chat-widget').shadowRoot.getElementById('chatWindow'); chatWindow.classList.toggle('open'); // Remove notification when opened if (chatWindow.classList.contains('open')) { const notification = document.querySelector('custom-chat-widget').shadowRoot.querySelector('.notification'); notification.style.display = 'none'; } }; window.sendMessage = function() { const chatInput = document.querySelector('custom-chat-widget').shadowRoot.getElementById('chatInput'); const message = chatInput.value.trim(); if (!message) return; const chatMessages = document.querySelector('custom-chat-widget').shadowRoot.getElementById('chatMessages'); const typingIndicator = document.querySelector('custom-chat-widget').shadowRoot.getElementById('typingIndicator'); // Add user message const userMessage = document.createElement('div'); userMessage.className = 'message user'; userMessage.innerHTML = `
👤
${message}
`; chatMessages.appendChild(userMessage); // Clear input chatInput.value = ''; // Show typing indicator typingIndicator.classList.add('active'); // Simulate bot response setTimeout(() => { typingIndicator.classList.remove('active'); const botResponse = getBotResponse(message); const botMessage = document.createElement('div'); botMessage.className = 'message bot'; botMessage.innerHTML = `
🤖
${botResponse}
`; chatMessages.appendChild(botMessage); // Scroll to bottom chatMessages.scrollTop = chatMessages.scrollHeight; }, 1500); // Scroll to bottom chatMessages.scrollTop = chatMessages.scrollHeight; }; window.handleChatKeyPress = function(event) { if (event.key === 'Enter') { sendMessage(); } }; function getBotResponse(message) { const lowerMessage = message.toLowerCase(); if (lowerMessage.includes('telegram')) { return "Our Telegram promotion services are top-notch! We can help you grow your channel with targeted campaigns, influencer partnerships, and community engagement strategies. Would you like to know more about our Telegram Ads or Community Management services?"; } else if (lowerMessage.includes('token') || lowerMessage.includes('crypto')) { return "Great choice for token promotion! We offer comprehensive crypto marketing solutions including token launches, community building, and strategic partnerships. Our team has helped raise millions for various projects. What type of token are you promoting?"; } else if (lowerMessage.includes('app')) { return "For app promotion and development, we've got you covered! From ASO optimization to viral marketing campaigns, we'll help your app reach millions of users. Are you looking to promote an existing app or develop a new one?"; } else if (lowerMessage.includes('youtube') || lowerMessage.includes('video')) { return "YouTube promotion is our specialty! We can help you grow your channel, increase views, and build a loyal subscriber base through organic and paid strategies. What type of content do you create?"; } else if (lowerMessage.includes('price') || lowerMessage.includes('cost')) { return "Our pricing varies based on your specific needs and goals. We offer customized packages for every budget. Would you like to schedule a free consultation to discuss your requirements and get a personalized quote?"; } else if (lowerMessage.includes('contact') || lowerMessage.includes('talk')) { return "I'd be happy to connect you with our team! You can fill out the contact form below, or I can collect some basic information here to get started. Which service interests you most?"; } else { return "I'd be happy to help you with our digital marketing services! We specialize in Telegram promotion, token marketing, app development, and much more. What specific service are you interested in learning about?"; } } customElements.define('custom-chat-widget', CustomChatWidget);