@cossistant/react 0.0.1

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 (372) hide show
  1. package/_virtual/rolldown_runtime.js +13 -0
  2. package/conversation.d.ts +312 -0
  3. package/conversation.d.ts.map +1 -0
  4. package/hooks/index.d.ts +23 -0
  5. package/hooks/index.js +24 -0
  6. package/hooks/private/store/use-conversations-store.d.ts +13 -0
  7. package/hooks/private/store/use-conversations-store.d.ts.map +1 -0
  8. package/hooks/private/store/use-conversations-store.js +34 -0
  9. package/hooks/private/store/use-conversations-store.js.map +1 -0
  10. package/hooks/private/store/use-store-selector.d.ts +10 -0
  11. package/hooks/private/store/use-store-selector.d.ts.map +1 -0
  12. package/hooks/private/store/use-store-selector.js +17 -0
  13. package/hooks/private/store/use-store-selector.js.map +1 -0
  14. package/hooks/private/store/use-website-store.d.ts +18 -0
  15. package/hooks/private/store/use-website-store.d.ts.map +1 -0
  16. package/hooks/private/store/use-website-store.js +39 -0
  17. package/hooks/private/store/use-website-store.js.map +1 -0
  18. package/hooks/private/use-client-query.d.ts +25 -0
  19. package/hooks/private/use-client-query.d.ts.map +1 -0
  20. package/hooks/private/use-client-query.js +122 -0
  21. package/hooks/private/use-client-query.js.map +1 -0
  22. package/hooks/private/use-default-messages.d.ts +18 -0
  23. package/hooks/private/use-default-messages.d.ts.map +1 -0
  24. package/hooks/private/use-default-messages.js +45 -0
  25. package/hooks/private/use-default-messages.js.map +1 -0
  26. package/hooks/private/use-grouped-messages.d.ts +54 -0
  27. package/hooks/private/use-grouped-messages.d.ts.map +1 -0
  28. package/hooks/private/use-grouped-messages.js +157 -0
  29. package/hooks/private/use-grouped-messages.js.map +1 -0
  30. package/hooks/private/use-multimodal-input.d.ts +40 -0
  31. package/hooks/private/use-multimodal-input.d.ts.map +1 -0
  32. package/hooks/private/use-multimodal-input.js +129 -0
  33. package/hooks/private/use-multimodal-input.js.map +1 -0
  34. package/hooks/private/use-rest-client.d.ts +17 -0
  35. package/hooks/private/use-rest-client.d.ts.map +1 -0
  36. package/hooks/private/use-rest-client.js +41 -0
  37. package/hooks/private/use-rest-client.js.map +1 -0
  38. package/hooks/private/use-visitor-typing-reporter.d.ts +19 -0
  39. package/hooks/private/use-visitor-typing-reporter.d.ts.map +1 -0
  40. package/hooks/private/use-visitor-typing-reporter.js +140 -0
  41. package/hooks/private/use-visitor-typing-reporter.js.map +1 -0
  42. package/hooks/use-composer-refocus.d.ts +20 -0
  43. package/hooks/use-composer-refocus.d.ts.map +1 -0
  44. package/hooks/use-composer-refocus.js +32 -0
  45. package/hooks/use-composer-refocus.js.map +1 -0
  46. package/hooks/use-conversation-auto-seen.d.ts +54 -0
  47. package/hooks/use-conversation-auto-seen.d.ts.map +1 -0
  48. package/hooks/use-conversation-auto-seen.js +106 -0
  49. package/hooks/use-conversation-auto-seen.js.map +1 -0
  50. package/hooks/use-conversation-history-page.d.ts +86 -0
  51. package/hooks/use-conversation-history-page.d.ts.map +1 -0
  52. package/hooks/use-conversation-history-page.js +97 -0
  53. package/hooks/use-conversation-history-page.js.map +1 -0
  54. package/hooks/use-conversation-lifecycle.d.ts +80 -0
  55. package/hooks/use-conversation-lifecycle.d.ts.map +1 -0
  56. package/hooks/use-conversation-lifecycle.js +54 -0
  57. package/hooks/use-conversation-lifecycle.js.map +1 -0
  58. package/hooks/use-conversation-page.d.ts +82 -0
  59. package/hooks/use-conversation-page.d.ts.map +1 -0
  60. package/hooks/use-conversation-page.js +138 -0
  61. package/hooks/use-conversation-page.js.map +1 -0
  62. package/hooks/use-conversation-seen.d.ts +17 -0
  63. package/hooks/use-conversation-seen.d.ts.map +1 -0
  64. package/hooks/use-conversation-seen.js +58 -0
  65. package/hooks/use-conversation-seen.js.map +1 -0
  66. package/hooks/use-conversation-timeline-items.d.ts +21 -0
  67. package/hooks/use-conversation-timeline-items.d.ts.map +1 -0
  68. package/hooks/use-conversation-timeline-items.js +87 -0
  69. package/hooks/use-conversation-timeline-items.js.map +1 -0
  70. package/hooks/use-conversation-typing.d.ts +13 -0
  71. package/hooks/use-conversation-typing.d.ts.map +1 -0
  72. package/hooks/use-conversation-typing.js +34 -0
  73. package/hooks/use-conversation-typing.js.map +1 -0
  74. package/hooks/use-conversation.d.ts +18 -0
  75. package/hooks/use-conversation.d.ts.map +1 -0
  76. package/hooks/use-conversation.js +44 -0
  77. package/hooks/use-conversation.js.map +1 -0
  78. package/hooks/use-conversations.d.ts +20 -0
  79. package/hooks/use-conversations.d.ts.map +1 -0
  80. package/hooks/use-conversations.js +68 -0
  81. package/hooks/use-conversations.js.map +1 -0
  82. package/hooks/use-create-conversation.d.ts +30 -0
  83. package/hooks/use-create-conversation.d.ts.map +1 -0
  84. package/hooks/use-create-conversation.js +67 -0
  85. package/hooks/use-create-conversation.js.map +1 -0
  86. package/hooks/use-home-page.d.ts +82 -0
  87. package/hooks/use-home-page.d.ts.map +1 -0
  88. package/hooks/use-home-page.js +89 -0
  89. package/hooks/use-home-page.js.map +1 -0
  90. package/hooks/use-message-composer.d.ts +88 -0
  91. package/hooks/use-message-composer.d.ts.map +1 -0
  92. package/hooks/use-message-composer.js +94 -0
  93. package/hooks/use-message-composer.js.map +1 -0
  94. package/hooks/use-realtime-support.d.ts +25 -0
  95. package/hooks/use-realtime-support.d.ts.map +1 -0
  96. package/hooks/use-realtime-support.js +29 -0
  97. package/hooks/use-realtime-support.js.map +1 -0
  98. package/hooks/use-send-message.d.ts +34 -0
  99. package/hooks/use-send-message.d.ts.map +1 -0
  100. package/hooks/use-send-message.js +118 -0
  101. package/hooks/use-send-message.js.map +1 -0
  102. package/hooks/use-visitor.d.ts +28 -0
  103. package/hooks/use-visitor.d.ts.map +1 -0
  104. package/hooks/use-visitor.js +59 -0
  105. package/hooks/use-visitor.js.map +1 -0
  106. package/hooks/use-window-visibility-focus.d.ts +9 -0
  107. package/hooks/use-window-visibility-focus.d.ts.map +1 -0
  108. package/hooks/use-window-visibility-focus.js +53 -0
  109. package/hooks/use-window-visibility-focus.js.map +1 -0
  110. package/identify-visitor.d.ts +18 -0
  111. package/identify-visitor.d.ts.map +1 -0
  112. package/identify-visitor.js +26 -0
  113. package/identify-visitor.js.map +1 -0
  114. package/index.d.ts +38 -0
  115. package/index.js +38 -0
  116. package/package.json +121 -0
  117. package/primitives/avatar/avatar.d.ts +31 -0
  118. package/primitives/avatar/avatar.d.ts.map +1 -0
  119. package/primitives/avatar/avatar.js +49 -0
  120. package/primitives/avatar/avatar.js.map +1 -0
  121. package/primitives/avatar/fallback.d.ts +24 -0
  122. package/primitives/avatar/fallback.d.ts.map +1 -0
  123. package/primitives/avatar/fallback.js +57 -0
  124. package/primitives/avatar/fallback.js.map +1 -0
  125. package/primitives/avatar/image.d.ts +27 -0
  126. package/primitives/avatar/image.d.ts.map +1 -0
  127. package/primitives/avatar/image.js +58 -0
  128. package/primitives/avatar/image.js.map +1 -0
  129. package/primitives/avatar/index.d.ts +4 -0
  130. package/primitives/avatar/index.js +5 -0
  131. package/primitives/avatar/index.parts.d.ts +4 -0
  132. package/primitives/avatar/index.parts.js +5 -0
  133. package/primitives/bubble.d.ts +28 -0
  134. package/primitives/bubble.d.ts.map +1 -0
  135. package/primitives/bubble.js +43 -0
  136. package/primitives/bubble.js.map +1 -0
  137. package/primitives/button.d.ts +19 -0
  138. package/primitives/button.d.ts.map +1 -0
  139. package/primitives/button.js +27 -0
  140. package/primitives/button.js.map +1 -0
  141. package/primitives/conversation-timeline.d.ts +86 -0
  142. package/primitives/conversation-timeline.d.ts.map +1 -0
  143. package/primitives/conversation-timeline.js +119 -0
  144. package/primitives/conversation-timeline.js.map +1 -0
  145. package/primitives/index.d.ts +20 -0
  146. package/primitives/index.d.ts.map +1 -0
  147. package/primitives/index.js +45 -0
  148. package/primitives/index.js.map +1 -0
  149. package/primitives/index.parts.d.ts +13 -0
  150. package/primitives/index.parts.js +14 -0
  151. package/primitives/multimodal-input.d.ts +53 -0
  152. package/primitives/multimodal-input.d.ts.map +1 -0
  153. package/primitives/multimodal-input.js +106 -0
  154. package/primitives/multimodal-input.js.map +1 -0
  155. package/primitives/timeline-item-group.d.ts +166 -0
  156. package/primitives/timeline-item-group.d.ts.map +1 -0
  157. package/primitives/timeline-item-group.js +204 -0
  158. package/primitives/timeline-item-group.js.map +1 -0
  159. package/primitives/timeline-item.d.ts +75 -0
  160. package/primitives/timeline-item.d.ts.map +1 -0
  161. package/primitives/timeline-item.js +145 -0
  162. package/primitives/timeline-item.js.map +1 -0
  163. package/primitives/window.d.ts +31 -0
  164. package/primitives/window.d.ts.map +1 -0
  165. package/primitives/window.js +58 -0
  166. package/primitives/window.js.map +1 -0
  167. package/provider.d.ts +95 -0
  168. package/provider.d.ts.map +1 -0
  169. package/provider.js +124 -0
  170. package/provider.js.map +1 -0
  171. package/realtime/event-filter.d.ts +8 -0
  172. package/realtime/event-filter.d.ts.map +1 -0
  173. package/realtime/event-filter.js +21 -0
  174. package/realtime/event-filter.js.map +1 -0
  175. package/realtime/index.d.ts +6 -0
  176. package/realtime/index.js +7 -0
  177. package/realtime/provider.d.ts +57 -0
  178. package/realtime/provider.d.ts.map +1 -0
  179. package/realtime/provider.js +351 -0
  180. package/realtime/provider.js.map +1 -0
  181. package/realtime/seen-store.d.ts +23 -0
  182. package/realtime/seen-store.d.ts.map +1 -0
  183. package/realtime/seen-store.js +34 -0
  184. package/realtime/seen-store.js.map +1 -0
  185. package/realtime/support-provider.d.ts +17 -0
  186. package/realtime/support-provider.d.ts.map +1 -0
  187. package/realtime/support-provider.js +54 -0
  188. package/realtime/support-provider.js.map +1 -0
  189. package/realtime/typing-store.d.ts +30 -0
  190. package/realtime/typing-store.d.ts.map +1 -0
  191. package/realtime/typing-store.js +34 -0
  192. package/realtime/typing-store.js.map +1 -0
  193. package/realtime/use-realtime.d.ts +29 -0
  194. package/realtime/use-realtime.d.ts.map +1 -0
  195. package/realtime/use-realtime.js +47 -0
  196. package/realtime/use-realtime.js.map +1 -0
  197. package/realtime-events.d.ts +344 -0
  198. package/realtime-events.d.ts.map +1 -0
  199. package/schemas.d.ts +90 -0
  200. package/schemas.d.ts.map +1 -0
  201. package/support/components/avatar-stack.d.ts +45 -0
  202. package/support/components/avatar-stack.d.ts.map +1 -0
  203. package/support/components/avatar-stack.js +72 -0
  204. package/support/components/avatar-stack.js.map +1 -0
  205. package/support/components/avatar.d.ts +15 -0
  206. package/support/components/avatar.d.ts.map +1 -0
  207. package/support/components/avatar.js +23 -0
  208. package/support/components/avatar.js.map +1 -0
  209. package/support/components/bubble.d.ts +10 -0
  210. package/support/components/bubble.d.ts.map +1 -0
  211. package/support/components/bubble.js +95 -0
  212. package/support/components/bubble.js.map +1 -0
  213. package/support/components/button.d.ts +20 -0
  214. package/support/components/button.d.ts.map +1 -0
  215. package/support/components/button.js +41 -0
  216. package/support/components/button.js.map +1 -0
  217. package/support/components/container.d.ts +14 -0
  218. package/support/components/container.d.ts.map +1 -0
  219. package/support/components/container.js +115 -0
  220. package/support/components/container.js.map +1 -0
  221. package/support/components/conversation-button-link.d.ts +34 -0
  222. package/support/components/conversation-button-link.d.ts.map +1 -0
  223. package/support/components/conversation-button-link.js +195 -0
  224. package/support/components/conversation-button-link.js.map +1 -0
  225. package/support/components/conversation-event.d.ts +14 -0
  226. package/support/components/conversation-event.d.ts.map +1 -0
  227. package/support/components/conversation-event.js +76 -0
  228. package/support/components/conversation-event.js.map +1 -0
  229. package/support/components/conversation-timeline.d.ts +17 -0
  230. package/support/components/conversation-timeline.d.ts.map +1 -0
  231. package/support/components/conversation-timeline.js +95 -0
  232. package/support/components/conversation-timeline.js.map +1 -0
  233. package/support/components/cossistant-branding.d.ts +12 -0
  234. package/support/components/cossistant-branding.d.ts.map +1 -0
  235. package/support/components/cossistant-branding.js +22 -0
  236. package/support/components/cossistant-branding.js.map +1 -0
  237. package/support/components/header.d.ts +11 -0
  238. package/support/components/header.d.ts.map +1 -0
  239. package/support/components/header.js +43 -0
  240. package/support/components/header.js.map +1 -0
  241. package/support/components/icons.d.ts +21 -0
  242. package/support/components/icons.d.ts.map +1 -0
  243. package/support/components/icons.js +131 -0
  244. package/support/components/icons.js.map +1 -0
  245. package/support/components/index.d.ts +11 -0
  246. package/support/components/index.js +12 -0
  247. package/support/components/multimodal-input.d.ts +28 -0
  248. package/support/components/multimodal-input.d.ts.map +1 -0
  249. package/support/components/multimodal-input.js +138 -0
  250. package/support/components/multimodal-input.js.map +1 -0
  251. package/support/components/navigation-tab.d.ts +7 -0
  252. package/support/components/navigation-tab.d.ts.map +1 -0
  253. package/support/components/navigation-tab.js +40 -0
  254. package/support/components/navigation-tab.js.map +1 -0
  255. package/support/components/support-content.d.ts +22 -0
  256. package/support/components/support-content.d.ts.map +1 -0
  257. package/support/components/support-content.js +50 -0
  258. package/support/components/support-content.js.map +1 -0
  259. package/support/components/text-effect.d.ts +49 -0
  260. package/support/components/text-effect.d.ts.map +1 -0
  261. package/support/components/text-effect.js +221 -0
  262. package/support/components/text-effect.js.map +1 -0
  263. package/support/components/timeline-message-group.d.ts +16 -0
  264. package/support/components/timeline-message-group.d.ts.map +1 -0
  265. package/support/components/timeline-message-group.js +117 -0
  266. package/support/components/timeline-message-group.js.map +1 -0
  267. package/support/components/timeline-message-item.d.ts +17 -0
  268. package/support/components/timeline-message-item.d.ts.map +1 -0
  269. package/support/components/timeline-message-item.js +42 -0
  270. package/support/components/timeline-message-item.js.map +1 -0
  271. package/support/components/typing-indicator.d.ts +26 -0
  272. package/support/components/typing-indicator.d.ts.map +1 -0
  273. package/support/components/typing-indicator.js +37 -0
  274. package/support/components/typing-indicator.js.map +1 -0
  275. package/support/components/watermark.d.ts +8 -0
  276. package/support/components/watermark.d.ts.map +1 -0
  277. package/support/components/watermark.js +34 -0
  278. package/support/components/watermark.js.map +1 -0
  279. package/support/context/config.d.ts +32 -0
  280. package/support/context/config.d.ts.map +1 -0
  281. package/support/context/config.js +27 -0
  282. package/support/context/config.js.map +1 -0
  283. package/support/context/websocket.d.ts +22 -0
  284. package/support/context/websocket.d.ts.map +1 -0
  285. package/support/context/websocket.js +113 -0
  286. package/support/context/websocket.js.map +1 -0
  287. package/support/index.d.ts +39 -0
  288. package/support/index.d.ts.map +1 -0
  289. package/support/index.js +43 -0
  290. package/support/index.js.map +1 -0
  291. package/support/pages/articles.d.ts +7 -0
  292. package/support/pages/articles.d.ts.map +1 -0
  293. package/support/pages/articles.js +39 -0
  294. package/support/pages/articles.js.map +1 -0
  295. package/support/pages/conversation-history.d.ts +18 -0
  296. package/support/pages/conversation-history.d.ts.map +1 -0
  297. package/support/pages/conversation-history.js +120 -0
  298. package/support/pages/conversation-history.js.map +1 -0
  299. package/support/pages/conversation.d.ts +32 -0
  300. package/support/pages/conversation.d.ts.map +1 -0
  301. package/support/pages/conversation.js +92 -0
  302. package/support/pages/conversation.js.map +1 -0
  303. package/support/pages/home.d.ts +20 -0
  304. package/support/pages/home.d.ts.map +1 -0
  305. package/support/pages/home.js +184 -0
  306. package/support/pages/home.js.map +1 -0
  307. package/support/router.d.ts +14 -0
  308. package/support/router.d.ts.map +1 -0
  309. package/support/router.js +31 -0
  310. package/support/router.js.map +1 -0
  311. package/support/store/index.d.ts +2 -0
  312. package/support/store/index.js +3 -0
  313. package/support/store/support-store.d.ts +42 -0
  314. package/support/store/support-store.d.ts.map +1 -0
  315. package/support/store/support-store.js +66 -0
  316. package/support/store/support-store.js.map +1 -0
  317. package/support/support-CMoDLQoC.css +408 -0
  318. package/support/support-CMoDLQoC.css.map +1 -0
  319. package/support/support.js +1 -0
  320. package/support/text/index.d.ts +35 -0
  321. package/support/text/index.d.ts.map +1 -0
  322. package/support/text/index.js +71 -0
  323. package/support/text/index.js.map +1 -0
  324. package/support/text/locales/en.d.ts +7 -0
  325. package/support/text/locales/en.d.ts.map +1 -0
  326. package/support/text/locales/en.js +65 -0
  327. package/support/text/locales/en.js.map +1 -0
  328. package/support/text/locales/es.d.ts +7 -0
  329. package/support/text/locales/es.d.ts.map +1 -0
  330. package/support/text/locales/es.js +64 -0
  331. package/support/text/locales/es.js.map +1 -0
  332. package/support/text/locales/fr.d.ts +7 -0
  333. package/support/text/locales/fr.d.ts.map +1 -0
  334. package/support/text/locales/fr.js +64 -0
  335. package/support/text/locales/fr.js.map +1 -0
  336. package/support/text/locales/keys.d.ts +216 -0
  337. package/support/text/locales/keys.d.ts.map +1 -0
  338. package/support/text/locales/keys.js +54 -0
  339. package/support/text/locales/keys.js.map +1 -0
  340. package/support/text/runtime.d.ts +17 -0
  341. package/support/text/runtime.d.ts.map +1 -0
  342. package/support/text/runtime.js +156 -0
  343. package/support/text/runtime.js.map +1 -0
  344. package/support/utils/index.d.ts +7 -0
  345. package/support/utils/index.d.ts.map +1 -0
  346. package/support/utils/index.js +11 -0
  347. package/support/utils/index.js.map +1 -0
  348. package/support/utils/time.d.ts +5 -0
  349. package/support/utils/time.d.ts.map +1 -0
  350. package/support/utils/time.js +28 -0
  351. package/support/utils/time.js.map +1 -0
  352. package/support-config.d.ts +20 -0
  353. package/support-config.d.ts.map +1 -0
  354. package/support-config.js +25 -0
  355. package/support-config.js.map +1 -0
  356. package/support.css +2 -0
  357. package/timeline-item.d.ts +133 -0
  358. package/timeline-item.d.ts.map +1 -0
  359. package/utils/id.d.ts +6 -0
  360. package/utils/id.d.ts.map +1 -0
  361. package/utils/id.js +13 -0
  362. package/utils/id.js.map +1 -0
  363. package/utils/index.d.ts +3 -0
  364. package/utils/index.js +4 -0
  365. package/utils/text.d.ts +5 -0
  366. package/utils/text.d.ts.map +1 -0
  367. package/utils/text.js +9 -0
  368. package/utils/text.js.map +1 -0
  369. package/utils/use-render-element.d.ts +22 -0
  370. package/utils/use-render-element.d.ts.map +1 -0
  371. package/utils/use-render-element.js +35 -0
  372. package/utils/use-render-element.js.map +1 -0
