@cossistant/react 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/_virtual/rolldown_runtime.js +19 -0
  2. package/conversation.d.ts +26 -3
  3. package/conversation.d.ts.map +1 -1
  4. package/hooks/index.d.ts +5 -3
  5. package/hooks/index.js +7 -5
  6. package/hooks/private/store/use-conversations-store.d.ts +8 -0
  7. package/hooks/private/store/use-conversations-store.d.ts.map +1 -1
  8. package/hooks/private/store/use-conversations-store.js +8 -0
  9. package/hooks/private/store/use-conversations-store.js.map +1 -1
  10. package/hooks/private/store/use-store-selector.d.ts +4 -0
  11. package/hooks/private/store/use-store-selector.d.ts.map +1 -1
  12. package/hooks/private/store/use-store-selector.js +5 -2
  13. package/hooks/private/store/use-store-selector.js.map +1 -1
  14. package/hooks/private/store/use-website-store.d.ts +4 -0
  15. package/hooks/private/store/use-website-store.d.ts.map +1 -1
  16. package/hooks/private/store/use-website-store.js +6 -3
  17. package/hooks/private/store/use-website-store.js.map +1 -1
  18. package/hooks/private/typing.d.ts +35 -0
  19. package/hooks/private/typing.d.ts.map +1 -0
  20. package/hooks/private/typing.js +49 -0
  21. package/hooks/private/typing.js.map +1 -0
  22. package/hooks/private/use-client-query.d.ts +5 -0
  23. package/hooks/private/use-client-query.d.ts.map +1 -1
  24. package/hooks/private/use-client-query.js +5 -0
  25. package/hooks/private/use-client-query.js.map +1 -1
  26. package/hooks/private/use-grouped-messages.d.ts +10 -4
  27. package/hooks/private/use-grouped-messages.d.ts.map +1 -1
  28. package/hooks/private/use-grouped-messages.js +24 -4
  29. package/hooks/private/use-grouped-messages.js.map +1 -1
  30. package/hooks/private/use-multimodal-input.d.ts.map +1 -1
  31. package/hooks/private/use-rest-client.d.ts.map +1 -1
  32. package/hooks/private/use-visitor-typing-reporter.d.ts +6 -0
  33. package/hooks/private/use-visitor-typing-reporter.d.ts.map +1 -1
  34. package/hooks/private/use-visitor-typing-reporter.js +6 -0
  35. package/hooks/private/use-visitor-typing-reporter.js.map +1 -1
  36. package/hooks/use-composer-refocus.d.ts.map +1 -1
  37. package/hooks/use-conversation-auto-seen.d.ts +9 -0
  38. package/hooks/use-conversation-auto-seen.d.ts.map +1 -1
  39. package/hooks/use-conversation-auto-seen.js +44 -3
  40. package/hooks/use-conversation-auto-seen.js.map +1 -1
  41. package/hooks/use-conversation-history-page.d.ts.map +1 -1
  42. package/hooks/use-conversation-history-page.js +16 -18
  43. package/hooks/use-conversation-history-page.js.map +1 -1
  44. package/hooks/use-conversation-lifecycle.d.ts.map +1 -1
  45. package/hooks/use-conversation-lifecycle.js +2 -4
  46. package/hooks/use-conversation-lifecycle.js.map +1 -1
  47. package/hooks/use-conversation-page.d.ts +6 -0
  48. package/hooks/use-conversation-page.d.ts.map +1 -1
  49. package/hooks/use-conversation-page.js +41 -3
  50. package/hooks/use-conversation-page.js.map +1 -1
  51. package/hooks/use-conversation-preview.d.ts +61 -0
  52. package/hooks/use-conversation-preview.d.ts.map +1 -0
  53. package/hooks/use-conversation-preview.js +173 -0
  54. package/hooks/use-conversation-preview.js.map +1 -0
  55. package/hooks/use-conversation-seen.d.ts +4 -0
  56. package/hooks/use-conversation-seen.d.ts.map +1 -1
  57. package/hooks/use-conversation-seen.js +4 -0
  58. package/hooks/use-conversation-seen.js.map +1 -1
  59. package/hooks/use-conversation-timeline-items.d.ts +4 -0
  60. package/hooks/use-conversation-timeline-items.d.ts.map +1 -1
  61. package/hooks/use-conversation-timeline-items.js +4 -0
  62. package/hooks/use-conversation-timeline-items.js.map +1 -1
  63. package/hooks/use-conversation-timeline.d.ts +32 -0
  64. package/hooks/use-conversation-timeline.d.ts.map +1 -0
  65. package/hooks/use-conversation-timeline.js +41 -0
  66. package/hooks/use-conversation-timeline.js.map +1 -0
  67. package/hooks/use-conversation-typing.d.ts +4 -0
  68. package/hooks/use-conversation-typing.d.ts.map +1 -1
  69. package/hooks/use-conversation-typing.js +4 -0
  70. package/hooks/use-conversation-typing.js.map +1 -1
  71. package/hooks/use-conversation.d.ts +11 -0
  72. package/hooks/use-conversation.d.ts.map +1 -1
  73. package/hooks/use-conversation.js +11 -0
  74. package/hooks/use-conversation.js.map +1 -1
  75. package/hooks/use-conversations.d.ts +12 -0
  76. package/hooks/use-conversations.d.ts.map +1 -1
  77. package/hooks/use-conversations.js +12 -0
  78. package/hooks/use-conversations.js.map +1 -1
  79. package/hooks/use-create-conversation.d.ts +5 -0
  80. package/hooks/use-create-conversation.d.ts.map +1 -1
  81. package/hooks/use-create-conversation.js +12 -9
  82. package/hooks/use-create-conversation.js.map +1 -1
  83. package/hooks/use-home-page.d.ts.map +1 -1
  84. package/hooks/use-home-page.js +6 -4
  85. package/hooks/use-home-page.js.map +1 -1
  86. package/hooks/use-message-composer.d.ts.map +1 -1
  87. package/hooks/use-realtime-support.d.ts.map +1 -1
  88. package/hooks/use-send-message.d.ts +9 -0
  89. package/hooks/use-send-message.d.ts.map +1 -1
  90. package/hooks/use-send-message.js +15 -13
  91. package/hooks/use-send-message.js.map +1 -1
  92. package/hooks/use-visitor.d.ts.map +1 -1
  93. package/hooks/use-visitor.js +28 -30
  94. package/hooks/use-visitor.js.map +1 -1
  95. package/hooks/use-window-visibility-focus.d.ts +4 -0
  96. package/hooks/use-window-visibility-focus.d.ts.map +1 -1
  97. package/hooks/use-window-visibility-focus.js +5 -2
  98. package/hooks/use-window-visibility-focus.js.map +1 -1
  99. package/identify-visitor.d.ts +12 -3
  100. package/identify-visitor.d.ts.map +1 -1
  101. package/identify-visitor.js +58 -9
  102. package/identify-visitor.js.map +1 -1
  103. package/index.d.ts +10 -7
  104. package/index.js +10 -9
  105. package/package.json +11 -16
  106. package/primitives/avatar/avatar.d.ts.map +1 -1
  107. package/primitives/avatar/fallback.d.ts.map +1 -1
  108. package/primitives/avatar/fallback.js +1 -3
  109. package/primitives/avatar/fallback.js.map +1 -1
  110. package/primitives/avatar/image.d.ts.map +1 -1
  111. package/primitives/avatar/index.d.ts +1 -0
  112. package/primitives/bubble.d.ts +2 -0
  113. package/primitives/bubble.d.ts.map +1 -1
  114. package/primitives/bubble.js +8 -2
  115. package/primitives/bubble.js.map +1 -1
  116. package/primitives/button.d.ts.map +1 -1
  117. package/primitives/conversation-timeline.d.ts.map +1 -1
  118. package/primitives/conversation-timeline.js +58 -5
  119. package/primitives/conversation-timeline.js.map +1 -1
  120. package/primitives/index.d.ts +1 -0
  121. package/primitives/index.parts.d.ts +1 -0
  122. package/primitives/multimodal-input.d.ts.map +1 -1
  123. package/primitives/timeline-item-group.d.ts +7 -7
  124. package/primitives/timeline-item-group.d.ts.map +1 -1
  125. package/primitives/timeline-item-group.js.map +1 -1
  126. package/primitives/timeline-item.d.ts +1 -1
  127. package/primitives/timeline-item.d.ts.map +1 -1
  128. package/primitives/timeline-item.js +7 -1
  129. package/primitives/timeline-item.js.map +1 -1
  130. package/primitives/window.d.ts +1 -1
  131. package/primitives/window.d.ts.map +1 -1
  132. package/primitives/window.js +4 -4
  133. package/primitives/window.js.map +1 -1
  134. package/provider.d.ts +23 -43
  135. package/provider.d.ts.map +1 -1
  136. package/provider.js +152 -49
  137. package/provider.js.map +1 -1
  138. package/realtime/event-filter.d.ts +4 -0
  139. package/realtime/event-filter.d.ts.map +1 -1
  140. package/realtime/event-filter.js +4 -0
  141. package/realtime/event-filter.js.map +1 -1
  142. package/realtime/index.js +1 -1
  143. package/realtime/provider.d.ts +7 -2
  144. package/realtime/provider.d.ts.map +1 -1
  145. package/realtime/provider.js +23 -1
  146. package/realtime/provider.js.map +1 -1
  147. package/realtime/seen-store.d.ts +13 -0
  148. package/realtime/seen-store.d.ts.map +1 -1
  149. package/realtime/seen-store.js +14 -2
  150. package/realtime/seen-store.js.map +1 -1
  151. package/realtime/support-provider.d.ts +1 -2
  152. package/realtime/support-provider.d.ts.map +1 -1
  153. package/realtime/support-provider.js +19 -20
  154. package/realtime/support-provider.js.map +1 -1
  155. package/realtime/typing-store.d.ts +18 -0
  156. package/realtime/typing-store.d.ts.map +1 -1
  157. package/realtime/typing-store.js +19 -2
  158. package/realtime/typing-store.js.map +1 -1
  159. package/realtime/use-realtime.d.ts +8 -4
  160. package/realtime/use-realtime.d.ts.map +1 -1
  161. package/realtime/use-realtime.js +4 -0
  162. package/realtime/use-realtime.js.map +1 -1
  163. package/realtime-events.d.ts +17 -3
  164. package/realtime-events.d.ts.map +1 -1
  165. package/schemas.d.ts +7 -1
  166. package/schemas.d.ts.map +1 -1
  167. package/support/components/avatar-stack.d.ts +8 -4
  168. package/support/components/avatar-stack.d.ts.map +1 -1
  169. package/support/components/avatar-stack.js +4 -0
  170. package/support/components/avatar-stack.js.map +1 -1
  171. package/support/components/avatar.d.ts +11 -6
  172. package/support/components/avatar.d.ts.map +1 -1
  173. package/support/components/avatar.js +4 -0
  174. package/support/components/avatar.js.map +1 -1
  175. package/support/components/bubble.d.ts.map +1 -1
  176. package/support/components/bubble.js +29 -6
  177. package/support/components/bubble.js.map +1 -1
  178. package/support/components/button.d.ts +8 -5
  179. package/support/components/button.d.ts.map +1 -1
  180. package/support/components/button.js +5 -1
  181. package/support/components/button.js.map +1 -1
  182. package/support/components/container.d.ts +0 -1
  183. package/support/components/container.d.ts.map +1 -1
  184. package/support/components/container.js +2 -8
  185. package/support/components/container.js.map +1 -1
  186. package/support/components/conversation-button-link.d.ts +8 -21
  187. package/support/components/conversation-button-link.d.ts.map +1 -1
  188. package/support/components/conversation-button-link.js +62 -178
  189. package/support/components/conversation-button-link.js.map +1 -1
  190. package/support/components/conversation-event.d.ts.map +1 -1
  191. package/support/components/conversation-event.js +4 -0
  192. package/support/components/conversation-event.js.map +1 -1
  193. package/support/components/conversation-timeline.d.ts +10 -1
  194. package/support/components/conversation-timeline.d.ts.map +1 -1
  195. package/support/components/conversation-timeline.js +63 -57
  196. package/support/components/conversation-timeline.js.map +1 -1
  197. package/support/components/cossistant-branding.d.ts +5 -2
  198. package/support/components/cossistant-branding.d.ts.map +1 -1
  199. package/support/components/cossistant-branding.js +3 -0
  200. package/support/components/cossistant-branding.js.map +1 -1
  201. package/support/components/header.d.ts.map +1 -1
  202. package/support/components/header.js +2 -2
  203. package/support/components/header.js.map +1 -1
  204. package/support/components/icons.d.ts.map +1 -1
  205. package/support/components/multimodal-input.d.ts.map +1 -1
  206. package/support/components/multimodal-input.js +5 -24
  207. package/support/components/multimodal-input.js.map +1 -1
  208. package/support/components/navigation-tab.d.ts +7 -2
  209. package/support/components/navigation-tab.d.ts.map +1 -1
  210. package/support/components/navigation-tab.js +4 -0
  211. package/support/components/navigation-tab.js.map +1 -1
  212. package/support/components/support-content.d.ts +1 -1
  213. package/support/components/support-content.d.ts.map +1 -1
  214. package/support/components/support-content.js +7 -10
  215. package/support/components/support-content.js.map +1 -1
  216. package/support/components/text-effect.d.ts +5 -2
  217. package/support/components/text-effect.d.ts.map +1 -1
  218. package/support/components/text-effect.js +4 -0
  219. package/support/components/text-effect.js.map +1 -1
  220. package/support/components/timeline-identification-tool.d.ts +7 -0
  221. package/support/components/timeline-identification-tool.d.ts.map +1 -0
  222. package/support/components/timeline-identification-tool.js +139 -0
  223. package/support/components/timeline-identification-tool.js.map +1 -0
  224. package/support/components/timeline-message-group.d.ts +2 -1
  225. package/support/components/timeline-message-group.d.ts.map +1 -1
  226. package/support/components/timeline-message-group.js +4 -19
  227. package/support/components/timeline-message-group.js.map +1 -1
  228. package/support/components/timeline-message-item.d.ts +6 -2
  229. package/support/components/timeline-message-item.d.ts.map +1 -1
  230. package/support/components/timeline-message-item.js +8 -4
  231. package/support/components/timeline-message-item.js.map +1 -1
  232. package/support/components/typing-indicator.d.ts +5 -2
  233. package/support/components/typing-indicator.d.ts.map +1 -1
  234. package/support/components/typing-indicator.js +4 -4
  235. package/support/components/typing-indicator.js.map +1 -1
  236. package/support/components/watermark.d.ts.map +1 -1
  237. package/support/context/websocket.d.ts +8 -0
  238. package/support/context/websocket.d.ts.map +1 -1
  239. package/support/context/websocket.js +12 -6
  240. package/support/context/websocket.js.map +1 -1
  241. package/support/index.d.ts +8 -8
  242. package/support/index.d.ts.map +1 -1
  243. package/support/index.js +18 -18
  244. package/support/index.js.map +1 -1
  245. package/support/pages/conversation-history.js +46 -54
  246. package/support/pages/conversation-history.js.map +1 -1
  247. package/support/pages/conversation.d.ts +3 -6
  248. package/support/pages/conversation.d.ts.map +1 -1
  249. package/support/pages/conversation.js +19 -9
  250. package/support/pages/conversation.js.map +1 -1
  251. package/support/pages/home.d.ts +2 -2
  252. package/support/pages/home.d.ts.map +1 -1
  253. package/support/pages/home.js +64 -77
  254. package/support/pages/home.js.map +1 -1
  255. package/support/store/support-store.d.ts +18 -2
  256. package/support/store/support-store.d.ts.map +1 -1
  257. package/support/store/support-store.js +20 -5
  258. package/support/store/support-store.js.map +1 -1
  259. package/support/{support-CMoDLQoC.css → support-Ck4jy29i.css} +1 -2
  260. package/support/support-Ck4jy29i.css.map +1 -0
  261. package/support/text/index.d.ts +15 -2
  262. package/support/text/index.d.ts.map +1 -1
  263. package/support/text/index.js +15 -2
  264. package/support/text/index.js.map +1 -1
  265. package/support/text/locales/en.js +22 -4
  266. package/support/text/locales/en.js.map +1 -1
  267. package/support/text/locales/es.js +18 -0
  268. package/support/text/locales/es.js.map +1 -1
  269. package/support/text/locales/fr.js +18 -0
  270. package/support/text/locales/fr.js.map +1 -1
  271. package/support/text/locales/keys.d.ts +69 -9
  272. package/support/text/locales/keys.d.ts.map +1 -1
  273. package/support/text/locales/keys.js +18 -0
  274. package/support/text/locales/keys.js.map +1 -1
  275. package/support/text/runtime.d.ts +21 -0
  276. package/support/text/runtime.d.ts.map +1 -1
  277. package/support/text/runtime.js +21 -0
  278. package/support/text/runtime.js.map +1 -1
  279. package/support/utils/index.d.ts +4 -0
  280. package/support/utils/index.d.ts.map +1 -1
  281. package/support/utils/index.js +4 -1
  282. package/support/utils/index.js.map +1 -1
  283. package/support/utils/time.d.ts +3 -0
  284. package/support/utils/time.d.ts.map +1 -1
  285. package/support/utils/time.js +3 -0
  286. package/support/utils/time.js.map +1 -1
  287. package/support-config.d.ts +2 -1
  288. package/support-config.d.ts.map +1 -1
  289. package/support-config.js.map +1 -1
  290. package/support.css +2 -2
  291. package/timeline-item.d.ts +10 -0
  292. package/timeline-item.d.ts.map +1 -1
  293. package/utils/conversation.d.ts +7 -0
  294. package/utils/conversation.d.ts.map +1 -0
  295. package/utils/conversation.js +18 -0
  296. package/utils/conversation.js.map +1 -0
  297. package/utils/id.d.ts +3 -0
  298. package/utils/id.d.ts.map +1 -1
  299. package/utils/id.js +3 -0
  300. package/utils/id.js.map +1 -1
  301. package/utils/index.d.ts +2 -1
  302. package/utils/index.js +2 -1
  303. package/utils/metadata-hash.d.ts +12 -0
  304. package/utils/metadata-hash.d.ts.map +1 -0
  305. package/utils/metadata-hash.js +26 -0
  306. package/utils/metadata-hash.js.map +1 -0
  307. package/utils/text.d.ts +3 -0
  308. package/utils/text.d.ts.map +1 -1
  309. package/utils/text.js +3 -0
  310. package/utils/text.js.map +1 -1
  311. package/utils/use-render-element.d.ts +3 -0
  312. package/utils/use-render-element.d.ts.map +1 -1
  313. package/utils/use-render-element.js +3 -0
  314. package/utils/use-render-element.js.map +1 -1
  315. package/support/context/config.d.ts +0 -32
  316. package/support/context/config.d.ts.map +0 -1
  317. package/support/context/config.js +0 -27
  318. package/support/context/config.js.map +0 -1
  319. package/support/support-CMoDLQoC.css.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"typing-indicator.js","names":["React"],"sources":["../../../src/support/components/typing-indicator.tsx"],"sourcesContent":["import type { AvailableAIAgent, AvailableHumanAgent } from \"@cossistant/types\";\nimport * as React from \"react\";\nimport { cn } from \"../utils\";\nimport { AvatarStack } from \"./avatar-stack\";\n\nexport type TypingParticipantType = \"visitor\" | \"team_member\" | \"ai\";\n\nexport type TypingParticipant = {\n\tid: string;\n\ttype: TypingParticipantType;\n};\n\nexport type TypingIndicatorProps = React.HTMLAttributes<HTMLDivElement> & {\n\tparticipants: TypingParticipant[];\n\tavailableAIAgents?: AvailableAIAgent[];\n\tavailableHumanAgents?: AvailableHumanAgent[];\n\twithAvatars?: boolean;\n};\n\nexport const BouncingDots = () => (\n\t<div className=\"flex gap-1\">\n\t\t<span className=\"dot-bounce-1 size-1 rounded-full bg-co-primary\" />\n\t\t<span className=\"dot-bounce-2 size-1 rounded-full bg-co-primary\" />\n\t\t<span className=\"dot-bounce-3 size-1 rounded-full bg-co-primary\" />\n\t</div>\n);\n\nexport const TypingIndicator = React.forwardRef<\n\tHTMLDivElement,\n\tTypingIndicatorProps\n>(\n\t(\n\t\t{\n\t\t\tparticipants,\n\t\t\tavailableAIAgents = [],\n\t\t\tavailableHumanAgents = [],\n\t\t\twithAvatars = true,\n\t\t\tclassName,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tif (!participants || participants.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Separate AI and human participants\n\t\tconst humanParticipantIds = participants\n\t\t\t.filter((p) => p.type === \"team_member\")\n\t\t\t.map((p) => p.id);\n\n\t\tconst aiParticipantIds = participants\n\t\t\t.filter((p) => p.type === \"ai\")\n\t\t\t.map((p) => p.id);\n\n\t\t// Get matching agents\n\t\tconst typingHumanAgents = availableHumanAgents.filter((agent) =>\n\t\t\thumanParticipantIds.includes(agent.id)\n\t\t);\n\n\t\tconst typingAIAgents = availableAIAgents.filter((agent) =>\n\t\t\taiParticipantIds.includes(agent.id)\n\t\t);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={cn(\"flex items-center gap-6\", className)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{withAvatars && (\n\t\t\t\t\t<AvatarStack\n\t\t\t\t\t\taiAgents={typingAIAgents}\n\t\t\t\t\t\thumanAgents={typingHumanAgents}\n\t\t\t\t\t\tsize={24}\n\t\t\t\t\t\tspacing={16}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<BouncingDots />\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nTypingIndicator.displayName = \"TypingIndicator\";\n"],"mappings":";;;;;;AAmBA,MAAa,qBACZ,qBAAC;CAAI,WAAU;;EACd,oBAAC,UAAK,WAAU,mDAAmD;EACnE,oBAAC,UAAK,WAAU,mDAAmD;EACnE,oBAAC,UAAK,WAAU,mDAAmD;;EAC9D;AAGP,MAAa,kBAAkBA,QAAM,YAKnC,EACC,cACA,oBAAoB,EAAE,EACtB,uBAAuB,EAAE,EACzB,cAAc,MACd,UACA,GAAG,SAEJ,QACI;AACJ,KAAI,CAAC,gBAAgB,aAAa,WAAW,EAC5C,QAAO;CAIR,MAAM,sBAAsB,aAC1B,QAAQ,MAAM,EAAE,SAAS,cAAc,CACvC,KAAK,MAAM,EAAE,GAAG;CAElB,MAAM,mBAAmB,aACvB,QAAQ,MAAM,EAAE,SAAS,KAAK,CAC9B,KAAK,MAAM,EAAE,GAAG;CAGlB,MAAM,oBAAoB,qBAAqB,QAAQ,UACtD,oBAAoB,SAAS,MAAM,GAAG,CACtC;CAED,MAAM,iBAAiB,kBAAkB,QAAQ,UAChD,iBAAiB,SAAS,MAAM,GAAG,CACnC;AAED,QACC,qBAAC;EACA,WAAW,GAAG,2BAA2B,UAAU;EAC9C;EACL,GAAI;aAEH,eACA,oBAAC;GACA,UAAU;GACV,aAAa;GACb,MAAM;GACN,SAAS;IACR,EAEH,oBAAC,iBAAe;GACX;EAGR;AAED,gBAAgB,cAAc"}
