From ba15e7a4bf9dc4ab6b312f40c2e0199d4e5a8255 Mon Sep 17 00:00:00 2001 From: Agando Date: Mon, 9 Nov 2026 15:02:17 +0100 Subject: feat(chat-widget): shippable widget package replacing the demo as the paid download MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The store sold a €149 package whose download_url was the sales demo page. This is the widget alone: 601 lines, no CDN, no operator host, no model name, config extracted to config.example.js, wx- prefixed ids so embeds cannot collide. Verified in headless Chromium against a mock gateway (streaming, chips, link detection, unconfigured state). --- CHANGELOG.md | 20 ++ LICENSE | 54 +++++ README.md | 83 +++++++ VERSION | 1 + docs/USAGE.md | 233 +++++++++++++++++++ src/config.example.js | 70 ++++++ src/widget.html | 601 ++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 1062 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 VERSION create mode 100644 docs/USAGE.md create mode 100644 src/config.example.js create mode 100644 src/widget.html diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..41a97b2 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,20 @@ +# Changelog + +All notable changes to the WebX11 Chat Widget are recorded here. + +## 1.0.0 — 2026-11-09 + +First packaged release. + +- Standalone `src/widget.html`: bubble, popup/fullscreen panel, streaming + answers, quick-reply chips, clickable links / e-mail / phone detection, + XSS-safe rendering (user input escaped, model output escaped before + formatting), reduced-motion and keyboard/Escape support. +- External configuration via `config.js`; every option has a documented + default in `src/config.example.js`. +- `accentColor` theming with automatic readable text colour. +- Optional system-prompt URL (`promptUrl` + `promptVersion`) with inline + `systemPrompt` fallback. +- Robust NDJSON stream reader (buffers partial lines across chunks). +- No hardcoded host, no bundled credentials, no third-party assets. +- Docs: README, usage guide with CORS troubleshooting, commercial license. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bdb844f --- /dev/null +++ b/LICENSE @@ -0,0 +1,54 @@ +WebX11 Chat Widget — Commercial License +Version 1.0.0 +Copyright (c) 2026 WebX11. All rights reserved. + +This license applies to the software in this package: the widget source +(`src/widget.html`), the configuration template (`src/config.example.js`), +and the accompanying documentation. + +1. GRANT OF LICENSE + Upon payment of the applicable fee, you are granted a non-exclusive, + non-transferable, perpetual license to: + a) install, run and modify the widget; + b) use the widget on any number of websites that you own or operate, + including client websites that you build and maintain on their behalf; + c) modify the source to fit your design and content. + +2. RESTRICTIONS + You may NOT: + a) resell, sublicense, rent, lease or distribute the widget itself, in + original or modified form, as a product, template, starter kit or + downloadable asset, whether alone or as part of a bundle; + b) publish the widget source in a public repository, marketplace or + template library as a standalone reusable component; + c) remove or obscure this license file from copies you redistribute + internally within your own organisation; + d) claim authorship of the original widget. + + Building a website for a client, where the widget is one component of that + website, is permitted under 1(b) and is not a resale under 2(a). + +3. THIRD-PARTY SERVICES + The widget contains no third-party code and bundles no credentials. You are + responsible for the endpoint it calls, for the model behind it, for the + content it returns, and for complying with the terms of whichever model + provider you use. + +4. NO WARRANTY + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF THE SOFTWARE. + +5. SUPPORT + Thirty (30) days of setup assistance are included with the Setup Package, + counted from the date of purchase. Support covers installation and + configuration of this package; it does not cover hosting, model quality, + or third-party services. The optional maintenance plan is governed by its + own terms at the point of purchase. + +6. TERMINATION + This license terminates automatically if you breach Section 2. On + termination you must stop using and delete all copies of the software. + Sections 2, 4 and 6 survive termination. diff --git a/README.md b/README.md new file mode 100644 index 0000000..fcea453 --- /dev/null +++ b/README.md @@ -0,0 +1,83 @@ +# WebX11 Chat Widget 1.0.0 + +A single-file AI chat widget you drop onto your own website. It renders a +floating bubble, streams answers token-by-token from an Ollama-compatible +endpoint, formats links/e-mails/phone numbers, offers quick-reply chips, and +goes fullscreen on phones. No build step, no framework, no external CDN, no +tracking, no cookies. + +## What you receive + +| Item | File | +|---|---| +| Widget source (HTML + CSS + JS in one file) | `src/widget.html` | +| Configuration template with every option documented | `src/config.example.js` | +| This README + license + changelog | `README.md`, `LICENSE`, `CHANGELOG.md` | +| Setup guide, embed snippet, troubleshooting | `docs/USAGE.md` | +| 30 days of setup help by e-mail after purchase | included with the Setup Package | + +You do **not** receive a hosted service, a model, or an API key. The widget is a +front end: it calls an endpoint that you own and operate. That is deliberate — +your conversations and your key stay on your infrastructure. + +## Requirements + +- Any static web host (or an existing site — the widget is a fragment you paste in). +- An Ollama-compatible endpoint reachable over HTTPS that accepts + `POST {"model": "...", "prompt": "...", "stream": true}` and returns + newline-delimited JSON with a `response` field. +- That endpoint must allow your website's origin (CORS). See + `docs/USAGE.md` → Troubleshooting. + +## Install in 3 steps + +1. **Copy the files.** Put `src/widget.html` and a copy of + `src/config.example.js` renamed to `config.js` in the same directory on + your server. +2. **Edit `config.js`.** Set `endpoint` to your gateway (for example + `https://YOUR-HOST/ollama`), set `model`, `title`, `accentColor`, + `welcomeMessage` and `systemPrompt`. Never put an API key in this file. +3. **Open or embed.** Visit the page, or paste the widget block from + `src/widget.html` plus the two ` +``` + +Order matters: `config.js` must be loaded before the widget script runs, and +the widget script must run after the DOM nodes exist (place it at the end of +``, or wrap your own init in `DOMContentLoaded`). + +Minimal page: + +```html + + + + + + My site + + + +

