@convai/web-sdk 1.9.0-beta.0 → 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.
Files changed (342) hide show
  1. package/README.md +35 -43
  2. package/dist/core/AudioManager.d.ts +0 -1
  3. package/dist/core/AudioManager.js +0 -1
  4. package/dist/core/BlendshapeQueue.d.ts +0 -1
  5. package/dist/core/BlendshapeQueue.js +20 -6
  6. package/dist/core/CharacterRoster.d.ts +0 -1
  7. package/dist/core/CharacterRoster.js +0 -1
  8. package/dist/core/CharacterVersionManager.d.ts +0 -1
  9. package/dist/core/CharacterVersionManager.js +0 -1
  10. package/dist/core/ConnectionStateHandler.d.ts +0 -1
  11. package/dist/core/ConnectionStateHandler.js +5 -2
  12. package/dist/core/ConvaiClient.d.ts +66 -3
  13. package/dist/core/ConvaiClient.js +253 -20
  14. package/dist/core/ConvaiRoomError.d.ts +0 -1
  15. package/dist/core/ConvaiRoomError.js +20 -2
  16. package/dist/core/EventEmitter.d.ts +0 -1
  17. package/dist/core/EventEmitter.js +0 -1
  18. package/dist/core/MemoryManager.d.ts +0 -1
  19. package/dist/core/MemoryManager.js +0 -1
  20. package/dist/core/MessageHandler.d.ts +5 -3
  21. package/dist/core/MessageHandler.js +125 -47
  22. package/dist/core/SSESession.d.ts +13 -9
  23. package/dist/core/SSESession.js +240 -13
  24. package/dist/core/ScreenShareManager.d.ts +0 -1
  25. package/dist/core/ScreenShareManager.js +0 -1
  26. package/dist/core/VideoManager.d.ts +0 -1
  27. package/dist/core/VideoManager.js +0 -1
  28. package/dist/core/characterInfo.d.ts +45 -0
  29. package/dist/core/characterInfo.js +55 -0
  30. package/dist/core/characterReference.d.ts +0 -1
  31. package/dist/core/characterReference.js +0 -1
  32. package/dist/core/connectRequest.d.ts +0 -1
  33. package/dist/core/connectRequest.js +0 -1
  34. package/dist/core/contextUpdateRequest.d.ts +0 -1
  35. package/dist/core/contextUpdateRequest.js +0 -1
  36. package/dist/core/index.d.ts +6 -1
  37. package/dist/core/index.js +20 -1
  38. package/dist/core/logicalTurn.d.ts +0 -1
  39. package/dist/core/logicalTurn.js +0 -1
  40. package/dist/core/modelOutput.d.ts +0 -1
  41. package/dist/core/modelOutput.js +0 -1
  42. package/dist/core/publishedChat.d.ts +0 -1
  43. package/dist/core/publishedChat.js +0 -1
  44. package/dist/core/rosterRequest.d.ts +0 -1
  45. package/dist/core/rosterRequest.js +0 -1
  46. package/dist/core/rtviEnvelope.d.ts +5 -0
  47. package/dist/core/rtviEnvelope.js +9 -0
  48. package/dist/core/types.d.ts +241 -17
  49. package/dist/core/types.js +0 -1
  50. package/dist/core/videoSourceState.d.ts +0 -1
  51. package/dist/core/videoSourceState.js +0 -1
  52. package/dist/core/visionRequest.d.ts +0 -1
  53. package/dist/core/visionRequest.js +0 -1
  54. package/dist/embed/index.d.ts +20 -3
  55. package/dist/embed/index.js +20 -3
  56. package/dist/embed/publicationApi.d.ts +0 -1
  57. package/dist/embed/publicationApi.js +0 -1
  58. package/dist/index.d.ts +0 -1
  59. package/dist/index.js +0 -1
  60. package/dist/lipsync-helpers/arkitOrder61.d.ts +0 -1
  61. package/dist/lipsync-helpers/arkitOrder61.js +5 -3
  62. package/dist/lipsync-helpers/createBlendshapeQueue.d.ts +0 -1
  63. package/dist/lipsync-helpers/createBlendshapeQueue.js +7 -1
  64. package/dist/lipsync-helpers/declarativeMapping.d.ts +2 -1
  65. package/dist/lipsync-helpers/declarativeMapping.js +72 -146
  66. package/dist/lipsync-helpers/index.d.ts +0 -1
  67. package/dist/lipsync-helpers/index.js +0 -1
  68. package/dist/lipsync-helpers/mappingTypes.d.ts +6 -5
  69. package/dist/lipsync-helpers/mappingTypes.js +0 -1
  70. package/dist/lipsync-helpers/metahumanOrder251.d.ts +0 -1
  71. package/dist/lipsync-helpers/metahumanOrder251.js +8 -9
  72. package/dist/lipsync-helpers/mhaLimitDrivers.d.ts +0 -1
  73. package/dist/lipsync-helpers/mhaLimitDrivers.js +0 -1
  74. package/dist/lipsync-helpers/naturalness/processor.d.ts +0 -1
  75. package/dist/lipsync-helpers/naturalness/processor.js +6 -4
  76. package/dist/lipsync-helpers/naturalness/profiles/mha.d.ts +0 -1
  77. package/dist/lipsync-helpers/naturalness/profiles/mha.js +0 -1
  78. package/dist/lipsync-helpers/naturalness/types.d.ts +0 -1
  79. package/dist/lipsync-helpers/naturalness/types.js +0 -1
  80. package/dist/lipsync-helpers/presetMappers.d.ts +0 -1
  81. package/dist/lipsync-helpers/presetMappers.js +0 -1
  82. package/dist/react/components/ConvaiWidget.d.ts +9 -1
  83. package/dist/react/components/ConvaiWidget.js +23 -28
  84. package/dist/react/components/index.d.ts +0 -1
  85. package/dist/react/components/index.js +0 -1
  86. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts +0 -1
  87. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js +0 -1
  88. package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts +0 -1
  89. package/dist/react/components/rtc-widget/components/AudioVisualizer.js +0 -1
  90. package/dist/react/components/rtc-widget/components/ConviMessage.d.ts +4 -2
  91. package/dist/react/components/rtc-widget/components/ConviMessage.js +2 -3
  92. package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts +0 -1
  93. package/dist/react/components/rtc-widget/components/FloatingVideo.js +1 -3
  94. package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts +21 -4
  95. package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +114 -131
  96. package/dist/react/components/rtc-widget/components/MessageBubble.d.ts +0 -1
  97. package/dist/react/components/rtc-widget/components/MessageBubble.js +0 -1
  98. package/dist/react/components/rtc-widget/components/MessageList.d.ts +4 -2
  99. package/dist/react/components/rtc-widget/components/MessageList.js +2 -3
  100. package/dist/react/components/rtc-widget/components/SiteCard.d.ts +14 -0
  101. package/dist/react/components/rtc-widget/components/SiteCard.js +34 -0
  102. package/dist/react/components/rtc-widget/components/UserMessage.d.ts +0 -1
  103. package/dist/react/components/rtc-widget/components/UserMessage.js +1 -2
  104. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts +0 -1
  105. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js +0 -1
  106. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts +0 -1
  107. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js +1 -3
  108. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts +0 -1
  109. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js +1 -3
  110. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts +0 -1
  111. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js +1 -4
  112. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts +0 -1
  113. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +0 -1
  114. package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts +0 -1
  115. package/dist/react/components/rtc-widget/components/conviComponents/index.js +0 -1
  116. package/dist/react/components/rtc-widget/components/index.d.ts +0 -1
  117. package/dist/react/components/rtc-widget/components/index.js +0 -1
  118. package/dist/react/components/rtc-widget/index.d.ts +0 -1
  119. package/dist/react/components/rtc-widget/index.js +0 -1
  120. package/dist/react/components/rtc-widget/styles/framerConfig.d.ts +0 -1
  121. package/dist/react/components/rtc-widget/styles/framerConfig.js +0 -1
  122. package/dist/react/components/rtc-widget/styles/icons.d.ts +0 -1
  123. package/dist/react/components/rtc-widget/styles/icons.js +0 -1
  124. package/dist/react/components/rtc-widget/styles/index.d.ts +0 -1
  125. package/dist/react/components/rtc-widget/styles/index.js +0 -1
  126. package/dist/react/components/rtc-widget/styles/styledComponents.d.ts +0 -1
  127. package/dist/react/components/rtc-widget/styles/styledComponents.js +0 -1
  128. package/dist/react/components/rtc-widget/styles/theme.d.ts +0 -1
  129. package/dist/react/components/rtc-widget/styles/theme.js +0 -1
  130. package/dist/react/components/rtc-widget/types/index.d.ts +0 -1
  131. package/dist/react/components/rtc-widget/types/index.js +0 -1
  132. package/dist/react/hooks/index.d.ts +0 -1
  133. package/dist/react/hooks/index.js +0 -1
  134. package/dist/react/hooks/useCharacterInfo.d.ts +12 -11
  135. package/dist/react/hooks/useCharacterInfo.js +49 -50
  136. package/dist/react/hooks/useConvaiClient.d.ts +0 -1
  137. package/dist/react/hooks/useConvaiClient.js +8 -5
  138. package/dist/react/hooks/useLocalCameraTrack.d.ts +0 -1
  139. package/dist/react/hooks/useLocalCameraTrack.js +0 -1
  140. package/dist/react/icons.d.ts +37 -0
  141. package/dist/react/icons.js +53 -0
  142. package/dist/react/index.d.ts +4 -1
  143. package/dist/react/index.js +2 -1
  144. package/dist/utils/inlineMarkdown.d.ts +0 -1
  145. package/dist/utils/inlineMarkdown.js +0 -1
  146. package/dist/utils/lightbox.d.ts +15 -0
  147. package/dist/utils/lightbox.js +94 -0
  148. package/dist/utils/linkPresentation.d.ts +75 -0
  149. package/dist/utils/linkPresentation.js +414 -0
  150. package/dist/utils/linkPreview.d.ts +45 -0
  151. package/dist/utils/linkPreview.js +71 -0
  152. package/dist/utils/logger.d.ts +0 -1
  153. package/dist/utils/logger.js +0 -1
  154. package/dist/vanilla/AudioRenderer.d.ts +0 -1
  155. package/dist/vanilla/AudioRenderer.js +0 -1
  156. package/dist/vanilla/ConvaiWidget.d.ts +0 -1
  157. package/dist/vanilla/ConvaiWidget.js +302 -226
  158. package/dist/vanilla/WebSocketSession.d.ts +0 -1
  159. package/dist/vanilla/WebSocketSession.js +0 -1
  160. package/dist/vanilla/WidgetEventSubscriptions.d.ts +0 -1
  161. package/dist/vanilla/WidgetEventSubscriptions.js +0 -1
  162. package/dist/vanilla/icons.d.ts +0 -1
  163. package/dist/vanilla/icons.js +0 -1
  164. package/dist/vanilla/index.d.ts +4 -1
  165. package/dist/vanilla/index.js +2 -1
  166. package/dist/vanilla/styles.d.ts +0 -1
  167. package/dist/vanilla/styles.js +9 -1
  168. package/dist/vanilla/types.d.ts +9 -1
  169. package/dist/vanilla/types.js +0 -1
  170. package/dist/vanilla/websocket.d.ts +0 -1
  171. package/dist/vanilla/websocket.js +0 -1
  172. package/dist/version.d.ts +1 -2
  173. package/dist/version.js +1 -2
  174. package/package.json +23 -28
  175. package/dist/core/AudioManager.d.ts.map +0 -1
  176. package/dist/core/AudioManager.js.map +0 -1
  177. package/dist/core/BlendshapeQueue.d.ts.map +0 -1
  178. package/dist/core/BlendshapeQueue.js.map +0 -1
  179. package/dist/core/CharacterRoster.d.ts.map +0 -1
  180. package/dist/core/CharacterRoster.js.map +0 -1
  181. package/dist/core/CharacterVersionManager.d.ts.map +0 -1
  182. package/dist/core/CharacterVersionManager.js.map +0 -1
  183. package/dist/core/ConnectionStateHandler.d.ts.map +0 -1
  184. package/dist/core/ConnectionStateHandler.js.map +0 -1
  185. package/dist/core/ConvaiClient.d.ts.map +0 -1
  186. package/dist/core/ConvaiClient.js.map +0 -1
  187. package/dist/core/ConvaiRoomError.d.ts.map +0 -1
  188. package/dist/core/ConvaiRoomError.js.map +0 -1
  189. package/dist/core/EventEmitter.d.ts.map +0 -1
  190. package/dist/core/EventEmitter.js.map +0 -1
  191. package/dist/core/MemoryManager.d.ts.map +0 -1
  192. package/dist/core/MemoryManager.js.map +0 -1
  193. package/dist/core/MessageHandler.d.ts.map +0 -1
  194. package/dist/core/MessageHandler.js.map +0 -1
  195. package/dist/core/SSESession.d.ts.map +0 -1
  196. package/dist/core/SSESession.js.map +0 -1
  197. package/dist/core/ScreenShareManager.d.ts.map +0 -1
  198. package/dist/core/ScreenShareManager.js.map +0 -1
  199. package/dist/core/VideoManager.d.ts.map +0 -1
  200. package/dist/core/VideoManager.js.map +0 -1
  201. package/dist/core/characterReference.d.ts.map +0 -1
  202. package/dist/core/characterReference.js.map +0 -1
  203. package/dist/core/connectRequest.d.ts.map +0 -1
  204. package/dist/core/connectRequest.js.map +0 -1
  205. package/dist/core/contextUpdateRequest.d.ts.map +0 -1
  206. package/dist/core/contextUpdateRequest.js.map +0 -1
  207. package/dist/core/index.d.ts.map +0 -1
  208. package/dist/core/index.js.map +0 -1
  209. package/dist/core/logicalTurn.d.ts.map +0 -1
  210. package/dist/core/logicalTurn.js.map +0 -1
  211. package/dist/core/modelOutput.d.ts.map +0 -1
  212. package/dist/core/modelOutput.js.map +0 -1
  213. package/dist/core/publishedChat.d.ts.map +0 -1
  214. package/dist/core/publishedChat.js.map +0 -1
  215. package/dist/core/rosterRequest.d.ts.map +0 -1
  216. package/dist/core/rosterRequest.js.map +0 -1
  217. package/dist/core/types.d.ts.map +0 -1
  218. package/dist/core/types.js.map +0 -1
  219. package/dist/core/videoSourceState.d.ts.map +0 -1
  220. package/dist/core/videoSourceState.js.map +0 -1
  221. package/dist/core/visionRequest.d.ts.map +0 -1
  222. package/dist/core/visionRequest.js.map +0 -1
  223. package/dist/embed/ConvaiChatElement.d.ts +0 -103
  224. package/dist/embed/ConvaiChatElement.d.ts.map +0 -1
  225. package/dist/embed/ConvaiChatElement.js +0 -679
  226. package/dist/embed/ConvaiChatElement.js.map +0 -1
  227. package/dist/embed/browser.d.ts +0 -3
  228. package/dist/embed/browser.d.ts.map +0 -1
  229. package/dist/embed/browser.js +0 -5
  230. package/dist/embed/browser.js.map +0 -1
  231. package/dist/embed/chat-embed-v1.js +0 -200
  232. package/dist/embed/chat-embed-v1.js.map +0 -7
  233. package/dist/embed/index.d.ts.map +0 -1
  234. package/dist/embed/index.js.map +0 -1
  235. package/dist/embed/publicationApi.d.ts.map +0 -1
  236. package/dist/embed/publicationApi.js.map +0 -1
  237. package/dist/index.d.ts.map +0 -1
  238. package/dist/index.js.map +0 -1
  239. package/dist/lipsync-helpers/arkitOrder61.d.ts.map +0 -1
  240. package/dist/lipsync-helpers/arkitOrder61.js.map +0 -1
  241. package/dist/lipsync-helpers/createBlendshapeQueue.d.ts.map +0 -1
  242. package/dist/lipsync-helpers/createBlendshapeQueue.js.map +0 -1
  243. package/dist/lipsync-helpers/declarativeMapping.d.ts.map +0 -1
  244. package/dist/lipsync-helpers/declarativeMapping.js.map +0 -1
  245. package/dist/lipsync-helpers/index.d.ts.map +0 -1
  246. package/dist/lipsync-helpers/index.js.map +0 -1
  247. package/dist/lipsync-helpers/mappingTypes.d.ts.map +0 -1
  248. package/dist/lipsync-helpers/mappingTypes.js.map +0 -1
  249. package/dist/lipsync-helpers/metahumanOrder251.d.ts.map +0 -1
  250. package/dist/lipsync-helpers/metahumanOrder251.js.map +0 -1
  251. package/dist/lipsync-helpers/mhaLimitDrivers.d.ts.map +0 -1
  252. package/dist/lipsync-helpers/mhaLimitDrivers.js.map +0 -1
  253. package/dist/lipsync-helpers/naturalness/processor.d.ts.map +0 -1
  254. package/dist/lipsync-helpers/naturalness/processor.js.map +0 -1
  255. package/dist/lipsync-helpers/naturalness/profiles/mha.d.ts.map +0 -1
  256. package/dist/lipsync-helpers/naturalness/profiles/mha.js.map +0 -1
  257. package/dist/lipsync-helpers/naturalness/types.d.ts.map +0 -1
  258. package/dist/lipsync-helpers/naturalness/types.js.map +0 -1
  259. package/dist/lipsync-helpers/presetMappers.d.ts.map +0 -1
  260. package/dist/lipsync-helpers/presetMappers.js.map +0 -1
  261. package/dist/react/components/ConvaiWidget.d.ts.map +0 -1
  262. package/dist/react/components/ConvaiWidget.js.map +0 -1
  263. package/dist/react/components/index.d.ts.map +0 -1
  264. package/dist/react/components/index.js.map +0 -1
  265. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts.map +0 -1
  266. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js.map +0 -1
  267. package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts.map +0 -1
  268. package/dist/react/components/rtc-widget/components/AudioVisualizer.js.map +0 -1
  269. package/dist/react/components/rtc-widget/components/ConviMessage.d.ts.map +0 -1
  270. package/dist/react/components/rtc-widget/components/ConviMessage.js.map +0 -1
  271. package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts.map +0 -1
  272. package/dist/react/components/rtc-widget/components/FloatingVideo.js.map +0 -1
  273. package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts.map +0 -1
  274. package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +0 -1
  275. package/dist/react/components/rtc-widget/components/MessageBubble.d.ts.map +0 -1
  276. package/dist/react/components/rtc-widget/components/MessageBubble.js.map +0 -1
  277. package/dist/react/components/rtc-widget/components/MessageList.d.ts.map +0 -1
  278. package/dist/react/components/rtc-widget/components/MessageList.js.map +0 -1
  279. package/dist/react/components/rtc-widget/components/UserMessage.d.ts.map +0 -1
  280. package/dist/react/components/rtc-widget/components/UserMessage.js.map +0 -1
  281. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts.map +0 -1
  282. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js.map +0 -1
  283. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts.map +0 -1
  284. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js.map +0 -1
  285. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts.map +0 -1
  286. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js.map +0 -1
  287. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts.map +0 -1
  288. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js.map +0 -1
  289. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts.map +0 -1
  290. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js.map +0 -1
  291. package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts.map +0 -1
  292. package/dist/react/components/rtc-widget/components/conviComponents/index.js.map +0 -1
  293. package/dist/react/components/rtc-widget/components/index.d.ts.map +0 -1
  294. package/dist/react/components/rtc-widget/components/index.js.map +0 -1
  295. package/dist/react/components/rtc-widget/index.d.ts.map +0 -1
  296. package/dist/react/components/rtc-widget/index.js.map +0 -1
  297. package/dist/react/components/rtc-widget/styles/framerConfig.d.ts.map +0 -1
  298. package/dist/react/components/rtc-widget/styles/framerConfig.js.map +0 -1
  299. package/dist/react/components/rtc-widget/styles/icons.d.ts.map +0 -1
  300. package/dist/react/components/rtc-widget/styles/icons.js.map +0 -1
  301. package/dist/react/components/rtc-widget/styles/index.d.ts.map +0 -1
  302. package/dist/react/components/rtc-widget/styles/index.js.map +0 -1
  303. package/dist/react/components/rtc-widget/styles/styledComponents.d.ts.map +0 -1
  304. package/dist/react/components/rtc-widget/styles/styledComponents.js.map +0 -1
  305. package/dist/react/components/rtc-widget/styles/theme.d.ts.map +0 -1
  306. package/dist/react/components/rtc-widget/styles/theme.js.map +0 -1
  307. package/dist/react/components/rtc-widget/types/index.d.ts.map +0 -1
  308. package/dist/react/components/rtc-widget/types/index.js.map +0 -1
  309. package/dist/react/hooks/index.d.ts.map +0 -1
  310. package/dist/react/hooks/index.js.map +0 -1
  311. package/dist/react/hooks/useCharacterInfo.d.ts.map +0 -1
  312. package/dist/react/hooks/useCharacterInfo.js.map +0 -1
  313. package/dist/react/hooks/useConvaiClient.d.ts.map +0 -1
  314. package/dist/react/hooks/useConvaiClient.js.map +0 -1
  315. package/dist/react/hooks/useLocalCameraTrack.d.ts.map +0 -1
  316. package/dist/react/hooks/useLocalCameraTrack.js.map +0 -1
  317. package/dist/react/index.d.ts.map +0 -1
  318. package/dist/react/index.js.map +0 -1
  319. package/dist/utils/inlineMarkdown.d.ts.map +0 -1
  320. package/dist/utils/inlineMarkdown.js.map +0 -1
  321. package/dist/utils/logger.d.ts.map +0 -1
  322. package/dist/utils/logger.js.map +0 -1
  323. package/dist/vanilla/AudioRenderer.d.ts.map +0 -1
  324. package/dist/vanilla/AudioRenderer.js.map +0 -1
  325. package/dist/vanilla/ConvaiWidget.d.ts.map +0 -1
  326. package/dist/vanilla/ConvaiWidget.js.map +0 -1
  327. package/dist/vanilla/WebSocketSession.d.ts.map +0 -1
  328. package/dist/vanilla/WebSocketSession.js.map +0 -1
  329. package/dist/vanilla/WidgetEventSubscriptions.d.ts.map +0 -1
  330. package/dist/vanilla/WidgetEventSubscriptions.js.map +0 -1
  331. package/dist/vanilla/icons.d.ts.map +0 -1
  332. package/dist/vanilla/icons.js.map +0 -1
  333. package/dist/vanilla/index.d.ts.map +0 -1
  334. package/dist/vanilla/index.js.map +0 -1
  335. package/dist/vanilla/styles.d.ts.map +0 -1
  336. package/dist/vanilla/styles.js.map +0 -1
  337. package/dist/vanilla/types.d.ts.map +0 -1
  338. package/dist/vanilla/types.js.map +0 -1
  339. package/dist/vanilla/websocket.d.ts.map +0 -1
  340. package/dist/vanilla/websocket.js.map +0 -1
  341. package/dist/version.d.ts.map +0 -1
  342. package/dist/version.js.map +0 -1
