@botonic/react 0.36.0-alpha.0 → 0.36.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.d.ts → button/index.d.ts} +4 -5
- package/lib/cjs/components/{button.js → button/index.js} +26 -57
- package/lib/cjs/components/button/index.js.map +1 -0
- package/lib/cjs/components/button/styles.d.ts +2 -0
- package/lib/cjs/components/button/styles.js +40 -0
- package/lib/cjs/components/button/styles.js.map +1 -0
- package/lib/cjs/components/buttons-disabler.d.ts +20 -23
- package/lib/cjs/components/buttons-disabler.js +11 -26
- package/lib/cjs/components/buttons-disabler.js.map +1 -1
- package/lib/cjs/components/carousel.d.ts +8 -9
- package/lib/cjs/components/carousel.js +28 -24
- 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.d.ts +7 -3
- package/lib/cjs/components/element.js +12 -12
- 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 +6 -6
- package/lib/cjs/components/image.js.map +1 -1
- package/lib/cjs/components/index-types.d.ts +31 -132
- package/lib/cjs/components/index.d.ts +8 -2
- package/lib/cjs/components/index.js +16 -3
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/components/message/index.js +9 -8
- 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 +9 -20
- 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 +4 -4
- package/lib/cjs/components/message/message-footer.js.map +1 -1
- package/lib/cjs/components/message/message-image.js +3 -3
- package/lib/cjs/components/message/message-image.js.map +1 -1
- package/lib/cjs/components/message/styles.d.ts +11 -11
- package/lib/cjs/components/message/timestamps.d.ts +1 -1
- package/lib/cjs/components/message/timestamps.js +3 -3
- package/lib/cjs/components/message/timestamps.js.map +1 -1
- package/lib/cjs/components/multichannel/index-types.d.ts +0 -4
- package/lib/cjs/components/multichannel/multichannel-button.d.ts +1 -1
- package/lib/cjs/components/multichannel/multichannel-button.js +5 -5
- package/lib/cjs/components/multichannel/multichannel-button.js.map +1 -1
- package/lib/cjs/components/multichannel/multichannel-carousel.d.ts +1 -1
- package/lib/cjs/components/multichannel/multichannel-carousel.js +59 -62
- package/lib/cjs/components/multichannel/multichannel-carousel.js.map +1 -1
- package/lib/cjs/components/multichannel/multichannel-context.d.ts +0 -3
- package/lib/cjs/components/multichannel/multichannel-context.js +0 -3
- package/lib/cjs/components/multichannel/multichannel-context.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 +19 -15
- 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/pic.d.ts +8 -5
- package/lib/cjs/components/pic.js +8 -8
- package/lib/cjs/components/pic.js.map +1 -1
- package/lib/cjs/components/raw.d.ts +1 -1
- package/lib/cjs/components/reply.d.ts +7 -6
- package/lib/cjs/components/reply.js +13 -7
- package/lib/cjs/components/reply.js.map +1 -1
- package/lib/cjs/components/subtitle.d.ts +9 -5
- package/lib/cjs/components/subtitle.js +6 -7
- package/lib/cjs/components/subtitle.js.map +1 -1
- package/lib/cjs/components/text.d.ts +1 -1
- package/lib/cjs/components/title.d.ts +9 -5
- package/lib/cjs/components/title.js +6 -7
- package/lib/cjs/components/title.js.map +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 +18 -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 +6 -6
- 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 +6 -6
- 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 -18
- package/lib/cjs/constants.js +1 -19
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/contexts.d.ts +3 -8
- package/lib/cjs/contexts.js +11 -77
- package/lib/cjs/contexts.js.map +1 -1
- package/lib/cjs/dev-app.d.ts +7 -0
- package/lib/cjs/dev-app.js +8 -13
- package/lib/cjs/dev-app.js.map +1 -1
- package/lib/cjs/index-types.d.ts +85 -77
- 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 +9 -12
- package/lib/cjs/msg-to-botonic.js.map +1 -1
- package/lib/cjs/react-bot.d.ts +16 -6
- package/lib/cjs/react-bot.js +5 -6
- package/lib/cjs/react-bot.js.map +1 -1
- package/lib/cjs/shared/styles.d.ts +2 -2
- package/lib/cjs/time-zone-to-country-code.d.ts +1 -0
- package/lib/cjs/time-zone-to-country-code.js +108 -0
- package/lib/cjs/time-zone-to-country-code.js.map +1 -0
- 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 +19 -6
- package/lib/cjs/util/webchat.js +44 -8
- 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/chat-area/styles.d.ts +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 +3 -3
- 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 +6 -6
- package/lib/cjs/webchat/components/opened-persistent-menu.js.map +1 -1
- package/lib/{esm/webchat → cjs/webchat/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 +83 -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 +83 -0
- package/lib/cjs/webchat/context/types.js +3 -0
- package/lib/cjs/webchat/context/types.js.map +1 -0
- package/lib/cjs/webchat/context/use-webchat.d.ts +46 -0
- package/lib/cjs/webchat/{hooks → context}/use-webchat.js +53 -47
- 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 +6 -0
- package/lib/cjs/webchat/cover-component/index.js +21 -0
- package/lib/cjs/webchat/cover-component/index.js.map +1 -0
- 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 +63 -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 +2 -56
- 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 +1 -2
- package/lib/cjs/webchat/input-panel/attachment.js +7 -6
- package/lib/cjs/webchat/input-panel/attachment.js.map +1 -1
- package/lib/cjs/webchat/input-panel/emoji-picker.d.ts +1 -2
- package/lib/cjs/webchat/input-panel/emoji-picker.js +7 -6
- package/lib/cjs/webchat/input-panel/emoji-picker.js.map +1 -1
- package/lib/cjs/webchat/input-panel/index.d.ts +2 -5
- package/lib/cjs/webchat/input-panel/index.js +10 -5
- 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 -2
- package/lib/cjs/webchat/input-panel/persistent-menu.js +6 -5
- 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 +5 -4
- package/lib/cjs/webchat/input-panel/send-button.js.map +1 -1
- package/lib/cjs/webchat/input-panel/styles.d.ts +3 -3
- package/lib/cjs/webchat/input-panel/textarea.d.ts +2 -4
- package/lib/cjs/webchat/input-panel/textarea.js +16 -6
- 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 +3 -3
- 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.d.ts +5 -5
- 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 +6 -6
- 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 +4 -0
- package/lib/cjs/webchat/styles.js +65 -0
- package/lib/cjs/webchat/styles.js.map +1 -0
- package/lib/cjs/webchat/theme/default-theme.d.ts +2 -0
- package/lib/cjs/webchat/theme/default-theme.js +104 -0
- package/lib/cjs/webchat/theme/default-theme.js.map +1 -0
- package/lib/cjs/webchat/theme/types.d.ts +214 -0
- package/lib/cjs/webchat/theme/types.js +3 -0
- package/lib/cjs/webchat/theme/types.js.map +1 -0
- package/lib/cjs/webchat/tracking.d.ts +10 -0
- package/lib/cjs/webchat/tracking.js +39 -1
- package/lib/cjs/webchat/tracking.js.map +1 -1
- package/lib/cjs/webchat/trigger-button/index.d.ts +1 -0
- package/lib/cjs/webchat/trigger-button/index.js +5 -5
- package/lib/cjs/webchat/trigger-button/index.js.map +1 -1
- package/lib/cjs/webchat/trigger-button/styles.d.ts +3 -3
- 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 +4 -3
- 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 +3 -3
- 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 +110 -148
- 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 +36 -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 +60 -0
- package/lib/cjs/webchat/webview/styles.js.map +1 -0
- package/lib/cjs/webchat-app.d.ts +95 -86
- package/lib/cjs/webchat-app.js +164 -72
- package/lib/cjs/webchat-app.js.map +1 -1
- package/lib/cjs/webview-app.js +54 -12
- 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.d.ts → button/index.d.ts} +4 -5
- package/lib/esm/components/{button.js → button/index.js} +26 -56
- package/lib/esm/components/button/index.js.map +1 -0
- package/lib/esm/components/button/styles.d.ts +2 -0
- package/lib/esm/components/button/styles.js +36 -0
- package/lib/esm/components/button/styles.js.map +1 -0
- package/lib/esm/components/buttons-disabler.d.ts +20 -23
- package/lib/esm/components/buttons-disabler.js +11 -26
- package/lib/esm/components/buttons-disabler.js.map +1 -1
- package/lib/esm/components/carousel.d.ts +8 -9
- package/lib/esm/components/carousel.js +27 -23
- 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.d.ts +7 -3
- package/lib/esm/components/element.js +10 -10
- 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 +5 -5
- package/lib/esm/components/image.js.map +1 -1
- package/lib/esm/components/index-types.d.ts +31 -132
- package/lib/esm/components/index.d.ts +8 -2
- package/lib/esm/components/index.js +8 -2
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/components/message/index.js +7 -6
- 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 +10 -21
- 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 +3 -3
- package/lib/esm/components/message/message-footer.js.map +1 -1
- package/lib/esm/components/message/message-image.js +2 -2
- package/lib/esm/components/message/message-image.js.map +1 -1
- package/lib/esm/components/message/styles.d.ts +11 -11
- package/lib/esm/components/message/timestamps.d.ts +1 -1
- package/lib/esm/components/message/timestamps.js +2 -2
- package/lib/esm/components/message/timestamps.js.map +1 -1
- package/lib/esm/components/multichannel/index-types.d.ts +0 -4
- package/lib/esm/components/multichannel/multichannel-button.d.ts +1 -1
- package/lib/esm/components/multichannel/multichannel-button.js +2 -2
- package/lib/esm/components/multichannel/multichannel-button.js.map +1 -1
- package/lib/esm/components/multichannel/multichannel-carousel.d.ts +1 -1
- package/lib/esm/components/multichannel/multichannel-carousel.js +62 -65
- package/lib/esm/components/multichannel/multichannel-carousel.js.map +1 -1
- package/lib/esm/components/multichannel/multichannel-context.d.ts +0 -3
- package/lib/esm/components/multichannel/multichannel-context.js +0 -3
- package/lib/esm/components/multichannel/multichannel-context.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 +9 -5
- 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/pic.d.ts +8 -5
- package/lib/esm/components/pic.js +6 -6
- package/lib/esm/components/pic.js.map +1 -1
- package/lib/esm/components/raw.d.ts +1 -1
- package/lib/esm/components/reply.d.ts +7 -6
- package/lib/esm/components/reply.js +13 -7
- package/lib/esm/components/reply.js.map +1 -1
- package/lib/esm/components/subtitle.d.ts +9 -5
- package/lib/esm/components/subtitle.js +4 -5
- package/lib/esm/components/subtitle.js.map +1 -1
- package/lib/esm/components/text.d.ts +1 -1
- package/lib/esm/components/title.d.ts +9 -5
- package/lib/esm/components/title.js +4 -5
- package/lib/esm/components/title.js.map +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 +18 -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 +6 -6
- package/lib/esm/components/whatsapp-button-list.js.map +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 +3 -3
- package/lib/esm/components/whatsapp-cta-url-button.js.map +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 -18
- package/lib/esm/constants.js +0 -18
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/contexts.d.ts +3 -8
- package/lib/esm/contexts.js +10 -76
- package/lib/esm/contexts.js.map +1 -1
- package/lib/esm/dev-app.d.ts +7 -0
- package/lib/esm/dev-app.js +8 -13
- package/lib/esm/dev-app.js.map +1 -1
- package/lib/esm/index-types.d.ts +85 -77
- 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 +8 -11
- package/lib/esm/msg-to-botonic.js.map +1 -1
- package/lib/esm/react-bot.d.ts +16 -6
- package/lib/esm/react-bot.js +5 -6
- package/lib/esm/react-bot.js.map +1 -1
- package/lib/esm/shared/styles.d.ts +2 -2
- package/lib/esm/time-zone-to-country-code.d.ts +1 -0
- package/lib/esm/time-zone-to-country-code.js +105 -0
- package/lib/esm/time-zone-to-country-code.js.map +1 -0
- 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 +19 -6
- package/lib/esm/util/webchat.js +42 -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/chat-area/styles.d.ts +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 +2 -2
- 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 +3 -3
- package/lib/esm/webchat/components/opened-persistent-menu.js.map +1 -1
- package/lib/{cjs/webchat → esm/webchat/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 +79 -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 +83 -0
- package/lib/esm/webchat/context/types.js +2 -0
- package/lib/esm/webchat/context/types.js.map +1 -0
- package/lib/esm/webchat/context/use-webchat.d.ts +46 -0
- package/lib/esm/webchat/{hooks → context}/use-webchat.js +51 -45
- 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 +6 -0
- package/lib/esm/webchat/cover-component/index.js +17 -0
- package/lib/esm/webchat/cover-component/index.js.map +1 -0
- 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 +59 -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 +2 -56
- 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 +1 -2
- package/lib/esm/webchat/input-panel/attachment.js +8 -7
- package/lib/esm/webchat/input-panel/attachment.js.map +1 -1
- package/lib/esm/webchat/input-panel/emoji-picker.d.ts +1 -2
- package/lib/esm/webchat/input-panel/emoji-picker.js +8 -7
- package/lib/esm/webchat/input-panel/emoji-picker.js.map +1 -1
- package/lib/esm/webchat/input-panel/index.d.ts +2 -5
- package/lib/esm/webchat/input-panel/index.js +9 -4
- 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 -2
- package/lib/esm/webchat/input-panel/persistent-menu.js +7 -6
- 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 +6 -5
- package/lib/esm/webchat/input-panel/send-button.js.map +1 -1
- package/lib/esm/webchat/input-panel/styles.d.ts +3 -3
- package/lib/esm/webchat/input-panel/textarea.d.ts +2 -4
- package/lib/esm/webchat/input-panel/textarea.js +16 -6
- 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 +2 -2
- 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.d.ts +5 -5
- 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 +5 -5
- 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 +4 -0
- package/lib/esm/webchat/styles.js +61 -0
- package/lib/esm/webchat/styles.js.map +1 -0
- package/lib/esm/webchat/theme/default-theme.d.ts +2 -0
- package/lib/esm/webchat/theme/default-theme.js +101 -0
- package/lib/esm/webchat/theme/default-theme.js.map +1 -0
- package/lib/esm/webchat/theme/types.d.ts +214 -0
- package/lib/esm/webchat/theme/types.js +2 -0
- package/lib/esm/webchat/theme/types.js.map +1 -0
- package/lib/esm/webchat/tracking.d.ts +10 -0
- package/lib/esm/webchat/tracking.js +37 -0
- package/lib/esm/webchat/tracking.js.map +1 -1
- package/lib/esm/webchat/trigger-button/index.d.ts +1 -0
- package/lib/esm/webchat/trigger-button/index.js +4 -4
- package/lib/esm/webchat/trigger-button/index.js.map +1 -1
- package/lib/esm/webchat/trigger-button/styles.d.ts +3 -3
- 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 +4 -3
- 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 +3 -3
- 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 +110 -148
- 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 +32 -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 +56 -0
- package/lib/esm/webchat/webview/styles.js.map +1 -0
- package/lib/esm/webchat-app.d.ts +95 -86
- package/lib/esm/webchat-app.js +165 -73
- package/lib/esm/webchat-app.js.map +1 -1
- package/lib/esm/webview-app.js +55 -13
- package/lib/esm/webview-app.js.map +1 -1
- package/package.json +23 -18
- package/src/components/{audio.jsx → audio.tsx} +10 -4
- package/src/components/{button.tsx → button/index.tsx} +26 -104
- package/src/components/button/styles.ts +38 -0
- package/src/components/{buttons-disabler.js → buttons-disabler.ts} +35 -39
- package/src/components/{carousel.jsx → carousel.tsx} +60 -36
- 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 → element.tsx} +12 -14
- package/src/components/handoff.jsx +1 -1
- package/src/components/{image.jsx → image.tsx} +13 -6
- package/src/components/index-types.ts +24 -119
- package/src/components/index.ts +23 -2
- package/src/components/message/index.jsx +7 -10
- package/src/components/message/message-feedback.tsx +10 -27
- package/src/components/message/message-footer.tsx +3 -3
- package/src/components/message/message-image.tsx +2 -5
- package/src/components/message/timestamps.tsx +2 -3
- package/src/components/multichannel/index-types.ts +0 -4
- package/src/components/multichannel/multichannel-button.jsx +2 -2
- package/src/components/multichannel/multichannel-carousel.jsx +96 -94
- package/src/components/multichannel/multichannel-context.jsx +0 -3
- package/src/components/multichannel/multichannel-text.jsx +12 -6
- 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/{pic.jsx → pic.tsx} +12 -5
- package/src/components/{reply.jsx → reply.tsx} +12 -12
- package/src/components/{subtitle.jsx → subtitle.tsx} +10 -10
- package/src/components/{title.jsx → title.tsx} +8 -6
- package/src/components/{video.jsx → video.tsx} +3 -2
- package/src/components/webchat-settings.tsx +22 -2
- package/src/components/whatsapp-button-list.tsx +6 -6
- package/src/components/whatsapp-catalog.tsx +42 -0
- package/src/components/whatsapp-cta-url-button.tsx +6 -3
- 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 -19
- package/src/contexts.tsx +14 -87
- package/src/dev-app.jsx +6 -30
- package/src/index-types.ts +100 -84
- package/src/index.ts +1 -5
- package/src/msg-to-botonic.jsx +8 -12
- package/src/react-bot.tsx +51 -0
- package/src/time-zone-to-country-code.ts +104 -0
- package/src/util/functional.ts +31 -0
- package/src/util/webchat.ts +102 -0
- package/src/webchat/chat-area/index.tsx +2 -4
- package/src/webchat/components/conditional-animation.jsx +3 -3
- package/src/webchat/components/opened-persistent-menu.jsx +3 -4
- package/src/webchat/{actions.ts → context/actions.ts} +4 -0
- package/src/webchat/context/index.tsx +82 -0
- package/src/webchat/{messages-reducer.ts → context/messages-reducer.ts} +4 -2
- package/src/webchat/context/types.ts +91 -0
- package/src/webchat/{hooks → context}/use-webchat.ts +104 -53
- package/src/webchat/{webchat-reducer.ts → context/webchat-reducer.ts} +5 -1
- package/src/webchat/cover-component/index.tsx +31 -0
- package/src/webchat/global.d.ts +3 -0
- package/src/webchat/header/default-header.tsx +64 -0
- package/src/webchat/header/index.tsx +37 -0
- package/src/webchat/header/styles.ts +66 -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 +2 -63
- package/src/webchat/index.ts +1 -0
- package/src/webchat/input-panel/attachment.tsx +6 -17
- package/src/webchat/input-panel/emoji-picker.tsx +6 -16
- package/src/webchat/input-panel/index.tsx +9 -16
- package/src/webchat/input-panel/persistent-menu.tsx +6 -16
- package/src/webchat/input-panel/send-button.tsx +4 -10
- package/src/webchat/input-panel/textarea.tsx +22 -15
- package/src/webchat/message-list/index.tsx +78 -49
- package/src/webchat/message-list/intro-message.tsx +2 -3
- 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 +5 -9
- 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 +65 -0
- package/src/webchat/theme/default-theme.ts +102 -0
- package/src/webchat/theme/theme.d.ts +8 -0
- package/src/webchat/theme/types.ts +206 -0
- package/src/webchat/tracking.ts +59 -0
- package/src/webchat/trigger-button/index.tsx +4 -6
- 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} +191 -243
- package/src/webchat/webview/header.tsx +22 -0
- package/src/webchat/webview/index.tsx +66 -0
- package/src/webchat/webview/styles.ts +62 -0
- package/src/webchat-app.tsx +575 -0
- package/src/webview-app.tsx +60 -16
- package/lib/cjs/components/button.js.map +0 -1
- 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.d.ts +0 -46
- 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/components/button.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.d.ts +0 -46
- 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/react-bot.jsx +0 -38
- package/src/util/webchat.js +0 -57
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webchat/typing-indicator/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webchat/typing-indicator/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAgB,UAAU,EAAE,MAAM,OAAO,CAAA;AAEvD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEjE,MAAM,eAAe,GAAG,UAAU,CAChC,CAAC,MAAM,EAAE,GAAiC,EAAE,EAAE,CAAC,CAC7C,KAAC,eAAe,kBAAC,GAAG,EAAE,GAAG,gBACvB,MAAC,gBAAgB,kBACf,IAAI,EAAE,KAAK,CAAC,gBAAgB,EAC5B,SAAS,EAAC,kBAAkB,EAC5B,eAAe,EAAE,MAAM,CAAC,cAAc,iBAEtC,KAAC,GAAG,KAAG,EACP,KAAC,GAAG,KAAG,EACP,KAAC,GAAG,KAAG,KACU,IACH,CACnB,CACF,CAAA;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAA;AAE/C,eAAe,eAAe,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export declare const TypingContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
2
|
+
interface TypingMsgWrapperProps {
|
|
2
3
|
backgroundColor: string;
|
|
3
4
|
}
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const Dot: import("styled-components").StyledComponent<"span",
|
|
5
|
+
export declare const TypingMsgWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TypingMsgWrapperProps, never>;
|
|
6
|
+
export declare const Dot: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
6
7
|
export {};
|
|
@@ -9,12 +9,15 @@ const bulge = keyframes `
|
|
|
9
9
|
transform: scale(1.05);
|
|
10
10
|
}
|
|
11
11
|
`;
|
|
12
|
-
export const
|
|
12
|
+
export const TypingContainer = styled.div `
|
|
13
|
+
padding: 0px 8px 8px 8px;
|
|
14
|
+
`;
|
|
15
|
+
export const TypingMsgWrapper = styled.div `
|
|
13
16
|
will-change: transform;
|
|
14
17
|
width: 44px;
|
|
15
18
|
line-height: 0px;
|
|
16
19
|
border-radius: 20px;
|
|
17
|
-
padding: 8px 2px
|
|
20
|
+
padding: 8px 2px;
|
|
18
21
|
text-align: center;
|
|
19
22
|
display: block;
|
|
20
23
|
margin: 8px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/webchat/typing-indicator/styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,KAAK,GAAG,SAAS,CAAA;;;;CAItB,CAAA;AAED,MAAM,KAAK,GAAG,SAAS,CAAA;;;;CAItB,CAAA;AAMD,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/webchat/typing-indicator/styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,KAAK,GAAG,SAAS,CAAA;;;;CAItB,CAAA;AAED,MAAM,KAAK,GAAG,SAAS,CAAA;;;;CAItB,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;CAExC,CAAA;AAMD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAuB;;;;;;;;;;kBAU/C,KAAK;sBACD,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe;CACnD,CAAA;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAA;;;;;;;;;oBASV,KAAK;;;oBAGL,KAAK;;;oBAGL,KAAK;;CAExB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export const DebugTab: import("styled-components").StyledComponent<"div",
|
|
1
|
+
export const DebugTab: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
2
2
|
export function DebugTabPortal({ webchatHooks, ...props }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
webchatHooks: any;
|
|
5
|
-
}):
|
|
5
|
+
}): React.ReactPortal;
|
|
6
6
|
export const WebchatDev: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
7
|
-
import
|
|
7
|
+
import React from "react";
|
|
@@ -5,7 +5,7 @@ import merge from 'lodash.merge';
|
|
|
5
5
|
import React, { forwardRef, useEffect } from 'react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { useWebchat } from './
|
|
8
|
+
import { useWebchat } from './context/use-webchat';
|
|
9
9
|
import { SessionView } from './session-view';
|
|
10
10
|
import { Webchat } from './webchat';
|
|
11
11
|
export const DebugTab = styled.div `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webchat-dev.js","sourceRoot":"","sources":["../../../src/webchat/webchat-dev.jsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,MAAM,cAAc,CAAA;AAChC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"webchat-dev.js","sourceRoot":"","sources":["../../../src/webchat/webchat-dev.jsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,MAAM,cAAc,CAAA;AAChC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAA;;;;WAIvB,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;YACvC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;CAClD,CAAA;AAED,iEAAiE;AACjE,wEAAwE;AACxE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAA0B,EAAE,EAAE;QAA9B,EAAE,YAAY,OAAY,EAAP,KAAK,cAAxB,gBAA0B,CAAF;IACrD,OAAA,YAAY,CACV,KAAC,QAAQ,oBAAK,KAAK,cACjB,KAAC,WAAW,IAAC,YAAY,EAAE,YAAY,GAAI,IAClC,EACX,QAAQ,CAAC,IAAI,CACd,CAAA;CAAA,CAAA;AAEH,MAAM,cAAc,GAAG;IACrB,oBAAoB,EAAE,IAAI;IAC1B,YAAY,EAAE,EAAE;IAChB,IAAI,EAAE;QACJ,EAAE,EAAE,QAAQ;QACZ,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,WAAW,EAAE,SAAS;QACtB,UAAU,EAAE,EAAE;KACf;IACD,YAAY,EAAE,EAAE;IAChB,GAAG,EAAE;QACH,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;KAChB;CACF,CAAA;AAED,8CAA8C;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAClD,MAAM,YAAY,GAAG,UAAU,EAAE,CAAA;IACjC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,YAAY,CAAA;IAElD;;6CAEyC;IACzC,SAAS,CAAC,GAAG,EAAE;QACb,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;IACrD,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;IAEjB,OAAO,CACL,8BACE,KAAC,OAAO,kBACN,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,IACpC,KAAK,IACT,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,kBAAkB,EAAE;oBAClB,mBAAmB,EAAE,YAAY,CAAC,WAAW,CAAC,mBAAmB;oBACjE,eAAe,EAAE,YAAY,CAAC,WAAW,CAAC,eAAe;iBAC1D,IACD,EACF,KAAC,cAAc,IACb,IAAI,EAAE,YAAY,CAAC,WAAW,CAAC,eAAe,EAC9C,YAAY,EAAE,YAAY,GAC1B,IACD,CACJ,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WebchatProps, WebchatRef } from '../index-types';
|
|
3
|
+
declare const Webchat: React.ForwardRefExoticComponent<WebchatProps & React.RefAttributes<WebchatRef | null>>;
|
|
4
|
+
export { Webchat };
|
|
@@ -1,83 +1,37 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { BotonicAction, INPUT,
|
|
3
|
+
import { BotonicAction, INPUT, params2queryString } from '@botonic/core';
|
|
4
4
|
import merge from 'lodash.merge';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState, } from 'react';
|
|
6
|
+
import { StyleSheetManager, ThemeProvider } from 'styled-components';
|
|
7
7
|
import { v7 as uuidv7 } from 'uuid';
|
|
8
|
-
import { Audio, Document, Image, Text, Video } from '../components';
|
|
9
|
-
import { Handoff } from '../components/handoff';
|
|
10
|
-
import { normalizeWebchatSettings } from '../components/webchat-settings';
|
|
8
|
+
import { Audio, Document, Handoff, Image, normalizeWebchatSettings, Text, Video, } from '../components';
|
|
11
9
|
import { COLORS, MAX_ALLOWED_SIZE_MB, ROLES, WEBCHAT } from '../constants';
|
|
12
|
-
import { WebchatContext, WebviewRequestContext } from '../contexts';
|
|
13
10
|
import { SENDERS } from '../index-types';
|
|
14
11
|
import { getMediaType, isAllowedSize, isAudio, isDocument, isImage, isMedia, isText, isVideo, readDataURL, } from '../message-utils';
|
|
15
12
|
import { msgToBotonic } from '../msg-to-botonic';
|
|
16
13
|
import { isDev } from '../util/environment';
|
|
17
14
|
import { deserializeRegex, stringifyWithRegexs } from '../util/regexs';
|
|
18
|
-
import { _getThemeProperty, getServerErrorMessage, initSession, shouldKeepSessionOnReload, } from '../util/webchat';
|
|
15
|
+
import { _getThemeProperty, getServerErrorMessage, initSession, shouldKeepSessionOnReload, updateUserLocaleAndCountry, } from '../util/webchat';
|
|
19
16
|
import { ChatArea } from './chat-area';
|
|
20
17
|
import { OpenedPersistentMenu } from './components/opened-persistent-menu';
|
|
21
18
|
import { BotonicContainerId } from './constants';
|
|
19
|
+
import { useWebchat, WebchatContext } from './context';
|
|
20
|
+
import { CoverComponent } from './cover-component';
|
|
22
21
|
import { WebchatHeader } from './header';
|
|
23
|
-
import { useComponentWillMount, usePrevious, useScrollToBottom, useTyping,
|
|
22
|
+
import { useComponentWillMount, usePrevious, useScrollToBottom, useTyping, } from './hooks';
|
|
24
23
|
import { InputPanel } from './input-panel';
|
|
24
|
+
import { DarkBackgroundMenu, ErrorMessage, ErrorMessageContainer, StyledWebchat, } from './styles';
|
|
25
25
|
import { TriggerButton } from './trigger-button';
|
|
26
26
|
import { useStorageState } from './use-storage-state-hook';
|
|
27
27
|
import { getParsedAction } from './utils';
|
|
28
|
-
import { WebviewContainer } from './webview';
|
|
29
|
-
const StyledWebchat = styled.div `
|
|
30
|
-
position: fixed;
|
|
31
|
-
right: 20px;
|
|
32
|
-
bottom: 20px;
|
|
33
|
-
width: ${props => props.width}px;
|
|
34
|
-
height: ${props => props.height}px;
|
|
35
|
-
margin: auto;
|
|
36
|
-
background-color: ${COLORS.SOLID_WHITE};
|
|
37
|
-
border-radius: 10px;
|
|
38
|
-
box-shadow: ${COLORS.SOLID_BLACK_ALPHA_0_2} 0px 0px 12px;
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-direction: column;
|
|
41
|
-
justify-content: space-between;
|
|
42
|
-
overflow: hidden;
|
|
43
|
-
`;
|
|
44
|
-
const ErrorMessageContainer = styled.div `
|
|
45
|
-
position: relative;
|
|
46
|
-
display: flex;
|
|
47
|
-
z-index: 1;
|
|
48
|
-
justify-content: center;
|
|
49
|
-
width: 100%;
|
|
50
|
-
`;
|
|
51
|
-
const ErrorMessage = styled.div `
|
|
52
|
-
position: absolute;
|
|
53
|
-
top: 10px;
|
|
54
|
-
font-size: 14px;
|
|
55
|
-
line-height: 20px;
|
|
56
|
-
padding: 4px 11px;
|
|
57
|
-
display: flex;
|
|
58
|
-
background-color: ${COLORS.ERROR_RED};
|
|
59
|
-
color: ${COLORS.CONCRETE_WHITE};
|
|
60
|
-
border-radius: 5px;
|
|
61
|
-
align-items: center;
|
|
62
|
-
justify-content: center;
|
|
63
|
-
font-family: ${WEBCHAT.DEFAULTS.FONT_FAMILY};
|
|
64
|
-
`;
|
|
65
|
-
const DarkBackgroundMenu = styled.div `
|
|
66
|
-
background: ${COLORS.SOLID_BLACK};
|
|
67
|
-
opacity: 0.3;
|
|
68
|
-
z-index: 1;
|
|
69
|
-
right: 0;
|
|
70
|
-
bottom: 0;
|
|
71
|
-
border-radius: 10px;
|
|
72
|
-
position: absolute;
|
|
73
|
-
width: 100%;
|
|
74
|
-
height: 100%;
|
|
75
|
-
`;
|
|
28
|
+
import { WebviewContainer } from './webview/index';
|
|
76
29
|
// eslint-disable-next-line complexity, react/display-name
|
|
77
|
-
|
|
78
|
-
|
|
30
|
+
const Webchat = forwardRef((props, ref) => {
|
|
31
|
+
var _a;
|
|
32
|
+
const { addMessage, addMessageComponent, clearMessages, doRenderCustomComponent, resetUnreadMessages, setCurrentAttachment, setError, setIsInputFocused, setLastMessageVisible, setOnline, toggleCoverComponent, toggleEmojiPicker, togglePersistentMenu, toggleWebchat, updateDevSettings, updateHandoff, updateLastMessageDate, updateLastRoutePath, updateLatestInput, updateMessage, updateReplies, updateSession, updateTheme, updateTyping, updateWebview, removeWebview, removeReplies, webchatState, webchatContainerRef, chatAreaRef, inputPanelRef, headerRef, repliesRef, scrollableMessagesListRef,
|
|
79
33
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
80
|
-
} = props.webchatHooks || useWebchat();
|
|
34
|
+
} = props.webchatHooks || useWebchat(props.theme);
|
|
81
35
|
const firstUpdate = useRef(true);
|
|
82
36
|
const isOnline = () => webchatState.online;
|
|
83
37
|
const currentDateString = () => new Date().toISOString();
|
|
@@ -92,7 +46,7 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
92
46
|
const [botonicState, saveState] = useStorageState(storage, storageKey);
|
|
93
47
|
const host = props.host || document.body;
|
|
94
48
|
const { scrollToBottom } = useScrollToBottom({ host });
|
|
95
|
-
const saveWebchatState = webchatState => {
|
|
49
|
+
const saveWebchatState = (webchatState) => {
|
|
96
50
|
storage &&
|
|
97
51
|
saveState(JSON.parse(stringifyWithRegexs({
|
|
98
52
|
messages: webchatState.messagesJSON,
|
|
@@ -103,28 +57,29 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
103
57
|
themeUpdates: webchatState.themeUpdates,
|
|
104
58
|
})));
|
|
105
59
|
};
|
|
106
|
-
const handleAttachment = event => {
|
|
60
|
+
const handleAttachment = (event) => {
|
|
107
61
|
if (!isAllowedSize(event.target.files[0].size)) {
|
|
108
62
|
throw new Error(`The file is too large. A maximum of ${MAX_ALLOWED_SIZE_MB}MB is allowed.`);
|
|
109
63
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
file: event.target.files[0],
|
|
113
|
-
attachmentType: getMediaType(event.target.files[0].type),
|
|
114
|
-
});
|
|
64
|
+
// TODO: Attach more files?
|
|
65
|
+
setCurrentAttachment(event.target.files[0]);
|
|
115
66
|
};
|
|
116
67
|
useEffect(() => {
|
|
117
|
-
if (webchatState.currentAttachment)
|
|
68
|
+
if (webchatState.currentAttachment) {
|
|
118
69
|
sendAttachment(webchatState.currentAttachment);
|
|
70
|
+
}
|
|
119
71
|
}, [webchatState.currentAttachment]);
|
|
120
72
|
const sendUserInput = (input) => __awaiter(void 0, void 0, void 0, function* () {
|
|
121
73
|
if (props.onUserInput) {
|
|
122
74
|
resetUnreadMessages();
|
|
123
|
-
scrollToBottom(
|
|
75
|
+
scrollToBottom();
|
|
124
76
|
props.onUserInput({
|
|
125
77
|
user: webchatState.session.user,
|
|
78
|
+
// TODO: Review if this input.sentBy exists in the frontend
|
|
126
79
|
input: input,
|
|
80
|
+
//@ts-ignore
|
|
127
81
|
session: webchatState.session,
|
|
82
|
+
// TODO: Review why we were passing lastRoutePath, is only for devMode?
|
|
128
83
|
lastRoutePath: webchatState.lastRoutePath,
|
|
129
84
|
});
|
|
130
85
|
}
|
|
@@ -161,9 +116,10 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
161
116
|
if (shouldKeepSessionOnReload({ initialDevSettings, devSettings })) {
|
|
162
117
|
if (messages) {
|
|
163
118
|
messages.forEach(message => {
|
|
119
|
+
var _a, _b;
|
|
164
120
|
addMessage(message);
|
|
165
|
-
const newMessageComponent = msgToBotonic(Object.assign(Object.assign({}, message), { delay: 0, typing: 0 }), (props.theme.message
|
|
166
|
-
|
|
121
|
+
const newMessageComponent = msgToBotonic(Object.assign(Object.assign({}, message), { delay: 0, typing: 0 }), (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.customTypes);
|
|
122
|
+
//@ts-ignore
|
|
167
123
|
if (newMessageComponent)
|
|
168
124
|
addMessageComponent(newMessageComponent);
|
|
169
125
|
});
|
|
@@ -179,12 +135,20 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
179
135
|
updateDevSettings(devSettings);
|
|
180
136
|
else if (initialDevSettings)
|
|
181
137
|
updateDevSettings(initialDevSettings);
|
|
182
|
-
if (lastMessageUpdate)
|
|
138
|
+
if (lastMessageUpdate) {
|
|
183
139
|
updateLastMessageDate(lastMessageUpdate);
|
|
184
|
-
|
|
140
|
+
}
|
|
141
|
+
if (themeUpdates !== undefined) {
|
|
185
142
|
updateTheme(merge(props.theme, themeUpdates), themeUpdates);
|
|
186
|
-
|
|
187
|
-
|
|
143
|
+
}
|
|
144
|
+
if (props.onInit) {
|
|
145
|
+
setTimeout(() => {
|
|
146
|
+
if (typeof props.onInit === 'function') {
|
|
147
|
+
props.onInit();
|
|
148
|
+
session.user = updateUserLocaleAndCountry(session.user);
|
|
149
|
+
}
|
|
150
|
+
}, 100);
|
|
151
|
+
}
|
|
188
152
|
}, []);
|
|
189
153
|
useEffect(() => {
|
|
190
154
|
if (!webchatState.isWebchatOpen) {
|
|
@@ -195,8 +159,9 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
195
159
|
}
|
|
196
160
|
}, [webchatState.isWebchatOpen]);
|
|
197
161
|
useEffect(() => {
|
|
198
|
-
|
|
199
|
-
|
|
162
|
+
const { messagesJSON, session } = webchatState;
|
|
163
|
+
if (onStateChange && typeof onStateChange === 'function' && session.user) {
|
|
164
|
+
onStateChange({ messagesJSON, user: session.user });
|
|
200
165
|
}
|
|
201
166
|
saveWebchatState(webchatState);
|
|
202
167
|
}, [
|
|
@@ -225,11 +190,12 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
225
190
|
const openWebview = (webviewComponent, params) => {
|
|
226
191
|
updateWebview(webviewComponent, params);
|
|
227
192
|
};
|
|
228
|
-
const textareaRef = useRef(
|
|
193
|
+
const textareaRef = useRef();
|
|
229
194
|
const closeWebview = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
230
|
-
|
|
195
|
+
var _b;
|
|
196
|
+
removeWebview();
|
|
231
197
|
if (userInputEnabled) {
|
|
232
|
-
textareaRef.current.focus();
|
|
198
|
+
(_b = textareaRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
233
199
|
}
|
|
234
200
|
if (options === null || options === void 0 ? void 0 : options.payload) {
|
|
235
201
|
yield sendPayload(options.payload);
|
|
@@ -239,8 +205,8 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
239
205
|
yield sendPayload(`__PATH_PAYLOAD__${options.path}?${params}`);
|
|
240
206
|
}
|
|
241
207
|
});
|
|
242
|
-
const persistentMenuOptions = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.persistentMenu
|
|
243
|
-
const darkBackgroundMenu = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.darkBackgroundMenu
|
|
208
|
+
const persistentMenuOptions = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.persistentMenu);
|
|
209
|
+
const darkBackgroundMenu = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.darkBackgroundMenu);
|
|
244
210
|
const getBlockInputs = (rule, inputData) => {
|
|
245
211
|
const processedInput = rule.preprocess
|
|
246
212
|
? rule.preprocess(inputData)
|
|
@@ -252,18 +218,27 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
252
218
|
});
|
|
253
219
|
};
|
|
254
220
|
const checkBlockInput = input => {
|
|
221
|
+
var _a;
|
|
255
222
|
// if is a text we check if it is a serialized RE
|
|
256
|
-
const blockInputs =
|
|
223
|
+
const blockInputs = (_a = webchatState.theme.userInput) === null || _a === void 0 ? void 0 : _a.blockInputs;
|
|
257
224
|
if (!Array.isArray(blockInputs))
|
|
258
225
|
return false;
|
|
259
226
|
for (const rule of blockInputs) {
|
|
260
227
|
if (getBlockInputs(rule, input.data)) {
|
|
261
|
-
addMessageComponent(_jsx(Text
|
|
228
|
+
addMessageComponent(_jsx(Text
|
|
229
|
+
// Is necessary to add the id of the input
|
|
230
|
+
// to keep the input.id generated in the frontend as id of the message
|
|
231
|
+
// @ts-ignore
|
|
232
|
+
, Object.assign({
|
|
233
|
+
// Is necessary to add the id of the input
|
|
234
|
+
// to keep the input.id generated in the frontend as id of the message
|
|
235
|
+
// @ts-ignore
|
|
236
|
+
id: input.id, sentBy: SENDERS.user, blob: false, style: {
|
|
262
237
|
backgroundColor: COLORS.SCORPION_GRAY,
|
|
263
238
|
borderColor: COLORS.SCORPION_GRAY,
|
|
264
239
|
padding: '8px 12px',
|
|
265
240
|
} }, { children: rule.message })));
|
|
266
|
-
|
|
241
|
+
removeReplies();
|
|
267
242
|
return true;
|
|
268
243
|
}
|
|
269
244
|
}
|
|
@@ -275,34 +250,35 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
275
250
|
const persistentMenu = () => {
|
|
276
251
|
return (_jsx(OpenedPersistentMenu, { onClick: closeMenu, options: persistentMenuOptions, borderRadius: webchatState.theme.style.borderRadius || '10px' }));
|
|
277
252
|
};
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
(props.coverComponent.component || props.coverComponent));
|
|
281
|
-
};
|
|
282
|
-
const CoverComponent = getCoverComponent();
|
|
283
|
-
const closeCoverComponent = () => {
|
|
284
|
-
toggleCoverComponent(false);
|
|
285
|
-
};
|
|
253
|
+
const coverComponent = webchatState.theme.coverComponent;
|
|
254
|
+
const coverComponentProps = (_a = webchatState.theme.coverComponent) === null || _a === void 0 ? void 0 : _a.props;
|
|
286
255
|
useEffect(() => {
|
|
287
|
-
if (!
|
|
256
|
+
if (!coverComponent)
|
|
288
257
|
return;
|
|
289
258
|
if (!botonicState ||
|
|
290
|
-
(botonicState.messages && botonicState.messages.length
|
|
259
|
+
(botonicState.messages && botonicState.messages.length === 0))
|
|
291
260
|
toggleCoverComponent(true);
|
|
292
261
|
}, []);
|
|
293
|
-
const coverComponent = () => {
|
|
294
|
-
const coverComponentProps = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.coverComponentProps, props.coverComponent && props.coverComponent.props);
|
|
295
|
-
if (CoverComponent && webchatState.isCoverComponentOpen)
|
|
296
|
-
return (_jsx(CoverComponent, Object.assign({ closeComponent: closeCoverComponent }, coverComponentProps)));
|
|
297
|
-
return null;
|
|
298
|
-
};
|
|
299
262
|
const messageComponentFromInput = input => {
|
|
300
263
|
let messageComponent = null;
|
|
301
264
|
if (isText(input)) {
|
|
302
|
-
messageComponent = (_jsx(Text
|
|
265
|
+
messageComponent = (_jsx(Text
|
|
266
|
+
// Is necessary to add the id of the input
|
|
267
|
+
// to keep the input.id generated in the frontend as id of the message
|
|
268
|
+
// @ts-ignore
|
|
269
|
+
, Object.assign({
|
|
270
|
+
// Is necessary to add the id of the input
|
|
271
|
+
// to keep the input.id generated in the frontend as id of the message
|
|
272
|
+
// @ts-ignore
|
|
273
|
+
id: input.id,
|
|
274
|
+
// Is necessary to add the payload of the input when user clicks a button
|
|
275
|
+
// @ts-ignore
|
|
276
|
+
payload: input.payload, sentBy: SENDERS.user }, { children: input.data })));
|
|
303
277
|
}
|
|
304
278
|
else if (isMedia(input)) {
|
|
305
279
|
const temporaryDisplayUrl = URL.createObjectURL(input.data);
|
|
280
|
+
// TODO: We should use URL.revokeObjectURL(temporaryDisplayUrl) when the component is unmounted
|
|
281
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static#memory_management
|
|
306
282
|
const mediaProps = {
|
|
307
283
|
id: input.id,
|
|
308
284
|
sentBy: SENDERS.user,
|
|
@@ -338,14 +314,17 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
338
314
|
sendUserInput(input);
|
|
339
315
|
updateLatestInput(input);
|
|
340
316
|
isOnline() && updateLastMessageDate(currentDateString());
|
|
341
|
-
|
|
317
|
+
removeReplies();
|
|
342
318
|
togglePersistentMenu(false);
|
|
343
319
|
toggleEmojiPicker(false);
|
|
344
320
|
});
|
|
345
321
|
/* This is the public API this component exposes to its parents
|
|
346
322
|
https://stackoverflow.com/questions/37949981/call-child-method-from-parent
|
|
347
323
|
*/
|
|
348
|
-
const updateSessionWithUser = userToUpdate =>
|
|
324
|
+
const updateSessionWithUser = (userToUpdate) => {
|
|
325
|
+
console.log('userToUpdate', userToUpdate);
|
|
326
|
+
updateSession(merge(webchatState.session, { user: userToUpdate }));
|
|
327
|
+
};
|
|
349
328
|
useImperativeHandle(ref, () => ({
|
|
350
329
|
addBotResponse: ({ response, session, lastRoutePath }) => {
|
|
351
330
|
updateTyping(false);
|
|
@@ -370,7 +349,7 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
370
349
|
updateLastRoutePath(lastRoutePath);
|
|
371
350
|
updateLastMessageDate(currentDateString());
|
|
372
351
|
},
|
|
373
|
-
setTyping: typing => updateTyping(typing),
|
|
352
|
+
setTyping: (typing) => updateTyping(typing),
|
|
374
353
|
addUserMessage: message => sendInput(message),
|
|
375
354
|
updateUser: updateSessionWithUser,
|
|
376
355
|
openWebchat: () => toggleWebchat(true),
|
|
@@ -384,24 +363,22 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
384
363
|
},
|
|
385
364
|
unmountCustomComponent: () => doRenderCustomComponent(false),
|
|
386
365
|
toggleCoverComponent: () => toggleCoverComponent(!webchatState.isCoverComponentOpen),
|
|
387
|
-
openWebviewApi: component => openWebviewT(component),
|
|
388
|
-
setError,
|
|
389
366
|
setOnline,
|
|
390
367
|
getMessages: () => webchatState.messagesJSON,
|
|
391
368
|
isOnline,
|
|
392
369
|
clearMessages: () => {
|
|
393
370
|
clearMessages();
|
|
394
|
-
|
|
371
|
+
removeReplies();
|
|
395
372
|
},
|
|
396
373
|
getLastMessageUpdate: () => webchatState.lastMessageUpdate,
|
|
397
374
|
updateMessageInfo: (msgId, messageInfo) => {
|
|
398
|
-
const messageToUpdate = webchatState.messagesJSON.filter(m => m.id
|
|
375
|
+
const messageToUpdate = webchatState.messagesJSON.filter(m => m.id === msgId)[0];
|
|
399
376
|
const updatedMsg = merge(messageToUpdate, messageInfo);
|
|
400
377
|
if (updatedMsg.ack === 1)
|
|
401
378
|
delete updatedMsg.unsentInput;
|
|
402
379
|
updateMessage(updatedMsg);
|
|
403
380
|
},
|
|
404
|
-
updateWebchatSettings: settings => {
|
|
381
|
+
updateWebchatSettings: (settings) => {
|
|
405
382
|
if (settings.user) {
|
|
406
383
|
updateSessionWithUser(settings.user);
|
|
407
384
|
}
|
|
@@ -409,20 +386,18 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
409
386
|
updateTheme(merge(webchatState.theme, themeUpdates), themeUpdates);
|
|
410
387
|
updateTyping(false);
|
|
411
388
|
},
|
|
412
|
-
closeWebview: closeWebview,
|
|
389
|
+
closeWebview: (options) => __awaiter(void 0, void 0, void 0, function* () { return closeWebview(options); }),
|
|
413
390
|
}));
|
|
414
391
|
const resolveCase = () => {
|
|
415
392
|
updateHandoff(false);
|
|
416
|
-
updateSession(Object.assign(Object.assign({}, webchatState.session), { _botonic_action:
|
|
393
|
+
updateSession(Object.assign(Object.assign({}, webchatState.session), { _botonic_action: undefined }));
|
|
417
394
|
};
|
|
418
395
|
const prevSession = usePrevious(webchatState.session);
|
|
419
396
|
useEffect(() => {
|
|
420
397
|
// Resume conversation after handoff
|
|
421
|
-
if (prevSession &&
|
|
422
|
-
prevSession._botonic_action &&
|
|
423
|
-
!webchatState.session._botonic_action) {
|
|
398
|
+
if ((prevSession === null || prevSession === void 0 ? void 0 : prevSession._botonic_action) && !webchatState.session._botonic_action) {
|
|
424
399
|
const action = getParsedAction(prevSession._botonic_action);
|
|
425
|
-
if (action
|
|
400
|
+
if (action === null || action === void 0 ? void 0 : action.on_finish)
|
|
426
401
|
sendPayload(action.on_finish);
|
|
427
402
|
}
|
|
428
403
|
}, [webchatState.session._botonic_action]);
|
|
@@ -439,24 +414,18 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
439
414
|
yield sendInput(input);
|
|
440
415
|
});
|
|
441
416
|
const sendAttachment = (attachment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
442
|
-
if (attachment
|
|
443
|
-
const attachmentType = getMediaType(attachment.
|
|
417
|
+
if (attachment) {
|
|
418
|
+
const attachmentType = getMediaType(attachment.type);
|
|
444
419
|
if (!attachmentType)
|
|
445
420
|
return;
|
|
446
421
|
const input = {
|
|
447
422
|
type: attachmentType,
|
|
448
|
-
data: attachment
|
|
423
|
+
data: attachment,
|
|
449
424
|
};
|
|
450
425
|
yield sendInput(input);
|
|
451
|
-
setCurrentAttachment(
|
|
426
|
+
setCurrentAttachment();
|
|
452
427
|
}
|
|
453
428
|
});
|
|
454
|
-
const webviewRequestContext = {
|
|
455
|
-
closeWebview: closeWebview,
|
|
456
|
-
getString: stringId => props.getString(stringId, webchatState.session),
|
|
457
|
-
params: webchatState.webviewParams || {},
|
|
458
|
-
session: webchatState.session || {},
|
|
459
|
-
};
|
|
460
429
|
useEffect(() => {
|
|
461
430
|
if (firstUpdate.current) {
|
|
462
431
|
firstUpdate.current = false;
|
|
@@ -471,21 +440,10 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
471
440
|
}
|
|
472
441
|
}, [webchatState.isWebchatOpen]);
|
|
473
442
|
const isUserInputEnabled = () => {
|
|
474
|
-
const isUserInputEnabled = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.enableUserInput
|
|
443
|
+
const isUserInputEnabled = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.enableUserInput);
|
|
475
444
|
return isUserInputEnabled && !webchatState.isCoverComponentOpen;
|
|
476
445
|
};
|
|
477
446
|
const userInputEnabled = isUserInputEnabled();
|
|
478
|
-
const webchatWebview = () => (_jsx(WebviewRequestContext.Provider, Object.assign({ value: webviewRequestContext }, { children: _jsx(WebviewContainer, { style: Object.assign(Object.assign({}, getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.webviewStyle)), mobileStyle), webview: webchatState.webview }) })));
|
|
479
|
-
let mobileStyle = {};
|
|
480
|
-
if (isMobile(getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.mobileBreakpoint))) {
|
|
481
|
-
mobileStyle = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.mobileStyle) || {
|
|
482
|
-
width: '100%',
|
|
483
|
-
height: '100%',
|
|
484
|
-
right: 0,
|
|
485
|
-
bottom: 0,
|
|
486
|
-
borderRadius: 0,
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
447
|
useEffect(() => {
|
|
490
448
|
// Prod mode
|
|
491
449
|
saveWebchatState(webchatState);
|
|
@@ -509,12 +467,14 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
509
467
|
else
|
|
510
468
|
return customComponent;
|
|
511
469
|
};
|
|
512
|
-
const WebchatComponent = (
|
|
470
|
+
const WebchatComponent = (_jsx(WebchatContext.Provider, Object.assign({ value: {
|
|
513
471
|
addMessage,
|
|
514
472
|
getThemeProperty,
|
|
473
|
+
closeWebview,
|
|
515
474
|
openWebview,
|
|
516
475
|
resolveCase,
|
|
517
476
|
resetUnreadMessages,
|
|
477
|
+
setIsInputFocused,
|
|
518
478
|
setLastMessageVisible,
|
|
519
479
|
sendAttachment,
|
|
520
480
|
sendInput,
|
|
@@ -523,25 +483,27 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
523
483
|
toggleWebchat,
|
|
524
484
|
toggleEmojiPicker,
|
|
525
485
|
togglePersistentMenu,
|
|
486
|
+
toggleCoverComponent,
|
|
526
487
|
updateLatestInput,
|
|
527
488
|
updateMessage,
|
|
528
489
|
updateReplies,
|
|
529
490
|
updateUser: updateSessionWithUser,
|
|
530
491
|
updateWebchatDevSettings: updateWebchatDevSettings,
|
|
531
|
-
webchatState,
|
|
532
492
|
trackEvent: props.onTrackEvent,
|
|
533
|
-
|
|
493
|
+
webchatState,
|
|
494
|
+
webchatContainerRef,
|
|
534
495
|
chatAreaRef,
|
|
535
496
|
inputPanelRef,
|
|
536
497
|
headerRef,
|
|
498
|
+
repliesRef,
|
|
537
499
|
scrollableMessagesListRef,
|
|
538
|
-
} }, { children: [!webchatState.isWebchatOpen && _jsx(TriggerButton, {}), webchatState.isWebchatOpen && (_jsxs(StyledWebchat, Object.assign({ id: BotonicContainerId.Webchat, ref:
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
customComponent &&
|
|
544
|
-
_renderCustomComponent()] })))] })));
|
|
500
|
+
} }, { children: _jsxs(ThemeProvider, Object.assign({ theme: webchatState.theme }, { children: [!webchatState.isWebchatOpen && _jsx(TriggerButton, {}), webchatState.isWebchatOpen && (_jsxs(StyledWebchat, Object.assign({ id: BotonicContainerId.Webchat, ref: webchatContainerRef,
|
|
501
|
+
// TODO: Distinguish between multiple instances of webchat, e.g. `${uniqueId}-botonic-webchat`
|
|
502
|
+
role: ROLES.WEBCHAT }, { children: [_jsx(WebchatHeader, { ref: headerRef }), webchatState.isCoverComponentOpen ? (_jsx(CoverComponent, { component: coverComponent, componentProps: coverComponentProps })) : (_jsxs(_Fragment, { children: [webchatState.error.message && (_jsx(ErrorMessageContainer, { children: _jsx(ErrorMessage, { children: webchatState.error.message }) })), _jsx(ChatArea, {}), webchatState.isPersistentMenuOpen && (_jsx(DarkenBackground, { component: persistentMenu() })), !webchatState.handoff && userInputEnabled && (_jsx(InputPanel, { handleAttachment: handleAttachment, textareaRef: textareaRef, host: host, onUserInput: props.onUserInput })), webchatState.webview && _jsx(WebviewContainer, {}), webchatState.isCustomComponentRendered &&
|
|
503
|
+
customComponent &&
|
|
504
|
+
_renderCustomComponent()] }))] })))] })) })));
|
|
545
505
|
return props.shadowDOM ? (_jsx(StyleSheetManager, Object.assign({ target: host }, { children: WebchatComponent }))) : (WebchatComponent);
|
|
546
506
|
});
|
|
507
|
+
Webchat.displayName = 'Webchat';
|
|
508
|
+
export { Webchat };
|
|
547
509
|
//# sourceMappingURL=webchat.js.map
|