=== CGB Visual Search ===
Contributors: cgb
Tags: visual search, image search, woocommerce, AI, product search, camera search, CLIP
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 2.5.2
WC requires at least: 6.0
WC tested up to: 9.8
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI-powered visual product search for WooCommerce. Customers upload a photo and find matching products instantly.

== Description ==

CGB Visual Search adds AI-powered image search to your WooCommerce store, powered by CLIP embeddings.

**Key Features:**

* Upload image → Find matching products instantly
* Floating camera button on all pages (customisable position, size, icon, color)
* Auto-inject camera icon into WooCommerce / WordPress default search bars
* Full widget customiser with live preview
* Shortcode `[cgb_visual_search]` for custom placement
* Grid & list result layouts with configurable columns
* Drag & drop + click-to-upload
* Real-time product sync via WooCommerce webhooks
* Responsive and mobile-friendly
* Multiple icon styles: Camera, Search, Lens, Sparkle
* Animation options: Fade, Slide, Scale
* Color, radius, shadow, overlay — all tuneable from the admin

== Installation ==

1. Upload the plugin ZIP via **Plugins → Add New → Upload Plugin**.
2. Activate the plugin.
3. Go to **Visual Search** in the admin menu.
4. Enter your CGB backend URL and credentials to connect.

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =
Yes. CGB Visual Search is designed for WooCommerce stores and requires WooCommerce to sync and display products.

= How does the visual search work? =
Customers upload a photo and the AI (powered by CLIP embeddings) compares it against your product catalog, returning visually similar products ranked by relevance.

= Is there a free plan? =
Yes. The free plan gives you up to 10 results per search with basic features. Upgrade to Pro for more results, advanced filters, and priority support.

= What image formats are supported? =
JPEG, PNG, GIF, and WebP images up to 20 MB. Images are automatically compressed before being sent for analysis.

== Source Code and Build ==

All JavaScript and CSS files shipped in this plugin are included as human-readable source files.
No minified-only assets are required to run the plugin.

Plugin source location (in this package):
* `assets/js/`
* `assets/css/`
* `includes/`

Build tools:
* No build step is required to regenerate runtime assets for the distributed plugin package.

== Screenshots ==

1. Floating camera button on the storefront
2. Upload modal with drag & drop support
3. Fullscreen results with sidebar filters
4. Widget customizer with live preview
5. Admin dashboard with store connection

== Third-Party Services ==

This plugin connects to the **CGB Visual Search API** hosted at `cgbshop1.com` to perform image-based product search using AI (CLIP embeddings). The following data is transmitted:

* **Product sync**: Product names, prices, images, categories, tags, and permalinks are sent to the CGB backend when you sync your WooCommerce catalog.
* **Image search**: When a visitor uploads an image, it is sent to the CGB backend for AI-powered similarity matching. No personal data is included.
* **Authentication**: Your API key and store ID are sent with every API request for authorization.

