@inkeep/agents-ui 0.1.0 → 0.14.8

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 (335) hide show
  1. package/LICENSE +64 -0
  2. package/README.md +1 -67
  3. package/dist/_virtual/index.cjs +1 -0
  4. package/dist/_virtual/index.js +4 -0
  5. package/dist/_virtual/use-sync-external-store-shim.development.cjs +1 -0
  6. package/dist/_virtual/use-sync-external-store-shim.development.js +5 -0
  7. package/dist/_virtual/use-sync-external-store-shim.production.cjs +1 -0
  8. package/dist/_virtual/use-sync-external-store-shim.production.js +5 -0
  9. package/dist/color-mode/index.cjs +1 -0
  10. package/dist/color-mode/index.js +170 -0
  11. package/dist/index.cjs +1 -0
  12. package/dist/index.d.cts +5093 -0
  13. package/dist/index.d.ts +5093 -0
  14. package/dist/index.js +213 -0
  15. package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +9 -0
  16. package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +68 -0
  17. package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.cjs +9 -0
  18. package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +56 -0
  19. package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.cjs +1 -0
  20. package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js +8 -0
  21. package/dist/primitives/atoms/avatars/ai.cjs +1 -0
  22. package/dist/primitives/atoms/avatars/ai.js +99 -0
  23. package/dist/primitives/atoms/avatars/user.cjs +1 -0
  24. package/dist/primitives/atoms/avatars/user.js +27 -0
  25. package/dist/primitives/atoms/cmdk/command-score.cjs +1 -0
  26. package/dist/primitives/atoms/cmdk/command-score.js +46 -0
  27. package/dist/primitives/atoms/cmdk/index.cjs +1 -0
  28. package/dist/primitives/atoms/cmdk/index.js +521 -0
  29. package/dist/primitives/atoms/codeblock/index.cjs +1 -0
  30. package/dist/primitives/atoms/codeblock/index.js +40 -0
  31. package/dist/primitives/atoms/custom-styles.cjs +1 -0
  32. package/dist/primitives/atoms/custom-styles.js +57 -0
  33. package/dist/primitives/atoms/dialog.cjs +1 -0
  34. package/dist/primitives/atoms/dialog.js +226 -0
  35. package/dist/primitives/atoms/error-boundary.cjs +1 -0
  36. package/dist/primitives/atoms/error-boundary.js +9 -0
  37. package/dist/primitives/atoms/icons/built-in-icon-renderer.cjs +1 -0
  38. package/dist/primitives/atoms/icons/built-in-icon-renderer.js +51 -0
  39. package/dist/primitives/atoms/icons/built-in-icons.cjs +1 -0
  40. package/dist/primitives/atoms/icons/built-in-icons.js +86 -0
  41. package/dist/primitives/atoms/icons/checkbox-icon.cjs +1 -0
  42. package/dist/primitives/atoms/icons/checkbox-icon.js +24 -0
  43. package/dist/primitives/atoms/icons/collections/bi.cjs +1 -0
  44. package/dist/primitives/atoms/icons/collections/bi.js +49 -0
  45. package/dist/primitives/atoms/icons/collections/fi.cjs +1 -0
  46. package/dist/primitives/atoms/icons/collections/fi.js +29 -0
  47. package/dist/primitives/atoms/icons/collections/gr.cjs +1 -0
  48. package/dist/primitives/atoms/icons/collections/gr.js +21 -0
  49. package/dist/primitives/atoms/icons/collections/io5.cjs +1 -0
  50. package/dist/primitives/atoms/icons/collections/io5.js +806 -0
  51. package/dist/primitives/atoms/icons/collections/pi.cjs +1 -0
  52. package/dist/primitives/atoms/icons/collections/pi.js +49 -0
  53. package/dist/primitives/atoms/icons/custom-icon.cjs +1 -0
  54. package/dist/primitives/atoms/icons/custom-icon.js +19 -0
  55. package/dist/primitives/atoms/icons/generate-icon.cjs +1 -0
  56. package/dist/primitives/atoms/icons/generate-icon.js +56 -0
  57. package/dist/primitives/atoms/icons/index.cjs +1 -0
  58. package/dist/primitives/atoms/icons/index.js +6 -0
  59. package/dist/primitives/atoms/icons/inkeep-default-icons.cjs +1 -0
  60. package/dist/primitives/atoms/icons/inkeep-default-icons.js +24 -0
  61. package/dist/primitives/atoms/link.cjs +1 -0
  62. package/dist/primitives/atoms/link.js +35 -0
  63. package/dist/primitives/atoms/markdown/components.cjs +1 -0
  64. package/dist/primitives/atoms/markdown/components.js +73 -0
  65. package/dist/primitives/atoms/markdown/index.cjs +1 -0
  66. package/dist/primitives/atoms/markdown/index.js +115 -0
  67. package/dist/primitives/atoms/markdown/rehype-inline-code-property.cjs +1 -0
  68. package/dist/primitives/atoms/markdown/rehype-inline-code-property.js +12 -0
  69. package/dist/primitives/atoms/portal-with-theme.cjs +1 -0
  70. package/dist/primitives/atoms/portal-with-theme.js +12 -0
  71. package/dist/primitives/atoms/portal.cjs +1 -0
  72. package/dist/primitives/atoms/portal.js +19 -0
  73. package/dist/primitives/atoms/select.cjs +1 -0
  74. package/dist/primitives/atoms/select.js +785 -0
  75. package/dist/primitives/atoms/shadow/context.cjs +1 -0
  76. package/dist/primitives/atoms/shadow/context.js +54 -0
  77. package/dist/primitives/atoms/shadow/create.cjs +1 -0
  78. package/dist/primitives/atoms/shadow/create.js +56 -0
  79. package/dist/primitives/atoms/shadow/root.cjs +1 -0
  80. package/dist/primitives/atoms/shadow/root.js +22 -0
  81. package/dist/primitives/atoms/shadow/use-ensured-forwarded-ref.cjs +1 -0
  82. package/dist/primitives/atoms/shadow/use-ensured-forwarded-ref.js +11 -0
  83. package/dist/primitives/atoms/shadow/utils.cjs +1 -0
  84. package/dist/primitives/atoms/shadow/utils.js +16 -0
  85. package/dist/primitives/components/chat-button.cjs +1 -0
  86. package/dist/primitives/components/chat-button.js +46 -0
  87. package/dist/primitives/components/embedded-chat/chat-provider.cjs +1 -0
  88. package/dist/primitives/components/embedded-chat/chat-provider.js +20 -0
  89. package/dist/primitives/components/embedded-chat/use-chat-action.cjs +1 -0
  90. package/dist/primitives/components/embedded-chat/use-chat-action.js +38 -0
  91. package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +3 -0
  92. package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +160 -0
  93. package/dist/primitives/components/embedded-chat/use-stream-processor.cjs +1 -0
  94. package/dist/primitives/components/embedded-chat/use-stream-processor.js +82 -0
  95. package/dist/primitives/components/embedded-chat.cjs +11 -0
  96. package/dist/primitives/components/embedded-chat.js +1898 -0
  97. package/dist/primitives/components/embedded-search/search-provider.cjs +1 -0
  98. package/dist/primitives/components/embedded-search/search-provider.js +26 -0
  99. package/dist/primitives/components/embedded-search/transform-results.cjs +1 -0
  100. package/dist/primitives/components/embedded-search/transform-results.js +47 -0
  101. package/dist/primitives/components/embedded-search/url-query.cjs +1 -0
  102. package/dist/primitives/components/embedded-search/url-query.js +12 -0
  103. package/dist/primitives/components/embedded-search/use-inkeep-search.cjs +1 -0
  104. package/dist/primitives/components/embedded-search/use-inkeep-search.js +35 -0
  105. package/dist/primitives/components/embedded-search/use-search-filter.cjs +1 -0
  106. package/dist/primitives/components/embedded-search/use-search-filter.js +77 -0
  107. package/dist/primitives/components/embedded-search.cjs +1 -0
  108. package/dist/primitives/components/embedded-search.js +628 -0
  109. package/dist/primitives/components/factory.cjs +1 -0
  110. package/dist/primitives/components/factory.js +39 -0
  111. package/dist/primitives/components/index.cjs +1 -0
  112. package/dist/primitives/components/index.js +27 -0
  113. package/dist/primitives/components/modal/modal-provider.cjs +1 -0
  114. package/dist/primitives/components/modal/modal-provider.js +8 -0
  115. package/dist/primitives/components/modal/use-inkeep-modal.cjs +1 -0
  116. package/dist/primitives/components/modal/use-inkeep-modal.js +45 -0
  117. package/dist/primitives/components/modal/widget-auto-focus.cjs +1 -0
  118. package/dist/primitives/components/modal/widget-auto-focus.js +16 -0
  119. package/dist/primitives/components/modal.cjs +1 -0
  120. package/dist/primitives/components/modal.js +40 -0
  121. package/dist/primitives/components/presence.cjs +1 -0
  122. package/dist/primitives/components/presence.js +26 -0
  123. package/dist/primitives/components/searchbar.cjs +1 -0
  124. package/dist/primitives/components/searchbar.js +54 -0
  125. package/dist/primitives/components/sidebar-chat/index.cjs +1 -0
  126. package/dist/primitives/components/sidebar-chat/index.js +86 -0
  127. package/dist/primitives/components/sidebar-chat/use-sidebar-chat-resizer.cjs +1 -0
  128. package/dist/primitives/components/sidebar-chat/use-sidebar-chat-resizer.js +34 -0
  129. package/dist/primitives/components/tagline-logo-icon.cjs +1 -0
  130. package/dist/primitives/components/tagline-logo-icon.js +26 -0
  131. package/dist/primitives/components/use-component-trigger.cjs +1 -0
  132. package/dist/primitives/components/use-component-trigger.js +16 -0
  133. package/dist/primitives/constants/search.cjs +1 -0
  134. package/dist/primitives/constants/search.js +5 -0
  135. package/dist/primitives/hooks/index.cjs +1 -0
  136. package/dist/primitives/hooks/index.js +24 -0
  137. package/dist/primitives/hooks/use-boolean.cjs +1 -0
  138. package/dist/primitives/hooks/use-boolean.js +17 -0
  139. package/dist/primitives/hooks/use-component-classnames.cjs +1 -0
  140. package/dist/primitives/hooks/use-component-classnames.js +14 -0
  141. package/dist/primitives/hooks/use-container-size.cjs +1 -0
  142. package/dist/primitives/hooks/use-container-size.js +18 -0
  143. package/dist/primitives/hooks/use-copy-to-clipboard.cjs +1 -0
  144. package/dist/primitives/hooks/use-copy-to-clipboard.js +24 -0
  145. package/dist/primitives/hooks/use-debounce.cjs +1 -0
  146. package/dist/primitives/hooks/use-debounce.js +16 -0
  147. package/dist/primitives/hooks/use-instant-update.cjs +1 -0
  148. package/dist/primitives/hooks/use-instant-update.js +16 -0
  149. package/dist/primitives/hooks/use-is-mounted.cjs +1 -0
  150. package/dist/primitives/hooks/use-is-mounted.js +11 -0
  151. package/dist/primitives/hooks/use-media-query.cjs +1 -0
  152. package/dist/primitives/hooks/use-media-query.js +14 -0
  153. package/dist/primitives/hooks/use-resize-observer.cjs +1 -0
  154. package/dist/primitives/hooks/use-resize-observer.js +32 -0
  155. package/dist/primitives/hooks/use-scroll-to-bottom.cjs +1 -0
  156. package/dist/primitives/hooks/use-scroll-to-bottom.js +52 -0
  157. package/dist/primitives/hooks/use-scrolling-fades.cjs +1 -0
  158. package/dist/primitives/hooks/use-scrolling-fades.js +18 -0
  159. package/dist/primitives/hooks/use-settle-action.cjs +1 -0
  160. package/dist/primitives/hooks/use-settle-action.js +11 -0
  161. package/dist/primitives/index.cjs +1 -0
  162. package/dist/primitives/index.js +155 -0
  163. package/dist/primitives/providers/attachment-item-provider.cjs +1 -0
  164. package/dist/primitives/providers/attachment-item-provider.js +13 -0
  165. package/dist/primitives/providers/attachments-bar-provider.cjs +1 -0
  166. package/dist/primitives/providers/attachments-bar-provider.js +57 -0
  167. package/dist/primitives/providers/base-events-provider.cjs +1 -0
  168. package/dist/primitives/providers/base-events-provider.js +37 -0
  169. package/dist/primitives/providers/chat-form-provider.cjs +1 -0
  170. package/dist/primitives/providers/chat-form-provider.js +109 -0
  171. package/dist/primitives/providers/config-provider.cjs +1 -0
  172. package/dist/primitives/providers/config-provider.js +38 -0
  173. package/dist/primitives/providers/feedback-item-provider.cjs +1 -0
  174. package/dist/primitives/providers/feedback-item-provider.js +16 -0
  175. package/dist/primitives/providers/feedback-provider.cjs +1 -0
  176. package/dist/primitives/providers/feedback-provider.js +83 -0
  177. package/dist/primitives/providers/form-field-provider.cjs +1 -0
  178. package/dist/primitives/providers/form-field-provider.js +17 -0
  179. package/dist/primitives/providers/help-menu-provider.cjs +1 -0
  180. package/dist/primitives/providers/help-menu-provider.js +19 -0
  181. package/dist/primitives/providers/hover-popover-provider.cjs +1 -0
  182. package/dist/primitives/providers/hover-popover-provider.js +13 -0
  183. package/dist/primitives/providers/index.cjs +1 -0
  184. package/dist/primitives/providers/index.js +57 -0
  185. package/dist/primitives/providers/markdown-provider.cjs +1 -0
  186. package/dist/primitives/providers/markdown-provider.js +8 -0
  187. package/dist/primitives/providers/message-attachments-provider.cjs +1 -0
  188. package/dist/primitives/providers/message-attachments-provider.js +27 -0
  189. package/dist/primitives/providers/message-provider.cjs +1 -0
  190. package/dist/primitives/providers/message-provider.js +14 -0
  191. package/dist/primitives/providers/root-provider.cjs +1 -0
  192. package/dist/primitives/providers/root-provider.js +21 -0
  193. package/dist/primitives/providers/search-events-provider.cjs +1 -0
  194. package/dist/primitives/providers/search-events-provider.js +17 -0
  195. package/dist/primitives/providers/sidebar-chat-provider.cjs +1 -0
  196. package/dist/primitives/providers/sidebar-chat-provider.js +41 -0
  197. package/dist/primitives/providers/source-item-provider.cjs +1 -0
  198. package/dist/primitives/providers/source-item-provider.js +13 -0
  199. package/dist/primitives/providers/theme-provider.cjs +3 -0
  200. package/dist/primitives/providers/theme-provider.js +79 -0
  201. package/dist/primitives/providers/widget-provider.cjs +1 -0
  202. package/dist/primitives/providers/widget-provider.js +8 -0
  203. package/dist/primitives/utils/component-ids.cjs +1 -0
  204. package/dist/primitives/utils/component-ids.js +309 -0
  205. package/dist/primitives/utils/compose-event-handlers.cjs +1 -0
  206. package/dist/primitives/utils/compose-event-handlers.js +10 -0
  207. package/dist/primitives/utils/compose-refs.cjs +1 -0
  208. package/dist/primitives/utils/compose-refs.js +30 -0
  209. package/dist/primitives/utils/default-settings.cjs +1 -0
  210. package/dist/primitives/utils/default-settings.js +50 -0
  211. package/dist/primitives/utils/form.cjs +1 -0
  212. package/dist/primitives/utils/form.js +17 -0
  213. package/dist/primitives/utils/generate-uid.cjs +1 -0
  214. package/dist/primitives/utils/generate-uid.js +14 -0
  215. package/dist/primitives/utils/get-source-icon.cjs +1 -0
  216. package/dist/primitives/utils/get-source-icon.js +11 -0
  217. package/dist/primitives/utils/highlight-emphasis.cjs +1 -0
  218. package/dist/primitives/utils/highlight-emphasis.js +15 -0
  219. package/dist/primitives/utils/merge-props.cjs +1 -0
  220. package/dist/primitives/utils/merge-props.js +41 -0
  221. package/dist/primitives/utils/misc.cjs +1 -0
  222. package/dist/primitives/utils/misc.js +31 -0
  223. package/dist/primitives/utils/split-props.cjs +1 -0
  224. package/dist/primitives/utils/split-props.js +10 -0
  225. package/dist/react/chat-button.cjs +1 -0
  226. package/dist/react/chat-button.js +60 -0
  227. package/dist/react/embedded-chat.cjs +1 -0
  228. package/dist/react/embedded-chat.js +380 -0
  229. package/dist/react/embedded-search-and-chat.cjs +1 -0
  230. package/dist/react/embedded-search-and-chat.impl.cjs +1 -0
  231. package/dist/react/embedded-search-and-chat.impl.js +43 -0
  232. package/dist/react/embedded-search-and-chat.js +66 -0
  233. package/dist/react/embedded-search.cjs +1 -0
  234. package/dist/react/embedded-search.js +181 -0
  235. package/dist/react/index.cjs +1 -0
  236. package/dist/react/index.js +213 -0
  237. package/dist/react/modal.chat.cjs +1 -0
  238. package/dist/react/modal.chat.js +21 -0
  239. package/dist/react/modal.cjs +1 -0
  240. package/dist/react/modal.js +27 -0
  241. package/dist/react/modal.search-and-chat.cjs +1 -0
  242. package/dist/react/modal.search-and-chat.js +27 -0
  243. package/dist/react/modal.search.cjs +1 -0
  244. package/dist/react/modal.search.js +21 -0
  245. package/dist/react/searchbar.cjs +1 -0
  246. package/dist/react/searchbar.js +68 -0
  247. package/dist/react/sidebar-chat.cjs +1 -0
  248. package/dist/react/sidebar-chat.js +49 -0
  249. package/dist/react/utils.cjs +1 -0
  250. package/dist/react/utils.js +20 -0
  251. package/dist/react/widget-toggle.cjs +1 -0
  252. package/dist/react/widget-toggle.js +65 -0
  253. package/dist/styled/components/chat-button.cjs +1 -0
  254. package/dist/styled/components/chat-button.js +56 -0
  255. package/dist/styled/components/data-summary-group.cjs +1 -0
  256. package/dist/styled/components/data-summary-group.js +76 -0
  257. package/dist/styled/components/embedded-chat.cjs +1 -0
  258. package/dist/styled/components/embedded-chat.js +1816 -0
  259. package/dist/styled/components/embedded-search/results-loading.cjs +1 -0
  260. package/dist/styled/components/embedded-search/results-loading.js +39 -0
  261. package/dist/styled/components/embedded-search.cjs +1 -0
  262. package/dist/styled/components/embedded-search.js +680 -0
  263. package/dist/styled/components/index.cjs +1 -0
  264. package/dist/styled/components/index.js +24 -0
  265. package/dist/styled/components/loading-indicator.cjs +1 -0
  266. package/dist/styled/components/loading-indicator.js +36 -0
  267. package/dist/styled/components/message.cjs +1 -0
  268. package/dist/styled/components/message.js +140 -0
  269. package/dist/styled/components/modal.cjs +1 -0
  270. package/dist/styled/components/modal.js +46 -0
  271. package/dist/styled/components/searchbar.cjs +1 -0
  272. package/dist/styled/components/searchbar.js +81 -0
  273. package/dist/styled/components/shadow.cjs +1 -0
  274. package/dist/styled/components/shadow.js +8 -0
  275. package/dist/styled/components/sidebar-chat.cjs +1 -0
  276. package/dist/styled/components/sidebar-chat.js +90 -0
  277. package/dist/styled/components/ui/markdown-styles.cjs +1 -0
  278. package/dist/styled/components/ui/markdown-styles.js +38 -0
  279. package/dist/styled/components/ui/recipes/ai-chat-page-wrapper.cjs +1 -0
  280. package/dist/styled/components/ui/recipes/ai-chat-page-wrapper.js +32 -0
  281. package/dist/styled/components/ui/recipes/attachment.cjs +1 -0
  282. package/dist/styled/components/ui/recipes/attachment.js +28 -0
  283. package/dist/styled/components/ui/recipes/button.cjs +1 -0
  284. package/dist/styled/components/ui/recipes/button.js +81 -0
  285. package/dist/styled/components/ui/recipes/checkbox.cjs +1 -0
  286. package/dist/styled/components/ui/recipes/checkbox.js +23 -0
  287. package/dist/styled/components/ui/recipes/citation.cjs +1 -0
  288. package/dist/styled/components/ui/recipes/citation.js +75 -0
  289. package/dist/styled/components/ui/recipes/icon.cjs +1 -0
  290. package/dist/styled/components/ui/recipes/icon.js +6 -0
  291. package/dist/styled/components/ui/recipes/index.cjs +1 -0
  292. package/dist/styled/components/ui/recipes/index.js +37 -0
  293. package/dist/styled/components/ui/recipes/input.cjs +1 -0
  294. package/dist/styled/components/ui/recipes/input.js +34 -0
  295. package/dist/styled/components/ui/recipes/link.cjs +1 -0
  296. package/dist/styled/components/ui/recipes/link.js +13 -0
  297. package/dist/styled/components/ui/recipes/markdown.cjs +1 -0
  298. package/dist/styled/components/ui/recipes/markdown.js +103 -0
  299. package/dist/styled/components/ui/recipes/modal.cjs +1 -0
  300. package/dist/styled/components/ui/recipes/modal.js +59 -0
  301. package/dist/styled/components/ui/recipes/popover.cjs +1 -0
  302. package/dist/styled/components/ui/recipes/popover.js +20 -0
  303. package/dist/styled/components/ui/recipes/scrollable.cjs +1 -0
  304. package/dist/styled/components/ui/recipes/scrollable.js +15 -0
  305. package/dist/styled/components/ui/recipes/select.cjs +1 -0
  306. package/dist/styled/components/ui/recipes/select.js +38 -0
  307. package/dist/styled/components/ui/recipes/skeleton.cjs +1 -0
  308. package/dist/styled/components/ui/recipes/skeleton.js +16 -0
  309. package/dist/styled/components/ui/recipes/widget-toggle.cjs +1 -0
  310. package/dist/styled/components/ui/recipes/widget-toggle.js +35 -0
  311. package/dist/styled/index.cjs +1 -0
  312. package/dist/styled/index.js +177 -0
  313. package/dist/styled/inkeep.css.cjs +4049 -0
  314. package/dist/styled/inkeep.css.js +4053 -0
  315. package/dist/styled/utils.cjs +1 -0
  316. package/dist/styled/utils.js +11 -0
  317. package/dist/theme/color-utils.cjs +1 -0
  318. package/dist/theme/color-utils.js +21 -0
  319. package/dist/theme/colors.cjs +1 -0
  320. package/dist/theme/colors.js +143 -0
  321. package/dist/theme/index.cjs +1 -0
  322. package/dist/theme/index.js +58 -0
  323. package/dist/theme/utils/create-css-variables.cjs +1 -0
  324. package/dist/theme/utils/create-css-variables.js +24 -0
  325. package/dist/theme/utils/generate-theme-variables.cjs +1 -0
  326. package/dist/theme/utils/generate-theme-variables.js +34 -0
  327. package/dist/types/message.cjs +1 -0
  328. package/dist/types/message.js +5 -0
  329. package/dist/types/types.d.cts +1754 -0
  330. package/dist/types/types.d.ts +1754 -0
  331. package/package.json +132 -39
  332. package/LICENSE.md +0 -51
  333. package/dist/assets/index-3anqgmEs.js +0 -49
  334. package/dist/assets/index-CF_BRP1w.css +0 -1
  335. package/dist/index.html +0 -14
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),n=require("react"),v=require("./root.cjs"),j=require("@radix-ui/react-id"),c=n.createContext(void 0),i=()=>n.useContext(c);function u({wrapperStyles:e={},children:d,customStyles:a,styles:l}){const[s,h]=n.useState(null),[r,x]=n.useState(null),S=n.useMemo(()=>({shadowHost:s,rootElement:r}),[s,r]),w=j.useId(),f=v.default.div;return o.jsxs(f,{id:`inkeep-shadow${w}`,ref:t=>{t&&h(t)},style:e,children:[o.jsx("style",{type:"text/css",dangerouslySetInnerHTML:{__html:`${l}`}}),a,o.jsx("div",{id:"inkeep-widget-root",ref:t=>{t&&x(t)},style:e,children:o.jsx(c.Provider,{value:S,children:s&&r&&d})})]})}const I=e=>i()?e.children:o.jsx(u,{...e});exports.InkeepShadow=I;exports.InkeepShadowProvider=u;exports.ShadowContext=c;exports.useShadow=i;
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import { jsxs as f, jsx as o } from "react/jsx-runtime";
3
+ import { createContext as w, useContext as p, useState as i, useMemo as v } from "react";
4
+ import S from "./root.js";
5
+ import { useId as k } from "@radix-ui/react-id";
6
+ const c = w(void 0), y = () => p(c);
7
+ function I({
8
+ wrapperStyles: t = {},
9
+ children: s,
10
+ customStyles: d,
11
+ styles: u
12
+ }) {
13
+ const [n, l] = i(null), [r, h] = i(null), m = v(() => ({ shadowHost: n, rootElement: r }), [n, r]), x = k(), a = S.div;
14
+ return /* @__PURE__ */ f(
15
+ a,
16
+ {
17
+ id: `inkeep-shadow${x}`,
18
+ ref: (e) => {
19
+ e && l(e);
20
+ },
21
+ style: t,
22
+ children: [
23
+ /* @__PURE__ */ o(
24
+ "style",
25
+ {
26
+ type: "text/css",
27
+ dangerouslySetInnerHTML: {
28
+ __html: `${u}`
29
+ }
30
+ }
31
+ ),
32
+ d,
33
+ /* @__PURE__ */ o(
34
+ "div",
35
+ {
36
+ id: "inkeep-widget-root",
37
+ ref: (e) => {
38
+ e && h(e);
39
+ },
40
+ style: t,
41
+ children: /* @__PURE__ */ o(c.Provider, { value: m, children: n && r && s })
42
+ }
43
+ )
44
+ ]
45
+ }
46
+ );
47
+ }
48
+ const E = (t) => y() ? t.children : /* @__PURE__ */ o(I, { ...t });
49
+ export {
50
+ E as InkeepShadow,
51
+ I as InkeepShadowProvider,
52
+ c as ShadowContext,
53
+ y as useShadow
54
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),s=require("react"),p=require("react-dom"),w=require("./utils.cjs"),x=require("react-dom/server"),g=require("./use-ensured-forwarded-ref.cjs");function m({children:e="",...a}){let t="";return s.isValidElement(e)?t=x.renderToString(e):typeof e=="string"&&(t=e),u.jsx("template",{...a,dangerouslySetInnerHTML:{__html:t}})}function q({root:e,children:a=null}){return p.createPortal(a,e)}function y(e){return s.forwardRef(({mode:t="open",delegatesFocus:l=!1,styleSheets:c=[],ssr:n=!1,children:f=null,...R},d)=>{const r=g.useEnsuredForwardedRef(d),[o,h]=s.useState(null),S=`node_${t}${l}`;return s.useLayoutEffect(()=>{if(r.current)try{if(typeof d=="function"&&d(r.current),n){const{shadowRoot:j}=r.current;h(j);return}const i=r.current.attachShadow({mode:t,delegatesFocus:l});c.length>0&&(i.adoptedStyleSheets=c),h(i)}catch(i){w.handleError({error:i,styleSheets:c,root:o})}},[d,r,c]),u.jsx(e.tag,{ref:r,...R,children:(o||n)&&u.jsx(w.Context.Provider,{value:o,children:n?u.jsx(m,{shadowroot:t,shadowrootmode:t,children:e.render({root:o,ssr:n,children:f})}):u.jsx(q,{root:o,children:e.render({root:o,ssr:n,children:f})})})},S)})}exports.create=y;
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import { jsx as a } from "react/jsx-runtime";
3
+ import R, { forwardRef as s, useState as S, useLayoutEffect as C } from "react";
4
+ import { createPortal as _ } from "react-dom";
5
+ import { handleError as g, Context as y } from "./utils.js";
6
+ import { renderToString as E } from "react-dom/server";
7
+ import { useEnsuredForwardedRef as x } from "./use-ensured-forwarded-ref.js";
8
+ function T({ children: o = "", ...d }) {
9
+ let t = "";
10
+ return R.isValidElement(o) ? t = E(o) : typeof o == "string" && (t = o), /* @__PURE__ */ a("template", { ...d, dangerouslySetInnerHTML: { __html: t } });
11
+ }
12
+ function v({ root: o, children: d = null }) {
13
+ return _(d, o);
14
+ }
15
+ function I(o) {
16
+ return s(
17
+ ({
18
+ mode: t = "open",
19
+ delegatesFocus: i = !1,
20
+ styleSheets: f = [],
21
+ ssr: n = !1,
22
+ children: l = null,
23
+ ...h
24
+ }, u) => {
25
+ const r = x(u), [e, m] = S(null), p = `node_${t}${i}`;
26
+ return C(() => {
27
+ if (r.current)
28
+ try {
29
+ if (typeof u == "function" && u(r.current), n) {
30
+ const { shadowRoot: w } = r.current;
31
+ m(w);
32
+ return;
33
+ }
34
+ const c = r.current.attachShadow({
35
+ mode: t,
36
+ delegatesFocus: i
37
+ });
38
+ f.length > 0 && (c.adoptedStyleSheets = f), m(c);
39
+ } catch (c) {
40
+ g({ error: c, styleSheets: f, root: e });
41
+ }
42
+ }, [u, r, f]), /* @__PURE__ */ a(o.tag, { ref: r, ...h, children: (e || n) && /* @__PURE__ */ a(y.Provider, { value: e, children: n ? /* @__PURE__ */ a(T, { shadowroot: t, shadowrootmode: t, children: o.render({
43
+ root: e,
44
+ ssr: n,
45
+ children: l
46
+ }) }) : /* @__PURE__ */ a(v, { root: e, children: o.render({
47
+ root: e,
48
+ ssr: n,
49
+ children: l
50
+ }) }) }) }, p);
51
+ }
52
+ );
53
+ }
54
+ export {
55
+ I as create
56
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("humps");require("react");const g=require("./create.cjs"),t=new Map;function n(c={},s="core",u=({children:r})=>r){return new Proxy(c,{get:function(f,a){const o=l.decamelize(a,{separator:"-"}),e=`${s}-${o}`;if(!t.has(e)){const i=g.create({tag:o,render:u});t.set(e,i)}return t.get(e)}})}const d=n();exports.createProxy=n;exports.default=d;
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import m from "humps";
3
+ import "react";
4
+ import { create as p } from "./create.js";
5
+ const e = /* @__PURE__ */ new Map();
6
+ function u(n = {}, c = "core", s = ({ children: o }) => o) {
7
+ return new Proxy(n, {
8
+ get: function(f, a) {
9
+ const r = m.decamelize(a, { separator: "-" }), t = `${c}-${r}`;
10
+ if (!e.has(t)) {
11
+ const i = p({ tag: r, render: s });
12
+ e.set(t, i);
13
+ }
14
+ return e.get(t);
15
+ }
16
+ });
17
+ }
18
+ const y = u();
19
+ export {
20
+ u as createProxy,
21
+ y as default
22
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react");function t(e){const u=r.useRef(e?.current);return r.useEffect(()=>{e&&(e.current=u.current)},[e]),u}exports.useEnsuredForwardedRef=t;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { useRef as n, useEffect as r } from "react";
3
+ function c(e) {
4
+ const u = n(e?.current);
5
+ return r(() => {
6
+ e && (e.current = u.current);
7
+ }, [e]), u;
8
+ }
9
+ export {
10
+ c as useEnsuredForwardedRef
11
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),o=r.createContext(null);function a({error:e,styleSheets:t,root:n}){switch(e?.name){case"NotSupportedError":t.length>0&&n&&(n.adoptedStyleSheets=t);break;default:throw e}}exports.Context=o;exports.handleError=a;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { createContext as o } from "react";
3
+ const a = o(null);
4
+ function c({ error: t, styleSheets: e, root: n }) {
5
+ switch (t?.name) {
6
+ case "NotSupportedError":
7
+ e.length > 0 && n && (n.adoptedStyleSheets = e);
8
+ break;
9
+ default:
10
+ throw t;
11
+ }
12
+ }
13
+ export {
14
+ a as Context,
15
+ c as handleError
16
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),s=require("react"),f=require("@radix-ui/react-avatar"),n=require("./factory.cjs"),B=require("../atoms/avatars/ai.cjs"),_=require("../providers/config-provider.cjs"),p=require("../utils/compose-event-handlers.cjs"),A=require("../../color-mode/index.cjs");function P(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const l=P(f),b=n.ikp("div",{_id:"chatButton__Container"}),k=n.ikp("button",{_id:"chatButton__Button"}),y=n.ikp("div",{_id:"chatButton__Text"}),S=n.ikp(l.Root,{_id:"chatButton__AvatarContent"}),j=n.ikp(l.Image,{_id:"chatButton__AvatarImage"}),g=s.memo(e=>{const{onLoadingStatusChange:a,avatar:t,...o}=e,{aiChatSettings:m}=_.useInkeepConfig(),{aiAssistantAvatar:r}=m??{},i=typeof t=="string"?t:A.useColorModeValue(t?.light,t?.dark),u=typeof r=="string"?r:r?.dark,[c,v]=s.useState(i??u);s.useEffect(()=>{v(i??u)},[i,u]);const h=C=>{C==="error"&&v(null)};return c?d.jsx(j,{src:c,alt:"Chat avatar","data-type":"image",onLoadingStatusChange:p.composeEventHandlers(a,h),...o}):d.jsx(B.default,{"data-type":"icon",...e})});exports.ChatButton=k;exports.ChatButtonAvatarContent=S;exports.ChatButtonAvatarImage=g;exports.ChatButtonContainer=b;exports.ChatButtonPrimitiveAvatarImage=g;exports.ChatButtonText=y;
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { jsx as m } from "react/jsx-runtime";
3
+ import { memo as g, useState as d, useEffect as B } from "react";
4
+ import * as u from "@radix-ui/react-avatar";
5
+ import { ikp as t } from "./factory.js";
6
+ import f from "../atoms/avatars/ai.js";
7
+ import { useInkeepConfig as _ } from "../providers/config-provider.js";
8
+ import { composeEventHandlers as l } from "../utils/compose-event-handlers.js";
9
+ import { useColorModeValue as p } from "../../color-mode/index.js";
10
+ const b = t("div", {
11
+ _id: "chatButton__Container"
12
+ }), E = t("button", {
13
+ _id: "chatButton__Button"
14
+ }), U = t("div", {
15
+ _id: "chatButton__Text"
16
+ }), j = t(u.Root, {
17
+ _id: "chatButton__AvatarContent"
18
+ }), A = t(u.Image, {
19
+ _id: "chatButton__AvatarImage"
20
+ }), H = g((r) => {
21
+ const { onLoadingStatusChange: h, avatar: a, ...v } = r, { aiChatSettings: c } = _(), { aiAssistantAvatar: o } = c ?? {}, n = typeof a == "string" ? a : p(a?.light, a?.dark), i = typeof o == "string" ? o : o?.dark, [e, s] = d(
22
+ n ?? i
23
+ );
24
+ return B(() => {
25
+ s(n ?? i);
26
+ }, [n, i]), e ? /* @__PURE__ */ m(
27
+ A,
28
+ {
29
+ src: e,
30
+ alt: "Chat avatar",
31
+ "data-type": "image",
32
+ onLoadingStatusChange: l(h, (C) => {
33
+ C === "error" && s(null);
34
+ }),
35
+ ...v
36
+ }
37
+ ) : /* @__PURE__ */ m(f, { "data-type": "icon", ...r });
38
+ });
39
+ export {
40
+ E as ChatButton,
41
+ j as ChatButtonAvatarContent,
42
+ H as ChatButtonAvatarImage,
43
+ b as ChatButtonContainer,
44
+ H as ChatButtonPrimitiveAvatarImage,
45
+ U as ChatButtonText
46
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("react"),s=require("./use-inkeep-chat.cjs"),u=require("../../providers/feedback-provider.cjs"),a=require("@radix-ui/react-tooltip"),d=require("../../providers/chat-form-provider.cjs");function l(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const h=l(a),c=i.createContext(void 0),v=e=>o.jsx(d.ChatFormProvider,{children:o.jsx(P,{...e})}),P=({children:e,...r})=>{const t=s.useInkeepChat();return o.jsx(c.Provider,{value:{...t,...r},children:o.jsx(u.FeedbackProvider,{children:o.jsx(h.Provider,{children:e})})})},C=()=>{const e=i.useContext(c);if(!e)throw new Error("useChat must be used within a ChatProvider");return e};exports.ChatProvider=v;exports.useChat=C;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import { useContext as n, createContext as m } from "react";
4
+ import { useInkeepChat as s } from "./use-inkeep-chat.js";
5
+ import { FeedbackProvider as a } from "../../providers/feedback-provider.js";
6
+ import * as c from "@radix-ui/react-tooltip";
7
+ import { ChatFormProvider as h } from "../../providers/chat-form-provider.js";
8
+ const o = m(void 0), f = (r) => /* @__PURE__ */ t(h, { children: /* @__PURE__ */ t(d, { ...r }) }), d = ({ children: r, ...e }) => {
9
+ const i = s();
10
+ return /* @__PURE__ */ t(o.Provider, { value: { ...i, ...e }, children: /* @__PURE__ */ t(a, { children: /* @__PURE__ */ t(c.Provider, { children: r }) }) });
11
+ }, l = () => {
12
+ const r = n(o);
13
+ if (!r)
14
+ throw new Error("useChat must be used within a ChatProvider");
15
+ return r;
16
+ };
17
+ export {
18
+ f as ChatProvider,
19
+ l as useChat
20
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../providers/base-events-provider.cjs"),p=require("../../providers/chat-form-provider.cjs"),c=require("../modal/modal-provider.cjs"),d=require("./chat-provider.cjs"),u=e=>{const{logEvent:n}=a.useBaseEvents(),{conversationId:o,messages:t}=d.useChat(),{openForm:s}=p.useChatForm(),i=c.useModal();return{handleAction:r=>{if(e.action.type==="open_form"){r?.onOpenForm?.();const l="name"in e?e:void 0;s?.(e.action.formSettings,l)}else e.action.type==="invoke_callback"&&(e.action.callback({conversation:{id:o,messages:t}}),e.action.shouldCloseModal&&i?.setOpen(!1))},logHelpAction:()=>{"name"in e&&(n({eventName:"get_help_option_clicked",properties:{getHelpOption:e,conversationId:o}}),e.action.type!=="open_form"&&n({eventName:"user_escalation_indicated",properties:{escalationType:"get_help_option",getHelpOption:e,conversationId:o}}))}}};exports.useChatAction=u;
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { useBaseEvents as r } from "../../providers/base-events-provider.js";
3
+ import { useChatForm as a } from "../../providers/chat-form-provider.js";
4
+ import { useModal as m } from "../modal/modal-provider.js";
5
+ import { useChat as f } from "./chat-provider.js";
6
+ const H = (e) => {
7
+ const { logEvent: n } = r(), { conversationId: o, messages: t } = f(), { openForm: s } = a(), i = m();
8
+ return { handleAction: (p) => {
9
+ if (e.action.type === "open_form") {
10
+ p?.onOpenForm?.();
11
+ const l = "name" in e ? e : void 0;
12
+ s?.(e.action.formSettings, l);
13
+ } else e.action.type === "invoke_callback" && (e.action.callback({
14
+ conversation: {
15
+ id: o,
16
+ messages: t
17
+ }
18
+ }), e.action.shouldCloseModal && i?.setOpen(!1));
19
+ }, logHelpAction: () => {
20
+ "name" in e && (n({
21
+ eventName: "get_help_option_clicked",
22
+ properties: {
23
+ getHelpOption: e,
24
+ conversationId: o
25
+ }
26
+ }), e.action.type !== "open_form" && n({
27
+ eventName: "user_escalation_indicated",
28
+ properties: {
29
+ escalationType: "get_help_option",
30
+ getHelpOption: e,
31
+ conversationId: o
32
+ }
33
+ }));
34
+ } };
35
+ };
36
+ export {
37
+ H as useChatAction
38
+ };
@@ -0,0 +1,3 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("@ai-sdk/react"),V=require("ai"),t=require("react"),G=require("../../providers/config-provider.cjs"),X=require("../../hooks/use-media-query.cjs"),Y=require("../../utils/generate-uid.cjs"),Z=require("../../providers/base-events-provider.cjs"),ee=require("../../providers/chat-form-provider.cjs"),te=require("../../providers/widget-provider.cjs"),se=require("@radix-ui/react-use-controllable-state"),ne=()=>{const{baseSettings:m,aiChatSettings:o}=G.useInkeepConfig(),[n="",f]=se.useControllableState({prop:o.conversationId,defaultProp:o.conversationId??""}),{logEvent:i}=Z.useBaseEvents(),[a,u]=t.useState(""),_=e=>u(e.target.value),{filters:v}=m,{onInputMessageChange:k,filters:b,graphUrl:F,context:P,headers:x,apiKey:y}=o,N=e=>{switch(e.code){case 400:return e.message;case 403:return`There seems to be a configuration error. Please contact ${m.organizationDisplayName??"Administrator"}`;default:return`Hmm..
2
+
3
+ It seems I might be having some issues right now. Please clear the chat and try again.`}},[D,A]=t.useState({}),[B,l]=t.useState([]),[R,C]=t.useState(null),{messages:g,sendMessage:U,status:I,setMessages:S,stop:K,error:d}=L.useChat({transport:new V.DefaultChatTransport({api:F,headers:{...y?{Authorization:`Bearer ${y}`}:{},...x},body:{requestContext:P}}),async onFinish(e){await i({eventName:"assistant_message_received",properties:{conversationId:n}}),i({eventName:"assistant_answer_displayed",properties:{conversationId:n}})},onError(e){console.log("onError",e.message),S(c=>{const r=[...c],s=r[r.length-1];return s&&(s.parts=[{type:"text",text:N(e)}]),r})}}),w=I==="submitted",T=I==="streaming",W=g.length===0,p=!a.trim()||w,$=X.useMediaQuery("(max-width: 768px)"),[z,E]=t.useState(null);t.useEffect(()=>{d&&E(d)},[d]);const H=()=>E(null),M=t.useRef(null);t.useEffect(()=>{k?.(a)},[a]);const O=e=>{e.key==="Enter"&&!e.shiftKey&&!p&&!e.nativeEvent.isComposing&&(e.preventDefault(),h())},h=async(e=a)=>{if(p&&(!e||e.trim().length===0))return;l([]),u(""),await i({eventName:"user_message_submitted",properties:{conversationId:n}});const c=v||b?JSON.stringify({...v,...b}):void 0,r={};c&&(r["inkeep-filters"]=c);let s=n;s||(s=`conv_${Y.generateUid(16)}`,f(s)),U({text:e},{headers:r,body:{conversationId:s}})},Q=()=>{K()},q=()=>{H(),S([]),f(""),A({}),l([]),C(null),i({eventName:"chat_clear_button_clicked",properties:{conversationId:n}})},{openForm:j}=ee.useChatForm(),J=te.useWidget();return t.useImperativeHandle(o.chatFunctionsRef,()=>({submitMessage:h,updateInputMessage(e){u(e)},clearChat:q,openForm:e=>{J?.setView("chat"),j(e,void 0)},focusInput:()=>{M.current?.focus()}})),{messages:g,isLoading:w,isStreaming:T,error:z,isSubmitDisabled:p,input:a,handleInputChange:_,handleInputKeyDown:O,handleSubmit:h,stop:Q,clear:q,messageButtons:D,isEmpty:g.length===0,inputRef:M,isMobile:$,messageAttachments:B,setMessageAttachments:l,selectedWorkflow:R,setSelectedWorkflow:C,isNewChat:W,conversationId:n}};exports.useInkeepChat=ne;
@@ -0,0 +1,160 @@
1
+ "use client";
2
+ import { useChat as j } from "@ai-sdk/react";
3
+ import { DefaultChatTransport as G } from "ai";
4
+ import { useState as r, useEffect as x, useRef as X, useImperativeHandle as Y } from "react";
5
+ import { useInkeepConfig as Z } from "../../providers/config-provider.js";
6
+ import { useMediaQuery as ee } from "../../hooks/use-media-query.js";
7
+ import { generateUid as te } from "../../utils/generate-uid.js";
8
+ import { useBaseEvents as se } from "../../providers/base-events-provider.js";
9
+ import { useChatForm as ne } from "../../providers/chat-form-provider.js";
10
+ import { useWidget as oe } from "../../providers/widget-provider.js";
11
+ import { useControllableState as re } from "@radix-ui/react-use-controllable-state";
12
+ const fe = () => {
13
+ const { baseSettings: h, aiChatSettings: a } = Z(), [s = "", f] = re({
14
+ prop: a.conversationId,
15
+ defaultProp: a.conversationId ?? ""
16
+ }), { logEvent: i } = se(), [o, m] = r(""), k = (e) => m(e.target.value), {
17
+ /* shouldBypassCaptcha, */
18
+ filters: v
19
+ } = h, {
20
+ onInputMessageChange: F,
21
+ filters: I,
22
+ graphUrl: N,
23
+ context: D,
24
+ headers: A,
25
+ apiKey: C
26
+ } = a, B = (e) => {
27
+ switch (e.code) {
28
+ case 400:
29
+ return e.message;
30
+ case 403:
31
+ return `There seems to be a configuration error. Please contact ${h.organizationDisplayName ?? "Administrator"}`;
32
+ default:
33
+ return `Hmm..
34
+
35
+ It seems I might be having some issues right now. Please clear the chat and try again.`;
36
+ }
37
+ }, [K, P] = r({}), [R, u] = r([]), [W, b] = r(null), {
38
+ messages: l,
39
+ sendMessage: $,
40
+ status: y,
41
+ setMessages: w,
42
+ stop: z,
43
+ error: p
44
+ } = j({
45
+ transport: new G({
46
+ api: N,
47
+ headers: {
48
+ ...C ? { Authorization: `Bearer ${C}` } : {},
49
+ ...A
50
+ },
51
+ body: {
52
+ requestContext: D
53
+ }
54
+ }),
55
+ async onFinish(e) {
56
+ await i({
57
+ eventName: "assistant_message_received",
58
+ properties: {
59
+ conversationId: s
60
+ }
61
+ }), i({
62
+ eventName: "assistant_answer_displayed",
63
+ properties: {
64
+ conversationId: s
65
+ }
66
+ });
67
+ },
68
+ onError(e) {
69
+ console.log("onError", e.message), w((c) => {
70
+ const n = [...c], t = n[n.length - 1];
71
+ return t && (t.parts = [{ type: "text", text: B(e) }]), n;
72
+ });
73
+ }
74
+ }), E = y === "submitted", H = y === "streaming", T = l.length === 0, g = !o.trim() || E, U = ee("(max-width: 768px)"), [q, M] = r(null);
75
+ x(() => {
76
+ p && M(p);
77
+ }, [p]);
78
+ const J = () => M(null), S = X(null);
79
+ x(() => {
80
+ F?.(o);
81
+ }, [o]);
82
+ const L = (e) => {
83
+ e.key === "Enter" && !e.shiftKey && !g && !e.nativeEvent.isComposing && (e.preventDefault(), d());
84
+ }, d = async (e = o) => {
85
+ if (g && (!e || e.trim().length === 0)) return;
86
+ u([]), m(""), await i({
87
+ eventName: "user_message_submitted",
88
+ properties: {
89
+ conversationId: s
90
+ }
91
+ });
92
+ const c = v || I ? JSON.stringify({
93
+ ...v,
94
+ ...I
95
+ }) : void 0, n = {};
96
+ c && (n["inkeep-filters"] = c);
97
+ let t = s;
98
+ t || (t = `conv_${te(16)}`, f(t)), $(
99
+ // { ...userMessage, files },
100
+ // { ...userMessage, },
101
+ {
102
+ text: e
103
+ },
104
+ {
105
+ headers: n,
106
+ body: {
107
+ conversationId: t
108
+ }
109
+ }
110
+ );
111
+ }, O = () => {
112
+ z();
113
+ }, _ = () => {
114
+ J(), w([]), f(""), P({}), u([]), b(null), i({
115
+ eventName: "chat_clear_button_clicked",
116
+ properties: {
117
+ conversationId: s
118
+ }
119
+ });
120
+ }, { openForm: Q } = ne(), V = oe();
121
+ return Y(a.chatFunctionsRef, () => ({
122
+ submitMessage: d,
123
+ updateInputMessage(e) {
124
+ m(e);
125
+ },
126
+ clearChat: _,
127
+ openForm: (e) => {
128
+ V?.setView("chat"), Q(e, void 0);
129
+ },
130
+ focusInput: () => {
131
+ S.current?.focus();
132
+ }
133
+ })), {
134
+ messages: l,
135
+ isLoading: E,
136
+ isStreaming: H,
137
+ error: q,
138
+ isSubmitDisabled: g,
139
+ input: o,
140
+ handleInputChange: k,
141
+ handleInputKeyDown: L,
142
+ handleSubmit: d,
143
+ stop: O,
144
+ clear: _,
145
+ messageButtons: K,
146
+ isEmpty: l.length === 0,
147
+ inputRef: S,
148
+ isMobile: U,
149
+ // Additional state for attachments and workflow
150
+ messageAttachments: R,
151
+ setMessageAttachments: u,
152
+ selectedWorkflow: W,
153
+ setSelectedWorkflow: b,
154
+ isNewChat: T,
155
+ conversationId: s
156
+ };
157
+ };
158
+ export {
159
+ fe as useInkeepChat
160
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),A=require("@inkeep/cxkit-react-oss/types");function D(a,f){const[i,x]=n.useState([]),[p,w]=n.useState(new Map),[y,P]=n.useState(Date.now()),[R,h]=n.useState(!1),g=n.useRef(0),d=n.useRef(0),S=n.useRef([]),c=n.useRef(p);c.current=p;const C=n.useCallback(()=>{const s=[];let t="",o=[];a.length>g.current&&(P(Date.now()),g.current=a.length),d.current=0;const u=new Map,l=(e=!1)=>{if(o.length>0){const r=`group-${d.current++}`,m=c.current.get(r);m?u.set(r,{...m,isCompleted:e}):u.set(r,{isCompleted:e}),s.push({type:"summary-group",summaries:[...o],groupKey:r}),o=[]}};for(const e of a)if(e.type==="text")l(!0),t+=e.text||"";else if(e.type==="data-summary")t.trim()&&(s.push({type:"text",text:t}),t=""),o.push(e.data);else if(e.type==="data-operation")e.data.type==="completion"&&l(!0);else if(e.type==="data-artifact")if(e.data?.type?.toLowerCase()===A.CITATION_ARTIFACT_TYPE){const r=e.data,m=r.artifactSummary||{title:r.name};t+=` ^${m?.title||r.name}^`}else t.trim()&&(s.push({type:"text",text:t}),t=""),s.push(e);else e.type==="data-component"&&(t.trim()&&(s.push({type:"text",text:t}),t=""),s.push(e));return l(!f),t.trim()&&s.push({type:"text",text:t}),{processed:s,newTimings:u}},[a,f]);n.useEffect(()=>{if(S.current===a)return;S.current=a;const{processed:s,newTimings:t}=C();x(s),(t.size!==c.current.size||Array.from(t.entries()).some(([u,l])=>{const e=c.current.get(u);return!e||e.isCompleted!==l.isCompleted}))&&w(t)},[C,a]);const T=n.useCallback(()=>{const s=Date.now()-y,t=Array.from(c.current.values()).some(u=>!u.isCompleted),o=s>1e3&&!t;h(o)},[y]);n.useEffect(()=>{if(!f){h(!1);return}if(!(i.length>0)){h(!1);return}const t=setInterval(T,200);return()=>clearInterval(t)},[f,T,i.length]);const v=n.useMemo(()=>!(i.length>0),[i.length]);return{processedParts:i,summaryTimings:p,shouldShowInitialLoading:v,shouldShowStreamDelayLoading:R}}exports.useStreamProcessor=D;
@@ -0,0 +1,82 @@
1
+ "use client";
2
+ import { useState as f, useRef as p, useCallback as S, useEffect as A, useMemo as R } from "react";
3
+ import { CITATION_ARTIFACT_TYPE as k } from "@inkeep/cxkit-react-oss/types";
4
+ function E(r, m) {
5
+ const [i, v] = f([]), [h, P] = f(/* @__PURE__ */ new Map()), [g, D] = f(Date.now()), [L, y] = f(!1), d = p(0), x = p(0), C = p([]), c = p(h);
6
+ c.current = h;
7
+ const T = S(() => {
8
+ const s = [];
9
+ let t = "", o = [];
10
+ r.length > d.current && (D(Date.now()), d.current = r.length), x.current = 0;
11
+ const a = /* @__PURE__ */ new Map(), u = (e = !1) => {
12
+ if (o.length > 0) {
13
+ const n = `group-${x.current++}`, l = c.current.get(n);
14
+ l ? a.set(n, {
15
+ ...l,
16
+ isCompleted: e
17
+ }) : a.set(n, {
18
+ isCompleted: e
19
+ }), s.push({
20
+ type: "summary-group",
21
+ summaries: [...o],
22
+ groupKey: n
23
+ }), o = [];
24
+ }
25
+ };
26
+ for (const e of r)
27
+ if (e.type === "text")
28
+ u(!0), t += e.text || "";
29
+ else if (e.type === "data-summary")
30
+ t.trim() && (s.push({ type: "text", text: t }), t = ""), o.push(e.data);
31
+ else if (e.type === "data-operation")
32
+ e.data.type === "completion" && u(!0);
33
+ else if (e.type === "data-artifact")
34
+ if (e.data?.type?.toLowerCase() === k) {
35
+ const n = e.data, l = n.artifactSummary || {
36
+ title: n.name
37
+ };
38
+ t += ` ^${l?.title || n.name}^`;
39
+ } else
40
+ t.trim() && (s.push({ type: "text", text: t }), t = ""), s.push(e);
41
+ else e.type === "data-component" && (t.trim() && (s.push({ type: "text", text: t }), t = ""), s.push(e));
42
+ return u(!m), t.trim() && s.push({ type: "text", text: t }), { processed: s, newTimings: a };
43
+ }, [r, m]);
44
+ A(() => {
45
+ if (C.current === r)
46
+ return;
47
+ C.current = r;
48
+ const { processed: s, newTimings: t } = T();
49
+ v(s), (t.size !== c.current.size || Array.from(t.entries()).some(([a, u]) => {
50
+ const e = c.current.get(a);
51
+ return !e || e.isCompleted !== u.isCompleted;
52
+ })) && P(t);
53
+ }, [T, r]);
54
+ const w = S(() => {
55
+ const s = Date.now() - g, t = Array.from(c.current.values()).some(
56
+ (a) => !a.isCompleted
57
+ ), o = s > 1e3 && !t;
58
+ y(o);
59
+ }, [g]);
60
+ A(() => {
61
+ if (!m) {
62
+ y(!1);
63
+ return;
64
+ }
65
+ if (!(i.length > 0)) {
66
+ y(!1);
67
+ return;
68
+ }
69
+ const t = setInterval(w, 200);
70
+ return () => clearInterval(t);
71
+ }, [m, w, i.length]);
72
+ const I = R(() => !(i.length > 0), [i.length]);
73
+ return {
74
+ processedParts: i,
75
+ summaryTimings: h,
76
+ shouldShowInitialLoading: I,
77
+ shouldShowStreamDelayLoading: L
78
+ };
79
+ }
80
+ export {
81
+ E as useStreamProcessor
82
+ };