@convai/web-sdk 1.9.0-beta.1 → 1.9.0-beta.12
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/README.md +35 -43
- package/dist/core/AudioManager.d.ts +0 -1
- package/dist/core/AudioManager.js +0 -1
- package/dist/core/BlendshapeQueue.d.ts +0 -1
- package/dist/core/BlendshapeQueue.js +20 -6
- package/dist/core/CharacterRoster.d.ts +0 -1
- package/dist/core/CharacterRoster.js +0 -1
- package/dist/core/CharacterVersionManager.d.ts +0 -1
- package/dist/core/CharacterVersionManager.js +0 -1
- package/dist/core/ConnectionStateHandler.d.ts +0 -1
- package/dist/core/ConnectionStateHandler.js +5 -2
- package/dist/core/ConvaiClient.d.ts +66 -3
- package/dist/core/ConvaiClient.js +253 -20
- package/dist/core/ConvaiRoomError.d.ts +0 -1
- package/dist/core/ConvaiRoomError.js +20 -2
- package/dist/core/EventEmitter.d.ts +0 -1
- package/dist/core/EventEmitter.js +0 -1
- package/dist/core/MemoryManager.d.ts +0 -1
- package/dist/core/MemoryManager.js +0 -1
- package/dist/core/MessageHandler.d.ts +5 -3
- package/dist/core/MessageHandler.js +125 -47
- package/dist/core/SSESession.d.ts +13 -9
- package/dist/core/SSESession.js +240 -13
- package/dist/core/ScreenShareManager.d.ts +0 -1
- package/dist/core/ScreenShareManager.js +0 -1
- package/dist/core/VideoManager.d.ts +0 -1
- package/dist/core/VideoManager.js +0 -1
- package/dist/core/characterInfo.d.ts +45 -0
- package/dist/core/characterInfo.js +55 -0
- package/dist/core/characterReference.d.ts +0 -1
- package/dist/core/characterReference.js +0 -1
- package/dist/core/connectRequest.d.ts +0 -1
- package/dist/core/connectRequest.js +0 -1
- package/dist/core/contextUpdateRequest.d.ts +0 -1
- package/dist/core/contextUpdateRequest.js +0 -1
- package/dist/core/index.d.ts +5 -2
- package/dist/core/index.js +20 -2
- package/dist/core/logicalTurn.d.ts +0 -1
- package/dist/core/logicalTurn.js +0 -1
- package/dist/core/modelOutput.d.ts +0 -1
- package/dist/core/modelOutput.js +0 -1
- package/dist/core/publishedChat.d.ts +0 -1
- package/dist/core/publishedChat.js +0 -1
- package/dist/core/rosterRequest.d.ts +0 -1
- package/dist/core/rosterRequest.js +0 -1
- package/dist/core/rtviEnvelope.d.ts +5 -0
- package/dist/core/rtviEnvelope.js +9 -0
- package/dist/core/types.d.ts +241 -17
- package/dist/core/types.js +0 -1
- package/dist/core/videoSourceState.d.ts +0 -1
- package/dist/core/videoSourceState.js +0 -1
- package/dist/core/visionRequest.d.ts +0 -1
- package/dist/core/visionRequest.js +0 -1
- package/dist/embed/index.d.ts +20 -3
- package/dist/embed/index.js +20 -3
- package/dist/embed/publicationApi.d.ts +0 -1
- package/dist/embed/publicationApi.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/lipsync-helpers/arkitOrder61.d.ts +0 -1
- package/dist/lipsync-helpers/arkitOrder61.js +5 -3
- package/dist/lipsync-helpers/createBlendshapeQueue.d.ts +0 -1
- package/dist/lipsync-helpers/createBlendshapeQueue.js +7 -1
- package/dist/lipsync-helpers/declarativeMapping.d.ts +2 -1
- package/dist/lipsync-helpers/declarativeMapping.js +72 -146
- package/dist/lipsync-helpers/index.d.ts +0 -1
- package/dist/lipsync-helpers/index.js +0 -1
- package/dist/lipsync-helpers/mappingTypes.d.ts +6 -5
- package/dist/lipsync-helpers/mappingTypes.js +0 -1
- package/dist/lipsync-helpers/metahumanOrder251.d.ts +0 -1
- package/dist/lipsync-helpers/metahumanOrder251.js +8 -9
- package/dist/lipsync-helpers/mhaLimitDrivers.d.ts +0 -1
- package/dist/lipsync-helpers/mhaLimitDrivers.js +0 -1
- package/dist/lipsync-helpers/naturalness/processor.d.ts +0 -1
- package/dist/lipsync-helpers/naturalness/processor.js +6 -4
- package/dist/lipsync-helpers/naturalness/profiles/mha.d.ts +0 -1
- package/dist/lipsync-helpers/naturalness/profiles/mha.js +0 -1
- package/dist/lipsync-helpers/naturalness/types.d.ts +0 -1
- package/dist/lipsync-helpers/naturalness/types.js +0 -1
- package/dist/lipsync-helpers/presetMappers.d.ts +0 -1
- package/dist/lipsync-helpers/presetMappers.js +0 -1
- package/dist/react/components/ConvaiWidget.d.ts +9 -1
- package/dist/react/components/ConvaiWidget.js +23 -28
- package/dist/react/components/index.d.ts +0 -1
- package/dist/react/components/index.js +0 -1
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js +0 -1
- package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/AudioVisualizer.js +0 -1
- package/dist/react/components/rtc-widget/components/ConviMessage.d.ts +4 -2
- package/dist/react/components/rtc-widget/components/ConviMessage.js +2 -3
- package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/FloatingVideo.js +1 -3
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts +7 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +9 -6
- package/dist/react/components/rtc-widget/components/MessageBubble.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/MessageBubble.js +0 -1
- package/dist/react/components/rtc-widget/components/MessageList.d.ts +4 -2
- package/dist/react/components/rtc-widget/components/MessageList.js +2 -3
- package/dist/react/components/rtc-widget/components/SiteCard.d.ts +14 -0
- package/dist/react/components/rtc-widget/components/SiteCard.js +34 -0
- package/dist/react/components/rtc-widget/components/UserMessage.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/UserMessage.js +1 -2
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js +1 -3
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js +1 -3
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js +1 -4
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/index.js +0 -1
- package/dist/react/components/rtc-widget/components/index.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/index.js +0 -1
- package/dist/react/components/rtc-widget/index.d.ts +0 -1
- package/dist/react/components/rtc-widget/index.js +0 -1
- package/dist/react/components/rtc-widget/styles/framerConfig.d.ts +0 -1
- package/dist/react/components/rtc-widget/styles/framerConfig.js +0 -1
- package/dist/react/components/rtc-widget/styles/icons.d.ts +0 -1
- package/dist/react/components/rtc-widget/styles/icons.js +0 -1
- package/dist/react/components/rtc-widget/styles/index.d.ts +0 -1
- package/dist/react/components/rtc-widget/styles/index.js +0 -1
- package/dist/react/components/rtc-widget/styles/styledComponents.d.ts +0 -1
- package/dist/react/components/rtc-widget/styles/styledComponents.js +0 -1
- package/dist/react/components/rtc-widget/styles/theme.d.ts +0 -1
- package/dist/react/components/rtc-widget/styles/theme.js +0 -1
- package/dist/react/components/rtc-widget/types/index.d.ts +0 -1
- package/dist/react/components/rtc-widget/types/index.js +0 -1
- package/dist/react/hooks/index.d.ts +0 -1
- package/dist/react/hooks/index.js +0 -1
- package/dist/react/hooks/useCharacterInfo.d.ts +12 -11
- package/dist/react/hooks/useCharacterInfo.js +49 -50
- package/dist/react/hooks/useConvaiClient.d.ts +0 -1
- package/dist/react/hooks/useConvaiClient.js +8 -5
- package/dist/react/hooks/useLocalCameraTrack.d.ts +0 -1
- package/dist/react/hooks/useLocalCameraTrack.js +0 -1
- package/dist/react/icons.d.ts +37 -0
- package/dist/react/icons.js +53 -0
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +1 -1
- package/dist/utils/inlineMarkdown.d.ts +0 -1
- package/dist/utils/inlineMarkdown.js +0 -1
- package/dist/utils/lightbox.d.ts +0 -1
- package/dist/utils/lightbox.js +0 -1
- package/dist/utils/linkPresentation.d.ts +7 -1
- package/dist/utils/linkPresentation.js +57 -1
- package/dist/utils/linkPreview.d.ts +45 -0
- package/dist/utils/linkPreview.js +71 -0
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.js +0 -1
- package/dist/vanilla/AudioRenderer.d.ts +0 -1
- package/dist/vanilla/AudioRenderer.js +0 -1
- package/dist/vanilla/ConvaiWidget.d.ts +0 -1
- package/dist/vanilla/ConvaiWidget.js +89 -40
- package/dist/vanilla/WebSocketSession.d.ts +0 -1
- package/dist/vanilla/WebSocketSession.js +0 -1
- package/dist/vanilla/WidgetEventSubscriptions.d.ts +0 -1
- package/dist/vanilla/WidgetEventSubscriptions.js +0 -1
- package/dist/vanilla/icons.d.ts +0 -1
- package/dist/vanilla/icons.js +0 -1
- package/dist/vanilla/index.d.ts +2 -1
- package/dist/vanilla/index.js +1 -1
- package/dist/vanilla/styles.d.ts +0 -1
- package/dist/vanilla/styles.js +0 -1
- package/dist/vanilla/types.d.ts +9 -1
- package/dist/vanilla/types.js +0 -1
- package/dist/vanilla/websocket.d.ts +0 -1
- package/dist/vanilla/websocket.js +0 -1
- package/dist/version.d.ts +1 -2
- package/dist/version.js +1 -2
- package/package.json +22 -27
- package/dist/core/AudioManager.d.ts.map +0 -1
- package/dist/core/AudioManager.js.map +0 -1
- package/dist/core/BlendshapeQueue.d.ts.map +0 -1
- package/dist/core/BlendshapeQueue.js.map +0 -1
- package/dist/core/CharacterRoster.d.ts.map +0 -1
- package/dist/core/CharacterRoster.js.map +0 -1
- package/dist/core/CharacterVersionManager.d.ts.map +0 -1
- package/dist/core/CharacterVersionManager.js.map +0 -1
- package/dist/core/ConnectionStateHandler.d.ts.map +0 -1
- package/dist/core/ConnectionStateHandler.js.map +0 -1
- package/dist/core/ConvaiClient.d.ts.map +0 -1
- package/dist/core/ConvaiClient.js.map +0 -1
- package/dist/core/ConvaiRoomError.d.ts.map +0 -1
- package/dist/core/ConvaiRoomError.js.map +0 -1
- package/dist/core/EventEmitter.d.ts.map +0 -1
- package/dist/core/EventEmitter.js.map +0 -1
- package/dist/core/MemoryManager.d.ts.map +0 -1
- package/dist/core/MemoryManager.js.map +0 -1
- package/dist/core/MessageHandler.d.ts.map +0 -1
- package/dist/core/MessageHandler.js.map +0 -1
- package/dist/core/SSESession.d.ts.map +0 -1
- package/dist/core/SSESession.js.map +0 -1
- package/dist/core/ScreenShareManager.d.ts.map +0 -1
- package/dist/core/ScreenShareManager.js.map +0 -1
- package/dist/core/VideoManager.d.ts.map +0 -1
- package/dist/core/VideoManager.js.map +0 -1
- package/dist/core/characterReference.d.ts.map +0 -1
- package/dist/core/characterReference.js.map +0 -1
- package/dist/core/connectRequest.d.ts.map +0 -1
- package/dist/core/connectRequest.js.map +0 -1
- package/dist/core/contextUpdateRequest.d.ts.map +0 -1
- package/dist/core/contextUpdateRequest.js.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/logicalTurn.d.ts.map +0 -1
- package/dist/core/logicalTurn.js.map +0 -1
- package/dist/core/modelOutput.d.ts.map +0 -1
- package/dist/core/modelOutput.js.map +0 -1
- package/dist/core/publishedChat.d.ts.map +0 -1
- package/dist/core/publishedChat.js.map +0 -1
- package/dist/core/rosterRequest.d.ts.map +0 -1
- package/dist/core/rosterRequest.js.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js.map +0 -1
- package/dist/core/videoSourceState.d.ts.map +0 -1
- package/dist/core/videoSourceState.js.map +0 -1
- package/dist/core/visionRequest.d.ts.map +0 -1
- package/dist/core/visionRequest.js.map +0 -1
- package/dist/embed/ConvaiChatElement.d.ts +0 -103
- package/dist/embed/ConvaiChatElement.d.ts.map +0 -1
- package/dist/embed/ConvaiChatElement.js +0 -679
- package/dist/embed/ConvaiChatElement.js.map +0 -1
- package/dist/embed/browser.d.ts +0 -3
- package/dist/embed/browser.d.ts.map +0 -1
- package/dist/embed/browser.js +0 -5
- package/dist/embed/browser.js.map +0 -1
- package/dist/embed/chat-embed-v1.js +0 -200
- package/dist/embed/chat-embed-v1.js.map +0 -7
- package/dist/embed/index.d.ts.map +0 -1
- package/dist/embed/index.js.map +0 -1
- package/dist/embed/publicationApi.d.ts.map +0 -1
- package/dist/embed/publicationApi.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lipsync-helpers/arkitOrder61.d.ts.map +0 -1
- package/dist/lipsync-helpers/arkitOrder61.js.map +0 -1
- package/dist/lipsync-helpers/createBlendshapeQueue.d.ts.map +0 -1
- package/dist/lipsync-helpers/createBlendshapeQueue.js.map +0 -1
- package/dist/lipsync-helpers/declarativeMapping.d.ts.map +0 -1
- package/dist/lipsync-helpers/declarativeMapping.js.map +0 -1
- package/dist/lipsync-helpers/index.d.ts.map +0 -1
- package/dist/lipsync-helpers/index.js.map +0 -1
- package/dist/lipsync-helpers/mappingTypes.d.ts.map +0 -1
- package/dist/lipsync-helpers/mappingTypes.js.map +0 -1
- package/dist/lipsync-helpers/metahumanOrder251.d.ts.map +0 -1
- package/dist/lipsync-helpers/metahumanOrder251.js.map +0 -1
- package/dist/lipsync-helpers/mhaLimitDrivers.d.ts.map +0 -1
- package/dist/lipsync-helpers/mhaLimitDrivers.js.map +0 -1
- package/dist/lipsync-helpers/naturalness/processor.d.ts.map +0 -1
- package/dist/lipsync-helpers/naturalness/processor.js.map +0 -1
- package/dist/lipsync-helpers/naturalness/profiles/mha.d.ts.map +0 -1
- package/dist/lipsync-helpers/naturalness/profiles/mha.js.map +0 -1
- package/dist/lipsync-helpers/naturalness/types.d.ts.map +0 -1
- package/dist/lipsync-helpers/naturalness/types.js.map +0 -1
- package/dist/lipsync-helpers/presetMappers.d.ts.map +0 -1
- package/dist/lipsync-helpers/presetMappers.js.map +0 -1
- package/dist/react/components/ConvaiWidget.d.ts.map +0 -1
- package/dist/react/components/ConvaiWidget.js.map +0 -1
- package/dist/react/components/index.d.ts.map +0 -1
- package/dist/react/components/index.js.map +0 -1
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js.map +0 -1
- package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/AudioVisualizer.js.map +0 -1
- package/dist/react/components/rtc-widget/components/ConviMessage.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/ConviMessage.js.map +0 -1
- package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/FloatingVideo.js.map +0 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +0 -1
- package/dist/react/components/rtc-widget/components/MessageBubble.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/MessageBubble.js.map +0 -1
- package/dist/react/components/rtc-widget/components/MessageList.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/MessageList.js.map +0 -1
- package/dist/react/components/rtc-widget/components/UserMessage.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/UserMessage.js.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/index.js.map +0 -1
- package/dist/react/components/rtc-widget/components/index.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/index.js.map +0 -1
- package/dist/react/components/rtc-widget/index.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/index.js.map +0 -1
- package/dist/react/components/rtc-widget/styles/framerConfig.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/styles/framerConfig.js.map +0 -1
- package/dist/react/components/rtc-widget/styles/icons.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/styles/icons.js.map +0 -1
- package/dist/react/components/rtc-widget/styles/index.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/styles/index.js.map +0 -1
- package/dist/react/components/rtc-widget/styles/styledComponents.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/styles/styledComponents.js.map +0 -1
- package/dist/react/components/rtc-widget/styles/theme.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/styles/theme.js.map +0 -1
- package/dist/react/components/rtc-widget/types/index.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/types/index.js.map +0 -1
- package/dist/react/hooks/index.d.ts.map +0 -1
- package/dist/react/hooks/index.js.map +0 -1
- package/dist/react/hooks/useCharacterInfo.d.ts.map +0 -1
- package/dist/react/hooks/useCharacterInfo.js.map +0 -1
- package/dist/react/hooks/useConvaiClient.d.ts.map +0 -1
- package/dist/react/hooks/useConvaiClient.js.map +0 -1
- package/dist/react/hooks/useLocalCameraTrack.d.ts.map +0 -1
- package/dist/react/hooks/useLocalCameraTrack.js.map +0 -1
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/index.js.map +0 -1
- package/dist/utils/inlineMarkdown.d.ts.map +0 -1
- package/dist/utils/inlineMarkdown.js.map +0 -1
- package/dist/utils/lightbox.d.ts.map +0 -1
- package/dist/utils/lightbox.js.map +0 -1
- package/dist/utils/linkPresentation.d.ts.map +0 -1
- package/dist/utils/linkPresentation.js.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/vanilla/AudioRenderer.d.ts.map +0 -1
- package/dist/vanilla/AudioRenderer.js.map +0 -1
- package/dist/vanilla/ConvaiWidget.d.ts.map +0 -1
- package/dist/vanilla/ConvaiWidget.js.map +0 -1
- package/dist/vanilla/WebSocketSession.d.ts.map +0 -1
- package/dist/vanilla/WebSocketSession.js.map +0 -1
- package/dist/vanilla/WidgetEventSubscriptions.d.ts.map +0 -1
- package/dist/vanilla/WidgetEventSubscriptions.js.map +0 -1
- package/dist/vanilla/icons.d.ts.map +0 -1
- package/dist/vanilla/icons.js.map +0 -1
- package/dist/vanilla/index.d.ts.map +0 -1
- package/dist/vanilla/index.js.map +0 -1
- package/dist/vanilla/styles.d.ts.map +0 -1
- package/dist/vanilla/styles.js.map +0 -1
- package/dist/vanilla/types.d.ts.map +0 -1
- package/dist/vanilla/types.js.map +0 -1
- package/dist/vanilla/websocket.d.ts.map +0 -1
- package/dist/vanilla/websocket.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
|
@@ -1,66 +1,65 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { logger } from "../../utils/logger.js";
|
|
3
|
+
import { fetchCharacterInfo, FALLBACK_CHARACTER_NAME, } from "../../core/characterInfo.js";
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Fetch a character's display name and avatar for the widget header.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* The request itself lives in `core/characterInfo` so the vanilla widget runs
|
|
8
|
+
* the same code rather than a hand-synced copy of it.
|
|
9
|
+
*
|
|
10
|
+
* @param characterId - Character to look up
|
|
11
|
+
* @param apiKey - Convai API key, sent as `X-API-Key`
|
|
12
|
+
* @param authToken - Preferred over `apiKey`, sent as `API-AUTH-TOKEN`
|
|
13
|
+
* @param baseUrl - Origin to ask; defaults to `https://api.convai.com`. Pass
|
|
14
|
+
* `client.characterInfoUrl` so a non-SaaS deployment is not asked to send
|
|
15
|
+
* its credential to Convai's public API.
|
|
9
16
|
*/
|
|
10
|
-
export const useCharacterInfo = (characterId, apiKey, authToken) => {
|
|
17
|
+
export const useCharacterInfo = (characterId, apiKey, authToken, baseUrl) => {
|
|
11
18
|
const [characterInfo, setCharacterInfo] = useState({
|
|
12
|
-
name:
|
|
19
|
+
name: FALLBACK_CHARACTER_NAME,
|
|
13
20
|
image: null,
|
|
14
21
|
});
|
|
15
22
|
const [isLoading, setIsLoading] = useState(true);
|
|
16
23
|
const [error, setError] = useState(null);
|
|
17
24
|
useEffect(() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
if (!characterId || !apiKey) {
|
|
26
|
+
setIsLoading(false);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// Dropped on unmount, and on any change of the inputs below: a resolved
|
|
30
|
+
// response for a character the widget has moved off must not overwrite the
|
|
31
|
+
// header with the previous one's name.
|
|
32
|
+
const controller = new AbortController();
|
|
33
|
+
let cancelled = false;
|
|
34
|
+
setIsLoading(true);
|
|
35
|
+
setError(null);
|
|
36
|
+
fetchCharacterInfo({
|
|
37
|
+
characterId,
|
|
38
|
+
apiKey,
|
|
39
|
+
authToken,
|
|
40
|
+
baseUrl,
|
|
41
|
+
signal: controller.signal,
|
|
42
|
+
})
|
|
43
|
+
.then((info) => {
|
|
44
|
+
if (!cancelled)
|
|
45
|
+
setCharacterInfo(info);
|
|
46
|
+
})
|
|
47
|
+
.catch((err) => {
|
|
48
|
+
if (cancelled || controller.signal.aborted)
|
|
21
49
|
return;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (authToken) {
|
|
30
|
-
headers["API-AUTH-TOKEN"] = authToken;
|
|
31
|
-
}
|
|
32
|
-
else if (apiKey) {
|
|
33
|
-
headers["X-API-Key"] = apiKey;
|
|
34
|
-
}
|
|
35
|
-
const response = await fetch("https://api.convai.com/character/get", {
|
|
36
|
-
method: "POST",
|
|
37
|
-
headers,
|
|
38
|
-
body: JSON.stringify({ charID: characterId }),
|
|
39
|
-
});
|
|
40
|
-
if (!response.ok) {
|
|
41
|
-
throw new Error(`Failed to fetch character info: ${response.status}`);
|
|
42
|
-
}
|
|
43
|
-
const data = await response.json();
|
|
44
|
-
// Extract character name and image with fallbacks
|
|
45
|
-
const name = data.character_name || "Convi";
|
|
46
|
-
const image = data.model_details?.METAHUMAN?.avatar_image_square ||
|
|
47
|
-
data.model_details?.METAHUMAN?.avatar_image ||
|
|
48
|
-
data.model_details?.modelPlaceholder ||
|
|
49
|
-
null;
|
|
50
|
-
setCharacterInfo({ name, image });
|
|
51
|
-
}
|
|
52
|
-
catch (err) {
|
|
53
|
-
const error = err instanceof Error ? err : new Error("Unknown error");
|
|
54
|
-
logger.error("Failed to fetch character info:", error);
|
|
55
|
-
setError(error);
|
|
56
|
-
// Keep default values on error
|
|
57
|
-
}
|
|
58
|
-
finally {
|
|
50
|
+
const error = err instanceof Error ? err : new Error("Unknown error");
|
|
51
|
+
logger.error("Failed to fetch character info:", error);
|
|
52
|
+
setError(error);
|
|
53
|
+
// Keep the fallback name and no image; the header is cosmetic.
|
|
54
|
+
})
|
|
55
|
+
.finally(() => {
|
|
56
|
+
if (!cancelled)
|
|
59
57
|
setIsLoading(false);
|
|
60
|
-
|
|
58
|
+
});
|
|
59
|
+
return () => {
|
|
60
|
+
cancelled = true;
|
|
61
|
+
controller.abort();
|
|
61
62
|
};
|
|
62
|
-
|
|
63
|
-
}, [characterId, apiKey]);
|
|
63
|
+
}, [characterId, apiKey, authToken, baseUrl]);
|
|
64
64
|
return { ...characterInfo, isLoading, error };
|
|
65
65
|
};
|
|
66
|
-
//# sourceMappingURL=useCharacterInfo.js.map
|
|
@@ -50,12 +50,14 @@ export const useConvaiClient = (config) => {
|
|
|
50
50
|
const unsubStateChange = client.on("stateChange", (newState) => {
|
|
51
51
|
setState(newState);
|
|
52
52
|
// Update activity based on state (priority: speaking > listening > thinking > connected)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
else if (newState.isConnecting) {
|
|
53
|
+
// isConnecting first: a connecting client is not yet connected, so
|
|
54
|
+
// checking !isConnected first made "Connecting..." unreachable.
|
|
55
|
+
if (newState.isConnecting) {
|
|
57
56
|
setActivity("Connecting...");
|
|
58
57
|
}
|
|
58
|
+
else if (!newState.isConnected) {
|
|
59
|
+
setActivity("Disconnected");
|
|
60
|
+
}
|
|
59
61
|
else if (newState.isSpeaking) {
|
|
60
62
|
setActivity("Speaking");
|
|
61
63
|
}
|
|
@@ -181,6 +183,8 @@ export const useConvaiClient = (config) => {
|
|
|
181
183
|
appendMessage: client.appendMessage.bind(client),
|
|
182
184
|
toggleUsageUpdates: client.toggleUsageUpdates.bind(client),
|
|
183
185
|
setInteractionTarget: client.setInteractionTarget.bind(client),
|
|
186
|
+
setCharacterMuted: client.setCharacterMuted.bind(client),
|
|
187
|
+
isCharacterMuted: client.isCharacterMuted.bind(client),
|
|
184
188
|
updateCharacterRoster: client.updateCharacterRoster.bind(client),
|
|
185
189
|
roomSession: client.roomSession,
|
|
186
190
|
characters: client.characters,
|
|
@@ -227,4 +231,3 @@ export const useConvaiClient = (config) => {
|
|
|
227
231
|
isScreenShareActive,
|
|
228
232
|
};
|
|
229
233
|
};
|
|
230
|
-
//# sourceMappingURL=useConvaiClient.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The icons the React widget draws, as inline SVG.
|
|
3
|
+
*
|
|
4
|
+
* These were the only 15 icons `react-icons` supplied, and that package is an
|
|
5
|
+
* 84 MB install — every icon set it ships — for 9 KB of bundled output. Each
|
|
6
|
+
* entry below is the exact element tree react-icons 5.6.0 generates for that
|
|
7
|
+
* icon, and `IconBase` reproduces its renderer: the same default
|
|
8
|
+
* `stroke`/`fill`/`strokeWidth`, `size` -> `height`/`width`, `color` both as
|
|
9
|
+
* an attribute and in `style`, and the `xmlns`. `__tests__/icons.test.tsx`
|
|
10
|
+
* pins that equivalence against the server-rendered markup of the original
|
|
11
|
+
* components, so a change here that alters a single attribute fails a test.
|
|
12
|
+
*
|
|
13
|
+
* Only the props the widget passes are supported — `size` and `color`, plus
|
|
14
|
+
* ordinary SVG attributes. react-icons' `IconContext` is not: nothing in this
|
|
15
|
+
* package ever provided one.
|
|
16
|
+
*/
|
|
17
|
+
import React from "react";
|
|
18
|
+
export interface IconProps extends React.SVGAttributes<SVGElement> {
|
|
19
|
+
size?: string | number;
|
|
20
|
+
color?: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const FaUser: (props: IconProps) => React.ReactElement;
|
|
24
|
+
export declare const FiMoreVertical: (props: IconProps) => React.ReactElement;
|
|
25
|
+
export declare const FiMic: (props: IconProps) => React.ReactElement;
|
|
26
|
+
export declare const FiSend: (props: IconProps) => React.ReactElement;
|
|
27
|
+
export declare const FiPhoneOff: (props: IconProps) => React.ReactElement;
|
|
28
|
+
export declare const IoClose: (props: IconProps) => React.ReactElement;
|
|
29
|
+
export declare const IoVideocam: (props: IconProps) => React.ReactElement;
|
|
30
|
+
export declare const IoVideocamOff: (props: IconProps) => React.ReactElement;
|
|
31
|
+
export declare const IoVolumeMute: (props: IconProps) => React.ReactElement;
|
|
32
|
+
export declare const IoVolumeHigh: (props: IconProps) => React.ReactElement;
|
|
33
|
+
export declare const LiaRedoAltSolid: (props: IconProps) => React.ReactElement;
|
|
34
|
+
export declare const MdDragIndicator: (props: IconProps) => React.ReactElement;
|
|
35
|
+
export declare const MdScreenShare: (props: IconProps) => React.ReactElement;
|
|
36
|
+
export declare const MdStopScreenShare: (props: IconProps) => React.ReactElement;
|
|
37
|
+
export declare const PiWaveform: (props: IconProps) => React.ReactElement;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The icons the React widget draws, as inline SVG.
|
|
3
|
+
*
|
|
4
|
+
* These were the only 15 icons `react-icons` supplied, and that package is an
|
|
5
|
+
* 84 MB install — every icon set it ships — for 9 KB of bundled output. Each
|
|
6
|
+
* entry below is the exact element tree react-icons 5.6.0 generates for that
|
|
7
|
+
* icon, and `IconBase` reproduces its renderer: the same default
|
|
8
|
+
* `stroke`/`fill`/`strokeWidth`, `size` -> `height`/`width`, `color` both as
|
|
9
|
+
* an attribute and in `style`, and the `xmlns`. `__tests__/icons.test.tsx`
|
|
10
|
+
* pins that equivalence against the server-rendered markup of the original
|
|
11
|
+
* components, so a change here that alters a single attribute fails a test.
|
|
12
|
+
*
|
|
13
|
+
* Only the props the widget passes are supported — `size` and `color`, plus
|
|
14
|
+
* ordinary SVG attributes. react-icons' `IconContext` is not: nothing in this
|
|
15
|
+
* package ever provided one.
|
|
16
|
+
*/
|
|
17
|
+
import React from "react";
|
|
18
|
+
function renderTree(tree) {
|
|
19
|
+
return tree.map((node, i) => React.createElement(node.tag, { key: i, ...node.attr }, renderTree(node.child)));
|
|
20
|
+
}
|
|
21
|
+
function IconBase({ data, size, title, ...svgProps }) {
|
|
22
|
+
const computedSize = size || "1em";
|
|
23
|
+
return React.createElement("svg", {
|
|
24
|
+
stroke: "currentColor",
|
|
25
|
+
fill: "currentColor",
|
|
26
|
+
strokeWidth: "0",
|
|
27
|
+
...data.attr,
|
|
28
|
+
...svgProps,
|
|
29
|
+
className: svgProps.className,
|
|
30
|
+
style: { color: svgProps.color, ...svgProps.style },
|
|
31
|
+
height: computedSize,
|
|
32
|
+
width: computedSize,
|
|
33
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
34
|
+
}, title && React.createElement("title", null, title), renderTree(data.child));
|
|
35
|
+
}
|
|
36
|
+
function icon(data) {
|
|
37
|
+
return (props) => IconBase({ ...props, data });
|
|
38
|
+
}
|
|
39
|
+
export const FaUser = icon({ "tag": "svg", "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z" }, "child": [] }] });
|
|
40
|
+
export const FiMoreVertical = icon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "circle", "attr": { "cx": "12", "cy": "12", "r": "1" }, "child": [] }, { "tag": "circle", "attr": { "cx": "12", "cy": "5", "r": "1" }, "child": [] }, { "tag": "circle", "attr": { "cx": "12", "cy": "19", "r": "1" }, "child": [] }] });
|
|
41
|
+
export const FiMic = icon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }, "child": [] }, { "tag": "path", "attr": { "d": "M19 10v2a7 7 0 0 1-14 0v-2" }, "child": [] }, { "tag": "line", "attr": { "x1": "12", "y1": "19", "x2": "12", "y2": "23" }, "child": [] }, { "tag": "line", "attr": { "x1": "8", "y1": "23", "x2": "16", "y2": "23" }, "child": [] }] });
|
|
42
|
+
export const FiSend = icon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "line", "attr": { "x1": "22", "y1": "2", "x2": "11", "y2": "13" }, "child": [] }, { "tag": "polygon", "attr": { "points": "22 2 15 22 11 13 2 9 22 2" }, "child": [] }] });
|
|
43
|
+
export const FiPhoneOff = icon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91" }, "child": [] }, { "tag": "line", "attr": { "x1": "23", "y1": "1", "x2": "1", "y2": "23" }, "child": [] }] });
|
|
44
|
+
export const IoClose = icon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "m289.94 256 95-95A24 24 0 0 0 351 127l-95 95-95-95a24 24 0 0 0-34 34l95 95-95 95a24 24 0 1 0 34 34l95-95 95 95a24 24 0 0 0 34-34z" }, "child": [] }] });
|
|
45
|
+
export const IoVideocam = icon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M464 384.39a32 32 0 0 1-13-2.77 15.77 15.77 0 0 1-2.71-1.54l-82.71-58.22A32 32 0 0 1 352 295.7v-79.4a32 32 0 0 1 13.58-26.16l82.71-58.22a15.77 15.77 0 0 1 2.71-1.54 32 32 0 0 1 45 29.24v192.76a32 32 0 0 1-32 32zM268 400H84a68.07 68.07 0 0 1-68-68V180a68.07 68.07 0 0 1 68-68h184.48A67.6 67.6 0 0 1 336 179.52V332a68.07 68.07 0 0 1-68 68z" }, "child": [] }] });
|
|
46
|
+
export const IoVideocamOff = icon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M336 179.52A67.52 67.52 0 0 0 268.48 112h-79.2a4 4 0 0 0-2.82 6.83l142.71 142.71a4 4 0 0 0 6.83-2.82zM16 180v152a68 68 0 0 0 68 68h184a67.66 67.66 0 0 0 42.84-15.24 4 4 0 0 0 .33-6L54.41 122a4 4 0 0 0-4.87-.62A68 68 0 0 0 16 180zm448 204.39a32 32 0 0 1-13-2.77 15.77 15.77 0 0 1-2.71-1.54l-82.71-58.22A32 32 0 0 1 352 295.7v-79.4a32 32 0 0 1 13.58-26.16l82.71-58.22a15.77 15.77 0 0 1 2.71-1.54 32 32 0 0 1 45 29.24v192.76a32 32 0 0 1-32 32z" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeMiterlimit": "10", "strokeWidth": "32", "d": "M416 416 80 80" }, "child": [] }] });
|
|
47
|
+
export const IoVolumeMute = icon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeMiterlimit": "10", "strokeWidth": "32", "d": "M416 432 64 80" }, "child": [] }, { "tag": "path", "attr": { "d": "M243.33 98.86a23.89 23.89 0 0 0-25.55 1.82l-.66.51-28.52 23.35a8 8 0 0 0-.59 11.85l54.33 54.33a8 8 0 0 0 13.66-5.66v-64.49a24.51 24.51 0 0 0-12.67-21.71zm8 236.43L96.69 180.69A16 16 0 0 0 85.38 176H56a24 24 0 0 0-24 24v112a24 24 0 0 0 24 24h69.76l92 75.31a23.9 23.9 0 0 0 25.87 1.69A24.51 24.51 0 0 0 256 391.45v-44.86a16 16 0 0 0-4.67-11.3zM352 256c0-24.56-5.81-47.87-17.75-71.27a16 16 0 1 0-28.5 14.55C315.34 218.06 320 236.62 320 256q0 4-.31 8.13a8 8 0 0 0 2.32 6.25l14.36 14.36a8 8 0 0 0 13.55-4.31A146 146 0 0 0 352 256zm64 0c0-51.18-13.08-83.89-34.18-120.06a16 16 0 0 0-27.64 16.12C373.07 184.44 384 211.83 384 256c0 23.83-3.29 42.88-9.37 60.65a8 8 0 0 0 1.9 8.26L389 337.4a8 8 0 0 0 13.13-2.79C411 311.76 416 287.26 416 256z" }, "child": [] }, { "tag": "path", "attr": { "d": "M480 256c0-74.25-20.19-121.11-50.51-168.61a16 16 0 1 0-27 17.22C429.82 147.38 448 189.5 448 256c0 46.19-8.43 80.27-22.43 110.53a8 8 0 0 0 1.59 9l11.92 11.92a8 8 0 0 0 12.92-2.16C471.6 344.9 480 305 480 256z" }, "child": [] }] });
|
|
48
|
+
export const IoVolumeHigh = icon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M232 416a23.88 23.88 0 0 1-14.2-4.68 8.27 8.27 0 0 1-.66-.51L125.76 336H56a24 24 0 0 1-24-24V200a24 24 0 0 1 24-24h69.75l91.37-74.81a8.27 8.27 0 0 1 .66-.51A24 24 0 0 1 256 120v272a24 24 0 0 1-24 24zm-106.18-80zm-.27-159.86zM320 336a16 16 0 0 1-14.29-23.19c9.49-18.87 14.3-38 14.3-56.81 0-19.38-4.66-37.94-14.25-56.73a16 16 0 0 1 28.5-14.54C346.19 208.12 352 231.44 352 256c0 23.86-6 47.81-17.7 71.19A16 16 0 0 1 320 336z" }, "child": [] }, { "tag": "path", "attr": { "d": "M368 384a16 16 0 0 1-13.86-24C373.05 327.09 384 299.51 384 256c0-44.17-10.93-71.56-29.82-103.94a16 16 0 0 1 27.64-16.12C402.92 172.11 416 204.81 416 256c0 50.43-13.06 83.29-34.13 120a16 16 0 0 1-13.87 8z" }, "child": [] }, { "tag": "path", "attr": { "d": "M416 432a16 16 0 0 1-13.39-24.74C429.85 365.47 448 323.76 448 256c0-66.5-18.18-108.62-45.49-151.39a16 16 0 1 1 27-17.22C459.81 134.89 480 181.74 480 256c0 64.75-14.66 113.63-50.6 168.74A16 16 0 0 1 416 432z" }, "child": [] }] });
|
|
49
|
+
export const LiaRedoAltSolid = icon({ "tag": "svg", "attr": { "viewBox": "0 0 32 32" }, "child": [{ "tag": "path", "attr": { "d": "M 16 3 C 8.832031 3 3 8.832031 3 16 C 3 23.167969 8.832031 29 16 29 C 23.167969 29 29 23.167969 29 16 L 27 16 C 27 22.085938 22.085938 27 16 27 C 9.914063 27 5 22.085938 5 16 C 5 9.914063 9.914063 5 16 5 C 19.875 5 23.261719 6.984375 25.21875 10 L 20 10 L 20 12 L 28 12 L 28 4 L 26 4 L 26 7.71875 C 23.617188 4.84375 20.019531 3 16 3 Z" }, "child": [] }] });
|
|
50
|
+
export const MdDragIndicator = icon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }, "child": [] }] });
|
|
51
|
+
export const MdScreenShare = icon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20 18c1.1 0 1.99-.9 1.99-2L22 6a2 2 0 0 0-2-2H4c-1.11 0-2 .89-2 2v10a2 2 0 0 0 2 2H0v2h24v-2h-4zm-7-3.53v-2.19c-2.78 0-4.61.85-6 2.72.56-2.67 2.11-5.33 6-5.87V7l4 3.73-4 3.74z" }, "child": [] }] });
|
|
52
|
+
export const MdStopScreenShare = icon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "m21.22 18.02 2 2H24v-2h-2.78zm.77-2 .01-10a2 2 0 0 0-2-2H7.22l5.23 5.23c.18-.04.36-.07.55-.1V7.02l4 3.73-1.58 1.47 5.54 5.54c.61-.33 1.03-.99 1.03-1.74zM2.39 1.73 1.11 3l1.54 1.54c-.4.36-.65.89-.65 1.48v10a2 2 0 0 0 2 2H0v2h18.13l2.71 2.71 1.27-1.27L2.39 1.73zM7 15.02c.31-1.48.92-2.95 2.07-4.06l1.59 1.59c-1.54.38-2.7 1.18-3.66 2.47z" }, "child": [] }] });
|
|
53
|
+
export const PiWaveform = icon({ "tag": "svg", "attr": { "viewBox": "0 0 256 256", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M56,96v64a8,8,0,0,1-16,0V96a8,8,0,0,1,16,0ZM88,24a8,8,0,0,0-8,8V224a8,8,0,0,0,16,0V32A8,8,0,0,0,88,24Zm40,32a8,8,0,0,0-8,8V192a8,8,0,0,0,16,0V64A8,8,0,0,0,128,56Zm40,32a8,8,0,0,0-8,8v64a8,8,0,0,0,16,0V96A8,8,0,0,0,168,88Zm40-16a8,8,0,0,0-8,8v96a8,8,0,0,0,16,0V80A8,8,0,0,0,208,72Z" }, "child": [] }] });
|
package/dist/react/index.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ export { parseInlineMarkdown, mediaKindForUrl, isSafeHref, compactUrl } from '..
|
|
|
5
5
|
export type { InlineNode, MediaKind } from '../utils/inlineMarkdown.js';
|
|
6
6
|
export { linkKindForUrl, describeUrl } from '../utils/linkPresentation.js';
|
|
7
7
|
export type { LinkKind } from '../utils/linkPresentation.js';
|
|
8
|
+
export { resolveLinkPreviewCached, isCardWorthy, LINK_PREVIEW_TIMEOUT_MS } from '../utils/linkPreview.js';
|
|
9
|
+
export type { LinkPreviewMeta, LinkPreviewResolver } from '../utils/linkPreview.js';
|
|
8
10
|
export * from './hooks/index.js';
|
|
9
11
|
export * from '../core/types.js';
|
|
10
12
|
export { getDisconnectReasonMessage } from '../core/types.js';
|
|
11
13
|
export { ActionResultAckError, ConvaiClient } from '../core/index.js';
|
|
12
14
|
export { RoomAudioRenderer as AudioRenderer, RoomContext as AudioContext } from '@livekit/components-react';
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/react/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { MarkdownRenderer } from './components/rtc-widget/components/MarkdownRen
|
|
|
10
10
|
// The tokenizer behind it, for building a renderer from scratch.
|
|
11
11
|
export { parseInlineMarkdown, mediaKindForUrl, isSafeHref, compactUrl } from '../utils/inlineMarkdown.js';
|
|
12
12
|
export { linkKindForUrl, describeUrl } from '../utils/linkPresentation.js';
|
|
13
|
+
export { resolveLinkPreviewCached, isCardWorthy, LINK_PREVIEW_TIMEOUT_MS } from '../utils/linkPreview.js';
|
|
13
14
|
// Additional hooks (for advanced usage)
|
|
14
15
|
export * from './hooks/index.js';
|
|
15
16
|
// Re-export core types for convenience
|
|
@@ -20,4 +21,3 @@ export { getDisconnectReasonMessage } from '../core/types.js';
|
|
|
20
21
|
export { ActionResultAckError, ConvaiClient } from '../core/index.js';
|
|
21
22
|
// Re-export LiveKit components for convenience (backward compatible)
|
|
22
23
|
export { RoomAudioRenderer as AudioRenderer, RoomContext as AudioContext } from '@livekit/components-react';
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -57,4 +57,3 @@ export declare function compactUrl(url: string, max?: number): string;
|
|
|
57
57
|
/** True when `url` uses a scheme safe to expose as an anchor href. */
|
|
58
58
|
export declare function isSafeHref(url: string): boolean;
|
|
59
59
|
export declare function parseInlineMarkdown(line: string): InlineNode[];
|
|
60
|
-
//# sourceMappingURL=inlineMarkdown.d.ts.map
|
package/dist/utils/lightbox.d.ts
CHANGED
package/dist/utils/lightbox.js
CHANGED
|
@@ -65,5 +65,11 @@ export declare const presentationStyles: {
|
|
|
65
65
|
lightboxControls: StyleObject;
|
|
66
66
|
lightboxButton: StyleObject;
|
|
67
67
|
lightboxFallback: StyleObject;
|
|
68
|
+
siteCard: StyleObject;
|
|
69
|
+
siteHeader: StyleObject;
|
|
70
|
+
siteFavicon: StyleObject;
|
|
71
|
+
siteName: StyleObject;
|
|
72
|
+
siteTitle: StyleObject;
|
|
73
|
+
siteDescription: StyleObject;
|
|
74
|
+
siteImage: StyleObject;
|
|
68
75
|
};
|
|
69
|
-
//# sourceMappingURL=linkPresentation.d.ts.map
|
|
@@ -122,6 +122,7 @@ const UNITLESS = new Set([
|
|
|
122
122
|
"lineHeight",
|
|
123
123
|
"fontWeight",
|
|
124
124
|
"order",
|
|
125
|
+
"WebkitLineClamp",
|
|
125
126
|
]);
|
|
126
127
|
/** `{ marginTop: 6 }` → `margin-top: 6px;` — the vanilla widget authors cssText. */
|
|
127
128
|
export function toCssText(style) {
|
|
@@ -354,5 +355,60 @@ export const presentationStyles = {
|
|
|
354
355
|
border: "1px dashed rgba(255,255,255,.3)",
|
|
355
356
|
borderRadius: RADIUS,
|
|
356
357
|
},
|
|
358
|
+
// Site card: Open Graph metadata under a plain web link. Same chrome as the
|
|
359
|
+
// file card so the three card kinds read as one family.
|
|
360
|
+
siteCard: {
|
|
361
|
+
display: "block",
|
|
362
|
+
marginTop: 6,
|
|
363
|
+
maxWidth: 320,
|
|
364
|
+
padding: "8px 10px",
|
|
365
|
+
borderRadius: RADIUS,
|
|
366
|
+
background: chrome(6),
|
|
367
|
+
boxShadow: `inset 0 0 0 1px ${chrome(10)}`,
|
|
368
|
+
color: "inherit",
|
|
369
|
+
textDecoration: "none",
|
|
370
|
+
},
|
|
371
|
+
siteHeader: { display: "flex", alignItems: "center", gap: 6, minWidth: 0 },
|
|
372
|
+
siteFavicon: {
|
|
373
|
+
width: 16,
|
|
374
|
+
height: 16,
|
|
375
|
+
flex: "0 0 auto",
|
|
376
|
+
borderRadius: 3,
|
|
377
|
+
objectFit: "contain",
|
|
378
|
+
},
|
|
379
|
+
siteName: {
|
|
380
|
+
fontSize: 12,
|
|
381
|
+
fontWeight: 700,
|
|
382
|
+
whiteSpace: "nowrap",
|
|
383
|
+
overflow: "hidden",
|
|
384
|
+
textOverflow: "ellipsis",
|
|
385
|
+
},
|
|
386
|
+
siteTitle: {
|
|
387
|
+
display: "block",
|
|
388
|
+
marginTop: 2,
|
|
389
|
+
fontSize: 13,
|
|
390
|
+
fontWeight: 600,
|
|
391
|
+
color: ACCENT,
|
|
392
|
+
whiteSpace: "nowrap",
|
|
393
|
+
overflow: "hidden",
|
|
394
|
+
textOverflow: "ellipsis",
|
|
395
|
+
},
|
|
396
|
+
siteDescription: {
|
|
397
|
+
display: "-webkit-box",
|
|
398
|
+
WebkitBoxOrient: "vertical",
|
|
399
|
+
WebkitLineClamp: 2,
|
|
400
|
+
overflow: "hidden",
|
|
401
|
+
marginTop: 2,
|
|
402
|
+
fontSize: 12,
|
|
403
|
+
opacity: 0.75,
|
|
404
|
+
lineHeight: 1.35,
|
|
405
|
+
},
|
|
406
|
+
siteImage: {
|
|
407
|
+
display: "block",
|
|
408
|
+
width: "100%",
|
|
409
|
+
aspectRatio: "16 / 9",
|
|
410
|
+
objectFit: "cover",
|
|
411
|
+
marginTop: 8,
|
|
412
|
+
borderRadius: 6,
|
|
413
|
+
},
|
|
357
414
|
};
|
|
358
|
-
//# sourceMappingURL=linkPresentation.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The site-card contract: what a host hands the renderer for a plain web
|
|
3
|
+
* link, and the one cache both renderers share.
|
|
4
|
+
*
|
|
5
|
+
* The SDK cannot read another origin's HTML, so the Open Graph tags a page
|
|
6
|
+
* declares have to come from somewhere server-side. That somewhere is the
|
|
7
|
+
* host's business; the renderer only needs a function that turns a URL into
|
|
8
|
+
* metadata or null. No resolver, no cards.
|
|
9
|
+
*/
|
|
10
|
+
export interface LinkPreviewMeta {
|
|
11
|
+
/** Final URL after redirects. */
|
|
12
|
+
url: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Absolute http(s) URL, or dropped. */
|
|
16
|
+
image?: string;
|
|
17
|
+
siteName?: string;
|
|
18
|
+
/** Absolute http(s) URL, or dropped. */
|
|
19
|
+
favicon?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolve metadata for a web URL, or null when there is nothing to show.
|
|
23
|
+
* Should resolve null for a bad or unknown URL and reject only on transport
|
|
24
|
+
* failure; either way the renderer draws nothing.
|
|
25
|
+
*/
|
|
26
|
+
export type LinkPreviewResolver = (url: string, signal: AbortSignal) => Promise<LinkPreviewMeta | null>;
|
|
27
|
+
/** A resolve that has not settled by then is treated as nothing to show. */
|
|
28
|
+
export declare const LINK_PREVIEW_TIMEOUT_MS = 8000;
|
|
29
|
+
/** Distinct URLs remembered per page load. */
|
|
30
|
+
export declare const LINK_PREVIEW_CACHE_SIZE = 200;
|
|
31
|
+
/** Description, site name and favicon alone are not worth a card. */
|
|
32
|
+
export declare function isCardWorthy(meta: LinkPreviewMeta | null | undefined): meta is LinkPreviewMeta;
|
|
33
|
+
/** Only http(s) may ever reach an `img`. Relative URLs are the resolver's job. */
|
|
34
|
+
export declare function safeHttpUrl(value: string | undefined): string | undefined;
|
|
35
|
+
export declare function siteNameFor(meta: LinkPreviewMeta, url: string): string;
|
|
36
|
+
/** Declared icon, else the origin's /favicon.ico. Never a third-party icon service. */
|
|
37
|
+
export declare function faviconFor(meta: LinkPreviewMeta, url: string): string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* One in-flight or settled promise per URL, shared by every card on the page.
|
|
40
|
+
* Rejections settle to null so a dead host is asked once, and each call gets a
|
|
41
|
+
* signal that fires after LINK_PREVIEW_TIMEOUT_MS.
|
|
42
|
+
*/
|
|
43
|
+
export declare function resolveLinkPreviewCached(resolver: LinkPreviewResolver, url: string): Promise<LinkPreviewMeta | null>;
|
|
44
|
+
/** Test seam. */
|
|
45
|
+
export declare function resetLinkPreviewCache(): void;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** A resolve that has not settled by then is treated as nothing to show. */
|
|
2
|
+
export const LINK_PREVIEW_TIMEOUT_MS = 8000;
|
|
3
|
+
/** Distinct URLs remembered per page load. */
|
|
4
|
+
export const LINK_PREVIEW_CACHE_SIZE = 200;
|
|
5
|
+
/** Description, site name and favicon alone are not worth a card. */
|
|
6
|
+
export function isCardWorthy(meta) {
|
|
7
|
+
return !!meta && (!!meta.title || !!meta.image);
|
|
8
|
+
}
|
|
9
|
+
/** Only http(s) may ever reach an `img`. Relative URLs are the resolver's job. */
|
|
10
|
+
export function safeHttpUrl(value) {
|
|
11
|
+
if (!value)
|
|
12
|
+
return undefined;
|
|
13
|
+
try {
|
|
14
|
+
const u = new URL(value);
|
|
15
|
+
return u.protocol === "http:" || u.protocol === "https:" ? u.href : undefined;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function siteNameFor(meta, url) {
|
|
22
|
+
if (meta.siteName)
|
|
23
|
+
return meta.siteName;
|
|
24
|
+
try {
|
|
25
|
+
return new URL(url).hostname.replace(/^www\./, "");
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return url;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Declared icon, else the origin's /favicon.ico. Never a third-party icon service. */
|
|
32
|
+
export function faviconFor(meta, url) {
|
|
33
|
+
const declared = safeHttpUrl(meta.favicon);
|
|
34
|
+
if (declared)
|
|
35
|
+
return declared;
|
|
36
|
+
try {
|
|
37
|
+
return `${new URL(url).origin}/favicon.ico`;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const cache = new Map();
|
|
44
|
+
/**
|
|
45
|
+
* One in-flight or settled promise per URL, shared by every card on the page.
|
|
46
|
+
* Rejections settle to null so a dead host is asked once, and each call gets a
|
|
47
|
+
* signal that fires after LINK_PREVIEW_TIMEOUT_MS.
|
|
48
|
+
*/
|
|
49
|
+
export function resolveLinkPreviewCached(resolver, url) {
|
|
50
|
+
const hit = cache.get(url);
|
|
51
|
+
if (hit)
|
|
52
|
+
return hit;
|
|
53
|
+
const controller = new AbortController();
|
|
54
|
+
const timer = setTimeout(() => controller.abort(), LINK_PREVIEW_TIMEOUT_MS);
|
|
55
|
+
const p = Promise.resolve()
|
|
56
|
+
.then(() => resolver(url, controller.signal))
|
|
57
|
+
.then((meta) => meta ? { ...meta, image: safeHttpUrl(meta.image), favicon: safeHttpUrl(meta.favicon) } : null)
|
|
58
|
+
.catch(() => null)
|
|
59
|
+
.finally(() => clearTimeout(timer));
|
|
60
|
+
if (cache.size >= LINK_PREVIEW_CACHE_SIZE) {
|
|
61
|
+
const oldest = cache.keys().next().value;
|
|
62
|
+
if (oldest !== undefined)
|
|
63
|
+
cache.delete(oldest);
|
|
64
|
+
}
|
|
65
|
+
cache.set(url, p);
|
|
66
|
+
return p;
|
|
67
|
+
}
|
|
68
|
+
/** Test seam. */
|
|
69
|
+
export function resetLinkPreviewCache() {
|
|
70
|
+
cache.clear();
|
|
71
|
+
}
|
package/dist/utils/logger.d.ts
CHANGED
package/dist/utils/logger.js
CHANGED