=== StoreSage – AI Chatbot for WooCommerce, Product Recommendations & FAQ ===
Contributors: jknetworks
Tags: ai chatbot, woocommerce chatbot, product recommendations, shopping assistant, product faq
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.5.16
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI chatbot and shopping assistant for WooCommerce — answers product questions with live price and stock, plus in-chat product recommendations.

== Description ==

Add an AI chatbot and shopping assistant to your WooCommerce store that answers pre-sale product questions right on the product page. StoreSage reads your live catalog — real price, real stock — so shoppers get grounded answers instead of invented specs, along with product recommendations they can add to the cart without leaving the chat. Every question the chat could not answer becomes a product FAQ gap you can see and fix, and you get to see which conversations actually made money.

**Grounded answers, or an honest "I don't have that"**

* Real-time price & stock — read live from your store at answer time, never hallucinated.
* Product facts come only from your own catalog and store policies. Specs, ingredients, and usage steps are never invented.
* When there is no grounding for a question, StoreSage does not make something up and does not dead-end you with "contact the store". It says so, then offers two or three concrete things it can do right now — find a product, check size and fit, look up shipping or returns.
* Every reply — including apologies and refusals — comes back in the same language the shopper wrote in.

**Conversation intelligence — from chat log to revenue**

* Sales attribution: the chat → add-to-cart → purchase funnel per product, with attributed revenue. Pure database aggregation, no AI cost.
* Unanswered-question mining: clusters the questions chat could not answer, so your product knowledge gaps stop being invisible.
* AI fix drafts: drafts the product-description sections that close those gaps. Nothing is published until you approve it.

**Knowledge quality audit**

* Right after install, StoreSage checks your catalog and policies for the six facets shoppers ask about most — usage/how-to, ingredients/materials, size/volume, care/storage, shipping, returns/refund — and shows which are covered and which are missing.
* Runs on keyword heuristics against your own content. No AI is called, so it costs nothing.

**Also in the box**

* Inline or floating widget
* Suggested question chips
* In-chat product cards with add-to-cart
* Multi-tenant isolated knowledge per store — your catalog never mixes with another seller's
* Guardrails for profanity, competitor, and refund-promise handling; prompt-injection and system-prompt extraction are refused
* Bring your own OpenAI or Anthropic key (BYOK) instead of using included credits

Part of the JK Composable Suite — works standalone, and when Revoo is installed alongside it, verified review themes flow into the chat's product knowledge.

== Installation ==

1. Install and activate WooCommerce.
2. Upload and activate StoreSage.
3. Open StoreSage settings, connect your license key, and train your catalog.
4. StoreSage works on the free plan out of the box. Pro is optional and is purchased on mustkit.com — the plugin contains no payment form.

== Frequently Asked Questions ==

= Does StoreSage work with any WooCommerce theme? =

Yes. The inline widget attaches to the standard WooCommerce product hook, and you can point it at a different hook from the settings if your theme uses one. On block-based product templates it falls back to rendering in the footer and repositions itself into the product area. All widget styles are namespaced under their own root element, so they do not collide with your theme's CSS.

= Do I need my own OpenAI or Anthropic API key? =

No. The chat runs on included credits, so you can install and be answering questions without signing up for any AI provider. If you would rather call the model with your own key, the settings screen has an optional "Use your own API key (BYOK)" field that accepts an OpenAI or Anthropic key.

= Is there a free version? =

Yes. The free plan includes a monthly allowance of shopper conversations and needs no credit card. Every plugin feature is identical on Free and Pro — only the monthly conversation limit differs.

= How does StoreSage avoid making up product specs? =

Answers are grounded only in your own catalog and store policies, and price and stock are read live from your store at the moment the question is asked rather than remembered. When a question has no grounding in your content, the AI chatbot says it does not have that information and offers two or three concrete things it can do instead, such as finding a product or checking shipping and returns. Specs, ingredients, and usage steps are never invented.

= What languages does the chat support? =

The assistant replies in whatever language the shopper wrote in, including its apologies and refusals. There is no per-language setup — you do not have to pre-configure a list of supported languages.

= Where is my catalog data sent, and is it shared with other stores? =

Product data and the visitor's chat messages go to the StoreSage AI chat service described in the "External services" section below, which returns the answer. Each store's knowledge is kept in its own isolated tenant, so your catalog is never mixed with another seller's or used to answer another store's shoppers. No payment data is sent to the chat service.

