@unctad-ai/voice-agent-ui 5.2.1 → 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-DANMPNO7.js → VoiceSettingsView-NHTSA3OB.js} +2 -2
- package/dist/{chunk-7ZBULBW7.js → chunk-ZOFSD63V.js} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- /package/dist/{VoiceSettingsView-DANMPNO7.js.map → VoiceSettingsView-NHTSA3OB.js.map} +0 -0
- /package/dist/{chunk-7ZBULBW7.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,
|
|
@@ -2897,7 +2905,7 @@ function WiredPanelInner({
|
|
|
2897
2905
|
timings: lastTimings ?? void 0,
|
|
2898
2906
|
route: window.location.pathname,
|
|
2899
2907
|
copilotName: config.copilotName,
|
|
2900
|
-
kitVersion: "5.2.
|
|
2908
|
+
kitVersion: "5.2.2"
|
|
2901
2909
|
})
|
|
2902
2910
|
});
|
|
2903
2911
|
const body = await res.json().catch(() => ({ ticketId: void 0 }));
|
|
@@ -2969,6 +2977,18 @@ function GlassCopilotPanel({ isOpen: isOpenProp, onOpen: onOpenProp, onClose: on
|
|
|
2969
2977
|
injectAgentFabCSS();
|
|
2970
2978
|
const config = useSiteConfig4();
|
|
2971
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;
|
|
2972
2992
|
const [internalOpen, setInternalOpen] = useState5(false);
|
|
2973
2993
|
const isControlled = isOpenProp !== void 0;
|
|
2974
2994
|
const isOpen = isControlled ? isOpenProp : internalOpen;
|
|
@@ -3048,9 +3068,9 @@ function GlassCopilotPanel({ isOpen: isOpenProp, onOpen: onOpenProp, onClose: on
|
|
|
3048
3068
|
"aria-label": "Voice Assistant",
|
|
3049
3069
|
"aria-modal": "false",
|
|
3050
3070
|
"data-testid": "voice-agent-panel",
|
|
3051
|
-
initial: { width:
|
|
3071
|
+
initial: { width: 80, height: 80, borderRadius: 40, opacity: 0, scale: 0.9 },
|
|
3052
3072
|
animate: { width: PANEL_WIDTH, height: Math.min(targetHeight, window.innerHeight - 48), borderRadius: PANEL_BORDER_RADIUS, opacity: 1, scale: 1, transition: SPRING_PANEL },
|
|
3053
|
-
exit: { width:
|
|
3073
|
+
exit: { width: 80, height: 80, borderRadius: 40, opacity: 0, scale: 0.95, transition: SPRING_PANEL_EXIT },
|
|
3054
3074
|
className: "fixed",
|
|
3055
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 },
|
|
3056
3076
|
children: [
|