@unctad-ai/voice-agent-ui 5.4.3 → 5.4.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.
@@ -5,7 +5,7 @@ import {
5
5
  SliderSetting,
6
6
  ToggleSetting,
7
7
  VoiceSettingsView
8
- } from "./chunk-HCWPPDLW.js";
8
+ } from "./chunk-KYZTZ7FR.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-5KC4U5MD.js.map
17
+ //# sourceMappingURL=VoiceSettingsView-LWZKDZHT.js.map
@@ -1949,7 +1949,7 @@ function VoiceSettingsView({ onBack, onVolumeChange }) {
1949
1949
  ) : /* @__PURE__ */ jsx3("span", {}),
1950
1950
  /* @__PURE__ */ jsxs2("span", { children: [
1951
1951
  "Kit v",
1952
- /* @__PURE__ */ jsx3("span", { style: { fontWeight: 500, color: "#6b7280" }, children: "5.4.3" })
1952
+ /* @__PURE__ */ jsx3("span", { style: { fontWeight: 500, color: "#6b7280" }, children: "5.4.5" })
1953
1953
  ] })
1954
1954
  ] }) })
1955
1955
  ]
@@ -2041,4 +2041,4 @@ export {
2041
2041
  SettingsSection,
2042
2042
  Divider
2043
2043
  };
2044
- //# sourceMappingURL=chunk-HCWPPDLW.js.map
2044
+ //# sourceMappingURL=chunk-KYZTZ7FR.js.map
package/dist/index.d.ts CHANGED
@@ -123,12 +123,13 @@ declare class VoiceErrorBoundary extends Component<Props, State> {
123
123
  render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
124
124
  }
125
125
 
126
- type VoiceErrorType = 'mic_denied' | 'mic_unavailable' | 'vad_load_failed' | 'stt_failed' | 'tts_failed' | 'network_error' | 'llm_failed' | 'speech_too_short' | 'not_addressed' | 'processing' | null;
126
+ type VoiceErrorType = 'mic_denied' | 'mic_unavailable' | 'mic_busy' | 'vad_load_failed' | 'stt_failed' | 'tts_failed' | 'network_error' | 'llm_failed' | 'speech_too_short' | 'not_addressed' | 'processing' | null;
127
127
  interface VoiceErrorDisplayProps {
128
128
  error: VoiceErrorType;
129
129
  onDismiss: () => void;
130
+ onRetry?: () => void;
130
131
  }
131
- declare function VoiceErrorDisplay({ error, onDismiss }: VoiceErrorDisplayProps): react_jsx_runtime.JSX.Element;
132
+ declare function VoiceErrorDisplay({ error, onDismiss, onRetry }: VoiceErrorDisplayProps): react_jsx_runtime.JSX.Element;
132
133
 
133
134
  interface VoiceOnboardingProps {
134
135
  onTryNow: () => void;
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  VoiceSettingsProvider,
9
9
  VoiceSettingsView,
10
10
  useVoiceSettings
11
- } from "./chunk-HCWPPDLW.js";
11
+ } from "./chunk-KYZTZ7FR.js";
12
12
 
13
13
  // src/VoiceAgentProvider.tsx
14
14
  import { SiteConfigProvider } from "@unctad-ai/voice-agent-core";
@@ -1099,7 +1099,7 @@ function VoiceTranscript({
1099
1099
  color: "#1a1a1a"
1100
1100
  }
1101
1101
  }
