feat: Agregar widget de chat del asistente printerCentral
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 2m26s

This commit is contained in:
2025-12-10 17:29:19 -06:00
parent 5a0da4d149
commit 0a90a2a0c2
2 changed files with 47 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
export default defineNuxtPlugin(() => {
const createWidget = () => {
// Verificar que el custom element esté registrado
if (!customElements.get('chat-widget')) {
setTimeout(createWidget, 100)
return
}
// Verificar que no exista ya
if (document.querySelector('.floating-widget')) {
return
}
// Crear contenedor flotante
const container = document.createElement('div')
container.className = 'floating-widget'
container.style.cssText = `
position: fixed;
bottom: 24px;
right: 24px;
z-index: 9999;
`
// Crear el widget
const widget = document.createElement('chat-widget')
widget.setAttribute('api-url', 'https://gamdias.nucleoriofrio.com')
widget.setAttribute('agent-id', '808d524b-fc61-4f16-b7aa-a34ef4e7fe1b')
widget.setAttribute('app-id', 'printerCentral-app')
widget.setAttribute('user-id', 'printerCentral-user')
widget.setAttribute('title', 'Asistente printerCentral')
// Aplicar color primario de printerCentral via CSS variable
widget.style.setProperty('--chat-primary', '#3f75d2')
container.appendChild(widget)
document.body.appendChild(container)
}
if (document.readyState === 'complete') {
setTimeout(createWidget, 100)
} else {
window.addEventListener('load', () => setTimeout(createWidget, 100))
}
})