1
+ {"version":3,"file":"typing-indicator.js","names":["React"],"sources":["../../../src/support/components/typing-indicator.tsx"],"sourcesContent":["import type { AvailableAIAgent, AvailableHumanAgent } from \"@cossistant/types\";\nimport * as React from \"react\";\nimport { cn } from \"../utils\";\nimport { AvatarStack } from \"./avatar-stack\";\n\nexport type TypingParticipantType = \"visitor\" | \"team_member\" | \"ai\";\n\nexport type TypingParticipant = {\n\tid: string;\n\ttype: TypingParticipantType;\n};\n\nexport type TypingIndicatorProps = React.HTMLAttributes<HTMLDivElement> & {\n\tparticipants: TypingParticipant[];\n\tavailableAIAgents?: AvailableAIAgent[];\n\tavailableHumanAgents?: AvailableHumanAgent[];\n\twithAvatars?: boolean;\n};\n\nexport const BouncingDots = ({\n\tclassName,\n}: {\n\tclassName?: string;\n}): React.ReactElement => (\n\t<div className=\"flex gap-1\">\n\t\t<span\n\t\t\tclassName={cn(\n\t\t\t\t\"dot-bounce-1 size-1 rounded-full bg-co-primary\",\n\t\t\t\tclassName\n\t\t\t)}\n\t\t/>\n\t\t<span\n\t\t\tclassName={cn(\n\t\t\t\t\"dot-bounce-2 size-1 rounded-full bg-co-primary\",\n\t\t\t\tclassName\n\t\t\t)}\n\t\t/>\n\t\t<span\n\t\t\tclassName={cn(\n\t\t\t\t\"dot-bounce-3 size-1 rounded-full bg-co-primary\",\n\t\t\t\tclassName\n\t\t\t)}\n\t\t/>\n\t</div>\n);\n\nexport const TypingIndicator = React.forwardRef<\n\tHTMLDivElement,\n\tTypingIndicatorProps\n>(\n\t(\n\t\t{\n\t\t\tparticipants,\n\t\t\tavailableAIAgents = [],\n\t\t\tavailableHumanAgents = [],\n\t\t\twithAvatars = true,\n\t\t\tclassName,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tif (!participants || participants.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Separate AI and human participants\n\t\tconst humanParticipantIds = participants\n\t\t\t.filter((p) => p.type === \"team_member\")\n\t\t\t.map((p) => p.id);\n\n\t\tconst aiParticipantIds = participants\n\t\t\t.filter((p) => p.type === \"ai\")\n\t\t\t.map((p) => p.id);\n\n\t\t// Get matching agents\n\t\tconst typingHumanAgents = availableHumanAgents.filter((agent) =>\n\t\t\thumanParticipantIds.includes(agent.id)\n\t\t);\n\n\t\tconst typingAIAgents = availableAIAgents.filter((agent) =>\n\t\t\taiParticipantIds.includes(agent.id)\n\t\t);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={cn(\"flex items-center gap-6\", className)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{withAvatars && (\n\t\t\t\t\t<AvatarStack\n\t\t\t\t\t\taiAgents={typingAIAgents}\n\t\t\t\t\t\thumanAgents={typingHumanAgents}\n\t\t\t\t\t\tsize={24}\n\t\t\t\t\t\tspacing={16}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<BouncingDots />\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nTypingIndicator.displayName = \"TypingIndicator\";\n"],"mappings":";;;;;;AAmBA,MAAa,gBAAgB,EAC5B,gBAIA,qBAAC;CAAI,WAAU;;EACd,oBAAC,UACA,WAAW,GACV,kDACA,UACA,GACA;EACF,oBAAC,UACA,WAAW,GACV,kDACA,UACA,GACA;EACF,oBAAC,UACA,WAAW,GACV,kDACA,UACA,GACA;;EACG;AAGP,MAAa,kBAAkBA,QAAM,YAKnC,EACC,cACA,oBAAoB,EAAE,EACtB,uBAAuB,EAAE,EACzB,cAAc,MACd,UACA,GAAG,SAEJ,QACI;AACJ,KAAI,CAAC,gBAAgB,aAAa,WAAW,EAC5C,QAAO;CAIR,MAAM,sBAAsB,aAC1B,QAAQ,MAAM,EAAE,SAAS,cAAc,CACvC,KAAK,MAAM,EAAE,GAAG;CAElB,MAAM,mBAAmB,aACvB,QAAQ,MAAM,EAAE,SAAS,KAAK,CAC9B,KAAK,MAAM,EAAE,GAAG;CAGlB,MAAM,oBAAoB,qBAAqB,QAAQ,UACtD,oBAAoB,SAAS,MAAM,GAAG,CACtC;CAED,MAAM,iBAAiB,kBAAkB,QAAQ,UAChD,iBAAiB,SAAS,MAAM,GAAG,CACnC;AAED,QACC,qBAAC;EACA,WAAW,GAAG,2BAA2B,UAAU;EAC9C;EACL,GAAI;aAEH,eACA,oBAAC;GACA,UAAU;GACV,aAAa;GACb,MAAM;GACN,SAAS;IACR,EAEH,oBAAC,iBAAe;GACX;EAGR;AAED,gBAAgB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"watermark.d.ts","names":[],"sources":["../../../src/support/components/watermark.tsx"],"sourcesContent":[],"mappings":";KAMY,cAAA;EAAA,SAAA,CAAA,EAAA,MAAc;AAI1B,CAAA;AAmCC,cAnCY,SAmCZ,EAnCuB,KAAA,CAAM,EAmC7B,CAnCgC,cAmChC,CAAA"}
1
+ {"version":3,"file":"watermark.d.ts","names":[],"sources":["../../../src/support/components/watermark.tsx"],"sourcesContent":[],"mappings":";KAMY,cAAA;EAAA,SAAA,CAAA,EAAA,MAAc;AAI1B,CAAA;cAAa,WAAW,KAAA,CAAM,GAAG"}
@@ -1,5 +1,6 @@
1
1
  import { RealtimeEvent } from "../../realtime-events.js";
2
2
  import { RealtimeContextValue } from "../../realtime/provider.js";
3
+ import "../../realtime/index.js";
3
4
  import React from "react";
4
5
 
5
6
  //#region src/support/context/websocket.d.ts
@@ -15,7 +16,14 @@ type WebSocketProviderProps = {
15
16
  onDisconnect?: () => void;
16
17
  onError?: (error: Error) => void;
17
18
  };
19
+ /**
20
+ * Support-specific realtime provider that authenticates visitors and keeps the
21
+ * connection alive with presence pings.
22
+ */
18
23
  declare const WebSocketProvider: React.FC<WebSocketProviderProps>;
24
+ /**
25
+ * Accessor for the support websocket context.
26
+ */
19
27
  declare const useWebSocket: () => WebSocketContextValue;
20
28
  //#endregion
21
29
  export { type RealtimeEvent, type WebSocketContextValue, WebSocketProvider, type WebSocketProviderProps, useWebSocket };
@@ -1 +1 @@
1
- {"version":3,"file":"websocket.d.ts","names":[],"sources":["../../../src/support/context/websocket.tsx"],"sourcesContent":[],"mappings":";;;;;KAYK,qBAAA,GAAwB;KAExB,sBAAA;YACM,KAAA,CAAM;EAHZ,SAAA,CAAA,EAAA,MAAA;EAEA,SAAA,CAAA,EAAA,MAAA;EAAsB,SAAA,CAAA,EAAA,MAAA;OAChB,CAAA,EAAA,MAAM;aAQE,CAAA,EAAA,OAAA;EAAK,SAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EAyIX,YAAA,CAAA,EAAA,GAAA,GAyBZ,IAAA;EAAA,OAAA,CAAA,EAAA,CAAA,KAAA,EAlKkB,KAkKlB,EAAA,GAAA,IAAA;;AAzB+B,cAAnB,iBAAyB,EAAN,KAAA,CAAM,EAAA,CAAG,sBAAH,CAAA;AAAE,cA2B3B,YA3B2B,EAAA,GAAA,GA2BR,qBA3BQ"}
1
+ {"version":3,"file":"websocket.d.ts","names":[],"sources":["../../../src/support/context/websocket.tsx"],"sourcesContent":[],"mappings":";;;;;;KAYK,qBAAA,GAAwB;KAExB,sBAAA;YACM,KAAA,CAAM;;EAHZ,SAAA,CAAA,EAAA,MAAA;EAEA,SAAA,CAAA,EAAA,MAAA;EAsJQ,KAAA,CAAA,EAAA,MAAA;EA8BA,WAAA,CAAA,EAAA,OAMZ;;;oBAjLkB;;;;;;cA6IN,mBAAmB,KAAA,CAAM,GAAG;;;;cA8B5B,oBAAmB"}
@@ -83,14 +83,17 @@ const WebSocketBridge = ({ children, onError }) => {
83
83
  children
84
84
  });
