@contentgrowth/llm-service 0.9.94 → 0.9.95

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.
@@ -762,6 +762,13 @@ var ChatInputArea = (0, import_react5.forwardRef)(({
762
762
  var _a2, _b2;
763
763
  console.log("[ChatInputArea] startRecording called. trigger:", trigger, "isMobile:", isMobile());
764
764
  console.log("[ChatInputArea] Current state - voiceTrigger:", voiceTrigger, "isTranscribing:", isTranscribing);
765
+ if (isMobile()) {
766
+ console.log("[ChatInputArea] SKIPPING textarea focus on mobile to prevent keyboard conflict");
767
+ if (document.activeElement instanceof HTMLElement) {
768
+ console.log("[ChatInputArea] Blur active element on mobile BEFORE start");
769
+ document.activeElement.blur();
770
+ }
771
+ }
765
772
  if (voiceTrigger || isTranscribing) {
766
773
  console.log("[ChatInputArea] startRecording ignored - already active");
767
774
  return;
@@ -804,12 +811,6 @@ var ChatInputArea = (0, import_react5.forwardRef)(({
804
811
  var _a3;
805
812
  return (_a3 = textareaRef.current) == null ? void 0 : _a3.focus();
806
813
  }, 0);
807
- } else {
808
- console.log("[ChatInputArea] SKIPPING textarea focus on mobile to prevent keyboard conflict");
809
- if (document.activeElement instanceof HTMLElement) {
810
- console.log("[ChatInputArea] Blur active element on mobile");
811
- document.activeElement.blur();
812
- }
813
814
  }
814
815
  };
815
816
  const stopRecording = () => {
@@ -1108,6 +1109,24 @@ var TapToTalk = ({
1108
1109
  e.preventDefault();
1109
1110
  e.stopPropagation();
1110
1111
  }
1112
+ const now = Date.now();
1113
+ if (now - tapCountRef.current.lastTap < 500) {
1114
+ tapCountRef.current.count++;
1115
+ } else {
1116
+ tapCountRef.current.count = 1;
1117
+ }
1118
+ tapCountRef.current.lastTap = now;
1119
+ if (tapCountRef.current.count >= 5) {
1120
+ setShowDebug((prev) => !prev);
1121
+ tapCountRef.current.count = 0;
1122
+ if (isActive) {
1123
+ console.log("[TapToTalk] Debug trigger force-stop");
1124
+ if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") nativeSpeech.stop();
1125
+ else customRecorder.stop();
1126
+ setVoiceTrigger(null);
1127
+ }
1128
+ return;
1129
+ }
1111
1130
  console.log("[TapToTalk] toggleVoice called. isMobile:", isMobile());
1112
1131
  if (processingRef.current) {
1113
1132
  console.log("[TapToTalk] toggleVoice ignored - processing");
@@ -1116,24 +1135,6 @@ var TapToTalk = ({
1116
1135
  processingRef.current = true;
1117
1136
  console.log("[TapToTalk] toggleVoice called. isActive:", isActive, "isListening:", isListening, "isTranscribing:", isTranscribing);
1118
1137
  try {
1119
- const now = Date.now();
1120
- if (now - tapCountRef.current.lastTap < 500) {
1121
- tapCountRef.current.count++;
1122
- } else {
1123
- tapCountRef.current.count = 1;
1124
- }
1125
- tapCountRef.current.lastTap = now;
1126
- if (tapCountRef.current.count >= 5) {
1127
- setShowDebug((prev) => !prev);
1128
- tapCountRef.current.count = 0;
1129
- if (isActive) {
1130
- console.log("[TapToTalk] Debug trigger force-stop");
1131
- if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") nativeSpeech.stop();
1132
- else customRecorder.stop();
1133
- setVoiceTrigger(null);
1134
- }
1135
- return;
1136
- }
1137
1138
  if (isActive) {
1138
1139
  if (isTranscribing && !isListening) {
1139
1140
  console.log("[TapToTalk] Ignoring click during transcription");
@@ -1149,17 +1150,14 @@ var TapToTalk = ({
1149
1150
  } else {
1150
1151
  console.log("[TapToTalk] Starting voice... mode:", voiceConfig == null ? void 0 : voiceConfig.mode);
1151
1152
  setErrorMsg(null);
1152
- if (onFocusTarget && !isMobile()) {
1153
- console.log("[TapToTalk] calling onFocusTarget() (desktop only)");
1154
- onFocusTarget();
1155
- } else {
1156
- if (onFocusTarget) {
1157
- console.log("[TapToTalk] SKIPPING onFocusTarget on mobile to prevent keyboard conflict");
1158
- }
1159
- if (isMobile() && document.activeElement instanceof HTMLElement) {
1160
- console.log("[TapToTalk] Blurring active element on mobile");
1153
+ if (isMobile()) {
1154
+ console.log("[TapToTalk] Mobile: Blurring active element and skipping onFocusTarget");
1155
+ if (document.activeElement instanceof HTMLElement) {
1161
1156
  document.activeElement.blur();
1162
1157
  }
1158
+ } else if (onFocusTarget) {
1159
+ console.log("[TapToTalk] Desktop: calling onFocusTarget()");
1160
+ onFocusTarget();
1163
1161
  }
1164
1162
  setVoiceTrigger("click");
1165
1163
  console.log("[TapToTalk] voiceTrigger set to click");