=== Miruto – Checkout Recovery & Insights for WooCommerce ===
Contributors: miruto
Tags: abandoned cart, checkout, woocommerce, analytics, cart recovery
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 7.0
WC tested up to: 11.2
Stable tag: 1.4.18
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Recover lost WooCommerce sales: see where real shoppers stop in the cart and checkout, fix the errors that block them, and win them back.

== Description ==

Miruto records every WooCommerce cart and checkout session and turns it into a clear dashboard:

* Every checkout field the customer filled in, the last field before leaving and a completion score.
* Cart contents and value, linked to the order and its status (unpaid, failed, cancelled, purchased, recovered).
* Traffic source: UTM, gclid, fbclid, msclkid, ttclid, referrer, landing page, first and last touch, page journey.
* Lost revenue with checkout intent, kept separate from plain add-to-cart activity.
* Funnel, sources, devices, payment methods, languages and the most abandoned products, each compared with the previous period.
* AI agent detection (Web Bot Auth Signature-Agent header, AI user agents, behaviour), robots and link previews flagged and excluded from the numbers.
* JavaScript and WooCommerce request errors on cart and checkout.
* Import of existing WooCommerce sessions and orders, without duplicates.
* Follow-up list of customers with contact details, notes and a "contacted" flag.
* Classic and block checkout, HPOS compatible, GDPR export/erase, consent cookie, IP anonymisation, retention.
* Read-only REST API and a `miruto_session_abandoned` action for recovery emails.

Miruto is fully translatable and follows the site's language. Bundled translations: Estonian.

== Installation ==

1. Upload the plugin zip in Plugins → Add New → Upload Plugin and activate it.
2. Open WooCommerce → Miruto → Import to bring in history.
3. If you use a page cache, purge it once.

== Frequently Asked Questions ==

= Does Miruto store card details? =
No. Card fields and passwords are never stored, and a configurable regular expression excludes any other sensitive fields.

= Why are some imported sessions empty? =
The WooCommerce session table only keeps the cart and the customer's default details. Full data is collected from the moment Miruto is activated.

== Changelog ==

= 1.4.18 =
* Conversations: numbered pages, and clearer status labels (agent is handling it, waiting for the phone line, email paused, with your team).

= 1.4.17 =
* Overview: the five checkout numbers sit on one row and key metrics use three columns on wide screens.

= 1.4.16 =
* New Conversations tab: chats the agent handed over (or you took over) in one place. Read the thread, reply on the same channel the shopper used, mark it solved or hand it back to the agent.
* A badge on the Miruto menu shows how many shoppers are waiting for your reply. Handover emails link straight to the conversation.

= 1.4.15 =
* Miruto switches itself back on after an update, even when WordPress leaves it off.
* The Miruto console is told who switched the plugin off or on, and when.
* After a switch-off, carts and orders from that time are taken over from WooCommerce. Carts that were paid in the meantime get no reminder; shoppers who never saw the Miruto notice at checkout are not messaged.

= 1.4.14 =
* Code quality: database queries use identifier placeholders, bot filters no longer need escaped wildcards, output escaping and translator comments tidied up. Requires WordPress 6.2 or newer.

= 1.4.13 =
* The Miruto console learns the plugin version right after an update and gets fresh status every 15 minutes.

= 1.4.12 =
* Order history for the agent is now exact: paid orders are matched by customer account, billing email (any case) and billing phone (any format), with the date of the last order. Post-purchase flow counts guests correctly.

= 1.4.11 =
* Phone numbers typed without a country code get the store's country code when the session has no country, so messages and replies match the right shopper.

= 1.4.10 =
* Flows → Agent: tone is now a choice. Miruto default (recommended) is selected out of the box; three presets or your own words are optional.

= 1.4.9 =
* Session detail shows the path to the agent step by step: contact left, left the checkout, handed to the agent, agent wrote, order. Each step says when it happens or why it stopped.
* The Miruto console now runs the background job every 15 minutes, so abandoned checkouts reach the agent on time even on quiet stores. Status is refreshed hourly.
* Read-only signed report for Miruto support (overview, sessions, session).

