Skip to content

Full-page header: square Smooth icon default + customizable logoUrl#19

Merged
brentrager merged 1 commit into
mainfrom
SMOODEV-logo-url
Jul 2, 2026
Merged

Full-page header: square Smooth icon default + customizable logoUrl#19
brentrager merged 1 commit into
mainfrom
SMOODEV-logo-url

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Problem

In fullpage mode the header avatar hardcoded the full "smooth" wordmark (SMOOTH_LOGO_SVG, viewBox 0 0 550 135) — a wide wordmark crammed into a square tile, so it overflowed and looked broken, and it stamped Smoo branding onto customers' pages. ChatWidgetConfig had no logo key, so consumers couldn't override it.

Changes

1. New default: the square Smooth icon. The fullpage header now renders the canonical square Smooth icon (the stylized th glyph — assets/smooth-icon.svg, viewBox 0 0 150 150), inlined as SMOOTH_ICON_SVG in src/logo.ts (mirrors how SMOOTH_LOGO_SVG is generated). It sits cleanly contained/centered in the square avatar tile — no overflow. SMOOTH_LOGO_SVG stays exported but is no longer referenced by the header (tree-shaken out of the bundle).

2. Customizable via logoUrl. New optional logoUrl config key + declarative logo-url attribute. When set, the fullpage header renders <img class="logo-img"> sized to contain within the tile; otherwise it falls back to the Smooth icon.

<smooth-agent-chat
  mode="fullpage"
  endpoint="wss://ai.smoo.ai/ws"
  agent-id=""
  logo-url="https://cdn.acme.com/logo.svg"
></smooth-agent-chat>
mountFullPageChat({ endpoint: 'wss://ai.smoo.ai/ws', agentId: '…', logoUrl: 'https://cdn.acme.com/logo.svg' });

Security. logoUrl is validated to absolute http(s) only via the existing safeHttpUrl guard (javascript:/data:/relative dropped) and escaped into the src attribute — a hostile config can't inject script or break out of the attribute.

Verification

  • pnpm check green (typecheck + 105 unit tests + build).
  • New tests: fullpage renders the icon (viewBox 0 0 150 150, not the wordmark) with no logo-img; a safe logoUrl renders an <img> with that src; javascript:/data: URLs are rejected and fall back to the icon; resolveConfig sanitizes logoUrl.
  • IIFE bundle still exposes window.SmoothAgentChat.{mountFullPageChat,mountChatWidget,defineChatWidget}; verified the bundle contains the icon + logo-url + logo-img and no longer the 550×135 wordmark.
  • Rendered the built bundle in headless chromium: the default icon sits cleanly contained in the tile (no overflow); logoUrl swaps in an <img> in its place.

Release

Minor bump (new config key) via changeset. Publish is automated on merge (changesets release workflow).

🤖 Generated with Claude Code

https://claude.ai/code/session_014pdFZByoK3RHMLDxprkdpx

… logoUrl

The full-page header avatar rendered the full "smooth" wordmark (550×135)
crammed into a square tile, so it overflowed/looked broken and stamped Smoo
branding onto customers' pages. Default it to the square Smooth icon
(assets/smooth-icon.svg, 150×150) which sits cleanly contained in the tile,
and add an optional `logoUrl` config key + `logo-url` attribute so host pages
can brand the header with their own logo.

logoUrl is validated to absolute http(s) only (safeHttpUrl) — javascript:/data:/
relative are dropped — and escaped into the img src, so a hostile config can't
inject script. Falls back to the Smooth icon when unset/invalid.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014pdFZByoK3RHMLDxprkdpx
@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 52b22f4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smooai/chat-widget Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brentrager brentrager merged commit a98d7a1 into main Jul 2, 2026
1 check passed
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