@botonic/react 0.36.0-alpha.0 → 0.36.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.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 +10 -11
- package/lib/cjs/contexts.js +15 -78
- 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 +39 -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 +62 -14
- 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 +10 -11
- package/lib/esm/contexts.js +14 -77
- 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 +35 -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 +64 -16
- 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 +26 -91
- 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 +73 -0
- package/src/webchat/webview/styles.ts +62 -0
- package/src/webchat-app.tsx +575 -0
- package/src/webview-app.tsx +75 -20
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/react",
|
|
3
|
-
"version": "0.36.0
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Build Chatbots using React",
|
|
6
6
|
"main": "./lib/cjs",
|
|
@@ -20,39 +20,44 @@
|
|
|
20
20
|
"lint_core": "../../node_modules/.bin/eslint_d --cache --quiet '.*.js' '*.js' 'src/**/*.js*' --fix"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@botonic/core": "^0.
|
|
24
|
-
"axios": "^1.
|
|
25
|
-
"emoji-picker-react": "^4.
|
|
23
|
+
"@botonic/core": "^0.36.0",
|
|
24
|
+
"axios": "^1.10.0",
|
|
25
|
+
"emoji-picker-react": "^4.12.0",
|
|
26
26
|
"lodash.merge": "^4.6.2",
|
|
27
|
-
"markdown-it": "^12.
|
|
28
|
-
"react": "^
|
|
29
|
-
"react-dom": "^
|
|
30
|
-
"react-json-tree": "^0.
|
|
27
|
+
"markdown-it": "^12.3.2",
|
|
28
|
+
"react": "^18.3.1",
|
|
29
|
+
"react-dom": "^18.3.1",
|
|
30
|
+
"react-json-tree": "^0.18.0",
|
|
31
31
|
"react-router-dom": "^5.3.4",
|
|
32
|
-
"react-textarea-autosize": "^8.5.
|
|
33
|
-
"styled-components": "^5.3.
|
|
32
|
+
"react-textarea-autosize": "^8.5.5",
|
|
33
|
+
"styled-components": "^5.3.11",
|
|
34
34
|
"ua-parser-js": "^1.0.39",
|
|
35
35
|
"uuid": "^10.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
39
|
-
"@babel/preset-react": "^7.
|
|
40
|
-
"@testing-library/
|
|
41
|
-
"@testing-library/react
|
|
42
|
-
"@
|
|
38
|
+
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
39
|
+
"@babel/preset-react": "^7.26.3",
|
|
40
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
41
|
+
"@testing-library/react": "^16.0.1",
|
|
42
|
+
"@testing-library/user-event": "^14.6.1",
|
|
43
|
+
"@types/jest": "^29.5.14",
|
|
44
|
+
"@types/lodash.merge": "^4.6.9",
|
|
43
45
|
"@types/parse5": "^7.0.0",
|
|
44
|
-
"@types/react": "^
|
|
46
|
+
"@types/react": "^18.3.18",
|
|
47
|
+
"@types/react-dom": "^18.3.5",
|
|
45
48
|
"@types/styled-components": "^5.1.34",
|
|
49
|
+
"@types/ua-parser-js": "^0.7.39",
|
|
46
50
|
"@types/uuid": "^10.0.0",
|
|
47
51
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
48
52
|
"copyfiles": "^2.4.1",
|
|
49
53
|
"identity-obj-proxy": "^3.0.0",
|
|
50
54
|
"intersection-observer": "^0.12.2",
|
|
51
|
-
"react-test-renderer": "^
|
|
55
|
+
"react-test-renderer": "^18.3.1",
|
|
52
56
|
"typescript": "5.0.4"
|
|
53
57
|
},
|
|
54
58
|
"engines": {
|
|
55
|
-
"node": ">=20.0.0"
|
|
59
|
+
"node": ">=20.0.0",
|
|
60
|
+
"npm": ">=10.0.0"
|
|
56
61
|
},
|
|
57
62
|
"sideEffects": [
|
|
58
63
|
"*.scss",
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import { INPUT, isBrowser } from '@botonic/core'
|
|
2
2
|
import React from 'react'
|
|
3
|
+
import styled from 'styled-components'
|
|
3
4
|
|
|
4
5
|
import { ROLES } from '../constants'
|
|
5
6
|
import { staticAsset } from '../util/environment'
|
|
7
|
+
import { AudioProps } from './index-types'
|
|
6
8
|
import { Message } from './message'
|
|
7
9
|
|
|
8
|
-
const
|
|
10
|
+
const StyledAudio = styled.audio`
|
|
11
|
+
max-width: 100%;
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
const serialize = (audioProps: { src: string }) => {
|
|
9
15
|
return { audio: audioProps.src }
|
|
10
16
|
}
|
|
11
17
|
|
|
12
|
-
export const Audio = props => {
|
|
18
|
+
export const Audio = (props: AudioProps) => {
|
|
13
19
|
props = { ...props, src: staticAsset(props.src) }
|
|
14
20
|
let content = props.children
|
|
15
21
|
if (isBrowser())
|
|
16
22
|
content = (
|
|
17
|
-
<
|
|
23
|
+
<StyledAudio id='myAudio' controls>
|
|
18
24
|
<source src={props.src} type='audio/mpeg' />
|
|
19
25
|
Your browser does not support this audio format.
|
|
20
|
-
</
|
|
26
|
+
</StyledAudio>
|
|
21
27
|
)
|
|
22
28
|
return (
|
|
23
29
|
<Message
|
|
@@ -1,64 +1,24 @@
|
|
|
1
1
|
import { INPUT } from '@botonic/core'
|
|
2
|
-
import React, { useContext
|
|
3
|
-
import styled from 'styled-components'
|
|
2
|
+
import React, { useContext } from 'react'
|
|
4
3
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
const StyledButton = styled.button`
|
|
14
|
-
display: flex;
|
|
15
|
-
width: 100%;
|
|
16
|
-
max-height: 80px;
|
|
17
|
-
font-size: 14px;
|
|
18
|
-
text-align: center;
|
|
19
|
-
align-content: center;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
gap: 6px;
|
|
22
|
-
padding: 12px 32px;
|
|
23
|
-
font-family: inherit;
|
|
24
|
-
border: none;
|
|
25
|
-
border: 1px solid ${COLORS.SEASHELL_WHITE};
|
|
26
|
-
cursor: pointer;
|
|
27
|
-
outline: 0;
|
|
28
|
-
border-top-right-radius: 0px;
|
|
29
|
-
border-top-left-radius: 0px;
|
|
30
|
-
border-bottom-right-radius: 0px;
|
|
31
|
-
border-bottom-left-radius: 0px;
|
|
32
|
-
overflow: hidden;
|
|
33
|
-
`
|
|
34
|
-
|
|
35
|
-
export const StyledUrlImage = styled.img`
|
|
36
|
-
width: 20px;
|
|
37
|
-
`
|
|
4
|
+
import { resolveImage } from '../../util/environment'
|
|
5
|
+
import { renderComponent } from '../../util/react'
|
|
6
|
+
import { generateWebviewUrlWithParams } from '../../util/webviews'
|
|
7
|
+
import { WebchatContext } from '../../webchat/context'
|
|
8
|
+
import { ButtonsDisabler } from '../buttons-disabler'
|
|
9
|
+
import { ButtonProps } from '../index-types'
|
|
10
|
+
import { StyledButton, StyledUrlImage } from './styles'
|
|
38
11
|
|
|
39
12
|
export const Button = (props: ButtonProps) => {
|
|
40
|
-
const {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
sendInput,
|
|
45
|
-
getThemeProperty,
|
|
46
|
-
updateMessage,
|
|
47
|
-
} = useContext(WebchatContext)
|
|
48
|
-
const [hover, setHover] = useState(false)
|
|
49
|
-
const { theme } = webchatState
|
|
50
|
-
const { autoDisable, disabledStyle } = ButtonsDisabler.resolveDisabling(
|
|
51
|
-
webchatState.theme,
|
|
52
|
-
props
|
|
53
|
-
)
|
|
13
|
+
const { webchatState, openWebview, sendPayload, sendInput, updateMessage } =
|
|
14
|
+
useContext(WebchatContext)
|
|
15
|
+
|
|
16
|
+
const autoDisable = webchatState.theme?.button?.autodisable
|
|
54
17
|
|
|
55
18
|
const handleClick = event => {
|
|
56
19
|
event.preventDefault()
|
|
57
20
|
|
|
58
|
-
const type =
|
|
59
|
-
WEBCHAT.CUSTOM_PROPERTIES.buttonMessageType,
|
|
60
|
-
INPUT.TEXT
|
|
61
|
-
)
|
|
21
|
+
const type = webchatState.theme?.button?.messageType
|
|
62
22
|
|
|
63
23
|
if (props.webview) {
|
|
64
24
|
openWebview(props.webview, props.params)
|
|
@@ -93,10 +53,7 @@ export const Button = (props: ButtonProps) => {
|
|
|
93
53
|
const messageToUpdate = webchatState.messagesJSON.filter(
|
|
94
54
|
m => m.id === props.parentId
|
|
95
55
|
)[0]
|
|
96
|
-
const updatedMsg = ButtonsDisabler.getUpdatedMessage(messageToUpdate
|
|
97
|
-
autoDisable,
|
|
98
|
-
disabledStyle,
|
|
99
|
-
})
|
|
56
|
+
const updatedMsg = ButtonsDisabler.getUpdatedMessage(messageToUpdate)
|
|
100
57
|
updateMessage(updatedMsg)
|
|
101
58
|
}
|
|
102
59
|
}
|
|
@@ -121,10 +78,12 @@ export const Button = (props: ButtonProps) => {
|
|
|
121
78
|
}
|
|
122
79
|
|
|
123
80
|
const renderBrowser = () => {
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
81
|
+
const themeButton = webchatState.theme.button
|
|
82
|
+
const urlIconEnabledProp = themeButton?.urlIcon?.enable
|
|
83
|
+
const urlIconImage = themeButton?.urlIcon?.image
|
|
84
|
+
const urlIcon = urlIconEnabledProp ? urlIconImage : undefined
|
|
85
|
+
|
|
86
|
+
const CustomButton = themeButton?.custom
|
|
128
87
|
|
|
129
88
|
if (CustomButton) {
|
|
130
89
|
return (
|
|
@@ -134,52 +93,11 @@ export const Button = (props: ButtonProps) => {
|
|
|
134
93
|
)
|
|
135
94
|
}
|
|
136
95
|
|
|
137
|
-
const buttonBgColor = hover
|
|
138
|
-
? getThemeProperty(
|
|
139
|
-
WEBCHAT.CUSTOM_PROPERTIES.buttonHoverBackground,
|
|
140
|
-
COLORS.CONCRETE_WHITE
|
|
141
|
-
)
|
|
142
|
-
: getThemeProperty(
|
|
143
|
-
WEBCHAT.CUSTOM_PROPERTIES.buttonStyleBackground,
|
|
144
|
-
COLORS.SOLID_WHITE
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
const buttonTextColor = hover
|
|
148
|
-
? getThemeProperty(
|
|
149
|
-
WEBCHAT.CUSTOM_PROPERTIES.buttonHoverTextColor,
|
|
150
|
-
COLORS.SOLID_BLACK
|
|
151
|
-
)
|
|
152
|
-
: getThemeProperty(
|
|
153
|
-
WEBCHAT.CUSTOM_PROPERTIES.buttonStyleColor,
|
|
154
|
-
COLORS.SOLID_BLACK
|
|
155
|
-
)
|
|
156
|
-
|
|
157
|
-
const urlIconEnabledProp = getThemeProperty(
|
|
158
|
-
WEBCHAT.CUSTOM_PROPERTIES.urlIconEnabled
|
|
159
|
-
)
|
|
160
|
-
|
|
161
|
-
const urlIconImageProp = getThemeProperty(
|
|
162
|
-
WEBCHAT.CUSTOM_PROPERTIES.urlIconImage
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
const urlIconImage = urlIconImageProp ?? WEBCHAT.DEFAULTS.URL_ICON
|
|
166
|
-
|
|
167
|
-
const urlIcon =
|
|
168
|
-
urlIconEnabledProp || urlIconImageProp ? urlIconImage : undefined
|
|
169
|
-
|
|
170
96
|
return (
|
|
171
97
|
<StyledButton
|
|
172
98
|
className={getClassName()}
|
|
173
|
-
theme={theme}
|
|
174
|
-
onMouseEnter={() => setHover(true)}
|
|
175
|
-
onMouseLeave={() => setHover(false)}
|
|
176
99
|
onClick={e => handleClick(e)}
|
|
177
|
-
|
|
178
|
-
...buttonStyle,
|
|
179
|
-
color: buttonTextColor,
|
|
180
|
-
backgroundColor: buttonBgColor,
|
|
181
|
-
...(props.disabled && autoDisable && disabledStyle),
|
|
182
|
-
}}
|
|
100
|
+
disabled={props.disabled && autoDisable}
|
|
183
101
|
>
|
|
184
102
|
{props.children}
|
|
185
103
|
{props.url && urlIcon && (
|
|
@@ -193,7 +111,11 @@ export const Button = (props: ButtonProps) => {
|
|
|
193
111
|
}
|
|
194
112
|
|
|
195
113
|
const renderNode = () => {
|
|
196
|
-
const disabledProps = ButtonsDisabler.constructNodeProps(
|
|
114
|
+
const disabledProps = ButtonsDisabler.constructNodeProps({
|
|
115
|
+
disabled: props.disabled,
|
|
116
|
+
disabledstyle: props.disabledstyle,
|
|
117
|
+
autodisable: props.autodisable,
|
|
118
|
+
})
|
|
197
119
|
if (props.webview) {
|
|
198
120
|
return (
|
|
199
121
|
<button
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const StyledButton = styled.button`
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-content: center;
|
|
7
|
+
gap: 6px;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
width: ${props => props.theme.button?.style?.width};
|
|
10
|
+
max-height: ${props => props.theme.button?.style?.maxHeight};
|
|
11
|
+
height: ${props => props.theme.button?.style?.height};
|
|
12
|
+
font-family: ${props => props.theme.style?.fontFamily};
|
|
13
|
+
font-size: ${props => props.theme.button?.style?.fontSize};
|
|
14
|
+
font-weight: ${props => props.theme.button?.style?.fontWeight};
|
|
15
|
+
background: ${props => props.theme.button?.style?.background};
|
|
16
|
+
color: ${props => props.theme.button?.style?.color};
|
|
17
|
+
outline: ${props => props.theme.button?.style?.outline};
|
|
18
|
+
border: ${props => props.theme.button?.style?.border};
|
|
19
|
+
border-radius: ${props => props.theme.button?.style?.borderRadius};
|
|
20
|
+
padding: ${props => props.theme.button?.style?.padding};
|
|
21
|
+
overflow: ${props => props.theme.button?.style?.overflow};
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
background: ${props => props.theme.button?.hoverBackground};
|
|
25
|
+
color: ${props => props.theme.button?.hoverTextColor};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:disabled {
|
|
29
|
+
opacity: ${props => props.theme.button?.disabledstyle?.opacity};
|
|
30
|
+
cursor: ${props => props.theme.button?.disabledstyle?.cursor};
|
|
31
|
+
pointer-events: ${props =>
|
|
32
|
+
props.theme.button?.disabledstyle?.pointerEvents};
|
|
33
|
+
}
|
|
34
|
+
`
|
|
35
|
+
|
|
36
|
+
export const StyledUrlImage = styled.img`
|
|
37
|
+
width: 20px;
|
|
38
|
+
`
|
|
@@ -1,21 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { WebchatMessage } from '../index-types'
|
|
3
4
|
import { isCarousel } from '../message-utils'
|
|
4
5
|
import { strToBool } from '../util/objects'
|
|
5
6
|
import { deepMapWithIndex } from '../util/react'
|
|
6
|
-
import {
|
|
7
|
+
import { Button } from './button'
|
|
8
|
+
import { ButtonProps } from './index-types'
|
|
9
|
+
|
|
10
|
+
interface DisabledProps {
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
autodisable?: boolean | string
|
|
13
|
+
disabledstyle?: Record<string, string> | string
|
|
14
|
+
}
|
|
7
15
|
|
|
16
|
+
interface AdditionalProps {
|
|
17
|
+
parentId: string
|
|
18
|
+
disabled?: boolean
|
|
19
|
+
setDisabled: (disabled: boolean) => void
|
|
20
|
+
}
|
|
8
21
|
export class ButtonsDisabler {
|
|
9
|
-
static constructBrowserProps(props) {
|
|
10
|
-
const disabledProps = {
|
|
22
|
+
static constructBrowserProps(props: DisabledProps): DisabledProps {
|
|
23
|
+
const disabledProps: DisabledProps = {}
|
|
11
24
|
if (props.autodisable !== undefined)
|
|
12
25
|
disabledProps.autodisable = strToBool(props.autodisable)
|
|
13
26
|
if (props.disabledstyle !== undefined)
|
|
14
27
|
disabledProps.disabledstyle = props.disabledstyle
|
|
15
28
|
return disabledProps
|
|
16
29
|
}
|
|
17
|
-
|
|
18
|
-
|
|
30
|
+
|
|
31
|
+
static constructNodeProps(props: DisabledProps): DisabledProps {
|
|
32
|
+
const disabledProps: DisabledProps = {}
|
|
19
33
|
if (props.autodisable !== undefined)
|
|
20
34
|
disabledProps.autodisable = String(props.autodisable)
|
|
21
35
|
if (props.disabledstyle !== undefined)
|
|
@@ -23,7 +37,7 @@ export class ButtonsDisabler {
|
|
|
23
37
|
return disabledProps
|
|
24
38
|
}
|
|
25
39
|
|
|
26
|
-
static withDisabledProps(props) {
|
|
40
|
+
static withDisabledProps(props: DisabledProps): DisabledProps {
|
|
27
41
|
return {
|
|
28
42
|
disabled: props.disabled,
|
|
29
43
|
autodisable: props.autodisable,
|
|
@@ -31,44 +45,25 @@ export class ButtonsDisabler {
|
|
|
31
45
|
}
|
|
32
46
|
}
|
|
33
47
|
|
|
34
|
-
static
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
WEBCHAT.DEFAULTS.BUTTON_AUTO_DISABLE
|
|
42
|
-
)
|
|
43
|
-
const computedDisabledStyle =
|
|
44
|
-
props.disabledstyle !== undefined
|
|
45
|
-
? props.disabledstyle
|
|
46
|
-
: getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.buttonDisabledStyle, {})
|
|
47
|
-
|
|
48
|
-
const disabledStyle = {
|
|
49
|
-
...WEBCHAT.DEFAULTS.BUTTON_DISABLED_STYLE,
|
|
50
|
-
...computedDisabledStyle,
|
|
51
|
-
}
|
|
52
|
-
return { autoDisable, disabledStyle }
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
static updateChildrenButtons(children, additionalProps = undefined) {
|
|
56
|
-
return deepMapWithIndex(children, n => {
|
|
57
|
-
if (n.type === Button) return this.updateButtons(n, additionalProps)
|
|
58
|
-
return n
|
|
48
|
+
static updateChildrenButtons(
|
|
49
|
+
children: React.ReactNode,
|
|
50
|
+
additionalProps?: AdditionalProps
|
|
51
|
+
): React.ReactNode {
|
|
52
|
+
return deepMapWithIndex(children, (node: any) => {
|
|
53
|
+
if (node.type === Button) return this.updateButtons(node, additionalProps)
|
|
54
|
+
return node
|
|
59
55
|
})
|
|
60
56
|
}
|
|
61
57
|
|
|
62
|
-
static updateButtons(node, additionalProps) {
|
|
63
|
-
if (
|
|
64
|
-
else {
|
|
58
|
+
static updateButtons(node: any, additionalProps?: AdditionalProps): any {
|
|
59
|
+
if (additionalProps) {
|
|
65
60
|
additionalProps = {
|
|
61
|
+
parentId: additionalProps.parentId,
|
|
66
62
|
disabled:
|
|
67
63
|
node.props.disabled === true
|
|
68
64
|
? node.props.disabled
|
|
69
65
|
: additionalProps.disabled,
|
|
70
66
|
setDisabled: additionalProps.setDisabled,
|
|
71
|
-
parentId: additionalProps.parentId,
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
return {
|
|
@@ -80,8 +75,8 @@ export class ButtonsDisabler {
|
|
|
80
75
|
}
|
|
81
76
|
}
|
|
82
77
|
|
|
83
|
-
static getUpdatedMessage(messageToUpdate
|
|
84
|
-
const updateMsgButton = button => {
|
|
78
|
+
static getUpdatedMessage(messageToUpdate: WebchatMessage): WebchatMessage {
|
|
79
|
+
const updateMsgButton = (button: ButtonProps) => {
|
|
85
80
|
return {
|
|
86
81
|
...button,
|
|
87
82
|
...{
|
|
@@ -89,6 +84,7 @@ export class ButtonsDisabler {
|
|
|
89
84
|
},
|
|
90
85
|
}
|
|
91
86
|
}
|
|
87
|
+
|
|
92
88
|
if (
|
|
93
89
|
isCarousel(messageToUpdate) &&
|
|
94
90
|
messageToUpdate.data &&
|
|
@@ -5,9 +5,10 @@ import styled from 'styled-components'
|
|
|
5
5
|
import LeftArrow from '../assets/leftArrow.svg'
|
|
6
6
|
import RightArrow from '../assets/rightArrow.svg'
|
|
7
7
|
import { COLORS, WEBCHAT } from '../constants'
|
|
8
|
-
import { WebchatContext } from '../contexts'
|
|
9
8
|
import { resolveImage } from '../util/environment'
|
|
9
|
+
import { WebchatContext } from '../webchat/context'
|
|
10
10
|
import { ButtonsDisabler } from './buttons-disabler'
|
|
11
|
+
import { CarouselProps } from './index-types'
|
|
11
12
|
import { Message } from './message'
|
|
12
13
|
|
|
13
14
|
const ScrollableCarousel = styled.div`
|
|
@@ -15,7 +16,11 @@ const ScrollableCarousel = styled.div`
|
|
|
15
16
|
-webkit-overflow-scrolling: touch;
|
|
16
17
|
`
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
interface StyledCarouselProps {
|
|
20
|
+
carouselArrowsEnabled: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const StyledCarousel = styled.div<StyledCarouselProps>`
|
|
19
24
|
padding: 10px 0px;
|
|
20
25
|
display: flex;
|
|
21
26
|
flex-direction: row;
|
|
@@ -27,7 +32,14 @@ const StyledItems = styled.div`
|
|
|
27
32
|
display: flex;
|
|
28
33
|
`
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
interface StyledArrowContainerProps {
|
|
36
|
+
left?: number
|
|
37
|
+
right?: number
|
|
38
|
+
arrow: 'right' | 'left'
|
|
39
|
+
justifyContent: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const StyledArrowContainer = styled.div<StyledArrowContainerProps>`
|
|
31
43
|
position: absolute;
|
|
32
44
|
top: calc(50% - 20px);
|
|
33
45
|
height: 40px;
|
|
@@ -37,10 +49,14 @@ const StyledArrowContainer = styled.div`
|
|
|
37
49
|
align-items: center;
|
|
38
50
|
cursor: pointer;
|
|
39
51
|
justify-content: ${props => props.justifyContent};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
|
|
53
|
+
${props => (props.left ? ` left: ${props.left}px` : '')};
|
|
54
|
+
${props => (props.right ? ` right: ${props.right}px` : '')};
|
|
55
|
+
${props => (props.arrow === 'right' ? 'border-top-right-radius: 30px' : '')};
|
|
56
|
+
${props =>
|
|
57
|
+
props.arrow === 'right' ? 'border-bottom-right-radius: 30px' : ''};
|
|
58
|
+
${props => (props.arrow === 'left' ? 'border-top-left-radius: 30px' : '')};
|
|
59
|
+
${props => (props.arrow === 'left' ? 'border-bottom-left-radius: 30px' : '')};
|
|
44
60
|
`
|
|
45
61
|
const StyledArrow = styled.img`
|
|
46
62
|
width: 20px;
|
|
@@ -53,38 +69,30 @@ const serialize = carouselProps => {
|
|
|
53
69
|
return {
|
|
54
70
|
type: INPUT.CAROUSEL,
|
|
55
71
|
elements: carouselChildren.map(
|
|
56
|
-
e => e
|
|
72
|
+
e => e?.type?.serialize && e.type.serialize(e.props)
|
|
57
73
|
),
|
|
58
74
|
}
|
|
59
75
|
}
|
|
60
76
|
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
* @param {MessageProps} props
|
|
64
|
-
* @returns {JSX.Element}
|
|
65
|
-
*/
|
|
66
|
-
export const Carousel = props => {
|
|
77
|
+
export const Carousel = (props: CarouselProps) => {
|
|
67
78
|
const { getThemeProperty } = useContext(WebchatContext)
|
|
68
|
-
let content = props.children
|
|
69
79
|
const [hasLeftArrow, setLeftArrow] = useState(false)
|
|
70
80
|
const [hasRightArrow, setRightArrow] = useState(true)
|
|
71
|
-
const carouselRef = useRef(null)
|
|
81
|
+
const carouselRef = useRef<HTMLDivElement>(null)
|
|
82
|
+
|
|
72
83
|
const CustomCarouselLeftArrow = getThemeProperty(
|
|
73
|
-
WEBCHAT.CUSTOM_PROPERTIES.customCarouselLeftArrow
|
|
74
|
-
undefined
|
|
84
|
+
WEBCHAT.CUSTOM_PROPERTIES.customCarouselLeftArrow
|
|
75
85
|
)
|
|
76
86
|
const CustomCarouselRightArrow = getThemeProperty(
|
|
77
|
-
WEBCHAT.CUSTOM_PROPERTIES.customCarouselRightArrow
|
|
78
|
-
undefined
|
|
87
|
+
WEBCHAT.CUSTOM_PROPERTIES.customCarouselRightArrow
|
|
79
88
|
)
|
|
80
89
|
// TODO: Investigate why when set to false, scroll is enabled via dragging the bar but not hovering the carousel elements
|
|
81
90
|
const carouselArrowsEnabled = getThemeProperty(
|
|
82
|
-
WEBCHAT.CUSTOM_PROPERTIES.enableCarouselArrows
|
|
83
|
-
true
|
|
91
|
+
WEBCHAT.CUSTOM_PROPERTIES.enableCarouselArrows
|
|
84
92
|
)
|
|
85
93
|
|
|
86
94
|
const scrollCarouselBy = value => {
|
|
87
|
-
carouselRef.current
|
|
95
|
+
carouselRef.current?.scrollBy({
|
|
88
96
|
left: value,
|
|
89
97
|
behavior: 'smooth',
|
|
90
98
|
})
|
|
@@ -139,8 +147,12 @@ export const Carousel = props => {
|
|
|
139
147
|
const carousel = carouselRef.current
|
|
140
148
|
if (carousel && carousel.addEventListener) {
|
|
141
149
|
carousel.addEventListener('scroll', setArrowsVisibility, false)
|
|
142
|
-
}
|
|
143
|
-
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return () => {
|
|
153
|
+
if (carousel && carousel.removeEventListener) {
|
|
154
|
+
carousel.removeEventListener('scroll', setArrowsVisibility, false)
|
|
155
|
+
}
|
|
144
156
|
}
|
|
145
157
|
}, [carouselRef.current])
|
|
146
158
|
|
|
@@ -150,16 +162,28 @@ export const Carousel = props => {
|
|
|
150
162
|
}
|
|
151
163
|
|
|
152
164
|
if (isBrowser()) {
|
|
153
|
-
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
return (
|
|
166
|
+
<Message
|
|
167
|
+
style={{
|
|
168
|
+
width: '85%',
|
|
169
|
+
padding: 0,
|
|
170
|
+
backgroundColor: COLORS.TRANSPARENT,
|
|
171
|
+
}}
|
|
172
|
+
blob={false}
|
|
173
|
+
json={serialize(carouselProps)}
|
|
174
|
+
type={INPUT.CAROUSEL}
|
|
175
|
+
{...carouselProps}
|
|
176
|
+
>
|
|
177
|
+
<ScrollableCarousel>
|
|
178
|
+
<StyledCarousel
|
|
179
|
+
ref={carouselRef}
|
|
180
|
+
carouselArrowsEnabled={carouselArrowsEnabled}
|
|
181
|
+
>
|
|
182
|
+
<StyledItems>{carouselProps.children}</StyledItems>
|
|
183
|
+
{carouselArrowsEnabled && getArrows()}
|
|
184
|
+
</StyledCarousel>
|
|
185
|
+
</ScrollableCarousel>
|
|
186
|
+
</Message>
|
|
163
187
|
)
|
|
164
188
|
}
|
|
165
189
|
|
|
@@ -171,7 +195,7 @@ export const Carousel = props => {
|
|
|
171
195
|
type={INPUT.CAROUSEL}
|
|
172
196
|
{...carouselProps}
|
|
173
197
|
>
|
|
174
|
-
{
|
|
198
|
+
{props.children}
|
|
175
199
|
</Message>
|
|
176
200
|
)
|
|
177
201
|
}
|
|
@@ -6,22 +6,31 @@ import { SENDERS } from '../index-types'
|
|
|
6
6
|
import { createErrorBoundary } from '../util/error-boundary'
|
|
7
7
|
import { warnDeprecatedProps } from '../util/logs'
|
|
8
8
|
import { mapObjectNonBooleanValues } from '../util/react'
|
|
9
|
+
import { CustomMessageType } from './index-types'
|
|
9
10
|
import { Message } from './message'
|
|
10
11
|
import { Reply } from './reply'
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* name: as it appears at ThemeProps' message.customTypes key
|
|
16
|
+
* CustomMessageComponent
|
|
17
|
+
* defaultProps: Props for the wrapper Message
|
|
18
|
+
* ErrorBoundary: to recover in case it fails
|
|
18
19
|
*/
|
|
20
|
+
|
|
21
|
+
export interface CustomMessageArgs {
|
|
22
|
+
name: string
|
|
23
|
+
component: React.ComponentType
|
|
24
|
+
defaultProps?: Record<string, any>
|
|
25
|
+
errorBoundary?: any
|
|
26
|
+
}
|
|
27
|
+
|
|
19
28
|
export const customMessage = ({
|
|
20
29
|
name,
|
|
21
30
|
component: CustomMessageComponent,
|
|
22
31
|
defaultProps = {},
|
|
23
|
-
errorBoundary
|
|
24
|
-
}) => {
|
|
32
|
+
errorBoundary = createErrorBoundary(),
|
|
33
|
+
}: CustomMessageArgs): CustomMessageType => {
|
|
25
34
|
const CustomMessage = props => {
|
|
26
35
|
warnDeprecatedProps(defaultProps, 'customMessage:')
|
|
27
36
|
if (defaultProps.sentBy === SENDERS.user) {
|
|
@@ -57,6 +66,9 @@ export const customMessage = ({
|
|
|
57
66
|
const WrappedComponent = props => {
|
|
58
67
|
const { id, children, ...customMessageProps } = props
|
|
59
68
|
const { replies, childrenWithoutReplies } = splitChildren(props)
|
|
69
|
+
|
|
70
|
+
const ErrorBoundary = errorBoundary
|
|
71
|
+
|
|
60
72
|
return (
|
|
61
73
|
<CustomMessage
|
|
62
74
|
id={id}
|
|
@@ -80,7 +92,7 @@ export const customMessage = ({
|
|
|
80
92
|
}
|
|
81
93
|
WrappedComponent.customTypeName = name
|
|
82
94
|
// eslint-disable-next-line react/display-name
|
|
83
|
-
WrappedComponent.deserialize = msg => (
|
|
95
|
+
WrappedComponent.deserialize = (msg: any) => (
|
|
84
96
|
<WrappedComponent
|
|
85
97
|
id={msg.id}
|
|
86
98
|
key={msg.key}
|