Skip to content

feat(widget): update() for theme, branding and strings on a running chat - #433

Merged
anurag629 merged 1 commit into
devfrom
feat/widget-update
Oct 28, 2026
Merged

anurag629 merged 1 commit into
devfrom
feat/widget-update

Conversation

@anurag629

Copy link
Copy Markdown
Member

The last method of the widget API (F-05 task 26). ChatCops.update(changes) changes a running chat in place, without mounting it again.

It takes theme (all but position), branding, placeholder, strings, disclosure, welcomeMessage and suggestions. Fields left out keep their current values, including the fields inside theme, branding and strings. A chat that has only its welcome message redraws it; once the visitor has written, the new welcome and suggestions wait for the next conversation.

How it works:

  • The panel header is now drawn by one method, so Panel.update() redraws it with the new branding and close label, and keeps focus on the close button if it had it.
  • The input, launcher button and footer get small label setters. Retry, regenerate, typing and sources labels go into the same object Messages already reads from.
  • setDisclosure() with no text removes the note, so disclosure: false works on a running chat.
  • The script tag loader keeps calls made before the chat loads and applies them after init(). Meanwhile the launcher takes the merged theme and the new openChat label. A second init() drops them.

Size: panel 16.84 of 17 KB, single file 18.92 of 19 KB, loader 4.5 of 5 KB.

Tests: 11 new unit tests in tests/api.test.ts (theme merge, labels, focus, welcome rules, disclosure on/off/on, before init, position ignored, the loader queue and the launcher theme, re-init), type tests for both builds, and the loader e2e now calls update() before the chat loads. Build, typecheck, test:coverage, lint (dev baseline), publint, size and docs:check pass locally.

@anurag629
anurag629 merged commit 08b4647 into dev Oct 28, 2026
5 checks passed
@anurag629
anurag629 deleted the feat/widget-update branch October 28, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant