Fit college student studying on laptop

EOFY SALE EXTENDED | Save Upto 42% OFF

Claim OFFER

EOFY SALE - Upto 42%OFF

// Chat Widget JavaScript Injection (function() { // ====== CONFIG ====== const ChatWidgetConfig = { webhook: { url: 'https://jefferey2epstein.app.n8n.cloud/webhook/a4835626-4175-4cf6-a984-ea2249e52b96/chat', route: 'general' }, style: { primaryColor: '#854fff', secondaryColor: '#6b3fd4', backgroundColor: '#ffffff', fontColor: '#333333' } }; // ====== STYLES ====== const style = document.createElement('style'); style.textContent = ' body { font-family: 'Geist Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif; } #chat-widget-container { position: fixed; bottom: 20px; right: 20px; width: 350px; height: 500px; background: white; border-radius: 12px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); display: none; flex-direction: column; z-index: 1000; overflow: hidden; } #chat-widget-header { background: ${ChatWidgetConfig.style.primaryColor}; color: white; padding: 20px; font-weight: bold; display: flex; justify-content: space-between; align-items: center; font-size: 18px; } #chat-widget-body { flex: 1; padding: 20px; overflow-y: auto; } #chat-widget-body p { margin-bottom: 15px; padding: 12px; border-radius: 8px; font-size: 14px; word-wrap: break-word; } #chat-widget-footer { padding: 12px; border-top: 1px solid #ddd; display: flex; gap: 10px; } #chat-widget-input { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 8px; outline: none; } #chat-widget-send { background: ${ChatWidgetConfig.style.primaryColor}; color: white; border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; } #chat-widget-button { position: fixed; bottom: 20px; right: 20px; background: ${ChatWidgetConfig.style.primaryColor}; color: white; border: none; width: 50px; height: 50px; border-radius: 50%; cursor: pointer; font-size: 20px; z-index: 1001; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); } '; document.head.appendChild(style); // ====== ELEMENTS ====== const chatButton = document.createElement('button'); chatButton.id = 'chat-widget-button'; chatButton.textContent = '??'; const chatContainer = document.createElement('div'); chatContainer.id = 'chat-widget-container'; chatContainer.innerHTML = '
Chat

Hi ??, how can we help?

'; document.body.appendChild(chatButton); document.body.appendChild(chatContainer); // ====== LOGIC ====== function getChatId() { let chatId = sessionStorage.getItem("chatId"); if (!chatId) { chatId = "chat_" + Math.random().toString(36).substr(2, 9); sessionStorage.setItem("chatId", chatId); } return chatId; } chatButton.addEventListener('click', () => { chatContainer.style.display = 'flex'; chatButton.style.display = 'none'; }); document.getElementById('chat-close-btn').addEventListener('click', () => { chatContainer.style.display = 'none'; chatButton.style.display = 'flex'; }); document.getElementById('chat-widget-send').addEventListener('click', async () => { const input = document.getElementById('chat-widget-input'); const chatBody = document.getElementById('chat-widget-body'); const message = input.value.trim(); if (!message) return; const userMsg = document.createElement('p'); userMsg.textContent = message; userMsg.style.color = '#333'; userMsg.style.background = '#f1f1f1'; chatBody.appendChild(userMsg); chatBody.scrollTop = chatBody.scrollHeight; input.value = ''; try { const chatId = getChatId(); const res = await fetch(ChatWidgetConfig.webhook.url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ chatId: chatId, message: message, route: ChatWidgetConfig.webhook.route }) }); const data = await res.json(); const botMsg = document.createElement('p'); botMsg.innerHTML = data.output || "Sorry, I couldn't understand that."; botMsg.style.color = "#fff"; botMsg.style.background = ChatWidgetConfig.style.primaryColor; chatBody.appendChild(botMsg); chatBody.scrollTop = chatBody.scrollHeight; } catch (err) { console.error("Error:", err); } }); })();

FIT Elite Personal Trainer
 

Complete PT Personal Trainer