ttp-agent-sdk 2.43.0 → 2.45.1

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 (46) hide show
  1. package/dist/agent-widget.dev.js +5999 -2308
  2. package/dist/agent-widget.dev.js.map +1 -1
  3. package/dist/agent-widget.esm.js +1 -1
  4. package/dist/agent-widget.esm.js.map +1 -1
  5. package/dist/agent-widget.js +1 -1
  6. package/dist/agent-widget.js.map +1 -1
  7. package/dist/audio-processor.js +2 -2
  8. package/dist/demos/demo-sdk-loader.js +1 -0
  9. package/dist/demos/discovery.js +1 -0
  10. package/dist/demos/index.html +0 -13
  11. package/dist/demos/test-ecommerce.html +28 -45
  12. package/dist/demos/test-tour.html +19 -35
  13. package/dist/demos/test-widget.html +38 -18
  14. package/dist/demos/widget-customization-dev.html +15 -6
  15. package/dist/demos/widget-customization.html +14 -6
  16. package/dist/discovery.js +1 -0
  17. package/dist/examples/demo-sdk-loader.js +1 -0
  18. package/dist/examples/demo-v2.html +2 -2
  19. package/dist/examples/discovery.js +1 -0
  20. package/dist/examples/ocado-cart-network-probe.js +1 -0
  21. package/dist/examples/sobeys-cart-dispatch-probe.js +1 -0
  22. package/dist/examples/sobeys-cart-read-test.html +112 -0
  23. package/dist/examples/sobeys-cart-read-test.js +1 -0
  24. package/dist/examples/sobeys-cart-subscribe-probe.js +1 -0
  25. package/dist/examples/sobeys-cart-subscribe-test.html +168 -0
  26. package/dist/examples/sobeys-cart-subscribe-test.js +1 -0
  27. package/dist/examples/sobeys-inject-probe-min.js +1 -0
  28. package/dist/examples/sobeys-inject-probe.js +1 -0
  29. package/dist/examples/test-ecommerce.html +28 -45
  30. package/dist/examples/test-index.html +0 -13
  31. package/dist/examples/test-restaurant.html +4 -2
  32. package/dist/examples/test-tour.html +19 -35
  33. package/dist/examples/test-widget.html +38 -18
  34. package/dist/examples/widget-customization-dev.html +15 -6
  35. package/dist/examples/widget-customization.html +14 -6
  36. package/dist/hooks/noyhasade.js +1 -0
  37. package/examples/demo-sdk-loader.js +249 -0
  38. package/examples/demo-v2.html +2 -2
  39. package/examples/test-ecommerce.html +28 -45
  40. package/examples/test-index.html +0 -13
  41. package/examples/test-restaurant.html +4 -2
  42. package/examples/test-tour.html +19 -35
  43. package/examples/test-widget.html +38 -18
  44. package/examples/widget-customization-dev.html +15 -6
  45. package/examples/widget-customization.html +14 -6
  46. package/package.json +2 -2
