=== Chattie for WooCommerce ===
Contributors: ondrejkonarik23
Tags: chatbot, ai, woocommerce, customer support, live chat
Requires at least: 6.5
Requires Plugins: woocommerce
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
WC requires at least: 8.0
WC tested up to: 9.6

Connect the Chattie AI chatbot to your WooCommerce store.

== Description ==

Chattie for WooCommerce connects your AI chatbot to your online store. The plugin provides:

* Embedding the Chattie chat widget on your store pages
* Automatic identification of logged-in customers
* Support for adding products to the cart directly from the chat (WooCommerce Store API nonce)

The connection to the Chattie backend (product synchronization, search, order status) is configured in the Chattie admin panel using WooCommerce REST API keys.

== Installation ==

1. Upload the `chattie-for-woocommerce` folder to `/wp-content/plugins/`.
2. Activate the plugin in the Plugins section.
3. Go to the **Chattie** menu and enter your Public Key.
4. Generate WooCommerce REST API keys and enter them in the Chattie admin panel.

== Verified identity of logged-in customers ==

For the AI assistant to know which customer it is talking to (name, order history, etc.), you need to
enable identity verification between the plugin and the Chattie backend:

1. In the Chattie admin panel, go to your project settings → **Email channel** (Email collection) and set
   identity verification (`identityVerification`) to **"Required"**.
2. Copy the generated **Signing Secret**.
3. In your WordPress admin, open the **Chattie** menu and paste the key into the **Signing Secret** field
   (for an already connected store the field is directly in the settings card, for a store that is not
   connected yet it is in the "Advanced settings" section).
4. Save the settings.

After saving, the plugin automatically computes an HMAC-SHA256 signature of the logged-in customer's
email and passes it together with their name to the widget (`ChattieWidget.identify()`). The Chattie
backend verifies the signature and only then makes the customer's identity available to the AI. Without
a configured Signing Secret, the AI will not know who it is talking to, even if the customer is logged in.

== External Services ==

This plugin connects to the Chattie service (https://chattie.cz), a third-party AI customer support
platform. A Chattie account is required for the plugin to be functional.

The plugin:

* Loads the Chattie chat widget script from Chattie servers (`app.chattie.cz` or the environment configured in the plugin settings) on the frontend of your store.
* Sends chat messages written by your visitors to the Chattie API so the AI assistant can respond.
* For logged-in customers, passes their email address, name, and an HMAC signature of the email to the Chattie service in order to identify the customer (only when a Signing Secret is configured).
* During the connection process, sends your store URL and store name to the Chattie admin panel.

This data is transmitted whenever the widget is displayed and used on your store. No data is sent to
Chattie before a Public Key is configured.

Chattie terms of service: https://chattie.cz/obchodni-podminky
Chattie privacy policy: https://chattie.cz/soukromi

== Frequently Asked Questions ==

= Where do I find the Public Key? =
In the Chattie admin panel, go to your project settings → Widget. The Public Key is shown in the embed code section.

= Where do I find the Signing Secret? =
In the Chattie admin panel, go to your project settings → Email channel (Email collection) and set identity
verification to "Required". The secret is displayed in that section.

= What permissions does the WooCommerce API key need? =
For full functionality (products, orders, coupons) we recommend Read/Write permissions.

= Can I use a staging environment? =
Yes, in the plugin settings choose the "Stage" environment or "Custom" for any URL.

== Changelog ==

= 1.0.0 =
* Initial release
* Chattie widget embedding
* Customer identification
* WooCommerce Store API nonce
* Environment support: production, stage, custom