85
85
  };
86
+ /**
87
+ * Support-specific realtime provider that authenticates visitors and keeps the
88
+ * connection alive with presence pings.
89
+ */
86
90
  const WebSocketProvider = ({ children, publicKey, websiteId, visitorId, wsUrl, autoConnect = true, onConnect, onDisconnect, onError }) => {
87
- const auth = createVisitorAuthConfig({
88
- publicKey,
89
- websiteId,
90
- visitorId
91
- });
92
91
  return /* @__PURE__ */ jsx(RealtimeProvider, {
93
- auth,
92
+ auth: createVisitorAuthConfig({
93
+ publicKey,
94
+ websiteId,
95
+ visitorId
96
+ }),
94
97
  autoConnect,
95
98
  onConnect,
96
99
  onDisconnect,
@@ -102,6 +105,9 @@ const WebSocketProvider = ({ children, publicKey, websiteId, visitorId, wsUrl, a
102
105
  })
103
106
  });
104
107
  };
108
+ /**
109
+ * Accessor for the support websocket context.
110
+ */
105
111
  const useWebSocket = () => {
106
112
  const context = useContext(WebSocketContext);
107
113
  if (!context) throw new Error("useWebSocket must be used within WebSocketProvider");
@@ -1 +1 @@
1
- {"version":3,"file":"websocket.js","names":["WebSocketBridge: React.FC<WebSocketBridgeProps>","intervalId: number | null","WebSocketProvider: React.FC<WebSocketProviderProps>"],"sources":["../../../src/support/context/websocket.tsx"],"sourcesContent":["\"use client\";\n\nimport { PRESENCE_PING_INTERVAL_MS } from \"@cossistant/types\";\nimport type React from \"react\";\nimport { createContext, useContext, useEffect, useMemo } from \"react\";\nimport {\n\ttype RealtimeAuthConfig,\n\ttype RealtimeContextValue,\n\tRealtimeProvider,\n\tuseRealtimeConnection,\n} from \"../../realtime\";\n\ntype WebSocketContextValue = RealtimeContextValue;\n\ntype WebSocketProviderProps = {\n\tchildren: React.ReactNode;\n\tpublicKey?: string;\n\twebsiteId?: string;\n\tvisitorId?: string;\n\twsUrl?: string;\n\tautoConnect?: boolean;\n\tonConnect?: () => void;\n\tonDisconnect?: () => void;\n\tonError?: (error: Error) => void;\n};\n\nconst WebSocketContext = createContext<WebSocketContextValue | null>(null);\n\nfunction createVisitorAuthConfig({\n\tvisitorId,\n\twebsiteId,\n\tpublicKey,\n}: Pick<\n\tWebSocketProviderProps,\n\t\"visitorId\" | \"websiteId\" | \"publicKey\"\n>): RealtimeAuthConfig | null {\n\tconst normalizedVisitorId = visitorId?.trim();\n\tif (!normalizedVisitorId) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tkind: \"visitor\",\n\t\tvisitorId: normalizedVisitorId,\n\t\twebsiteId: websiteId?.trim() || null,\n\t\tpublicKey: publicKey?.trim() || null,\n\t} satisfies RealtimeAuthConfig;\n}\n\ntype WebSocketBridgeProps = {\n\tchildren: React.ReactNode;\n\tonError?: (error: Error) => void;\n};\n\nconst WebSocketBridge: React.FC<WebSocketBridgeProps> = ({\n\tchildren,\n\tonError,\n}) => {\n\tconst connection = useRealtimeConnection();\n\tconst { visitorId, sendRaw, isConnected } = connection;\n\n\tuseEffect(() => {\n\t\tif (typeof window === \"undefined\" || typeof document === \"undefined\") {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!(visitorId && sendRaw)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst pingMessage = \"presence:ping\";\n\n\t\tconst sendPresencePing = () => {\n\t\t\tif (!isConnected) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tsendRaw(pingMessage);\n\t\t\t} catch (error) {\n\t\t\t\tif (!onError) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst normalizedError =\n\t\t\t\t\terror instanceof Error\n\t\t\t\t\t\t? error\n\t\t\t\t\t\t: new Error(\n\t\t\t\t\t\t\t\ttypeof error === \"string\"\n\t\t\t\t\t\t\t\t\t? error\n\t\t\t\t\t\t\t\t\t: \"Unknown presence ping error\"\n\t\t\t\t\t\t\t);\n\n\t\t\t\tif (!normalizedError.message.includes(\"Failed to send presence ping\")) {\n\t\t\t\t\tnormalizedError.message = `Failed to send presence ping: ${normalizedError.message}`;\n\t\t\t\t}\n\n\t\t\t\tonError(normalizedError);\n\t\t\t}\n\t\t};\n\n\t\tlet intervalId: number | null = null;\n\n\t\tconst clearPresenceInterval = () => {\n\t\t\tif (intervalId !== null) {\n\t\t\t\twindow.clearInterval(intervalId);\n\t\t\t\tintervalId = null;\n\t\t\t}\n\t\t};\n\n\t\tconst startPresenceInterval = () => {\n\t\t\tclearPresenceInterval();\n\n\t\t\tif (!isConnected || document.visibilityState === \"hidden\") {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tintervalId = window.setInterval(\n\t\t\t\tsendPresencePing,\n\t\t\t\tPRESENCE_PING_INTERVAL_MS\n\t\t\t);\n\t\t};\n\n\t\tconst handleFocus = () => {\n\t\t\tsendPresencePing();\n\t\t\tstartPresenceInterval();\n\t\t};\n\n\t\tconst handleVisibilityChange = () => {\n\t\t\tif (document.visibilityState === \"hidden\") {\n\t\t\t\tclearPresenceInterval();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsendPresencePing();\n\t\t\tstartPresenceInterval();\n\t\t};\n\n\t\twindow.addEventListener(\"focus\", handleFocus);\n\t\tdocument.addEventListener(\"visibilitychange\", handleVisibilityChange);\n\n\t\tif (isConnected && document.visibilityState !== \"hidden\") {\n\t\t\tsendPresencePing();\n\t\t\tstartPresenceInterval();\n\t\t}\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"focus\", handleFocus);\n\t\t\tdocument.removeEventListener(\"visibilitychange\", handleVisibilityChange);\n\t\t\tclearPresenceInterval();\n\t\t};\n\t}, [isConnected, onError, sendRaw, visitorId]);\n\tconst value = useMemo(() => connection, [connection]);\n\treturn (\n\t\t<WebSocketContext.Provider value={value}>\n\t\t\t{children}\n\t\t</WebSocketContext.Provider>\n\t);\n};\n\nexport const WebSocketProvider: React.FC<WebSocketProviderProps> = ({\n\tchildren,\n\tpublicKey,\n\twebsiteId,\n\tvisitorId,\n\twsUrl,\n\tautoConnect = true,\n\tonConnect,\n\tonDisconnect,\n\tonError,\n}) => {\n\tconst auth = createVisitorAuthConfig({ publicKey, websiteId, visitorId });\n\n\treturn (\n\t\t<RealtimeProvider\n\t\t\tauth={auth}\n\t\t\tautoConnect={autoConnect}\n\t\t\tonConnect={onConnect}\n\t\t\tonDisconnect={onDisconnect}\n\t\t\tonError={onError}\n\t\t\twsUrl={wsUrl}\n\t\t>\n\t\t\t<WebSocketBridge onError={onError}>{children}</WebSocketBridge>\n\t\t</RealtimeProvider>\n\t);\n};\n\nexport const useWebSocket = (): WebSocketContextValue => {\n\tconst context = useContext(WebSocketContext);\n\tif (!context) {\n\t\tthrow new Error(\"useWebSocket must be used within WebSocketProvider\");\n\t}\n\treturn context;\n};\n\nexport type { WebSocketContextValue, WebSocketProviderProps };\nexport type { RealtimeEvent } from \"@cossistant/types/realtime-events\";\n"],"mappings":";;;;;;;;;AA0BA,MAAM,mBAAmB,cAA4C,KAAK;AAE1E,SAAS,wBAAwB,EAChC,WACA,WACA,aAI6B;CAC7B,MAAM,sBAAsB,WAAW,MAAM;AAC7C,KAAI,CAAC,oBACJ,QAAO;AAGR,QAAO;EACN,MAAM;EACN,WAAW;EACX,WAAW,WAAW,MAAM,IAAI;EAChC,WAAW,WAAW,MAAM,IAAI;EAChC;;AAQF,MAAMA,mBAAmD,EACxD,UACA,cACK;CACL,MAAM,aAAa,uBAAuB;CAC1C,MAAM,EAAE,WAAW,SAAS,gBAAgB;AAE5C,iBAAgB;AACf,MAAI,OAAO,WAAW,eAAe,OAAO,aAAa,YACxD;AAGD,MAAI,EAAE,aAAa,SAClB;EAGD,MAAM,cAAc;EAEpB,MAAM,yBAAyB;AAC9B,OAAI,CAAC,YACJ;AAGD,OAAI;AACH,YAAQ,YAAY;YACZ,OAAO;AACf,QAAI,CAAC,QACJ;IAGD,MAAM,kBACL,iBAAiB,QACd,QACA,IAAI,MACJ,OAAO,UAAU,WACd,QACA,8BACH;AAEJ,QAAI,CAAC,gBAAgB,QAAQ,SAAS,+BAA+B,CACpE,iBAAgB,UAAU,iCAAiC,gBAAgB;AAG5E,YAAQ,gBAAgB;;;EAI1B,IAAIC,aAA4B;EAEhC,MAAM,8BAA8B;AACnC,OAAI,eAAe,MAAM;AACxB,WAAO,cAAc,WAAW;AAChC,iBAAa;;;EAIf,MAAM,8BAA8B;AACnC,0BAAuB;AAEvB,OAAI,CAAC,eAAe,SAAS,oBAAoB,SAChD;AAGD,gBAAa,OAAO,YACnB,kBACA,0BACA;;EAGF,MAAM,oBAAoB;AACzB,qBAAkB;AAClB,0BAAuB;;EAGxB,MAAM,+BAA+B;AACpC,OAAI,SAAS,oBAAoB,UAAU;AAC1C,2BAAuB;AACvB;;AAGD,qBAAkB;AAClB,0BAAuB;;AAGxB,SAAO,iBAAiB,SAAS,YAAY;AAC7C,WAAS,iBAAiB,oBAAoB,uBAAuB;AAErE,MAAI,eAAe,SAAS,oBAAoB,UAAU;AACzD,qBAAkB;AAClB,0BAAuB;;AAGxB,eAAa;AACZ,UAAO,oBAAoB,SAAS,YAAY;AAChD,YAAS,oBAAoB,oBAAoB,uBAAuB;AACxE,0BAAuB;;IAEtB;EAAC;EAAa;EAAS;EAAS;EAAU,CAAC;CAC9C,MAAM,QAAQ,cAAc,YAAY,CAAC,WAAW,CAAC;AACrD,QACC,oBAAC,iBAAiB;EAAgB;EAChC;GAC0B;;AAI9B,MAAaC,qBAAuD,EACnE,UACA,WACA,WACA,WACA,OACA,cAAc,MACd,WACA,cACA,cACK;CACL,MAAM,OAAO,wBAAwB;EAAE;EAAW;EAAW;EAAW,CAAC;AAEzE,QACC,oBAAC;EACM;EACO;EACF;EACG;EACL;EACF;YAEP,oBAAC;GAAyB;GAAU;IAA2B;GAC7C;;AAIrB,MAAa,qBAA4C;CACxD,MAAM,UAAU,WAAW,iBAAiB;AAC5C,KAAI,CAAC,QACJ,OAAM,IAAI,MAAM,qDAAqD;AAEtE,QAAO"}
1
+ {"version":3,"file":"websocket.js","names":["WebSocketBridge: React.FC<WebSocketBridgeProps>","intervalId: number | null","WebSocketProvider: React.FC<WebSocketProviderProps>"],"sources":["../../../src/support/context/websocket.tsx"],"sourcesContent":["\"use client\";\n\nimport { PRESENCE_PING_INTERVAL_MS } from \"@cossistant/types\";\nimport type React from \"react\";\nimport { createContext, useContext, useEffect, useMemo } from \"react\";\nimport {\n\ttype RealtimeAuthConfig,\n\ttype RealtimeContextValue,\n\tRealtimeProvider,\n\tuseRealtimeConnection,\n} from \"../../realtime\";\n\ntype WebSocketContextValue = RealtimeContextValue;\n\ntype WebSocketProviderProps = {\n\tchildren: React.ReactNode;\n\tpublicKey?: string;\n\twebsiteId?: string;\n\tvisitorId?: string;\n\twsUrl?: string;\n\tautoConnect?: boolean;\n\tonConnect?: () => void;\n\tonDisconnect?: () => void;\n\tonError?: (error: Error) => void;\n};\n\nconst WebSocketContext = createContext<WebSocketContextValue | null>(null);\n\nfunction createVisitorAuthConfig({\n\tvisitorId,\n\twebsiteId,\n\tpublicKey,\n}: Pick<\n\tWebSocketProviderProps,\n\t\"visitorId\" | \"websiteId\" | \"publicKey\"\n>): RealtimeAuthConfig | null {\n\tconst normalizedVisitorId = visitorId?.trim();\n\tif (!normalizedVisitorId) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tkind: \"visitor\",\n\t\tvisitorId: normalizedVisitorId,\n\t\twebsiteId: websiteId?.trim() || null,\n\t\tpublicKey: publicKey?.trim() || null,\n\t} satisfies RealtimeAuthConfig;\n}\n\ntype WebSocketBridgeProps = {\n\tchildren: React.ReactNode;\n\tonError?: (error: Error) => void;\n};\n\nconst WebSocketBridge: React.FC<WebSocketBridgeProps> = ({\n\tchildren,\n\tonError,\n}) => {\n\tconst connection = useRealtimeConnection();\n\tconst { visitorId, sendRaw, isConnected } = connection;\n\n\tuseEffect(() => {\n\t\tif (typeof window === \"undefined\" || typeof document === \"undefined\") {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!(visitorId && sendRaw)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst pingMessage = \"presence:ping\";\n\n\t\tconst sendPresencePing = () => {\n\t\t\tif (!isConnected) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tsendRaw(pingMessage);\n\t\t\t} catch (error) {\n\t\t\t\tif (!onError) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst normalizedError =\n\t\t\t\t\terror instanceof Error\n\t\t\t\t\t\t? error\n\t\t\t\t\t\t: new Error(\n\t\t\t\t\t\t\t\ttypeof error === \"string\"\n\t\t\t\t\t\t\t\t\t? error\n\t\t\t\t\t\t\t\t\t: \"Unknown presence ping error\"\n\t\t\t\t\t\t\t);\n\n\t\t\t\tif (!normalizedError.message.includes(\"Failed to send presence ping\")) {\n\t\t\t\t\tnormalizedError.message = `Failed to send presence ping: ${normalizedError.message}`;\n\t\t\t\t}\n\n\t\t\t\tonError(normalizedError);\n\t\t\t}\n\t\t};\n\n\t\tlet intervalId: number | null = null;\n\n\t\tconst clearPresenceInterval = () => {\n\t\t\tif (intervalId !== null) {\n\t\t\t\twindow.clearInterval(intervalId);\n\t\t\t\tintervalId = null;\n\t\t\t}\n\t\t};\n\n\t\tconst startPresenceInterval = () => {\n\t\t\tclearPresenceInterval();\n\n\t\t\tif (!isConnected || document.visibilityState === \"hidden\") {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tintervalId = window.setInterval(\n\t\t\t\tsendPresencePing,\n\t\t\t\tPRESENCE_PING_INTERVAL_MS\n\t\t\t);\n\t\t};\n\n\t\tconst handleFocus = () => {\n\t\t\tsendPresencePing();\n\t\t\tstartPresenceInterval();\n\t\t};\n\n\t\tconst handleVisibilityChange = () => {\n\t\t\tif (document.visibilityState === \"hidden\") {\n\t\t\t\tclearPresenceInterval();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsendPresencePing();\n\t\t\tstartPresenceInterval();\n\t\t};\n\n\t\twindow.addEventListener(\"focus\", handleFocus);\n\t\tdocument.addEventListener(\"visibilitychange\", handleVisibilityChange);\n\n\t\tif (isConnected && document.visibilityState !== \"hidden\") {\n\t\t\tsendPresencePing();\n\t\t\tstartPresenceInterval();\n\t\t}\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"focus\", handleFocus);\n\t\t\tdocument.removeEventListener(\"visibilitychange\", handleVisibilityChange);\n\t\t\tclearPresenceInterval();\n\t\t};\n\t}, [isConnected, onError, sendRaw, visitorId]);\n\tconst value = useMemo(() => connection, [connection]);\n\treturn (\n\t\t<WebSocketContext.Provider value={value}>\n\t\t\t{children}\n\t\t</WebSocketContext.Provider>\n\t);\n};\n\n/**\n * Support-specific realtime provider that authenticates visitors and keeps the\n * connection alive with presence pings.\n */\nexport const WebSocketProvider: React.FC<WebSocketProviderProps> = ({\n\tchildren,\n\tpublicKey,\n\twebsiteId,\n\tvisitorId,\n\twsUrl,\n\tautoConnect = true,\n\tonConnect,\n\tonDisconnect,\n\tonError,\n}) => {\n\tconst auth = createVisitorAuthConfig({ publicKey, websiteId, visitorId });\n\n\treturn (\n\t\t<RealtimeProvider\n\t\t\tauth={auth}\n\t\t\tautoConnect={autoConnect}\n\t\t\tonConnect={onConnect}\n\t\t\tonDisconnect={onDisconnect}\n\t\t\tonError={onError}\n\t\t\twsUrl={wsUrl}\n\t\t>\n\t\t\t<WebSocketBridge onError={onError}>{children}</WebSocketBridge>\n\t\t</RealtimeProvider>\n\t);\n};\n\n/**\n * Accessor for the support websocket context.\n */\nexport const useWebSocket = (): WebSocketContextValue => {\n\tconst context = useContext(WebSocketContext);\n\tif (!context) {\n\t\tthrow new Error(\"useWebSocket must be used within WebSocketProvider\");\n\t}\n\treturn context;\n};\n\nexport type { WebSocketContextValue, WebSocketProviderProps };\nexport type { RealtimeEvent } from \"@cossistant/types/realtime-events\";\n"],"mappings":";;;;;;;;;AA0BA,MAAM,mBAAmB,cAA4C,KAAK;AAE1E,SAAS,wBAAwB,EAChC,WACA,WACA,aAI6B;CAC7B,MAAM,sBAAsB,WAAW,MAAM;AAC7C,KAAI,CAAC,oBACJ,QAAO;AAGR,QAAO;EACN,MAAM;EACN,WAAW;EACX,WAAW,WAAW,MAAM,IAAI;EAChC,WAAW,WAAW,MAAM,IAAI;EAChC;;AAQF,MAAMA,mBAAmD,EACxD,UACA,cACK;CACL,MAAM,aAAa,uBAAuB;CAC1C,MAAM,EAAE,WAAW,SAAS,gBAAgB;AAE5C,iBAAgB;AACf,MAAI,OAAO,WAAW,eAAe,OAAO,aAAa,YACxD;AAGD,MAAI,EAAE,aAAa,SAClB;EAGD,MAAM,cAAc;EAEpB,MAAM,yBAAyB;AAC9B,OAAI,CAAC,YACJ;AAGD,OAAI;AACH,YAAQ,YAAY;YACZ,OAAO;AACf,QAAI,CAAC,QACJ;IAGD,MAAM,kBACL,iBAAiB,QACd,QACA,IAAI,MACJ,OAAO,UAAU,WACd,QACA,8BACH;AAEJ,QAAI,CAAC,gBAAgB,QAAQ,SAAS,+BAA+B,CACpE,iBAAgB,UAAU,iCAAiC,gBAAgB;AAG5E,YAAQ,gBAAgB;;;EAI1B,IAAIC,aAA4B;EAEhC,MAAM,8BAA8B;AACnC,OAAI,eAAe,MAAM;AACxB,WAAO,cAAc,WAAW;AAChC,iBAAa;;;EAIf,MAAM,8BAA8B;AACnC,0BAAuB;AAEvB,OAAI,CAAC,eAAe,SAAS,oBAAoB,SAChD;AAGD,gBAAa,OAAO,YACnB,kBACA,0BACA;;EAGF,MAAM,oBAAoB;AACzB,qBAAkB;AAClB,0BAAuB;;EAGxB,MAAM,+BAA+B;AACpC,OAAI,SAAS,oBAAoB,UAAU;AAC1C,2BAAuB;AACvB;;AAGD,qBAAkB;AAClB,0BAAuB;;AAGxB,SAAO,iBAAiB,SAAS,YAAY;AAC7C,WAAS,iBAAiB,oBAAoB,uBAAuB;AAErE,MAAI,eAAe,SAAS,oBAAoB,UAAU;AACzD,qBAAkB;AAClB,0BAAuB;;AAGxB,eAAa;AACZ,UAAO,oBAAoB,SAAS,YAAY;AAChD,YAAS,oBAAoB,oBAAoB,uBAAuB;AACxE,0BAAuB;;IAEtB;EAAC;EAAa;EAAS;EAAS;EAAU,CAAC;CAC9C,MAAM,QAAQ,cAAc,YAAY,CAAC,WAAW,CAAC;AACrD,QACC,oBAAC,iBAAiB;EAAgB;EAChC;GAC0B;;;;;;AAQ9B,MAAaC,qBAAuD,EACnE,UACA,WACA,WACA,WACA,OACA,cAAc,MACd,WACA,cACA,cACK;AAGL,QACC,oBAAC;EACA,MAJW,wBAAwB;GAAE;GAAW;GAAW;GAAW,CAAC;EAK1D;EACF;EACG;EACL;EACF;YAEP,oBAAC;GAAyB;GAAU;IAA2B;GAC7C;;;;;AAOrB,MAAa,qBAA4C;CACxD,MAAM,UAAU,WAAW,iBAAiB;AAC5C,KAAI,CAAC,QACJ,OAAM,IAAI,MAAM,qDAAqD;AAEtE,QAAO"}
@@ -1,17 +1,17 @@
1
1
  import { SupportLocale, SupportTextContentOverrides } from "./text/locales/keys.js";
2
2
  import { Text, useSupportText } from "./text/index.js";
3
- import { useSupportConfig } from "./context/config.js";
4
3
  import { WebSocketContextValue, WebSocketProvider, useWebSocket } from "./context/websocket.js";
5
- import { useSupportStore } from "./store/support-store.js";
4
+ import { useSupportConfig, useSupportNavigation, useSupportStore } from "./store/support-store.js";
5
+ import "./store/index.js";
6
+ import { ReactElement } from "react";
6
7
  import { DefaultMessage } from "@cossistant/types";
7
- import * as react_jsx_runtime1 from "react/jsx-runtime";
8
8
 
9
9
  //#region src/support/index.d.ts
10
10
  type SupportProps<Locale extends string = SupportLocale> = {
11
11
  className?: string;
12
12
  position?: "top" | "bottom";
13
13
  align?: "right" | "left";
14
- mode?: "floating" | "responsive";
14
+ positioning?: "fixed" | "absolute";
15
15
  quickOptions?: string[];
16
16
  defaultMessages?: DefaultMessage[];
17
17
  defaultOpen?: boolean;
@@ -19,7 +19,7 @@ type SupportProps<Locale extends string = SupportLocale> = {
19
19
  content?: SupportTextContentOverrides<Locale>;
20
20
  };
21
21
  /**
22
- * Orchestrates the end-user support experience by nesting realtime, config and
22
+ * Orchestrates the end-user support experience by nesting realtime and
23
23
  * content providers. Renders nothing until website data is available to avoid
24
24
  * flashing incomplete UI.
25
25
  */
@@ -27,13 +27,13 @@ declare function Support<Locale extends string = SupportLocale>({
27
27
  className,
28
28
  position,
29
29
  align,
30
- mode,
30
+ positioning,
31
31
  quickOptions,
32
32
  defaultMessages,
33
33
  defaultOpen,
34
34
  locale,
35
35
  content
36
- }: SupportProps<Locale>): react_jsx_runtime1.JSX.Element | null;
36
+ }: SupportProps<Locale>): ReactElement | null;
37
37
  //#endregion
