=== Baza Live Chat ===
Contributors: bazadevelopers
Donate link: https://www.paypal.com/donate/?business=A9R843N82XG3G&no_recurring=0&currency_code=USD
Tags: live chat, live support, chatbot, ai, gemini
Requires at least: 5.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.3.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Live chat with Telegram & AI integration. Visitors chat on your site — you reply in Telegram. Self-hosted, no monthly fees.

== Description ==

**Baza Live Chat** connects your WordPress site to Telegram — self-hosted, no third-party servers, no data sharing. Visitors chat on your site and you reply directly from Telegram.

### Main Features:

**Core Chat:**
* Live chat widget embedded on your WordPress site
* Visitors send messages — you reply via Telegram bot
* Real-time polling for instant message delivery
* Sound notifications for new messages
* GDPR consent support
* IP blocking for spam protection
* Visitor session logs and analytics

**Telegram Integration:**
* Connect any Telegram bot to receive visitor messages
* Supergroup Mode — each session gets its own Telegram Topic
* Webhook support for instant operator replies
* Operator hand-off buttons in Telegram

**AI Assistant (Pro):**
* Gemini AI integration for automated responses
* Knowledge base from WordPress post types
* WooCommerce order lookup via AI
* Configurable system prompt and behavior
* Seamless AI-to-operator handoff

**Customization:**
* Custom colors for the chat widget
* Custom avatar in chat header
* Teaser messages to engage visitors
* Auto-questions for quick replies
* Static mode — embed chat inline anywhere
* Custom CSS variables

**Security:**
* Cloudflare Turnstile CAPTCHA support
* Geo-based session tracking
* Rate limiting for messages

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/baza-live-chat/` or install via the WordPress plugin screen.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Go to **Baza Live Chat → Settings** and create a Telegram bot via [@BotFather](https://t.me/BotFather).
4. Enter your Bot Token and Chat ID, click **Save**.
5. Click **Set Webhook** to connect Telegram to your site.
6. The chat widget will appear on your site automatically.

== Frequently Asked Questions ==

= Do I need a paid account? =

No. The free plan includes core chat functionality with Telegram integration. Pro features (AI Assistant, custom colors) require a license.

= Is my data stored on your servers? =

No. All chat data is stored in your own WordPress database. Messages go directly from your site to your Telegram bot.

= Does it work with page builders? =

Yes. Use the `[baza_live_chat]` shortcode to embed the chat anywhere, including Gutenberg, Elementor, and other page builders. Add `static="true"` to show it as an inline block.

= Can I use AI to answer visitors automatically? =

Yes, with a Pro license. Connect your Gemini API key in the AI Settings tab and the assistant will respond to visitors automatically, with a hand-off option to a human operator.

== External services ==

This plugin connects to the following external services. Please review their terms and privacy policies before use.

= Telegram Bot API (api.telegram.org) =
Required for core chat functionality. Every visitor message and operator reply is transmitted through Telegram's servers using the bot token you configure.
* Terms of Service: https://telegram.org/tos
* Privacy Policy: https://telegram.org/privacy

= Cloudflare Turnstile (challenges.cloudflare.com) — optional =
Used for bot protection on the chat widget. Only active when a Turnstile site key is configured in the plugin settings. When enabled, visitor browser data is sent to Cloudflare for verification on each chat session start.
* Terms of Service: https://www.cloudflare.com/terms/
* Privacy Policy: https://www.cloudflare.com/privacypolicy/

= ip-api.com — optional, requires opt-in =
Used to determine the visitor's country from their IP address for session analytics. Only active when "Geo Tracking" is explicitly enabled in the plugin settings (disabled by default). The visitor's IP address is sent to ip-api.com.
* Terms of Service: https://ip-api.com/docs/legal
* Privacy Policy: https://ip-api.com/docs/legal

= Google Gemini AI (generativelanguage.googleapis.com) — optional, Pro feature =
Used to generate AI-powered responses to visitor messages. Only active when a Gemini API key is configured in the AI Settings tab. Visitor messages are sent to Google's servers for processing.
* Terms of Service: https://ai.google.dev/terms
* Privacy Policy: https://policies.google.com/privacy

== Source code ==

Unminified JavaScript source files are included in the plugin under `assets/js/`. The minified files (`*.min.js`) are generated from these sources using Gulp + Terser. The build configuration is available in `gulpfile.js`.