@contentgrowth/llm-service 0.9.97 → 0.9.98

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.
@@ -258,6 +258,10 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
258
258
  recognition.onend = () => {
259
259
  console.log("[useSpeechRecognition] Native onend event fired. Timestamp:", Date.now());
260
260
  isStartingRef.current = false;
261
+ if (recognitionRef.current === recognition) {
262
+ console.log("[useSpeechRecognition] Nullifying recognitionRef (onend)");
263
+ recognitionRef.current = null;
264
+ }
261
265
  if (isSimulatingRef.current) {
262
266
  console.log("[useSpeechRecognition] onend ignored - simulating");
263
267
  return;
@@ -303,6 +307,10 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
303
307
  } else if (event.error === "network") {
304
308
  console.error("[useSpeechRecognition] - network: Network error during recognition");
305
309
  }
310
+ if (recognitionRef.current === recognition) {
311
+ console.log("[useSpeechRecognition] Nullifying recognitionRef (onerror)");
312
+ recognitionRef.current = null;
313
+ }
306
314
  isStartingRef.current = false;
307
315
  if (event.error === "not-allowed" && process.env.NODE_ENV === "development") {
308
316
  console.warn("Speech recognition blocked. Simulating input for development...");
@@ -363,6 +371,8 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
363
371
  if (recognitionRef.current) {
364
372
  console.log("[useSpeechRecognition] Stopping existing instance before creating new one");
365
373
  try {
374
+ recognitionRef.current.onend = null;
375
+ recognitionRef.current.onerror = null;
366
376
  recognitionRef.current.stop();
367
377
  } catch (e) {
368
378
  }
@@ -1064,10 +1074,6 @@ var TapToTalk = ({
1064
1074
  return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || "ontouchstart" in window || navigator.maxTouchPoints > 0;
1065
1075
  }, []);
1066
1076
  const toggleVoice = async (e) => {
1067
- if (e) {
1068
- e.preventDefault();
1069
- e.stopPropagation();
1070
- }
1071
1077
  const now = Date.now();
1072
1078
  if (now - tapCountRef.current.lastTap < 500) {
1073
1079
  tapCountRef.current.count++;
@@ -1181,6 +1187,7 @@ var TapToTalk = ({
1181
1187
  /* @__PURE__ */ jsxs4(
1182
1188
  "button",
1183
1189
  {
1190
+ type: "button",
1184
1191
  onClick: toggleVoice,
1185
1192
  disabled: disabled || isTranscribing && !isListening,
1186
1193
  className: `flex items-center justify-center gap-3 px-6 py-3 rounded-xl transition-all duration-300 w-full font-medium shadow-md active:scale-[0.98]
@@ -1189,9 +1196,9 @@ var TapToTalk = ({
1189
1196
  ${className}`,
1190
1197
  title: label,
1191
1198
  children: [
1192
- /* @__PURE__ */ jsx6("div", { className: "flex items-center justify-center shrink-0", children: Icon }),
1193
- /* @__PURE__ */ jsx6("span", { className: "truncate", children: label }),
1194
- errorMsg && /* @__PURE__ */ jsx6("span", { className: "text-[10px] bg-white/20 px-1.5 py-0.5 rounded text-red-100 animate-in fade-in slide-in-from-right-1", children: errorMsg })
1199
+ /* @__PURE__ */ jsx6("div", { className: "flex items-center justify-center shrink-0 pointer-events-none", children: Icon }),
1200
+ /* @__PURE__ */ jsx6("span", { className: "truncate pointer-events-none", children: label }),
1201
+ errorMsg && /* @__PURE__ */ jsx6("span", { className: "text-[10px] bg-white/20 px-1.5 py-0.5 rounded text-red-100 animate-in fade-in slide-in-from-right-1 pointer-events-none", children: errorMsg })
1195
1202
  ]
1196
1203
  }
1197
1204
  )