38
- export { Support, Support as default, type SupportLocale, SupportProps, type SupportTextContentOverrides, Text, type WebSocketContextValue, WebSocketProvider, useSupportConfig, useSupportStore, useSupportText, useWebSocket };
38
+ export { Support, Support as default, type SupportLocale, SupportProps, type SupportTextContentOverrides, Text, type WebSocketContextValue, WebSocketProvider, useSupportConfig, useSupportNavigation, useSupportStore, useSupportText, useWebSocket };
39
39
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/support/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;KAWY,qCAAqC;;;;;;EAArC,eAAY,CAAA,EAOL,cAPK,EAAA;EAAA,WAAA,CAAA,EAAA,OAAA;QAAyB,CAAA,EASvC,MATuC;SAO9B,CAAA,EAGR,2BAHQ,CAGoB,MAHpB,CAAA;;;;;AAYnB;;AAAgD,iBAAhC,OAAgC,CAAA,eAAA,MAAA,GAAA,aAAA,CAAA,CAAA;EAAA,SAAA;EAAA,QAAA;EAAA,KAAA;EAAA,IAAA;EAAA,YAAA;EAAA,eAAA;EAAA,WAAA;EAAA,MAAA;EAAA;AAAA,CAAA,EAU7C,YAV6C,CAUhC,MAVgC,CAAA,CAAA,EAUzB,kBAAA,CAAA,GAAA,CAAA,OAAA,GAVyB,IAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/support/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;KAYY,qCAAqC;;;;;EAArC,YAAA,CAAA,EAAY,MAAA,EAAA;EAAyB,eAAA,CAAA,EAM9B,cAN8B,EAAA;EAM9B,WAAA,CAAA,EAAA,OAAA;EAET,MAAA,CAAA,EAAA,MAAA;EAC6B,OAAA,CAAA,EAA5B,2BAA4B,CAAA,MAAA,CAAA;CAA5B;;AASX;;;;AAGC,iBAHe,OAGf,CAAA,eAAA,MAAA,GAH+C,aAG/C,CAAA,CAAA;EAAA,SAAA;EAAA,QAAA;EAAA,KAAA;EAAA,WAAA;EAAA,YAAA;EAAA,eAAA;EAAA,WAAA;EAAA,MAAA;EAAA;AAAA,CAAA,EAOE,YAPF,CAOe,MAPf,CAAA,CAAA,EAOyB,YAPzB,GAAA,IAAA"}
package/support/index.js CHANGED
@@ -1,35 +1,35 @@
1
1
  import "./support.js";
