=== Nyelux Widget ===
Contributors: nyelux
Tags: chat, ai, assistant, medical devices, customer support
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add the Nyelux AI assistant to your site — an FDA-aware chat widget that answers visitors' product questions, grounded in your own content.

== Description ==

**Nyelux Widget** adds the Nyelux AI assistant to your WordPress site as a floating chat bubble (or an inline embed). Visitors can ask questions about your products and get instant answers grounded in **your** content plus neutral FDA device data (GUDID, MAUDE, FDA labels) — with built-in safeguards that decline off-label, dosing, and clinical-judgment questions.

Setup is one field: paste the **public key** Nyelux provides and save. The widget loads a small (<5 KB) script from the Nyelux CDN that boots an isolated iframe (Shadow DOM), so it cannot leak CSS or JavaScript into your theme. New to Nyelux? Request access at https://nyelux.com/widget and we'll provision your account, plan, and widget — then you paste the key here.

= Features =

* Floating bubble (bottom-right or bottom-left) or inline embed inside any page element.
* Answers grounded in your vendor content + neutral FDA/GUDID data, with source citations.
* FDA-aware refusals for off-label / dosing / clinical-judgment questions.
* Soft lead capture (visitors can leave an email mid-conversation).
* Zero theme conflicts — the chat UI runs inside an isolated iframe.

= I don't have a Nyelux account yet — how do I get started? =

Request access at https://nyelux.com/widget. The Nyelux team will set up your vendor account, confirm a plan that fits your site, and provision your widget. You'll then receive a **public key** — paste it into this plugin (**Settings → Nyelux Widget**) and the assistant goes live on your site. (This is a guided, white-glove setup so your content and branding are configured correctly before launch.)

= Where do I get my public key? =

Existing customers: sign in to your Nyelux vendor dashboard and open **Widget → Install Status**. Copy the public key shown there and paste it into this plugin's settings (**Settings → Nyelux Widget**). The key is your install's permanent credential (not a trial token), so once you paste it the widget keeps working. New to Nyelux? Request access at https://nyelux.com/widget.

= Uses a Third-Party Service =

This plugin connects to **Nyelux**, a third-party service, to provide the chat assistant. When a visitor opens the chat, the widget loads a script from the Nyelux CDN (`https://widget.nyelux.com`) and the visitor's questions, the current page URL/title (for context), and — only if the visitor chooses to provide it — an email address are sent to the Nyelux API (`https://api.nyelux.com`). No data is sent until a visitor interacts with the widget, and the widget does not load at all unless you configure a public key.

To protect the service from automated abuse, the widget also loads **Cloudflare Turnstile** (`https://challenges.cloudflare.com`), an invisible bot-detection challenge, when a visitor starts a chat. Cloudflare processes challenge data per its Privacy Policy and Turnstile Privacy Addendum.

* Service: Nyelux — https://nyelux.com
* Terms of Service: https://nyelux.com/terms
* Privacy Policy: https://nyelux.com/privacy
* Bot protection: Cloudflare Turnstile — https://www.cloudflare.com/privacypolicy/ (see the Turnstile Privacy Addendum)

== Installation ==

1. Upload the `nyelux-widget` folder to `/wp-content/plugins/`, or install it from the Plugins screen in WordPress.
2. Activate the plugin through the **Plugins** menu.
3. Go to **Settings → Nyelux Widget**.
4. **Already a Nyelux partner?** Paste your **public key** (from your Nyelux dashboard → Widget → Install Status) and choose a position. The plugin checks the key with Nyelux when you save and tells you whether it's live.
5. **New to Nyelux?** Use the **Request access** form at the bottom of the settings page — it sends your details to Nyelux, who set up your account + plan and provision your widget, then give you a public key to paste in.
6. Save. Once a valid key is set, the chat bubble appears on your site.

== Frequently Asked Questions ==

= How do I know my public key is correct? =

When you save your key, the plugin asks Nyelux to confirm it and shows the result: **✓ Active** (recognized and live), a notice that the key is recognized but not serving yet (still provisioning or paused on Nyelux's side), or **✗ Key not recognized** if it doesn't match — so a typo is caught at setup instead of failing silently on your site.

= I don't have a Nyelux account yet — can I request access from inside WordPress? =

Yes. Open **Settings → Nyelux Widget** and scroll to **Request access**. Fill in your company and work email and submit — it goes straight to the Nyelux team, who will set up your account and provision your widget. (You can also request access at https://nyelux.com/widget.)

= Can I use the same widget on a page that isn't WordPress? =

Yes. The settings page shows a one-line `<script>` snippet (with your key filled in) that you can paste into any HTML page just before `</body>`. The same public key works everywhere.

= Does the widget load if I don't enter a public key? =

No. With no public key configured, the plugin adds nothing to your pages.

= Will it conflict with my theme's styles? =

No. The chat UI runs inside an isolated iframe mounted in a Shadow DOM, so neither your theme nor the widget can affect the other's CSS/JS.

= Can I place the chat inside a specific element instead of a floating bubble? =

Yes. Set Position to **Inline** and provide a CSS selector in **Inline target selector** (for example `.product-chat`).

= What are the Advanced API/CDN settings for? =

Leave them blank. They exist only so Nyelux support can point a test site at a non-production environment.

== Changelog ==

= 1.0.1 =
* Fixed: the widget loader no longer loads inside a page builder's editor/preview. Some builders (notably **Divi's Visual Builder**) render the live page inside an editing iframe where the loader was mounting over the builder canvas and breaking module renderers — Divi's Text module showed "Oops! An Error Has Occurred," so pages could not be edited until the plugin was deactivated. The widget now detects builder/editor/preview/customizer contexts (Divi, Elementor, Beaver Builder, WPBakery, Oxygen, Brizy, Thrive) and stays out of them. This is invisible to site visitors, who never load those contexts.

= 1.0.0 =
* Initial release.
* Settings page: public key, position (floating bubble / inline), inline target, advanced API/CDN overrides, and loader injection.
* Public key is validated with Nyelux on save (recognized / live / not-serving / not-recognized) instead of being assumed valid.
* Built-in **Request access** form for sites that aren't Nyelux partners yet — submits straight to the Nyelux team.
* Copy-paste `<script>` snippet for installing the same widget on non-WordPress pages.

== Upgrade Notice ==

= 1.0.1 =
Fixes a conflict with visual page builders (e.g. Divi's Visual Builder) where the widget prevented pages from being edited. Recommended for all sites built with a page builder.

= 1.0.0 =
Initial release.
