@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
|
@@ -1,110 +1,112 @@
|
|
|
1
|
-
import { isWhatsapp } from '@botonic/core'
|
|
1
|
+
import { isDev, isFacebook, isWebchat, isWhatsapp } from '@botonic/core'
|
|
2
2
|
import React, { useContext } from 'react'
|
|
3
3
|
|
|
4
4
|
import { RequestContext } from '../../contexts'
|
|
5
|
+
import { Button } from '../button/index'
|
|
5
6
|
import { Carousel } from '../carousel'
|
|
6
|
-
import {
|
|
7
|
+
import { Image } from '../image'
|
|
8
|
+
import { Text } from '../text'
|
|
9
|
+
import { WhatsappCTAUrlButton } from '../whatsapp-cta-url-button'
|
|
7
10
|
import {
|
|
8
11
|
getFilteredElements,
|
|
9
12
|
isMultichannelButton,
|
|
10
|
-
|
|
13
|
+
isNodePic,
|
|
14
|
+
isNodeSubtitle,
|
|
15
|
+
isNodeTitle,
|
|
11
16
|
} from './multichannel-utils'
|
|
17
|
+
import { convertToMarkdownMeta } from './whatsapp/markdown-meta'
|
|
12
18
|
|
|
13
19
|
export const MultichannelCarousel = props => {
|
|
14
20
|
const requestContext = useContext(RequestContext)
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
[].concat(getFilteredElements(node, isMultichannelButton))
|
|
18
|
-
|
|
19
|
-
if (isWhatsapp(requestContext.session)) {
|
|
20
|
-
const elements = props.children
|
|
21
|
-
.map(e => e.props.children)
|
|
22
|
-
.map((element, i) => {
|
|
23
|
-
let imageProps = undefined
|
|
24
|
-
let title = undefined
|
|
25
|
-
let subtitle = undefined
|
|
26
|
-
const buttons = []
|
|
27
|
-
|
|
28
|
-
for (const node of element) {
|
|
29
|
-
if (isNodeKind(node, 'Pic')) {
|
|
30
|
-
imageProps = node.props
|
|
31
|
-
}
|
|
32
|
-
if (isNodeKind(node, 'Title')) {
|
|
33
|
-
title = node.props.children
|
|
34
|
-
}
|
|
35
|
-
if (isNodeKind(node, 'Subtitle')) {
|
|
36
|
-
subtitle = node.props.children
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (isNodeKind(node, 'MultichannelButton')) {
|
|
40
|
-
buttons.push(node)
|
|
41
|
-
}
|
|
42
|
-
//TODO support fragment containing an array
|
|
43
|
-
if (Array.isArray(node)) {
|
|
44
|
-
buttons.push(getButtons(node))
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
let header = ''
|
|
49
|
-
if (props.showTitle && title) {
|
|
50
|
-
header += `${title ? `**${title}**` : ''}`
|
|
51
|
-
if (title && subtitle) {
|
|
52
|
-
header += ' '
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (props.showSubtitle && subtitle) {
|
|
56
|
-
header += `_${subtitle}_`
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
// TODO: newkey only for 1 nested button
|
|
61
|
-
<MultichannelText
|
|
62
|
-
key={i}
|
|
63
|
-
newkey={i}
|
|
64
|
-
indexMode={props.indexMode}
|
|
65
|
-
buttonsAsText={props.buttonsAsText}
|
|
66
|
-
>
|
|
67
|
-
{header || null}
|
|
68
|
-
{buttons}
|
|
69
|
-
</MultichannelText>
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
// TODO: in the future, this would be the default mode
|
|
73
|
-
// } else {
|
|
74
|
-
// return (
|
|
75
|
-
// <React.Fragment key={i}>
|
|
76
|
-
// <Image
|
|
77
|
-
// src={imageSrc}
|
|
78
|
-
// caption={carouselToCaption(
|
|
79
|
-
// i + 1,
|
|
80
|
-
// title,
|
|
81
|
-
// subtitle,
|
|
82
|
-
// imageSrc,
|
|
83
|
-
// buttonProps
|
|
84
|
-
// )}
|
|
85
|
-
// ></Image>
|
|
86
|
-
// </React.Fragment>
|
|
87
|
-
// )
|
|
88
|
-
// }
|
|
89
|
-
})
|
|
90
|
-
return elements
|
|
91
|
-
} else {
|
|
22
|
+
if (isDev(requestContext.session) || isWebchat(requestContext.session)) {
|
|
92
23
|
return <Carousel {...props}>{props.children}</Carousel>
|
|
93
24
|
}
|
|
25
|
+
|
|
26
|
+
const messages = []
|
|
27
|
+
const childrenElements = props.children.map(e => e.props.children)
|
|
28
|
+
|
|
29
|
+
childrenElements.forEach((element, i) => {
|
|
30
|
+
const { imageProps, title, subtitle, buttons } =
|
|
31
|
+
parseCarouselElement(element)
|
|
32
|
+
|
|
33
|
+
const textMessage = getTextMessage(requestContext.session, title, subtitle)
|
|
34
|
+
|
|
35
|
+
if (imageProps?.src) {
|
|
36
|
+
const messageWithImage = <Image src={imageProps.src} />
|
|
37
|
+
messages.push(messageWithImage)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (
|
|
41
|
+
isWhatsapp(requestContext.session) &&
|
|
42
|
+
buttons.some(button => button.url)
|
|
43
|
+
) {
|
|
44
|
+
const messageWithButtonUrl = (
|
|
45
|
+
<WhatsappCTAUrlButton
|
|
46
|
+
key={`carousel-element-${i}-cta-url`}
|
|
47
|
+
body={title}
|
|
48
|
+
footer={`_${subtitle}_`}
|
|
49
|
+
displayText={buttons[0].text}
|
|
50
|
+
url={buttons[0].url}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
messages.push(messageWithButtonUrl)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const messageWithButtons = buttons.some(button => button.payload) ? (
|
|
57
|
+
<Text key={`carousel-element-${i}-text`}>
|
|
58
|
+
{textMessage}
|
|
59
|
+
{buttons
|
|
60
|
+
.filter(button => isWhatsapp(requestContext.session) && !button.url)
|
|
61
|
+
.map(button => (
|
|
62
|
+
<Button
|
|
63
|
+
key={`carousel-element-${i}-button`}
|
|
64
|
+
payload={button.payload}
|
|
65
|
+
url={button.url}
|
|
66
|
+
>
|
|
67
|
+
{button.text}
|
|
68
|
+
</Button>
|
|
69
|
+
))}
|
|
70
|
+
</Text>
|
|
71
|
+
) : (
|
|
72
|
+
[]
|
|
73
|
+
)
|
|
74
|
+
messages.push(messageWithButtons)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
return <>{messages}</>
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function getButtons(node) {
|
|
81
|
+
return [].concat(getFilteredElements(node, isMultichannelButton))
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function parseCarouselElement(element) {
|
|
85
|
+
let imageProps, title, subtitle
|
|
86
|
+
const buttonsChildren = []
|
|
87
|
+
|
|
88
|
+
for (const node of element) {
|
|
89
|
+
if (isNodePic(node)) imageProps = node.props
|
|
90
|
+
if (isNodeTitle(node)) title = node.props.children
|
|
91
|
+
if (isNodeSubtitle(node)) subtitle = node.props.children
|
|
92
|
+
if (isMultichannelButton(node)) buttonsChildren.push(node)
|
|
93
|
+
if (Array.isArray(node)) buttonsChildren.push(...getButtons(node))
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const buttons = buttonsChildren.map(button => {
|
|
97
|
+
return {
|
|
98
|
+
text: button.props.children,
|
|
99
|
+
payload: button.props.payload,
|
|
100
|
+
url: button.props.url,
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
return { imageProps, title, subtitle, buttons }
|
|
94
105
|
}
|
|
95
106
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// buttons += ` - ${buttonProps.children}: ${buttonProps.url}`
|
|
103
|
-
// caption = `${header ? `${header}\n` : ''}${buttons}`
|
|
104
|
-
// }
|
|
105
|
-
// if (buttonProps.payload || buttonProps.path) {
|
|
106
|
-
// buttons += `${index}. `
|
|
107
|
-
// caption = `${buttons}${buttonProps.children}`
|
|
108
|
-
// }
|
|
109
|
-
// return caption
|
|
110
|
-
// }
|
|
107
|
+
function getTextMessage(session, title, subtitle) {
|
|
108
|
+
const formattedTextMessage = `**${title}**${subtitle ? ` _${subtitle}_` : ''}`
|
|
109
|
+
return isWhatsapp(session) || isFacebook(session)
|
|
110
|
+
? convertToMarkdownMeta(formattedTextMessage)
|
|
111
|
+
: formattedTextMessage
|
|
112
|
+
}
|
|
@@ -9,18 +9,20 @@ import { MultichannelButton } from './multichannel-button'
|
|
|
9
9
|
import { MultichannelContext } from './multichannel-context'
|
|
10
10
|
import {
|
|
11
11
|
buttonTypes,
|
|
12
|
-
DEFAULT_WHATSAPP_MAX_BUTTON_SEPARATOR,
|
|
13
12
|
elementHasPostback,
|
|
14
13
|
elementHasUrl,
|
|
15
14
|
elementHasWebview,
|
|
16
15
|
getButtonType,
|
|
17
16
|
getMultichannelButtons,
|
|
18
17
|
getMultichannelReplies,
|
|
18
|
+
} from './multichannel-utils'
|
|
19
|
+
import {
|
|
20
|
+
DEFAULT_WHATSAPP_MAX_BUTTON_SEPARATOR,
|
|
19
21
|
MENU_BUTTON_WHATSAPP_BUTTON_LIST,
|
|
20
22
|
MULTICHANNEL_WHATSAPP_PROPS,
|
|
21
23
|
WHATSAPP_LIST_MAX_BUTTONS,
|
|
22
24
|
WHATSAPP_MAX_BUTTONS,
|
|
23
|
-
} from './
|
|
25
|
+
} from './whatsapp/constants'
|
|
24
26
|
import { convertToMarkdownMeta } from './whatsapp/markdown-meta'
|
|
25
27
|
|
|
26
28
|
export const MultichannelText = props => {
|
|
@@ -162,7 +164,7 @@ export const MultichannelText = props => {
|
|
|
162
164
|
}
|
|
163
165
|
return row
|
|
164
166
|
})
|
|
165
|
-
const
|
|
167
|
+
const whatsAppButtonListProps = {
|
|
166
168
|
body: index === 0 ? texts.join('') : buttonsTextSeparator,
|
|
167
169
|
button: menuButtonTextWhatsappList,
|
|
168
170
|
sections: [{ rows }],
|
|
@@ -170,7 +172,7 @@ export const MultichannelText = props => {
|
|
|
170
172
|
|
|
171
173
|
return {
|
|
172
174
|
type: INPUT.WHATSAPP_BUTTON_LIST,
|
|
173
|
-
props:
|
|
175
|
+
props: whatsAppButtonListProps,
|
|
174
176
|
}
|
|
175
177
|
}
|
|
176
178
|
)
|
|
@@ -237,10 +239,14 @@ export const MultichannelText = props => {
|
|
|
237
239
|
)
|
|
238
240
|
|
|
239
241
|
if (postbackButtonElements.length === 0) {
|
|
242
|
+
// Use texts[0] instead of textElements[0] as a body to avoid apply the markdownMeta function twice.
|
|
243
|
+
// If the markdownMeta function is applied twice, bold is replaced by italics.
|
|
244
|
+
const body = texts[0] || ''
|
|
245
|
+
|
|
240
246
|
if (urlButtonElements.length === 1) {
|
|
241
247
|
return (
|
|
242
248
|
<WhatsappCTAUrlButton
|
|
243
|
-
body={
|
|
249
|
+
body={body}
|
|
244
250
|
displayText={urlButtonElements[0].props.children}
|
|
245
251
|
url={urlButtonElements[0].props.url}
|
|
246
252
|
/>
|
|
@@ -250,7 +256,7 @@ export const MultichannelText = props => {
|
|
|
250
256
|
if (webviewButtonElements.length === 1) {
|
|
251
257
|
return (
|
|
252
258
|
<WhatsappCTAUrlButton
|
|
253
|
-
body={
|
|
259
|
+
body={body}
|
|
254
260
|
displayText={webviewButtonElements[0].props.children}
|
|
255
261
|
webview={webviewButtonElements[0].props.webview}
|
|
256
262
|
params={webviewButtonElements[0].props.params}
|
|
@@ -1,45 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export const DEFAULT_WHATSAPP_MAX_BUTTON_SEPARATOR = 'More options:'
|
|
15
|
-
export const MENU_BUTTON_WHATSAPP_BUTTON_LIST = 'Show options'
|
|
1
|
+
import { Button } from '../button/index'
|
|
2
|
+
import { Carousel } from '../carousel'
|
|
3
|
+
import { Pic } from '../pic'
|
|
4
|
+
import { Reply } from '../reply'
|
|
5
|
+
import { Subtitle } from '../subtitle'
|
|
6
|
+
import { Text } from '../text'
|
|
7
|
+
import { Title } from '../title'
|
|
8
|
+
import { MultichannelButton } from './multichannel-button'
|
|
9
|
+
import { MultichannelReply } from './multichannel-reply'
|
|
10
|
+
|
|
11
|
+
function isNodeKind(node, kind) {
|
|
12
|
+
return node?.type?.name === kind
|
|
13
|
+
}
|
|
16
14
|
|
|
17
15
|
export function isMultichannelButton(node) {
|
|
18
|
-
return isNodeKind(node,
|
|
16
|
+
return isNodeKind(node, MultichannelButton.name)
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
export function isMultichannelReply(node) {
|
|
22
|
-
return isNodeKind(node,
|
|
20
|
+
return isNodeKind(node, MultichannelReply.name)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function isNodeText(node) {
|
|
24
|
+
return isNodeKind(node, Text.name)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function isNodeButton(node) {
|
|
28
|
+
return isNodeKind(node, Button.name)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function isNodeCarousel(node) {
|
|
32
|
+
return isNodeKind(node, Carousel.name)
|
|
23
33
|
}
|
|
24
34
|
|
|
25
|
-
export function
|
|
26
|
-
return isNodeKind(node,
|
|
35
|
+
export function isNodeReply(node) {
|
|
36
|
+
return isNodeKind(node, Reply.name)
|
|
27
37
|
}
|
|
28
38
|
|
|
29
|
-
export function
|
|
30
|
-
return node
|
|
39
|
+
export function isNodePic(node) {
|
|
40
|
+
return isNodeKind(node, Pic.name)
|
|
31
41
|
}
|
|
42
|
+
|
|
43
|
+
export function isNodeTitle(node) {
|
|
44
|
+
return isNodeKind(node, Title.name)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function isNodeSubtitle(node) {
|
|
48
|
+
return isNodeKind(node, Subtitle.name)
|
|
49
|
+
}
|
|
50
|
+
|
|
32
51
|
export function elementHasUrl(element) {
|
|
33
|
-
return element
|
|
52
|
+
return element?.props?.url
|
|
34
53
|
}
|
|
54
|
+
|
|
35
55
|
export function elementHasPostback(element) {
|
|
36
|
-
return
|
|
37
|
-
(element.props && element.props.payload) ||
|
|
38
|
-
(element.props && element.props.path)
|
|
39
|
-
)
|
|
56
|
+
return element?.props?.payload || element?.props?.path
|
|
40
57
|
}
|
|
58
|
+
|
|
41
59
|
export function elementHasWebview(element) {
|
|
42
|
-
return element
|
|
60
|
+
return element?.props?.webview
|
|
43
61
|
}
|
|
44
62
|
|
|
45
63
|
export const buttonTypes = {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { isFacebook, isWhatsapp } from '@botonic/core'
|
|
2
2
|
import React, { useContext } from 'react'
|
|
3
3
|
|
|
4
|
-
import { COMPONENT_TYPE } from '../../constants'
|
|
5
4
|
import { RequestContext } from '../../contexts'
|
|
6
5
|
import { deepMapWithIndex } from '../../util/react'
|
|
7
6
|
import { Text } from '../text'
|
|
@@ -10,7 +9,13 @@ import { MultichannelCarousel } from './multichannel-carousel'
|
|
|
10
9
|
import { MultichannelContext } from './multichannel-context'
|
|
11
10
|
import { MultichannelReply } from './multichannel-reply'
|
|
12
11
|
import { MultichannelText } from './multichannel-text'
|
|
13
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
isNodeButton,
|
|
14
|
+
isNodeCarousel,
|
|
15
|
+
isNodeReply,
|
|
16
|
+
isNodeText,
|
|
17
|
+
} from './multichannel-utils'
|
|
18
|
+
import { MULTICHANNEL_WHATSAPP_PROPS } from './whatsapp/constants'
|
|
14
19
|
|
|
15
20
|
export const Multichannel = props => {
|
|
16
21
|
const requestContext = useContext(RequestContext)
|
|
@@ -22,7 +27,7 @@ export const Multichannel = props => {
|
|
|
22
27
|
}
|
|
23
28
|
if (isFacebook(requestContext.session)) {
|
|
24
29
|
const newChildren = deepMapWithIndex(props.children, child => {
|
|
25
|
-
if (child
|
|
30
|
+
if (isNodeText(child)) {
|
|
26
31
|
return (
|
|
27
32
|
<MultichannelText {...child.props} key={child.key}>
|
|
28
33
|
{child.props.children}
|
|
@@ -35,21 +40,21 @@ export const Multichannel = props => {
|
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
let newChildren = deepMapWithIndex(props.children, (child, index) => {
|
|
38
|
-
if (child
|
|
43
|
+
if (isNodeButton(child)) {
|
|
39
44
|
return (
|
|
40
45
|
<MultichannelButton {...child.props} key={child.key}>
|
|
41
46
|
{child.props.children}
|
|
42
47
|
</MultichannelButton>
|
|
43
48
|
)
|
|
44
49
|
}
|
|
45
|
-
if (child
|
|
50
|
+
if (isNodeReply(child)) {
|
|
46
51
|
return (
|
|
47
52
|
<MultichannelReply {...child.props} key={child.key}>
|
|
48
53
|
{child.props.children}
|
|
49
54
|
</MultichannelReply>
|
|
50
55
|
)
|
|
51
56
|
}
|
|
52
|
-
if (child
|
|
57
|
+
if (isNodeText(child)) {
|
|
53
58
|
return (
|
|
54
59
|
<MultichannelText
|
|
55
60
|
{...child.props}
|
|
@@ -62,7 +67,7 @@ export const Multichannel = props => {
|
|
|
62
67
|
</MultichannelText>
|
|
63
68
|
)
|
|
64
69
|
}
|
|
65
|
-
if (child
|
|
70
|
+
if (isNodeCarousel(child)) {
|
|
66
71
|
return (
|
|
67
72
|
<MultichannelCarousel
|
|
68
73
|
{...child.props}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const MULTICHANNEL_WHATSAPP_PROPS = { markdown: false }
|
|
2
|
+
|
|
3
|
+
export const WHATSAPP_MAX_BUTTONS = 3
|
|
4
|
+
export const WHATSAPP_LIST_MAX_BUTTONS = 10
|
|
5
|
+
export const WHATSAPP_MAX_BUTTON_CHARS = 20
|
|
6
|
+
export const WHATSAPP_MAX_HEADER_CHARS = 60
|
|
7
|
+
export const WHATSAPP_MAX_BODY_CHARS = 1024
|
|
8
|
+
export const WHATSAPP_MAX_FOOTER_CHARS = 60
|
|
9
|
+
export const DEFAULT_WHATSAPP_MAX_BUTTON_SEPARATOR = 'More options:'
|
|
10
|
+
export const MENU_BUTTON_WHATSAPP_BUTTON_LIST = 'Show options'
|
|
@@ -10,18 +10,25 @@ const PicStyled = styled.img`
|
|
|
10
10
|
border-top-right-radius: 8px;
|
|
11
11
|
width: ${WEBCHAT.DEFAULTS.ELEMENT_WIDTH}px;
|
|
12
12
|
height: 140px;
|
|
13
|
-
background: ${COLORS.SOLID_WHITE}
|
|
14
|
-
|
|
13
|
+
background: ${COLORS.SOLID_WHITE};
|
|
14
|
+
object-fit: center/cover;
|
|
15
15
|
border-bottom: 1px solid ${COLORS.SEASHELL_WHITE};
|
|
16
16
|
`
|
|
17
|
+
export interface PicProps {
|
|
18
|
+
src: string
|
|
19
|
+
}
|
|
17
20
|
|
|
18
|
-
export const Pic = props => {
|
|
21
|
+
export const Pic = (props: PicProps) => {
|
|
19
22
|
props = { ...props, src: staticAsset(props.src) }
|
|
23
|
+
|
|
20
24
|
const renderBrowser = () => <PicStyled src={props.src} />
|
|
25
|
+
|
|
26
|
+
// @ts-ignore
|
|
21
27
|
const renderNode = () => <pic>{props.src}</pic>
|
|
28
|
+
|
|
22
29
|
return renderComponent({ renderBrowser, renderNode })
|
|
23
30
|
}
|
|
24
31
|
|
|
25
|
-
Pic.serialize =
|
|
26
|
-
return { pic:
|
|
32
|
+
Pic.serialize = (props: PicProps) => {
|
|
33
|
+
return { pic: props.src }
|
|
27
34
|
}
|
|
@@ -2,21 +2,25 @@ import React, { useContext } from 'react'
|
|
|
2
2
|
import styled from 'styled-components'
|
|
3
3
|
|
|
4
4
|
import { COLORS, WEBCHAT } from '../constants'
|
|
5
|
-
import { WebchatContext } from '../contexts'
|
|
6
5
|
import { renderComponent } from '../util/react'
|
|
6
|
+
import { WebchatContext } from '../webchat/context'
|
|
7
|
+
import { ReplyProps } from './index-types'
|
|
7
8
|
|
|
8
9
|
const StyledButton = styled.button`
|
|
9
10
|
width: 100%;
|
|
10
11
|
padding: 4px 8px;
|
|
11
12
|
font-family: inherit;
|
|
12
13
|
border-radius: 8px;
|
|
14
|
+
border: 1px solid ${props => props.theme.brand?.color};
|
|
15
|
+
color: ${props => props.theme.brand?.color};
|
|
13
16
|
cursor: pointer;
|
|
14
17
|
outline: 0;
|
|
15
18
|
`
|
|
16
19
|
|
|
17
|
-
export const Reply = props => {
|
|
20
|
+
export const Reply = (props: ReplyProps) => {
|
|
18
21
|
const { sendText, getThemeProperty } = useContext(WebchatContext)
|
|
19
|
-
|
|
22
|
+
|
|
23
|
+
const handleClick = (event: any) => {
|
|
20
24
|
event.preventDefault()
|
|
21
25
|
if (props.children) {
|
|
22
26
|
let payload = props.payload
|
|
@@ -39,14 +43,6 @@ export const Reply = props => {
|
|
|
39
43
|
return (
|
|
40
44
|
<StyledButton
|
|
41
45
|
style={{
|
|
42
|
-
border: `1px solid ${getThemeProperty(
|
|
43
|
-
WEBCHAT.CUSTOM_PROPERTIES.brandColor,
|
|
44
|
-
COLORS.BOTONIC_BLUE
|
|
45
|
-
)}`,
|
|
46
|
-
color: getThemeProperty(
|
|
47
|
-
WEBCHAT.CUSTOM_PROPERTIES.brandColor,
|
|
48
|
-
COLORS.BOTONIC_BLUE
|
|
49
|
-
),
|
|
50
46
|
...replyStyle,
|
|
51
47
|
}}
|
|
52
48
|
onClick={e => handleClick(e)}
|
|
@@ -59,15 +55,19 @@ export const Reply = props => {
|
|
|
59
55
|
const renderNode = () => {
|
|
60
56
|
if (props.path) {
|
|
61
57
|
const payload = `__PATH_PAYLOAD__${props.path}`
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
62
60
|
return <reply payload={payload}>{props.children}</reply>
|
|
63
61
|
}
|
|
62
|
+
// @ts-ignore
|
|
63
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
64
64
|
return <reply payload={props.payload}>{props.children}</reply>
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
return renderComponent({ renderBrowser, renderNode })
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
Reply.serialize = replyProps => {
|
|
70
|
+
Reply.serialize = (replyProps: ReplyProps) => {
|
|
71
71
|
let payload = replyProps.payload
|
|
72
72
|
if (replyProps.path) payload = `__PATH_PAYLOAD__${replyProps.path}`
|
|
73
73
|
return { reply: { title: replyProps.children, payload } }
|
|
@@ -9,21 +9,21 @@ const SubtitleContainer = styled.div`
|
|
|
9
9
|
padding: 0px 15px 10px 15px;
|
|
10
10
|
color: ${COLORS.MID_GRAY};
|
|
11
11
|
`
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
export interface SubtitleProps {
|
|
14
|
+
children: React.ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Subtitle = (props: SubtitleProps) => {
|
|
13
18
|
const renderBrowser = () => (
|
|
14
|
-
<SubtitleContainer
|
|
15
|
-
style={{
|
|
16
|
-
...props.style,
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
{props.children}
|
|
20
|
-
</SubtitleContainer>
|
|
19
|
+
<SubtitleContainer>{props.children}</SubtitleContainer>
|
|
21
20
|
)
|
|
21
|
+
|
|
22
22
|
const renderNode = () => <desc>{props.children}</desc>
|
|
23
23
|
|
|
24
24
|
return renderComponent({ renderBrowser, renderNode })
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
Subtitle.serialize =
|
|
28
|
-
return { subtitle:
|
|
27
|
+
Subtitle.serialize = (props: SubtitleProps) => {
|
|
28
|
+
return { subtitle: props.children }
|
|
29
29
|
}
|
|
@@ -7,16 +7,18 @@ const TitleContainer = styled.div`
|
|
|
7
7
|
font-size: 14px;
|
|
8
8
|
padding: 10px 15px;
|
|
9
9
|
`
|
|
10
|
+
export interface TitleProps {
|
|
11
|
+
children: React.ReactNode
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Title = (props: TitleProps) => {
|
|
15
|
+
const renderBrowser = () => <TitleContainer>{props.children}</TitleContainer>
|
|
10
16
|
|
|
11
|
-
export const Title = props => {
|
|
12
|
-
const renderBrowser = () => (
|
|
13
|
-
<TitleContainer style={{ ...props.style }}>{props.children}</TitleContainer>
|
|
14
|
-
)
|
|
15
17
|
const renderNode = () => <title>{props.children}</title>
|
|
16
18
|
|
|
17
19
|
return renderComponent({ renderBrowser, renderNode })
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
Title.serialize =
|
|
21
|
-
return { title:
|
|
22
|
+
Title.serialize = (props: TitleProps) => {
|
|
23
|
+
return { title: props.children }
|
|
22
24
|
}
|
|
@@ -4,6 +4,7 @@ import styled from 'styled-components'
|
|
|
4
4
|
|
|
5
5
|
import { COLORS, ROLES } from '../constants'
|
|
6
6
|
import { staticAsset } from '../util/environment'
|
|
7
|
+
import { VideoProps } from './index-types'
|
|
7
8
|
import { Message } from './message'
|
|
8
9
|
|
|
9
10
|
const StyledVideo = styled.video`
|
|
@@ -14,11 +15,11 @@ const StyledVideo = styled.video`
|
|
|
14
15
|
margin: 10px;
|
|
15
16
|
`
|
|
16
17
|
|
|
17
|
-
const serialize = videoProps => {
|
|
18
|
+
const serialize = (videoProps: { src: string }) => {
|
|
18
19
|
return { video: videoProps.src }
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
export const Video = props => {
|
|
22
|
+
export const Video = (props: VideoProps) => {
|
|
22
23
|
props = { ...props, src: staticAsset(props.src) }
|
|
23
24
|
let content = props.children
|
|
24
25
|
if (isBrowser())
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import { INPUT } from '@botonic/core'
|
|
2
2
|
import React, { useContext } from 'react'
|
|
3
3
|
|
|
4
|
-
import { WebchatContext } from '../contexts'
|
|
5
4
|
import { renderComponent } from '../util/react'
|
|
6
5
|
import { stringifyWithRegexs } from '../util/regexs'
|
|
7
|
-
import {
|
|
6
|
+
import { WebchatContext } from '../webchat/context'
|
|
7
|
+
import {
|
|
8
|
+
PersistentMenuOptionsTheme,
|
|
9
|
+
WebchatTheme,
|
|
10
|
+
} from '../webchat/theme/types'
|
|
11
|
+
import { BlockInputOption } from './index-types'
|
|
12
|
+
|
|
13
|
+
export interface WebchatSettingsProps {
|
|
14
|
+
blockInputs?: BlockInputOption[]
|
|
15
|
+
enableAnimations?: boolean
|
|
16
|
+
enableAttachments?: boolean
|
|
17
|
+
enableEmojiPicker?: boolean
|
|
18
|
+
enableUserInput?: boolean
|
|
19
|
+
persistentMenu?: PersistentMenuOptionsTheme
|
|
20
|
+
theme?: Partial<WebchatTheme>
|
|
21
|
+
user?: {
|
|
22
|
+
extra_data?: any
|
|
23
|
+
country?: string
|
|
24
|
+
locale?: string
|
|
25
|
+
system_locale?: string
|
|
26
|
+
}
|
|
27
|
+
}
|
|
8
28
|
|
|
9
29
|
export const WebchatSettings = ({
|
|
10
30
|
theme,
|