2
2
  import { SupportRealtimeProvider } from "../realtime/support-provider.js";
3
3
  import { SupportConfig } from "../support-config.js";
4
- import { useSupportStore } from "./store/support-store.js";
5
- import { SupportConfigProvider, useSupportConfig } from "./context/config.js";
4
+ import { initializeSupportStore, useSupportConfig, useSupportNavigation, useSupportStore } from "./store/support-store.js";
6
5
  import { SupportTextProvider, Text, useSupportText } from "./text/index.js";
7
6
  import { SupportContent } from "./components/support-content.js";
8
7
  import { WebSocketProvider, useWebSocket } from "./context/websocket.js";
9
8
  import { useSupport } from "../provider.js";
9
+ import React from "react";
10
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
11
 
12
12
  //#region src/support/index.tsx
13
13
  /**
14
- * Orchestrates the end-user support experience by nesting realtime, config and
14
+ * Orchestrates the end-user support experience by nesting realtime and
15
15
  * content providers. Renders nothing until website data is available to avoid
16
16
  * flashing incomplete UI.
17
17
  */
18
- function Support({ className, position = "bottom", align = "right", mode = "floating", quickOptions, defaultMessages, defaultOpen, locale, content }) {
18
+ function Support({ className, position = "bottom", align = "right", positioning = "fixed", quickOptions, defaultMessages, defaultOpen, locale, content }) {
19
19
  const { website } = useSupport();
20
- if (!website) return null;
21
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SupportRealtimeProvider, { children: /* @__PURE__ */ jsx(SupportConfigProvider, {
22
- defaultOpen,
23
- mode,
24
- children: /* @__PURE__ */ jsx(SupportTextProvider, {
25
- content,
26
- locale,
27
- children: /* @__PURE__ */ jsx(SupportContent, {
28
- align,
29
- className,
30
- mode,
31
- position
32
- })
20
+ const isVisitorBlocked = website?.visitor?.isBlocked ?? false;
21
+ React.useEffect(() => {
22
+ if (defaultOpen !== void 0) initializeSupportStore({ defaultOpen });
23
+ }, [defaultOpen]);
24
+ if (!website || isVisitorBlocked) return null;
25
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SupportRealtimeProvider, { children: /* @__PURE__ */ jsx(SupportTextProvider, {
26
+ content,
27
+ locale,
28
+ children: /* @__PURE__ */ jsx(SupportContent, {
29
+ align,
30
+ className,
31
+ position,
32
+ positioning
33
33
  })
34
34
  }) }), /* @__PURE__ */ jsx(SupportConfig, {
35
35
  defaultMessages,
@@ -39,5 +39,5 @@ function Support({ className, position = "bottom", align = "right", mode = "floa
39
39
  var support_default = Support;
40
40
 
41
41
  //#endregion
42
- export { Support, Text, WebSocketProvider, support_default as default, useSupportConfig, useSupportStore, useSupportText, useWebSocket };
42
+ export { Support, Text, WebSocketProvider, support_default as default, useSupportConfig, useSupportNavigation, useSupportStore, useSupportText, useWebSocket };
43
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/support/index.tsx"],"sourcesContent":["import \"./support.css\";\n\nimport type { DefaultMessage } from \"@cossistant/types\";\nimport { useSupport } from \"../provider\";\nimport { SupportRealtimeProvider } from \"../realtime\";\nimport { SupportConfig } from \"../support-config\";\nimport { SupportContent } from \"./components/support-content\";\nimport { SupportConfigProvider } from \"./context/config\";\nimport type { SupportLocale, SupportTextContentOverrides } from \"./text\";\nimport { SupportTextProvider } from \"./text\";\n\nexport type SupportProps<Locale extends string = SupportLocale> = {\n\tclassName?: string;\n\tposition?: \"top\" | \"bottom\";\n\talign?: \"right\" | \"left\";\n\t// Display the support widget in a floating window or in responsive mode (takes the full width / height of the parent)\n\tmode?: \"floating\" | \"responsive\";\n\tquickOptions?: string[];\n\tdefaultMessages?: DefaultMessage[];\n\tdefaultOpen?: boolean;\n\tlocale?: Locale;\n\tcontent?: SupportTextContentOverrides<Locale>;\n};\n\n// Internal component that needs the conversation context\n/**\n * Orchestrates the end-user support experience by nesting realtime, config and\n * content providers. Renders nothing until website data is available to avoid\n * flashing incomplete UI.\n */\nexport function Support<Locale extends string = SupportLocale>({\n\tclassName,\n\tposition = \"bottom\",\n\talign = \"right\",\n\tmode = \"floating\",\n\tquickOptions,\n\tdefaultMessages,\n\tdefaultOpen,\n\tlocale,\n\tcontent,\n}: SupportProps<Locale>) {\n\tconst { website } = useSupport();\n\n\tif (!website) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<SupportRealtimeProvider>\n\t\t\t\t<SupportConfigProvider defaultOpen={defaultOpen} mode={mode}>\n\t\t\t\t\t<SupportTextProvider content={content} locale={locale}>\n\t\t\t\t\t\t<SupportContent\n\t\t\t\t\t\t\talign={align}\n\t\t\t\t\t\t\tclassName={className}\n\t\t\t\t\t\t\tmode={mode}\n\t\t\t\t\t\t\tposition={position}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SupportTextProvider>\n\t\t\t\t</SupportConfigProvider>\n\t\t\t</SupportRealtimeProvider>\n\t\t\t<SupportConfig\n\t\t\t\tdefaultMessages={defaultMessages}\n\t\t\t\tquickOptions={quickOptions}\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default Support;\n\nexport { useSupportConfig } from \"./context/config\";\nexport type { WebSocketContextValue } from \"./context/websocket\";\nexport { useWebSocket, WebSocketProvider } from \"./context/websocket\";\n// Export the store for direct access if needed\nexport { useSupportStore } from \"./store\";\nexport type { SupportLocale, SupportTextContentOverrides } from \"./text\";\nexport { Text, useSupportText } from \"./text\";\n"],"mappings":";;;;;;;;;;;;;;;;;AA8BA,SAAgB,QAA+C,EAC9D,WACA,WAAW,UACX,QAAQ,SACR,OAAO,YACP,cACA,iBACA,aACA,QACA,WACwB;CACxB,MAAM,EAAE,YAAY,YAAY;AAEhC,KAAI,CAAC,QACJ,QAAO;AAGR,QACC,4CACC,oBAAC,qCACA,oBAAC;EAAmC;EAAmB;YACtD,oBAAC;GAA6B;GAAiB;aAC9C,oBAAC;IACO;IACI;IACL;IACI;KACT;IACmB;GACC,GACC,EAC1B,oBAAC;EACiB;EACH;GACb,IACA;;AAIL,sBAAe"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/support/index.tsx"],"sourcesContent":["import \"./support.css\";\n\nimport type { DefaultMessage } from \"@cossistant/types\";\nimport React, { type ReactElement } from \"react\";\nimport { useSupport } from \"../provider\";\nimport { SupportRealtimeProvider } from \"../realtime\";\nimport { SupportConfig } from \"../support-config\";\nimport { SupportContent } from \"./components/support-content\";\nimport { initializeSupportStore } from \"./store/support-store\";\nimport type { SupportLocale, SupportTextContentOverrides } from \"./text\";\nimport { SupportTextProvider } from \"./text\";\n\nexport type SupportProps<Locale extends string = SupportLocale> = {\n\tclassName?: string;\n\tposition?: \"top\" | \"bottom\";\n\talign?: \"right\" | \"left\";\n\tpositioning?: \"fixed\" | \"absolute\";\n\tquickOptions?: string[];\n\tdefaultMessages?: DefaultMessage[];\n\tdefaultOpen?: boolean;\n\tlocale?: Locale;\n\tcontent?: SupportTextContentOverrides<Locale>;\n};\n\n// Internal component that needs the conversation context\n/**\n * Orchestrates the end-user support experience by nesting realtime and\n * content providers. Renders nothing until website data is available to avoid\n * flashing incomplete UI.\n */\nexport function Support<Locale extends string = SupportLocale>({\n\tclassName,\n\tposition = \"bottom\",\n\talign = \"right\",\n\tpositioning = \"fixed\",\n\tquickOptions,\n\tdefaultMessages,\n\tdefaultOpen,\n\tlocale,\n\tcontent,\n}: SupportProps<Locale>): ReactElement | null {\n\tconst { website } = useSupport();\n\tconst isVisitorBlocked = website?.visitor?.isBlocked ?? false;\n\n\t// Initialize support store with defaultOpen when component mounts or prop changes\n\tReact.useEffect(() => {\n\t\tif (defaultOpen !== undefined) {\n\t\t\tinitializeSupportStore({ defaultOpen });\n\t\t}\n\t}, [defaultOpen]);\n\n\tif (!website || isVisitorBlocked) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<SupportRealtimeProvider>\n\t\t\t\t<SupportTextProvider content={content} locale={locale}>\n\t\t\t\t\t<SupportContent\n\t\t\t\t\t\talign={align}\n\t\t\t\t\t\tclassName={className}\n\t\t\t\t\t\tposition={position}\n\t\t\t\t\t\tpositioning={positioning}\n\t\t\t\t\t/>\n\t\t\t\t</SupportTextProvider>\n\t\t\t</SupportRealtimeProvider>\n\t\t\t<SupportConfig\n\t\t\t\tdefaultMessages={defaultMessages}\n\t\t\t\tquickOptions={quickOptions}\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default Support;\n\nexport type { WebSocketContextValue } from \"./context/websocket\";\nexport { useWebSocket, WebSocketProvider } from \"./context/websocket\";\n// Export the store for direct access if needed\nexport {\n\tuseSupportConfig,\n\tuseSupportNavigation,\n\tuseSupportStore,\n} from \"./store\";\nexport type { SupportLocale, SupportTextContentOverrides } from \"./text\";\nexport { Text, useSupportText } from \"./text\";\n"],"mappings":";;;;;;;;;;;;;;;;;AA8BA,SAAgB,QAA+C,EAC9D,WACA,WAAW,UACX,QAAQ,SACR,cAAc,SACd,cACA,iBACA,aACA,QACA,WAC6C;CAC7C,MAAM,EAAE,YAAY,YAAY;CAChC,MAAM,mBAAmB,SAAS,SAAS,aAAa;AAGxD,OAAM,gBAAgB;AACrB,MAAI,gBAAgB,OACnB,wBAAuB,EAAE,aAAa,CAAC;IAEtC,CAAC,YAAY,CAAC;AAEjB,KAAI,CAAC,WAAW,iBACf,QAAO;AAGR,QACC,4CACC,oBAAC,qCACA,oBAAC;EAA6B;EAAiB;YAC9C,oBAAC;GACO;GACI;GACD;GACG;IACZ;GACmB,GACG,EAC1B,oBAAC;EACiB;EACH;GACb,IACA;;AAIL,sBAAe"}
@@ -8,7 +8,6 @@ import { PENDING_CONVERSATION_ID } from "../../utils/id.js";
8
8
  import { Watermark } from "../components/watermark.js";
9
9
  import { useConversationHistoryPage } from "../../hooks/use-conversation-history-page.js";
10
10
  import { ConversationButtonLink } from "../components/conversation-button-link.js";
11
- import { TextEffect } from "../components/text-effect.js";
12
11
  import { useSupport } from "../../provider.js";
13
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
13
 
@@ -49,36 +48,36 @@ const ConversationHistoryPage = () => {
49
48
  if (canGoBack) goBack();
50
49
  else navigate({ page: "HOME" });
51
50
  };
52
- return /* @__PURE__ */ jsxs(Fragment, { children: [
53
- /* @__PURE__ */ jsx(Header, {
54
- onGoBack: handleGoBack,
55
- children: /* @__PURE__ */ jsxs("div", {
56
- className: "flex w-full items-center justify-between gap-2 py-3",
57
- children: [/* @__PURE__ */ jsx("div", { className: "flex flex-col" }), /* @__PURE__ */ jsx(AvatarStack, {
58
- aiAgents: availableAIAgents,
59
- gapWidth: 2,
60
- humanAgents: availableHumanAgents,
61
- size: 32,
62
- spacing: 28
63
- })]
64
- })
65
- }),
66
- /* @__PURE__ */ jsx("div", {
67
- className: "sticky top-4 flex flex-1 items-center justify-center",
68
- children: /* @__PURE__ */ jsx("div", {
69
- className: "flex flex-col items-center gap-2",
70
- children: /* @__PURE__ */ jsx(TextEffect, {
71
- as: "h2",
72
- className: "max-w-xs text-balance text-center font-co-sans text-2xl leading-normal",
73
- delay: .5,
74
- preset: "fade-in-blur",
51
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Header, {
52
+ onGoBack: handleGoBack,
53
+ children: /* @__PURE__ */ jsxs("div", {
54
+ className: "flex w-full items-center justify-between gap-2 py-3",
55
+ children: [/* @__PURE__ */ jsx("div", {
56
+ className: "flex flex-col",
57
+ children: /* @__PURE__ */ jsx("h2", {
58
+ className: "max-w-xs text-balance font-co-sans text-md leading-normal",
75
59
  children: text("page.conversationHistory.title")
76
60
  })
77
- })
78
- }),
79
- /* @__PURE__ */ jsxs("div", {
80
- className: "flex flex-shrink-0 flex-col items-center justify-center gap-2 px-6 pt-20 pb-4",
81
- children: [history.conversations.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [history.hasMore && /* @__PURE__ */ jsx(Button, {
61
+ }), /* @__PURE__ */ jsx(AvatarStack, {
62
+ aiAgents: availableAIAgents,
63
+ gapWidth: 2,
64
+ humanAgents: availableHumanAgents,
65
+ size: 32,
66
+ spacing: 28
67
+ })]
68
+ })
69
+ }), /* @__PURE__ */ jsxs("div", {
70
+ className: "flex flex-1 flex-col items-center justify-between gap-2 px-6 pb-4",
71
+ children: [history.conversations.length > 0 && /* @__PURE__ */ jsxs("div", {
72
+ className: "flex flex-col items-center justify-between gap-2 pt-10",
73
+ children: [/* @__PURE__ */ jsx("div", {
74
+ className: "flex w-full flex-col overflow-clip rounded-md border border-co-border/80",
75
+ children: history.visibleConversations.map((conversation) => /* @__PURE__ */ jsx(ConversationButtonLink, {
76
+ className: "rounded-none",
77
+ conversation,
78
+ onClick: () => history.openConversation(conversation.id)
79
+ }, conversation.id))
80
+ }), history.hasMore && /* @__PURE__ */ jsx(Button, {
82
81
  className: "relative mt-6 w-full text-co-primary/40 text-xs hover:text-co-primary",
83
82
  onClick: history.showAll,
84
83
  variant: "ghost",
@@ -87,32 +86,25 @@ const ConversationHistoryPage = () => {
87
86
  textKey: "page.conversationHistory.showMore",
88
87
  variables: { count: history.remainingCount }
89
88
  })
90
- }), /* @__PURE__ */ jsx("div", {
91
- className: "mt-6 flex w-full flex-col overflow-clip rounded-md border border-co-border/80",
92
- children: history.visibleConversations.map((conversation) => /* @__PURE__ */ jsx(ConversationButtonLink, {
93
- className: "rounded-none",
94
- conversation,
95
- onClick: () => history.openConversation(conversation.id)
96
- }, conversation.id))
97
- })] }), /* @__PURE__ */ jsxs("div", {
98
- className: "sticky bottom-4 z-10 flex w-full flex-col items-center gap-2",
99
- children: [/* @__PURE__ */ jsxs(Button, {
100
- className: "relative w-full justify-between",
101
- onClick: () => history.startConversation(),
102
- size: "large",
103
- variant: "secondary",
104
- children: [/* @__PURE__ */ jsx(icons_default, {
105
- className: "-translate-y-1/2 absolute top-1/2 right-4 size-3 text-co-primary/60 transition-transform duration-200 group-hover/btn:translate-x-0.5 group-hover/btn:text-co-primary",
106
- name: "arrow-right",
107
- variant: "default"
108
- }), /* @__PURE__ */ jsx(Text, {
109
- as: "span",
110
- textKey: "common.actions.askQuestion"
111
- })]
112
- }), /* @__PURE__ */ jsx(Watermark, { className: "mt-4 mb-2" })]
113
89
  })]
114
- })
115
- ] });
90
+ }), /* @__PURE__ */ jsxs("div", {
91
+ className: "sticky bottom-4 z-10 flex w-full flex-col items-center gap-2",
92
+ children: [/* @__PURE__ */ jsxs(Button, {
93
+ className: "relative w-full justify-between",
94
+ onClick: () => history.startConversation(),
95
+ size: "large",
96
+ variant: "secondary",
97
+ children: [/* @__PURE__ */ jsx(icons_default, {
98
+ className: "-translate-y-1/2 absolute top-1/2 right-4 size-3 text-co-primary/60 transition-transform duration-200 group-hover/btn:translate-x-0.5 group-hover/btn:text-co-primary",
99
+ name: "arrow-right",
100
+ variant: "default"
101
+ }), /* @__PURE__ */ jsx(Text, {
102
+ as: "span",
103
+ textKey: "common.actions.askQuestion"
104
+ })]
105
+ }), /* @__PURE__ */ jsx(Watermark, { className: "mt-4 mb-2" })]
106
+ })]
107
+ })] });
116
108
  };
117
109
 
118
110
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-history.js","names":["ConversationHistoryPage: React.FC","Icon"],"sources":["../../../src/support/pages/conversation-history.tsx"],"sourcesContent":["import { useSupport } from \"@cossistant/react\";\nimport { PENDING_CONVERSATION_ID } from \"@cossistant/react/utils/id\";\nimport type React from \"react\";\nimport { useConversationHistoryPage } from \"../../hooks/use-conversation-history-page\";\nimport { AvatarStack } from \"../components/avatar-stack\";\nimport { Button } from \"../components/button\";\nimport { ConversationButtonLink } from \"../components/conversation-button-link\";\nimport { Header } from \"../components/header\";\nimport Icon from \"../components/icons\";\nimport { TextEffect } from \"../components/text-effect\";\nimport { Watermark } from \"../components/watermark\";\nimport { useSupportNavigation } from \"../store/support-store\";\nimport { Text, useSupportText } from \"../text\";\n\n/**\n * Conversation history page component.\n *\n * Displays:\n * - List of all conversations\n * - Pagination controls\n * - Button to start new conversation\n *\n * All logic is handled by the useConversationHistoryPage hook.\n */\nexport const ConversationHistoryPage: React.FC = () => {\n\tconst { goBack, canGoBack, navigate } = useSupportNavigation();\n\tconst { availableAIAgents, availableHumanAgents } = useSupport();\n\tconst text = useSupportText();\n\n\tconst history = useConversationHistoryPage({\n\t\tinitialVisibleCount: 4,\n\t\tonOpenConversation: (conversationId) => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: {\n\t\t\t\t\tconversationId,\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tonStartConversation: (initialMessage) => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: {\n\t\t\t\t\tconversationId: PENDING_CONVERSATION_ID,\n\t\t\t\t\tinitialMessage,\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n\n\tconst handleGoBack = () => {\n\t\tif (canGoBack) {\n\t\t\tgoBack();\n\t\t} else {\n\t\t\tnavigate({\n\t\t\t\tpage: \"HOME\",\n\t\t\t});\n\t\t}\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Header onGoBack={handleGoBack}>\n\t\t\t\t<div className=\"flex w-full items-center justify-between gap-2 py-3\">\n\t\t\t\t\t<div className=\"flex flex-col\" />\n\t\t\t\t\t<AvatarStack\n\t\t\t\t\t\taiAgents={availableAIAgents}\n\t\t\t\t\t\tgapWidth={2}\n\t\t\t\t\t\thumanAgents={availableHumanAgents}\n\t\t\t\t\t\tsize={32}\n\t\t\t\t\t\tspacing={28}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</Header>\n\t\t\t<div className=\"sticky top-4 flex flex-1 items-center justify-center\">\n\t\t\t\t<div className=\"flex flex-col items-center gap-2\">\n\t\t\t\t\t<TextEffect\n\t\t\t\t\t\tas=\"h2\"\n\t\t\t\t\t\tclassName=\"max-w-xs text-balance text-center font-co-sans text-2xl leading-normal\"\n\t\t\t\t\t\tdelay={0.5}\n\t\t\t\t\t\tpreset=\"fade-in-blur\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{text(\"page.conversationHistory.title\")}\n\t\t\t\t\t</TextEffect>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div className=\"flex flex-shrink-0 flex-col items-center justify-center gap-2 px-6 pt-20 pb-4\">\n\t\t\t\t{history.conversations.length > 0 && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{history.hasMore && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"relative mt-6 w-full text-co-primary/40 text-xs hover:text-co-primary\"\n\t\t\t\t\t\t\t\tonClick={history.showAll}\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\t\ttextKey=\"page.conversationHistory.showMore\"\n\t\t\t\t\t\t\t\t\tvariables={{ count: history.remainingCount }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<div className=\"mt-6 flex w-full flex-col overflow-clip rounded-md border border-co-border/80\">\n\t\t\t\t\t\t\t{history.visibleConversations.map((conversation) => (\n\t\t\t\t\t\t\t\t<ConversationButtonLink\n\t\t\t\t\t\t\t\t\tclassName=\"rounded-none\"\n\t\t\t\t\t\t\t\t\tconversation={conversation}\n\t\t\t\t\t\t\t\t\tkey={conversation.id}\n\t\t\t\t\t\t\t\t\tonClick={() => history.openConversation(conversation.id)}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\n\t\t\t\t<div className=\"sticky bottom-4 z-10 flex w-full flex-col items-center gap-2\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"relative w-full justify-between\"\n\t\t\t\t\t\tonClick={() => history.startConversation()}\n\t\t\t\t\t\tsize=\"large\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tclassName=\"-translate-y-1/2 absolute top-1/2 right-4 size-3 text-co-primary/60 transition-transform duration-200 group-hover/btn:translate-x-0.5 group-hover/btn:text-co-primary\"\n\t\t\t\t\t\t\tname=\"arrow-right\"\n\t\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Text as=\"span\" textKey=\"common.actions.askQuestion\" />\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Watermark className=\"mt-4 mb-2\" />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAaA,gCAA0C;CACtD,MAAM,EAAE,QAAQ,WAAW,aAAa,sBAAsB;CAC9D,MAAM,EAAE,mBAAmB,yBAAyB,YAAY;CAChE,MAAM,OAAO,gBAAgB;CAE7B,MAAM,UAAU,2BAA2B;EAC1C,qBAAqB;EACrB,qBAAqB,mBAAmB;AACvC,YAAS;IACR,MAAM;IACN,QAAQ,EACP,gBACA;IACD,CAAC;;EAEH,sBAAsB,mBAAmB;AACxC,YAAS;IACR,MAAM;IACN,QAAQ;KACP,gBAAgB;KAChB;KACA;IACD,CAAC;;EAEH,CAAC;CAEF,MAAM,qBAAqB;AAC1B,MAAI,UACH,SAAQ;MAER,UAAS,EACR,MAAM,QACN,CAAC;;AAIJ,QACC;EACC,oBAAC;GAAO,UAAU;aACjB,qBAAC;IAAI,WAAU;eACd,oBAAC,SAAI,WAAU,kBAAkB,EACjC,oBAAC;KACA,UAAU;KACV,UAAU;KACV,aAAa;KACb,MAAM;KACN,SAAS;MACR;KACG;IACE;EACT,oBAAC;GAAI,WAAU;aACd,oBAAC;IAAI,WAAU;cACd,oBAAC;KACA,IAAG;KACH,WAAU;KACV,OAAO;KACP,QAAO;eAEN,KAAK,iCAAiC;MAC3B;KACR;IACD;EACN,qBAAC;GAAI,WAAU;cACb,QAAQ,cAAc,SAAS,KAC/B,4CACE,QAAQ,WACR,oBAAC;IACA,WAAU;IACV,SAAS,QAAQ;IACjB,SAAQ;cAER,oBAAC;KACA,IAAG;KACH,SAAQ;KACR,WAAW,EAAE,OAAO,QAAQ,gBAAgB;MAC3C;KACM,EAEV,oBAAC;IAAI,WAAU;cACb,QAAQ,qBAAqB,KAAK,iBAClC,oBAAC;KACA,WAAU;KACI;KAEd,eAAe,QAAQ,iBAAiB,aAAa,GAAG;OADnD,aAAa,GAEjB,CACD;KACG,IACJ,EAGJ,qBAAC;IAAI,WAAU;eACd,qBAAC;KACA,WAAU;KACV,eAAe,QAAQ,mBAAmB;KAC1C,MAAK;KACL,SAAQ;gBAER,oBAACC;MACA,WAAU;MACV,MAAK;MACL,SAAQ;OACP,EACF,oBAAC;MAAK,IAAG;MAAO,SAAQ;OAA+B;MAC/C,EACT,oBAAC,aAAU,WAAU,cAAc;KAC9B;IACD;KACJ"}
1
+ {"version":3,"file":"conversation-history.js","names":["ConversationHistoryPage: React.FC","Icon"],"sources":["../../../src/support/pages/conversation-history.tsx"],"sourcesContent":["import { useSupport } from \"@cossistant/react\";\nimport { PENDING_CONVERSATION_ID } from \"@cossistant/react/utils/id\";\nimport type React from \"react\";\nimport { useConversationHistoryPage } from \"../../hooks/use-conversation-history-page\";\nimport { AvatarStack } from \"../components/avatar-stack\";\nimport { Button } from \"../components/button\";\nimport { ConversationButtonLink } from \"../components/conversation-button-link\";\nimport { Header } from \"../components/header\";\nimport Icon from \"../components/icons\";\nimport { TextEffect } from \"../components/text-effect\";\nimport { Watermark } from \"../components/watermark\";\nimport { useSupportNavigation } from \"../store/support-store\";\nimport { Text, useSupportText } from \"../text\";\n\n/**\n * Conversation history page component.\n *\n * Displays:\n * - List of all conversations\n * - Pagination controls\n * - Button to start new conversation\n *\n * All logic is handled by the useConversationHistoryPage hook.\n */\nexport const ConversationHistoryPage: React.FC = () => {\n\tconst { goBack, canGoBack, navigate } = useSupportNavigation();\n\tconst { availableAIAgents, availableHumanAgents } = useSupport();\n\tconst text = useSupportText();\n\n\tconst history = useConversationHistoryPage({\n\t\tinitialVisibleCount: 4,\n\t\tonOpenConversation: (conversationId) => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: {\n\t\t\t\t\tconversationId,\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tonStartConversation: (initialMessage) => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: {\n\t\t\t\t\tconversationId: PENDING_CONVERSATION_ID,\n\t\t\t\t\tinitialMessage,\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n\n\tconst handleGoBack = () => {\n\t\tif (canGoBack) {\n\t\t\tgoBack();\n\t\t} else {\n\t\t\tnavigate({\n\t\t\t\tpage: \"HOME\",\n\t\t\t});\n\t\t}\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Header onGoBack={handleGoBack}>\n\t\t\t\t<div className=\"flex w-full items-center justify-between gap-2 py-3\">\n\t\t\t\t\t<div className=\"flex flex-col\">\n\t\t\t\t\t\t<h2 className=\"max-w-xs text-balance font-co-sans text-md leading-normal\">\n\t\t\t\t\t\t\t{text(\"page.conversationHistory.title\")}\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t</div>\n\t\t\t\t\t<AvatarStack\n\t\t\t\t\t\taiAgents={availableAIAgents}\n\t\t\t\t\t\tgapWidth={2}\n\t\t\t\t\t\thumanAgents={availableHumanAgents}\n\t\t\t\t\t\tsize={32}\n\t\t\t\t\t\tspacing={28}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</Header>\n\n\t\t\t<div className=\"flex flex-1 flex-col items-center justify-between gap-2 px-6 pb-4\">\n\t\t\t\t{history.conversations.length > 0 && (\n\t\t\t\t\t<div className=\"flex flex-col items-center justify-between gap-2 pt-10\">\n\t\t\t\t\t\t<div className=\"flex w-full flex-col overflow-clip rounded-md border border-co-border/80\">\n\t\t\t\t\t\t\t{history.visibleConversations.map((conversation) => (\n\t\t\t\t\t\t\t\t<ConversationButtonLink\n\t\t\t\t\t\t\t\t\tclassName=\"rounded-none\"\n\t\t\t\t\t\t\t\t\tconversation={conversation}\n\t\t\t\t\t\t\t\t\tkey={conversation.id}\n\t\t\t\t\t\t\t\t\tonClick={() => history.openConversation(conversation.id)}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{history.hasMore && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"relative mt-6 w-full text-co-primary/40 text-xs hover:text-co-primary\"\n\t\t\t\t\t\t\t\tonClick={history.showAll}\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\t\ttextKey=\"page.conversationHistory.showMore\"\n\t\t\t\t\t\t\t\t\tvariables={{ count: history.remainingCount }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t<div className=\"sticky bottom-4 z-10 flex w-full flex-col items-center gap-2\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"relative w-full justify-between\"\n\t\t\t\t\t\tonClick={() => history.startConversation()}\n\t\t\t\t\t\tsize=\"large\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tclassName=\"-translate-y-1/2 absolute top-1/2 right-4 size-3 text-co-primary/60 transition-transform duration-200 group-hover/btn:translate-x-0.5 group-hover/btn:text-co-primary\"\n\t\t\t\t\t\t\tname=\"arrow-right\"\n\t\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Text as=\"span\" textKey=\"common.actions.askQuestion\" />\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Watermark className=\"mt-4 mb-2\" />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAaA,gCAA0C;CACtD,MAAM,EAAE,QAAQ,WAAW,aAAa,sBAAsB;CAC9D,MAAM,EAAE,mBAAmB,yBAAyB,YAAY;CAChE,MAAM,OAAO,gBAAgB;CAE7B,MAAM,UAAU,2BAA2B;EAC1C,qBAAqB;EACrB,qBAAqB,mBAAmB;AACvC,YAAS;IACR,MAAM;IACN,QAAQ,EACP,gBACA;IACD,CAAC;;EAEH,sBAAsB,mBAAmB;AACxC,YAAS;IACR,MAAM;IACN,QAAQ;KACP,gBAAgB;KAChB;KACA;IACD,CAAC;;EAEH,CAAC;CAEF,MAAM,qBAAqB;AAC1B,MAAI,UACH,SAAQ;MAER,UAAS,EACR,MAAM,QACN,CAAC;;AAIJ,QACC,4CACC,oBAAC;EAAO,UAAU;YACjB,qBAAC;GAAI,WAAU;cACd,oBAAC;IAAI,WAAU;cACd,oBAAC;KAAG,WAAU;eACZ,KAAK,iCAAiC;MACnC;KACA,EACN,oBAAC;IACA,UAAU;IACV,UAAU;IACV,aAAa;IACb,MAAM;IACN,SAAS;KACR;IACG;GACE,EAET,qBAAC;EAAI,WAAU;aACb,QAAQ,cAAc,SAAS,KAC/B,qBAAC;GAAI,WAAU;cACd,oBAAC;IAAI,WAAU;cACb,QAAQ,qBAAqB,KAAK,iBAClC,oBAAC;KACA,WAAU;KACI;KAEd,eAAe,QAAQ,iBAAiB,aAAa,GAAG;OADnD,aAAa,GAEjB,CACD;KACG,EACL,QAAQ,WACR,oBAAC;IACA,WAAU;IACV,SAAS,QAAQ;IACjB,SAAQ;cAER,oBAAC;KACA,IAAG;KACH,SAAQ;KACR,WAAW,EAAE,OAAO,QAAQ,gBAAgB;MAC3C;KACM;IAEL,EAGP,qBAAC;GAAI,WAAU;cACd,qBAAC;IACA,WAAU;IACV,eAAe,QAAQ,mBAAmB;IAC1C,MAAK;IACL,SAAQ;eAER,oBAACC;KACA,WAAU;KACV,MAAK;KACL,SAAQ;MACP,EACF,oBAAC;KAAK,IAAG;KAAO,SAAQ;MAA+B;KAC/C,EACT,oBAAC,aAAU,WAAU,cAAc;IAC9B;GACD,IACJ"}
@@ -1,5 +1,5 @@
1
1
  import { TimelineItem } from "../../timeline-item.js";
2
- import * as react_jsx_runtime8 from "react/jsx-runtime";
2
+ import { ReactElement } from "react";
3
3
 
4
4
  //#region src/support/pages/conversation.d.ts
5
5
  type ConversationPageProps = {
@@ -22,11 +22,8 @@ type ConversationPageProps = {
22
22
  * All conversation logic is handled by the useConversationPage hook,
23
23
  * making this component focused purely on rendering and user interaction.
24
24
  */
25
- declare const ConversationPage: ({
26
- conversationId: initialConversationId,
27
- initialMessage,
28
- items: passedItems
29
- }: ConversationPageProps) => react_jsx_runtime8.JSX.Element;
25
+ type ConversationPageComponent = (props: ConversationPageProps) => ReactElement;
26
+ declare const ConversationPage: ConversationPageComponent;
30
27
  //#endregion
31
28
  export { ConversationPage };
32
29
  //# sourceMappingURL=conversation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","names":[],"sources":["../../../src/support/pages/conversation.tsx"],"sourcesContent":[],"mappings":";;;;KAUK,qBAAA;;;AAVmE;EAiC3D,cAAA,EAAA,MA+EZ;EAAA;;;gBA/EgC,CAAA,EAAA,MAAA;;;;UATxB;;;;;;;;cASI;kBAAoB;;SAAA;GAI9B,0BAAqB,kBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"conversation.d.ts","names":[],"sources":["../../../src/support/pages/conversation.tsx"],"sourcesContent":[],"mappings":";;;;KAcK,qBAAA;;AAZ8C;AA0B9B;EAWR,cAAA,EAAA,MA2GZ;;;;;;;;UAtHQ;;;;;;;;KASJ,yBAAA,WAAoC,0BAA0B;cAEtD,kBAAkB"}
@@ -1,28 +1,29 @@
1
1
  import { AvatarStack } from "../components/avatar-stack.js";
2
- import { useSupportNavigation } from "../store/support-store.js";
2
+ import { useSupportConfig, useSupportNavigation } from "../store/support-store.js";
3
3
  import { Header } from "../components/header.js";
4
4
  import { Text, useSupportText } from "../text/index.js";
5
+ import { useConversation } from "../../hooks/use-conversation.js";
5
6
  import { useConversationPage } from "../../hooks/use-conversation-page.js";
6
7
  import { ConversationTimelineList } from "../components/conversation-timeline.js";
7
8
  import { MultimodalInput } from "../components/multimodal-input.js";
9
+ import { IdentificationTimelineTool } from "../components/timeline-identification-tool.js";
8
10
  import { useSupport } from "../../provider.js";
11
+ import { useMemo } from "react";
12
+ import { ConversationStatus } from "@cossistant/types";
9
13
  import { jsx, jsxs } from "react/jsx-runtime";
10
14
 
11
15
  //#region src/support/pages/conversation.tsx
12
- /**
13
- * Main conversation page component.
14
- *
15
- * All conversation logic is handled by the useConversationPage hook,
16
- * making this component focused purely on rendering and user interaction.
17
- */
18
16
  const ConversationPage = ({ conversationId: initialConversationId, initialMessage, items: passedItems = [] }) => {
19
17
  const { website, availableAIAgents, availableHumanAgents, visitor } = useSupport();
20
18
  const { navigate, replace, goBack, canGoBack } = useSupportNavigation();
19
+ const { isOpen } = useSupportConfig();
21
20
  const text = useSupportText();
21
+ const timelineTools = useMemo(() => ({ identification: { component: IdentificationTimelineTool } }), []);
22
22
  const conversation = useConversationPage({
23
23
  conversationId: initialConversationId,
24
24
  items: passedItems,
25
25
  initialMessage,
26
+ autoSeenEnabled: isOpen,
26
27
  onConversationIdChange: (newConversationId) => {
27
28
  replace({
28
29
  page: "CONVERSATION",
@@ -30,6 +31,8 @@ const ConversationPage = ({ conversationId: initialConversationId, initialMessag
30
31
  });
31
32
  }
32
33
  });
34
+ const { conversation: activeConversation } = useConversation(conversation.isPending ? null : conversation.conversationId, { enabled: !conversation.isPending });
35
+ const isConversationClosed = Boolean(activeConversation && (activeConversation.status === ConversationStatus.RESOLVED || activeConversation.status === ConversationStatus.SPAM || activeConversation.deletedAt));
33
36
  const handleGoBack = () => {
34
37
  if (canGoBack) goBack();
35
38
  else navigate({ page: "HOME" });
@@ -66,9 +69,16 @@ const ConversationPage = ({ conversationId: initialConversationId, initialMessag
66
69
  className: "min-h-0 flex-1 px-4",
67
70
  conversationId: conversation.conversationId,
68
71
  currentVisitorId: visitor?.id,
69
- items: conversation.items
72
+ items: conversation.items,
73
+ tools: timelineTools
70
74
  }),
71
- /* @__PURE__ */ jsx("div", {
75
+ isConversationClosed ? /* @__PURE__ */ jsx("div", {
76
+ className: "m-4 flex items-center justify-center text-balance px-4 pb-6 text-center font-medium text-muted-foreground text-sm",
77
+ children: /* @__PURE__ */ jsx(Text, {
78
+ as: "p",
79
+ textKey: "component.conversationPage.closedMessage"
80
+ })
81
+ }) : /* @__PURE__ */ jsx("div", {
72
82
  className: "flex-shrink-0 p-1",
73
83
  children: /* @__PURE__ */ jsx(MultimodalInput, {
74
84
  disabled: conversation.composer.isSubmitting,
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.js","names":[],"sources":["../../../src/support/pages/conversation.tsx"],"sourcesContent":["import type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport { useConversationPage } from \"../../hooks/use-conversation-page\";\nimport { useSupport } from \"../../provider\";\nimport { AvatarStack } from \"../components/avatar-stack\";\nimport { ConversationTimelineList } from \"../components/conversation-timeline\";\nimport { Header } from \"../components/header\";\nimport { MultimodalInput } from \"../components/multimodal-input\";\nimport { useSupportNavigation } from \"../store\";\nimport { Text, useSupportText } from \"../text\";\n\ntype ConversationPageProps = {\n\t/**\n\t * The conversation ID to display (can be PENDING_CONVERSATION_ID or a real ID).\n\t */\n\tconversationId: string;\n\n\t/**\n\t * Optional initial message to send when opening the conversation.\n\t */\n\tinitialMessage?: string;\n\n\t/**\n\t * Optional timeline items to display (for optimistic updates or initial state).\n\t */\n\titems?: TimelineItem[];\n};\n\n/**\n * Main conversation page component.\n *\n * All conversation logic is handled by the useConversationPage hook,\n * making this component focused purely on rendering and user interaction.\n */\nexport const ConversationPage = ({\n\tconversationId: initialConversationId,\n\tinitialMessage,\n\titems: passedItems = [],\n}: ConversationPageProps) => {\n\tconst { website, availableAIAgents, availableHumanAgents, visitor } =\n\t\tuseSupport();\n\tconst { navigate, replace, goBack, canGoBack } = useSupportNavigation();\n\tconst text = useSupportText();\n\n\t// Main conversation hook - handles all logic\n\tconst conversation = useConversationPage({\n\t\tconversationId: initialConversationId,\n\t\titems: passedItems,\n\t\tinitialMessage,\n\t\tonConversationIdChange: (newConversationId) => {\n\t\t\t// Update navigation when conversation is created\n\t\t\treplace({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: { conversationId: newConversationId },\n\t\t\t});\n\t\t},\n\t});\n\n\tconst handleGoBack = () => {\n\t\tif (canGoBack) {\n\t\t\tgoBack();\n\t\t} else {\n\t\t\tnavigate({ page: \"HOME\" });\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"flex h-full flex-col gap-0 overflow-hidden\">\n\t\t\t<Header onGoBack={handleGoBack}>\n\t\t\t\t<div className=\"flex w-full items-center justify-between gap-2 py-3\">\n\t\t\t\t\t<div className=\"flex flex-col\">\n\t\t\t\t\t\t<p className=\"font-medium text-sm\">{website?.name}</p>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t\t\tclassName=\"text-muted-foreground text-sm\"\n\t\t\t\t\t\t\ttextKey=\"common.labels.supportOnline\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<AvatarStack\n\t\t\t\t\t\taiAgents={availableAIAgents}\n\t\t\t\t\t\tgapWidth={2}\n\t\t\t\t\t\thumanAgents={availableHumanAgents}\n\t\t\t\t\t\tsize={32}\n\t\t\t\t\t\tspacing={28}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</Header>\n\n\t\t\t<ConversationTimelineList\n\t\t\t\tavailableAIAgents={availableAIAgents}\n\t\t\t\tavailableHumanAgents={availableHumanAgents}\n\t\t\t\tclassName=\"min-h-0 flex-1 px-4\"\n\t\t\t\tconversationId={conversation.conversationId}\n\t\t\t\tcurrentVisitorId={visitor?.id}\n\t\t\t\titems={conversation.items}\n\t\t\t/>\n\n\t\t\t<div className=\"flex-shrink-0 p-1\">\n\t\t\t\t<MultimodalInput\n\t\t\t\t\tdisabled={conversation.composer.isSubmitting}\n\t\t\t\t\terror={conversation.error}\n\t\t\t\t\tfiles={conversation.composer.files}\n\t\t\t\t\tisSubmitting={conversation.composer.isSubmitting}\n\t\t\t\t\tonChange={conversation.composer.setMessage}\n\t\t\t\t\tonFileSelect={conversation.composer.addFiles}\n\t\t\t\t\tonRemoveFile={conversation.composer.removeFile}\n\t\t\t\t\tonSubmit={conversation.composer.submit}\n\t\t\t\t\tplaceholder={text(\"component.multimodalInput.placeholder\")}\n\t\t\t\t\tvalue={conversation.composer.message}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,MAAa,oBAAoB,EAChC,gBAAgB,uBAChB,gBACA,OAAO,cAAc,EAAE,OACK;CAC5B,MAAM,EAAE,SAAS,mBAAmB,sBAAsB,YACzD,YAAY;CACb,MAAM,EAAE,UAAU,SAAS,QAAQ,cAAc,sBAAsB;CACvE,MAAM,OAAO,gBAAgB;CAG7B,MAAM,eAAe,oBAAoB;EACxC,gBAAgB;EAChB,OAAO;EACP;EACA,yBAAyB,sBAAsB;AAE9C,WAAQ;IACP,MAAM;IACN,QAAQ,EAAE,gBAAgB,mBAAmB;IAC7C,CAAC;;EAEH,CAAC;CAEF,MAAM,qBAAqB;AAC1B,MAAI,UACH,SAAQ;MAER,UAAS,EAAE,MAAM,QAAQ,CAAC;;AAI5B,QACC,qBAAC;EAAI,WAAU;;GACd,oBAAC;IAAO,UAAU;cACjB,qBAAC;KAAI,WAAU;gBACd,qBAAC;MAAI,WAAU;iBACd,oBAAC;OAAE,WAAU;iBAAuB,SAAS;QAAS,EACtD,oBAAC;OACA,IAAG;OACH,WAAU;OACV,SAAQ;QACP;OACG,EACN,oBAAC;MACA,UAAU;MACV,UAAU;MACV,aAAa;MACb,MAAM;MACN,SAAS;OACR;MACG;KACE;GAET,oBAAC;IACmB;IACG;IACtB,WAAU;IACV,gBAAgB,aAAa;IAC7B,kBAAkB,SAAS;IAC3B,OAAO,aAAa;KACnB;GAEF,oBAAC;IAAI,WAAU;cACd,oBAAC;KACA,UAAU,aAAa,SAAS;KAChC,OAAO,aAAa;KACpB,OAAO,aAAa,SAAS;KAC7B,cAAc,aAAa,SAAS;KACpC,UAAU,aAAa,SAAS;KAChC,cAAc,aAAa,SAAS;KACpC,cAAc,aAAa,SAAS;KACpC,UAAU,aAAa,SAAS;KAChC,aAAa,KAAK,wCAAwC;KAC1D,OAAO,aAAa,SAAS;MAC5B;KACG;;GACD"}
1
+ {"version":3,"file":"conversation.js","names":["ConversationPage: ConversationPageComponent"],"sources":["../../../src/support/pages/conversation.tsx"],"sourcesContent":["import { ConversationStatus } from \"@cossistant/types\";\nimport type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport { type ReactElement, useMemo } from \"react\";\nimport { useConversation } from \"../../hooks/use-conversation\";\nimport { useConversationPage } from \"../../hooks/use-conversation-page\";\nimport { useSupport } from \"../../provider\";\nimport { AvatarStack } from \"../components/avatar-stack\";\nimport { ConversationTimelineList } from \"../components/conversation-timeline\";\nimport { Header } from \"../components/header\";\nimport { MultimodalInput } from \"../components/multimodal-input\";\nimport { IdentificationTimelineTool } from \"../components/timeline-identification-tool\";\nimport { useSupportConfig, useSupportNavigation } from \"../store\";\nimport { Text, useSupportText } from \"../text\";\n\ntype ConversationPageProps = {\n\t/**\n\t * The conversation ID to display (can be PENDING_CONVERSATION_ID or a real ID).\n\t */\n\tconversationId: string;\n\n\t/**\n\t * Optional initial message to send when opening the conversation.\n\t */\n\tinitialMessage?: string;\n\n\t/**\n\t * Optional timeline items to display (for optimistic updates or initial state).\n\t */\n\titems?: TimelineItem[];\n};\n\n/**\n * Main conversation page component.\n *\n * All conversation logic is handled by the useConversationPage hook,\n * making this component focused purely on rendering and user interaction.\n */\ntype ConversationPageComponent = (props: ConversationPageProps) => ReactElement;\n\nexport const ConversationPage: ConversationPageComponent = ({\n\tconversationId: initialConversationId,\n\tinitialMessage,\n\titems: passedItems = [],\n}: ConversationPageProps) => {\n\tconst { website, availableAIAgents, availableHumanAgents, visitor } =\n\t\tuseSupport();\n\tconst { navigate, replace, goBack, canGoBack } = useSupportNavigation();\n\tconst { isOpen } = useSupportConfig();\n\tconst text = useSupportText();\n\n\tconst timelineTools = useMemo(\n\t\t() => ({\n\t\t\tidentification: { component: IdentificationTimelineTool },\n\t\t}),\n\t\t[]\n\t);\n\n\t// Main conversation hook - handles all logic\n\tconst conversation = useConversationPage({\n\t\tconversationId: initialConversationId,\n\t\titems: passedItems,\n\t\tinitialMessage,\n\t\tautoSeenEnabled: isOpen,\n\t\tonConversationIdChange: (newConversationId) => {\n\t\t\t// Update navigation when conversation is created\n\t\t\treplace({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: { conversationId: newConversationId },\n\t\t\t});\n\t\t},\n\t});\n\n\tconst { conversation: activeConversation } = useConversation(\n\t\tconversation.isPending ? null : conversation.conversationId,\n\t\t{ enabled: !conversation.isPending }\n\t);\n\n\tconst isConversationClosed = Boolean(\n\t\tactiveConversation &&\n\t\t\t(activeConversation.status === ConversationStatus.RESOLVED ||\n\t\t\t\tactiveConversation.status === ConversationStatus.SPAM ||\n\t\t\t\tactiveConversation.deletedAt)\n\t);\n\n\tconst handleGoBack = () => {\n\t\tif (canGoBack) {\n\t\t\tgoBack();\n\t\t} else {\n\t\t\tnavigate({ page: \"HOME\" });\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"flex h-full flex-col gap-0 overflow-hidden\">\n\t\t\t<Header onGoBack={handleGoBack}>\n\t\t\t\t<div className=\"flex w-full items-center justify-between gap-2 py-3\">\n\t\t\t\t\t<div className=\"flex flex-col\">\n\t\t\t\t\t\t<p className=\"font-medium text-sm\">{website?.name}</p>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t\t\tclassName=\"text-muted-foreground text-sm\"\n\t\t\t\t\t\t\ttextKey=\"common.labels.supportOnline\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<AvatarStack\n\t\t\t\t\t\taiAgents={availableAIAgents}\n\t\t\t\t\t\tgapWidth={2}\n\t\t\t\t\t\thumanAgents={availableHumanAgents}\n\t\t\t\t\t\tsize={32}\n\t\t\t\t\t\tspacing={28}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</Header>\n\n\t\t\t<ConversationTimelineList\n\t\t\t\tavailableAIAgents={availableAIAgents}\n\t\t\t\tavailableHumanAgents={availableHumanAgents}\n\t\t\t\tclassName=\"min-h-0 flex-1 px-4\"\n\t\t\t\tconversationId={conversation.conversationId}\n\t\t\t\tcurrentVisitorId={visitor?.id}\n\t\t\t\titems={conversation.items}\n\t\t\t\ttools={timelineTools}\n\t\t\t/>\n\n\t\t\t{isConversationClosed ? (\n\t\t\t\t<div className=\"m-4 flex items-center justify-center text-balance px-4 pb-6 text-center font-medium text-muted-foreground text-sm\">\n\t\t\t\t\t<Text as=\"p\" textKey=\"component.conversationPage.closedMessage\" />\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<div className=\"flex-shrink-0 p-1\">\n\t\t\t\t\t<MultimodalInput\n\t\t\t\t\t\tdisabled={conversation.composer.isSubmitting}\n\t\t\t\t\t\terror={conversation.error}\n\t\t\t\t\t\tfiles={conversation.composer.files}\n\t\t\t\t\t\tisSubmitting={conversation.composer.isSubmitting}\n\t\t\t\t\t\tonChange={conversation.composer.setMessage}\n\t\t\t\t\t\tonFileSelect={conversation.composer.addFiles}\n\t\t\t\t\t\tonRemoveFile={conversation.composer.removeFile}\n\t\t\t\t\t\tonSubmit={conversation.composer.submit}\n\t\t\t\t\t\tplaceholder={text(\"component.multimodalInput.placeholder\")}\n\t\t\t\t\t\tvalue={conversation.composer.message}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAuCA,MAAaA,oBAA+C,EAC3D,gBAAgB,uBAChB,gBACA,OAAO,cAAc,EAAE,OACK;CAC5B,MAAM,EAAE,SAAS,mBAAmB,sBAAsB,YACzD,YAAY;CACb,MAAM,EAAE,UAAU,SAAS,QAAQ,cAAc,sBAAsB;CACvE,MAAM,EAAE,WAAW,kBAAkB;CACrC,MAAM,OAAO,gBAAgB;CAE7B,MAAM,gBAAgB,eACd,EACN,gBAAgB,EAAE,WAAW,4BAA4B,EACzD,GACD,EAAE,CACF;CAGD,MAAM,eAAe,oBAAoB;EACxC,gBAAgB;EAChB,OAAO;EACP;EACA,iBAAiB;EACjB,yBAAyB,sBAAsB;AAE9C,WAAQ;IACP,MAAM;IACN,QAAQ,EAAE,gBAAgB,mBAAmB;IAC7C,CAAC;;EAEH,CAAC;CAEF,MAAM,EAAE,cAAc,uBAAuB,gBAC5C,aAAa,YAAY,OAAO,aAAa,gBAC7C,EAAE,SAAS,CAAC,aAAa,WAAW,CACpC;CAED,MAAM,uBAAuB,QAC5B,uBACE,mBAAmB,WAAW,mBAAmB,YACjD,mBAAmB,WAAW,mBAAmB,QACjD,mBAAmB,WACrB;CAED,MAAM,qBAAqB;AAC1B,MAAI,UACH,SAAQ;MAER,UAAS,EAAE,MAAM,QAAQ,CAAC;;AAI5B,QACC,qBAAC;EAAI,WAAU;;GACd,oBAAC;IAAO,UAAU;cACjB,qBAAC;KAAI,WAAU;gBACd,qBAAC;MAAI,WAAU;iBACd,oBAAC;OAAE,WAAU;iBAAuB,SAAS;QAAS,EACtD,oBAAC;OACA,IAAG;OACH,WAAU;OACV,SAAQ;QACP;OACG,EACN,oBAAC;MACA,UAAU;MACV,UAAU;MACV,aAAa;MACb,MAAM;MACN,SAAS;OACR;MACG;KACE;GAET,oBAAC;IACmB;IACG;IACtB,WAAU;IACV,gBAAgB,aAAa;IAC7B,kBAAkB,SAAS;IAC3B,OAAO,aAAa;IACpB,OAAO;KACN;GAED,uBACA,oBAAC;IAAI,WAAU;cACd,oBAAC;KAAK,IAAG;KAAI,SAAQ;MAA6C;KAC7D,GAEN,oBAAC;IAAI,WAAU;cACd,oBAAC;KACA,UAAU,aAAa,SAAS;KAChC,OAAO,aAAa;KACpB,OAAO,aAAa,SAAS;KAC7B,cAAc,aAAa,SAAS;KACpC,UAAU,aAAa,SAAS;KAChC,cAAc,aAAa,SAAS;KACpC,cAAc,aAAa,SAAS;KACpC,UAAU,aAAa,SAAS;KAChC,aAAa,KAAK,wCAAwC;KAC1D,OAAO,aAAa,SAAS;MAC5B;KACG;;GAEF"}
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime10 from "react/jsx-runtime";
1
+ import { ReactElement } from "react";
2
2
 
3
3
  //#region src/support/pages/home.d.ts
4
4
 
@@ -14,7 +14,7 @@ import * as react_jsx_runtime10 from "react/jsx-runtime";
14
14
  *
15
15
  * All logic is handled by the useHomePage hook.
16
16
  */
17
- declare const HomePage: () => react_jsx_runtime10.JSX.Element;
17
+ declare const HomePage: () => ReactElement;
18
18
  //#endregion
19
19
  export { HomePage };
20
20
  //# sourceMappingURL=home.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"home.d.ts","names":[],"sources":["../../../src/support/pages/home.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA0BA;;;;;;;;;cAAa,gBAAQ,mBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"home.d.ts","names":[],"sources":["../../../src/support/pages/home.tsx"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;;;;;;;cAAa,gBAAe"}