=== AutoEmails by AutoThink ===
Contributors: autothinkgroup
Tags: woocommerce, email marketing, AI email, revenue attribution, campaign tracking
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 2.1.26
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI-powered email marketing command centre for WooCommerce — revenue attribution, automated campaigns, and smart customer insights.

== Description ==

**AutoEmails by AutoThink** transforms your WordPress admin into a full email marketing command centre powered by AI.

Tell Leo — your AI marketing assistant — what you want to do, and it handles everything: building customer segments, creating automated flows, and sending targeted campaigns based on your store data.

= What's New in v2.0 =

* **Command Centre** — full AutoEmails experience embedded directly in your WordPress admin
* **AI Assistant (Leo)** — describe what you want in plain English and Leo builds it
* **Dashboard Widget** — revenue attributed, orders driven, and open rates at a glance
* **Order Timeline** — see email activity for every customer on their order page
* **Bulk Actions** — send campaigns directly from WooCommerce order and product lists
* **Smart Onboarding** — connect, sync, and start marketing in under 2 minutes

= Core Features =

* **Revenue attribution** — see which campaigns, emails, and automations are generating sales
* **Real-time order sync** — orders are sent the moment they're placed
* **Refund tracking** — refunded orders are synced too, keeping revenue figures accurate
* **Popup & overlay delivery** — your AutoEmails popups load automatically on your store
* **Coupon tracking** — see which coupon codes are driving revenue
* **HPOS compatible** — fully supports WooCommerce High-Performance Order Storage
* **Lightweight** — no JavaScript on the storefront (except optional popups), zero performance impact

= How It Works =

1. Install the plugin and enter your API key
2. Leo analyses your store and suggests your first campaign
3. Orders sync automatically — revenue is attributed to the campaigns that drove them
4. Manage everything from the Command Centre without leaving WordPress

== External Services ==

