Skip to content

feat(react): @chativa/react wrapper package - #31

Merged
AimTune merged 2 commits into
mainfrom
feature/chativa-react
Jul 27, 2026
Merged

feat(react): @chativa/react wrapper package#31
AimTune merged 2 commits into
mainfrom
feature/chativa-react

Conversation

@AimTune

@AimTune AimTune commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • New @chativa/react package: ChativaProvider, ChatIva, ChatBotButton, GenUIMessage — React wrappers over the LitElement chat widget built with @lit/react's createComponent.
  • SSR-safe: @chativa/ui / @chativa/genui are only ever dynamic-imported inside client effects, so the package has no window/document reference at module scope and builds cleanly with next build / vite build. "use client" is preserved through the bundler via an output banner (Rollup drops per-module directives once everything is merged into one chunk).
  • connector prop accepts either a registered connector name or a live IConnector instance directly (<ChatIva connector={dummy} />), auto-registering it.
  • Event props (onMessage, onMessageSent, onConnect, onDisconnect, onSurveySubmit, onWidgetOpen, onWidgetClose) map from @chativa/core's EventBus.
  • examples/react-vite/ — living usage doc: ChativaProvider + a custom ChatBotButton launcher element, plus two custom GenUI components (a display-only weather card and an interactive poll using sendEvent) demonstrating the component-authoring pattern for consumers.

Test plan

  • pnpm --filter @chativa/react typecheck / test (10 tests) / build all pass
  • pnpm --filter chativa-example-react-vite typecheck / build pass
  • Exercised the example live in a real browser (chrome-devtools): provider registration, custom launcher toggling the panel, message round-trip through DummyConnector, both custom GenUI components rendering and firing events
  • Full workspace typecheck/test pass with no regressions

Closes #1

🤖 Generated with Claude Code

AimTune and others added 2 commits July 27, 2026 20:15
React wrapper for the Chativa chat widget: ChativaProvider,
ChatIva, ChatBotButton, and GenUIMessage components built on
@lit/react's createComponent, lazily loading @chativa/ui /
@chativa/genui on the client only so the package is SSR-safe
(no window/document at module scope, "use client" preserved
through the bundler).

Adds examples/react-vite as a living usage doc: ChativaProvider +
a custom ChatBotButton launcher element, plus two custom GenUI
components (a display-only weather card and an interactive poll
using sendEvent) to demonstrate the component authoring pattern.

Closes #1

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@chativa/core, @chativa/genui, and @chativa/ui are already
published at 0.9.0; this repo's package.json files still said
0.0.1 (the release workflow bumps versions from the git tag, not
from committed files). Needed so pnpm publish resolves this
package's workspace:* dependencies to the real published version
instead of embedding 0.0.1 into @chativa/react's package.json.

Verified via `pnpm pack`: @chativa/core and @chativa/ui both
resolve to "0.9.0" in the packed tarball.
@AimTune
AimTune merged commit f0f0d49 into main Jul 27, 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.

feat(react): @chativa/react wrapper package

1 participant