ttp-agent-sdk 2.36.0 → 2.38.4

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.
@@ -68,9 +68,8 @@ class AudioProcessor extends AudioWorkletProcessor {
68
68
  case 'setForceContinuous':
69
69
  this.forceContinuous = data.enabled;
70
70
  this.isProcessing = true;
71
- // FIXED: Don't set isCurrentlyStreaming = true here - let VAD control it
72
- // VAD will set isCurrentlyStreaming = true when voice is detected
73
- this.isCurrentlyStreaming = false;
71
+ // iOS: bypass client VAD - always send. Desktop: keep VAD (saves bandwidth, reduces noise).
72
+ this.isCurrentlyStreaming = data.enabled && (data.bypassVad === true);
74
73
  break;
75
74
 
76
75
  case 'flush':
@@ -155,7 +155,7 @@
155
155
  <div class="settings-grid">
156
156
  <label>Agent
157
157
  <select id="agentSelect" onchange="handleAgentChange()">
158
- <option value="agent_87c4a55a1|app_Bc01EqMQt2Euehl4qqZSi6l3FJP42Q9vJ0pC|en|ltr">e-commerce_english (agent_87c4a55a1)</option>
158
+ <option value="agent_e165840eb|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|en|ltr">e-commerce_english (agent_e165840eb)</option>
159
159
  <option value="agent_ed18369b3|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|he|rtl">e-commerce_hebrew (agent_ed18369b3)</option>
160
160
  <option value="agent_d119003d8|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|es|ltr">ecommerce_spanish (agent_d119003d8)</option>
161
161
  <option value="custom">Custom...</option>
@@ -257,7 +257,25 @@ window.__TTP_ECOMMERCE__.getCart();
257
257
  window.__TTP_ECOMMERCE__.clearCart();</div>
258
258
  </div>
259
259
 
260
- <script src="/dist/agent-widget.js"></script>
260
+ <script>
261
+ // Load SDK - use fetch with ngrok-skip-browser-warning when on ngrok (fixes iPhone/mobile)
262
+ (function() {
263
+ var isNgrok = window.location.hostname.includes('ngrok');
264
+ if (isNgrok) {
265
+ var s = document.createElement('script');
266
+ s.type = 'text/javascript';
267
+ document.head.appendChild(s);
268
+ fetch('/agent-widget.js', { headers: { 'ngrok-skip-browser-warning': '1' } })
269
+ .then(function(r) { return r.text(); })
270
+ .then(function(code) { s.textContent = code; })
271
+ .catch(function(e) { console.error('SDK fetch failed:', e); });
272
+ } else {
273
+ var s = document.createElement('script');
274
+ s.src = '/agent-widget.js';
275
+ document.head.appendChild(s);
276
+ }
277
+ })();
278
+ </script>
261
279
 
262
280
  <script>
263
281
  let ecomWidget = null;
@@ -417,10 +435,11 @@ window.__TTP_ECOMMERCE__.clearCart();</div>
417
435
  return new Promise((resolve, reject) => {
418
436
  if (window.TTPAgentSDK?.TTPEcommerceWidget) { resolve(); return; }
419
437
  let attempts = 0;
438
+ const maxAttempts = 150; // 15s - allows for slow mobile/ngrok
420
439
  const iv = setInterval(() => {
421
440
  attempts++;
422
441
  if (window.TTPAgentSDK?.TTPEcommerceWidget) { clearInterval(iv); resolve(); }
423
- else if (attempts >= 50) { clearInterval(iv); reject(new Error('SDK failed to load')); }
442
+ else if (attempts >= maxAttempts) { clearInterval(iv); reject(new Error('SDK failed to load')); }
424
443
  }, 100);
425
444
  });
426
445
  }
@@ -399,7 +399,7 @@
399
399
  </div>
400
400
 
401
401
  <!-- Load SDK as UMD library (script tag) -->
402
- <script src="../agent-widget.js" onload="console.log('✅ SDK script loaded, TTPAgentSDK:', typeof window.TTPAgentSDK)" onerror="console.error('❌ Failed to load SDK script')"></script>
402
+ <script src="/agent-widget.js" onload="console.log('✅ SDK script loaded, TTPAgentSDK:', typeof window.TTPAgentSDK)" onerror="console.error('❌ Failed to load SDK script')"></script>
403
403
  <script>
404
404
  console.log('🔵 Waiting for SDK to load...');
405
405
 
@@ -4368,6 +4368,6 @@
4368
4368
  </script>
4369
4369
 
4370
4370
  <!-- Load the widget SDK -->
