@botonic/react 0.31.0-alpha.4 → 0.31.0-alpha.6

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 (413) hide show
  1. package/lib/cjs/components/audio.d.ts +8 -7
  2. package/lib/cjs/components/audio.js +7 -4
  3. package/lib/cjs/components/audio.js.map +1 -1
  4. package/lib/cjs/components/button.js +3 -4
  5. package/lib/cjs/components/button.js.map +1 -1
  6. package/lib/cjs/components/carousel.js +2 -2
  7. package/lib/cjs/components/carousel.js.map +1 -1
  8. package/lib/cjs/components/custom-message.d.ts +16 -12
  9. package/lib/cjs/components/custom-message.js +3 -9
  10. package/lib/cjs/components/custom-message.js.map +1 -1
  11. package/lib/cjs/components/document.d.ts +8 -7
  12. package/lib/cjs/components/document.js +5 -5
  13. package/lib/cjs/components/document.js.map +1 -1
  14. package/lib/cjs/components/handoff.js +2 -2
  15. package/lib/cjs/components/handoff.js.map +1 -1
  16. package/lib/cjs/components/image.d.ts +8 -7
  17. package/lib/cjs/components/image.js +5 -5
  18. package/lib/cjs/components/image.js.map +1 -1
  19. package/lib/cjs/components/index-types.d.ts +30 -128
  20. package/lib/cjs/components/index.d.ts +2 -1
  21. package/lib/cjs/components/index.js +4 -1
  22. package/lib/cjs/components/index.js.map +1 -1
  23. package/lib/cjs/components/message/index.js +2 -1
  24. package/lib/cjs/components/message/index.js.map +1 -1
  25. package/lib/cjs/components/message/message-feedback.js +2 -2
  26. package/lib/cjs/components/message/message-feedback.js.map +1 -1
  27. package/lib/cjs/components/message/message-footer.js +2 -2
  28. package/lib/cjs/components/message/message-footer.js.map +1 -1
  29. package/lib/cjs/components/message/message-image.js +2 -2
  30. package/lib/cjs/components/message/message-image.js.map +1 -1
  31. package/lib/cjs/components/message/timestamps.js +2 -2
  32. package/lib/cjs/components/message/timestamps.js.map +1 -1
  33. package/lib/cjs/components/reply.d.ts +7 -6
  34. package/lib/cjs/components/reply.js +10 -6
  35. package/lib/cjs/components/reply.js.map +1 -1
  36. package/lib/cjs/components/video.d.ts +8 -7
  37. package/lib/cjs/components/video.js +2 -3
  38. package/lib/cjs/components/video.js.map +1 -1
  39. package/lib/cjs/components/webchat-settings.d.ts +15 -2
  40. package/lib/cjs/components/webchat-settings.js +2 -2
  41. package/lib/cjs/components/webchat-settings.js.map +1 -1
  42. package/lib/cjs/contexts.d.ts +3 -4
  43. package/lib/cjs/contexts.js +2 -79
  44. package/lib/cjs/contexts.js.map +1 -1
  45. package/lib/cjs/index-types.d.ts +89 -56
  46. package/lib/cjs/index-types.js.map +1 -1
  47. package/lib/cjs/index.d.ts +2 -2
  48. package/lib/cjs/index.js +1 -2
  49. package/lib/cjs/index.js.map +1 -1
  50. package/lib/cjs/msg-to-botonic.d.ts +1 -1
  51. package/lib/cjs/msg-to-botonic.js +5 -8
  52. package/lib/cjs/msg-to-botonic.js.map +1 -1
  53. package/lib/cjs/util/webchat.d.ts +17 -6
  54. package/lib/cjs/util/webchat.js +9 -7
  55. package/lib/cjs/util/webchat.js.map +1 -1
  56. package/lib/cjs/webchat/chat-area/index.js +3 -3
  57. package/lib/cjs/webchat/chat-area/index.js.map +1 -1
  58. package/lib/cjs/webchat/components/conditional-animation.js +2 -2
  59. package/lib/cjs/webchat/components/conditional-animation.js.map +1 -1
  60. package/lib/cjs/webchat/components/opened-persistent-menu.js +2 -2
  61. package/lib/cjs/webchat/components/opened-persistent-menu.js.map +1 -1
  62. package/lib/cjs/webchat/{actions.d.ts → context/actions.d.ts} +2 -0
  63. package/lib/cjs/webchat/{actions.js → context/actions.js} +3 -0
  64. package/lib/cjs/webchat/context/actions.js.map +1 -0
  65. package/lib/cjs/webchat/context/index.d.ts +5 -0
  66. package/lib/cjs/webchat/context/index.js +83 -0
  67. package/lib/cjs/webchat/context/index.js.map +1 -0
  68. package/lib/cjs/webchat/{messages-reducer.d.ts → context/messages-reducer.d.ts} +1 -1
  69. package/lib/cjs/webchat/{messages-reducer.js → context/messages-reducer.js} +3 -1
  70. package/lib/cjs/webchat/context/messages-reducer.js.map +1 -0
  71. package/lib/cjs/webchat/context/types.d.ts +74 -0
  72. package/lib/cjs/webchat/context/types.js +3 -0
  73. package/lib/cjs/webchat/context/types.js.map +1 -0
  74. package/lib/cjs/webchat/{hooks → context}/use-webchat.d.ts +20 -20
  75. package/lib/cjs/webchat/{hooks → context}/use-webchat.js +11 -5
  76. package/lib/cjs/webchat/context/use-webchat.js.map +1 -0
  77. package/lib/cjs/webchat/{webchat-reducer.d.ts → context/webchat-reducer.d.ts} +1 -1
  78. package/lib/cjs/webchat/{webchat-reducer.js → context/webchat-reducer.js} +2 -0
  79. package/lib/cjs/webchat/context/webchat-reducer.js.map +1 -0
  80. package/lib/cjs/webchat/cover-component/index.js +2 -2
  81. package/lib/cjs/webchat/cover-component/index.js.map +1 -1
  82. package/lib/cjs/webchat/header/default-header.d.ts +1 -0
  83. package/lib/cjs/webchat/header/default-header.js +25 -0
  84. package/lib/cjs/webchat/header/default-header.js.map +1 -0
  85. package/lib/cjs/webchat/header/index.d.ts +2 -0
  86. package/lib/cjs/webchat/header/index.js +23 -0
  87. package/lib/cjs/webchat/header/index.js.map +1 -0
  88. package/lib/cjs/webchat/header/styles.d.ts +7 -0
  89. package/lib/cjs/webchat/header/styles.js +59 -0
  90. package/lib/cjs/webchat/header/styles.js.map +1 -0
  91. package/lib/cjs/webchat/hooks/index.d.ts +0 -1
  92. package/lib/cjs/webchat/hooks/index.js +1 -4
  93. package/lib/cjs/webchat/hooks/index.js.map +1 -1
  94. package/lib/cjs/webchat/hooks/use-previous.d.ts +1 -1
  95. package/lib/cjs/webchat/hooks/use-previous.js.map +1 -1
  96. package/lib/cjs/webchat/hooks/use-scrollbar-controller.js +3 -3
  97. package/lib/cjs/webchat/hooks/use-scrollbar-controller.js.map +1 -1
  98. package/lib/cjs/webchat/hooks/use-typing.d.ts +1 -1
  99. package/lib/cjs/webchat/hooks/use-webchat-dimensions.js +2 -2
  100. package/lib/cjs/webchat/hooks/use-webchat-dimensions.js.map +1 -1
  101. package/lib/cjs/webchat/hooks/use-webchat-resizer.js +2 -2
  102. package/lib/cjs/webchat/hooks/use-webchat-resizer.js.map +1 -1
  103. package/lib/cjs/webchat/index-types.d.ts +3 -47
  104. package/lib/cjs/webchat/index.d.ts +1 -0
  105. package/lib/cjs/webchat/index.js +3 -1
  106. package/lib/cjs/webchat/index.js.map +1 -1
  107. package/lib/cjs/webchat/input-panel/attachment.d.ts +1 -1
  108. package/lib/cjs/webchat/input-panel/attachment.js +2 -2
  109. package/lib/cjs/webchat/input-panel/attachment.js.map +1 -1
  110. package/lib/cjs/webchat/input-panel/emoji-picker.d.ts +1 -1
  111. package/lib/cjs/webchat/input-panel/emoji-picker.js +2 -2
  112. package/lib/cjs/webchat/input-panel/emoji-picker.js.map +1 -1
  113. package/lib/cjs/webchat/input-panel/index.d.ts +3 -3
  114. package/lib/cjs/webchat/input-panel/index.js +8 -3
  115. package/lib/cjs/webchat/input-panel/index.js.map +1 -1
  116. package/lib/cjs/webchat/input-panel/persistent-menu.js +2 -2
  117. package/lib/cjs/webchat/input-panel/persistent-menu.js.map +1 -1
  118. package/lib/cjs/webchat/input-panel/send-button.js +2 -2
  119. package/lib/cjs/webchat/input-panel/send-button.js.map +1 -1
  120. package/lib/cjs/webchat/input-panel/textarea.d.ts +3 -3
  121. package/lib/cjs/webchat/input-panel/textarea.js +4 -2
  122. package/lib/cjs/webchat/input-panel/textarea.js.map +1 -1
  123. package/lib/cjs/webchat/message-list/index.js +5 -7
  124. package/lib/cjs/webchat/message-list/index.js.map +1 -1
  125. package/lib/cjs/webchat/message-list/intro-message.js +2 -2
  126. package/lib/cjs/webchat/message-list/intro-message.js.map +1 -1
  127. package/lib/cjs/webchat/message-list/styles.js +1 -0
  128. package/lib/cjs/webchat/message-list/styles.js.map +1 -1
  129. package/lib/cjs/webchat/message-list/unread-messages-banner.js +2 -2
  130. package/lib/cjs/webchat/message-list/unread-messages-banner.js.map +1 -1
  131. package/lib/cjs/webchat/message-list/use-notifications.js +2 -2
  132. package/lib/cjs/webchat/message-list/use-notifications.js.map +1 -1
  133. package/lib/cjs/webchat/replies/index.d.ts +1 -0
  134. package/lib/cjs/webchat/replies/index.js +32 -0
  135. package/lib/cjs/webchat/replies/index.js.map +1 -0
  136. package/lib/cjs/webchat/replies/styles.d.ts +8 -0
  137. package/lib/cjs/webchat/replies/styles.js +25 -0
  138. package/lib/cjs/webchat/replies/styles.js.map +1 -0
  139. package/lib/cjs/webchat/session-view.js +2 -2
  140. package/lib/cjs/webchat/session-view.js.map +1 -1
  141. package/lib/cjs/webchat/{webchat-typed/styles.d.ts → styles.d.ts} +6 -4
  142. package/lib/cjs/webchat/{webchat-typed/styles.js → styles.js} +1 -1
  143. package/lib/cjs/webchat/styles.js.map +1 -0
  144. package/lib/cjs/webchat/theme/types.d.ts +167 -0
  145. package/lib/cjs/webchat/theme/types.js +3 -0
  146. package/lib/cjs/webchat/theme/types.js.map +1 -0
  147. package/lib/cjs/webchat/trigger-button/index.js +2 -2
  148. package/lib/cjs/webchat/trigger-button/index.js.map +1 -1
  149. package/lib/cjs/webchat/webchat-dev.js +2 -2
  150. package/lib/cjs/webchat/webchat-dev.js.map +1 -1
  151. package/lib/cjs/webchat/webchat.d.ts +4 -2
  152. package/lib/cjs/webchat/webchat.js +85 -108
  153. package/lib/cjs/webchat/webchat.js.map +1 -1
  154. package/lib/cjs/webchat/webview.js +3 -2
  155. package/lib/cjs/webchat/webview.js.map +1 -1
  156. package/lib/cjs/webchat-app.d.ts +14 -80
  157. package/lib/cjs/webchat-app.js +28 -14
  158. package/lib/cjs/webchat-app.js.map +1 -1
  159. package/lib/esm/components/audio.d.ts +8 -7
  160. package/lib/esm/components/audio.js +7 -4
  161. package/lib/esm/components/audio.js.map +1 -1
  162. package/lib/esm/components/button.js +2 -3
  163. package/lib/esm/components/button.js.map +1 -1
  164. package/lib/esm/components/carousel.js +1 -1
  165. package/lib/esm/components/carousel.js.map +1 -1
  166. package/lib/esm/components/custom-message.d.ts +16 -12
  167. package/lib/esm/components/custom-message.js +3 -9
  168. package/lib/esm/components/custom-message.js.map +1 -1
  169. package/lib/esm/components/document.d.ts +8 -7
  170. package/lib/esm/components/document.js +4 -4
  171. package/lib/esm/components/document.js.map +1 -1
  172. package/lib/esm/components/handoff.js +1 -1
  173. package/lib/esm/components/handoff.js.map +1 -1
  174. package/lib/esm/components/image.d.ts +8 -7
  175. package/lib/esm/components/image.js +4 -4
  176. package/lib/esm/components/image.js.map +1 -1
  177. package/lib/esm/components/index-types.d.ts +30 -128
  178. package/lib/esm/components/index.d.ts +2 -1
  179. package/lib/esm/components/index.js +2 -1
  180. package/lib/esm/components/index.js.map +1 -1
  181. package/lib/esm/components/message/index.js +2 -1
  182. package/lib/esm/components/message/index.js.map +1 -1
  183. package/lib/esm/components/message/message-feedback.js +1 -1
  184. package/lib/esm/components/message/message-feedback.js.map +1 -1
  185. package/lib/esm/components/message/message-footer.js +1 -1
  186. package/lib/esm/components/message/message-footer.js.map +1 -1
  187. package/lib/esm/components/message/message-image.js +1 -1
  188. package/lib/esm/components/message/message-image.js.map +1 -1
  189. package/lib/esm/components/message/timestamps.js +1 -1
  190. package/lib/esm/components/message/timestamps.js.map +1 -1
  191. package/lib/esm/components/reply.d.ts +7 -6
  192. package/lib/esm/components/reply.js +9 -5
  193. package/lib/esm/components/reply.js.map +1 -1
  194. package/lib/esm/components/video.d.ts +8 -7
  195. package/lib/esm/components/video.js +2 -3
  196. package/lib/esm/components/video.js.map +1 -1
  197. package/lib/esm/components/webchat-settings.d.ts +15 -2
  198. package/lib/esm/components/webchat-settings.js +1 -1
  199. package/lib/esm/components/webchat-settings.js.map +1 -1
  200. package/lib/esm/contexts.d.ts +3 -4
  201. package/lib/esm/contexts.js +1 -78
  202. package/lib/esm/contexts.js.map +1 -1
  203. package/lib/esm/index-types.d.ts +89 -56
  204. package/lib/esm/index-types.js.map +1 -1
  205. package/lib/esm/index.d.ts +2 -2
  206. package/lib/esm/index.js +1 -1
  207. package/lib/esm/index.js.map +1 -1
  208. package/lib/esm/msg-to-botonic.d.ts +1 -1
  209. package/lib/esm/msg-to-botonic.js +5 -8
  210. package/lib/esm/msg-to-botonic.js.map +1 -1
  211. package/lib/esm/util/webchat.d.ts +17 -6
  212. package/lib/esm/util/webchat.js +9 -7
  213. package/lib/esm/util/webchat.js.map +1 -1
  214. package/lib/esm/webchat/chat-area/index.js +2 -2
  215. package/lib/esm/webchat/chat-area/index.js.map +1 -1
  216. package/lib/esm/webchat/components/conditional-animation.js +1 -1
  217. package/lib/esm/webchat/components/conditional-animation.js.map +1 -1
  218. package/lib/esm/webchat/components/opened-persistent-menu.js +1 -1
  219. package/lib/esm/webchat/components/opened-persistent-menu.js.map +1 -1
  220. package/lib/esm/webchat/{actions.d.ts → context/actions.d.ts} +2 -0
  221. package/lib/esm/webchat/{actions.js → context/actions.js} +3 -0
  222. package/lib/esm/webchat/context/actions.js.map +1 -0
  223. package/lib/esm/webchat/context/index.d.ts +5 -0
  224. package/lib/esm/webchat/context/index.js +78 -0
  225. package/lib/esm/webchat/context/index.js.map +1 -0
  226. package/lib/esm/webchat/{messages-reducer.d.ts → context/messages-reducer.d.ts} +1 -1
  227. package/lib/esm/webchat/{messages-reducer.js → context/messages-reducer.js} +3 -1
  228. package/lib/esm/webchat/context/messages-reducer.js.map +1 -0
  229. package/lib/esm/webchat/context/types.d.ts +74 -0
  230. package/lib/esm/webchat/context/types.js +2 -0
  231. package/lib/esm/webchat/context/types.js.map +1 -0
  232. package/lib/esm/webchat/{hooks → context}/use-webchat.d.ts +20 -20
  233. package/lib/esm/webchat/{hooks → context}/use-webchat.js +11 -5
  234. package/lib/esm/webchat/context/use-webchat.js.map +1 -0
  235. package/lib/esm/webchat/{webchat-reducer.d.ts → context/webchat-reducer.d.ts} +1 -1
  236. package/lib/esm/webchat/{webchat-reducer.js → context/webchat-reducer.js} +2 -0
  237. package/lib/esm/webchat/context/webchat-reducer.js.map +1 -0
  238. package/lib/esm/webchat/cover-component/index.js +1 -1
  239. package/lib/esm/webchat/cover-component/index.js.map +1 -1
  240. package/lib/esm/webchat/header/default-header.d.ts +1 -0
  241. package/lib/esm/webchat/header/default-header.js +21 -0
  242. package/lib/esm/webchat/header/default-header.js.map +1 -0
  243. package/lib/esm/webchat/header/index.d.ts +2 -0
  244. package/lib/esm/webchat/header/index.js +20 -0
  245. package/lib/esm/webchat/header/index.js.map +1 -0
  246. package/lib/esm/webchat/header/styles.d.ts +7 -0
  247. package/lib/esm/webchat/header/styles.js +55 -0
  248. package/lib/esm/webchat/header/styles.js.map +1 -0
  249. package/lib/esm/webchat/hooks/index.d.ts +0 -1
  250. package/lib/esm/webchat/hooks/index.js +0 -1
  251. package/lib/esm/webchat/hooks/index.js.map +1 -1
  252. package/lib/esm/webchat/hooks/use-previous.d.ts +1 -1
  253. package/lib/esm/webchat/hooks/use-previous.js.map +1 -1
  254. package/lib/esm/webchat/hooks/use-scrollbar-controller.js +2 -2
  255. package/lib/esm/webchat/hooks/use-scrollbar-controller.js.map +1 -1
  256. package/lib/esm/webchat/hooks/use-typing.d.ts +1 -1
  257. package/lib/esm/webchat/hooks/use-webchat-dimensions.js +1 -1
  258. package/lib/esm/webchat/hooks/use-webchat-dimensions.js.map +1 -1
  259. package/lib/esm/webchat/hooks/use-webchat-resizer.js +1 -1
  260. package/lib/esm/webchat/hooks/use-webchat-resizer.js.map +1 -1
  261. package/lib/esm/webchat/index-types.d.ts +3 -47
  262. package/lib/esm/webchat/index.d.ts +1 -0
  263. package/lib/esm/webchat/index.js +1 -0
  264. package/lib/esm/webchat/index.js.map +1 -1
  265. package/lib/esm/webchat/input-panel/attachment.d.ts +1 -1
  266. package/lib/esm/webchat/input-panel/attachment.js +1 -1
  267. package/lib/esm/webchat/input-panel/attachment.js.map +1 -1
  268. package/lib/esm/webchat/input-panel/emoji-picker.d.ts +1 -1
  269. package/lib/esm/webchat/input-panel/emoji-picker.js +1 -1
  270. package/lib/esm/webchat/input-panel/emoji-picker.js.map +1 -1
  271. package/lib/esm/webchat/input-panel/index.d.ts +3 -3
  272. package/lib/esm/webchat/input-panel/index.js +7 -2
  273. package/lib/esm/webchat/input-panel/index.js.map +1 -1
  274. package/lib/esm/webchat/input-panel/persistent-menu.js +1 -1
  275. package/lib/esm/webchat/input-panel/persistent-menu.js.map +1 -1
  276. package/lib/esm/webchat/input-panel/send-button.js +1 -1
  277. package/lib/esm/webchat/input-panel/send-button.js.map +1 -1
  278. package/lib/esm/webchat/input-panel/textarea.d.ts +3 -3
  279. package/lib/esm/webchat/input-panel/textarea.js +3 -1
  280. package/lib/esm/webchat/input-panel/textarea.js.map +1 -1
  281. package/lib/esm/webchat/message-list/index.js +4 -6
  282. package/lib/esm/webchat/message-list/index.js.map +1 -1
  283. package/lib/esm/webchat/message-list/intro-message.js +1 -1
  284. package/lib/esm/webchat/message-list/intro-message.js.map +1 -1
  285. package/lib/esm/webchat/message-list/styles.js +1 -0
  286. package/lib/esm/webchat/message-list/styles.js.map +1 -1
  287. package/lib/esm/webchat/message-list/unread-messages-banner.js +1 -1
  288. package/lib/esm/webchat/message-list/unread-messages-banner.js.map +1 -1
  289. package/lib/esm/webchat/message-list/use-notifications.js +1 -1
  290. package/lib/esm/webchat/message-list/use-notifications.js.map +1 -1
  291. package/lib/esm/webchat/replies/index.d.ts +1 -0
  292. package/lib/esm/webchat/replies/index.js +28 -0
  293. package/lib/esm/webchat/replies/index.js.map +1 -0
  294. package/lib/esm/webchat/replies/styles.d.ts +8 -0
  295. package/lib/esm/webchat/replies/styles.js +21 -0
  296. package/lib/esm/webchat/replies/styles.js.map +1 -0
  297. package/lib/esm/webchat/session-view.js +1 -1
  298. package/lib/esm/webchat/session-view.js.map +1 -1
  299. package/lib/esm/webchat/{webchat-typed/styles.d.ts → styles.d.ts} +6 -4
  300. package/lib/esm/webchat/{webchat-typed/styles.js → styles.js} +1 -1
  301. package/lib/esm/webchat/styles.js.map +1 -0
  302. package/lib/esm/webchat/theme/types.d.ts +167 -0
  303. package/lib/esm/webchat/theme/types.js +2 -0
  304. package/lib/esm/webchat/theme/types.js.map +1 -0
  305. package/lib/esm/webchat/trigger-button/index.js +1 -1
  306. package/lib/esm/webchat/trigger-button/index.js.map +1 -1
  307. package/lib/esm/webchat/webchat-dev.js +1 -1
  308. package/lib/esm/webchat/webchat-dev.js.map +1 -1
  309. package/lib/esm/webchat/webchat.d.ts +4 -2
  310. package/lib/esm/webchat/webchat.js +81 -104
  311. package/lib/esm/webchat/webchat.js.map +1 -1
  312. package/lib/esm/webchat/webview.js +2 -1
  313. package/lib/esm/webchat/webview.js.map +1 -1
  314. package/lib/esm/webchat-app.d.ts +14 -80
  315. package/lib/esm/webchat-app.js +28 -14
  316. package/lib/esm/webchat-app.js.map +1 -1
  317. package/package.json +2 -1
  318. package/src/components/{audio.jsx → audio.tsx} +10 -4
  319. package/src/components/button.tsx +1 -3
  320. package/src/components/carousel.jsx +1 -1
  321. package/src/components/{custom-message.jsx → custom-message.tsx} +19 -7
  322. package/src/components/{document.jsx → document.tsx} +5 -3
  323. package/src/components/handoff.jsx +1 -1
  324. package/src/components/{image.jsx → image.tsx} +10 -4
  325. package/src/components/index-types.ts +25 -117
  326. package/src/components/index.ts +6 -1
  327. package/src/components/message/index.jsx +2 -1
  328. package/src/components/message/message-feedback.tsx +1 -1
  329. package/src/components/message/message-footer.tsx +1 -1
  330. package/src/components/message/message-image.tsx +1 -1
  331. package/src/components/message/timestamps.tsx +1 -1
  332. package/src/components/{reply.jsx → reply.tsx} +10 -4
  333. package/src/components/{video.jsx → video.tsx} +3 -2
  334. package/src/components/webchat-settings.tsx +14 -2
  335. package/src/contexts.tsx +5 -83
  336. package/src/index-types.ts +99 -64
  337. package/src/index.ts +2 -6
  338. package/src/msg-to-botonic.jsx +5 -9
  339. package/src/util/{webchat.js → webchat.ts} +15 -9
  340. package/src/webchat/chat-area/index.tsx +2 -4
  341. package/src/webchat/components/conditional-animation.jsx +1 -1
  342. package/src/webchat/components/opened-persistent-menu.jsx +1 -1
  343. package/src/webchat/{actions.ts → context/actions.ts} +3 -0
  344. package/src/webchat/context/index.tsx +81 -0
  345. package/src/webchat/{messages-reducer.ts → context/messages-reducer.ts} +4 -2
  346. package/src/webchat/context/types.ts +84 -0
  347. package/src/webchat/{hooks → context}/use-webchat.ts +62 -13
  348. package/src/webchat/{webchat-reducer.ts → context/webchat-reducer.ts} +3 -1
  349. package/src/webchat/cover-component/index.tsx +1 -1
  350. package/src/webchat/global.d.ts +3 -0
  351. package/src/webchat/header/default-header.tsx +75 -0
  352. package/src/webchat/header/index.tsx +37 -0
  353. package/src/webchat/header/styles.ts +62 -0
  354. package/src/webchat/hooks/index.ts +0 -1
  355. package/src/webchat/hooks/use-previous.ts +1 -1
  356. package/src/webchat/hooks/use-scrollbar-controller.ts +2 -2
  357. package/src/webchat/hooks/use-typing.ts +1 -1
  358. package/src/webchat/hooks/use-webchat-dimensions.ts +1 -1
  359. package/src/webchat/hooks/use-webchat-resizer.ts +1 -1
  360. package/src/webchat/index-types.ts +3 -53
  361. package/src/webchat/index.ts +1 -0
  362. package/src/webchat/input-panel/attachment.tsx +2 -2
  363. package/src/webchat/input-panel/emoji-picker.tsx +2 -2
  364. package/src/webchat/input-panel/index.tsx +9 -5
  365. package/src/webchat/input-panel/persistent-menu.tsx +1 -1
  366. package/src/webchat/input-panel/send-button.tsx +1 -1
  367. package/src/webchat/input-panel/textarea.tsx +6 -4
  368. package/src/webchat/message-list/index.tsx +4 -6
  369. package/src/webchat/message-list/intro-message.tsx +1 -1
  370. package/src/webchat/message-list/styles.ts +1 -0
  371. package/src/webchat/message-list/unread-messages-banner.tsx +1 -1
  372. package/src/webchat/message-list/use-notifications.ts +1 -1
  373. package/src/webchat/replies/index.tsx +47 -0
  374. package/src/webchat/replies/styles.ts +28 -0
  375. package/src/webchat/session-view.jsx +1 -1
  376. package/src/webchat/{webchat-typed/styles.ts → styles.ts} +7 -2
  377. package/src/webchat/theme/types.ts +119 -0
  378. package/src/webchat/trigger-button/index.tsx +1 -1
  379. package/src/webchat/webchat-dev.jsx +1 -1
  380. package/src/webchat/{webchat.jsx → webchat.tsx} +114 -124
  381. package/src/webchat/webview.jsx +2 -1
  382. package/src/webchat-app.tsx +55 -95
  383. package/lib/cjs/webchat/actions.js.map +0 -1
  384. package/lib/cjs/webchat/header.d.ts +0 -3
  385. package/lib/cjs/webchat/header.js +0 -86
  386. package/lib/cjs/webchat/header.js.map +0 -1
  387. package/lib/cjs/webchat/hooks/use-webchat.js.map +0 -1
  388. package/lib/cjs/webchat/messages-reducer.js.map +0 -1
  389. package/lib/cjs/webchat/replies.d.ts +0 -1
  390. package/lib/cjs/webchat/replies.js +0 -47
  391. package/lib/cjs/webchat/replies.js.map +0 -1
  392. package/lib/cjs/webchat/webchat-reducer.js.map +0 -1
  393. package/lib/cjs/webchat/webchat-typed/styles.js.map +0 -1
  394. package/lib/cjs/webchat/webchat-typed/webchat-typed.d.ts +0 -0
  395. package/lib/cjs/webchat/webchat-typed/webchat-typed.js +0 -663
  396. package/lib/cjs/webchat/webchat-typed/webchat-typed.js.map +0 -1
  397. package/lib/esm/webchat/actions.js.map +0 -1
  398. package/lib/esm/webchat/header.d.ts +0 -3
  399. package/lib/esm/webchat/header.js +0 -81
  400. package/lib/esm/webchat/header.js.map +0 -1
  401. package/lib/esm/webchat/hooks/use-webchat.js.map +0 -1
  402. package/lib/esm/webchat/messages-reducer.js.map +0 -1
  403. package/lib/esm/webchat/replies.d.ts +0 -1
  404. package/lib/esm/webchat/replies.js +0 -42
  405. package/lib/esm/webchat/replies.js.map +0 -1
  406. package/lib/esm/webchat/webchat-reducer.js.map +0 -1
  407. package/lib/esm/webchat/webchat-typed/styles.js.map +0 -1
  408. package/lib/esm/webchat/webchat-typed/webchat-typed.d.ts +0 -0
  409. package/lib/esm/webchat/webchat-typed/webchat-typed.js +0 -663
  410. package/lib/esm/webchat/webchat-typed/webchat-typed.js.map +0 -1
  411. package/src/webchat/header.jsx +0 -149
  412. package/src/webchat/replies.jsx +0 -64
  413. package/src/webchat/webchat-typed/webchat-typed.tsx +0 -728
