# WhatsApp Floating Widget

🔗 Also available in: [Português](README.md) | [English](README.en.md) | [Español](README.es.md)

This is a lightweight and simple WhatsApp floating button widget, built with HTML, CSS and vanilla JavaScript. It allows visitors to contact you directly via WhatsApp with a single click.

## 🚀 Features

- **Zero Dependencies**: Built with plain JS and CSS.
- **Easy Integration**: Just add the script and CSS to your project.
- **Configurable**: Set phone number, initial message and position via data attributes.
- **SVG Icon**: Crisp, scalable WhatsApp icon.

## 📦 Install via NPM
<br>

You can install this package easily via npm:

```bash
npm install whatsapp-floating-widget
```

## 💻 Usage (ES Modules / Bundlers)

Ideal for React, Vue, Angular or Vanilla JS projects using Webpack/Vite.

1. **Import the JS and CSS:**

```javascript
import WhatsAppWidget from 'whatsapp-floating-widget';
// If using a CSS bundler
import 'whatsapp-floating-widget/widget.css';
```

2. **Initialize the widget:**

```javascript
WhatsAppWidget.init({
    phoneNumber: '553340420000',
    message: 'Hello! I would like more information.',
    position: 'right' // 'right' or 'left'
});
```

---

## 🚀 Usage via Upload (Script Tag)
<br>
1. Download `widget.js` and `widget.css` and place them in your project.
2. Add the CSS reference inside the `<head>` of your HTML:

```html
<link rel="stylesheet" href="./path/to/widget.css">
```

3. Add the script before closing the `</body>` tag, configuring the needed attributes:

```html
<!-- Example -->
<script 
    src="./path/to/widget.js" 
    data-phone="553340420000" 
    data-message="Hello! I would like more information." 
    data-position="right">
</script>
```

## 🚀 Usage via CDN (jsDelivr)
<br>
1. Add the CSS reference inside the `<head>` of your HTML:

```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/whatsapp-floating-widget@latest/widget.css">
```

2. Add the script before closing the `</body>` tag, configuring the needed attributes:

```html
<!-- Example -->
<script 
    src="https://cdn.jsdelivr.net/npm/whatsapp-floating-widget@latest/widget.js" 
    data-phone="553340420000" 
    data-message="Hello! I would like more information." 
    data-position="right">
</script>
```

## ⚙️ Configuration

You can configure the widget using the following `data-` attributes on the `<script>` tag:

| Attribute | Description | Default / Example |
|----------|-------------|------------------|
| `data-phone` | The WhatsApp phone number for contact (with country code). | `553340420000` |
| `data-message` | Pre-filled initial message. | `Hello! I would like more information.` |
| `data-position` | Button position on the screen (`right` or `left`). | Default: `right` (if not specified or any other value) |

## 🤝 Contributing

Contributions are welcome! If you have suggestions or improvements:

1. Fork the project.
2. Create a branch for your feature (`git checkout -b feature/YourFeature`).
3. Commit your changes (`git commit -m 'Add feature X'`).
4. Push the branch (`git push origin feature/YourFeature`).
5. Open a Pull Request.

## 📄 License

Created by [Gigabaite Tecnologia](https://www.gigabaite.com.br) and licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
```