My site

+ + + + + + + +``` + +The widget uses `wx-` prefixed ids and classes and all CSS is scoped to +`#wx-chat-widget`, so it will not collide with your site's styles. It sets +`z-index: 2147483000`; lower it in your CSS if you have a cookie banner that +must sit above the bubble. + +## 4. The endpoint contract + +The widget sends: + +``` +POST +Content-Type: application/json + +{"model":"","prompt":"\n\nUser Question: ","stream":true} +``` + +and expects newline-delimited JSON (Ollama `/api/generate` format), where each +line has a `response` string: + +``` +{"model":"llama3.2:latest","response":"Hello","done":false} +{"model":"llama3.2:latest","response":" there","done":false} +{"model":"llama3.2:latest","response":"","done":true} +``` + +Server-sent events (`data: {...}`) and a non-streaming JSON reply with a +`response` field are also accepted, so most OpenAI-style shims work if they +emit one of those shapes. + +## 5. Gateway examples + +nginx reverse proxy in front of a local Ollama: + +```nginx +location /ollama/ { + proxy_pass http://127.0.0.1:11434/; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_buffering off; # streaming + proxy_read_timeout 300s; + # your key is added here, server side, e.g. + # proxy_set_header Authorization "..." ; (kept out of this doc on purpose) +} +``` + +Ollama itself refuses cross-origin browser calls unless the origin is allowed: + +```bash +# systemd drop-in or shell environment for the ollama service +OLLAMA_ORIGINS="https://www.example.com,https://example.com" +``` + +Caddy: + +```caddy +handle_path /ollama/* { + reverse_proxy 127.0.0.1:11434 +} +``` + +## 6. Troubleshooting + +**Nothing happens when I open the page.** +Check the browser console. A 404 on `config.js` means the file is not next to +`widget.html` or the path in the ` + + + -- cgit v1.2.3