@botonic/react 0.21.6 → 0.21.7-alpha.0

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 (424) 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 +9 -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 +10 -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 +1 -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 +1 -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 +34 -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 +3 -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 +18 -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 +11 -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.js +47 -0
  143. package/lib/cjs/util/error-boundary.js.map +1 -0
  144. package/lib/cjs/util/index.d.ts +0 -0
  145. package/lib/cjs/util/index.js +2 -0
  146. package/lib/cjs/util/index.js.map +1 -0
  147. package/lib/cjs/util/logs.d.ts +2 -0
  148. package/lib/cjs/util/logs.js +20 -0
  149. package/lib/cjs/util/logs.js.map +1 -0
  150. package/lib/cjs/util/objects.d.ts +3 -0
  151. package/lib/cjs/util/objects.js +44 -0
  152. package/lib/cjs/util/objects.js.map +1 -0
  153. package/lib/cjs/util/react.d.ts +12 -0
  154. package/lib/cjs/util/react.js +42 -0
  155. package/lib/cjs/util/react.js.map +1 -0
  156. package/lib/cjs/util/regexs.d.ts +2 -0
  157. package/lib/cjs/util/regexs.js +23 -0
  158. package/lib/cjs/util/regexs.js.map +1 -0
  159. package/lib/cjs/util/webchat.d.ts +11 -0
  160. package/lib/cjs/util/webchat.js +62 -0
  161. package/lib/cjs/util/webchat.js.map +1 -0
  162. package/lib/cjs/webchat/actions.d.ts +23 -0
  163. package/lib/cjs/webchat/actions.js +27 -0
  164. package/lib/cjs/webchat/actions.js.map +1 -0
  165. package/lib/cjs/webchat/components/attachment.d.ts +5 -0
  166. package/lib/cjs/webchat/components/attachment.js +32 -0
  167. package/lib/cjs/webchat/components/attachment.js.map +1 -0
  168. package/lib/cjs/webchat/components/common.d.ts +1 -0
  169. package/lib/cjs/webchat/components/common.js +13 -0
  170. package/lib/cjs/webchat/components/common.js.map +1 -0
  171. package/lib/cjs/webchat/components/conditional-animation.d.ts +1 -0
  172. package/lib/cjs/webchat/components/conditional-animation.js +18 -0
  173. package/lib/cjs/webchat/components/conditional-animation.js.map +1 -0
  174. package/lib/cjs/webchat/components/emoji-picker.d.ts +5 -0
  175. package/lib/cjs/webchat/components/emoji-picker.js +52 -0
  176. package/lib/cjs/webchat/components/emoji-picker.js.map +1 -0
  177. package/lib/cjs/webchat/components/persistent-menu.d.ts +10 -0
  178. package/lib/cjs/webchat/components/persistent-menu.js +59 -0
  179. package/lib/cjs/webchat/components/persistent-menu.js.map +1 -0
  180. package/lib/cjs/webchat/components/send-button.d.ts +3 -0
  181. package/lib/cjs/webchat/components/send-button.js +24 -0
  182. package/lib/cjs/webchat/components/send-button.js.map +1 -0
  183. package/lib/cjs/webchat/components/styled-scrollbar.d.ts +1 -0
  184. package/lib/cjs/webchat/components/styled-scrollbar.js +54 -0
  185. package/lib/cjs/webchat/components/styled-scrollbar.js.map +1 -0
  186. package/lib/cjs/webchat/components/typing-indicator.d.ts +1 -0
  187. package/lib/cjs/webchat/components/typing-indicator.js +14 -0
  188. package/lib/cjs/webchat/components/typing-indicator.js.map +1 -0
  189. package/lib/cjs/webchat/devices/device-adapter.d.ts +12 -0
  190. package/lib/cjs/webchat/devices/device-adapter.js +47 -0
  191. package/lib/cjs/webchat/devices/device-adapter.js.map +1 -0
  192. package/lib/cjs/webchat/devices/index.d.ts +11 -0
  193. package/lib/cjs/webchat/devices/index.js +23 -0
  194. package/lib/cjs/webchat/devices/index.js.map +1 -0
  195. package/lib/cjs/webchat/devices/scrollbar-controller.d.ts +12 -0
  196. package/lib/cjs/webchat/devices/scrollbar-controller.js +103 -0
  197. package/lib/cjs/webchat/devices/scrollbar-controller.js.map +1 -0
  198. package/lib/cjs/webchat/devices/webchat-resizer.d.ts +9 -0
  199. package/lib/cjs/webchat/devices/webchat-resizer.js +47 -0
  200. package/lib/cjs/webchat/devices/webchat-resizer.js.map +1 -0
  201. package/lib/cjs/webchat/header.d.ts +3 -0
  202. package/lib/cjs/webchat/header.js +95 -0
  203. package/lib/cjs/webchat/header.js.map +1 -0
  204. package/lib/cjs/webchat/hooks.d.ts +80 -0
  205. package/lib/cjs/webchat/hooks.js +218 -0
  206. package/lib/cjs/webchat/hooks.js.map +1 -0
  207. package/lib/cjs/webchat/index.d.ts +4 -0
  208. package/lib/cjs/webchat/index.js +17 -0
  209. package/lib/cjs/webchat/index.js.map +1 -0
  210. package/lib/cjs/webchat/message-list.d.ts +1 -0
  211. package/lib/cjs/webchat/message-list.js +46 -0
  212. package/lib/cjs/webchat/message-list.js.map +1 -0
  213. package/lib/cjs/webchat/messages-reducer.d.ts +1 -0
  214. package/lib/cjs/webchat/messages-reducer.js +58 -0
  215. package/lib/cjs/webchat/messages-reducer.js.map +1 -0
  216. package/lib/cjs/webchat/replies.d.ts +1 -0
  217. package/lib/cjs/webchat/replies.js +46 -0
  218. package/lib/cjs/webchat/replies.js.map +1 -0
  219. package/lib/cjs/webchat/session-view.d.ts +1 -0
  220. package/lib/cjs/webchat/session-view.js +124 -0
  221. package/lib/cjs/webchat/session-view.js.map +1 -0
  222. package/lib/cjs/webchat/use-storage-state-hook.d.ts +1 -0
  223. package/lib/cjs/webchat/use-storage-state-hook.js +32 -0
  224. package/lib/cjs/webchat/use-storage-state-hook.js.map +1 -0
  225. package/lib/cjs/webchat/webchat-dev.d.ts +7 -0
  226. package/lib/cjs/webchat/webchat-dev.js +64 -0
  227. package/lib/cjs/webchat/webchat-dev.js.map +1 -0
  228. package/lib/cjs/webchat/webchat-reducer.d.ts +1 -0
  229. package/lib/cjs/webchat/webchat-reducer.js +48 -0
  230. package/lib/cjs/webchat/webchat-reducer.js.map +1 -0
  231. package/lib/cjs/webchat/webchat.d.ts +3 -0
  232. package/lib/cjs/webchat/webchat.js +703 -0
  233. package/lib/cjs/webchat/webchat.js.map +1 -0
  234. package/lib/cjs/webchat/webview.d.ts +2 -0
  235. package/lib/cjs/webchat/webview.js +92 -0
  236. package/lib/cjs/webchat/webview.js.map +1 -0
  237. package/lib/cjs/webchat-app.d.ts +99 -0
  238. package/lib/cjs/webchat-app.js +269 -0
  239. package/lib/cjs/webchat-app.js.map +1 -0
  240. package/lib/cjs/webview.d.ts +9 -0
  241. package/lib/cjs/webview.js +102 -0
  242. package/lib/cjs/webview.js.map +1 -0
  243. package/package.json +3 -3
  244. package/lib/app.js +0 -19
  245. package/lib/app.js.map +0 -1
  246. package/lib/assets/attachment-icon.svg +0 -7
  247. package/lib/assets/audio.svg +0 -4
  248. package/lib/assets/botonic_react_logo100x100.png +0 -0
  249. package/lib/assets/document.svg +0 -3
  250. package/lib/assets/emojiButton.svg +0 -6
  251. package/lib/assets/image.svg +0 -4
  252. package/lib/assets/leftArrow.svg +0 -3
  253. package/lib/assets/menuButton.svg +0 -3
  254. package/lib/assets/rightArrow.svg +0 -3
  255. package/lib/assets/send-button.svg +0 -1
  256. package/lib/assets/video.svg +0 -3
  257. package/lib/botonic-tester.js +0 -224
  258. package/lib/botonic-tester.js.map +0 -1
  259. package/lib/components/audio.js +0 -48
  260. package/lib/components/audio.js.map +0 -1
  261. package/lib/components/button.js +0 -224
  262. package/lib/components/button.js.map +0 -1
  263. package/lib/components/buttons-disabler.js +0 -133
  264. package/lib/components/buttons-disabler.js.map +0 -1
  265. package/lib/components/carousel.js +0 -194
  266. package/lib/components/carousel.js.map +0 -1
  267. package/lib/components/components.js.map +0 -1
  268. package/lib/components/custom-message.js +0 -131
  269. package/lib/components/custom-message.js.map +0 -1
  270. package/lib/components/document.js +0 -76
  271. package/lib/components/document.js.map +0 -1
  272. package/lib/components/element.js +0 -69
  273. package/lib/components/element.js.map +0 -1
  274. package/lib/components/handoff.js +0 -69
  275. package/lib/components/handoff.js.map +0 -1
  276. package/lib/components/image.js +0 -91
  277. package/lib/components/image.js.map +0 -1
  278. package/lib/components/index.d.ts +0 -228
  279. package/lib/components/index.js +0 -193
  280. package/lib/components/index.js.map +0 -1
  281. package/lib/components/location.js +0 -69
  282. package/lib/components/location.js.map +0 -1
  283. package/lib/components/markdown.js +0 -108
  284. package/lib/components/markdown.js.map +0 -1
  285. package/lib/components/message-template.js +0 -36
  286. package/lib/components/message-template.js.map +0 -1
  287. package/lib/components/message.js +0 -351
  288. package/lib/components/message.js.map +0 -1
  289. package/lib/components/multichannel/facebook/facebook.js +0 -96
  290. package/lib/components/multichannel/facebook/facebook.js.map +0 -1
  291. package/lib/components/multichannel/index.d.ts +0 -65
  292. package/lib/components/multichannel/index.js +0 -46
  293. package/lib/components/multichannel/index.js.map +0 -1
  294. package/lib/components/multichannel/multichannel-button.js +0 -119
  295. package/lib/components/multichannel/multichannel-button.js.map +0 -1
  296. package/lib/components/multichannel/multichannel-carousel.js +0 -143
  297. package/lib/components/multichannel/multichannel-carousel.js.map +0 -1
  298. package/lib/components/multichannel/multichannel-context.js +0 -24
  299. package/lib/components/multichannel/multichannel-context.js.map +0 -1
  300. package/lib/components/multichannel/multichannel-reply.js +0 -46
  301. package/lib/components/multichannel/multichannel-reply.js.map +0 -1
  302. package/lib/components/multichannel/multichannel-text.js +0 -222
  303. package/lib/components/multichannel/multichannel-text.js.map +0 -1
  304. package/lib/components/multichannel/multichannel-utils.js +0 -126
  305. package/lib/components/multichannel/multichannel-utils.js.map +0 -1
  306. package/lib/components/multichannel/multichannel.js +0 -111
  307. package/lib/components/multichannel/multichannel.js.map +0 -1
  308. package/lib/components/pic.js +0 -50
  309. package/lib/components/pic.js.map +0 -1
  310. package/lib/components/raw.js +0 -70
  311. package/lib/components/raw.js.map +0 -1
  312. package/lib/components/reply.js +0 -107
  313. package/lib/components/reply.js.map +0 -1
  314. package/lib/components/share-button.js +0 -36
  315. package/lib/components/share-button.js.map +0 -1
  316. package/lib/components/subtitle.js +0 -54
  317. package/lib/components/subtitle.js.map +0 -1
  318. package/lib/components/text.js +0 -80
  319. package/lib/components/text.js.map +0 -1
  320. package/lib/components/timestamps.js +0 -69
  321. package/lib/components/timestamps.js.map +0 -1
  322. package/lib/components/title.js +0 -52
  323. package/lib/components/title.js.map +0 -1
  324. package/lib/components/video.js +0 -51
  325. package/lib/components/video.js.map +0 -1
  326. package/lib/components/webchat-settings.js +0 -118
  327. package/lib/components/webchat-settings.js.map +0 -1
  328. package/lib/components/whatsapp-template.js +0 -53
  329. package/lib/components/whatsapp-template.js.map +0 -1
  330. package/lib/constants.js +0 -203
  331. package/lib/constants.js.map +0 -1
  332. package/lib/contexts.js +0 -57
  333. package/lib/contexts.js.map +0 -1
  334. package/lib/dev-app.js +0 -241
  335. package/lib/dev-app.js.map +0 -1
  336. package/lib/index.d.ts +0 -238
  337. package/lib/index.js +0 -131
  338. package/lib/index.js.map +0 -1
  339. package/lib/message-utils.js +0 -149
  340. package/lib/message-utils.js.map +0 -1
  341. package/lib/msg-to-botonic.js +0 -199
  342. package/lib/msg-to-botonic.js.map +0 -1
  343. package/lib/node-app.js +0 -97
  344. package/lib/node-app.js.map +0 -1
  345. package/lib/react-bot.js +0 -167
  346. package/lib/react-bot.js.map +0 -1
  347. package/lib/util/dom.js +0 -84
  348. package/lib/util/dom.js.map +0 -1
  349. package/lib/util/environment.js +0 -42
  350. package/lib/util/environment.js.map +0 -1
  351. package/lib/util/error-boundary.js +0 -105
  352. package/lib/util/error-boundary.js.map +0 -1
  353. package/lib/util/index.d.ts +0 -9
  354. package/lib/util/index.js +0 -2
  355. package/lib/util/index.js.map +0 -1
  356. package/lib/util/logs.js +0 -28
  357. package/lib/util/logs.js.map +0 -1
  358. package/lib/util/objects.js +0 -60
  359. package/lib/util/objects.js.map +0 -1
  360. package/lib/util/react.js +0 -75
  361. package/lib/util/react.js.map +0 -1
  362. package/lib/util/regexs.js +0 -31
  363. package/lib/util/regexs.js.map +0 -1
  364. package/lib/util/webchat.js +0 -92
  365. package/lib/util/webchat.js.map +0 -1
  366. package/lib/webchat/actions.js +0 -53
  367. package/lib/webchat/actions.js.map +0 -1
  368. package/lib/webchat/components/attachment.js +0 -68
  369. package/lib/webchat/components/attachment.js.map +0 -1
  370. package/lib/webchat/components/common.js +0 -29
  371. package/lib/webchat/components/common.js.map +0 -1
  372. package/lib/webchat/components/conditional-animation.js +0 -42
  373. package/lib/webchat/components/conditional-animation.js.map +0 -1
  374. package/lib/webchat/components/emoji-picker.js +0 -89
  375. package/lib/webchat/components/emoji-picker.js.map +0 -1
  376. package/lib/webchat/components/persistent-menu.js +0 -104
  377. package/lib/webchat/components/persistent-menu.js.map +0 -1
  378. package/lib/webchat/components/send-button.js +0 -45
  379. package/lib/webchat/components/send-button.js.map +0 -1
  380. package/lib/webchat/components/styled-scrollbar.js +0 -55
  381. package/lib/webchat/components/styled-scrollbar.js.map +0 -1
  382. package/lib/webchat/components/styled-scrollbar.scss +0 -12
  383. package/lib/webchat/components/typing-indicator.js +0 -27
  384. package/lib/webchat/components/typing-indicator.js.map +0 -1
  385. package/lib/webchat/components/typing-indicator.scss +0 -38
  386. package/lib/webchat/devices/device-adapter.js +0 -82
  387. package/lib/webchat/devices/device-adapter.js.map +0 -1
  388. package/lib/webchat/devices/index.js +0 -32
  389. package/lib/webchat/devices/index.js.map +0 -1
  390. package/lib/webchat/devices/scrollbar-controller.js +0 -152
  391. package/lib/webchat/devices/scrollbar-controller.js.map +0 -1
  392. package/lib/webchat/devices/webchat-resizer.js +0 -76
  393. package/lib/webchat/devices/webchat-resizer.js.map +0 -1
  394. package/lib/webchat/header.js +0 -116
  395. package/lib/webchat/header.js.map +0 -1
  396. package/lib/webchat/hooks.js +0 -359
  397. package/lib/webchat/hooks.js.map +0 -1
  398. package/lib/webchat/index.d.ts +0 -62
  399. package/lib/webchat/index.js +0 -32
  400. package/lib/webchat/index.js.map +0 -1
  401. package/lib/webchat/message-list.js +0 -88
  402. package/lib/webchat/message-list.js.map +0 -1
  403. package/lib/webchat/messages-reducer.js +0 -93
  404. package/lib/webchat/messages-reducer.js.map +0 -1
  405. package/lib/webchat/replies.js +0 -78
  406. package/lib/webchat/replies.js.map +0 -1
  407. package/lib/webchat/session-view.js +0 -106
  408. package/lib/webchat/session-view.js.map +0 -1
  409. package/lib/webchat/use-storage-state-hook.js +0 -60
  410. package/lib/webchat/use-storage-state-hook.js.map +0 -1
  411. package/lib/webchat/webchat-dev.js +0 -109
  412. package/lib/webchat/webchat-dev.js.map +0 -1
  413. package/lib/webchat/webchat-reducer.js +0 -108
  414. package/lib/webchat/webchat-reducer.js.map +0 -1
  415. package/lib/webchat/webchat.js +0 -1108
  416. package/lib/webchat/webchat.js.map +0 -1
  417. package/lib/webchat/webview.js +0 -122
  418. package/lib/webchat/webview.js.map +0 -1
  419. package/lib/webchat-app.js +0 -660
  420. package/lib/webchat-app.js.map +0 -1
  421. package/lib/webchat.template.html +0 -37
  422. package/lib/webview.js +0 -231
  423. package/lib/webview.js.map +0 -1
  424. package/lib/webview.template.html +0 -39
