=== UPCODEA Store Chat ===
Contributors: dervisis
Author: UPCODEA
Author URI: https://upcodea.gr
Tags: woocommerce, chatbot, live chat, ai, customer support
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Requires Plugins: woocommerce
Stable tag: 0.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI-powered live chat & chatbot for WooCommerce that answers product questions in real time.

== Description ==

UPCODEA Store Chat is an AI chatbot and live chat widget for your WooCommerce storefront. Customers can ask about products in plain language — "do you have this in blue?", "what's on sale under $30?", "is this in stock?" — and get answers generated from your **live** product catalog, not a stale export.

Developed by [UPCODEA](https://upcodea.gr).

**Key features**

* Floating chat widget with product/category page awareness.
* Answers grounded in real-time WooCommerce data (price, stock, SKU, description, permalink).
* Powered by Google Gemini — a generous free tier means most small stores can run it at no AI cost.
* Nonce-protected, rate-limited REST API endpoint; no API keys ever reach the browser.
* Configurable widget appearance (title, button label, colors).
* Optional site-wide daily reply cap to protect against unexpected API costs.
* Guardrails keep the bot on-topic and resistant to prompt-injection attempts from users.

**Requirements**

* WooCommerce 8.0+
* A free Google Gemini API key from [aistudio.google.com/apikey](https://aistudio.google.com/apikey)

= Third-party service =

UPCODEA Store Chat relies on the **Google Gemini API** to generate chat replies. To do so, the plugin sends the visitor's chat message and a small, relevant slice of your product catalog (name, price, stock, SKU, short description, permalink) to Google's servers for each chat turn. No chat content is stored on your own server; conversation history lives only in the visitor's browser for the duration of the session.

By using this plugin you are sending customer-submitted data to a third party. Please review and link to in your own store's privacy policy:

* Google Privacy Policy: https://policies.google.com/privacy
* Google Gemini API Terms: https://ai.google.dev/gemini-api/terms

UPCODEA Store Chat adds suggested language to your site's Privacy Policy draft automatically (Settings → Privacy → "Suggest Text") — review and publish it before going live.

== Installation ==

1. Upload the `upcodea-store-chat` folder to `/wp-content/plugins/`, or install the zip via Plugins → Add New → Upload Plugin.
2. Activate the plugin. WooCommerce must already be installed and active.
3. Go to **UPCODEA Store Chat** in the wp-admin menu.
4. Paste a free Gemini API key from [aistudio.google.com/apikey](https://aistudio.google.com/apikey).
5. Customize the widget title, button label and colors as needed.
6. Review Settings → Privacy and publish the suggested disclosure text.

== Frequently Asked Questions ==

= Does this cost money to run? =

The plugin itself doesn't add a subscription fee. Google Gemini has a free tier (`gemini-2.5-flash`, `gemini-2.5-flash-lite`) generous enough for most small-to-medium stores. You can also set a daily reply cap in the plugin's settings to hard-limit usage.

= Where does the customer's data go? =

Chat messages and a relevant slice of your product catalog are sent to Google's Gemini API to generate a reply. See the "Third-party service" section above.

= Can I use my own OpenAI/Claude key instead of Gemini? =

Not in the current version — Gemini-only for now.

= Does the bot see private/draft products? =

No. The catalog query only fetches published, publicly visible products via WooCommerce's own product query APIs.

= What happens if I uninstall the plugin? =

All plugin options and transients are removed automatically on deletion (not on simple deactivation).

== Screenshots ==

1. Storefront chat widget.
2. Settings screen.

== Changelog ==

= 0.2.1 =
* Fixed: the floating button, header, user message bubble, and send button colors could be silently overridden by theme CSS that sets `background-color` on generic button selectors. Colors are now set explicitly (including the `background-color` longhand, not just the `background` shorthand) with the priority needed to respect the color pickers in the plugin settings.

= 0.2.0 =
* Changed: plugin name to "UPCODEA Store Chat" and text domain to `upcodea-store-chat`. The original working name ("WoobotAI") was flagged during WordPress.org review as confusingly similar to an existing WooCommerce chatbot plugin and to a registered chatbot trademark, so it was replaced before the first public release.
* Added: site-wide daily reply cap to protect against unexpected API costs.
* Added: `uninstall.php` to fully clean up plugin data on removal.
* Added: Privacy Policy suggested-text integration and in-widget data disclaimer.
* Added: minimum PHP version check with a graceful admin notice.
* Improved: friendlier handling of Gemini safety-blocked responses.
* Improved: error logging via the WooCommerce logger for easier troubleshooting.
* Fixed: chat now falls back to catalog search if an invalid `product_id` is supplied.
* Reduced: outbound AI request timeout to avoid PHP execution-time fatals on shared hosting.

= 0.1.0 =
* Initial MVP: chat widget, REST endpoint, WooCommerce catalog context, Gemini integration, admin settings.

== Upgrade Notice ==

= 0.2.1 =
Fixes widget colors sometimes being overridden by theme CSS.

= 0.2.0 =
Adds uninstall cleanup, cost-protection controls, and privacy-policy disclosures. Recommended before making the plugin public.
