=== BetterCX Widget ===
Contributors: appwavedev
Tags: chat, widget, customer support, ai, live chat
Requires at least: 5.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.0.20
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Professional AI-powered chat widget for BetterCX platform. Seamlessly integrate intelligent customer support into any WordPress website.

== Description ==

The BetterCX Widget plugin provides a powerful, AI-driven customer support solution that integrates seamlessly into your WordPress website. This plugin offers a complete chat widget experience with advanced features, customizable appearance, and enterprise-grade security.

= Key Features =

* **AI-Powered Support**: Intelligent chatbot that understands context and provides helpful responses
* **Real-time Chat**: Instant messaging with your customers
* **Customizable Appearance**: Match your brand with themes, colors, titles, and positioning options
* **Embedded Mode Options**: Flexible sizing (full, medium, small) and placement (top, center, bottom) for embedded contexts
* **Rich Media Support**: Image upload and sharing capabilities for enhanced communication
* **Branding Control**: Customizable "Powered by BetterCX" attribution display
* **Mobile Responsive**: Optimized for all devices and screen sizes
* **WordPress Integration**: Native shortcode and widget support
* **Event Tracking**: Monitor user interactions and analytics
* **Security First**: GPLv2+ licensed, no tracking without consent
* **Developer Friendly**: Full API access and customization options

= How It Works =

1. **Install & Activate**: Install the plugin and activate it
2. **Get Your Key**: Obtain your public key from the BetterCX dashboard
3. **Configure**: Set your preferences in the admin settings
4. **Deploy**: Use shortcodes, widgets, or automatic placement
5. **Monitor**: Track interactions and improve customer support

= Integration Options =

* **Shortcode**: `[bettercx_widget]` - Use anywhere in posts, pages, or widgets
* **Widget Areas**: Drag and drop into any widget area
* **Automatic Placement**: Global widget placement on all pages
* **Custom Positioning**: Left or right side positioning
* **Embedded Sizing**: Full screen, medium (60%), or small (40%) width with 4:3 aspect ratio
* **Embedded Placement**: Top, center, or bottom positioning for embedded widgets
* **Theme Integration**: Seamless integration with any WordPress theme

= Privacy & Security =

This plugin is designed with privacy and security in mind:

* **No Unauthorized Tracking**: Only tracks with explicit user consent
* **Local Asset Loading**: All assets are bundled locally (no external CDN dependencies)
* **No External Scripts**: All JavaScript and CSS files are included in the plugin
* **Secure Communication**: All API calls use HTTPS encryption
* **Data Minimization**: Only collects necessary information for functionality
* **GDPR Compliant**: Follows European data protection regulations
* **Opt-in Analytics**: Analytics tracking requires explicit user consent
* **No Third-party Dependencies**: No external libraries loaded from CDNs

= Service Integration =

This plugin integrates with the BetterCX service to provide AI-powered customer support. The service:

* Processes chat messages to provide intelligent responses
* Stores conversation history for context
* Provides analytics and insights
* Offers enterprise-grade security and reliability

**Service Terms and Privacy:**
* Service Provider: BetterCX Inc.
* Service URL: https://bettercx.ai
* Terms of Service: https://bettercx.ai/terms
* Privacy Policy: https://bettercx.ai/privacy
* Data Processing: All data processing occurs on BetterCX servers
* Data Retention: As per BetterCX privacy policy
* User Rights: Users can request data deletion and opt-out of tracking

**Important:** This plugin requires a BetterCX account and API key to function. The plugin is free, but the BetterCX service may have usage limits or pricing tiers.

