Repository navigation
feat(widget): update() for theme, branding and strings on a running chat - #433
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 butposition),branding,placeholder,strings,disclosure,welcomeMessageandsuggestions. Fields left out keep their current values, including the fields insidetheme,brandingandstrings. 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:
Panel.update()redraws it with the new branding and close label, and keeps focus on the close button if it had it.Messagesalready reads from.setDisclosure()with no text removes the note, sodisclosure: falseworks on a running chat.init(). Meanwhile the launcher takes the merged theme and the newopenChatlabel. A secondinit()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 callsupdate()before the chat loads. Build, typecheck, test:coverage, lint (dev baseline), publint, size and docs:check pass locally.