@belonguniverseai/react-sdk
v0.1.8
Published
Belong — embeddable React AI assistant dock. Mount <BelongWidget> in your app tree with getToken dependency-injection auth.
Maintainers
Readme
@belonguniverseai/react-sdk
Embeddable Belong AI assistant dock as a React component. Mount <BelongWidget>
inside your own React tree — no <script> tag, no globals. Authentication is
dependency-injected via a getToken callback (called per request; Belong never
caches your token).
Install
npm install @belonguniverseai/react-sdkreact and react-dom (>= 18.2) are peer dependencies — the component mounts on
your app's single React copy.
Usage
import { BelongWidget } from "@belonguniverseai/react-sdk";
export function App() {
return (
<BelongWidget
getToken={async () => {
// Return a fresh Belong-audience JWT. Called per request.
return await getBelongToken();
}}
backend="https://your-belong-backend.example.com"
/>
);
}Props
| Prop | Type | Required | Description |
| ---------------- | ----------------------- | -------- | ------------------------------------------------------------ |
| getToken | () => Promise<string> | yes | Resolves a bearer token per request (DI auth; never cached). |
| backend | string | yes | Belong backend base URL. |
| universeOrigin | string | no | Canonical host origin for cross-origin navigation rebasing. |
| agentId | string | no | Sent as X-Belong-Agent-Id on every request. |
| locale | BelongLocale | no | Host/tenant default language (user choice still wins). |
| panelEnabled | boolean | no | Whether the active workspace shows the assistant panel. |
The dock renders into its own shadow root, so its styles never leak into (or inherit from) your app.