For more information about the BetterCX service, visit [bettercx.ai](https://bettercx.ai).

== External Services ==

This plugin uses the following external services:

= BetterCX API Service =

**What it is:** AI-powered customer support service that processes chat messages and provides intelligent responses.

**What data is sent:**
* Chat messages sent through the widget
* Session information for authentication
* Website origin for security validation

**When data is sent:**
* When a user sends a message through the chat widget
* When the widget initializes and creates a session
* When the widget needs to authenticate with the service

**Service Provider:** BetterCX Inc.
**Terms of Service:** https://bettercx.ai/terms
**Privacy Policy:** https://bettercx.ai/privacy

= Google Translate API (Optional) =

**What it is:** Language detection service used to automatically detect the website's language for proper widget localization.

**What data is sent:**
* Sample text from the website (first 1000 characters)
* Only sent when automatic language detection is enabled

**When data is sent:**
* Only when the widget needs to detect the website's language
* Only if the language cannot be determined from HTML meta tags or browser settings

**Service Provider:** Google LLC
**Terms of Service:** https://policies.google.com/terms
**Privacy Policy:** https://policies.google.com/privacy

**Note:** This service is optional and only used for language detection. The widget will fall back to English if the service is unavailable or if the user has disabled this feature.

**Important:** The Google Translate API usage is implemented in the compiled JavaScript files (`/assets/p-*.js`) and is only called when automatic language detection is enabled. The source code for this functionality is available in `/src/services/theme.service.ts` in the `detectLanguageWithGoogleTranslate()` method.

== Installation ==

= Automatic Installation =

1. Log in to your WordPress admin dashboard
2. Navigate to Plugins > Add New
3. Search for "BetterCX Widget"
4. Click "Install Now" and then "Activate"
5. Go to Settings > BetterCX Widget to configure

= Manual Installation =

1. Download the plugin files
2. Upload the `bettercx-widget` folder to `/wp-content/plugins/`
3. Activate the plugin through the 'Plugins' menu in WordPress
4. Go to Settings > BetterCX Widget to configure

= Configuration =

1. **Get Your Public Key**: Sign up at [bettercx.ai](https://bettercx.ai) and get your widget public key
2. **Enter Your Key**: Go to Settings > BetterCX Widget and enter your public key
3. **Customize Appearance**: Choose theme, position, and other visual options
4. **Test Connection**: Use the "Test Connection" button to verify your setup
5. **Deploy**: The widget will automatically appear on your site

== Frequently Asked Questions ==

= How do I get started? =

1. Install and activate the plugin
2. Get your public key from the BetterCX dashboard
3. Enter the key in the plugin settings
4. Customize the appearance to match your brand
5. The widget will automatically appear on your site

= Is this plugin free? =

Yes, the plugin is completely free to use. BetterCX offers various pricing plans for the AI-powered backend services, but the WordPress plugin itself is free and open source.

= What data does the plugin collect? =

The plugin only collects:
* Messages sent through the chat widget (for AI responses)
* Session information (for authentication)
* Basic usage analytics (with user consent)

No personal information is collected without explicit consent.

= Can I customize the appearance? =

Yes! The plugin offers extensive customization options:
* Light, dark, or automatic theme detection
* Left or right positioning
* Custom CSS support
* Brand color customization
* Custom widget titles
* Image upload and sharing capabilities
* Optional "Powered by BetterCX" attribution display

= Does it work on mobile devices? =

Absolutely! The widget is fully responsive and optimized for:
* Desktop computers
* Tablets
* Mobile phones
* All screen sizes and orientations

= Can I use it with any WordPress theme? =

Yes, the plugin is designed to work with any WordPress theme. It uses modern web standards and doesn't interfere with your theme's styling.

= Is it compatible with page builders? =

Yes, the plugin works with all major page builders including:
* Elementor
* Gutenberg
* Beaver Builder
* Divi
* Visual Composer
* And many more

= How do I track widget interactions? =

The plugin provides several ways to track interactions:
* WordPress action hooks
* JavaScript event listeners
* Google Analytics integration (optional)
* Custom event handlers

= Can I disable the widget on certain pages? =

Yes, you can:
* Disable globally in settings
* Use shortcode attributes to control individual instances
* Use WordPress conditional tags in your theme
* Exclude specific pages or post types

= Is the plugin secure? =

Yes, the plugin follows WordPress security best practices:
* Input sanitization and validation
* Output escaping
* Nonce verification for forms
* Capability checks for admin functions
* No external script loading without consent

= What if I need help? =

We provide comprehensive support:
* Plugin documentation
* WordPress.org support forums
* BetterCX support center
* Email support for premium users

== Screenshots ==

1. **Admin Settings Page** - Clean, intuitive settings interface
2. **Widget on Website** - Professional chat widget in action
3. **Mobile View** - Responsive design on mobile devices
4. **Customization Options** - Theme and appearance settings
5. **Event Tracking** - Analytics and monitoring features

== Changelog ==

= 1.0.20 =
* Fixed spinner animation in send button - spinner now properly animates during message sending/generation
* Fixed avatar display in typing indicator (3 dots animation) on fullscreen/embedded mode
* Improved delay status message positioning across all embedded mode combinations (medium, small, top, center, bottom)
* Enhanced message layout with proper flex direction for avatar and content alignment

= 1.0.19 =
* Added delay message display when waiting for AI response (after 5 seconds)
* Delay message shows "Connecting to assistant" for first-time users and "Thinking..." for returning users
* Delay message includes animated dots and disappears when streaming starts
* Improved user experience during message processing with visual feedback
* Users can now type and add attachments while message is being sent/generated
* Fixed spinner animation in send button during message processing

= 1.0.18 =
* Updated AI service URL to new endpoint

= 1.0.17 =
* Fixed z-index value - increased to higher value to ensure widget appears above all other page elements

= 1.0.16 =
* New option: `isAttachmentsDisabled` to hide image upload in composer while keeping send button aligned to the right
* Ping/trigger message text now keeps full words together (no hyphen breaks) for better readability
* Updated type definitions and wrappers (React/WordPress) to pass the new prop
* Documentation refresh for the new toggle

= 1.0.15 =

= 1.0.13 =
* Unified horizontal spacing for messages and composer - padding and margin now perfectly aligned across all modes
* Fixed chat list overlay positioning and sizing in embedded mode (medium/small) to match chat view exactly
* Unified mobile styles for embedded and non-embedded modes using shared selectors for consistent behavior
* Added border: none for chat and chat list overlay on fullscreen and mobile for seamless appearance
* Improved chat list component styling on mobile/fullscreen to eliminate visible gaps and ensure full coverage
* Enhanced embedded mode consistency - chat list overlay now matches chat view position and size in all contexts

= 1.0.12 =
* Removed 'large' size option from embedded mode - now supports only full, medium, and small sizes
* Fixed embedded mode behavior on mobile devices to match non-embedded chat experience
* Improved mobile viewport handling for embedded widgets with proper keyboard support
* Enhanced visual viewport integration for better mobile responsiveness
* Fixed safe area padding and animations for embedded mode on mobile

= 1.0.11 =
* Added embedded size configuration (full, medium, small) with 4:3 aspect ratio
* Added embedded placement options (top, center, bottom) for flexible positioning
* Enhanced embedded mode with responsive sizing - mobile always uses full screen
* Improved widget layout in embedded mode with proper flexbox implementation
* Fixed content overflow issues in embedded widgets
* Enhanced admin panel with embedded size and placement settings
* Updated shortcode support for embedded_size and embedded_placement attributes
* Improved widget rendering in embedded contexts with better viewport handling

= 1.0.10 =
* Fixed duplicate trigger message content issue
* Improved trigger message handling to prevent content duplication
* Enhanced message display reliability

= 1.0.9 =
* Added "Logged-in Users Only" option to restrict widget visibility to authenticated WordPress users
* Enhanced security with WordPress native authentication check using is_user_logged_in()
* Optimized performance - scripts and styles only load for logged-in users when option is enabled
* Perfect for member-only sites and applications with WordPress authentication
* Works with both standard wp-login.php and custom login forms

= 1.0.8 =
* Fixed mobile keyboard handling with visualViewport API for perfect input behavior
* Improved mobile UX - input now properly scrolls up when keyboard appears
* Enhanced viewport handling for both embedded and non-embedded modes
* Fixed chat jumping issues on mobile devices when focusing input
* Optimized mobile experience to match world-class web chat applications

= 1.0.7 =
* Added support for language prop (auto, pl, en) with automatic detection
* Added support for embedded mode prop for iframe/embedded contexts
* Updated all widget props to match latest Stencil component implementation
* Enhanced admin panel with language and embedded mode settings
* Improved widget configuration and prop handling

= 1.0.6 =
* Added support for multiple trigger messages with URL-based matching
* Trigger messages now automatically selected based on current page URL
* Improved default message handling - only displays on matching website origins
* Fixed ping message close button click reliability on desktop and mobile
* Removed rotation animation from close button for cleaner interaction
* Enhanced touch event handling for better mobile responsiveness
* Improved event propagation to prevent click blocking issues
* Simplified close button styling for better accessibility

= 1.0.5 =
* Added product parser with markdown-style product link parsing: [![Product Name](image_url)](product_url)
* Products now parsed from streaming content and displayed in interactive slider
* Fixed mobile touch event handling to distinguish clicks from swipes
* Improved newline cleanup after product removal - maintains proper text formatting
* Products are now clickable on mobile devices
* Enhanced newline removal logic to preserve intentional paragraph breaks

= 1.0.4 =
* Added product slider component with streaming support
* Support for single and multiple product display with navigation dots
* Implement touch and mouse drag interactions for mobile and desktop
* Add internationalization support (EN/PL) for 'View Product' text
* Display products only after streaming finishes to prevent premature rendering
* Polish UI/UX with professional styling consistent with widget theme
* Add Product interface to API types
* Update ChatMessage interface to include products array and streamingFinished flag
* Remove all debugging console logs for production readiness
* Fix message creation timing to only create assistant message when first text chunk arrives

= 1.0.3 =
* Enhanced link parsing functionality in chat messages
* Added support for markdown-style links: [text](url)
* Improved language detection with better English/Polish balance
* Fixed widget styling conflicts with PrestaShop themes
* Enhanced security and form submission handling
* Updated default configuration values for better local testing

= 1.0.2 =
* Fixed mobile click blocking issue
* Widget now only covers full screen when chat is open on mobile devices
* Users can now click other elements on mobile when chat is closed
* Maintains full-screen chat experience when opened
* Improved mobile user experience

= 1.0.1 =
* Added customizable widget title support
* Added "Powered by BetterCX" attribution toggle
* Added image upload and sharing capabilities
* Enhanced customization options
* Updated documentation and examples

= 1.0.0 =
* Initial release
* Full WordPress integration
* Shortcode and widget support
* Admin settings interface
* Mobile responsive design
* Event tracking and analytics
* Custom CSS support
* Privacy policy integration
* GPLv2+ licensing
* WordPress coding standards compliance

== Upgrade Notice ==

= 1.0.20 =
Update: Fixed spinner animation in send button and improved avatar display in typing indicator. Enhanced delay status message positioning across all embedded modes for better visual consistency.

= 1.0.19 =
Update: Enhanced user experience with delay message display during AI response processing. Users can now type and add attachments while messages are being sent. Improved visual feedback with animated status messages and fixed spinner animation.

= 1.0.18 =
Update: Updated AI service URL to new endpoint for improved service reliability and performance.

= 1.0.17 =
Update: Fixed z-index value to ensure widget appears above all other page elements for better visibility and user experience.

= 1.0.16 =
Update: Added `isAttachmentsDisabled` to hide image uploads while keeping the send button aligned right, improved ping message word wrapping (no hyphen breaks), and refreshed wrappers/types to support the new toggle.

= 1.0.15 =

= 1.0.13 =
Update: Unified spacing system ensures perfect alignment between messages and composer. Fixed chat list overlay to match chat view exactly in all modes. Improved mobile consistency with shared styles for embedded and non-embedded modes. Enhanced visual polish with seamless borders on fullscreen.

= 1.0.12 =
Update: Removed 'large' size option from embedded mode. Improved embedded widget behavior on mobile devices to match standard chat experience with proper keyboard handling and viewport support.

= 1.0.11 =
New feature: Added embedded size and placement options for flexible widget positioning. Configure widget size (full, medium, small) and vertical placement (top, center, bottom) in Advanced Settings. Mobile devices always use full screen for optimal UX.

= 1.0.10 =
Bug fix: Fixed duplicate trigger message content issue. Improved message handling for better reliability.

= 1.0.9 =
New feature: Added "Logged-in Users Only" option in Advanced Settings. Perfect for member-only sites - widget will only display to authenticated WordPress users. Optimized for performance with early script loading prevention.

= 1.0.8 =
Important mobile fix: Enhanced mobile keyboard handling for perfect input behavior. Chat now properly adjusts when keyboard appears, providing smooth UX on all mobile devices.

= 1.0.7 =
Update: Added language and embedded mode support. All widget props now fully implemented and configurable through admin panel.

= 1.0.6 =
Important update: Enhanced trigger messages system with URL-based matching. Fixed mobile and desktop click issues on the ping message close button. Improved overall reliability and user experience.

= 1.0.5 =
Product parsing update: Added markdown-style product link parsing from streamed messages. Fixed mobile click issues and improved text formatting after product removal.

= 1.0.4 =
Major feature update: Added product slider component with streaming support, touch interactions, internationalization, and production-ready optimizations.

= 1.0.3 =
Enhanced functionality: Added link parsing, improved language detection, and better cross-platform compatibility. Enhanced security and styling fixes.

= 1.0.2 =
Important mobile fix: Resolves click blocking issue on mobile devices. Users can now interact with other website elements when chat is closed.

= 1.0.1 =
New features: customizable titles, image upload support, and attribution controls. Enhanced customization options for better brand integration.

= 1.0.0 =
Initial release of the BetterCX Widget plugin. Install to add AI-powered customer support to your WordPress site.

== Privacy Policy ==

This plugin integrates with the BetterCX service to provide AI-powered customer support. Here's what you need to know about privacy:

= Data Collection =

The plugin may collect the following information:
* Chat messages sent through the widget
* Session information for authentication
* Basic usage analytics (with user consent)

= Data Usage =

Collected data is used to:
* Provide AI-powered responses to customer inquiries
* Maintain conversation context
* Improve the service quality
* Generate analytics and insights

= Data Storage =

* Chat messages are stored securely on BetterCX servers
* Session data is stored temporarily for authentication
* No sensitive data is stored locally on your WordPress site

= User Rights =

Users have the right to:
* Access their data
* Request data deletion
* Opt out of analytics tracking
* Close the chat widget at any time

= Contact Information =

For privacy-related questions, contact:
* Email: privacy@bettercx.ai
* Website: [bettercx.ai/privacy](https://bettercx.ai/privacy)

== Service Terms ==

This plugin integrates with the BetterCX service. By using this plugin, you agree to:

* BetterCX Terms of Service: [bettercx.ai/terms](https://bettercx.ai/terms)
* BetterCX Privacy Policy: [bettercx.ai/privacy](https://bettercx.ai/privacy)
* WordPress.org Plugin Directory Guidelines

The BetterCX service is provided by BetterCX Inc. and is subject to their terms and conditions.

== Support ==

= Getting Help =

* **Plugin Documentation**: Check the plugin settings page for usage instructions
* **WordPress.org Forums**: Post questions in the plugin support forum
* **BetterCX Support**: Visit [bettercx.ai/support](https://bettercx.ai/support)
* **Email Support**: Contact office@appwave.dev

= Reporting Issues =

If you encounter any issues:
1. Check the plugin settings and configuration
2. Test with a default WordPress theme
3. Disable other plugins temporarily
4. Check the browser console for errors
5. Report the issue with detailed information

= Feature Requests =

We welcome feature requests! Please:
* Check if the feature already exists
* Describe the use case clearly
* Explain how it would benefit users
* Submit through our support channels

== Development ==

= Source Code =

This plugin includes human-readable source code in the `/src/` directory:
* TypeScript/React source files for the widget component
* SCSS source files for styling
* Service layer source code
* Type definitions
* Build configuration files

The source code is licensed under the MIT License (GPLv2+ compatible) and is provided to meet WordPress.org requirements for human-readable code.

**Source Code Location:** The complete source code is available in the `/src/` directory of this plugin, including:
- `/src/components/` - React/TypeScript components
- `/src/services/` - API and authentication services
- `/src/types/` - TypeScript type definitions
- `/src/utils/` - Utility functions
- `/src/global/` - Global styles

= Building =

To build the widget from source:
1. Navigate to the `/src/` directory
2. Run `npm install` to install dependencies
3. Run `npm run build` to build the widget
4. The built files will be output to the `assets/` directory

**Build Process:** The plugin uses Stencil.js build system to compile TypeScript/React source code into web components. The build process:
1. Compiles TypeScript source files from `/src/` directory
2. Bundles and minifies JavaScript/CSS assets
3. Outputs compiled files to `/assets/` directory
4. Generates multiple output formats (ES modules, SystemJS, UMD)

= Contributing =

This plugin is open source and welcomes contributions:
* Fork the repository
* Create a feature branch
* Follow WordPress coding standards
* Submit a pull request

= Code Standards =

The plugin follows:
* WordPress PHP Coding Standards
* WordPress JavaScript Coding Standards
* WordPress CSS Coding Standards
* PSR-12 coding standards where applicable

= Testing =

Before submitting changes:
* Test with multiple WordPress versions
* Test with different themes
* Test with other plugins
* Run PHP linting tools
* Test JavaScript functionality

== License ==

This plugin is licensed under the GPLv2 or later.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

== Credits ==

= Development Team =

* **BetterCX Team** - Plugin development and maintenance
* **WordPress Community** - Testing and feedback
* **Open Source Contributors** - Code improvements and bug fixes

= Third-Party Libraries =

This plugin uses the following open source libraries:
* BetterCX Widget (MIT License)
* WordPress Core APIs (GPLv2+)
* Modern JavaScript (ES6+)

= Acknowledgments =

Special thanks to:
* WordPress.org Plugin Directory team
* WordPress community contributors
* Beta testers and early adopters
* All users who provide feedback and suggestions

== Technical Details ==

= Requirements =

* WordPress 5.0 or higher
* PHP 7.4 or higher
* Modern web browser (Chrome 60+, Firefox 55+, Safari 12+, Edge 79+)
* HTTPS recommended for production use

= Performance =

* Lightweight and fast loading
* Optimized asset delivery
* Minimal database queries
* Efficient caching mechanisms

= Security =

* Input sanitization and validation
* Output escaping
* Nonce verification
* Capability checks
* Secure API communication

= Compatibility =

* WordPress 5.0 - 6.8+
* PHP 7.4 - 8.3+
* All major browsers
* Mobile and tablet devices
* Popular WordPress themes
* Major page builders

== Additional Information ==

= Plugin URI =
https://wordpress.org/plugins/bettercx-widget/

= Author URI =
https://bettercx.ai


= Tags =
chat, widget, customer support, ai, live chat, support, customer service, chatbot, bettercx, artificial intelligence, automation, help desk, customer experience

= Requires Plugins =
None

= Network =
No

= Multisite =
Yes, works with WordPress Multisite

= Export =
Yes, settings can be exported and imported

= Import =
Yes, settings can be imported from exported files

= Last Updated =
2025-01-09

= Version =
1.0.20

= Minimum WordPress Version =
5.0

= Tested WordPress Version =
6.8

= Minimum PHP Version =
7.4

= Tested PHP Version =
8.3

= Stable Tag =
1.0.20

= Development Version =
1.0.20

= Requires at least =
5.0

= Tested up to =
6.8

= Requires PHP =
7.4

= License =
GPLv2 or later

= License URI =
https://www.gnu.org/licenses/gpl-2.0.html

= Text Domain =
bettercx-widget

= Domain Path =
/languages

= Network =
false

= Update URI =
https://wordpress.org/plugins/bettercx-widget/
