=== Wawp Country Code & Chat Widget for WooCommerce ===
Contributors: 101Gen
Tags: country code, woocommerce phone, phone field, phone validation, intl tel input
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 6.0
WC tested up to: 9.8
Stable tag: 5.1.0
License: GPLv3 or later
License URI: https://opensource.org/licenses/GPL-3.0
Donate link: https://wawp.net/en/pricing

Country code selector with flags, auto-detection, phone number formatting, and interactive chat widget for WooCommerce.

== Description ==

**Wawp Country Code & Chat Widget for WooCommerce** provides a practical solution to add country flags, dial codes, and phone number validation to your WooCommerce checkout and forms.

Help customers enter valid phone numbers with an interactive phone input field featuring national flags, automatic country detection by IP, and standardized international formatting.

### 🌟 Key Features

#### 🌍 Country Code & Phone Validation
* **Interactive Country Flag Dropdown:** International telephone input with country flags and dial codes.
* **Auto-Detection:** Automatically detect the customer's country via IP or WooCommerce billing country to pre-select the dial code.
* **WooCommerce Checkout Integration:** Attaches to the Billing and Shipping Phone fields in Classic and WooCommerce Block checkouts.
* **Standardized Formatting:** Formats phone numbers using libphonenumber standards (E.164 and National formats).
* **Phone Validation:** Verifies phone number length and structure before submission.
* **Country Filtering:** Restrict or configure dropdown lists to display only the countries your store ships to.
* **Custom Field Selectors:** Bind international phone input to any custom CSS selector on your site.
* **RTL & LTR Support:** Responsive design with support for both Right-to-Left and Left-to-Right languages.

