@botonic/react 0.30.0-alpha.1 → 0.30.0-alpha.2

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 (251) hide show
  1. package/lib/cjs/components/carousel.js +6 -3
  2. package/lib/cjs/components/carousel.js.map +1 -1
  3. package/lib/cjs/constants.d.ts +0 -6
  4. package/lib/cjs/constants.js +0 -6
  5. package/lib/cjs/constants.js.map +1 -1
  6. package/lib/cjs/contexts.d.ts +1 -1
  7. package/lib/cjs/contexts.js +9 -3
  8. package/lib/cjs/contexts.js.map +1 -1
  9. package/lib/cjs/index-types.d.ts +7 -1
  10. package/lib/cjs/index-types.js +0 -5
  11. package/lib/cjs/index-types.js.map +1 -1
  12. package/lib/cjs/node-app.d.ts +0 -5
  13. package/lib/cjs/node-app.js +0 -5
  14. package/lib/cjs/node-app.js.map +1 -1
  15. package/lib/cjs/util/dom.d.ts +0 -10
  16. package/lib/cjs/util/dom.js +3 -29
  17. package/lib/cjs/util/dom.js.map +1 -1
  18. package/lib/cjs/webchat/actions.d.ts +0 -1
  19. package/lib/cjs/webchat/actions.js +0 -1
  20. package/lib/cjs/webchat/actions.js.map +1 -1
  21. package/lib/cjs/webchat/constants.d.ts +8 -0
  22. package/lib/cjs/webchat/constants.js +13 -0
  23. package/lib/cjs/webchat/constants.js.map +1 -0
  24. package/lib/cjs/webchat/header.d.ts +2 -2
  25. package/lib/cjs/webchat/header.js +14 -13
  26. package/lib/cjs/webchat/header.js.map +1 -1
  27. package/lib/cjs/webchat/hooks/index.d.ts +6 -0
  28. package/lib/cjs/webchat/hooks/index.js +13 -1
  29. package/lib/cjs/webchat/hooks/index.js.map +1 -1
  30. package/lib/cjs/webchat/hooks/use-device-adapter.d.ts +3 -0
  31. package/lib/cjs/webchat/hooks/use-device-adapter.js +46 -0
  32. package/lib/cjs/webchat/hooks/use-device-adapter.js.map +1 -0
  33. package/lib/cjs/webchat/hooks/use-scroll-to-bottom.d.ts +7 -0
  34. package/lib/cjs/webchat/hooks/use-scroll-to-bottom.js +26 -0
  35. package/lib/cjs/webchat/hooks/use-scroll-to-bottom.js.map +1 -0
  36. package/lib/cjs/webchat/hooks/use-scrollbar-controller.d.ts +6 -0
  37. package/lib/cjs/webchat/hooks/use-scrollbar-controller.js +140 -0
  38. package/lib/cjs/webchat/hooks/use-scrollbar-controller.js.map +1 -0
  39. package/lib/cjs/webchat/hooks/use-virtual-keyboard-detection.d.ts +3 -0
  40. package/lib/cjs/webchat/hooks/use-virtual-keyboard-detection.js +28 -0
  41. package/lib/cjs/webchat/hooks/use-virtual-keyboard-detection.js.map +1 -0
  42. package/lib/cjs/webchat/hooks/use-webchat-dimensions.d.ts +4 -0
  43. package/lib/cjs/webchat/hooks/use-webchat-dimensions.js +39 -0
  44. package/lib/cjs/webchat/hooks/use-webchat-dimensions.js.map +1 -0
  45. package/lib/cjs/webchat/hooks/use-webchat-resizer.d.ts +4 -0
  46. package/lib/cjs/webchat/hooks/use-webchat-resizer.js +34 -0
  47. package/lib/cjs/webchat/hooks/use-webchat-resizer.js.map +1 -0
  48. package/lib/cjs/webchat/hooks/use-webchat.d.ts +6 -1
  49. package/lib/cjs/webchat/hooks/use-webchat.js +12 -8
  50. package/lib/cjs/webchat/hooks/use-webchat.js.map +1 -1
  51. package/lib/cjs/webchat/index-types.d.ts +0 -1
  52. package/lib/cjs/webchat/message-list/index.js +4 -9
  53. package/lib/cjs/webchat/message-list/index.js.map +1 -1
  54. package/lib/cjs/webchat/message-list/scroll-button.js.map +1 -1
  55. package/lib/cjs/webchat/message-list/styles.d.ts +1 -0
  56. package/lib/cjs/webchat/message-list/styles.js +10 -1
  57. package/lib/cjs/webchat/message-list/styles.js.map +1 -1
  58. package/lib/cjs/webchat/replies.js +8 -4
  59. package/lib/cjs/webchat/replies.js.map +1 -1
  60. package/lib/cjs/webchat/typing-indicator/index.d.ts +1 -0
  61. package/lib/cjs/webchat/typing-indicator/index.js +9 -0
  62. package/lib/cjs/webchat/typing-indicator/index.js.map +1 -0
  63. package/lib/cjs/webchat/typing-indicator/styles.d.ts +6 -0
  64. package/lib/cjs/webchat/typing-indicator/styles.js +47 -0
  65. package/lib/cjs/webchat/typing-indicator/styles.js.map +1 -0
  66. package/lib/cjs/webchat/webchat-chat-area/index.d.ts +1 -0
  67. package/lib/cjs/webchat/webchat-chat-area/index.js +22 -0
  68. package/lib/cjs/webchat/webchat-chat-area/index.js.map +1 -0
  69. package/lib/cjs/webchat/webchat-chat-area/styles.d.ts +3 -0
  70. package/lib/cjs/webchat/webchat-chat-area/styles.js +13 -0
  71. package/lib/cjs/webchat/webchat-chat-area/styles.js.map +1 -0
  72. package/lib/cjs/webchat/webchat-input-panel/index.d.ts +2 -3
  73. package/lib/cjs/webchat/webchat-input-panel/index.js +4 -3
  74. package/lib/cjs/webchat/webchat-input-panel/index.js.map +1 -1
  75. package/lib/cjs/webchat/webchat-input-panel/textarea.d.ts +2 -3
  76. package/lib/cjs/webchat/webchat-input-panel/textarea.js +5 -7
  77. package/lib/cjs/webchat/webchat-input-panel/textarea.js.map +1 -1
  78. package/lib/cjs/webchat/webchat-reducer.js +0 -2
  79. package/lib/cjs/webchat/webchat-reducer.js.map +1 -1
  80. package/lib/cjs/webchat/webchat.js +18 -18
  81. package/lib/cjs/webchat/webchat.js.map +1 -1
  82. package/lib/cjs/webchat/webview.js +13 -22
  83. package/lib/cjs/webchat/webview.js.map +1 -1
  84. package/lib/cjs/webchat-app.d.ts +1 -1
  85. package/lib/cjs/webchat-app.js +3 -1
  86. package/lib/cjs/webchat-app.js.map +1 -1
  87. package/lib/cjs/webview-app.js +11 -11
  88. package/lib/cjs/webview-app.js.map +1 -1
  89. package/lib/esm/components/carousel.js +6 -3
  90. package/lib/esm/components/carousel.js.map +1 -1
  91. package/lib/esm/constants.d.ts +0 -6
  92. package/lib/esm/constants.js +0 -6
  93. package/lib/esm/constants.js.map +1 -1
  94. package/lib/esm/contexts.d.ts +1 -1
  95. package/lib/esm/contexts.js +9 -3
  96. package/lib/esm/contexts.js.map +1 -1
  97. package/lib/esm/index-types.d.ts +7 -1
  98. package/lib/esm/index-types.js +0 -5
  99. package/lib/esm/index-types.js.map +1 -1
  100. package/lib/esm/node-app.d.ts +0 -5
  101. package/lib/esm/node-app.js +0 -5
  102. package/lib/esm/node-app.js.map +1 -1
  103. package/lib/esm/util/dom.d.ts +0 -10
  104. package/lib/esm/util/dom.js +2 -25
  105. package/lib/esm/util/dom.js.map +1 -1
  106. package/lib/esm/webchat/actions.d.ts +0 -1
  107. package/lib/esm/webchat/actions.js +0 -1
  108. package/lib/esm/webchat/actions.js.map +1 -1
  109. package/lib/esm/webchat/constants.d.ts +8 -0
  110. package/lib/esm/webchat/constants.js +10 -0
  111. package/lib/esm/webchat/constants.js.map +1 -0
  112. package/lib/esm/webchat/header.d.ts +2 -2
  113. package/lib/esm/webchat/header.js +14 -12
  114. package/lib/esm/webchat/header.js.map +1 -1
  115. package/lib/esm/webchat/hooks/index.d.ts +6 -0
  116. package/lib/esm/webchat/hooks/index.js +6 -0
  117. package/lib/esm/webchat/hooks/index.js.map +1 -1
  118. package/lib/esm/webchat/hooks/use-device-adapter.d.ts +3 -0
  119. package/lib/esm/webchat/hooks/use-device-adapter.js +42 -0
  120. package/lib/esm/webchat/hooks/use-device-adapter.js.map +1 -0
  121. package/lib/esm/webchat/hooks/use-scroll-to-bottom.d.ts +7 -0
  122. package/lib/esm/webchat/hooks/use-scroll-to-bottom.js +22 -0
  123. package/lib/esm/webchat/hooks/use-scroll-to-bottom.js.map +1 -0
  124. package/lib/esm/webchat/hooks/use-scrollbar-controller.d.ts +6 -0
  125. package/lib/esm/webchat/hooks/use-scrollbar-controller.js +136 -0
  126. package/lib/esm/webchat/hooks/use-scrollbar-controller.js.map +1 -0
  127. package/lib/esm/webchat/hooks/use-virtual-keyboard-detection.d.ts +3 -0
  128. package/lib/esm/webchat/hooks/use-virtual-keyboard-detection.js +24 -0
  129. package/lib/esm/webchat/hooks/use-virtual-keyboard-detection.js.map +1 -0
  130. package/lib/esm/webchat/hooks/use-webchat-dimensions.d.ts +4 -0
  131. package/lib/esm/webchat/hooks/use-webchat-dimensions.js +35 -0
  132. package/lib/esm/webchat/hooks/use-webchat-dimensions.js.map +1 -0
  133. package/lib/esm/webchat/hooks/use-webchat-resizer.d.ts +4 -0
  134. package/lib/esm/webchat/hooks/use-webchat-resizer.js +30 -0
  135. package/lib/esm/webchat/hooks/use-webchat-resizer.js.map +1 -0
  136. package/lib/esm/webchat/hooks/use-webchat.d.ts +6 -1
  137. package/lib/esm/webchat/hooks/use-webchat.js +13 -9
  138. package/lib/esm/webchat/hooks/use-webchat.js.map +1 -1
  139. package/lib/esm/webchat/index-types.d.ts +0 -1
  140. package/lib/esm/webchat/message-list/index.js +6 -11
  141. package/lib/esm/webchat/message-list/index.js.map +1 -1
  142. package/lib/esm/webchat/message-list/scroll-button.js.map +1 -1
  143. package/lib/esm/webchat/message-list/styles.d.ts +1 -0
  144. package/lib/esm/webchat/message-list/styles.js +9 -0
  145. package/lib/esm/webchat/message-list/styles.js.map +1 -1
  146. package/lib/esm/webchat/replies.js +8 -4
  147. package/lib/esm/webchat/replies.js.map +1 -1
  148. package/lib/esm/webchat/typing-indicator/index.d.ts +1 -0
  149. package/lib/esm/webchat/typing-indicator/index.js +5 -0
  150. package/lib/esm/webchat/typing-indicator/index.js.map +1 -0
  151. package/lib/esm/webchat/typing-indicator/styles.d.ts +6 -0
  152. package/lib/esm/webchat/typing-indicator/styles.js +43 -0
  153. package/lib/esm/webchat/typing-indicator/styles.js.map +1 -0
  154. package/lib/esm/webchat/webchat-chat-area/index.d.ts +1 -0
  155. package/lib/esm/webchat/webchat-chat-area/index.js +18 -0
  156. package/lib/esm/webchat/webchat-chat-area/index.js.map +1 -0
  157. package/lib/esm/webchat/webchat-chat-area/styles.d.ts +3 -0
  158. package/lib/esm/webchat/webchat-chat-area/styles.js +9 -0
  159. package/lib/esm/webchat/webchat-chat-area/styles.js.map +1 -0
  160. package/lib/esm/webchat/webchat-input-panel/index.d.ts +2 -3
  161. package/lib/esm/webchat/webchat-input-panel/index.js +4 -3
  162. package/lib/esm/webchat/webchat-input-panel/index.js.map +1 -1
  163. package/lib/esm/webchat/webchat-input-panel/textarea.d.ts +2 -3
  164. package/lib/esm/webchat/webchat-input-panel/textarea.js +5 -7
  165. package/lib/esm/webchat/webchat-input-panel/textarea.js.map +1 -1
  166. package/lib/esm/webchat/webchat-reducer.js +0 -2
  167. package/lib/esm/webchat/webchat-reducer.js.map +1 -1
  168. package/lib/esm/webchat/webchat.js +19 -19
  169. package/lib/esm/webchat/webchat.js.map +1 -1
  170. package/lib/esm/webchat/webview.js +14 -22
  171. package/lib/esm/webchat/webview.js.map +1 -1
  172. package/lib/esm/webchat-app.d.ts +1 -1
  173. package/lib/esm/webchat-app.js +3 -1
  174. package/lib/esm/webchat-app.js.map +1 -1
  175. package/lib/esm/webview-app.js +11 -11
  176. package/lib/esm/webview-app.js.map +1 -1
  177. package/package.json +3 -6
  178. package/src/components/carousel.jsx +8 -10
  179. package/src/constants.js +0 -6
  180. package/src/contexts.tsx +9 -3
  181. package/src/index-types.ts +7 -52
  182. package/src/node-app.jsx +0 -6
  183. package/src/util/dom.js +2 -35
  184. package/src/webchat/actions.ts +0 -1
  185. package/src/webchat/constants.ts +9 -0
  186. package/src/webchat/header.jsx +31 -20
  187. package/src/webchat/hooks/index.ts +6 -0
  188. package/src/webchat/hooks/use-device-adapter.ts +50 -0
  189. package/src/webchat/hooks/use-scroll-to-bottom.ts +29 -0
  190. package/src/webchat/hooks/use-scrollbar-controller.ts +159 -0
  191. package/src/webchat/hooks/use-virtual-keyboard-detection.ts +27 -0
  192. package/src/webchat/hooks/use-webchat-dimensions.ts +50 -0
  193. package/src/webchat/hooks/use-webchat-resizer.ts +43 -0
  194. package/src/webchat/hooks/use-webchat.ts +14 -10
  195. package/src/webchat/index-types.ts +0 -1
  196. package/src/webchat/message-list/index.tsx +9 -19
  197. package/src/webchat/message-list/scroll-button.tsx +1 -3
  198. package/src/webchat/message-list/styles.ts +10 -0
  199. package/src/webchat/replies.jsx +13 -11
  200. package/src/webchat/typing-indicator/index.tsx +16 -0
  201. package/src/webchat/typing-indicator/styles.ts +50 -0
  202. package/src/webchat/webchat-chat-area/index.tsx +35 -0
  203. package/src/webchat/webchat-chat-area/styles.ts +9 -0
  204. package/src/webchat/webchat-input-panel/index.tsx +7 -4
  205. package/src/webchat/webchat-input-panel/textarea.tsx +7 -11
  206. package/src/webchat/webchat-reducer.ts +0 -2
  207. package/src/webchat/webchat.jsx +27 -20
  208. package/src/webchat/webview.jsx +14 -23
  209. package/src/webchat-app.jsx +2 -2
  210. package/src/webview-app.tsx +16 -11
  211. package/lib/cjs/webchat/components/styled-scrollbar.d.ts +0 -2
  212. package/lib/cjs/webchat/components/styled-scrollbar.js +0 -54
  213. package/lib/cjs/webchat/components/styled-scrollbar.js.map +0 -1
  214. package/lib/cjs/webchat/components/styled-scrollbar.scss +0 -12
  215. package/lib/cjs/webchat/components/typing-indicator.d.ts +0 -1
  216. package/lib/cjs/webchat/components/typing-indicator.js +0 -11
  217. package/lib/cjs/webchat/components/typing-indicator.js.map +0 -1
  218. package/lib/cjs/webchat/components/typing-indicator.scss +0 -38
  219. package/lib/cjs/webchat/devices/device-adapter.d.ts +0 -12
  220. package/lib/cjs/webchat/devices/device-adapter.js +0 -44
  221. package/lib/cjs/webchat/devices/device-adapter.js.map +0 -1
  222. package/lib/cjs/webchat/devices/scrollbar-controller.d.ts +0 -12
  223. package/lib/cjs/webchat/devices/scrollbar-controller.js +0 -103
  224. package/lib/cjs/webchat/devices/scrollbar-controller.js.map +0 -1
  225. package/lib/cjs/webchat/devices/webchat-resizer.d.ts +0 -9
  226. package/lib/cjs/webchat/devices/webchat-resizer.js +0 -47
  227. package/lib/cjs/webchat/devices/webchat-resizer.js.map +0 -1
  228. package/lib/esm/webchat/components/styled-scrollbar.d.ts +0 -2
  229. package/lib/esm/webchat/components/styled-scrollbar.js +0 -50
  230. package/lib/esm/webchat/components/styled-scrollbar.js.map +0 -1
  231. package/lib/esm/webchat/components/styled-scrollbar.scss +0 -12
  232. package/lib/esm/webchat/components/typing-indicator.d.ts +0 -1
  233. package/lib/esm/webchat/components/typing-indicator.js +0 -6
  234. package/lib/esm/webchat/components/typing-indicator.js.map +0 -1
  235. package/lib/esm/webchat/components/typing-indicator.scss +0 -38
  236. package/lib/esm/webchat/devices/device-adapter.d.ts +0 -12
  237. package/lib/esm/webchat/devices/device-adapter.js +0 -40
  238. package/lib/esm/webchat/devices/device-adapter.js.map +0 -1
  239. package/lib/esm/webchat/devices/scrollbar-controller.d.ts +0 -12
  240. package/lib/esm/webchat/devices/scrollbar-controller.js +0 -99
  241. package/lib/esm/webchat/devices/scrollbar-controller.js.map +0 -1
  242. package/lib/esm/webchat/devices/webchat-resizer.d.ts +0 -9
  243. package/lib/esm/webchat/devices/webchat-resizer.js +0 -43
  244. package/lib/esm/webchat/devices/webchat-resizer.js.map +0 -1
  245. package/src/webchat/components/styled-scrollbar.jsx +0 -60
  246. package/src/webchat/components/styled-scrollbar.scss +0 -12
  247. package/src/webchat/components/typing-indicator.jsx +0 -17
  248. package/src/webchat/components/typing-indicator.scss +0 -38
  249. package/src/webchat/devices/device-adapter.js +0 -43
  250. package/src/webchat/devices/scrollbar-controller.js +0 -107
  251. package/src/webchat/devices/webchat-resizer.js +0 -45
