@skippr/live-agent-sdk 0.105.0 → 0.106.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 CHANGED
@@ -230,6 +230,42 @@ function App() {
230
230
  - **Close** — call `disconnect()` to end the current session.
231
231
  - **Show the right label** — use `isConnected` and `isStarting` to switch your button between start, connecting, and end states.
232
232
 
233
+ ### Splash screen
234
+
235
+ When your workspace selects the `Template` launcher style under Appearance, the SDK shows a pre-session card instead of the launcher bubble: what the agent can do, the microphone and screen-access rows it needs, and a Start / Continue button. Script-tag embeds get it as a centred overlay automatically. In React you place it yourself, anywhere inside `<LiveAgent>`:
236
+
237
+ ```tsx
238
+ import { useState } from 'react';
239
+ import { LiveAgent, SplashScreen } from '@skippr/live-agent-sdk';
240
+
241
+ function App() {
242
+ const [showSplash, setShowSplash] = useState(true);
243
+
244
+ return (
245
+ <LiveAgent appKey="pk_live_your_key">
246
+ {showSplash && (
247
+ <aside className="w-[380px] p-4">
248
+ <SplashScreen onDismiss={() => setShowSplash(false)} />
249
+ </aside>
250
+ )}
251
+ </LiveAgent>
252
+ );
253
+ }
254
+ ```
255
+
256
+ | Prop | Type | Description |
257
+ |------|------|-------------|
258
+ | `className` | `string` | Applied to the component's own light-DOM element. This is the placement and sizing lever — the card fills whatever slot you give it. |
259
+ | `onDismiss` | `() => void` | Called when the user dismisses the splash, via either the close button or "Skip for now". |
260
+
261
+ - **You own unmounting.** `<SplashScreen>` renders nothing once it no longer applies — the user dismissed it, a session is running, or your workspace has the splash turned off — but it stays mounted until you remove it.
262
+ - **Conditionally render your own wrapper too.** A styled slot (padding, border, grid cell) survives as an empty box when the card stops rendering, as in the example above.
263
+ - **Session start needs no callback.** `useLiveAgent()` already reports `isStarting` / `isConnected`, so read the session from there rather than mirroring it into your own state.
264
+ - **Render exactly one.** Each instance keeps its own microphone and screen state; the SDK warns in the console when a second one mounts, or when the splash is enabled and none is placed.
265
+ - **Bring it back after a skip.** Dismissal lasts for the page load, so the card returns on the next navigation. On a single-page app, call `reopenSplash()` from `useLiveAgent()` — wire it to a "Start guided tour" link or a help-menu item. Skipping never reveals a launcher bubble; the host owns when the card comes back.
266
+ - **Want the centred treatment instead?** Render `<SplashOverlay>` (also exported) for the same backdrop-and-centred card the script-tag embed gets; use the bare `<SplashScreen>` when you want it inline in your own layout. It takes optional `width` (px) and `maxHeight` (% of viewport height) to override the card size your workspace configured; both are clamped to the supported range.
267
+ - **Check the config before you build around it.** `useLiveAgent()` exposes `isSplashConfigured` so you can pick between the splash and your own launcher; it reflects the workspace setting only, not whether the card is on screen right now.
268
+
233
269
  ## API Reference
234
270
 
235
271
  ### `<LiveAgent>`
@@ -278,6 +314,7 @@ Hook for accessing session state and panel controls. Must be called within `<Liv
278
314
  | `activeModule` | `Module \| null` | The module the current session was started with |
279
315
  | `isLoadingModules` | `boolean` | Whether the picker list is being fetched |
280
316
  | `modulesError` | `string \| null` | Error from fetching the picker list, if any |
317
+ | `isSplashConfigured` | `boolean` | Whether your workspace uses the `Template` launcher style, which turns the splash screen on. Configuration only — it does not tell you whether the splash is currently on screen |
281
318
 
282
319
  ```ts
283
320
  interface Module {
@@ -306,6 +343,7 @@ interface Module {
306
343
  | `setPosition` | `(position: 'left' \| 'right') => void` | Change widget position |
307
344
  | `selectModule` | `(id: string) => void` | Start a session with the module of the given id |
308
345
  | `refetchModules` | `() => Promise<void>` | Refetch the picker list |
346
+ | `reopenSplash` | `() => void` | Show the splash screen again after the user skipped it. No-op while a session is running or when your workspace has the splash turned off |
309
347
 
310
348
  ### Additional Hooks
311
349