@@ -0,0 +1,167 @@
1
+ /// <reference types="react" />
2
+ import { BlockInputOption, ButtonProps, CustomMessageType } from '../../components/index-types';
3
+ interface ImagePreviewerProps {
4
+ src: string;
5
+ isPreviewerOpened: boolean;
6
+ closePreviewer: () => void;
7
+ }
8
+ export interface CoverComponentProps {
9
+ closeComponent: () => void;
10
+ }
11
+ export interface CoverComponentOptions {
12
+ component: React.ComponentType<CoverComponentProps>;
13
+ props?: any;
14
+ }
15
+ export type PersistentMenuCloseOption = {
16
+ closeLabel: string;
17
+ };
18
+ export type PersistentMenuOption = {
19
+ label: string;
20
+ } & ButtonProps;
21
+ export type PersistentMenuOptionsTheme = (PersistentMenuCloseOption | PersistentMenuOption)[];
22
+ export interface PersistentMenuOptionsProps {
23
+ onClick: () => void;
24
+ options: any;
25
+ }
26
+ export interface BlobProps {
27
+ blobTick?: boolean;
28
+ blobTickStyle?: any;
29
+ blobWidth?: string;
30
+ imageStyle?: any;
31
+ }
32
+ export interface ThemeProps {
33
+ style?: any;
34
+ coverComponent?: CoverComponentOptions;
35
+ mobileBreakpoint?: number;
36
+ mobileStyle?: any;
37
+ webview?: {
38
+ style?: any;
39
+ header?: {
40
+ style?: any;
41
+ };
42
+ };
43
+ animations?: {
44
+ enable?: boolean;
45
+ };
46
+ intro?: {
47
+ style?: any;
48
+ image?: string;
49
+ custom?: React.ComponentType;
50
+ };
51
+ brand?: {
52
+ color?: string;
53
+ image?: string;
54
+ };
55
+ header?: {
56
+ title?: string;
57
+ subtitle?: string;
58
+ image?: string;
59
+ style?: any;
60
+ custom?: React.ComponentType;
61
+ };
62
+ customMessageTypes?: CustomMessageType[];
63
+ message?: {
64
+ bot?: BlobProps & {
65
+ image?: string;
66
+ style?: any;
67
+ };
68
+ agent?: {
69
+ image?: string;
70
+ };
71
+ user?: BlobProps & {
72
+ style?: any;
73
+ };
74
+ customTypes?: CustomMessageType[];
75
+ style?: any;
76
+ timestamps?: {
77
+ withImage?: boolean;
78
+ format: () => string;
79
+ style?: any;
80
+ enable?: boolean;
81
+ };
82
+ };
83
+ button?: {
84
+ autodisable?: boolean;
85
+ disabledstyle?: any;
86
+ hoverBackground?: string;
87
+ hoverTextColor?: string;
88
+ messageType?: 'text' | 'payload';
89
+ urlIcon?: {
90
+ image?: string;
91
+ enable?: boolean;
92
+ };
93
+ style?: any;
94
+ custom?: React.ComponentType;
95
+ };
96
+ replies?: {
97
+ align?: 'left' | 'center' | 'right';
98
+ wrap?: 'wrap' | 'nowrap';
99
+ };
100
+ carousel?: {
101
+ arrow?: {
102
+ left: {
103
+ custom?: React.ComponentType;
104
+ };
105
+ right: {
106
+ custom?: React.ComponentType;
107
+ };
108
+ };
109
+ enableArrows?: boolean;
110
+ };
111
+ reply?: {
112
+ style?: any;
113
+ custom?: React.ComponentType;
114
+ };
115
+ triggerButton?: {
116
+ image?: string;
117
+ style?: any;
118
+ custom?: React.ComponentType;
119
+ };
120
+ notifications?: {
121
+ enable?: boolean;
122
+ banner?: {
123
+ custom?: React.ComponentType;
124
+ enable?: boolean;
125
+ text?: string;
126
+ };
127
+ triggerButton?: {
128
+ enable?: boolean;
129
+ };
130
+ };
131
+ scrollButton?: {
132
+ enable?: boolean;
133
+ custom?: React.ComponentType;
134
+ };
135
+ markdownStyle?: string;
136
+ userInput?: {
137
+ attachments?: {
138
+ enable?: boolean;
139
+ custom?: React.ComponentType;
140
+ };
141
+ blockInputs?: BlockInputOption[];
142
+ box?: {
143
+ placeholder: string;
144
+ style?: any;
145
+ };
146
+ emojiPicker?: {
147
+ enable?: boolean;
148
+ custom?: React.ComponentType;
149
+ };
150
+ menu?: {
151
+ darkBackground?: boolean;
152
+ custom?: React.ComponentType<PersistentMenuOptionsProps>;
153
+ };
154
+ menuButton?: {
155
+ custom?: React.ComponentType;
156
+ };
157
+ persistentMenu?: PersistentMenuOptionsTheme;
158
+ sendButton?: {
159
+ enable?: boolean;
160
+ custom?: React.ComponentType;
161
+ };
162
+ enable?: boolean;
163
+ style?: any;
164
+ };
165
+ imagePreviewer?: React.ComponentType<ImagePreviewerProps>;
166
+ }
167
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/webchat/theme/types.ts"],"names":[],"mappings":""}
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useContext } from 'react';
3
3
  import { ROLES, WEBCHAT } from '../../constants';
