﻿=== Rakuten Viber Click to Chat ===
Contributors: rakutenviber
Tags: viber, click-to-chat, messaging, woocommerce, customer-support
Requires at least: 5.8
Requires PHP: 7.4
Tested up to: 7.0
Stable tag: 4.0.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Turn visitors into buyers with a one-tap Viber chat button. Effortless customer conversations for e-commerce stores and service providers alike.

== Description ==

**Every customer interaction is an opportunity.** Rakuten Viber Click to Chat makes it effortless for customers to reach you, helping you build deeper connections and drive business growth — turning website visitors into buyers.

The plugin adds a Viber chat button to your site so visitors can start a conversation with you in one tap. It's perfect for e-commerce stores and service providers.

= Requirements =

**A free Viber Business account is required for the button to work.** It's built into your existing Viber app — no separate app or new phone number needed. Create one by opening this link on your mobile device: `viber://business/create?smb_utm_campaign=ACQ_wordpress_plugin`

Note: If you are using the multi-agent feature, each one of the phone numbers is required to have its own business account, otherwise the link won't work.

= Features =

* **Floating Chat Button** – Eye-catching floating button with pulse animation that appears on every page
* **WooCommerce Integration** – Display dedicated Viber buttons on product pages for customer inquiries
* **Multi-Agent Routing** – Assign different Viber contacts for different pages and sections
* **Gutenberg Block Support** – Native WordPress block editor integration for inline chat buttons
* **Elementor Widget** – Full Elementor page builder support with drag-and-drop configuration
* **Customizable Design** – Adjust button size (small/medium/large), alignment, and messaging
* **Pre-filled Messages** – Set custom messages that populate when users click the button
* **Privacy-First** – No external API calls, GDPR compliant, server-side locale detection
* **Accessibility** – Full WCAG compliance with aria-labels, focus states, and motion preferences
* **Multi-language Ready** – Complete internationalization support for global audiences

= Use Cases =

* Customer support chat for e-commerce stores
* Product inquiry buttons on specific WooCommerce items
* Sales team direct messaging links
* Customer service channels on contact pages
* Multi-agent support routing by department

== Installation ==

1. Go to **Plugins → Add New** in your WordPress admin
2. Search for "Rakuten Viber Click to Chat"
3. Click **Install Now** and then **Activate**
4. Navigate to **Settings → Viber Click to Chat** to configure:
   - Your Viber contact number
   - Floating button visibility and message
   - WooCommerce product page settings
5. Use the **Gutenberg block** (search "Viber Chat Button") or **Elementor widget** to add inline buttons

= Configuration Guide =

**General Settings:**
- **Viber Account Number** – Your Viber phone number for receiving chats (required)
- **Floating Button Enabled** – Show/hide the persistent floating button
- **Floating Button Message** – Pre-filled message when users click (supports {url}, {title}, {product_name}, {price} variables)
- **Button Size** – Choose small (52px), medium (60px), or large (78px)
- **Show on Mobile** – Control floating button visibility on mobile devices
- **Show on Desktop** – Control floating button visibility on desktop devices

**WooCommerce Integration:**
- **Enable for Products** – Add a Viber button to product pages
- **Position** – Choose where the button appears (before or after add-to-cart form)
- **Product Message** – Custom message for product inquiries (auto-includes product name and price)

**Gutenberg Blocks:**
Use the native "Viber Chat Button" block in the block editor:
- Set custom button text
- Customize pre-filled message
- Align left, center, or right

**Elementor:**
Add the "Viber Chat Button" widget from the widgets panel:
- Configure button text and message in the inspector
- Adjust alignment and styling with Elementor controls

== Message Variables ==

Pre-filled messages support these variables:
- `{url}` – Current page URL
- `{title}` – Current page title
- `{product_name}` – WooCommerce product name (product pages only)
- `{price}` – WooCommerce product price (product pages only)

Example: "Hi, I'm interested in {product_name} ({price}). Can you help?"

== Privacy & GDPR ==

This plugin is fully GDPR compliant:
- **No external requests** – All functionality is server-side
- **No IP tracking** – Uses server-side locale detection only
- **No cookies** – Viber links open via standard URL parameters
- **No analytics** – No tracking of user behavior or interactions
- **User control** – Visitors can disable JavaScript to prevent button display

== Accessibility ==