#### 💬 Floating Chat Widget
* **Multi-Agent Support:** Assign contact cards for Support, Sales, or Billing lines.
* **Custom Avatars & Starting Messages:** Set individual agent names, roles, avatars, and customized starting messages.
* **Social Channels:** Connect your Facebook, Instagram, Telegram, TikTok, LinkedIn, and YouTube profiles inside the widget.
* **QR Code Scanner:** QR code mapping for desktop traffic to scan with their phone and chat directly.
* **Display Conditions:** Control widget visibility based on device type (Desktop/Mobile) or targeted site pages.
* **Local Engagement Analytics:** Track impressions, widget opens, agent clicks, and social clicks locally without third-party tracking.
* **Fast & Optimized:** Clean code structure without redundant dependencies.
* **WAWP Ecosystem Integration:** Connect with the [WAWP Platform](https://wawp.net/) for order notifications, OTP verification, and marketing automations.

---

== Wawp PRO Features ==

Optionally upgrade to access additional workflow tools on [Wawp.net](https://wawp.net/):

* **Automated Order Notifications:** Send order updates for WooCommerce orders (New Order, Processing, Completed, Shipping updates, and custom statuses).
* **Abandoned Cart Recovery:** Send follow-up reminders to customers who leave checkout early.
* **Bulk Campaigns & Broadcasts:** Send updates to your customer list with rate-limit protection.
* **Cloud API Integration:** Connect to official cloud business messaging gateways.
* **SMS Integration:** Backup authentication channel utilizing phone tokens for OTP delivery.
* **Custom Order Statuses:** Manage and customize WooCommerce order statuses.
* **Multilingual Notifications:** Route notifications based on the customer's selected checkout language.
* **Message Assistant:** Template drafting and translation assistance.
* **HTML Email Templates:** Custom transactional email templates to match your store branding.

👉 [Check Out Our Pro Plans & Pricing](https://wawp.net/en/pricing)

---

== External Services ==

This plugin provides interactive communication tools and direct chat redirection:

= 1. WhatsApp (Direct Chat Interaction) =
* **Service:** WhatsApp Public Web & App URLs (api.whatsapp.com / web.whatsapp.com)
* **Purpose:** Enables the Chat Widget to redirect users to chat with your designated numbers upon user click.
* **Data Sent:** Recipient phone number and optional pre-filled message text. No data is sent automatically; redirection happens only upon direct user click.
* **Consent:** Granted when a visitor clicks the chat button.
* **Policies:** [WhatsApp Terms of Service](https://www.whatsapp.com/legal/terms-of-service/) | [WhatsApp Privacy Policy](https://www.whatsapp.com/legal/privacy-policy/)

= 2. Geolocation & Privacy =
* **Local Processing:** Geolocation is handled locally; no external IP-lookup services are contacted by this plugin.
* **Privacy:** This plugin does not track user behavior or send store data to external servers.
* **Dashboard Analytics:** Statistics (widget impressions, clicks) are stored locally in your site's database.
* **Assets:** Core CSS, JS, and icon assets are bundled locally.


== Source Code & Build Tools ==

This plugin uses modern open-source development tools (React, Vite, NPM, Composer) to build the administrative dashboard and handle libraries. To comply with WordPress.org guidelines regarding human-readable code:

1. **Dashboard Source Code (Included in Package):**
The complete, non-minified, human-readable source code for the administrative React dashboard is included directly within this plugin package under the `app/src/` directory:
- **Main Application Entry:** `app/src/main.tsx` and `app/src/App.tsx`
- **React Components & UI:** `app/src/components/` (including `PhoneFieldSettings.tsx`, `ChatWidgetSettings.tsx`, and Radix UI integrations)
- **State Management & Hooks:** `app/src/hooks/` and `app/src/lib/`
- **Build Configurations:** `app/package.json`, `app/vite.config.ts`, `app/tsconfig.json`
- **Build Instructions:** To compile the distribution assets in `app/dist/`, navigate to `app/` and run:
  `npm install`
  `npm run build`

2. **PHP Dependencies & Composer:**
- **Composer Configuration:** `composer.json` is included in the root directory specifying all project dependencies.

3. **Third-Party Libraries & Public Repositories:**
The following third-party libraries are included in compiled/minified form for runtime efficiency; their full uncompressed source code is publicly accessible at:
- **intl-tel-input & utils.js:** [intl-tel-input GitHub Repository](https://github.com/jackocnr/intl-tel-input) (Used for `assets/js/resources/intlTelInput.min.js` and `assets/js/resources/utils.js`)
- **libphonenumber-for-php:** [libphonenumber-for-php GitHub Repository](https://github.com/giggsey/libphonenumber-for-php) (Used in `vendor/giggsey/libphonenumber-for-php/`)
- **QRCode.js:** [qrcodejs GitHub Repository](https://github.com/davidshimjs/qrcodejs) (Used for `assets/js/resources/qrcode.js`)


== Installation ==

1. Install using the WordPress built-in Plugin installer, or extract the zip file and drop the contents into the `wp-content/plugins/` directory of your WordPress installation.
2. Activate the plugin through the **‘Plugins’** menu in WordPress.
3. Navigate to **WAWP** in the WordPress admin menu to configure your **Country Code** and **Chat Widget** settings.


== Frequently Asked Questions ==

**How do I enable the country code selector on WooCommerce checkout?**
Simply navigate to **WAWP > Country Code** and make sure the feature is enabled. It will automatically attach flags and validation to your WooCommerce checkout phone fields.

**Does it support WooCommerce Block Checkout?**
Yes! The plugin integrates with both WooCommerce Gutenberg Block Checkout and Classic Checkout.

**Can I add multiple numbers to the chat widget?**
Yes, you can add multiple support agents, each with their own name, role, avatar, and pre-filled message.

**Is any customer data sent to third parties?**
No. Geolocation detection, phone validation, and widget analytics are processed locally on your WordPress server.


== Screenshots ==

1. Country Code & Phone Validation Settings
2. Chat Widget Configuration & Live Preview
3. Multi-Agent Contact List Setup
4. Social Media Links Integration
5. Engagement Analytics Dashboard
6. WooCommerce Checkout Flag Dropdown


== Upgrade Notice ==

= 5.1.0 =
Compliance, security, and stability update: Updated naming conventions, included full human-readable source code and build instructions, hardened settings sanitization and REST API endpoints, resolved frontend initialization bug, and ensured full adherence to WordPress.org directory guidelines.


== Changelog ==

= Version: 5.1.0 – Date: 07-10-2026 =
- **Compliance:** Updated plugin display name to "Wawp Country Code & Chat Widget for WooCommerce" in compliance with WordPress.org trademark guidelines.
- **Compliance:** Refined description, feature lists, and external service notices to ensure strict adherence to directory standards.
- **Source Code & Open Source Compliance:** Included complete unminified source code (`app/src/`, `app/package.json`, `app/vite.config.ts`, `composer.json`) and documented build instructions in `readme.txt` per WordPress.org human-readable code guidelines.
- **Privacy & Security:** Replaced external emoji dependency with a lightweight Native Emoji Picker, eliminating all third-party CDN requests.
- **Security & Integrity:** Enhanced settings sanitization for `register_setting` handling nested country and phone field structures recursively.
- **Security:** Hardened REST API settings controller with an explicit allowlist for WooCommerce options modification.
- **Bug Fix:** Fixed fatal error during frontend script localization in `WAWP_CountryCode::add_frontend_global_vars()`.

= Version: 5.0.0 – Date: 03-10-2026 =
- **Major Overhaul:** Streamlined the plugin core to focus on Country Code & Phone Number validation and Chat Widget for WooCommerce and WordPress.
- **Enhancement:** International flag dropdown with auto-detection for WooCommerce checkout and registration forms.
- **Enhancement:** Multi-agent chat widget with custom avatars, pre-filled messages, and social media links.
- **Enhancement:** Enhanced RTL/LTR display and phone number normalization.
- **Optimization:** Cleaned up redundant legacy modules and dependencies for performance and security.

= Version: 4.8.7 – Date: 21-08-2026 =
- **Security:** Hardened token verification routines and security boundaries.
- **Optimization:** Performance optimizations and cleanup of deprecated routines.

= Version: 4.8.6 – Date: 29-06-2026 =
- **Fix:** Resolved a potential conflict during plugin activation and improved system checks.

= Version: 4.8.5 – Date: 20-06-2026 =
- **Optimization:** Code optimization and cleanup of deprecated helper methods.
- **Performance:** Improved admin asset loading and rendering performance.

= Version: 4.8.4 – Date: 14-06-2026 =
- **Optimization:** Core performance optimization and asset enqueuing improvements.

= Version: 4.8.3 – Date: 05-06-2026 =
- Tested up to WordPress 7.0.
- Removed unused files and assets.

= Version: 4.8.2 – Date: 16-05-2026 =
- **Security:** Resolved non-validated inputs by implementing strict WordPress-standard nonce and capability checks across all API handlers.
- **Compliance:** Updated third-party libraries (including libphonenumber-for-php) to the latest stable versions for enhanced security.
- **Compliance:** Replaced remote assets with local alternatives to ensure 100% compliance with WordPress repository policies.
- **Refinement:** Standardized granular sanitization for nested settings arrays to ensure robust data integrity.

= Version: 4.8.1 – Date: 10-05-2026 =
- **Compliance Update:** Unlocked all core functionalities for standalone deployment.
- **Enhancement:** Cleaned up translation components and refined string domains.

= Version: 4.7.9 – Date: 09-05-2026 =
- **New Architecture:** Major refactoring to a trait-based modular system for better performance and maintainability.
- **Security:** Standardized AJAX and REST security with centralized nonce and capability checks.
- **UI Optimization:** Centralized all SVG assets and UI helpers to reduce plugin footprint and improve load speed.
- **Standardization:** Unified phone number sanitization and formatting using the new global Phone Helper Trait.
- **Compliance:** Standardized all module behaviors to align with WordPress.org security and privacy guidelines.
- **New:** Live real-time preview for the WhatsApp Chat Widget in backend settings.
- **Enhancement:** Advanced Phone Field settings upgraded with modern toggles and instant status indicators.
- **Enhancement:** Added a mobile sidebar toggle button for better responsiveness.
- **Fix:** Resolve country flag image loading issues and plugin conflicts by using unique asset handles and absolute paths.
- **Performance:** Optimized Block Manager to lazy-load phone dependencies (intl-tel-input) only when accessed.
- **New:** Added Country Code direction Auto / Right / Left (or based on site language).
- **New:** Added Country Code +972 for Palestine 48 Lands.

= Version: 4.2 – Date: 14-12-2025 =
- **Enhancement:** Code optimization.

= Version: 4.1.1 – Date: 07-12-2025 =
- **Enhancement:** Code optimization.

= Version: 4.1.0 – Date: 04-12-2025 =
- **Bug Fixes:** get_page_by_title() replaced with WP_Query for WordPress 6.2+ compatibility.
- **Enhancement:** Removed unused assets CSS/JS files.
- **Enhancement:** Updated international phone number input library to latest local version.
- **Enhancement:** Code optimization.

= Version: 4.0.5.1 – Date: 01-11-2025 =
- **Bug Fixes:** Remix icons loading improvements.

= Version: 4.0.5 – Date: 30-10-2025 =
- **Enhancement:** Phone Fields support for WooCommerce Gutenberg Block checkout.
- **Enhancement:** Redesigned administration interface with faster loading times.
- **Enhancement:** Updated intl-tel-input library.
- **Enhancement:** Improved all translation files associated with the plugin.

= Version: 4.0.3.12 – Date: 15-08-2025 =
- **New:** Added dual action buttons in chat widget (direct WhatsApp and QR code scan).
- **Enhancement:** UI & UX design improvements across the settings panel.
- **Enhancement:** Code optimization.

= Version: 4.0.3.11 – Date: 09-09-2025 =
- **Enhancement:** Code optimization.

= Version: 4.0.3.10 – Date: 04-08-2025 =
- **Enhancement:** Code optimization.

= Version: 4.0.3.9 – Date: 31-07-2025 =
- **Enhancement:** Translations updated for all languages.

= Version: 4.0.3.8 – Date: 31-07-2025 =
- **Enhancement:** Improved system status information.

= Version: 4.0.3.7 – Date: 30-07-2025 =
- **Enhancement:** Code optimization.

= Version: 4.0.3.6 – Date: 29-07-2025 =
- **Enhancement:** Updated system info data.

= Version: 4.0.3.5 – Date: 27-07-2025 =
- **Enhancement:** Code optimization.

= Version: 4.0.3.4 – Date: 26-07-2025 =
- **Enhancement:** Code optimization.

= Version: 4.0.3.3 – Date: 25-07-2025 =
- **Enhancement:** Improve form display compatibility with third-party themes.

= Version: 4.0.3.2 – Date: 24-07-2025 =
- **Enhancement:** Code optimization.

= Version: 4.0.3.1 – Date: 24-07-2025 =
- **Enhancement:** Code optimization.

= Version: 4.0.2 – Date: 17-07-2025 =
- **New:** WhatsApp Chat Widget with multi-agent support and social channels.
- **Enhancement:** Auto country-code detection and selection.
- **Enhancement:** Setup Wizard performance and UX improvements.
- **Misc:** Minor improvements and refinements throughout the plugin.

= Version: 4.0.1.11 – Date: 21-05-2025 =
- **Enhancement:** Updated WhatsApp number display for the chat button in the admin panel.
- **Enhancement:** Code optimization.

= Version: 4.0.1.10 – Date: 18-05-2025 =
- **Enhancement:** Added auto load to make plugin load faster.
- **Enhancement:** Improved Arabic translation.
- **Enhancement:** Code optimization.

= Version: 4.0.1.9 – Date: 02-05-2025 =
- **Enhancement:** Code optimization.

= Version: 4.0.1.8 – Date: 26-03-2025 =
- **Enhancement:** Code optimization.

= Version: 4.0.1.7 – Date: 09-03-2025 =
- **Fix:** Country code loading fix on checkout forms.

= Version: 4.0.1.5 – Date: 09-03-2025 =
- **New:** WooCommerce Gutenberg Block support for country code phone fields.
- **New:** Added Spanish translation.
- **Enhancement:** Improved country code flag selector and RTL/LTR alignment options.
- **Enhancement:** Added support for Palestine 48 Lands (+972).
- **Enhancement:** WhatsApp Chat Button feature with contact list and hiding when empty.

= Version: 4.0.1.3 – Date: 14-02-2025 =
- **Enhancement:** Phone number normalization and formatting improvements.
- **Enhancement:** Code optimization.

= Version: 4.0.1.2 – Date: 12-02-2025 =
- **Added:** Translations (Portuguese, French, Hindi, Italian, Spanish).
- **Enhancement:** Country code entry and flag display improvements.
- **Enhancement:** Code optimization.

= Version: 4.0.1.1 – Date: 07-02-2025 =
- **Added:** Arabic translation with full RTL support.

= Version: 4.0 – Date: 01-02-2025 =
- **Enhancement:** Code optimization.
- **Enhancement:** Option to automatically detect country code via IP.

= Version: 4.0 – Date: 31-01-2025 =
- **New:** WhatsApp Chat Widget supporting multiple numbers, avatars, roles, QR code scanner, and social media links.
- **New:** Advanced Country Code selector with flags and WooCommerce checkout integration.
- **Enhancement:** Performance and code optimization.

= Version: 3.0.19 – Date: 15-12-2024 =
- **Enhancement:** Complete code optimization.