=== Coffield.io – AI Chat Agent ===
Contributors: jcoffield1
Tags: chat, chatbot, ai, lead generation, customer support
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI chat agent for WordPress. Answers visitor questions, captures leads, and books appointments. Paste your claim code – no theme editing.

== Description ==

**Coffield.io – AI Chat Agent** adds an AI-powered chat bubble to your WordPress site that answers visitor questions, captures leads, and books appointments – without writing a single line of code.

= Set up in 60 seconds =

1. Sign up at [coffield.io](https://coffield.io) and create your agent.
2. Generate a claim code in your Coffield.io dashboard.
3. In WordPress, go to **Settings → Coffield.io** and paste the code.
4. Click **Save & Connect**. The chat bubble appears site-wide.

That's it. No JavaScript snippets, no `<script>` tags to paste into your theme.

= What it does =

* **AI chat bubble** on every public page, configurable from your Coffield.io dashboard
* **Lead capture** with custom fields (name, email, phone, anything you want)
* **Appointment booking** – the agent can offer time slots and confirm bookings
* **WooCommerce-aware** – when WooCommerce is active, the plugin reports this capability in its heartbeat for future connector features
* **Self-monitoring** – heartbeat health checks let you see in your dashboard if your site is connected
* **GDPR compliant** – lead data stored on your Coffield.io tenant; you control retention

= Why Coffield.io =

* **Tenant isolation by default.** Your conversations, leads, and knowledge base never mix with other companies' data.
* **You own the conversation log.** Every visitor message is stored on your tenant and exportable.
* **Real platform integrations.** Hand off bookings to your calendar, leads to your CRM, support tickets to your Kanban board.
* **Plain pricing.** Starter, Growth, and Pro plans with a 14-day free trial. No setup fees.

= External services =

This plugin connects your WordPress site to **coffield.io** (the SaaS that powers the chat). Specifically:

* When you paste a claim code, the plugin contacts `https://coffield.io/api/agent/claim` to redeem the code. It sends your claim code and site domain.
* The plugin then calls `https://coffield.io/api/agent/package/exchange` to provision an install UUID and secret. It sends platform metadata (plugin version, WordPress version, PHP version).
* Every 5 minutes the plugin sends a signed heartbeat to `https://coffield.io/api/agent/package/heartbeat` reporting plugin/runtime status (plugin version, PHP version, WordPress version, manifest hash, WooCommerce capability flag).
* The chat script (`agent.js`) is loaded by your visitors' browsers directly from `https://coffield.io`. Visitor messages do not pass through this plugin.

[Coffield.io Terms of Service](https://coffield.io/terms-of-service) | [Privacy Policy](https://coffield.io/privacy-policy)

== Installation ==

1. In WordPress admin go to **Plugins → Add New** and search for "Coffield.io".
2. Click **Install Now**, then **Activate**.
3. Go to **Settings → Coffield.io**.
4. Paste the claim code from your Coffield.io dashboard and click **Save & Connect**.

Or install manually:

1. Upload the `coffield-io` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** menu.
3. Visit **Settings → Coffield.io** to connect.

== Frequently Asked Questions ==

= Do I need a Coffield.io account? =

Yes. Sign up at [coffield.io](https://coffield.io). The free 14-day trial is plenty to see the plugin in action.

= Where does my visitor data go? =

Visitor messages and lead submissions go directly from the visitor's browser to coffield.io – they never pass through your WordPress server. This plugin only handles the WordPress↔Coffield.io connection (registering the install, periodic health pings).

= Does it work with caching plugins like WP Rocket or W3 Total Cache? =

Yes. The chat script is loaded asynchronously and is safe to combine/minify. The plugin uses standard `wp_enqueue_script()` so it composes correctly with optimization plugins.

= Does it work with WooCommerce? =

Yes. When WooCommerce is active the plugin reports that capability to your Coffield.io tenant. Direct WooCommerce order lookup tooling is planned in a future release.

= How do I disconnect? =

**Settings → Coffield.io → Disconnect**. The chat bubble stops appearing immediately.

= How do I uninstall completely? =

Deactivate, then delete via the **Plugins** screen. All plugin options are removed automatically; no orphaned data is left in `wp_options`.

= Is the plugin GDPR compliant? =

The plugin itself does not store visitor data on your server. Visitor data lives on your Coffield.io tenant under your control – exportable, deletable, region-pinnable.

= Can I translate the plugin? =

Yes. The plugin uses the `coffield-io` text domain. WordPress.org translation packs are loaded automatically once available.

== Screenshots ==

1. The Coffield.io AI chat agent answering a visitor question on a live WordPress site — with rich formatting and a natural follow-up.
2. Built-in lead capture: visitors leave their name, email, and phone so a human can follow up.
3. Setup in under a minute — paste your claim code and click Save & Connect. No theme editing.
4. Connected status showing the agent name, live heartbeat health, and one-click disconnect.

== Changelog ==

= 0.1.0 =
* Initial release.
* Claim-code based connect flow (paste, click, done).
* Site-wide embed via `wp_enqueue_script()` with `async` loading.
* 5-minute WP-Cron heartbeat with HMAC-SHA256 signing.
* WooCommerce capability detection (reported in heartbeat).
* Settings-page UX polish (branded header, action links, Site Health diagnostic).
* Full uninstall cleanup – removes options and scheduled events.

== Upgrade Notice ==

= 0.1.0 =
First public release.