4371
- <script src="/dist/agent-widget.js?v=2.34.2" onload="if (typeof window.checkAndInitWidget === 'function') setTimeout(window.checkAndInitWidget, 100);" onerror="console.error('❌ Failed to load SDK script from /dist/agent-widget.js'); alert('Failed to load SDK. Check console for details.');"></script>
4371
+ <script src="/agent-widget.js" onload="if (typeof window.checkAndInitWidget === 'function') setTimeout(window.checkAndInitWidget, 100);" onerror="console.error('❌ Failed to load SDK script from /agent-widget.js'); alert('Failed to load SDK. Check console for details.');"></script>
4372
4372
  </body>
4373
4373
  </html>
@@ -866,7 +866,7 @@
866
866
  <!-- Load SDK -->
867
867
 
868
868
  <!-- Load SDK from local build -->
869
- <script src="../dist/agent-widget.js"></script>
869
+ <script src="/agent-widget.js"></script>
870
870
 
871
871
  <script>
872
872
 
@@ -251,7 +251,7 @@
251
251
  </div>
252
252
 
253
253
  <!-- Load the SDK from local dist -->
254
- <script src="/dist/agent-widget.js?v=20250127"></script>
254
+ <script src="/agent-widget.js"></script>
255
255
 
256
256
  <script>
257
257
  let widget = null;
@@ -155,7 +155,7 @@
155
155
  <div class="settings-grid">
156
156
  <label>Agent
157
157
  <select id="agentSelect" onchange="handleAgentChange()">
158
- <option value="agent_87c4a55a1|app_Bc01EqMQt2Euehl4qqZSi6l3FJP42Q9vJ0pC|en|ltr">e-commerce_english (agent_87c4a55a1)</option>
158
+ <option value="agent_e165840eb|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|en|ltr">e-commerce_english (agent_e165840eb)</option>
159
159
  <option value="agent_ed18369b3|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|he|rtl">e-commerce_hebrew (agent_ed18369b3)</option>
160
160
  <option value="agent_d119003d8|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|es|ltr">ecommerce_spanish (agent_d119003d8)</option>
161
161
  <option value="custom">Custom...</option>
@@ -257,7 +257,25 @@ window.__TTP_ECOMMERCE__.getCart();
257
257
  window.__TTP_ECOMMERCE__.clearCart();</div>
258
258
  </div>
259
259
 
260
- <script src="/dist/agent-widget.js"></script>
260
+ <script>
261
+ // Load SDK - use fetch with ngrok-skip-browser-warning when on ngrok (fixes iPhone/mobile)
262
+ (function() {
263
+ var isNgrok = window.location.hostname.includes('ngrok');
264
+ if (isNgrok) {
265
+ var s = document.createElement('script');
266
+ s.type = 'text/javascript';
267
+ document.head.appendChild(s);
268
+ fetch('/agent-widget.js', { headers: { 'ngrok-skip-browser-warning': '1' } })
269
+ .then(function(r) { return r.text(); })
270
+ .then(function(code) { s.textContent = code; })
271
+ .catch(function(e) { console.error('SDK fetch failed:', e); });
272
+ } else {
273
+ var s = document.createElement('script');
274
+ s.src = '/agent-widget.js';
275
+ document.head.appendChild(s);
276
+ }
277
+ })();
278
+ </script>
261
279
 
262
280
  <script>
263
281
  let ecomWidget = null;
@@ -417,10 +435,11 @@ window.__TTP_ECOMMERCE__.clearCart();</div>
417
435
  return new Promise((resolve, reject) => {
418
436
  if (window.TTPAgentSDK?.TTPEcommerceWidget) { resolve(); return; }
419
437
  let attempts = 0;
438
+ const maxAttempts = 150; // 15s - allows for slow mobile/ngrok
420
439
  const iv = setInterval(() => {
421
440
  attempts++;
422
441
  if (window.TTPAgentSDK?.TTPEcommerceWidget) { clearInterval(iv); resolve(); }
423
- else if (attempts >= 50) { clearInterval(iv); reject(new Error('SDK failed to load')); }
442
+ else if (attempts >= maxAttempts) { clearInterval(iv); reject(new Error('SDK failed to load')); }
424
443
  }, 100);
425
444
  });
426
445
  }
@@ -726,7 +726,7 @@
726
726
  </div>
727
727
 
728
728
  <!-- Load the SDK from local dist -->