= Can the chat add products to the cart? =

Yes. Product recommendations appear as in-chat product cards, and their add-to-cart button goes through WooCommerce's own AJAX add-to-cart endpoint, so your normal cart, pricing, and fragments behave exactly as they do elsewhere on the store.

= How do I see which chats led to a sale? =

The Insights screen shows the chat to add-to-cart to purchase funnel per product, with the revenue attributed to those conversations. It is calculated by aggregating your existing order and event data, so it costs no AI credits to look at.

= Does it slow down my product pages? =

The widget's CSS and JavaScript are enqueued in the footer, and in inline mode they load only on product pages rather than across the whole site. The chat itself is fetched from the service after the page has rendered, so it is not part of your page's initial render path.

= How do I upgrade to Pro? =

Upgrading happens on mustkit.com, outside WordPress — the plugin has no payment form and no card details ever reach it. After purchasing, you paste the license key you receive into the plugin's Plan & Usage screen, which raises your monthly conversation limit.

== Screenshots ==

1. The chat on a live product page — a shopper asks, and gets a grounded answer with the product right there in the conversation.
2. Home — see what the chat actually earned you this month, and the one thing worth fixing next.
3. Insights — which shopper questions turned into purchases, and where the conversations stalled.
4. Knowledge — decide exactly what the AI is allowed to answer from, and spot the gaps before shoppers do.
5. Assistant — the tone, policies, and the chat widget as it appears on your live store.

== External services ==

StoreSage relies on the JK Networks StoreSage service to function:

1. **StoreSage AI chat service** (`storesage.mustkit.com`, operated by JK Networks). To answer shopper questions, the plugin sends product data (titles, descriptions, prices, stock from your WooCommerce catalog) and the visitor's chat messages to this service, which returns AI-generated answers. Required for the chat feature, on both the Free and Pro plan. No payment data is sent here.
   - Terms: https://mustkit.com/legal/service — Privacy: https://mustkit.com/legal/privacy

2. **License activation** (via `platform.mustkit.com`). Upgrading to Pro happens entirely on the mustkit.com website, outside the plugin — the plugin itself contains no payment form. After you purchase there, you paste the license key it gives you into the plugin's Plan & Usage screen; the plugin sends that key to this service to verify it and unlock your higher monthly credit limit. No card details ever reach the plugin or this service.
   - Refund/Payment terms: https://mustkit.com/legal/payment

3. **Support tickets** (via `platform.mustkit.com`). If you submit a question from the Support tab, the plugin sends your message, site URL, and (if you attach it) basic diagnostics (plugin/WordPress/PHP version) to this service so our team can reply.
   - Terms: https://mustkit.com/legal/service — Privacy: https://mustkit.com/legal/privacy

4. **Anonymous usage reporting — opt-in, off by default** (via `storesage.mustkit.com`). Only if you turn on "Share anonymous usage data" in the Assistant tab does the plugin report your site domain, plugin version, and plan (free/licensed) once every 24 hours, so it shows up in your account dashboard. Nothing is sent unless you turn this on, and no catalog, chat, or visitor data is ever included.
   - Terms: https://mustkit.com/legal/service — Privacy: https://mustkit.com/legal/privacy

== Source Code ==

All JavaScript and CSS in this plugin is hand-written, human-readable source, shipped exactly as authored — there is no build, transpilation, or minification step for JS/CSS, so the files in `assets/` are the complete source themselves.

The bundled `vendor/jk-wp-sdk` PHP library is also hand-written source. During packaging its PHP namespace is prefixed per product with PHP-Scoper (to prevent class collisions when two of our plugins are active on the same site); this only renames namespaces and the code remains fully human-readable.

== Changelog ==

= 0.5.16 =
* No functional changes. Renamed the plugin's display title so it states plainly what it is — an AI chatbot for WooCommerce with product recommendations and FAQ. New plugin banner and a new animated plugin icon. The plugin, its settings, and its data are unchanged.

= 0.5.15 =
* New: an occasional, dismissible reminder in the StoreSage admin screens asking whether you would like to review the plugin. It appears only after the plugin has been installed for at least two weeks and your store has actually used the chat, it appears once and never again, and nothing is offered in exchange for a review. Stores that never used the chat never see it.

= 0.5.14 =
* No functional changes. Replaced three very broad plugin tags (woocommerce, chatbot, ai) with more specific ones that describe what the plugin actually does — woocommerce chatbot, shopping assistant, product faq — and reworded the short description and opening paragraph to match. Documentation only.

