@inkeep/cxkit-primitives 0.0.0-dev-20250221234142

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 (477) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/atoms/api/analytics/conversation.cjs +1 -0
  4. package/dist/atoms/api/analytics/conversation.d.cts +3 -0
  5. package/dist/atoms/api/analytics/conversation.d.ts +3 -0
  6. package/dist/atoms/api/analytics/conversation.js +37 -0
  7. package/dist/atoms/api/analytics/events.cjs +1 -0
  8. package/dist/atoms/api/analytics/events.d.cts +2 -0
  9. package/dist/atoms/api/analytics/events.d.ts +2 -0
  10. package/dist/atoms/api/analytics/events.js +30 -0
  11. package/dist/atoms/api/analytics/feedback.cjs +1 -0
  12. package/dist/atoms/api/analytics/feedback.d.cts +11 -0
  13. package/dist/atoms/api/analytics/feedback.d.ts +11 -0
  14. package/dist/atoms/api/analytics/feedback.js +26 -0
  15. package/dist/atoms/avatars/ai.cjs +1 -0
  16. package/dist/atoms/avatars/ai.d.cts +3 -0
  17. package/dist/atoms/avatars/ai.d.ts +3 -0
  18. package/dist/atoms/avatars/ai.js +88 -0
  19. package/dist/atoms/avatars/user.cjs +1 -0
  20. package/dist/atoms/avatars/user.d.cts +3 -0
  21. package/dist/atoms/avatars/user.d.ts +3 -0
  22. package/dist/atoms/avatars/user.js +27 -0
  23. package/dist/atoms/codeblock/index.cjs +1 -0
  24. package/dist/atoms/codeblock/index.d.cts +10 -0
  25. package/dist/atoms/codeblock/index.d.ts +10 -0
  26. package/dist/atoms/codeblock/index.js +40 -0
  27. package/dist/atoms/custom-styles.cjs +1 -0
  28. package/dist/atoms/custom-styles.d.cts +5 -0
  29. package/dist/atoms/custom-styles.d.ts +5 -0
  30. package/dist/atoms/custom-styles.js +57 -0
  31. package/dist/atoms/dialog.cjs +1 -0
  32. package/dist/atoms/dialog.d.cts +68 -0
  33. package/dist/atoms/dialog.d.ts +68 -0
  34. package/dist/atoms/dialog.js +185 -0
  35. package/dist/atoms/icons/built-in-icon-renderer.cjs +1 -0
  36. package/dist/atoms/icons/built-in-icon-renderer.d.cts +6 -0
  37. package/dist/atoms/icons/built-in-icon-renderer.d.ts +6 -0
  38. package/dist/atoms/icons/built-in-icon-renderer.js +49 -0
  39. package/dist/atoms/icons/built-in-icons.cjs +1 -0
  40. package/dist/atoms/icons/built-in-icons.d.cts +72 -0
  41. package/dist/atoms/icons/built-in-icons.d.ts +72 -0
  42. package/dist/atoms/icons/built-in-icons.js +79 -0
  43. package/dist/atoms/icons/checkbox-icon.cjs +1 -0
  44. package/dist/atoms/icons/checkbox-icon.d.cts +1 -0
  45. package/dist/atoms/icons/checkbox-icon.d.ts +1 -0
  46. package/dist/atoms/icons/checkbox-icon.js +24 -0
  47. package/dist/atoms/icons/custom-icon.cjs +1 -0
  48. package/dist/atoms/icons/custom-icon.d.cts +6 -0
  49. package/dist/atoms/icons/custom-icon.d.ts +6 -0
  50. package/dist/atoms/icons/custom-icon.js +19 -0
  51. package/dist/atoms/icons/index.cjs +1 -0
  52. package/dist/atoms/icons/index.d.cts +2 -0
  53. package/dist/atoms/icons/index.d.ts +2 -0
  54. package/dist/atoms/icons/index.js +6 -0
  55. package/dist/atoms/icons/inkeep-default-icons.cjs +1 -0
  56. package/dist/atoms/icons/inkeep-default-icons.d.cts +2 -0
  57. package/dist/atoms/icons/inkeep-default-icons.d.ts +2 -0
  58. package/dist/atoms/icons/inkeep-default-icons.js +23 -0
  59. package/dist/atoms/link.cjs +1 -0
  60. package/dist/atoms/link.d.cts +14 -0
  61. package/dist/atoms/link.d.ts +14 -0
  62. package/dist/atoms/link.js +35 -0
  63. package/dist/atoms/markdown/components.cjs +1 -0
  64. package/dist/atoms/markdown/components.d.cts +27 -0
  65. package/dist/atoms/markdown/components.d.ts +27 -0
  66. package/dist/atoms/markdown/components.js +64 -0
  67. package/dist/atoms/markdown/index.cjs +1 -0
  68. package/dist/atoms/markdown/index.d.cts +15 -0
  69. package/dist/atoms/markdown/index.d.ts +15 -0
  70. package/dist/atoms/markdown/index.js +79 -0
  71. package/dist/atoms/markdown/rehype-inline-code-property.cjs +1 -0
  72. package/dist/atoms/markdown/rehype-inline-code-property.d.cts +1 -0
  73. package/dist/atoms/markdown/rehype-inline-code-property.d.ts +1 -0
  74. package/dist/atoms/markdown/rehype-inline-code-property.js +12 -0
  75. package/dist/atoms/portal-with-theme.cjs +1 -0
  76. package/dist/atoms/portal-with-theme.d.cts +2 -0
  77. package/dist/atoms/portal-with-theme.d.ts +2 -0
  78. package/dist/atoms/portal-with-theme.js +12 -0
  79. package/dist/atoms/portal.cjs +1 -0
  80. package/dist/atoms/portal.d.cts +8 -0
  81. package/dist/atoms/portal.d.ts +8 -0
  82. package/dist/atoms/portal.js +19 -0
  83. package/dist/atoms/shadow/context.cjs +2 -0
  84. package/dist/atoms/shadow/context.d.cts +14 -0
  85. package/dist/atoms/shadow/context.d.ts +14 -0
  86. package/dist/atoms/shadow/context.js +55 -0
  87. package/dist/atoms/shadow/create.cjs +1 -0
  88. package/dist/atoms/shadow/create.d.cts +8 -0
  89. package/dist/atoms/shadow/create.d.ts +8 -0
  90. package/dist/atoms/shadow/create.js +56 -0
  91. package/dist/atoms/shadow/index.d.cts +1 -0
  92. package/dist/atoms/shadow/index.d.ts +1 -0
  93. package/dist/atoms/shadow/root.cjs +1 -0
  94. package/dist/atoms/shadow/root.d.cts +5 -0
  95. package/dist/atoms/shadow/root.d.ts +5 -0
  96. package/dist/atoms/shadow/root.js +22 -0
  97. package/dist/atoms/shadow/use-ensured-forwarded-ref.cjs +1 -0
  98. package/dist/atoms/shadow/use-ensured-forwarded-ref.d.cts +2 -0
  99. package/dist/atoms/shadow/use-ensured-forwarded-ref.d.ts +2 -0
  100. package/dist/atoms/shadow/use-ensured-forwarded-ref.js +11 -0
  101. package/dist/atoms/shadow/utils.cjs +1 -0
  102. package/dist/atoms/shadow/utils.d.cts +9 -0
  103. package/dist/atoms/shadow/utils.d.ts +9 -0
  104. package/dist/atoms/shadow/utils.js +16 -0
  105. package/dist/components/chat-button.cjs +1 -0
  106. package/dist/components/chat-button.d.cts +11 -0
  107. package/dist/components/chat-button.d.ts +11 -0
  108. package/dist/components/chat-button.js +42 -0
  109. package/dist/components/embedded-chat/chat-provider.cjs +1 -0
  110. package/dist/components/embedded-chat/chat-provider.d.cts +19 -0
  111. package/dist/components/embedded-chat/chat-provider.d.ts +19 -0
  112. package/dist/components/embedded-chat/chat-provider.js +22 -0
  113. package/dist/components/embedded-chat/use-captcha.cjs +1 -0
  114. package/dist/components/embedded-chat/use-captcha.d.cts +13 -0
  115. package/dist/components/embedded-chat/use-captcha.d.ts +13 -0
  116. package/dist/components/embedded-chat/use-captcha.js +56 -0
  117. package/dist/components/embedded-chat/use-chat-action.cjs +1 -0
  118. package/dist/components/embedded-chat/use-chat-action.d.cts +9 -0
  119. package/dist/components/embedded-chat/use-chat-action.d.ts +9 -0
  120. package/dist/components/embedded-chat/use-chat-action.js +26 -0
  121. package/dist/components/embedded-chat/use-inkeep-chat.cjs +4 -0
  122. package/dist/components/embedded-chat/use-inkeep-chat.d.cts +25 -0
  123. package/dist/components/embedded-chat/use-inkeep-chat.d.ts +25 -0
  124. package/dist/components/embedded-chat/use-inkeep-chat.js +227 -0
  125. package/dist/components/embedded-chat.cjs +17 -0
  126. package/dist/components/embedded-chat.d.cts +415 -0
  127. package/dist/components/embedded-chat.d.ts +415 -0
  128. package/dist/components/embedded-chat.js +1840 -0
  129. package/dist/components/embedded-search/search-provider.cjs +1 -0
  130. package/dist/components/embedded-search/search-provider.d.cts +21 -0
  131. package/dist/components/embedded-search/search-provider.d.ts +21 -0
  132. package/dist/components/embedded-search/search-provider.js +19 -0
  133. package/dist/components/embedded-search/search-query.graphql.cjs +82 -0
  134. package/dist/components/embedded-search/search-query.graphql.js +86 -0
  135. package/dist/components/embedded-search/transform-results.cjs +1 -0
  136. package/dist/components/embedded-search/transform-results.d.cts +3 -0
  137. package/dist/components/embedded-search/transform-results.d.ts +3 -0
  138. package/dist/components/embedded-search/transform-results.js +113 -0
  139. package/dist/components/embedded-search/use-inkeep-search.cjs +1 -0
  140. package/dist/components/embedded-search/use-inkeep-search.d.cts +21 -0
  141. package/dist/components/embedded-search/use-inkeep-search.d.ts +21 -0
  142. package/dist/components/embedded-search/use-inkeep-search.js +137 -0
  143. package/dist/components/embedded-search.cjs +1 -0
  144. package/dist/components/embedded-search.d.cts +229 -0
  145. package/dist/components/embedded-search.d.ts +229 -0
  146. package/dist/components/embedded-search.js +390 -0
  147. package/dist/components/factory.cjs +1 -0
  148. package/dist/components/factory.d.cts +19 -0
  149. package/dist/components/factory.d.ts +19 -0
  150. package/dist/components/factory.js +39 -0
  151. package/dist/components/index.cjs +1 -0
  152. package/dist/components/index.d.cts +11 -0
  153. package/dist/components/index.d.ts +11 -0
  154. package/dist/components/index.js +31 -0
  155. package/dist/components/intelligent-form/actions/context-model-response.cjs +9 -0
  156. package/dist/components/intelligent-form/actions/context-model-response.d.cts +10 -0
  157. package/dist/components/intelligent-form/actions/context-model-response.d.ts +10 -0
  158. package/dist/components/intelligent-form/actions/context-model-response.js +36 -0
  159. package/dist/components/intelligent-form/actions/escalation-schema.cjs +1 -0
  160. package/dist/components/intelligent-form/actions/escalation-schema.d.cts +2 -0
  161. package/dist/components/intelligent-form/actions/escalation-schema.d.ts +2 -0
  162. package/dist/components/intelligent-form/actions/escalation-schema.js +48 -0
  163. package/dist/components/intelligent-form/actions/qa-model-messages.cjs +27 -0
  164. package/dist/components/intelligent-form/actions/qa-model-messages.d.cts +2 -0
  165. package/dist/components/intelligent-form/actions/qa-model-messages.d.ts +2 -0
  166. package/dist/components/intelligent-form/actions/qa-model-messages.js +45 -0
  167. package/dist/components/intelligent-form/actions/qa-model-response.cjs +1 -0
  168. package/dist/components/intelligent-form/actions/qa-model-response.d.cts +14 -0
  169. package/dist/components/intelligent-form/actions/qa-model-response.d.ts +14 -0
  170. package/dist/components/intelligent-form/actions/qa-model-response.js +46 -0
  171. package/dist/components/intelligent-form/intelligent-form-provider.cjs +1 -0
  172. package/dist/components/intelligent-form/intelligent-form-provider.d.cts +29 -0
  173. package/dist/components/intelligent-form/intelligent-form-provider.d.ts +29 -0
  174. package/dist/components/intelligent-form/intelligent-form-provider.js +23 -0
  175. package/dist/components/intelligent-form/use-inkeep-intelligent-form.cjs +1 -0
  176. package/dist/components/intelligent-form/use-inkeep-intelligent-form.d.cts +30 -0
  177. package/dist/components/intelligent-form/use-inkeep-intelligent-form.d.ts +30 -0
  178. package/dist/components/intelligent-form/use-inkeep-intelligent-form.js +157 -0
  179. package/dist/components/intelligent-form.cjs +1 -0
  180. package/dist/components/intelligent-form.d.cts +135 -0
  181. package/dist/components/intelligent-form.d.ts +135 -0
  182. package/dist/components/intelligent-form.js +568 -0
  183. package/dist/components/modal/modal-provider.cjs +1 -0
  184. package/dist/components/modal/modal-provider.d.cts +13 -0
  185. package/dist/components/modal/modal-provider.d.ts +13 -0
  186. package/dist/components/modal/modal-provider.js +8 -0
  187. package/dist/components/modal/use-inkeep-modal.cjs +1 -0
  188. package/dist/components/modal/use-inkeep-modal.d.cts +8 -0
  189. package/dist/components/modal/use-inkeep-modal.d.ts +8 -0
  190. package/dist/components/modal/use-inkeep-modal.js +30 -0
  191. package/dist/components/modal.cjs +1 -0
  192. package/dist/components/modal.d.cts +18 -0
  193. package/dist/components/modal.d.ts +18 -0
  194. package/dist/components/modal.js +40 -0
  195. package/dist/components/searchbar.cjs +1 -0
  196. package/dist/components/searchbar.d.cts +23 -0
  197. package/dist/components/searchbar.d.ts +23 -0
  198. package/dist/components/searchbar.js +54 -0
  199. package/dist/components/tagline-logo-icon.cjs +1 -0
  200. package/dist/components/tagline-logo-icon.d.cts +1 -0
  201. package/dist/components/tagline-logo-icon.d.ts +1 -0
  202. package/dist/components/tagline-logo-icon.js +34 -0
  203. package/dist/hooks/index.cjs +1 -0
  204. package/dist/hooks/index.d.cts +12 -0
  205. package/dist/hooks/index.d.ts +12 -0
  206. package/dist/hooks/index.js +27 -0
  207. package/dist/hooks/use-boolean.cjs +1 -0
  208. package/dist/hooks/use-boolean.d.cts +10 -0
  209. package/dist/hooks/use-boolean.d.ts +10 -0
  210. package/dist/hooks/use-boolean.js +17 -0
  211. package/dist/hooks/use-browser-storage.cjs +1 -0
  212. package/dist/hooks/use-browser-storage.d.cts +17 -0
  213. package/dist/hooks/use-browser-storage.d.ts +17 -0
  214. package/dist/hooks/use-browser-storage.js +88 -0
  215. package/dist/hooks/use-component-classnames.cjs +1 -0
  216. package/dist/hooks/use-component-classnames.d.cts +6 -0
  217. package/dist/hooks/use-component-classnames.d.ts +6 -0
  218. package/dist/hooks/use-component-classnames.js +14 -0
  219. package/dist/hooks/use-container-size.cjs +1 -0
  220. package/dist/hooks/use-container-size.d.cts +5 -0
  221. package/dist/hooks/use-container-size.d.ts +5 -0
  222. package/dist/hooks/use-container-size.js +18 -0
  223. package/dist/hooks/use-copy-to-clipboard.cjs +1 -0
  224. package/dist/hooks/use-copy-to-clipboard.d.cts +3 -0
  225. package/dist/hooks/use-copy-to-clipboard.d.ts +3 -0
  226. package/dist/hooks/use-copy-to-clipboard.js +19 -0
  227. package/dist/hooks/use-instant-update.cjs +1 -0
  228. package/dist/hooks/use-instant-update.d.cts +17 -0
  229. package/dist/hooks/use-instant-update.d.ts +17 -0
  230. package/dist/hooks/use-instant-update.js +16 -0
  231. package/dist/hooks/use-is-mounted.cjs +1 -0
  232. package/dist/hooks/use-is-mounted.d.cts +1 -0
  233. package/dist/hooks/use-is-mounted.d.ts +1 -0
  234. package/dist/hooks/use-is-mounted.js +11 -0
  235. package/dist/hooks/use-media-query.cjs +1 -0
  236. package/dist/hooks/use-media-query.d.cts +1 -0
  237. package/dist/hooks/use-media-query.d.ts +1 -0
  238. package/dist/hooks/use-media-query.js +14 -0
  239. package/dist/hooks/use-resize-observer.cjs +1 -0
  240. package/dist/hooks/use-resize-observer.d.cts +12 -0
  241. package/dist/hooks/use-resize-observer.d.ts +12 -0
  242. package/dist/hooks/use-resize-observer.js +32 -0
  243. package/dist/hooks/use-scroll-to-bottom.cjs +1 -0
  244. package/dist/hooks/use-scroll-to-bottom.d.cts +13 -0
  245. package/dist/hooks/use-scroll-to-bottom.d.ts +13 -0
  246. package/dist/hooks/use-scroll-to-bottom.js +52 -0
  247. package/dist/hooks/use-scrolling-fades.cjs +1 -0
  248. package/dist/hooks/use-scrolling-fades.d.cts +2 -0
  249. package/dist/hooks/use-scrolling-fades.d.ts +2 -0
  250. package/dist/hooks/use-scrolling-fades.js +18 -0
  251. package/dist/hooks/use-settle-action.cjs +1 -0
  252. package/dist/hooks/use-settle-action.d.cts +3 -0
  253. package/dist/hooks/use-settle-action.d.ts +3 -0
  254. package/dist/hooks/use-settle-action.js +11 -0
  255. package/dist/index.cjs +1 -0
  256. package/dist/index.d.cts +11 -0
  257. package/dist/index.d.ts +11 -0
  258. package/dist/index.js +152 -0
  259. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fa6/index.cjs +1 -0
  260. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fa6/index.js +92 -0
  261. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fi/index.cjs +1 -0
  262. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fi/index.js +8 -0
  263. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/hi2/index.cjs +1 -0
  264. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/hi2/index.js +8 -0
  265. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/io5/index.cjs +1 -0
  266. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/io5/index.js +128 -0
  267. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lib/iconBase.cjs +1 -0
  268. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lib/iconBase.js +109 -0
  269. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lib/iconContext.cjs +1 -0
  270. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lib/iconContext.js +13 -0
  271. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.cjs +1 -0
  272. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.js +68 -0
  273. package/dist/providers/attachment-item-provider.cjs +1 -0
  274. package/dist/providers/attachment-item-provider.d.cts +9 -0
  275. package/dist/providers/attachment-item-provider.d.ts +9 -0
  276. package/dist/providers/attachment-item-provider.js +13 -0
  277. package/dist/providers/attachments-bar-provider.cjs +1 -0
  278. package/dist/providers/attachments-bar-provider.d.cts +30 -0
  279. package/dist/providers/attachments-bar-provider.d.ts +30 -0
  280. package/dist/providers/attachments-bar-provider.js +64 -0
  281. package/dist/providers/base-events-provider.cjs +1 -0
  282. package/dist/providers/base-events-provider.d.cts +8 -0
  283. package/dist/providers/base-events-provider.d.ts +8 -0
  284. package/dist/providers/base-events-provider.js +39 -0
  285. package/dist/providers/chat-events-provider.cjs +1 -0
  286. package/dist/providers/chat-events-provider.d.cts +12 -0
  287. package/dist/providers/chat-events-provider.d.ts +12 -0
  288. package/dist/providers/chat-events-provider.js +66 -0
  289. package/dist/providers/chat-form-provider.cjs +1 -0
  290. package/dist/providers/chat-form-provider.d.cts +23 -0
  291. package/dist/providers/chat-form-provider.d.ts +23 -0
  292. package/dist/providers/chat-form-provider.js +66 -0
  293. package/dist/providers/config-provider.cjs +1 -0
  294. package/dist/providers/config-provider.d.cts +24 -0
  295. package/dist/providers/config-provider.d.ts +24 -0
  296. package/dist/providers/config-provider.js +37 -0
  297. package/dist/providers/conversation-provider.cjs +1 -0
  298. package/dist/providers/conversation-provider.d.cts +12 -0
  299. package/dist/providers/conversation-provider.d.ts +12 -0
  300. package/dist/providers/conversation-provider.js +49 -0
  301. package/dist/providers/feedback-item-provider.cjs +1 -0
  302. package/dist/providers/feedback-item-provider.d.cts +10 -0
  303. package/dist/providers/feedback-item-provider.d.ts +10 -0
  304. package/dist/providers/feedback-item-provider.js +16 -0
  305. package/dist/providers/feedback-provider.cjs +1 -0
  306. package/dist/providers/feedback-provider.d.cts +19 -0
  307. package/dist/providers/feedback-provider.d.ts +19 -0
  308. package/dist/providers/feedback-provider.js +82 -0
  309. package/dist/providers/form-field-provider.cjs +1 -0
  310. package/dist/providers/form-field-provider.d.cts +15 -0
  311. package/dist/providers/form-field-provider.d.ts +15 -0
  312. package/dist/providers/form-field-provider.js +17 -0
  313. package/dist/providers/help-menu-provider.cjs +1 -0
  314. package/dist/providers/help-menu-provider.d.cts +11 -0
  315. package/dist/providers/help-menu-provider.d.ts +11 -0
  316. package/dist/providers/help-menu-provider.js +19 -0
  317. package/dist/providers/index.cjs +1 -0
  318. package/dist/providers/index.d.cts +19 -0
  319. package/dist/providers/index.d.ts +19 -0
  320. package/dist/providers/index.js +63 -0
  321. package/dist/providers/intelligent-form-field-provider.cjs +1 -0
  322. package/dist/providers/intelligent-form-field-provider.d.cts +15 -0
  323. package/dist/providers/intelligent-form-field-provider.d.ts +15 -0
  324. package/dist/providers/intelligent-form-field-provider.js +19 -0
  325. package/dist/providers/markdown-provider.cjs +1 -0
  326. package/dist/providers/markdown-provider.d.cts +9 -0
  327. package/dist/providers/markdown-provider.d.ts +9 -0
  328. package/dist/providers/markdown-provider.js +8 -0
  329. package/dist/providers/message-attachments-provider.cjs +1 -0
  330. package/dist/providers/message-attachments-provider.d.cts +13 -0
  331. package/dist/providers/message-attachments-provider.d.ts +13 -0
  332. package/dist/providers/message-attachments-provider.js +27 -0
  333. package/dist/providers/message-provider.cjs +1 -0
  334. package/dist/providers/message-provider.d.cts +10 -0
  335. package/dist/providers/message-provider.d.ts +10 -0
  336. package/dist/providers/message-provider.js +14 -0
  337. package/dist/providers/root-provider.cjs +1 -0
  338. package/dist/providers/root-provider.d.cts +8 -0
  339. package/dist/providers/root-provider.d.ts +8 -0
  340. package/dist/providers/root-provider.js +21 -0
  341. package/dist/providers/search-events-provider.cjs +1 -0
  342. package/dist/providers/search-events-provider.d.cts +11 -0
  343. package/dist/providers/search-events-provider.d.ts +11 -0
  344. package/dist/providers/search-events-provider.js +18 -0
  345. package/dist/providers/source-item-provider.cjs +1 -0
  346. package/dist/providers/source-item-provider.d.cts +12 -0
  347. package/dist/providers/source-item-provider.d.ts +12 -0
  348. package/dist/providers/source-item-provider.js +13 -0
  349. package/dist/providers/theme-provider.cjs +1 -0
  350. package/dist/providers/theme-provider.d.cts +3 -0
  351. package/dist/providers/theme-provider.d.ts +3 -0
  352. package/dist/providers/theme-provider.js +65 -0
  353. package/dist/providers/user-provider.cjs +1 -0
  354. package/dist/providers/user-provider.d.cts +13 -0
  355. package/dist/providers/user-provider.d.ts +13 -0
  356. package/dist/providers/user-provider.js +34 -0
  357. package/dist/providers/widget-provider.cjs +1 -0
  358. package/dist/providers/widget-provider.d.cts +9 -0
  359. package/dist/providers/widget-provider.d.ts +9 -0
  360. package/dist/providers/widget-provider.js +8 -0
  361. package/dist/utils/component-ids.cjs +1 -0
  362. package/dist/utils/component-ids.d.cts +632 -0
  363. package/dist/utils/component-ids.d.ts +632 -0
  364. package/dist/utils/component-ids.js +340 -0
  365. package/dist/utils/compose-event-handlers.cjs +1 -0
  366. package/dist/utils/compose-event-handlers.d.cts +3 -0
  367. package/dist/utils/compose-event-handlers.d.ts +3 -0
  368. package/dist/utils/compose-event-handlers.js +10 -0
  369. package/dist/utils/compose-refs.cjs +1 -0
  370. package/dist/utils/compose-refs.d.cts +5 -0
  371. package/dist/utils/compose-refs.d.ts +5 -0
  372. package/dist/utils/compose-refs.js +30 -0
  373. package/dist/utils/default-settings.cjs +1 -0
  374. package/dist/utils/default-settings.d.cts +244 -0
  375. package/dist/utils/default-settings.d.ts +244 -0
  376. package/dist/utils/default-settings.js +75 -0
  377. package/dist/utils/form.cjs +1 -0
  378. package/dist/utils/form.d.cts +3 -0
  379. package/dist/utils/form.d.ts +3 -0
  380. package/dist/utils/form.js +17 -0
  381. package/dist/utils/generate-uid.cjs +1 -0
  382. package/dist/utils/generate-uid.d.cts +2 -0
  383. package/dist/utils/generate-uid.d.ts +2 -0
  384. package/dist/utils/generate-uid.js +14 -0
  385. package/dist/utils/get-message-metadata.cjs +10 -0
  386. package/dist/utils/get-message-metadata.d.cts +8 -0
  387. package/dist/utils/get-message-metadata.d.ts +8 -0
  388. package/dist/utils/get-message-metadata.js +142 -0
  389. package/dist/utils/graphql-client.cjs +1 -0
  390. package/dist/utils/graphql-client.d.cts +8 -0
  391. package/dist/utils/graphql-client.d.ts +8 -0
  392. package/dist/utils/graphql-client.js +23 -0
  393. package/dist/utils/highlight-emphasis.cjs +1 -0
  394. package/dist/utils/highlight-emphasis.d.cts +4 -0
  395. package/dist/utils/highlight-emphasis.d.ts +4 -0
  396. package/dist/utils/highlight-emphasis.js +15 -0
  397. package/dist/utils/merge-props.cjs +1 -0
  398. package/dist/utils/merge-props.d.cts +7 -0
  399. package/dist/utils/merge-props.d.ts +7 -0
  400. package/dist/utils/merge-props.js +41 -0
  401. package/dist/utils/misc.cjs +1 -0
  402. package/dist/utils/misc.d.cts +13 -0
  403. package/dist/utils/misc.d.ts +13 -0
  404. package/dist/utils/misc.js +36 -0
  405. package/dist/utils/reset-query-params.cjs +1 -0
  406. package/dist/utils/reset-query-params.d.cts +1 -0
  407. package/dist/utils/reset-query-params.d.ts +1 -0
  408. package/dist/utils/reset-query-params.js +13 -0
  409. package/dist/utils/tools/links-schema.cjs +1 -0
  410. package/dist/utils/tools/links-schema.d.cts +64 -0
  411. package/dist/utils/tools/links-schema.d.ts +64 -0
  412. package/dist/utils/tools/links-schema.js +85 -0
  413. package/dist/utils/transform-source/breadcrumbs.cjs +1 -0
  414. package/dist/utils/transform-source/breadcrumbs.d.cts +2 -0
  415. package/dist/utils/transform-source/breadcrumbs.d.ts +2 -0
  416. package/dist/utils/transform-source/breadcrumbs.js +16 -0
  417. package/dist/utils/transform-source/common-words/long.cjs +1 -0
  418. package/dist/utils/transform-source/common-words/long.d.cts +1 -0
  419. package/dist/utils/transform-source/common-words/long.d.ts +1 -0
  420. package/dist/utils/transform-source/common-words/long.js +69 -0
  421. package/dist/utils/transform-source/common-words/lowercase.cjs +1 -0
  422. package/dist/utils/transform-source/common-words/lowercase.d.cts +1 -0
  423. package/dist/utils/transform-source/common-words/lowercase.d.ts +1 -0
  424. package/dist/utils/transform-source/common-words/lowercase.js +48 -0
  425. package/dist/utils/transform-source/common-words/short.cjs +1 -0
  426. package/dist/utils/transform-source/common-words/short.d.cts +1 -0
  427. package/dist/utils/transform-source/common-words/short.d.ts +1 -0
  428. package/dist/utils/transform-source/common-words/short.js +141 -0
  429. package/dist/utils/transform-source/description.cjs +1 -0
  430. package/dist/utils/transform-source/description.d.cts +2 -0
  431. package/dist/utils/transform-source/description.d.ts +2 -0
  432. package/dist/utils/transform-source/description.js +10 -0
  433. package/dist/utils/transform-source/icon.cjs +1 -0
  434. package/dist/utils/transform-source/icon.d.cts +2 -0
  435. package/dist/utils/transform-source/icon.d.ts +2 -0
  436. package/dist/utils/transform-source/icon.js +9 -0
  437. package/dist/utils/transform-source/index.cjs +1 -0
  438. package/dist/utils/transform-source/index.d.cts +2 -0
  439. package/dist/utils/transform-source/index.d.ts +2 -0
  440. package/dist/utils/transform-source/index.js +21 -0
  441. package/dist/utils/transform-source/tabs.cjs +1 -0
  442. package/dist/utils/transform-source/tabs.d.cts +2 -0
  443. package/dist/utils/transform-source/tabs.d.ts +2 -0
  444. package/dist/utils/transform-source/tabs.js +13 -0
  445. package/dist/utils/transform-source/title.cjs +1 -0
  446. package/dist/utils/transform-source/title.d.cts +2 -0
  447. package/dist/utils/transform-source/title.d.ts +2 -0
  448. package/dist/utils/transform-source/title.js +12 -0
  449. package/dist/utils/transform-source/utils/description-without-title.cjs +1 -0
  450. package/dist/utils/transform-source/utils/description-without-title.d.cts +11 -0
  451. package/dist/utils/transform-source/utils/description-without-title.d.ts +11 -0
  452. package/dist/utils/transform-source/utils/description-without-title.js +12 -0
  453. package/dist/utils/transform-source/utils/index.cjs +1 -0
  454. package/dist/utils/transform-source/utils/index.d.cts +6 -0
  455. package/dist/utils/transform-source/utils/index.d.ts +6 -0
  456. package/dist/utils/transform-source/utils/index.js +16 -0
  457. package/dist/utils/transform-source/utils/misc.cjs +1 -0
  458. package/dist/utils/transform-source/utils/misc.d.cts +2 -0
  459. package/dist/utils/transform-source/utils/misc.d.ts +2 -0
  460. package/dist/utils/transform-source/utils/misc.js +15 -0
  461. package/dist/utils/transform-source/utils/standardize-common-words.cjs +1 -0
  462. package/dist/utils/transform-source/utils/standardize-common-words.d.cts +1 -0
  463. package/dist/utils/transform-source/utils/standardize-common-words.d.ts +1 -0
  464. package/dist/utils/transform-source/utils/standardize-common-words.js +26 -0
  465. package/dist/utils/transform-source/utils/standardize-organization-display-name.cjs +1 -0
  466. package/dist/utils/transform-source/utils/standardize-organization-display-name.d.cts +8 -0
  467. package/dist/utils/transform-source/utils/standardize-organization-display-name.d.ts +8 -0
  468. package/dist/utils/transform-source/utils/standardize-organization-display-name.js +10 -0
  469. package/dist/utils/transform-source/utils/standardize-suffixes.cjs +1 -0
  470. package/dist/utils/transform-source/utils/standardize-suffixes.d.cts +5 -0
  471. package/dist/utils/transform-source/utils/standardize-suffixes.d.ts +5 -0
  472. package/dist/utils/transform-source/utils/standardize-suffixes.js +16 -0
  473. package/dist/utils/transform-source/utils/strip-branding-keywords.cjs +1 -0
  474. package/dist/utils/transform-source/utils/strip-branding-keywords.d.cts +17 -0
  475. package/dist/utils/transform-source/utils/strip-branding-keywords.d.ts +17 -0
  476. package/dist/utils/transform-source/utils/strip-branding-keywords.js +14 -0
  477. package/package.json +111 -0
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ import { jsx as f } from "react/jsx-runtime";
3
+ import { useMemo as d, useCallback as y, createContext as x, useContext as B } from "react";
4
+ import { logEvent as C } from "../atoms/api/analytics/events.js";
5
+ import { useInkeepConfig as P } from "./config-provider.js";
6
+ import { useUser as b } from "./user-provider.js";
7
+ const m = x(void 0), M = ({ children: e }) => {
8
+ const { baseSettings: t, interactionType: o } = P(), { apiKey: s, analyticsBaseUrl: n, tags: r, analytics: p, env: u } = t, { userProperties: a } = b(), i = d(
9
+ () => ({
10
+ widgetLibraryVersion: "0.4.9",
11
+ interactionType: o,
12
+ tags: r
13
+ }),
14
+ [o, r]
15
+ ), c = !p.optOutAllAnalytics && u !== "DEVELOPMENT", E = { logEvent: y(
16
+ async (v) => {
17
+ const g = {
18
+ ...i,
19
+ ...v.properties
20
+ }, l = {
21
+ eventName: v.eventName,
22
+ properties: g,
23
+ userProperties: a
24
+ };
25
+ c && C(l, s, n), t.logEventCallback?.(l);
26
+ },
27
+ [c, t, s, n, a, i]
28
+ ) };
29
+ return /* @__PURE__ */ f(m.Provider, { value: E, children: e });
30
+ }, O = () => {
31
+ const e = B(m);
32
+ if (!e)
33
+ throw new Error("useBaseEvents must be used within a BaseEventsProvider");
34
+ return e;
35
+ };
36
+ export {
37
+ M as BaseEventsProvider,
38
+ O as useBaseEvents
39
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),s=require("react"),b=require("../atoms/api/analytics/conversation.cjs"),q=require("./config-provider.cjs"),x=require("./conversation-provider.cjs"),y=require("./user-provider.cjs"),g=require("./base-events-provider.cjs"),p=s.createContext(void 0),m=({children:t})=>{const{baseSettings:P}=q.useInkeepConfig(),{apiKey:u,analyticsBaseUrl:v,tags:d}=P,{userProperties:l}=y.useUser(),{logEvent:C}=g.useBaseEvents(),{conversation:i,setConversation:h}=x.useInkeepConversation(),o=s.useRef(i.id);s.useEffect(()=>{o.current=i.id},[i.id]);const f=["chat_message_submitted","chat_message_bot_response_received","intelligent_form_primary_submitted","intelligent_form_qa_response"],a=s.useCallback(async e=>{const n=o.current,r=await b.logConversation(n,{messages:e,tags:d,userProperties:l},u,v);return r&&h(r),r},[v,u,d,l,h]),_={logEvent:s.useCallback(async e=>{let n=o.current;if(f.includes(e.eventName)&&"messages"in e.properties){const E=await a(e.properties.messages);E&&(n=E.id,o.current=n)}const r={...e,properties:{...e.properties,conversationId:n}};C(r)},[C,a]),logConversation:a};return c.jsx(p.Provider,{value:_,children:t})},j=({children:t})=>c.jsx(g.BaseEventsProvider,{children:c.jsx(m,{children:t})}),w=()=>{const t=s.useContext(p);if(!t)throw new Error("useChatEvents must be used within a ChatEventsProvider");return t};exports.ChatEventsProvider=m;exports.ChatEventsProviderWithBase=j;exports.useChatEvents=w;
@@ -0,0 +1,12 @@
1
+ import { ConversationResponse, InkeepEvent, Message } from '@inkeep/cxkit-types';
2
+ export type ChatEventsContextValue = {
3
+ logEvent: (event: InkeepEvent) => void;
4
+ logConversation: (messages: Message[]) => Promise<ConversationResponse | undefined>;
5
+ };
6
+ export declare const ChatEventsProvider: React.FC<{
7
+ children: React.ReactNode;
8
+ }>;
9
+ export declare const ChatEventsProviderWithBase: React.FC<{
10
+ children: React.ReactNode;
11
+ }>;
12
+ export declare const useChatEvents: () => ChatEventsContextValue;
@@ -0,0 +1,12 @@
1
+ import { ConversationResponse, InkeepEvent, Message } from '@inkeep/cxkit-types';
2
+ export type ChatEventsContextValue = {
3
+ logEvent: (event: InkeepEvent) => void;
4
+ logConversation: (messages: Message[]) => Promise<ConversationResponse | undefined>;
5
+ };
6
+ export declare const ChatEventsProvider: React.FC<{
7
+ children: React.ReactNode;
8
+ }>;
9
+ export declare const ChatEventsProviderWithBase: React.FC<{
10
+ children: React.ReactNode;
11
+ }>;
12
+ export declare const useChatEvents: () => ChatEventsContextValue;
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { jsx as a } from "react/jsx-runtime";
3
+ import { useRef as _, useEffect as b, useCallback as C, createContext as x, useContext as P } from "react";
4
+ import { logConversation as w } from "../atoms/api/analytics/conversation.js";
5
+ import { useInkeepConfig as y } from "./config-provider.js";
6
+ import { useInkeepConversation as I } from "./conversation-provider.js";
7
+ import { useUser as B } from "./user-provider.js";
8
+ import { useBaseEvents as k, BaseEventsProvider as U } from "./base-events-provider.js";
9
+ const f = x(void 0), j = ({ children: t }) => {
10
+ const { baseSettings: h } = y(), { apiKey: c, analyticsBaseUrl: u, tags: v } = h, { userProperties: m } = B(), { logEvent: p } = k(), { conversation: r, setConversation: d } = I(), o = _(r.id);
11
+ b(() => {
12
+ o.current = r.id;
13
+ }, [r.id]);
14
+ const g = [
15
+ "chat_message_submitted",
16
+ "chat_message_bot_response_received",
17
+ "intelligent_form_primary_submitted",
18
+ "intelligent_form_qa_response"
19
+ ], i = C(
20
+ async (e) => {
21
+ const s = o.current, n = await w(
22
+ s,
23
+ {
24
+ messages: e,
25
+ tags: v,
26
+ userProperties: m
27
+ },
28
+ c,
29
+ u
30
+ );
31
+ return n && d(n), n;
32
+ },
33
+ [u, c, v, m, d]
34
+ ), E = {
35
+ logEvent: C(
36
+ async (e) => {
37
+ let s = o.current;
38
+ if (g.includes(e.eventName) && "messages" in e.properties) {
39
+ const l = await i(e.properties.messages);
40
+ l && (s = l.id, o.current = s);
41
+ }
42
+ const n = {
43
+ ...e,
44
+ properties: {
45
+ ...e.properties,
46
+ conversationId: s
47
+ }
48
+ };
49
+ p(n);
50
+ },
51
+ [p, i]
52
+ ),
53
+ logConversation: i
54
+ };
55
+ return /* @__PURE__ */ a(f.Provider, { value: E, children: t });
56
+ }, A = ({ children: t }) => /* @__PURE__ */ a(U, { children: /* @__PURE__ */ a(j, { children: t }) }), D = () => {
57
+ const t = P(f);
58
+ if (!t)
59
+ throw new Error("useChatEvents must be used within a ChatEventsProvider");
60
+ return t;
61
+ };
62
+ export {
63
+ j as ChatEventsProvider,
64
+ A as ChatEventsProviderWithBase,
65
+ D as useChatEvents
66
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),o=require("react"),M=require("react-hook-form"),O=require("./conversation-provider.cjs"),P=require("../components/modal/modal-provider.cjs"),R=require("../utils/form.cjs"),x="root.serverError",S=o.createContext(void 0);function f(){const[t,n]=o.useState(null),[C,u]=o.useState(!1),{conversation:i}=O.useInkeepConversation(),h=P.useModal(),v=e=>{n(e)},E=()=>{n(null),u(!1),t?.buttons.close?.action==="CLOSE_MODAL"&&h?.closeModal()},c=o.useMemo(()=>t?.fields.map(e=>{const r=e;return"_type"in e&&e._type==="INCLUDE_CHAT_SESSION"&&(r.required=!1,r.inputType="CHECKBOX",i.id||(r.isHidden=!0)),r}),[t?.fields,i.id]),a=c?.find(e=>"_type"in e&&e._type==="INCLUDE_CHAT_SESSION"),s=o.useMemo(()=>R.getFormDefaultValues(c),[c]),{control:F,handleSubmit:b,formState:{errors:m,isSubmitting:p},setError:_,reset:l}=M.useForm({defaultValues:s});o.useEffect(()=>{s&&l(s)},[l,s]);const w=b(async e=>{const r=typeof window>"u"?"":window.location.href,g=i.id&&a&&e[a.name]?i:null;try{await t?.buttons.submit.onSubmit({values:e,conversation:g,client:{currentUrl:r}}),u(!0)}catch(d){_(x,{message:d instanceof Error?d.message:"Something went wrong."})}}),y=m?.root?.serverError;return{form:t,openForm:v,closeForm:E,handleSubmit:w,isSuccess:C,isSubmitting:p,formError:y,fields:c,errors:m,control:F,defaultValues:s}}const I=({children:t})=>{const n=f();return q.jsx(S.Provider,{value:n,children:t})},H=()=>{const t=o.useContext(S);if(!t)throw new Error("useChatForm must be used within a ChatFormProvider");return t};exports.ChatFormProvider=I;exports.useChatForm=H;exports.useChatFormState=f;
@@ -0,0 +1,23 @@
1
+ import { FormConfig, FormField } from '@inkeep/cxkit-types';
2
+ import { Message, FieldErrors, Control } from 'react-hook-form';
3
+ export type ChatFormContextValue = ReturnType<typeof useChatFormState>;
4
+ export declare function useChatFormState(): {
5
+ form: FormConfig | null;
6
+ openForm: (formConfig: FormConfig) => void;
7
+ closeForm: () => void;
8
+ handleSubmit: (e?: React.BaseSyntheticEvent) => Promise<void>;
9
+ isSuccess: boolean;
10
+ isSubmitting: boolean;
11
+ formError: Partial<{
12
+ type: string | number;
13
+ message: Message;
14
+ }> | undefined;
15
+ fields: FormField[] | undefined;
16
+ errors: FieldErrors<Record<string, any>>;
17
+ control: Control<Record<string, any>, any>;
18
+ defaultValues: Record<string, any>;
19
+ };
20
+ export declare const ChatFormProvider: React.FC<{
21
+ children: React.ReactNode;
22
+ }>;
23
+ export declare const useChatForm: () => ChatFormContextValue;
@@ -0,0 +1,23 @@
1
+ import { FormConfig, FormField } from '@inkeep/cxkit-types';
2
+ import { Message, FieldErrors, Control } from 'react-hook-form';
3
+ export type ChatFormContextValue = ReturnType<typeof useChatFormState>;
4
+ export declare function useChatFormState(): {
5
+ form: FormConfig | null;
6
+ openForm: (formConfig: FormConfig) => void;
7
+ closeForm: () => void;
8
+ handleSubmit: (e?: React.BaseSyntheticEvent) => Promise<void>;
9
+ isSuccess: boolean;
10
+ isSubmitting: boolean;
11
+ formError: Partial<{
12
+ type: string | number;
13
+ message: Message;
14
+ }> | undefined;
15
+ fields: FormField[] | undefined;
16
+ errors: FieldErrors<Record<string, any>>;
17
+ control: Control<Record<string, any>, any>;
18
+ defaultValues: Record<string, any>;
19
+ };
20
+ export declare const ChatFormProvider: React.FC<{
21
+ children: React.ReactNode;
22
+ }>;
23
+ export declare const useChatForm: () => ChatFormContextValue;
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { jsx as x } from "react/jsx-runtime";
3
+ import { useState as f, useMemo as d, useEffect as I, createContext as O, useContext as M } from "react";
4
+ import { useForm as N } from "react-hook-form";
5
+ import { useInkeepConversation as R } from "./conversation-provider.js";
6
+ import { useModal as A } from "../components/modal/modal-provider.js";
7
+ import { getFormDefaultValues as D } from "../utils/form.js";
8
+ const H = "root.serverError", S = O(void 0);
9
+ function L() {
10
+ const [o, n] = f(null), [p, c] = f(!1), { conversation: s } = R(), C = A(), E = (t) => {
11
+ n(t);
12
+ }, h = () => {
13
+ n(null), c(!1), o?.buttons.close?.action === "CLOSE_MODAL" && C?.closeModal();
14
+ }, i = d(() => o?.fields.map((t) => {
15
+ const e = t;
16
+ return "_type" in t && t._type === "INCLUDE_CHAT_SESSION" && (e.required = !1, e.inputType = "CHECKBOX", s.id || (e.isHidden = !0)), e;
17
+ }), [o?.fields, s.id]), a = i?.find((t) => "_type" in t && t._type === "INCLUDE_CHAT_SESSION"), r = d(() => D(i), [i]), {
18
+ control: v,
19
+ handleSubmit: F,
20
+ formState: { errors: u, isSubmitting: b },
21
+ setError: _,
22
+ reset: m
23
+ } = N({
24
+ defaultValues: r
25
+ });
26
+ I(() => {
27
+ r && m(r);
28
+ }, [m, r]);
29
+ const w = F(async (t) => {
30
+ const e = typeof window > "u" ? "" : window.location.href, g = s.id && a && t[a.name] ? s : null;
31
+ try {
32
+ await o?.buttons.submit.onSubmit({ values: t, conversation: g, client: { currentUrl: e } }), c(!0);
33
+ } catch (l) {
34
+ _(H, {
35
+ message: l instanceof Error ? l.message : "Something went wrong."
36
+ });
37
+ }
38
+ }), y = u?.root?.serverError;
39
+ return {
40
+ form: o,
41
+ openForm: E,
42
+ closeForm: h,
43
+ handleSubmit: w,
44
+ isSuccess: p,
45
+ isSubmitting: b,
46
+ formError: y,
47
+ fields: i,
48
+ errors: u,
49
+ control: v,
50
+ defaultValues: r
51
+ };
52
+ }
53
+ const K = ({ children: o }) => {
54
+ const n = L();
55
+ return /* @__PURE__ */ x(S.Provider, { value: n, children: o });
56
+ }, X = () => {
57
+ const o = M(S);
58
+ if (!o)
59
+ throw new Error("useChatForm must be used within a ChatFormProvider");
60
+ return o;
61
+ };
62
+ export {
63
+ K as ChatFormProvider,
64
+ X as useChatForm,
65
+ L as useChatFormState
66
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),p=require("merge-anything"),o=require("react"),r=require("../utils/default-settings.cjs"),E=require("../atoms/shadow/context.cjs"),a={ChatButton:"CHAT_BUTTON",CustomTrigger:"CUSTOM_TRIGGER",SearchBar:"SEARCH_BAR",EmbeddedChat:"EMBEDDED_CHAT",EmbeddedSearch:"EMBEDDED_SEARCH",EmbeddedSearchAndChat:"EMBEDDED_SEARCH_AND_CHAT",IntelligentForm:"INTELLIGENT_FORM"},c={prefix:"ikp",aiChatSettings:r.defaultInkeepAIChatSettings,baseSettings:r.defaultInkeepBaseSettings,searchSettings:r.defaultInkeepSearchSettings,interactionType:a.EmbeddedChat},g=o.createContext(c),h=({children:t,value:i})=>{const d=E.useShadow(),u=(s,e,n)=>(n==="apiKey"&&!e&&!i?.baseSettings?.baseUrl&&console.warn("Inkeep API key is missing."),n==="tools"&&Array.isArray(e)?(s||[]).concat(e):["baseSettings","searchSettings","aiChatSettings"].includes(n)&&!e?s:e),C={baseSettings:d??{}},S=p.mergeAndCompare(u,c,C,i??{});return f.jsx(g.Provider,{value:S,children:t})},I=()=>{const t=o.useContext(g);if(!t)throw new Error("useInkeepConfig must be used within a ConfigProvider");return t};exports.InkeepConfigProvider=h;exports.WebWidgetInteractionType=a;exports.useInkeepConfig=I;
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ import { DefaultInkeepAIChatSettings, DefaultInkeepBaseSettings, DefaultInkeepSearchSettings } from '../utils/default-settings';
3
+ import { InkeepConfig } from '@inkeep/cxkit-types';
4
+ export declare const WebWidgetInteractionType: {
5
+ readonly ChatButton: "CHAT_BUTTON";
6
+ readonly CustomTrigger: "CUSTOM_TRIGGER";
7
+ readonly SearchBar: "SEARCH_BAR";
8
+ readonly EmbeddedChat: "EMBEDDED_CHAT";
9
+ readonly EmbeddedSearch: "EMBEDDED_SEARCH";
10
+ readonly EmbeddedSearchAndChat: "EMBEDDED_SEARCH_AND_CHAT";
11
+ readonly IntelligentForm: "INTELLIGENT_FORM";
12
+ };
13
+ export interface WidgetConfig extends InkeepConfig {
14
+ aiChatSettings: InkeepConfig['aiChatSettings'] & DefaultInkeepAIChatSettings;
15
+ baseSettings: InkeepConfig['baseSettings'] & DefaultInkeepBaseSettings;
16
+ searchSettings: InkeepConfig['searchSettings'] & DefaultInkeepSearchSettings;
17
+ }
18
+ interface InkeepConfigProviderProps {
19
+ children: ReactNode;
20
+ value?: Partial<InkeepConfig>;
21
+ }
22
+ export declare const InkeepConfigProvider: ({ children, value }: InkeepConfigProviderProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const useInkeepConfig: () => WidgetConfig;
24
+ export {};
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ import { DefaultInkeepAIChatSettings, DefaultInkeepBaseSettings, DefaultInkeepSearchSettings } from '../utils/default-settings';
3
+ import { InkeepConfig } from '@inkeep/cxkit-types';
4
+ export declare const WebWidgetInteractionType: {
5
+ readonly ChatButton: "CHAT_BUTTON";
6
+ readonly CustomTrigger: "CUSTOM_TRIGGER";
7
+ readonly SearchBar: "SEARCH_BAR";
8
+ readonly EmbeddedChat: "EMBEDDED_CHAT";
9
+ readonly EmbeddedSearch: "EMBEDDED_SEARCH";
10
+ readonly EmbeddedSearchAndChat: "EMBEDDED_SEARCH_AND_CHAT";
11
+ readonly IntelligentForm: "INTELLIGENT_FORM";
12
+ };
13
+ export interface WidgetConfig extends InkeepConfig {
14
+ aiChatSettings: InkeepConfig['aiChatSettings'] & DefaultInkeepAIChatSettings;
15
+ baseSettings: InkeepConfig['baseSettings'] & DefaultInkeepBaseSettings;
16
+ searchSettings: InkeepConfig['searchSettings'] & DefaultInkeepSearchSettings;
17
+ }
18
+ interface InkeepConfigProviderProps {
19
+ children: ReactNode;
20
+ value?: Partial<InkeepConfig>;
21
+ }
22
+ export declare const InkeepConfigProvider: ({ children, value }: InkeepConfigProviderProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const useInkeepConfig: () => WidgetConfig;
24
+ export {};
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { jsx as d } from "react/jsx-runtime";
3
+ import { mergeAndCompare as C } from "merge-anything";
4
+ import { createContext as g, useContext as p } from "react";
5
+ import { defaultInkeepSearchSettings as f, defaultInkeepBaseSettings as m, defaultInkeepAIChatSettings as E } from "../utils/default-settings.js";
6
+ import { useShadow as S } from "../atoms/shadow/context.js";
7
+ const h = {
8
+ ChatButton: "CHAT_BUTTON",
9
+ CustomTrigger: "CUSTOM_TRIGGER",
10
+ SearchBar: "SEARCH_BAR",
11
+ EmbeddedChat: "EMBEDDED_CHAT",
12
+ EmbeddedSearch: "EMBEDDED_SEARCH",
13
+ EmbeddedSearchAndChat: "EMBEDDED_SEARCH_AND_CHAT",
14
+ IntelligentForm: "INTELLIGENT_FORM"
15
+ }, i = {
16
+ prefix: "ikp",
17
+ // Default prefix
18
+ aiChatSettings: E,
19
+ baseSettings: m,
20
+ searchSettings: f,
21
+ interactionType: h.EmbeddedChat
22
+ }, s = g(i), B = ({ children: t, value: r }) => {
23
+ const a = S(), c = C((o, e, n) => (n === "apiKey" && !e && !r?.baseSettings?.baseUrl && console.warn("Inkeep API key is missing."), n === "tools" && Array.isArray(e) ? (o || []).concat(e) : ["baseSettings", "searchSettings", "aiChatSettings"].includes(n) && !e ? o : e), i, {
24
+ baseSettings: a ?? {}
25
+ }, r ?? {});
26
+ return /* @__PURE__ */ d(s.Provider, { value: c, children: t });
27
+ }, x = () => {
28
+ const t = p(s);
29
+ if (!t)
30
+ throw new Error("useInkeepConfig must be used within a ConfigProvider");
31
+ return t;
32
+ };
33
+ export {
34
+ B as InkeepConfigProvider,
35
+ h as WebWidgetInteractionType,
36
+ x as useInkeepConfig
37
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),o=require("react"),h=require("./config-provider.cjs"),C="conversationId",l=o.createContext(null),S=({children:n})=>{const i=w(),{aiChatSettings:c}=h.useInkeepConfig(),t=c.chatId||i,s={id:"",messages:[]},[r,a]=o.useState(s),e=()=>{a(s)},u=o.useMemo(()=>({conversation:r,setConversation:a,chatId:t,resetConversation:e}),[r,t]);return p.jsx(l.Provider,{value:u,children:n})},f=()=>{const n=o.useContext(l);if(!n)throw new Error("useInkeepConversation must be used within an InkeepConversationProvider");return n};function w(){const[n,i]=o.useState(void 0),{aiChatSettings:c}=h.useInkeepConfig(),{shareChatUrlBasePath:t}=c;return o.useEffect(()=>{if(!t||typeof window>"u")return;const s=e=>e.endsWith("/")?e.slice(0,-1):e,r=()=>{const{origin:e,pathname:u,search:m}=window.location,d=new URL(t),I=s(u),P=s(d.pathname);if(e===d.origin&&I===P){const v=new URLSearchParams(m).get(C);v&&i(v)}};r();const a=()=>r();return window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}},[t]),n}exports.InkeepConversationProvider=S;exports.SHARE_QUERY_PARAM=C;exports.useInkeepConversation=f;
@@ -0,0 +1,12 @@
1
+ import { ConversationResponse } from '@inkeep/cxkit-types';
2
+ export declare const SHARE_QUERY_PARAM = "conversationId";
3
+ export interface InkeepConversationContextValue {
4
+ conversation: ConversationResponse;
5
+ setConversation: React.Dispatch<React.SetStateAction<ConversationResponse>>;
6
+ chatId: string | undefined;
7
+ resetConversation: () => void;
8
+ }
9
+ export declare const InkeepConversationProvider: React.FC<{
10
+ children: React.ReactNode;
11
+ }>;
12
+ export declare const useInkeepConversation: () => InkeepConversationContextValue;
@@ -0,0 +1,12 @@
1
+ import { ConversationResponse } from '@inkeep/cxkit-types';
2
+ export declare const SHARE_QUERY_PARAM = "conversationId";
3
+ export interface InkeepConversationContextValue {
4
+ conversation: ConversationResponse;
5
+ setConversation: React.Dispatch<React.SetStateAction<ConversationResponse>>;
6
+ chatId: string | undefined;
7
+ resetConversation: () => void;
8
+ }
9
+ export declare const InkeepConversationProvider: React.FC<{
10
+ children: React.ReactNode;
11
+ }>;
12
+ export declare const useInkeepConversation: () => InkeepConversationContextValue;
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { jsx as I } from "react/jsx-runtime";
3
+ import { useState as u, useMemo as f, createContext as w, useContext as P, useEffect as S } from "react";
4
+ import { useInkeepConfig as m } from "./config-provider.js";
5
+ const g = "conversationId", v = w(null), z = ({ children: t }) => {
6
+ const a = x(), { aiChatSettings: i } = m(), n = i.chatId || a, o = {
7
+ id: "",
8
+ messages: []
9
+ }, [s, r] = u(o), e = () => {
10
+ r(o);
11
+ }, c = f(
12
+ () => ({
13
+ conversation: s,
14
+ setConversation: r,
15
+ chatId: n,
16
+ resetConversation: e
17
+ }),
18
+ [s, n]
19
+ );
20
+ return /* @__PURE__ */ I(v.Provider, { value: c, children: t });
21
+ }, L = () => {
22
+ const t = P(v);
23
+ if (!t)
24
+ throw new Error("useInkeepConversation must be used within an InkeepConversationProvider");
25
+ return t;
26
+ };
27
+ function x() {
28
+ const [t, a] = u(void 0), { aiChatSettings: i } = m(), { shareChatUrlBasePath: n } = i;
29
+ return S(() => {
30
+ if (!n || typeof window > "u") return;
31
+ const o = (e) => e.endsWith("/") ? e.slice(0, -1) : e, s = () => {
32
+ const { origin: e, pathname: c, search: C } = window.location, d = new URL(n), l = o(c), p = o(d.pathname);
33
+ if (e === d.origin && l === p) {
34
+ const h = new URLSearchParams(C).get(g);
35
+ h && a(h);
36
+ }
37
+ };
38
+ s();
39
+ const r = () => s();
40
+ return window.addEventListener("popstate", r), () => {
41
+ window.removeEventListener("popstate", r);
42
+ };
43
+ }, [n]), t;
44
+ }
45
+ export {
46
+ z as InkeepConversationProvider,
47
+ g as SHARE_QUERY_PARAM,
48
+ L as useInkeepConversation
49
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),t=require("react"),r=t.createContext(void 0),s=({children:e,name:o})=>{const c=t.useRef(null);return n.jsx(r.Provider,{value:{name:o,focusItem:c},children:e})},u=()=>{const e=t.useContext(r);if(!e)throw new Error("useFeedbackItem must be used within a FeedbackItemProvider");return e};exports.FeedbackItemProvider=s;exports.useFeedbackItem=u;
@@ -0,0 +1,10 @@
1
+ import { FeedbackItemType } from '@inkeep/cxkit-types';
2
+ export type FeedbackItemContextValue = {
3
+ name: FeedbackItemType;
4
+ focusItem: React.RefObject<HTMLElement | null>;
5
+ };
6
+ export declare const FeedbackItemProvider: React.FC<{
7
+ children: React.ReactNode;
8
+ name: FeedbackItemType;
9
+ }>;
10
+ export declare const useFeedbackItem: () => FeedbackItemContextValue;
@@ -0,0 +1,10 @@
1
+ import { FeedbackItemType } from '@inkeep/cxkit-types';
2
+ export type FeedbackItemContextValue = {
3
+ name: FeedbackItemType;
4
+ focusItem: React.RefObject<HTMLElement | null>;
5
+ };
6
+ export declare const FeedbackItemProvider: React.FC<{
7
+ children: React.ReactNode;
8
+ name: FeedbackItemType;
9
+ }>;
10
+ export declare const useFeedbackItem: () => FeedbackItemContextValue;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ import { useRef as c, createContext as s, useContext as u } from "react";
4
+ const t = s(void 0), i = ({ children: e, name: o }) => {
5
+ const r = c(null);
6
+ return /* @__PURE__ */ n(t.Provider, { value: { name: o, focusItem: r }, children: e });
7
+ }, a = () => {
8
+ const e = u(t);
9
+ if (!e)
10
+ throw new Error("useFeedbackItem must be used within a FeedbackItemProvider");
11
+ return e;
12
+ };
13
+ export {
14
+ i as FeedbackItemProvider,
15
+ a as useFeedbackItem
16
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react/jsx-runtime"),n=require("react"),x=require("../atoms/api/analytics/feedback.cjs"),M=require("../components/embedded-chat/chat-provider.cjs"),l=require("../utils/misc.cjs"),S=require("./config-provider.cjs"),E=require("./conversation-provider.cjs"),j=require("./chat-events-provider.cjs"),I=require("./user-provider.cjs"),f=n.createContext(void 0);function R(){const{baseSettings:e}=S.useInkeepConfig(),{apiKey:s,analyticsBaseUrl:o}=e,[b,g]=n.useState(null),[F,h]=n.useState({}),{conversation:k}=E.useInkeepConversation(),{messages:c,selectedWorkflow:m}=M.useChat(),{userProperties:p}=I.useUser(),{logEvent:C}=j.useChatEvents(),r=n.useCallback(async(t,a,i=[])=>{const u=await x.submitFeedback({type:a,messageId:t,reasons:i,apiKey:s,apiUrl:o,userProperties:p});u&&h(d=>({...d,[t]:{type:u.type,reasons:u.reasons}}));const v=c.findIndex(d=>d.id===t),w=c[v],y={conversationId:k.id,question:l.getMessageContent(c[v-1]),answer:l.getMessageContent(w),messageId:t,reasons:i,workflowId:m?.id};C({eventName:a==="positive"?"chat_thumbs_up_feedback_submitted":"chat_thumbs_down_feedback_submitted",properties:y})},[c,k]),P=n.useCallback(async t=>{r(t,"positive")},[r]),q=n.useCallback(async(t,a)=>{const i=$(a);r(t,"negative",i)},[r]);return{feedback:F,currentFeedback:b,setCurrentFeedback:g,submitPositiveFeedback:P,submitNegativeFeedback:q}}const U=({children:e})=>{const s=R();return _.jsx(f.Provider,{value:s,children:e})},N=()=>{const e=n.useContext(f);if(!e)throw new Error("useFeedback must be used within a FeedbackProvider");return e};function $(e){const s=[];for(const o in e)e[o]==="on"&&s.push({label:o,details:e[`${o}:description`]||""});return s.length>0?s:[]}exports.FeedbackProvider=U;exports.useMessageFeedback=N;
@@ -0,0 +1,19 @@
1
+ import { FeebackReason, FeedbackType } from '@inkeep/cxkit-types';
2
+ import { Dispatch, SetStateAction } from 'react';
3
+ export type FeedbackContextValue = ReturnType<typeof useFeedback>;
4
+ export type MessageFeedbackItem = Record<string, {
5
+ type: FeedbackType;
6
+ reasons: FeebackReason[] | null;
7
+ }>;
8
+ declare function useFeedback(): {
9
+ feedback: MessageFeedbackItem;
10
+ currentFeedback: string | null;
11
+ setCurrentFeedback: Dispatch<SetStateAction<string | null>>;
12
+ submitPositiveFeedback: (messageId: string) => Promise<void>;
13
+ submitNegativeFeedback: (messageId: string, reasonsData: Record<string, FormDataEntryValue>) => Promise<void>;
14
+ };
15
+ export declare const FeedbackProvider: React.FC<{
16
+ children: React.ReactNode;
17
+ }>;
18
+ export declare const useMessageFeedback: () => FeedbackContextValue;
19
+ export {};
@@ -0,0 +1,19 @@
1
+ import { FeebackReason, FeedbackType } from '@inkeep/cxkit-types';
2
+ import { Dispatch, SetStateAction } from 'react';
3
+ export type FeedbackContextValue = ReturnType<typeof useFeedback>;
4
+ export type MessageFeedbackItem = Record<string, {
5
+ type: FeedbackType;
6
+ reasons: FeebackReason[] | null;
7
+ }>;
8
+ declare function useFeedback(): {
9
+ feedback: MessageFeedbackItem;
10
+ currentFeedback: string | null;
11
+ setCurrentFeedback: Dispatch<SetStateAction<string | null>>;
12
+ submitPositiveFeedback: (messageId: string) => Promise<void>;
13
+ submitNegativeFeedback: (messageId: string, reasonsData: Record<string, FormDataEntryValue>) => Promise<void>;
14
+ };
15
+ export declare const FeedbackProvider: React.FC<{
16
+ children: React.ReactNode;
17
+ }>;
18
+ export declare const useMessageFeedback: () => FeedbackContextValue;
19
+ export {};
@@ -0,0 +1,82 @@
1
+ "use client";
2
+ import { jsx as E } from "react/jsx-runtime";
3
+ import { createContext as I, useContext as U, useState as f, useCallback as u } from "react";
4
+ import { submitFeedback as M } from "../atoms/api/analytics/feedback.js";
5
+ import { useChat as N } from "../components/embedded-chat/chat-provider.js";
6
+ import { getMessageContent as p } from "../utils/misc.js";
7
+ import { useInkeepConfig as S } from "./config-provider.js";
8
+ import { useInkeepConversation as j } from "./conversation-provider.js";
9
+ import { useChatEvents as q } from "./chat-events-provider.js";
10
+ import { useUser as B } from "./user-provider.js";
11
+ const l = I(void 0);
12
+ function K() {
13
+ const { baseSettings: e } = S(), { apiKey: s, analyticsBaseUrl: o } = e, [b, v] = f(null), [F, h] = f({}), { conversation: m } = j(), { messages: n, selectedWorkflow: g } = N(), { userProperties: C } = B(), { logEvent: w } = q(), r = u(
14
+ async (t, c, i = []) => {
15
+ const a = await M({
16
+ type: c,
17
+ messageId: t,
18
+ reasons: i,
19
+ apiKey: s,
20
+ apiUrl: o,
21
+ userProperties: C
22
+ });
23
+ a && h((d) => ({
24
+ ...d,
25
+ [t]: { type: a.type, reasons: a.reasons }
26
+ }));
27
+ const k = n.findIndex((d) => d.id === t), y = n[k], P = {
28
+ conversationId: m.id,
29
+ question: p(n[k - 1]),
30
+ answer: p(y),
31
+ messageId: t,
32
+ reasons: i,
33
+ workflowId: g?.id
34
+ };
35
+ w({
36
+ eventName: c === "positive" ? "chat_thumbs_up_feedback_submitted" : "chat_thumbs_down_feedback_submitted",
37
+ properties: P
38
+ });
39
+ },
40
+ [n, m]
41
+ ), _ = u(
42
+ async (t) => {
43
+ r(t, "positive");
44
+ },
45
+ [r]
46
+ ), x = u(
47
+ async (t, c) => {
48
+ const i = R(c);
49
+ r(t, "negative", i);
50
+ },
51
+ [r]
52
+ );
53
+ return {
54
+ feedback: F,
55
+ currentFeedback: b,
56
+ setCurrentFeedback: v,
57
+ submitPositiveFeedback: _,
58
+ submitNegativeFeedback: x
59
+ };
60
+ }
61
+ const O = ({ children: e }) => {
62
+ const s = K();
63
+ return /* @__PURE__ */ E(l.Provider, { value: s, children: e });
64
+ }, Q = () => {
65
+ const e = U(l);
66
+ if (!e)
67
+ throw new Error("useFeedback must be used within a FeedbackProvider");
68
+ return e;
69
+ };
70
+ function R(e) {
71
+ const s = [];
72
+ for (const o in e)
73
+ e[o] === "on" && s.push({
74
+ label: o,
75
+ details: e[`${o}:description`] || ""
76
+ });
77
+ return s.length > 0 ? s : [];
78
+ }
79
+ export {
80
+ O as FeedbackProvider,
81
+ Q as useMessageFeedback
82
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),o=require("react"),F=require("./chat-form-provider.cjs"),t=o.createContext(void 0),d=({children:e,field:r,fieldProps:i,autoFocus:n})=>{const{errors:s}=F.useChatForm(),u=s[r.name];return c.jsx(t.Provider,{value:{field:r,fieldProps:i,error:u,autoFocus:n},children:e})},m=()=>{const e=o.useContext(t);if(!e)throw new Error("useFormField must be used within a FormFieldProvider");return e};exports.FormFieldProvider=d;exports.useFormField=m;
@@ -0,0 +1,15 @@
1
+ import { FormField } from '@inkeep/cxkit-types';
2
+ import { ControllerRenderProps, FieldErrors } from 'react-hook-form';
3
+ interface FormFieldCtx {
4
+ field: FormField;
5
+ fieldProps: ControllerRenderProps<Record<string, any>, string>;
6
+ autoFocus?: boolean;
7
+ }
8
+ export interface FormFieldContextValue extends FormFieldCtx {
9
+ error: FieldErrors<Record<string, any>>[number];
10
+ }
11
+ export declare const FormFieldProvider: React.FC<{
12
+ children: React.ReactNode;
13
+ } & FormFieldCtx>;
14
+ export declare const useFormField: () => FormFieldContextValue;
15
+ export {};
@@ -0,0 +1,15 @@
1
+ import { FormField } from '@inkeep/cxkit-types';
2
+ import { ControllerRenderProps, FieldErrors } from 'react-hook-form';
3
+ interface FormFieldCtx {
4
+ field: FormField;
5
+ fieldProps: ControllerRenderProps<Record<string, any>, string>;
6
+ autoFocus?: boolean;
7
+ }
8
+ export interface FormFieldContextValue extends FormFieldCtx {
9
+ error: FieldErrors<Record<string, any>>[number];
10
+ }
11
+ export declare const FormFieldProvider: React.FC<{
12
+ children: React.ReactNode;
13
+ } & FormFieldCtx>;
14
+ export declare const useFormField: () => FormFieldContextValue;
15
+ export {};