Service URL: [https://cgbshop1.com/cgb-api](https://cgbshop1.com/cgb-api)
Terms of Service: [https://cgbshop1.com/terms](https://cgbshop1.com/terms)
Privacy Policy: [https://cgbshop1.com/privacy](https://cgbshop1.com/privacy)

== Changelog ==

= 2.5.2 =
* New: "Add to Cart" button on each result card (WooCommerce AJAX, no page reload) with success toast
* New: "Load More" pagination for results with a remaining-count label (configurable per-page size)
* New: Customizer toggles for "Show Add to Cart" and "Per Page (Load More)"
* Added 10-language translations for the new cart and pagination strings

= 2.5.1 =
* Search results: match score now capped at 100% (no more confusing >100% badges)
* Search results: sale prices now shown with original price struck through
* Search results: graceful image placeholder when a product photo is missing or fails to load
* Search results: prices with no value are hidden instead of showing "NaN"
* Hardened result rendering and deduplicated products returned from the search index
* Maintenance: silence index.php added to every directory; full uninstall cleanup

= 2.4.9 =
* Removed development-only ngrok header from API HTTP requests

= 2.4.8 =
* Fixed skeleton loading animation not showing in floating button modal

= 2.4.7 =
* Added Image Uploads analytics card
* Added help tooltips on all analytics cards
* Fixed help button click not showing tooltip content
* Fixed i18n fallback for missing translation keys
* Fixed analytics grid layout for 5 columns

= 2.4.2 =
* Fixed recommended/recent sections not appearing in floating button search results

= 2.4.1 =
* Added Columns setting for Recommended Products and Recent Searches
* Fixed Products card showing incorrect limit
* Fixed recommended/recent sections not appearing in search results
* Fixed missing i18n translation for Products card label

= 2.3.1 =
* Per-store secret codes: each store now has its own unique secret code
* Plan limit enforcement: stores beyond plan limit are blocked from plugin auth
* Store-level API key support: plugin authenticates per-store, not per-account
* Improved error messages when store exceeds plan limit

= 2.3.0 =
* Multi-store support: Pro+ (3 stores), Enterprise (10 stores)
* Domain binding: store IDs locked to connected website
* Session enforcement: one active session per store
* Analytics: show top products found with links, image search count
* Client dashboard: multi-store management with usage display
* Admin notifications system with read/unread tracking
* Store creation and deletion from client dashboard

= 2.2.9 =
* Search Analytics dashboard: view total searches, search trends, top queries, peak hours, and recent searches
* Analytics locked for Free plan with upgrade prompt
* Full 10-language i18n support for analytics tab
* Fixed ZIP download path structure for WordPress compatibility

= 2.2.6 =
* Feature flags: full enforcement on frontend (price/color/category filters, display modes)
* Results per search: plan-based limits (Free=10, Pro=400, Pro+=1200, Enterprise=5000)
* Default results count changed to 30 for paid plans
* Widget customizer: results count input clamped to plan max with hint label
* CORS fix: preflight requests now allowed for plugin stores
* Monthly search limit message improved

= 2.2.5 =
* Brand logo: replaced SVG placeholder with actual CGB logo across login and dashboard header
* Feature flags: labels now use i18n translation keys for multi-language support
* Deploy sync fix: admin.js and class-cgb-admin.php synced to latest

= 2.2.4 =
* Direct upload mode: camera click opens file picker directly without showing modal first
* Lock advanced customizer settings for free plan (Upload Mode, Icon, Position, Button/Icon size, Shadow, Label, CSS Reference, Custom CSS)

= 2.2.3 =
* 16 color filters in 4×4 grid (added Navy, Beige, Gold, Teal, Maroon)
* Category filter now uses dropdown select with counts
* Wider sidebar (320px) for better filter layout
* Floating button: 6 positions (bottom-right/left/center, top-right/left/center) + pixel offset controls
* Upload mode: always opens modal first, direct mode auto-triggers file picker
* Plan-based result limits: Free=20, Pro/Pro+/Enterprise=100 results per search
* Upgrade message and CGB watermark for Free plan
* Enable/disable toggles fully independent (shortcode, floating button, modal, searchbar)
* Customizer layout larger with sticky preview panel
* Max Searches displays "Unlimited" for high-limit plans
* Results count max raised from 50 to 100
* Fixed duplicate upgrade/watermark elements on filter change
* Fixed payment flow crash (undefined translator function)

= 2.2.1 =
* Complete i18n audit — all plugin strings verified across 10 languages
* Fixed missing translations in Widget Customizer (raw keys displayed instead of text)
* Added data-i18n to shortcode upload button, disconnect button title, not-connected notice
* Added aria-label translation support (data-i18n-aria) for accessibility
* Fixed "Enabled" status text flash in customizer live preview tabs

= 2.1.2 =
* Shortcode element toggles (icon, button, divider) with size controls
* Shadow and padding customizer options
* Admin dashboard JS fix
* Full sync deployment

= 2.1.1 =
* Compact uploaded image preview in modal
* Real AI similarity scores from CLIP backend
* Plan-based feature flags with lock overlays

= 2.1.0 =
* Fullscreen sidebar redesigned: compact layout matching admin preview style
* Price Range slider replaces Budget min/max inputs
* Smaller color swatches, horizontal category pills
* Camera button in search bar: icon only, no background box
* Simplified Search Bar customizer: Camera Color + Camera Size only

= 2.0.9 =
* Added Compact and Large layout options (Grid, List, Compact, Large)
* Fixed: List layout now works on fullscreen search results
* All 4 layouts work on both shortcode and fullscreen results

= 2.0.8 =
* Removed test drag zone from customizer tabs
* Added device preview bar: Desktop, Tablet, and Phone views
* Results Card preview now shows sidebar with live filter toggles

= 2.0.7 =
* Compact sidebar: narrower width, tighter spacing
* Camera button positioned inside WC search bar input
* Added quick test search to every customizer tab

= 2.0.6 =
* Fullscreen search results with left sidebar
* Price, Color, Category filters in sidebar
* Sort by relevance, price low/high

= 2.0.5 =
* Added auto-sync: new, edited, and removed products detected and synced automatically
* Last Sync date/time displayed in WooCommerce tab

= 2.0.4 =
* Fixed live preview for border radius, overlay opacity, and card gap sliders
* Fixed card image overlapping price display
* Added shortcode icon style selector

= 2.0.3 =
* Performance improvements and bug fixes

= 2.0.2 =
* Added enable/disable toggle for each widget feature (Search Bar, Floating Button, Modal, Results Card)
* Wider customizer sidebar (420px) with more compact layout
* Frontend respects feature toggles — disabled features are not rendered

= 2.0.1 =
* Improved admin live preview for results cards, floating button label, modal animation, and overlay opacity
* Added min score preview feedback inside the customizer
* Enlarged uploaded image previews for portrait and landscape images in modal and shortcode views
* Updated downloadable plugin package with the latest customizer polish

= 2.0.0 =
* Complete rewrite with modern admin dashboard
* Full widget customiser with live preview
* Auto camera button in WooCommerce search bar
* Multiple icon styles and animations
* Grid & list result layouts
* AJAX-based login flow (no redirects)
* WooCommerce auto-connect & sync
* All API interactions via AJAX with nonce verification
