@skippr/live-agent-sdk 0.86.0 → 0.87.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.
Files changed (2) hide show
  1. package/README.md +38 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -10,6 +10,7 @@ Embed product specialists that see, speak, and act in real time. Configure **mod
10
10
  - **Real-time voice** — two-way audio with live transcription
11
11
  - **Capture modes** — `screenshare` (user shares screen) or `auto` (DOM capture)
12
12
  - **Agent controls** — opt-in capabilities like element highlighting and on-screen actions, configured per module (auto mode only)
13
+ - **Bring your own button** — start, pause, and end sessions from your own UI with the `useLiveAgent` hook (see [Bring your own button](#bring-your-own-button))
13
14
  - **Chat + transcript** — text messaging with voice transcripts merged into one thread
14
15
  - **Session agenda** — structured phases with progress tracking
15
16
  - **Flexible auth** — email OTP (direct auth) or backend-signed JWT (secret mode)
@@ -195,6 +196,41 @@ function App() {
195
196
  }
196
197
  ```
197
198
 
199
+ ### Bring your own button
200
+
201
+ You can bring your own widget or button and start, pause, and end sessions from it — no need to rely on the built-in launcher:
202
+
203
+ ```tsx
204
+ import { LiveAgent, useLiveAgent } from '@skippr/live-agent-sdk';
205
+
206
+ function TalkToExpertButton() {
207
+ const { isConnected, isStarting, displayModules, selectModule, disconnect } = useLiveAgent();
208
+
209
+ if (isConnected) {
210
+ return <button onClick={() => disconnect()}>End session</button>;
211
+ }
212
+
213
+ const module = displayModules[0];
214
+ return (
215
+ <button disabled={!module || isStarting} onClick={() => module && selectModule(module.id)}>
216
+ {isStarting ? 'Connecting…' : 'Talk to an expert'}
217
+ </button>
218
+ );
219
+ }
220
+
221
+ function App() {
222
+ return (
223
+ <LiveAgent appKey="pk_live_your_key">
224
+ <TalkToExpertButton />
225
+ </LiveAgent>
226
+ );
227
+ }
228
+ ```
229
+
230
+ - **Start** — call `selectModule(id)` with your agent's id (the same id you'd pass as `agentId`). Running multiple agents? Pick one from `displayModules`. If the user has a paused session with that agent, it resumes automatically.
231
+ - **Close** — call `disconnect()` to end the current session.
232
+ - **Show the right label** — use `isConnected` and `isStarting` to switch your button between start, connecting, and end states.
233
+
198
234
  ## API Reference
199
235
 
200
236
  ### `<LiveAgent>`
@@ -231,16 +267,14 @@ Hook for accessing session state and panel controls. Must be called within `<Liv
231
267
  | `isDisconnecting` | `boolean` | Whether the session is being torn down |
232
268
  | `isPausing` | `boolean` | Whether a pause request is in flight (before `isPaused` commits) |
233
269
  | `isPaused` | `boolean` | Whether the current session is paused |
234
- | `resumableSession` | `{ id: string } \| null` | The pinned agent's most recent paused session, or `null` |
235
- | `resumableSessions` | `{ id: string; agentId: string }[]` | All of the user's paused sessions (one per agent), for module pickers |
270
+ | `resumableSession` | `{ id: string; agentId: string } \| null` | The operating module's paused session, or `null` |
236
271
  | `isPanelOpen` | `boolean` | Whether the panel is currently open |
237
272
  | `isMinimized` | `boolean` | Whether the widget is minimized |
238
273
  | `isAuthenticated` | `boolean` | Whether the user is authenticated |
239
274
  | `variant` | `'floating' \| 'sidebar'` | Current widget display mode |
240
275
  | `position` | `'left' \| 'right'` | Current widget position |
241
276
  | `error` | `string` | Error message, if any |
242
- | `hasModuleSelector` | `boolean` | Whether the widget is in picker mode |
243
- | `availableModules` | `Module[]` | Modules fetched for the picker |
277
+ | `displayModules` | `Module[]` | The user's active modules, for pickers and custom start buttons |
244
278
  | `activeModule` | `Module \| null` | The module the current session was started with |
245
279
  | `isLoadingModules` | `boolean` | Whether the picker list is being fetched |
246
280
  | `modulesError` | `string \| null` | Error from fetching the picker list, if any |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skippr/live-agent-sdk",
3
- "version": "0.86.0",
3
+ "version": "0.87.0",
4
4
  "type": "module",
5
5
  "main": "dist/esm/lib-exports.js",
6
6
  "module": "dist/esm/lib-exports.js",