=== MxChat Trigger ===
Contributors: mxchat
Tags: chatbot, trigger, button, mxchat, chat
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
Stable tag: 2.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add chat trigger buttons that open MxChat and send predefined messages. Turn any element into a conversation starter.

== Description ==

MxChat Trigger is a Pro add-on for MxChat that allows you to create trigger buttons and links throughout your website. When visitors click these elements, the MxChat chatbot opens and automatically sends a predefined message to start the conversation.

**Key Features:**

* Add triggers to any HTML element using simple data attributes
* Open chat with or without sending a message
* Support for Multi-Bot targeting (when Multi-Bot add-on is active)
* Built-in button styles and animations
* Shortcode support for easy integration
* Works with all major page builders

**Requirements:**

* MxChat plugin (free version)
* MxChat Pro license activation

== Installation ==

1. Ensure MxChat is installed and activated
2. Ensure your MxChat Pro license is activated
3. Upload the `mxchat-trigger` folder to `/wp-content/plugins/`
4. Activate the plugin through the 'Plugins' menu in WordPress
5. Navigate to MxChat > Triggers to configure

== Usage ==

**Basic Trigger (Send Message):**
`<button data-mxchat-trigger="Hello! I have a question">Ask a Question</button>`

**Open Chat Only:**
`<button data-mxchat-open>Chat with Us</button>`

**Target Specific Bot (Multi-Bot):**
`<button data-mxchat-trigger="I need help" data-mxchat-bot-id="support_bot">Get Support</button>`

**Shortcode:**
`[mxchat_trigger message="Hello!" text="Chat Now"]`
`[mxchat_trigger message="I need help" text="Support" bot_id="support_bot"]`
`[mxchat_trigger text="Open Chat" open_only="yes"]`

== Shortcode Parameters ==

* `message` - The message to send when clicked (default: "Hello!")
* `text` - The button text displayed (default: "Chat with Us")
* `class` - Additional CSS classes
* `bot_id` - Target a specific bot ID (requires Multi-Bot add-on)
* `open_only` - Set to "yes" to only open chat without sending message

== CSS Classes ==

**Button Styles:**
* `mxchat-btn mxchat-btn-primary` - Primary styled button
* `mxchat-btn mxchat-btn-secondary` - Secondary/outline button
* `mxchat-btn mxchat-btn-gradient` - Animated gradient button

**Animations:**
* `mxchat-trigger-shake` - Subtle shake animation
* `mxchat-trigger-pulse` - Pulse/glow animation
* `mxchat-trigger-bounce` - Bounce animation

== JavaScript API ==

`// Open chat and send a message
window.mxchatOpenAndSend('Your message here');

// Just open the chat
window.mxchatOpen();

// Send a message (chat must be open)
window.mxchatSendMessage('Your message');

// Check if chat is ready
if (window.mxchatIsReady()) {
    // Chat is loaded
}

// Multi-Bot: Target specific bot
window.mxchatOpenAndSend('Hello', 'sales_bot');
window.mxchatOpen('support_bot');`

== Changelog ==

= 2.2.1 =
* Added update checker integration
* Added MxChat Pro license verification
* Improved multisite support

= 2.2.0 =
* Added Multi-Bot support with data-mxchat-bot-id attribute
* New sidebar-based admin interface
* Added JavaScript API for programmatic control
* Added custom events for trigger actions
* Improved shortcode with bot_id and open_only parameters

= 2.1.0 =
* Added animation classes
* Improved button styles
* Bug fixes

= 2.0.0 =
* Complete rewrite with class-based selectors
* Added shortcode support
* Pro license requirement

= 1.0.0 =
* Initial release

== Frequently Asked Questions ==

= Does this work with page builders? =

Yes! You can add the data attributes to any element in Elementor, Divi, Beaver Builder, and other page builders. Check the Usage Guide in the admin panel for specific instructions.

= Can I style my own buttons? =

Absolutely. The data attributes work on any HTML element. You can use your own CSS or the built-in helper classes.

= What happens if Multi-Bot is not installed? =

The plugin works perfectly with the default MxChat chatbot. Multi-Bot features are only available when that add-on is also installed and activated.

== Support ==

For support, please visit [mxchat.ai](https://mxchat.ai) or email support@mxchat.ai.
