@sanela/webchat-runtime
v0.3.6
Published
Embeddable webchat widget runtime — Preact + Shadow DOM. Builds to ESM / CJS for bundler consumers (used directly by @sanela/webchat-react and as an internal dep of @sanela/webchat).
Maintainers
Readme
@sanela/webchat-runtime
Embeddable webchat widget runtime — Preact + Shadow DOM.
Most consumers want @sanela/webchat-react (React/Next.js sites) or @sanela/webchat (<script> tag) instead. This package is the lower-level core that those wrappers use.
When to use this directly
- Building a wrapper for a non-React framework (Vue, Svelte, Solid, vanilla).
- Embedding the runtime into an existing client-side codebase without going through the
<script>loader. - Authoring custom dashboard UIs that need to render the widget in preview mode.
Install
pnpm add @sanela/webchat-runtimeUse
import { mount } from "@sanela/webchat-runtime";
const handle = mount({
sourceKey: "pk_...", // from the dashboard
origin: "https://convex-url.convex.cloud", // your Convex backend
dashboardOrigin: "https://dashboard.example.com", // for "open in new window"
});
// Public API surface:
handle.open();
handle.close();
handle.identify({ id: "user_42", email, signature });
handle.context({ order_id: "ORD-1", plan: "pro" });
handle.destroy();See WebchatMountOptions in ./types for the full options reference.
License
MIT