729
- <script src="/dist/agent-widget.js" data-agent-id="agent_87c4a55a1" data-app-id="app_Bc01EqMQt2Euehl4qqZSi6l3FJP42Q9vJ0pC" onload="console.log('SDK script loaded successfully, TTPAgentSDK:', typeof window.TTPAgentSDK)" onerror="console.error('Failed to load SDK script')"></script>
729
+ <script src="/agent-widget.js" data-agent-id="agent_87c4a55a1" data-app-id="app_Bc01EqMQt2Euehl4qqZSi6l3FJP42Q9vJ0pC" onload="console.log('SDK script loaded successfully, TTPAgentSDK:', typeof window.TTPAgentSDK)" onerror="console.error('Failed to load SDK script')"></script>
730
730
 
731
731
  <script>
732
732
  // Language selection only affects widget, not page UI
@@ -399,7 +399,7 @@
399
399
  </div>
400
400
 
401
401
  <!-- Load SDK as UMD library (script tag) -->
402
- <script src="../agent-widget.js" onload="console.log('✅ SDK script loaded, TTPAgentSDK:', typeof window.TTPAgentSDK)" onerror="console.error('❌ Failed to load SDK script')"></script>
402
+ <script src="/agent-widget.js" onload="console.log('✅ SDK script loaded, TTPAgentSDK:', typeof window.TTPAgentSDK)" onerror="console.error('❌ Failed to load SDK script')"></script>
403
403
  <script>
404
404
  console.log('🔵 Waiting for SDK to load...');
405
405
 
@@ -4368,6 +4368,6 @@
4368
4368
  </script>
4369
4369
 
4370
4370
  <!-- Load the widget SDK -->
4371
- <script src="/dist/agent-widget.js?v=2.34.2" onload="if (typeof window.checkAndInitWidget === 'function') setTimeout(window.checkAndInitWidget, 100);" onerror="console.error('❌ Failed to load SDK script from /dist/agent-widget.js'); alert('Failed to load SDK. Check console for details.');"></script>
4371
+ <script src="/agent-widget.js" onload="if (typeof window.checkAndInitWidget === 'function') setTimeout(window.checkAndInitWidget, 100);" onerror="console.error('❌ Failed to load SDK script from /agent-widget.js'); alert('Failed to load SDK. Check console for details.');"></script>
4372
4372
  </body>
4373
4373
  </html>
@@ -866,7 +866,7 @@
866
866
  <!-- Load SDK -->
867
867
 
868
868
  <!-- Load SDK from local build -->
869
- <script src="../dist/agent-widget.js"></script>
869
+ <script src="/agent-widget.js"></script>
870
870
 
871
871
  <script>
872
872
 
@@ -251,7 +251,7 @@
251
251
  </div>
252
252
 
253
253
  <!-- Load the SDK from local dist -->
254
- <script src="/dist/agent-widget.js?v=20250127"></script>
254
+ <script src="/agent-widget.js"></script>
255
255
 
256
256
  <script>
257
257
  let widget = null;
@@ -155,7 +155,7 @@
155
155
  <div class="settings-grid">
156
156
  <label>Agent
157
157
  <select id="agentSelect" onchange="handleAgentChange()">
158
- <option value="agent_87c4a55a1|app_Bc01EqMQt2Euehl4qqZSi6l3FJP42Q9vJ0pC|en|ltr">e-commerce_english (agent_87c4a55a1)</option>
158
+ <option value="agent_e165840eb|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|en|ltr">e-commerce_english (agent_e165840eb)</option>
159
159
  <option value="agent_ed18369b3|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|he|rtl">e-commerce_hebrew (agent_ed18369b3)</option>
160
160
  <option value="agent_d119003d8|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|es|ltr">ecommerce_spanish (agent_d119003d8)</option>
161
161
  <option value="custom">Custom...</option>
@@ -257,7 +257,25 @@ window.__TTP_ECOMMERCE__.getCart();
257
257
  window.__TTP_ECOMMERCE__.clearCart();</div>
258
258
  </div>
259
259
 
260
- <script src="/dist/agent-widget.js"></script>
260
+ <script>
261
+ // Load SDK - use fetch with ngrok-skip-browser-warning when on ngrok (fixes iPhone/mobile)
262
+ (function() {
263
+ var isNgrok = window.location.hostname.includes('ngrok');
264
+ if (isNgrok) {
265
+ var s = document.createElement('script');
266
+ s.type = 'text/javascript';
267
+ document.head.appendChild(s);
268
+ fetch('/agent-widget.js', { headers: { 'ngrok-skip-browser-warning': '1' } })
269
+ .then(function(r) { return r.text(); })
270
+ .then(function(code) { s.textContent = code; })
271
+ .catch(function(e) { console.error('SDK fetch failed:', e); });
272
+ } else {
273
+ var s = document.createElement('script');
274
+ s.src = '/agent-widget.js';
275
+ document.head.appendChild(s);
276
+ }
277
+ })();
278
+ </script>
261
279
 