4
- import { WebchatContext } from '../../contexts';
5
4
  import { resolveImage } from '../../util/environment';
5
+ import { WebchatContext } from '../../webchat/context';
6
6
  import { StyledTriggerButton, TriggerImage, UnreadMessagesCounter, } from './styles';
7
7
  export const TriggerButton = () => {
8
8
  const { webchatState, getThemeProperty, toggleWebchat } = useContext(WebchatContext);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webchat/trigger-button/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,GACtB,MAAM,UAAU,CAAA;AAEjB,MAAM,CAAC,MAAM,aAAa,GAAG,GAAgB,EAAE;IAC7C,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,GACrD,UAAU,CAAC,cAAc,CAAC,CAAA;IAE5B,MAAM,eAAe,GAAG,GAAG,EAAE;QAC3B,MAAM,KAAK,GAAG,gBAAgB,CAC5B,OAAO,CAAC,iBAAiB,CAAC,kBAAkB,EAC5C,SAAS,CACV,CAAA;QAED,IA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B,CAAC,aAAa,EACvC,SAAS,CACV,CAAA;IAED,MAAM,WAAW,GAAG,CAAC,KAAU,EAAE,EAAE;QACjC,aAAa,CAAC,IAAI,CAAC,CAAA;QACnB,KAAK,CAAC,cAAc,EAAE,CAAA;IACxB,CAAC,CAAA;IAED,OAAO,CACL,6BAAK,OAAO,EAAE,WAAW,iBACtB,YAAY,CAAC,iBAAiB,KAAK,CAAC,IAAI,oBAAoB,IAAI,CAC/D,KAAC,qBAAqB,kBAAC,SAAS,EAAC,uBAAuB,gBACrD,YAAY,CAAC,iBAAiB,IACT,CACzB,EACA,mBAAmB,CAAC,CAAC,CAAC,CACrB,KAAC,mBAAmB,KAAG,CACxB,CAAC,CAAC,CAAC,CACF,KAAC,mBAAmB,kBAClB,IAAI,EAAE,KAAK,CAAC,cAAc,EAC1B,KAAK,EAAE,kBAAkB,gBAExB,kBAAkB,IAAI,CACrB,KAAC,YAAY,IAAC,GAAG,EAAE,YAAY,CAAC,kBAAkB,CAAC,GAAI,CACxD,IACmB,CACvB,KACG,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -5,7 +5,7 @@ import merge from 'lodash.merge';
5
5
  import React, { forwardRef, useEffect } from 'react';
6
6
  import { createPortal } from 'react-dom';
7
7
  import styled from 'styled-components';
8
- import { useWebchat } from './hooks';
8
+ import { useWebchat } from './context/use-webchat';
9
9
  import { SessionView } from './session-view';
10
10
  import { Webchat } from './webchat';
11
11
  export const DebugTab = styled.div `
@@ -1 +1 @@
1
- {"version":3,"file":"webchat-dev.js","sourceRoot":"","sources":["../../../src/webchat/webchat-dev.jsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,MAAM,cAAc,CAAA;AAChC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,MAAM,MAAM,mB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YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;IACrD,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;IAEjB,OAAO,CACL,8BACE,KAAC,OAAO,kBACN,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,IACpC,KAAK,IACT,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,kBAAkB,EAAE;oBAClB,mBAAmB,EAAE,YAAY,CAAC,WAAW,CAAC,mBAAmB;oBACjE,eAAe,EAAE,YAAY,CAAC,WAAW,CAAC,eAAe;iBAC1D,IACD,EACF,KAAC,cAAc,IACb,IAAI,EAAE,YAAY,CAAC,WAAW,CAAC,eAAe,EAC9C,YAAY,EAAE,YAAY,GAC1B,IACD,CACJ,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -1,2 +1,4 @@
1
- export const Webchat: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
- import React from "react";
1
+ import React from 'react';
2
+ import { WebchatProps, WebchatRef } from '../index-types';
3
+ declare const Webchat: React.ForwardRefExoticComponent<WebchatProps & React.RefAttributes<WebchatRef | null>>;
4
+ export { Webchat };
@@ -2,14 +2,12 @@ import { __awaiter } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { BotonicAction, INPUT, isMobile, params2queryString, } from '@botonic/core';
4
4
  import merge from 'lodash.merge';
5
- import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState, } from 'react';
6
- import styled, { StyleSheetManager } from 'styled-components';
5
+ import { forwardRef, useEffect, useImperativeHandle, useRef, useState, } from 'react';
6
+ import { StyleSheetManager } from 'styled-components';
7
7
  import { v7 as uuidv7 } from 'uuid';
8
- import { Audio, Document, Image, Text, Video } from '../components';
9
- import { Handoff } from '../components/handoff';
10
- import { normalizeWebchatSettings } from '../components/webchat-settings';
8
+ import { Audio, Document, Handoff, Image, normalizeWebchatSettings, Text, Video, } from '../components';
11
9
  import { COLORS, MAX_ALLOWED_SIZE_MB, ROLES, WEBCHAT } from '../constants';
12
- import { WebchatContext, WebviewRequestContext } from '../contexts';
10
+ import { WebviewRequestContext } from '../contexts';
13
11
  import { SENDERS } from '../index-types';
14
12
  import { getMediaType, isAllowedSize, isAudio, isDocument, isImage, isMedia, isText, isVideo, readDataURL, } from '../message-utils';
15
13
  import { msgToBotonic } from '../msg-to-botonic';
@@ -19,65 +17,20 @@ import { _getThemeProperty, getServerErrorMessage, initSession, shouldKeepSessio
19
17
  import { ChatArea } from './chat-area';
20
18
  import { OpenedPersistentMenu } from './components/opened-persistent-menu';
21
19
  import { BotonicContainerId } from './constants';
20
+ import { useWebchat, WebchatContext } from './context';
22
21
  import { CoverComponent } from './cover-component';
23
22
  import { WebchatHeader } from './header';
24
- import { useComponentWillMount, usePrevious, useScrollToBottom, useTyping, useWebchat, } from './hooks';
23
+ import { useComponentWillMount, usePrevious, useScrollToBottom, useTyping, } from './hooks';
25
24
  import { InputPanel } from './input-panel';
25
+ import { DarkBackgroundMenu, ErrorMessage, ErrorMessageContainer, StyledWebchat, } from './styles';
26
26
  import { TriggerButton } from './trigger-button';
27
27
  import { useStorageState } from './use-storage-state-hook';
28
28
  import { getParsedAction } from './utils';
29
29
  import { WebviewContainer } from './webview';
30
- const StyledWebchat = styled.div `
31
- position: fixed;
32
- right: 20px;
33
- bottom: 20px;
34
- width: ${props => props.width}px;
35
- height: ${props => props.height}px;
36
- margin: auto;
37
- background-color: ${COLORS.SOLID_WHITE};
38
- border-radius: 10px;
39
- box-shadow: ${COLORS.SOLID_BLACK_ALPHA_0_2} 0px 0px 12px;
40
- display: flex;
41
- flex-direction: column;
42
- justify-content: space-between;
43
- overflow: hidden;
44
- `;
45
- const ErrorMessageContainer = styled.div `
46
- position: relative;
47
- display: flex;
48
- z-index: 1;
49
- justify-content: center;
50
- width: 100%;
51
- `;
52
- const ErrorMessage = styled.div `
53
- position: absolute;
54
- top: 10px;
55
- font-size: 14px;
56
- line-height: 20px;
57
- padding: 4px 11px;
58
- display: flex;
59
- background-color: ${COLORS.ERROR_RED};
60
- color: ${COLORS.CONCRETE_WHITE};
61
- border-radius: 5px;
62
- align-items: center;
63
- justify-content: center;
64
- font-family: ${WEBCHAT.DEFAULTS.FONT_FAMILY};
65
- `;
66
- const DarkBackgroundMenu = styled.div `
67
- background: ${COLORS.SOLID_BLACK};
68
- opacity: 0.3;
69
- z-index: 1;
70
- right: 0;
71
- bottom: 0;
72
- border-radius: 10px;
73
- position: absolute;
74
- width: 100%;
75
- height: 100%;
76
- `;
77
30
  // eslint-disable-next-line complexity, react/display-name
78
- export const Webchat = forwardRef((props, ref) => {
31
+ const Webchat = forwardRef((props, ref) => {
79
32
  var _a;
80
- const { addMessage, addMessageComponent, clearMessages, doRenderCustomComponent, openWebviewT, resetUnreadMessages, setCurrentAttachment, setError, setIsInputFocused, setLastMessageVisible, setOnline, toggleCoverComponent, toggleEmojiPicker, togglePersistentMenu, toggleWebchat, updateDevSettings, updateHandoff, updateLastMessageDate, updateLastRoutePath, updateLatestInput, updateMessage, updateReplies, updateSession, updateTheme, updateTyping, updateWebview, webchatState, webchatRef, chatAreaRef, inputPanelRef, headerRef, scrollableMessagesListRef,
33
+ const { addMessage, addMessageComponent, clearMessages, doRenderCustomComponent, resetUnreadMessages, setCurrentAttachment, setError, setIsInputFocused, setLastMessageVisible, setOnline, toggleCoverComponent, toggleEmojiPicker, togglePersistentMenu, toggleWebchat, updateDevSettings, updateHandoff, updateLastMessageDate, updateLastRoutePath, updateLatestInput, updateMessage, updateReplies, updateSession, updateTheme, updateTyping, updateWebview, removeWebview, removeReplies, webchatState, webchatRef, chatAreaRef, inputPanelRef, headerRef, repliesRef, scrollableMessagesListRef,
81
34
  // eslint-disable-next-line react-hooks/rules-of-hooks
82
35
  } = props.webchatHooks || useWebchat();
83
36
  const firstUpdate = useRef(true);
@@ -94,7 +47,7 @@ export const Webchat = forwardRef((props, ref) => {
94
47
  const [botonicState, saveState] = useStorageState(storage, storageKey);
95
48
  const host = props.host || document.body;
96
49
  const { scrollToBottom } = useScrollToBottom({ host });
97
- const saveWebchatState = webchatState => {
50
+ const saveWebchatState = (webchatState) => {
98
51
  storage &&
99
52
  saveState(JSON.parse(stringifyWithRegexs({
100
53
  messages: webchatState.messagesJSON,
@@ -105,19 +58,17 @@ export const Webchat = forwardRef((props, ref) => {
105
58
  themeUpdates: webchatState.themeUpdates,
106
59
  })));
107
60
  };
108
- const handleAttachment = event => {
61
+ const handleAttachment = (event) => {
109
62
  if (!isAllowedSize(event.target.files[0].size)) {
110
63
  throw new Error(`The file is too large. A maximum of ${MAX_ALLOWED_SIZE_MB}MB is allowed.`);
111
64
  }
112
- setCurrentAttachment({
113
- fileName: event.target.files[0].name,
114
- file: event.target.files[0],
115
- attachmentType: getMediaType(event.target.files[0].type),
116
- });
65
+ // TODO: Attach more files?
66
+ setCurrentAttachment(event.target.files[0]);
117
67
  };
118
68
  useEffect(() => {
119
- if (webchatState.currentAttachment)
69
+ if (webchatState.currentAttachment) {
120
70
  sendAttachment(webchatState.currentAttachment);
71
+ }
121
72
  }, [webchatState.currentAttachment]);
122
73
  const sendUserInput = (input) => __awaiter(void 0, void 0, void 0, function* () {
123
74
  if (props.onUserInput) {
@@ -125,8 +76,11 @@ export const Webchat = forwardRef((props, ref) => {
125
76
  scrollToBottom();
126
77
  props.onUserInput({
127
78
  user: webchatState.session.user,
79
+ // TODO: Review if this input.sentBy exists in the frontend
128
80
  input: input,
81
+ //@ts-ignore
129
82
  session: webchatState.session,
83
+ // TODO: Review why we were passing lastRoutePath, is only for devMode?
130
84
  lastRoutePath: webchatState.lastRoutePath,
131
85
  });
132
86
  }
@@ -163,9 +117,10 @@ export const Webchat = forwardRef((props, ref) => {
163
117
  if (shouldKeepSessionOnReload({ initialDevSettings, devSettings })) {
164
118
  if (messages) {
165
119
  messages.forEach(message => {
120
+ var _a, _b, _c;
166
121
  addMessage(message);
167
- const newMessageComponent = msgToBotonic(Object.assign(Object.assign({}, message), { delay: 0, typing: 0 }), (props.theme.message && props.theme.message.customTypes) ||
168
- props.theme.customMessageTypes);
122
+ const newMessageComponent = msgToBotonic(Object.assign(Object.assign({}, message), { delay: 0, typing: 0 }), ((_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.customTypes) || ((_c = props.theme) === null || _c === void 0 ? void 0 : _c.customMessageTypes));
123
+ //@ts-ignore
169
124
  if (newMessageComponent)
170
125
  addMessageComponent(newMessageComponent);
171
126
  });
@@ -181,12 +136,15 @@ export const Webchat = forwardRef((props, ref) => {
181
136
  updateDevSettings(devSettings);
182
137
  else if (initialDevSettings)
183
138
  updateDevSettings(initialDevSettings);
184
- if (lastMessageUpdate)
139
+ if (lastMessageUpdate) {
185
140
  updateLastMessageDate(lastMessageUpdate);
186
- if (themeUpdates !== undefined)
141
+ }
142
+ if (themeUpdates !== undefined) {
187
143
  updateTheme(merge(props.theme, themeUpdates), themeUpdates);
188
- if (props.onInit)
189
- setTimeout(() => props.onInit(), 100);
144
+ }
145
+ if (props.onInit) {
146
+ setTimeout(() => props.onInit && props.onInit(), 100);
147
+ }
190
148
  }, []);
191
149
  useEffect(() => {
192
150
  if (!webchatState.isWebchatOpen) {
@@ -197,8 +155,9 @@ export const Webchat = forwardRef((props, ref) => {
197
155
  }
198
156
  }, [webchatState.isWebchatOpen]);
199
157
  useEffect(() => {
200
- if (onStateChange && typeof onStateChange === 'function') {
201
- onStateChange(webchatState);
158
+ const { messagesJSON, session } = webchatState;
159
+ if (onStateChange && typeof onStateChange === 'function' && session.user) {
160
+ onStateChange({ messagesJSON, user: session.user });
202
161
  }
203
162
  saveWebchatState(webchatState);
204
163
  }, [
@@ -227,11 +186,12 @@ export const Webchat = forwardRef((props, ref) => {
227
186
  const openWebview = (webviewComponent, params) => {
228
187
  updateWebview(webviewComponent, params);
229
188
  };
230
- const textareaRef = useRef(null);
189
+ const textareaRef = useRef();
231
190
  const closeWebview = (options) => __awaiter(void 0, void 0, void 0, function* () {
232
- updateWebview();
191
+ var _b;
192
+ removeWebview();
233
193
  if (userInputEnabled) {
234
- textareaRef.current.focus();
194
+ (_b = textareaRef.current) === null || _b === void 0 ? void 0 : _b.focus();
235
195
  }
236
196
  if (options === null || options === void 0 ? void 0 : options.payload) {
237
197
  yield sendPayload(options.payload);
@@ -260,12 +220,20 @@ export const Webchat = forwardRef((props, ref) => {
260
220
  return false;
261
221
  for (const rule of blockInputs) {
262
222
  if (getBlockInputs(rule, input.data)) {
263
- addMessageComponent(_jsx(Text, Object.assign({ id: input.id, sentBy: SENDERS.user, blob: false, style: {
223
+ addMessageComponent(_jsx(Text
224
+ // Is necessary to add the id of the input
225
+ // to keep the input.id generated in the frontend as id of the message
226
+ // @ts-ignore
227
+ , Object.assign({
228
+ // Is necessary to add the id of the input
229
+ // to keep the input.id generated in the frontend as id of the message
230
+ // @ts-ignore
231
+ id: input.id, sentBy: SENDERS.user, blob: false, style: {
264
232
  backgroundColor: COLORS.SCORPION_GRAY,
265
233
  borderColor: COLORS.SCORPION_GRAY,
266
234
  padding: '8px 12px',
267
235
  } }, { children: rule.message })));
268
- updateReplies(false);
236
+ removeReplies();
269
237
  return true;
270
238
  }
271
239
  }
@@ -293,12 +261,23 @@ export const Webchat = forwardRef((props, ref) => {
293
261
  const messageComponentFromInput = input => {
294
262
  let messageComponent = null;
295
263
  if (isText(input)) {
296
- messageComponent = (
297
- //TODO: Remove id and payload from Text component
298
- _jsx(Text, Object.assign({ id: input.id, payload: input.payload, sentBy: SENDERS.user }, { children: input.data })));
264
+ messageComponent = (_jsx(Text
265
+ // Is necessary to add the id of the input
266
+ // to keep the input.id generated in the frontend as id of the message
267
+ // @ts-ignore
268
+ , Object.assign({
269
+ // Is necessary to add the id of the input
270
+ // to keep the input.id generated in the frontend as id of the message
271
+ // @ts-ignore
272
+ id: input.id,
273
+ // Is necessary to add the payload of the input when user clicks a button
274
+ // @ts-ignore
275
+ payload: input.payload, sentBy: SENDERS.user }, { children: input.data })));
299
276
  }
300
277
  else if (isMedia(input)) {
301
278
  const temporaryDisplayUrl = URL.createObjectURL(input.data);
279
+ // TODO: We sould use URL.revokeObjectURL(temporaryDisplayUrl) when the component is unmounted
280
+ // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static#memory_management
302
281
  const mediaProps = {
303
282
  id: input.id,
304
283
  sentBy: SENDERS.user,
@@ -334,14 +313,14 @@ export const Webchat = forwardRef((props, ref) => {
334
313
  sendUserInput(input);
335
314
  updateLatestInput(input);
336
315
  isOnline() && updateLastMessageDate(currentDateString());
337
- updateReplies(false);
316
+ removeReplies();
338
317
  togglePersistentMenu(false);
339
318
  toggleEmojiPicker(false);
340
319
  });
341
320
  /* This is the public API this component exposes to its parents
342
321
  https://stackoverflow.com/questions/37949981/call-child-method-from-parent
343
322
  */
344
- const updateSessionWithUser = userToUpdate => updateSession(merge(webchatState.session, { user: userToUpdate }));
323
+ const updateSessionWithUser = (userToUpdate) => updateSession(merge(webchatState.session, { user: userToUpdate }));
345
324
  useImperativeHandle(ref, () => ({
346
325
  addBotResponse: ({ response, session, lastRoutePath }) => {
347
326
  updateTyping(false);
@@ -366,7 +345,7 @@ export const Webchat = forwardRef((props, ref) => {
366
345
  updateLastRoutePath(lastRoutePath);
367
346
  updateLastMessageDate(currentDateString());
368
347
  },
369
- setTyping: typing => updateTyping(typing),
348
+ setTyping: (typing) => updateTyping(typing),
370
349
  addUserMessage: message => sendInput(message),
371
350
  updateUser: updateSessionWithUser,
372
351
  openWebchat: () => toggleWebchat(true),
@@ -380,24 +359,22 @@ export const Webchat = forwardRef((props, ref) => {
380
359
  },
381
360
  unmountCustomComponent: () => doRenderCustomComponent(false),
382
361
  toggleCoverComponent: () => toggleCoverComponent(!webchatState.isCoverComponentOpen),
383
- openWebviewApi: component => openWebviewT(component),
384
- setError,
385
362
  setOnline,
386
363
  getMessages: () => webchatState.messagesJSON,
387
364
  isOnline,
388
365
  clearMessages: () => {
389
366
  clearMessages();
390
- updateReplies(false);
367
+ removeReplies();
391
368
  },
392
369
  getLastMessageUpdate: () => webchatState.lastMessageUpdate,
393
370
  updateMessageInfo: (msgId, messageInfo) => {
394
- const messageToUpdate = webchatState.messagesJSON.filter(m => m.id == msgId)[0];
371
+ const messageToUpdate = webchatState.messagesJSON.filter(m => m.id === msgId)[0];
395
372
  const updatedMsg = merge(messageToUpdate, messageInfo);
396
373
  if (updatedMsg.ack === 1)
397
374
  delete updatedMsg.unsentInput;
398
375
  updateMessage(updatedMsg);
399
376
  },
400
- updateWebchatSettings: settings => {
377
+ updateWebchatSettings: (settings) => {
401
378
  if (settings.user) {
402
379
  updateSessionWithUser(settings.user);
403
380
  }
@@ -405,20 +382,18 @@ export const Webchat = forwardRef((props, ref) => {
405
382
  updateTheme(merge(webchatState.theme, themeUpdates), themeUpdates);
406
383
  updateTyping(false);
407
384
  },
408
- closeWebview: closeWebview,
385
+ closeWebview: (options) => __awaiter(void 0, void 0, void 0, function* () { return closeWebview(options); }),
409
386
  }));
410
387
  const resolveCase = () => {
411
388
  updateHandoff(false);
412
- updateSession(Object.assign(Object.assign({}, webchatState.session), { _botonic_action: null }));
389
+ updateSession(Object.assign(Object.assign({}, webchatState.session), { _botonic_action: undefined }));
413
390
  };
414
391
  const prevSession = usePrevious(webchatState.session);
415
392
  useEffect(() => {
416
393
  // Resume conversation after handoff
417
- if (prevSession &&
418
- prevSession._botonic_action &&
419
- !webchatState.session._botonic_action) {
394
+ if ((prevSession === null || prevSession === void 0 ? void 0 : prevSession._botonic_action) && !webchatState.session._botonic_action) {
420
395
  const action = getParsedAction(prevSession._botonic_action);
421
- if (action && action.on_finish)
396
+ if (action === null || action === void 0 ? void 0 : action.on_finish)
422
397
  sendPayload(action.on_finish);
423
398
  }
424
399
  }, [webchatState.session._botonic_action]);
@@ -435,21 +410,20 @@ export const Webchat = forwardRef((props, ref) => {
435
410
  yield sendInput(input);
436
411
  });
437
412
  const sendAttachment = (attachment) => __awaiter(void 0, void 0, void 0, function* () {
438
- if (attachment.file) {
439
- const attachmentType = getMediaType(attachment.file.type);
413
+ if (attachment) {
414
+ const attachmentType = getMediaType(attachment.type);
440
415
  if (!attachmentType)
441
416
  return;
442
417
  const input = {
443
418
  type: attachmentType,
444
- data: attachment.file,
419
+ data: attachment,
445
420
  };
446
421
  yield sendInput(input);
447
- setCurrentAttachment(undefined);
422
+ setCurrentAttachment();
448
423
  }
449
424
  });
450
425
  const webviewRequestContext = {
451
- closeWebview: closeWebview,
452
- getString: stringId => props.getString(stringId, webchatState.session),
426
+ closeWebview: (options) => __awaiter(void 0, void 0, void 0, function* () { return yield closeWebview(options); }),
453
427
  params: webchatState.webviewParams || {},
454
428
  session: webchatState.session || {},
455
429
  };
@@ -526,20 +500,23 @@ export const Webchat = forwardRef((props, ref) => {
526
500
  updateReplies,
527
501
  updateUser: updateSessionWithUser,
528
502
  updateWebchatDevSettings: updateWebchatDevSettings,
529
- webchatState,
530
503
  trackEvent: props.onTrackEvent,
504
+ webchatState,
505
+ // TODO: Review if need theme inside Context, already exist innside webchatState
506
+ theme,
531
507
  webchatRef,
532
508
  chatAreaRef,
533
509
  inputPanelRef,
534
510
  headerRef,
511
+ repliesRef,
535
512
  scrollableMessagesListRef,
536
513
  } }, { children: [!webchatState.isWebchatOpen && _jsx(TriggerButton, {}), webchatState.isWebchatOpen && (_jsxs(StyledWebchat, Object.assign({ id: BotonicContainerId.Webchat, ref: webchatRef,
537
514
  // TODO: Distinguish between multiple instances of webchat, e.g. `${uniqueId}-botonic-webchat`
538
- role: ROLES.WEBCHAT, width: webchatState.width, height: webchatState.height, style: Object.assign(Object.assign({}, webchatState.theme.style), mobileStyle) }, { children: [_jsx(WebchatHeader, { id: BotonicContainerId.Header, ref: headerRef, onCloseClick: () => {
539
- toggleWebchat(false);
540
- } }), webchatState.isCoverComponentOpen ? (_jsx(CoverComponent, { component: coverComponent, componentProps: coverComponentProps })) : (_jsxs(_Fragment, { children: [webchatState.error.message && (_jsx(ErrorMessageContainer, { children: _jsx(ErrorMessage, { children: webchatState.error.message }) })), _jsx(ChatArea, {}), webchatState.isPersistentMenuOpen && (_jsx(DarkenBackground, { component: persistentMenu() })), !webchatState.handoff && userInputEnabled && (_jsx(InputPanel, { persistentMenu: props.persistentMenu, enableEmojiPicker: props.enableEmojiPicker, enableAttachments: props.enableAttachments, handleAttachment: handleAttachment, textareaRef: textareaRef, host: host, onUserInput: props.onUserInput })), webchatState.webview && webchatWebview(), webchatState.isCustomComponentRendered &&
515
+ role: ROLES.WEBCHAT, width: webchatState.width, height: webchatState.height, style: Object.assign(Object.assign({}, webchatState.theme.style), mobileStyle) }, { children: [_jsx(WebchatHeader, { ref: headerRef }), webchatState.isCoverComponentOpen ? (_jsx(CoverComponent, { component: coverComponent, componentProps: coverComponentProps })) : (_jsxs(_Fragment, { children: [webchatState.error.message && (_jsx(ErrorMessageContainer, { children: _jsx(ErrorMessage, { children: webchatState.error.message }) })), _jsx(ChatArea, {}), webchatState.isPersistentMenuOpen && (_jsx(DarkenBackground, { component: persistentMenu() })), !webchatState.handoff && userInputEnabled && (_jsx(InputPanel, { persistentMenu: props.persistentMenu, enableEmojiPicker: props.enableEmojiPicker, enableAttachments: props.enableAttachments, handleAttachment: handleAttachment, textareaRef: textareaRef, host: host, onUserInput: props.onUserInput })), webchatState.webview && webchatWebview(), webchatState.isCustomComponentRendered &&
541
516
  customComponent &&
542
517
  _renderCustomComponent()] }))] })))] })));
543
518
  return props.shadowDOM ? (_jsx(StyleSheetManager, Object.assign({ target: host }, { children: WebchatComponent }))) : (WebchatComponent);
544
519
  });
520
+ Webchat.displayName = 'Webchat';
521
+ export { Webchat };
545
522
  //# sourceMappingURL=webchat.js.map