=== OfferNudge ===
Contributors: goowin
Tags: woocommerce, offers, whatsapp, analytics, conversion
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 2.3.0
License: GPLv2 or later

Personalized offers for returning visitors, with a 30-day trial, annual licensing, and private updates.

== Description ==

OfferNudge counts valid visits per browser and product, resolves configurable discount rules, and presents an accessible Bottom Sheet backed by a real WooCommerce coupon. Customers can copy the code, buy online with automatic application, or request the offer through WhatsApp.

Version 2.3.0 adds a complete trial-to-paid path with an annual-license checkout CTA, local trial results, expiration notices, preserved read-only Analytics, and existing license-key activation.

This is a private commercial distribution and requires the provider's production public key.

== Installation ==

1. Confirm that WordPress 6.4+, PHP 8.0+ with Sodium, and WooCommerce 8.0+ are available. Back up the site before updating an existing installation.
2. In WordPress, open Plugins > Add Plugin > Upload Plugin, choose `offernudge-2.3.0.zip`, and select Install Now. If WordPress detects an older OfferNudge version, approve replacing it; settings and statistics are preserved.
3. Activate OfferNudge. Installation alone does not start the trial and does not send site information to offernudge.com.
4. Open OfferNudge > License. Read the data-transfer notice, select the consent checkbox, and choose Start free trial. No payment method is required. The 30 days begin only after successful registration.
5. Open OfferNudge > Settings > General. Choose English, Español, or Automatic, then review the visit threshold and offer behavior.
6. Under Rules, choose the default discount and any category or product exclusions. Products already on sale are excluded automatically.
7. Under WhatsApp, enter the international number with country code and no `+`, spaces, or punctuation, then review the default message.
8. Under Design, customize the offer text, colors, logo, and buttons. Save the settings.
9. Test on a staging product: visit it three valid times using the configured interval, open the offer, copy the coupon, and verify the online cart/checkout and WhatsApp link. Do not complete a real WhatsApp message unless intended.
10. To purchase later, use the secure checkout link on OfferNudge > License. Return with the emailed key, read and accept the activation notice, enter the key, and select Activate license.

== Instalación en español ==

1. Confirma que el sitio tenga WordPress 6.4 o posterior, PHP 8.0 o posterior con Sodium y WooCommerce 8.0 o posterior. Haz una copia de seguridad antes de actualizar una instalación existente.
2. En WordPress, abre Plugins > Añadir plugin > Subir plugin, selecciona `offernudge-2.3.0.zip` y pulsa Instalar ahora. Si WordPress detecta una versión anterior de OfferNudge, autoriza reemplazarla; la configuración y las estadísticas se conservan.
3. Activa OfferNudge. Instalar o activar el plugin no inicia la prueba ni envía información del sitio a offernudge.com.
4. Abre OfferNudge > Licencia. Lee el aviso de transferencia de datos, marca la casilla de consentimiento y pulsa Iniciar prueba gratuita. No se requiere medio de pago. Los 30 días empiezan únicamente cuando el registro se completa correctamente.
5. Abre OfferNudge > Configuración > General. Elige English, Español o Automático y revisa el número de visitas y el comportamiento de las ofertas.
6. En Reglas, define el descuento predeterminado y las exclusiones por categoría o producto. Los productos que ya están en oferta se excluyen automáticamente.
7. En WhatsApp, escribe el número internacional con código de país, sin `+`, espacios ni signos, y revisa el mensaje predeterminado.
8. En Diseño, personaliza los textos, colores, logotipo y botones de la oferta. Guarda la configuración.
9. Prueba el funcionamiento en un producto de pruebas: visítalo tres veces válidas respetando el intervalo configurado, abre la oferta, copia el cupón y verifica el carrito o checkout y el enlace de WhatsApp. No envíes un mensaje real salvo que sea tu intención.
10. Si decides comprar, utiliza el enlace seguro de OfferNudge > Licencia. Regresa con la clave recibida por correo, lee y acepta el aviso de activación, introduce la clave y pulsa Activar licencia.

== Frequently Asked Questions ==

= When does the trial begin? =

When an administrator explicitly accepts the disclosed data transfer and the server successfully registers the installation. It lasts exactly 30 days; reinstalling or changing the local UUID does not restart the trial for the same site.

= What happens when access expires? =