@@ -7,7 +7,11 @@ import { aeroTheme, injectGlobalStyles, injectKeyframes, } from "./styles.js";
7
7
  import { Icons } from "./icons.js";
8
8
  import { WidgetEventSubscriptions } from "./WidgetEventSubscriptions.js";
9
9
  import { ConvaiClient } from "../core/ConvaiClient.js";
10
+ import { fetchCharacterInfo as requestCharacterInfo } from "../core/characterInfo.js";
10
11
  import { parseInlineMarkdown, compactUrl } from "../utils/inlineMarkdown.js";
12
+ import { linkKindForUrl, describeUrl, fileNameOf, documentBadge, contactLabel, hoverTitle, isMixedContent, glyph, presentationStyles as S, toCssText, PREVIEW_TIMEOUT_MS, MAX_CARDS_PER_MESSAGE, } from "../utils/linkPresentation.js";
13
+ import { openLightbox } from "../utils/lightbox.js";
14
+ import { resolveLinkPreviewCached, isCardWorthy, siteNameFor, faviconFor, } from "../utils/linkPreview.js";
11
15
  import { freshPublicationGrantOptions } from "../core/publishedChat.js";
12
16
  /**
13
17
  * Positioning declarations for the widget root, keyed by `placement`. The
@@ -254,42 +258,30 @@ export function createConvaiWidget(container, options) {
254
258
  // uses when building /connect headers -- a client carrying both must
255
259
  // behave identically in both places.
256
260
  //
257
- // The two credentials travel in *different* headers: api.convai.com reads
258
- // an auth token from API-AUTH-TOKEN and an API key from X-API-Key, and
259
- // answers an API key sent as API-AUTH-TOKEN with `400 Your session has
260
- // expired.` Because the failure is swallowed below, sending the wrong one
261
- // showed up only as a header stuck on the fallback name.
261
+ // The two travel in *different* headers, which requestCharacterInfo
262
+ // handles: an auth token goes in API-AUTH-TOKEN, an API key in X-API-Key,
263
+ // and the host answers an API key sent as API-AUTH-TOKEN with `400 Your
264
+ // session has expired.` The failure is swallowed below, so getting it
265
+ // wrong showed up only as a header stuck on the fallback name.
262
266
  const credential = client.authToken ?? client.apiKey;
263
267
  if (!credential || !client.characterId)
264
268
  return;
265
- const headers = {
266
- "Content-Type": "application/json",
267
- };
268
- if (client.authToken) {
269
- headers["API-AUTH-TOKEN"] = client.authToken;
270
- }
271
- else {
272
- headers["X-API-Key"] = credential;
273
- }
269
+ // Same request as the React hook, because it is literally the same
270
+ // function now -- the two used to be hand-synced copies sharing a
271
+ // hardcoded host, which is what made this unconfigurable on-prem.
274
272
  try {
275
- const response = await fetch("https://api.convai.com/character/get", {
276
- method: "POST",
277
- headers,
278
- body: JSON.stringify({ charID: client.characterId }),
273
+ const info = await requestCharacterInfo({
274
+ characterId: client.characterId,
275
+ apiKey: credential,
276
+ authToken: client.authToken,
277
+ baseUrl: client.characterInfoUrl,
279
278
  });
280
- if (response.ok) {
281
- const data = await response.json();
282
- // Extract character name and image with fallbacks - matches React version
283
- characterName = data.character_name || "Convi";
284
- characterImage =
285
- data.model_details?.METAHUMAN?.avatar_image_square ||
286
- data.model_details?.METAHUMAN?.avatar_image ||
287
- data.model_details?.modelPlaceholder ||
288
- "";
289
- updateHeader();
290
- }
279
+ characterName = info.name;
280
+ characterImage = info.image ?? "";
281
+ updateHeader();
291
282
  }
292
283
  catch (error) {
284
+ // Cosmetic: keep the fallback header rather than surface this.
293
285
  console.error("Failed to fetch character info:", error);
294
286
  }
295
287
  };
@@ -1768,16 +1760,10 @@ export function createConvaiWidget(container, options) {
1768
1760
  // Microphone toggle removed - only controlled via voice mode now
1769
1761
  const handleToggleMute = () => {
1770
1762
  isMuted = !isMuted;
1771
- if (client.room) {
1772
- const remoteParticipants = Array.from(client.room.remoteParticipants.values());
1773
- remoteParticipants.forEach((participant) => {
1774
- participant.audioTrackPublications.forEach((publication) => {
1775
- if (publication.track) {
1776
- publication.track.setMuted(isMuted);
1777
- }
1778
- });
1779
- });
1780
- }
1763
+ // The client owns this now: it covers the WebSocket transport, which this
1764
+ // handler never did, and it holds the state so a reconnect or a joining
1765
+ // roster member does not come back audible.
1766
+ client.setCharacterMuted(isMuted);
1781
1767
  updateHeader();
1782
1768
  };
1783
1769
  const handleReset = async () => {
@@ -2074,217 +2060,308 @@ export function createConvaiWidget(container, options) {
2074
2060
  });
2075
2061
  };
2076
2062
  // Microphone button removed - only controlled via voice mode now
2077
- // Helper for Markdown - matches React MarkdownRenderer.tsx
2078
- // `media` renders inline image/video previews under a media link. Bot messages
2079
- // want them; the user's own bubble does not — you already know what you typed,
2080
- // and a preview there would let a URL a user pasted embed remote media into
2081
- // the transcript. Links stay clickable either way.
2063
+ // The bubble renderer. Everything visual comes from utils/linkPresentation
2064
+ // so this and the React MarkdownRenderer cannot drift; this only maps
2065
+ // tokenizer nodes onto DOM. `media` gates cards and chips: bot bubbles get
2066
+ // them, the user's own bubble keeps anchors only, so a pasted URL never
2067
+ // pulls remote media into the transcript.
2082
2068
  const renderMarkdown = (text, container, { media = true } = {}) => {
2083
2069
  if (!text)
2084
2070
  return;
2085
- // Handle both actual newlines and \n escape sequences
2086
- const normalizedText = text.replace(/\\n/g, "\n");
2087
- const lines = normalizedText.split("\n");
2088
- lines.forEach((line, lineIndex) => {
2089
- // Process markdown within each line
2090
- // Bold, italic, links, images and bare URLs — see utils/inlineMarkdown.
2091
- // `cdn.example.com/a/b/c.png` -> `cdn.example.com · c.png`
2092
- const describeUrl = (url) => {
2093
- try {
2094
- const { host, pathname } = new URL(url);
2095
- const file = pathname.split("/").filter(Boolean).pop();
2096
- return file ? `${host} · ${file}` : host;
2071
+ // Handle both actual newlines and literal "\n" sequences.
2072
+ const lines = text.replace(/\\n/g, "\n").split("\n");
2073
+ // Cards drawn so far in this message, against MAX_CARDS_PER_MESSAGE.
2074
+ const budget = { cards: 0 };
2075
+ const make = (tag, part, ...styles) => {
2076
+ const node = document.createElement(tag);
2077
+ node.setAttribute("part", part);
2078
+ node.style.cssText = toCssText(Object.assign({}, ...styles));
2079
+ return node;
2080
+ };
2081
+ // Inline styles cannot express :focus-visible, so the ring is toggled by hand.
2082
+ const focusRing = (node) => {
2083
+ const base = node.style.cssText;
2084
+ node.addEventListener("focus", () => {
2085
+ if (node.matches(":focus-visible"))
2086
+ node.style.cssText = `${base} ${toCssText(S.linkFocus)}`;
2087
+ });
2088
+ node.addEventListener("blur", () => {
2089
+ node.style.cssText = base;
2090
+ });
2091
+ };
2092
+ const anchor = (href, kind, label) => {
2093
+ const a = make("a", "message-link", S.link);
2094
+ a.href = href;
2095
+ a.target = "_blank";
2096
+ a.rel = "noopener noreferrer";
2097
+ // A bare URL is its own label and may be elided for display; the title
2098
+ // compares against what is shown so the full target is one hover away.
2099
+ const display = label === href ? compactUrl(label) : label;
2100
+ a.textContent = display;
2101
+ const title = hoverTitle(kind, href, display);
2102
+ if (title)
2103
+ a.title = title;
2104
+ if (kind === "ftp") {
2105
+ const badge = make("span", "message-link-badge", S.badge);
2106
+ badge.textContent = "FTP";
2107
+ a.appendChild(badge);
2108
+ }
2109
+ focusRing(a);
2110
+ return a;
2111
+ };
2112
+ const contactChip = (href, kind) => {
2113
+ const a = make("a", "message-contact", S.contact);
2114
+ a.href = href;
2115
+ a.title = hoverTitle(kind, href, href);
2116
+ const g = make("span", "message-contact-glyph", S.contactGlyph);
2117
+ g.innerHTML = glyph(kind);
2118
+ const t = document.createElement("span");
2119
+ t.textContent = contactLabel(href);
2120
+ a.append(g, t);
2121
+ focusRing(a);
2122
+ return a;
2123
+ };
2124
+ const documentCard = (href) => {
2125
+ let host = "";
2126
+ try {
2127
+ host = new URL(href).host;
2128
+ }
2129
+ catch {
2130
+ /* keep empty */
2131
+ }
2132
+ const a = make("a", "message-file-card", S.fileCard);
2133
+ a.href = href;
2134
+ a.target = "_blank";
2135
+ a.rel = "noopener noreferrer";
2136
+ a.title = href;
2137
+ const icon = make("span", "message-file-icon", S.fileIcon);
2138
+ icon.textContent = documentBadge(href);
2139
+ const body = document.createElement("span");
2140
+ body.style.cssText = toCssText(S.fileBody);
2141
+ const name = make("span", "message-file-name", S.fileName);
2142
+ name.textContent = fileNameOf(href);
2143
+ const meta = make("span", "message-file-meta", S.fileMeta);
2144
+ meta.textContent = `${host} · Opens in a new tab`;
2145
+ body.append(name, meta);
2146
+ a.append(icon, body);
2147
+ focusRing(a);
2148
+ return a;
2149
+ };
2150
+ /**
2151
+ * Open Graph card under a plain web link. A comment node holds the place
2152
+ * until the host's resolver settles; it is replaced only when the result
2153
+ * has a title or an image, so nothing flashes for the many links that
2154
+ * resolve to nothing card-worthy. Resolver text becomes text nodes only.
2155
+ */
2156
+ const siteCard = (href) => {
2157
+ const resolver = options.linkPreviewResolver;
2158
+ const slot = document.createComment("site-card");
2159
+ if (!resolver)
2160
+ return slot;
2161
+ resolveLinkPreviewCached(resolver, href).then((meta) => {
2162
+ if (!isCardWorthy(meta) || !slot.parentNode)
2163
+ return;
2164
+ const a = make("a", "message-site-card", S.siteCard);
2165
+ a.href = href;
2166
+ a.target = "_blank";
2167
+ a.rel = "noopener noreferrer";
2168
+ const header = document.createElement("span");
2169
+ header.style.cssText = toCssText(S.siteHeader);
2170
+ const favicon = faviconFor(meta, href);
2171
+ if (favicon) {
2172
+ const icon = make("img", "message-site-favicon", S.siteFavicon);
2173
+ icon.src = favicon;
2174
+ icon.alt = "";
2175
+ icon.addEventListener("error", () => icon.remove());
2176
+ header.appendChild(icon);
2097
2177
  }
2098
- catch {
2099
- return url;
2178
+ const name = make("span", "message-site-name", S.siteName);
2179
+ name.textContent = siteNameFor(meta, href);
2180
+ header.appendChild(name);
2181
+ a.appendChild(header);
2182
+ if (meta.title) {
2183
+ const t = make("span", "message-site-title", S.siteTitle);
2184
+ t.textContent = meta.title;
2185
+ a.appendChild(t);
2100
2186
  }
2101
- };
2102
- /**
2103
- * A preview card that reserves its space before the media arrives, so the
2104
- * bubble does not jump when an image decodes, and collapses to one muted
2105
- * line if the URL does not resolve — a character can easily invent one,
2106
- * and an empty player in the transcript reads as a broken widget.
2107
- *
2108
- * Chrome is derived from the inherited text colour: the widget is embedded
2109
- * in someone else's page, on a background this code cannot know.
2110
- */
2111
- const mediaPreview = (src, alt, media) => {
2112
- const card = document.createElement("span");
2113
- card.setAttribute("part", "message-media-card");
2114
- card.style.cssText = `
2115
- display: block;
2116
- position: relative;
2117
- margin-top: 6px;
2118
- max-width: 320px;
2119
- aspect-ratio: 16 / 10;
2120
- border-radius: 8px;
2121
- overflow: hidden;
2122
- background: color-mix(in srgb, currentColor 6%, transparent);
2123
- box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 10%, transparent);
2124
- `;
2125
- const el = media === "image"
2126
- ? Object.assign(document.createElement("img"), { src, alt, loading: "lazy" })
2127
- : Object.assign(document.createElement("video"), { src, controls: true, preload: "metadata" });
2128
- el.setAttribute("part", "message-media");
2129
- el.style.cssText = `
2130
- display: block;
2131
- width: 100%;
2132
- height: 100%;
2133
- object-fit: ${media === "image" ? "cover" : "contain"};
2134
- border-radius: 8px;
2135
- opacity: 0;
2136
- transition: opacity .18s ease;
2137
- `;
2138
- const skeleton = document.createElement("span");
2139
- skeleton.setAttribute("part", "message-media-skeleton");
2140
- skeleton.setAttribute("aria-hidden", "true");
2141
- skeleton.dataset.convaiSkeleton = "";
2142
- skeleton.style.cssText = `
2143
- position: absolute;
2144
- inset: 0;
2145
- border-radius: 8px;
2146
- background: color-mix(in srgb, currentColor 8%, transparent);
2147
- background-image: linear-gradient(90deg, transparent, color-mix(in srgb, currentColor 12%, transparent), transparent);
2148
- background-size: 200% 100%;
2149
- animation: convai-preview-shimmer 1.4s ease-in-out infinite;
2150
- `;
2151
- const caption = document.createElement("span");
2152
- caption.setAttribute("part", "message-media-caption");
2153
- caption.textContent = describeUrl(src);
2154
- caption.style.cssText = `
2155
- display: block;
2156
- margin-top: 4px;
2157
- font-size: 11px;
2158
- opacity: .7;
2159
- white-space: nowrap;
2160
- overflow: hidden;
2161
- text-overflow: ellipsis;
2162
- `;
2163
- const settled = () => {
2164
- el.style.opacity = "1";
2165
- skeleton.remove();
2166
- };
2167
- el.addEventListener(media === "image" ? "load" : "loadedmetadata", settled);
2168
- el.addEventListener("error", () => {
2169
- const dead = document.createElement("span");
2170
- dead.setAttribute("part", "message-media-unavailable");
2171
- dead.textContent = `Preview unavailable — ${describeUrl(src)}`;
2172
- dead.style.cssText = `
2173
- display: block;
2174
- margin-top: 6px;
2175
- font-size: 11px;
2176
- opacity: .55;
2177
- font-style: italic;
2178
- white-space: nowrap;
2179
- overflow: hidden;
2180
- text-overflow: ellipsis;
2181
- `;
2182
- card.replaceWith(dead);
2183
- caption.remove();
2184
- });
2185
- card.appendChild(el);
2186
- card.appendChild(skeleton);
2187
- const frag = document.createDocumentFragment();
2188
- frag.appendChild(card);
2189
- frag.appendChild(caption);
2187
+ if (meta.description) {
2188
+ const d = make("span", "message-site-description", S.siteDescription);
2189
+ d.textContent = meta.description;
2190
+ a.appendChild(d);
2191
+ }
2192
+ if (meta.image) {
2193
+ const img = make("img", "message-site-image", S.siteImage);
2194
+ img.src = meta.image;
2195
+ img.alt = "";
2196
+ img.loading = "lazy";
2197
+ img.addEventListener("error", () => img.remove());
2198
+ a.appendChild(img);
2199
+ }
2200
+ focusRing(a);
2201
+ slot.replaceWith(a);
2202
+ });
2203
+ return slot;
2204
+ };
2205
+ const unavailable = (src, insecure) => {
2206
+ const dead = make("span", "message-media-unavailable", S.unavailable);
2207
+ dead.textContent = `Preview unavailable — ${describeUrl(src)}${insecure ? " (insecure URL)" : ""}`;
2208
+ return dead;
2209
+ };
2210
+ /**
2211
+ * Image or video card. The element is created up front so the fetch starts
2212
+ * immediately; a skeleton covers it until it decodes. Error, timeout, or an
2213
+ * insecure URL collapse the card to one muted line — a character can
2214
+ * invent a URL, and an empty player in the transcript reads as a broken
2215
+ * widget.
2216
+ */
2217
+ const mediaPreview = (src, alt, kind) => {
2218
+ const frag = document.createDocumentFragment();
2219
+ if (isMixedContent(src)) {
2220
+ frag.appendChild(unavailable(src, true));
2190
2221
  return frag;
2222
+ }
2223
+ const card = make("span", "message-media-card", S.card, kind === "image" ? S.cardButton : {});
2224
+ const el = kind === "image"
2225
+ ? Object.assign(document.createElement("img"), { src, alt, loading: "lazy" })
2226
+ : Object.assign(document.createElement("video"), { src, controls: true, preload: "metadata" });
2227
+ el.setAttribute("part", "message-media");
2228
+ el.style.cssText = toCssText(Object.assign({}, S.media, kind === "video" ? S.videoMedia : {}, { opacity: 0 }));
2229
+ const skeleton = make("span", "message-media-skeleton", S.skeleton);
2230
+ skeleton.setAttribute("aria-hidden", "true");
2231
+ skeleton.dataset.convaiSkeleton = "";
2232
+ const caption = make("span", "message-media-caption", S.caption);
2233
+ caption.textContent = describeUrl(src);
2234
+ const fail = () => {
2235
+ clearTimeout(timer);
2236
+ card.replaceWith(unavailable(src, false));
2237
+ caption.remove();
2238
+ };
2239
+ const settled = () => {
2240
+ clearTimeout(timer);
2241
+ el.style.opacity = "1";
2242
+ skeleton.remove();
2243
+ if (kind === "image") {
2244
+ const zoom = make("span", "message-media-zoom", S.zoom);
2245
+ zoom.innerHTML = glyph("zoom");
2246
+ card.appendChild(zoom);
2247
+ }
2191
2248
  };
2192
- const processLine = (text) => {
2193
- const parts = [];
2194
- for (const node of parseInlineMarkdown(text)) {
2195
- switch (node.kind) {
2196
- case "strong": {
2197
- // matches React UserBubble styling
2198
- const strong = document.createElement("strong");
2199
- strong.textContent = node.text;
2200
- strong.style.cssText = `
2249
+ const timer = setTimeout(fail, PREVIEW_TIMEOUT_MS);
2250
+ el.addEventListener(kind === "image" ? "load" : "loadedmetadata", settled);
2251
+ el.addEventListener("error", fail);
2252
+ if (kind === "image") {
2253
+ card.setAttribute("role", "button");
2254
+ card.tabIndex = 0;
2255
+ card.setAttribute("aria-label", `Open image: ${fileNameOf(src)}`);
2256
+ const open = () => openLightbox({
2257
+ src,
2258
+ alt,
2259
+ caption: describeUrl(src),
2260
+ href: src,
2261
+ root: styleTarget,
2262
+ returnFocusTo: card,
2263
+ });
2264
+ card.addEventListener("click", open);
2265
+ card.addEventListener("keydown", (e) => {
2266
+ if (e.key === "Enter" || e.key === " ") {
2267
+ e.preventDefault();
2268
+ open();
2269
+ }
2270
+ });
2271
+ }
2272
+ card.append(el, skeleton);
2273
+ frag.append(card, caption);
2274
+ return frag;
2275
+ };
2276
+ const processLine = (line) => {
2277
+ const parts = [];
2278
+ for (const node of parseInlineMarkdown(line)) {
2279
+ switch (node.kind) {
2280
+ case "strong": {
2281
+ // matches React UserBubble styling
2282
+ const strong = document.createElement("strong");
2283
+ strong.textContent = node.text;
2284
+ strong.style.cssText = `
2201
2285
  font-weight: 600;
2202
2286
  color: var(--convai-panel-fg, ${aeroTheme.colors.text.primary});
2203
2287
  `;
2204
- parts.push(strong);
2205
- break;
2288
+ parts.push(strong);
2289
+ break;
2290
+ }
2291
+ case "em": {
2292
+ const em = document.createElement("em");
2293
+ em.textContent = node.text;
2294
+ em.style.cssText = `font-style: italic;`;
2295
+ parts.push(em);
2296
+ break;
2297
+ }
2298
+ case "blocked": {
2299
+ // Not an anchor, ever. The label reads as the character wrote it;
2300
+ // the target is only revealed on hover.
2301
+ const blocked = make("span", "message-link-blocked", S.blocked);
2302
+ blocked.textContent = node.label;
2303
+ blocked.title = `Link blocked: ${node.href}`;
2304
+ parts.push(blocked);
2305
+ break;
2306
+ }
2307
+ case "image": {
2308
+ if (media && budget.cards < MAX_CARDS_PER_MESSAGE) {
2309
+ budget.cards++;
2310
+ parts.push(mediaPreview(node.src, node.alt, "image"));
2206
2311
  }
2207
- case "em": {
2208
- const em = document.createElement("em");
2209
- em.textContent = node.text;
2210
- em.style.cssText = `font-style: italic;`;
2211
- parts.push(em);
2212
- break;
2312
+ else {
2313
+ // With previews off (or the budget spent), an image still has to
2314
+ // say what it pointed at, so it degrades to a plain anchor.
2315
+ parts.push(anchor(node.src, "image", node.alt || node.src));
2213
2316
  }
2214
- case "link": {
2215
- const a = document.createElement("a");
2216
- a.href = node.href;
2217
- a.textContent = node.label === node.href ? compactUrl(node.label) : node.label;
2218
- a.target = "_blank";
2219
- a.rel = "noopener noreferrer";
2220
- a.setAttribute("part", "message-link");
2221
- a.style.cssText = `
2222
- color: #10b981;
2223
- text-decoration: underline;
2224
- word-break: break-all;
2225
- `;
2226
- parts.push(a);
2227
- if (media && node.media)
2228
- parts.push(mediaPreview(node.href, node.label, node.media));
2317
+ break;
2318
+ }
2319
+ case "link": {
2320
+ const kind = linkKindForUrl(node.href);
2321
+ if (kind === "email" || kind === "phone" || kind === "sms") {
2322
+ parts.push(media ? contactChip(node.href, kind) : anchor(node.href, kind, node.label));
2229
2323
  break;
2230
2324
  }
2231
- case "blocked": {
2232
- const blocked = document.createElement("span");
2233
- blocked.setAttribute("part", "message-link-blocked");
2234
- blocked.textContent = node.label;
2235
- blocked.title = `Link blocked: ${node.href}`;
2236
- blocked.style.cssText = `
2237
- opacity: .75;
2238
- text-decoration: underline dotted;
2239
- cursor: help;
2240
- `;
2241
- parts.push(blocked);
2325
+ parts.push(anchor(node.href, kind, node.label));
2326
+ // The budget is spent when the card mounts, not when it resolves,
2327
+ // so the cap stays deterministic for a message naming twenty pages.
2328
+ const wantsSiteCard = media &&
2329
+ kind === "web" &&
2330
+ !!options.linkPreviewResolver &&
2331
+ budget.cards < MAX_CARDS_PER_MESSAGE;
2332
+ if (wantsSiteCard) {
2333
+ budget.cards++;
2334
+ parts.push(siteCard(node.href));
2242
2335
  break;
2243
2336
  }
2244
- case "image": {
2245
- if (media) {
2246
- parts.push(mediaPreview(node.src, node.alt, "image"));
2247
- break;
2248
- }
2249
- // With previews off, an image still has to say what it pointed at,
2250
- // so it degrades to the same anchor a plain link would render.
2251
- const imgLink = document.createElement("a");
2252
- imgLink.href = node.src;
2253
- imgLink.textContent = node.alt || node.src;
2254
- imgLink.target = "_blank";
2255
- imgLink.rel = "noopener noreferrer";
2256
- imgLink.setAttribute("part", "message-link");
2257
- imgLink.style.cssText = `
2258
- color: #10b981;
2259
- text-decoration: underline;
2260
- word-break: break-all;
2261
- `;
2262
- parts.push(imgLink);
2337
+ const wantsCard = media &&
2338
+ (kind === "image" || kind === "video" || kind === "document") &&
2339
+ budget.cards < MAX_CARDS_PER_MESSAGE;
2340
+ if (!wantsCard)
2263
2341
  break;
2264
- }
2265
- default:
2266
- parts.push(document.createTextNode(node.text));
2342
+ budget.cards++;
2343
+ parts.push(kind === "document" ? documentCard(node.href) : mediaPreview(node.href, node.label, kind));
2344
+ break;
2267
2345
  }
2346
+ default:
2347
+ parts.push(document.createTextNode(node.text));
2268
2348
  }
2269
- return parts;
2270
- };
2271
- const processedLine = processLine(line);
2272
- // Handle empty lines (creates paragraph spacing)
2349
+ }
2350
+ return parts;
2351
+ };
2352
+ lines.forEach((line, lineIndex) => {
2353
+ // An empty line is paragraph spacing.
2273
2354
  if (line.trim() === "" && lineIndex > 0) {
2274
2355
  container.appendChild(document.createElement("br"));
2275
2356
  return;
2276
2357
  }
2277
- // Append the processed line
2278
- if (processedLine.length > 0) {
2279
- processedLine.forEach((part) => container.appendChild(part));
2280
- }
2281
- else {
2358
+ const processed = processLine(line);
2359
+ if (processed.length > 0)
2360
+ processed.forEach((p) => container.appendChild(p));
2361
+ else
2282
2362
  container.appendChild(document.createTextNode(line));
2283
- }
2284
- // Add line break between lines
2285
- if (lineIndex < lines.length - 1) {
2363
+ if (lineIndex < lines.length - 1)
2286
2364
  container.appendChild(document.createElement("br"));
2287
- }
2288
2365
  });
2289
2366
  };
2290
2367
  const updateMessageList = () => {
@@ -2787,4 +2864,3 @@ export function createConvaiWidget(container, options) {
2787
2864
  export function destroyConvaiWidget(widget) {
2788
2865
  widget.destroy();
2789
2866
  }
2790
- //# sourceMappingURL=ConvaiWidget.js.map
@@ -42,4 +42,3 @@ export declare class WebSocketSession extends EventEmitter {
42
42
  private _getLocalAudioTrack;
43
43
  private _setupMessageForwarding;
44
44
  }
45
- //# sourceMappingURL=WebSocketSession.d.ts.map
@@ -130,4 +130,3 @@ export class WebSocketSession extends EventEmitter {
130
130
  });
131
131
  }
132
132
  }
133
- //# sourceMappingURL=WebSocketSession.js.map
@@ -12,4 +12,3 @@ export declare class WidgetEventSubscriptions {
12
12
  unsubscribeAll(): void;
13
13
  }
14
14
  export {};
15
- //# sourceMappingURL=WidgetEventSubscriptions.d.ts.map
@@ -34,4 +34,3 @@ export class WidgetEventSubscriptions {
34
34
  }
35
35
  }
36
36
  }
37
- //# sourceMappingURL=WidgetEventSubscriptions.js.map
@@ -32,4 +32,3 @@ export declare const Icons: {
32
32
  * Helper to create icon wrapper div
33
33
  */
34
34
  export declare function createIconWrapper(icon: SVGSVGElement, size?: IconSize, color?: string, className?: string): HTMLDivElement;
35
- //# sourceMappingURL=icons.d.ts.map
@@ -266,4 +266,3 @@ export function createIconWrapper(icon, size = 'md', color, className) {
266
266
  wrapper.appendChild(icon);
267
267
  return wrapper;
268
268
  }
269
- //# sourceMappingURL=icons.js.map
@@ -36,5 +36,8 @@ export { createConvaiWidget, destroyConvaiWidget } from './ConvaiWidget.js';
36
36
  export * from '../core/types.js';
37
37
  export { parseInlineMarkdown, mediaKindForUrl, isSafeHref, compactUrl } from '../utils/inlineMarkdown.js';
38
38
  export type { InlineNode, MediaKind } from '../utils/inlineMarkdown.js';
39
+ export { linkKindForUrl, describeUrl } from '../utils/linkPresentation.js';
40
+ export type { LinkKind } from '../utils/linkPresentation.js';
41
+ export { resolveLinkPreviewCached, isCardWorthy, LINK_PREVIEW_TIMEOUT_MS } from '../utils/linkPreview.js';
42
+ export type { LinkPreviewMeta, LinkPreviewResolver } from '../utils/linkPreview.js';
39
43
  export type { VanillaWidget, VanillaWidgetOptions, WidgetPlacement, } from './types.js';
40
- //# sourceMappingURL=index.d.ts.map