1.0.1 • Published 7 months ago
@cristianbm/ianetic-chat v1.0.1
Ianetic Chat
Un widget de chat ligero y fácil de integrar en cualquier sitio web.
Características
- 🚀 Ligero y rápido
- 🎨 Diseño moderno y responsive
- 📱 Compatible con móviles
- 🔌 Fácil integración
- ⚙️ Altamente personalizable
- 🌐 Compatible con todos los navegadores modernos
Instalación
Vía NPM
npm install ianetic-chat
Vía CDN
<script src="https://unpkg.com/ianetic-chat"></script>
Uso
Con módulos ES6
import IaneticChat from 'ianetic-chat';
const chat = new IaneticChat({
title: 'Mi Chat',
placeholder: 'Escribe tu mensaje...',
position: 'bottom-right', // o 'bottom-left'
onMessage: (text) => {
// Maneja los mensajes aquí
console.log('Mensaje enviado:', text);
}
});
Con CDN
<script>
const chat = new IaneticChat({
title: 'Mi Chat',
placeholder: 'Escribe tu mensaje...',
position: 'bottom-right',
onMessage: (text) => {
console.log('Mensaje enviado:', text);
}
});
</script>
Opciones
Opción | Tipo | Por defecto | Descripción |
---|---|---|---|
title | string | 'Chat' | Título del chat |
placeholder | string | 'Escribe un mensaje...' | Texto del placeholder del input |
position | string | 'bottom-right' | Posición del widget ('bottom-right' o 'bottom-left') |
onMessage | function | undefined | Callback que se ejecuta cuando se envía un mensaje |
Métodos
addMessage(options)
Añade un mensaje al chat.
chat.addMessage({
text: 'Hola, ¿en qué puedo ayudarte?',
sender: 'bot' // 'bot' o 'user'
});
Ejemplos
Puedes encontrar ejemplos de implementación en la carpeta /example
del repositorio.
Contribuir
Las contribuciones son bienvenidas. Por favor, abre un issue primero para discutir los cambios que te gustaría hacer.
- Fork el repositorio
- Crea tu rama de características (
git checkout -b feature/AmazingFeature
) - Commit tus cambios (
git commit -m 'Add some AmazingFeature'
) - Push a la rama (
git push origin feature/AmazingFeature
) - Abre un Pull Request
Licencia
MIT