@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.
- package/lib/cjs/components/carousel.js +6 -3
- package/lib/cjs/components/carousel.js.map +1 -1
- package/lib/cjs/constants.d.ts +0 -6
- package/lib/cjs/constants.js +0 -6
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/contexts.d.ts +1 -1
- package/lib/cjs/contexts.js +9 -3
- package/lib/cjs/contexts.js.map +1 -1
- package/lib/cjs/index-types.d.ts +7 -1
- package/lib/cjs/index-types.js +0 -5
- package/lib/cjs/index-types.js.map +1 -1
- package/lib/cjs/node-app.d.ts +0 -5
- package/lib/cjs/node-app.js +0 -5
- package/lib/cjs/node-app.js.map +1 -1
- package/lib/cjs/util/dom.d.ts +0 -10
- package/lib/cjs/util/dom.js +3 -29
- package/lib/cjs/util/dom.js.map +1 -1
- package/lib/cjs/webchat/actions.d.ts +0 -1
- package/lib/cjs/webchat/actions.js +0 -1
- package/lib/cjs/webchat/actions.js.map +1 -1
- package/lib/cjs/webchat/constants.d.ts +8 -0
- package/lib/cjs/webchat/constants.js +13 -0
- package/lib/cjs/webchat/constants.js.map +1 -0
- package/lib/cjs/webchat/header.d.ts +2 -2
- package/lib/cjs/webchat/header.js +14 -13
- package/lib/cjs/webchat/header.js.map +1 -1
- package/lib/cjs/webchat/hooks/index.d.ts +6 -0
- package/lib/cjs/webchat/hooks/index.js +13 -1
- package/lib/cjs/webchat/hooks/index.js.map +1 -1
- package/lib/cjs/webchat/hooks/use-device-adapter.d.ts +3 -0
- package/lib/cjs/webchat/hooks/use-device-adapter.js +46 -0
- package/lib/cjs/webchat/hooks/use-device-adapter.js.map +1 -0
- package/lib/cjs/webchat/hooks/use-scroll-to-bottom.d.ts +7 -0
- package/lib/cjs/webchat/hooks/use-scroll-to-bottom.js +26 -0
- package/lib/cjs/webchat/hooks/use-scroll-to-bottom.js.map +1 -0
- package/lib/cjs/webchat/hooks/use-scrollbar-controller.d.ts +6 -0
- package/lib/cjs/webchat/hooks/use-scrollbar-controller.js +140 -0
- package/lib/cjs/webchat/hooks/use-scrollbar-controller.js.map +1 -0
- package/lib/cjs/webchat/hooks/use-virtual-keyboard-detection.d.ts +3 -0
- package/lib/cjs/webchat/hooks/use-virtual-keyboard-detection.js +28 -0
- package/lib/cjs/webchat/hooks/use-virtual-keyboard-detection.js.map +1 -0
- package/lib/cjs/webchat/hooks/use-webchat-dimensions.d.ts +4 -0
- package/lib/cjs/webchat/hooks/use-webchat-dimensions.js +39 -0
- package/lib/cjs/webchat/hooks/use-webchat-dimensions.js.map +1 -0
- package/lib/cjs/webchat/hooks/use-webchat-resizer.d.ts +4 -0
- package/lib/cjs/webchat/hooks/use-webchat-resizer.js +34 -0
- package/lib/cjs/webchat/hooks/use-webchat-resizer.js.map +1 -0
- package/lib/cjs/webchat/hooks/use-webchat.d.ts +6 -1
- package/lib/cjs/webchat/hooks/use-webchat.js +12 -8
- package/lib/cjs/webchat/hooks/use-webchat.js.map +1 -1
- package/lib/cjs/webchat/index-types.d.ts +0 -1
- package/lib/cjs/webchat/message-list/index.js +4 -9
- package/lib/cjs/webchat/message-list/index.js.map +1 -1
- package/lib/cjs/webchat/message-list/scroll-button.js.map +1 -1
- package/lib/cjs/webchat/message-list/styles.d.ts +1 -0
- package/lib/cjs/webchat/message-list/styles.js +10 -1
- package/lib/cjs/webchat/message-list/styles.js.map +1 -1
- package/lib/cjs/webchat/replies.js +8 -4
- package/lib/cjs/webchat/replies.js.map +1 -1
- package/lib/cjs/webchat/typing-indicator/index.d.ts +1 -0
- package/lib/cjs/webchat/typing-indicator/index.js +9 -0
- package/lib/cjs/webchat/typing-indicator/index.js.map +1 -0
- package/lib/cjs/webchat/typing-indicator/styles.d.ts +6 -0
- package/lib/cjs/webchat/typing-indicator/styles.js +47 -0
- package/lib/cjs/webchat/typing-indicator/styles.js.map +1 -0
- package/lib/cjs/webchat/webchat-chat-area/index.d.ts +1 -0
- package/lib/cjs/webchat/webchat-chat-area/index.js +22 -0
- package/lib/cjs/webchat/webchat-chat-area/index.js.map +1 -0
- package/lib/cjs/webchat/webchat-chat-area/styles.d.ts +3 -0
- package/lib/cjs/webchat/webchat-chat-area/styles.js +13 -0
- package/lib/cjs/webchat/webchat-chat-area/styles.js.map +1 -0
- package/lib/cjs/webchat/webchat-input-panel/index.d.ts +2 -3
- package/lib/cjs/webchat/webchat-input-panel/index.js +4 -3
- package/lib/cjs/webchat/webchat-input-panel/index.js.map +1 -1
- package/lib/cjs/webchat/webchat-input-panel/textarea.d.ts +2 -3
- package/lib/cjs/webchat/webchat-input-panel/textarea.js +5 -7
- package/lib/cjs/webchat/webchat-input-panel/textarea.js.map +1 -1
- package/lib/cjs/webchat/webchat-reducer.js +0 -2
- package/lib/cjs/webchat/webchat-reducer.js.map +1 -1
- package/lib/cjs/webchat/webchat.js +18 -18
- package/lib/cjs/webchat/webchat.js.map +1 -1
- package/lib/cjs/webchat/webview.js +13 -22
- package/lib/cjs/webchat/webview.js.map +1 -1
- package/lib/cjs/webchat-app.d.ts +1 -1
- package/lib/cjs/webchat-app.js +3 -1
- package/lib/cjs/webchat-app.js.map +1 -1
- package/lib/cjs/webview-app.js +11 -11
- package/lib/cjs/webview-app.js.map +1 -1
- package/lib/esm/components/carousel.js +6 -3
- package/lib/esm/components/carousel.js.map +1 -1
- package/lib/esm/constants.d.ts +0 -6
- package/lib/esm/constants.js +0 -6
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/contexts.d.ts +1 -1
- package/lib/esm/contexts.js +9 -3
- package/lib/esm/contexts.js.map +1 -1
- package/lib/esm/index-types.d.ts +7 -1
- package/lib/esm/index-types.js +0 -5
- package/lib/esm/index-types.js.map +1 -1
- package/lib/esm/node-app.d.ts +0 -5
- package/lib/esm/node-app.js +0 -5
- package/lib/esm/node-app.js.map +1 -1
- package/lib/esm/util/dom.d.ts +0 -10
- package/lib/esm/util/dom.js +2 -25
- package/lib/esm/util/dom.js.map +1 -1
- package/lib/esm/webchat/actions.d.ts +0 -1
- package/lib/esm/webchat/actions.js +0 -1
- package/lib/esm/webchat/actions.js.map +1 -1
- package/lib/esm/webchat/constants.d.ts +8 -0
- package/lib/esm/webchat/constants.js +10 -0
- package/lib/esm/webchat/constants.js.map +1 -0
- package/lib/esm/webchat/header.d.ts +2 -2
- package/lib/esm/webchat/header.js +14 -12
- package/lib/esm/webchat/header.js.map +1 -1
- package/lib/esm/webchat/hooks/index.d.ts +6 -0
- package/lib/esm/webchat/hooks/index.js +6 -0
- package/lib/esm/webchat/hooks/index.js.map +1 -1
- package/lib/esm/webchat/hooks/use-device-adapter.d.ts +3 -0
- package/lib/esm/webchat/hooks/use-device-adapter.js +42 -0
- package/lib/esm/webchat/hooks/use-device-adapter.js.map +1 -0
- package/lib/esm/webchat/hooks/use-scroll-to-bottom.d.ts +7 -0
- package/lib/esm/webchat/hooks/use-scroll-to-bottom.js +22 -0
- package/lib/esm/webchat/hooks/use-scroll-to-bottom.js.map +1 -0
- package/lib/esm/webchat/hooks/use-scrollbar-controller.d.ts +6 -0
- package/lib/esm/webchat/hooks/use-scrollbar-controller.js +136 -0
- package/lib/esm/webchat/hooks/use-scrollbar-controller.js.map +1 -0
- package/lib/esm/webchat/hooks/use-virtual-keyboard-detection.d.ts +3 -0
- package/lib/esm/webchat/hooks/use-virtual-keyboard-detection.js +24 -0
- package/lib/esm/webchat/hooks/use-virtual-keyboard-detection.js.map +1 -0
- package/lib/esm/webchat/hooks/use-webchat-dimensions.d.ts +4 -0
- package/lib/esm/webchat/hooks/use-webchat-dimensions.js +35 -0
- package/lib/esm/webchat/hooks/use-webchat-dimensions.js.map +1 -0
- package/lib/esm/webchat/hooks/use-webchat-resizer.d.ts +4 -0
- package/lib/esm/webchat/hooks/use-webchat-resizer.js +30 -0
- package/lib/esm/webchat/hooks/use-webchat-resizer.js.map +1 -0
- package/lib/esm/webchat/hooks/use-webchat.d.ts +6 -1
- package/lib/esm/webchat/hooks/use-webchat.js +13 -9
- package/lib/esm/webchat/hooks/use-webchat.js.map +1 -1
- package/lib/esm/webchat/index-types.d.ts +0 -1
- package/lib/esm/webchat/message-list/index.js +6 -11
- package/lib/esm/webchat/message-list/index.js.map +1 -1
- package/lib/esm/webchat/message-list/scroll-button.js.map +1 -1
- package/lib/esm/webchat/message-list/styles.d.ts +1 -0
- package/lib/esm/webchat/message-list/styles.js +9 -0
- package/lib/esm/webchat/message-list/styles.js.map +1 -1
- package/lib/esm/webchat/replies.js +8 -4
- package/lib/esm/webchat/replies.js.map +1 -1
- package/lib/esm/webchat/typing-indicator/index.d.ts +1 -0
- package/lib/esm/webchat/typing-indicator/index.js +5 -0
- package/lib/esm/webchat/typing-indicator/index.js.map +1 -0
- package/lib/esm/webchat/typing-indicator/styles.d.ts +6 -0
- package/lib/esm/webchat/typing-indicator/styles.js +43 -0
- package/lib/esm/webchat/typing-indicator/styles.js.map +1 -0
- package/lib/esm/webchat/webchat-chat-area/index.d.ts +1 -0
- package/lib/esm/webchat/webchat-chat-area/index.js +18 -0
- package/lib/esm/webchat/webchat-chat-area/index.js.map +1 -0
- package/lib/esm/webchat/webchat-chat-area/styles.d.ts +3 -0
- package/lib/esm/webchat/webchat-chat-area/styles.js +9 -0
- package/lib/esm/webchat/webchat-chat-area/styles.js.map +1 -0
- package/lib/esm/webchat/webchat-input-panel/index.d.ts +2 -3
- package/lib/esm/webchat/webchat-input-panel/index.js +4 -3
- package/lib/esm/webchat/webchat-input-panel/index.js.map +1 -1
- package/lib/esm/webchat/webchat-input-panel/textarea.d.ts +2 -3
- package/lib/esm/webchat/webchat-input-panel/textarea.js +5 -7
- package/lib/esm/webchat/webchat-input-panel/textarea.js.map +1 -1
- package/lib/esm/webchat/webchat-reducer.js +0 -2
- package/lib/esm/webchat/webchat-reducer.js.map +1 -1
- package/lib/esm/webchat/webchat.js +19 -19
- package/lib/esm/webchat/webchat.js.map +1 -1
- package/lib/esm/webchat/webview.js +14 -22
- package/lib/esm/webchat/webview.js.map +1 -1
- package/lib/esm/webchat-app.d.ts +1 -1
- package/lib/esm/webchat-app.js +3 -1
- package/lib/esm/webchat-app.js.map +1 -1
- package/lib/esm/webview-app.js +11 -11
- package/lib/esm/webview-app.js.map +1 -1
- package/package.json +3 -6
- package/src/components/carousel.jsx +8 -10
- package/src/constants.js +0 -6
- package/src/contexts.tsx +9 -3
- package/src/index-types.ts +7 -52
- package/src/node-app.jsx +0 -6
- package/src/util/dom.js +2 -35
- package/src/webchat/actions.ts +0 -1
- package/src/webchat/constants.ts +9 -0
- package/src/webchat/header.jsx +31 -20
- package/src/webchat/hooks/index.ts +6 -0
- package/src/webchat/hooks/use-device-adapter.ts +50 -0
- package/src/webchat/hooks/use-scroll-to-bottom.ts +29 -0
- package/src/webchat/hooks/use-scrollbar-controller.ts +159 -0
- package/src/webchat/hooks/use-virtual-keyboard-detection.ts +27 -0
- package/src/webchat/hooks/use-webchat-dimensions.ts +50 -0
- package/src/webchat/hooks/use-webchat-resizer.ts +43 -0
- package/src/webchat/hooks/use-webchat.ts +14 -10
- package/src/webchat/index-types.ts +0 -1
- package/src/webchat/message-list/index.tsx +9 -19
- package/src/webchat/message-list/scroll-button.tsx +1 -3
- package/src/webchat/message-list/styles.ts +10 -0
- package/src/webchat/replies.jsx +13 -11
- package/src/webchat/typing-indicator/index.tsx +16 -0
- package/src/webchat/typing-indicator/styles.ts +50 -0
- package/src/webchat/webchat-chat-area/index.tsx +35 -0
- package/src/webchat/webchat-chat-area/styles.ts +9 -0
- package/src/webchat/webchat-input-panel/index.tsx +7 -4
- package/src/webchat/webchat-input-panel/textarea.tsx +7 -11
- package/src/webchat/webchat-reducer.ts +0 -2
- package/src/webchat/webchat.jsx +27 -20
- package/src/webchat/webview.jsx +14 -23
- package/src/webchat-app.jsx +2 -2
- package/src/webview-app.tsx +16 -11
- package/lib/cjs/webchat/components/styled-scrollbar.d.ts +0 -2
- package/lib/cjs/webchat/components/styled-scrollbar.js +0 -54
- package/lib/cjs/webchat/components/styled-scrollbar.js.map +0 -1
- package/lib/cjs/webchat/components/styled-scrollbar.scss +0 -12
- package/lib/cjs/webchat/components/typing-indicator.d.ts +0 -1
- package/lib/cjs/webchat/components/typing-indicator.js +0 -11
- package/lib/cjs/webchat/components/typing-indicator.js.map +0 -1
- package/lib/cjs/webchat/components/typing-indicator.scss +0 -38
- package/lib/cjs/webchat/devices/device-adapter.d.ts +0 -12
- package/lib/cjs/webchat/devices/device-adapter.js +0 -44
- package/lib/cjs/webchat/devices/device-adapter.js.map +0 -1
- package/lib/cjs/webchat/devices/scrollbar-controller.d.ts +0 -12
- package/lib/cjs/webchat/devices/scrollbar-controller.js +0 -103
- package/lib/cjs/webchat/devices/scrollbar-controller.js.map +0 -1
- package/lib/cjs/webchat/devices/webchat-resizer.d.ts +0 -9
- package/lib/cjs/webchat/devices/webchat-resizer.js +0 -47
- package/lib/cjs/webchat/devices/webchat-resizer.js.map +0 -1
- package/lib/esm/webchat/components/styled-scrollbar.d.ts +0 -2
- package/lib/esm/webchat/components/styled-scrollbar.js +0 -50
- package/lib/esm/webchat/components/styled-scrollbar.js.map +0 -1
- package/lib/esm/webchat/components/styled-scrollbar.scss +0 -12
- package/lib/esm/webchat/components/typing-indicator.d.ts +0 -1
- package/lib/esm/webchat/components/typing-indicator.js +0 -6
- package/lib/esm/webchat/components/typing-indicator.js.map +0 -1
- package/lib/esm/webchat/components/typing-indicator.scss +0 -38
- package/lib/esm/webchat/devices/device-adapter.d.ts +0 -12
- package/lib/esm/webchat/devices/device-adapter.js +0 -40
- package/lib/esm/webchat/devices/device-adapter.js.map +0 -1
- package/lib/esm/webchat/devices/scrollbar-controller.d.ts +0 -12
- package/lib/esm/webchat/devices/scrollbar-controller.js +0 -99
- package/lib/esm/webchat/devices/scrollbar-controller.js.map +0 -1
- package/lib/esm/webchat/devices/webchat-resizer.d.ts +0 -9
- package/lib/esm/webchat/devices/webchat-resizer.js +0 -43
- package/lib/esm/webchat/devices/webchat-resizer.js.map +0 -1
- package/src/webchat/components/styled-scrollbar.jsx +0 -60
- package/src/webchat/components/styled-scrollbar.scss +0 -12
- package/src/webchat/components/typing-indicator.jsx +0 -17
- package/src/webchat/components/typing-indicator.scss +0 -38
- package/src/webchat/devices/device-adapter.js +0 -43
- package/src/webchat/devices/scrollbar-controller.js +0 -107
- 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
|
-
}
|