1102
- ) : /* @__PURE__ */ jsx4(
1102
+ ) : isAI && isLast && voiceState === "PROCESSING" ? null : /* @__PURE__ */ jsx4(
1103
1103
  FormattedText,
1104
1104
  {
1105
1105
  text: displayText,
@@ -1560,7 +1560,7 @@ var VoiceErrorBoundary = class extends Component {
1560
1560
 
1561
1561
  // src/components/VoiceErrorDisplay.tsx
1562
1562
  import { motion as motion3, AnimatePresence as AnimatePresence3 } from "motion/react";
1563
- import { AlertTriangle as AlertTriangle2, Hourglass, Mic as Mic2, MicOff, VolumeX, Wifi, WifiOff } from "lucide-react";
1563
+ import { AlertTriangle as AlertTriangle2, Hourglass, Mic as Mic2, MicOff, RefreshCw as RefreshCw2, VolumeX, Wifi, WifiOff } from "lucide-react";
1564
1564
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1565
1565
  var SEVERITY_STYLES = {
1566
1566
  error: {
@@ -1596,6 +1596,12 @@ var ERROR_CONFIG = {
1596
1596
  title: "No microphone found",
1597
1597
  severity: "error"
1598
1598
  },
1599
+ mic_busy: {
1600
+ icon: Mic2,
1601
+ title: "Could not access your microphone. Close video call apps (Teams, Zoom) and retry.",
1602
+ severity: "warning",
1603
+ retryable: true
1604
+ },
1599
1605
  vad_load_failed: {
1600
1606
  icon: AlertTriangle2,
1601
1607
  title: "Voice detection unavailable",
@@ -1637,7 +1643,7 @@ var ERROR_CONFIG = {
1637
1643
  severity: "info"
1638
1644
  }
1639
1645
  };
1640
- function VoiceErrorDisplay({ error, onDismiss }) {
1646
+ function VoiceErrorDisplay({ error, onDismiss, onRetry }) {
1641
1647
  return /* @__PURE__ */ jsx7(AnimatePresence3, { children: error && /* @__PURE__ */ jsx7(
1642
1648
  motion3.div,
1643
1649
  {
@@ -1660,6 +1666,17 @@ function VoiceErrorDisplay({ error, onDismiss }) {
1660
1666
  return /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
1661
1667
  /* @__PURE__ */ jsx7(Icon, { className: cn("h-4 w-4 shrink-0", styles.icon) }),
1662
1668
  /* @__PURE__ */ jsx7("span", { className: cn("text-xs flex-1", styles.text), children: config.title }),
1669
+ config.retryable && onRetry && /* @__PURE__ */ jsxs6(
1670
+ "button",
1671
+ {
1672
+ onClick: onRetry,
1673
+ className: cn("text-xs font-medium transition-colors cursor-pointer", styles.text, "hover:underline flex items-center gap-1"),
1674
+ children: [
1675
+ /* @__PURE__ */ jsx7(RefreshCw2, { className: "h-3 w-3" }),
1676
+ "Retry"
1677
+ ]
1678
+ }
1679
+ ),
1663
1680
  /* @__PURE__ */ jsx7(
1664
1681
  "button",
1665
1682
  {
@@ -1761,7 +1778,7 @@ function PipelineMetricsBar({
1761
1778
 
1762
1779
  // src/components/GlassCopilotPanel.tsx
1763
1780
  import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1764
- var VoiceSettingsView2 = lazy(() => import("./VoiceSettingsView-5KC4U5MD.js"));
1781
+ var VoiceSettingsView2 = lazy(() => import("./VoiceSettingsView-LWZKDZHT.js"));
1765
1782
  var RETRY_INITIAL_MS = 3e3;
1766
1783
  var RETRY_MAX_MS = 3e4;
1767
1784
  var STATE_LABELS = {
@@ -2672,7 +2689,11 @@ function ExpandedContent({
2672
2689
  /* @__PURE__ */ jsx9(motion5.span, { animate: isRetrying ? { rotate: 360 } : { rotate: 0 }, transition: isRetrying ? { duration: 0.8, repeat: Infinity, ease: "linear" } : { duration: 0.3 }, style: { display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx9(RotateCw, { style: { width: 14, height: 14 } }) }),
2673
2690
  isRetrying ? "Checking..." : retryCountdown ? `Retrying in ${retryCountdown}s...` : "Retry connection"
2674
2691
  ] }) }),
2675
- voiceError !== "network_error" && /* @__PURE__ */ jsx9("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ jsx9(VoiceErrorDisplay, { error: voiceError, onDismiss: dismissError }) }),
2692
+ voiceError !== "network_error" && /* @__PURE__ */ jsx9("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ jsx9(VoiceErrorDisplay, { error: voiceError, onDismiss: dismissError, onRetry: voiceError === "mic_busy" ? () => {
2693
+ dismissError();
2694
+ onMicToggle();
2695
+ setTimeout(onMicToggle, 200);
2696
+ } : void 0 }) }),
2676
2697
  /* @__PURE__ */ jsx9("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ jsx9(VoiceToolCard, { result: toolResult, onDismiss: onToolDismiss, variant: "capsule" }) })
2677
2698
  ] })
2678
2699
  ] }),
@@ -2977,7 +2998,7 @@ function WiredPanelInner({
2977
2998
  timings: lastTimings ?? void 0,
2978
2999
  route: window.location.pathname,
2979
3000
  copilotName: config.copilotName,
2980
- kitVersion: "5.4.3"
3001
+ kitVersion: "5.4.5"
2981
3002
  })
2982
3003
  });
2983
3004
  const body = await res.json().catch(() => ({ ticketId: void 0 }));
@@ -3855,7 +3876,11 @@ function WiredOverlayContent({
3855
3876
  children: /* @__PURE__ */ jsx16(VoiceTranscript, { messages, isTyping: state === "AI_SPEAKING" || isLLMLoading })
3856
3877
  }
3857
3878
  ),
3858
- /* @__PURE__ */ jsx16("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ jsx16(VoiceErrorDisplay, { error: voiceError, onDismiss: dismissError }) }),
3879
+ /* @__PURE__ */ jsx16("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ jsx16(VoiceErrorDisplay, { error: voiceError, onDismiss: dismissError, onRetry: voiceError === "mic_busy" ? () => {
3880
+ dismissError();
3881
+ stop();
3882
+ setTimeout(start, 200);
3883
+ } : void 0 }) }),
3859
3884
  /* @__PURE__ */ jsx16("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ jsx16(VoiceToolCard, { result: toolResult, onDismiss: () => setToolResult(null) }) }),
3860
3885
  /* @__PURE__ */ jsx16(
3861
3886
  motion9.div,