262
280
  <script>
263
281
  let ecomWidget = null;
@@ -417,10 +435,11 @@ window.__TTP_ECOMMERCE__.clearCart();</div>
417
435
  return new Promise((resolve, reject) => {
418
436
  if (window.TTPAgentSDK?.TTPEcommerceWidget) { resolve(); return; }
419
437
  let attempts = 0;
438
+ const maxAttempts = 150; // 15s - allows for slow mobile/ngrok
420
439
  const iv = setInterval(() => {
421
440
  attempts++;
422
441
  if (window.TTPAgentSDK?.TTPEcommerceWidget) { clearInterval(iv); resolve(); }
423
- else if (attempts >= 50) { clearInterval(iv); reject(new Error('SDK failed to load')); }
442
+ else if (attempts >= maxAttempts) { clearInterval(iv); reject(new Error('SDK failed to load')); }
424
443
  }, 100);
425
444
  });
426
445
  }
@@ -726,7 +726,7 @@
726
726
  </div>
727
727
 
728
728
  <!-- Load the SDK from local dist -->
729
- <script src="/dist/agent-widget.js" data-agent-id="agent_87c4a55a1" data-app-id="app_Bc01EqMQt2Euehl4qqZSi6l3FJP42Q9vJ0pC" onload="console.log('SDK script loaded successfully, TTPAgentSDK:', typeof window.TTPAgentSDK)" onerror="console.error('Failed to load SDK script')"></script>
729
+ <script src="/agent-widget.js" data-agent-id="agent_87c4a55a1" data-app-id="app_Bc01EqMQt2Euehl4qqZSi6l3FJP42Q9vJ0pC" onload="console.log('SDK script loaded successfully, TTPAgentSDK:', typeof window.TTPAgentSDK)" onerror="console.error('Failed to load SDK script')"></script>
730
730
 
731
731
  <script>
732
732
  // Language selection only affects widget, not page UI
@@ -399,7 +399,7 @@
399
399
  </div>
400
400
 
401
401
  <!-- Load SDK as UMD library (script tag) -->
402
- <script src="../agent-widget.js" onload="console.log('✅ SDK script loaded, TTPAgentSDK:', typeof window.TTPAgentSDK)" onerror="console.error('❌ Failed to load SDK script')"></script>
402
+ <script src="/agent-widget.js" onload="console.log('✅ SDK script loaded, TTPAgentSDK:', typeof window.TTPAgentSDK)" onerror="console.error('❌ Failed to load SDK script')"></script>
403
403
  <script>
404
404
  console.log('🔵 Waiting for SDK to load...');
405
405
 
@@ -4368,6 +4368,6 @@
4368
4368
  </script>
4369
4369
 
4370
4370
  <!-- Load the widget SDK -->
4371
- <script src="/dist/agent-widget.js?v=2.34.2" onload="if (typeof window.checkAndInitWidget === 'function') setTimeout(window.checkAndInitWidget, 100);" onerror="console.error('❌ Failed to load SDK script from /dist/agent-widget.js'); alert('Failed to load SDK. Check console for details.');"></script>
4371
+ <script src="/agent-widget.js" onload="if (typeof window.checkAndInitWidget === 'function') setTimeout(window.checkAndInitWidget, 100);" onerror="console.error('❌ Failed to load SDK script from /agent-widget.js'); alert('Failed to load SDK. Check console for details.');"></script>
4372
4372
  </body>
4373
4373
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ttp-agent-sdk",
3
- "version": "2.36.0",
3
+ "version": "2.38.4",
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",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "scripts": {
26
26
  "build": "npm run build:umd && npm run build:esm && npm run build:dev",
27
- "deploy": "npm run build && npx wrangler pages deploy dist --project-name=ttp-sdk-front --branch=main --commit-dirty=true",
27
+ "deploy": "npm run build && npx wrangler pages deploy dist --project-name=ttp-sdk-front --branch=master --commit-dirty=true",
28
28
  "deploy:prod": "./deploy-production.sh",
29
29
  "build:prod": "webpack --config webpack.config.js",
30
30
  "build:dev": "webpack --config webpack.dev.config.js",
@@ -74,7 +74,7 @@
74
74
  "webpack": "^5.102.1",
75
75
  "webpack-cli": "^6.0.1",
76
76
  "webpack-dev-server": "^5.2.2",
77
- "wrangler": "^4.59.3"
77
+ "wrangler": "^4.69.0"
78
78
  },
79
79
  "dependencies": {
80
80
  "html2canvas": "^1.4.1"