Skip to content

Add served Webchat runtime support#45

Merged
rockwellll merged 19 commits into
mainfrom
message-teaser
May 5, 2026
Merged

Add served Webchat runtime support#45
rockwellll merged 19 commits into
mainfrom
message-teaser

Conversation

@rockwellll
Copy link
Copy Markdown
Collaborator

@rockwellll rockwellll commented May 5, 2026

Summary

Adds package-side support for the served Webchat runtime.

The package now treats the Webchat HTML as the source of truth for teaser messages, opening-sequence messages, attachments, and configured appearance. Hellotext.js wires runtime behavior around that DOM instead of rebuilding those surfaces from JSON.

Added

  • DOM-driven teaser presentation for pre-conversation Webchat messages.
  • DOM-driven opening sequence support for new conversations.
  • Dedicated teaser quick-reply sending path.
  • Webchat appearance overrides for appearance.header.name and appearance.launcher.iconUrl.
  • WhatsApp override support through whatsapp.number and whatsapp.restrictToChannel.
  • Public typings and Webchat docs for the new config shape.

Changed

  • Teasers now run as a one-time, session-scoped pre-conversation presentation instead of an infinite carousel.
  • Opening sequence sends only the message ids that were actually revealed before the first customer reply.
  • Customer-originated send paths include revealed opening-sequence ids when available.
  • Webchat config merging preserves dashboard defaults while allowing sparse local overrides.
  • Attachment rendering now supports the served [data-attachments-container] contract.
  • Runtime unread counters clamp at 9, matching the served Webchat badge.
  • The emoji picker is lazy-loaded when opened, reducing the initial dist/hellotext.js bundle.
  • classes and triggerClasses were removed from the public Webchat config.
  • Webchat docs now focus on the public configuration surface only.

Compatibility Notes

  • Public JS config stays camelCase.
  • webchat: false still disables automatic Webchat mounting.
  • Dashboard Webchat defaults still load unless explicitly overridden.
  • The browser build now ships lazy Webchat emoji chunks next to dist/hellotext.js.

Tests

  • git diff --check
  • npm test
  • npm run build

Build completed successfully. The initial browser bundle is now about 188 KB raw / 43.6 KB gzip / 36.6 KB brotli, with emoji picker code split into lazy chunks.


Note

Medium Risk
Updates core webchat runtime behavior (auto-open/teaser/opening-sequence flows, message rendering, and request serialization), which could affect widget UX and message delivery if edge cases are missed. No auth or sensitive data handling changes, but the surface area is broad across controllers, config, and API calls.

Overview
Adds new Webchat config surface for mode, runtime behaviour (with explicit override tracking), plus appearance and whatsapp overrides, and serializes these overrides onto the public/webchats request and (optionally) onto the rendered Stimulus data-...-behaviour-value.

Updates the webchat controller/runtime to better align with served DOM contracts: supports [data-attachments-container], clamps unread badge at 9, de-dupes inbound messages, adds popover close-on-outside-click for popover mode, and introduces teaser + opening-sequence flows (including sending revealed opening-sequence ids with the first customer interaction and new teaser quick-reply sending).

Improves performance/UX by cancelling pending auto-open timers when manually opening/toggling, and lazy-loads the emoji picker assets only when the picker popover opens.

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

@rockwellll rockwellll marked this pull request as ready for review May 5, 2026 05:29
@rockwellll rockwellll marked this pull request as draft May 5, 2026 05:36
@rockwellll rockwellll marked this pull request as ready for review May 5, 2026 05:43
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1e84319. Configure here.

Comment thread src/controllers/webchat_controller.js Outdated
@rockwellll rockwellll merged commit 1accc6d into main May 5, 2026
3 checks passed
@rockwellll rockwellll deleted the message-teaser branch May 5, 2026 06:08
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