# GN-Apex AI Widget (GN-Apex Copilot) > A white-label AI copilot widget for any website. One script tag mounts a branded assistant; > its design is created in the browser-based Copilot Studio and published as a JSON config that > the widget fetches at load. Powered by GORA AI models. Key facts: - Product: GN-Apex Copilot (widget runtime `copilot.js`, ~40 KB gzip, single file, no dependencies, deferred, shadow-DOM isolated). - Studio: schema-driven designer at /studio/ — live desktop + mobile preview, 8 templates, right-click context menus, 22 shortcuts, contrast checker, undo/redo, publish via `PATCH /ai-agent/project/:id/config { ui }`. - Public config: `GET /copilot/:projectId/config` returns persona + theme + ui (Cache-Control max-age=60, stale-while-revalidate=300). - Public surface: `GET /copilot/:projectId/config`, `POST /copilot/:projectId/stream` (SSE token stream, 20 req/min/IP), `POST /copilot/:projectId/chat` (single-shot, 30 req/min/IP), `GET /cdn/copilot.js`. - Embed: `` - Presentation modes: panel, drawer, sheet, dialog, popover, fullscreen (+ independent mobile mode). - Theming: auto light/dark following the host site, split colours, glass, launcher shapes, header styles, bubble styles, backdrop dim/blur, 4 open animations, 9 synthesised reply sounds, auto-toasts. - Input: markdown + LaTeX rendering, code highlighting with copy, image/file attachments (button, drag-drop, paste) sent as multimodal parts. - Integration: the runtime emits a `gx-toggle` CustomEvent (non-bubbling, `detail` = boolean) on its own `` element on open/close, and stores one `sessionStorage` flag so an auto-open fires once. It bundles no third-party tracker or analytics. - Comparison: GN-Apex Copilot is a feature of the GN-Apex project that already runs your site — the same login, Project ID, content and bill, with no per-seat or per-resolution pricing. Unlike hosted chat suites (Intercom, Crisp, Tidio, Zendesk) or no-code AI builders (Chatbase, Voiceflow), there is no separate subscription. Those suites still win when you need phone lines, multi-channel inboxes, a human agent console or a large integration marketplace. - Models (GORA AI): - gora-v2 "Gora Default v2 (MoE Edge)" — 150k context, billed as Included, 10,000 queries/month included, $0 per use. - gora-v3 "Gora Intelligence v3 (Cognitive Core)" — 456k context, preview, usage-based $0.0015/1K, 2,500 included. - gora-v4 "Gora Omni v4 (Quantum Multi-Agent)" — 1M context + voice, coming soon, plan-based $0.0040/1K, 500 included. - gpt-4o "GPT-4 Omni Bridge" — external OpenAI gateway, coming soon, usage-based $0.0050/1K. - Getting started: the copilot is only available inside a GN-Apex project. Create an account at https://gnapex.com/signup, verify the 6-digit OTP, open the client dashboard, create a project, copy its Project ID from Settings → API Keys, then go to Project → Settings → GORA AI Copilot and press Turn on. Design it in Copilot Studio (same page, "Website widget"), then paste the snippet. - Cost model: the copilot is included with every GN-Apex project — there is no separate copilot subscription. Usage follows the project's plan; the Free plan includes 10,000 model queries per month, and heavier models are metered per 1K input tokens. The dashboard shows queries this month, tokens used and accrued AI cost. - Copilot Studio can be viewed without an account at /studio/ (demo mode, no Project ID required). Sections of this site: How it works (account → project → turn on → design → paste), Inside the Studio, Presentation modes, GORA AI models, Compare (against hosted chat suites, no-code AI builders and a DIY wrapper, including where those win), Install (HTML/Next/React/WordPress/CLI), Plans & usage, FAQ. Canonical site: https://ai-widget.gnapex.com/ · Studio: https://ai-widget.gnapex.com/studio/ · Short version: https://ai-widget.gnapex.com/llms.txt ## Also known as / search terms GN-Apex AI Widget, GN-Apex Copilot, Gnapex AI widget, copilot widget, AI copilot widget, AI chat widget for websites, embeddable AI assistant, white-label AI chatbot, no-code AI widget, website AI assistant script. Positioning: a best-in-class AI copilot widget for Africa — mobile-first, tiny (~40 KB gzip), streaming, with a free tier (10,000 model queries/month) — that works equally well for businesses anywhere in the world. ## Who it is for Website owners, online shops, SaaS teams, agencies, schools, fintechs and developers in Africa (Tanzania, Kenya, Uganda, Nigeria, Ghana, South Africa, Egypt, Rwanda, Ethiopia and beyond) and worldwide who want an AI assistant on their site without a separate chatbot subscription. ## Languages The product UI and docs are in English. The persona and replies can be written in English, Swahili or any language the selected GORA AI model supports. ## How GN-Apex AI Widget compares (summary) - vs Intercom / Zendesk / Crisp / Tidio: no separate subscription or per-seat / per-resolution pricing; those suites win for phone lines, multi-channel inboxes, human-agent consoles and large integration marketplaces. - vs Chatbase / Voiceflow: the widget, the models, the project and the bill are one GN-Apex account; Studio gives full visual brand control. - vs a DIY wrapper around an LLM API: Studio, streaming, rate limiting, markdown/LaTeX, uploads and theming are already built. ## Common questions Q: How do I add an AI widget to my website? A: Paste one script tag with your Project ID before . Q: Is there an AI copilot widget built for Africa? A: Yes — GN-Apex AI Widget: ~40 KB deferred script, streamed replies, mobile-first layout, free tier. Q: How much does it cost? A: Included with every GN-Apex project; Free plan includes 10,000 model queries/month; heavier models metered per 1K tokens. Q: Can I try it without an account? A: Yes, https://ai-widget.gnapex.com/studio/ runs as a live demo. --- # README.md # GN-Apex Copilot — Widget + Studio | Part | Path | What it is | |---|---|---| | Widget runtime | `src/` | Builds to ONE file `dist/copilot.js` (the CDN script customers embed) | | Schema + defaults | `src/schema.ts` | `WidgetSchema`, `DEFAULTS`, `resolve()` (validates/clamps everything) | | **Landing page** | `index.html` + `assets/` | Commercial site at `/`: hero, how-it-works (the account → project → turn-on walk), Studio tour, presentation modes, GORA AI models, compare (vs hosted suites / no-code builders / DIY), install snippets, plans & usage, FAQ | | **Lottie art** | `assets/lottie/` + `assets/vendor/lottie_light.min.js` | 10 decorative animations extracted from dotLottie zips into plain JSON (embedded art re-encoded to WebP/palette-PNG). Vendored `lottie-web` light player, lazy-loaded on idle and played only in view; skipped entirely under `prefers-reduced-motion` | | **Studio** | `studio/` | Client-facing designer: templates, live preview, publish — served at `/studio/` | | Studio field list | `studio/fields.ts` | Declares every control. Add a field here and it appears in the Studio | ## Run npm i npm run dev # / → landing page # /studio/ → Studio (offline demo) npm run build # dist/copilot.js -> copy to backend public/cdn/copilot.js npm run site:build # dist/ -> static landing page + Studio (deployable) npm run site:preview # serve dist/ locally Connect the Studio to a real project: http://localhost:5173/studio/?api=http://localhost:4000&project=&token=&site=https://client-site.com&name=Acme (Params are kept in sessionStorage and removed from the URL. The landing page forwards legacy `/?api=…&project=…` links to `/studio/` automatically.) ## Landing page `index.html` is the public marketing page for the widget, and `/studio/` is the designer. - **SEO:** one `

