Skip to content

CHI-3864: Add label to end chat button#4316

Merged
stephenhand merged 11 commits intomasterfrom
CHI-3864-widget_button_label
May 7, 2026
Merged

CHI-3864: Add label to end chat button#4316
stephenhand merged 11 commits intomasterfrom
CHI-3864-widget_button_label

Conversation

@stephenhand
Copy link
Copy Markdown
Collaborator

Description

Add optional label to the chat widget button
Support explicit empty strings in translation keys

Checklist

  • Corresponding issue has been opened
  • New tests added
  • Feature flags added
  • Strings are localized
  • Tested for chat contacts
  • Tested for call contacts

Other Related Issues

None

Verification steps

AFTER YOU MERGE

  1. Cut a release tag using the Github workflow. Wait for it to complete and notify in the #aselo-deploys Slack channel.
  2. Comment on the ticket with the release tag version AND any additional instructions required to configure an environment to test the changes.
  3. Only then move the ticket into the QA column in JIRA

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

@stephenhand stephenhand requested a review from gpaoloni May 6, 2026 08:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 localizeKey to 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 thread aselo-webchat-react-app/src/components/MessageInput.tsx Outdated
Comment thread aselo-webchat-react-app/src/components/MessageInput.tsx
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 thread aselo-webchat-react-app/src/components/EntryPoint.tsx Outdated
Comment thread aselo-webchat-react-app/src/components/PreEngagementFormPhase.tsx Outdated
Comment thread aselo-webchat-react-app/src/localization/localizeKey.ts
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();
Comment thread aselo-webchat-react-app/src/components/PreEngagementFormPhase.tsx Outdated
stephenhand and others added 3 commits May 7, 2026 10:28
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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

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" />
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit 7e7b11b. Added two tests in a new open widget label describe block:

  1. Verifies the label renders with the correct text when the translation key resolves to a non-empty string
  2. 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);
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

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" />
@stephenhand stephenhand merged commit 3d32b3f into master May 7, 2026
30 checks passed
@stephenhand stephenhand deleted the CHI-3864-widget_button_label branch May 7, 2026 14:48
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.

3 participants