=== Smekits Chat ===
Contributors: smekits
Tags: chatbot, faq, ai, widget, deepseek
Requires at least: 6.0
Tested up to: 6.9
Stable tag: 0.17.5
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Lightweight on-site chat widget. Local FAQ works out of the box, unanswered questions turn into contact leads, optionally add your own AI key.

== Description ==

Smekits Chat adds a chat widget to your WordPress site:

* Zero config: a floating bubble appears bottom-right after activation, with built-in Smekits intro + FAQ matching.
* FAQ manager: add/edit questions, keywords, and answers under Settings → Smekits Chat.
* Optional AI: paste your own key for any OpenAI-compatible API (DeepSeek, OpenAI, …; BYOK, billed to you) and unmatched questions fall back to AI.
* Brand link: a small link to smekits.com under the widget, removable in one click.
* No tracking: no external requests and no chat logs by default.

Embed inside content with shortcode: `[smekits_chat]`

== Installation ==

1. Upload the `smekits-chat` folder to `/wp-content/plugins/`.
2. Go to Plugins → activate Smekits Chat.
3. Go to Smekits Chat to change the bot name, welcome message, colors, and FAQs.

== Frequently Asked Questions ==

= Do I need an API key? =
No. Local FAQ + brand fallback work out of the box. A key is only an optional upgrade.

= Where are chats stored? =
Chat questions are logged for 30 days (then auto-pruned) and contact leads are kept until you delete them. Uninstalling the plugin wipes everything.

= How do I remove the Smekits link? =
Settings → Smekits Chat → Appearance → uncheck “Show Smekits link”.

== Screenshots ==

1. Floating widget on the site
2. Settings page

== Changelog ==

= 0.17.5 =
* Fallback reply no longer names Smekits; says "our services" for white-label installs.

= 0.17.4 =
* Internal cleanup: single FAQ cap constant, one stats query, no dead selectors.

= 0.17.3 =
* Unanswered stats and the draft table now include clarify-band chats; tidier dedup and uninstall cleanup.

= 0.17.2 =
* Daily AI cap now gated on the logs table, so the gate and the counter can never disagree.

= 0.17.1 =
* Hotfix: missing parenthesis in the FAQ seed merge (fatal on PHP 8).

= 0.17.0 =
* Smarter matching: answers need keyword plus question-word corroboration, ties prefer the shorter question, near-misses ask "which one do you mean?", and chat logs record the matched FAQ. Ships 10 built-in LeadAutomate FAQs (one-time merge, existing FAQs untouched).

= 0.16.1 =
* Smekits brand link is now always displayed; the opt-out setting is removed.

= 0.16.0 =
* Widget facelift: asymmetric bubbles, bot avatar, typing indicator, unread badge, anchored scroll. Bubble CSS patterns adapted from freefrontend.com/css-chats examples (MIT).

= 0.15.1 =
* Bigger controls, stat icons, and input-group prefixes (| for keywords, key for API key).

= 0.15.0 =
* Admin design tokens: one radius/spacing scale, 14px type floor, semantic stat colors, Q/K/A input badges, button hierarchy. Also fixes Active toggle dimming and duplicate input classes.

= 0.14.2 =
* AI kit download lives inside the how-to steps as a bold link.

= 0.14.1 =
* Markdown flow trimmed to download-kit plus load-file import with read-only preview.

= 0.14.0 =
* FAQ area rework: import/export buttons live with the list, Markdown section is explanation-only, batch select + delete selected/all.

= 0.13.7 =
* One-click fill for FAQs with empty keywords (auto-extracted, for content imported before auto-keywords existed).

= 0.13.6 =
* AI kit: single downloadable file (prompt + samples) for ChatGPT, plus load-result-.md-file button (file never leaves the browser).

= 0.13.5 =
* Color-coded Markdown import boxes: grey mono prompt, green paste area.

= 0.13.4 =
* Color-coded FAQ inputs: blue question, amber keywords, green answer.

= 0.13.3 =
* Markdown import now posts a real form so the success notice with counts actually shows.

= 0.13.2 =
* Full-audit fixes: readme paths and stale claims corrected, stats timezone unified, Add-to-FAQ drafts survive early saves, chip clicks no longer eat typed text, output escaping hardened.

= 0.13.1 =
* Fix duplicate JS declaration that killed the whole settings-page script (Test/Add/Search/Import buttons dead).

= 0.13.0 =
* Markdown round-trip: starter template, copy-paste ChatGPT prompt, paste-back import with preview counts, export current FAQs. Empty keywords auto-filled.

= 0.12.0 =
* AI cost guards: per-IP hourly cap, site-wide daily breaker with admin email, junk and injection probes never reach the API, hardened system prompt, live today-counter.

= 0.11.4 =
* Author link points to smekits.com; added a Settings shortcut under the plugin name.

= 0.11.3 =
* Brand footer is now a CTA link to smekits.com (still one-click removable in settings).

= 0.11.2 =
* Fix auto-open ignoring the saved setting when flags arrive as "0" strings; brand toggle hardened the same way.

= 0.11.1 =
* Bigger chat panel (370px, taller history) and 15px type to match industry standard widget sizing.

= 0.11.0 =
* Icon-only launcher when minimized, full-width sheet on mobile, send button disables mid-request, chat log announced to screen readers. Greeting intent (EN+MS) with popular-question chips. Import now auto-fills keywords (pure PHP, no API).

= 0.10.0 =
* Smarter matching: scores keywords AND question text, so exact questions always hit even with empty keywords. Fallback suggests closest FAQs; answers come with related questions.

= 0.9.2 =
* Fix dead minimize/Send buttons: `button:last-child` matched the wrong button, use dedicated classes.

= 0.9.1 =
* Accessibility fixes: labels for all inputs, live region on lead feedback, keyboard support on FAQ accordion, safe-area + touch-action on mobile widget.

= 0.9.0 =
* Dashboard redo: top-level menu, Overview / FAQs / Leads / Appearance / AI / Help tabs, per-FAQ Active toggle, sticky save bar.

= 0.8.0 =
* FAQ management complete: per-row Delete, + Add FAQ button, Test-a-question box, live search filter.

= 0.7.0 =
* AI settings generalized: any OpenAI-compatible endpoint + model + key. Old DeepSeek keys migrate automatically.

= 0.6.0 =
* Import from site content: one click pulls latest posts/pages in as FAQ drafts (deduped).

= 0.5.0 =
* Mini dashboard: 30-day chat counts, FAQ hit rate, top unanswered questions with one-click “Add to FAQ”.

= 0.4.0 =
* Lead capture: contact form appears when the bot cannot answer; leads saved + emailed to admin, with consent tick and spam throttle.

= 0.3.0 =
* English UI: all labels, helpers, defaults, and widget strings in English.

= 0.2.0 =
* Settings page redo: 3-step onboarding strip, sticky live preview, inline help per field, advanced key collapsed.

= 0.1.0 =
* First release: bubble + shortcode + FAQ + optional DeepSeek + brand toggle.

== External services ==

This plugin contacts no external server by default. Only when you save an API key under Smekits Chat → AI, and a visitor question matches no local FAQ, the question text is sent to your configured OpenAI-compatible endpoint (default `https://api.deepseek.com/chat/completions`) to generate a reply. With no key saved, no request ever leaves your site.
