=== SellChat ===
Contributors: sellchat
Tags: woocommerce, ai, chatbot, product finder, recommendations
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.2.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

An AI chat that guides your WooCommerce shoppers to the right product through a short question-and-answer conversation.

== Description ==

SellChat adds a friendly chat widget to your WooCommerce store. Visitors describe what they need in their own words; the AI asks a few clarifying questions and recommends the products from your catalog that fit best — with a direct link to each product.

The AI runs on a hosted backend service (your Anthropic key stays server-side, never in the browser). A **free plan** includes a monthly conversation limit; paid plans raise it.

**Features**

* Floating chat widget, configurable title, colour and position.
* AI matches against *your* WooCommerce catalog (retrieval-based, scales to large catalogs).
* Product recommendation cards with image, price and reason.
* Automatic catalog sync (on product save + daily).
* Human hand-off contact form fallback.
* Freemium: monthly conversation limit on the free plan, higher on paid plans.

== Installation ==

1. Install and activate the plugin (WooCommerce required).
2. Go to **SellChat** in the admin menu.
3. Paste your backend URL and API key from your dashboard.
4. Enable the widget and click **Sync now** to push your catalog.

== Frequently Asked Questions ==

= Do I need an account? =
Yes — the AI runs on a hosted backend. Create an account to get an API key. A free tier is available.

= Which products can it recommend? =
Any published WooCommerce product. The plugin syncs titles, descriptions, categories, attributes, price and stock to the backend for matching.

= Is my Anthropic key exposed? =
No. The plugin only talks to the backend; the AI provider key lives server-side.

== External services ==

This plugin connects to the **SellChat** backend service to power the chat
and product matching. The AI provider key is held server-side; the plugin never
contacts the AI provider directly.

What is sent, and when:

* **When you sync your catalog** (manually, on product save, and once daily): your
  published WooCommerce product data — title, description, categories, tags,
  attributes, price, stock status, product URL and image URL — is sent to the
  backend so it can be indexed for matching.
* **When a visitor sends a chat message**: the visitor's messages, an anonymous
  session id, and the current page URL / product id are sent to the backend. The
  visitor's IP address is used server-side only for rate-limiting. The backend
  forwards the conversation to **Anthropic (Claude)** to generate a reply and
  product suggestions.
* **On the settings screen**: your site URL and plan/usage are read from the backend.
* **When a visitor who used the chat places an order**: the order id, the attributed
  amount, currency and any recommended product ids are sent to the backend so the
  admin screen and dashboard can show revenue driven by the advisor. To attribute
  orders the widget stores two first-party cookies (30 days): `aipa_reco` (recommended
  product ids) and `aipa_chat` (chat-engagement marker). Attribution can be disabled
  with the `aipa_attribution_enabled` filter, and the model switched between whole-order
  ("assisted", default) and recommended-items-only ("direct") with `aipa_attribution_mode`.

No data is sent until you enter an API key and enable the widget.

* Terms of Service: https://sellchat.nl/terms
* Privacy Policy: https://sellchat.nl/privacy
* AI sub-processor (Anthropic) terms: https://www.anthropic.com/legal/consumer-terms
* Payments sub-processor (Mollie): https://www.mollie.com/privacy

== Changelog ==

= 0.2.3 =
* The settings-page "Sync now" script is now enqueued (assets/js/admin.js) instead of printed inline.
* Translation loading moved to the `init` hook.

= 0.2.2 =
* New: the advisor now knows sale prices, stock levels and product specs (weight, dimensions, attributes and custom meta via the `aipa_product_meta` filter), so it can answer "what's on offer?" and spec questions accurately.
* Sale-priced products are surfaced for discount/offer queries, and recommendation cards show the sale price.

= 0.2.1 =
* Code quality: added translators comments, hardened input sanitization (unslash), and removed discouraged functions to pass WordPress Plugin Check.

= 0.2.0 =
* Renamed to SellChat.
* English source strings with a bundled Dutch (nl_NL) translation.
* Self-serve dashboard, plans and (Mollie) billing groundwork.

= 0.1.3 =
* New: revenue attribution — orders containing advisor-recommended products are attributed and shown in the dashboard.
* Attribution reporting runs asynchronously (via WP-Cron) so it never blocks checkout.
* The attribution cookie respects the `aipa_attribution_enabled` filter for cookie-consent gating.

= 0.1.2 =
* Chat widget now initialises on DOM-ready so the button reliably opens, even when footer script order or a caching plugin moves/combines the script.
* Catalog sync uses 3-product batches to stay well within the embedding function's resource limits.

= 0.1.1 =
* Widget config now passed via a data-attribute (robust against JS-combining cache plugins) so the chat reliably opens.
* Smaller catalog sync batches to stay within the embedding function's resource limits.

= 0.1.0 =
* Initial scaffold: widget, settings, catalog sync, chat proxy.
