@centive/aria-sdk 0.7.8 → 0.8.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
@@ -250,12 +250,88 @@ You don't need to manage any of these - the SDK handles them internally:
250
250
  | **Auto-Reconnect** | Exponential backoff (1s → 30s max), up to 10 attempts |
251
251
  | **Session Refresh** | Refreshes 5 minutes before expiry |
252
252
  | **Tab Visibility** | Only refreshes when tab is active |
253
- | **Session Persistence** | Survives page navigation, widget close/reopen |
253
+ | **Session Persistence** | Video and session survive page navigation when SDK is at root level |
254
254
  | **Error Recovery** | Automatic retries with backoff |
255
255
  | **UI Rendering** | Mounts trigger button and widget to DOM |
256
256
 
257
257
  ---
258
258
 
259
+ ## Important: SDK Placement for Session Persistence
260
+
261
+ For the video session to persist across page navigation (no black screen when switching pages), ensure the SDK is initialized at the **root level** of your application, outside of any route-specific components.
262
+
263
+ ### Correct Placement
264
+
265
+ ```tsx
266
+ // App.tsx or _app.tsx - SDK at root level
267
+ import { Aria } from '@centive/aria-sdk';
268
+
269
+ // Initialize once at app startup (outside component or in useEffect with empty deps)
270
+ Aria.init({
271
+ websocketUrl: 'wss://your-server.com/ws',
272
+ userId: 'user_123',
273
+ });
274
+
275
+ function App() {
276
+ return (
277
+ <Router>
278
+ <Routes>
279
+ <Route path="/" element={<HomePage />} />
280
+ <Route path="/dashboard" element={<DashboardPage />} />
281
+ <Route path="/settings" element={<SettingsPage />} />
282
+ {/* SDK persists across all routes - video stays connected */}
283
+ </Routes>
284
+ </Router>
285
+ );
286
+ }
287
+ ```
288
+
289
+ ### Incorrect Placement (causes video to reset on navigation)
290
+
291
+ ```tsx
292
+ // DON'T initialize inside route components - this will reinitialize on every navigation!
293
+ function SettingsPage() {
294
+ useEffect(() => {
295
+ Aria.init({ ... }); // Bad - reinitializes when navigating to this page
296
+ }, []);
297
+
298
+ return <div>Settings</div>;
299
+ }
300
+ ```
301
+
302
+ ### For React Provider Pattern
303
+
304
+ If using the Provider pattern, wrap your entire app at the root:
305
+
306
+ ```tsx
307
+ // Correct - Provider at root, outside Router
308
+ function App() {
309
+ return (
310
+ <AriaProvider config={config}>
311
+ <Router>
312
+ <Routes>
313
+ <Route path="/" element={<HomePage />} />
314
+ <Route path="/settings" element={<SettingsPage />} />
315
+ </Routes>
316
+ </Router>
317
+ </AriaProvider>
318
+ );
319
+ }
320
+ ```
321
+
322
+ ```tsx
323
+ // Incorrect - Provider inside routes (will remount on navigation!)
324
+ function SettingsPage() {
325
+ return (
326
+ <AriaProvider config={config}>
327
+ <SettingsContent />
328
+ </AriaProvider>
329
+ );
330
+ }
331
+ ```
332
+
333
+ ---
334
+
259
335
  ## Security Best Practices
260
336
 
261
337
  ### Do
@@ -1 +1 @@
1
- {"version":3,"file":"AriaAssistant.d.ts","sourceRoot":"","sources":["../../src/components/AriaAssistant.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOhC,UAAU,kBAAkB;IAC1B,uDAAuD;IACvD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA+DhD,CAAC"}
1
+ {"version":3,"file":"AriaAssistant.d.ts","sourceRoot":"","sources":["../../src/components/AriaAssistant.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOhC,UAAU,kBAAkB;IAC1B,uDAAuD;IACvD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA8DhD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AriaStandaloneUI.d.ts","sourceRoot":"","sources":["../../src/components/AriaStandaloneUI.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA4C,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgB1E,OAAO,KAAK,EAOV,KAAK,EACN,MAAM,SAAS,CAAC;AAOjB,UAAU,qBAAqB;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,WAAW,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA2dtD,CAAC;AAk5BF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"AriaStandaloneUI.d.ts","sourceRoot":"","sources":["../../src/components/AriaStandaloneUI.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA4C,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgB1E,OAAO,KAAK,EAOV,KAAK,EACN,MAAM,SAAS,CAAC;AAOjB,UAAU,qBAAqB;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,WAAW,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA8etD,CAAC;AAk5BF,eAAe,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AriaProvider.d.ts","sourceRoot":"","sources":["../../src/context/AriaProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAW1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,UAAU,iBAAiB;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CA0jB9C,CAAC"}
1
+ {"version":3,"file":"AriaProvider.d.ts","sourceRoot":"","sources":["../../src/context/AriaProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAW1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,UAAU,iBAAiB;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAmkB9C,CAAC"}