CHI-3864: Add label to end chat button#4316
Merged
stephenhand merged 11 commits intomasterfrom May 7, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new/expanded localization support across the Aselo webchat widget UI, including an optional text label for the widget entry-point button, and updates several components/tests to use translation-driven strings (including allowing translation values to be explicit empty strings).
Changes:
- Add new English translation keys for entry point label, message input strings, read indicator, and pre-engagement copy (including an explicit empty-string description).
- Update
localizeKeyto use nullish coalescing (??) so explicit empty-string translations are preserved. - Update EntryPoint / MessageInput / MessageBubble / PreEngagementFormPhase to use new translation keys and adjust tests accordingly.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| aselo-webchat-react-app/translationsSrc/en.json | Adds new English translation keys (including explicit empty string) used by updated UI components. |
| aselo-webchat-react-app/src/localization/localizeKey.ts | Changes translation lookup to preserve explicit empty-string values. |
| aselo-webchat-react-app/src/components/styles/EntryPoint.styles.ts | Updates entry point button styling to support wider/pill-shaped button when label is present. |
| aselo-webchat-react-app/src/components/PreEngagementFormPhase.tsx | Switches pre-engagement header/description/submit label to fixed translation keys and adds test id for submit label span. |
| aselo-webchat-react-app/src/components/MessageInput.tsx | Localizes placeholder and send/emoji accessible text (but currently contains a key typo). |
| aselo-webchat-react-app/src/components/MessageBubble.tsx | Localizes the “Read” indicator and adds a test id for it. |
| aselo-webchat-react-app/src/components/tests/PreEngagementFormPhase.test.tsx | Updates spinner/label assertions to use the new test id instead of hard-coded button text. |
| aselo-webchat-react-app/src/components/tests/MessageInput.test.tsx | Updates mocked config state to include translations to satisfy new selectors. |
| aselo-webchat-react-app/src/components/tests/MessageBubble.test.tsx | Updates assertions to use the new ReadIndicator test id. |
| aselo-webchat-react-app/src/components/tests/EntryPoint.test.tsx | Updates mocked state to include config.translations and clears mocks between tests. |
Comment on lines
+39
to
48
| const openWidgetLabel = localizeKey(currentTranslations)('EntryPoint-ClosedState-OpenWidgetButtonLabel'); | ||
|
|
||
| return ( | ||
| <Box | ||
| as="button" | ||
| data-testid="entry-point-button" | ||
| onClick={() => dispatch(changeExpandedStatus({ expanded: !expanded }))} | ||
| {...containerStyles} | ||
| padding={openWidgetLabel && !expanded ? 'space40' : 'space0'} | ||
| > |
Comment on lines
29
to
33
| export const EntryPoint = () => { | ||
| const dispatch = useDispatch(); | ||
| const expanded = useSelector((state: AppState) => state.session.expanded); | ||
| const currentTranslations = useSelector(selectCurrentTranslations); | ||
| const { isMobileFullscreen } = useMobileOptimizations(); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines
+112
to
+130
| const title = localize('PreEngagementPhase-Form-Title'); | ||
|
|
||
| const description = localize('PreEngagementPhase-Form-Description'); | ||
|
|
||
| return ( | ||
| <> | ||
| <Header /> | ||
| <NotificationBar /> | ||
| <Box as="form" data-test="pre-engagement-chat-form" onSubmit={handleSubmit} {...formStyles} ref={formRef}> | ||
| <Text {...titleStyles} as="h3"> | ||
| <LocalizedTemplate code={titleText} /> | ||
| </Text> | ||
| {title && ( | ||
| <Text {...titleStyles} as="h3"> | ||
| {title} | ||
| </Text> | ||
| )} | ||
| {description && ( | ||
| <Text {...descriptionStyles} as="p"> | ||
| {description} | ||
| </Text> | ||
| )} |
| data-testid="pre-engagement-start-chat-button-label" | ||
| style={isRecaptchaVerifyPending ? { visibility: 'hidden' } : {}} | ||
| > | ||
| <LocalizedTemplate code="PreEngagementPhase-Form-SubmitButtonLabel" /> |
Comment on lines
+39
to
+58
| const openWidgetLabel = localizeKey(currentTranslations)('EntryPoint-ClosedState-OpenWidgetButtonLabel'); | ||
|
|
||
| return ( | ||
| <Box | ||
| as="button" | ||
| data-testid="entry-point-button" | ||
| onClick={() => dispatch(changeExpandedStatus({ expanded: !expanded }))} | ||
| {...containerStyles} | ||
| padding={openWidgetLabel && !expanded ? 'space40' : 'space0'} | ||
| > | ||
| {expanded ? ( | ||
| <ChevronDownIcon decorative={false} title="Minimize chat" size="sizeIcon80" /> | ||
| ) : ( | ||
| <ChatIcon decorative={false} title="Open chat" size="sizeIcon60" /> | ||
| <> | ||
| {openWidgetLabel && ( | ||
| <Box as="span" marginRight="space30"> | ||
| {openWidgetLabel} | ||
| </Box> | ||
| )} | ||
| <ChatIcon decorative={false} title="Open chat" size="sizeIcon60" /> |
Comment on lines
+39
to
+58
| const openWidgetLabel = localizeKey(currentTranslations)('EntryPoint-ClosedState-OpenWidgetButtonLabel'); | ||
|
|
||
| return ( | ||
| <Box | ||
| as="button" | ||
| data-testid="entry-point-button" | ||
| onClick={() => dispatch(changeExpandedStatus({ expanded: !expanded }))} | ||
| {...containerStyles} | ||
| padding={openWidgetLabel && !expanded ? 'space40' : 'space0'} | ||
| > | ||
| {expanded ? ( | ||
| <ChevronDownIcon decorative={false} title="Minimize chat" size="sizeIcon80" /> | ||
| ) : ( | ||
| <ChatIcon decorative={false} title="Open chat" size="sizeIcon60" /> | ||
| <> | ||
| {openWidgetLabel && ( | ||
| <Box as="span" marginRight="space30"> | ||
| {openWidgetLabel} | ||
| </Box> | ||
| )} | ||
| <ChatIcon decorative={false} title="Open chat" size="sizeIcon60" /> |
Collaborator
Author
There was a problem hiding this comment.
@copilot apply changes based on this feedback
Contributor
There was a problem hiding this comment.
Done in commit 7e7b11b. Added two tests in a new open widget label describe block:
- Verifies the label renders with the correct text when the translation key resolves to a non-empty string
- Verifies the label is not rendered when the translation key resolves to an explicit empty string
Also added data-testid="open-widget-label" to the label span to make it reliably queryable in tests.
Comment on lines
20
to
24
| export const localizeKey = | ||
| (localeTranslations: ConfigState['translations'][keyof ConfigState['translations']]) => | ||
| (key: string, parameters: Record<string, string> = {}) => { | ||
| const lookedUpValue = (localeTranslations && localeTranslations[key]) || key; | ||
| const lookedUpValue = (localeTranslations && localeTranslations[key]) ?? key; | ||
| return Mustache.render(lookedUpValue, parameters); |
Agent-Logs-Url: https://github.com/techmatters/flex-plugins/sessions/d60e5a73-5e80-41fa-a14b-781cbf98984c Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
Comment on lines
+112
to
+114
| const title = localize('PreEngagementPhase-Form-Title'); | ||
|
|
||
| const description = localize('PreEngagementPhase-Form-Description'); |
| data-testid="pre-engagement-start-chat-button-label" | ||
| style={isRecaptchaVerifyPending ? { visibility: 'hidden' } : {}} | ||
| > | ||
| <LocalizedTemplate code="PreEngagementPhase-Form-SubmitButtonLabel" /> |
| </Box> | ||
| {read && ( | ||
| <Flex hAlignContent="right" vAlignContent="center" marginTop="space20"> | ||
| <Flex data-testid="ReadIndicator" hAlignContent="right" vAlignContent="center" marginTop="space20"> |
Comment on lines
+39
to
+58
| const openWidgetLabel = localizeKey(currentTranslations)('EntryPoint-ClosedState-OpenWidgetButtonLabel'); | ||
|
|
||
| return ( | ||
| <Box | ||
| as="button" | ||
| data-testid="entry-point-button" | ||
| onClick={() => dispatch(changeExpandedStatus({ expanded: !expanded }))} | ||
| {...containerStyles} | ||
| padding={openWidgetLabel && !expanded ? 'space40' : 'space0'} | ||
| > | ||
| {expanded ? ( | ||
| <ChevronDownIcon decorative={false} title="Minimize chat" size="sizeIcon80" /> | ||
| ) : ( | ||
| <ChatIcon decorative={false} title="Open chat" size="sizeIcon60" /> | ||
| <> | ||
| {openWidgetLabel && ( | ||
| <Box as="span" data-testid="open-widget-label" marginRight="space30"> | ||
| {openWidgetLabel} | ||
| </Box> | ||
| )} | ||
| <ChatIcon decorative={false} title="Open chat" size="sizeIcon60" /> |
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.
Description
Add optional label to the chat widget button
Support explicit empty strings in translation keys
Checklist
Other Related Issues
None
Verification steps
AFTER YOU MERGE
You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P