@botonic/react 0.31.5-alpha.1 → 0.32.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.
- package/lib/cjs/components/audio.d.ts +8 -7
- package/lib/cjs/components/audio.js +7 -4
- package/lib/cjs/components/audio.js.map +1 -1
- package/lib/cjs/components/button.js +3 -4
- package/lib/cjs/components/button.js.map +1 -1
- package/lib/cjs/components/carousel.js +2 -2
- package/lib/cjs/components/carousel.js.map +1 -1
- package/lib/cjs/components/custom-message.d.ts +16 -12
- package/lib/cjs/components/custom-message.js +3 -9
- package/lib/cjs/components/custom-message.js.map +1 -1
- package/lib/cjs/components/document.d.ts +8 -7
- package/lib/cjs/components/document.js +5 -5
- package/lib/cjs/components/document.js.map +1 -1
- package/lib/cjs/components/element.js +6 -6
- package/lib/cjs/components/element.js.map +1 -1
- package/lib/cjs/components/handoff.d.ts +1 -1
- package/lib/cjs/components/handoff.js +2 -2
- package/lib/cjs/components/handoff.js.map +1 -1
- package/lib/cjs/components/image.d.ts +8 -7
- package/lib/cjs/components/image.js +5 -5
- package/lib/cjs/components/image.js.map +1 -1
- package/lib/cjs/components/index-types.d.ts +30 -127
- package/lib/cjs/components/index.d.ts +7 -1
- package/lib/cjs/components/index.js +14 -1
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/components/message/index.js +2 -1
- package/lib/cjs/components/message/index.js.map +1 -1
- package/lib/cjs/components/message/message-feedback.d.ts +1 -1
- package/lib/cjs/components/message/message-feedback.js +2 -2
- package/lib/cjs/components/message/message-feedback.js.map +1 -1
- package/lib/cjs/components/message/message-footer.d.ts +1 -1
- package/lib/cjs/components/message/message-footer.js +2 -2
- package/lib/cjs/components/message/message-footer.js.map +1 -1
- package/lib/cjs/components/message/message-image.js +2 -2
- package/lib/cjs/components/message/message-image.js.map +1 -1
- package/lib/cjs/components/message/timestamps.d.ts +1 -1
- package/lib/cjs/components/message/timestamps.js +2 -2
- package/lib/cjs/components/message/timestamps.js.map +1 -1
- package/lib/cjs/components/multichannel/multichannel-button.d.ts +1 -1
- package/lib/cjs/components/multichannel/multichannel-button.js +2 -2
- package/lib/cjs/components/multichannel/multichannel-button.js.map +1 -1
- package/lib/cjs/components/multichannel/multichannel-carousel.js +4 -4
- package/lib/cjs/components/multichannel/multichannel-carousel.js.map +1 -1
- package/lib/cjs/components/multichannel/multichannel-reply.d.ts +1 -1
- package/lib/cjs/components/multichannel/multichannel-text.d.ts +1 -1
- package/lib/cjs/components/multichannel/multichannel-text.js +12 -11
- package/lib/cjs/components/multichannel/multichannel-text.js.map +1 -1
- package/lib/cjs/components/multichannel/multichannel-utils.d.ts +9 -15
- package/lib/cjs/components/multichannel/multichannel-utils.js +48 -27
- package/lib/cjs/components/multichannel/multichannel-utils.js.map +1 -1
- package/lib/cjs/components/multichannel/multichannel.js +7 -7
- package/lib/cjs/components/multichannel/multichannel.js.map +1 -1
- package/lib/cjs/components/multichannel/whatsapp/constants.d.ts +11 -0
- package/lib/cjs/components/multichannel/whatsapp/constants.js +13 -0
- package/lib/cjs/components/multichannel/whatsapp/constants.js.map +1 -0
- package/lib/cjs/components/raw.d.ts +1 -1
- package/lib/cjs/components/reply.d.ts +7 -6
- package/lib/cjs/components/reply.js +10 -6
- package/lib/cjs/components/reply.js.map +1 -1
- package/lib/cjs/components/text.d.ts +1 -1
- package/lib/cjs/components/video.d.ts +8 -7
- package/lib/cjs/components/video.js +2 -3
- package/lib/cjs/components/video.js.map +1 -1
- package/lib/cjs/components/webchat-settings.d.ts +15 -2
- package/lib/cjs/components/webchat-settings.js +2 -2
- package/lib/cjs/components/webchat-settings.js.map +1 -1
- package/lib/cjs/components/whatsapp-button-list.js +2 -2
- package/lib/cjs/components/whatsapp-button-list.js.map +1 -1
- package/lib/cjs/components/whatsapp-catalog.d.ts +6 -0
- package/lib/cjs/components/whatsapp-catalog.js +25 -0
- package/lib/cjs/components/whatsapp-catalog.js.map +1 -0
- package/lib/cjs/components/whatsapp-cta-url-button.js +5 -5
- package/lib/cjs/components/whatsapp-cta-url-button.js.map +1 -1
- package/lib/cjs/components/whatsapp-media-carousel.d.ts +46 -0
- package/lib/cjs/components/whatsapp-media-carousel.js +40 -0
- package/lib/cjs/components/whatsapp-media-carousel.js.map +1 -0
- package/lib/cjs/components/whatsapp-product-carousel.d.ts +32 -0
- package/lib/cjs/components/whatsapp-product-carousel.js +34 -0
- package/lib/cjs/components/whatsapp-product-carousel.js.map +1 -0
- package/lib/cjs/components/whatsapp-product-list.d.ts +15 -0
- package/lib/cjs/components/whatsapp-product-list.js +26 -0
- package/lib/cjs/components/whatsapp-product-list.js.map +1 -0
- package/lib/cjs/components/whatsapp-product.d.ts +7 -0
- package/lib/cjs/components/whatsapp-product.js +25 -0
- package/lib/cjs/components/whatsapp-product.js.map +1 -0
- package/lib/cjs/constants.d.ts +0 -6
- package/lib/cjs/constants.js +1 -7
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/contexts.d.ts +3 -4
- package/lib/cjs/contexts.js +2 -76
- package/lib/cjs/contexts.js.map +1 -1
- package/lib/cjs/dev-app.d.ts +7 -0
- package/lib/cjs/dev-app.js +5 -2
- package/lib/cjs/dev-app.js.map +1 -1
- package/lib/cjs/index-types.d.ts +90 -61
- package/lib/cjs/index-types.js.map +1 -1
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/index.js +1 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/msg-to-botonic.d.ts +1 -1
- package/lib/cjs/msg-to-botonic.js +5 -8
- package/lib/cjs/msg-to-botonic.js.map +1 -1
- package/lib/cjs/react-bot.d.ts +1 -1
- package/lib/cjs/util/error-boundary.d.ts +1 -1
- package/lib/cjs/util/functional.d.ts +3 -0
- package/lib/cjs/util/functional.js +30 -0
- package/lib/cjs/util/functional.js.map +1 -0
- package/lib/cjs/util/react.d.ts +1 -1
- package/lib/cjs/util/webchat.d.ts +17 -6
- package/lib/cjs/util/webchat.js +9 -7
- package/lib/cjs/util/webchat.js.map +1 -1
- package/lib/cjs/webchat/chat-area/index.d.ts +1 -1
- package/lib/cjs/webchat/chat-area/index.js +3 -3
- package/lib/cjs/webchat/chat-area/index.js.map +1 -1
- package/lib/cjs/webchat/components/common.d.ts +1 -1
- package/lib/cjs/webchat/components/conditional-animation.d.ts +1 -1
- package/lib/cjs/webchat/components/conditional-animation.js +2 -2
- package/lib/cjs/webchat/components/conditional-animation.js.map +1 -1
- package/lib/cjs/webchat/components/opened-persistent-menu.d.ts +1 -1
- package/lib/cjs/webchat/components/opened-persistent-menu.js +2 -2
- package/lib/cjs/webchat/components/opened-persistent-menu.js.map +1 -1
- package/lib/cjs/webchat/{actions.d.ts → context/actions.d.ts} +4 -1
- package/lib/cjs/webchat/{actions.js → context/actions.js} +4 -0
- package/lib/cjs/webchat/context/actions.js.map +1 -0
- package/lib/cjs/webchat/context/index.d.ts +5 -0
- package/lib/cjs/webchat/context/index.js +86 -0
- package/lib/cjs/webchat/context/index.js.map +1 -0
- package/lib/cjs/webchat/{messages-reducer.d.ts → context/messages-reducer.d.ts} +1 -1
- package/lib/cjs/webchat/{messages-reducer.js → context/messages-reducer.js} +3 -1
- package/lib/cjs/webchat/context/messages-reducer.js.map +1 -0
- package/lib/cjs/webchat/context/types.d.ts +76 -0
- package/lib/cjs/webchat/context/types.js +3 -0
- package/lib/cjs/webchat/context/types.js.map +1 -0
- package/lib/cjs/webchat/{hooks → context}/use-webchat.d.ts +21 -20
- package/lib/cjs/webchat/{hooks → context}/use-webchat.js +21 -7
- package/lib/cjs/webchat/context/use-webchat.js.map +1 -0
- package/lib/cjs/webchat/{webchat-reducer.d.ts → context/webchat-reducer.d.ts} +1 -1
- package/lib/cjs/webchat/{webchat-reducer.js → context/webchat-reducer.js} +4 -0
- package/lib/cjs/webchat/context/webchat-reducer.js.map +1 -0
- package/lib/cjs/webchat/cover-component/index.d.ts +1 -1
- package/lib/cjs/webchat/cover-component/index.js +2 -2
- package/lib/cjs/webchat/cover-component/index.js.map +1 -1
- package/lib/cjs/webchat/header/default-header.d.ts +1 -0
- package/lib/cjs/webchat/header/default-header.js +25 -0
- package/lib/cjs/webchat/header/default-header.js.map +1 -0
- package/lib/cjs/webchat/header/index.d.ts +2 -0
- package/lib/cjs/webchat/header/index.js +23 -0
- package/lib/cjs/webchat/header/index.js.map +1 -0
- package/lib/cjs/webchat/header/styles.d.ts +7 -0
- package/lib/cjs/webchat/header/styles.js +59 -0
- package/lib/cjs/webchat/header/styles.js.map +1 -0
- package/lib/cjs/webchat/hooks/index.d.ts +0 -1
- package/lib/cjs/webchat/hooks/index.js +1 -4
- package/lib/cjs/webchat/hooks/index.js.map +1 -1
- package/lib/cjs/webchat/hooks/use-previous.d.ts +1 -1
- package/lib/cjs/webchat/hooks/use-previous.js.map +1 -1
- package/lib/cjs/webchat/hooks/use-scroll-to-bottom.d.ts +6 -4
- package/lib/cjs/webchat/hooks/use-scroll-to-bottom.js.map +1 -1
- package/lib/cjs/webchat/hooks/use-scrollbar-controller.js +16 -16
- package/lib/cjs/webchat/hooks/use-scrollbar-controller.js.map +1 -1
- package/lib/cjs/webchat/hooks/use-typing.d.ts +1 -1
- package/lib/cjs/webchat/hooks/use-webchat-dimensions.js +4 -4
- package/lib/cjs/webchat/hooks/use-webchat-dimensions.js.map +1 -1
- package/lib/cjs/webchat/hooks/use-webchat-resizer.js +6 -6
- package/lib/cjs/webchat/hooks/use-webchat-resizer.js.map +1 -1
- package/lib/cjs/webchat/index-types.d.ts +3 -46
- package/lib/cjs/webchat/index.d.ts +1 -0
- package/lib/cjs/webchat/index.js +3 -1
- package/lib/cjs/webchat/index.js.map +1 -1
- package/lib/cjs/webchat/input-panel/attachment.d.ts +2 -2
- package/lib/cjs/webchat/input-panel/attachment.js +2 -2
- package/lib/cjs/webchat/input-panel/attachment.js.map +1 -1
- package/lib/cjs/webchat/input-panel/emoji-picker.d.ts +2 -2
- package/lib/cjs/webchat/input-panel/emoji-picker.js +2 -2
- package/lib/cjs/webchat/input-panel/emoji-picker.js.map +1 -1
- package/lib/cjs/webchat/input-panel/index.d.ts +4 -4
- package/lib/cjs/webchat/input-panel/index.js +8 -3
- package/lib/cjs/webchat/input-panel/index.js.map +1 -1
- package/lib/cjs/webchat/input-panel/opened-emoji-picker.d.ts +1 -1
- package/lib/cjs/webchat/input-panel/persistent-menu.d.ts +1 -1
- package/lib/cjs/webchat/input-panel/persistent-menu.js +2 -2
- package/lib/cjs/webchat/input-panel/persistent-menu.js.map +1 -1
- package/lib/cjs/webchat/input-panel/send-button.d.ts +1 -1
- package/lib/cjs/webchat/input-panel/send-button.js +2 -2
- package/lib/cjs/webchat/input-panel/send-button.js.map +1 -1
- package/lib/cjs/webchat/input-panel/textarea.d.ts +4 -4
- package/lib/cjs/webchat/input-panel/textarea.js +11 -3
- package/lib/cjs/webchat/input-panel/textarea.js.map +1 -1
- package/lib/cjs/webchat/message-list/index.d.ts +1 -1
- package/lib/cjs/webchat/message-list/index.js +64 -38
- package/lib/cjs/webchat/message-list/index.js.map +1 -1
- package/lib/cjs/webchat/message-list/intro-message.d.ts +1 -1
- package/lib/cjs/webchat/message-list/intro-message.js +2 -2
- package/lib/cjs/webchat/message-list/intro-message.js.map +1 -1
- package/lib/cjs/webchat/message-list/scroll-button.d.ts +1 -0
- package/lib/cjs/webchat/message-list/styles.js +4 -3
- package/lib/cjs/webchat/message-list/styles.js.map +1 -1
- package/lib/cjs/webchat/message-list/unread-messages-banner.js +2 -2
- package/lib/cjs/webchat/message-list/unread-messages-banner.js.map +1 -1
- package/lib/cjs/webchat/message-list/use-notifications.js +2 -2
- package/lib/cjs/webchat/message-list/use-notifications.js.map +1 -1
- package/lib/cjs/webchat/replies/index.d.ts +1 -0
- package/lib/cjs/webchat/replies/index.js +32 -0
- package/lib/cjs/webchat/replies/index.js.map +1 -0
- package/lib/cjs/webchat/replies/styles.d.ts +8 -0
- package/lib/cjs/webchat/replies/styles.js +25 -0
- package/lib/cjs/webchat/replies/styles.js.map +1 -0
- package/lib/cjs/webchat/session-view.d.ts +1 -1
- package/lib/cjs/webchat/session-view.js +4 -4
- package/lib/cjs/webchat/session-view.js.map +1 -1
- package/lib/cjs/webchat/styles.d.ts +9 -0
- package/lib/cjs/webchat/styles.js +54 -0
- package/lib/cjs/webchat/styles.js.map +1 -0
- package/lib/cjs/webchat/theme/types.d.ts +167 -0
- package/lib/cjs/webchat/theme/types.js +3 -0
- package/lib/cjs/webchat/theme/types.js.map +1 -0
- package/lib/cjs/webchat/trigger-button/index.d.ts +1 -0
- package/lib/cjs/webchat/trigger-button/index.js +2 -2
- package/lib/cjs/webchat/trigger-button/index.js.map +1 -1
- package/lib/cjs/webchat/typing-indicator/index.d.ts +3 -1
- package/lib/cjs/webchat/typing-indicator/index.js +4 -3
- package/lib/cjs/webchat/typing-indicator/index.js.map +1 -1
- package/lib/cjs/webchat/typing-indicator/styles.d.ts +3 -2
- package/lib/cjs/webchat/typing-indicator/styles.js +6 -3
- package/lib/cjs/webchat/typing-indicator/styles.js.map +1 -1
- package/lib/cjs/webchat/webchat-dev.d.ts +2 -2
- package/lib/cjs/webchat/webchat-dev.js +2 -2
- package/lib/cjs/webchat/webchat-dev.js.map +1 -1
- package/lib/cjs/webchat/webchat.d.ts +4 -2
- package/lib/cjs/webchat/webchat.js +91 -116
- package/lib/cjs/webchat/webchat.js.map +1 -1
- package/lib/cjs/webchat/webview/header.d.ts +1 -0
- package/lib/cjs/webchat/webview/header.js +16 -0
- package/lib/cjs/webchat/webview/header.js.map +1 -0
- package/lib/cjs/webchat/webview/index.d.ts +1 -0
- package/lib/cjs/webchat/webview/index.js +49 -0
- package/lib/cjs/webchat/webview/index.js.map +1 -0
- package/lib/cjs/webchat/webview/styles.d.ts +7 -0
- package/lib/cjs/webchat/webview/styles.js +46 -0
- package/lib/cjs/webchat/webview/styles.js.map +1 -0
- package/lib/cjs/webchat-app.d.ts +62 -86
- package/lib/cjs/webchat-app.js +126 -62
- package/lib/cjs/webchat-app.js.map +1 -1
- package/lib/cjs/webview-app.js +5 -2
- package/lib/cjs/webview-app.js.map +1 -1
- package/lib/esm/components/audio.d.ts +8 -7
- package/lib/esm/components/audio.js +7 -4
- package/lib/esm/components/audio.js.map +1 -1
- package/lib/esm/components/button.js +2 -3
- package/lib/esm/components/button.js.map +1 -1
- package/lib/esm/components/carousel.js +1 -1
- package/lib/esm/components/carousel.js.map +1 -1
- package/lib/esm/components/custom-message.d.ts +16 -12
- package/lib/esm/components/custom-message.js +3 -9
- package/lib/esm/components/custom-message.js.map +1 -1
- package/lib/esm/components/document.d.ts +8 -7
- package/lib/esm/components/document.js +4 -4
- package/lib/esm/components/document.js.map +1 -1
- package/lib/esm/components/element.js +6 -6
- package/lib/esm/components/element.js.map +1 -1
- package/lib/esm/components/handoff.d.ts +1 -1
- package/lib/esm/components/handoff.js +1 -1
- package/lib/esm/components/handoff.js.map +1 -1
- package/lib/esm/components/image.d.ts +8 -7
- package/lib/esm/components/image.js +4 -4
- package/lib/esm/components/image.js.map +1 -1
- package/lib/esm/components/index-types.d.ts +30 -127
- package/lib/esm/components/index.d.ts +7 -1
- package/lib/esm/components/index.js +7 -1
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/components/message/index.js +2 -1
- package/lib/esm/components/message/index.js.map +1 -1
- package/lib/esm/components/message/message-feedback.d.ts +1 -1
- package/lib/esm/components/message/message-feedback.js +1 -1
- package/lib/esm/components/message/message-feedback.js.map +1 -1
- package/lib/esm/components/message/message-footer.d.ts +1 -1
- package/lib/esm/components/message/message-footer.js +1 -1
- package/lib/esm/components/message/message-footer.js.map +1 -1
- package/lib/esm/components/message/message-image.js +1 -1
- package/lib/esm/components/message/message-image.js.map +1 -1
- package/lib/esm/components/message/timestamps.d.ts +1 -1
- package/lib/esm/components/message/timestamps.js +1 -1
- package/lib/esm/components/message/timestamps.js.map +1 -1
- package/lib/esm/components/multichannel/multichannel-button.d.ts +1 -1
- package/lib/esm/components/multichannel/multichannel-button.js +1 -1
- package/lib/esm/components/multichannel/multichannel-carousel.js +5 -5
- package/lib/esm/components/multichannel/multichannel-carousel.js.map +1 -1
- package/lib/esm/components/multichannel/multichannel-reply.d.ts +1 -1
- package/lib/esm/components/multichannel/multichannel-text.d.ts +1 -1
- package/lib/esm/components/multichannel/multichannel-text.js +2 -1
- package/lib/esm/components/multichannel/multichannel-text.js.map +1 -1
- package/lib/esm/components/multichannel/multichannel-utils.d.ts +9 -15
- package/lib/esm/components/multichannel/multichannel-utils.js +40 -24
- package/lib/esm/components/multichannel/multichannel-utils.js.map +1 -1
- package/lib/esm/components/multichannel/multichannel.js +7 -7
- package/lib/esm/components/multichannel/multichannel.js.map +1 -1
- package/lib/esm/components/multichannel/whatsapp/constants.d.ts +11 -0
- package/lib/esm/components/multichannel/whatsapp/constants.js +10 -0
- package/lib/esm/components/multichannel/whatsapp/constants.js.map +1 -0
- package/lib/esm/components/raw.d.ts +1 -1
- package/lib/esm/components/reply.d.ts +7 -6
- package/lib/esm/components/reply.js +9 -5
- package/lib/esm/components/reply.js.map +1 -1
- package/lib/esm/components/text.d.ts +1 -1
- package/lib/esm/components/video.d.ts +8 -7
- package/lib/esm/components/video.js +2 -3
- package/lib/esm/components/video.js.map +1 -1
- package/lib/esm/components/webchat-settings.d.ts +15 -2
- package/lib/esm/components/webchat-settings.js +1 -1
- package/lib/esm/components/webchat-settings.js.map +1 -1
- package/lib/esm/components/whatsapp-button-list.js +1 -1
- package/lib/esm/components/whatsapp-catalog.d.ts +6 -0
- package/lib/esm/components/whatsapp-catalog.js +21 -0
- package/lib/esm/components/whatsapp-catalog.js.map +1 -0
- package/lib/esm/components/whatsapp-cta-url-button.js +1 -1
- package/lib/esm/components/whatsapp-media-carousel.d.ts +46 -0
- package/lib/esm/components/whatsapp-media-carousel.js +36 -0
- package/lib/esm/components/whatsapp-media-carousel.js.map +1 -0
- package/lib/esm/components/whatsapp-product-carousel.d.ts +32 -0
- package/lib/esm/components/whatsapp-product-carousel.js +30 -0
- package/lib/esm/components/whatsapp-product-carousel.js.map +1 -0
- package/lib/esm/components/whatsapp-product-list.d.ts +15 -0
- package/lib/esm/components/whatsapp-product-list.js +22 -0
- package/lib/esm/components/whatsapp-product-list.js.map +1 -0
- package/lib/esm/components/whatsapp-product.d.ts +7 -0
- package/lib/esm/components/whatsapp-product.js +21 -0
- package/lib/esm/components/whatsapp-product.js.map +1 -0
- 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 +3 -4
- package/lib/esm/contexts.js +1 -75
- package/lib/esm/contexts.js.map +1 -1
- package/lib/esm/dev-app.d.ts +7 -0
- package/lib/esm/dev-app.js +5 -2
- package/lib/esm/dev-app.js.map +1 -1
- package/lib/esm/index-types.d.ts +90 -61
- package/lib/esm/index-types.js.map +1 -1
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/msg-to-botonic.d.ts +1 -1
- package/lib/esm/msg-to-botonic.js +5 -8
- package/lib/esm/msg-to-botonic.js.map +1 -1
- package/lib/esm/react-bot.d.ts +1 -1
- package/lib/esm/util/error-boundary.d.ts +1 -1
- package/lib/esm/util/functional.d.ts +3 -0
- package/lib/esm/util/functional.js +26 -0
- package/lib/esm/util/functional.js.map +1 -0
- package/lib/esm/util/react.d.ts +1 -1
- package/lib/esm/util/webchat.d.ts +17 -6
- package/lib/esm/util/webchat.js +9 -7
- package/lib/esm/util/webchat.js.map +1 -1
- package/lib/esm/webchat/chat-area/index.d.ts +1 -1
- package/lib/esm/webchat/chat-area/index.js +2 -2
- package/lib/esm/webchat/chat-area/index.js.map +1 -1
- package/lib/esm/webchat/components/common.d.ts +1 -1
- package/lib/esm/webchat/components/conditional-animation.d.ts +1 -1
- package/lib/esm/webchat/components/conditional-animation.js +1 -1
- package/lib/esm/webchat/components/conditional-animation.js.map +1 -1
- package/lib/esm/webchat/components/opened-persistent-menu.d.ts +1 -1
- package/lib/esm/webchat/components/opened-persistent-menu.js +1 -1
- package/lib/esm/webchat/components/opened-persistent-menu.js.map +1 -1
- package/lib/esm/webchat/{actions.d.ts → context/actions.d.ts} +4 -1
- package/lib/esm/webchat/{actions.js → context/actions.js} +4 -0
- package/lib/esm/webchat/context/actions.js.map +1 -0
- package/lib/esm/webchat/context/index.d.ts +5 -0
- package/lib/esm/webchat/context/index.js +81 -0
- package/lib/esm/webchat/context/index.js.map +1 -0
- package/lib/esm/webchat/{messages-reducer.d.ts → context/messages-reducer.d.ts} +1 -1
- package/lib/esm/webchat/{messages-reducer.js → context/messages-reducer.js} +3 -1
- package/lib/esm/webchat/context/messages-reducer.js.map +1 -0
- package/lib/esm/webchat/context/types.d.ts +76 -0
- package/lib/esm/webchat/context/types.js +2 -0
- package/lib/esm/webchat/context/types.js.map +1 -0
- package/lib/esm/webchat/{hooks → context}/use-webchat.d.ts +21 -20
- package/lib/esm/webchat/{hooks → context}/use-webchat.js +21 -7
- package/lib/esm/webchat/context/use-webchat.js.map +1 -0
- package/lib/esm/webchat/{webchat-reducer.d.ts → context/webchat-reducer.d.ts} +1 -1
- package/lib/esm/webchat/{webchat-reducer.js → context/webchat-reducer.js} +4 -0
- package/lib/esm/webchat/context/webchat-reducer.js.map +1 -0
- package/lib/esm/webchat/cover-component/index.d.ts +1 -1
- package/lib/esm/webchat/cover-component/index.js +1 -1
- package/lib/esm/webchat/cover-component/index.js.map +1 -1
- package/lib/esm/webchat/header/default-header.d.ts +1 -0
- package/lib/esm/webchat/header/default-header.js +21 -0
- package/lib/esm/webchat/header/default-header.js.map +1 -0
- package/lib/esm/webchat/header/index.d.ts +2 -0
- package/lib/esm/webchat/header/index.js +20 -0
- package/lib/esm/webchat/header/index.js.map +1 -0
- package/lib/esm/webchat/header/styles.d.ts +7 -0
- package/lib/esm/webchat/header/styles.js +55 -0
- package/lib/esm/webchat/header/styles.js.map +1 -0
- package/lib/esm/webchat/hooks/index.d.ts +0 -1
- package/lib/esm/webchat/hooks/index.js +0 -1
- package/lib/esm/webchat/hooks/index.js.map +1 -1
- package/lib/esm/webchat/hooks/use-previous.d.ts +1 -1
- package/lib/esm/webchat/hooks/use-previous.js.map +1 -1
- package/lib/esm/webchat/hooks/use-scroll-to-bottom.d.ts +6 -4
- package/lib/esm/webchat/hooks/use-scroll-to-bottom.js.map +1 -1
- package/lib/esm/webchat/hooks/use-scrollbar-controller.js +16 -16
- package/lib/esm/webchat/hooks/use-scrollbar-controller.js.map +1 -1
- package/lib/esm/webchat/hooks/use-typing.d.ts +1 -1
- package/lib/esm/webchat/hooks/use-webchat-dimensions.js +4 -4
- package/lib/esm/webchat/hooks/use-webchat-dimensions.js.map +1 -1
- package/lib/esm/webchat/hooks/use-webchat-resizer.js +6 -6
- package/lib/esm/webchat/hooks/use-webchat-resizer.js.map +1 -1
- package/lib/esm/webchat/index-types.d.ts +3 -46
- package/lib/esm/webchat/index.d.ts +1 -0
- package/lib/esm/webchat/index.js +1 -0
- package/lib/esm/webchat/index.js.map +1 -1
- package/lib/esm/webchat/input-panel/attachment.d.ts +2 -2
- package/lib/esm/webchat/input-panel/attachment.js +1 -1
- package/lib/esm/webchat/input-panel/attachment.js.map +1 -1
- package/lib/esm/webchat/input-panel/emoji-picker.d.ts +2 -2
- package/lib/esm/webchat/input-panel/emoji-picker.js +1 -1
- package/lib/esm/webchat/input-panel/emoji-picker.js.map +1 -1
- package/lib/esm/webchat/input-panel/index.d.ts +4 -4
- package/lib/esm/webchat/input-panel/index.js +7 -2
- package/lib/esm/webchat/input-panel/index.js.map +1 -1
- package/lib/esm/webchat/input-panel/opened-emoji-picker.d.ts +1 -1
- package/lib/esm/webchat/input-panel/persistent-menu.d.ts +1 -1
- package/lib/esm/webchat/input-panel/persistent-menu.js +1 -1
- package/lib/esm/webchat/input-panel/persistent-menu.js.map +1 -1
- package/lib/esm/webchat/input-panel/send-button.d.ts +1 -1
- package/lib/esm/webchat/input-panel/send-button.js +1 -1
- package/lib/esm/webchat/input-panel/send-button.js.map +1 -1
- package/lib/esm/webchat/input-panel/textarea.d.ts +4 -4
- package/lib/esm/webchat/input-panel/textarea.js +11 -3
- package/lib/esm/webchat/input-panel/textarea.js.map +1 -1
- package/lib/esm/webchat/message-list/index.d.ts +1 -1
- package/lib/esm/webchat/message-list/index.js +62 -37
- package/lib/esm/webchat/message-list/index.js.map +1 -1
- package/lib/esm/webchat/message-list/intro-message.d.ts +1 -1
- package/lib/esm/webchat/message-list/intro-message.js +1 -1
- package/lib/esm/webchat/message-list/intro-message.js.map +1 -1
- package/lib/esm/webchat/message-list/scroll-button.d.ts +1 -0
- package/lib/esm/webchat/message-list/styles.js +4 -3
- package/lib/esm/webchat/message-list/styles.js.map +1 -1
- package/lib/esm/webchat/message-list/unread-messages-banner.js +1 -1
- package/lib/esm/webchat/message-list/unread-messages-banner.js.map +1 -1
- package/lib/esm/webchat/message-list/use-notifications.js +1 -1
- package/lib/esm/webchat/message-list/use-notifications.js.map +1 -1
- package/lib/esm/webchat/replies/index.d.ts +1 -0
- package/lib/esm/webchat/replies/index.js +28 -0
- package/lib/esm/webchat/replies/index.js.map +1 -0
- package/lib/esm/webchat/replies/styles.d.ts +8 -0
- package/lib/esm/webchat/replies/styles.js +21 -0
- package/lib/esm/webchat/replies/styles.js.map +1 -0
- package/lib/esm/webchat/session-view.d.ts +1 -1
- package/lib/esm/webchat/session-view.js +2 -2
- package/lib/esm/webchat/session-view.js.map +1 -1
- package/lib/esm/webchat/styles.d.ts +9 -0
- package/lib/esm/webchat/styles.js +50 -0
- package/lib/esm/webchat/styles.js.map +1 -0
- package/lib/esm/webchat/theme/types.d.ts +167 -0
- package/lib/esm/webchat/theme/types.js +2 -0
- package/lib/esm/webchat/theme/types.js.map +1 -0
- package/lib/esm/webchat/trigger-button/index.d.ts +1 -0
- package/lib/esm/webchat/trigger-button/index.js +1 -1
- package/lib/esm/webchat/trigger-button/index.js.map +1 -1
- package/lib/esm/webchat/typing-indicator/index.d.ts +3 -1
- package/lib/esm/webchat/typing-indicator/index.js +5 -2
- package/lib/esm/webchat/typing-indicator/index.js.map +1 -1
- package/lib/esm/webchat/typing-indicator/styles.d.ts +3 -2
- package/lib/esm/webchat/typing-indicator/styles.js +5 -2
- package/lib/esm/webchat/typing-indicator/styles.js.map +1 -1
- package/lib/esm/webchat/webchat-dev.d.ts +2 -2
- package/lib/esm/webchat/webchat-dev.js +1 -1
- package/lib/esm/webchat/webchat-dev.js.map +1 -1
- package/lib/esm/webchat/webchat.d.ts +4 -2
- package/lib/esm/webchat/webchat.js +87 -112
- package/lib/esm/webchat/webchat.js.map +1 -1
- package/lib/esm/webchat/webview/header.d.ts +1 -0
- package/lib/esm/webchat/webview/header.js +12 -0
- package/lib/esm/webchat/webview/header.js.map +1 -0
- package/lib/esm/webchat/webview/index.d.ts +1 -0
- package/lib/esm/webchat/webview/index.js +45 -0
- package/lib/esm/webchat/webview/index.js.map +1 -0
- package/lib/esm/webchat/webview/styles.d.ts +7 -0
- package/lib/esm/webchat/webview/styles.js +42 -0
- package/lib/esm/webchat/webview/styles.js.map +1 -0
- package/lib/esm/webchat-app.d.ts +62 -86
- package/lib/esm/webchat-app.js +127 -63
- package/lib/esm/webchat-app.js.map +1 -1
- package/lib/esm/webview-app.js +5 -2
- package/lib/esm/webview-app.js.map +1 -1
- package/package.json +21 -18
- package/src/components/{audio.jsx → audio.tsx} +10 -4
- package/src/components/button.tsx +1 -3
- package/src/components/carousel.jsx +1 -1
- package/src/components/{custom-message.jsx → custom-message.tsx} +19 -7
- package/src/components/{document.jsx → document.tsx} +5 -3
- package/src/components/element.jsx +4 -11
- package/src/components/handoff.jsx +1 -1
- package/src/components/{image.jsx → image.tsx} +10 -4
- package/src/components/index-types.ts +25 -114
- package/src/components/index.ts +22 -1
- package/src/components/message/index.jsx +2 -1
- package/src/components/message/message-feedback.tsx +1 -1
- package/src/components/message/message-footer.tsx +1 -1
- package/src/components/message/message-image.tsx +1 -1
- package/src/components/message/timestamps.tsx +1 -1
- package/src/components/multichannel/multichannel-button.jsx +1 -1
- package/src/components/multichannel/multichannel-carousel.jsx +7 -5
- package/src/components/multichannel/multichannel-text.jsx +4 -2
- package/src/components/multichannel/multichannel-utils.js +45 -27
- package/src/components/multichannel/multichannel.jsx +12 -7
- package/src/components/multichannel/whatsapp/constants.ts +10 -0
- package/src/components/{reply.jsx → reply.tsx} +10 -4
- package/src/components/{video.jsx → video.tsx} +3 -2
- package/src/components/webchat-settings.tsx +14 -2
- package/src/components/whatsapp-button-list.tsx +1 -1
- package/src/components/whatsapp-catalog.tsx +42 -0
- package/src/components/whatsapp-cta-url-button.tsx +1 -1
- package/src/components/whatsapp-media-carousel.tsx +104 -0
- package/src/components/whatsapp-product-carousel.tsx +83 -0
- package/src/components/whatsapp-product-list.tsx +56 -0
- package/src/components/whatsapp-product.tsx +44 -0
- package/src/constants.js +0 -7
- package/src/contexts.tsx +5 -80
- package/src/dev-app.jsx +5 -5
- package/src/index-types.ts +101 -70
- package/src/index.ts +1 -5
- package/src/msg-to-botonic.jsx +5 -9
- package/src/util/functional.ts +31 -0
- package/src/util/{webchat.js → webchat.ts} +15 -9
- package/src/webchat/chat-area/index.tsx +2 -4
- package/src/webchat/components/conditional-animation.jsx +1 -1
- package/src/webchat/components/opened-persistent-menu.jsx +1 -1
- package/src/webchat/{actions.ts → context/actions.ts} +4 -0
- package/src/webchat/context/index.tsx +84 -0
- package/src/webchat/{messages-reducer.ts → context/messages-reducer.ts} +4 -2
- package/src/webchat/context/types.ts +86 -0
- package/src/webchat/{hooks → context}/use-webchat.ts +73 -15
- package/src/webchat/{webchat-reducer.ts → context/webchat-reducer.ts} +5 -1
- package/src/webchat/cover-component/index.tsx +1 -1
- package/src/webchat/global.d.ts +3 -0
- package/src/webchat/header/default-header.tsx +75 -0
- package/src/webchat/header/index.tsx +37 -0
- package/src/webchat/header/styles.ts +62 -0
- package/src/webchat/hooks/index.ts +0 -1
- package/src/webchat/hooks/use-previous.ts +1 -1
- package/src/webchat/hooks/use-scroll-to-bottom.ts +8 -2
- package/src/webchat/hooks/use-scrollbar-controller.ts +22 -17
- package/src/webchat/hooks/use-typing.ts +1 -1
- package/src/webchat/hooks/use-webchat-dimensions.ts +4 -4
- package/src/webchat/hooks/use-webchat-resizer.ts +6 -6
- package/src/webchat/index-types.ts +3 -52
- package/src/webchat/index.ts +1 -0
- package/src/webchat/input-panel/attachment.tsx +2 -2
- package/src/webchat/input-panel/emoji-picker.tsx +2 -2
- package/src/webchat/input-panel/index.tsx +9 -5
- package/src/webchat/input-panel/persistent-menu.tsx +1 -1
- package/src/webchat/input-panel/send-button.tsx +1 -1
- package/src/webchat/input-panel/textarea.tsx +18 -5
- package/src/webchat/message-list/index.tsx +78 -49
- package/src/webchat/message-list/intro-message.tsx +1 -1
- package/src/webchat/message-list/styles.ts +4 -3
- package/src/webchat/message-list/unread-messages-banner.tsx +1 -1
- package/src/webchat/message-list/use-notifications.ts +1 -1
- package/src/webchat/replies/index.tsx +47 -0
- package/src/webchat/replies/styles.ts +28 -0
- package/src/webchat/session-view.jsx +2 -2
- package/src/webchat/styles.ts +59 -0
- package/src/webchat/theme/types.ts +119 -0
- package/src/webchat/trigger-button/index.tsx +1 -1
- package/src/webchat/typing-indicator/index.tsx +20 -12
- package/src/webchat/typing-indicator/styles.ts +7 -3
- package/src/webchat/webchat-dev.jsx +1 -1
- package/src/webchat/{webchat.jsx → webchat.tsx} +118 -144
- package/src/webchat/webview/header.tsx +22 -0
- package/src/webchat/webview/index.tsx +80 -0
- package/src/webchat/webview/styles.ts +48 -0
- package/src/webchat-app.tsx +522 -0
- package/src/webview-app.tsx +6 -4
- package/lib/cjs/webchat/actions.js.map +0 -1
- package/lib/cjs/webchat/header.d.ts +0 -3
- package/lib/cjs/webchat/header.js +0 -86
- package/lib/cjs/webchat/header.js.map +0 -1
- package/lib/cjs/webchat/hooks/use-webchat.js.map +0 -1
- package/lib/cjs/webchat/messages-reducer.js.map +0 -1
- package/lib/cjs/webchat/replies.d.ts +0 -1
- package/lib/cjs/webchat/replies.js +0 -47
- package/lib/cjs/webchat/replies.js.map +0 -1
- package/lib/cjs/webchat/webchat-reducer.js.map +0 -1
- package/lib/cjs/webchat/webview.d.ts +0 -2
- package/lib/cjs/webchat/webview.js +0 -75
- package/lib/cjs/webchat/webview.js.map +0 -1
- package/lib/esm/webchat/actions.js.map +0 -1
- package/lib/esm/webchat/header.d.ts +0 -3
- package/lib/esm/webchat/header.js +0 -81
- package/lib/esm/webchat/header.js.map +0 -1
- package/lib/esm/webchat/hooks/use-webchat.js.map +0 -1
- package/lib/esm/webchat/messages-reducer.js.map +0 -1
- package/lib/esm/webchat/replies.d.ts +0 -1
- package/lib/esm/webchat/replies.js +0 -42
- package/lib/esm/webchat/replies.js.map +0 -1
- package/lib/esm/webchat/webchat-reducer.js.map +0 -1
- package/lib/esm/webchat/webview.d.ts +0 -2
- package/lib/esm/webchat/webview.js +0 -70
- package/lib/esm/webchat/webview.js.map +0 -1
- package/src/webchat/header.jsx +0 -149
- package/src/webchat/replies.jsx +0 -64
- package/src/webchat/webview.jsx +0 -105
- package/src/webchat-app.jsx +0 -389
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Input as CoreInput,
|
|
3
|
+
Session as CoreSession,
|
|
4
|
+
SessionUser as CoreSessionUser,
|
|
5
|
+
} from '@botonic/core'
|
|
6
|
+
|
|
7
|
+
import { Reply, WebchatSettingsProps, Webview } from '../../components'
|
|
8
|
+
import { CloseWebviewOptions } from '../../contexts'
|
|
9
|
+
import { TrackEventFunction, WebchatMessage } from '../../index-types'
|
|
10
|
+
import { WebchatStateTheme } from '../index-types'
|
|
11
|
+
import { ThemeProps } from '../theme/types'
|
|
12
|
+
|
|
13
|
+
export interface ErrorMessage {
|
|
14
|
+
message?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface DevSettings {
|
|
18
|
+
keepSessionOnReload?: boolean
|
|
19
|
+
showSessionView?: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface WebchatState {
|
|
23
|
+
width: number // TODO: move this inside webchatState.theme.style
|
|
24
|
+
height: number // TODO: move this inside webchatState.theme.style
|
|
25
|
+
messagesJSON: any[]
|
|
26
|
+
messagesComponents: any[]
|
|
27
|
+
replies?: (typeof Reply)[]
|
|
28
|
+
latestInput: Partial<CoreInput>
|
|
29
|
+
typing: boolean
|
|
30
|
+
webview: Webview | null
|
|
31
|
+
webviewParams: null
|
|
32
|
+
session: Partial<CoreSession>
|
|
33
|
+
lastRoutePath?: string
|
|
34
|
+
handoff: boolean
|
|
35
|
+
theme: WebchatStateTheme // TODO: type this as ThemeProps
|
|
36
|
+
themeUpdates: Partial<WebchatStateTheme> // TODO: type this as Partial<ThemeProps>
|
|
37
|
+
error: ErrorMessage
|
|
38
|
+
online: boolean
|
|
39
|
+
devSettings: DevSettings
|
|
40
|
+
isWebchatOpen: boolean
|
|
41
|
+
isEmojiPickerOpen: boolean
|
|
42
|
+
isPersistentMenuOpen: boolean
|
|
43
|
+
isCoverComponentOpen: boolean
|
|
44
|
+
isCustomComponentRendered: boolean
|
|
45
|
+
lastMessageUpdate?: string
|
|
46
|
+
currentAttachment?: File
|
|
47
|
+
numUnreadMessages: number
|
|
48
|
+
isLastMessageVisible: boolean
|
|
49
|
+
isInputFocused: boolean
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ClientInput: type for sendInput and updateLatestInput function without message_id and bot_interaction_id because backend set this values
|
|
53
|
+
export type ClientInput = Omit<CoreInput, 'message_id' | 'bot_interaction_id'>
|
|
54
|
+
|
|
55
|
+
export interface WebchatContextProps {
|
|
56
|
+
addMessage: (message: WebchatMessage) => void
|
|
57
|
+
getThemeProperty: (property: string, defaultValue?: any) => any
|
|
58
|
+
closeWebview: (options?: CloseWebviewOptions) => Promise<void>
|
|
59
|
+
openWebview: (webviewComponent: Webview, params?: any) => void
|
|
60
|
+
resetUnreadMessages: () => void
|
|
61
|
+
resolveCase: () => void
|
|
62
|
+
sendAttachment: (attachment: File) => Promise<void>
|
|
63
|
+
sendInput: (input: ClientInput) => Promise<void>
|
|
64
|
+
sendPayload: (payload: string) => Promise<void>
|
|
65
|
+
sendText: (text: string, payload?: string) => Promise<void>
|
|
66
|
+
setIsInputFocused: (isInputFocused: boolean) => void
|
|
67
|
+
setLastMessageVisible: (isLastMessageVisible: boolean) => void
|
|
68
|
+
theme: ThemeProps // TODO: Remove this attribute and use allways webchatState.theme
|
|
69
|
+
toggleWebchat: (toggle: boolean) => void
|
|
70
|
+
toggleEmojiPicker: (toggle: boolean) => void
|
|
71
|
+
togglePersistentMenu: (toggle: boolean) => void
|
|
72
|
+
toggleCoverComponent: (toggle: boolean) => void
|
|
73
|
+
updateLatestInput: (input: ClientInput) => void
|
|
74
|
+
updateMessage: (message: WebchatMessage) => void
|
|
75
|
+
updateReplies: (replies: (typeof Reply)[]) => void
|
|
76
|
+
updateUser: (user: Partial<CoreSessionUser>) => void
|
|
77
|
+
updateWebchatDevSettings: (settings: WebchatSettingsProps) => void
|
|
78
|
+
trackEvent?: TrackEventFunction
|
|
79
|
+
webchatState: WebchatState
|
|
80
|
+
webchatContainerRef: React.MutableRefObject<HTMLDivElement | null>
|
|
81
|
+
chatAreaRef: React.MutableRefObject<HTMLDivElement | null>
|
|
82
|
+
inputPanelRef: React.MutableRefObject<HTMLDivElement | null>
|
|
83
|
+
headerRef: React.MutableRefObject<HTMLDivElement | null>
|
|
84
|
+
scrollableMessagesListRef: React.MutableRefObject<HTMLDivElement | null>
|
|
85
|
+
repliesRef: React.MutableRefObject<HTMLDivElement | null>
|
|
86
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Session } from '@botonic/core'
|
|
2
2
|
import { useReducer, useRef } from 'react'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Reply } from '../../components'
|
|
5
|
+
import { Webview } from '../../components/index-types'
|
|
5
6
|
import { COLORS, WEBCHAT } from '../../constants'
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { WebchatMessage } from '../../index-types'
|
|
8
|
+
import { ThemeProps } from '../theme/types'
|
|
9
|
+
import { WebchatAction } from './actions'
|
|
10
|
+
import { ClientInput, DevSettings, ErrorMessage, WebchatState } from './types'
|
|
11
|
+
import { webchatReducer } from './webchat-reducer'
|
|
10
12
|
|
|
11
13
|
export const webchatInitialState: WebchatState = {
|
|
12
14
|
width: WEBCHAT.DEFAULTS.WIDTH,
|
|
@@ -19,8 +21,9 @@ export const webchatInitialState: WebchatState = {
|
|
|
19
21
|
webview: null,
|
|
20
22
|
webviewParams: null,
|
|
21
23
|
session: { user: undefined },
|
|
22
|
-
lastRoutePath:
|
|
24
|
+
lastRoutePath: undefined,
|
|
23
25
|
handoff: false,
|
|
26
|
+
// TODO: type create a defaultTheme using ThemeProps, and put this in initialState
|
|
24
27
|
theme: {
|
|
25
28
|
headerTitle: WEBCHAT.DEFAULTS.TITLE,
|
|
26
29
|
brandColor: COLORS.BOTONIC_BLUE,
|
|
@@ -44,15 +47,53 @@ export const webchatInitialState: WebchatState = {
|
|
|
44
47
|
currentAttachment: undefined,
|
|
45
48
|
numUnreadMessages: 0,
|
|
46
49
|
isLastMessageVisible: true,
|
|
50
|
+
isInputFocused: false,
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
export
|
|
53
|
+
export interface UseWebchat {
|
|
54
|
+
addMessage: (message: WebchatMessage) => void
|
|
55
|
+
addMessageComponent: (message: { props: WebchatMessage }) => void
|
|
56
|
+
clearMessages: () => void
|
|
57
|
+
doRenderCustomComponent: (toggle: boolean) => void
|
|
58
|
+
resetUnreadMessages: () => void
|
|
59
|
+
setCurrentAttachment: (attachment?: File) => void
|
|
60
|
+
setError: (error?: ErrorMessage) => void
|
|
61
|
+
setIsInputFocused: (isInputFocused: boolean) => void
|
|
62
|
+
setLastMessageVisible: (isLastMessageVisible: boolean) => void
|
|
63
|
+
setOnline: (online: boolean) => void
|
|
64
|
+
toggleCoverComponent: (toggle: boolean) => void
|
|
65
|
+
toggleEmojiPicker: (toggle: boolean) => void
|
|
66
|
+
togglePersistentMenu: (toggle: boolean) => void
|
|
67
|
+
toggleWebchat: (toggle: boolean) => void
|
|
68
|
+
updateDevSettings: (settings: DevSettings) => void
|
|
69
|
+
updateHandoff: (handoff: boolean) => void
|
|
70
|
+
updateLastMessageDate: (date: string) => void
|
|
71
|
+
updateLastRoutePath: (path: string) => void
|
|
72
|
+
updateLatestInput: (input: ClientInput) => void
|
|
73
|
+
updateMessage: (message: WebchatMessage) => void
|
|
74
|
+
updateReplies: (replies: (typeof Reply)[]) => void
|
|
75
|
+
updateSession: (session: Partial<Session>) => void
|
|
76
|
+
updateTheme: (theme: ThemeProps, themeUpdates?: ThemeProps) => void
|
|
77
|
+
updateTyping: (typing: boolean) => void
|
|
78
|
+
updateWebview: (webview: Webview, params: Record<string, string>) => void
|
|
79
|
+
removeReplies: () => void
|
|
80
|
+
removeWebview: () => void
|
|
81
|
+
webchatState: WebchatState
|
|
82
|
+
webchatContainerRef: React.MutableRefObject<HTMLDivElement | null>
|
|
83
|
+
headerRef: React.MutableRefObject<HTMLDivElement | null>
|
|
84
|
+
chatAreaRef: React.MutableRefObject<HTMLDivElement | null>
|
|
85
|
+
scrollableMessagesListRef: React.MutableRefObject<HTMLDivElement | null>
|
|
86
|
+
repliesRef: React.MutableRefObject<HTMLDivElement | null>
|
|
87
|
+
inputPanelRef: React.MutableRefObject<HTMLDivElement | null>
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function useWebchat(): UseWebchat {
|
|
50
91
|
const [webchatState, webchatDispatch] = useReducer(
|
|
51
92
|
webchatReducer,
|
|
52
93
|
webchatInitialState
|
|
53
94
|
)
|
|
54
95
|
|
|
55
|
-
const
|
|
96
|
+
const webchatContainerRef = useRef<HTMLDivElement | null>(null)
|
|
56
97
|
const chatAreaRef = useRef<HTMLDivElement | null>(null)
|
|
57
98
|
const inputPanelRef = useRef<HTMLDivElement | null>(null)
|
|
58
99
|
const headerRef = useRef<HTMLDivElement | null>(null)
|
|
@@ -71,9 +112,12 @@ export function useWebchat() {
|
|
|
71
112
|
const updateMessage = (message: WebchatMessage) =>
|
|
72
113
|
webchatDispatch({ type: WebchatAction.UPDATE_MESSAGE, payload: message })
|
|
73
114
|
|
|
74
|
-
const updateReplies = replies =>
|
|
115
|
+
const updateReplies = (replies: (typeof Reply)[]) =>
|
|
75
116
|
webchatDispatch({ type: WebchatAction.UPDATE_REPLIES, payload: replies })
|
|
76
117
|
|
|
118
|
+
const removeReplies = () =>
|
|
119
|
+
webchatDispatch({ type: WebchatAction.REMOVE_REPLIES, payload: [] })
|
|
120
|
+
|
|
77
121
|
const updateLatestInput = (input: ClientInput) =>
|
|
78
122
|
webchatDispatch({ type: WebchatAction.UPDATE_LATEST_INPUT, payload: input })
|
|
79
123
|
|
|
@@ -86,7 +130,12 @@ export function useWebchat() {
|
|
|
86
130
|
payload: { webview, webviewParams: params },
|
|
87
131
|
})
|
|
88
132
|
|
|
89
|
-
const
|
|
133
|
+
const removeWebview = () =>
|
|
134
|
+
webchatDispatch({
|
|
135
|
+
type: WebchatAction.REMOVE_WEBVIEW,
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
const updateSession = (session: Partial<Session>) => {
|
|
90
139
|
webchatDispatch({
|
|
91
140
|
type: WebchatAction.UPDATE_SESSION,
|
|
92
141
|
payload: session,
|
|
@@ -151,7 +200,7 @@ export function useWebchat() {
|
|
|
151
200
|
payload: toggle,
|
|
152
201
|
})
|
|
153
202
|
|
|
154
|
-
const setError = (error
|
|
203
|
+
const setError = (error?: ErrorMessage) =>
|
|
155
204
|
webchatDispatch({
|
|
156
205
|
type: WebchatAction.SET_ERROR,
|
|
157
206
|
payload: error,
|
|
@@ -176,7 +225,7 @@ export function useWebchat() {
|
|
|
176
225
|
})
|
|
177
226
|
}
|
|
178
227
|
|
|
179
|
-
const setCurrentAttachment = (attachment
|
|
228
|
+
const setCurrentAttachment = (attachment?: File) => {
|
|
180
229
|
webchatDispatch({
|
|
181
230
|
type: WebchatAction.SET_CURRENT_ATTACHMENT,
|
|
182
231
|
payload: attachment,
|
|
@@ -196,6 +245,13 @@ export function useWebchat() {
|
|
|
196
245
|
})
|
|
197
246
|
}
|
|
198
247
|
|
|
248
|
+
const setIsInputFocused = (isInputFocused: boolean) => {
|
|
249
|
+
webchatDispatch({
|
|
250
|
+
type: WebchatAction.SET_IS_INPUT_FOCUSED,
|
|
251
|
+
payload: isInputFocused,
|
|
252
|
+
})
|
|
253
|
+
}
|
|
254
|
+
|
|
199
255
|
return {
|
|
200
256
|
addMessage,
|
|
201
257
|
addMessageComponent,
|
|
@@ -204,6 +260,7 @@ export function useWebchat() {
|
|
|
204
260
|
resetUnreadMessages,
|
|
205
261
|
setCurrentAttachment,
|
|
206
262
|
setError,
|
|
263
|
+
setIsInputFocused,
|
|
207
264
|
setLastMessageVisible,
|
|
208
265
|
setOnline,
|
|
209
266
|
toggleCoverComponent,
|
|
@@ -221,9 +278,10 @@ export function useWebchat() {
|
|
|
221
278
|
updateTheme,
|
|
222
279
|
updateTyping,
|
|
223
280
|
updateWebview,
|
|
224
|
-
|
|
281
|
+
removeReplies,
|
|
282
|
+
removeWebview,
|
|
225
283
|
webchatState,
|
|
226
|
-
|
|
284
|
+
webchatContainerRef,
|
|
227
285
|
headerRef,
|
|
228
286
|
chatAreaRef,
|
|
229
287
|
scrollableMessagesListRef,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WebchatAction } from './actions'
|
|
2
|
-
import { WebchatState } from './index-types'
|
|
3
2
|
import { messagesReducer } from './messages-reducer'
|
|
3
|
+
import { WebchatState } from './types'
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line complexity
|
|
6
6
|
export function webchatReducer(
|
|
@@ -10,6 +10,8 @@ export function webchatReducer(
|
|
|
10
10
|
switch (action.type) {
|
|
11
11
|
case WebchatAction.UPDATE_WEBVIEW:
|
|
12
12
|
return { ...state, ...action.payload }
|
|
13
|
+
case WebchatAction.REMOVE_WEBVIEW:
|
|
14
|
+
return { ...state, webview: null, webviewParams: null }
|
|
13
15
|
case WebchatAction.UPDATE_SESSION:
|
|
14
16
|
return { ...state, session: { ...action.payload } }
|
|
15
17
|
case WebchatAction.UPDATE_TYPING:
|
|
@@ -48,6 +50,8 @@ export function webchatReducer(
|
|
|
48
50
|
return { ...state, lastRoutePath: action.payload }
|
|
49
51
|
case WebchatAction.SET_CURRENT_ATTACHMENT:
|
|
50
52
|
return { ...state, currentAttachment: action.payload }
|
|
53
|
+
case WebchatAction.SET_IS_INPUT_FOCUSED:
|
|
54
|
+
return { ...state, isInputFocused: action.payload }
|
|
51
55
|
default:
|
|
52
56
|
return messagesReducer(state, action)
|
|
53
57
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { useContext } from 'react'
|
|
2
|
+
|
|
3
|
+
import { COLORS, ROLES, WEBCHAT } from '../../constants'
|
|
4
|
+
import { Scale } from '../../shared/styles'
|
|
5
|
+
import { resolveImage } from '../../util/environment'
|
|
6
|
+
import { ConditionalWrapper } from '../../util/react'
|
|
7
|
+
import { WebchatContext } from '../../webchat/context'
|
|
8
|
+
import {
|
|
9
|
+
CloseHeader,
|
|
10
|
+
HeaderContainer,
|
|
11
|
+
ImageContainer,
|
|
12
|
+
Subtitle,
|
|
13
|
+
TextContainer,
|
|
14
|
+
Title,
|
|
15
|
+
} from './styles'
|
|
16
|
+
|
|
17
|
+
export const DefaultHeader = () => {
|
|
18
|
+
const { getThemeProperty, toggleWebchat } = useContext(WebchatContext)
|
|
19
|
+
|
|
20
|
+
const animationsEnabled = getThemeProperty(
|
|
21
|
+
WEBCHAT.CUSTOM_PROPERTIES.enableAnimations,
|
|
22
|
+
true
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const headerImage = getThemeProperty(
|
|
26
|
+
WEBCHAT.CUSTOM_PROPERTIES.headerImage,
|
|
27
|
+
getThemeProperty(
|
|
28
|
+
WEBCHAT.CUSTOM_PROPERTIES.brandImage,
|
|
29
|
+
WEBCHAT.DEFAULTS.LOGO
|
|
30
|
+
)
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
const headerTitle = getThemeProperty(
|
|
34
|
+
WEBCHAT.CUSTOM_PROPERTIES.headerTitle,
|
|
35
|
+
WEBCHAT.DEFAULTS.TITLE
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
const headerSubtitle = getThemeProperty(
|
|
39
|
+
WEBCHAT.CUSTOM_PROPERTIES.headerSubtitle,
|
|
40
|
+
''
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
const handleCloseWebchat = () => {
|
|
44
|
+
toggleWebchat(false)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const color = getThemeProperty(
|
|
48
|
+
WEBCHAT.CUSTOM_PROPERTIES.brandColor,
|
|
49
|
+
COLORS.BOTONIC_BLUE
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<HeaderContainer
|
|
54
|
+
role={ROLES.HEADER}
|
|
55
|
+
color={color}
|
|
56
|
+
style={{ ...getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.headerStyle) }}
|
|
57
|
+
>
|
|
58
|
+
{headerImage && (
|
|
59
|
+
<ImageContainer>
|
|
60
|
+
<img src={resolveImage(headerImage)} />
|
|
61
|
+
</ImageContainer>
|
|
62
|
+
)}
|
|
63
|
+
<TextContainer>
|
|
64
|
+
<Title>{headerTitle}</Title>
|
|
65
|
+
{headerSubtitle ? <Subtitle>{headerSubtitle}</Subtitle> : null}
|
|
66
|
+
</TextContainer>
|
|
67
|
+
<ConditionalWrapper
|
|
68
|
+
condition={animationsEnabled}
|
|
69
|
+
wrapper={children => <Scale>{children}</Scale>}
|
|
70
|
+
>
|
|
71
|
+
<CloseHeader onClick={handleCloseWebchat}>⨯</CloseHeader>
|
|
72
|
+
</ConditionalWrapper>
|
|
73
|
+
</HeaderContainer>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { ForwardedRef, forwardRef, useContext } from 'react'
|
|
2
|
+
|
|
3
|
+
import { WEBCHAT } from '../../constants'
|
|
4
|
+
import { WebchatContext } from '../../webchat/context'
|
|
5
|
+
import { BotonicContainerId } from '../constants'
|
|
6
|
+
import { DefaultHeader } from './default-header'
|
|
7
|
+
import { StyledWebchatHeader } from './styles'
|
|
8
|
+
|
|
9
|
+
export const WebchatHeader = forwardRef(
|
|
10
|
+
(_, ref: ForwardedRef<HTMLDivElement>) => {
|
|
11
|
+
const { getThemeProperty, toggleWebchat } = useContext(WebchatContext)
|
|
12
|
+
|
|
13
|
+
const handleCloseWebchat = () => {
|
|
14
|
+
toggleWebchat(false)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const CustomHeader = getThemeProperty(
|
|
18
|
+
WEBCHAT.CUSTOM_PROPERTIES.customHeader
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
if (CustomHeader) {
|
|
22
|
+
return (
|
|
23
|
+
<div id={BotonicContainerId.Header} ref={ref}>
|
|
24
|
+
<CustomHeader onCloseClick={handleCloseWebchat} />
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<StyledWebchatHeader id={BotonicContainerId.Header} ref={ref}>
|
|
31
|
+
<DefaultHeader />
|
|
32
|
+
</StyledWebchatHeader>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
WebchatHeader.displayName = 'WebchatHeader'
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
|
|
3
|
+
import { COLORS, WEBCHAT } from '../../constants'
|
|
4
|
+
|
|
5
|
+
export const HeaderContainer = styled.div`
|
|
6
|
+
display: flex;
|
|
7
|
+
background: linear-gradient(
|
|
8
|
+
90deg,
|
|
9
|
+
${COLORS.BLEACHED_CEDAR_PURPLE} 0%,
|
|
10
|
+
${props => props.color} 100%
|
|
11
|
+
);
|
|
12
|
+
border-radius: ${WEBCHAT.DEFAULTS.BORDER_RADIUS_TOP_CORNERS};
|
|
13
|
+
z-index: 2;
|
|
14
|
+
height: inherit;
|
|
15
|
+
`
|
|
16
|
+
|
|
17
|
+
export const ImageContainer = styled.div`
|
|
18
|
+
padding: 10px;
|
|
19
|
+
align-items: center;
|
|
20
|
+
|
|
21
|
+
img {
|
|
22
|
+
width: 32px;
|
|
23
|
+
border-radius: 50%;
|
|
24
|
+
}
|
|
25
|
+
`
|
|
26
|
+
|
|
27
|
+
export const TextContainer = styled.div`
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
flex: 1 1 auto;
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
export const Title = styled.div`
|
|
35
|
+
display: flex;
|
|
36
|
+
font-family: inherit;
|
|
37
|
+
font-size: 15px;
|
|
38
|
+
font-weight: bold;
|
|
39
|
+
color: ${COLORS.SOLID_WHITE};
|
|
40
|
+
`
|
|
41
|
+
|
|
42
|
+
export const Subtitle = styled.div`
|
|
43
|
+
display: flex;
|
|
44
|
+
font-family: inherit;
|
|
45
|
+
font-size: 11px;
|
|
46
|
+
color: ${COLORS.SOLID_WHITE};
|
|
47
|
+
`
|
|
48
|
+
|
|
49
|
+
export const CloseHeader = styled.div`
|
|
50
|
+
padding: 0px 16px;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
color: ${COLORS.SOLID_WHITE};
|
|
53
|
+
font-family: inherit;
|
|
54
|
+
font-size: 36px;
|
|
55
|
+
`
|
|
56
|
+
|
|
57
|
+
export const StyledWebchatHeader = styled.div`
|
|
58
|
+
border-radius: 8px 8px 0px 0px;
|
|
59
|
+
box-shadow: ${COLORS.PIGEON_POST_BLUE_ALPHA_0_5} 0px 2px 5px;
|
|
60
|
+
height: 55px;
|
|
61
|
+
flex: none;
|
|
62
|
+
`
|
|
@@ -6,6 +6,5 @@ export { useScrollToBottom } from './use-scroll-to-bottom'
|
|
|
6
6
|
export { useScrollbarController } from './use-scrollbar-controller'
|
|
7
7
|
export { useTyping } from './use-typing'
|
|
8
8
|
export { useVirtualKeyboardDetection } from './use-virtual-keyboard-detection'
|
|
9
|
-
export { useWebchat, webchatInitialState } from './use-webchat'
|
|
10
9
|
export { useWebchatDimensions } from './use-webchat-dimensions'
|
|
11
10
|
export { useWebchatResizer } from './use-webchat-resizer'
|
|
@@ -3,11 +3,17 @@ import {
|
|
|
3
3
|
getWebchatElement,
|
|
4
4
|
} from '../../util/dom'
|
|
5
5
|
|
|
6
|
+
interface UseScrollToBottom {
|
|
7
|
+
host: any
|
|
8
|
+
behavior?: ScrollBehavior
|
|
9
|
+
timeout?: number
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
export const useScrollToBottom = ({
|
|
7
13
|
host,
|
|
8
14
|
behavior = 'smooth',
|
|
9
15
|
timeout = 200,
|
|
10
|
-
}) => {
|
|
16
|
+
}: UseScrollToBottom) => {
|
|
11
17
|
const scrollToBottom = () => {
|
|
12
18
|
const webchatElement = getWebchatElement(host)
|
|
13
19
|
if (!webchatElement) return
|
|
@@ -17,7 +23,7 @@ export const useScrollToBottom = ({
|
|
|
17
23
|
setTimeout(() => {
|
|
18
24
|
scrollableMessagesListElement.scrollTo({
|
|
19
25
|
top: scrollableMessagesListElement.scrollHeight,
|
|
20
|
-
behavior: behavior
|
|
26
|
+
behavior: behavior,
|
|
21
27
|
})
|
|
22
28
|
}, timeout)
|
|
23
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext, useEffect } from 'react'
|
|
2
2
|
|
|
3
|
-
import { WebchatContext } from '../../
|
|
3
|
+
import { WebchatContext } from '../../webchat/context'
|
|
4
4
|
import { DEVICES, isMobileDevice } from '../devices'
|
|
5
5
|
|
|
6
6
|
// TODO: Investigate why when we have some messages, scroll actions are not disabled properly
|
|
@@ -25,12 +25,16 @@ const stopAtScrollLimit = element => {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const useScrollbarController = (currentDevice, host) => {
|
|
28
|
-
const {
|
|
29
|
-
|
|
28
|
+
const {
|
|
29
|
+
webchatContainerRef,
|
|
30
|
+
chatAreaRef,
|
|
31
|
+
repliesRef,
|
|
32
|
+
scrollableMessagesListRef,
|
|
33
|
+
} = useContext(WebchatContext)
|
|
30
34
|
|
|
31
35
|
const hasScrollbar = () => {
|
|
32
36
|
if (chatAreaRef.current && scrollableMessagesListRef.current) {
|
|
33
|
-
if (!repliesRef) {
|
|
37
|
+
if (!repliesRef?.current) {
|
|
34
38
|
return (
|
|
35
39
|
scrollableMessagesListRef.current?.scrollHeight >
|
|
36
40
|
chatAreaRef.current?.clientHeight
|
|
@@ -70,25 +74,25 @@ export const useScrollbarController = (currentDevice, host) => {
|
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
const toggleOnTouchMoveEvents = () => {
|
|
73
|
-
if (
|
|
77
|
+
if (webchatContainerRef.current && scrollableMessagesListRef.current) {
|
|
74
78
|
if (hasScrollbar()) {
|
|
75
79
|
scrollableMessagesListRef.current.style.touchAction = 'auto'
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
webchatContainerRef.current.style.touchAction = 'auto'
|
|
81
|
+
webchatContainerRef.current.ontouchmove = null
|
|
82
|
+
webchatContainerRef.current.ontouchstart = null
|
|
79
83
|
return
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
scrollableMessagesListRef.current.style.touchAction = 'none'
|
|
83
|
-
|
|
87
|
+
webchatContainerRef.current.style.touchAction = 'none'
|
|
84
88
|
}
|
|
85
|
-
if (
|
|
86
|
-
|
|
89
|
+
if (webchatContainerRef.current) {
|
|
90
|
+
webchatContainerRef.current.ontouchstart = e => {
|
|
87
91
|
if (e.target === e.currentTarget) {
|
|
88
92
|
e.preventDefault()
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
|
-
|
|
95
|
+
webchatContainerRef.current.ontouchmove = e => {
|
|
92
96
|
if (e.target === e.currentTarget) {
|
|
93
97
|
e.preventDefault()
|
|
94
98
|
}
|
|
@@ -122,22 +126,23 @@ export const useScrollbarController = (currentDevice, host) => {
|
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
const handleScrollEvents = () => {
|
|
125
|
-
if (
|
|
129
|
+
if (webchatContainerRef.current) {
|
|
126
130
|
if (isMobileDevice()) {
|
|
127
131
|
if (currentDevice !== DEVICES.MOBILE.IPHONE) return
|
|
128
132
|
|
|
129
133
|
limitScrollBoundaries()
|
|
130
134
|
|
|
131
|
-
|
|
132
|
-
|
|
135
|
+
webchatContainerRef.current.ontouchstart = handleOnTouchMoveEvents
|
|
136
|
+
webchatContainerRef.current.ontouchmove = handleOnTouchMoveEvents
|
|
133
137
|
} else {
|
|
134
|
-
|
|
138
|
+
webchatContainerRef.current.onmouseover = e =>
|
|
139
|
+
handleOnMouseOverEvents(e)
|
|
135
140
|
}
|
|
136
141
|
}
|
|
137
142
|
}
|
|
138
143
|
|
|
139
144
|
useEffect(() => {
|
|
140
|
-
const webchat =
|
|
145
|
+
const webchat = webchatContainerRef.current
|
|
141
146
|
|
|
142
147
|
handleScrollEvents()
|
|
143
148
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { useCallback, useContext } from 'react'
|
|
2
2
|
|
|
3
|
-
import { WebchatContext } from '../../
|
|
3
|
+
import { WebchatContext } from '../../webchat/context'
|
|
4
4
|
|
|
5
5
|
export const useWebchatDimensions = () => {
|
|
6
6
|
const {
|
|
7
|
-
|
|
7
|
+
webchatContainerRef,
|
|
8
8
|
headerRef,
|
|
9
9
|
inputPanelRef,
|
|
10
10
|
webchatState: { isWebchatOpen },
|
|
11
11
|
} = useContext(WebchatContext)
|
|
12
12
|
|
|
13
13
|
const calculateResizedPercentualWebchatHeight = useCallback(() => {
|
|
14
|
-
const webchatElement =
|
|
14
|
+
const webchatElement = webchatContainerRef.current
|
|
15
15
|
if (!isWebchatOpen || !webchatElement) return 0
|
|
16
16
|
const webchatHeight = webchatElement.clientHeight || 0
|
|
17
17
|
const keyboardOffset =
|
|
@@ -24,7 +24,7 @@ export const useWebchatDimensions = () => {
|
|
|
24
24
|
}, [isWebchatOpen])
|
|
25
25
|
|
|
26
26
|
const calculateResizedPxChatAreaHeight = useCallback(() => {
|
|
27
|
-
const webchatElement =
|
|
27
|
+
const webchatElement = webchatContainerRef.current
|
|
28
28
|
const headerElement = headerRef.current
|
|
29
29
|
const inputPanelElement = inputPanelRef.current
|
|
30
30
|
|