# Changelog

All notable changes to the Salla Notifier plugin are documented here.

---

## [1.0.0] — 2026-05-08

Initial release.

### Added

#### Store Management
- Connect multiple Salla stores per user account, each with its own configuration
- Per-store fields: Store Name, Client ID, Client Secret, Webhook Secret (optional), WhatsApp Device
- Unique webhook token per store (`Str::random(40)`) generating a distinct public webhook URL
- Active / inactive toggle to pause a store without deleting its data
- Edit and delete with full cascade removal of templates and logs

#### Webhook Integration
- Public `/salla/webhook/{token}` endpoint exempt from CSRF verification
- Store lookup by unique webhook token; inactive stores are silently ignored
- HMAC-SHA256 signature verification against the `X-Salla-Signature` header using the store's Webhook Secret
- Graceful handling when Webhook Secret is not configured (verification skipped)

#### Supported Events (8 total)
- **Orders group**: `order.created`, `order.status.updated`, `order.payment.updated`, `order.cancelled`, `order.refunded`
- **Shipments group**: `shipment.creating`, `shipment.created`, `shipment.cancelled`

#### Message Templates
- Per-event configurable message template with `{variable}` placeholder replacement
- Sensible default template for each event type
- 12 variables available: `{customer_name}`, `{customer_phone}`, `{order_number}`, `{order_id}`, `{order_status}`, `{payment_status}`, `{order_total}`, `{store_name}`, `{shipment_id}`, `{shipment_company}`, `{tracking_number}`, `{tracking_url}`
- Variable chip buttons with click-to-insert-at-cursor functionality
- Enable/disable toggle per event; disabled events are skipped entirely
- Events grouped visually into Orders and Shipments sections
- Accordion layout: enabled events expand automatically on page load

#### Recipient Routing
- **Customer** mode: reads phone from the Salla order payload (`data.customer.mobile`)
- **Custom Number** mode: always sends to a fixed number regardless of order data
- Per-template recipient configuration; defaults to customer mode

#### WhatsApp Delivery
- Sends via the store's selected `Device` using `WhatsappService::sendText()`
- Device resolved from `salla_notifier_stores.device_id`; falls back gracefully if device not found
- All delivery attempts (success and failure) are recorded in logs

#### Message History & Logs
- Paginated log table (25 per page) showing event type, order number, customer name/phone, recipient, status, date, and sent message
- Filter logs by event type or delivery status (`sent` / `failed`)
- Bootstrap modal to view the full message content for any log entry
- Clear all logs for a store with a single confirmation action

#### Dashboard
- Stats row: Total Stores, Active Stores, Sent Today, Total Sent — scoped to current user
- Store cards showing status badge, message count, and webhook URL (click to copy)
- Empty state with prompt to connect first store

#### UI & Design
- Custom CSS with `.sn-` prefix — no global style pollution
- Animated store cards with hover lift effect
- Salla-green gradient accent on store logos
- Full dark mode via `[data-bs-theme="dark"]` selectors
- Bootstrap 5.3 components: modals, badges, pagination
- Tabler Icons throughout
- All user-facing strings wrapped in `__()`

#### Security
- All controller actions scoped by `auth()->id()` — users cannot access other users' stores
- Client Secret and Webhook Secret stored as plain text in DB; fields use password inputs with visibility toggle in UI
- CSRF token sent on all fetch-based state-changing requests
- Webhook route excluded from CSRF middleware only — all other routes remain protected

---

## License

This plugin is licensed under the **Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)**.

> Full license text: https://creativecommons.org/licenses/by-nc-nd/4.0/
