@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
|
@@ -4,7 +4,7 @@ import React from 'react'
|
|
|
4
4
|
import { truncateText } from '../util'
|
|
5
5
|
import { renderComponent } from '../util/react'
|
|
6
6
|
import { Message } from './message'
|
|
7
|
-
import { WHATSAPP_MAX_BUTTON_CHARS } from './multichannel/
|
|
7
|
+
import { WHATSAPP_MAX_BUTTON_CHARS } from './multichannel/whatsapp/constants'
|
|
8
8
|
import { convertToMarkdownMeta } from './multichannel/whatsapp/markdown-meta'
|
|
9
9
|
|
|
10
10
|
// TODO: Add validation in component
|
|
@@ -32,15 +32,15 @@ export interface WhatsappButtonListProps {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const serialize = _whatsappButtonListProps => {
|
|
35
|
-
// TODO: Implement to have data
|
|
35
|
+
// TODO: Implement to have data persistence in localStorage, not needed for this WhatsApp development
|
|
36
36
|
return {}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export const WhatsappButtonList = (props: WhatsappButtonListProps) => {
|
|
40
|
-
const
|
|
40
|
+
const truncateSectionsContents = (
|
|
41
41
|
sections: WhatsappButtonListSectionProps[]
|
|
42
42
|
): WhatsappButtonListSectionProps[] => {
|
|
43
|
-
const
|
|
43
|
+
const truncateRowContents = (
|
|
44
44
|
row: WhatsappButtonListRowProps
|
|
45
45
|
): WhatsappButtonListRowProps => {
|
|
46
46
|
const title = truncateText(row.title, WHATSAPP_MAX_BUTTON_LIST_CHARS)
|
|
@@ -62,7 +62,7 @@ export const WhatsappButtonList = (props: WhatsappButtonListProps) => {
|
|
|
62
62
|
title: section.title
|
|
63
63
|
? truncateText(section.title, WHATSAPP_MAX_BUTTON_LIST_CHARS)
|
|
64
64
|
: undefined,
|
|
65
|
-
rows: section.rows.map(
|
|
65
|
+
rows: section.rows.map(truncateRowContents),
|
|
66
66
|
}))
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -87,7 +87,7 @@ export const WhatsappButtonList = (props: WhatsappButtonListProps) => {
|
|
|
87
87
|
{...props}
|
|
88
88
|
body={convertToMarkdownMeta(props.body)}
|
|
89
89
|
button={truncateText(props.button, WHATSAPP_MAX_BUTTON_CHARS)}
|
|
90
|
-
sections={JSON.stringify(
|
|
90
|
+
sections={JSON.stringify(truncateSectionsContents(props.sections))}
|
|
91
91
|
type={INPUT.WHATSAPP_BUTTON_LIST}
|
|
92
92
|
/>
|
|
93
93
|
)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { INPUT } from '@botonic/core'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { renderComponent } from '../util/react'
|
|
5
|
+
import { Message } from './message'
|
|
6
|
+
|
|
7
|
+
export interface WhatsappCatalogProps {
|
|
8
|
+
body: string
|
|
9
|
+
footer?: string
|
|
10
|
+
thumbnailProductId?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const serialize = (message: string) => {
|
|
14
|
+
return { text: message }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const WhatsappCatalog = (props: WhatsappCatalogProps) => {
|
|
18
|
+
const renderBrowser = () => {
|
|
19
|
+
// Return a dummy message for browser
|
|
20
|
+
const message = `WhatsApp Catalog would be sent to the user.`
|
|
21
|
+
return (
|
|
22
|
+
<Message json={serialize(message)} {...props} type={INPUT.TEXT}>
|
|
23
|
+
{message}
|
|
24
|
+
</Message>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const renderNode = () => {
|
|
29
|
+
return (
|
|
30
|
+
// @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
|
|
31
|
+
<message
|
|
32
|
+
{...props}
|
|
33
|
+
body={props.body}
|
|
34
|
+
footer={props.footer}
|
|
35
|
+
thumbnailProductId={props.thumbnailProductId}
|
|
36
|
+
type={INPUT.WHATSAPP_CATALOG}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return renderComponent({ renderBrowser, renderNode })
|
|
42
|
+
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
WHATSAPP_MAX_BUTTON_CHARS,
|
|
11
11
|
WHATSAPP_MAX_FOOTER_CHARS,
|
|
12
12
|
WHATSAPP_MAX_HEADER_CHARS,
|
|
13
|
-
} from './multichannel/
|
|
13
|
+
} from './multichannel/whatsapp/constants'
|
|
14
14
|
import { convertToMarkdownMeta } from './multichannel/whatsapp/markdown-meta'
|
|
15
15
|
|
|
16
16
|
export interface WhatsappCTAUrlButtonCommonProps {
|
|
@@ -36,7 +36,7 @@ export type WhatsappCTAUrlButtonProps =
|
|
|
36
36
|
| WhatsappCTAUrlButtonWebviewProps
|
|
37
37
|
|
|
38
38
|
const serialize = _whatsappCTAUrlButtonProps => {
|
|
39
|
-
// TODO: Implement to have data
|
|
39
|
+
// TODO: Implement to have data persistence in localStorage, not needed for this WhatsApp development
|
|
40
40
|
return {}
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -66,7 +66,10 @@ export const WhatsappCTAUrlButton = (props: WhatsappCTAUrlButtonProps) => {
|
|
|
66
66
|
WHATSAPP_MAX_BODY_CHARS
|
|
67
67
|
),
|
|
68
68
|
footer: props.footer
|
|
69
|
-
? truncateText(
|
|
69
|
+
? truncateText(
|
|
70
|
+
convertToMarkdownMeta(props.footer),
|
|
71
|
+
WHATSAPP_MAX_FOOTER_CHARS
|
|
72
|
+
)
|
|
70
73
|
: undefined,
|
|
71
74
|
displayText: truncateText(props.displayText, WHATSAPP_MAX_BUTTON_CHARS),
|
|
72
75
|
url:
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { INPUT } from '@botonic/core'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { toSnakeCaseKeys } from '../util/functional'
|
|
5
|
+
import { renderComponent } from '../util/react'
|
|
6
|
+
import { Message } from './message'
|
|
7
|
+
|
|
8
|
+
type Parameters = TextParameter | CurrencyParameter | DateTimeParameter
|
|
9
|
+
|
|
10
|
+
interface TextParameter {
|
|
11
|
+
type: 'text'
|
|
12
|
+
text: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface CurrencyParameter {
|
|
16
|
+
type: 'currency'
|
|
17
|
+
currency: {
|
|
18
|
+
fallbackValue: string
|
|
19
|
+
code: string
|
|
20
|
+
amount1000: number
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface DateTimeParameter {
|
|
25
|
+
type: 'date_time'
|
|
26
|
+
dateTime: { fallbackValue: string }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type CardButton = QuickReplyButton | UrlButton
|
|
30
|
+
|
|
31
|
+
interface Button {
|
|
32
|
+
type: 'quick_reply' | 'url'
|
|
33
|
+
buttonIndex?: number
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface QuickReplyButton extends Button {
|
|
37
|
+
payload: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface UrlButton extends Button {
|
|
41
|
+
urlVariable: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface Card {
|
|
45
|
+
fileType: 'image' | 'video'
|
|
46
|
+
fileId: string
|
|
47
|
+
cardIndex?: number
|
|
48
|
+
bodyParameters?: Parameters[]
|
|
49
|
+
buttons?: CardButton[]
|
|
50
|
+
extraComponents?: Record<string, any>[]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface WhatsappMediaCarouselProps {
|
|
54
|
+
templateName: string
|
|
55
|
+
templateLanguage: string
|
|
56
|
+
cards: Card[]
|
|
57
|
+
bodyParameters?: Parameters[]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const serialize = (message: string) => {
|
|
61
|
+
return { text: message }
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const WhatsappMediaCarousel = (props: WhatsappMediaCarouselProps) => {
|
|
65
|
+
const renderBrowser = () => {
|
|
66
|
+
// Return a dummy message for browser
|
|
67
|
+
const message = `WhatsApp Media Carousel would be sent to the user.`
|
|
68
|
+
return (
|
|
69
|
+
<Message json={serialize(message)} {...props} type={INPUT.TEXT}>
|
|
70
|
+
{message}
|
|
71
|
+
</Message>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const getCards = (cards: Card[]) => {
|
|
76
|
+
cards.forEach((card, index) => {
|
|
77
|
+
if (!card.cardIndex) {
|
|
78
|
+
card.cardIndex = index
|
|
79
|
+
}
|
|
80
|
+
card.buttons?.forEach((button, index) => {
|
|
81
|
+
if (!button.buttonIndex) {
|
|
82
|
+
button.buttonIndex = index
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
return toSnakeCaseKeys(cards)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const renderNode = () => {
|
|
90
|
+
return (
|
|
91
|
+
// @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
|
|
92
|
+
<message
|
|
93
|
+
{...props}
|
|
94
|
+
bodyParameters={JSON.stringify(toSnakeCaseKeys(props.bodyParameters))}
|
|
95
|
+
cards={JSON.stringify(getCards(props.cards))}
|
|
96
|
+
templateName={props.templateName}
|
|
97
|
+
templateLanguage={props.templateLanguage}
|
|
98
|
+
type={INPUT.WHATSAPP_MEDIA_CAROUSEL}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return renderComponent({ renderBrowser, renderNode })
|
|
104
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { INPUT } from '@botonic/core'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { toSnakeCaseKeys } from '../util/functional'
|
|
5
|
+
import { renderComponent } from '../util/react'
|
|
6
|
+
import { Message } from './message'
|
|
7
|
+
|
|
8
|
+
type Parameters = TextParameter | CurrencyParameter | DateTimeParameter
|
|
9
|
+
|
|
10
|
+
interface TextParameter {
|
|
11
|
+
type: 'text'
|
|
12
|
+
text: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface CurrencyParameter {
|
|
16
|
+
type: 'currency'
|
|
17
|
+
currency: {
|
|
18
|
+
fallbackValue: string
|
|
19
|
+
code: string
|
|
20
|
+
amount1000: number
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface DateTimeParameter {
|
|
25
|
+
type: 'date_time'
|
|
26
|
+
dateTime: { fallbackValue: string }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface Card {
|
|
30
|
+
productRetailerId: string
|
|
31
|
+
catalogId: string
|
|
32
|
+
cardIndex?: number
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface WhatsappProductCarouselProps {
|
|
36
|
+
templateName: string
|
|
37
|
+
templateLanguage: string
|
|
38
|
+
cards: Card[]
|
|
39
|
+
bodyParameters?: Parameters[]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const serialize = (message: string) => {
|
|
43
|
+
return { text: message }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const WhatsappProductCarousel = (
|
|
47
|
+
props: WhatsappProductCarouselProps
|
|
48
|
+
) => {
|
|
49
|
+
const renderBrowser = () => {
|
|
50
|
+
// Return a dummy message for browser
|
|
51
|
+
const message = `WhatsApp Product Carousel would be sent to the user.`
|
|
52
|
+
return (
|
|
53
|
+
<Message json={serialize(message)} {...props} type={INPUT.TEXT}>
|
|
54
|
+
{message}
|
|
55
|
+
</Message>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const getCards = (cards: Card[]) => {
|
|
60
|
+
cards.forEach((card, index) => {
|
|
61
|
+
if (!card.cardIndex) {
|
|
62
|
+
card.cardIndex = index
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
return toSnakeCaseKeys(cards)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const renderNode = () => {
|
|
69
|
+
return (
|
|
70
|
+
// @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
|
|
71
|
+
<message
|
|
72
|
+
{...props}
|
|
73
|
+
bodyParameters={JSON.stringify(toSnakeCaseKeys(props.bodyParameters))}
|
|
74
|
+
cards={JSON.stringify(getCards(props.cards))}
|
|
75
|
+
templateName={props.templateName}
|
|
76
|
+
templateLanguage={props.templateLanguage}
|
|
77
|
+
type={INPUT.WHATSAPP_PRODUCT_CAROUSEL}
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return renderComponent({ renderBrowser, renderNode })
|
|
83
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { INPUT } from '@botonic/core'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { toSnakeCaseKeys } from '../util/functional'
|
|
5
|
+
import { renderComponent } from '../util/react'
|
|
6
|
+
import { Message } from './message'
|
|
7
|
+
|
|
8
|
+
export interface ProductItem {
|
|
9
|
+
productRetailerId: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface WhatsappProductListSection {
|
|
13
|
+
title: string
|
|
14
|
+
productItems: ProductItem[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface WhatsappProductListProps {
|
|
18
|
+
body: string
|
|
19
|
+
header: string
|
|
20
|
+
catalogId: string
|
|
21
|
+
sections: WhatsappProductListSection[]
|
|
22
|
+
footer?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const serialize = (message: string) => {
|
|
26
|
+
return { text: message }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const WhatsappProductList = (props: WhatsappProductListProps) => {
|
|
30
|
+
const renderBrowser = () => {
|
|
31
|
+
// Return a dummy message for browser
|
|
32
|
+
const message = `WhatsApp Product List would be sent to the user.`
|
|
33
|
+
return (
|
|
34
|
+
<Message json={serialize(message)} {...props} type={INPUT.TEXT}>
|
|
35
|
+
{message}
|
|
36
|
+
</Message>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const renderNode = () => {
|
|
41
|
+
return (
|
|
42
|
+
// @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
|
|
43
|
+
<message
|
|
44
|
+
{...props}
|
|
45
|
+
body={props.body}
|
|
46
|
+
footer={props.footer}
|
|
47
|
+
header={props.header}
|
|
48
|
+
sections={JSON.stringify(toSnakeCaseKeys(props.sections))}
|
|
49
|
+
catalogId={props.catalogId}
|
|
50
|
+
type={INPUT.WHATSAPP_PRODUCT_LIST}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return renderComponent({ renderBrowser, renderNode })
|
|
56
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { INPUT } from '@botonic/core'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { renderComponent } from '../util/react'
|
|
5
|
+
import { Message } from './message'
|
|
6
|
+
|
|
7
|
+
export interface WhatsappProductProps {
|
|
8
|
+
body: string
|
|
9
|
+
catalogId: string
|
|
10
|
+
productId: string
|
|
11
|
+
footer?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const serialize = (message: string) => {
|
|
15
|
+
return { text: message }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const WhatsappProduct = (props: WhatsappProductProps) => {
|
|
19
|
+
const renderBrowser = () => {
|
|
20
|
+
// Return a dummy message for browser
|
|
21
|
+
const message = `WhatsApp Product would be sent to the user.`
|
|
22
|
+
return (
|
|
23
|
+
<Message json={serialize(message)} {...props} type={INPUT.TEXT}>
|
|
24
|
+
{message}
|
|
25
|
+
</Message>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const renderNode = () => {
|
|
30
|
+
return (
|
|
31
|
+
// @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
|
|
32
|
+
<message
|
|
33
|
+
{...props}
|
|
34
|
+
body={props.body}
|
|
35
|
+
footer={props.footer}
|
|
36
|
+
catalogId={props.catalogId}
|
|
37
|
+
productId={props.productId}
|
|
38
|
+
type={INPUT.WHATSAPP_PRODUCT}
|
|
39
|
+
/>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return renderComponent({ renderBrowser, renderNode })
|
|
44
|
+
}
|
package/src/constants.js
CHANGED
|
@@ -33,25 +33,13 @@ export const COLORS = {
|
|
|
33
33
|
|
|
34
34
|
export const WEBCHAT = {
|
|
35
35
|
DEFAULTS: {
|
|
36
|
-
WIDTH: 300,
|
|
37
|
-
HEIGHT: 450,
|
|
38
|
-
TITLE: 'Botonic',
|
|
39
36
|
LOGO: BotonicLogo,
|
|
40
37
|
URL_ICON: UrlIcon,
|
|
41
|
-
PLACEHOLDER: 'Ask me something...',
|
|
42
|
-
FONT_FAMILY: "'Noto Sans JP', sans-serif",
|
|
43
|
-
BORDER_RADIUS_TOP_CORNERS: '6px 6px 0px 0px',
|
|
44
38
|
ELEMENT_WIDTH: 222,
|
|
45
39
|
ELEMENT_MARGIN_RIGHT: 6,
|
|
46
40
|
STORAGE_KEY: 'botonicState',
|
|
47
41
|
HOST_ID: 'root',
|
|
48
42
|
ID: 'botonic-webchat',
|
|
49
|
-
BUTTON_AUTO_DISABLE: false,
|
|
50
|
-
BUTTON_DISABLED_STYLE: {
|
|
51
|
-
opacity: 0.5,
|
|
52
|
-
cursor: 'auto',
|
|
53
|
-
pointerEvents: 'none',
|
|
54
|
-
},
|
|
55
43
|
},
|
|
56
44
|
CUSTOM_PROPERTIES: {
|
|
57
45
|
// General
|
|
@@ -189,10 +177,3 @@ export const ROLES = {
|
|
|
189
177
|
DOCUMENT_MESSAGE: 'document-message',
|
|
190
178
|
RAW_MESSAGE: 'raw-message',
|
|
191
179
|
}
|
|
192
|
-
|
|
193
|
-
export const COMPONENT_TYPE = {
|
|
194
|
-
TEXT: 'Text',
|
|
195
|
-
BUTTON: 'Button',
|
|
196
|
-
REPLY: 'Reply',
|
|
197
|
-
CAROUSEL: 'Carousel',
|
|
198
|
-
}
|
package/src/contexts.tsx
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { Input as CoreInput, Session as CoreSession } from '@botonic/core'
|
|
2
2
|
import { createContext } from 'react'
|
|
3
3
|
|
|
4
|
-
import { ActionRequest
|
|
5
|
-
import { webchatInitialState } from './webchat/hooks'
|
|
4
|
+
import { ActionRequest } from './index-types'
|
|
6
5
|
|
|
7
|
-
export const RequestContext = createContext<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
setLocale: () => undefined,
|
|
15
|
-
session: {} as CoreSession,
|
|
6
|
+
export const RequestContext = createContext<ActionRequest>({
|
|
7
|
+
getUserCountry: () => '',
|
|
8
|
+
getUserLocale: () => '',
|
|
9
|
+
getSystemLocale: () => '',
|
|
10
|
+
setUserCountry: () => undefined,
|
|
11
|
+
setUserLocale: () => undefined,
|
|
12
|
+
setSystemLocale: () => undefined,
|
|
16
13
|
params: {},
|
|
17
|
-
input: {} as CoreInput,
|
|
18
14
|
defaultDelay: 0,
|
|
19
15
|
defaultTyping: 0,
|
|
16
|
+
input: {} as CoreInput,
|
|
17
|
+
session: {} as CoreSession,
|
|
18
|
+
lastRoutePath: '',
|
|
19
|
+
plugins: {},
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
export interface CloseWebviewOptions {
|
|
@@ -25,85 +25,20 @@ export interface CloseWebviewOptions {
|
|
|
25
25
|
params?: Record<string, any>
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export
|
|
28
|
+
export interface WebviewRequestContextType {
|
|
29
|
+
params: Record<string, string>
|
|
30
|
+
session: Partial<CoreSession>
|
|
31
|
+
getUserCountry: () => string
|
|
32
|
+
getUserLocale: () => string
|
|
33
|
+
getSystemLocale: () => string
|
|
29
34
|
closeWebview: (options?: CloseWebviewOptions) => Promise<void>
|
|
30
|
-
|
|
31
|
-
params: Record<string, any>
|
|
32
|
-
session: CoreSession
|
|
33
|
-
}>({
|
|
34
|
-
closeWebview: async () => undefined,
|
|
35
|
-
getString: () => '',
|
|
36
|
-
params: {} as Record<string, any>,
|
|
37
|
-
session: {} as CoreSession,
|
|
38
|
-
})
|
|
35
|
+
}
|
|
39
36
|
|
|
40
|
-
export const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
getThemeProperty: () => {
|
|
48
|
-
return
|
|
49
|
-
}, // used to retrieve a specific property of the theme defined by the developer in his 'webchat/index.js'
|
|
50
|
-
openWebview: () => {
|
|
51
|
-
return
|
|
52
|
-
},
|
|
53
|
-
resolveCase: () => {
|
|
54
|
-
return
|
|
55
|
-
},
|
|
56
|
-
resetUnreadMessages: () => {
|
|
57
|
-
return
|
|
58
|
-
},
|
|
59
|
-
setLastMessageVisible: () => {
|
|
60
|
-
return
|
|
61
|
-
},
|
|
62
|
-
sendAttachment: async () => {
|
|
63
|
-
return
|
|
64
|
-
},
|
|
65
|
-
sendInput: async () => {
|
|
66
|
-
return
|
|
67
|
-
},
|
|
68
|
-
sendPayload: async () => {
|
|
69
|
-
return
|
|
70
|
-
},
|
|
71
|
-
sendText: async () => {
|
|
72
|
-
return
|
|
73
|
-
},
|
|
74
|
-
theme: {},
|
|
75
|
-
toggleWebchat: () => {
|
|
76
|
-
return
|
|
77
|
-
},
|
|
78
|
-
toggleEmojiPicker: () => {
|
|
79
|
-
return
|
|
80
|
-
},
|
|
81
|
-
togglePersistentMenu: () => {
|
|
82
|
-
return
|
|
83
|
-
},
|
|
84
|
-
updateLatestInput: () => {
|
|
85
|
-
return
|
|
86
|
-
},
|
|
87
|
-
updateMessage: () => {
|
|
88
|
-
return
|
|
89
|
-
},
|
|
90
|
-
updateReplies: () => {
|
|
91
|
-
return
|
|
92
|
-
},
|
|
93
|
-
updateUser: () => {
|
|
94
|
-
return
|
|
95
|
-
},
|
|
96
|
-
updateWebchatDevSettings: () => {
|
|
97
|
-
return
|
|
98
|
-
},
|
|
99
|
-
webchatState: webchatInitialState,
|
|
100
|
-
trackEvent: async () => {
|
|
101
|
-
return
|
|
102
|
-
},
|
|
103
|
-
webchatRef: { current: null },
|
|
104
|
-
chatAreaRef: { current: null },
|
|
105
|
-
inputPanelRef: { current: null },
|
|
106
|
-
headerRef: { current: null },
|
|
107
|
-
scrollableMessagesListRef: { current: null },
|
|
108
|
-
repliesRef: { current: null },
|
|
37
|
+
export const WebviewRequestContext = createContext<WebviewRequestContextType>({
|
|
38
|
+
params: {} as Record<string, string>,
|
|
39
|
+
session: {} as Partial<CoreSession>,
|
|
40
|
+
getUserCountry: () => '',
|
|
41
|
+
getUserLocale: () => '',
|
|
42
|
+
getSystemLocale: () => '',
|
|
43
|
+
closeWebview: async () => undefined,
|
|
109
44
|
})
|
package/src/dev-app.jsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import merge from 'lodash.merge'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import {
|
|
2
|
+
import { createRoot } from 'react-dom/client'
|
|
4
3
|
|
|
5
4
|
import { SENDERS } from './index-types'
|
|
6
5
|
import { ReactBot } from './react-bot'
|
|
@@ -56,13 +55,6 @@ export class DevApp extends WebchatApp {
|
|
|
56
55
|
getComponent(host, optionsAtRuntime = {}) {
|
|
57
56
|
let {
|
|
58
57
|
theme = {},
|
|
59
|
-
persistentMenu,
|
|
60
|
-
coverComponent,
|
|
61
|
-
blockInputs,
|
|
62
|
-
enableEmojiPicker,
|
|
63
|
-
enableAttachments,
|
|
64
|
-
enableUserInput,
|
|
65
|
-
enableAnimations,
|
|
66
58
|
storage,
|
|
67
59
|
storageKey,
|
|
68
60
|
onInit,
|
|
@@ -73,14 +65,7 @@ export class DevApp extends WebchatApp {
|
|
|
73
65
|
hostId,
|
|
74
66
|
...webchatOptions
|
|
75
67
|
} = optionsAtRuntime
|
|
76
|
-
theme =
|
|
77
|
-
persistentMenu = persistentMenu || this.persistentMenu
|
|
78
|
-
coverComponent = coverComponent || this.coverComponent
|
|
79
|
-
blockInputs = blockInputs || this.blockInputs
|
|
80
|
-
enableEmojiPicker = enableEmojiPicker || this.enableEmojiPicker
|
|
81
|
-
enableAttachments = enableAttachments || this.enableAttachments
|
|
82
|
-
enableUserInput = enableUserInput || this.enableUserInput
|
|
83
|
-
enableAnimations = enableAnimations || this.enableAnimations
|
|
68
|
+
theme = super.createInitialTheme(optionsAtRuntime)
|
|
84
69
|
storage = storage || this.storage
|
|
85
70
|
storageKey = storageKey || this.storageKey
|
|
86
71
|
this.onInit = onInit || this.onInit
|
|
@@ -97,17 +82,8 @@ export class DevApp extends WebchatApp {
|
|
|
97
82
|
host={this.host}
|
|
98
83
|
shadowDOM={this.shadowDOM}
|
|
99
84
|
theme={theme}
|
|
100
|
-
persistentMenu={persistentMenu}
|
|
101
|
-
coverComponent={coverComponent}
|
|
102
|
-
blockInputs={blockInputs}
|
|
103
|
-
enableEmojiPicker={enableEmojiPicker}
|
|
104
|
-
enableAttachments={enableAttachments}
|
|
105
|
-
enableUserInput={enableUserInput}
|
|
106
|
-
enableAnimations={enableAnimations}
|
|
107
85
|
storage={storage}
|
|
108
86
|
storageKey={storageKey}
|
|
109
|
-
getString={(stringId, session) => this.bot.getString(stringId, session)}
|
|
110
|
-
setLocale={(locale, session) => this.bot.setLocale(locale, session)}
|
|
111
87
|
onInit={(...args) => this.onInitWebchat(...args)}
|
|
112
88
|
onOpen={(...args) => this.onOpenWebchat(...args)}
|
|
113
89
|
onClose={(...args) => this.onCloseWebchat(...args)}
|
|
@@ -119,10 +95,10 @@ export class DevApp extends WebchatApp {
|
|
|
119
95
|
|
|
120
96
|
render(dest, optionsAtRuntime = {}) {
|
|
121
97
|
onDOMLoaded(() => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
)
|
|
98
|
+
const devAppComponent = this.getComponent(dest, optionsAtRuntime)
|
|
99
|
+
const container = this.getReactMountNode(dest)
|
|
100
|
+
const reactRoot = createRoot(container)
|
|
101
|
+
reactRoot.render(devAppComponent)
|
|
126
102
|
})
|
|
127
103
|
}
|
|
128
104
|
|