@@ -1,69 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.Element = void 0;
9
-
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
-
14
- var _react = _interopRequireDefault(require("react"));
15
-
16
- var _styledComponents = _interopRequireDefault(require("styled-components"));
17
-
18
- var _constants = require("../constants");
19
-
20
- var _react2 = require("../util/react");
21
-
22
- var _templateObject;
23
-
24
- var ElementContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n width: ", "px;\n margin-right: ", "px;\n border-radius: 6px;\n border: 1px solid ", ";\n overflow: hidden;\n justify-content: space-between;\n"])), _constants.WEBCHAT.DEFAULTS.ELEMENT_WIDTH, _constants.WEBCHAT.DEFAULTS.ELEMENT_MARGIN_RIGHT, _constants.COLORS.SEASHELL_WHITE);
25
-
26
- var Element = function Element(props) {
27
- var renderBrowser = function renderBrowser() {
28
- return /*#__PURE__*/_react["default"].createElement(ElementContainer, null, props.children);
29
- };
30
-
31
- var renderNode = function renderNode() {
32
- return /*#__PURE__*/_react["default"].createElement("element", null, props.children);
33
- };
34
-
35
- return (0, _react2.renderComponent)({
36
- renderBrowser: renderBrowser,
37
- renderNode: renderNode
38
- });
39
- };
40
-
41
- exports.Element = Element;
42
-
43
- Element.serialize = function (elementProps) {
44
- var element = Object.assign.apply(Object, [{}].concat((0, _toConsumableArray2["default"])(elementProps.children.filter(function (c) {
45
- return c && c.type && c.type.name != 'Button';
46
- }).map(function (c) {
47
- return c.type.serialize && c.type.serialize(c.props);
48
- })))); // When we are serializer buttons from backend, we are receiving the data
49
- // as an array of buttons, so we have to keep robust with serve and deal with arrays
50
-
51
- element.buttons = (0, _toConsumableArray2["default"])(elementProps.children.filter(function (c) {
52
- if (c instanceof Array) return true;
53
- return c && c.type && c.type.name == 'Button';
54
- }).map(function (b) {
55
- if (b instanceof Array) {
56
- return b.map(function (bb) {
57
- return bb && bb.type && bb.type.serialize && bb.type.serialize(bb.props).button;
58
- });
59
- }
60
-
61
- return b && b.type && b.type.serialize && b.type.serialize(b.props).button;
62
- })); // When we have the buttons from backend, we have all buttons inside an array on the first position
63
- // of another array in element['buttons'] we want that element['buttons'] to be an array of buttons,
64
- // not an array of another array of buttons
65
-
66
- if (element.buttons[0] instanceof Array) element.buttons = element.buttons[0];
67
- return element;
68
- };
69
- //# sourceMappingURL=element.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/element.jsx"],"names":["ElementContainer","styled","div","WEBCHAT","DEFAULTS","ELEMENT_WIDTH","ELEMENT_MARGIN_RIGHT","COLORS","SEASHELL_WHITE","Element","props","renderBrowser","children","renderNode","serialize","elementProps","element","Object","assign","filter","c","type","name","map","buttons","Array","b","bb","button"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;AAEA,IAAMA,gBAAgB,GAAGC,6BAAOC,GAAV,2RAGXC,mBAAQC,QAAR,CAAiBC,aAHN,EAIJF,mBAAQC,QAAR,CAAiBE,oBAJb,EAMAC,kBAAOC,cANP,CAAtB;;AAWO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAAAC,KAAK,EAAI;AAC9B,MAAMC,aAAa,GAAG,SAAhBA,aAAgB;AAAA,wBACpB,gCAAC,gBAAD,QAAmBD,KAAK,CAACE,QAAzB,CADoB;AAAA,GAAtB;;AAIA,MAAMC,UAAU,GAAG,SAAbA,UAAa;AAAA,wBAAM,iDAAUH,KAAK,CAACE,QAAhB,CAAN;AAAA,GAAnB;;AAEA,SAAO,6BAAgB;AAAED,IAAAA,aAAa,EAAbA,aAAF;AAAiBE,IAAAA,UAAU,EAAVA;AAAjB,GAAhB,CAAP;AACD,CARM;;;;AAUPJ,OAAO,CAACK,SAAR,GAAoB,UAAAC,YAAY,EAAI;AAClC,MAAMC,OAAO,GAAGC,MAAM,CAACC,MAAP,OAAAD,MAAM,GACpB,EADoB,6CAEjBF,YAAY,CAACH,QAAb,CACAO,MADA,CACO,UAAAC,CAAC;AAAA,WAAIA,CAAC,IAAIA,CAAC,CAACC,IAAP,IAAeD,CAAC,CAACC,IAAF,CAAOC,IAAP,IAAe,QAAlC;AAAA,GADR,EAEAC,GAFA,CAEI,UAAAH,CAAC;AAAA,WAAIA,CAAC,CAACC,IAAF,CAAOP,SAAP,IAAoBM,CAAC,CAACC,IAAF,CAAOP,SAAP,CAAiBM,CAAC,CAACV,KAAnB,CAAxB;AAAA,GAFL,CAFiB,GAAtB,CADkC,CAOlC;AACA;;AACAM,EAAAA,OAAO,CAACQ,OAAR,uCACKT,YAAY,CAACH,QAAb,CACAO,MADA,CACO,UAAAC,CAAC,EAAI;AACX,QAAIA,CAAC,YAAYK,KAAjB,EAAwB,OAAO,IAAP;AACxB,WAAOL,CAAC,IAAIA,CAAC,CAACC,IAAP,IAAeD,CAAC,CAACC,IAAF,CAAOC,IAAP,IAAe,QAArC;AACD,GAJA,EAKAC,GALA,CAKI,UAAAG,CAAC,EAAI;AACR,QAAIA,CAAC,YAAYD,KAAjB,EAAwB;AACtB,aAAOC,CAAC,CAACH,GAAF,CACL,UAAAI,EAAE;AAAA,eACAA,EAAE,IACFA,EAAE,CAACN,IADH,IAEAM,EAAE,CAACN,IAAH,CAAQP,SAFR,IAGAa,EAAE,CAACN,IAAH,CAAQP,SAAR,CAAkBa,EAAE,CAACjB,KAArB,EAA4BkB,MAJ5B;AAAA,OADG,CAAP;AAOD;;AACD,WACEF,CAAC,IAAIA,CAAC,CAACL,IAAP,IAAeK,CAAC,CAACL,IAAF,CAAOP,SAAtB,IAAmCY,CAAC,CAACL,IAAF,CAAOP,SAAP,CAAiBY,CAAC,CAAChB,KAAnB,EAA0BkB,MAD/D;AAGD,GAlBA,CADL,EATkC,CA8BlC;AACA;AACA;;AACA,MAAIZ,OAAO,CAACQ,OAAR,CAAgB,CAAhB,aAA8BC,KAAlC,EAAyCT,OAAO,CAACQ,OAAR,GAAkBR,OAAO,CAACQ,OAAR,CAAgB,CAAhB,CAAlB;AACzC,SAAOR,OAAP;AACD,CAnCD","sourcesContent":["import React from 'react'\nimport styled from 'styled-components'\n\nimport { COLORS, WEBCHAT } from '../constants'\nimport { renderComponent } from '../util/react'\n\nconst ElementContainer = styled.div`\n display: flex;\n flex-direction: column;\n width: ${WEBCHAT.DEFAULTS.ELEMENT_WIDTH}px;\n margin-right: ${WEBCHAT.DEFAULTS.ELEMENT_MARGIN_RIGHT}px;\n border-radius: 6px;\n border: 1px solid ${COLORS.SEASHELL_WHITE};\n overflow: hidden;\n justify-content: space-between;\n`\n\nexport const Element = props => {\n const renderBrowser = () => (\n <ElementContainer>{props.children}</ElementContainer>\n )\n\n const renderNode = () => <element>{props.children}</element>\n\n return renderComponent({ renderBrowser, renderNode })\n}\n\nElement.serialize = elementProps => {\n const element = Object.assign(\n {},\n ...elementProps.children\n .filter(c => c && c.type && c.type.name != 'Button')\n .map(c => c.type.serialize && c.type.serialize(c.props))\n )\n // When we are serializer buttons from backend, we are receiving the data\n // as an array of buttons, so we have to keep robust with serve and deal with arrays\n element.buttons = [\n ...elementProps.children\n .filter(c => {\n if (c instanceof Array) return true\n return c && c.type && c.type.name == 'Button'\n })\n .map(b => {\n if (b instanceof Array) {\n return b.map(\n bb =>\n bb &&\n bb.type &&\n bb.type.serialize &&\n bb.type.serialize(bb.props).button\n )\n }\n return (\n b && b.type && b.type.serialize && b.type.serialize(b.props).button\n )\n }),\n ]\n // When we have the buttons from backend, we have all buttons inside an array on the first position\n // of another array in element['buttons'] we want that element['buttons'] to be an array of buttons,\n // not an array of another array of buttons\n if (element.buttons[0] instanceof Array) element.buttons = element.buttons[0]\n return element\n}\n"],"file":"element.js"}
@@ -1,69 +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.Handoff = void 0;
11
-
12
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
-
14
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
- var _react = _interopRequireWildcard(require("react"));
17
-
18
- var _styledComponents = _interopRequireDefault(require("styled-components"));
19
-
20
- var _constants = require("../constants");
21
-
22
- var _contexts = require("../contexts");
23
-
24
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
25
-
26
- 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); }
27
-
28
- 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; }
29
-
30
- var Container = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n font-family: inherit;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 24px;\n"])));
31
-
32
- var TransferredContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: center;\n white-space: normal;\n"])));
33
-
34
- var EndedContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: center;\n white-space: normal;\n"])));
35
-
36
- var StyledButton = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n max-width: 60%;\n padding: 12px 24px;\n background-color: ", ";\n border: none;\n border-radius: 4px;\n margin-top: 8px;\n cursor: pointer;\n"])), _constants.COLORS.SOLID_WHITE);
37
-
38
- var Handoff = function Handoff(props) {
39
- var _useContext = (0, _react.useContext)(_contexts.WebchatContext),
40
- resolveCase = _useContext.resolveCase;
41
-
42
- var _useState = (0, _react.useState)({
43
- showContinue: true
44
- }),
45
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
46
- state = _useState2[0],
47
- setState = _useState2[1];
48
-
49
- var continueClick = function continueClick() {
50
- setState({
51
- showContinue: false
52
- });
53
- resolveCase();
54
- };
55
-
56
- var bgColor = state.showContinue ? _constants.COLORS.FRINGY_FLOWER_GREEN : _constants.COLORS.TASMAN_GRAY;
57
- var fontColor = state.showContinue ? _constants.COLORS.APPLE_GREEN : _constants.COLORS.CACTUS_GREEN;
58
- return /*#__PURE__*/_react["default"].createElement(Container, {
59
- style: {
60
- color: fontColor,
61
- backgroundColor: bgColor
62
- }
63
- }, state.showContinue ? /*#__PURE__*/_react["default"].createElement(TransferredContainer, null, "Conversation transferred to a human agent...") : /*#__PURE__*/_react["default"].createElement(EndedContainer, null, "Human handoff ended"), state.showContinue && /*#__PURE__*/_react["default"].createElement(StyledButton, {
64
- onClick: continueClick
65
- }, "Continue"));
66
- };
67
-
68
- exports.Handoff = Handoff;
69
- //# sourceMappingURL=handoff.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/handoff.jsx"],"names":["Container","styled","div","TransferredContainer","EndedContainer","StyledButton","button","COLORS","SOLID_WHITE","Handoff","props","WebchatContext","resolveCase","showContinue","state","setState","continueClick","bgColor","FRINGY_FLOWER_GREEN","TASMAN_GRAY","fontColor","APPLE_GREEN","CACTUS_GREEN","color","backgroundColor"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;AAEA,IAAMA,SAAS,GAAGC,6BAAOC,GAAV,oOAAf;;AASA,IAAMC,oBAAoB,GAAGF,6BAAOC,GAAV,yIAA1B;;AAKA,IAAME,cAAc,GAAGH,6BAAOC,GAAV,yIAApB;;AAKA,IAAMG,YAAY,GAAGJ,6BAAOK,MAAV,gPAGIC,kBAAOC,WAHX,CAAlB;;AAUO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAAAC,KAAK,EAAI;AAC9B,oBAAwB,uBAAWC,wBAAX,CAAxB;AAAA,MAAQC,WAAR,eAAQA,WAAR;;AACA,kBAA0B,qBAAS;AAAEC,IAAAA,YAAY,EAAE;AAAhB,GAAT,CAA1B;AAAA;AAAA,MAAOC,KAAP;AAAA,MAAcC,QAAd;;AAEA,MAAMC,aAAa,GAAG,SAAhBA,aAAgB,GAAM;AAC1BD,IAAAA,QAAQ,CAAC;AAAEF,MAAAA,YAAY,EAAE;AAAhB,KAAD,CAAR;AACAD,IAAAA,WAAW;AACZ,GAHD;;AAKA,MAAMK,OAAO,GAAGH,KAAK,CAACD,YAAN,GACZN,kBAAOW,mBADK,GAEZX,kBAAOY,WAFX;AAGA,MAAMC,SAAS,GAAGN,KAAK,CAACD,YAAN,GACdN,kBAAOc,WADO,GAEdd,kBAAOe,YAFX;AAGA,sBACE,gCAAC,SAAD;AACE,IAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAEH,SADF;AAELI,MAAAA,eAAe,EAAEP;AAFZ;AADT,KAMGH,KAAK,CAACD,YAAN,gBACC,gCAAC,oBAAD,uDADD,gBAKC,gCAAC,cAAD,8BAXJ,EAaGC,KAAK,CAACD,YAAN,iBACC,gCAAC,YAAD;AAAc,IAAA,OAAO,EAAEG;AAAvB,gBAdJ,CADF;AAmBD,CAlCM","sourcesContent":["import React, { useContext, useState } from 'react'\nimport styled from 'styled-components'\n\nimport { COLORS } from '../constants'\nimport { WebchatContext } from '../contexts'\n\nconst Container = styled.div`\n display: flex;\n font-family: inherit;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 24px;\n`\n\nconst TransferredContainer = styled.div`\n text-align: center;\n white-space: normal;\n`\n\nconst EndedContainer = styled.div`\n text-align: center;\n white-space: normal;\n`\n\nconst StyledButton = styled.button`\n max-width: 60%;\n padding: 12px 24px;\n background-color: ${COLORS.SOLID_WHITE};\n border: none;\n border-radius: 4px;\n margin-top: 8px;\n cursor: pointer;\n`\n\nexport const Handoff = props => {\n const { resolveCase } = useContext(WebchatContext)\n const [state, setState] = useState({ showContinue: true })\n\n const continueClick = () => {\n setState({ showContinue: false })\n resolveCase()\n }\n\n const bgColor = state.showContinue\n ? COLORS.FRINGY_FLOWER_GREEN\n : COLORS.TASMAN_GRAY\n const fontColor = state.showContinue\n ? COLORS.APPLE_GREEN\n : COLORS.CACTUS_GREEN\n return (\n <Container\n style={{\n color: fontColor,\n backgroundColor: bgColor,\n }}\n >\n {state.showContinue ? (\n <TransferredContainer>\n Conversation transferred to a human agent...\n </TransferredContainer>\n ) : (\n <EndedContainer>Human handoff ended</EndedContainer>\n )}\n {state.showContinue && (\n <StyledButton onClick={continueClick}>Continue</StyledButton>\n )}\n </Container>\n )\n}\n"],"file":"handoff.js"}
@@ -1,91 +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.Image = void 0;
11
-
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
-
16
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
17
-
18
- var _core = require("@botonic/core");
19
-
20
- var _react = _interopRequireWildcard(require("react"));
21
-
22
- var _styledComponents = _interopRequireDefault(require("styled-components"));
23
-
24
- var _constants = require("../constants");
25
-
26
- var _contexts = require("../contexts");
27
-
28
- var _message = require("./message");
29
-
30
- var _templateObject;
31
-
32
- 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); }
33
-
34
- 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; }
35
-
36
- var StyledImage = _styledComponents["default"].img(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n border-radius: 8px;\n max-width: 150px;\n max-height: 150px;\n margin: -3px -6px;\n cursor: ", ";\n"])), function (_ref) {
37
- var hasPreviewer = _ref.hasPreviewer;
38
- return hasPreviewer ? 'pointer' : 'auto';
39
- });
40
-
41
- var serialize = function serialize(imageProps) {
42
- return {
43
- image: imageProps.src
44
- };
45
- };
46
-
47
- var Image = function Image(props) {
48
- var content = props.children;
49
-
50
- var _useState = (0, _react.useState)(false),
51
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
52
- isPreviewerOpened = _useState2[0],
53
- setIsPreviewerOpened = _useState2[1];
54
-
55
- var openPreviewer = function openPreviewer() {
56
- return setIsPreviewerOpened(true);
57
- };
58
-
59
- var closePreviewer = function closePreviewer() {
60
- return setIsPreviewerOpened(false);
61
- };
62
-
63
- var _useContext = (0, _react.useContext)(_contexts.WebchatContext),
64
- getThemeProperty = _useContext.getThemeProperty;
65
-
66
- var ImagePreviewer = getThemeProperty(_constants.WEBCHAT.CUSTOM_PROPERTIES.imagePreviewer, null);
67
-
68
- if ((0, _core.isBrowser)()) {
69
- content = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(StyledImage, {
70
- src: props.src,
71
- onClick: openPreviewer,
72
- hasPreviewer: Boolean(ImagePreviewer)
73
- }), ImagePreviewer && /*#__PURE__*/_react["default"].createElement(ImagePreviewer, {
74
- src: props.src,
75
- isPreviewerOpened: isPreviewerOpened,
76
- openPreviewer: openPreviewer,
77
- closePreviewer: closePreviewer
78
- }));
79
- }
80
-
81
- return /*#__PURE__*/_react["default"].createElement(_message.Message, (0, _extends2["default"])({
82
- role: _constants.ROLES.IMAGE_MESSAGE,
83
- json: serialize(props)
84
- }, props, {
85
- type: _core.INPUT.IMAGE
86
- }), content);
87
- };
88
-
89
- exports.Image = Image;
90
- Image.serialize = serialize;
91
- //# sourceMappingURL=image.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/image.jsx"],"names":["StyledImage","styled","img","hasPreviewer","serialize","imageProps","image","src","Image","props","content","children","isPreviewerOpened","setIsPreviewerOpened","openPreviewer","closePreviewer","WebchatContext","getThemeProperty","ImagePreviewer","WEBCHAT","CUSTOM_PROPERTIES","imagePreviewer","Boolean","ROLES","IMAGE_MESSAGE","INPUT","IMAGE"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,WAAW,GAAGC,6BAAOC,GAAV,kMAKL;AAAA,MAAGC,YAAH,QAAGA,YAAH;AAAA,SAAuBA,YAAY,GAAG,SAAH,GAAe,MAAlD;AAAA,CALK,CAAjB;;AAQA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAAAC,UAAU,EAAI;AAC9B,SAAO;AAAEC,IAAAA,KAAK,EAAED,UAAU,CAACE;AAApB,GAAP;AACD,CAFD;;AAIO,IAAMC,KAAK,GAAG,SAARA,KAAQ,CAAAC,KAAK,EAAI;AAC5B,MAAIC,OAAO,GAAGD,KAAK,CAACE,QAApB;;AAEA,kBAAkD,qBAAS,KAAT,CAAlD;AAAA;AAAA,MAAOC,iBAAP;AAAA,MAA0BC,oBAA1B;;AACA,MAAMC,aAAa,GAAG,SAAhBA,aAAgB;AAAA,WAAMD,oBAAoB,CAAC,IAAD,CAA1B;AAAA,GAAtB;;AACA,MAAME,cAAc,GAAG,SAAjBA,cAAiB;AAAA,WAAMF,oBAAoB,CAAC,KAAD,CAA1B;AAAA,GAAvB;;AAEA,oBAA6B,uBAAWG,wBAAX,CAA7B;AAAA,MAAQC,gBAAR,eAAQA,gBAAR;;AACA,MAAMC,cAAc,GAAGD,gBAAgB,CACrCE,mBAAQC,iBAAR,CAA0BC,cADW,EAErC,IAFqC,CAAvC;;AAIA,MAAI,sBAAJ,EAAiB;AACfX,IAAAA,OAAO,gBACL,+EACE,gCAAC,WAAD;AACE,MAAA,GAAG,EAAED,KAAK,CAACF,GADb;AAEE,MAAA,OAAO,EAAEO,aAFX;AAGE,MAAA,YAAY,EAAEQ,OAAO,CAACJ,cAAD;AAHvB,MADF,EAMGA,cAAc,iBACb,gCAAC,cAAD;AACE,MAAA,GAAG,EAAET,KAAK,CAACF,GADb;AAEE,MAAA,iBAAiB,EAAEK,iBAFrB;AAGE,MAAA,aAAa,EAAEE,aAHjB;AAIE,MAAA,cAAc,EAAEC;AAJlB,MAPJ,CADF;AAiBD;;AACD,sBACE,gCAAC,gBAAD;AACE,IAAA,IAAI,EAAEQ,iBAAMC,aADd;AAEE,IAAA,IAAI,EAAEpB,SAAS,CAACK,KAAD;AAFjB,KAGMA,KAHN;AAIE,IAAA,IAAI,EAAEgB,YAAMC;AAJd,MAMGhB,OANH,CADF;AAUD,CAzCM;;;AA2CPF,KAAK,CAACJ,SAAN,GAAkBA,SAAlB","sourcesContent":["import { INPUT, isBrowser } from '@botonic/core'\nimport React, { useContext, useState } from 'react'\nimport styled from 'styled-components'\n\nimport { ROLES, WEBCHAT } from '../constants'\nimport { WebchatContext } from '../contexts'\nimport { Message } from './message'\n\nconst StyledImage = styled.img`\n border-radius: 8px;\n max-width: 150px;\n max-height: 150px;\n margin: -3px -6px;\n cursor: ${({ hasPreviewer }) => (hasPreviewer ? 'pointer' : 'auto')};\n`\n\nconst serialize = imageProps => {\n return { image: imageProps.src }\n}\n\nexport const Image = props => {\n let content = props.children\n\n const [isPreviewerOpened, setIsPreviewerOpened] = useState(false)\n const openPreviewer = () => setIsPreviewerOpened(true)\n const closePreviewer = () => setIsPreviewerOpened(false)\n\n const { getThemeProperty } = useContext(WebchatContext)\n const ImagePreviewer = getThemeProperty(\n WEBCHAT.CUSTOM_PROPERTIES.imagePreviewer,\n null\n )\n if (isBrowser()) {\n content = (\n <>\n <StyledImage\n src={props.src}\n onClick={openPreviewer}\n hasPreviewer={Boolean(ImagePreviewer)}\n />\n {ImagePreviewer && (\n <ImagePreviewer\n src={props.src}\n isPreviewerOpened={isPreviewerOpened}\n openPreviewer={openPreviewer}\n closePreviewer={closePreviewer}\n />\n )}\n </>\n )\n }\n return (\n <Message\n role={ROLES.IMAGE_MESSAGE}\n json={serialize(props)}\n {...props}\n type={INPUT.IMAGE}\n >\n {content}\n </Message>\n )\n}\n\nImage.serialize = serialize\n"],"file":"image.js"}
@@ -1,228 +0,0 @@
1
- import * as React from 'react'
2
- import { ErrorInfo } from 'react'
3
-
4
- import { CoverComponentProps } from '../webchat'
5
-
6
- export type MessageType =
7
- | 'audio'
8
- | 'buttonmessage'
9
- | 'carousel'
10
- | 'custom'
11
- | 'document'
12
- | 'image'
13
- | 'location'
14
- | 'text'
15
- | 'video'
16
-
17
- export interface MessageProps {
18
- blob?: boolean
19
- children: React.ReactNode
20
- delay?: number
21
- enabletimestamps?: boolean
22
- from?: 'user' | 'bot'
23
- json?: Record<string, unknown>
24
- style?: Record<string, unknown>
25
- type?: MessageType
26
- typing?: number
27
- }
28
-
29
- export const Audio: React.FunctionComponent<MessageProps>
30
- export const Document: React.FunctionComponent<MessageProps>
31
-
32
- export const Message: React.FunctionComponent<MessageProps>
33
- export type Message = React.FunctionComponent<MessageProps>
34
- export const Video: React.FunctionComponent<MessageProps>
35
-
36
- export interface TextProps extends MessageProps {
37
- // converts markdown syntax to HTML
38
- markdown?: boolean
39
- }
40
- export const Text: React.FunctionComponent<TextProps>
41
-
42
- export interface Webview {
43
- name: string
44
- }
45
-
46
- export interface ButtonProps {
47
- params?: any
48
- path?: string
49
- payload?: string
50
- target?: string
51
- url?: string
52
- webview?: Webview
53
- onClick?: () => void
54
- autodisable?: boolean
55
- disabled?: boolean
56
- disabledstyle?: boolean
57
- }
58
-
59
- export const Button: React.FunctionComponent<ButtonProps>
60
-
61
- export interface ReplyProps {
62
- path?: string
63
- payload?: string
64
- children: string
65
- }
66
- export const Reply: React.FunctionComponent<ReplyProps>
67
- export type Reply = React.FunctionComponent<ReplyProps>
68
-
69
- export interface PicProps {
70
- src: string
71
- }
72
-
73
- export const Carousel: React.FunctionComponent<MessageProps>
74
- export const Image: React.FunctionComponent<ImageProps>
75
- export const Pic: React.FunctionComponent<PicProps>
76
- export type ImageProps = PicProps
77
-
78
- export interface TitleProps {
79
- children: React.ReactNode
80
- style: string
81
- }
82
-
83
- export const Element: React.FunctionComponent<MessageProps>
84
- export const Subtitle: React.FunctionComponent<SubtitleProps>
85
- export const Title: React.FunctionComponent<TitleProps>
86
- export type SubtitleProps = TitleProps
87
-
88
- type CustomProp = { custom?: React.ComponentType }
89
- type EnableProp = { enable?: boolean }
90
- type ImageProp = { image?: string } // https URL or imported Image asset
91
- type PersistentMenuCloseOption = { closeLabel: string }
92
- type PersistentMenuOption = { label: string } & ButtonProps
93
- type StyleProp = { style?: any }
94
-
95
- export type PersistentMenuTheme = (
96
- | PersistentMenuCloseOption
97
- | PersistentMenuOption
98
- )[]
99
-
100
- export interface PersistentMenuProps {
101
- onClick: () => void
102
- options: any
103
- }
104
-
105
- export type BlockInputOption = {
106
- preprocess?: (message: string) => string
107
- match: RegExp[]
108
- message: string
109
- }
110
-
111
- export interface BlobProps {
112
- blobTick?: boolean
113
- blobTickStyle?: any
114
- blobWidth?: string
115
- imageStyle?: any
116
- }
117
-
118
- export interface ScrollbarProps {
119
- autoHide?: boolean
120
- thumb?: {
121
- bgcolor?: string
122
- border?: string
123
- color?: string
124
- opacity?: string
125
- }
126
- track?: {
127
- bgcolor?: string
128
- border?: string
129
- color?: string
130
- }
131
- }
132
-
133
- export interface ThemeProps extends StyleProp {
134
- mobileBreakpoint?: number
135
- mobileStyle?: any
136
- webview?: StyleProp & { header?: StyleProp }
137
- animations?: EnableProp
138
- intro?: StyleProp & ImageProp & CustomProp
139
- brand?: { color?: string } & ImageProp
140
- header?: { title?: string; subtitle?: string } & ImageProp &
141
- StyleProp &
142
- CustomProp
143
- message?: {
144
- bot?: BlobProps & ImageProp & StyleProp
145
- user?: BlobProps & StyleProp
146
- customTypes?: React.ComponentType[]
147
- } & StyleProp & {
148
- timestamps?: {
149
- enable?: boolean
150
- format(): string
151
- } & StyleProp
152
- }
153
- button?: {
154
- autodisable?: boolean
155
- disabledstyle?: any
156
- hoverBackground?: string
157
- hoverTextColor?: string
158
- messageType?: 'text' | 'payload'
159
- } & StyleProp &
160
- CustomProp
161
- replies?: {
162
- align?: 'left' | 'center' | 'right'
163
- wrap?: 'wrap' | 'nowrap'
164
- }
165
- carousel?: {
166
- arrow?: {
167
- left: CustomProp
168
- right: CustomProp
169
- }
170
- enableArrows?: boolean
171
- }
172
- reply?: StyleProp & CustomProp
173
- triggerButton?: ImageProp & StyleProp & CustomProp
174
- markdownStyle?: string // string template with css styles
175
- scrollbar?: ScrollbarProps & EnableProp
176
- userInput?: {
177
- attachments?: EnableProp & CustomProp
178
- blockInputs?: BlockInputOption[]
179
- box?: { placeholder: string } & StyleProp
180
- emojiPicker?: EnableProp & CustomProp
181
- menu?: { darkBackground?: boolean } & {
182
- custom?: React.ComponentType<PersistentMenuProps>
183
- }
184
- menuButton?: CustomProp
185
- persistentMenu?: PersistentMenuTheme
186
- sendButton?: EnableProp & CustomProp
187
- } & EnableProp &
188
- StyleProp
189
- }
190
-
191
- export interface CoverComponentOptions {
192
- component: React.ComponentType<CoverComponentProps>
193
- props?: any
194
- }
195
-
196
- export interface WebchatSettingsProps {
197
- blockInputs?: BlockInputOption[]
198
- enableAnimations?: boolean
199
- enableAttachments?: boolean
200
- enableEmojiPicker?: boolean
201
- enableUserInput?: boolean
202
- persistentMenu?: PersistentMenuTheme
203
- theme?: ThemeProps
204
- }
205
- export const WebchatSettings: React.FunctionComponent<WebchatSettingsProps>
206
-
207
- export type WrappedComponent<Props> = React.FunctionComponent<Props> & {
208
- customTypeName: string
209
- }
210
-
211
- export class ErrorBoundary<Props> extends React.Component<Props> {
212
- componentDidCatch(error: Error, errorInfo: ErrorInfo): void
213
- }
214
-
215
- export function createErrorBoundary<Props>(_?: {
216
- errorComponent: React.ComponentType
217
- }): ErrorBoundary<Props>
218
-
219
- export function customMessage<Props>(_: {
220
- name: string
221
- component: React.ComponentType<Props>
222
- defaultProps?: Record<string, unknown>
223
- errorBoundary?: ErrorBoundary<Props>
224
- }): WrappedComponent<Props>
225
-
226
- export function getDisplayName(component: React.ComponentType): string
227
-
228
- export * from './multichannel'
@@ -1,193 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- Audio: true,
8
- Button: true,
9
- Carousel: true,
10
- customMessage: true,
11
- Document: true,
12
- Element: true,
13
- Image: true,
14
- Location: true,
15
- MessageTemplate: true,
16
- Pic: true,
17
- Raw: true,
18
- Reply: true,
19
- ShareButton: true,
20
- Subtitle: true,
21
- Text: true,
22
- Title: true,
23
- Video: true,
24
- WebchatSettings: true,
25
- WhatsappTemplate: true
26
- };
27
- Object.defineProperty(exports, "Audio", {
28
- enumerable: true,
29
- get: function get() {
30
- return _audio.Audio;
31
- }
32
- });
33
- Object.defineProperty(exports, "Button", {
34
- enumerable: true,
35
- get: function get() {
36
- return _button.Button;
37
- }
38
- });
39
- Object.defineProperty(exports, "Carousel", {
40
- enumerable: true,
41
- get: function get() {
42
- return _carousel.Carousel;
43
- }
44
- });
45
- Object.defineProperty(exports, "Document", {
46
- enumerable: true,
47
- get: function get() {
48
- return _document.Document;
49
- }
50
- });
51
- Object.defineProperty(exports, "Element", {
52
- enumerable: true,
53
- get: function get() {
54
- return _element.Element;
55
- }
56
- });
57
- Object.defineProperty(exports, "Image", {
58
- enumerable: true,
59
- get: function get() {
60
- return _image.Image;
61
- }
62
- });
63
- Object.defineProperty(exports, "Location", {
64
- enumerable: true,
65
- get: function get() {
66
- return _location.Location;
67
- }
68
- });
69
- Object.defineProperty(exports, "MessageTemplate", {
70
- enumerable: true,
71
- get: function get() {
72
- return _messageTemplate.MessageTemplate;
73
- }
74
- });
75
- Object.defineProperty(exports, "Pic", {
76
- enumerable: true,
77
- get: function get() {
78
- return _pic.Pic;
79
- }
80
- });
81
- Object.defineProperty(exports, "Raw", {
82
- enumerable: true,
83
- get: function get() {
84
- return _raw.Raw;
85
- }
86
- });
87
- Object.defineProperty(exports, "Reply", {
88
- enumerable: true,
89
- get: function get() {
90
- return _reply.Reply;
91
- }
92
- });
93
- Object.defineProperty(exports, "ShareButton", {
94
- enumerable: true,
95
- get: function get() {
96
- return _shareButton.ShareButton;
97
- }
98
- });
99
- Object.defineProperty(exports, "Subtitle", {
100
- enumerable: true,
101
- get: function get() {
102
- return _subtitle.Subtitle;
103
- }
104
- });
105
- Object.defineProperty(exports, "Text", {
106
- enumerable: true,
107
- get: function get() {
108
- return _text.Text;
109
- }
110
- });
111
- Object.defineProperty(exports, "Title", {
112
- enumerable: true,
113
- get: function get() {
114
- return _title.Title;
115
- }
116
- });
117
- Object.defineProperty(exports, "Video", {
118
- enumerable: true,
119
- get: function get() {
120
- return _video.Video;
121
- }
122
- });
123
- Object.defineProperty(exports, "WebchatSettings", {
124
- enumerable: true,
125
- get: function get() {
126
- return _webchatSettings.WebchatSettings;
127
- }
128
- });
129
- Object.defineProperty(exports, "WhatsappTemplate", {
130
- enumerable: true,
131
- get: function get() {
132
- return _whatsappTemplate.WhatsappTemplate;
133
- }
134
- });
135
- Object.defineProperty(exports, "customMessage", {
136
- enumerable: true,
137
- get: function get() {
138
- return _customMessage.customMessage;
139
- }
140
- });
141
-
142
- var _audio = require("./audio");
143
-
144
- var _button = require("./button");
145
-
146
- var _carousel = require("./carousel");
147
-
148
- var _customMessage = require("./custom-message");
149
-
150
- var _document = require("./document");
151
-
152
- var _element = require("./element");
153
-
154
- var _image = require("./image");
155
-
156
- var _location = require("./location");
157
-
158
- var _messageTemplate = require("./message-template");
159
-
160
- var _multichannel = require("./multichannel");
161
-
162
- Object.keys(_multichannel).forEach(function (key) {
163
- if (key === "default" || key === "__esModule") return;
164
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
165
- if (key in exports && exports[key] === _multichannel[key]) return;
166
- Object.defineProperty(exports, key, {
167
- enumerable: true,
168
- get: function get() {
169
- return _multichannel[key];
170
- }
171
- });
172
- });
173
-
174
- var _pic = require("./pic");
175
-
176
- var _raw = require("./raw");
177
-
178
- var _reply = require("./reply");
179
-
180
- var _shareButton = require("./share-button");
181
-
182
- var _subtitle = require("./subtitle");
183
-
184
- var _text = require("./text");
185
-
186
- var _title = require("./title");
187
-
188
- var _video = require("./video");
189
-
190
- var _webchatSettings = require("./webchat-settings");
191
-
192
- var _whatsappTemplate = require("./whatsapp-template");
193
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { Audio } from './audio'\nexport { Button } from './button'\nexport { Carousel } from './carousel'\nexport { customMessage } from './custom-message'\nexport { Document } from './document'\nexport { Element } from './element'\nexport { Image } from './image'\nexport { Location } from './location'\nexport { MessageTemplate } from './message-template'\nexport * from './multichannel'\nexport { Pic } from './pic'\nexport { Raw } from './raw'\nexport { Reply } from './reply'\nexport { ShareButton } from './share-button'\nexport { Subtitle } from './subtitle'\nexport { Text } from './text'\nexport { Title } from './title'\nexport { Video } from './video'\nexport { WebchatSettings } from './webchat-settings'\nexport { WhatsappTemplate } from './whatsapp-template'\n"],"file":"index.js"}