Visit counting, offers, the Bottom Sheet, and promotional messages stop. The admin remains available in read-only mode and all data is preserved.

= How do languages work? =

Choose English, Español, or Automatic under OfferNudge > Settings > General. English is the default for new installations. Automatic follows the WordPress Site Language: every `es_*` locale uses the bundled common Spanish catalog and every other locale falls back to English. Existing installations updating from 2.1.1 start in Automatic mode.

= Does the frontend contact the license server? =

No. Validation uses WP-Cron or controlled administrative actions with a short timeout.

= Is everything deleted on uninstall? =

Not by default. Full removal must be enabled explicitly before uninstalling.

= Which products support automatic checkout? =

Simple and variable products. Variable products require a selected variation and preserve its attributes. Other types retain manual code copy and WhatsApp.

= Does the coupon stack with sales or other coupons? =

No. The coupon is individual-use, excludes sale items, discounts one unit, and works only for the product that generated the OfferNudge promotion.

== Privacy Notices ==

Tracking stores an HMAC of a first-party identifier. Only after an administrator explicitly starts a trial or activates a license, licensing communicates the canonical URL, installation UUID, environment, technical versions, administrator email at trial registration, and the required credential. This validates licenses and authorizes updates; no hidden telemetry is included.

== Changelog ==

= 2.3.0 =
* Explicit consent before trial registration or license activation; no update or license-server request before consent.
* State-aware annual-license CTA for active, ending, and expired trials.
* Attribution-safe local trial results with strict multi-currency separation.
* Validated HTTPS checkout URL containing only static product and quantity parameters.
* Existing settings, offers, coupons, metadata, and Analytics remain intact through activation.
* English and Spanish purchase guidance and regression coverage.

= 2.2.2 =
* Accept and normalize WooCommerce's empty or numeric-string variation IDs during add-to-cart validation.
* Preserve normal WooCommerce missing-variation handling outside the OfferNudge flow.

= 2.2.1 =
* Correct journey percentages, including 1 of 1 as 100%.
* One canonical journey classification for cards, recent conversions, and CSV exports.
* Reversed orders remain historical but stay outside active journey percentages.
* Zero-conversion products show an em dash; real unresolved order currencies remain pending.
* Reliable secret scanning with `rg`, a `grep` fallback, and explicit scan failures.

= 2.2.0 =
* Commercial impact KPIs with attribution-safe language and equivalent previous-period comparisons.
* Awareness, engagement, and conversion funnel with successful idempotent `code_copied` tracking.
* Accessible dependency-free SVG trend, conversion journeys, top products, and recent conversions.
* Strict multi-currency grouping with stored `order_currency` and resumable WooCommerce CRUD backfill.
* Protected filtered summary and conversion CSV exports without PII.
* Full English/Spanish/Automatic support through the existing OfferNudge language selector.

= 2.1.2 =
* Independent OfferNudge language selector with `en`, `es`, and Site Language-based `auto` modes.
* Non-destructive migration: new installations default to English and existing 2.1.1 settings default to Automatic.
* Bidirectional localized defaults that preserve customized admin content.
* Nonce- and capability-protected restoration of only configurable OfferNudge texts.
* Regression coverage for admin, License, preview, Bottom Sheet, floating tab, WhatsApp, AJAX strings, and repeated language switching.

= 2.1.1 =
* Friendly, accessible license status card with signed expiration and remaining trial days.
* English source language plus automatic common Spanish catalog for every `es_*` locale.
* OfferNudge branding across visible admin, frontend, notices, previews, and documentation.
* Safe server-side price normalization for new and existing promotions.
* `{site_name}` WhatsApp default with exact legacy-template migration and UTF-8 preservation.
* Floating tab receives scoped color and typography custom properties.

= 2.1.0 =
* Real one-use, one-unit WooCommerce coupons with OfferNudge codes.
* Automatic online checkout for simple and variable products.
* Central sale-product blocking, HPOS order attribution, and conversion metrics.
* Non-destructive 2.0.0 migration and active-promotion repair.

= 2.0.0 =
* Central license client with eight states and Ed25519 signatures.
* Remote 30-day trial, annual license, scheduled validation, and private updates.
* Read-only expiration behavior without deleting data.

= 1.1.0 =
* Product and category rules, accessible admin panel, analytics, and 1.0.0 compatibility.

= 1.0.0 =
* First complete version.
