=== SupportFlow – Chatbot & Documentation Builder ===
Contributors: wpbranddigital25
Tags: chatbot, knowledge base, documentation, helpdesk, live chat
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later 
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Build a modern customer support center on WordPress with a dual-mode AI/human Chatbot and a complete dynamic Gutenberg-based Knowledge Base.

== Description ==

**SupportFlow** is an all-in-one customer engagement and support toolkit for WordPress. It includes an AI-powered floating Chatbot (supporting OpenAI & Anthropic) with live human fallback, a dynamic Knowledge Base (Docs KB) custom post type, and voice/site search capabilities — all built natively for the Block Editor.

Designed with high performance, accessibility, and SEO best practices in mind, SupportFlow operates without bulky framework dependencies. It utilizes Gutenberg `apiVersion: 3` and server-side rendering for lightning-fast frontend loading.

= Free Blocks =

1. **AI Chat Widget** — A floating support chat bubble that responds automatically using OpenAI (GPT-3.5/4o) or Anthropic (Claude). Includes built-in Lead Captures, automated email notifications for new inquiries, and a fallback "Talk to a Human" queue.
2. **Docs Knowledge Base** — Displays a complete documentation index categorizing all your support articles with dynamic accordion navigation.
3. **Docs Category Grid** — Renders doc categories as grid cards with custom icons and post counters, letting visitors find topics visually.
4. **Docs Search Form** — A fast, live search bar tailored specifically to query your documentation articles (Docs KB).
5. **Docs Viewer** — A comprehensive, readable document layout showing sibling article navigation and a dynamic, auto-parsed Table of Contents (TOC).
6. **Voice Search** — Native browser speech recognition search block (Web Speech API). Click the mic, speak, and results load inline instantly.
7. **AI FAQ** — An accessible accordion FAQ block with automatic FAQ Schema (JSON-LD) generation, helping you get rich snippets on Google search results.
8. **AI Site Search** — Live, debounced site-wide search with keyword highlighting, searching pages and posts via REST API.


= Technical Highlights =
* Native Gutenberg standard (`apiVersion: 3`) using `@wordpress/scripts`.
* Zero jQuery: Built entirely with vanilla Javascript.
* Server-side rendering (via block `render.php`).
* Database-driven chat persistence with custom MySQL schemas.
* Fully localized & translatable codebase.

== External Services ==

This plugin integrates with third-party AI providers to offer automated chatbot assistance. Depending on your configuration under Chat Inbox → Chat Settings, the plugin may connect to the following external APIs:

1. OpenAI API (https://api.openai.com)
   * Use: Used to generate intelligent conversational responses for the AI Chat Widget block.
   * Data Sent: Send user-entered chat messages and context history to the OpenAI completions endpoint. No personal site database data is sent. Data is sent only when a visitor submits a query to the chat widget and OpenAI is the active selected provider.
   * OpenAI Terms of Service: https://openai.com/policies/terms-of-use
   * OpenAI Privacy Policy: https://openai.com/policies/privacy-policy

2. Anthropic Claude API (https://api.anthropic.com)
   * Use: Used to generate intelligent conversational responses for the AI Chat Widget block.
   * Data Sent: Send user-entered chat messages and context history to the Anthropic messages endpoint. No personal site database data is sent. Data is sent only when a visitor submits a query to the chat widget and Anthropic is the active selected provider.
   * Anthropic Terms of Service: https://www.anthropic.com/legal/consumer-terms
   * Anthropic Privacy Policy: https://www.anthropic.com/legal/privacy

== Installation ==

1. In your WordPress admin dashboard, navigate to **Plugins → Add New**.
2. Click **Upload Plugin** and select the `supportflow.zip` archive.
3. Click **Install Now** and then **Activate**.
4. Navigate to **Chat Inbox → Chat Settings** inside your sidebar to set up your AI Provider (OpenAI/Anthropic), adjust widget styling, or configure team email alerts.

== Development ==
 
Public source code repository:
https://github.com/wpbranddigital/SupportFlow-Chatbot-Documentation-Builder

Build Instructions:

1. npm install
2. npm run build
3. npm run start (development)
SupportFlow is built using @wordpress/scripts.


== Frequently Asked Questions ==

= Do I need an API key to use the plugin? =
No. The Knowledge Base blocks, FAQ accordions, Voice Search, and Site Search operate out of the box without any external services. The AI Chat widget runs in a canned "Demo Mode" until you add an API key under **Chat Inbox → Chat Settings → AI Provider Settings**.

= How does the AI/Human dual-mode work? =
When a visitor initiates a chat, SupportFlow answers using the selected AI provider. If the visitor is not satisfied or clicks "Talk to a Human", the chatbot changes state to human mode, alerts support representatives via email, and adds the conversation as a pending thread in your admin **Chat Inbox**.

= Where are lead captures stored? =
Customer names and emails are securely stored in custom tables inside your WordPress database. You can review leads under **Chat Inbox → Chat Settings → Lead Captures** and download the data as a CSV.

= Does the Voice Search block work in all browsers? =
Voice Search utilizes the browser Web Speech API (supported natively by Chrome, Safari, and Edge). In unsupported environments, the microphone button is gracefully hidden, falling back to a regular text input.

= How is the Table of Contents (TOC) generated? =
The **Docs Viewer** block automatically parses the `<h2>` and `<h3>` tags of the support article and populates a dynamic sidebar list.

== Changelog ==

= 1.0.1 = 
* Added public source code repository documentation.
* Added development and build instructions.
* Updated plugin documentation.

= 1.0.0 =
* Initial release.
* Added AI Chat Widget block (floating, OpenAI + Anthropic, demo mode, and style presets).
* Built custom chat DB schema (`aivb_conversations`, `aivb_messages`) and REST polling.
* Integrated admin Chat Inbox dashboard with unread counters.
* Added 4 Knowledge Base (Docs KB) blocks: Docs Knowledge Base, Category Grid, Search Form, and Viewer.
* Built Docs Guide and automated reading time calculations.
* Added Voice Search, AI FAQ (JSON-LD schema support), and AI Site Search blocks.

== Upgrade Notice ==

= 1.0.0 =
Initial release.