feat(react): @chativa/react wrapper package - #31
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@chativa/reactpackage:ChativaProvider,ChatIva,ChatBotButton,GenUIMessage— React wrappers over the LitElement chat widget built with@lit/react'screateComponent.@chativa/ui/@chativa/genuiare only ever dynamic-imported inside client effects, so the package has nowindow/documentreference at module scope and builds cleanly withnext 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).connectorprop accepts either a registered connector name or a liveIConnectorinstance directly (<ChatIva connector={dummy} />), auto-registering it.onMessage,onMessageSent,onConnect,onDisconnect,onSurveySubmit,onWidgetOpen,onWidgetClose) map from@chativa/core'sEventBus.examples/react-vite/— living usage doc:ChativaProvider+ a customChatBotButtonlauncher element, plus two custom GenUI components (a display-only weather card and an interactive poll usingsendEvent) demonstrating the component-authoring pattern for consumers.Test plan
pnpm --filter @chativa/react typecheck/test(10 tests) /buildall passpnpm --filter chativa-example-react-vite typecheck/buildpassDummyConnector, both custom GenUI components rendering and firing eventstypecheck/testpass with no regressionsCloses #1
🤖 Generated with Claude Code