ttp-agent-sdk 2.48.2 → 2.48.7

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.
@@ -521,9 +521,6 @@
521
521
  language: language,
522
522
  primaryColor: primaryColor,
523
523
  useShadowDOM: useShadowDOM,
524
- // Same last-hop as platform Test AI Agent (2.48.0 destination).
525
- // 2.48.1 HTML <audio> hop played 24 kHz TTS ~2× on this page.
526
- htmlAudioPlayback: false,
527
524
  behavior: {
528
525
  mode: mode
529
526
  }
@@ -273,6 +273,7 @@
273
273
  <div class="config-group">
274
274
  <label for="agentId">Agent ID *</label>
275
275
  <input type="text" id="agentId" value="agent_e5cf06457" placeholder="agent_123">
276
+ <p style="font-size: 12px; color: #6b7280; margin-top: 6px;">Saved in this browser after you set them once.</p>
276
277
  </div>
277
278
 
278
279
  <div class="config-group">
@@ -412,9 +413,51 @@
412
413
 
413
414
  <script src="demo-sdk-loader.js"></script>
414
415
  <script>
416
+ const DEMO_IDS_KEY = 'ttp-demo-widget-ids';
417
+ const DEFAULT_AGENT_ID = 'agent_e5cf06457';
418
+ const DEFAULT_APP_ID = 'app_Bc01EqMQt2Euehl4qqZSi6l3FJP42Q9vJ0pC';
419
+
420
+ function loadSavedDemoIds() {
421
+ try {
422
+ const parsed = JSON.parse(localStorage.getItem(DEMO_IDS_KEY) || 'null');
423
+ if (parsed && typeof parsed.agentId === 'string' && typeof parsed.appId === 'string'
424
+ && parsed.agentId.trim() && parsed.appId.trim()) {
425
+ return { agentId: parsed.agentId.trim(), appId: parsed.appId.trim() };
426
+ }
427
+ } catch (e) { /* ignore bad localStorage */ }
428
+ return null;
429
+ }
430
+
431
+ function saveDemoIds(agentId, appId) {
432
+ const next = { agentId: (agentId || '').trim(), appId: (appId || '').trim() };
433
+ if (!next.agentId || !next.appId) return;
434
+ localStorage.setItem(DEMO_IDS_KEY, JSON.stringify(next));
435
+ }
436
+
437
+ function applySavedDemoIds() {
438
+ const saved = loadSavedDemoIds();
439
+ if (!saved) return saved;
440
+ const agentEl = document.getElementById('agentId');
441
+ const appEl = document.getElementById('appId');
442
+ if (agentEl) agentEl.value = saved.agentId;
443
+ if (appEl) appEl.value = saved.appId;
444
+ return saved;
445
+ }
446
+
447
+ applySavedDemoIds();
448
+ ['agentId', 'appId'].forEach((id) => {
449
+ document.getElementById(id)?.addEventListener('change', () => {
450
+ saveDemoIds(
451
+ document.getElementById('agentId')?.value,
452
+ document.getElementById('appId')?.value
453
+ );
454
+ });
455
+ });
456
+
415
457
  console.log('🔵 Waiting for SDK to load (use top-right toggle for prod/dev)...');
416
458
 
417
459
  function initSDK() {
460
+ applySavedDemoIds();
418
461
  if (typeof window.TTPAgentSDK === 'undefined') {
419
462
  return;
420
463
  }
@@ -462,6 +505,8 @@
462
505
  return;
463
506
  }
464
507
 
508
+ saveDemoIds(agentId, appId);
509
+
465
510
  // Destroy existing widget if any
466
511
  if (window.widgetInstance) {
467
512
  window.destroyWidget();
@@ -559,8 +604,9 @@
559
604
  };
560
605
 
561
606
  window.resetConfig = function() {
562
- document.getElementById('agentId').value = 'agent_e5cf06457';
563
- document.getElementById('appId').value = 'app_Bc01EqMQt2Euehl4qqZSi6l3FJP42Q9vJ0pC';
607
+ localStorage.removeItem(DEMO_IDS_KEY);
608
+ document.getElementById('agentId').value = DEFAULT_AGENT_ID;
609
+ document.getElementById('appId').value = DEFAULT_APP_ID;
564
610
  document.getElementById('getSessionUrl').value = '';
565
611
  document.getElementById('position').value = 'bottom-right';
566
612
  document.getElementById('language').value = 'en';
package/dist/index.html CHANGED
@@ -23,7 +23,7 @@
23
23
  <img src="https://talktopc.com/logo192.png" alt="TTP Logo" style="width: 40px; height: 40px; border-radius: 8px;">
24
24
  <div>
25
25
  <h1 style="margin: 0; font-size: 1.4rem;">TTP Agent SDK</h1>
26
- <p class="version" style="margin: 0;">v2.48.2</p>
26
+ <p class="version" style="margin: 0;">v2.48.6</p>
27
27
  </div>
28
28
  </div>
29
29
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ttp-agent-sdk",
3
- "version": "2.48.2",
3
+ "version": "2.48.7",
4
4
  "description": "Comprehensive Voice Agent SDK with Customizable Widget - Real-time audio, WebSocket communication, React components, and extensive customization options",
5
5
  "main": "dist/agent-widget.js",
6
6
  "module": "dist/agent-widget.esm.js",