@flowengage/react-chatbot 6.0.26 → 6.0.30
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 +44 -0
- package/dist/flowengage-embed.js +18 -17
- package/dist/flowengage-react-chatbot.cjs +12 -11
- package/dist/flowengage-react-chatbot.mjs +180 -207
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -265,6 +265,35 @@ function RouteTracker() {
|
|
|
265
265
|
|
|
266
266
|
---
|
|
267
267
|
|
|
268
|
+
## Voice Mode
|
|
269
|
+
|
|
270
|
+
The widget includes an ElevenLabs-powered voice agent that visitors can interact with hands-free.
|
|
271
|
+
|
|
272
|
+
### Session lifecycle
|
|
273
|
+
|
|
274
|
+
1. Visitor clicks "Start Voice" (or auto-starts on voice-enabled sites)
|
|
275
|
+
2. Widget fetches a signed URL from the backend (`GET /api/voice/signed-url`)
|
|
276
|
+
3. ElevenLabs WebSocket session starts with page-context greeting override
|
|
277
|
+
4. Agent can call client tools: `flowengage_navigate`, `flowengage_highlight`, `flowengage_list_forms`, `flowengage_fill_form`, `flowengage_click_button`, `end_voice_session`
|
|
278
|
+
5. On SPA navigation the session persists — a URL-change tracker sends contextual updates so the agent knows the current page
|
|
279
|
+
6. On hard navigation (page reload), the transcript is saved to `sessionStorage` and the session auto-resumes on the next page
|
|
280
|
+
|
|
281
|
+
### Voice resume across page reloads
|
|
282
|
+
|
|
283
|
+
When the agent navigates the visitor to a new page (`flowengage_navigate`), the widget:
|
|
284
|
+
- Saves the current transcript and a resume flag to `sessionStorage`
|
|
285
|
+
- Triggers a hard reload or SPA route change
|
|
286
|
+
- On the new page, `useLayoutEffect` detects the pending resume and re-enters `voice_mode`
|
|
287
|
+
- The new session loads with a "continue the tour" preamble so the agent picks up where it left off
|
|
288
|
+
|
|
289
|
+
### Requirements
|
|
290
|
+
|
|
291
|
+
- ElevenLabs agent must have `first_message` override enabled in platform settings
|
|
292
|
+
- Backend must have `ELEVENLABS_API_KEY` configured
|
|
293
|
+
- Visitor must grant microphone permission
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
268
297
|
## How It Works
|
|
269
298
|
|
|
270
299
|
```
|
|
@@ -274,6 +303,7 @@ Your App
|
|
|
274
303
|
├── Boot: GET /api/widget/bootstrap → validates siteId, returns config
|
|
275
304
|
├── Start: POST /api/ai/chat → loads chat history
|
|
276
305
|
├── Chat: Socket.IO → real-time messages & agent handoff
|
|
306
|
+
├── Voice: GET /api/voice/signed-url → ElevenLabs WebSocket voice session
|
|
277
307
|
└── Track: Socket.IO events → visitor session, page views
|
|
278
308
|
```
|
|
279
309
|
|
|
@@ -289,6 +319,20 @@ Backend URLs are resolved by FlowEngage; you normally do not set them unless usi
|
|
|
289
319
|
|
|
290
320
|
---
|
|
291
321
|
|
|
322
|
+
## Building the embed
|
|
323
|
+
|
|
324
|
+
The CDN embed is an IIFE bundle that includes React, all widget code, and inlined CSS. Build it with:
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
FLOWENGAGE_API_URL=https://your-api-url npx vite build --config vite.embed.config.js
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Output lands in `dist/flowengage-embed.js`. Copy this file to the CDN or the backend `public/` folder for serving.
|
|
331
|
+
|
|
332
|
+
The `FLOWENGAGE_API_URL` env var is baked into the bundle at build time — the widget uses it as the default API base URL when no `data-api-url` attribute is present on the script tag.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
292
336
|
## License
|
|
293
337
|
|
|
294
338
|
MIT © FlowEngage
|