= 0.5.13 =
* Change: the top-bar credit indicator now shows used / total (e.g. "10 / 500 credits") and has a distinct color so it stands out from the plan badge.

= 0.5.12 =
* New: monthly credit balance now shows in the top bar next to your plan badge (e.g. "1,985 / 2,000 credits left"). It is read directly in the browser, so it displays reliably even when the server-side usage call is blocked by the host.

= 0.5.11 =
* Fix: "Train all" no longer bounces you to the Home screen — it returns to the Knowledge screen so you can see the updated training coverage. Removed a duplicate handler that also pointed at a non-existent server route.

= 0.5.10 =
* Fix: the chat could fail with a "chat token expired" error on cached product pages (the signed chat token is short-lived and was embedded in the cached HTML). The widget now fetches a fresh token from your site and automatically retries once on expiry, so the chat keeps working regardless of page caching or how long the page has been open.

= 0.5.9 =
* New first screenshot showing the chat answering on a real product page, and a matching caption. Screenshot-only change.

= 0.5.8 =
* No functional changes. The bundled SDK's scoped PHP namespace now starts with the plugin's own prefix (`Storesage_ai_chat\Scoped\…` instead of `JKWP\Scoped\…`) to satisfy the WordPress coding standard that all global namespaces be plugin-prefixed. This is a mechanical rename only; behaviour is unchanged.
* Added a Frequently Asked Questions section covering theme compatibility, API keys, the free plan, grounding, languages, data handling, add-to-cart, sales attribution, page performance, and upgrading.
* Rewrote the short description, the opening paragraph, and the screenshot captions for clarity, and noted in Installation that the plugin works on the free plan out of the box.

= 0.5.6 =
* Reformatted long single-line statements in the widget and admin JavaScript for readability, and documented in the new "Source Code" section that all JS/CSS ships as hand-written, unminified source (no build step).
* The public provisioning-challenge REST route no longer returns the raw challenge: it now responds only with a one-way SHA-256 digest (404 when no provisioning is pending), so the endpoint exposes no secret material.

= 0.5.5 =
* Review feedback round: the Revoo review-knowledge integration no longer checks for any license — it works free whenever both plugins are active.
* Removed the "Require valid license" toggle and the last license-related restriction wording; updates are delivered free via WordPress.org for everyone.
* All inline SVG icon and metric card output is now escaped through `wp_kses`/`esc_attr`.
* Support requests now use the correct service endpoint (`platform.mustkit.com`).

= 0.5.1 =
* Fixed WP.org automated scan failures: "Tested up to" bumped to the current WordPress release (7.0), and added the missing `languages/` folder that the Domain Path header pointed to.

= 0.5.0 =
* WordPress.org guideline compliance pass: removed the in-plugin PayPal checkout (upgrading now happens on mustkit.com; the plugin only links out and accepts a license key) and removed all local license checks that hid or capped features — every plugin feature is now identical on Free and Pro, only your monthly credit limit changes.
* Installation reporting is now off by default and only runs if you explicitly turn on "Share anonymous usage data" in Assistant settings.
* Updates are now delivered through WordPress.org's own update system instead of a custom in-plugin updater.
* Bundled the Pretendard admin font locally instead of loading it from a CDN; moved remaining inline `<script>`/`<style>` into properly enqueued files.

= 0.3.0 =
* Conversation intelligence: sales attribution (chat → add-to-cart → purchase funnel with attributed revenue), unanswered-question mining, and AI-drafted product-description fixes awaiting your approval.
* Knowledge quality audit: six-facet coverage check (usage, ingredients, size, care, shipping, returns) on your own content — no AI call, no cost.
* Graceful grounding: when an answer has no basis in your catalog, the assistant says so and offers concrete next steps instead of guessing or dead-ending.
* Replies always follow the shopper's language, including apologies and refusals.

= 0.1.18 =
* In-dashboard Pro upgrade: PayPal subscription button inside Plan & Usage (no external pricing redirect). Server-side payment verification (PayPal re-check + signed webhooks).

= 0.1.13 =
* Settings page (license, updates, AI credits, support) is now fully in English for global sellers.
* Added a 3-step license activation guide showing where to get and how to enter your key.
* Chat widget now hides the store's right-edge currency switcher while the panel is open to avoid overlap.

= 0.1.0 =
* Initial scaffold: base SDK (license/update/settings), plugin bootstrap.
