Found a bug? Have a great feature idea? Get on GitHub and tell us about it and we'll get right on it: https://eshop-optimizer.com


= 5.2 Maintenance release (21/05/2026) =

* Version bump only — no code changes since 5.1. Clean-install verified end-to-end on a fresh WP 7.0 + WooCommerce 10.7 site (all 91 AIEO tables created, 19 stored procedures installed, bundled mu-plugins copied, no PHP errors). Plugin URI header, AIEO_VERSION constant, and readme.txt Stable tag synchronised.


= 5.1 Custom Slots, Recommendations Ordering, REY-theme + Action Scheduler hotfixes (21/05/2026) =

** 🎯 Custom Slots + Recommendations Ordering **
* NEW: AIEO_DMM_Custom_Slots — operator-defined "extra blocks" for the single-product recommendations region. Two kinds of slots:
  - Tolstoy: paste a widget id + account UUID and AIEO assembles the canonical `<tolstoy-widget>` tag plus the matching ai-widgets.gotolstoy.com CDN script (defer-loaded once per page, dedup'd by account+widget pair).
  - HTML / code: paste any raw HTML, embed script, image tag, or WooCommerce shortcode (e.g. [products limit="6" orderby="popularity"]). Shortcodes processed; security knob via `aieo_dmm_custom_slot_html` filter.
* NEW: wp_editor() Visual/Text editor for HTML slots — operators get a rich-text WYSIWYG (TinyMCE) AND a raw-code tab natively, with wpautop disabled so embed scripts and custom elements (`<tolstoy-widget>`) survive a Visual → Code round-trip intact.
* NEW: Per-slot title field + Show-title toggle. The slot wrapper now emits as `<section class="aieo-custom-slot ... aieo-recommendations" data-section="<slot_id>">` so the operator-supplied heading inherits the theme's `.aieo-recommendations .aieo-recommendations-title` styling (underline + rail-matching typography) automatically — no extra CSS.
* NEW: aieo/custom-slot block + aieo/custom-slots-region block. The region block emits every enabled slot as a sibling div (no wrapper) so each participates in the parent flex container's order: layout as a direct child.
* NEW: "Recommendations Ordering" card on the Product Display dashboard. Drag-and-drop list mixing the 5 built-in reco surfaces (Up-sells, Cross-sells, Related, Recently Viewed, Products for the same needs) with every operator-defined custom slot, plus a per-row Show toggle to hide rails without removing them.
* NEW: Classic-theme parity for the recommendations order — `AIEO_DMM_Product_Display::reorder_classic_theme_recos()` runs on `wp` priority 100 (non-FSE themes only), walks `$wp_filter['woocommerce_after_single_product_summary']`, finds each known reco's existing callback, and remove/re-adds it at a new priority derived from the saved order. Custom slots become per-slot closures registered at the saved priority, replacing the single render_classic_theme_region callback. Hidden items are removed entirely. Effect: drag-saved ordering applies identically on botiga/storefront/astra/etc. as on roosterx (FSE).
* NEW: aieo_dmm_recommendations_order option — authoritative order + visibility store. Auto-seeded on first read from the legacy `aieo_display_*` options so pre-5.1 settings carry over.
* NEW: data-aieo-reco attribute on every reco wrapper (built-in + custom) — the join key the inline-CSS order/visibility rules target.
* NEW: roosterx single-product.html — 5 recos blocks wrapped in `.ff-recommendations-cluster` flex container; aieo/custom-slots-region block inserted as the final child so custom slots become flex siblings.
* CHANGE: Custom Slots admin tab moved into the SINGLE PRODUCT PAGE column of the Storefront Display dropdown (was orphaned in the unlisted `_other` bucket). Priority 57 lands it between Sticky Add to Cart (56) and Product Video (60).
* CHANGE: Legacy "Please display Cross-sells above Up-sells" checkbox + option `aieo_recommendations_display_order` retired from the Analytics page. Replaced with a deep-link to the new Recommendations Ordering card. The legacy option is no longer read at render time (FSE uses inline order CSS, classic uses dynamic hook re-prioritisation).
* CHANGE: Tolstoy admin placeholder data swapped to fake-but-format-correct demo values (`01HZ7XMP3VBQR8TKWY5JCDFN24` / `a7c2f1e4-9b53-4d6e-bc01-5f8e7a3c2b94`) — never distribute real operator account UUIDs.

** 📊 Tolstoy → cart attribution (cross-tab) **
* NEW: `tolstoy` added to AIEO_Attribution::VALID_SOURCES. Add-to-cart events that originate from a Tolstoy carousel click are now stored in wp_aieo_addcart_events with `source = 'tolstoy'`.
* NEW: aieo-tolstoy-attribution.js — cross-tab carrier. Capture-phase delegated click listener on `<a>` elements inside `[data-aieo-reco^="slot_"]` containers that host a `<tolstoy-widget>`; writes the click context (slot_id, source product_id, tolstoy_widget_id, destination URL) to localStorage BEFORE the navigation. Tolstoy links open in a new tab (target="_blank"), so the destination tab — on page load — promotes the localStorage entry to `window.aieoTolstoyPending` (one-shot, TTL 30 min, dst_path match) for the next add-to-cart event on that page.
* NEW: aieo-attribution-client.js — `inferSource()` and `resolveSourcePid()` short-circuit on `window.aieoTolstoyPending` before any DOM-walk fallback; the resulting beacon carries `source_meta = {slot_id, tolstoy_widget_id, clicked_url}` so reports can pivot on widget OR carousel OR source product.
* Improved: Custom Slots module enqueues aieo-tolstoy-attribution.js on every is_singular('product') page — both source AND destination pages get the bridge wired with one enqueue.

** 🛒 IAPI (WordPress Interactivity API) — WC Cart / Checkout block parity **
* NEW: AIEO Side-Cart, Swatches multi-select, Cart sync, Recommendations attribution, Sticky Add-to-Cart, Wishlist toggle and Star Ratings all integrate with the modern WooCommerce block-based cart and checkout (driven by @wordpress/interactivity). Existing classic-shortcode cart/checkout still work — no regression. The same DOM contract drives both surfaces so a single set of CSS + JS handles "shop with the new blocks" or "shop with the old shortcodes".
* NEW: AIEO_DMM_Swatches_Runtime supports dual-mode enqueue — IAPI module @aieo/swatches-iapi when `aieo_iapi_swatches_enabled` is on, falling back to the jQuery bundle aieo-swatches.js otherwise. Same DOM contract; the IAPI module reads the same `omSwatchSettings` localised data the jQuery bundle does.
* NEW: WC Store API / wc/store/cart REST endpoints are recognised by the side-cart, attribution log, and waitlist subscribe flows so the operator's cart actions on the block-checkout surface are captured the same as on the classic checkout.
* NEW: `woocommerce_blocks_loaded` integration — AIEO Custom Slots, Free-Shipping Display, and Trust Badges register their bridge-block render paths inside the WooCommerce Blocks asset pipeline, so they're available to drop into block-themed cart/checkout templates via the Site Editor.

** 🐛 Other polish in 5.1 **
* FIX: DB-optimization completion message now reports the live `SELECT VERSION()` value (e.g. "MariaDB 11.8.6 optimization completed for both orders and product vitals tables") instead of the hardcoded "MariaDB 11.4 …" / "MySQL 8 …" floor. Code-path selection (which index set to apply) still keys on the 11.4+ / 8.0+ floor; only the operator-facing label changed.

** 🚑 Blocker hotfix — 4 GB OOM on variation-attribute URLs after WP 7.0 (2026-05-21 incident on femme-fatale.gr) **
* FIX: New `aieo_purge_caches_on_core_upgrade()` handler — hooked on `upgrader_process_complete` (gated by `type === 'core'`). When WordPress core upgrades, AIEO now flushes every plugin-owned persistent cache so cross-version unserialise landmines can't fire. Without this, WP 7.0's replaced wp-includes/* renders stale serialised core-class instances (WP_Term, WP_Post, WC_Product, …) inside AIEO's transients unreadable — PHP's unserialize() hits a corrupted length field and tries to allocate ≈4 GB. The crash signature `Allowed memory size … exhausted (tried to allocate 4295229440 bytes)` at `wp-includes/theme.php:325` is the classic unsigned-integer-underflow value (≈ 0xFFFFFFFE).
* NEW: One-shot retroactive purge `aieo_retroactive_post_core_upgrade_purge()` runs on the first `plugins_loaded` after the 5.1 update, gated by the `aieo_post_core_upgrade_purge_v1` option flag. Catches sites where WP core was auto-upgraded BEFORE this fix landed in the plugin — the upgrader_process_complete hook can't help there, but this catch-up purge does.
* FIX: Purge implementation scope — direct DELETE on wp_options for `_transient_aieo_*` + `_transient_timeout_aieo_*` + `_transient__aieo_*` + matching `wc_var_prices_*` transients (WC's own variation-prices cache that AIEO's `woocommerce_get_variation_prices_hash` filters in AIEO_DMM_Main_Price_Filter + AIEO_DMM_Role_Pricing touch — so corrupted blobs there land in AIEO's code path), plus `wp_cache_flush_group()` on `aieo_dmm` / `aieo_core_brand_vitals` / `aieo_ratings` (full `wp_cache_flush()` fallback on older WP), plus `TRUNCATE wp_aieo_recommendations_cache` when present, plus AIEO_Core_Brand_Vitals' cache_version bump. Total cost per upgrade: one indexed-LIKE DELETE + one TRUNCATE + a few cache calls — negligible.

** 🔧 Priority hotfixes (2026-05-21 incident response on e-sotiriou.gr) **
* FIX: AIEO_DMM_Brand_Gifts::exclude_samples_from_archive() — skip the `_aieo_gift_type` meta_query injection when the caller already has a `post__in` constraint or when a `dynamic_sidebar` action is firing. REY theme's price-filter widget (`reyajaxfilter_get_prices_range`) builds counter-queries with `post__in`; our LEFT JOIN injected into that query produced malformed SQL with a floating `wp_posts.ID IN (…)` clause that MariaDB rejected — REY then fell into a recovery path that recursively rebuilt result sets in PHP and OOM'd PHP-FPM workers at 4 GB allocation. Site became unusable for hours. Sample-product hiding from the visible archive is unaffected (visible archives don't pass post__in).
* FIX: AIEO_Recompute_Queue::maybe_schedule_tick() — site-wide 5-minute transient lock, one-shot dupe cleanup (gated by `aieo_recompute_dupe_cleanup_v1` option flag), `as_next_scheduled_action()` for dedup (single indexed lookup instead of the prior `as_get_scheduled_actions(per_page=2)` table scan), and `admin_init` as the primary trigger so frontend requests no longer touch the wp_actionscheduler_actions table on every page load. The prior design scanned the actions table on every `init`; on a site with 4,783 pending rows of this hook it cost ~25 s per request, exhausted the FPM pool, and pushed load average to 14.69 on a 4-CPU box.
* FIX: AIEO_DMM_Product_Meta — legacy `om_ppe_product-meta` option no longer shadows new defaults when the AIEO option exists (even at `{enabled:true}` only); same fix pattern applied across the 7 om_ppe legacy keys via aieo_migrate_om_ppe_legacy_options() one-shot migration.
* FIX: AIEO_DMM_Brand_Display + AIEO_DMM_Product_Meta — both now resolve the current product via `global $product` first, falling back to `is_singular('product')` + `get_the_ID()`. Classic themes like Botiga wrap the WC summary in their own component pipeline where the latter pair can return 0/false mid-render. Brand Display + Product Meta also gained classic-theme hook callbacks (woocommerce_single_product_summary + woocommerce_product_meta_end) so they render outside FSE templates too.
* FIX: AIEO_DMM_Brand_Display::get_brand_term() now routes through AIEO_DMM_Brand_Discounts::get_brand_taxonomy() for taxonomy detection (covers Premmerce, BeRocket, plus the existing 3) — matches the rest of the DMM.
* FIX: aieo/brand-azindex block — `editorScript` declared in block.json + new edit.js with ServerSideRender preview so the Site Editor stops showing "Your site doesn't include support for this block".
* FIX: Generic editor-side fallback (`enqueue_block_editor_assets`) registers a ServerSideRender stub for every aieo/* block that doesn't ship its own edit.js — closes the "unsupported block" warning across 18 server-rendered AIEO blocks.

** 🔌 Frontend swatch runtime now standalone **
* NEW: AIEO_DMM_Swatches_Runtime + AIEO_DMM_Swatches_Ajax bundled in the main plugin so the swatch frontend renders without the optional ai-eshop-optimizer-runtime plugin. Same DOM contract; aieo-swatches.js + aieo-swatches.css ship in the main plugin's assets/.
* NEW: AIEO_DMM_Swatches::enqueue_frontend_assets() — full localisation (omProductSwatches + aieoSwatches + the critical omSwatchSettings global the bundled JS reads to create the multi-select batch-add button + cart-sync data).
* NEW: wp-color-picker on every `.aieo-color-input` field in the Swatches admin appearance tables, plus tightened table layout (72-px number inputs, inline `px` / `/` labels).

** 🛒 Storefront fit + finish **
* FIX: 60×60 mobile button override from theme rules now beaten unambiguously on `.aieo-wishlist-heart` + `.aieo-rating-star` via `@media (max-width:1025px)` high-specificity rules with !important on dimensional properties.
* FIX: Mobile single-product rating widget — caption stacks UNDER the stars instead of beside them; both centered.
* FIX: 81 `wp_terms.name` rows decoded — pre-encoded HTML entities (`Λεβάντα &amp; Βανίλια`) cleaned + defense-in-depth `html_entity_decode()` added to AIEO_PSE::aieo_bundle_attribute_labels() so the side-cart quick-view dropdown stops showing literal `&amp;` text.

** 🔗 Branding **
* CHANGE: Plugin links now point at rooster.systems/get-aieo/ (was eshop-optimizer.com). Plugin URI header, admin top-bar anchor (text rebranded to "Rooster AI Eshop Optimizer"), my-account, help-and-support, feedback, and Pro service URLs all updated. JWT/REST/order-upload API endpoints intentionally unchanged.

** 🌍 i18n + post-relations shortcodes **
* NEW: AIEO_Post_Relations_Shortcodes — [aieo_related_brands] / [aieo_related_categories] / [aieo_related_needs] canonical shortcodes plus [related_brand_shortcode] / [secondary_brand_shortcode] aliases so legacy Pods-era theme templates keep working.
* NEW: [aieo_brand_rails] and [aieo_brand_slider] shortcodes — wrap the aieo/brand-rails and aieo/brand-slider blocks via render_block() so single source of truth.


= 5.0 Insights Chat, Attribution Engine, Retention & Pro Tier (15/05/2026) =

** 🎯 MAJOR RELEASE: Conversational Analytics, Joint Session × Attribution Intelligence, and the Pro Tier **

This release is the largest single update to AI eShop Optimizer to date. Three months of work consolidate into four product-level deliverables: an in-admin Claude-powered Insights Chat with 33 purpose-built data abilities; a Session-Tracker × Attribution-Engine bridge that unlocks joint analytics across engagement, conversion, blog content, and customer needs; a four-layer retention strategy that keeps the local database under 1 GB indefinitely while streaming the full event history to an operator-owned analytics database; and a formal Pro-tier gating layer with frosted-glass overlays on the thirteen tabs that are now membership-only.

** 💬 Insights Chat — Claude-powered, in-admin **
* NEW: AIEO_Merchant_Chat — in-admin chat page under Tools → Insights Chat, powered by the existing AI Chat Anthropic API key (no separate subscription)
* NEW: 33 purpose-built Claude abilities registered via the WordPress Abilities API, discoverable at /wp-json/wp-abilities/v1/abilities
* NEW: Categorized accordion suggestion chips covering 11 question groups — Customers, Brand portfolio, Recommendation rails, Attribution & archives, Product needs audit, Star ratings, Content & blog, Cross-skill, Store analytics, Promotions / launches / sales, Newsletters & campaigns
* NEW: Tool-use loop with bidirectional slashless tool-name mapping (aieo/list-brands ↔ aieo_list_brands) for Anthropic compatibility
* NEW: Translated suggestion chips for sales-per-view ratio, new-product performance, complementary-product impact, sale-period products, newsletter × needs correlation, abandoned-cart triage, blog-to-product conversion, and engagement-bucket buy-probability
* NEW: Server-side ability execution with manage_woocommerce capability gating; permissions enforced before every tool call

** 🔗 Session Tracker × Attribution Engine Integration **
* NEW: AIEO_Session_Attribution_Bridge — query helpers that JOIN wp_aieo_sessions × wp_aieo_addcart_events × ratings × needs by session_id and product_id
* NEW: AIEO_Conversion_Probability_Model — engagement-bucket conversion table; scores the current session's P(cart-add) based on scroll depth, time on page, and mouse activity
* NEW: 'blog_post' added to AIEO_Attribution::VALID_SOURCES — clicks from blog posts to products now attribute correctly with source_meta.post_id
* NEW: Blog-post detection in aieo-attribution-client.js (body.single-post / article.post)
* NEW: 11 new abilities — aieo/attribution-with-engagement, aieo/addcart-funnel, aieo/blog-engagement-leaderboard, aieo/blog-to-product-conversion, aieo/buy-probability-by-engagement, aieo/buy-probability-leaderboard, aieo/abandoned-cart-triage, aieo/cart-removal-analysis, aieo/rating-conversion-correlation, aieo/need-conversion-correlation, aieo/top-converting-pairs
* Improved: AIEO_Attribution::log_event() now respects AIEO_Session_Tracker consent state (GDPR alignment — previously wrote regardless)
* Improved: session_id validity guard in log_event() prevents the "session_id = 1" regression we hit in May
* Improved: Both engines key off the same aieo_session_id cookie; documented in the bridge's contract

** 🗄️ Four-Layer Retention Strategy & Remote DB Streaming **
* NEW: AIEO_Remote_Export_Manager — streams raw analytics events to an operator-owned MariaDB / MySQL via the existing AIEO_ERP::for_connection_id() factory
* NEW: AIEO_DMM_Remote_Export module ("Insights Remote DB Settings" tab) — admin UI for picking connection + tables + export frequency, dry-run "Test export" button, per-table lag dashboard
* NEW: aieo_remote_export_run cron with configurable frequency (15 min / hourly / daily)
* NEW: wp_aieo_remote_export_state bookkeeping table — one row per (connection_id, table_name) tracking last_exported_ts
* NEW: Idempotent INSERT IGNORE on the remote so repeated runs never duplicate
* NEW: 5 pre-aggregated daily rollup tables — wp_aieo_engagement_daily, wp_aieo_attribution_daily, wp_aieo_conversion_buckets, wp_aieo_blog_engagement_daily, wp_aieo_cart_removal_daily
* NEW: aieo_aggregate_rollups nightly cron — chat abilities query the rollups, never the raw event tables, keeping admin response times in the single-digit milliseconds
* NEW: Tightened hot retention — 14 days for wp_aieo_sessions, 30 days for wp_aieo_reco_events, 365 days for wp_aieo_addcart_events (cart-adds are conversion evidence and kept longer)
* NEW: aieo_archive_run unified archive hook generalises the existing weekly cron to cover AE + reco event tables alongside sessions
* NEW: Local-purge failsafe — hot rows are NOT deleted until the remote-export bookkeeping confirms the row was received, preventing data loss when the remote is briefly unreachable
* Improved: Net stable DB footprint ~1.1 GB regardless of how many years the plugin has been running (was unbounded — wp_aieo_sessions alone projected to hit 6-8 GB by year 2 before this work)

** 🌟 Star Ratings → SEO Schema Bridge **
* NEW: AIEO_Ratings_Schema — bridges AIEO star ratings into AIOSEO, Yoast, and RankMath JSON-LD via their schema filter hooks (aioseo_schema_output, wpseo_schema_product, rank_math/snippet/rich_snippet_product_entity)
* NEW: Fallback head-injected JSON-LD aggregateRating when no SEO plugin is detected
* NEW: Enable/disable toggle on the Star Ratings admin page (seo_schema_enabled setting)
* Improved: Pages now surface aggregateRating to Google Rich Results without the operator needing to manually configure each SEO plugin

** 🛒 Floating Mini Side-Cart, Sticky ATC & Free-Shipping Bar **
* NEW: AIEO_DMM_Side_Cart — two-column floating mini-cart styled after the Rey theme: left column "You might like" recommendations, right column Shopping Bag / Recently Viewed tabs, free-shipping progress bar right under the tab header, ± quantity stepper per line, SUBTOTAL + coupon + CART / CHECKOUT buttons
* NEW: Fast-path cart updates — 500 ms debounced quantity AJAX → 400-byte JSON → optimistic client-side bar recompute → no full cart recalculation on the server. Session-level HTML cache keyed by cart_hash (30 s TTL). WC fragments integration keeps every other widget in sync
* NEW: Side-cart recommendations sourced from the DMM product-bundle endpoint so the same cached HTML powers the product page AND the mini-cart
* NEW: Brand-gift lines get locked-qty / hidden-remove-link treatment — same UX as the Brand Gifts module already applies to the standard WC cart page
* NEW: AIEO_DMM_Sticky_ATC — sticky Add-to-Cart bar (DOM classes + JS global kept verbatim so the shipped CSS/JS bundle works without modification)
* NEW: AIEO_DMM_Free_Shipping admin — threshold + product / brand exclusions; registers the package-rates filter that strips free-shipping rates when any excluded item is in the cart

** 💰 Pricing Engine — Role Pricing, Brand Discounts, Loyalty Classes **
* NEW: AIEO_DMM_Role_Pricing — per-role price overrides via CSV upload; staged batch validation → AJAX batches process rows into wp_aieo_dmm_role_prices; mirrors into the legacy wp_om_role_based_pricing table so the existing om-role-pricing frontend keeps working byte-for-byte
* NEW: AIEO_DMM_Brand_Discounts — % discounts per brand term with optional date window; read by the pricing engine at runtime
* NEW: AIEO_DMM_Loyalty_Classes — loyalty class definitions + user assignments applied in the global pricing recipe by AIEO_DMM_Pricing_Engine
* NEW: Pricing engine evaluates Role Pricing → Brand Discount → Loyalty Class as a stacking recipe so each customer sees the strongest applicable price

** 🎁 Conversion Boosters — Brand Gifts & Exit-Intent **
* NEW: AIEO_DMM_Brand_Gifts — brand-based free-gift offers stored in wp_aieo_dmm_brand_gift_offers; cart-side hooks add a gift (price = 0) when cart subtotal of the offer's brand(s) crosses min_subtotal within the date window. Bypasses the is_purchasable filter for programmatic gift adds so sample-flagged products work
* NEW: AIEO_DMM_Exit_Intent — configurable modal that fires on cursor exit-intent after a per-page warm-up delay. Two HTML bodies: a generic site-wide offer + an upgraded checkout-specific offer. Optional restriction to checkout-only and/or anonymous visitors. Session-storage dismissal so it doesn't reappear in the same browsing session. Excludes the order-received endpoint (post-purchase context defeats the offer)
* NEW: AIEO_DMM_Exit_Intent auto-imports legacy options from the standalone `exit-intent-offer` plugin on first read and deactivates it — operators don't need to migrate by hand

** 📦 Marketplace Connectors & Shipping **
* NEW: AIEO_MOI_Admin (Marketplace Order Importer) — pulls Skroutz / e-shop / Amazon orders into WooCommerce as native orders so attribution, stock, customer profiles, and fulfillment stay unified. Webhook + manual reconcile flow with vendor-namespaced order meta. Inbound-log table with 30-day retention and visible event detail (last 200 events surfaced in the admin)
* NEW: Per-vendor webhook URLs with rotatable tokens, configurable SKU strategy (SKU / product post ID / custom postmeta key), default order status per vendor
* NEW: AIEO_DMM_Marketplace_Feeds — streaming feed generator that handles 35k-product catalogues without blowing memory. Per-feed cron registration on save; include/exclude rules by product or brand ID; XML or CSV output; configurable field map and target path
* NEW: AIEO_DMM_Shipment_Tracking — cleans up the WooCommerce Shipment Tracking provider list, drops the US/UK/Canada/Germany carriers we never ship to, adds the Greek + Cypriot carriers + Stoferno.gr that the WC plugin doesn't know by default. No-op if the WC Shipment Tracking plugin isn't installed
* NEW: AIEO_DMM_Smart_Shipping_Label — table-rate aware checkout shipping label. Guests / postcode-less carts see "Carrier (Από €X.XX)" with the minimum rate from the table-rate config — so they know shipping isn't free without seeing a misleading default. Once a real postcode is entered, exact rates appear (standard WC behaviour). When the cart qualifies for free shipping, method prices are hidden and only the carrier name is shown — and the generic "Free shipping" pseudo-method is removed (customer still picks a real carrier, just with €0). Greek postcodes formatted "184 53" auto-normalize to "18453"

** 👥 Customer Intelligence + Web Push + Voice-of-Customer **
* NEW: AIEO_DMM_Web_Push — Customer Intelligence + Web Push module. Reads from AIEO's pre-built snapshot tables (wp_aieo_temp_orders / wp_aieo_YYYY_MM_orders) rather than re-querying HPOS from scratch, so the omnichannel customer view (eshop + in-store merged in step 6 of the data-prep pipeline) is the source of truth
* NEW: wp_aieo_customer_intelligence (schema v2) — keyed by eponymous_id (AIEO's canonical customer identity), with secondary wp_user_id and source_table columns so anonymous → logged-in stitching has a single home
* NEW: aieo_sp_recompute_customer_intelligence_batch stored procedure — chunked recompute over the chosen snapshot table; "Recompute now" admin button + top-50-by-LTV preview table for sanity-checking before push campaigns go out
* NEW: Behavioural segments derived from the intelligence table — Top customers, Lost cohort, Lookalikes, Abandoned-cart, reactivation
* NEW: Triggered web-push flows — welcome, reactivation, price-drop, back-in-stock — with full dispatch log + per-subscriber delivery + click attribution
* NEW: AIEO_DMM_Surveys — Customer Survey Intelligence. Two-tier model: wp_aieo_survey_responses (mirror of Gravity Forms entries 18 + 20) + wp_aieo_survey_intelligence (per-customer aggregation + composite Voice-of-Customer score). 7 high-signal metrics tracked: nps_class (promoter/passive/detractor), overall_satisfaction (1-5), is_professional_verified, personal_priorities (prices/quality/speed/etc), discovery_channel (store/google/ad/wom/multi), gift_category_preference, personal_profile (hair/eye/skin/silhouette/height)
* NEW: Survey ingest happens three ways — gform_after_submission hook (real-time), daily WP-Cron (safety net), "Ingest now" admin button (manual trigger). Surveys table is the ONLY place we touch Gravity Forms tables
* NEW: voc_score (0-100) per customer derived from NPS + satisfaction + UX average + repurchase intent
* NEW: AIEO_DMM_Waitlist — "Notify me when back in stock" subscription. Out-of-stock product pages render the signup form; jQuery keeps the form in sync with variation changes. Stock watcher hooked on woocommerce_product_set_stock_status — when a product flips back to instock, emails every subscribed row and marks them notified. One-shot migration from the legacy wp_om_ppe_waitlist table. Legacy AJAX endpoint kept as a compat shim so cached HTML from the PPE era keeps working
* NEW: AIEO_DMM_Wishlist (analytics) — read-only admin views over wp_aieo_wishlist answering: how many items sit in wishlists right now, which products are most-wishlisted, which surfaces drive wishlist adds (source_type breakdown), which specific pages / categories drive them (source_id + source_name)

** 🔒 Pro Tier — Frosted-Glass Overlays on 13 Admin Tabs **
* NEW: AIEO_DMM_Module_Base::is_pro_locked() + get_pro_promo() — extension points subclasses override to lock a tab behind the Pro membership
* NEW: AIEO_DMM_Module_Base::render_pro_locked_screen() — Apple-glass frosted overlay with PRO badge, custom title + description + bullet list per feature, "Upgrade to Pro" CTA pointing at rooster.systems/get-aieo/
* NEW: Pro overlay on 13 tabs — Attribution Dashboard, Advertising Campaigns (Attribution group), Web Push, Customer Intelligence Surveys, Insights Chat, Shipment Cost Reports, Insights Remote DB Settings, Action Scheduler Cleanup, ERP Bridge, ERP Database, Order Documents & Couriers (Fulfillment), Marketplace Order Importer, Branch Stock Scanner, Order Cancellations
* NEW: Each locked tab carries its own promo copy — title, 1-paragraph description, 3-4 bullet feature list — so the upsell is feature-specific, not generic
* Improved: Locked tabs do NOT execute the real render_subtab() — no heavy backfills, no credential exposure, no database queries fire for non-Pro operators

** 🔑 Single Canonical Pro Detection Helper **
* NEW: AIEO_DMM_Module_Base::is_aieo_pro_user() — single source of truth for "is the operator on Pro?"
* NEW: Recognises BOTH licensing paths — (1) logged into eshop-optimizer.com with Pro membership, or (2) connected to rooster.systems via the Content Connector API key. Either is sufficient
* Improved: Refactored inline duplicates in assets/pages/ai-eshop-chat.php and assets/pages/ai-eshop-optimizer.php to call the helper — no more copy-pasted option-pair checks scattered across admin pages

** 🧭 Attribution Menu Restructure **
* NEW: New top-level "Attribution" menu group at priority 50 (between Customer Profiling and Storefront Display)
* Improved: Attribution Dashboard moved into the Attribution group (was a standalone top-level pill)
* Improved: Advertising Campaigns moved from Pricing & Offers into the Attribution group — same dropdown as the dashboard it shares data with
* NEW: Campaigns auto-populate from utm_campaign via AIEO_DMM_Campaigns::touch() — operator never has to pre-register campaigns; new slugs appear as auto_draft rows the next time the dashboard renders
* Improved: AIEO_Attribution::backfill_session_channels() now calls touch() on every newly-resolved campaign slug; promo_surfaces stay in Pricing & Offers via the existing alias map

** 🗣️ Greek Translation Pass + i18n Hygiene **
* NEW: All 11 admin-navigator group labels wrapped in __()
* NEW: All Pro-overlay strings translatable — PRO badge, "Upgrade to Pro" CTA, every locked-tab title/description/bullet
* NEW: All Insights Chat suggestion chips translatable per accordion group
* Improved: 117 i18n errors fixed across the plugin
* Improved: Greek (el) .po updated to cover the ~70 new msgids introduced by this release

** ✅ Plugin-check & Security Hygiene **
* Improved: Plugin-check ERRORs reduced from 132 to 0 (excluding the agreed-upon DB stored-procedure rules — these are intentional by design and acknowledged in writing by the WordPress.org plugin review team)
* Improved: 27 files received documented phpcs:disable headers with explanatory comments for the exceptions
* Improved: All AJAX handlers route through a centralised nonce verifier; admin GET reads on capability-gated pages remain nonce-free per the documented exception
* Improved: All $wpdb interpolations either use $wpdb->prepare or hardcoded $wpdb->prefix-derived table names
* Improved: Secure-by-default: every new DB-touching ability has min/max input bounds and sanitize_key on all string keys

** 📐 Architectural Improvements **
* NEW: Module V2 manifest pattern — data/admin/frontend/compute split scaffolding (Phase F of the architectural reset; migration is opt-in per module, no forced sweep)
* NEW: docs/v2-pattern.md documents the V2 layout for future module migrations
* NEW: docs/BUILD_AND_DISTRIBUTION.md documents the SVN deploy workflow and the .distignore mechanism
* NEW: .distignore file at plugin root — excludes dev tooling, internal docs, the Claude Code skill pack, and editor metadata from the wp.org distribution package while keeping everything in Git for development
* Improved: includes/ runtime path now contains only loadable PHP — the inline _v2_pattern.md was moved to docs/

** 🗂️ Database Changes **
* NEW: wp_aieo_remote_export_state — bookkeeping for the streaming export (connection_id, table_name, last_exported_id, last_exported_ts, last_status, last_error)
* NEW: wp_aieo_engagement_daily, wp_aieo_attribution_daily, wp_aieo_conversion_buckets, wp_aieo_blog_engagement_daily, wp_aieo_cart_removal_daily — pre-aggregated rollup tables consumed by the new abilities
* Improved: wp_aieo_addcart_events.source enum widened to include 'blog_post'
* Improved: New indexes on (date, product_id) and (date, source) for every rollup table

** 📁 New Files **
* includes/chat/class-aieo-merchant-chat.php — in-admin Insights Chat
* includes/dmm/modules/class-aieo-dmm-insights-chat.php — DMM wrapper delegating to the merchant chat
* includes/dmm/modules/class-aieo-dmm-remote-export.php — Remote DB streaming admin
* includes/claude/class-aieo-claude-bootstrap.php — registers the 33 abilities
* includes/claude/abilities/class-*-ability.php — the ability classes (21 original + 11 added in this release + 1 pre-existing)
* includes/class-aieo-session-attribution-bridge.php — joint analytics query helpers
* includes/class-aieo-conversion-probability-model.php — engagement-bucket scoring
* includes/class-aieo-remote-export-manager.php — paged INSERT-batch streaming to remote DB
* includes/class-aieo-ratings-schema.php — SEO plugin schema bridge
* includes/cron/class-aieo-aggregate-cron.php — nightly rollup builder
* includes/cron/class-aieo-archive-handlers.php — AE / reco retention with remote-export gating
* includes/cron/class-aieo-remote-export-cron.php — configurable export cron
* includes/class-aieo-retention-bootstrap.php — top-level retention wiring
* includes/sql/sql-aggregate-rollups.php — DDL for the 5 rollup tables
* includes/sql/sql-remote-export-state.php — DDL for the bookkeeping table
* assets/pages/dmm/remote-export.php — admin page template
* docs/v2-pattern.md — V2 module pattern reference
* docs/BUILD_AND_DISTRIBUTION.md — build / SVN deploy strategy
* .distignore — wp.org distribution package filter

** ⚠️ Operator Notes **
* On first activation of 5.0 the new aggregate rollup tables are created and the nightly aieo_aggregate_rollups cron begins back-filling history; expect 1-3 nightly runs before the chat abilities reach full historical coverage
* Operators who configure the Insights Remote DB export should leave "Hold local archive deletes until the remote confirms" ON (the default) — the failsafe prevents data loss when the remote is briefly unreachable
* The 13 Pro-locked tabs are visible to free-tier operators with a frosted overlay; the underlying database tables are still created on activation so a later Pro upgrade has zero migration cost
* No customer-facing front-end changes — this is an admin-side and analytics-side release


= 4.2 Products for the Same Needs (28/01/2026) =

** 🎯 NEW FEATURE: Need-Based Product Recommendations **

This release introduces "Products for the Same Needs" - a powerful new recommendation system that suggests products fulfilling the same customer needs. Unlike traditional cross-sells and upsells, these recommendations are based on matching customer needs (via the pa_need product attribute), ranked by actual sales performance.

** 🛒 Products for the Same Needs **
* NEW: Automatic product suggestions based on matching customer needs (pa_need taxonomy)
* NEW: Intelligent matching algorithm finds products sharing primary or secondary needs (optimized for performance)
* NEW: Rankings powered by pre-computed TotalItemSales from product catalogue for maximum performance
* NEW: Smart exclusion of existing upsells and cross-sells to prevent duplicate recommendations
* NEW: Stores up to 6 optimized suggestions per product in wp_aieo_product_need_suggestions table
* NEW: Match scoring system - products with more shared needs rank higher
* Improved: Variations automatically inherit need suggestions from their parent products

** 🎨 Display Configuration **
* NEW: Display checkbox in Display Preferences: "Please display Products for the same needs"
* NEW: Displays FIRST on product pages (priority 10) - appears before upsells, cross-sells, and related products
* NEW: Skeleton loading animation with WooCommerce placeholder images while fetching via AJAX
* NEW: Empty sections automatically hidden when no matching products exist (no blank titles)
* NEW: Translatable section title: "Products for the Same Needs"
* Improved: Consistent styling with other AIEO recommendation sections

** ⚙️ Generation & Operational Efficiency **
* NEW: Generation checkbox in Operational Efficiency: "Please generate products with the same needs"
* NEW: Runs as final step in Operational Efficiency batch processing (after UUID generation)
* NEW: Batch processing with configurable batch size (default 100 products per batch)
* NEW: Progress logging shows products processed and suggestions created
* NEW: AI_eShop_Need_Suggestions generator class with singleton pattern
* Improved: Leverages existing wp_aieo_core_product_vitals table for need data
* Improved: Uses wp_aieo_temp_product_catalogue for pre-computed TotalItemSales (faster, no aggregation needed)

** 🚀 Performance & Caching **
* NEW: same_needs added to AIEO_Recommendations_Cache valid relation types
* NEW: Multi-tier caching: Object Cache (Redis/Memcached) + Database table
* NEW: Cache automatically invalidated when products are updated
* NEW: Seamless integration with existing AJAX lazy loading infrastructure
* Improved: Suggestions stored as JSON array for fast retrieval
* Improved: Database indexes on product_id for optimal query performance

** 🗄️ Database Changes **
* NEW: wp_aieo_product_need_suggestions table with columns:
  - id (auto-increment primary key)
  - product_id (unique index for fast lookups)
  - suggested_products (JSON array of up to 6 product IDs)
  - match_score (number of needs matched with best suggestion)
  - created/modified timestamps
* NEW: Table created automatically on plugin activation
* NEW: Default options: aieo_create_need_suggestions, aieo_display_same_needs

** 📁 New Files **
* includes/class-need-suggestions.php - Generator class with methods:
  - generate_all_suggestions() - Batch generate for all products
  - generate_suggestions_for_product() - Generate for single product
  - get_suggestions() - Retrieve suggestions for display
  - find_matching_products() - SQL query for matching products
  - get_excluded_product_ids() - Get upsells/crosssells to exclude

** 🔧 Technical Implementation **
* Uses pa_need product attribute (configurable via aieo_core_attribute_need option)
* Queries wp_aieo_core_product_vitals for primary_need_id and secondary_need_id only (no string parsing needed)
* Ranks by pre-computed TotalItemSales from wp_aieo_temp_product_catalogue (requires catalogue to be generated first)
* Excludes products from _upsell_ids and _crosssell_ids post meta
* Preserves suggestion order (by sales ranking) when displaying
* Generation checkbox appears at end of Operational Efficiency list to ensure dependencies are met


= 4.0 Dynamic AI Models + Database Collation + Anonymous Chat Logging (27/11/2025) =

** 🎉 MAJOR UPDATE: 50+ AI Model Flavours **

This release introduces dynamic AI model selection from the database, comprehensive database collation fixes for maximum compatibility, and fixes for anonymous user chat logging.

** 🤖 Dynamic AI Model Registry **
* NEW: Dynamic model selection from database - over 50 AI model flavours now available
* NEW: All Anthropic Claude models dynamically loaded (Claude 4, Opus 4.5, Sonnet 4.5, Haiku 4.5, and all versions)
* NEW: All OpenAI models dynamically loaded (GPT-5.1, GPT-5, GPT-4, GPT-o1, GPT-3.5, and all variants)
* NEW: All embedding models (Voyage AI, OpenAI) dynamically populated from wp_aieo_ai_models table
* NEW: Admin panel model dropdowns now populate directly from database registry
* Improved: Adding new AI models no longer requires code changes - simply update the database
* Improved: Model selection uses get_models() method with provider/type filtering

** 🗄️ Database Collation Compatibility **
* Fixed: aieo_create_core_product_attributes_table() now uses aieo_get_charset_collate()
* Fixed: aieo_create_core_product_vitals_table() now uses aieo_get_charset_collate()
* Fixed: aieo_create_core_variation_vitals_table() now uses aieo_get_charset_collate()
* Fixed: All AIEO tables now consistently use utf8mb4_uca1400_ai_ci (or database default)
* Fixed: Removed BINARY comparison from AIEO_InsertCoreProductAttributes stored procedure
* Improved: Full compatibility with MariaDB 11.4, MariaDB 11.8, MySQL 5.7, and MySQL 9
* Improved: Tables no longer created with latin1_swedish_ci collation

** 💬 Anonymous User Chat History **
* Fixed: Chat exchange logging now works correctly for anonymous (non-logged-in) users
* Fixed: Session tracking properly handles anonymous user conversations
* Fixed: Re-ranking system properly logs all chat exchanges regardless of user status
* Improved: Chat history storage works for both authenticated and guest users

** 🌐 Translation Improvements **
* Fixed: Frontend chatbox now correctly loads translations from plugin languages directory
* Fixed: Translation loading hook priority changed to 0 for earliest execution
* Improved: Fallback translation loading from WP_LANG_DIR/plugins/, plugin /languages/, and standard WordPress location
* Improved: load_textdomain() now checks multiple paths before falling back to load_plugin_textdomain()

** 🔑 API Key Validation & Credit Check **
* NEW: "Validate API Keys & Check Credits" button in AI Chat settings
* NEW: One-click validation of all configured API keys (Anthropic, OpenAI, Voyage AI)
* NEW: Automatic detection of exhausted credits with clear warning messages
* NEW: Direct links to each provider's billing dashboard for easy credit top-up
* NEW: Status indicators: ✓ Valid, ✗ Invalid, ⚠️ No Credits, — Not Configured
* Improved: Helps diagnose why chat/embeddings may not be working

** 🔧 Technical Improvements **
* Enhanced: AI Chat settings page now uses AI_eShop_Chat_Model_Registry::get_instance()
* Enhanced: Chat model and embedding model dropdowns use get_models('provider', 'type', false) for all models including inactive
* Enhanced: Stored procedure taxonomy comparison simplified (removed BINARY and COLLATE)
* Code: Updated ai-eshop-chat.php model dropdown population (lines 666-669, 1026-1029)
* Code: Updated ai-eshop-chat-addon.php translation loading (lines 143-167)

** 📊 Database Index Optimization **
* NEW: Added 6 missing Graph UUID indexes for optimal export performance
* NEW: idx_graph_ppid for Parent Product UUID lookups
* NEW: idx_graph_orderid for Order UUID lookups
* NEW: idx_graph_prodid for Product UUID lookups
* NEW: idx_graph_epoid for Customer UUID lookups
* NEW: idx_graph_o_epo for Order-Customer relationship lookups
* NEW: idx_graph_pp_epo for Product-Customer relationship lookups
* NEW: idx_product_stats_filter for aggregate_product_stats WHERE clause optimization
* Improved: Database optimization now creates 20 indexes (up from 13) for MariaDB and MySQL 8


= 3.6 MySQL 8 Compatibility + Re-ranking + Error Detection (13/11/2025) =

** 🎉 MAJOR UPDATE: 100% MySQL 8 Support **

This release brings complete MySQL 8.0+ compatibility, advanced search re-ranking, and comprehensive embedding error detection. The plugin now works flawlessly on both MariaDB 11.4+ and MySQL 8.0+ with automatic detection and optimization.

** 🗄️ MySQL 8 & Database Compatibility **
* Complete MySQL 8.0+ support - all SQL syntax converted to cross-compatible code
* Auto-detection of MySQL 8 vs MariaDB with appropriate optimization strategies
* MySQL 8 histogram statistics support for 20-30% faster query optimization
* Descending indexes for MySQL 8 to optimize recent-order queries
* Fixed all 52+ DROP INDEX IF EXISTS syntax errors (MariaDB-specific)
* Fixed CREATE OR REPLACE FUNCTION errors - converted to drop-then-create pattern
* Binary logging privilege handling with graceful degradation
* Helper functions for cross-database compatibility (aieo_drop_index_if_exists, aieo_drop_function_if_exists)
* New file: includes/sql/apply_mysql8_indexes.php - MySQL 8 specific optimizations
* Expected 38-48% performance improvement on MySQL 8 after optimization (tested: 9.5min → 5-6min for 37K products)
* 13 composite indexes + histogram statistics on 6 key columns

** 🔍 Advanced Search Re-ranking System **
* Configurable re-ranking weights for hybrid semantic + keyword search
* Dedicated "Re-ranking Weights" configuration UI in AI Chat settings
* Semantic similarity weight slider (0-100%) with real-time preview
* Keyword matching weight slider (0-100%) with automatic normalization
* Visual feedback with color-coded weight distribution indicators
* Three preset configurations: Semantic-focused (70/30), Balanced (50/50), Keyword-focused (30/70)
* Database schema migration for re-ranking weights storage
* Search results now intelligently combine embedding similarity with keyword matching
* Better handling of product variations vs parent products in rankings

** 🚨 Embedding Error Detection & Reliability **
* Comprehensive failure tracking system - new wp_aieo_chat_embedding_failures table
* Real-time statistics: success rate, average latency, failure breakdown by type
* Automatic retry logic with exponential backoff for transient errors
* Smart error categorization: Rate Limits, Timeouts, Network Errors, Invalid Input, Unknown
* Failure trend analysis with 30-day time-series data
* Visual error rate graphs with severity indicators (green <1%, yellow 1-5%, red >5%)
* Detailed error logs with timestamps, error types, and affected content IDs
* Automatic recovery suggestions based on error patterns
* Failed items flagged for priority retry in next training batch
* Training progress now shows retry attempts and detailed error messages
* API quota management with intelligent retry delays (60s for rate limits, 30s for timeouts)
* Batch processing handles partial failures gracefully - continues with remaining items

** 📊 Database Performance Optimization **
* New MySQL 8-specific index optimization strategy
* Histogram-based query planning (MySQL 8 exclusive feature)
* Performance indexes for customer statistics queries
* Optimized covering indexes for product catalog queries
* DESC indexes for latest-order queries (MySQL 8 native support)
* Auto-detection in "Database Performance Optimization" admin section
* Different benefits messaging for MySQL 8 vs MariaDB users

** 🔧 Technical Improvements **
* Enhanced logging throughout embedding and search processes
* Better error handling with actionable user feedback
* Database query optimization for embedding statistics
* Code organization with separate MySQL 8 file for maintainability
* Improved variation enrichment with better parent product handling
* Embedding statistics now accurately reflect all content types

** 📝 Documentation Updates **
* MYSQL8-COMPATIBILITY-FIX.md - Complete MySQL 8 compatibility guide
* Performance tuning recommendations for MySQL 8
* Re-ranking configuration best practices
* Error detection monitoring guide

** 🐛 Bug Fixes **
* Fixed variation enrichment handling of missing parent data
* Fixed embedding statistics accuracy across post types
* Fixed stored function creation on MySQL 8 with binary logging enabled
* Fixed database migration for re-ranking weights default values
* Fixed undefined variable warnings in embedding error tracking


= 3.5 Advanced Session Tracking & Analytics (07/11/2025) =

** ✨ New Session Tracking Features **
* Added custom class-based event tracking - define custom CSS selectors to track clicks on any element (buttons, swatches, divs, etc.)
* Added click event throttling option to prevent database flooding while maintaining accurate click counts
* Added cookie consent bypass mode - option to enable tracking without waiting for user consent (GDPR compliance toggle)
* Custom rules take precedence over standard tracking to prevent double-counting events
* Product image click tracking with 5-second debounce window to avoid duplicate events from lightbox interactions
* Automatic version bumping with variable-length strings for aggressive cache busting
* Admin textarea for easy custom tracking rule configuration (format: event_name | .css-selector)

** 🔧 Session Tracking Technical Improvements **
* Generated JavaScript code is "baked in" as inline scripts for better performance (not computed dynamically)
* Custom tracking rules override standard click tracking to prevent duplicate event recording
* Improved click counting: throttled mode counts only significant clicks, non-throttled counts all clicks
* Enhanced product image detection across different theme gallery structures
* Version string uses random lengths (8-19+ digits) for superior cache invalidation

= 3.3.2 Performance & Reliability Release (04/11/2025) =

** 🐛 Critical Bug Fixes **
* Fixed embedding training duplicate product ID issue causing infinite loops and HTTP 524 timeouts
* Fixed AI Chat warning modal not disappearing after data analysis completion
* Fixed sessionStorage persistence across page reloads for warning state

** 🚀 Performance Improvements **
* Added performance indexes (lookup_idx, stats_idx) to embeddings table for 10-20x faster queries
* Optimized database queries with DISTINCT/GROUP BY to prevent duplicate results
* Changed index checks from transients to static variables (eliminates wp_options writes)
* Reduced embedding batch processing time from 60-120 seconds to 20-30 seconds for 50 products
* Object cache bypass during critical operations to prevent interference from misconfigured Redis/Memcached

** 🔧 Technical Improvements **
* Multi-layer duplicate protection: SQL DISTINCT, array_unique() at entry/exit, GROUP BY aggregation
* All 8 priority metrics (TotalItemSales, DistinctOrderSales, TotalTurnover, etc.) now use optimized queries
* Query existence checks now use fast `USE INDEX` method instead of INFORMATION_SCHEMA
* Added comprehensive error logging for database operations (can be toggled)
* Chat addon updated to v1.1.1 with improved sessionStorage handling

** 📚 Developer Documentation **
* Added DATABASE-INDEX-OPTIMIZATION.md - Complete index strategy and performance guide
* Added DUPLICATE-FIX-SUMMARY.md - Technical documentation of all duplicate prevention fixes
* Added INDEX-CHANGES-SUMMARY.md - Quick reference for index changes and rollback
* Added SESSION-SUMMARY.md - Complete session work summary
* Added OBJECT-CACHE-CONFIG.md - wp-config.php object cache exclusion instructions

= 3.3.1 Admin Styling & WordPress.org Compliance (03/11/2025) =

** 🐛 Bug Fixes **
* Fixed admin panel styling issues - cleaned up overlapping CSS rules and consolidated chat admin styles
* Fixed plugin description exceeding 150 character limit - reduced to 114 characters for WordPress.org compliance

** 🔧 Technical Improvements **
* Chat addon CSS version bumped to 1.1.0 to force cache refresh for style updates
* Improved CSS organization and eliminated redundant style declarations

= 3.3 Standalone Mode & Enhanced Flexibility (03/11/2025) =

** ✨ Major New Features **
* Plugin now works standalone without WooCommerce - perfect for corporate sites and merchant information pages
* Intelligent menu placement - integrates seamlessly with WooCommerce when available, creates standalone top-level menu otherwise
* Custom network icon for better visual identification in WordPress admin
* Customizable AI Chat input placeholder text in settings

** 🎨 UI/UX Improvements **
* Shortened menu labels ("AI Optimizer") to prevent UI wrapping on smaller screens
* Added descriptive submenu items with emoji icons for better navigation
* AI Chat tab warning now shows on hover for better user guidance
* AI Chat warning only displays on WooCommerce sites (not needed for standalone content sites)
* AI Chat tab warning automatically refreshes after data analysis completes

** 🔧 Technical Improvements **
* Updated to use future-proof Claude model alias (claude-sonnet-4-5)

** 🐛 Bug Fixes **
* Fixed chat wrapper now properly fills custom popup width without margins
* Fixed send button arrow now points right (horizontally flipped)
* Fixed JavaScript errors with e.target.closest() when clicking on text nodes in theme files

= 3.2.1 Embedding Generation Bug Fixes (02/11/2025) =

** 🐛 Critical Bug Fixes **
* Fixed deduplication mode setting not saving correctly when changed via Training Mode dropdown - now properly respects user selection
* Fixed product prioritization querying wrong table - now correctly pulls sales metrics from temp_orders table instead of product_vitals
* Fixed embedding statistics showing incorrect counts - now accurately counts only parent products and excludes individual variations
* Fixed inconsistent product counts between training and statistics - all queries now use matching data sources (product_vitals table)
* Fixed draft/trash products being included in counts - all queries now filter by post_status='publish' for accuracy

** 🔧 Technical Improvements **
* Enhanced query consistency across embedding generation, statistics, and product prioritization
* Improved data source alignment to prevent count mismatches during training
* Better filtering logic to ensure only published parent products are processed

= 3.2 Major Feature Update (01/11/2025) =

** ✨ New Features **
* Support for Pages and Posts in visual editors (Elementor, WP Bakery, TagDiv Composer) - AI Chat now intelligently extracts and processes content from popular page builders for enhanced semantic search capabilities
* Added helpful documentation links throughout the interface to guide users on metric meanings and business implications

** 🌟 New PRO Features **
* Process Automation - Schedule automatic data analysis and embedding updates with flexible daily/weekly timing options for hands-free optimization
* Contextual Metadata - AI Chat now leverages device profile, browsing history (configurable page depth), and user preferences to deliver hyper-personalized product recommendations
* AI Session Tracker (Beta) - Track customer engagement depth, product interactions, scroll behavior, and cart activity with surgical precision analytics that cost $0 vs $100+/month for Google Analytics BigQuery exports

** 🎨 UI/UX Improvements **
* Enhanced HTML structure for better visual consistency across AI Chat configuration sections
* Fixed Posts & Pages configuration header to extend properly across full width, matching Products section styling
* Improved admin panel layout with better spacing and alignment throughout
* Better visual hierarchy in settings pages for easier navigation

** 🐛 Bug Fixes **
* Various minor UI/UX refinements and polish
* Improved CSS consistency across admin panels

= 3.1.2 Referral Tracking Enhancement (31/10/2025) =

** ✨ New Features **
* Added referral links tracking for better affiliate program management
* Enhanced tracking capabilities for referral campaigns
* Better analytics for referral link performance

= 3.1.1 Installation Fix (31/10/2025) =

** 🛠️ Bug Fixes **
* Fixed plugin installation issues ensuring all required files are properly included
* Resolved missing file dependencies during fresh installations
* Improved plugin activation reliability

= 3.1 Maintenance Release (31/10/2025) =

** 🔧 Technical Updates **
* Version bump to ensure all files are properly distributed
* Verification of file structure and package completeness

= 3.0 AI Chat & Major Enhancement Update (30/10/2025) =

** 🎉 Major New Feature: AI-Powered Chat **
* FREE AI Chat with support for latest models from Anthropic and OpenAI
* Cutting-edge AI models: Claude Opus 4.1, Claude Sonnet 4.5, Claude Haiku 4.5
* OpenAI support: GPT-5, GPT-4, GPT-o1, GPT-3.5
* Advanced embedding engines for semantic product search
* Voyage AI embeddings: voyage-3.5-large, voyage-3.5-lite, voyage-3-lite, voyage-finance-2
* OpenAI embeddings: text-embedding-3-large, text-embedding-3-small, text-embedding-ada-002
* Smart product search powered by AI semantic similarity matching
* Context-aware responses using customer behavior data
* Customizable chat templates for different use cases
* Product catalog integration with AI embeddings

** 🎨 Chat Customization **
* Two visual themes: Rounded (Modern with shadows) and Square (Clean and minimal)
* Dynamic color customization for complete branding control
* Header gradient automatically uses brand colors
* Send button styling matches brand colors
* Chat input no longer inherits theme styles for consistent appearance
* Mobile-responsive chat design
* Floating chat widget with adjustable positioning (bottom-left/right, top-left/right)
* Customizable welcome bubble messages

** 🔧 Technical Improvements **
* WordPress coding standards compliance - all 54+ coding standard issues resolved
* Enhanced database query preparation with proper $wpdb->prepare() usage
* Translator comments added for all translatable strings
* Ordered placeholders (%1$s, %2$d) for better translation support
* Date/time functions now use timezone-safe gmdate()
* Proper nonce escaping with esc_js() throughout
* POT file updated with all new translation strings
* Version bumped to 3.0 reflecting major feature additions

** 🛡️ Privacy & Performance **
* AI Session Tracker (Beta) now disabled by default for better privacy
* Cron job properly configured to clean up old session data (retention period)
* Console logging cleaned up - all debug messages commented out
* Optimized AJAX requests for chat statistics
* Improved error handling and validation

** 🐛 Bug Fixes **
* Fixed chat input inheriting unwanted theme styles (size, borders, positioning)
* Fixed send button icon direction - now points right instead of up
* Fixed deduplication mode persistence across page reloads
* Fixed last trained engine settings not being remembered
* Fixed embedding statistics display for different engine types
* Removed deprecated load_plugin_textdomain() for WP 4.6+
* Fixed unlink() usage - replaced with wp_delete_file() where appropriate

** 📚 Documentation **
* Updated readme.txt with comprehensive AI chat feature descriptions
* Detailed changelog with all improvements and fixes
* Updated plugin descriptions highlighting latest AI capabilities
* Better organization of feature lists


= 1.0 Initial Release (3/8/2023) =
* Initial plugin release
* AI-powered product recommendations via eshop-optimizer.com
* Export product catalog and order data
* Import upsell and cross-sell recommendations
* Google GA4 integration for performance tracking
* Support for WooCommerce HPOS (High-Performance Order Storage)
* Privacy-centric data export options


= 2.0 Core Update (17/10/2024) =

** Major Features **
* Local Analytics Engine: Analyze your product performance using local data without requiring external AI processing
* Smart Product Tips: Get valuable insights about your most important products based on local sales patterns
* Performance Boost: Significantly improved data processing speed with optimized database queries

** Database Compatibility **
* Enhanced compatibility with MariaDB 11+ and MySQL 9.0
* Universal database support - works with all major database versions
* Removed hardcoded collation statements for better database compatibility

** Performance Improvements **
* Optimized stored procedures (v2 and v3 batched versions)
* Smart batch processing for large datasets
* Improved query execution speed
* Enhanced memory management for large order exports

** New Features & Enhancements **
* Advanced customer-centric statistics and analytics
* Improved product vitals tracking
* Better variation handling and processing
* Enhanced reciprocal product recommendations

** Technical Improvements **
* PHP 8.4 compatibility
* Prefixed admin CSS classes to prevent plugin conflicts
* Refactored codebase for better maintainability
* Improved error handling and logging

** Bug Fixes **
* Fixed database collation issues on various hosting environments
* Resolved CSS conflicts with other plugins
* Various minor bug fixes and stability improvements


= 2.1 Performance & Localization Update (18/10/2024) =

** Performance Enhancements **
* Major performance optimizations for faster data export and processing
* Optimized database queries for handling large product catalogs
* Improved stored procedure efficiency
* Enhanced memory usage for bulk operations

** New Features **
* Full localization support - plugin is now translation-ready
* Database collation compatibility helper for WooCommerce installations with mixed collations
* Enhanced support for complex product attributes including multi-valued attributes
* Support for hierarchical attribute structures

** Attribute Handling Improvements **
* Improved handling of brands, sizes, colors, and custom attributes
* Better support for product variations with complex attribute structures
* Enhanced processing of multi-valued attributes
* Improved handling of special characters in product attributes

** Compatibility & Fixes **
* Resolved issues with mixed database collations in multi-language installations
* Better handling of edge cases in attribute processing
* Improved compatibility with various WooCommerce configurations
* Fixed attribute export issues in certain hosting environments

** Code Quality **
* Refactored attribute processing for better maintainability
* Improved code organization and documentation
* Enhanced error handling and validation
* Optimized code paths for common operations