@@ -1,45 +0,0 @@
1
- import { getWebchatElement, scrollToBottom } from '../../util/dom'
2
- import { DEVICES } from '.'
3
-
4
- export class WebchatResizer {
5
- constructor(currentDevice, host) {
6
- this.currentDevice = currentDevice
7
- this.host = host
8
- this.webchat = getWebchatElement(host)
9
- }
10
-
11
- onFocus(onKeyboardShownFn) {
12
- if (this.currentDevice !== DEVICES.MOBILE.IPHONE) return
13
- /*
14
- Based on Tip #4 from https://blog.opendigerati.com/the-eccentric-ways-of-ios-safari-with-the-keyboard-b5aa3f34228d,
15
- taking window.innerHeight as the amount of pixels the virtual keyboard adds
16
- */
17
- const waitUntilKeyboardIsShown = 400
18
- const calculateNewWebchatElementHeight = () => {
19
- const webchatHeight = this.webchat.clientHeight
20
- // Some iOS versions keep track of this height with VisualViewport API: https://stackoverflow.com/a/59056851
21
- const keyboardOffset =
22
- (window.visualViewport && window.visualViewport.height) ||
23
- window.innerHeight
24
- let newWebchatPercentualHeight = keyboardOffset / webchatHeight
25
- const toTwoDecimal = toRound => Math.round(toRound * 100) / 100
26
- newWebchatPercentualHeight =
27
- toTwoDecimal(newWebchatPercentualHeight) * 100
28
- return newWebchatPercentualHeight
29
- }
30
- setTimeout(() => {
31
- this.setWebchatElementHeight(`${calculateNewWebchatElementHeight()}%`)
32
- // scrollToBottom(this.host)
33
- onKeyboardShownFn()
34
- }, waitUntilKeyboardIsShown)
35
- }
36
-
37
- onBlur() {
38
- if (this.currentDevice !== DEVICES.MOBILE.IPHONE) return
39
- this.setWebchatElementHeight('100%')
40
- }
41
-
42
- setWebchatElementHeight(newHeight) {
43
- this.webchat.style.height = newHeight
44
- }
45
- }