@botonic/react 0.22.0-alpha.0 → 0.22.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (693) hide show
  1. package/lib/cjs/app.d.ts +2 -0
  2. package/lib/cjs/app.js +10 -0
  3. package/lib/cjs/app.js.map +1 -0
  4. package/lib/cjs/botonic-tester.d.ts +18 -0
  5. package/lib/cjs/botonic-tester.js +70 -0
  6. package/lib/cjs/botonic-tester.js.map +1 -0
  7. package/lib/cjs/components/audio.d.ts +8 -0
  8. package/lib/cjs/components/audio.js +27 -0
  9. package/lib/cjs/components/audio.js.map +1 -0
  10. package/lib/cjs/components/button.d.ts +15 -0
  11. package/lib/cjs/components/button.js +156 -0
  12. package/lib/cjs/components/button.js.map +1 -0
  13. package/lib/cjs/components/buttons-disabler.d.ts +24 -0
  14. package/lib/cjs/components/buttons-disabler.js +88 -0
  15. package/lib/cjs/components/buttons-disabler.js.map +1 -0
  16. package/lib/cjs/components/carousel.d.ts +10 -0
  17. package/lib/cjs/components/carousel.js +120 -0
  18. package/lib/cjs/components/carousel.js.map +1 -0
  19. package/lib/cjs/components/components.d.ts +12 -0
  20. package/lib/{components → cjs/components}/components.js +6 -11
  21. package/lib/cjs/components/components.js.map +1 -0
  22. package/lib/cjs/components/custom-message.d.ts +43 -0
  23. package/lib/cjs/components/custom-message.js +65 -0
  24. package/lib/cjs/components/custom-message.js.map +1 -0
  25. package/lib/cjs/components/document.d.ts +8 -0
  26. package/lib/cjs/components/document.js +50 -0
  27. package/lib/cjs/components/document.js.map +1 -0
  28. package/lib/cjs/components/element.d.ts +4 -0
  29. package/lib/cjs/components/element.js +55 -0
  30. package/lib/cjs/components/element.js.map +1 -0
  31. package/lib/cjs/components/handoff.d.ts +1 -0
  32. package/lib/cjs/components/handoff.js +58 -0
  33. package/lib/cjs/components/handoff.js.map +1 -0
  34. package/lib/cjs/components/image.d.ts +8 -0
  35. package/lib/cjs/components/image.js +42 -0
  36. package/lib/cjs/components/image.js.map +1 -0
  37. package/lib/cjs/components/index.d.ts +20 -0
  38. package/lib/cjs/components/index.js +44 -0
  39. package/lib/cjs/components/index.js.map +1 -0
  40. package/lib/cjs/components/location.d.ts +11 -0
  41. package/lib/cjs/components/location.js +38 -0
  42. package/lib/cjs/components/location.js.map +1 -0
  43. package/lib/cjs/components/markdown.d.ts +7 -0
  44. package/lib/cjs/components/markdown.js +162 -0
  45. package/lib/cjs/components/markdown.js.map +1 -0
  46. package/lib/cjs/components/message-template.d.ts +1 -0
  47. package/lib/cjs/components/message-template.js +15 -0
  48. package/lib/cjs/components/message-template.js.map +1 -0
  49. package/lib/cjs/components/message.d.ts +1 -0
  50. package/lib/cjs/components/message.js +206 -0
  51. package/lib/cjs/components/message.js.map +1 -0
  52. package/lib/cjs/components/multichannel/facebook/facebook.d.ts +17 -0
  53. package/lib/cjs/components/multichannel/facebook/facebook.js +47 -0
  54. package/lib/cjs/components/multichannel/facebook/facebook.js.map +1 -0
  55. package/lib/cjs/components/multichannel/index.d.ts +6 -0
  56. package/lib/cjs/components/multichannel/index.js +14 -0
  57. package/lib/cjs/components/multichannel/index.js.map +1 -0
  58. package/lib/cjs/components/multichannel/multichannel-button.d.ts +1 -0
  59. package/lib/cjs/components/multichannel/multichannel-button.js +77 -0
  60. package/lib/cjs/components/multichannel/multichannel-button.js.map +1 -0
  61. package/lib/cjs/components/multichannel/multichannel-carousel.d.ts +1 -0
  62. package/lib/cjs/components/multichannel/multichannel-carousel.js +95 -0
  63. package/lib/cjs/components/multichannel/multichannel-carousel.js.map +1 -0
  64. package/lib/cjs/components/multichannel/multichannel-context.d.ts +11 -0
  65. package/lib/cjs/components/multichannel/multichannel-context.js +16 -0
  66. package/lib/cjs/components/multichannel/multichannel-context.js.map +1 -0
  67. package/lib/cjs/components/multichannel/multichannel-reply.d.ts +1 -0
  68. package/lib/cjs/components/multichannel/multichannel-reply.js +24 -0
  69. package/lib/cjs/components/multichannel/multichannel-reply.js.map +1 -0
  70. package/lib/cjs/components/multichannel/multichannel-text.d.ts +1 -0
  71. package/lib/cjs/components/multichannel/multichannel-text.js +147 -0
  72. package/lib/cjs/components/multichannel/multichannel-text.js.map +1 -0
  73. package/lib/cjs/components/multichannel/multichannel-utils.d.ts +24 -0
  74. package/lib/cjs/components/multichannel/multichannel-utils.js +83 -0
  75. package/lib/cjs/components/multichannel/multichannel-utils.js.map +1 -0
  76. package/lib/cjs/components/multichannel/multichannel.d.ts +1 -0
  77. package/lib/cjs/components/multichannel/multichannel.js +72 -0
  78. package/lib/cjs/components/multichannel/multichannel.js.map +1 -0
  79. package/lib/cjs/components/pic.d.ts +6 -0
  80. package/lib/cjs/components/pic.js +29 -0
  81. package/lib/cjs/components/pic.js.map +1 -0
  82. package/lib/cjs/components/raw.d.ts +9 -0
  83. package/lib/cjs/components/raw.js +53 -0
  84. package/lib/cjs/components/raw.js.map +1 -0
  85. package/lib/cjs/components/reply.d.ts +9 -0
  86. package/lib/cjs/components/reply.js +57 -0
  87. package/lib/cjs/components/reply.js.map +1 -0
  88. package/lib/cjs/components/share-button.d.ts +1 -0
  89. package/lib/cjs/components/share-button.js +15 -0
  90. package/lib/cjs/components/share-button.js.map +1 -0
  91. package/lib/cjs/components/subtitle.d.ts +6 -0
  92. package/lib/cjs/components/subtitle.js +25 -0
  93. package/lib/cjs/components/subtitle.js.map +1 -0
  94. package/lib/cjs/components/text.d.ts +8 -0
  95. package/lib/cjs/components/text.js +50 -0
  96. package/lib/cjs/components/text.js.map +1 -0
  97. package/lib/cjs/components/timestamps.d.ts +10 -0
  98. package/lib/cjs/components/timestamps.js +54 -0
  99. package/lib/cjs/components/timestamps.js.map +1 -0
  100. package/lib/cjs/components/title.d.ts +6 -0
  101. package/lib/cjs/components/title.js +21 -0
  102. package/lib/cjs/components/title.js.map +1 -0
  103. package/lib/cjs/components/video.d.ts +8 -0
  104. package/lib/cjs/components/video.js +34 -0
  105. package/lib/cjs/components/video.js.map +1 -0
  106. package/lib/cjs/components/webchat-settings.d.ts +10 -0
  107. package/lib/cjs/components/webchat-settings.js +78 -0
  108. package/lib/cjs/components/webchat-settings.js.map +1 -0
  109. package/lib/cjs/components/whatsapp-template.d.ts +1 -0
  110. package/lib/cjs/components/whatsapp-template.js +26 -0
  111. package/lib/cjs/components/whatsapp-template.js.map +1 -0
  112. package/lib/cjs/constants.d.ts +168 -0
  113. package/lib/cjs/constants.js +190 -0
  114. package/lib/cjs/constants.js.map +1 -0
  115. package/lib/cjs/contexts.d.ts +69 -0
  116. package/lib/cjs/contexts.js +38 -0
  117. package/lib/cjs/contexts.js.map +1 -0
  118. package/lib/cjs/dev-app.d.ts +30 -0
  119. package/lib/cjs/dev-app.js +71 -0
  120. package/lib/cjs/dev-app.js.map +1 -0
  121. package/lib/cjs/index.d.ts +10 -0
  122. package/lib/cjs/index.js +28 -0
  123. package/lib/cjs/index.js.map +1 -0
  124. package/lib/cjs/message-utils.d.ts +19 -0
  125. package/lib/cjs/message-utils.js +61 -0
  126. package/lib/cjs/message-utils.js.map +1 -0
  127. package/lib/cjs/msg-to-botonic.d.ts +18 -0
  128. package/lib/cjs/msg-to-botonic.js +160 -0
  129. package/lib/cjs/msg-to-botonic.js.map +1 -0
  130. package/lib/cjs/node-app.d.ts +12 -0
  131. package/lib/cjs/node-app.js +25 -0
  132. package/lib/cjs/node-app.js.map +1 -0
  133. package/lib/cjs/react-bot.d.ts +8 -0
  134. package/lib/cjs/react-bot.js +35 -0
  135. package/lib/cjs/react-bot.js.map +1 -0
  136. package/lib/cjs/util/dom.d.ts +13 -0
  137. package/lib/cjs/util/dom.js +55 -0
  138. package/lib/cjs/util/dom.js.map +1 -0
  139. package/lib/cjs/util/environment.d.ts +6 -0
  140. package/lib/cjs/util/environment.js +68 -0
  141. package/lib/cjs/util/environment.js.map +1 -0
  142. package/lib/cjs/util/error-boundary.d.ts +40 -0
  143. package/lib/cjs/util/error-boundary.js +46 -0
  144. package/lib/cjs/util/error-boundary.js.map +1 -0
  145. package/lib/cjs/util/index.d.ts +0 -0
  146. package/lib/cjs/util/index.js +2 -0
  147. package/lib/cjs/util/index.js.map +1 -0
  148. package/lib/cjs/util/logs.d.ts +2 -0
  149. package/lib/cjs/util/logs.js +20 -0
  150. package/lib/cjs/util/logs.js.map +1 -0
  151. package/lib/cjs/util/objects.d.ts +3 -0
  152. package/lib/cjs/util/objects.js +44 -0
  153. package/lib/cjs/util/objects.js.map +1 -0
  154. package/lib/cjs/util/react.d.ts +12 -0
  155. package/lib/cjs/util/react.js +42 -0
  156. package/lib/cjs/util/react.js.map +1 -0
  157. package/lib/cjs/util/regexs.d.ts +2 -0
  158. package/lib/cjs/util/regexs.js +23 -0
  159. package/lib/cjs/util/regexs.js.map +1 -0
  160. package/lib/cjs/util/webchat.d.ts +11 -0
  161. package/lib/cjs/util/webchat.js +62 -0
  162. package/lib/cjs/util/webchat.js.map +1 -0
  163. package/lib/cjs/webchat/actions.d.ts +23 -0
  164. package/lib/cjs/webchat/actions.js +27 -0
  165. package/lib/cjs/webchat/actions.js.map +1 -0
  166. package/lib/cjs/webchat/components/attachment.d.ts +5 -0
  167. package/lib/cjs/webchat/components/attachment.js +32 -0
  168. package/lib/cjs/webchat/components/attachment.js.map +1 -0
  169. package/lib/cjs/webchat/components/common.d.ts +1 -0
  170. package/lib/cjs/webchat/components/common.js +13 -0
  171. package/lib/cjs/webchat/components/common.js.map +1 -0
  172. package/lib/cjs/webchat/components/conditional-animation.d.ts +1 -0
  173. package/lib/cjs/webchat/components/conditional-animation.js +18 -0
  174. package/lib/cjs/webchat/components/conditional-animation.js.map +1 -0
  175. package/lib/cjs/webchat/components/emoji-picker.d.ts +5 -0
  176. package/lib/cjs/webchat/components/emoji-picker.js +52 -0
  177. package/lib/cjs/webchat/components/emoji-picker.js.map +1 -0
  178. package/lib/cjs/webchat/components/persistent-menu.d.ts +10 -0
  179. package/lib/cjs/webchat/components/persistent-menu.js +59 -0
  180. package/lib/cjs/webchat/components/persistent-menu.js.map +1 -0
  181. package/lib/cjs/webchat/components/send-button.d.ts +3 -0
  182. package/lib/cjs/webchat/components/send-button.js +24 -0
  183. package/lib/cjs/webchat/components/send-button.js.map +1 -0
  184. package/lib/cjs/webchat/components/styled-scrollbar.d.ts +1 -0
  185. package/lib/cjs/webchat/components/styled-scrollbar.js +54 -0
  186. package/lib/cjs/webchat/components/styled-scrollbar.js.map +1 -0
  187. package/lib/cjs/webchat/components/typing-indicator.d.ts +1 -0
  188. package/lib/cjs/webchat/components/typing-indicator.js +14 -0
  189. package/lib/cjs/webchat/components/typing-indicator.js.map +1 -0
  190. package/lib/cjs/webchat/devices/device-adapter.d.ts +12 -0
  191. package/lib/cjs/webchat/devices/device-adapter.js +47 -0
  192. package/lib/cjs/webchat/devices/device-adapter.js.map +1 -0
  193. package/lib/cjs/webchat/devices/index.d.ts +11 -0
  194. package/lib/cjs/webchat/devices/index.js +23 -0
  195. package/lib/cjs/webchat/devices/index.js.map +1 -0
  196. package/lib/cjs/webchat/devices/scrollbar-controller.d.ts +12 -0
  197. package/lib/cjs/webchat/devices/scrollbar-controller.js +103 -0
  198. package/lib/cjs/webchat/devices/scrollbar-controller.js.map +1 -0
  199. package/lib/cjs/webchat/devices/webchat-resizer.d.ts +9 -0
  200. package/lib/cjs/webchat/devices/webchat-resizer.js +47 -0
  201. package/lib/cjs/webchat/devices/webchat-resizer.js.map +1 -0
  202. package/lib/cjs/webchat/header.d.ts +3 -0
  203. package/lib/cjs/webchat/header.js +95 -0
  204. package/lib/cjs/webchat/header.js.map +1 -0
  205. package/lib/cjs/webchat/hooks.d.ts +80 -0
  206. package/lib/cjs/webchat/hooks.js +218 -0
  207. package/lib/cjs/webchat/hooks.js.map +1 -0
  208. package/lib/cjs/webchat/index.d.ts +6 -0
  209. package/lib/cjs/webchat/index.js +17 -0
  210. package/lib/cjs/webchat/index.js.map +1 -0
  211. package/lib/cjs/webchat/message-list.d.ts +1 -0
  212. package/lib/cjs/webchat/message-list.js +46 -0
  213. package/lib/cjs/webchat/message-list.js.map +1 -0
  214. package/lib/cjs/webchat/messages-reducer.d.ts +1 -0
  215. package/lib/cjs/webchat/messages-reducer.js +58 -0
  216. package/lib/cjs/webchat/messages-reducer.js.map +1 -0
  217. package/lib/cjs/webchat/replies.d.ts +1 -0
  218. package/lib/cjs/webchat/replies.js +46 -0
  219. package/lib/cjs/webchat/replies.js.map +1 -0
  220. package/lib/cjs/webchat/session-view.d.ts +1 -0
  221. package/lib/cjs/webchat/session-view.js +124 -0
  222. package/lib/cjs/webchat/session-view.js.map +1 -0
  223. package/lib/cjs/webchat/use-storage-state-hook.d.ts +1 -0
  224. package/lib/cjs/webchat/use-storage-state-hook.js +32 -0
  225. package/lib/cjs/webchat/use-storage-state-hook.js.map +1 -0
  226. package/lib/cjs/webchat/webchat-dev.d.ts +7 -0
  227. package/lib/cjs/webchat/webchat-dev.js +64 -0
  228. package/lib/cjs/webchat/webchat-dev.js.map +1 -0
  229. package/lib/cjs/webchat/webchat-reducer.d.ts +1 -0
  230. package/lib/cjs/webchat/webchat-reducer.js +48 -0
  231. package/lib/cjs/webchat/webchat-reducer.js.map +1 -0
  232. package/lib/cjs/webchat/webchat.d.ts +3 -0
  233. package/lib/cjs/webchat/webchat.js +704 -0
  234. package/lib/cjs/webchat/webchat.js.map +1 -0
  235. package/lib/cjs/webchat/webview.d.ts +2 -0
  236. package/lib/cjs/webchat/webview.js +92 -0
  237. package/lib/cjs/webchat/webview.js.map +1 -0
  238. package/lib/cjs/webchat-app.d.ts +99 -0
  239. package/lib/cjs/webchat-app.js +269 -0
  240. package/lib/cjs/webchat-app.js.map +1 -0
  241. package/lib/cjs/webview-app.d.ts +7 -0
  242. package/lib/cjs/webview-app.js +103 -0
  243. package/lib/cjs/webview-app.js.map +1 -0
  244. package/lib/esm/app.d.ts +2 -0
  245. package/lib/esm/app.js +6 -0
  246. package/lib/esm/app.js.map +1 -0
  247. package/lib/esm/assets/attachment-icon.svg +7 -0
  248. package/lib/esm/assets/audio.svg +4 -0
  249. package/lib/esm/assets/botonic_react_logo100x100.png +0 -0
  250. package/lib/esm/assets/document.svg +3 -0
  251. package/lib/esm/assets/emojiButton.svg +6 -0
  252. package/lib/esm/assets/image.svg +4 -0
  253. package/lib/esm/assets/leftArrow.svg +3 -0
  254. package/lib/esm/assets/menuButton.svg +3 -0
  255. package/lib/esm/assets/rightArrow.svg +3 -0
  256. package/lib/esm/assets/send-button.svg +1 -0
  257. package/lib/esm/assets/video.svg +3 -0
  258. package/lib/esm/botonic-tester.d.ts +18 -0
  259. package/lib/esm/botonic-tester.js +64 -0
  260. package/lib/esm/botonic-tester.js.map +1 -0
  261. package/lib/esm/components/audio.d.ts +8 -0
  262. package/lib/esm/components/audio.js +22 -0
  263. package/lib/esm/components/audio.js.map +1 -0
  264. package/lib/esm/components/button.d.ts +15 -0
  265. package/lib/esm/components/button.js +151 -0
  266. package/lib/esm/components/button.js.map +1 -0
  267. package/lib/esm/components/buttons-disabler.d.ts +24 -0
  268. package/lib/esm/components/buttons-disabler.js +84 -0
  269. package/lib/esm/components/buttons-disabler.js.map +1 -0
  270. package/lib/esm/components/carousel.d.ts +9 -0
  271. package/lib/esm/components/carousel.js +115 -0
  272. package/lib/esm/components/carousel.js.map +1 -0
  273. package/lib/esm/components/components.d.ts +12 -0
  274. package/lib/esm/components/components.js +17 -0
  275. package/lib/esm/components/components.js.map +1 -0
  276. package/lib/esm/components/custom-message.d.ts +43 -0
  277. package/lib/esm/components/custom-message.js +61 -0
  278. package/lib/esm/components/custom-message.js.map +1 -0
  279. package/lib/esm/components/document.d.ts +8 -0
  280. package/lib/esm/components/document.js +45 -0
  281. package/lib/esm/components/document.js.map +1 -0
  282. package/lib/esm/components/element.d.ts +4 -0
  283. package/lib/esm/components/element.js +50 -0
  284. package/lib/esm/components/element.js.map +1 -0
  285. package/lib/esm/components/handoff.d.ts +1 -0
  286. package/lib/esm/components/handoff.js +53 -0
  287. package/lib/esm/components/handoff.js.map +1 -0
  288. package/lib/esm/components/image.d.ts +8 -0
  289. package/lib/esm/components/image.js +37 -0
  290. package/lib/esm/components/image.js.map +1 -0
  291. package/lib/esm/components/index.d.ts +19 -0
  292. package/lib/esm/components/index.js +21 -0
  293. package/lib/esm/components/index.js.map +1 -0
  294. package/lib/esm/components/location.d.ts +11 -0
  295. package/lib/esm/components/location.js +33 -0
  296. package/lib/esm/components/location.js.map +1 -0
  297. package/lib/esm/components/markdown.d.ts +7 -0
  298. package/lib/esm/components/markdown.js +152 -0
  299. package/lib/esm/components/markdown.js.map +1 -0
  300. package/lib/esm/components/message-template.d.ts +1 -0
  301. package/lib/esm/components/message-template.js +10 -0
  302. package/lib/esm/components/message-template.js.map +1 -0
  303. package/lib/esm/components/message.d.ts +1 -0
  304. package/lib/esm/components/message.js +202 -0
  305. package/lib/esm/components/message.js.map +1 -0
  306. package/lib/esm/components/multichannel/facebook/facebook.d.ts +17 -0
  307. package/lib/esm/components/multichannel/facebook/facebook.js +43 -0
  308. package/lib/esm/components/multichannel/facebook/facebook.js.map +1 -0
  309. package/lib/esm/components/multichannel/index.d.ts +6 -0
  310. package/lib/esm/components/multichannel/index.js +11 -0
  311. package/lib/esm/components/multichannel/index.js.map +1 -0
  312. package/lib/esm/components/multichannel/multichannel-button.d.ts +1 -0
  313. package/lib/esm/components/multichannel/multichannel-button.js +72 -0
  314. package/lib/esm/components/multichannel/multichannel-button.js.map +1 -0
  315. package/lib/esm/components/multichannel/multichannel-carousel.d.ts +1 -0
  316. package/lib/esm/components/multichannel/multichannel-carousel.js +90 -0
  317. package/lib/esm/components/multichannel/multichannel-carousel.js.map +1 -0
  318. package/lib/esm/components/multichannel/multichannel-context.d.ts +11 -0
  319. package/lib/esm/components/multichannel/multichannel-context.js +12 -0
  320. package/lib/esm/components/multichannel/multichannel-context.js.map +1 -0
  321. package/lib/esm/components/multichannel/multichannel-reply.d.ts +1 -0
  322. package/lib/esm/components/multichannel/multichannel-reply.js +19 -0
  323. package/lib/esm/components/multichannel/multichannel-reply.js.map +1 -0
  324. package/lib/esm/components/multichannel/multichannel-text.d.ts +1 -0
  325. package/lib/esm/components/multichannel/multichannel-text.js +142 -0
  326. package/lib/esm/components/multichannel/multichannel-text.js.map +1 -0
  327. package/lib/esm/components/multichannel/multichannel-utils.d.ts +24 -0
  328. package/lib/esm/components/multichannel/multichannel-utils.js +67 -0
  329. package/lib/esm/components/multichannel/multichannel-utils.js.map +1 -0
  330. package/lib/esm/components/multichannel/multichannel.d.ts +1 -0
  331. package/lib/esm/components/multichannel/multichannel.js +67 -0
  332. package/lib/esm/components/multichannel/multichannel.js.map +1 -0
  333. package/lib/esm/components/pic.d.ts +6 -0
  334. package/lib/esm/components/pic.js +24 -0
  335. package/lib/esm/components/pic.js.map +1 -0
  336. package/lib/esm/components/raw.d.ts +9 -0
  337. package/lib/esm/components/raw.js +48 -0
  338. package/lib/esm/components/raw.js.map +1 -0
  339. package/lib/esm/components/reply.d.ts +9 -0
  340. package/lib/esm/components/reply.js +52 -0
  341. package/lib/esm/components/reply.js.map +1 -0
  342. package/lib/esm/components/share-button.d.ts +1 -0
  343. package/lib/esm/components/share-button.js +10 -0
  344. package/lib/esm/components/share-button.js.map +1 -0
  345. package/lib/esm/components/subtitle.d.ts +6 -0
  346. package/lib/esm/components/subtitle.js +20 -0
  347. package/lib/esm/components/subtitle.js.map +1 -0
  348. package/lib/esm/components/text.d.ts +8 -0
  349. package/lib/esm/components/text.js +45 -0
  350. package/lib/esm/components/text.js.map +1 -0
  351. package/lib/esm/components/timestamps.d.ts +10 -0
  352. package/lib/esm/components/timestamps.js +48 -0
  353. package/lib/esm/components/timestamps.js.map +1 -0
  354. package/lib/esm/components/title.d.ts +6 -0
  355. package/lib/esm/components/title.js +16 -0
  356. package/lib/esm/components/title.js.map +1 -0
  357. package/lib/esm/components/video.d.ts +8 -0
  358. package/lib/esm/components/video.js +29 -0
  359. package/lib/esm/components/video.js.map +1 -0
  360. package/lib/esm/components/webchat-settings.d.ts +10 -0
  361. package/lib/esm/components/webchat-settings.js +72 -0
  362. package/lib/esm/components/webchat-settings.js.map +1 -0
  363. package/lib/esm/components/whatsapp-template.d.ts +1 -0
  364. package/lib/esm/components/whatsapp-template.js +21 -0
  365. package/lib/esm/components/whatsapp-template.js.map +1 -0
  366. package/lib/esm/constants.d.ts +168 -0
  367. package/lib/esm/constants.js +186 -0
  368. package/lib/esm/constants.js.map +1 -0
  369. package/lib/esm/contexts.d.ts +69 -0
  370. package/lib/esm/contexts.js +34 -0
  371. package/lib/esm/contexts.js.map +1 -0
  372. package/lib/esm/dev-app.d.ts +30 -0
  373. package/lib/esm/dev-app.js +67 -0
  374. package/lib/esm/dev-app.js.map +1 -0
  375. package/lib/esm/index.d.ts +9 -0
  376. package/lib/esm/index.js +11 -0
  377. package/lib/esm/index.js.map +1 -0
  378. package/lib/esm/message-utils.d.ts +18 -0
  379. package/lib/esm/message-utils.js +41 -0
  380. package/lib/esm/message-utils.js.map +1 -0
  381. package/lib/esm/msg-to-botonic.d.ts +18 -0
  382. package/lib/esm/msg-to-botonic.js +154 -0
  383. package/lib/esm/msg-to-botonic.js.map +1 -0
  384. package/lib/esm/node-app.d.ts +12 -0
  385. package/lib/esm/node-app.js +21 -0
  386. package/lib/esm/node-app.js.map +1 -0
  387. package/lib/esm/react-bot.d.ts +7 -0
  388. package/lib/esm/react-bot.js +30 -0
  389. package/lib/esm/react-bot.js.map +1 -0
  390. package/lib/esm/util/dom.d.ts +13 -0
  391. package/lib/esm/util/dom.js +46 -0
  392. package/lib/esm/util/dom.js.map +1 -0
  393. package/lib/esm/util/environment.d.ts +6 -0
  394. package/lib/esm/util/environment.js +61 -0
  395. package/lib/esm/util/environment.js.map +1 -0
  396. package/lib/esm/util/error-boundary.d.ts +40 -0
  397. package/lib/esm/util/error-boundary.js +41 -0
  398. package/lib/esm/util/error-boundary.js.map +1 -0
  399. package/lib/esm/util/index.d.ts +0 -0
  400. package/lib/esm/util/index.js +2 -0
  401. package/lib/esm/util/index.js.map +1 -0
  402. package/lib/esm/util/logs.d.ts +2 -0
  403. package/lib/esm/util/logs.js +15 -0
  404. package/lib/esm/util/logs.js.map +1 -0
  405. package/lib/esm/util/objects.d.ts +3 -0
  406. package/lib/esm/util/objects.js +38 -0
  407. package/lib/esm/util/objects.js.map +1 -0
  408. package/lib/esm/util/react.d.ts +12 -0
  409. package/lib/esm/util/react.js +34 -0
  410. package/lib/esm/util/react.js.map +1 -0
  411. package/lib/esm/util/regexs.d.ts +2 -0
  412. package/lib/esm/util/regexs.js +18 -0
  413. package/lib/esm/util/regexs.js.map +1 -0
  414. package/lib/esm/util/webchat.d.ts +11 -0
  415. package/lib/esm/util/webchat.js +53 -0
  416. package/lib/esm/util/webchat.js.map +1 -0
  417. package/lib/esm/webchat/actions.d.ts +23 -0
  418. package/lib/esm/webchat/actions.js +24 -0
  419. package/lib/esm/webchat/actions.js.map +1 -0
  420. package/lib/esm/webchat/components/attachment.d.ts +5 -0
  421. package/lib/esm/webchat/components/attachment.js +27 -0
  422. package/lib/esm/webchat/components/attachment.js.map +1 -0
  423. package/lib/esm/webchat/components/common.d.ts +1 -0
  424. package/lib/esm/webchat/components/common.js +8 -0
  425. package/lib/esm/webchat/components/common.js.map +1 -0
  426. package/lib/esm/webchat/components/conditional-animation.d.ts +1 -0
  427. package/lib/esm/webchat/components/conditional-animation.js +13 -0
  428. package/lib/esm/webchat/components/conditional-animation.js.map +1 -0
  429. package/lib/esm/webchat/components/emoji-picker.d.ts +5 -0
  430. package/lib/esm/webchat/components/emoji-picker.js +46 -0
  431. package/lib/esm/webchat/components/emoji-picker.js.map +1 -0
  432. package/lib/esm/webchat/components/persistent-menu.d.ts +10 -0
  433. package/lib/esm/webchat/components/persistent-menu.js +53 -0
  434. package/lib/esm/webchat/components/persistent-menu.js.map +1 -0
  435. package/lib/esm/webchat/components/send-button.d.ts +3 -0
  436. package/lib/esm/webchat/components/send-button.js +19 -0
  437. package/lib/esm/webchat/components/send-button.js.map +1 -0
  438. package/lib/esm/webchat/components/styled-scrollbar.d.ts +1 -0
  439. package/lib/esm/webchat/components/styled-scrollbar.js +50 -0
  440. package/lib/esm/webchat/components/styled-scrollbar.js.map +1 -0
  441. package/lib/esm/webchat/components/styled-scrollbar.scss +12 -0
  442. package/lib/esm/webchat/components/typing-indicator.d.ts +1 -0
  443. package/lib/esm/webchat/components/typing-indicator.js +9 -0
  444. package/lib/esm/webchat/components/typing-indicator.js.map +1 -0
  445. package/lib/esm/webchat/components/typing-indicator.scss +38 -0
  446. package/lib/esm/webchat/devices/device-adapter.d.ts +12 -0
  447. package/lib/esm/webchat/devices/device-adapter.js +43 -0
  448. package/lib/esm/webchat/devices/device-adapter.js.map +1 -0
  449. package/lib/esm/webchat/devices/index.d.ts +11 -0
  450. package/lib/esm/webchat/devices/index.js +18 -0
  451. package/lib/esm/webchat/devices/index.js.map +1 -0
  452. package/lib/esm/webchat/devices/scrollbar-controller.d.ts +12 -0
  453. package/lib/esm/webchat/devices/scrollbar-controller.js +99 -0
  454. package/lib/esm/webchat/devices/scrollbar-controller.js.map +1 -0
  455. package/lib/esm/webchat/devices/webchat-resizer.d.ts +9 -0
  456. package/lib/esm/webchat/devices/webchat-resizer.js +43 -0
  457. package/lib/esm/webchat/devices/webchat-resizer.js.map +1 -0
  458. package/lib/esm/webchat/header.d.ts +3 -0
  459. package/lib/esm/webchat/header.js +89 -0
  460. package/lib/esm/webchat/header.js.map +1 -0
  461. package/lib/esm/webchat/hooks.d.ts +80 -0
  462. package/lib/esm/webchat/hooks.js +210 -0
  463. package/lib/esm/webchat/hooks.js.map +1 -0
  464. package/lib/esm/webchat/index.d.ts +6 -0
  465. package/lib/esm/webchat/index.js +11 -0
  466. package/lib/esm/webchat/index.js.map +1 -0
  467. package/lib/esm/webchat/message-list.d.ts +1 -0
  468. package/lib/esm/webchat/message-list.js +41 -0
  469. package/lib/esm/webchat/message-list.js.map +1 -0
  470. package/lib/esm/webchat/messages-reducer.d.ts +1 -0
  471. package/lib/esm/webchat/messages-reducer.js +54 -0
  472. package/lib/esm/webchat/messages-reducer.js.map +1 -0
  473. package/lib/esm/webchat/replies.d.ts +1 -0
  474. package/lib/esm/webchat/replies.js +41 -0
  475. package/lib/esm/webchat/replies.js.map +1 -0
  476. package/lib/esm/webchat/session-view.d.ts +1 -0
  477. package/lib/esm/webchat/session-view.js +119 -0
  478. package/lib/esm/webchat/session-view.js.map +1 -0
  479. package/lib/esm/webchat/use-storage-state-hook.d.ts +1 -0
  480. package/lib/esm/webchat/use-storage-state-hook.js +28 -0
  481. package/lib/esm/webchat/use-storage-state-hook.js.map +1 -0
  482. package/lib/esm/webchat/webchat-dev.d.ts +7 -0
  483. package/lib/esm/webchat/webchat-dev.js +60 -0
  484. package/lib/esm/webchat/webchat-dev.js.map +1 -0
  485. package/lib/esm/webchat/webchat-reducer.d.ts +1 -0
  486. package/lib/esm/webchat/webchat-reducer.js +44 -0
  487. package/lib/esm/webchat/webchat-reducer.js.map +1 -0
  488. package/lib/esm/webchat/webchat.d.ts +3 -0
  489. package/lib/esm/webchat/webchat.js +699 -0
  490. package/lib/esm/webchat/webchat.js.map +1 -0
  491. package/lib/esm/webchat/webview.d.ts +2 -0
  492. package/lib/esm/webchat/webview.js +86 -0
  493. package/lib/esm/webchat/webview.js.map +1 -0
  494. package/lib/esm/webchat-app.d.ts +98 -0
  495. package/lib/esm/webchat-app.js +265 -0
  496. package/lib/esm/webchat-app.js.map +1 -0
  497. package/lib/esm/webchat.template.html +37 -0
  498. package/lib/esm/webview-app.d.ts +7 -0
  499. package/lib/esm/webview-app.js +98 -0
  500. package/lib/esm/webview-app.js.map +1 -0
  501. package/lib/esm/webview.template.html +39 -0
  502. package/package.json +27 -20
  503. package/src/components/audio.jsx +2 -0
  504. package/src/components/document.jsx +2 -0
  505. package/src/components/image.jsx +2 -0
  506. package/src/components/location.jsx +2 -2
  507. package/src/components/pic.jsx +3 -1
  508. package/src/components/video.jsx +2 -0
  509. package/src/index.js +1 -1
  510. package/src/msg-to-botonic.jsx +1 -1
  511. package/src/util/environment.js +31 -2
  512. package/src/{webview.jsx → webview-app.tsx} +7 -1
  513. package/lib/app.js +0 -19
  514. package/lib/app.js.map +0 -1
  515. package/lib/botonic-tester.js +0 -224
  516. package/lib/botonic-tester.js.map +0 -1
  517. package/lib/components/audio.js +0 -48
  518. package/lib/components/audio.js.map +0 -1
  519. package/lib/components/button.js +0 -224
  520. package/lib/components/button.js.map +0 -1
  521. package/lib/components/buttons-disabler.js +0 -133
  522. package/lib/components/buttons-disabler.js.map +0 -1
  523. package/lib/components/carousel.js +0 -194
  524. package/lib/components/carousel.js.map +0 -1
  525. package/lib/components/components.js.map +0 -1
  526. package/lib/components/custom-message.js +0 -131
  527. package/lib/components/custom-message.js.map +0 -1
  528. package/lib/components/document.js +0 -76
  529. package/lib/components/document.js.map +0 -1
  530. package/lib/components/element.js +0 -69
  531. package/lib/components/element.js.map +0 -1
  532. package/lib/components/handoff.js +0 -69
  533. package/lib/components/handoff.js.map +0 -1
  534. package/lib/components/image.js +0 -91
  535. package/lib/components/image.js.map +0 -1
  536. package/lib/components/index.d.ts +0 -228
  537. package/lib/components/index.js +0 -193
  538. package/lib/components/index.js.map +0 -1
  539. package/lib/components/location.js +0 -69
  540. package/lib/components/location.js.map +0 -1
  541. package/lib/components/markdown.js +0 -108
  542. package/lib/components/markdown.js.map +0 -1
  543. package/lib/components/message-template.js +0 -36
  544. package/lib/components/message-template.js.map +0 -1
  545. package/lib/components/message.js +0 -351
  546. package/lib/components/message.js.map +0 -1
  547. package/lib/components/multichannel/facebook/facebook.js +0 -96
  548. package/lib/components/multichannel/facebook/facebook.js.map +0 -1
  549. package/lib/components/multichannel/index.d.ts +0 -65
  550. package/lib/components/multichannel/index.js +0 -46
  551. package/lib/components/multichannel/index.js.map +0 -1
  552. package/lib/components/multichannel/multichannel-button.js +0 -119
  553. package/lib/components/multichannel/multichannel-button.js.map +0 -1
  554. package/lib/components/multichannel/multichannel-carousel.js +0 -143
  555. package/lib/components/multichannel/multichannel-carousel.js.map +0 -1
  556. package/lib/components/multichannel/multichannel-context.js +0 -24
  557. package/lib/components/multichannel/multichannel-context.js.map +0 -1
  558. package/lib/components/multichannel/multichannel-reply.js +0 -46
  559. package/lib/components/multichannel/multichannel-reply.js.map +0 -1
  560. package/lib/components/multichannel/multichannel-text.js +0 -222
  561. package/lib/components/multichannel/multichannel-text.js.map +0 -1
  562. package/lib/components/multichannel/multichannel-utils.js +0 -126
  563. package/lib/components/multichannel/multichannel-utils.js.map +0 -1
  564. package/lib/components/multichannel/multichannel.js +0 -111
  565. package/lib/components/multichannel/multichannel.js.map +0 -1
  566. package/lib/components/pic.js +0 -50
  567. package/lib/components/pic.js.map +0 -1
  568. package/lib/components/raw.js +0 -70
  569. package/lib/components/raw.js.map +0 -1
  570. package/lib/components/reply.js +0 -107
  571. package/lib/components/reply.js.map +0 -1
  572. package/lib/components/share-button.js +0 -36
  573. package/lib/components/share-button.js.map +0 -1
  574. package/lib/components/subtitle.js +0 -54
  575. package/lib/components/subtitle.js.map +0 -1
  576. package/lib/components/text.js +0 -80
  577. package/lib/components/text.js.map +0 -1
  578. package/lib/components/timestamps.js +0 -69
  579. package/lib/components/timestamps.js.map +0 -1
  580. package/lib/components/title.js +0 -52
  581. package/lib/components/title.js.map +0 -1
  582. package/lib/components/video.js +0 -51
  583. package/lib/components/video.js.map +0 -1
  584. package/lib/components/webchat-settings.js +0 -118
  585. package/lib/components/webchat-settings.js.map +0 -1
  586. package/lib/components/whatsapp-template.js +0 -53
  587. package/lib/components/whatsapp-template.js.map +0 -1
  588. package/lib/constants.js +0 -203
  589. package/lib/constants.js.map +0 -1
  590. package/lib/contexts.js +0 -57
  591. package/lib/contexts.js.map +0 -1
  592. package/lib/dev-app.js +0 -241
  593. package/lib/dev-app.js.map +0 -1
  594. package/lib/index.d.ts +0 -238
  595. package/lib/index.js +0 -131
  596. package/lib/index.js.map +0 -1
  597. package/lib/message-utils.js +0 -149
  598. package/lib/message-utils.js.map +0 -1
  599. package/lib/msg-to-botonic.js +0 -199
  600. package/lib/msg-to-botonic.js.map +0 -1
  601. package/lib/node-app.js +0 -97
  602. package/lib/node-app.js.map +0 -1
  603. package/lib/react-bot.js +0 -167
  604. package/lib/react-bot.js.map +0 -1
  605. package/lib/util/dom.js +0 -84
  606. package/lib/util/dom.js.map +0 -1
  607. package/lib/util/environment.js +0 -42
  608. package/lib/util/environment.js.map +0 -1
  609. package/lib/util/error-boundary.js +0 -105
  610. package/lib/util/error-boundary.js.map +0 -1
  611. package/lib/util/index.d.ts +0 -9
  612. package/lib/util/index.js +0 -2
  613. package/lib/util/index.js.map +0 -1
  614. package/lib/util/logs.js +0 -28
  615. package/lib/util/logs.js.map +0 -1
  616. package/lib/util/objects.js +0 -60
  617. package/lib/util/objects.js.map +0 -1
  618. package/lib/util/react.js +0 -75
  619. package/lib/util/react.js.map +0 -1
  620. package/lib/util/regexs.js +0 -31
  621. package/lib/util/regexs.js.map +0 -1
  622. package/lib/util/webchat.js +0 -92
  623. package/lib/util/webchat.js.map +0 -1
  624. package/lib/webchat/actions.js +0 -53
  625. package/lib/webchat/actions.js.map +0 -1
  626. package/lib/webchat/components/attachment.js +0 -68
  627. package/lib/webchat/components/attachment.js.map +0 -1
  628. package/lib/webchat/components/common.js +0 -29
  629. package/lib/webchat/components/common.js.map +0 -1
  630. package/lib/webchat/components/conditional-animation.js +0 -42
  631. package/lib/webchat/components/conditional-animation.js.map +0 -1
  632. package/lib/webchat/components/emoji-picker.js +0 -89
  633. package/lib/webchat/components/emoji-picker.js.map +0 -1
  634. package/lib/webchat/components/persistent-menu.js +0 -104
  635. package/lib/webchat/components/persistent-menu.js.map +0 -1
  636. package/lib/webchat/components/send-button.js +0 -45
  637. package/lib/webchat/components/send-button.js.map +0 -1
  638. package/lib/webchat/components/styled-scrollbar.js +0 -55
  639. package/lib/webchat/components/styled-scrollbar.js.map +0 -1
  640. package/lib/webchat/components/typing-indicator.js +0 -27
  641. package/lib/webchat/components/typing-indicator.js.map +0 -1
  642. package/lib/webchat/devices/device-adapter.js +0 -82
  643. package/lib/webchat/devices/device-adapter.js.map +0 -1
  644. package/lib/webchat/devices/index.js +0 -32
  645. package/lib/webchat/devices/index.js.map +0 -1
  646. package/lib/webchat/devices/scrollbar-controller.js +0 -152
  647. package/lib/webchat/devices/scrollbar-controller.js.map +0 -1
  648. package/lib/webchat/devices/webchat-resizer.js +0 -76
  649. package/lib/webchat/devices/webchat-resizer.js.map +0 -1
  650. package/lib/webchat/header.js +0 -116
  651. package/lib/webchat/header.js.map +0 -1
  652. package/lib/webchat/hooks.js +0 -359
  653. package/lib/webchat/hooks.js.map +0 -1
  654. package/lib/webchat/index.d.ts +0 -62
  655. package/lib/webchat/index.js +0 -32
  656. package/lib/webchat/index.js.map +0 -1
  657. package/lib/webchat/message-list.js +0 -88
  658. package/lib/webchat/message-list.js.map +0 -1
  659. package/lib/webchat/messages-reducer.js +0 -93
  660. package/lib/webchat/messages-reducer.js.map +0 -1
  661. package/lib/webchat/replies.js +0 -78
  662. package/lib/webchat/replies.js.map +0 -1
  663. package/lib/webchat/session-view.js +0 -106
  664. package/lib/webchat/session-view.js.map +0 -1
  665. package/lib/webchat/use-storage-state-hook.js +0 -60
  666. package/lib/webchat/use-storage-state-hook.js.map +0 -1
  667. package/lib/webchat/webchat-dev.js +0 -109
  668. package/lib/webchat/webchat-dev.js.map +0 -1
  669. package/lib/webchat/webchat-reducer.js +0 -108
  670. package/lib/webchat/webchat-reducer.js.map +0 -1
  671. package/lib/webchat/webchat.js +0 -1108
  672. package/lib/webchat/webchat.js.map +0 -1
  673. package/lib/webchat/webview.js +0 -122
  674. package/lib/webchat/webview.js.map +0 -1
  675. package/lib/webchat-app.js +0 -660
  676. package/lib/webchat-app.js.map +0 -1
  677. package/lib/webview.js +0 -231
  678. package/lib/webview.js.map +0 -1
  679. /package/lib/{assets → cjs/assets}/attachment-icon.svg +0 -0
  680. /package/lib/{assets → cjs/assets}/audio.svg +0 -0
  681. /package/lib/{assets → cjs/assets}/botonic_react_logo100x100.png +0 -0
  682. /package/lib/{assets → cjs/assets}/document.svg +0 -0
  683. /package/lib/{assets → cjs/assets}/emojiButton.svg +0 -0
  684. /package/lib/{assets → cjs/assets}/image.svg +0 -0
  685. /package/lib/{assets → cjs/assets}/leftArrow.svg +0 -0
  686. /package/lib/{assets → cjs/assets}/menuButton.svg +0 -0
  687. /package/lib/{assets → cjs/assets}/rightArrow.svg +0 -0
  688. /package/lib/{assets → cjs/assets}/send-button.svg +0 -0
  689. /package/lib/{assets → cjs/assets}/video.svg +0 -0
  690. /package/lib/{webchat → cjs/webchat}/components/styled-scrollbar.scss +0 -0
  691. /package/lib/{webchat → cjs/webchat}/components/typing-indicator.scss +0 -0
  692. /package/lib/{webchat.template.html → cjs/webchat.template.html} +0 -0
  693. /package/lib/{webview.template.html → cjs/webview.template.html} +0 -0
