Skip to content

[codex] Preserve inbound webchat teaser layout#46

Merged
rockwellll merged 2 commits into
mainfrom
teaser-additions
May 29, 2026
Merged

[codex] Preserve inbound webchat teaser layout#46
rockwellll merged 2 commits into
mainfrom
teaser-additions

Conversation

@rockwellll
Copy link
Copy Markdown
Collaborator

@rockwellll rockwellll commented May 29, 2026

Summary

This keeps inbound webchat message teasers inside the server-rendered teaser layout instead of replacing the entire teaser shell.

Root Cause

The SDK previously handled inbound message teasers by assigning the teaser payload to teaserTarget.innerHTML. That replaced the outer teaser contents and wiped out the styled .hellotext--webchat-teaser-stack / .hellotext--webchat-teaser-message structure rendered by Rails.

What Changed

  • Added Stimulus targets for configured teaser messages plus the reusable inbound message teaser slot.
  • Updated inbound teaser rendering to hide configured teaser stacks, fill inboundMessageTeaserBodyTarget, and unhide inboundMessageTeaserTarget.
  • Kept the outer teaserTarget responsible only for visibility, so positioning and styling remain intact.
  • Added regression coverage for regular inbound messages and carousel messages.
  • Rebuilt generated lib and dist outputs.

Verification

  • yarn test __tests__/controllers/webchat_controller_test.js --runInBand
  • yarn test --runInBand
  • yarn build
  • git diff --check

Note

Low Risk
UI-only teaser rendering with graceful fallbacks when targets are missing; covered by focused controller tests.

Overview
Inbound webchat message teasers no longer replace the entire teaserTarget DOM (which stripped Rails-rendered .hellotext--webchat-teaser-stack markup). The controller now uses dedicated Stimulus targets—teaserMessage, inboundMessageTeaser, and inboundMessageTeaserBody—to hide configured teaser stacks, inject the payload into the inbound slot, and toggle only outer teaser visibility.

Tests in webchat_controller_test.js were expanded with DOM helpers and assertions that the teaser shell stays intact, inbound content lands in the right target, session “teaser seen” is not set for ephemeral inbound teasers, and message handling still works when inbound teaser targets or the teaser surface are missing (including carousel messages).

Reviewed by Cursor Bugbot for commit a883d24. Bugbot is set up for automated code reviews on this repo. Configure here.

@rockwellll rockwellll marked this pull request as ready for review May 29, 2026 01:56
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bae0e6a16e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/controllers/webchat_controller.js Outdated
@rockwellll rockwellll merged commit 4b21a3d into main May 29, 2026
3 checks passed
@rockwellll rockwellll deleted the teaser-additions branch May 29, 2026 07:32
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