=== Glance Live Search ===
Contributors: woonet237
Tags: woocommerce, search, live search, ajax search, product search
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 8.0
Stable tag: 1.5.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Instant AJAX product search for WooCommerce — results appear as your customers type, no page reload needed.

== Description ==

**Glance Live Search** transforms your WooCommerce store's search experience. The moment a customer starts typing, matching products appear instantly — by name, SKU, or category — without any page reload.

Stop losing sales to a slow, frustrating search. Give shoppers the fast, fluid experience they expect.

= Why Glance Live Search? =

* **Instant results** — powered by optimized WC_AJAX queries, results appear in milliseconds
* **Finds everything** — searches product titles, SKUs, descriptions, excerpts, categories, and tags
* **Beautiful by default** — design presets + full Custom mode to match any brand
* **Smart caching** — client-side cache + server-side object cache (Redis / Memcached compatible)
* **Mobile-first** — full-screen overlay with safe area support for notched phones
* **Search history** — recent searches saved locally and displayed on focus
* **Fully accessible** — ARIA combobox, keyboard navigation, WCAG 2.4.3 focus management
* **Extensible** — 15+ PHP hooks for developers
* **Data-driven** — analytics dashboard with top keywords and zero-results tracking
* **Theme-proof** — defensive CSS with dedicated integrations for Shoptimizer, Astra, and Kadence

= Free Features =

* Instant AJAX live search by title and SKU
* Search in product descriptions and short descriptions (optional)
* Product tag search results
* Up to 20 results per query with "View all results" link
* Search history displayed on focus (configurable, 1–20 items)
* Client-side multi-term cache (5-minute TTL)
* Full-screen mobile overlay with configurable breakpoint
* 2 design presets: Sharp and Clean
* Configurable search delay, minimum characters, and placeholder text
* Search button (icon or text) — inside or outside the bar
* Text button switches to icon automatically on mobile
* Analytics dashboard — top keywords with configurable data retention (1–90 days)
* Shortcode `[glance_search]`, WordPress widget, Gutenberg block, Elementor widget
* Full Site Editing (FSE) block theme support
* 15+ PHP filter hooks for developers
* WC_AJAX endpoint for faster responses
* Object cache with automatic invalidation on product changes
* Dedicated theme integrations (Shoptimizer, Astra, Kadence)

= Pro Features =

* **Up to 50 results** per search
* **4 design presets** — Sharp, Clean, Pill, and fully Custom
* **Full color customization** — bar, border, text, placeholder, button
* **Category filter** in the search bar
* **Variation search** — find products by attribute values (color, size, etc.)
* **Price range and in-stock filters**
* **Show SKU, rating, and category count** in results
* **Upsell recommendations** below search results
* **CTR / click tracking**
* **Advanced analytics** — 7 / 14 / 30 / 90-day views, hourly breakdown, CSV export
* **WPML and Polylang** multilingual support
* Priority support

== Installation ==

1. Upload the `glance-live-search` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** menu.
3. Make sure **WooCommerce** is installed and active.
4. Go to **WooCommerce → Glance Search** to configure.
5. Add the search bar using the `[glance_search]` shortcode, the WordPress widget, the Gutenberg block, or the Elementor widget.

**Shoptimizer users:** go to **Customize → Header → Display the search** and select **Glance Live Search**.

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =

Yes. Glance Live Search is built exclusively for WooCommerce product catalogs.

= How do I add the search bar to my site? =

Use the `[glance_search]` shortcode, the **Glance Live Search** widget (Appearance → Widgets), the Gutenberg block, or the Elementor widget.

= Can I customize the look? =

Yes. Choose a preset (Sharp, Clean, Pill, or Custom in Pro) and adjust colors, borders, radius, and height from the Search Bar settings tab.

= Will it slow down my site? =

No. Assets load only where the search bar is present. CSS and JS are minified in production. Searches are cached via the WordPress object cache and invalidated automatically when products change.

= Does it work with WPML / Polylang? =

Yes. Results are automatically filtered to the active language.

= Is it accessible? =

Yes. Full ARIA combobox pattern, keyboard navigation (Arrow keys, Enter, Escape, Tab), focus trap on mobile, and `prefers-reduced-motion` support.

= I have both Free and Pro installed — what happens? =

The Pro automatically deactivates the Free. No conflict, no manual action needed.

= Does it work with Shoptimizer / CommerceKit? =