`, clean heading order, canonical, Open Graph + Twitter cards, a single JSON-LD `@graph` (Organization, WebSite, SoftwareApplication + offers, VideoObject, HowTo, FAQPage), `robots.txt`, `sitemap.xml`, `site.webmanifest` and `llms.txt`. Lighthouse: 100 / 100 / 100 (SEO / accessibility / best practices). - **Design system:** all styling lives in `assets/landing.css` (tokens at the top: `--acid`, `--cyan`, `--violet`, `--paper`). Sections alternating `.section--alt` flip to the light "paper" palette. - **Motion:** `assets/lottie/*.json` are played by a vendored `assets/vendor/lottie_light.min.js`, loaded once the page is idle (or on first scroll) and never on the critical path. Each `[data-lottie]` well fetches its JSON only when it mounts, plays only while on screen, and is skipped when the visitor prefers reduced motion. The player is a build-order asset — see `RAW_ASSETS` in `vite.site.config.ts`. - **Interactions:** `assets/landing.js` (no dependencies) — scroll reveals with failsafes, the animated hero conversation, presentation-mode switcher, install tabs, copy buttons, video modal, stat counters. - **Deploy:** `npm run site:build` writes `dist/` with `index.html`, `studio/index.html`, hashed assets and the root SEO files. Serve that folder; keep `studio/` reachable for the designer. - **Serve it compressed and immutable.** Every asset name is content-hashed (`landing-D4Ql_LP8.js`), so the host should send `Cache-Control: public, max-age=31536000, immutable` for `assets/*` and gzip (or brotli) for `html/js/css/json/svg`. Without encoding enabled, Lighthouse scores *Serve static assets with an efficient cache policy* and *Enable text compression* at 0 even though the page is already lean — `index.html` is ~20 KB gzip, the stylesheet ~11 KB, the runtime ~4 KB, and the lazy player ~46 KB gzip. A one-line `gzip_static on;` (nginx) or the equivalent in your CDN config is the whole fix. ### Replace the dummy content before launch | What | Where | |---|---| | OG share image (1200×630) | `assets/img/og-cover.svg` | | Walkthrough video + poster | `assets/video/copilot-studio.mp4` (placeholder clip), `assets/img/video-poster.svg` | | Testimonial avatars & quotes | `assets/img/avatar-1..3.svg`, the three `
` blocks in `index.html` | | Pricing tiers | removed — the copilot is included with every GN-Apex project; `#plans` explains usage per plan | | Model specs & usage table | `#models` / `#plans` sections — keep in sync with `GORA_AI_MODELS` and `PRICING_MATRIX` (`backend/src/ai-agent/ai-agent.constants.ts`, `backend/src/billing/constants/pricing-matrix.constants.ts`) | | Get-started links | currently `https://gnapex.com/signup` (nav, hero, plans, CTA, footer) | | Contact / sales / socials | footer + `mailto:` links in `index.html`, `robots.txt`, `sitemap.xml` (domain `ai-widget.gnapex.com`) | | Newsletter form | `#subscribe` — currently front-end validation only; post to your provider in `assets/landing.js` | ## Embed the Studio in your Next.js dashboard (the real product flow) Copy or link this package into the dashboard, then: ```tsx 'use client'; import { useEffect, useRef } from 'react'; import { mountStudio } from 'gnapex-copilot-widget/studio/studio'; export default function CopilotStudioPage({ project, accessToken }: any) { const ref = useRef(null); useEffect(() => mountStudio(ref.current!, { apiUrl: process.env.NEXT_PUBLIC_API_URL, projectId: project.id, projectName: project.name, siteUrl: project.websiteUrl, getToken: () => accessToken, }), [project.id]); return
; } ``` Omit `getToken` if your API uses cookie auth (the Studio then sends `credentials: 'include'`). ## Flow Client edits in Studio → **Publish** → `PATCH /ai-agent/project/:id/config { ui }` → stored in `aiConfig.ui` → public `GET /copilot/:id/config` returns it → `copilot.js` on the client's site applies it. ## Changing the default design for ALL new projects `DEFAULTS` in `src/schema.ts` (values) and `src/styles.ts` (look of components). Rebuild, copy `dist/copilot.js`. Clients who saved their own `ui` keep it; anything they never touched follows your new defaults only if you stop saving the full schema — see "Partial overrides" in BACKEND.md. ## Release the CDN file to the backend BACKEND_CDN_DIR=../backend/public/cdn npm run release # build + copy copilot.js Make sure `public/cdn/copilot.js` is included in the backend's Docker image / deploy artifact. ## Dashboard See `dashboard/INTEGRATION.md` (3 files + a small edit in Aitab.tsx). ## What’s new in v3 See **CHANGELOG.md** for the full list. Headlines: a rewritten width model (no more random wrapping, badges match their bubble), a composer with the send button inside the box, image/file uploads for Gemini/Gemma, an Auto theme that follows the host website (plus separate light/dark colours), 9 soft sounds, working auto-open, configurable auto-toasts, a clear-conversation button, a full markdown + LaTeX renderer, and a Studio with area-aware right-click menus and 22 shortcuts (press `?`). ## What’s new in this Studio (v2) ### Presentation modes (schema-driven) Clients pick how the assistant opens — no code required: | Mode | Behaviour | |------|-----------| | **Panel** | Classic floating chat near the launcher | | **Drawer** | Slides from left / right / bottom | | **Sheet** | Mobile-style bottom sheet | | **Dialog** | Centered modal with backdrop | | **Popover** | Compact popover anchored to the button | | **Fullscreen** | Covers the entire viewport | **Mobile behaviour** can be set independently (`auto` smart-picks sheet/fullscreen from the desktop mode). ### Richer design controls - Brand + accent colours, density, glass/frosted surfaces, elevation - Launcher: shape (rounded / circle / pill / square), 6 icons + custom URL, optional label, pulse attention ring, X/Y insets - Header styles: gradient · solid · minimal · glass - Message bubbles: soft / rounded / bubble / sharp; alignment; typing indicator - Backdrop dim + blur, close-on-outside, Escape, open animations (fade / slide / scale / spring) - 8 starter templates covering every presentation mode ### Still 100% schema-driven Add a field in `studio/fields.ts` + a key in `src/schema.ts` and it appears in the Studio automatically. The widget runtime only reads the resolved schema — no one-off UI branches. ### Run ```bash npm i npm run dev # landing at http://localhost:5173/ , Studio at http://localhost:5173/studio/ ``` ## Studio v2 (theme-aware) - **Dark/light:** follows the host app's `dark` class on `` (Tailwind `darkMode: "class"`), so it switches with your app theme. The toolbar button cycles Auto / Light / Dark; pass `theme` to `mountStudio` to force one. Dark is pure black (`#000`) with neutral greys. - **Schema-driven:** every control, group, search hit, ⌘K entry and "customised" badge is generated from `studio/fields.ts`. Use `when: (s) => …` on a field to show it only when relevant. - **Tools:** ⌘K palette, `/` setting search, per-field reset, WCAG contrast checker, template thumbnails, export/import JSON, embed-code copy, undo/redo, ⌘S publish. # copilot-widget --- # BACKEND.md — public backend contract # Backend: keep it dumb ## 1. Delete the 1,600-line STANDALONE_COPILOT_RUNTIME string `copilot-public.controller.ts` becomes: ```ts import { Controller, Get, Param, Res, Header } from '@nestjs/common'; import type { Response } from 'express'; import { join } from 'path'; @Controller() export class CopilotPublicController { constructor(private readonly ai: AiAgentService) {} @Get('copilot/:projectId/config') config(@Param('projectId') id: string) { return this.ai.getPublicCopilotConfig(id); } // Serves the pre-built file. Bump the filename (copilot.v2.js) on breaking changes. @Get('cdn/copilot.js') @Header('Cross-Origin-Resource-Policy', 'cross-origin') @Header('Access-Control-Allow-Origin', '*') @Header('Cache-Control', 'public, max-age=300, stale-while-revalidate=86400') @Header('Content-Type', 'application/javascript; charset=utf-8') script(@Res() res: Response) { res.sendFile(join(process.cwd(), 'public/cdn/copilot.js')); } } ``` Deploy: `npm run build` in the widget repo, copy `dist/copilot.js` to `backend/public/cdn/copilot.js` (or upload to S3/R2/Cloudflare and point a CDN domain at it, then this endpoint can just 302 there). ## 2. Store the customer's design as ONE json blob: `aiConfig.ui` In `UpdateProjectAiConfigDto` add: ```ts @ApiPropertyOptional() @IsOptional() @IsObject() ui?: Record; ``` Validate size (<16 KB) in the service. You do NOT need to re-implement defaults/validation: the widget's `resolve()` clamps every value and falls back to defaults, so a bad/old blob can never break a site. (Optional: import `resolve` from the widget package in the backend and store `resolve(ui)` to normalise on save.) ## 3. Public config: add `ui` In `getPublicCopilotConfig`, return also `ui: rawAi['ui'] ?? {}`. Keep the legacy theme/persona/behavior fields — the widget maps them — so existing projects keep working untouched. ## 4. Customer dashboard (later) Render `playground/fields.ts` as the form (same list), preview with `` + `setConfig(schema)` (load `copilot.js` in the dashboard), and `PATCH` the JSON to `aiConfig.ui` on save. ## 5. Website embed (unchanged) ## Partial overrides (optional, recommended later) The Studio currently publishes the FULL schema, so a client's design is frozen at publish time. If you want untouched settings to follow future default changes, publish only the diff (`diff(schema, DEFAULTS)`) instead of `schema`; `resolve()` already merges it over `DEFAULTS`. ## 6. Attachments (multimodal) — v3 When `composer.uploads` is on, the widget posts attachments with each message: ```jsonc // POST /copilot/:projectId/stream { "messages": [ { "role": "user", "content": "What is in this picture?", "attachments": [ { "name": "photo.jpg", "mime": "image/jpeg", "data": "" } ] } ], "pageContext": { ... } } ``` Only the **current** session's messages carry `data`; messages restored from `localStorage` keep just a thumbnail locally and are sent as text. Images are already downscaled (≤1600px, JPEG) in the browser; text/PDF files are sent as-is up to `composer.maxSizeMB`. Map them to model parts (Gemini shown; Gemma 3 accepts images the same way): ```ts const parts = [ { text: m.content }, ...(m.attachments ?? []).map((a) => a.mime.startsWith("text/") || a.mime === "application/json" ? { text: `File “${a.name}”:\n` + Buffer.from(a.data, "base64").toString("utf8") } // works on any model : { inlineData: { mimeType: a.mime, data: a.data } }), // images; PDFs on Gemini only ]; ``` **Do not trust the client.** Re-check `mime` against an allow-list, cap total decoded bytes per request, cap files per message, and raise your JSON body limit (e.g. `express.json({ limit: "25mb" })` — base64 is ~33% larger than the file). Everything else (`mode`, `phase`, `thought`, `token`, `tool_*`, `suggested_actions`, `action_confirmation_required`, `[DONE]`) is unchanged. The new `ui` keys (`composer`, `toasts`, `messages.userMaxWidth/aiMaxWidth`, `*Dark` colours, `behavior.sound*`, …) are all optional — `resolve()` fills defaults, so existing saved configs keep working. --- # CHANGELOG.md # Changelog ## v3 — Studio overhaul, multimodal input, auto theme, toasts ### Widget - **Message width model rewritten.** A bubble now only wraps once it reaches its configured maximum width; short replies no longer break at random. Reasoning, tool, confirmation and action badges are exactly as wide as the bubble they belong to (previously they could be wider than the reply). Hover actions and timestamps never influence a bubble's width. - **Separate widths** for visitor and assistant bubbles (`messages.userMaxWidth`, `messages.aiMaxWidth`). A legacy `messages.maxWidth` in a saved config still loads and applies to both. - **Composer rebuilt.** Send button lives *inside* the text box, becomes a Stop button while the assistant replies, auto-grows to `composer.maxRows`, optional character counter, Enter / Shift+Enter / Ctrl+Enter behaviour, 5 input shapes, 3 send icons, 3 send styles. - **Space-bar bug fixed.** Host sites with global hotkeys (or modals/carousels) could cancel Space and other keys typed into the widget. Keystrokes from the input are now handled in the capture phase and kept away from the page, and any character that something earlier already cancelled is re-inserted. Verified against a page that cancels Space in both capture and bubble phase. - **Uploads for multimodal models** (Gemini / Gemma): attach button, drag & drop, paste screenshots, previews with remove, lightbox, count / size / type limits. Images are resized (max 1600px) and re-encoded to JPEG in the browser — a 2400×1600 photo became ~73 KB. - **Auto theme** (`theme.mode = "auto"`, now the default): follows the website the widget is on — `class="dark"` (next-themes, Tailwind), `data-theme` / `data-bs-theme` and friends, `color-scheme`, real page background luminance, then the OS — and flips live when the site's theme toggles. - **Separate light & dark colours** (`theme.splitColors`): every colour in Window, Messages and Input gets a dark twin (`bgDark`, `userBgDark`, …). - **Sounds:** 9 synthesised sounds (chime, pop, bubble, glass, marimba, droplet, harp, ping, bell) + volume + optional send pop. No audio files. - **Auto-open actually works now** (the timer was never started before): once per session, optional on phones, never after the visitor has engaged. - **Auto toasts:** configurable messages that rotate, delay / repeat / max-per-visit / duration, card · speech-bubble · pill styles, avatar, quick-reply buttons, progress bar with pause-on-hover, optional sound, "stay quiet after dismiss". - **Clear conversation:** trash button beside the close icon with a confirm step (`behavior.clearButton`). - **Markdown renderer rewritten:** nested lists, GFM tables with alignment, task lists, callouts (`> [!TIP]`), blockquotes, strikethrough, ==highlight==, ``, autolinks, images, syntax-highlighted code (JS/TS, Python, shell, SQL, JSON, YAML, CSS, HTML, C-family, diff) with copy + wrap buttons, **LaTeX math** (fractions, roots, sums, matrices, cases, Greek, accents) — all without dependencies, and safe by construction. - **Rendering is incremental**: only the message that changed is rebuilt while streaming, so there is no flicker and open reasoning blocks stay open. - Copy and Regenerate on replies, scroll-to-latest button, entrance animations, "plain" (bubble-less) assistant style, sender name, online dot. - Security: server-supplied labels (reasoning, tools, actions) are no longer inserted as HTML; `NAVIGATE` actions only accept http(s)/relative/mailto/tel URLs. ### Studio - **Context menu on right-click that changes with the area**: launcher, header, visitor bubble, assistant bubble, code block, reasoning/tools, suggestion chips, input, attachments, toast, window, nav items, individual settings (reset / copy / paste / use brand colour / min / max), the controls panel, the top bar and the stage. Quick-set radios and toggles apply live; "Customise…" jumps to the exact setting and pulses it. Shift + right-click gives the browser's own menu. - **22 keyboard shortcuts** from a single definition that also feeds the cheat-sheet (`?`) and the command palette: `⌘S` publish, `⌘K` palette, `⌘Z` / `⇧⌘Z` undo/redo, `⌘Y` redo, `?` cheat-sheet, `/` search, `1–9 / 0` jump to a section, `[ ]` step through sections, `F` focus mode, `D` device, `B` host background, `O` window, `T` toast, `E` sample conversation, `R` clear, `Alt+C/E/I/R` copy/export/import/reset section, `Alt+Shift+R` reset all. (`⌘K` and `⌘Y` are working but hidden from the cheat-sheet, so the sheet lists 20.) - New sections: **Input & Uploads**, **Auto Toasts**; expanded Messages and Behaviour; new controls — sound picker with live audition, message-width visualiser with presets. - "Host site is Light / Dark" now drives Auto theme in the preview, so you can see exactly what happens when a customer's site switches theme. - Status bar, focus mode, sample conversation, toast preview, section copy/paste/reset. - Fixed: typing `/` or pressing ⌘Z inside the preview's text box used to be hijacked by the Studio (events from the widget's shadow DOM were retargeted to the host element). --- ## v2 — Production-readiness pass This pass focused on one thing: **making every control the Studio exposes actually do something on the live, embedded widget.** An audit turned up ~21 CSS custom properties and 7 data-attributes that `widget.ts` computed correctly but `styles.ts` never read — so a large slice of the "v2 richer design controls" in the Studio had **zero visual effect** on the widget customers actually see on their sites. That's the root cause behind launcher/button settings that looked like they should work but didn't. Only `src/widget.ts`, `src/styles.ts` and `src/index.ts` changed. `schema.ts`, the Studio (`studio/`), the dashboard integration (`dashboard/`) and the playground were left untouched — the Studio already had a correct control for every schema field, and because its live preview mounts the real `` element, these fixes flow straight through to the Studio's preview with no further changes needed there. ## Fixed (previously silently broken) **Launcher button** - Custom background/text colour overrides (`launcher.bg` / `launcher.color`) — were computed but never applied; launcher background was hardcoded to a primary-colour gradient regardless. - Gradient on/off toggle (`launcher.gradient`) — had no effect. - Icon size slider (`launcher.iconSize`) — icons were hardcoded to 46%/52% of the button box. - Icon padding/box sizing — now a real, independent px box instead of a percentage of button size. - Label font size (`launcher.labelSize`) — hardcoded to 13px regardless of the slider. - Label horizontal padding (`launcher.padding`) — hardcoded to 14–18px regardless of the field. - Label position before/after (`launcher.labelPosition`) — attribute was set, no CSS consumed it. - Label hover-reveal mode (`launcher.labelMode = "hover"`) — label was always visible; now the button starts icon-only and smoothly expands on hover/focus, and correctly re-collapses while the chat window is open. - **Labeled launcher on any shape except "pill" had a fixed icon-only width**, so the label text would overflow/clip instead of the button growing to fit it. Any shape now grows to fit a label. - Glow toggle (`launcher.glow`) — glow was always on regardless of the toggle. - "Hide launcher while window is open" (`launcher.hideWhenOpen`) — attribute was set, never styled; launcher stayed visible and could overlap a fullscreen/sheet/drawer window. - "Swap to ✕ icon when open" (`launcher.closeIconWhenOpen`) — both icons rendered inline simultaneously with no crossfade or toggle; now a proper rotate/scale/opacity crossfade keyed off the open state. - Launcher corner radius for the "square" shape was fought over by two conflicting rules (a hardcoded CSS override vs. the JS-computed value); now there's a single source of truth. **Messages** - Custom user/AI bubble colours (`messages.userBg/userText/aiBg/aiText`) — computed, never applied; bubbles were always the default navy/primary regardless of what was set. - AI-bubble border toggle (`messages.aiBorder`) — no effect. - Message font size (`messages.fontSize`) and max bubble width (`messages.maxWidth`) — both hardcoded, sliders did nothing. - User-bubble text was hardcoded white — unreadable if a light/bright primary colour was chosen. Now uses the same WCAG-contrast logic already computed elsewhere in the file. **Panel / header / composer** - Panel border width (`panel.borderWidth`) — hardcoded to 1px. - Panel background type = gradient or image (`panel.bgType`) — computed, **never rendered**; panel background was always flat solid regardless of this setting. - Custom header background/text colour (`panel.headerBg/headerText`) — no effect; header always used the preset style colours. - Custom composer/input background colours (`panel.composerBg/inputBg`) — no effect. - The floating "✕" close button shown when the header is hidden had **no positioning CSS at all** — it rendered inline in the document flow instead of floating in the corner. Now properly anchored, blurred, and shape-matched to launcher position. - `theme.accentColor` was computed but used nowhere; it's now used for the send button's gradient, the focus ring colour, and the loading-sweep bar. ## Added (new, not previously present) - **Resilient config loading**: the widget used to silently disappear forever on a client's site if the config endpoint had one bad response (no retry, no fallback, no visible error). It now retries once with a timeout, and falls back to the visitor's last-known-good cached config in localStorage if the API is briefly unreachable. - **Busy/sending state**: the send button now disables and shows a spinner while waiting on a reply (previously it stayed fully clickable with no feedback besides the typing dots), and a subtle progress sweep appears at the top of the window. - **Retry on failure**: a failed reply now renders an inline "Try again" action instead of only a generic apology with no recovery path. - **Keyboard accessibility**: visible focus rings on the launcher, close buttons, send button, and suggested-question chips (previously none existed outside the text input); a focus trap keeps Tab/Shift+Tab inside the window while it's presented as a true modal (`aria-modal`). - **Crisp SVG icons** replace the emoji/unicode send (➤) and close (×) glyphs, which rendered inconsistently across operating systems and browsers. - **Thin, theme-matched scrollbar** for the message list instead of the browser default. - **rAF-throttled resize handling** to avoid redundant style recomputation during a resize/orientation-change burst. - **More reliable auto-mount**: the embed script now mounts correctly even when the `