@@ -0,0 +1,13 @@
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (all) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ return target;
10
+ };
11
+
12
+ //#endregion
13
+ export { __export };
@@ -0,0 +1,312 @@
1
+ import { z } from "@hono/zod-openapi";
2
+
3
+ //#region ../types/src/api/conversation.d.ts
4
+
5
+ declare const createConversationResponseSchema: z.ZodObject<{
6
+ initialTimelineItems: z.ZodArray<z.ZodObject<{
7
+ id: z.ZodOptional<z.ZodString>;
8
+ conversationId: z.ZodString;
9
+ organizationId: z.ZodString;
10
+ visibility: z.ZodEnum<{
11
+ public: "public";
12
+ private: "private";
13
+ }>;
14
+ type: z.ZodEnum<{
15
+ message: "message";
16
+ event: "event";
17
+ }>;
18
+ text: z.ZodNullable<z.ZodString>;
19
+ parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
20
+ type: z.ZodLiteral<"text">;
21
+ text: z.ZodString;
22
+ }, z.core.$strip>, z.ZodObject<{
23
+ type: z.ZodLiteral<"event">;
24
+ eventType: z.ZodEnum<{
25
+ assigned: "assigned";
26
+ unassigned: "unassigned";
27
+ participant_requested: "participant_requested";
28
+ participant_joined: "participant_joined";
29
+ participant_left: "participant_left";
30
+ status_changed: "status_changed";
31
+ priority_changed: "priority_changed";
32
+ tag_added: "tag_added";
33
+ tag_removed: "tag_removed";
34
+ resolved: "resolved";
35
+ reopened: "reopened";
36
+ }>;
37
+ actorUserId: z.ZodNullable<z.ZodString>;
38
+ actorAiAgentId: z.ZodNullable<z.ZodString>;
39
+ targetUserId: z.ZodNullable<z.ZodString>;
40
+ targetAiAgentId: z.ZodNullable<z.ZodString>;
41
+ message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
+ }, z.core.$strip>, z.ZodObject<{
43
+ type: z.ZodLiteral<"image">;
44
+ url: z.ZodString;
45
+ mediaType: z.ZodString;
46
+ fileName: z.ZodOptional<z.ZodString>;
47
+ size: z.ZodOptional<z.ZodNumber>;
48
+ width: z.ZodOptional<z.ZodNumber>;
49
+ height: z.ZodOptional<z.ZodNumber>;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ type: z.ZodLiteral<"file">;
52
+ url: z.ZodString;
53
+ mediaType: z.ZodString;
54
+ fileName: z.ZodOptional<z.ZodString>;
55
+ size: z.ZodOptional<z.ZodNumber>;
56
+ }, z.core.$strip>]>>;
57
+ userId: z.ZodNullable<z.ZodString>;
58
+ aiAgentId: z.ZodNullable<z.ZodString>;
59
+ visitorId: z.ZodNullable<z.ZodString>;
60
+ createdAt: z.ZodString;
61
+ deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
+ }, z.core.$strip>>;
63
+ conversation: z.ZodObject<{
64
+ id: z.ZodString;
65
+ title: z.ZodOptional<z.ZodString>;
66
+ createdAt: z.ZodString;
67
+ updatedAt: z.ZodString;
68
+ visitorId: z.ZodString;
69
+ websiteId: z.ZodString;
70
+ status: z.ZodDefault<z.ZodEnum<{
71
+ resolved: "resolved";
72
+ open: "open";
73
+ spam: "spam";
74
+ }>>;
75
+ lastTimelineItem: z.ZodOptional<z.ZodObject<{
76
+ id: z.ZodOptional<z.ZodString>;
77
+ conversationId: z.ZodString;
78
+ organizationId: z.ZodString;
79
+ visibility: z.ZodEnum<{
80
+ public: "public";
81
+ private: "private";
82
+ }>;
83
+ type: z.ZodEnum<{
84
+ message: "message";
85
+ event: "event";
86
+ }>;
87
+ text: z.ZodNullable<z.ZodString>;
88
+ parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
89
+ type: z.ZodLiteral<"text">;
90
+ text: z.ZodString;
91
+ }, z.core.$strip>, z.ZodObject<{
92
+ type: z.ZodLiteral<"event">;
93
+ eventType: z.ZodEnum<{
94
+ assigned: "assigned";
95
+ unassigned: "unassigned";
96
+ participant_requested: "participant_requested";
97
+ participant_joined: "participant_joined";
98
+ participant_left: "participant_left";
99
+ status_changed: "status_changed";
100
+ priority_changed: "priority_changed";
101
+ tag_added: "tag_added";
102
+ tag_removed: "tag_removed";
103
+ resolved: "resolved";
104
+ reopened: "reopened";
105
+ }>;
106
+ actorUserId: z.ZodNullable<z.ZodString>;
107
+ actorAiAgentId: z.ZodNullable<z.ZodString>;
108
+ targetUserId: z.ZodNullable<z.ZodString>;
109
+ targetAiAgentId: z.ZodNullable<z.ZodString>;
110
+ message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
111
+ }, z.core.$strip>, z.ZodObject<{
112
+ type: z.ZodLiteral<"image">;
113
+ url: z.ZodString;
114
+ mediaType: z.ZodString;
115
+ fileName: z.ZodOptional<z.ZodString>;
116
+ size: z.ZodOptional<z.ZodNumber>;
117
+ width: z.ZodOptional<z.ZodNumber>;
118
+ height: z.ZodOptional<z.ZodNumber>;
119
+ }, z.core.$strip>, z.ZodObject<{
120
+ type: z.ZodLiteral<"file">;
121
+ url: z.ZodString;
122
+ mediaType: z.ZodString;
123
+ fileName: z.ZodOptional<z.ZodString>;
124
+ size: z.ZodOptional<z.ZodNumber>;
125
+ }, z.core.$strip>]>>;
126
+ userId: z.ZodNullable<z.ZodString>;
127
+ aiAgentId: z.ZodNullable<z.ZodString>;
128
+ visitorId: z.ZodNullable<z.ZodString>;
129
+ createdAt: z.ZodString;
130
+ deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
131
+ }, z.core.$strip>>;
132
+ }, z.core.$strip>;
133
+ }, z.core.$strip>;
134
+ type CreateConversationResponseBody = z.infer<typeof createConversationResponseSchema>;
135
+ declare const listConversationsRequestSchema: z.ZodObject<{
136
+ visitorId: z.ZodOptional<z.ZodString>;
137
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
138
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
139
+ status: z.ZodOptional<z.ZodEnum<{
140
+ open: "open";
141
+ closed: "closed";
142
+ }>>;
143
+ orderBy: z.ZodDefault<z.ZodEnum<{
144
+ createdAt: "createdAt";
145
+ updatedAt: "updatedAt";
146
+ }>>;
147
+ order: z.ZodDefault<z.ZodEnum<{
148
+ desc: "desc";
149
+ asc: "asc";
150
+ }>>;
151
+ }, z.core.$strip>;
152
+ type ListConversationsRequest = z.infer<typeof listConversationsRequestSchema>;
153
+ declare const listConversationsResponseSchema: z.ZodObject<{
154
+ conversations: z.ZodArray<z.ZodObject<{
155
+ id: z.ZodString;
156
+ title: z.ZodOptional<z.ZodString>;
157
+ createdAt: z.ZodString;
158
+ updatedAt: z.ZodString;
159
+ visitorId: z.ZodString;
160
+ websiteId: z.ZodString;
161
+ status: z.ZodDefault<z.ZodEnum<{
162
+ resolved: "resolved";
163
+ open: "open";
164
+ spam: "spam";
165
+ }>>;
166
+ lastTimelineItem: z.ZodOptional<z.ZodObject<{
167
+ id: z.ZodOptional<z.ZodString>;
168
+ conversationId: z.ZodString;
169
+ organizationId: z.ZodString;
170
+ visibility: z.ZodEnum<{
171
+ public: "public";
172
+ private: "private";
173
+ }>;
174
+ type: z.ZodEnum<{
175
+ message: "message";
176
+ event: "event";
177
+ }>;
178
+ text: z.ZodNullable<z.ZodString>;
179
+ parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
180
+ type: z.ZodLiteral<"text">;
181
+ text: z.ZodString;
182
+ }, z.core.$strip>, z.ZodObject<{
183
+ type: z.ZodLiteral<"event">;
184
+ eventType: z.ZodEnum<{
185
+ assigned: "assigned";
186
+ unassigned: "unassigned";
187
+ participant_requested: "participant_requested";
188
+ participant_joined: "participant_joined";
189
+ participant_left: "participant_left";
190
+ status_changed: "status_changed";
191
+ priority_changed: "priority_changed";
192
+ tag_added: "tag_added";
193
+ tag_removed: "tag_removed";
194
+ resolved: "resolved";
195
+ reopened: "reopened";
196
+ }>;
197
+ actorUserId: z.ZodNullable<z.ZodString>;
198
+ actorAiAgentId: z.ZodNullable<z.ZodString>;
199
+ targetUserId: z.ZodNullable<z.ZodString>;
200
+ targetAiAgentId: z.ZodNullable<z.ZodString>;
201
+ message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
202
+ }, z.core.$strip>, z.ZodObject<{
203
+ type: z.ZodLiteral<"image">;
204
+ url: z.ZodString;
205
+ mediaType: z.ZodString;
206
+ fileName: z.ZodOptional<z.ZodString>;
207
+ size: z.ZodOptional<z.ZodNumber>;
208
+ width: z.ZodOptional<z.ZodNumber>;
209
+ height: z.ZodOptional<z.ZodNumber>;
210
+ }, z.core.$strip>, z.ZodObject<{
211
+ type: z.ZodLiteral<"file">;
212
+ url: z.ZodString;
213
+ mediaType: z.ZodString;
214
+ fileName: z.ZodOptional<z.ZodString>;
215
+ size: z.ZodOptional<z.ZodNumber>;
216
+ }, z.core.$strip>]>>;
217
+ userId: z.ZodNullable<z.ZodString>;
218
+ aiAgentId: z.ZodNullable<z.ZodString>;
219
+ visitorId: z.ZodNullable<z.ZodString>;
220
+ createdAt: z.ZodString;
221
+ deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
222
+ }, z.core.$strip>>;
223
+ }, z.core.$strip>>;
224
+ pagination: z.ZodObject<{
225
+ page: z.ZodNumber;
226
+ limit: z.ZodNumber;
227
+ total: z.ZodNumber;
228
+ totalPages: z.ZodNumber;
229
+ hasMore: z.ZodBoolean;
230
+ }, z.core.$strip>;
231
+ }, z.core.$strip>;
232
+ type ListConversationsResponse = z.infer<typeof listConversationsResponseSchema>;
233
+ declare const getConversationRequestSchema: z.ZodObject<{
234
+ conversationId: z.ZodString;
235
+ }, z.core.$strip>;
236
+ type GetConversationRequest = z.infer<typeof getConversationRequestSchema>;
237
+ declare const getConversationResponseSchema: z.ZodObject<{
238
+ conversation: z.ZodObject<{
239
+ id: z.ZodString;
240
+ title: z.ZodOptional<z.ZodString>;
241
+ createdAt: z.ZodString;
242
+ updatedAt: z.ZodString;
243
+ visitorId: z.ZodString;
244
+ websiteId: z.ZodString;
245
+ status: z.ZodDefault<z.ZodEnum<{
246
+ resolved: "resolved";
247
+ open: "open";
248
+ spam: "spam";
249
+ }>>;
250
+ lastTimelineItem: z.ZodOptional<z.ZodObject<{
251
+ id: z.ZodOptional<z.ZodString>;
252
+ conversationId: z.ZodString;
253
+ organizationId: z.ZodString;
254
+ visibility: z.ZodEnum<{
255
+ public: "public";
256
+ private: "private";
257
+ }>;
258
+ type: z.ZodEnum<{
259
+ message: "message";
260
+ event: "event";
261
+ }>;
262
+ text: z.ZodNullable<z.ZodString>;
263
+ parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
264
+ type: z.ZodLiteral<"text">;
265
+ text: z.ZodString;
266
+ }, z.core.$strip>, z.ZodObject<{
267
+ type: z.ZodLiteral<"event">;
268
+ eventType: z.ZodEnum<{
269
+ assigned: "assigned";
270
+ unassigned: "unassigned";
271
+ participant_requested: "participant_requested";
272
+ participant_joined: "participant_joined";
273
+ participant_left: "participant_left";
274
+ status_changed: "status_changed";
275
+ priority_changed: "priority_changed";
276
+ tag_added: "tag_added";
277
+ tag_removed: "tag_removed";
278
+ resolved: "resolved";
279
+ reopened: "reopened";
280
+ }>;
281
+ actorUserId: z.ZodNullable<z.ZodString>;
282
+ actorAiAgentId: z.ZodNullable<z.ZodString>;
283
+ targetUserId: z.ZodNullable<z.ZodString>;
284
+ targetAiAgentId: z.ZodNullable<z.ZodString>;
285
+ message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
286
+ }, z.core.$strip>, z.ZodObject<{
287
+ type: z.ZodLiteral<"image">;
288
+ url: z.ZodString;
289
+ mediaType: z.ZodString;
290
+ fileName: z.ZodOptional<z.ZodString>;
291
+ size: z.ZodOptional<z.ZodNumber>;
292
+ width: z.ZodOptional<z.ZodNumber>;
293
+ height: z.ZodOptional<z.ZodNumber>;
294
+ }, z.core.$strip>, z.ZodObject<{
295
+ type: z.ZodLiteral<"file">;
296
+ url: z.ZodString;
297
+ mediaType: z.ZodString;
298
+ fileName: z.ZodOptional<z.ZodString>;
299
+ size: z.ZodOptional<z.ZodNumber>;
300
+ }, z.core.$strip>]>>;
301
+ userId: z.ZodNullable<z.ZodString>;
302
+ aiAgentId: z.ZodNullable<z.ZodString>;
303
+ visitorId: z.ZodNullable<z.ZodString>;
304
+ createdAt: z.ZodString;
305
+ deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
306
+ }, z.core.$strip>>;
307
+ }, z.core.$strip>;
308
+ }, z.core.$strip>;
309
+ type GetConversationResponse = z.infer<typeof getConversationResponseSchema>;
310
+ //#endregion
311
+ export { CreateConversationResponseBody, GetConversationRequest, GetConversationResponse, ListConversationsRequest, ListConversationsResponse };
312
+ //# sourceMappingURL=conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation.d.ts","names":[],"sources":["../../types/src/api/conversation.ts"],"sourcesContent":[],"mappings":";;;;cA8Ba,kCAAgC,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAA,CAAA,CAAA;MAAA,IAAA,eAAA,YAAA,CAAA;MASjC,KAAA,YAAA,WAA8B,CAAA,SAAA,YAAA,CAAA;QAAA,IAAA,cAAA,CAAA,MAAA,CAAA;QAClC,IAAA,aAAA;MADuC,CAAA,eAAA,CAAA,aAAA,CAAA;QAAK,IAAA,cAAA,CAAA,OAAA,CAAA;QAIvC,SAAA,WAAA,CA2BV;UAAA,QAAA,EAAA,UAAA;;;;;;;;;;;;;;QA3BwC,YAAA,eAAA,YAAA,CAAA;QAAA,eAAA,eAAA,YAAA,CAAA;QA6B/B,OAAA,eAAwB,cAAA,YAAA,CAAA,CAAA;MAAA,CAAA,eAAA,CAAA,aAAA,CAAA;QAC5B,IAAA,cAAA,CAAA,OAAA,CAAA;QADiC,GAAA,aAAA;QAAK,SAAA,aAAA;QAIjC,QAAA,eAaV,YAAA,CAAA;QAAA,IAAA,eAAA,YAAA,CAAA;;;;;;;;;;;;;;;;;;KAlDS,8BAAA,GAAiC,CAAA,CAAE,aACvC;cAGK,gCAA8B,CAAA,CAAA;;;;;;;;;;;;;;;;;KA6B/B,wBAAA,GAA2B,CAAA,CAAE,aACjC;cAGK,iCAA+B,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAAA,OAAA,eAAA,cAAA,YAAA,CAAA,CAAA;MAAA,CAAA,eAAA,CAAA,aAAA,CAAA;QAehC,IAAA,cAAyB,CAAA,OAAA,CAAA;QAAA,GAAA,aAAA;QAC7B,SAAA,aAAA;QADkC,QAAA,eAAA,YAAA,CAAA;QAAK,IAAA,eAAA,YAAA,CAAA;QAIlC,KAAA,eAQV,YAAA,CAAA;QAAA,MAAA,eAAA,YAAA,CAAA;;;QARsC,GAAA,aAAA;QAAA,SAAA,aAAA;QAU7B,QAAA,eAAsB,YAAA,CAAA;QAAA,IAAA,eAAA,YAAA,CAAA;MAC1B,CAAA,eAAA,CAAA,CAAA,CAAA,CAAA;MAD+B,MAAA,eAAA,YAAA,CAAA;MAAK,SAAA,eAAA,YAAA,CAAA;MAI/B,SAAA,eAMV,YAAA,CAAA;MAAA,SAAA,aAAA;;;;;;;;;;;;KAxBS,yBAAA,GAA4B,CAAA,CAAE,aAClC;cAGK,8BAA4B,CAAA,CAAA;;;KAU7B,sBAAA,GAAyB,CAAA,CAAE,aAC/B;cAGK,+BAA6B,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAAA,SAAA,aAAA;QAAA,QAAA,eAAA,YAAA,CAAA;QAQ9B,IAAA,eAAuB,YAAA,CAAA;MAAA,CAAA,eAAA,CAAA,CAAA,CAAA,CAAA;MAC3B,MAAA,eAAA,YAAA,CAAA;MADgC,SAAA,eAAA,YAAA,CAAA;MAAK,SAAA,eAAA,YAAA,CAAA;;;;;;KAAjC,uBAAA,GAA0B,CAAA,CAAE,aAChC"}
@@ -0,0 +1,23 @@
1
+ import { useClientQuery } from "./private/use-client-query.js";
2
+ import { useDefaultMessages } from "./private/use-default-messages.js";
3
+ import { ConversationItem, GroupedMessage, TimelineEventItem, UseGroupedMessagesOptions, UseGroupedMessagesProps, useGroupedMessages } from "./private/use-grouped-messages.js";
4
+ import { UseMultimodalInputOptions, UseMultimodalInputReturn, useMultimodalInput } from "./private/use-multimodal-input.js";
5
+ import { UseClientResult, useClient } from "./private/use-rest-client.js";
6
+ import { UseComposerRefocusOptions, UseComposerRefocusReturn, useComposerRefocus } from "./use-composer-refocus.js";
7
+ import { UseConversationOptions, UseConversationResult, useConversation } from "./use-conversation.js";
8
+ import { CONVERSATION_AUTO_SEEN_DELAY_MS, UseConversationAutoSeenOptions, useConversationAutoSeen } from "./use-conversation-auto-seen.js";
9
+ import { UseConversationHistoryPageOptions, UseConversationHistoryPageReturn, useConversationHistoryPage } from "./use-conversation-history-page.js";
10
+ import { ConversationLifecycleState, UseConversationLifecycleOptions, UseConversationLifecycleReturn, useConversationLifecycle } from "./use-conversation-lifecycle.js";
11
+ import { UseConversationPageOptions, UseConversationPageReturn, useConversationPage } from "./use-conversation-page.js";
12
+ import { useConversationSeen, useDebouncedConversationSeen } from "./use-conversation-seen.js";
13
+ import { UseConversationTimelineItemsOptions, UseConversationTimelineItemsResult, useConversationTimelineItems } from "./use-conversation-timeline-items.js";
14
+ import { ConversationTypingParticipant, useConversationTyping } from "./use-conversation-typing.js";
15
+ import { UseConversationsOptions, UseConversationsResult, useConversations } from "./use-conversations.js";
16
+ import { CreateConversationVariables, UseCreateConversationOptions, UseCreateConversationResult, useCreateConversation } from "./use-create-conversation.js";
17
+ import { UseHomePageOptions, UseHomePageReturn, useHomePage } from "./use-home-page.js";
18
+ import { UseMessageComposerOptions, UseMessageComposerReturn, useMessageComposer } from "./use-message-composer.js";
19
+ import { UseRealtimeSupportOptions, UseRealtimeSupportResult, useRealtimeSupport } from "./use-realtime-support.js";
20
+ import { SendMessageOptions, SendMessageResult, UseSendMessageOptions, UseSendMessageResult, useSendMessage } from "./use-send-message.js";
21
+ import { UseVisitorReturn, useVisitor } from "./use-visitor.js";
22
+ import { WindowVisibilityFocusState, useWindowVisibilityFocus } from "./use-window-visibility-focus.js";
23
+ export { CONVERSATION_AUTO_SEEN_DELAY_MS, ConversationItem, ConversationLifecycleState, ConversationTypingParticipant, CreateConversationVariables, GroupedMessage, SendMessageOptions, SendMessageResult, TimelineEventItem, UseClientResult, UseComposerRefocusOptions, UseComposerRefocusReturn, UseConversationAutoSeenOptions, UseConversationHistoryPageOptions, UseConversationHistoryPageReturn, UseConversationLifecycleOptions, UseConversationLifecycleReturn, UseConversationOptions, UseConversationPageOptions, UseConversationPageReturn, UseConversationResult, UseConversationTimelineItemsOptions, UseConversationTimelineItemsResult, UseConversationsOptions, UseConversationsResult, UseCreateConversationOptions, UseCreateConversationResult, UseGroupedMessagesOptions, UseGroupedMessagesProps, UseHomePageOptions, UseHomePageReturn, UseMessageComposerOptions, UseMessageComposerReturn, UseMultimodalInputOptions, UseMultimodalInputReturn, UseRealtimeSupportOptions, UseRealtimeSupportResult, UseSendMessageOptions, UseSendMessageResult, UseVisitorReturn, WindowVisibilityFocusState, useClient, useClientQuery, useComposerRefocus, useConversation, useConversationAutoSeen, useConversationHistoryPage, useConversationLifecycle, useConversationPage, useConversationSeen, useConversationTimelineItems, useConversationTyping, useConversations, useCreateConversation, useDebouncedConversationSeen, useDefaultMessages, useGroupedMessages, useHomePage, useMessageComposer, useMultimodalInput, useRealtimeSupport, useSendMessage, useVisitor, useWindowVisibilityFocus };
package/hooks/index.js ADDED
@@ -0,0 +1,24 @@
1
+ import { useClientQuery } from "./private/use-client-query.js";
2
+ import { useClient } from "./private/use-rest-client.js";
3
+ import { useWindowVisibilityFocus } from "./use-window-visibility-focus.js";
4
+ import { CONVERSATION_AUTO_SEEN_DELAY_MS, useConversationAutoSeen } from "./use-conversation-auto-seen.js";
5
+ import { useConversationLifecycle } from "./use-conversation-lifecycle.js";
6
+ import { useConversationTimelineItems } from "./use-conversation-timeline-items.js";
7
+ import { useMultimodalInput } from "./private/use-multimodal-input.js";
8
+ import { useSendMessage } from "./use-send-message.js";
9
+ import { useMessageComposer } from "./use-message-composer.js";
10
+ import { useConversationPage } from "./use-conversation-page.js";
11
+ import { useGroupedMessages } from "./private/use-grouped-messages.js";
12
+ import { useComposerRefocus } from "./use-composer-refocus.js";
13
+ import { useConversations } from "./use-conversations.js";
14
+ import { useConversationHistoryPage } from "./use-conversation-history-page.js";
15
+ import { useHomePage } from "./use-home-page.js";
16
+ import { useDefaultMessages } from "./private/use-default-messages.js";
17
+ import { useConversation } from "./use-conversation.js";
18
+ import { useConversationSeen, useDebouncedConversationSeen } from "./use-conversation-seen.js";
19
+ import { useConversationTyping } from "./use-conversation-typing.js";
20
+ import { useCreateConversation } from "./use-create-conversation.js";
21
+ import { useRealtimeSupport } from "./use-realtime-support.js";
22
+ import { useVisitor } from "./use-visitor.js";
23
+
24
+ export { CONVERSATION_AUTO_SEEN_DELAY_MS, useClient, useClientQuery, useComposerRefocus, useConversation, useConversationAutoSeen, useConversationHistoryPage, useConversationLifecycle, useConversationPage, useConversationSeen, useConversationTimelineItems, useConversationTyping, useConversations, useCreateConversation, useDebouncedConversationSeen, useDefaultMessages, useGroupedMessages, useHomePage, useMessageComposer, useMultimodalInput, useRealtimeSupport, useSendMessage, useVisitor, useWindowVisibilityFocus };
@@ -0,0 +1,13 @@
1
+ import { ConversationPagination } from "@cossistant/core";
2
+ import { Conversation } from "@cossistant/types";
3
+
4
+ //#region src/hooks/private/store/use-conversations-store.d.ts
5
+ type ConversationSelection = {
6
+ conversations: Conversation[];
7
+ pagination: ConversationPagination | null;
8
+ };
9
+ declare function useConversationsStore(): ConversationSelection;
10
+ declare function useConversationById(conversationId: string | null): Conversation | null;
11
+ //#endregion
12
+ export { useConversationById, useConversationsStore };
13
+ //# sourceMappingURL=use-conversations-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-conversations-store.d.ts","names":[],"sources":["../../../../src/hooks/private/store/use-conversations-store.ts"],"sourcesContent":[],"mappings":";;;;KAQK,qBAAA;iBACW;EADX,UAAA,EAEQ,sBAFa,GAAA,IAAA;CAAA;AACV,iBAoCA,qBAAA,CAAA,CApCA,EAoCyB,qBApCzB;AACH,iBA2DG,mBAAA,CA3DH,cAAA,EAAA,MAAA,GAAA,IAAA,CAAA,EA6DV,YA7DU,GAAA,IAAA"}
@@ -0,0 +1,34 @@
1
+ import { useStoreSelector } from "./use-store-selector.js";
2
+ import { useSupport } from "../../../provider.js";
3
+
4
+ //#region src/hooks/private/store/use-conversations-store.ts
5
+ function areSelectionsEqual(a, b) {
6
+ if (a === b) return true;
7
+ if (a.pagination !== b.pagination) {
8
+ if (!(a.pagination && b.pagination)) return false;
9
+ if (a.pagination.page !== b.pagination.page || a.pagination.limit !== b.pagination.limit || a.pagination.total !== b.pagination.total || a.pagination.totalPages !== b.pagination.totalPages || a.pagination.hasMore !== b.pagination.hasMore) return false;
10
+ }
11
+ if (a.conversations.length !== b.conversations.length) return false;
12
+ for (let index = 0; index < a.conversations.length; index += 1) if (a.conversations[index] !== b.conversations[index]) return false;
13
+ return true;
14
+ }
15
+ function useConversationsStore() {
16
+ const { client } = useSupport();
17
+ if (!client) throw new Error("useConversationsStore requires a configured Cossistant client");
18
+ return useStoreSelector(client.conversationsStore, (state) => ({
19
+ conversations: state.ids.map((id) => state.byId[id]).filter((conversation) => conversation !== void 0),
20
+ pagination: state.pagination
21
+ }), areSelectionsEqual);
22
+ }
23
+ function useConversationById(conversationId) {
24
+ const { client } = useSupport();
25
+ if (!client) throw new Error("useConversationById requires a configured Cossistant client");
26
+ return useStoreSelector(client.conversationsStore, (state) => {
27
+ if (!conversationId) return null;
28
+ return state.byId[conversationId] ?? null;
29
+ });
30
+ }
31
+
32
+ //#endregion
33
+ export { useConversationById, useConversationsStore };
34
+ //# sourceMappingURL=use-conversations-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-conversations-store.js","names":[],"sources":["../../../../src/hooks/private/store/use-conversations-store.ts"],"sourcesContent":["import type {\n\tConversationPagination,\n\tConversationsState,\n} from \"@cossistant/core\";\nimport type { Conversation } from \"@cossistant/types\";\nimport { useSupport } from \"../../../provider\";\nimport { useStoreSelector } from \"./use-store-selector\";\n\ntype ConversationSelection = {\n\tconversations: Conversation[];\n\tpagination: ConversationPagination | null;\n};\n\nfunction areSelectionsEqual(\n\ta: ConversationSelection,\n\tb: ConversationSelection\n): boolean {\n\tif (a === b) {\n\t\treturn true;\n\t}\n\tif (a.pagination !== b.pagination) {\n\t\tif (!(a.pagination && b.pagination)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (\n\t\t\ta.pagination.page !== b.pagination.page ||\n\t\t\ta.pagination.limit !== b.pagination.limit ||\n\t\t\ta.pagination.total !== b.pagination.total ||\n\t\t\ta.pagination.totalPages !== b.pagination.totalPages ||\n\t\t\ta.pagination.hasMore !== b.pagination.hasMore\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t}\n\tif (a.conversations.length !== b.conversations.length) {\n\t\treturn false;\n\t}\n\tfor (let index = 0; index < a.conversations.length; index += 1) {\n\t\tif (a.conversations[index] !== b.conversations[index]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nexport function useConversationsStore(): ConversationSelection {\n\tconst { client } = useSupport();\n\n\tif (!client) {\n\t\tthrow new Error(\n\t\t\t\"useConversationsStore requires a configured Cossistant client\"\n\t\t);\n\t}\n\n\treturn useStoreSelector(\n\t\tclient.conversationsStore,\n\t\t(state: ConversationsState) => ({\n\t\t\tconversations: state.ids\n\t\t\t\t.map((id) => state.byId[id])\n\t\t\t\t.filter(\n\t\t\t\t\t(conversation): conversation is Conversation =>\n\t\t\t\t\t\tconversation !== undefined\n\t\t\t\t),\n\t\t\tpagination: state.pagination,\n\t\t}),\n\t\tareSelectionsEqual\n\t);\n}\n\nexport function useConversationById(\n\tconversationId: string | null\n): Conversation | null {\n\tconst { client } = useSupport();\n\n\tif (!client) {\n\t\tthrow new Error(\n\t\t\t\"useConversationById requires a configured Cossistant client\"\n\t\t);\n\t}\n\n\treturn useStoreSelector(client.conversationsStore, (state) => {\n\t\tif (!conversationId) {\n\t\t\treturn null;\n\t\t}\n\t\treturn state.byId[conversationId] ?? null;\n\t});\n}\n"],"mappings":";;;;AAaA,SAAS,mBACR,GACA,GACU;AACV,KAAI,MAAM,EACT,QAAO;AAER,KAAI,EAAE,eAAe,EAAE,YAAY;AAClC,MAAI,EAAE,EAAE,cAAc,EAAE,YACvB,QAAO;AAER,MACC,EAAE,WAAW,SAAS,EAAE,WAAW,QACnC,EAAE,WAAW,UAAU,EAAE,WAAW,SACpC,EAAE,WAAW,UAAU,EAAE,WAAW,SACpC,EAAE,WAAW,eAAe,EAAE,WAAW,cACzC,EAAE,WAAW,YAAY,EAAE,WAAW,QAEtC,QAAO;;AAGT,KAAI,EAAE,cAAc,WAAW,EAAE,cAAc,OAC9C,QAAO;AAER,MAAK,IAAI,QAAQ,GAAG,QAAQ,EAAE,cAAc,QAAQ,SAAS,EAC5D,KAAI,EAAE,cAAc,WAAW,EAAE,cAAc,OAC9C,QAAO;AAGT,QAAO;;AAGR,SAAgB,wBAA+C;CAC9D,MAAM,EAAE,WAAW,YAAY;AAE/B,KAAI,CAAC,OACJ,OAAM,IAAI,MACT,gEACA;AAGF,QAAO,iBACN,OAAO,qBACN,WAA+B;EAC/B,eAAe,MAAM,IACnB,KAAK,OAAO,MAAM,KAAK,IAAI,CAC3B,QACC,iBACA,iBAAiB,OAClB;EACF,YAAY,MAAM;EAClB,GACD,mBACA;;AAGF,SAAgB,oBACf,gBACsB;CACtB,MAAM,EAAE,WAAW,YAAY;AAE/B,KAAI,CAAC,OACJ,OAAM,IAAI,MACT,8DACA;AAGF,QAAO,iBAAiB,OAAO,qBAAqB,UAAU;AAC7D,MAAI,CAAC,eACJ,QAAO;AAER,SAAO,MAAM,KAAK,mBAAmB;GACpC"}
@@ -0,0 +1,10 @@
1
+ //#region src/hooks/private/store/use-store-selector.d.ts
2
+ type Subscription<TState> = (state: TState) => void;
3
+ type BasicStore<TState> = {
4
+ getState(): TState;
5
+ subscribe(listener: Subscription<TState>): () => void;
6
+ };
7
+ declare function useStoreSelector<TState, TSelected>(store: BasicStore<TState>, selector: (state: TState) => TSelected, isEqual?: (previous: TSelected, next: TSelected) => boolean): TSelected;
8
+ //#endregion
9
+ export { useStoreSelector };
10
+ //# sourceMappingURL=use-store-selector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-store-selector.d.ts","names":[],"sources":["../../../../src/hooks/private/store/use-store-selector.ts"],"sourcesContent":[],"mappings":";KAEK,+BAA+B;KAE/B,UAFA,CAAA,MAAY,CAAA,GAAA;EAEZ,QAAA,EAAA,EACQ,MADE;EAAA,SAAA,CAAA,QAAA,EAEM,YAFN,CAEmB,MAFnB,CAAA,CAAA,EAAA,GAAA,GAAA,IAAA;;AAEmB,iBAGlB,gBAHkB,CAAA,MAAA,EAAA,SAAA,CAAA,CAAA,KAAA,EAI1B,UAJ0B,CAIf,MAJe,CAAA,EAAA,QAAA,EAAA,CAAA,KAAA,EAKf,MALe,EAAA,GAKJ,SALI,EAAA,OAAA,CAAA,EAAA,CAAA,QAAA,EAMb,SANa,EAAA,IAAA,EAMI,SANJ,EAAA,GAAA,OAAA,CAAA,EAO/B,SAP+B"}
@@ -0,0 +1,17 @@
1
+ import { useRef, useSyncExternalStore } from "react";
2
+
3
+ //#region src/hooks/private/store/use-store-selector.ts
4
+ function useStoreSelector(store, selector, isEqual = Object.is) {
5
+ const selectionRef = useRef(void 0);
6
+ const subscribe = (onStoreChange) => store.subscribe(() => {
7
+ onStoreChange();
8
+ });
9
+ const snapshot = useSyncExternalStore(subscribe, () => store.getState(), () => store.getState());
10
+ const selected = selector(snapshot);
11
+ if (selectionRef.current === void 0 || !isEqual(selectionRef.current, selected)) selectionRef.current = selected;
12
+ return selectionRef.current;
13
+ }
14
+
15
+ //#endregion
16
+ export { useStoreSelector };
17
+ //# sourceMappingURL=use-store-selector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-store-selector.js","names":[],"sources":["../../../../src/hooks/private/store/use-store-selector.ts"],"sourcesContent":["import { useRef, useSyncExternalStore } from \"react\";\n\ntype Subscription<TState> = (state: TState) => void;\n\ntype BasicStore<TState> = {\n\tgetState(): TState;\n\tsubscribe(listener: Subscription<TState>): () => void;\n};\n\nexport function useStoreSelector<TState, TSelected>(\n\tstore: BasicStore<TState>,\n\tselector: (state: TState) => TSelected,\n\tisEqual: (previous: TSelected, next: TSelected) => boolean = Object.is\n): TSelected {\n\tconst selectionRef = useRef<TSelected>(undefined);\n\n\tconst subscribe = (onStoreChange: () => void) =>\n\t\tstore.subscribe(() => {\n\t\t\tonStoreChange();\n\t\t});\n\n\tconst snapshot = useSyncExternalStore(\n\t\tsubscribe,\n\t\t() => store.getState(),\n\t\t() => store.getState()\n\t);\n\tconst selected = selector(snapshot);\n\n\tif (\n\t\tselectionRef.current === undefined ||\n\t\t!isEqual(selectionRef.current, selected)\n\t) {\n\t\tselectionRef.current = selected;\n\t}\n\n\treturn selectionRef.current as TSelected;\n}\n"],"mappings":";;;AASA,SAAgB,iBACf,OACA,UACA,UAA6D,OAAO,IACxD;CACZ,MAAM,eAAe,OAAkB,OAAU;CAEjD,MAAM,aAAa,kBAClB,MAAM,gBAAgB;AACrB,iBAAe;GACd;CAEH,MAAM,WAAW,qBAChB,iBACM,MAAM,UAAU,QAChB,MAAM,UAAU,CACtB;CACD,MAAM,WAAW,SAAS,SAAS;AAEnC,KACC,aAAa,YAAY,UACzB,CAAC,QAAQ,aAAa,SAAS,SAAS,CAExC,cAAa,UAAU;AAGxB,QAAO,aAAa"}
@@ -0,0 +1,18 @@
1
+ import { CossistantClient, WebsiteState } from "@cossistant/core";
2
+
3
+ //#region src/hooks/private/store/use-website-store.d.ts
4
+ type UseWebsiteStoreResult = {
5
+ website: WebsiteState["website"];
6
+ status: WebsiteState["status"];
7
+ isLoading: boolean;
8
+ error: Error | null;
9
+ refresh: () => Promise<WebsiteState["website"] | null>;
10
+ };
11
+ type UseWebsiteStoreOptions = {
12
+ refetchInterval?: number | false;
13
+ refetchOnWindowFocus?: boolean;
14
+ };
15
+ declare function useWebsiteStore(client: CossistantClient, options?: UseWebsiteStoreOptions): UseWebsiteStoreResult;
16
+ //#endregion
17
+ export { UseWebsiteStoreOptions, UseWebsiteStoreResult, useWebsiteStore };
18
+ //# sourceMappingURL=use-website-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-website-store.d.ts","names":[],"sources":["../../../../src/hooks/private/store/use-website-store.ts"],"sourcesContent":[],"mappings":";;;KAgBY,qBAAA;WACF;EADE,MAAA,EAEH,YAFG,CAAA,QAAqB,CAAA;EAAA,SAAA,EAAA,OAAA;OACvB,EAGF,KAHE,GAAA,IAAA;SACD,EAAA,GAAA,GAGO,OAHP,CAGe,YAHf,CAAA,SAAA,CAAA,GAAA,IAAA,CAAA;;AAGe,KAGZ,sBAAA,GAHY;iBAAR,CAAA,EAAA,MAAA,GAAA,KAAA;EAAO,oBAAA,CAAA,EAAA,OAAA;AAGvB,CAAA;AAiBgB,iBAAA,eAAA,CAAe,MAAA,EACtB,gBADsB,EAAA,OAAA,CAAA,EAErB,sBAFqB,CAAA,EAG5B,qBAH4B"}
@@ -0,0 +1,39 @@
1
+ import { useClientQuery } from "../use-client-query.js";
2
+ import { useStoreSelector } from "./use-store-selector.js";
3
+ import { useMemo } from "react";
4
+
5
+ //#region src/hooks/private/store/use-website-store.ts
6
+ function toError(state, fallback) {
7
+ if (fallback) return fallback;
8
+ if (!state.error) return null;
9
+ return new Error(state.error.message);
10
+ }
11
+ function useWebsiteStore(client, options = {}) {
12
+ const store = client.websiteStore ?? (() => {
13
+ throw new Error("Website store is not available on the client instance");
14
+ })();
15
+ const state = useStoreSelector(store, (current) => current);
16
+ const query = useClientQuery({
17
+ client,
18
+ queryFn: (instance, params) => instance.fetchWebsite(params ?? {}),
19
+ enabled: true,
20
+ refetchInterval: options.refetchInterval ?? false,
21
+ refetchOnWindowFocus: options.refetchOnWindowFocus ?? true,
22
+ refetchOnMount: state.status === "idle",
23
+ initialData: state.website ?? void 0
24
+ });
25
+ const error = useMemo(() => toError(state, query.error), [state, query.error]);
26
+ const isLoading = query.isLoading || state.status === "loading" || state.status === "idle";
27
+ const refresh = () => query.refetch({ force: true }).then((result) => result ?? client.websiteStore.getState().website).catch(() => client.websiteStore.getState().website).then((website) => website ?? null);
28
+ return {
29
+ website: state.website,
30
+ status: state.status,
31
+ isLoading,
32
+ error,
33
+ refresh
34
+ };
35
+ }
36
+
37
+ //#endregion
38
+ export { useWebsiteStore };
39
+ //# sourceMappingURL=use-website-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-website-store.js","names":[],"sources":["../../../../src/hooks/private/store/use-website-store.ts"],"sourcesContent":["import type {\n\tCossistantClient,\n\tWebsiteState,\n\tWebsiteStore,\n} from \"@cossistant/core\";\nimport type { PublicWebsiteResponse } from \"@cossistant/types\";\nimport { useMemo } from \"react\";\nimport { useClientQuery } from \"../use-client-query\";\nimport { useStoreSelector } from \"./use-store-selector\";\n\nconst EMPTY_STATE: WebsiteState = {\n\twebsite: null,\n\tstatus: \"idle\",\n\terror: null,\n};\n\nexport type UseWebsiteStoreResult = {\n\twebsite: WebsiteState[\"website\"];\n\tstatus: WebsiteState[\"status\"];\n\tisLoading: boolean;\n\terror: Error | null;\n\trefresh: () => Promise<WebsiteState[\"website\"] | null>;\n};\n\nexport type UseWebsiteStoreOptions = {\n\trefetchInterval?: number | false;\n\trefetchOnWindowFocus?: boolean;\n};\n\nfunction toError(state: WebsiteState, fallback: Error | null): Error | null {\n\tif (fallback) {\n\t\treturn fallback;\n\t}\n\n\tif (!state.error) {\n\t\treturn null;\n\t}\n\n\treturn new Error(state.error.message);\n}\n\nexport function useWebsiteStore(\n\tclient: CossistantClient,\n\toptions: UseWebsiteStoreOptions = {}\n): UseWebsiteStoreResult {\n\tconst store =\n\t\tclient.websiteStore ??\n\t\t((): WebsiteStore => {\n\t\t\tthrow new Error(\"Website store is not available on the client instance\");\n\t\t})();\n\tconst state = useStoreSelector(store, (current) => current);\n\n\tconst query = useClientQuery<PublicWebsiteResponse, { force?: boolean }>({\n\t\tclient,\n\t\tqueryFn: (instance, params) => instance.fetchWebsite(params ?? {}),\n\t\tenabled: true,\n\t\trefetchInterval: options.refetchInterval ?? false,\n\t\trefetchOnWindowFocus: options.refetchOnWindowFocus ?? true,\n\t\trefetchOnMount: state.status === \"idle\",\n\t\tinitialData: state.website ?? undefined,\n\t});\n\n\tconst error = useMemo(\n\t\t() => toError(state, query.error),\n\t\t[state, query.error]\n\t);\n\tconst isLoading =\n\t\tquery.isLoading || state.status === \"loading\" || state.status === \"idle\";\n\n\tconst refresh = () =>\n\t\tquery\n\t\t\t.refetch({ force: true })\n\t\t\t.then((result) => result ?? client.websiteStore.getState().website)\n\t\t\t.catch(() => client.websiteStore.getState().website)\n\t\t\t.then((website) => website ?? null);\n\n\treturn {\n\t\twebsite: state.website,\n\t\tstatus: state.status,\n\t\tisLoading,\n\t\terror,\n\t\trefresh,\n\t};\n}\n"],"mappings":";;;;;AA6BA,SAAS,QAAQ,OAAqB,UAAsC;AAC3E,KAAI,SACH,QAAO;AAGR,KAAI,CAAC,MAAM,MACV,QAAO;AAGR,QAAO,IAAI,MAAM,MAAM,MAAM,QAAQ;;AAGtC,SAAgB,gBACf,QACA,UAAkC,EAAE,EACZ;CACxB,MAAM,QACL,OAAO,uBACc;AACpB,QAAM,IAAI,MAAM,wDAAwD;KACrE;CACL,MAAM,QAAQ,iBAAiB,QAAQ,YAAY,QAAQ;CAE3D,MAAM,QAAQ,eAA2D;EACxE;EACA,UAAU,UAAU,WAAW,SAAS,aAAa,UAAU,EAAE,CAAC;EAClE,SAAS;EACT,iBAAiB,QAAQ,mBAAmB;EAC5C,sBAAsB,QAAQ,wBAAwB;EACtD,gBAAgB,MAAM,WAAW;EACjC,aAAa,MAAM,WAAW;EAC9B,CAAC;CAEF,MAAM,QAAQ,cACP,QAAQ,OAAO,MAAM,MAAM,EACjC,CAAC,OAAO,MAAM,MAAM,CACpB;CACD,MAAM,YACL,MAAM,aAAa,MAAM,WAAW,aAAa,MAAM,WAAW;CAEnE,MAAM,gBACL,MACE,QAAQ,EAAE,OAAO,MAAM,CAAC,CACxB,MAAM,WAAW,UAAU,OAAO,aAAa,UAAU,CAAC,QAAQ,CAClE,YAAY,OAAO,aAAa,UAAU,CAAC,QAAQ,CACnD,MAAM,YAAY,WAAW,KAAK;AAErC,QAAO;EACN,SAAS,MAAM;EACf,QAAQ,MAAM;EACd;EACA;EACA;EACA"}
@@ -0,0 +1,25 @@
1
+ import { CossistantClient } from "@cossistant/core";
2
+
3
+ //#region src/hooks/private/use-client-query.d.ts
4
+ type QueryFn<TData, TArgs> = (client: CossistantClient, args?: TArgs | undefined) => Promise<TData>;
5
+ type UseClientQueryOptions<TData, TArgs> = {
6
+ client: CossistantClient;
7
+ queryFn: QueryFn<TData, TArgs>;
8
+ enabled?: boolean;
9
+ refetchInterval?: number | false;
10
+ refetchOnWindowFocus?: boolean;
11
+ refetchOnMount?: boolean;
12
+ initialData?: TData;
13
+ initialArgs?: TArgs;
14
+ dependencies?: readonly unknown[];
15
+ };
16
+ type UseClientQueryResult<TData, TArgs> = {
17
+ data: TData | undefined;
18
+ error: Error | null;
19
+ isLoading: boolean;
20
+ refetch: (args?: TArgs) => Promise<TData | undefined>;
21
+ };
22
+ declare function useClientQuery<TData, TArgs = void>(options: UseClientQueryOptions<TData, TArgs>): UseClientQueryResult<TData, TArgs>;
23
+ //#endregion
24
+ export { useClientQuery };
25
+ //# sourceMappingURL=use-client-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-client-query.d.ts","names":[],"sources":["../../../src/hooks/private/use-client-query.ts"],"sourcesContent":[],"mappings":";;;KAGK,iCACI,yBACD,sBACH,QAAQ;KAER;EALA,MAAA,EAMI,gBANG;EAAA,OAAA,EAOF,OAPE,CAOM,KAPN,EAOa,KAPb,CAAA;SACH,CAAA,EAAA,OAAA;iBACD,CAAA,EAAA,MAAA,GAAA,KAAA;sBACK,CAAA,EAAA,OAAA;gBAAR,CAAA,EAAA,OAAA;EAAO,WAAA,CAAA,EASG,KATH;EAEP,WAAA,CAAA,EAQU,KARV;EAAqB,YAAA,CAAA,EAAA,SAAA,OAAA,EAAA;;KAYrB,oBAVa,CAAA,KAAA,EAAA,KAAA,CAAA,GAAA;MAAO,EAWlB,KAXkB,GAAA,SAAA;OAAf,EAYF,KAZE,GAAA,IAAA;WAKK,EAAA,OAAA;SACA,EAAA,CAAA,IAAA,CAAA,EAQG,KARH,EAAA,GAQa,OARb,CAQqB,KARrB,GAAA,SAAA,CAAA;CAAK;AAIf,iBAiBW,cAjBS,CAAA,KAAA,EAAA,QAAA,IAAA,CAAA,CAAA,OAAA,EAkBf,qBAlBe,CAkBO,KAlBP,EAkBc,KAlBd,CAAA,CAAA,EAmBtB,oBAnBsB,CAmBD,KAnBC,EAmBM,KAnBN,CAAA"}