ttp-agent-sdk 2.43.0 → 2.44.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/dist/agent-widget.dev.js +3907 -1701
- package/dist/agent-widget.dev.js.map +1 -1
- package/dist/agent-widget.esm.js +1 -1
- package/dist/agent-widget.esm.js.map +1 -1
- package/dist/agent-widget.js +1 -1
- package/dist/agent-widget.js.map +1 -1
- package/dist/audio-processor.js +2 -2
- package/dist/demos/discovery.js +1 -0
- package/dist/demos/index.html +0 -13
- package/dist/demos/test-ecommerce.html +5 -3
- package/dist/demos/test-tour.html +4 -2
- package/dist/discovery.js +1 -0
- package/dist/examples/demo-v2.html +2 -2
- package/dist/examples/discovery.js +1 -0
- package/dist/examples/test-ecommerce.html +5 -3
- package/dist/examples/test-index.html +0 -13
- package/dist/examples/test-restaurant.html +4 -2
- package/dist/examples/test-tour.html +4 -2
- package/dist/hooks/noyhasade.js +1 -0
- package/examples/demo-v2.html +2 -2
- package/examples/test-ecommerce.html +5 -3
- package/examples/test-index.html +0 -13
- package/examples/test-restaurant.html +4 -2
- package/examples/test-tour.html +4 -2
- package/package.json +1 -2
package/dist/audio-processor.js
CHANGED
|
@@ -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
|
|
16
|
-
this.sampleRate = typeof sampleRate !== 'undefined' ? sampleRate : (this.config.sampleRate || this.config.outputSampleRate ||
|
|
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(){"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){}}()}();
|
package/dist/demos/index.html
CHANGED
|
@@ -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>
|
|
@@ -166,11 +166,11 @@
|
|
|
166
166
|
</label>
|
|
167
167
|
<label>STT Provider
|
|
168
168
|
<select id="sttSelect">
|
|
169
|
+
<option value="soniox" selected>Soniox (default — no override)</option>
|
|
169
170
|
<option value="">Default (server)</option>
|
|
170
|
-
<option value="azure-stt"
|
|
171
|
+
<option value="azure-stt">Azure STT</option>
|
|
171
172
|
<option value="cartesia-stt">Cartesia (Ink-Whisper)</option>
|
|
172
173
|
<option value="openai-realtime">OpenAI Realtime</option>
|
|
173
|
-
<option value="soniox">Soniox</option>
|
|
174
174
|
</select>
|
|
175
175
|
</label>
|
|
176
176
|
<label>Start Open
|
|
@@ -304,7 +304,8 @@ window.testWidget._flavor.messageHandlers['show_media']({
|
|
|
304
304
|
agentSettingsOverride: (() => {
|
|
305
305
|
const override = {};
|
|
306
306
|
const stt = document.getElementById('sttSelect').value;
|
|
307
|
-
|
|
307
|
+
// Soniox is server default; only override when picking a non-default provider
|
|
308
|
+
if (stt && stt !== 'soniox') override.sttProvider = stt;
|
|
308
309
|
return override;
|
|
309
310
|
})(),
|
|
310
311
|
behavior: {
|
|
@@ -434,5 +435,6 @@ window.testWidget._flavor.messageHandlers['show_media']({
|
|
|
434
435
|
updateStatus('SDK load failed: ' + e.message, 'error');
|
|
435
436
|
});
|
|
436
437
|
</script>
|
|
438
|
+
<script src="discovery.js"></script>
|
|
437
439
|
</body>
|
|
438
440
|
</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"
|
|
154
|
+
<option value="azure-stt">Azure STT</option>
|
|
154
155
|
</select>
|
|
155
156
|
</label>
|
|
156
157
|
</div>
|
|
@@ -251,7 +252,8 @@ window.testWidget._flavor.messageHandlers['show_items']({
|
|
|
251
252
|
agentSettingsOverride: (() => {
|
|
252
253
|
const override = {};
|
|
253
254
|
const stt = document.getElementById('sttSelect').value;
|
|
254
|
-
|
|
255
|
+
// Soniox is server default; only override when picking a non-default provider
|
|
256
|
+
if (stt && stt !== 'soniox') override.sttProvider = stt;
|
|
255
257
|
return override;
|
|
256
258
|
})(),
|
|
257
259
|
behavior: {
|
|
@@ -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){}}()}();
|
|
@@ -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"
|
|
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){}}()}();
|
|
@@ -166,11 +166,11 @@
|
|
|
166
166
|
</label>
|
|
167
167
|
<label>STT Provider
|
|
168
168
|
<select id="sttSelect">
|
|
169
|
+
<option value="soniox" selected>Soniox (default — no override)</option>
|
|
169
170
|
<option value="">Default (server)</option>
|
|
170
|
-
<option value="azure-stt"
|
|
171
|
+
<option value="azure-stt">Azure STT</option>
|
|
171
172
|
<option value="cartesia-stt">Cartesia (Ink-Whisper)</option>
|
|
172
173
|
<option value="openai-realtime">OpenAI Realtime</option>
|
|
173
|
-
<option value="soniox">Soniox</option>
|
|
174
174
|
</select>
|
|
175
175
|
</label>
|
|
176
176
|
<label>Start Open
|
|
@@ -304,7 +304,8 @@ window.testWidget._flavor.messageHandlers['show_media']({
|
|
|
304
304
|
agentSettingsOverride: (() => {
|
|
305
305
|
const override = {};
|
|
306
306
|
const stt = document.getElementById('sttSelect').value;
|
|
307
|
-
|
|
307
|
+
// Soniox is server default; only override when picking a non-default provider
|
|
308
|
+
if (stt && stt !== 'soniox') override.sttProvider = stt;
|
|
308
309
|
return override;
|
|
309
310
|
})(),
|
|
310
311
|
behavior: {
|
|
@@ -434,5 +435,6 @@ window.testWidget._flavor.messageHandlers['show_media']({
|
|
|
434
435
|
updateStatus('SDK load failed: ' + e.message, 'error');
|
|
435
436
|
});
|
|
436
437
|
</script>
|
|
438
|
+
<script src="discovery.js"></script>
|
|
437
439
|
</body>
|
|
438
440
|
</html>
|
|
@@ -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>
|
|
@@ -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"
|
|
154
|
+
<option value="azure-stt">Azure STT</option>
|
|
154
155
|
</select>
|
|
155
156
|
</label>
|
|
156
157
|
</div>
|
|
@@ -251,7 +252,8 @@ window.testWidget._flavor.messageHandlers['show_items']({
|
|
|
251
252
|
agentSettingsOverride: (() => {
|
|
252
253
|
const override = {};
|
|
253
254
|
const stt = document.getElementById('sttSelect').value;
|
|
254
|
-
|
|
255
|
+
// Soniox is server default; only override when picking a non-default provider
|
|
256
|
+
if (stt && stt !== 'soniox') override.sttProvider = stt;
|
|
255
257
|
return override;
|
|
256
258
|
})(),
|
|
257
259
|
behavior: {
|
|
@@ -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"
|
|
154
|
+
<option value="azure-stt">Azure STT</option>
|
|
154
155
|
</select>
|
|
155
156
|
</label>
|
|
156
157
|
</div>
|
|
@@ -251,7 +252,8 @@ window.testWidget._flavor.messageHandlers['show_items']({
|
|
|
251
252
|
agentSettingsOverride: (() => {
|
|
252
253
|
const override = {};
|
|
253
254
|
const stt = document.getElementById('sttSelect').value;
|
|
254
|
-
|
|
255
|
+
// Soniox is server default; only override when picking a non-default provider
|
|
256
|
+
if (stt && stt !== 'soniox') override.sttProvider = stt;
|
|
255
257
|
return override;
|
|
256
258
|
})(),
|
|
257
259
|
behavior: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function noyhasadeDataProductId(t){if(null==t||""===t)return"";const o=String(t);return o.startsWith("product#")?"search-product#"+o.slice(8):(o.startsWith("search-product#"),o)}function ensureCatGrid(){let t=document.querySelector(".cat-grid");if(t)return t;const o=document.querySelector("main")||document.querySelector(".site-content")||document.body;return t=document.createElement("div"),t.className="cat-grid",o.prepend(t),t}function findCardByDataId(t){if(null==t||""===t)return null;const o=String(t),e=[o];o.startsWith("api-")||e.push("api-"+o);for(const t of e)for(const o of document.querySelectorAll("[data-product-id]"))if(o.getAttribute("data-product-id")===t)return o;return null}function findCartLineMeta(t,o){if(void 0===window.NoyCart||"function"!=typeof window.NoyCart.getAll)return null;try{const e=window.NoyCart.getAll()||[],n=Array.isArray(e)?e:Object.values(e),r=t=>{const o=String(t||"").match(/#(\d+)/);return o?o[1]:""},a=r(o)||r(t)||r(noyhasadeDataProductId(t));if(!a)return null;for(const t of n)if(t&&String(t.id||"").includes("#"+a))return t}catch(t){console.warn("[NoyHasade] findCartLineMeta:",t)}return null}function truthyFlag(t){return!0===t||"true"===t||1===t||"1"===t}function escapeHtml(t){return String(null==t?"":t).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function cartSummaryForLog(t){return t&&t.length?t.map(t=>`${t.id||"?"}×${t.qty??"?"}`).join(" | "):"(empty)"}function openNoyCart(){if(void 0!==window.NoyCartUI&&"function"==typeof window.NoyCartUI.open)return window.NoyCartUI.open(),!0;const t=document.getElementById("headCart");return!!t&&(t.click(),!0)}function closeNoyCart(){if(void 0!==window.NoyCartUI&&"function"==typeof window.NoyCartUI.close)try{return window.NoyCartUI.close(),!0}catch(t){console.warn("[NoyHasade] NoyCartUI.close failed:",t)}const t=document.getElementById("headCart");if(t&&"true"===t.getAttribute("aria-expanded"))return t.click(),!0;try{document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",code:"Escape",bubbles:!0,cancelable:!0}))}catch(t){console.warn("[NoyHasade] closeNoyCart Escape fallback failed:",t)}return!1}function noyCategoryPathForSlug(t){const o=String(t||"").trim();if(!o)return"";const e=o.split("/").map(t=>t.trim()).filter(Boolean);return e.length?"/product-category/"+e.map(t=>encodeURIComponent(t)).join("/")+"/":""}function noyFindCategoryNavLink(t){const o=String(t||"").trim();if(!o)return null;const e=noyCategoryPathForSlug(o);let n=e;try{n=decodeURIComponent(e)}catch(t){}for(const t of document.querySelectorAll("[data-api-category-slug]")){if((t.getAttribute("data-api-category-slug")||"").trim()!==o)continue;const e=t.closest("a");if(e&&e.href)return e}for(const t of document.querySelectorAll('a[href*="product-category"]')){const r=t.getAttribute("href")||"";if(!r)continue;let a="";try{a=new URL(r,location.origin).pathname}catch(t){continue}try{const r=decodeURIComponent(a);if(a===new URL(e,location.origin).pathname||r===n||r.includes("/"+o+"/")||r.endsWith("/"+o))return t}catch(e){if(a.includes(encodeURIComponent(o))||a.includes(o))return t}}return null}function noyOpenCategory(t){const o=String(t||"").trim();if(!o)return;try{sessionStorage.setItem(STORAGE_SCROLL_CATEGORY_KEY,o)}catch(t){}const e=noyCategoryPathForSlug(o);if(!e)return;let n=location.pathname;try{n=decodeURIComponent(location.pathname)}catch(t){}const r=new URL(e,location.origin);try{if(location.pathname===r.pathname||n===decodeURIComponent(r.pathname))return void[350,900,1800].forEach(t=>window.setTimeout(noyTryScrollToCategoryProducts,t))}catch(t){}const a=noyFindCategoryNavLink(o);if(a)try{return a.click(),console.log("[NoyHasade] open_category via native nav link",e),void[350,900,1800].forEach(t=>window.setTimeout(noyTryScrollToCategoryProducts,t))}catch(t){console.warn("[NoyHasade] nav link click failed:",t)}if("function"==typeof window.NoyNavigateToCategory)try{return window.NoyNavigateToCategory(o),console.log("[NoyHasade] open_category via NoyNavigateToCategory",o),void[350,900,1800].forEach(t=>window.setTimeout(noyTryScrollToCategoryProducts,t))}catch(t){console.warn("[NoyHasade] NoyNavigateToCategory failed:",t)}try{history.pushState(null,"",e),window.dispatchEvent(new PopStateEvent("popstate",{state:null})),console.log("[NoyHasade] open_category via pushState+popstate",e)}catch(t){return console.warn("[NoyHasade] pushState failed, assigning location:",t),void location.assign(e)}[350,900,1800].forEach(t=>window.setTimeout(noyTryScrollToCategoryProducts,t))}let _shoppingListAddQueue=Promise.resolve();const SHOPPING_LIST_REVEAL_MS=380,SHOPPING_LIST_FLY_PAD_MS=820,OPEN_CATEGORY_AFTER_CART_CLOSE_MS=260,STORAGE_SCROLL_CATEGORY_KEY="ttpNoyCatScrollSlug";function noyScrollDebugEnabled(){try{if("undefined"!=typeof window&&!0===window.__TTP_NOY_SCROLL_DEBUG__)return!0;if("undefined"!=typeof localStorage&&"1"===localStorage.getItem("ttpNoyScrollDebug"))return!0}catch(t){}return!1}function noyScrollLog(...t){noyScrollDebugEnabled()&&console.log("[NoyHasade scroll]",...t)}const CATEGORY_SCROLL_EXTRA_DRASTIC_PX=1e3,CATEGORY_SCROLL_SLOW_EXTRA_PX=2e3,CATEGORY_SCROLL_LOOP_PX_PER_SEC=2600,CATEGORY_SCROLL_LOOP_MIN_STEP_PX=28,CATEGORY_SCROLL_LOOP_MAX_STEP_PX=220,CATEGORY_SCROLL_LOOP_STUCK_FRAMES=5,CATEGORY_SCROLL_LOOP_MAX_MS=25e3,CATEGORY_SCROLL_TARGET_OFFSET_PX=3e3,CATEGORY_SCROLL_AFTER_SMOOTH_INTO_VIEW_MS=600,CATEGORY_SCROLL_POST_LOAD_MS=3e3,CATEGORY_SCROLL_POST_LOAD_MS_FAST=400,CATEGORY_SCROLL_LOAD_FALLBACK_MS=15e3;function noyRunAfterPageLoaded(t,o){const e="number"==typeof o?o:CATEGORY_SCROLL_POST_LOAD_MS;let n=!1;const r=()=>{n||(n=!0,window.setTimeout(t,e))};"complete"!==document.readyState?(window.addEventListener("load",r,{once:!0}),window.setTimeout(r,15e3)):r()}function noyFindInnerScrollContainer(){let t=null,o=0;const e=document.body;if(!e)return null;const n=e.querySelectorAll("*");for(let e=0;e<n.length;e++){const r=n[e],a=r.tagName;if("SCRIPT"===a||"STYLE"===a||"SVG"===a||"IFRAME"===a)continue;let c;try{c=getComputedStyle(r)}catch(t){continue}if(!/(auto|scroll|overlay)/.test(c.overflowY))continue;const i=r.scrollHeight-r.clientHeight;i>o&&i>48&&(o=i,t=r)}return t}function noyResolveScrollTarget(){const t=document.documentElement,o=Math.max(0,t.scrollHeight-window.innerHeight),e=noyFindInnerScrollContainer(),n=e?Math.max(0,e.scrollHeight-e.clientHeight):0;let r=!1;try{const o=document.body?getComputedStyle(document.body):{},e=getComputedStyle(t);r=/hidden|clip/.test(o.overflowY||"")||/hidden|clip/.test(e.overflowY||"")||/hidden|clip/.test(o.overflow||"")||/hidden|clip/.test(e.overflow||"")}catch(t){}return noyScrollLog("noyResolveScrollTarget",{winMax:o,innerMax:n,bodyLocksVertical:r,inner:e?e.tagName+"."+(e.className||""):null}),e&&n>64&&(r||n+8>=o)?{mode:"element",el:e}:{mode:"window",el:null}}function noyWithInstantScroll(t,o){const e=[],n=t=>{t&&1===t.nodeType&&e.push(t)};n(document.documentElement),n(document.body),n(t);const r=e.map(t=>t.style.scrollBehavior);e.forEach(t=>{try{t.style.scrollBehavior="auto"}catch(t){}});try{o()}finally{e.forEach((t,o)=>{try{t.style.scrollBehavior=r[o]||""}catch(t){}})}}function noyCategoryScrollLoopToOffset(t){if(t<1)return;let o=noyResolveScrollTarget();const e=performance.now();let n=e,r=0,a=t;const c=()=>{if("element"===o.mode&&o.el){const t=o.el,e=Math.max(0,t.scrollHeight-t.clientHeight);return{el:t,max:e,get:()=>t.scrollTop,kind:"element"}}return{el:null,max:Math.max(0,document.documentElement.scrollHeight-window.innerHeight),get:()=>window.scrollY??window.pageYOffset??0,kind:"window"}},i=c();noyScrollLog("noyCategoryScrollLoopToOffset",{mode:o.mode,totalOffsetPx:t,start:i.get(),scrollMax:i.max,pxPerSec:2600}),i.max-i.get()<2?noyScrollLog("scroll loop: no room at start"):requestAnimationFrame(function t(i){if(a<=2)return void noyScrollLog("scroll loop: done (budget spent)");if(i-e>25e3)return void noyScrollLog("scroll loop: timeout",{remaining:a});const l=c();if(l.get()>=l.max-2)return void noyScrollLog("scroll loop: hit scroll max",{remaining:a});const d=Math.min(.1,Math.max(0,(i-n)/1e3));n=i;let s=Math.ceil(2600*d);s=Math.max(28,Math.min(220,s));const u=function(t){const o=c(),e=o.get(),n=Math.max(0,o.max-e),r=Math.min(t,n,a);if(r<1)return 0;if("element"===o.kind&&o.el){const t=o.el;return noyWithInstantScroll(t,()=>{try{t.scrollBy({top:r,left:0,behavior:"auto"})}catch(o){t.scrollTop+=r}t.scrollTop<=e+.5&&(t.scrollTop=Math.min(e+r,o.max))}),Math.max(0,t.scrollTop-e)}return noyWithInstantScroll(null,()=>{try{window.scrollBy({top:r,left:0,behavior:"auto"})}catch(t){window.scrollTo(window.scrollX,e+r)}}),Math.max(0,(window.scrollY??window.pageYOffset??0)-e)}(s);if(a=Math.max(0,a-u),u<1){if(r+=1,r>=5){r=0;const t=noyResolveScrollTarget();t.mode===o.mode&&t.el===o.el||noyScrollLog("scroll loop: re-resolve target",{was:o.mode,now:t.mode}),o=t}}else r=0;requestAnimationFrame(t)})}function noyCategoryScrollSequence(t){if(t&&t.isConnected){noyScrollLog("noyCategoryScrollSequence: start",t.tagName,t.className);try{t.scrollIntoView({behavior:"instant",block:"start"})}catch(t){}window.setTimeout(()=>{noyCategoryScrollLoopToOffset(3e3)},600)}else noyScrollLog("noyCategoryScrollSequence: anchor not connected, skipping",t)}function noyStripHebrewNiqqud(t){return String(t||"").replace(/[\u0591-\u05C7]/g,"")}function noyCategoryScrollWindowOnly(){noyScrollLog("noyCategoryScrollWindowOnly: no product anchor, scrolling window or inner panel"),window.setTimeout(()=>{noyCategoryScrollLoopToOffset(3e3)},600)}function findFirstCategoryProductRow(){const t=document.querySelector(".cat-grid");if(t){const o=t.querySelector('.cat-card, article[class*="product"], li.product');if(o)return o}const o=document.querySelector("ul.products");if(o){const t=o.querySelector("li.product");if(t)return t}const e=document.querySelector(".woocommerce .products .product");if(e)return e;const n=["main",".site-content","#siteMain","#content",".page-content","article.page"];for(const t of n)for(const o of[`${t} [data-product-id]`,`${t} .product`,`${t} [class*="product-card"]`,`${t} .cat-card`])try{const t=document.querySelector(o);if(t)return t}catch(t){}for(const t of[".category-products [data-product-id]",".category-products .product","[data-category-products] [data-product-id]","section.products [data-product-id]"])try{const o=document.querySelector(t);if(o)return o}catch(t){}return document.querySelector("[data-product-id]")||null}const NOY_CATEGORY_SCROLL_EXTRA_PATH_TESTS={המזווה:t=>/category-pantry/i.test(t),מזווה:t=>/category-pantry/i.test(t),pantry:t=>/category-pantry/i.test(t)};function noyPathMatchesCategorySlug(t,o){const e=String(o||"").trim();if(!e)return!1;const n="/product-category/"+e+"/";if(t.includes(n))return!0;try{const o="/product-category/"+encodeURIComponent(e)+"/";if(t.includes(o))return!0}catch(t){}const r=NOY_CATEGORY_SCROLL_EXTRA_PATH_TESTS[e];if("function"==typeof r&&r(t))return!0;const a=noyStripHebrewNiqqud(e);for(const o of Object.keys(NOY_CATEGORY_SCROLL_EXTRA_PATH_TESTS))if(noyStripHebrewNiqqud(o)===a){const e=NOY_CATEGORY_SCROLL_EXTRA_PATH_TESTS[o];if("function"==typeof e&&e(t))return!0}return!!(/category-pantry/i.test(t)&&a.length>0)}function noyRunCategoryScrollWhenReady(){let t=0;const o=()=>{t+=1;const e=findFirstCategoryProductRow();if(!e||!e.isConnected)return t>=80?(noyScrollLog("give up: no product row after",t,"tries; window-only scroll"),void noyCategoryScrollWindowOnly()):void window.setTimeout(o,120);noyCategoryScrollSequence(e)};o()}function noyTryScrollToCategoryProducts(){let t=null;try{t=sessionStorage.getItem(STORAGE_SCROLL_CATEGORY_KEY)}catch(t){return}if(!t)return void(/category-pantry/i.test(location.pathname)&&noyScrollDebugEnabled()&&console.warn("[NoyHasade scroll] sessionStorage missing",STORAGE_SCROLL_CATEGORY_KEY,"— open_category must run before navigating here, or scroll will not run."));let o="";try{o=decodeURIComponent(location.pathname)}catch(t){o=location.pathname}if(!noyPathMatchesCategorySlug(o,t))return void noyScrollLog("path/slug mismatch — skip scroll",{path:o,wanted:t,pathname:location.pathname});const e=/category-pantry/i.test(o)||/category-pantry/i.test(location.pathname)?CATEGORY_SCROLL_POST_LOAD_MS_FAST:CATEGORY_SCROLL_POST_LOAD_MS;let n=0;const r=()=>{if(n+=1,findFirstCategoryProductRow()){try{sessionStorage.removeItem(STORAGE_SCROLL_CATEGORY_KEY)}catch(t){}return noyScrollLog("product row found, scheduling post-load scroll"),void noyRunAfterPageLoaded(()=>{noyRunCategoryScrollWhenReady()},e)}if(n>=120){try{sessionStorage.removeItem(STORAGE_SCROLL_CATEGORY_KEY)}catch(t){}return noyScrollLog("no product node in time — post-load window-only scroll"),void noyRunAfterPageLoaded(()=>{noyRunCategoryScrollWhenReady()},e)}setTimeout(r,100)};r()}function noyDefaultFlyPadMs(){return void 0!==window.NoyCart&&"number"==typeof window.NoyCart.flyAnimationMs?window.NoyCart.flyAnimationMs:820}window.__TTP_HOOKS__={addToCart(t){const o=async()=>{const{productId:o,quantity:e,productName:n,price:r,currency:a,imageUrl:c,sellBy:i,openCart:l}=t||{},d="[NoyHasade addToCart]";let s=!1;const u=truthyFlag(t?.showOnPage),y=truthyFlag(t?.last),g=u?y:!1!==l;if(void 0===window.NoyCart||"function"!=typeof window.NoyCart.setQtyFromCard){console.error(`${d} NoyCart missing or setQtyFromCard unavailable`);const t=Number(e),r=Number.isFinite(t)&&t<=0,a=!r||0!==t&&-1!==t?r?Math.abs(t):0:1;return{productName:n||o,quantity:r?-a:Number.isFinite(t)&&t>0?t:1}}const p=noyhasadeDataProductId(o);let f=null;if(u){const t=ensureCatGrid(),e=p||String(o||""),l=null!=r&&""!==r?String(r):"",d=c?[c]:[],s="weight"===i?'/ לק"ג':"/ יחידה";"function"==typeof window.NoyAppendProductCard?f=window.NoyAppendProductCard(t,{id:e,name:n||"",images:d,price:l,showPriceBy:s,isIsraeli:!0}):(window.__TTP_HOOKS__._showProductOnPage({productId:o,productName:n,price:r,currency:a,imageUrl:c,dataId:p,sellBy:i}),"function"==typeof window.NoyEnhanceCategoryCards&&window.NoyEnhanceCategoryCards(t)),f||(f=findCardByDataId(e)||findCardByDataId(p))}f||(f=findCardByDataId(p));const m=!!f;if(!f){const t=findCartLineMeta(o,p),e=c||t?.imageSrc||t?.image||"",l=n||t?.name||"",u=null!=r&&""!==r?r:t?.unitPrice,y=null!=u&&""!==u?`${u} ${a||"₪"}`:"",g="weight"===i?'לק"ג':"quantity"===i?"ליח'":t?.meta&&/לק|ק"ג/.test(String(t.meta))?'לק"ג':"ליח'";f=document.createElement("div"),f.setAttribute("data-product-id",t&&t.id?t.id:p||o);const m=escapeHtml(l);f.innerHTML=`\n <span class="cat-card__title">${m}</span>\n <span class="cat-card__price">${escapeHtml(y)}</span>\n <span class="cat-card__unit">${escapeHtml(g)}</span>\n <div class="cat-card__img"><img src="${escapeHtml(e)}" alt="${m}"></div>\n `,console.log(`${d} fake card pidAttr=${f.getAttribute("data-product-id")} enriched=${!!t}`);const w=ensureCatGrid();f.classList.add("cat-card"),w.appendChild(f),s=!0}let w=[];if("function"==typeof window.NoyCart.getAll)try{const t=window.NoyCart.getAll()||[];w=Array.isArray(t)?t:Object.values(t)}catch(t){console.error(`${d} getAll before op failed:`,t)}const C=Number(e),S=Number.isFinite(C)&&C<=0;console.log(`${d} start`,{productId:o,quantity:C,mode:S?"subtract":"add",dataId:p,card:m?"dom":"fake",cartLines:w.length,cart:cartSummaryForLog(w)});const _="function"==typeof window.NoyCart.getQtyStepForCard?window.NoyCart.getQtyStepForCard(f):1,h=!S||0!==C&&-1!==C?S?Math.abs(C):0:1,T="function"==typeof window.NoyCart.getProductId?window.NoyCart.getProductId(f):"",O=T&&"function"==typeof window.NoyCart.getQty?window.NoyCart.getQty(T):0;let L;if(S&&0===O&&console.warn(`${d} SUBTRACT no-op: cart has qty 0 for resolved pid="${T}" (productId=${o}). Wrong SKU vs cart, or line not in cart — backend should match get_site_cart.`),S){const t=Math.max(0,O-h);L="function"==typeof window.NoyCart.normalizeQty?window.NoyCart.normalizeQty(t,_):t}else{const t=Number.isFinite(C)&&C>0?C:1;if(u){const o=O+t;L="function"==typeof window.NoyCart.normalizeQty?window.NoyCart.normalizeQty(o,_):o}else L="function"==typeof window.NoyCart.normalizeQty?window.NoyCart.normalizeQty(t,_):t}if(!S&&f&&f.isConnected&&"function"==typeof f.scrollIntoView&&(u||s)){try{f.scrollIntoView({behavior:"smooth",block:"nearest"})}catch(t){}await new Promise(t=>setTimeout(t,380))}console.log(`${d} setQty`,{pid:T,prevQty:O,targetQty:L,step:_,subtractUnits:S?h:void 0});try{S?window.NoyCart.setQtyFromCard(f,L,{fly:!1}):window.NoyCart.setQtyFromCard(f,L,{fly:!0})}catch(t){console.error(`${d} setQtyFromCard failed:`,t)}if(S||await new Promise(t=>setTimeout(t,noyDefaultFlyPadMs())),s){try{f.remove()}catch(t){}s=!1}const N=T&&"function"==typeof window.NoyCart.getQty?window.NoyCart.getQty(T):void 0;S&&O>0&&N===O&&L!==O&&console.warn(`${d} SUBTRACT: qty unchanged after setQty (still ${O}); target was ${L}`);let A=[];if("function"==typeof window.NoyCart.getAll)try{const t=window.NoyCart.getAll()||[];A=Array.isArray(t)?t:Object.values(t)}catch(t){console.error(`${d} getAll after op failed:`,t)}const R=t=>{const o={};return t.forEach(t=>{t&&t.id&&(o[t.id]=t.qty)}),o},E=R(w),v=R(A),P=Object.keys({...E,...v}).some(t=>E[t]!==v[t]);S&&O>0&&!P&&console.warn(`${d} subtract did not change any cart line`,{pid:T,prevQty:O,targetQty:L,cart:cartSummaryForLog(A)}),console.log(`${d} done`,{cart:cartSummaryForLog(A),cartChanged:P,pid:T,qtyAfter:N}),g&&(openNoyCart()||console.warn(`${d} could not open cart drawer`));const b=A.length,I=A.reduce((t,o)=>t+(o.unitPrice??o.price??0)*(o.qty||0),0);return{productName:n||o,quantity:S?-h:Number.isFinite(C)&&C>0?C:1,cartItemCount:b,cartTotal:I,currency:a||"ILS"}};if(truthyFlag(t?.showOnPage)){const t=_shoppingListAddQueue.then(o,o);return _shoppingListAddQueue=t.catch(()=>{}),t}return o()},getCart(){if(void 0!==window.NoyCart&&"function"==typeof window.NoyCart.getAll){const t=window.NoyCart.getAll(),o=Array.isArray(t)?t:Object.values(t||{}),e=o.reduce((t,o)=>t+(o.unitPrice??o.price??0)*(o.qty||o.quantity||0),0);return console.log("[NoyHasade getCart]",{lines:o.length,cart:cartSummaryForLog(o),total_price:e}),{items:o.map(t=>({title:t.name||t.title,quantity:t.qty||t.quantity,price:t.unitPrice??t.price})),item_count:o.length,total_price:e}}return console.warn("[NoyHasade getCart] NoyCart.getAll not available"),{items:[],item_count:0,total_price:0}},async simulateSearch({query:t}){closeNoyCart(),void 0!==window.NoyDevSearch&&"function"==typeof window.NoyDevSearch.run?await window.NoyDevSearch.run(t):console.warn("[NoyHasade Hooks] NoyDevSearch.run not available")},clear_products(){const t=ensureCatGrid();t.innerHTML="",t.scrollIntoView({behavior:"smooth",block:"start"}),console.log("[NoyHasade Hooks] Cleared product grid (.cat-grid)")},open_category(t){closeNoyCart();const o=t?.slug??t?.category_slug;window.setTimeout(()=>{noyOpenCategory(o),console.log("[NoyHasade Hooks] open_category",o||"(empty)")},260)},_showProductOnPage({productId:t,productName:o,price:e,currency:n,imageUrl:r,dataId:a,sellBy:c}){const i=ensureCatGrid(),l=a||noyhasadeDataProductId(t),d=e?`${e} ₪`:"",s="weight"===c?'/ לק"ג':"/ יחידה",u=escapeHtml(o||""),y='<article class="cat-card" data-product-id="'+l+'"><div class="cat-card__media"><div class="cat-card__img"><img src="'+escapeHtml(r||"")+'" alt="'+u+'" loading="lazy" width="600" height="600"/></div></div><div class="cat-card__body"><h3 class="cat-card__title">'+u+'</h3><div class="cat-card__price-row"><span class="cat-card__price">'+d+'</span><span class="cat-card__unit">'+s+'</span></div><div class="cat-card__actions"><button type="button" class="cat-card__plus" aria-label="הוסף לעגלה">+</button></div></div></article>';i.insertAdjacentHTML("beforeend",y),"function"==typeof window.NoyEnhanceCategoryCards&&window.NoyEnhanceCategoryCards(i),console.log(`[NoyHasade Hooks] Added product card to page: ${o} (${l})`)}},window.__TTP_NOY_CATEGORY_SCROLL_INIT__||(window.__TTP_NOY_CATEGORY_SCROLL_INIT__=!0,window.addEventListener("pageshow",()=>noyTryScrollToCategoryProducts()),window.addEventListener("popstate",()=>window.setTimeout(noyTryScrollToCategoryProducts,50))),noyTryScrollToCategoryProducts();
|
package/examples/demo-v2.html
CHANGED
|
@@ -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"
|
|
726
|
+
<option value="44100">44.1 kHz (CD Quality)</option>
|
|
727
727
|
|
|
728
728
|
<option value="48000">48 kHz (Pro)</option>
|
|
729
729
|
|
|
@@ -166,11 +166,11 @@
|
|
|
166
166
|
</label>
|
|
167
167
|
<label>STT Provider
|
|
168
168
|
<select id="sttSelect">
|
|
169
|
+
<option value="soniox" selected>Soniox (default — no override)</option>
|
|
169
170
|
<option value="">Default (server)</option>
|
|
170
|
-
<option value="azure-stt"
|
|
171
|
+
<option value="azure-stt">Azure STT</option>
|
|
171
172
|
<option value="cartesia-stt">Cartesia (Ink-Whisper)</option>
|
|
172
173
|
<option value="openai-realtime">OpenAI Realtime</option>
|
|
173
|
-
<option value="soniox">Soniox</option>
|
|
174
174
|
</select>
|
|
175
175
|
</label>
|
|
176
176
|
<label>Start Open
|
|
@@ -304,7 +304,8 @@ window.testWidget._flavor.messageHandlers['show_media']({
|
|
|
304
304
|
agentSettingsOverride: (() => {
|
|
305
305
|
const override = {};
|
|
306
306
|
const stt = document.getElementById('sttSelect').value;
|
|
307
|
-
|
|
307
|
+
// Soniox is server default; only override when picking a non-default provider
|
|
308
|
+
if (stt && stt !== 'soniox') override.sttProvider = stt;
|
|
308
309
|
return override;
|
|
309
310
|
})(),
|
|
310
311
|
behavior: {
|
|
@@ -434,5 +435,6 @@ window.testWidget._flavor.messageHandlers['show_media']({
|
|
|
434
435
|
updateStatus('SDK load failed: ' + e.message, 'error');
|
|
435
436
|
});
|
|
436
437
|
</script>
|
|
438
|
+
<script src="discovery.js"></script>
|
|
437
439
|
</body>
|
|
438
440
|
</html>
|
package/examples/test-index.html
CHANGED
|
@@ -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>
|
|
@@ -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"
|
|
154
|
+
<option value="azure-stt">Azure STT</option>
|
|
154
155
|
</select>
|
|
155
156
|
</label>
|
|
156
157
|
</div>
|
|
@@ -251,7 +252,8 @@ window.testWidget._flavor.messageHandlers['show_items']({
|
|
|
251
252
|
agentSettingsOverride: (() => {
|
|
252
253
|
const override = {};
|
|
253
254
|
const stt = document.getElementById('sttSelect').value;
|
|
254
|
-
|
|
255
|
+
// Soniox is server default; only override when picking a non-default provider
|
|
256
|
+
if (stt && stt !== 'soniox') override.sttProvider = stt;
|
|
255
257
|
return override;
|
|
256
258
|
})(),
|
|
257
259
|
behavior: {
|
package/examples/test-tour.html
CHANGED
|
@@ -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"
|
|
154
|
+
<option value="azure-stt">Azure STT</option>
|
|
154
155
|
</select>
|
|
155
156
|
</label>
|
|
156
157
|
</div>
|
|
@@ -251,7 +252,8 @@ window.testWidget._flavor.messageHandlers['show_items']({
|
|
|
251
252
|
agentSettingsOverride: (() => {
|
|
252
253
|
const override = {};
|
|
253
254
|
const stt = document.getElementById('sttSelect').value;
|
|
254
|
-
|
|
255
|
+
// Soniox is server default; only override when picking a non-default provider
|
|
256
|
+
if (stt && stt !== 'soniox') override.sttProvider = stt;
|
|
255
257
|
return override;
|
|
256
258
|
})(),
|
|
257
259
|
behavior: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ttp-agent-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.44.0",
|
|
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",
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"README.md",
|
|
20
20
|
"GETTING_STARTED.md",
|
|
21
21
|
"ENHANCED_WIDGET_GUIDE.md",
|
|
22
|
-
"SIGNED_LINK_GUIDE.md",
|
|
23
22
|
"WORDPRESS_WIX_GUIDE.md"
|
|
24
23
|
],
|
|
25
24
|
"scripts": {
|