=== Kwiro — AI Sales Agent & Chatbot for WooCommerce ===
Contributors: kwiro
Tags: woocommerce, ai chatbot, sales agent, live chat, ecommerce
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 7.0
WC tested up to: 9.5
Stable tag: 1.2.16
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI Sales Agent for WooCommerce — recommends products, answers shoppers, recovers carts. 58 languages, ~0% hallucination, 30-minute setup.

== Description ==

#### AI SALES AGENT FOR WOOCOMMERCE — TRAINED ON YOUR CATALOG, MEASURED IN REVENUE.

Your store gets visitors at 11 PM. They land with buying questions — *"Will this fit a 5'8 frame?"*, *"What's the difference between these two?"*, *"Do you have it in red?"* — and there's no one to answer. Cart abandoned. Sale lost. Tomorrow morning your conversion report shows the gap, but you can't see how big it really was.

Kwiro is the first AI Sales Agent built specifically for WooCommerce. It reads your entire catalog, answers shoppers in 58 languages, and converts visitors into buyers — even at 3 AM. Independently tested at **~0% hallucination across 887 real shopper scenarios** (full results published at [kwiro.ai/proof](https://kwiro.ai/proof)). Not another live-chat plugin retrofitted with AI; built from the first line of code to **recommend, qualify, and close**.

#### KWIRO VS A GENERIC AI CHATBOT

Generic live-chat and chatbot plugins were built for **support** — answering tickets, deflecting questions, freeing up human agents. They got "AI" bolted on later. Kwiro inverts the design:

* **Catalog-grounded answers** — every reply is anchored to retrieved products from your live WooCommerce catalog. Hallucinations don't just degrade UX, they kill trust. We test for them on every release.
* **Recommends specific SKUs** — not *"you might like our jewellery"* but *"the Gold Chain Bracelet, $129, in stock — add to bag"*. Sale-aware, in-stock-aware, currency-correct.
* **Handles objections** — *"Is this good quality?"*, *"Will it fit?"*, *"What's your return policy?"* — answered with your store's voice, not boilerplate.
* **Closes at 2 AM** — first-token response in ~1.5 s, full reply in ~2.5 s, in any of 58 tested languages.
* **Measured in revenue, not tickets** — direct attribution within 30 minutes of the chat, assisted attribution within 24 hours. Every dollar earned through chat shows up on your dashboard.

#### KEY FEATURES

* **One-click connect** – click *Connect to Kwiro* on the plugin settings page, sign in via magic link, products sync automatically. No API-key copy-paste, no CSV uploads, no manual setup.
* **Trained on your live catalog** – every product, variant, price, and attribute syncs in 1–5 minutes for a typical store. New products and edits appear in seconds via WooCommerce hooks.
* **~0% hallucination on product data** – 887 scenarios tested across 33 categories and 58 languages, audited monthly. We won't pretend it'll always stay there — no AI is perfect — but every uncertain answer surfaces in your dashboard's Knowledge Gaps so you can review and teach. Full receipts at [kwiro.ai/proof](https://kwiro.ai/proof).
* **Guided Selling** – tap-friendly multiple-choice quiz for shoppers who don't know what to type. Hands off to chat with real product cards in 2–4 taps. No other WooCommerce chatbot does this.
* **5-layer memory that learns what converts** [Growth] – product intelligence + store memory + winning conversations + cross-store network + outcome scoring. Each store grows its own playbook.
* **ROI Dashboard** [Pro] – AI-attributed revenue, conversion rate, top questions, top recommended products. Direct + assisted attribution windows.
* **Memory Inspector** [Growth] – pin, edit, or delete what the AI has learned. Knowledge Gaps surface unanswered questions so you can teach the AI in two clicks.
* **Forbidden Topics** [Growth] – exclude product categories, brands, or topics from the AI. Default list already deflects support questions (refunds, order tracking, warranties) to your existing helpdesk.
* **58 languages, native quality** – English (US, UK, Australian variants), Spanish, French, German, Italian, Portuguese, Dutch, plus 50 more. 95%+ pass rate on multilingual scenarios.
* **3 KB iframe widget** – loads asynchronously, no theme CSS conflicts, no impact on Core Web Vitals. Mobile-first by default.
* **Clean uninstall** – Disconnect button purges every locally stored credential in one click. Uninstall removes every option, transient, and cron event.

#### BUILT FOR WOOCOMMERCE, NOT BOLTED ON

* **All product types supported** – simple, variable, grouped, and external/affiliate products with attributes (size, colour, etc.), categories, tags, sale prices, and stock status.
* **Cart-aware widget** – knows what's in the shopper's basket and recommends complementary products that ship from your inventory.
* **Order webhooks** – paid orders fire attribution lookups that link the conversation, the recommendation, and the sale.
* **Adaptive batch sync** – auto-tunes batch size based on your host's response time, so even slow shared hosts complete a full catalog sync without timeouts.
* **Theme-agnostic** – tested with Storefront, Astra, GeneratePress, OceanWP, Flatsome, Kadence, Divi, and more. The widget is an isolated iframe; your theme's CSS can't break it.

#### YOUR DATA, YOUR CHOICE

Kwiro is fully **GDPR + CCPA + CPRA compliant**. Customer chats are encrypted in transit (TLS 1.2+) and at rest (AES-256). Conversation data is hosted on AWS us-west-2 (Oregon), never sold, never used to train third-party models. AI inference is routed through a **privacy-preserving AI gateway under a Zero Data Retention (ZDR) agreement** — prompts and responses are not logged, stored, or retained by the gateway or its upstream model providers. **No customer PII** (name, email, address, payment) is ever sent to Kwiro.

You can export every conversation to CSV, or delete a visitor's data on request, in a single click. Cancel and you keep everything.

The plugin makes **no network requests until you click *Connect to Kwiro*** — explicit user opt-in by design. Full disclosure of every endpoint and the data sent to each is in the **External services** section below.

#### PRICING — FOUNDING-MEMBER LAUNCH RATES

Plans differ by monthly conversation cap, language coverage, and advanced memory features. **Subscribe at the launch rate and lock it forever, even after the public price increases.**

* **Free** – $0/mo, **200 conversations/month**, English only, "Powered by Kwiro" badge, full conversation transcripts, community support.
* **Pro** – launch **$39/mo** (regular $79), **2,000 conversations**, all 58 languages, ROI dashboard, AI-attributed sales, Missing Products report, email support.
* **Growth (most popular)** – launch **$99/mo** (regular $199), **5,000 conversations**, Memory Inspector, Knowledge Gaps, custom prompts, priority queue, API access, 3 team seats.
* **Scale** – launch **$299/mo** (regular $599), **25,000 conversations**, white-label widget, multi-store management, priority infrastructure, 10 team seats, dedicated CSM.

Overage on paid plans: **$10 per extra 1,000 conversations** — billed metered, never surprises. By default (1× cap), your bill **never exceeds your plan price** even past your limit; the AI shifts to short, polite degrade-mode replies. Raise the cap to 2×/3×/5× if you'd rather pay for full-quality replies past the limit. **Kwiro never stops mid-chat.**

#### TRY IT WITHOUT INSTALLING

Open the [live demo at kwiro.ai](https://kwiro.ai) — chat with the AI Sales Agent on a real WooCommerce store, then read all 887 test scenarios at [kwiro.ai/proof](https://kwiro.ai/proof). No signup. No card. 30 seconds.

== Installation ==

**The fastest path — install from inside WordPress:**

1. In WP admin go to **Plugins → Add New** and search for *Kwiro*.
2. On the *Kwiro — AI Sales Agent & Chatbot for WooCommerce* card, click **Install Now**, then **Activate**.
3. Open **WooCommerce → Kwiro** in the sidebar.
4. Click the orange **Connect to Kwiro →** button on the consent panel and sign in via magic link (no password).
5. Products sync automatically in the background — a typical 100-product catalog finishes in 1–5 minutes.

**Alternative — manual upload:** Download the ZIP from [wordpress.org/plugins/kwiro-ai-sales-agent](https://wordpress.org/plugins/kwiro-ai-sales-agent/), then in WP admin go to **Plugins → Add New → Upload Plugin** and choose the ZIP. Continue from step 3 above.

== Frequently Asked Questions ==

= Is this a chatbot or a sales agent? =

A sales agent. Chatbots are built around FAQ/ticket deflection; Kwiro is built around "find me the right product, recommend a better one, close the sale". Different prompts, different memory, different metrics.

= Does it work with any WooCommerce theme? =

Yes. The widget is an iframe so it can't be broken by your theme's CSS, and it ships responsive defaults for every screen size.

= Do I need to copy an API key? =

No. The **Connect to Kwiro** button does the linking automatically in one click. The API-key paste flow still exists for users who prefer it or are linking a store behind a VPN.

= How does product sync work? =

The first sync runs in the foreground when you click **Sync Now** (so you see progress immediately), and subsequent batches run via WP CRON. Simple, variable, grouped, and external products all supported — including attributes, categories, images, and sale prices.

= Will this slow down my store? =

No. AI runs in the cloud, the widget is a lightweight iframe loaded asynchronously, and sync batches are small and throttled so they never hold up a page load.

= What data leaves my server? =

Product catalog only (names, descriptions, prices, images, categories, attributes) plus chat messages during an active conversation. No customer PII (name, email, address) is ever sent to Kwiro.

= Is it GDPR compliant? =

Yes. The widget sets one strictly-necessary functional cookie called `kwiro_conv` (24-hour TTL) that links a chat conversation to a checkout — without it the ROI/attribution dashboard can't tell which conversations drove which sales. Strictly-necessary cookies are exempt from the consent-banner requirement under GDPR Article 5(3) of the ePrivacy Directive. No third-party advertising or tracking cookies are set. Conversation context also lives in sessionStorage (cleared when the tab closes) so the same data flows through the Block Checkout path. Store owners can export or delete all data via the Kwiro dashboard.

= Can I track revenue from AI conversations? =

Yes. The ROI Dashboard tracks direct attribution (customer bought within 30 min of chatting) and assisted attribution (bought within 24h). Revenue, conversion rate, top products, top questions — all visible on the overview.

= What happens to my data if I disconnect or uninstall the plugin? =

* **Disconnect** (the *Disconnect this store* button on the plugin settings page) — purges your locally stored API key, store ID, and consent flag. The chat widget stops appearing. Your Kwiro account, chat logs, and ROI history remain in the Kwiro dashboard so you can reconnect later without losing data.
* **Uninstall** (Plugins → Delete in WP admin) — runs `uninstall.php`, which wipes every plugin option, transient, and scheduled cron event from your WordPress database. Same as Disconnect: server-side data in your Kwiro account is untouched.
* **Permanently delete everything** (including server-side data) — open the Kwiro dashboard, go to Account → Delete account, or email <support@kwiro.ai>. We honour deletion requests within 7 days per our [Privacy Policy](https://kwiro.ai/privacy).

== Screenshots ==

1. The first thing your shopper sees — a small greeting bubble in the corner with two starter chips: one catalog-aware ("What's trending?"), one handoff ("Help me find something"). Friendly, never intrusive.
2. The full sales-assistant view when a shopper opens the widget — a personalised greeting from your store's named assistant, four catalog-aware suggestion cards drawn from your real products, and the language hint *"Talk in your language — I speak 57"*. This is what turns a passive browser into a buying conversation.
3. The assistant in conversation — answering a real product comparison question with your actual prices, ratings, and stock levels pulled live from WooCommerce. No generic answers, no made-up products.
4. The same conversation, scrolled down to the product cards — your real SKUs with rating, in-stock status, price, and an Add to Bag button right inside the chat. Shoppers can buy without ever leaving the conversation.
5. Dark mode + cart hand-off — the widget automatically adapts to your shopper's preferred colour scheme, and when their bag is ready it surfaces a one-tap *Checkout* nudge so the conversation flows straight into the purchase.
6. The same plugin on a different store — here it's "Luna" at a skincare shop with a soft pink accent and skincare-specific starter chips and quiz options. Bot name, welcome message, brand colour, starter cards and the assistant's tone are all dashboard-controlled, so every store feels native to its own brand.
7. Context-aware on a product page — when a shopper lands on a specific product, the assistant peeks open with a question about THAT product ("Checking out Encapsulated Retinol 0.5%? I can answer any questions about it 👋"). Stops checkout hesitation before it turns into a closed tab.
8. Your Kwiro dashboard — see the revenue the assistant actually earned for your store this month, the after-hours sales it closed while you slept, conversion rate, average order value, and your return on investment. Every conversation is logged and reviewable.
9. The WordPress plugin settings page with an explicit-consent disclosure. Nothing leaves your store until you click *Connect to Kwiro* — required by wordpress.org rules, and good for your peace of mind.
10. After connecting — the full settings surface in WP admin. One-click open the Kwiro dashboard, paste an API key manually if you prefer, run a catalog sync on demand, and toggle the widget on or off for your storefront.

== External services ==

This plugin connects to Kwiro, a third-party SaaS service (https://kwiro.ai), to deliver the AI sales agent functionality. Connection happens only after you click **Connect to Kwiro** on the plugin settings page — nothing is sent on activation.

Once connected, the plugin communicates with the following endpoints on Kwiro's servers:

* **`https://api.kwiro.ai/api/auth/register`** — sent on first connect: your store domain, store name, and currency code. Used to create your Kwiro account and issue an API key.
* **`https://api.kwiro.ai/api/auth/verify`** — sent before each authenticated request: your API key. Used to issue a short-lived JWT.
* **`https://api.kwiro.ai/api/auth/link-status`** — sent every few minutes while the settings page is open: your API key. Used to flip the "Connect to Kwiro" panel to "Connected" once linking is complete in the dashboard.
* **`https://api.kwiro.ai/api/auth/begin-link`** — sent when you click *Connect to Kwiro*: a short-lived signed token used to sign you into the Kwiro dashboard and link this store to your account.
* **`https://api.kwiro.ai/api/health`** — sent when you click *Test Connection*: confirms the API is reachable.
* **`https://api.kwiro.ai/api/sync/batch`** — sent when you click *Sync Now* and on every WP-CRON sync batch: product names, descriptions, prices, sale prices, stock status, categories, tags, attributes, and image URLs. Used to teach the AI what your store sells. **No customer PII is ever included.**
* **`https://api.kwiro.ai/api/sync/product/{id}`** — sent when you delete or trash a product in WooCommerce: just the product ID. Used to remove that product from your Kwiro catalog so the AI stops recommending it.
* **`https://api.kwiro.ai/api/sync/finalize`** — sent at the end of a full sync: the store's free-shipping threshold (if any). Used to trigger the final embedding pass and let the widget's MiniCart render the "X away from free shipping" nudge.
* **`https://api.kwiro.ai/api/sync/status`** — sent on demand: empty body. Used by the admin to read sync status from the cloud's authoritative copy.
* **`https://api.kwiro.ai/api/sync/event`** — sent on plugin activation, sync starts, batch completion, manual sync clicks, and sync errors: a structured event payload. Used by the Sync History page in the Kwiro dashboard.
* **`https://api.kwiro.ai/api/sync/sales-event`** — sent when an order moves to a paid status (`processing`, `on-hold`, `payment_complete`, or `completed`) and has an associated chat attribution: order ID, total, currency, the products in the order, the conversation ID, and the attribution type (direct or assisted). Used for the ROI / attribution dashboard. **No customer name, email, address, or payment data is sent.**
* **`https://widget.kwiro.ai/`** — loaded as an iframe in your store's frontend (only when the widget is enabled and the visitor arrives on a non-checkout page). Carries the chat conversation between the visitor and the AI; chat messages are processed on Kwiro's servers and not stored locally on your WordPress install.
* **`https://app.kwiro.ai/`** — opened in a new browser tab when a connected store owner clicks the **Open Kwiro dashboard →** button on the plugin settings page, or on the *Open Kwiro* link added to the WordPress Plugins list row. The plugin passes a short-lived signed link token in the URL (see `/api/auth/begin-link` above) so the dashboard can finish linking this store to your Kwiro account. No customer PII is sent.

**Upstream AI inference sub-processor.** Chat messages received at `api.kwiro.ai` are forwarded to **OpenRouter, Inc.** (https://openrouter.ai), a privacy-preserving AI inference gateway, which routes them to a large language model for response generation and returns the model's reply. OpenRouter is operated as a third-party data sub-processor to Kwiro. Our OpenRouter account is configured for **Zero Data Retention (ZDR)**: neither OpenRouter nor the upstream model providers log, store, or retain the prompts or responses that pass through. The plugin itself never contacts OpenRouter directly — only the Kwiro cloud does — but we disclose it here for full transparency under WordPress Plugin Directory Guideline 7. OpenRouter's terms and privacy policy: https://openrouter.ai/terms and https://openrouter.ai/privacy.

Kwiro's terms of service and privacy policy describe how Kwiro handles the data above:

* Terms of Service: https://kwiro.ai/terms
* Privacy Policy: https://kwiro.ai/privacy
* Refund Policy: https://kwiro.ai/refund-policy

You can disconnect at any time using the *Disconnect this store* button on the plugin settings page. Disconnecting purges the locally stored API key and revokes the link with your Kwiro account.

== Changelog ==

= 1.2.16 =
* **Faster updates, cleaner support handoff.** When you upgrade Kwiro, your admin pages and your shoppers' widgets now pick up the new version's changes immediately instead of waiting on browser cache. We also keep the version number the plugin reports to our cloud in sync with what you actually have installed — so if you ever email support, your message is correctly tagged with your real plugin version. No setting changes; nothing to reconfigure. Drop-in upgrade.

= 1.2.15 =
* **Privacy update — Zero Data Retention for AI replies.** Your customers' chat questions and the AI's replies travel through a privacy-preserving AI gateway under a Zero Data Retention agreement. The gateway, and the AI model behind it, never log, store, or retain a single message. This has always been true behind the scenes — this release just makes it plain in the readme's "Your Data, Your Choice" and "External services" sections, and on the Connect screen, so you can show your shoppers (and your DPO) exactly how their data is handled. Recommended reading if your store has strict GDPR / privacy obligations. No code changes; drop-in upgrade.

= 1.2.14 =
* **Compat — tested with WordPress 7.0.** WP 7.0 became the current stable shortly after 1.2.13 shipped, which made the directory show an "Untested with your version of WordPress" warning on the listing for every WP 7.0 shopper — a measurable drag on install conversion. Smoke-tested 1.2.13 against WP 7.0 (clean install, WP_DEBUG=true): activation clean, no deprecation notices in debug.log, Connect-to-Kwiro one-click link OK, settings page renders, widget injects on the storefront, full sync completes. No code changes — only the `Tested up to` field and Stable tag advance. Drop-in upgrade.

= 1.2.13 =
* **WordPress.org review-team feedback applied.** Every piece of JavaScript the plugin uses — on your admin pages and on your shoppers' storefront — is now loaded the standard WordPress way. The side benefit you'll notice: slightly faster admin-page load, better browser caching, and full compatibility with caching plugins like WP Rocket and W3 Total Cache. We also tightened the code to the latest WordPress coding standards. No setting changes; nothing to reconfigure. Drop-in upgrade.

= 1.2.12 =
* **Copy fix** — Short Description now reads "~0% hallucination" instead of "0% hallucination". No AI hits absolute zero across non-trivial test sets; the tilde makes the claim honest and defensible. Body of the readme (which already used "~0%") is unchanged. No behavior or functional changes. *Note: this version was built but never uploaded to wp.org; the copy change is included in 1.2.13.*

= 1.2.11 =
* **WordPress.org submission cleanup — strip diagnostic logging.** Removed the temporary `kwiro-debug.log` file write under `wp-content/uploads/`, the `rest_api_init` request-tracker hook, and every `[kwiro] …` diagnostic line that was added in 1.2.10 to chase the Block Checkout attribution bug. The bug is fixed (1.2.7 + 1.2.8 + 1.2.9), so the diagnostic surface is no longer needed in production. Kept one `error_log()` call gated behind `WP_DEBUG` — only fires on actual cloud-POST failures, so support can still see the underlying error message when something goes wrong without writing to a publicly-readable log file. Drop-in upgrade, no behaviour change for working installs.

= 1.2.10 =
* **Diagnostic logging for Block Checkout attribution debugging.** Added a temporary `wp-content/uploads/kwiro-debug.log` file + `rest_api_init` checkout-request tracker so we could pin down where Store API attribution was getting lost on real merchant traffic. Helped catch the `_update_order_from_request` hook firing without extensions populated — fix shipped in 1.2.9. Diagnostic surface is removed in 1.2.11; if you're upgrading from < 1.2.10 you can skip this version.

= 1.2.9 =
* **Belt-and-suspenders: cookie-only attribution save on `_order_processed`.** 1.2.8 registered the Store API extension schema and added a cookie fallback inside `_update_order_from_request`, but headless-Chrome end-to-end testing showed the meta still wasn't sticking on some WC builds — likely because the order is reconstructed between hook fires on certain stacks. Added a redundant `woocommerce_store_api_checkout_order_processed` handler that runs cookie-only (doesn't need `$request`) and only acts if the upstream handler didn't already write the meta. Also added `error_log()` diagnostic lines on every code path so when this is reported next we have a paper trail in `wp-content/debug.log` (or PHP error log) instead of guessing. Drop-in upgrade.

= 1.2.8 =
* **Register `kwiro_attribution` as a Store API extension + add cookie fallback.** End-to-end repro showed the storefront fetch interceptor was correctly attaching `extensions.kwiro_attribution.conversation_id` to the `/wc/store/v1/checkout` POST body — the JSON sent by the browser had it — but the `_kwiro_conversation_id` order meta was still empty after place-order. Root cause: WC's `CheckoutSchema` strips unregistered extension namespaces from `$request['extensions']` *before* `woocommerce_store_api_checkout_update_order_from_request` fires, so 1.2.7's hook saw an empty extensions array and returned early. We now register the namespace via `ExtendSchema::register_endpoint_data` on `woocommerce_blocks_loaded`. As a belt-and-suspenders safety net (some WC + caching combinations still drop the data even with the schema registered) the hook now also reads the `kwiro_conv` cookie out of `$_COOKIE` server-side when the extensions array comes up empty — same UUID validation as the JS write side. Drop-in upgrade.

= 1.2.7 =
* **Block Checkout attribution actually reaches the order now.** Two compounding bugs were swallowing AI-attribution on stores running the WC Block Checkout (the default since WC 8.3): (1) the plugin hooked `woocommerce_store_api_checkout_order_processed`, which only passes `$order` — so we had to re-parse `php://input` to read the request extensions, and that buffer was already consumed on a number of PHP/WC stacks; and (2) the JS captured `Date.now()` (milliseconds) but PHP compared with `time()` (seconds), so the attribution window check was working by accident on direct orders and never firing for assisted orders. Switched to `woocommerce_store_api_checkout_update_order_from_request` (the hook that passes both `$order` and the `WP_REST_Request` — clean access to `extensions.kwiro_attribution`), normalized the JS write to seconds-since-epoch, and added a defensive ms→seconds rescale in PHP for any orders that have legacy values stored. Drop-in upgrade.

= 1.2.6 =
* **Declare HPOS + Block Checkout compatibility** — clears the WooCommerce admin notice "Kwiro is incompatible with currently enabled WooCommerce features." The plugin only touches orders through the WC CRUD API (`wc_get_order`, meta accessors, status hooks) and the Block Checkout's Store API hook is already wired for attribution, so this is purely a declaration — no behavior change. Drop-in upgrade.

= 1.2.5 =
* **Cash-on-Delivery / Bank Transfer orders now report to Kwiro** — sales attribution previously only fired on `woocommerce_payment_complete` (Stripe / PayPal) or on a manual transition to `completed`, so COD and BACS orders never reached the dashboard's Sales page until an admin marked them complete by hand. The tracker now also hooks `processing` and `on-hold` status transitions, with the existing `_kwiro_tracked` order-meta dedup ensuring online-paid orders don't double-fire. Drop-in upgrade.

= 1.2.4 =
* **Sync correctly fires `sync/finalize` on completion** — restores the cloud-side hook that builds `store_intelligence` (which feeds the widget's "I know all N products" contextual greeting) and runs the final embedding pass. The 1.2.3 inline-loop refactor inadvertently dropped the call to the finalize handler, so freshly-synced stores rendered "I know all 0 products here" on the storefront until the cloud's hourly enrichment cron caught up. Drop-in upgrade — no DB or credential changes.

= 1.2.3 =
* **Sync no longer depends on WP-CRON.** Manual *Sync Now* now loops batches inline up to a 25-second AJAX budget, so a typical 100–250 product catalog finishes in a single click without relying on the host's cron loop. Catalogs larger than the budget still hand off to `kwiro_batch_sync` for the rest, but if cron never fires the merchant can simply hit *Sync Now* again — the plugin resumes from the saved offset instead of restarting from zero. Fixes the "Syncing… 50/107" stall reported on dev VPS hosts and any prod host with WP-CRON disabled or rate-limited.

= 1.2.2 =
* **Recoverable "domain already linked" error** — when a domain that was previously connected to Kwiro is re-installing the plugin, the WP admin now shows a clear path forward instead of a dead-end. Fresh installs on a domain that was registered but never claimed by a Kwiro user now succeed automatically (no manual intervention). Domains that *are* claimed by a Kwiro account show a recoverable warning with the redacted email hint, "Open Kwiro dashboard" / "Try again" / "Contact support" actions, and clear copy guiding the merchant to retrieve their existing API key from Settings → API.
* **External Services disclosure** — added `app.kwiro.ai` (the dashboard iframe loaded inside WP admin's *AI Sales Dashboard* submenu) so every external host the plugin connects to is listed in the readme's External services section, per Plugin Directory Guideline 7.
* **Widget ↔ plugin postMessage compatibility** — bundled widget now dispatches both the v1.2 `kwiro_*` and legacy v1.1 `aisales_*` prefixes for resize / add-to-cart / navigate / viewport events. Resolves a real-customer interop bug where opening the widget left the iframe wrapper at the closed-launcher size (chips invisible under the input bar) and add-to-cart silently no-op'd on v1.2 plugin installs.

= 1.2.1 =
* **Plugin slug rename** — `ai-sales-assistant` → `kwiro-ai-sales-agent` to match the product name on WordPress.org. Existing v1.1.x installs are migrated automatically on first activation: API key, store ID, public key, sync status, settings, and consent flag carry over without reconfiguration. CRON hooks (`aisales_batch_sync` → `kwiro_batch_sync`, weekly sync) are rescheduled in place.
* **Internal prefix alignment** — `aisales_*` → `kwiro_*` across all options, transients, hooks, classes, AJAX action names, JS handles, and HTML element IDs. No user-visible change for fresh installs; v1.1.x upgrades are handled by the migration above.
* **Display name** — "Kwiro — AI Sales Agent & Chatbot for WooCommerce" (clarifies the product category in the WP admin Plugins list and the wp.org listing).

= 1.1.4 =
* **WordPress.org submission readiness** — explicit user-consent gate before the first connection to api.kwiro.ai (was: silent registration on settings-page open). Plugin now ships with no application/test files, an up-to-date "Tested up to" header, the new `Requires Plugins: woocommerce` declaration (WP 6.5+), and the External Services disclosure required by Plugin Directory Guideline 7.
* **Privacy/Terms links** surfaced on the plugin settings screen.
* **Disconnect button** added — purges the locally stored API key with a single click.

= 1.1.x and earlier =
Pre-publication development versions. Highlights: One-click Connect flow (1.1.0), foreground first-sync (1.1.0), sync history logging (1.1.2), sync pagination + indexing fixes (1.1.1–1.1.3). Full notes available in the GitHub repository.

== Upgrade Notice ==

= 1.2.16 =
Faster cache refresh when you upgrade, and the version we report to support now matches what you have installed. No settings to change.

= 1.2.15 =
Privacy disclosure update — explains how chats are routed under a Zero Data Retention agreement, so customer messages are never logged or stored.

= 1.2.13 =
Admin and widget JavaScript now loads the standard WordPress way — faster page loads, better caching, full compat with WP Rocket / W3 Total Cache.

= 1.2.12 =
Copy fix in the Short Description — "0% hallucination" → "~0% hallucination" to match the body of the readme and stay honest about model behavior. No code changes. *This version was built but never uploaded to wp.org; the copy change ships in 1.2.13.*

= 1.2.11 =
WordPress.org submission cleanup — removes the temporary debug log written under `wp-content/uploads/` and tightens diagnostic output. No functional change for working installs. Safe drop-in.

= 1.2.10 =
Adds temporary diagnostic logging that helped pin the last Block Checkout attribution bug. Removed cleanly in 1.2.11; recommend skipping straight to 1.2.11 from 1.2.9.

= 1.2.9 =
Adds a redundant cookie-only attribution-save hook for the Block Checkout edge cases that 1.2.8 still couldn't catch + diagnostic logging so future regressions are debuggable. Required for accurate Sales reporting on Block Checkout. Safe drop-in.

= 1.2.8 =
Required if you're on Block Checkout — registers `kwiro_attribution` as a Store API extension namespace so WC stops stripping it from the request, plus a cookie fallback. Order-attribution will be empty on Block Checkout until you upgrade.

= 1.2.7 =
Fixes Block Checkout AI-attribution being silently dropped (wrong Store API hook + ms-vs-seconds timestamp mismatch). Required for accurate Sales reporting on any store running the default WC Block Checkout. Safe drop-in upgrade.

= 1.2.6 =
Declares compatibility with WooCommerce HPOS (custom_order_tables) and Block Checkout (cart_checkout_blocks) so the WC admin "incompatible plugins" notice stops firing. No behavior change. Safe drop-in upgrade.

= 1.2.5 =
Fixes Cash-on-Delivery / Bank Transfer orders not appearing on the Sales dashboard — the tracker now fires on `processing` / `on-hold` status transitions in addition to `payment_complete` and `completed`. Safe drop-in upgrade.

= 1.2.4 =
Restores the post-sync finalize call so the widget's "I know all N products" greeting renders correctly after a fresh sync. Drop-in upgrade.

= 1.2.3 =
Sync no longer depends on WP-CRON — *Sync Now* finishes typical catalogs in a single click and resumes from the last saved offset on retry, fixing the "Syncing… 50/107" stall on dev VPS / cron-disabled hosts. Safe drop-in upgrade.

= 1.2.2 =
Fixes the "domain already registered" dead-end on plugin re-installs. Adds app.kwiro.ai disclosure to External services, and a widget that handles both v1.1 and v1.2 postMessage prefixes so resize + add-to-cart fire correctly. Safe drop-in upgrade.

= 1.2.1 =
Plugin slug rename + display-name clarification ("Kwiro — AI Sales Agent & Chatbot for WooCommerce"). Existing installs are migrated automatically — your API key, sync state, and consent stay in place, no reconfiguration needed.

= 1.1.4 =
WordPress.org submission readiness — adds explicit consent before first connection, "Disconnect this store" button, External Services disclosure, and current WP 6.9 compatibility. No data behavior changes for already-connected stores.