= 1.4.8 =
* The Recovery tab is now called Flows, the same as in the Miruto console.
* Channels card: nothing to set up. Each channel shows In use, Ready (agent paused) or Not in use yet; Miruto picks the channel for every shopper from device and consent.

= 1.4.7 =
* Setup, step 3: nothing has to be filled in. The Miruto EQ model is the default tone; ready-made tones (warm and personal, short and factual, calm and premium) or your own words. Name, hand-offs, discounts and AI disclosure are folded under More options with a summary of the defaults.

= 1.4.6 =
* New: Get started. Right after activation the plugin opens a five-step setup: connect to the console, import history, how the agent writes, checkout notice and flows, turn the agent on. Each step opens when the previous one is done. Overview shows a reminder until setup is finished.
* Fix: the Channels card on the Recovery tab showed every channel as not set up (since 1.4.5).
* Channels card now also shows RCS.

= 1.4.5 =
* New flow: Post-purchase. A few days after an order is completed the agent checks that everything arrived, helps with questions and asks for a review when things went well.
* New flow: Win-back. Earlier buyers who have not ordered for a while get a personal message with a link that puts their last order back in the cart. Only shoppers who checked out after the flow was turned on, because the checkout notice now mentions these messages.
* Orders placed within 14 days of a flow message are counted for that flow.
* Recovery tab: days setting and results for both flows.

= 1.4.4 =
* New channel: email. Shoppers who left only an email address can now be reached, and email is the last fallback when no phone channel reaches the shopper. Replies come back to the agent and show in the conversation.
* Unsubscribing from email stops email to that address (one-click unsubscribe in every email).
* Checkout notice and consent text mention email.

= 1.4.3 =
* Updated plugin description. The plugin name and description on the Plugins screen are now always in English.

= 1.4.2 =
* The first sync with the Miruto console no longer waits for WP-Cron. If a store has not synced for 2 hours (cron disabled, page cache, quiet shop), Miruto syncs in the background when an admin page is opened.

= 1.4.1 =
* Updates from Miruto: new versions now show up on the Plugins screen ("update available", View details, Update now and automatic updates), delivered from the Miruto console. Includes a "Check for updates" link.

= 1.4.0 =
* Real shoppers only: robots, link previews and price-comparison bots (product added with an ?add-to-cart= link or the browser script never ran, with no contact, field or order) are hidden from the Overview, the session list and the console numbers by default. Turn on "Include robots and link-only carts" to see them.
* New Errors screen: JavaScript errors, files that did not load, failed cart and checkout requests, checkout errors, PHP fatals and WooCommerce error logs, grouped and sorted by lost sales. Browser extensions, ad blockers and robots are left out.
* Miruto AI fixer (free during beta): explains the cause of an error and prepares a fix. Code fixes are installed only after you click Apply, as a separate must-use plugin file, health-checked on the home, shop, cart and checkout pages and removed automatically if anything breaks. One-click undo.

= 1.3.4 =
* Fix: console numbers now follow the Overview rules. Robots and suspected robots are excluded, only carts with checkout intent count as abandoned checkouts, plain add-to-cart and imported carts are reported separately.
* Heartbeat to the console every hour (was twice a day).

= 1.3.3 =
* New Miruto logo everywhere in the admin (same mark as miruto.app).

= 1.3.2 =
* Sends checkout behaviour signals (how far the shopper got, Place order clicks, errors, page views, time) to the Miruto EQ model so the assistant can respond to how the shopper feels.

= 1.3.1 =
* One-click connect: the WordPress admin who connects becomes the store's Miruto user.
* "Open Miruto console" signs you in to your own Miruto console with a signed one-time link. No separate password.

= 1.3.0 =
* Legal basis modes for recovery messages: notice + opt-out (default, EU existing-customer exception), opt-in checkbox, or terms only.
* Channel order per shopper: Apple devices get iMessage first, WhatsApp only with explicit opt-in.
* "Message us" button on cart and checkout (iMessage on Apple devices, WhatsApp elsewhere) with a cart reference, plus /agent/session-by-ref.
* Session view shows the legal basis and channel order. Console default is now console.miruto.app.

= 1.2.0 =
* Recovery agent: connect to the Miruto console, messaging consent at checkout, guardrails, signed agent API, cart restore links.

= 1.0.0 =
* First public release.
