=== Mahrous AI Reply Assistant ===
Contributors: wphope
Tags: ai, chatbot, woocommerce, email, autoresponder
Requires at least: 5.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.2.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI-powered automatic responses for email, WooCommerce, contact forms, and website FAQ search. Extensible with addons.

== Description ==

Mahrous AI Reply Assistant is a modular AI support engine that can automatically reply to:

- Customer emails (IMAP inbox integration, with proper reply threading and attachment support)
- WooCommerce order questions (Addon)
- Contact Form 7 submissions (Addon)
- Live Chat widgets
- WhatsApp Business messages via the WhatsApp Cloud API (Addon)
- FAQ frontend search widget

Includes:
- AI-powered reply generator (OpenAI / Anthropic / Gemini)
- Conversation inbox viewer
- Knowledge base system with AI-generated keywords/synonyms to improve search matching, plus CSV import/export
- AI-enhanced FAQ shortcode
- Optional companion addons (WooCommerce, WhatsApp Business, Contact Form 7), distributed and installed separately like any other WordPress plugin
- REST API for custom developers

== Features ==

* AI Replies (OpenAI, Claude, Gemini)
* Email Inbox Reader (IMAP) with Gmail-style reply threading (In-Reply-To/References headers, quoted original message) and attachment handling
* Auto-Responder with safeguards against escalating to a human without a valid customer email on file
* Knowledge Base Manager with AI-generated keywords/synonyms and CSV import/export
* AI FAQ Search Shortcode
* Conversation Inbox
* Regenerate AI Replies
* Live Chat Widget
* Optional companion addons available separately: WooCommerce, Contact Form 7, WhatsApp Business

== Shortcodes ==

`[ai_faq_search]`  
Displays the FAQ search box with AI suggestions.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`
2. Activate the plugin through the **Plugins** menu
3. Go to **Mahrous > Settings**
4. Enter your API keys and IMAP email settings
5. Add FAQ entries under **Knowledge Base**
6. Add the shortcode `[ai_faq_search]` anywhere on your site

== External Services ==

This plugin relies on third-party AI services to generate responses. When you use this plugin, user messages and conversation data may be sent to one of the following external services based on your configuration:

= OpenAI =
* Service: OpenAI API (https://api.openai.com/v1/chat/completions)
* Terms of Use: https://openai.com/policies/terms-of-use
* Privacy Policy: https://openai.com/policies/privacy-policy
* Data Usage: User messages are sent to OpenAI servers for AI response generation
* API Key Required: Yes (obtain from https://platform.openai.com/api-keys)

= Anthropic (Claude) =
* Service: Anthropic API (https://api.anthropic.com/v1/messages)
* Terms of Service: https://www.anthropic.com/legal/consumer-terms
* Privacy Policy: https://www.anthropic.com/legal/privacy
* Data Usage: User messages are sent to Anthropic servers for AI response generation
* API Key Required: Yes (obtain from https://console.anthropic.com/)

= Google Gemini =
* Service: Google Generative AI API (https://generativelanguage.googleapis.com/v1beta/models/)
* Terms of Service: https://ai.google.dev/terms
* Privacy Policy: https://policies.google.com/privacy
* Data Usage: User messages are sent to Google servers for AI response generation
* API Key Required: Yes (obtain from https://makersuite.google.com/app/apikey)

**Important Privacy Notice:**  
By using this plugin with external AI services, you acknowledge that customer messages, emails, and chat conversations will be transmitted to the selected AI provider for processing. You are responsible for informing your users about this data transmission and ensuring compliance with applicable privacy laws (GDPR, CCPA, etc.).

Please review each service's terms and privacy policies before using them.

== Frequently Asked Questions ==

= Does it require API keys? =  
Yes, for AI processing (OpenAI / Anthropic / Gemini).

= Does it work with WooCommerce? =  
Yes, using the WooCommerce addon (sold separately).

= Can it auto-reply to emails? =  
Yes. Configure IMAP inbox under **AI Settings**.

= Is my customer data secure? =
Customer messages are sent to external AI providers (OpenAI, Anthropic, or Google) for processing. Please review the External Services section above for privacy policies of each provider. Ensure you inform your users about this data processing.

== Screenshots ==

1. Dashboard — inbox status and conversation counts
2. Conversation inbox — AI replies threaded per customer
3. Knowledge Base — entries with AI-generated keywords
4. Settings — IMAP inbox, reply rules and auto-reply
5. Live chat widget on the frontend
6. FAQ search on the frontend via [ai_faq_search]

== Changelog ==

= 0.2.2 =
* Fixed "Enable Auto-Reply" and "Enable Chat Widget" checkboxes: unchecking them and saving did not persist as off, and could even flip them back on, because an unchecked checkbox submits nothing at all and was mishandled as "on" instead of "off"

= 0.2.1 =
* Fixed AI model selection settings validating the wrong provider's model list (Anthropic and Gemini selections were being checked against OpenAI's defaults)
* Added an explicit nonce and capability check to the model-selection sanitize callback

= 0.2.0 =
* Removed the built-in addon downloader; companion addons (WooCommerce, WhatsApp Business, Contact Form 7) are now installed the same way as any other WordPress plugin
* Fixed the FAQ search widget failing to display results
* Added "Load More" pagination to the FAQ search widget
* Removed unnecessary bundled translation files; translations are now provided through translate.wordpress.org
* Various admin UI and packaging cleanups

= 0.1.0 =
* Initial release
* Email inbox integration
* AI responders (OpenAI, Anthropic, Gemini)
* Knowledge Base Manager
* Conversation Inbox
* FAQ AI Search
* Addon architecture

== Upgrade Notice ==

= 0.2.2 =
Fixes the Auto-Reply and Chat Widget "enable" checkboxes not staying off when unchecked and saved.

= 0.2.1 =
Fixes AI model selection incorrectly validating against the wrong provider's defaults.

= 0.2.0 =
Addon downloading/browsing has moved out of the plugin; get addons directly. Also fixes the FAQ search widget.

= 0.1.0 =
Initial release of Mahrous AI Reply Assistant.
