@unctad-ai/voice-agent-ui 5.1.2 → 5.1.3

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.
@@ -5,7 +5,7 @@ import {
5
5
  SliderSetting,
6
6
  ToggleSetting,
7
7
  VoiceSettingsView
8
- } from "./chunk-OUTD6CWN.js";
8
+ } from "./chunk-LOZIYINE.js";
9
9
  export {
10
10
  Divider,
11
11
  SelectSetting,
@@ -14,4 +14,4 @@ export {
14
14
  ToggleSetting,
15
15
  VoiceSettingsView as default
16
16
  };
17
- //# sourceMappingURL=VoiceSettingsView-DAYBNBVA.js.map
17
+ //# sourceMappingURL=VoiceSettingsView-UL3TSETS.js.map
@@ -1902,7 +1902,7 @@ function VoiceSettingsView({ onBack, onVolumeChange }) {
1902
1902
  ) : /* @__PURE__ */ jsx3("span", {}),
1903
1903
  /* @__PURE__ */ jsxs2("span", { children: [
1904
1904
  "Kit v",
1905
- /* @__PURE__ */ jsx3("span", { style: { fontWeight: 500, color: "#6b7280" }, children: "5.1.2" })
1905
+ /* @__PURE__ */ jsx3("span", { style: { fontWeight: 500, color: "#6b7280" }, children: "5.1.3" })
1906
1906
  ] })
1907
1907
  ] }) })
1908
1908
  ]
@@ -1994,4 +1994,4 @@ export {
1994
1994
  SettingsSection,
1995
1995
  Divider
1996
1996
  };
1997
- //# sourceMappingURL=chunk-OUTD6CWN.js.map
1997
+ //# sourceMappingURL=chunk-LOZIYINE.js.map
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  VoiceSettingsProvider,
9
9
  VoiceSettingsView,
10
10
  useVoiceSettings
11
- } from "./chunk-OUTD6CWN.js";
11
+ } from "./chunk-LOZIYINE.js";
12
12
 
13
13
  // src/VoiceAgentProvider.tsx
14
14
  import { SiteConfigProvider } from "@unctad-ai/voice-agent-core";
@@ -1764,7 +1764,7 @@ function PipelineMetricsBar({
1764
1764
 
1765
1765
  // src/components/GlassCopilotPanel.tsx
1766
1766
  import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1767
- var VoiceSettingsView2 = lazy(() => import("./VoiceSettingsView-DAYBNBVA.js"));
1767
+ var VoiceSettingsView2 = lazy(() => import("./VoiceSettingsView-UL3TSETS.js"));
1768
1768
  var RETRY_INITIAL_MS = 3e3;
1769
1769
  var RETRY_MAX_MS = 3e4;
1770
1770
  var STATE_LABELS = {
@@ -2673,19 +2673,30 @@ function WiredPanelInner({
2673
2673
  useEffect6(() => {
2674
2674
  if (panelState === "hidden") stopRef.current(true);
2675
2675
  }, [panelState]);
2676
+ const micOpen = state === "LISTENING" || state === "USER_SPEAKING";
2677
+ const stateRef = useRef4(state);
2678
+ stateRef.current = state;
2676
2679
  useEffect6(() => {
2677
2680
  if (panelState === "hidden" || micPaused || showSettings) return;
2678
- if (state === "PROCESSING" || state === "AI_SPEAKING") return;
2679
- const timer = setTimeout(() => {
2680
- stopRef.current();
2681
- if (hasConversationRef.current) {
2682
- setMicPaused(true);
2683
- } else {
2684
- onCollapseRef.current();
2685
- }
2686
- }, settings.idleTimeoutMs);
2681
+ if (!micOpen) return;
2682
+ let timer;
2683
+ const schedule = () => {
2684
+ timer = setTimeout(() => {
2685
+ if (stateRef.current === "USER_SPEAKING") {
2686
+ schedule();
2687
+ return;
2688
+ }
2689
+ stopRef.current();
2690
+ if (hasConversationRef.current) {
2691
+ setMicPaused(true);
2692
+ } else {
2693
+ onCollapseRef.current();
2694
+ }
2695
+ }, settings.idleTimeoutMs);
2696
+ };
2697
+ schedule();
2687
2698
  return () => clearTimeout(timer);
2688
- }, [state, panelState, micPaused, showSettings, activity, settings.idleTimeoutMs]);
2699
+ }, [micOpen, panelState, micPaused, showSettings, activity, settings.idleTimeoutMs]);
2689
2700
  useEffect6(() => {
2690
2701
  if (!micPaused || panelState !== "expanded" || showSettings) return;
2691
2702
  if (settings.panelCollapseTimeoutMs === 0) return;
@@ -2721,7 +2732,7 @@ function WiredPanelInner({
2721
2732
  timings: lastTimings ?? void 0,
2722
2733
  route: window.location.pathname,
2723
2734
  copilotName: config.copilotName,
2724
- kitVersion: "5.1.2"
2735
+ kitVersion: "5.1.3"
2725
2736
  })
2726
2737
  });
2727
2738
  const body = await res.json().catch(() => ({ ticketId: void 0 }));