=== KolossusAI Chat ===
Contributors: kolossusai
Tags: chatbot, ai, chat, live chat, assistant
Requires at least: 6.3
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

Add a KolossusAI assistant to your site as a chat bubble on every page, or as a button wherever you place a shortcode.

== Description ==

KolossusAI Chat connects your WordPress site to your AI agent built in KolossusAI. Visitors can ask questions and get answers from your assistant without leaving the page.

* A chat bubble on every page, or only where you add the `[kolossus_chat]` shortcode.
* Bubble, sidebar or bottom-bar layout, set in your KolossusAI dashboard.
* Choose light, dark or automatic theme, the accent colour and the layout from WordPress.
* Place the chat bubble anywhere: pick the bottom-right or bottom-left corner and set the X and Y distance in pixels. Small, medium or large size.
* Choose what happens on page load: remember each visitor's last state, always open, or start minimized.
* Optional: logged-in WordPress users chat under their own name, with their history kept (needs the widget secret, which stays on your server).

You need a KolossusAI account and a widget created for your agent in the KolossusAI dashboard.

**Don't have an agent yet?** Contact the KolossusAI team at [kolossus.ai](https://kolossus.ai/). They will set up a personalised agent for your business and give you the widget token to use with this plugin.

== External services ==

This plugin connects to the KolossusAI service to show the chat and answer questions. Without it the plugin does nothing.

* **What is loaded:** the chat script (`widget.js`) from the KolossusAI server set as the Host URL in Settings → KolossusAI Chat (`https://engine.kolossus.ai` unless you change it). Nothing loads until you save a widget token. It then loads on every front-end page when the site-wide bubble is on, otherwise only on pages that contain the `[kolossus_chat]` shortcode.
* **What is sent, and when:** when the page loads, the visitor's browser sends your widget token to load the chat settings. When the visitor chats, it sends their messages, any files they attach, their IP address and approximate location (city and country) to the KolossusAI server so the assistant can reply.
* **Service provider:** KolossusAI. Terms of service: https://kolossusai.in/terms/. Privacy policy: https://kolossusai.in/privacy/.

== Installation ==

1. Install and activate the plugin.
2. In your KolossusAI dashboard, create a widget for your agent and add your site's domain (for example `example.org`) to its allowed domains.
3. In WordPress, go to Settings → KolossusAI Chat.
4. Enter the widget token, which starts with `wt_`. The KolossusAI Host URL is already filled in (`https://engine.kolossus.ai`); change it only if you were given a different address. Optionally add the widget secret (`ws_`) and choose the theme, accent colour and layout.
5. Leave "Show the chat on every page" ticked for a site-wide bubble, or untick it and add the shortcode where you want a button.

If your site uses a Content Security Policy, allow your KolossusAI host in `script-src` and in `connect-src` (both `https://` and `wss://`).

== Frequently Asked Questions ==

= Where do I find the widget token? =

In your KolossusAI dashboard, open the settings of your agent's widget. Use the public token that starts with `wt_`. If you don't have an agent or a dashboard account yet, contact the KolossusAI team at https://kolossus.ai/ and they will provide your agent and its token. The widget secret (it starts with `ws_`) is optional and goes in its own field. It never reaches visitors' browsers.

= What does the widget secret do? =

When it is saved, WordPress signs the email of each logged-in user with it (HMAC-SHA256) and passes the signature to the chat. KolossusAI checks the signature, so those users get a verified chat under their own name and keep their history. Visitors who are not logged in chat anonymously.

= The bubble does not appear. =

Check that the Host URL starts with `https://`, that the token is correct, and that your site's domain is in the widget's allowed domains. Caching or security plugins (for example Cloudflare or Wordfence) may also need to allow your KolossusAI host.

= How do I add a chat button to a page? =

Add `[kolossus_chat label="Ask our assistant"]`. You can add your own CSS class with `class="my-button"`.

= How do I hide the bubble on some pages? =

Use the `kolossus_chat_show_sitewide` filter:

`add_filter( 'kolossus_chat_show_sitewide', function ( $show ) { return is_page( 'checkout' ) ? false : $show; } );`

= Does it work on WordPress.com? =

Yes on Business and Commerce plans, which allow plugins. Not on the Free, Personal or Premium plans.

== Screenshots ==

1. The chat bubble on a website.
2. The open chat panel.
3. The settings page.

== Changelog ==

= 1.3.0 =
* Bubble position settings: corner (bottom right or bottom left) plus horizontal (X) and vertical (Y) offsets in pixels. The chat panel opens just above the bubble.
* "Bubble size" setting: small, medium (default) or large.

= 1.2.1 =
* The Host URL is now pre-filled with the KolossusAI server, so you only need to add the widget token. You can still change it.
* Settings page explains how to get a personalised agent from the KolossusAI team.
* Use the KolossusAI name throughout.

= 1.2.0 =
* "On page load" setting: remember the visitor's last state (default), always open, or start minimized. Previously the chat always reopened on refresh.

= 1.1.0 =
* Theme (auto, light, dark), accent colour and layout settings.
* Optional widget secret for verified chat for logged-in users.
* Accept http:// Host URLs on localhost for testing.

= 1.0.0 =
* First release.
