@unctad-ai/voice-agent-ui 5.2.0 → 5.2.2
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.
- package/dist/{VoiceSettingsView-OPMI5HCP.js → VoiceSettingsView-NHTSA3OB.js} +2 -2
- package/dist/{chunk-IMDRPZ6B.js → chunk-ZOFSD63V.js} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +44 -29
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- /package/dist/{VoiceSettingsView-OPMI5HCP.js.map → VoiceSettingsView-NHTSA3OB.js.map} +0 -0
- /package/dist/{chunk-IMDRPZ6B.js.map → chunk-ZOFSD63V.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
SliderSetting,
|
|
6
6
|
ToggleSetting,
|
|
7
7
|
VoiceSettingsView
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZOFSD63V.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-
|
|
17
|
+
//# sourceMappingURL=VoiceSettingsView-NHTSA3OB.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.2.
|
|
1905
|
+
/* @__PURE__ */ jsx3("span", { style: { fontWeight: 500, color: "#6b7280" }, children: "5.2.2" })
|
|
1906
1906
|
] })
|
|
1907
1907
|
] }) })
|
|
1908
1908
|
]
|
|
@@ -1994,4 +1994,4 @@ export {
|
|
|
1994
1994
|
SettingsSection,
|
|
1995
1995
|
Divider
|
|
1996
1996
|
};
|
|
1997
|
-
//# sourceMappingURL=chunk-
|
|
1997
|
+
//# sourceMappingURL=chunk-ZOFSD63V.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ interface GlassCopilotPanelProps {
|
|
|
57
57
|
/** URL for the avatar portrait image */
|
|
58
58
|
portraitSrc?: string;
|
|
59
59
|
}
|
|
60
|
-
declare function GlassCopilotPanel({ isOpen: isOpenProp, onOpen: onOpenProp, onClose: onCloseProp, onStateChange, portraitSrc }: GlassCopilotPanelProps): react.ReactPortal;
|
|
60
|
+
declare function GlassCopilotPanel({ isOpen: isOpenProp, onOpen: onOpenProp, onClose: onCloseProp, onStateChange, portraitSrc }: GlassCopilotPanelProps): react.ReactPortal | null;
|
|
61
61
|
|
|
62
62
|
interface AgentAvatarProps {
|
|
63
63
|
state: OrbState;
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
VoiceSettingsProvider,
|
|
9
9
|
VoiceSettingsView,
|
|
10
10
|
useVoiceSettings
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ZOFSD63V.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-
|
|
1767
|
+
var VoiceSettingsView2 = lazy(() => import("./VoiceSettingsView-NHTSA3OB.js"));
|
|
1768
1768
|
var RETRY_INITIAL_MS = 3e3;
|
|
1769
1769
|
var RETRY_MAX_MS = 3e4;
|
|
1770
1770
|
var STATE_LABELS = {
|
|
@@ -1781,6 +1781,14 @@ var ARIA_LIVE_LABELS = {
|
|
|
1781
1781
|
speaking: "Playing response",
|
|
1782
1782
|
error: "An error occurred"
|
|
1783
1783
|
};
|
|
1784
|
+
function isRouteExcluded(patterns) {
|
|
1785
|
+
if (!patterns?.length || typeof window === "undefined") return false;
|
|
1786
|
+
const path = window.location.pathname;
|
|
1787
|
+
return patterns.some((p) => {
|
|
1788
|
+
if (p.endsWith("/*")) return path.startsWith(p.slice(0, -1));
|
|
1789
|
+
return path === p;
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1784
1792
|
function CopilotFAB({ onClick, portraitSrc, isOffline = false }) {
|
|
1785
1793
|
const { colors } = useSiteConfig4();
|
|
1786
1794
|
return /* @__PURE__ */ jsx9(
|
|
@@ -1795,12 +1803,12 @@ function CopilotFAB({ onClick, portraitSrc, isOffline = false }) {
|
|
|
1795
1803
|
border: "none",
|
|
1796
1804
|
padding: 0,
|
|
1797
1805
|
borderRadius: "50%",
|
|
1798
|
-
width:
|
|
1799
|
-
height:
|
|
1806
|
+
width: 80,
|
|
1807
|
+
height: 80
|
|
1800
1808
|
},
|
|
1801
1809
|
"aria-label": "Open voice assistant",
|
|
1802
1810
|
"data-testid": "voice-agent-fab",
|
|
1803
|
-
children: /* @__PURE__ */ jsx9("div", { className: "agent-fab-border", style: { width:
|
|
1811
|
+
children: /* @__PURE__ */ jsx9("div", { className: "agent-fab-border", style: { width: 80, height: 80, "--agent-primary": isOffline ? "#9ca3af" : colors.primary, animation: isOffline ? "none" : void 0 }, children: /* @__PURE__ */ jsx9("div", { className: "agent-fab-border-inner", children: portraitSrc ? /* @__PURE__ */ jsx9(
|
|
1804
1812
|
"img",
|
|
1805
1813
|
{
|
|
1806
1814
|
src: portraitSrc,
|
|
@@ -2037,9 +2045,9 @@ function CollapsedBar({
|
|
|
2037
2045
|
"div",
|
|
2038
2046
|
{
|
|
2039
2047
|
className: "relative shrink-0",
|
|
2040
|
-
style: { width:
|
|
2048
|
+
style: { width: 56, height: 56, opacity: isOffline ? 0.4 : 1 },
|
|
2041
2049
|
children: [
|
|
2042
|
-
/* @__PURE__ */ jsx9(AgentAvatar, { state: orbState, getAmplitude, size:
|
|
2050
|
+
/* @__PURE__ */ jsx9(AgentAvatar, { state: orbState, getAmplitude, size: 56, portraitSrc }),
|
|
2043
2051
|
!ttsEnabled && /* @__PURE__ */ jsx9(
|
|
2044
2052
|
"div",
|
|
2045
2053
|
{
|
|
@@ -2261,31 +2269,26 @@ function ComposerBar({
|
|
|
2261
2269
|
className: "flex items-center gap-3",
|
|
2262
2270
|
style: { height: 56, padding: "10px 14px" },
|
|
2263
2271
|
children: [
|
|
2264
|
-
/* @__PURE__ */
|
|
2265
|
-
|
|
2272
|
+
/* @__PURE__ */ jsx9(
|
|
2273
|
+
motion5.button,
|
|
2266
2274
|
{
|
|
2267
2275
|
onClick: onMicToggle,
|
|
2268
|
-
|
|
2276
|
+
whileHover: { scale: 1.08 },
|
|
2277
|
+
whileTap: { scale: 0.93 },
|
|
2278
|
+
animate: isListening ? { backgroundColor: [colors.primary, `${colors.primary}BB`, colors.primary] } : { backgroundColor: "rgba(0,0,0,0.06)" },
|
|
2279
|
+
transition: isListening ? { backgroundColor: { duration: 1.8, repeat: Infinity, ease: "easeInOut" } } : { duration: 0.3 },
|
|
2280
|
+
className: "shrink-0 rounded-full flex items-center justify-center relative cursor-pointer",
|
|
2269
2281
|
style: {
|
|
2270
2282
|
width: 44,
|
|
2271
2283
|
height: 44,
|
|
2272
|
-
|
|
2273
|
-
|
|
2284
|
+
color: isListening ? "white" : "rgba(0,0,0,0.5)",
|
|
2285
|
+
border: "none",
|
|
2286
|
+
padding: 0,
|
|
2287
|
+
boxShadow: isListening ? `0 2px 8px ${colors.primary}40, 0 1px 3px rgba(0,0,0,0.12)` : "0 1px 4px rgba(0,0,0,0.10)"
|
|
2274
2288
|
},
|
|
2275
2289
|
"aria-label": isListening ? "Stop listening" : "Start listening",
|
|
2276
2290
|
"data-testid": "voice-agent-mic",
|
|
2277
|
-
children:
|
|
2278
|
-
isListening && /* @__PURE__ */ jsx9(
|
|
2279
|
-
motion5.span,
|
|
2280
|
-
{
|
|
2281
|
-
className: "absolute inset-0 rounded-full",
|
|
2282
|
-
animate: { scale: [1, 1.22, 1], opacity: [0.25, 0.08, 0.25] },
|
|
2283
|
-
transition: { duration: 1.8, repeat: Infinity, ease: "easeInOut" },
|
|
2284
|
-
style: { backgroundColor: `${colors.primary}33`, filter: "blur(4px)" }
|
|
2285
|
-
}
|
|
2286
|
-
),
|
|
2287
|
-
/* @__PURE__ */ jsx9(Mic3, { style: { width: 18, height: 18, position: "relative", zIndex: 1 } })
|
|
2288
|
-
]
|
|
2291
|
+
children: /* @__PURE__ */ jsx9(Mic3, { style: { width: 18, height: 18, position: "relative", zIndex: 1 } })
|
|
2289
2292
|
}
|
|
2290
2293
|
),
|
|
2291
2294
|
/* @__PURE__ */ jsx9("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx9(AnimatePresence5, { mode: "wait", children: /* @__PURE__ */ jsx9(
|
|
@@ -2581,9 +2584,9 @@ function ExpandedContent({
|
|
|
2581
2584
|
{
|
|
2582
2585
|
animate: { opacity: isOffline ? 0.35 : 1 },
|
|
2583
2586
|
className: "relative shrink-0",
|
|
2584
|
-
style: { width:
|
|
2587
|
+
style: { width: 56, height: 56, filter: isOffline ? "grayscale(0.8)" : "none" },
|
|
2585
2588
|
children: [
|
|
2586
|
-
/* @__PURE__ */ jsx9(AgentAvatar, { state: orbState, getAmplitude, size:
|
|
2589
|
+
/* @__PURE__ */ jsx9(AgentAvatar, { state: orbState, getAmplitude, size: 56, showRing: true, portraitSrc }),
|
|
2587
2590
|
!ttsEnabled && /* @__PURE__ */ jsx9(
|
|
2588
2591
|
"div",
|
|
2589
2592
|
{
|
|
@@ -2902,7 +2905,7 @@ function WiredPanelInner({
|
|
|
2902
2905
|
timings: lastTimings ?? void 0,
|
|
2903
2906
|
route: window.location.pathname,
|
|
2904
2907
|
copilotName: config.copilotName,
|
|
2905
|
-
kitVersion: "5.2.
|
|
2908
|
+
kitVersion: "5.2.2"
|
|
2906
2909
|
})
|
|
2907
2910
|
});
|
|
2908
2911
|
const body = await res.json().catch(() => ({ ticketId: void 0 }));
|
|
@@ -2974,6 +2977,18 @@ function GlassCopilotPanel({ isOpen: isOpenProp, onOpen: onOpenProp, onClose: on
|
|
|
2974
2977
|
injectAgentFabCSS();
|
|
2975
2978
|
const config = useSiteConfig4();
|
|
2976
2979
|
const resolvedPortrait = portraitSrc ?? config.avatarUrl;
|
|
2980
|
+
const [routeHidden, setRouteHidden] = useState5(() => isRouteExcluded(config.excludeRoutes));
|
|
2981
|
+
useEffect6(() => {
|
|
2982
|
+
if (!config.excludeRoutes?.length) return;
|
|
2983
|
+
const check = () => setRouteHidden(isRouteExcluded(config.excludeRoutes));
|
|
2984
|
+
window.addEventListener("popstate", check);
|
|
2985
|
+
const timer = setInterval(check, 500);
|
|
2986
|
+
return () => {
|
|
2987
|
+
window.removeEventListener("popstate", check);
|
|
2988
|
+
clearInterval(timer);
|
|
2989
|
+
};
|
|
2990
|
+
}, [config.excludeRoutes]);
|
|
2991
|
+
if (routeHidden) return null;
|
|
2977
2992
|
const [internalOpen, setInternalOpen] = useState5(false);
|
|
2978
2993
|
const isControlled = isOpenProp !== void 0;
|
|
2979
2994
|
const isOpen = isControlled ? isOpenProp : internalOpen;
|
|
@@ -3053,9 +3068,9 @@ function GlassCopilotPanel({ isOpen: isOpenProp, onOpen: onOpenProp, onClose: on
|
|
|
3053
3068
|
"aria-label": "Voice Assistant",
|
|
3054
3069
|
"aria-modal": "false",
|
|
3055
3070
|
"data-testid": "voice-agent-panel",
|
|
3056
|
-
initial: { width:
|
|
3071
|
+
initial: { width: 80, height: 80, borderRadius: 40, opacity: 0, scale: 0.9 },
|
|
3057
3072
|
animate: { width: PANEL_WIDTH, height: Math.min(targetHeight, window.innerHeight - 48), borderRadius: PANEL_BORDER_RADIUS, opacity: 1, scale: 1, transition: SPRING_PANEL },
|
|
3058
|
-
exit: { width:
|
|
3073
|
+
exit: { width: 80, height: 80, borderRadius: 40, opacity: 0, scale: 0.95, transition: SPRING_PANEL_EXIT },
|
|
3059
3074
|
className: "fixed",
|
|
3060
3075
|
style: { bottom: PANEL_BOTTOM, right: PANEL_RIGHT, zIndex: PANEL_Z_INDEX, transformOrigin: "bottom right", maxWidth: "calc(100vw - 32px)", outline: "none", fontFamily: config.fontFamily ?? DEFAULT_FONT_FAMILY2 },
|
|
3061
3076
|
children: [
|