# Changelog

All notable changes to the Group Sender plugin are documented here.

---

## [1.1.1] — 2026-06

### Added
- **Peringatan Mention + Jadwal**: Saat user memilih mode mention (All/Specific/Silent) tanpa mengisi jadwal, muncul peringatan kuning yang menjelaskan bahwa fitur mention hanya bekerja optimal dengan jadwal. Peringatan otomatis hilang saat jadwal diisi.

### Notes
- Fitur mention (All/Specific/Silent) bekerja penuh dan stabil saat menggunakan **jadwal kirim** (Node.js scheduler punya waktu cukup untuk fetch data grup dari WhatsApp)
- Untuk kirim langsung tanpa jadwal, mention mungkin tidak berfungsi karena keterbatasan timing koneksi WhatsApp real-time

---

## [1.1.0] — 2026-06

### Fixed
- **Silent mention tidak berfungsi**: Panel member kini tampil untuk mode `all` dan `silent` (sebelumnya hanya `specific`). Member di-fetch otomatis saat mode dipilih atau grup dipilih.
- **Mention all/silent tidak kirim JIDs**: `mention_members` kini dikumpulkan untuk semua mode di form submit. Node.js tetap fetch live via `groupMetadata` sebagai fallback.
- Member list kini menampilkan tombol **Semua / Batal** untuk centang/hapus centang sekaligus.
- Auto-fetch member saat grup pertama kali dipilih dan mention mode aktif.
- Error message lebih jelas jika fetch member gagal.

### Added
- **Fitur Kirim Berulang (Recurring)**: Setelah broadcast terjadwal berhasil dikirim, dapat dijadwalkan ulang secara otomatis — setiap X jam, setiap hari, setiap minggu, setiap bulan, atau setiap tahun.
- UI repeat muncul otomatis di bawah field Schedule saat tanggal diisi.
- Badge repeat + info "Next run" ditampilkan di halaman daftar broadcast.
- Migration baru: kolom `repeat_type`, `repeat_interval`, `next_run`, `last_sent_at` pada tabel `group_broadcasts`.

---

## [1.0.0] — 2026-04-21

Initial release.

### Added

#### Core Broadcast Engine
- Device-scoped broadcasts: each broadcast belongs to the currently selected WhatsApp device and the authenticated user
- Five message types: **Text**, **Image**, **Video**, **Audio**, **Document**
- Per-broadcast configurable delay between group sends (0–300 seconds) to avoid WhatsApp rate-limiting
- Broadcast statuses: `draft`, `scheduled`, `sending`, `completed`, `partial`, `failed`
- Per-group delivery log (`group_broadcast_logs`) tracking `sent` / `failed` per target group with raw response storage

#### Mention Support (via Node.js)
- **No Mention**: plain message send via Laravel `WhatsappService`
- **Mention All**: fetches all group member JIDs via `session.groupMetadata()` and passes them as `mentionedJid`
- **Mention Specific**: user selects individual members from a fetched member list; only selected JIDs are mentioned
- **Silent Mention**: embeds member JIDs using zero-width joiners (`\u200d`) so mentions trigger push notifications without appearing as visible `@` tags in the chat

#### Scheduling
- `scheduled_at` field per broadcast with browser timezone auto-detection (stored in `user_timezone`)
- `group-sender:send-scheduled` Artisan command dispatches all due broadcasts; registered on the Laravel scheduler via `ScheduleServiceProvider`

#### Group Management
- Fetch live group list from the connected WhatsApp device via `WhatsappService`
- Sync & cache groups for offline browsing
- Searchable, filterable group picker in the broadcast editor
- Select All / Deselect All / Select Filtered shortcuts

#### Templates
- Save any broadcast configuration as a named reusable template (`group_sender_templates` table)
- **My Templates** selector in the editor loads user-owned templates
- **Core Templates** selector loads MPWA system-wide templates via `fetchMpwaTemplates()`
- Templates page with paginated grid and per-card delete
- Template type badge (`text`, `image`, etc.) and message preview shown on each card

#### Retry
- **Retry Failed** action re-sends only to groups with `status = failed` in the broadcast log, without touching previously succeeded groups
- Broadcast status updated to `completed` / `partial` / `failed` after retry

#### Bulk Operations
- **Delete All** removes all broadcasts and their logs for the current device in one action (two-step confirmation modal)
- **Send Now** confirmation modal before immediate dispatch

#### Node.js Routes
- `POST /api/group-sender/send-with-mention` — mention send (all / specific / silent modes)
- `GET /api/group-sender/fetch-members/:groupId` — returns group member JIDs and names
- `POST /api/group-sender/send-message` — plain text group send
- `POST /api/group-sender/send-media` — media group send (image / video / audio / document)
- CORS middleware applied to all `/api/group-sender` routes

#### UI
- Broadcasts grid with status badge, group count, message type badge, mention badge, scheduled date, send/fail progress bar, and relative timestamp
- Broadcast editor split into three left-column cards (Broadcast Settings / Mention Settings / Load from Template) and two right-column cards (Target Groups / Message)
- File upload for media via Laravel Filemanager (`stand-alone-button.js`)
- WhatsApp-style text formatting toolbar (Bold, Italic, Strikethrough, Monospace, Bullet list)
- Breadcrumb navigation on all pages
- Keyword search on the broadcasts index
- Device-required guard on all views; menu item hidden until a device is selected

#### Security
- All broadcast data scoped by `user_id` and `device_id`
- CSRF token sent on all state-changing requests
- Validation enforced on store/update: required name, at least one target, valid message type, valid mention type, delay bounded 0–300

#### Internationalization
- `lang/en.json` covering all UI strings
- Additional translations: Arabic (`ar`), Azerbaijani (`az`), Spanish (`es`), Hindi (`hi`), Indonesian (`id`), Turkish (`tr`), Urdu (`ur`), Chinese (`zh`)

---

## License

This plugin is licensed under the **MIT License**.