@@ -12,8 +12,8 @@ class AudioProcessor extends AudioWorkletProcessor {
12
12
  // Configuration
13
13
  this.config = options.processorOptions || {};
14
14
  // Use AudioContext sampleRate (available as global 'sampleRate' in AudioWorkletProcessor)
15
- // Fall back to config if sampleRate not available, default to 44100 Hz to match server output
16
- this.sampleRate = typeof sampleRate !== 'undefined' ? sampleRate : (this.config.sampleRate || this.config.outputSampleRate || 44100);
15
+ // Fall back to config if sampleRate not available, default to 24 kHz to match typical server/TTS output
16
+ this.sampleRate = typeof sampleRate !== 'undefined' ? sampleRate : (this.config.sampleRate || this.config.outputSampleRate || 24000);
17
17
  this.bufferSize = 128; // Process 128 samples at a time (256 bytes = 8ms at 16kHz)
18
18
  this.buffer = new Float32Array(this.bufferSize);
19
19
  this.bufferIndex = 0;
@@ -0,0 +1 @@
1
+ !function(e){const t="ttp-demo-sdk-mode",n="/agent-widget.js",o="/agent-widget.dev.js",d="wss://speech.talktopc.com/ws/conv",r="wss://speech.bidme.co.il/ws/conv";let c=null,s=null;function a(){return"dev"===e.localStorage.getItem(t)?"dev":"prod"}function i(e){return"dev"===e?o:n}function l(e){return"dev"===e?"Development":"Production"}function p(e){return"dev"===e?r:d}function u(){const t=e=>{try{e?.destroy?.()}catch(e){console.warn("[TTPDemoSdk] destroy failed",e)}};t(e.widgetInstance),t(e.chatWidget),t(e.testWidget),void 0!==e.actualWidgetInstance&&(t(e.actualWidgetInstance),e.actualWidgetInstance=null),e.widgetInstance=null,e.chatWidget=null,e.testWidget=null}function g(){document.querySelectorAll('script[src*="agent-widget"]').forEach(e=>e.remove()),delete e.TTPAgentSDK,delete e.TTPChatWidget}function m(n){return n="dev"===n||"prod"===n?n:a(),e.localStorage.setItem(t,n),v(n),c=e.location.hostname.includes("ngrok")?function(t){return fetch(i(t),{headers:{"ngrok-skip-browser-warning":"1"}}).then(e=>{if(!e.ok)throw new Error("SDK fetch HTTP "+e.status);return e.text()}).then(n=>{g();const o=document.createElement("script");o.type="text/javascript",o.textContent=n,document.head.appendChild(o),s=t;const d={mode:t,src:i(t),label:l(t),ngrok:!0};return e.dispatchEvent(new CustomEvent("ttp-demo-sdk-ready",{detail:d})),e.TTPAgentSDK})}(n):function(t){return new Promise((n,o)=>{g();const d=document.createElement("script");d.src=i(t)+"?t="+Date.now(),d.onload=()=>{s=t;const o={mode:t,src:d.src,label:l(t)};e.dispatchEvent(new CustomEvent("ttp-demo-sdk-ready",{detail:o})),n(e.TTPAgentSDK)},d.onerror=()=>o(new Error("Failed to load SDK: "+d.src)),document.head.appendChild(d)})}(n),c.catch(e=>{throw console.error("[TTPDemoSdk]",e),e})}function f(e){return"dev"!==e&&"prod"!==e?m(a()):(u(),m(e))}function v(e){const t=document.getElementById("ttp-demo-sdk-toggle");if(!t)return;const n=t.querySelector('[data-mode="prod"]'),o=t.querySelector('[data-mode="dev"]'),d=t.querySelector(".ttp-demo-sdk-file");n&&(n.classList.toggle("active","prod"===e),n.classList.toggle("active-dev",!1)),o&&(o.classList.toggle("active","dev"===e),o.classList.toggle("active-dev","dev"===e)),d&&(d.title=p(e),d.textContent="dev"===e?"dev.js · speech.bidme":"prod.js · talktopc")}function b(){return function(){if(document.getElementById("ttp-demo-sdk-toggle"))return;!function(){if(document.getElementById("ttp-demo-sdk-toggle-styles"))return;const e=document.createElement("style");e.id="ttp-demo-sdk-toggle-styles",e.textContent="\n #ttp-demo-sdk-toggle {\n position: fixed;\n top: 12px;\n right: 12px;\n z-index: 2147483646;\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 12px;\n background: #111827;\n color: #f9fafb;\n font: 13px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n border-radius: 10px;\n box-shadow: 0 4px 14px rgba(0,0,0,.25);\n }\n #ttp-demo-sdk-toggle .ttp-demo-sdk-label { opacity: .85; margin-right: 4px; }\n #ttp-demo-sdk-toggle button {\n border: none;\n cursor: pointer;\n padding: 6px 12px;\n border-radius: 6px;\n font-size: 12px;\n font-weight: 600;\n background: #374151;\n color: #e5e7eb;\n }\n #ttp-demo-sdk-toggle button:hover { background: #4b5563; }\n #ttp-demo-sdk-toggle button.active {\n background: #4f46e5;\n color: #fff;\n }\n #ttp-demo-sdk-toggle button.active-dev {\n background: #d97706;\n color: #fff;\n }\n #ttp-demo-sdk-toggle .ttp-demo-sdk-file {\n font-size: 11px;\n opacity: .7;\n max-width: 140px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n ",document.head.appendChild(e)}();const e=document.createElement("div");e.id="ttp-demo-sdk-toggle",e.setAttribute("role","group"),e.setAttribute("aria-label","SDK bundle"),e.innerHTML='<span class="ttp-demo-sdk-label">SDK</span><button type="button" data-mode="prod" title="Production minified bundle">Production</button><button type="button" data-mode="dev" title="Development bundle with source maps">Development</button><span class="ttp-demo-sdk-file"></span>',e.querySelector('[data-mode="prod"]').addEventListener("click",()=>{"prod"!==a()&&f("prod")}),e.querySelector('[data-mode="dev"]').addEventListener("click",()=>{"dev"!==a()&&f("dev")}),document.body.appendChild(e),v(a())}(),m(a())}e.TTPDemoSdkLoader={STORAGE_KEY:t,PROD_SRC:n,DEV_SRC:o,PROD_WS_URL:d,DEV_WS_URL:r,getMode:a,getSrc:i,getLabel:l,getWebSocketUrl:p,applyWebSocketUrl:function(e,t){const n=e&&"object"==typeof e?e:{},o="dev"===t||"prod"===t?t:a();return n.websocketUrl=p(o),n},loadSdk:m,setMode:f,waitForReady:function(){return e.TTPAgentSDK?.TTPChatWidget&&c?Promise.resolve(e.TTPAgentSDK):c||m(a())},destroyWidgetInstances:u},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",b):b()}(window);
@@ -0,0 +1 @@
1
+ !function(){"use strict";var e=["google.com","googleapis.com","gstatic.com","googletagmanager.com","google-analytics.com","googlesyndication.com","doubleclick.net","facebook.net","facebook.com","fbcdn.net","connect.facebook","cdn.jsdelivr.net","jsdelivr.net","unpkg.com","cdnjs.cloudflare.com","hotjar.com","segment.com","segment.io","mixpanel.com","clarity.ms","licdn.com","bat.bing.com","pinterest.com","tiktok.com","tiktokcdn.com","criteo.com","taboola.com","outbrain.com","cloudflareinsights.com","browser.sentry-cdn.com","sentry.io","amazon-adsystem.com","adsafeprotected.com","scorecardresearch.com","snapchat.com","twitter.com","twimg.com","x.com"];function o(e){if(!e||"string"!=typeof e)return!1;var o=e.trim();return!!o&&(-1!==o.indexOf("fetch")||-1!==o.indexOf("axios")||-1!==o.indexOf("ajax")||-1!==o.indexOf("api")||-1!==o.indexOf("search")||-1!==o.indexOf("query")||-1!==o.indexOf("חיפוש"))}function n(o,n){try{var r=new URL(o,window.location.href);if(function(o){if(!o)return!0;for(var n=String(o).toLowerCase(),r=0;r<e.length;r++)if(n===e[r]||n.endsWith("."+e[r]))return!0;return!1}(r.hostname))return!1;var t=window.location.hostname;if(!t)return!1;if(r.hostname===t)return!0;if(r.hostname.endsWith("."+t))return!0;if(-1!==o.indexOf(t))return!0;var c=n||"";return"/"===c.charAt(0)||0===c.indexOf("./")}catch(e){return!1}}function r(e){if(null==e)return"";var o=String(e);return o.length<=500?o:o.slice(0,500)+"…"}window.ttpDiscover=function(){var e="",t="",c=(new Date).toISOString(),i=[],s=[];try{e=window.location.href,t=window.location.hostname;var l=[];try{l=document.querySelectorAll("script:not([src])")}catch(e){l=[]}for(var a=0;a<l.length;a++)try{var u=(l[a].textContent||"").trim();if(!o(u))continue;i.push(u)}catch(e){}var p=[];try{p=document.querySelectorAll("script[src]")}catch(e){p=[]}for(var g={},d=0;d<p.length;d++)try{var h=p[d],m=h.getAttribute("src")||"",f=h.src||"";if(!n(f,m))continue;if(g[f])continue;g[f]=!0,s.push(f)}catch(e){}}catch(o){return console.error("[TTP Discovery] Unexpected error while scanning:",o),{pageUrl:e||function(){try{return window.location.href}catch(e){return""}}(),hostname:t||function(){try{return window.location.hostname}catch(e){return""}}(),discoveredAt:c,inlineScripts:[],scriptUrls:[],error:String(o&&o.message?o.message:o)}}var v={pageUrl:e,hostname:t,discoveredAt:c,inlineScripts:i,scriptUrls:s};try{console.group("🔍 TTP GO Site Discovery"),console.log("Starting discovery on: "+e),console.group("📄 Inline Scripts"),console.log("Found "+i.length+" relevant inline scripts");for(var y=0;y<i.length;y++)console.log("--- Inline Script #"+(y+1)+" ---"),console.log(r(i[y]));console.groupEnd(),console.group("🔗 Script URLs"),console.log("Found "+s.length+" same-domain script files");for(var w=0;w<s.length;w++)console.log(" - "+s[w]);console.groupEnd(),console.group("📦 Full Payload (ready to send to backend)");try{console.log(JSON.stringify(v,null,2))}catch(e){console.log(v)}console.groupEnd(),console.log("✅ Discovery complete. Call ttpDiscover() again anytime."),console.groupEnd()}catch(e){try{console.log(v)}catch(e){}}return v},window.ttpDiscoverFull=async function(){try{console.group("🚀 TTP GO Discovery Full");var e=await Promise.resolve(window.ttpDiscover()),o=["fetch(","axios.","$.ajax","XMLHttpRequest","/api/","/search","/products","?q=","?search=","?s=","search=","query=","חיפוש"],n=5e5,r=[];console.group("📂 Fetching JS files");for(var t=0;t<e.scriptUrls.length;t++){var c=e.scriptUrls[t];console.log("Fetching:",c);try{var i,s=new AbortController,l=setTimeout(function(){s.abort()},5e3);try{i=await fetch(c,{signal:s.signal})}finally{clearTimeout(l)}if(!i.ok){console.warn("⚠️ HTTP "+i.status+": "+c),r.push({url:c,skipped:!0,reason:"http_"+i.status,snippets:[]});continue}var a=i.headers.get("content-length");if(a&&parseInt(a,10)>n){console.warn("⚠️ Skipped (too large): "+c),r.push({url:c,skipped:!0,reason:"too_large",snippets:[]});continue}var u=await i.text();if(u.length>n){console.warn("⚠️ Skipped after read (too large): "+c),r.push({url:c,skipped:!0,reason:"too_large",snippets:[]});continue}for(var p=u.split("\n"),g=[],d=0;d<p.length;d++){for(var h=p[d],m=!1,f=0;f<o.length;f++)if(-1!==h.indexOf(o[f])){m=!0;break}if(m){for(var v=Math.max(0,d-2),y=Math.min(p.length-1,d+2),w=[],x=0;x<o.length;x++)-1!==h.indexOf(o[x])&&w.push(o[x]);g.push({lineNumber:d+1,matchedKeywords:w,context:p.slice(v,y+1).join("\n")})}}console.log(" → "+g.length+" matches found");for(var S=0;S<g.length;S++){var b=g[S];console.group(" Line "+b.lineNumber+" — ["+b.matchedKeywords.join(", ")+"]"),console.log(b.context),console.groupEnd()}r.push({url:c,skipped:!1,snippets:g})}catch(e){e&&"AbortError"===e.name?(console.warn("⚠️ Timeout: "+c),r.push({url:c,skipped:!0,reason:"timeout",snippets:[]})):(console.warn("⚠️ Failed ("+(e&&e.message?e.message:e)+"): "+c),r.push({url:c,skipped:!0,reason:String(e&&e.message?e.message:e),snippets:[]}))}}console.groupEnd(),console.group("📄 Grepping inline scripts");for(var k=[],O=0;O<e.inlineScripts.length;O++)for(var D=e.inlineScripts[O].split("\n"),T=0;T<D.length;T++){for(var U=D[T],E=!1,F=0;F<o.length;F++)if(-1!==U.indexOf(o[F])){E=!0;break}if(E){for(var A=Math.max(0,T-2),j=Math.min(D.length-1,T+2),P=[],I=0;I<o.length;I++)-1!==U.indexOf(o[I])&&P.push(o[I]);k.push({scriptIndex:O,lineNumber:T+1,matchedKeywords:P,context:D.slice(A,j+1).join("\n")})}}console.log("Found "+k.length+" matches in inline scripts");for(var q=0;q<k.length;q++){var N=k[q];console.group("Inline #"+(N.scriptIndex+1)+" line "+N.lineNumber+" — ["+N.matchedKeywords.join(", ")+"]"),console.log(N.context),console.groupEnd()}console.groupEnd();var L={pageUrl:e.pageUrl,hostname:e.hostname,discoveredAt:e.discoveredAt,inlineScripts:e.inlineScripts,scriptUrls:e.scriptUrls,fileResults:r,inlineSnippets:k};e.error&&(L.error=e.error),console.group("📦 Full Enriched Payload");try{console.log(JSON.stringify(L,null,2))}catch(e){console.log(L)}return console.groupEnd(),console.log("✅ ttpDiscoverFull() complete"),console.groupEnd(),L}catch(e){try{console.error("[TTP Discovery] ttpDiscoverFull failed:",e),console.groupEnd()}catch(e){}return{pageUrl:function(){try{return window.location.href}catch(e){return""}}(),hostname:function(){try{return window.location.hostname}catch(e){return""}}(),discoveredAt:(new Date).toISOString(),inlineScripts:[],scriptUrls:[],fileResults:[],inlineSnippets:[],error:String(e&&e.message?e.message:e)}}},function(){try{console.log("💡 TTP GO Discovery ready — run ttpDiscover() or ttpDiscoverFull() in console to start")}catch(e){}}()}();
@@ -192,19 +192,6 @@
192
192
  </div>
193
193
  </a>
194
194
 
195
- <a href="../examples/test-signed-link.html" class="test-card">
196
- <span class="test-card__icon">🔐</span>
197
- <h3 class="test-card__title">Signed Link Test</h3>
198
- <p class="test-card__description">
199
- Test secure authentication using signed links. Demonstrates how to use signed URLs
200
- for production-ready voice agent integration without exposing agent IDs.
201
- </p>
202
- <div class="test-card__badges">
203
- <span class="badge badge--voice">Voice</span>
204
- <span class="badge badge--sdk">Security</span>
205
- </div>
206
- </a>
207
-
208
195
  <a href="../examples/test.html" class="test-card">
209
196
  <span class="test-card__icon">⚡</span>
210
197
  <h3 class="test-card__title">Basic Voice Test</h3>
@@ -119,16 +119,14 @@
119
119
  </head>
120
120
  <body>
121
121
  <div class="container">
122
- <h1>TTP Hotels Flavor Test</h1>
122
+ <h1>TTP Flavor Test (Ecommerce / Hotels / …)</h1>
123
123
 
124
124
  <div class="info">
125
125
  <strong>How it works:</strong>
126
126
  <ul>
127
- <li>Uses the standard <code>TTPChatWidget</code> with <code>flavor: { type: 'hotels', partnerId: 'mock-hotel' }</code></li>
128
- <li>The backend injects hotel tools (<code>search_rooms</code>, <code>select_room</code>, <code>add_extra</code>, <code>get_booking</code>)</li>
129
- <li>Room cards display when the agent sends <code>show_items</code> messages</li>
130
- <li>Booking summary updates on <code>booking_updated</code> messages</li>
131
- <li>Gallery (<code>show_media</code>) opens fullscreen with widget minimized</li>
127
+ <li>Pick an <strong>Agent</strong> below — the demo passes <code>flavor: { type, partnerId, callView: 'minimized' }</code> for every vertical.</li>
128
+ <li>On <strong>desktop</strong> (&gt;768px), <strong><code>callView: 'minimized'</code></strong> uses the bottom voice strip when a call is active (in-panel active call UI is hidden). Mobile keeps the existing minimized bar behavior.</li>
129
+ <li>Each vertical wires WebSocket handlers (e.g. hotels: <code>show_items</code> rooms, <code>booking_updated</code>, <code>show_media</code>).</li>
132
130
  </ul>
133
131
  </div>
134
132
 
@@ -138,8 +136,8 @@
138
136
  <div class="settings-grid">
139
137
  <label>Agent
140
138
  <select id="agentSelect" onchange="handleAgentChange()">
141
- <option value="agent_ed18369b3|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|ecommerce|mock-store">Ecommerce Demo (agent_ed18369b3)</option>
142
- <option value="agent_d0774f1af|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|hotels|mock-hotel" selected>Hotels Demo (agent_d0774f1af)</option>
139
+ <option value="agent_ed18369b3|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|ecommerce|mock-store" selected>Ecommerce Demo (agent_ed18369b3)</option>
140
+ <option value="agent_d0774f1af|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|hotels|mock-hotel">Hotels Demo (agent_d0774f1af)</option>
143
141
  <option value="agent_PHARMA_ID|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|pharma|mock-pharm">Pharma Demo (update agent ID)</option>
144
142
  <option value="agent_RESTAURANT_ID|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|restaurants|mock-restaurant">Restaurant Demo (update agent ID)</option>
145
143
  <option value="agent_TOUR_ID|app_wNGQKiMUfUT5JdVIaxzXOJfdcgBegxGY5hZo|tours|mock-tour">Tour Demo (update agent ID)</option>
@@ -166,11 +164,11 @@
166
164
  </label>
167
165
  <label>STT Provider
168
166
  <select id="sttSelect">
167
+ <option value="soniox" selected>Soniox (default — no override)</option>
169
168
  <option value="">Default (server)</option>
170
- <option value="azure-stt" selected>Azure STT</option>
169
+ <option value="azure-stt">Azure STT</option>
171
170
  <option value="cartesia-stt">Cartesia (Ink-Whisper)</option>
172
171
  <option value="openai-realtime">OpenAI Realtime</option>
173
- <option value="soniox">Soniox</option>
174
172
  </select>
175
173
  </label>
176
174
  <label>Start Open
@@ -233,24 +231,7 @@ window.testWidget._flavor.messageHandlers['show_media']({
233
231
  });</div>
234
232
  </div>
235
233
 
236
- <script>
237
- (function() {
238
- var isNgrok = window.location.hostname.includes('ngrok');
239
- if (isNgrok) {
240
- var s = document.createElement('script');
241
- s.type = 'text/javascript';
242
- document.head.appendChild(s);
243
- fetch('/agent-widget.js', { headers: { 'ngrok-skip-browser-warning': '1' } })
244
- .then(function(r) { return r.text(); })
245
- .then(function(code) { s.textContent = code; })
246
- .catch(function(e) { console.error('SDK fetch failed:', e); });
247
- } else {
248
- var s = document.createElement('script');
249
- s.src = '/agent-widget.js';
250
- document.head.appendChild(s);
251
- }
252
- })();
253
- </script>
234
+ <script src="demo-sdk-loader.js"></script>
254
235
 
255
236
  <script>
256
237
  let chatWidget = null;
@@ -296,7 +277,7 @@ window.testWidget._flavor.messageHandlers['show_media']({
296
277
 
297
278
  const agent = getAgentConfig();
298
279
 
299
- chatWidget = new TTPAgentSDK.TTPChatWidget({
280
+ const widgetConfig = window.TTPDemoSdkLoader.applyWebSocketUrl({
300
281
  agentId: agent.agentId,
301
282
  appId: agent.appId,
302
283
  language: document.getElementById('languageSelect').value,
@@ -304,7 +285,8 @@ window.testWidget._flavor.messageHandlers['show_media']({
304
285
  agentSettingsOverride: (() => {
305
286
  const override = {};
306
287
  const stt = document.getElementById('sttSelect').value;
307
- if (stt) override.sttProvider = stt;
288
+ // Soniox is server default; only override when picking a non-default provider
289
+ if (stt && stt !== 'soniox') override.sttProvider = stt;
308
290
  return override;
309
291
  })(),
310
292
  behavior: {
@@ -312,7 +294,8 @@ window.testWidget._flavor.messageHandlers['show_media']({
312
294
  },
313
295
  flavor: {
314
296
  type: agent.flavorType,
315
- partnerId: agent.partnerId
297
+ partnerId: agent.partnerId,
298
+ callView: 'minimized',
316
299
  },
317
300
  icon: {
318
301
  type: 'custom',
@@ -325,6 +308,7 @@ window.testWidget._flavor.messageHandlers['show_media']({
325
308
  text: 'היי, אשמח אם תוכלי לעזור לי '
326
309
  }
327
310
  });
311
+ chatWidget = new TTPAgentSDK.TTPChatWidget(widgetConfig);
328
312
 
329
313
  window.testWidget = chatWidget;
330
314
  const sttLabel = document.getElementById('sttSelect').selectedOptions[0].text;
@@ -415,24 +399,23 @@ window.testWidget._flavor.messageHandlers['show_media']({
415
399
  };
416
400
 
417
401
  // Wait for SDK and auto-create
418
- function waitForSDK() {
419
- return new Promise((resolve, reject) => {
420
- if (window.TTPAgentSDK?.TTPChatWidget) { resolve(); return; }
421
- let attempts = 0;
422
- const iv = setInterval(() => {
423
- attempts++;
424
- if (window.TTPAgentSDK?.TTPChatWidget) { clearInterval(iv); resolve(); }
425
- else if (attempts >= 150) { clearInterval(iv); reject(new Error('SDK failed to load')); }
426
- }, 100);
427
- });
402
+ function boot() {
403
+ const mode = window.TTPDemoSdkLoader?.getMode?.() || 'prod';
404
+ updateStatus('SDK loaded (' + mode + ') click Create Widget or wait...', '');
405
+ createWidget();
428
406
  }
429
407
 
430
- waitForSDK().then(() => {
431
- updateStatus('SDK loaded — creating widget...', '');
432
- createWidget();
433
- }).catch(e => {
408
+ window.addEventListener('ttp-demo-sdk-ready', () => {
409
+ if (chatWidget) {
410
+ chatWidget.destroy();
411
+ chatWidget = null;
412
+ }
413
+ boot();
414
+ });
415
+ window.TTPDemoSdkLoader.waitForReady().then(boot).catch((e) => {
434
416
  updateStatus('SDK load failed: ' + e.message, 'error');
435
417
  });
436
418
  </script>
419
+ <script src="discovery.js"></script>
437
420
  </body>
438
421
  </html>
@@ -149,8 +149,9 @@
149
149
  </label>
150
150
  <label>STT Provider
151
151
  <select id="sttSelect">
152
+ <option value="soniox" selected>Soniox (default — no override)</option>
152
153
  <option value="">Default (server)</option>
153
- <option value="azure-stt" selected>Azure STT</option>
154
+ <option value="azure-stt">Azure STT</option>
154
155
  </select>
155
156
  </label>
156
157
  </div>
@@ -201,24 +202,7 @@ window.testWidget._flavor.messageHandlers['show_items']({
201
202
  });</div>
202
203
  </div>
203
204
 
204
- <script>
205
- (function() {
206
- var isNgrok = window.location.hostname.includes('ngrok');
207
- if (isNgrok) {
208
- var s = document.createElement('script');
209
- s.type = 'text/javascript';
210
- document.head.appendChild(s);
211
- fetch('/agent-widget.js', { headers: { 'ngrok-skip-browser-warning': '1' } })
212
- .then(function(r) { return r.text(); })
213
- .then(function(code) { s.textContent = code; })
214
- .catch(function(e) { console.error('SDK fetch failed:', e); });
215
- } else {
216
- var s = document.createElement('script');
217
- s.src = '/agent-widget.js';
218
- document.head.appendChild(s);
219
- }
220
- })();
221
- </script>
205
+ <script src="demo-sdk-loader.js"></script>
222
206
 
223
207
  <script>
224
208
  let chatWidget = null;
@@ -244,14 +228,15 @@ window.testWidget._flavor.messageHandlers['show_items']({
244
228
  const agentId = document.getElementById('agentId').value;
245
229
  const appId = document.getElementById('appId').value;
246
230
 
247
- chatWidget = new TTPAgentSDK.TTPChatWidget({
231
+ const widgetConfig = window.TTPDemoSdkLoader.applyWebSocketUrl({
248
232
  agentId,
249
233
  appId,
250
234
  language: document.getElementById('languageSelect').value,
251
235
  agentSettingsOverride: (() => {
252
236
  const override = {};
253
237
  const stt = document.getElementById('sttSelect').value;
254
- if (stt) override.sttProvider = stt;
238
+ // Soniox is server default; only override when picking a non-default provider
239
+ if (stt && stt !== 'soniox') override.sttProvider = stt;
255
240
  return override;
256
241
  })(),
257
242
  behavior: {
@@ -272,6 +257,7 @@ window.testWidget._flavor.messageHandlers['show_items']({
272
257
  text: 'היי, אשמח אם תוכלי לעזור לי במשהו....'
273
258
  }
274
259
  });
260
+ chatWidget = new TTPAgentSDK.TTPChatWidget(widgetConfig);
275
261
 
276
262
  window.testWidget = chatWidget;
277
263
  updateStatus('TTPChatWidget created — tours flavor (mock-tour)', 'success');
@@ -352,22 +338,20 @@ window.testWidget._flavor.messageHandlers['show_items']({
352
338
  updateStatus('Booking cleared', '');
353
339
  };
354
340
 
355
- function waitForSDK() {
356
- return new Promise((resolve, reject) => {
357
- if (window.TTPAgentSDK?.TTPChatWidget) { resolve(); return; }
358
- let attempts = 0;
359
- const iv = setInterval(() => {
360
- attempts++;
361
- if (window.TTPAgentSDK?.TTPChatWidget) { clearInterval(iv); resolve(); }
362
- else if (attempts >= 150) { clearInterval(iv); reject(new Error('SDK failed to load')); }
363
- }, 100);
364
- });
341
+ function boot() {
342
+ const mode = window.TTPDemoSdkLoader?.getMode?.() || 'prod';
343
+ updateStatus('SDK loaded (' + mode + ') creating widget...', '');
344
+ createWidget();
365
345
  }
366
346
 
367
- waitForSDK().then(() => {
368
- updateStatus('SDK loaded — creating widget...', '');
369
- createWidget();
370
- }).catch(e => {
347
+ window.addEventListener('ttp-demo-sdk-ready', () => {
348
+ if (chatWidget) {
349
+ chatWidget.destroy();
350
+ chatWidget = null;
351
+ }
352
+ boot();
353
+ });
354
+ window.TTPDemoSdkLoader.waitForReady().then(boot).catch((e) => {
371
355
  updateStatus('SDK load failed: ' + e.message, 'error');
372
356
  });
373
357
  </script>
@@ -285,9 +285,11 @@
285
285
  <input type="text" id="getSessionUrl" value="" placeholder="https://your-api.com/get-session">
286
286
  </div>
287
287
 
288
- <div class="config-group">
289
- <label for="websocketUrl">WebSocket URL</label>
290
- <input type="text" id="websocketUrl" value="wss://speech.talktopc.com/ws/conv" placeholder="wss://...">
288
+ <div class="config-group" style="grid-column: 1 / -1;">
289
+ <label>WebSocket URL</label>
290
+ <p id="demoWsUrlDisplay" style="font-size: 13px; color: #4b5563; margin-top: 4px; font-family: monospace;">
291
+ Set by SDK toggle (top-right): Production → speech.talktopc.com · Development → speech.bidme.co.il
292
+ </p>
291
293
  </div>
292
294
 
293
295
  <div class="config-group">
@@ -398,16 +400,12 @@
398
400
  </div>
399
401
  </div>
400
402
 
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>
403
+ <script src="demo-sdk-loader.js"></script>
403
404
  <script>
404
- console.log('🔵 Waiting for SDK to load...');
405
-
406
- // Wait for TTPAgentSDK to be available (UMD library loads as global)
405
+ console.log('🔵 Waiting for SDK to load (use top-right toggle for prod/dev)...');
406
+
407
407
  function initSDK() {
408
408
  if (typeof window.TTPAgentSDK === 'undefined') {
409
- console.log('⏳ TTPAgentSDK not ready yet, waiting...');
410
- setTimeout(initSDK, 100);
411
409
  return;
412
410
  }
413
411
 
@@ -427,6 +425,8 @@
427
425
 
428
426
  window.TTPChatWidget = TTPChatWidget;
429
427
  window.widgetInstance = null;
428
+ const mode = window.TTPDemoSdkLoader?.getMode?.() || '?';
429
+ console.log('✅ SDK ready:', window.TTPDemoSdkLoader?.getSrc?.(mode), '(' + mode + ')');
430
430
 
431
431
  // Define functions after module loads
432
432
  window.initializeWidget = function() {
@@ -442,7 +442,6 @@
442
442
  const agentId = document.getElementById('agentId').value;
443
443
  const appId = document.getElementById('appId').value;
444
444
  const getSessionUrl = document.getElementById('getSessionUrl').value;
445
- const websocketUrl = document.getElementById('websocketUrl').value;
446
445
  const position = document.getElementById('position').value;
447
446
  const language = document.getElementById('language').value;
448
447
  const mode = document.getElementById('mode').value;
@@ -477,9 +476,8 @@
477
476
  config.getSessionUrl = getSessionUrl;
478
477
  }
479
478
 
480
- if (websocketUrl) {
481
- config.websocketUrl = websocketUrl;
482
- }
479
+ window.TTPDemoSdkLoader.applyWebSocketUrl(config);
480
+ console.log('🔌 websocketUrl:', config.websocketUrl, '(SDK mode:', window.TTPDemoSdkLoader.getMode() + ')');
483
481
 
484
482
  // Handle position
485
483
  if (position) {
@@ -549,7 +547,6 @@
549
547
  document.getElementById('agentId').value = 'agent_e5cf06457';
550
548
  document.getElementById('appId').value = 'app_Bc01EqMQt2Euehl4qqZSi6l3FJP42Q9vJ0pC';
551
549
  document.getElementById('getSessionUrl').value = '';
552
- document.getElementById('websocketUrl').value = 'wss://speech.talktopc.com/ws/conv';
553
550
  document.getElementById('position').value = 'bottom-right';
554
551
  document.getElementById('language').value = 'en';
555
552
  document.getElementById('mode').value = 'unified';
@@ -638,9 +635,32 @@
638
635
  resetConfig: typeof window.resetConfig
639
636
  });
640
637
  }
641
-
642
- // Start initialization
643
- initSDK();
638
+
639
+ function updateWsUrlDisplay() {
640
+ const el = document.getElementById('demoWsUrlDisplay');
641
+ if (!el || !window.TTPDemoSdkLoader) return;
642
+ const mode = window.TTPDemoSdkLoader.getMode();
643
+ el.textContent = window.TTPDemoSdkLoader.getWebSocketUrl(mode) + ' (' + mode + ')';
644
+ }
645
+
646
+ window.addEventListener('ttp-demo-sdk-ready', () => {
647
+ updateWsUrlDisplay();
648
+ if (window.widgetInstance && typeof window.destroyWidget === 'function') {
649
+ window.destroyWidget();
650
+ }
651
+ initSDK();
652
+ // Re-create widget if user already initialized (so WS URL matches new SDK mode)
653
+ if (typeof window.initializeWidget === 'function' && document.getElementById('widgetStatus')?.textContent === 'Yes') {
654
+ window.initializeWidget();
655
+ }
656
+ });
657
+ window.TTPDemoSdkLoader.waitForReady().then(() => {
658
+ updateWsUrlDisplay();
659
+ initSDK();
660
+ }).catch((e) => {
661
+ console.error('❌ SDK load failed:', e);
662
+ alert('SDK load failed. Check Network for agent-widget*.js');
663
+ });
644
664
  </script>
645
665
  </body>
646
666
  </html>
@@ -1280,10 +1280,11 @@
1280
1280
  }
1281
1281
  }
1282
1282
  </style>
1283
+ <script src="demo-sdk-loader.js"></script>
1283
1284
  </head>
1284
1285
  <body>
1285
1286
  <div class="header">
1286
- <div class="dev-banner">⚠️ DEV PAGE - Using production SDK (agent-widget.js)</div>
1287
+ <div class="dev-banner">🔧 Use the SDK toggle (top-right) to switch Production ↔ Development bundles</div>
1287
1288
  <a href="test-index.html" class="back-link">← Back to Demos</a>
1288
1289
  <h1>🎨 Widget Live Customization (Dev Page)</h1>
1289
1290
  <div style="margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 24px; flex-wrap: wrap;">
@@ -4126,6 +4127,10 @@
4126
4127
  }
4127
4128
  };
4128
4129
 
4130
+ if (window.TTPDemoSdkLoader) {
4131
+ window.TTPDemoSdkLoader.applyWebSocketUrl(actualConfig);
4132
+ }
4133
+
4129
4134
  try {
4130
4135
  // Reset manual close tracking when widget is recreated (unless user manually closed it)
4131
4136
  // Don't reset if widget was manually closed and mock panel is also closed
@@ -4348,8 +4353,15 @@
4348
4353
  };
4349
4354
 
4350
4355
  // Start checking for SDK (will also be called when script loads)
4351
- window.checkAndInitWidget();
4352
-
4356
+ window.addEventListener('ttp-demo-sdk-ready', () => {
4357
+ if (actualWidgetInstance) {
4358
+ try { actualWidgetInstance.destroy(); } catch (e) { /* ignore */ }
4359
+ actualWidgetInstance = null;
4360
+ }
4361
+ window.checkAndInitWidget();
4362
+ });
4363
+ window.TTPDemoSdkLoader.waitForReady().then(() => window.checkAndInitWidget());
4364
+
4353
4365
  // Debug helper - expose widget instance globally for inspection
4354
4366
  window.debugWidget = function() {
4355
4367
  console.log('=== Widget Debug Info ===');
@@ -4376,8 +4388,5 @@
4376
4388
  };
4377
4389
  };
4378
4390
  </script>
4379
-
4380
- <!-- Load the widget SDK (production version) -->
4381
- <script src="/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 /agent-widget.js'); alert('Failed to load SDK. Check console for details.');"></script>
4382
4391
  </body>
4383
4392
  </html>
@@ -1793,6 +1793,7 @@
1793
1793
  }
1794
1794
  }
1795
1795
  </style>
1796
+ <script src="demo-sdk-loader.js"></script>
1796
1797
  </head>
1797
1798
  <body>
1798
1799
  <div class="header">
@@ -5017,6 +5018,10 @@
5017
5018
  }
5018
5019
  };
5019
5020
 
5021
+ if (window.TTPDemoSdkLoader) {
5022
+ window.TTPDemoSdkLoader.applyWebSocketUrl(actualConfig);
5023
+ }
5024
+
5020
5025
  try {
5021
5026
  // Reset manual close tracking when widget is recreated (unless user manually closed it)
5022
5027
  // Don't reset if widget was manually closed and mock panel is also closed
@@ -5450,9 +5455,15 @@
5450
5455
  }
5451
5456
  };
5452
5457
 
5453
- // Start checking for SDK (will also be called when script loads)
5454
- window.checkAndInitWidget();
5455
-
5458
+ window.addEventListener('ttp-demo-sdk-ready', () => {
5459
+ if (actualWidgetInstance) {
5460
+ try { actualWidgetInstance.destroy(); } catch (e) { /* ignore */ }
5461
+ actualWidgetInstance = null;
5462
+ }
5463
+ window.checkAndInitWidget();
5464
+ });
5465
+ window.TTPDemoSdkLoader.waitForReady().then(() => window.checkAndInitWidget());
5466
+
5456
5467
  // Debug helper - expose widget instance globally for inspection
5457
5468
  window.debugWidget = function() {
5458
5469
  console.log('=== Widget Debug Info ===');
@@ -5479,8 +5490,5 @@
5479
5490
  };
5480
5491
  };
5481
5492
  </script>
5482
-
5483
- <!-- Load the widget SDK -->
5484
- <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>
5485
5493
  </body>
5486
5494
  </html>
@@ -0,0 +1 @@
1
+ !function(){"use strict";var e=["google.com","googleapis.com","gstatic.com","googletagmanager.com","google-analytics.com","googlesyndication.com","doubleclick.net","facebook.net","facebook.com","fbcdn.net","connect.facebook","cdn.jsdelivr.net","jsdelivr.net","unpkg.com","cdnjs.cloudflare.com","hotjar.com","segment.com","segment.io","mixpanel.com","clarity.ms","licdn.com","bat.bing.com","pinterest.com","tiktok.com","tiktokcdn.com","criteo.com","taboola.com","outbrain.com","cloudflareinsights.com","browser.sentry-cdn.com","sentry.io","amazon-adsystem.com","adsafeprotected.com","scorecardresearch.com","snapchat.com","twitter.com","twimg.com","x.com"];function o(e){if(!e||"string"!=typeof e)return!1;var o=e.trim();return!!o&&(-1!==o.indexOf("fetch")||-1!==o.indexOf("axios")||-1!==o.indexOf("ajax")||-1!==o.indexOf("api")||-1!==o.indexOf("search")||-1!==o.indexOf("query")||-1!==o.indexOf("חיפוש"))}function n(o,n){try{var r=new URL(o,window.location.href);if(function(o){if(!o)return!0;for(var n=String(o).toLowerCase(),r=0;r<e.length;r++)if(n===e[r]||n.endsWith("."+e[r]))return!0;return!1}(r.hostname))return!1;var t=window.location.hostname;if(!t)return!1;if(r.hostname===t)return!0;if(r.hostname.endsWith("."+t))return!0;if(-1!==o.indexOf(t))return!0;var c=n||"";return"/"===c.charAt(0)||0===c.indexOf("./")}catch(e){return!1}}function r(e){if(null==e)return"";var o=String(e);return o.length<=500?o:o.slice(0,500)+"…"}window.ttpDiscover=function(){var e="",t="",c=(new Date).toISOString(),i=[],s=[];try{e=window.location.href,t=window.location.hostname;var l=[];try{l=document.querySelectorAll("script:not([src])")}catch(e){l=[]}for(var a=0;a<l.length;a++)try{var u=(l[a].textContent||"").trim();if(!o(u))continue;i.push(u)}catch(e){}var p=[];try{p=document.querySelectorAll("script[src]")}catch(e){p=[]}for(var g={},d=0;d<p.length;d++)try{var h=p[d],m=h.getAttribute("src")||"",f=h.src||"";if(!n(f,m))continue;if(g[f])continue;g[f]=!0,s.push(f)}catch(e){}}catch(o){return console.error("[TTP Discovery] Unexpected error while scanning:",o),{pageUrl:e||function(){try{return window.location.href}catch(e){return""}}(),hostname:t||function(){try{return window.location.hostname}catch(e){return""}}(),discoveredAt:c,inlineScripts:[],scriptUrls:[],error:String(o&&o.message?o.message:o)}}var v={pageUrl:e,hostname:t,discoveredAt:c,inlineScripts:i,scriptUrls:s};try{console.group("🔍 TTP GO Site Discovery"),console.log("Starting discovery on: "+e),console.group("📄 Inline Scripts"),console.log("Found "+i.length+" relevant inline scripts");for(var y=0;y<i.length;y++)console.log("--- Inline Script #"+(y+1)+" ---"),console.log(r(i[y]));console.groupEnd(),console.group("🔗 Script URLs"),console.log("Found "+s.length+" same-domain script files");for(var w=0;w<s.length;w++)console.log(" - "+s[w]);console.groupEnd(),console.group("📦 Full Payload (ready to send to backend)");try{console.log(JSON.stringify(v,null,2))}catch(e){console.log(v)}console.groupEnd(),console.log("✅ Discovery complete. Call ttpDiscover() again anytime."),console.groupEnd()}catch(e){try{console.log(v)}catch(e){}}return v},window.ttpDiscoverFull=async function(){try{console.group("🚀 TTP GO Discovery Full");var e=await Promise.resolve(window.ttpDiscover()),o=["fetch(","axios.","$.ajax","XMLHttpRequest","/api/","/search","/products","?q=","?search=","?s=","search=","query=","חיפוש"],n=5e5,r=[];console.group("📂 Fetching JS files");for(var t=0;t<e.scriptUrls.length;t++){var c=e.scriptUrls[t];console.log("Fetching:",c);try{var i,s=new AbortController,l=setTimeout(function(){s.abort()},5e3);try{i=await fetch(c,{signal:s.signal})}finally{clearTimeout(l)}if(!i.ok){console.warn("⚠️ HTTP "+i.status+": "+c),r.push({url:c,skipped:!0,reason:"http_"+i.status,snippets:[]});continue}var a=i.headers.get("content-length");if(a&&parseInt(a,10)>n){console.warn("⚠️ Skipped (too large): "+c),r.push({url:c,skipped:!0,reason:"too_large",snippets:[]});continue}var u=await i.text();if(u.length>n){console.warn("⚠️ Skipped after read (too large): "+c),r.push({url:c,skipped:!0,reason:"too_large",snippets:[]});continue}for(var p=u.split("\n"),g=[],d=0;d<p.length;d++){for(var h=p[d],m=!1,f=0;f<o.length;f++)if(-1!==h.indexOf(o[f])){m=!0;break}if(m){for(var v=Math.max(0,d-2),y=Math.min(p.length-1,d+2),w=[],x=0;x<o.length;x++)-1!==h.indexOf(o[x])&&w.push(o[x]);g.push({lineNumber:d+1,matchedKeywords:w,context:p.slice(v,y+1).join("\n")})}}console.log(" → "+g.length+" matches found");for(var S=0;S<g.length;S++){var b=g[S];console.group(" Line "+b.lineNumber+" — ["+b.matchedKeywords.join(", ")+"]"),console.log(b.context),console.groupEnd()}r.push({url:c,skipped:!1,snippets:g})}catch(e){e&&"AbortError"===e.name?(console.warn("⚠️ Timeout: "+c),r.push({url:c,skipped:!0,reason:"timeout",snippets:[]})):(console.warn("⚠️ Failed ("+(e&&e.message?e.message:e)+"): "+c),r.push({url:c,skipped:!0,reason:String(e&&e.message?e.message:e),snippets:[]}))}}console.groupEnd(),console.group("📄 Grepping inline scripts");for(var k=[],O=0;O<e.inlineScripts.length;O++)for(var D=e.inlineScripts[O].split("\n"),T=0;T<D.length;T++){for(var U=D[T],E=!1,F=0;F<o.length;F++)if(-1!==U.indexOf(o[F])){E=!0;break}if(E){for(var A=Math.max(0,T-2),j=Math.min(D.length-1,T+2),P=[],I=0;I<o.length;I++)-1!==U.indexOf(o[I])&&P.push(o[I]);k.push({scriptIndex:O,lineNumber:T+1,matchedKeywords:P,context:D.slice(A,j+1).join("\n")})}}console.log("Found "+k.length+" matches in inline scripts");for(var q=0;q<k.length;q++){var N=k[q];console.group("Inline #"+(N.scriptIndex+1)+" line "+N.lineNumber+" — ["+N.matchedKeywords.join(", ")+"]"),console.log(N.context),console.groupEnd()}console.groupEnd();var L={pageUrl:e.pageUrl,hostname:e.hostname,discoveredAt:e.discoveredAt,inlineScripts:e.inlineScripts,scriptUrls:e.scriptUrls,fileResults:r,inlineSnippets:k};e.error&&(L.error=e.error),console.group("📦 Full Enriched Payload");try{console.log(JSON.stringify(L,null,2))}catch(e){console.log(L)}return console.groupEnd(),console.log("✅ ttpDiscoverFull() complete"),console.groupEnd(),L}catch(e){try{console.error("[TTP Discovery] ttpDiscoverFull failed:",e),console.groupEnd()}catch(e){}return{pageUrl:function(){try{return window.location.href}catch(e){return""}}(),hostname:function(){try{return window.location.hostname}catch(e){return""}}(),discoveredAt:(new Date).toISOString(),inlineScripts:[],scriptUrls:[],fileResults:[],inlineSnippets:[],error:String(e&&e.message?e.message:e)}}},function(){try{console.log("💡 TTP GO Discovery ready — run ttpDiscover() or ttpDiscoverFull() in console to start")}catch(e){}}()}();
@@ -0,0 +1 @@
1
+ !function(e){const t="ttp-demo-sdk-mode",n="/agent-widget.js",o="/agent-widget.dev.js",d="wss://speech.talktopc.com/ws/conv",r="wss://speech.bidme.co.il/ws/conv";let c=null,s=null;function a(){return"dev"===e.localStorage.getItem(t)?"dev":"prod"}function i(e){return"dev"===e?o:n}function l(e){return"dev"===e?"Development":"Production"}function p(e){return"dev"===e?r:d}function u(){const t=e=>{try{e?.destroy?.()}catch(e){console.warn("[TTPDemoSdk] destroy failed",e)}};t(e.widgetInstance),t(e.chatWidget),t(e.testWidget),void 0!==e.actualWidgetInstance&&(t(e.actualWidgetInstance),e.actualWidgetInstance=null),e.widgetInstance=null,e.chatWidget=null,e.testWidget=null}function g(){document.querySelectorAll('script[src*="agent-widget"]').forEach(e=>e.remove()),delete e.TTPAgentSDK,delete e.TTPChatWidget}function m(n){return n="dev"===n||"prod"===n?n:a(),e.localStorage.setItem(t,n),v(n),c=e.location.hostname.includes("ngrok")?function(t){return fetch(i(t),{headers:{"ngrok-skip-browser-warning":"1"}}).then(e=>{if(!e.ok)throw new Error("SDK fetch HTTP "+e.status);return e.text()}).then(n=>{g();const o=document.createElement("script");o.type="text/javascript",o.textContent=n,document.head.appendChild(o),s=t;const d={mode:t,src:i(t),label:l(t),ngrok:!0};return e.dispatchEvent(new CustomEvent("ttp-demo-sdk-ready",{detail:d})),e.TTPAgentSDK})}(n):function(t){return new Promise((n,o)=>{g();const d=document.createElement("script");d.src=i(t)+"?t="+Date.now(),d.onload=()=>{s=t;const o={mode:t,src:d.src,label:l(t)};e.dispatchEvent(new CustomEvent("ttp-demo-sdk-ready",{detail:o})),n(e.TTPAgentSDK)},d.onerror=()=>o(new Error("Failed to load SDK: "+d.src)),document.head.appendChild(d)})}(n),c.catch(e=>{throw console.error("[TTPDemoSdk]",e),e})}function f(e){return"dev"!==e&&"prod"!==e?m(a()):(u(),m(e))}function v(e){const t=document.getElementById("ttp-demo-sdk-toggle");if(!t)return;const n=t.querySelector('[data-mode="prod"]'),o=t.querySelector('[data-mode="dev"]'),d=t.querySelector(".ttp-demo-sdk-file");n&&(n.classList.toggle("active","prod"===e),n.classList.toggle("active-dev",!1)),o&&(o.classList.toggle("active","dev"===e),o.classList.toggle("active-dev","dev"===e)),d&&(d.title=p(e),d.textContent="dev"===e?"dev.js · speech.bidme":"prod.js · talktopc")}function b(){return function(){if(document.getElementById("ttp-demo-sdk-toggle"))return;!function(){if(document.getElementById("ttp-demo-sdk-toggle-styles"))return;const e=document.createElement("style");e.id="ttp-demo-sdk-toggle-styles",e.textContent="\n #ttp-demo-sdk-toggle {\n position: fixed;\n top: 12px;\n right: 12px;\n z-index: 2147483646;\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 12px;\n background: #111827;\n color: #f9fafb;\n font: 13px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n border-radius: 10px;\n box-shadow: 0 4px 14px rgba(0,0,0,.25);\n }\n #ttp-demo-sdk-toggle .ttp-demo-sdk-label { opacity: .85; margin-right: 4px; }\n #ttp-demo-sdk-toggle button {\n border: none;\n cursor: pointer;\n padding: 6px 12px;\n border-radius: 6px;\n font-size: 12px;\n font-weight: 600;\n background: #374151;\n color: #e5e7eb;\n }\n #ttp-demo-sdk-toggle button:hover { background: #4b5563; }\n #ttp-demo-sdk-toggle button.active {\n background: #4f46e5;\n color: #fff;\n }\n #ttp-demo-sdk-toggle button.active-dev {\n background: #d97706;\n color: #fff;\n }\n #ttp-demo-sdk-toggle .ttp-demo-sdk-file {\n font-size: 11px;\n opacity: .7;\n max-width: 140px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n ",document.head.appendChild(e)}();const e=document.createElement("div");e.id="ttp-demo-sdk-toggle",e.setAttribute("role","group"),e.setAttribute("aria-label","SDK bundle"),e.innerHTML='<span class="ttp-demo-sdk-label">SDK</span><button type="button" data-mode="prod" title="Production minified bundle">Production</button><button type="button" data-mode="dev" title="Development bundle with source maps">Development</button><span class="ttp-demo-sdk-file"></span>',e.querySelector('[data-mode="prod"]').addEventListener("click",()=>{"prod"!==a()&&f("prod")}),e.querySelector('[data-mode="dev"]').addEventListener("click",()=>{"dev"!==a()&&f("dev")}),document.body.appendChild(e),v(a())}(),m(a())}e.TTPDemoSdkLoader={STORAGE_KEY:t,PROD_SRC:n,DEV_SRC:o,PROD_WS_URL:d,DEV_WS_URL:r,getMode:a,getSrc:i,getLabel:l,getWebSocketUrl:p,applyWebSocketUrl:function(e,t){const n=e&&"object"==typeof e?e:{},o="dev"===t||"prod"===t?t:a();return n.websocketUrl=p(o),n},loadSdk:m,setMode:f,waitForReady:function(){return e.TTPAgentSDK?.TTPChatWidget&&c?Promise.resolve(e.TTPAgentSDK):c||m(a())},destroyWidgetInstances:u},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",b):b()}(window);
@@ -721,9 +721,9 @@
721
721
 
722
722
  <option value="22050">22.05 kHz</option>
723
723
 
724
- <option value="24000">24 kHz</option>
724
+ <option value="24000" selected>24 kHz</option>
725
725
 
726
- <option value="44100" selected>44.1 kHz (CD Quality)</option>
726
+ <option value="44100">44.1 kHz (CD Quality)</option>
727
727
 
728
728
  <option value="48000">48 kHz (Pro)</option>
729
729
 
@@ -0,0 +1 @@
1
+ !function(){"use strict";var e=["google.com","googleapis.com","gstatic.com","googletagmanager.com","google-analytics.com","googlesyndication.com","doubleclick.net","facebook.net","facebook.com","fbcdn.net","connect.facebook","cdn.jsdelivr.net","jsdelivr.net","unpkg.com","cdnjs.cloudflare.com","hotjar.com","segment.com","segment.io","mixpanel.com","clarity.ms","licdn.com","bat.bing.com","pinterest.com","tiktok.com","tiktokcdn.com","criteo.com","taboola.com","outbrain.com","cloudflareinsights.com","browser.sentry-cdn.com","sentry.io","amazon-adsystem.com","adsafeprotected.com","scorecardresearch.com","snapchat.com","twitter.com","twimg.com","x.com"];function o(e){if(!e||"string"!=typeof e)return!1;var o=e.trim();return!!o&&(-1!==o.indexOf("fetch")||-1!==o.indexOf("axios")||-1!==o.indexOf("ajax")||-1!==o.indexOf("api")||-1!==o.indexOf("search")||-1!==o.indexOf("query")||-1!==o.indexOf("חיפוש"))}function n(o,n){try{var r=new URL(o,window.location.href);if(function(o){if(!o)return!0;for(var n=String(o).toLowerCase(),r=0;r<e.length;r++)if(n===e[r]||n.endsWith("."+e[r]))return!0;return!1}(r.hostname))return!1;var t=window.location.hostname;if(!t)return!1;if(r.hostname===t)return!0;if(r.hostname.endsWith("."+t))return!0;if(-1!==o.indexOf(t))return!0;var c=n||"";return"/"===c.charAt(0)||0===c.indexOf("./")}catch(e){return!1}}function r(e){if(null==e)return"";var o=String(e);return o.length<=500?o:o.slice(0,500)+"…"}window.ttpDiscover=function(){var e="",t="",c=(new Date).toISOString(),i=[],s=[];try{e=window.location.href,t=window.location.hostname;var l=[];try{l=document.querySelectorAll("script:not([src])")}catch(e){l=[]}for(var a=0;a<l.length;a++)try{var u=(l[a].textContent||"").trim();if(!o(u))continue;i.push(u)}catch(e){}var p=[];try{p=document.querySelectorAll("script[src]")}catch(e){p=[]}for(var g={},d=0;d<p.length;d++)try{var h=p[d],m=h.getAttribute("src")||"",f=h.src||"";if(!n(f,m))continue;if(g[f])continue;g[f]=!0,s.push(f)}catch(e){}}catch(o){return console.error("[TTP Discovery] Unexpected error while scanning:",o),{pageUrl:e||function(){try{return window.location.href}catch(e){return""}}(),hostname:t||function(){try{return window.location.hostname}catch(e){return""}}(),discoveredAt:c,inlineScripts:[],scriptUrls:[],error:String(o&&o.message?o.message:o)}}var v={pageUrl:e,hostname:t,discoveredAt:c,inlineScripts:i,scriptUrls:s};try{console.group("🔍 TTP GO Site Discovery"),console.log("Starting discovery on: "+e),console.group("📄 Inline Scripts"),console.log("Found "+i.length+" relevant inline scripts");for(var y=0;y<i.length;y++)console.log("--- Inline Script #"+(y+1)+" ---"),console.log(r(i[y]));console.groupEnd(),console.group("🔗 Script URLs"),console.log("Found "+s.length+" same-domain script files");for(var w=0;w<s.length;w++)console.log(" - "+s[w]);console.groupEnd(),console.group("📦 Full Payload (ready to send to backend)");try{console.log(JSON.stringify(v,null,2))}catch(e){console.log(v)}console.groupEnd(),console.log("✅ Discovery complete. Call ttpDiscover() again anytime."),console.groupEnd()}catch(e){try{console.log(v)}catch(e){}}return v},window.ttpDiscoverFull=async function(){try{console.group("🚀 TTP GO Discovery Full");var e=await Promise.resolve(window.ttpDiscover()),o=["fetch(","axios.","$.ajax","XMLHttpRequest","/api/","/search","/products","?q=","?search=","?s=","search=","query=","חיפוש"],n=5e5,r=[];console.group("📂 Fetching JS files");for(var t=0;t<e.scriptUrls.length;t++){var c=e.scriptUrls[t];console.log("Fetching:",c);try{var i,s=new AbortController,l=setTimeout(function(){s.abort()},5e3);try{i=await fetch(c,{signal:s.signal})}finally{clearTimeout(l)}if(!i.ok){console.warn("⚠️ HTTP "+i.status+": "+c),r.push({url:c,skipped:!0,reason:"http_"+i.status,snippets:[]});continue}var a=i.headers.get("content-length");if(a&&parseInt(a,10)>n){console.warn("⚠️ Skipped (too large): "+c),r.push({url:c,skipped:!0,reason:"too_large",snippets:[]});continue}var u=await i.text();if(u.length>n){console.warn("⚠️ Skipped after read (too large): "+c),r.push({url:c,skipped:!0,reason:"too_large",snippets:[]});continue}for(var p=u.split("\n"),g=[],d=0;d<p.length;d++){for(var h=p[d],m=!1,f=0;f<o.length;f++)if(-1!==h.indexOf(o[f])){m=!0;break}if(m){for(var v=Math.max(0,d-2),y=Math.min(p.length-1,d+2),w=[],x=0;x<o.length;x++)-1!==h.indexOf(o[x])&&w.push(o[x]);g.push({lineNumber:d+1,matchedKeywords:w,context:p.slice(v,y+1).join("\n")})}}console.log(" → "+g.length+" matches found");for(var S=0;S<g.length;S++){var b=g[S];console.group(" Line "+b.lineNumber+" — ["+b.matchedKeywords.join(", ")+"]"),console.log(b.context),console.groupEnd()}r.push({url:c,skipped:!1,snippets:g})}catch(e){e&&"AbortError"===e.name?(console.warn("⚠️ Timeout: "+c),r.push({url:c,skipped:!0,reason:"timeout",snippets:[]})):(console.warn("⚠️ Failed ("+(e&&e.message?e.message:e)+"): "+c),r.push({url:c,skipped:!0,reason:String(e&&e.message?e.message:e),snippets:[]}))}}console.groupEnd(),console.group("📄 Grepping inline scripts");for(var k=[],O=0;O<e.inlineScripts.length;O++)for(var D=e.inlineScripts[O].split("\n"),T=0;T<D.length;T++){for(var U=D[T],E=!1,F=0;F<o.length;F++)if(-1!==U.indexOf(o[F])){E=!0;break}if(E){for(var A=Math.max(0,T-2),j=Math.min(D.length-1,T+2),P=[],I=0;I<o.length;I++)-1!==U.indexOf(o[I])&&P.push(o[I]);k.push({scriptIndex:O,lineNumber:T+1,matchedKeywords:P,context:D.slice(A,j+1).join("\n")})}}console.log("Found "+k.length+" matches in inline scripts");for(var q=0;q<k.length;q++){var N=k[q];console.group("Inline #"+(N.scriptIndex+1)+" line "+N.lineNumber+" — ["+N.matchedKeywords.join(", ")+"]"),console.log(N.context),console.groupEnd()}console.groupEnd();var L={pageUrl:e.pageUrl,hostname:e.hostname,discoveredAt:e.discoveredAt,inlineScripts:e.inlineScripts,scriptUrls:e.scriptUrls,fileResults:r,inlineSnippets:k};e.error&&(L.error=e.error),console.group("📦 Full Enriched Payload");try{console.log(JSON.stringify(L,null,2))}catch(e){console.log(L)}return console.groupEnd(),console.log("✅ ttpDiscoverFull() complete"),console.groupEnd(),L}catch(e){try{console.error("[TTP Discovery] ttpDiscoverFull failed:",e),console.groupEnd()}catch(e){}return{pageUrl:function(){try{return window.location.href}catch(e){return""}}(),hostname:function(){try{return window.location.hostname}catch(e){return""}}(),discoveredAt:(new Date).toISOString(),inlineScripts:[],scriptUrls:[],fileResults:[],inlineSnippets:[],error:String(e&&e.message?e.message:e)}}},function(){try{console.log("💡 TTP GO Discovery ready — run ttpDiscover() or ttpDiscoverFull() in console to start")}catch(e){}}()}();
@@ -0,0 +1 @@
1
+ !function(){"use strict";if(window.__ttpCartProbeInstalled)return console.warn("[TTP-CART-PROBE] already installed — run __ttpCartProbeReport() or __ttpCartProbeUninstall()"),window.__ttpCartProbeHits;const t=[];function e(t){return"string"==typeof t&&/\/api\/cart\//i.test(t)}function o(e,o,n){const r={at:(new Date).toISOString(),kind:e,url:String(o),extra:n||null};t.push(r),console.log("[TTP-CART-PROBE]",e,r.url,n||"")}window.__ttpCartProbeHits=t;const n=window.fetch;window.__ttpCartProbeNativeFetch=n,window.fetch=function(t,r){const s="string"==typeof t?t:t&&t.url||"",i=n.apply(this,arguments);return e(s)&&(o("fetch-start",s,{method:r&&r.method||"GET"}),i.then(function(t){o("fetch-end",s,{status:t.status,ok:t.ok})}).catch(function(t){o("fetch-error",s,{message:String(t&&t.message||t)})})),i};const r=XMLHttpRequest.prototype.open,s=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(t,e){return this.__ttpProbeMethod=t,this.__ttpProbeUrl="string"==typeof e?e:String(e||""),r.apply(this,arguments)},XMLHttpRequest.prototype.send=function(t){const n=this.__ttpProbeUrl||"",r=this.__ttpProbeMethod||"GET";if(e(n)){const t=this;o("xhr-start",n,{method:r}),t.addEventListener("loadend",function(){o("xhr-end",n,{method:r,status:t.status})})}return s.apply(this,arguments)},window.__ttpCartProbeReport=function(){const e={hostname:location.hostname,fetchPatched:window.fetch!==n,hitCount:t.length,hits:t.slice(),hint:0===t.length?"No /api/cart/ via fetch or XHR. Open Network tab, add to cart, note the real request URL.":"Hooks see cart traffic — cart.subscribe should be able to listen here."};return console.table(t),console.log("[TTP-CART-PROBE] report",e),e},window.__ttpCartProbeUninstall=function(){window.__ttpCartProbeNativeFetch&&(window.fetch=window.__ttpCartProbeNativeFetch),XMLHttpRequest.prototype.open=r,XMLHttpRequest.prototype.send=s,delete window.__ttpCartProbeInstalled,delete window.__ttpCartProbeHits,delete window.__ttpCartProbeReport,delete window.__ttpCartProbeUninstall,delete window.__ttpCartProbeNativeFetch,console.log("[TTP-CART-PROBE] uninstalled")},window.__ttpCartProbeInstalled=!0,console.log("[TTP-CART-PROBE] installed on",location.hostname,"— manually add to cart, then __ttpCartProbeReport()")}();
@@ -0,0 +1 @@
1
+ !function(){"use strict";if(window.__ttpSobeysDispatchProbeInstalled)return console.warn("[SOBEYS-PROBE] already installed"),window.__ttpSobeysDispatchProbeReport();const t=[];function e(){if(window.__reduxStore&&"function"==typeof window.__reduxStore.dispatch)return window.__reduxStore;function t(t,e){const o=[t];for(;o.length&&e-- >0;){const t=o.shift();if(!t)continue;const e=t.memoizedProps?.store||t.memoizedState?.store||t.pendingProps?.store||t.stateNode?.store;if(e&&"function"==typeof e.dispatch)return e;t.child&&o.push(t.child),t.sibling&&o.push(t.sibling),t.return&&o.push(t.return)}return null}function e(e){if(!e)return null;const o=Object.keys(e).filter(t=>t.startsWith("__reactFiber")||t.startsWith("__reactContainer")||t.startsWith("__reactInternalInstance"));for(const n of o){const o=t(e[n]?.current||e[n],800);if(o)return o}return null}const o=[document.getElementById("root"),document.getElementById("app"),document.getElementById("__next"),document.body,document.body?.firstElementChild].filter(Boolean);for(const t of o){const o=e(t);if(o)return o}for(const t of document.querySelectorAll("body *")){const o=e(t);if(o)return o}return null}function o(t){try{const e=t?.getState?.()||{},o=e.shoppingListSlice?.shoppingListProducts?.products;if(Array.isArray(o))return{source:"redux",products:o}}catch(t){}return n(t)}function n(t){try{const e=t?.getState?.()||{};if(e.manageListSlice)return{source:"redux",data:e.manageListSlice}}catch(t){}try{const t=sessionStorage.getItem("persist:root");if(!t)return{source:"none",data:null};const e=JSON.parse(t);return{source:"persist:root",data:e.manageListSlice?JSON.parse(e.manageListSlice):null,persistKeys:Object.keys(e)}}catch(t){return{source:"error",error:String(t.message||t)}}}function r(t,e){if(!t||!e)return 0;const o=t.products||t.items||t.listItems||t.data;if(Array.isArray(o)){const t=o.find(t=>t&&(t.item_id===e||t.objectID===e||t.objectId===e||t.id===e||t.productId===e));return Number(t?.quantity??t?.qty??t?.count??0)||0}if(o&&"object"==typeof o){const t=o[e];return Number(t?.quantity??t?.qty??t??0)||0}return 0}window.__ttpSobeysDispatchProbeHits=t;const i=e();if(window.__ttpSobeysReduxStore=i,i){const e=i.dispatch.bind(i);i.dispatch=function(o){try{const e=String(("string"==typeof o?o:o?.type)||"");if(/list|cart|add|item|manage|persist|favour|favorite|product|algolia/i.test(e)){const n={at:(new Date).toISOString(),type:e,payload:o?.payload,meta:o?.meta};t.push(n),console.log("[SOBEYS-PROBE] dispatch",n)}}catch(t){console.warn("[SOBEYS-PROBE] log error",t)}return e.apply(i,arguments)}}else console.warn("[SOBEYS-PROBE] Redux store not found yet — will retry on report/click");window.__ttpSobeysDispatchProbeReport=function(){const r=window.__ttpSobeysReduxStore||e();window.__ttpSobeysReduxStore=r;const i=o(r),s=Array.from(document.querySelectorAll('[id^="ObjectID-"]')).slice(0,8).map(t=>({tileId:t.id,addBtn:!!t.querySelector('#add_to_cart_product button, button[aria-label*="Add to list" i]')})),c={hostname:location.hostname,storeFound:!!r,stateKeys:r?Object.keys(r.getState()||{}):[],shoppingList:i,manageList:n(r),hitCount:t.length,hits:t.slice(),objectTiles:s,hint:0===t.length?"Click Add to list on a product tile, then run report again.":"Use hits[].type + hits[].payload to implement cart.add dispatch."};return console.table(t),console.log("[SOBEYS-PROBE] report",c),c},window.__ttpSobeysDispatchAdd=function(t,n){const i=window.__ttpSobeysReduxStore||e();if(!i)return{ok:!1,reason:"redux_store_not_found"};const s=Number(n);if(!Number.isFinite(s)||s<0)return{ok:!1,reason:"invalid_qty",quantity:n};const c=r(o(i),t);i.dispatch({type:"shoppingListSlice/setItemListData",payload:{items:[{item_id:String(t),product_type:"Product",quantity:s}]}});const a=r(o(i),t);return{ok:a===s||0===s&&0===a,objectId:t,previousQty:c,newQty:a,action:0===s?"remove":0===c?"add":"update"}},window.__ttpSobeysTryAddByObjectId=function(t,e){e=null==e?1:e;const n=document.getElementById("ObjectID-"+t+" OfferType-"+e);if(!n)return console.warn("[SOBEYS-PROBE] tile not found for",t,e),{ok:!1,reason:"tile_not_found"};const i=n.querySelector("#add_to_cart_product button")||n.querySelector('button[aria-label*="Add to list" i]')||Array.from(n.querySelectorAll("button")).find(t=>/add to list/i.test(t.textContent||t.getAttribute("aria-label")||""));if(!i)return{ok:!1,reason:"add_button_not_found",tileId:n.id};const s=r(o(window.__ttpSobeysReduxStore).data,t);return i.click(),{ok:!0,clicked:!0,tileId:n.id,prevQty:s,note:"Wait ~1s then __ttpSobeysDispatchProbeReport()"}},window.__ttpSobeysDispatchProbeUninstall=function(){console.log("[SOBEYS-PROBE] uninstall not fully implemented — refresh page to reset dispatch wrapper")},window.__ttpSobeysDispatchProbeInstalled=!0,console.log("[SOBEYS-PROBE] installed — click Add to list or __ttpSobeysTryAddByObjectId(objectId, offerType)"),window.__ttpSobeysDispatchProbeReport()}();