feat(rn-webview): @chativa/rn-webview package - #32
Merged
Conversation
Embeds the existing Chativa web chat widget inside a react-native-webview, bridged to native props/callbacks, instead of re-implementing the UI as native RN views. The widget's JS (core + connector + UI) genuinely runs inside the WebView's own browser engine, loaded from each package's published CDN/global build, so every existing @chativa/connector-* package works completely unmodified. <ChativaWebView> exposes the same event props @chativa/react's <ChatIva> does (onMessage, onConnect, onSurveySubmit, ...), plus sendToChativaWebView() for live updates (e.g. theme) after mount without reloading the page. A from-scratch native RN UI is tracked separately per platform, as a conditional follow-up only if this doesn't meet the UX bar in practice: iOS (#29), Android (#30). Adds examples/rn-webview-expo as a living usage doc. Closes #6 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@chativa/core is already published at 0.9.0; this repo's package.json still said 0.0.1 (the release workflow bumps versions from the git tag, not from committed files). Needed so pnpm publish resolves @chativa/rn-webview's workspace:* dependency on @chativa/core to the real published version instead of embedding 0.0.1. Verified via `pnpm pack`: @chativa/core resolves to "0.9.0" in the packed tarball.
@chativa/rn-webview resolves @chativa/core through its built dist/index.d.ts (not a source alias — aliasing to source there made react-native-builder-bob's declaration-emit mirror core's entire source tree into rn-webview's own output, see the package README). CI ran typecheck before build, so a fresh checkout had no dist/ yet and rn-webview's typecheck failed with "Cannot find module '@chativa/core'". Verified locally: clean dist/lib, pnpm install, pnpm build, pnpm typecheck now passes in that order.
…bview # Conflicts: # .github/workflows/release.yml # pnpm-lock.yaml # tsconfig.json
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/rn-webviewpackage:<ChativaWebView>embeds the existing web chat widget (@chativa/ui+@chativa/genui, loaded from each package's published CDN/global build) inside areact-native-webview, bridged to native props/callbacks viawindow.chativaSettings+EventBus↔postMessage.@chativa/connector-*package works completely unmodified — no connector code to port.connectoris described via a JSON-serializable spec ({ type: "dummy" | "websocket" | ... }or{ type: "custom", scriptUrl, globalName, className }) since a liveIConnectorinstance can't cross the native/web bridge.@chativa/react's<ChatIva>(onMessage,onConnect,onSurveySubmit,onWidgetOpen, ...), plussendToChativaWebView()for live updates (e.g. theme) after mount without reloading the page.examples/rn-webview-expo/— living usage doc, scaffolded withcreate-expo-appfor correct SDK 57 version pins.Test plan
pnpm --filter @chativa/rn-webview typecheck/build(react-native-builder-bob) passpnpm --filter chativa-example-rn-webview-expo typecheckpassestypecheckpasses with no regressionsCloses #6
🤖 Generated with Claude Code