=== Hazelchat ===
Contributors: hazelchat
Tags: chat, chatbot, customer support, sales
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Answer buying questions from reviewed website content and offer visitors a next step with the hosted Hazelchat website agent.

== Description ==

Hazelchat installs your existing website agent on public WordPress pages. Configure its sources, answers, appearance and enquiry form in your Hazelchat account, then paste your public widget key into Settings > Hazelchat.

The plugin provides:

* A public widget key field, with strict validation.
* An explicit switch to load the widget on public pages.
* An optional connection gate for your visitor consent manager.
* A link back to Hazelchat to check installation and test your published agent.

Activation alone does not load the hosted service. No account password, administrative token or AI provider key belongs in WordPress settings. The public widget key grants no administrative access.

Answers use your reviewed, published sources. Source-only mode shows retrieved excerpts; AI-evidence mode writes answers from retrieved evidence. This plugin does not implement an AI engine, guarantee correctness or guarantee sales.

== External service ==

This plugin connects to Hazelchat, a hosted service at https://app.hazelchat.co. A Hazelchat account is required; free and paid plans are available. Billing, content management and agent configuration take place on Hazelchat, not in WordPress. Pricing: https://hazelchat.co/pricing/

After an administrator supplies a valid public widget key, accepts the service connection and enables loading, visitors' browsers download https://app.hazelchat.co/widget.js. The script displays a chat frame from the same service. Browser network requests expose ordinary connection information, such as the visitor's IP address, to the service. When visitors use the chat, their questions, conversation data and any submitted enquiry details (name, email and message) are sent to Hazelchat. Configured AI-evidence mode sends questions and retrieved source passages to its model provider; source-only mode does not use a model. Retention and data requests are managed in Hazelchat. The plugin itself does not read or send WordPress users, posts, orders or private pages, and performs no server-to-server service requests or activation telemetry.

The optional visitor-consent setting still allows the small launcher script to download; it prevents creation of the chat frame, chat API requests and session-storage access until your consent manager dispatches hazelchat-consent with detail: true. A consent manager must be connected separately. To block all external downloads before consent, configure your consent manager to block the launcher script as well. Turning consent off removes the widget but does not erase records already held by Hazelchat.

Service terms: https://hazelchat.co/terms/
Privacy notice: https://hazelchat.co/privacy/
Data processing agreement: https://hazelchat.co/dpa/

== Installation ==

1. In WordPress, go to Plugins > Add New Plugin, search for Hazelchat, install and activate it.
2. In Hazelchat, add your content, check the details and try your agent. Under Website > Installation, add the website's domain.
3. Copy the 64-character data-agent value from Hazelchat's installation code.
4. Open WordPress Settings > Hazelchat. Paste that public widget key, accept the hosted-service connection, enable loading, and save. Connect your consent manager first if using the optional gate.
5. Remove any older manually pasted Hazelchat script and clear your page cache.
6. In Hazelchat, click Publish and switch on (Switch on Hazelchat if your published agent is unchanged). Installation is checked before the agent goes live. Refresh your website, then complete Test on your website.

== Frequently Asked Questions ==

= Does this publish my agent or verify my website automatically? =

No. Complete publishing, domain verification, enablement and the real website test in Hazelchat. The plugin only installs the public widget script.

= Does it work with page builders and WooCommerce? =

It adds a footer script using WordPress's normal script API. Themes must call wp_footer(). It does not import private WooCommerce data, retrieve orders or manage carts. Individual builder, commerce and optimization-plugin combinations require testing.

= Why is my widget missing? =

Check the public key, both enable switches, your published agent and allowed verified domain. Clear page caches. Exclude app.hazelchat.co/widget.js from script combining, rewriting and delayed execution: the launcher needs its original script tag and data-agent attribute. A Content Security Policy must allow https://app.hazelchat.co in script-src and frame-src. A consent-gated installation needs the consent event after the script loads. WordPress admin, feeds, JSON requests and draft previews do not load the widget.

= How do I connect my consent manager? =

After consent is granted, run:

window.dispatchEvent(new CustomEvent('hazelchat-consent', { detail: true }));

On revocation, dispatch the same event with detail: false. Dispatch after the widget script loads, including when consent was already granted on a previous visit. This plugin does not install or configure a consent manager and makes no claim of legal compliance.

= What happens on deactivation or deletion? =

Deactivation stops adding the script to newly generated pages and keeps settings for reactivation. Deletion removes the plugin's WordPress settings, including on each site in a multisite network. Clear page caches after disabling, deactivating, deleting or changing the key; cached pages and already-open browser tabs can retain the script. Pause the agent in Hazelchat to stop hosted requests immediately. Neither action deletes your Hazelchat account, sources or conversations or cancels a subscription.

= Can I use it on WordPress.com? =

Only if your WordPress.com plan permits installing plugins. This plugin targets self-hosted WordPress and does not bypass hosting restrictions.

== Screenshots ==

1. Settings > Hazelchat: paste your public widget key, accept the service connection and switch on loading. Shown with an empty test installation.

== Changelog ==

= 1.0.0 =
* First version: validated public key, explicit loading, service disclosure, optional consent gate and site-local settings cleanup.

== Credits ==

Bricolage Grotesque and Parkinsans (the outlined Hazelchat wordmark) are licensed under the SIL Open Font License 1.1. Their license files are bundled with the local assets. No external fonts are loaded.
