<!-- AI Chat Widget by Freelancer Agent Builder -->
<div id="ai-chat-widget-container"></div>
<script>
(function() {
const container = document.getElementById('ai-chat-widget-container');
if (!container) return;
// Widget configuration
const config = {
agentId: "e3940689-9c1d-4ca1-ade4-9f20ef6f0458",
chatTitle: "Chat with AI Assistant",
primaryColor: "#4F46E5",
textColor: "#FFFFFF",
initialMessage: "Hello! How can I help you today?",
chatIcon: "message",
customIconUrl: "",
includeBranding: false,
responsiveDesign: true,
typingIndicator: true,
allowFileUploads: false,
widgetWidth: 350,
widgetHeight: 500
};
// Create and append the chat widget
const widget = document.createElement('div');
widget.id = 'freelancer-ai-chat';
widget.style.position = 'fixed';
widget.style.bottom = '20px';
widget.style.right = '20px';
widget.style.zIndex = '9999';
// Create the chat button
const button = document.createElement('div');
button.style.width = '56px';
button.style.height = '56px';
button.style.borderRadius = '28px';
button.style.backgroundColor = config.primaryColor;
button.style.color = config.textColor;
button.style.display = 'flex';
button.style.alignItems = 'center';
button.style.justifyContent = 'center';
button.style.cursor = 'pointer';
button.style.boxShadow = '0 4px 12px rgba(0,0,0,0.2)';
button.style.transition = 'transform 0.3s ease';
// Helper to get the appropriate icon HTML
function getIconHtml(iconType, customUrl) {
switch(iconType) {
case 'message':
return '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>';
case 'question':
return '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>';
case 'support':
return '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9.59 4.59A2 2 0 1 1 11 8H8m0 0h4m-4 0v3m-1 4h4m4-4a2 2 0 1 0-.59-3.95"></path><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"></path><path d="M12 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4z"></path></svg>';
case 'custom':
return customUrl ? '<img src="'+customUrl+'" width="24" height="24" alt="Chat" />' : '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>';
default:
return '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>';
}
}
button.innerHTML = getIconHtml(config.chatIcon, config.customIconUrl);
button.addEventListener('mouseover', () => {
button.style.transform = 'scale(1.05)';
});
button.addEventListener('mouseout', () => {
button.style.transform = 'scale(1)';
});
// Create the chat iframe
const chatFrame = document.createElement('iframe');
chatFrame.src = "https://cb68077a-365c-43e7-874f-c0a4a0de0435-00-1vyo1fou970pz.riker.replit.dev/embedded-chat/e3940689-9c1d-4ca1-ade4-9f20ef6f0458";
chatFrame.style.width = config.widgetWidth + 'px';
chatFrame.style.height = config.widgetHeight + 'px';
chatFrame.style.border = 'none';
chatFrame.style.borderRadius = '12px';
chatFrame.style.boxShadow = '0 10px 25px rgba(0,0,0,0.1)';
chatFrame.style.display = 'none';
chatFrame.style.marginBottom = '15px';
// Add everything to the DOM
widget.appendChild(chatFrame);
widget.appendChild(button);
container.appendChild(widget);
// Toggle the chat window
let chatOpen = false;
button.addEventListener('click', () => {
chatOpen = !chatOpen;
chatFrame.style.display = chatOpen ? 'block' : 'none';
button.innerHTML = chatOpen
? '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>'
: getIconHtml(config.chatIcon, config.customIconUrl);
});
})();
</script>
UK Telephone: 0844 357 9523
email: admin@wordartprints.com