=== Chat App Brasil ===
Contributors: lupee
Tags: woocommerce, notifications, abandoned cart, chat, mensagens
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 2.7.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

WhatsApp automation for WooCommerce. Order notifications, abandoned cart recovery, floating button, Mercado Pago PIX integration and mass messaging.

== Description ==

**Chat App Brasil** is the official WordPress integration with the [ChatAppBrasil](https://chatappbrasil.com/) platform, enabling you to automatically send WhatsApp messages to your customers directly from your site or store.

No technical complexity, no complex APIs — just enter your Access Token and start sending.

> **Requires an active account at [chatappbrasil.com](https://chatappbrasil.com/).** Create your free account and get your Access Token to get started.

---

= 🛒 Automatic WooCommerce Order Notifications =

Configure a different message for each order status:

* **New order** — sent on the thank you page, right after purchase
* **Pending, On Hold, Processing, Completed** order statuses
* **Cancelled, Refunded, Failed** order statuses
* **Order note** — when the store owner adds a note to the order
* **Admin notification** — receive a copy of each order on your WhatsApp
* **Custom statuses** — compatible with any custom status from other plugins

All messages support **spintax** `{Hello|Hi|Hey}` for random variations, and **dynamic tags** like `%billing_first_name%`, `%order_total%`, `%product_name%` and 20+ available variables.

---

= 🛒 Abandoned Cart Recovery =

Requires [CartBounty Free or Pro](https://wordpress.org/plugins/woo-save-abandoned-carts/):

* Up to **3 follow-up messages** with configurable hourly intervals
* **Aftersales message** sent X hours after order completion — ideal for reviews or upsells

---

= 💬 Floating WhatsApp Button =

* Inline SVG icon — no external images, loads instantly
* **4 positions** available with configurable horizontal and vertical offset
* Configurable size from 40 to 200px
* **Pulse effect**, tooltip and pre-filled message
* Hide on mobile, desktop or specific pages
* **Click tracking** with statistics dashboard

---

= 💳 Mercado Pago PIX Integration =

Native integration with **WooCommerce Mercado Pago** plugin (v8.x):

* Automatically detects PIX orders
* Sends the **PIX copy-and-paste code** via WhatsApp message
* Sends the **QR code** as an image attachment
* Special tag `%pix_code%` available in the configured message
* QR code image automatically deleted after 30 minutes
* If Mercado Pago is not installed, an informational banner is shown with an install link

---

= 📋 Form Integrations =

**Contact Form 7** — WhatsApp tab added directly in the form editor. Configure number, message and image using CF7 tags like `[your-name]` and `[your-tel]`.

**Caldera Forms** — Same concept with native panel in the editor. Uses `{slug}` instead of `[tag]`, with automatic field listing.

---

= 🛍️ Easy Digital Downloads =

* Phone field automatically added to EDD checkout
* **New order notification** — sent on the receipt page
* **Completed order notification** — sent when payment is confirmed

---

= 📢 Mass Messaging =

* Share posts and products to a list of numbers
* Import WooCommerce customers
* Personalization with `%fname%` and `%lname%`

---

= 🔒 Security =

* Token validated before unlocking features
* All inputs sanitized with `wp_unslash()` and `sanitize_*`
* Nonces on all forms and AJAX actions
* Token never exposed in frontend JS — API calls made exclusively via PHP
* Compatible with **HPOS** (WooCommerce 7.1+)
* WordPress native **Privacy Policy** integration

---

= External Service =

This plugin transmits data (phone number, message, image) to the **ChatAppBrasil** API (`https://api.chatappbrasil.com`) solely to enable WhatsApp message delivery.

* [Terms of Service](https://chatappbrasil.com/termos)
* [Privacy Policy](https://chatappbrasil.com/privacidade)

---

= Compatibility =

* WordPress 6.0+ | WooCommerce 7.0+ with HPOS | PHP 7.4+
* Contact Form 7 | Caldera Forms | Easy Digital Downloads
* CartBounty Free and Pro | WooCommerce Mercado Pago 8.x

== Installation ==

1. Go to **Plugins → Add New → Upload Plugin**.
2. Select the `.zip` file and click **Install Now**.
3. Activate the plugin.
4. Go to **Chat App Brasil → Configuration**, enter your Access Token and click **Test Connection**.
5. Configure messages in **Chat App Brasil → Notifications**.
6. Customize the button in **Chat App Brasil → WhatsApp Button**.

== Frequently Asked Questions ==

= Do I need an account to use the plugin? =

Yes. An active account at [ChatAppBrasil](https://chatappbrasil.com/) with a valid Access Token is required.

= The floating button doesn't appear on my site. =

Make sure a phone number is entered in **Chat App Brasil → WhatsApp Button**. Without a number the button won't display.

= Messages are not being sent. =

1. Make sure the Access Token was validated successfully.
2. Check that the message for the corresponding status is not blank.
3. Check the log at **Chat App Brasil → Message Logs**.

= The WhatsApp tab doesn't appear in the CF7 editor. =

Make sure the Chat App Brasil plugin is active. The tab is added automatically to any CF7 form editor.

= Is the plugin compatible with WooCommerce HPOS? =

Yes. High-Performance Order Storage compatibility is declared automatically and tested with WooCommerce 7.1+.

= How does the Mercado Pago PIX integration work? =

When a customer places a PIX order, the plugin automatically reads the QR code and copy-and-paste code generated by the Mercado Pago plugin and sends them via WhatsApp. Requires WooCommerce Mercado Pago v8.x.

== Third-party Libraries ==

**International Telephone Input v15.0.2**
* Repository: https://github.com/jackocnr/intl-tel-input
* License: MIT
* Files: assets/js/intlTelInput.js, assets/css/intlTelInput.css, assets/js/utils.js

**jQuery Modal v0.9.1**
* Repository: https://github.com/kylefox/jquery-modal
* License: MIT
* File: assets/js/jquery.modal.min.js

== Changelog ==

= 2.1.0 - 04/2026 =
* Mercado Pago PIX integration — automatic QR code and copy-and-paste code via WhatsApp
* WLP_VERSION constant synchronized with plugin version (2.1.0)
* flags@2x.png added for high-resolution (Retina) screen support
* .pot file updated with new strings, fuzzy flag removed
* English (en_US) base translation included
* Informational blocks reorganized by tab (tags, spintax, EDD)
* Admin panel footer overlap fixed

= 2.7.3 - 05/2026 =
* Back In Stock Notifier integration — automatic WhatsApp when product is back in stock
* New dedicated "🔔 Back In Stock" tab in Notifications with locked gate when plugin not installed
* Available tags: %name%, %product_name%, %product_url%
* Product image sent automatically; option for custom fixed image
* Fixed "View subscribers" link in Back In Stock tab

= 2.7.1 - 04/2026 =
* Logs tab: exclusive Abandoned Carts view with customer data, items, time since abandonment and manual resend button
* Blocked gate on Abandoned Carts tab when CartBounty is not installed (blurred preview with install prompt)
* Full CartBounty Free and Pro support (automatic detection — Free: followup_1/2/3, Pro: wp_steps_completed)
* Automatic sending of all 3 abandoned cart follow-ups compatible with CartBounty Pro and Free
* Reason for non-delivery shown per cart (no phone, no message configured)
* Mercado Pago PIX integration — automatic QR code and copy-paste code via WhatsApp
* Security: duplicate message blocking (deduplication) — configurable in Settings
* Security: rate limit per minute (1–100) — configurable in Settings
* Debug system: enable in Settings, generates detailed logs with environment info, active plugins, cron status, CartBounty diagnostics
* Diagnostic report with one click: PHP/WP/WC versions, DISABLE_WP_CRON detection, CartBounty cart counts with phone numbers
* wlp_debug_log() calls at critical send points (followup, rate limit, dedup)
* register_setting() with sanitize_callback for all button options in wlp-button.php
* Logger optimized to use fgets() line-by-line instead of file_get_contents() for large log files
* .pot regenerated with 44 strings, version 2.7.1, no fuzzy flag
* English translation (en_US) updated

= 2.0.0 - 04/2026 =
* CF7 hooks corrected (wpcf7_editor_panels, wpcf7_after_save, wpcf7_before_send_mail)
* Caldera Forms integration implemented with native panel and {slug} resolution
* PHP proxy for instance actions — token never exposed in JavaScript
* wp_localize_script replacing inline JS variables
* register_setting with sanitize_callback for all fields
* wp_unslash() on all $_POST inputs
* SSL mandatory on cURL calls
* .pot file with 43 strings for translation
* Privacy policy integration via wp_add_privacy_policy_content()
* Automatic data migration for users updating from previous versions
* WLP_API_URL and WLP_API_BASE constants for API endpoints
* GPL and @package headers in all PHP files

= 1.5.0 - 04/2026 =
* Full HPOS support (WooCommerce 7.1+)
* Token validation via API before unlocking features
* Floating button with inline SVG, configurable offset and pulse effect
* JSONL logs with pagination and one-click resend
* Click tracking available for non-logged visitors

= 1.0 - 07/2023 =
* Initial plugin release.

== Upgrade Notice ==

= 2.1.0 =
Adds Mercado Pago PIX integration, Retina flag sprites, updated .pot and English translation. Recommended for all users.
