@bytexbyte/nxtlinq-ai-agent-ui-react-development 0.2.4 → 0.2.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyB/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA4sGlD,CAAC"}
1
+ {"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyB/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAgtGlD,CAAC"}
@@ -160,6 +160,7 @@ piiDisplayMode = 'redacted', voiceThresholds, debugVoiceRms = false, sttGlossary
160
160
  const lastPartialRangeRef = React.useRef(null);
161
161
  const lastAutoSentTranscriptRef = React.useRef('');
162
162
  const autoSendTimerRef = React.useRef(null);
163
+ const isCorrectingRef = React.useRef(false);
163
164
  const lastCustomErrorRef = React.useRef(undefined);
164
165
  function insertPartial(input, partial, caret) {
165
166
  let start = caret;
@@ -499,11 +500,9 @@ piiDisplayMode = 'redacted', voiceThresholds, debugVoiceRms = false, sttGlossary
499
500
  clearTimeout(autoSendTimerRef.current);
500
501
  }
501
502
  const currentTranscript = normalizedText.trim();
502
- // Wait 3 seconds before auto-sending
503
- // Timer will be cleared if user continues speaking (transcript/partialTranscript changes)
504
503
  const scheduleAutoSend = (text, delay) => {
505
504
  autoSendTimerRef.current = setTimeout(() => {
506
- if (isCorrecting) {
505
+ if (isCorrectingRef.current) {
507
506
  // Correction still in flight — re-check in 300ms
508
507
  autoSendTimerRef.current = null;
509
508
  scheduleAutoSend(text, 300);
@@ -528,7 +527,11 @@ piiDisplayMode = 'redacted', voiceThresholds, debugVoiceRms = false, sttGlossary
528
527
  autoSendTimerRef.current = null;
529
528
  }
530
529
  // eslint-disable-next-line react-hooks/exhaustive-deps
531
- }, [transcript, autoSendEnabled, isMicEnabled, isLoading, isCorrecting]);
530
+ }, [transcript, autoSendEnabled, isMicEnabled, isLoading]);
531
+ // Keep isCorrectingRef in sync with isCorrecting state
532
+ React.useEffect(() => {
533
+ isCorrectingRef.current = isCorrecting;
534
+ }, [isCorrecting]);
532
535
  // Clear timer when user continues speaking (partialTranscript updates)
533
536
  React.useEffect(() => {
534
537
  if (partialTranscript && partialTranscript.trim() && autoSendEnabled && isMicEnabled && autoSendTimerRef.current) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/nxtlinq-ai-agent-ui-react-development",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Official React Web UI for nxtlinq AI Agent — drop-in chat widget",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@bytexbyte/nxtlinq-ai-agent-core-development": "0.4.4",
42
- "@bytexbyte/nxtlinq-ai-agent-web-development": "0.2.4",
42
+ "@bytexbyte/nxtlinq-ai-agent-web-development": "0.2.5",
43
43
  "@emotion/react": "^11.14.0",
44
44
  "@emotion/styled": "^11.14.1",
45
45
  "@mui/icons-material": "^7.2.0",
@@ -224,6 +224,7 @@ export const ChatBotProvider: React.FC<ChatBotProps> = ({
224
224
  const lastPartialRangeRef = React.useRef<{ start: number; end: number } | null>(null);
225
225
  const lastAutoSentTranscriptRef = React.useRef<string>('');
226
226
  const autoSendTimerRef = React.useRef<NodeJS.Timeout | null>(null);
227
+ const isCorrectingRef = React.useRef(false);
227
228
  const lastCustomErrorRef = React.useRef<string | undefined>(undefined);
228
229
 
229
230
  function insertPartial(input: string, partial: string, caret: number) {
@@ -588,11 +589,9 @@ export const ChatBotProvider: React.FC<ChatBotProps> = ({
588
589
 
589
590
  const currentTranscript = normalizedText.trim();
590
591
 
591
- // Wait 3 seconds before auto-sending
592
- // Timer will be cleared if user continues speaking (transcript/partialTranscript changes)
593
592
  const scheduleAutoSend = (text: string, delay: number) => {
594
593
  autoSendTimerRef.current = setTimeout(() => {
595
- if (isCorrecting) {
594
+ if (isCorrectingRef.current) {
596
595
  // Correction still in flight — re-check in 300ms
597
596
  autoSendTimerRef.current = null;
598
597
  scheduleAutoSend(text, 300);
@@ -617,7 +616,12 @@ export const ChatBotProvider: React.FC<ChatBotProps> = ({
617
616
  autoSendTimerRef.current = null;
618
617
  }
619
618
  // eslint-disable-next-line react-hooks/exhaustive-deps
620
- }, [transcript, autoSendEnabled, isMicEnabled, isLoading, isCorrecting]);
619
+ }, [transcript, autoSendEnabled, isMicEnabled, isLoading]);
620
+
621
+ // Keep isCorrectingRef in sync with isCorrecting state
622
+ React.useEffect(() => {
623
+ isCorrectingRef.current = isCorrecting;
624
+ }, [isCorrecting]);
621
625
 
622
626
  // Clear timer when user continues speaking (partialTranscript updates)
623
627
  React.useEffect(() => {