This plugin connects to the **AutoEmails** platform ([https://autoemails.com](https://autoemails.com)) to provide email marketing, revenue attribution, and AI campaign management.

= What data is sent =

When a WooCommerce order status changes to Processing, Completed, or Refunded, the following data is sent to the AutoEmails API:

* Order ID and order number
* Order status and total amount
* Currency
* Billing email, first name, and last name
* Order creation and completion dates
* Line items (product name, quantity, total, SKU)
* Coupon codes used

The Command Centre iframe communicates with AutoEmails servers to display your marketing dashboard. A JWT token is requested for seamless authentication.

= When data is sent =

Data is sent automatically via a server-side HTTP POST request each time an order reaches one of the tracked statuses. The Command Centre loads when you open it in the admin. No data is sent from the customer's browser and no JavaScript is loaded on the storefront (except the optional popup script).

= Service details =

* **Service provider:** AutoThink ([https://autothink.io](https://autothink.io))
* **Terms of Use:** [https://autoemails.com/terms](https://autoemails.com/terms)
* **Privacy Policy:** [https://autoemails.com/privacy](https://autoemails.com/privacy)

== Installation ==

1. Upload the `autoemails-by-autothink` folder to `/wp-content/plugins/`
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to **AutoEmails → Settings** in your WordPress admin
4. Enter your API key and click **Save Settings**
5. Open the **Command Centre** to start marketing with AI

== Frequently Asked Questions ==

= Where do I find my API key? =

Log in to AutoEmails, go to Settings → Integrations → WooCommerce, and copy your API key.

= Does this slow down my store? =

No. The plugin sends order data via server-side HTTP requests. The only frontend script is the optional popup loader, which loads asynchronously.

= What is the Command Centre? =

It's the full AutoEmails experience embedded in your WordPress admin. You can build campaigns, create automations, view analytics, and chat with Leo — all without leaving WordPress.

= Does it work with WooCommerce HPOS? =

Yes, full compatibility with High-Performance Order Storage is declared.

== Changelog ==

= 2.1.26 =
* Cart abandonment: full WooCommerce Blocks (Store API) checkout support — captures guest emails on the modern blocks-based checkout used by most current themes. Fixes empty-email cart rows on stores running the Blocks checkout.

= 2.1.25 =
* Cart abandonment: capture guest email from WooCommerce checkout AJAX (`post_data`) so checkout drop-offs are recoverable

= 2.1.24 =
* Cart abandonment release for live testing — same payload as 2.1.23, republished after build pipeline fix

= 2.1.23 =
* Real-time WooCommerce cart abandonment tracking — captures cart mutations, checkout drop-offs, and guest emails for the new Cart Recovery automation
* Sticky cart token + magic recovery link rebuilds the customer's exact cart (variations, quantities) on return for one-click checkout
* Hardened guest-checkout email capture and recovery attribution pipeline

= 2.1.22 =
* Internal release — superseded by 2.1.23

= 2.1.21 =
* Internal release — superseded by 2.1.22

= 2.1.20 =
* Stability improvements to historical order sync and revenue attribution pipeline
* Hardened plugin update check and connection diagnostics
* Minor bug fixes and performance improvements

= 2.1.19 =
* Internal reliability improvements to the order sync queue
* Improved error reporting for failed syncs

= 2.1.18 =
* Removed the persistent "AutoEmails Connection" diagnostic banner from the WordPress admin dashboard — connection is now stable and the noisy banner is no longer shown
* Fixed historical order sync getting stuck on "Starting background sync…" — the AJAX poll now drives sync progress inline on every tick so orders pull through reliably even when WP-Cron is asleep
* Sync progress bar now also detects completion when total reaches processed count, preventing edge-case "stuck at 99%" displays

= 2.1.17 =
* Historical sync progress now updates live in the plugin settings screen while the background backfill runs
* Existing running syncs now hydrate correctly on page load instead of appearing stuck at 0%
* Sync start now processes the first batch immediately so counts move straight away

= 2.1.16 =
* Removed the "Force Reconnect & Sync Now" button from the admin diagnostic notice — connection is now stable and self-healing

= 2.1.15 =
* Historical sync now pulls newest orders first so recent revenue appears in the dashboard within minutes
* Capped historical backfill at the last 12 months of orders for dramatically faster initial sync on large stores
* Added "Stop & Reset Sync" button so admins can cancel a running background sync at any time

= 2.1.14 =
* Historical order sync now starts a server-side background queue instead of relying on repeated browser AJAX batches
* Reduced background sync batch size to 25 orders for better compatibility with slower WordPress hosts
* Improved sync resilience with retryable server-side error tracking and safer AJAX JSON responses

= 2.1.8 =
* Self-healing bootstrap: handshake + 30-day order backfill now fires immediately on settings save and on plugin update — no longer dependent on wp-cron
* Plugin re-registers the real store URL with the platform on every save and upgrade so connections never get stuck on a placeholder
* Bug fix: existing installs with empty REST credentials now sync automatically without users needing to generate WooCommerce API keys

= 2.1.5 =
* Improved auto-update reliability — manual "Check Again" now bypasses local cache and fetches the latest version instantly
* Cache window for update checks reduced from 6 hours to 1 hour
* Added plugin icon to update notifications

= 2.1.4 =
* Maintenance release — refreshed update channel push to ensure all existing installs receive the latest packaged assets
* Verified compatibility with WordPress 6.9.4 and WooCommerce 9.6
* Internal: rebuilt plugin ZIP and re-published to auto-update channel

= 2.1.3 =
* Multi-workspace support — agency users can now choose which AutoEmails workspace to bind to each WordPress site
* Site-level workspace lock — once chosen, the site is locked to that single workspace (manage from main app → Settings → Integrations)
* Workspace switcher hidden inside WP iframe to prevent accidental cross-client data exposure
* Backend: new wp_site_workspace_bindings table with full audit trail and revoke support

= 2.1.2 =
* Self-hosted auto-update channel — existing installs now receive update notifications automatically within ~12 hours
* Bundled menu icon asset for reliable rendering across all WP themes
* Internal version constant aligned with plugin header

= 2.1.1 =
* FIX: Admin menu icon now renders correctly (assets bundled in plugin package)

= 2.1.0 =
* In-WordPress account creation — no more leaving WP to sign up
* One-click free plan provisioning with automatic store connection
* API key auto-generated and saved during onboarding (no copy/paste)
* Inline email/password signup form in the onboarding wizard
* Existing account detection with seamless login
* Updated onboarding messaging for free plan clarity

= 2.0.0 =
* Command Centre — full app embedded via iframe with JWT auth
* WP Dashboard widget showing revenue, orders, emails sent, open rate
* Order metabox showing AutoEmails activity per customer
* Bulk actions on order and product lists
* Coupon line sync in order payloads
* Separate Settings and Command Centre menu pages
* Branded admin styles (pink accent)
* Updated plugin description and readme

= 1.1.1 =
* Popup & overlay auto-loading via widget config
* Auto-update system
* HPOS compatibility

= 1.0.0 =
* Initial release
* Order sync on status change
* Settings page with API key management
* Test connection button

== Upgrade Notice ==

= 2.0.0 =
Major upgrade — your WordPress admin becomes a full email marketing command centre. Update now to access Leo AI, dashboard widgets, and order-level email tracking.
