=== Chatessa – Live Chat & AI Chatbot ===
Contributors: platkadigital
Tags: live chat, chatbot, ai, support, woocommerce
Requires at least: 5.6
Tested up to: 7.0
Requires PHP: 7.2
Stable tag: 1.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add the Chatessa live chat + AI chatbot to your site in one click, with secure user identity and WooCommerce customer context.

== Description ==

Chatessa is a live chat that answers with AI when your team is offline and learns from every conversation. This plugin embeds the Chatessa widget on your WordPress site and - for a true enterprise integration - can:

* **One-click Connect** – paste your Chatessa API URL + API key and the plugin auto-provisions a widget key locked to your domain. No manual snippet editing.
* **Secure identity (tamper-proof)** – logged-in WordPress users are identified to your agents using a server-signed HMAC (Intercom-style `user_hash`), computed on your server so it cannot be forged in the browser.
* **WooCommerce context** – on login, the plugin sends the customer's order count and lifetime value to Chatessa so your agents see who they're talking to.
* **Consent gating (GDPR)** – optionally load the widget only after your cookie-consent banner is accepted.
* **Inbound webhooks** – receive Chatessa events (new leads, escalations) in WordPress and react via the `chatessa_webhook` action hook (HMAC-verified).
* **Performance-first** – the widget script loads asynchronously and never blocks rendering.

The widget key is public by design (it lives in client HTML). The API key and identity secret are server-to-server only and are never printed into the page.

== External services ==

This plugin is a client for **Chatessa**, a third-party hosted live-chat and AI
chatbot service. The plugin does not work on its own: a Chatessa account is
required, and the chat itself runs on Chatessa's servers. By installing this
plugin you are sending the data listed below to that service.

Service provider: Chatessa (https://chatessa.com)
Terms of Service: https://chatessa.com/terms-of-service
Privacy Policy:   https://chatessa.com/privacy-policy

By default the plugin talks to the Chatessa cloud at `https://chatessa.com` and
`https://api.chatessa.com`. If you self-host Chatessa you can point the plugin at
your own installation under **Settings → Chatessa → Advanced**, in which case the
data below goes to your own server instead.

The plugin contacts the service in these situations, and only these:

1. **Loading the chat widget (every page view, front end)**
   The widget script `widget.js` is loaded from the Chatessa app host so the chat
   can render. As with any hosted chat widget, the visitor's browser therefore
   contacts Chatessa directly, which makes the visitor's IP address, user agent
   and the page URL visible to the service. Chat messages the visitor types are
   sent to Chatessa to be answered and to be shown to your agents.
   *Not loaded at all when the plugin is disabled, when no widget key is set, or -
   if you enable consent gating - until your cookie-consent cookie is present.*

2. **Connecting your site (once, when an administrator clicks "Connect")**
   Sends your site's host name and site title so Chatessa can provision a widget
   key restricted to your domain and return it to this plugin.

3. **Completing the "Connect with Chatessa" authorization (once, on approval)**
   Exchanges the single-use authorization code returned by Chatessa for your
   workspace's widget key, API key and identity secret.

4. **Identifying a logged-in user to your agents (optional, on each login)**
   Only when "Secure identity" is enabled. The user's WordPress user ID, email
   address and display name are signed on your server and passed to the widget so
   your agents can see a verified identity instead of an anonymous visitor.

5. **Sending WooCommerce customer context (optional, on each login)**
   Only when "WooCommerce context" is enabled and WooCommerce is active. Sends the
   customer's email address, display name, order count, lifetime value and last
   order (number, date, total, status) so agents can see purchase history while
   chatting.

Items 4 and 5 are switched off by unchecking them on the plugin's settings screen;
items 1-3 are inherent to using the service.

== Installation ==

1. Upload the `chattora-live-chat-ai-chatbot` folder to `/wp-content/plugins/`, or install via the Plugins screen.
2. Activate the plugin.
3. Go to **Settings → Chatessa**.
4. Enter your **API URL** (e.g. `https://api.chatessa.com`) and an **API key** (create one in Chatessa under Settings → Developer), then click **Connect**.
5. Done - the chat widget is now live on your site.

You can also skip Connect and paste a **Widget key** manually.

== Frequently Asked Questions ==

= Do I need a Chatessa account? =
Yes. Create a workspace at chatessa.com, then generate an API key to connect.

= Is the identity verification secure? =
Yes. The `user_hash` is an HMAC-SHA256 of the user's id AND email together, signed on your server with a secret shared only server-to-server. A visitor cannot impersonate another user - or swap in a different email address - from the browser.

= Does it work with WooCommerce? =
Yes. When enabled, order count and lifetime value are sent to Chatessa on login.

= Will it slow down my site? =
No. The widget script is loaded asynchronously and is fully isolated (Shadow DOM).

== Changelog ==

= 1.0.2 =
* Documented every third-party (Chatessa) service call in the readme, including exactly what data is sent, when, and how to switch the optional ones off, with links to the service's Terms of Service and Privacy Policy.
* Corrected the plugin's `Contributors` list.

= 1.0.1 =
* Removed the self-hosted update checker (`pre_set_site_transient_update_plugins` / `plugins_api`) and the "License key" setting - WordPress.org hosts updates for this plugin directly, and hosted plugins may not ship their own updater.
* Fixed the plugin's text domain to match its WordPress.org slug.

= 1.0.0 =
* Initial release: one-click Connect, secure identity (HMAC), WooCommerce context, consent gating, async loading, multisite-safe uninstall.