Full WCAG 2.1 compliance:
- Semantic HTML with proper aria-labels
- Keyboard navigation support
- Focus indicators for all interactive elements
- Respects `prefers-reduced-motion` for users with motion sensitivities
- Tested with screen readers and accessibility validators

== Frequently Asked Questions ==

= Do I need a Viber Business account? =
Yes! You don't need a separate app or a new phone number. A Viber Business account is a free enhancement built right into your existing Viber account.

We require this because the click-to-chat button uses a dedicated business routing link (viber.me). If you skip this step, the link won't be able to connect customers to your chat.

Create a free Viber Business account by opening this link on your mobile device: `viber://business/create?smb_utm_campaign=ACQ_wordpress_plugin`

= How do I add a Viber button to a specific page? =
Use the "Viber Chat Button" Gutenberg block in the page editor. You can set custom text and messages for each button.

= Can I use multiple Viber contacts? =
Currently, the plugin supports one primary Viber account. To use different contacts, add multiple inline buttons using the Gutenberg block with different pre-filled messages.

= What happens if a user clicks the button? =
The button opens Viber (if installed on the user's device) or the Viber web app, with the chat window pre-populated with your customized message. If Viber isn't installed, the user can install it first.

= Will the button work on mobile devices? =
Yes! The plugin detects mobile devices and opens the native Viber app. You can control mobile/desktop visibility independently in settings.

= Does this plugin track user data? =
No. The plugin does not track, store, or send any user data. It simply provides a link to start a Viber conversation. No analytics or cookies are used.

= Is the plugin compatible with my theme? =
Yes. The plugin uses standard WordPress hooks and CSS, and works with any properly coded theme. If you experience styling issues, contact your theme developer.

= Can I customize the button appearance? =
You can adjust size (52px, 60px, 78px), enable/disable animations, and customize alignment. For advanced styling, use custom CSS in your theme.

= Does this work with WooCommerce? =
Yes! The plugin includes native WooCommerce integration. Enable it in settings to add Viber buttons to product pages.

= How do I use the block editor? =
Search for "Viber Chat Button" in the block editor's block inserter. Set your custom text and message, then adjust alignment.

= What about Elementor users? =
The plugin includes a full Elementor widget. Add it from the widgets panel and configure it like any other Elementor element.

= What server languages are supported? =
The plugin automatically detects your WordPress site's language and uses server-side locale information. Full translation support for multilingual sites.

== Screenshots ==

1. **Floating Chat Button** – Purple button with Viber logo appearing on your site with pulse animation
2. **Admin Settings** – Easy-to-use settings panel for configuring Viber contact and display options

== Changelog ==

= 4.0.1 =
* Fixed: Settings page JavaScript was not loading, which broke message-tag insertion, the multi-agent add/remove controls, the advanced agents toggle, and live phone-number validation.
* Added: WooCommerce {product_name} and {price} message variables, resolved on product pages, with HTML-entity decoding so chat drafts are clean plain text.
* Added: {product_name} and {price} insert buttons on the settings page.
* Changed: Inline shortcode button icon size increased to 60px.
* Changed: Refreshed the Viber Business account notice on the settings page, including create-account links for web and the Viber mobile app.
* Changed: Updated the default pre-filled message wording.

= 4.0.0 =
* Complete security and compatibility audit
* Enhanced GDPR compliance with server-side locale detection
* Improved accessibility with WCAG 2.1 compliance
* Fixed CSS injection vulnerability with strict validation
* Added WooCommerce hook whitelist for security
* Optimized animation performance with prefers-reduced-motion support
* Updated widget sizing (small: 52px, medium: 60px, large: 78px)
* Improved Gutenberg block usability
* Enhanced Elementor widget integration
* Added comprehensive internationalization support

= 3.5.0 =
* Added Elementor widget support
* Improved animation performance
* Enhanced mobile responsiveness
* Bug fixes and stability improvements

= 3.0.0 =
* Initial Gutenberg block support
* Added WooCommerce integration
* Introduced floating button feature
* Basic settings page

== Support ==

For questions, feature requests, or bug reports, please visit the [plugin support page](https://wordpress.org/support/plugin/rakuten-viber-click-to-chat/).

You can also reach out to **Viber Support** for help with your Viber Business account, questions, or to report issues: [help.viber.com](https://help.viber.com/hc/en-us).

== License ==

This plugin is licensed under the GPL-2.0-or-later license. See LICENSE file for details.

== Contributing ==

Contributions are welcome! Please submit pull requests or feature suggestions through the official WordPress plugin repository.
