=== AANYA AI Chatbot ===
Contributors: owebest
Tags: chatbot, AI, live chat, customer support, woocommerce
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.12
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds an AI chat widget powered by AANYA.ai. Manage settings in WP Admin. Optional WooCommerce sync and Connect human.

== Description ==

AANYA AI Chatbot connects your WordPress site to an AI assistant you configure and train at AANYA.ai. Open Settings → AANYA Chatbot, click Authorize with AANYA, sign in on aanya.ai, and return to WordPress. Manage training, appearance, conversations, leads, and store features directly in WordPress Admin (no iframe). The chat widget appears on your site when published — no theme editing required.

On eligible AANYA plans, visitors can use Connect human to reach a live agent (availability is controlled in AANYA Live Desk).

= WooCommerce (optional) =

If WooCommerce is installed, you can opt in (per data type) to share catalog, order, or customer fields with AANYA so the chatbot can answer shop questions. Customer sharing defaults to off.

== External services ==

This plugin connects to the AANYA.ai service (https://www.aanya.ai) to provide the chat widget, native admin studio APIs, and optional store sync.

Data that may be sent:

* Site URL and WordPress admin origin (for authorize)
* Chatbot ID and embed token (stored in your WordPress options after you authorize)
* Studio API requests for chatbot settings, knowledge, conversations, and leads (admin only)
* Storefront widget requests for configuration and chat messages (visitor messages and related session data)
* If you enable WooCommerce sharing: product fields (name, price, stock, description, URL), order fields (id, status, total, billing email), and/or customer fields (id, email, name)

Services and policies:

* Service: https://www.aanya.ai
* Privacy policy: https://www.aanya.ai/privacy-policy
* Terms: https://www.aanya.ai/terms-of-service

== Installation ==

1. Upload the `aanya-ai-chatbot` folder to `/wp-content/plugins/` or install the zip via Plugins → Add New → Upload.
2. Activate the plugin through the Plugins menu in WordPress.
3. Go to Settings → AANYA Chatbot.
4. Click Authorize with AANYA, sign in on aanya.ai, and approve the connection.
5. Manage your chatbot in the native WordPress studio. Visit your site front end to see the widget when published in AANYA.

== Frequently Asked Questions ==

= Do I need an AANYA.ai account? =

Yes. Click Authorize with AANYA on the settings page, sign in on aanya.ai, and approve the connection for this site.

= Does this work without WooCommerce? =

Yes. WooCommerce options only appear when WooCommerce is active. The chat widget works on any WordPress site.

= Where is my data stored? =

Credentials are stored in your WordPress options table. Chat and optional store data are processed by AANYA.ai according to their privacy policy.

= How do I remove the widget? =

Click Uninstall on the AANYA Chatbot settings page (or deactivate/delete the plugin). Uninstall clears saved options from WordPress.

== Screenshots ==

1. Connect screen — Authorize with AANYA from Settings → AANYA Chatbot.
2. Native AANYA studio in WordPress Admin after connection (Overview, Settings, Knowledge, Conversations, Leads, Store).

== Changelog ==

= 1.1.12 =
* Auto-fix install folder: if the plugin lives in aanya-ai-chatbot-1.1.x, it renames to aanya-ai-chatbot when an admin opens wp-admin (so WordPress.org updates work without asking each client).

= 1.1.11 =
* Fix: Authorize no longer fails with “invalid security token” after returning from AANYA (OAuth uses one-time state, not a fragile WP nonce in return_url).

= 1.1.10 =
* Security hardening notes for Plugin Check; AJAX/uninstall nonces unchanged.

= 1.1.9 =
* Fix: fatal “Cannot redeclare aanya_chatbot_init()” when two plugin folders are present.
* Zip installs into `aanya-ai-chatbot/` so upgrades replace the same plugin directory.

= 1.1.8 =
* Studio tip note: manage more settings from the Aanya.ai dashboard with registered credentials.

= 1.1.7 =
* Meridian template locks Light theme; brand-color hint so accents stay visible.
* Enterprise upgrade opens AANYA pricing with subject prefilled (via API upgrade_url).

= 1.1.6 =
* Studio UI aligned with Shopify: piano tabs, primary buttons, live CSS widget-template mocks (no broken images).
* Knowledge training library list with View / Remove action pills (Shopify Knowledge Forge style).

= 1.1.5 =
* Knowledge: Shopify-style crawl loader, progress bar, and disabled Start crawl while a job runs (prevents duplicate clicks).

= 1.1.4 =
* Widget settings UI aligned with Shopify (template preview cards, form layout, theme pills, brand color + hex).
* Plan chip: Manage plan / Upgrade links open AANYA billing from WordPress Admin.
* Preview widget Connect human enabled (widget build 114).

= 1.1.3 =
* Fix: native studio bootstrap “Not connected to AANYA” after a successful Authorize (credentials passed reliably to admin-ajax; option storage hardened).
* Clearer errors when the server cannot reach www.aanya.ai over HTTPS.

= 1.1.2 =
* Fix: settings page slug aligned to `aanya-ai-chatbot` so Authorize / return / disconnect no longer hit “Sorry, you are not allowed to access this page.”
* Legacy `page=aanya-chatbot` return URLs are still accepted.

= 1.1.1 =
* Internationalization: text domain updated to match plugin slug `aanya-ai-chatbot`.
* Security: sanitize/validate logo and knowledge document uploads (filename, MIME, is_uploaded_file).
* Front-end widget loads current AANYA CDN build (includes Connect human / Live Desk support).

= 1.1.0 =
* Native WordPress Admin studio — no iframe.
* Chatbot settings, knowledge, conversations, leads, and store features via AANYA studio APIs.
* Authorize flow, widget inject, and WooCommerce sync unchanged.

= 1.0.2 =
* WordPress.org packaging: LICENSE, languages path, External services disclosure.
* Restored compact WooCommerce data-sharing settings when connected.
* Compliance and i18n hardening for Plugin Directory review.

= 1.0.1 =
* Professional WordPress connect screen.
* After authorize: full-page AANYA studio iframe with Uninstall only.

= 1.0.0 =
* Initial release — widget inject, authorize flow, optional WooCommerce sync.

== Upgrade Notice ==

= 1.1.12 =
Automatically renames versioned plugin folders to aanya-ai-chatbot for WordPress.org updates.

= 1.1.11 =
Fixes Authorize “invalid security token” after connecting via AANYA.

= 1.1.10 =
Plugin Check security notes; keep using this only if 1.1.11 is unavailable.

= 1.1.9 =
Fixes duplicate-plugin fatal. Delete any extra folder like aanya-ai-chatbot-1.1.8 and keep only aanya-ai-chatbot.

= 1.1.8 =
Short dashboard tip note under the studio toolbar.

= 1.1.7 =
Meridian always uses Light theme; clearer brand-color guidance for visible widget accents.

= 1.1.6 =
Shopify-matching studio tabs, live template previews, and Knowledge library actions.

= 1.1.5 =
Knowledge crawl now shows a visible loader and blocks repeat Start crawl clicks.

= 1.1.4 =
Improved Widget settings UI (template previews), plan upgrade links, and Connect human on preview.

= 1.1.3 =
Fixes studio “Not connected to AANYA” and empty tabs after Authorize.

= 1.1.2 =
Fixes admin “not allowed to access this page” after Authorize / settings return (settings slug mismatch).

= 1.1.1 =
Compliance fixes for WordPress.org review (text domain + upload sanitization). Widget CDN build updated for Connect human.

= 1.1.0 =
Native WordPress Admin studio replaces the embedded iframe. Re-authorize only if credentials were cleared.