@@ -1,660 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.WebchatApp = void 0;
11
-
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
-
16
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
17
-
18
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
19
-
20
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
21
-
22
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
23
-
24
- var _core = require("@botonic/core");
25
-
26
- var _lodash = _interopRequireDefault(require("lodash.merge"));
27
-
28
- var _react = _interopRequireWildcard(require("react"));
29
-
30
- var _reactDom = require("react-dom");
31
-
32
- var _constants = require("./constants");
33
-
34
- var _msgToBotonic = require("./msg-to-botonic");
35
-
36
- var _dom = require("./util/dom");
37
-
38
- var _webchat = require("./webchat/webchat");
39
-
40
- var _excluded = ["theme", "persistentMenu", "coverComponent", "blockInputs", "enableAttachments", "enableUserInput", "enableAnimations", "enableEmojiPicker", "defaultDelay", "defaultTyping", "storage", "storageKey", "onInit", "onOpen", "onClose", "onMessage", "onConnectionChange", "appId", "visibility", "server", "hostId"];
41
-
42
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
43
-
44
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
45
-
46
- var WebchatApp = /*#__PURE__*/function () {
47
- function WebchatApp(_ref) {
48
- var _ref$theme = _ref.theme,
49
- theme = _ref$theme === void 0 ? {} : _ref$theme,
50
- persistentMenu = _ref.persistentMenu,
51
- coverComponent = _ref.coverComponent,
52
- blockInputs = _ref.blockInputs,
53
- enableEmojiPicker = _ref.enableEmojiPicker,
54
- enableAttachments = _ref.enableAttachments,
55
- enableUserInput = _ref.enableUserInput,
56
- enableAnimations = _ref.enableAnimations,
57
- hostId = _ref.hostId,
58
- shadowDOM = _ref.shadowDOM,
59
- defaultDelay = _ref.defaultDelay,
60
- defaultTyping = _ref.defaultTyping,
61
- storage = _ref.storage,
62
- storageKey = _ref.storageKey,
63
- onInit = _ref.onInit,
64
- onOpen = _ref.onOpen,
65
- onClose = _ref.onClose,
66
- onMessage = _ref.onMessage,
67
- onConnectionChange = _ref.onConnectionChange,
68
- appId = _ref.appId,
69
- visibility = _ref.visibility,
70
- server = _ref.server;
71
- (0, _classCallCheck2["default"])(this, WebchatApp);
72
- this.theme = theme;
73
- this.persistentMenu = persistentMenu;
74
- this.coverComponent = coverComponent;
75
- this.blockInputs = blockInputs;
76
- this.enableEmojiPicker = enableEmojiPicker;
77
- this.enableAttachments = enableAttachments;
78
- this.enableUserInput = enableUserInput;
79
- this.enableAnimations = enableAnimations;
80
- this.shadowDOM = Boolean(typeof shadowDOM === 'function' ? shadowDOM() : shadowDOM);
81
-
82
- if (this.shadowDOM && !(0, _dom.isShadowDOMSupported)()) {
83
- console.warn('[botonic] ShadowDOM not supported on this browser');
84
- this.shadowDOM = false;
85
- }
86
-
87
- this.hostId = hostId || _constants.WEBCHAT.DEFAULTS.HOST_ID;
88
- this.defaultDelay = defaultDelay;
89
- this.defaultTyping = defaultTyping;
90
- this.storage = storage === undefined ? localStorage : storage;
91
- this.storageKey = storageKey || _constants.WEBCHAT.DEFAULTS.STORAGE_KEY;
92
- this.onInit = onInit;
93
- this.onOpen = onOpen;
94
- this.onClose = onClose;
95
- this.onMessage = onMessage;
96
- this.onConnectionChange = onConnectionChange;
97
- this.visibility = visibility;
98
- this.server = server;
99
- this.webchatRef = /*#__PURE__*/(0, _react.createRef)();
100
- this.appId = appId;
101
- }
102
-
103
- (0, _createClass2["default"])(WebchatApp, [{
104
- key: "createRootElement",
105
- value: function createRootElement(host) {
106
- // Create root element <div id='root'> if not exists
107
- // Create shadowDOM to root element if needed
108
- if (host) {
109
- if (host.id && this.hostId) {
110
- if (host.id != this.hostId) {
111
- console.warn("[botonic] Host ID \"".concat(host.id, "\" don't match 'hostId' option: ").concat(this.hostId, ". Using value: ").concat(host.id, "."));
112
- this.hostId = host.id;
113
- }
114
- } else if (host.id) this.hostId = host.id;else if (this.hostId) host.id = this.hostId;
115
- } else {
116
- host = document.getElementById(this.hostId);
117
- }
118
-
119
- if (!host) {
120
- host = document.createElement('div');
121
- host.id = this.hostId;
122
- if (document.body.firstChild) document.body.insertBefore(host, document.body.firstChild);else document.body.appendChild(host);
123
- }
124
-
125
- this.host = this.shadowDOM ? host.attachShadow({
126
- mode: 'open'
127
- }) : host;
128
- }
129
- }, {
130
- key: "getReactMountNode",
131
- value: function getReactMountNode(node) {
132
- if (!node) node = this.host;
133
- return node.shadowRoot ? node.shadowRoot : node;
134
- }
135
- }, {
136
- key: "onInitWebchat",
137
- value: function onInitWebchat() {
138
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
139
- args[_key] = arguments[_key];
140
- }
141
-
142
- this.onInit && this.onInit.apply(this, [this].concat(args));
143
- }
144
- }, {
145
- key: "onOpenWebchat",
146
- value: function onOpenWebchat() {
147
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
148
- args[_key2] = arguments[_key2];
149
- }
150
-
151
- this.onOpen && this.onOpen.apply(this, [this].concat(args));
152
- }
153
- }, {
154
- key: "onCloseWebchat",
155
- value: function onCloseWebchat() {
156
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
157
- args[_key3] = arguments[_key3];
158
- }
159
-
160
- this.onClose && this.onClose.apply(this, [this].concat(args));
161
- }
162
- }, {
163
- key: "onUserInput",
164
- value: function () {
165
- var _onUserInput = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref2) {
166
- var user, input;
167
- return _regenerator["default"].wrap(function _callee$(_context) {
168
- while (1) {
169
- switch (_context.prev = _context.next) {
170
- case 0:
171
- user = _ref2.user, input = _ref2.input;
172
- this.onMessage && this.onMessage(this, {
173
- from: _constants.SENDERS.user,
174
- message: input
175
- });
176
- return _context.abrupt("return", this.hubtypeService.postMessage(user, input));
177
-
178
- case 3:
179
- case "end":
180
- return _context.stop();
181
- }
182
- }
183
- }, _callee, this);
184
- }));
185
-
186
- function onUserInput(_x) {
187
- return _onUserInput.apply(this, arguments);
188
- }
189
-
190
- return onUserInput;
191
- }()
192
- }, {
193
- key: "onConnectionRegained",
194
- value: function () {
195
- var _onConnectionRegained = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
196
- return _regenerator["default"].wrap(function _callee2$(_context2) {
197
- while (1) {
198
- switch (_context2.prev = _context2.next) {
199
- case 0:
200
- return _context2.abrupt("return", this.hubtypeService.onConnectionRegained());
201
-
202
- case 1:
203
- case "end":
204
- return _context2.stop();
205
- }
206
- }
207
- }, _callee2, this);
208
- }));
209
-
210
- function onConnectionRegained() {
211
- return _onConnectionRegained.apply(this, arguments);
212
- }
213
-
214
- return onConnectionRegained;
215
- }()
216
- }, {
217
- key: "onStateChange",
218
- value: function onStateChange(_ref3) {
219
- var _this = this;
220
-
221
- var user = _ref3.session.user,
222
- messagesJSON = _ref3.messagesJSON;
223
- var lastMessage = messagesJSON[messagesJSON.length - 1];
224
- var lastMessageId = lastMessage && lastMessage.id;
225
- var lastMessageUpdateDate = this.getLastMessageUpdate();
226
-
227
- if (this.hubtypeService) {
228
- this.hubtypeService.lastMessageId = lastMessageId;
229
- this.hubtypeService.lastMessageUpdateDate = lastMessageUpdateDate;
230
- } else if (!this.hubtypeService && user) {
231
- this.hubtypeService = new _core.HubtypeService({
232
- appId: this.appId,
233
- user: user,
234
- lastMessageId: lastMessageId,
235
- lastMessageUpdateDate: lastMessageUpdateDate,
236
- onEvent: function onEvent(event) {
237
- return _this.onServiceEvent(event);
238
- },
239
- unsentInputs: function unsentInputs() {
240
- return _this.webchatRef.current.getMessages().filter(function (msg) {
241
- return msg.ack === 0 && msg.unsentInput;
242
- });
243
- },
244
- server: this.server
245
- });
246
- }
247
- }
248
- }, {
249
- key: "onServiceEvent",
250
- value: function onServiceEvent(event) {
251
- if (event.action === 'connectionChange') {
252
- this.onConnectionChange && this.onConnectionChange(this, event.online);
253
- this.webchatRef.current.setOnline(event.online);
254
- } else if (event.action === 'update_message_info') this.updateMessageInfo(event.message.id, event.message);else if (event.message.type === 'update_webchat_settings') this.updateWebchatSettings(event.message.data);else if (event.message.type === 'sender_action') this.setTyping(event.message.data === 'typing_on');else {
255
- this.onMessage && this.onMessage(this, {
256
- from: _constants.SENDERS.bot,
257
- message: event.message
258
- });
259
- this.addBotMessage(event.message);
260
- }
261
- }
262
- }, {
263
- key: "updateUser",
264
- value: function updateUser(user) {
265
- this.webchatRef.current.updateUser(user);
266
- }
267
- }, {
268
- key: "addBotMessage",
269
- value: function addBotMessage(message) {
270
- this.webchatRef.current.addBotResponse({
271
- response: (0, _msgToBotonic.msgToBotonic)(message, this.theme.message && this.theme.message.customTypes || this.theme.customMessageTypes)
272
- });
273
- }
274
- }, {
275
- key: "addBotText",
276
- value: function addBotText(text) {
277
- this.addBotMessage({
278
- type: _core.INPUT.TEXT,
279
- data: text
280
- });
281
- }
282
- }, {
283
- key: "addUserMessage",
284
- value: function addUserMessage(message) {
285
- this.webchatRef.current.addUserMessage(message);
286
- }
287
- }, {
288
- key: "addUserText",
289
- value: function addUserText(text) {
290
- this.webchatRef.current.addUserMessage({
291
- type: _core.INPUT.TEXT,
292
- data: text
293
- });
294
- }
295
- }, {
296
- key: "addUserPayload",
297
- value: function addUserPayload(payload) {
298
- this.webchatRef.current.addUserMessage({
299
- type: _core.INPUT.POSTBACK,
300
- payload: payload
301
- });
302
- }
303
- }, {
304
- key: "setTyping",
305
- value: function setTyping(typing) {
306
- this.webchatRef.current.setTyping(typing);
307
- }
308
- }, {
309
- key: "open",
310
- value: function open() {
311
- this.webchatRef.current.openWebchat();
312
- }
313
- }, {
314
- key: "close",
315
- value: function close() {
316
- this.webchatRef.current.closeWebchat();
317
- }
318
- }, {
319
- key: "toggle",
320
- value: function toggle() {
321
- this.webchatRef.current.toggleWebchat();
322
- }
323
- }, {
324
- key: "openCoverComponent",
325
- value: function openCoverComponent() {
326
- this.webchatRef.current.openCoverComponent();
327
- }
328
- }, {
329
- key: "closeCoverComponent",
330
- value: function closeCoverComponent() {
331
- this.webchatRef.current.closeCoverComponent();
332
- }
333
- }, {
334
- key: "renderCustomComponent",
335
- value: function renderCustomComponent(_customComponent) {
336
- this.webchatRef.current.renderCustomComponent(_customComponent);
337
- }
338
- }, {
339
- key: "unmountCustomComponent",
340
- value: function unmountCustomComponent() {
341
- this.webchatRef.current.unmountCustomComponent();
342
- }
343
- }, {
344
- key: "toggleCoverComponent",
345
- value: function toggleCoverComponent() {
346
- this.webchatRef.current.toggleCoverComponent();
347
- }
348
- }, {
349
- key: "getMessages",
350
- value: function getMessages() {
351
- return this.webchatRef.current.getMessages();
352
- }
353
- }, {
354
- key: "clearMessages",
355
- value: function clearMessages() {
356
- this.webchatRef.current.clearMessages();
357
- }
358
- }, {
359
- key: "getVisibility",
360
- value: function () {
361
- var _getVisibility = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
362
- return _regenerator["default"].wrap(function _callee3$(_context3) {
363
- while (1) {
364
- switch (_context3.prev = _context3.next) {
365
- case 0:
366
- return _context3.abrupt("return", this.resolveWebchatVisibility({
367
- appId: this.appId,
368
- visibility: this.visibility
369
- }));
370
-
371
- case 1:
372
- case "end":
373
- return _context3.stop();
374
- }
375
- }
376
- }, _callee3, this);
377
- }));
378
-
379
- function getVisibility() {
380
- return _getVisibility.apply(this, arguments);
381
- }
382
-
383
- return getVisibility;
384
- }()
385
- }, {
386
- key: "getLastMessageUpdate",
387
- value: function getLastMessageUpdate() {
388
- return this.webchatRef.current.getLastMessageUpdate();
389
- }
390
- }, {
391
- key: "updateMessageInfo",
392
- value: function updateMessageInfo(msgId, messageInfo) {
393
- return this.webchatRef.current.updateMessageInfo(msgId, messageInfo);
394
- }
395
- }, {
396
- key: "updateWebchatSettings",
397
- value: function updateWebchatSettings(settings) {
398
- return this.webchatRef.current.updateWebchatSettings(settings);
399
- } // eslint-disable-next-line complexity
400
-
401
- }, {
402
- key: "getComponent",
403
- value: function getComponent(host) {
404
- var _this2 = this;
405
-
406
- var optionsAtRuntime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
407
- var _optionsAtRuntime$the = optionsAtRuntime.theme,
408
- theme = _optionsAtRuntime$the === void 0 ? {} : _optionsAtRuntime$the,
409
- persistentMenu = optionsAtRuntime.persistentMenu,
410
- coverComponent = optionsAtRuntime.coverComponent,
411
- blockInputs = optionsAtRuntime.blockInputs,
412
- enableAttachments = optionsAtRuntime.enableAttachments,
413
- enableUserInput = optionsAtRuntime.enableUserInput,
414
- enableAnimations = optionsAtRuntime.enableAnimations,
415
- enableEmojiPicker = optionsAtRuntime.enableEmojiPicker,
416
- defaultDelay = optionsAtRuntime.defaultDelay,
417
- defaultTyping = optionsAtRuntime.defaultTyping,
418
- storage = optionsAtRuntime.storage,
419
- storageKey = optionsAtRuntime.storageKey,
420
- onInit = optionsAtRuntime.onInit,
421
- onOpen = optionsAtRuntime.onOpen,
422
- onClose = optionsAtRuntime.onClose,
423
- onMessage = optionsAtRuntime.onMessage,
424
- onConnectionChange = optionsAtRuntime.onConnectionChange,
425
- appId = optionsAtRuntime.appId,
426
- visibility = optionsAtRuntime.visibility,
427
- server = optionsAtRuntime.server,
428
- hostId = optionsAtRuntime.hostId,
429
- webchatOptions = (0, _objectWithoutProperties2["default"])(optionsAtRuntime, _excluded);
430
- theme = (0, _lodash["default"])(this.theme, theme);
431
- persistentMenu = persistentMenu || this.persistentMenu;
432
- coverComponent = coverComponent || this.coverComponent;
433
- blockInputs = blockInputs || this.blockInputs;
434
- enableEmojiPicker = enableEmojiPicker || this.enableEmojiPicker;
435
- enableAttachments = enableAttachments || this.enableAttachments;
436
- enableUserInput = enableUserInput || this.enableUserInput;
437
- enableAnimations = enableAnimations || this.enableAnimations;
438
- defaultDelay = defaultDelay || this.defaultDelay;
439
- defaultTyping = defaultTyping || this.defaultTyping;
440
- server = server || this.server;
441
- this.storage = storage || this.storage;
442
- this.storageKey = storageKey || this.storageKey;
443
- this.onInit = onInit || this.onInit;
444
- this.onOpen = onOpen || this.onOpen;
445
- this.onClose = onClose || this.onClose;
446
- this.onMessage = onMessage || this.onMessage;
447
- this.onConnectionChange = onConnectionChange || this.onConnectionChange;
448
- this.visibility = visibility || this.visibility;
449
- this.appId = appId || this.appId;
450
- this.hostId = hostId || this.hostId;
451
- this.createRootElement(host);
452
- return /*#__PURE__*/_react["default"].createElement(_webchat.Webchat, (0, _extends2["default"])({}, webchatOptions, {
453
- ref: this.webchatRef,
454
- host: this.host,
455
- shadowDOM: this.shadowDOM,
456
- theme: theme,
457
- persistentMenu: persistentMenu,
458
- coverComponent: coverComponent,
459
- blockInputs: blockInputs,
460
- enableEmojiPicker: enableEmojiPicker,
461
- enableAttachments: enableAttachments,
462
- enableUserInput: enableUserInput,
463
- enableAnimations: enableAnimations,
464
- storage: this.storage,
465
- storageKey: this.storageKey,
466
- defaultDelay: defaultDelay,
467
- defaultTyping: defaultTyping,
468
- onInit: function onInit() {
469
- return _this2.onInitWebchat.apply(_this2, arguments);
470
- },
471
- onOpen: function onOpen() {
472
- return _this2.onOpenWebchat.apply(_this2, arguments);
473
- },
474
- onClose: function onClose() {
475
- return _this2.onCloseWebchat.apply(_this2, arguments);
476
- },
477
- onUserInput: function onUserInput() {
478
- return _this2.onUserInput.apply(_this2, arguments);
479
- },
480
- onStateChange: function onStateChange(webchatState) {
481
- return _this2.onStateChange(webchatState);
482
- },
483
- server: server
484
- }));
485
- }
486
- }, {
487
- key: "isWebchatVisible",
488
- value: function () {
489
- var _isWebchatVisible = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_ref4) {
490
- var appId, _yield$HubtypeService, status;
491
-
492
- return _regenerator["default"].wrap(function _callee4$(_context4) {
493
- while (1) {
494
- switch (_context4.prev = _context4.next) {
495
- case 0:
496
- appId = _ref4.appId;
497
- _context4.prev = 1;
498
- _context4.next = 4;
499
- return _core.HubtypeService.getWebchatVisibility({
500
- appId: appId
501
- });
502
-
503
- case 4:
504
- _yield$HubtypeService = _context4.sent;
505
- status = _yield$HubtypeService.status;
506
- return _context4.abrupt("return", status === 200);
507
-
508
- case 9:
509
- _context4.prev = 9;
510
- _context4.t0 = _context4["catch"](1);
511
- return _context4.abrupt("return", false);
512
-
513
- case 12:
514
- case "end":
515
- return _context4.stop();
516
- }
517
- }
518
- }, _callee4, null, [[1, 9]]);
519
- }));
520
-
521
- function isWebchatVisible(_x2) {
522
- return _isWebchatVisible.apply(this, arguments);
523
- }
524
-
525
- return isWebchatVisible;
526
- }()
527
- }, {
528
- key: "isOnline",
529
- value: function isOnline() {
530
- return this.webchatRef.current.isOnline();
531
- }
532
- }, {
533
- key: "resolveWebchatVisibility",
534
- value: function () {
535
- var _resolveWebchatVisibility = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(optionsAtRuntime) {
536
- var appId, visibility;
537
- return _regenerator["default"].wrap(function _callee5$(_context5) {
538
- while (1) {
539
- switch (_context5.prev = _context5.next) {
540
- case 0:
541
- appId = optionsAtRuntime.appId, visibility = optionsAtRuntime.visibility;
542
- visibility = visibility || this.visibility;
543
-
544
- if (!(visibility === undefined || visibility === true)) {
545
- _context5.next = 4;
546
- break;
547
- }
548
-
549
- return _context5.abrupt("return", true);
550
-
551
- case 4:
552
- if (!(typeof visibility === 'function' && visibility())) {
553
- _context5.next = 6;
554
- break;
555
- }
556
-
557
- return _context5.abrupt("return", true);
558
-
559
- case 6:
560
- _context5.t0 = visibility === 'dynamic';
561
-
562
- if (!_context5.t0) {
563
- _context5.next = 11;
564
- break;
565
- }
566
-
567
- _context5.next = 10;
568
- return this.isWebchatVisible({
569
- appId: appId
570
- });
571
-
572
- case 10:
573
- _context5.t0 = _context5.sent;
574
-
575
- case 11:
576
- if (!_context5.t0) {
577
- _context5.next = 13;
578
- break;
579
- }
580
-
581
- return _context5.abrupt("return", true);
582
-
583
- case 13:
584
- return _context5.abrupt("return", false);
585
-
586
- case 14:
587
- case "end":
588
- return _context5.stop();
589
- }
590
- }
591
- }, _callee5, this);
592
- }));
593
-
594
- function resolveWebchatVisibility(_x3) {
595
- return _resolveWebchatVisibility.apply(this, arguments);
596
- }
597
-
598
- return resolveWebchatVisibility;
599
- }()
600
- }, {
601
- key: "destroy",
602
- value: function destroy() {
603
- if (this.hubtypeService) this.hubtypeService.destroyPusher();
604
- (0, _reactDom.unmountComponentAtNode)(this.host);
605
- if (this.storage) this.storage.removeItem(this.storageKey);
606
- }
607
- }, {
608
- key: "render",
609
- value: function () {
610
- var _render2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(dest) {
611
- var _this3 = this;
612
-
613
- var optionsAtRuntime,
614
- _args7 = arguments;
615
- return _regenerator["default"].wrap(function _callee7$(_context7) {
616
- while (1) {
617
- switch (_context7.prev = _context7.next) {
618
- case 0:
619
- optionsAtRuntime = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
620
- (0, _dom.onDOMLoaded)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
621
- var isVisible;
622
- return _regenerator["default"].wrap(function _callee6$(_context6) {
623
- while (1) {
624
- switch (_context6.prev = _context6.next) {
625
- case 0:
626
- _context6.next = 2;
627
- return _this3.resolveWebchatVisibility(optionsAtRuntime);
628
-
629
- case 2:
630
- isVisible = _context6.sent;
631
- if (isVisible) (0, _reactDom.render)(_this3.getComponent(dest, optionsAtRuntime), _this3.getReactMountNode(dest));
632
-
633
- case 4:
634
- case "end":
635
- return _context6.stop();
636
- }
637
- }
638
- }, _callee6);
639
- })));
640
-
641
- case 2:
642
- case "end":
643
- return _context7.stop();
644
- }
645
- }
646
- }, _callee7);
647
- }));
648
-
649
- function render(_x4) {
650
- return _render2.apply(this, arguments);
651
- }
652
-
653
- return render;
654
- }()
655
- }]);
656
- return WebchatApp;
657
- }();
658
-
659
- exports.WebchatApp = WebchatApp;
660
- //# sourceMappingURL=webchat-app.js.map