=== LCE Chat ===
Contributors: lineacomercialestrategica, freemius
Tags: live chat, chat, customer support, woocommerce, support
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.16
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Live chat for your WordPress or WooCommerce site: talk to visitors in real time from a simple panel, with sound alerts and business hours.

== Description ==

LCE Chat adds a simple, modern chat window to your site so you can answer visitors in real time, right from your WordPress admin.

When a visitor writes, you get an alert you can't miss. The persistent alert keeps reminding you until you open each conversation, so no chat gets forgotten.

Your conversations stay in your own WordPress database. The free version of LCE Chat does not send your visitors' data to any third-party service.

**What you get for free**

* Chat window for visitors, with real-time replies and read receipts.
* Conversation panel with tabs: All, Pending, Answered, Archived and Trash.
* Search across the full history of messages.
* Persistent alert: blinking tab, counter banner, sound and browser notification, repeated until you open the chat.
* Notification settings: browser sound, MP3 sound, tab blinking and side counter, plus a test sound button.
* Quick replies: save the answers you use most, paste them with one click or type / to search them.
* Business hours, with an out-of-hours form for visitors.
* Up to 5 advisors, each with a name and photo. Choose the advisor on duty with one click; they are shown at the top of the chat.
* Button position (corners, centered bar or floating round icon), show/hide option, and colors for the header and the Send button.
* See which page or product the visitor is looking at.
* Visitor country with flag, detected on your own server from a database bundled with the plugin (no external lookups).
* Human check in the browser: page visits are only reported after a real interaction, so bots and crawlers rarely reach your data.

**LCE Chat Pro**

* Two-way Telegram integration: get alerts and reply from your phone. Messages are relayed through Telegram.
* File attachments (JPG, PNG, WebP and PDF).
* Statistics panel: conversations and messages per day, response time, busiest hours, most visited products and pages, abandoned carts and rejected visits.
* Server-side bot filter, with a counter of the visits it rejects.
* Quick reply variables, such as the visitor's name, the advisor on duty and your site name.
* Abandoned cart reminders, sent only with the customer's consent.

You can try LCE Chat Pro free for 14 days, with no credit card, from the plugin settings or from the Plugins screen.

Learn more about LCE Chat Pro at https://lineacomercialestrategica.com/lce-chat/.

== Installation ==

The plugin screens are currently in Spanish; the Spanish menu names are shown in brackets.

1. Upload the `lce-chat` folder to the `/wp-content/plugins/` directory, or install the plugin from the Plugins screen in WordPress.
2. Activate the plugin through the Plugins screen.
3. Go to LCE Chat > Ajustes (Settings) to choose the button position, colors and notification options.
4. Go to LCE Chat > Asesores (Advisors) to add the name and photo of your advisors.
5. Open LCE Chat > Conversaciones (Conversations) and keep it open (or any admin page) to receive alerts.

== Frequently Asked Questions ==

= Do I need WooCommerce? =

No. On WooCommerce stores, LCE Chat can also show you the product the visitor is looking at.

= In which language is the plugin interface? =

The admin panel and the visitor chat are currently in Spanish. The plugin is built for the Spanish-speaking market, so the readme is in English for the plugin directory, but the interface texts are in Spanish.

= Why don't I hear the alert sound? =

Browsers block sound until you click somewhere on the page. Click once inside the admin panel, and make sure browser notifications are allowed for your site.

= Does the persistent alert work with the browser closed? =

No. It needs the browser open. To get alerts on your phone, use the Telegram integration in LCE Chat Pro.

= Can I try LCE Chat Pro before buying it? =

Yes. Use the "Probar avanzado" (Try advanced) button in LCE Chat > Ajustes (Settings), or the "Probar avanzado" link in the Plugins screen. The trial lasts 14 days and does not ask for a credit card.

= Why don't I see the visitor's country? =

The country is worked out on your own server from the visitor's IP address, using a country database bundled with the plugin. The IP address is never sent to any third-party service, and you don't need to configure anything. Some addresses (private networks, local development, or ranges missing from the database) have no country, so the chat is shown without one. Country detection is approximate: VPNs, proxies and mobile data can show a different country. Only the country is shown, never the city or region. The database is a snapshot and is refreshed with plugin updates.

= Can I use my own GeoIP database? =

Yes. Developers can return a two-letter country code (for example `CO`) from the `gudy_chat_codigo_pais_ip` filter. If the code is valid, it is used instead of the bundled database.

= Does it work with caching plugins? =

Yes. Purge your cache after changing the advisor, the button position or the colors, so visitors see the changes right away.

= What happens to my data if I delete the plugin? =

The plugin's settings and chat tables are removed from your database. To keep them, add `define( 'GUDY_CHAT_CONSERVAR_DATOS', true );` to your `wp-config.php` before deleting the plugin.

== Privacy ==

LCE Chat stores the chat messages and, when available, the visitor's name, IP address, country and the page being viewed, in custom tables of your WordPress database. If a visitor uses the out-of-hours form, the contact details they type (name, WhatsApp number, email and message) are stored the same way. The data stays on your site.

The country is calculated locally from the IP address, using a database bundled with the plugin. The IP address is not sent anywhere to do this.

To keep a visitor's conversation together, the plugin assigns a random session identifier and stores it in the visitor's browser: in the browser's local storage (`gudy_chat_id`) and, in some cases, in a cookie named `gudy_session_id` (set by the server when a visitor sends a message or the out-of-hours form without an existing identifier, valid for up to one year).

The browser's local storage is also used to remember the sound volume and mute choice, and the last rendered conversation, so the chat loads faster. The browser's session storage (per tab) holds two small flags: one remembers that the tab already showed a real person, to filter out bots, and the other avoids reporting the same page twice in a few seconds. None of these values leave the visitor's browser except the session identifier, which is sent to your own site.

If you use the Telegram integration (LCE Chat Pro), the chat messages and attachments you choose to relay are sent to Telegram, which processes them under its own terms. The free version does not do this.

You are responsible for informing your visitors and for having a privacy policy that covers this processing.

== External services ==

**Freemius**

This plugin uses the Freemius SDK to handle licensing, updates, the optional Pro trial and, only if you opt in, usage data. If you accept the opt-in, or if you start the Pro trial, Freemius receives basic information such as your site URL, WordPress and plugin versions, and the admin email. If you skip it and do not start the trial, nothing is sent.

* Terms of service: https://freemius.com/terms/
* Privacy policy: https://freemius.com/privacy/

**Telegram (LCE Chat Pro only)**

The Telegram integration, available only in LCE Chat Pro, sends the chat messages and attachments from your visitors to the Telegram bot you configure, so you can receive alerts and reply from your phone. It is off unless you turn it on.

* Terms of service: https://telegram.org/tos
* Privacy policy: https://telegram.org/privacy

The free version of LCE Chat does not connect to any other external service. In particular, visitor IP addresses are not sent to any geolocation service.

**Bundled data (no external connection)**

* Country detection uses the files `assets/geo/paises-ip-v4.txt` and `assets/geo/paises-ip-v6.txt`, built from the "user-country" data of the ip-location-db project (https://github.com/sapics/ip-location-db), published under the Public Domain Dedication and License v1.0 (PDDL).
* Country names come from the Unicode CLDR (https://cldr.unicode.org/), distributed under the Unicode License.

== Changelog ==

= 1.0.16 =
* New: buttons to start the free 14-day trial of LCE Chat Pro, in the plugin settings and in the Plugins screen.

= 1.0.15 =
* All 5 advisors are now included in the free version.

= 1.0.14 =
* Security and compatibility improvements.

= 1.0.13 =
* First release.