@percena/weft-react 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/index.cjs +8400 -0
- package/dist/index.d.cts +4980 -0
- package/dist/index.d.ts +4980 -0
- package/dist/index.js +8332 -0
- package/dist/styles.css +2 -0
- package/package.json +83 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @percena/weft-react
|
|
2
|
+
|
|
3
|
+
React chat panel + headless hooks for Flitro-backed agents, with **precompiled
|
|
4
|
+
CSS** — the host app needs no Tailwind toolchain.
|
|
5
|
+
|
|
6
|
+
```tsx
|
|
7
|
+
import { useAgentSession, TimelineAgentChatPanel } from '@percena/weft-react'
|
|
8
|
+
import '@percena/weft-react/styles.css'
|
|
9
|
+
|
|
10
|
+
function Support({ boot }: { boot: { server: string; token: string; sessionId: string } }) {
|
|
11
|
+
const session = useAgentSession({
|
|
12
|
+
server: boot.server,
|
|
13
|
+
token: boot.token,
|
|
14
|
+
sessionId: boot.sessionId,
|
|
15
|
+
onTokenExpired: () => refetchToken(boot.sessionId),
|
|
16
|
+
})
|
|
17
|
+
return <TimelineAgentChatPanel runtime={session.runtime} />
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`{ server, token, sessionId }` comes from your backend's embed bootstrap
|
|
22
|
+
(`@percena/weft-node` → `weft.sessions.create(...)`). Re-exports the full
|
|
23
|
+
`@weft/ui` + `@weft/local-chat` surface (including `EN_FALLBACK` and
|
|
24
|
+
`createFlitroEmbedRuntime`). Peers: `react`, `react-dom` (and optionally
|
|
25
|
+
`i18next`/`react-i18next`).
|