Yes. Dedicated integration with Shoptimizer's Customizer. CommerceKit AJAX Search is automatically disabled when Glance is active.

== Screenshots ==

1. Search bar with live results dropdown
2. Admin settings — Behavior tab
3. Admin settings — Search Bar design tab
4. Admin settings — Analytics dashboard
5. Mobile overlay — full-screen search on small screens

== Changelog ==

= 1.5.0 =
* Fix: number of results is now fully configurable up to 20 — the previous limit of 5 has been removed
* Fix: analytics retention period is now a configurable setting (1–90 days)
* Fix: improved output sanitization in the search form shortcode
* Fix: translation strings in the Shoptimizer compatibility layer now use the correct text domain
* Fix: direct file access protection added to the block editor asset file

= 1.4.0 =
* New: FULLTEXT search support with automatic index detection (large catalog performance boost)
* New: Full Site Editing (FSE) block theme support
* New: object cache (Redis / Memcached) with wp_cache_flush_group invalidation (WP 6.1+)
* New: automatic cache invalidation on product create, update, delete, and stock change
* New: text button switches to icon on mobile
* New: Pro/Free dual-activation guard with automatic deactivation and admin notice
* New: body-offset awareness for dropdown positioning (Elementor, Divi compatibility)
* Improved: minified CSS/JS loaded in production via SCRIPT_DEBUG detection
* Improved: shortcode guarantees asset loading via ensure_assets() in late-rendering contexts
* Improved: FULLTEXT boolean operators escaped from user input
* Improved: search cache stores total_found — no duplicate COUNT query on cache hit
* Improved: CSV export streams in 1000-row chunks (prevents out-of-memory)
* Improved: CSV export includes UTF-8 BOM for Excel Windows
* Improved: max_results server-side cap (1–50)
* Improved: is_product() added to asset detection
* Improved: ARIA attributes on mobile overlay input
* Improved: ArrowUp from no selection selects last result
* Improved: Tab key closes dropdown
* Improved: network error fallback message always shown
* Improved: focus restored on mobile overlay close
* Improved: prefers-reduced-motion covers admin animations
* Improved: unique form IDs for multi-instance outside-button mode
* Improved: hook naming harmonized to slash format with backward-compatible aliases
* Improved: @since docblocks on all public methods
* Improved: defensive CSS protects layout against theme overrides
* Improved: CommerceKit AJAX Search neutralized when Glance is active on Shoptimizer
* Removed: Modal display mode
* Removed: Inline display mode
* Fix: search bar unstyled on homepage — ensure_assets() enqueues in theme header context
* Fix: WC_AJAX requests not loading search engine — $_GET['wc-ajax'] detection added
* Fix: Pro/Free simultaneous activation fatal error — GLS_PRO_ACTIVE sentinel constant
* Fix: Free version color and result display options not locked behind Pro gate

= 1.3.0 =
* New: client-side multi-term cache (5-minute TTL)
* New: "View all results" link with total product count
* New: search history with localStorage and clear button
* New: full-screen mobile overlay with configurable breakpoint and safe area support
* New: search in descriptions and short descriptions
* New: product tag search results
* New: WC_AJAX endpoints (faster responses)
* New: 10 PHP filter hooks for developers
* New: Gutenberg block and Elementor widget
* Improved: analytics fire only on network requests
* Improved: XSS protection on history items
* Fix: mobile overlay body scroll lock
* Fix: WC_AJAX class existence check

= 1.2.0 =
* Added CTR / click tracking and upsell recommendations
* Added design presets: Sharp, Clean, Pill
* Added category search results
* Improved rate limiting and cache key (includes filters + language)
* Added DB migration system

= 1.1.0 =
* Added search analytics dashboard
* Added Polylang / WPML language support
* Added price and in-stock filters

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 1.5.0 =
Removes the 5-result limit, makes analytics retention configurable, and includes several code quality improvements. Recommended for all users.

= 1.4.0 =
Major update: FULLTEXT search, Redis/Memcached cache, automatic invalidation, FSE support, minified assets, 20+ improvements and bug fixes. Modal and Inline modes removed. Recommended for all users.

= 1.3.0 =
Client-side cache, search history, mobile overlay, Gutenberg block, Elementor widget, and developer hooks. Recommended for all users.

= 1.2.0 =
Click tracking, recommendations, and design presets. Recommended for all users.
