Repository navigation
fix(widget): use welcomeBubbleDefault locale string when text is omitted - #630
Open
bhushan4work wants to merge 1 commit into
Open
bhushan4work wants to merge 1 commit into
bhushan4work wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
What does this change?
Makes
WidgetConfig.welcomeBubble.textoptional, defaulting to the chat'swelcomeBubbleDefaultlocale string ("Need help? Chat with us!" in English, or the active translation).packages/widget/src/widget.ts: Madetextoptional inWidgetConfig.welcomeBubble. IncreateBubble(), fallback tothis.locale.welcomeBubbleDefaultwhentextis not provided (welcomeBubble: {}andwelcomeBubble: { delay: 5000 }now display default text).packages/widget/src/script-config.ts: Changeddata-welcome-bubbleattribute check so an empty attribute (data-welcome-bubble=""or baredata-welcome-bubble) enables the welcome bubble with default text, while a tag without the attribute still shows no bubble. The loader gzip size remains within budget (4.95 kB / 5 kB budget), so no script-tag work needed to be dropped.website/src/content/docs/widget/configuration.mdx: Updated documentation forwelcomeBubbleto showtextis optional defaulting towelcomeBubbleDefault, corrected "hover bubble" comment to "bubble", and updated thedata-welcome-bubblerow to reflect that an empty value enables the bubble with default text.api/widget.api.md&api/react.api.md: Updated API snapshots viapnpm api.@chatcops/widgetnoting the empty attribute behavior.Tests added
packages/widget/tests/widget.test.ts: Added test initializing withwelcomeBubble: {}, advancing past 3000 ms, and asserting.cc-bubble-triggerdisplays "Need help? Chat with us!" as well as the translated string whenstringsoverrides are passed, plus verification forwelcomeBubble: { delay: 5000 }.packages/widget/tests/script-config.test.ts: Added test verifyingdata-welcome-bubble=""enables the bubble with default text, and tags without the attribute show no bubble.packages/widget/tests/loader.test.ts: Added test verifyingcreateLoaderwithloadLocaleresolving{ default: { welcomeBubbleDefault: 'Brauchen Sie Hilfe?' } }passes it throughstringsto the widget when the bubble is due.Closes #610
How I tested this
Ran the required checks, all passing:
pnpm vitest run --project @chatcops/widgetpnpm test:coveragepnpm lintpnpm size(chatcops.min.js at 4.95 kB gzipped <= 5 kB limit)pnpm docs:checkAI assistance
None
Checklist
devpnpm -r build,pnpm testandpnpm -r typecheckpass locallypnpm changeset) if this changescore,widgetorserverpnpm apirun andapi/committed if an exported type or option changed