=== ChatNexus AI Chat ===
Contributors: chatnexus
Tags: ai chat, chatbot, ai agent, live chat, customer support
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed your ChatNexus AI agent on any WordPress site in two clicks. No coding required.

== Description ==

ChatNexus AI Chat lets you add a fully configured AI agent to your WordPress site instantly. Choose from 20+ industry templates — real estate, healthcare, SaaS, legal, beauty, and more — or build your own agent in the ChatNexus dashboard and paste in the Agent ID.

**Features:**

* Auto-inject the widget on every page, or use the `[chatnexus_chat]` shortcode for manual placement
* Choose widget position: bottom-right or bottom-left
* Test your connection directly from the settings page
* Override the agent per-page using shortcode attributes
* Zero JavaScript files stored in WordPress — the widget script is loaded from ChatNexus CDN

**How it works:**

1. Create a free account at [chatnexus.cloud](https://chatnexus.cloud)
2. Build or choose an AI agent from the template gallery
3. Copy your Agent ID from Agent Settings → Embed
4. Paste it into Settings → ChatNexus in your WordPress dashboard
5. Done — your AI agent is live on your site

== Installation ==

1. Upload the `chatnexus` folder to `/wp-content/plugins/`
2. Activate the plugin through the **Plugins** menu in WordPress
3. Go to **Settings → ChatNexus** to configure your Agent ID

== Frequently Asked Questions ==

= Do I need a ChatNexus account? =

Yes. Create a free account at [chatnexus.cloud](https://chatnexus.cloud). The Free plan includes one agent and 300 messages/month.

= Where do I find my Agent ID? =

In the ChatNexus dashboard, open your agent and go to **Settings → Embed**. Your Agent ID (a UUID) is displayed there.

= Can I add the chat widget to specific pages only? =

Disable **Auto-inject Widget** in Settings → ChatNexus, then add `[chatnexus_chat]` to the pages where you want the widget to appear.

= Is the widget GDPR-compliant? =

ChatNexus does not collect personal data without user consent. See [chatnexus.cloud/privacy-policy](https://chatnexus.cloud/privacy-policy) for full details.

= Does this work with page builders like Elementor or Divi? =

Yes — use the shortcode widget/module in your page builder and enter `[chatnexus_chat]`.

== Screenshots ==

1. Settings page in the WordPress admin
2. Chat widget on a live site (bottom-right position)
3. Shortcode placement in the Gutenberg editor

== Changelog ==

= 1.0.2 =
* Fix: Add `register_activation_hook` to write default option rows on install,
  preventing the update-checker from treating a fresh upload as an update to a
  missing slug.
* Fix: Add `register_deactivation_hook` that removes the plugin entry from the
  `_site_transient_update_plugins` cache on deactivation. This eliminates the
  "ghost deletion" paradox where a deactivated plugin kept reappearing in the
  admin list after its files were deleted from disk.
* Fix: `uninstall.php` now forcefully deletes the `update_plugins` site
  transient on plugin deletion, evicting any platform-level object cache entry
  so a subsequent clean upload is always treated as a fresh install.
* Fix: Replace anonymous sanitize callback for `chatnexus_auto_inject` setting
  with a named function (`chatnexus_sanitize_bool`) to ensure serialization
  safety across all hosting environments.
* Fix: Extract inline `<script>` from the settings page into a properly
  enqueued `assets/admin.js` file loaded via `wp_enqueue_script`. Server-side
  values (nonce, AJAX URL, i18n strings) are passed via `wp_localize_script`
  rather than being interpolated directly into script tags.

= 1.0.1 =
* Fix widget embed script URL so chat bubble loads correctly on frontend pages.
* Improve compatibility of auto-inject script output.
* Pin widget script to versioned URL (`/js/embed.v1.js`). Plugin updates and widget updates now roll out independently. When the ChatNexus platform ships a breaking widget change, a new versioned file (`embed.v2.js`, etc.) will be published and a new plugin version will target it.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.1 =
Fixes frontend widget loading for WordPress installs.

= 1.0.0 =
Initial release.
