@botonic/react 0.31.1-alpha.0 → 0.31.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/app.d.ts +2 -0
- package/lib/esm/app.js +6 -0
- package/lib/esm/app.js.map +1 -0
- package/lib/esm/botonic-tester.d.ts +30 -0
- package/lib/esm/botonic-tester.js +78 -0
- package/lib/esm/botonic-tester.js.map +1 -0
- package/lib/esm/components/audio.d.ts +9 -0
- package/lib/esm/components/audio.js +21 -0
- package/lib/esm/components/audio.js.map +1 -0
- package/lib/esm/components/button.d.ts +17 -0
- package/lib/esm/components/button.js +159 -0
- package/lib/esm/components/button.js.map +1 -0
- package/lib/esm/components/buttons-disabler.d.ts +24 -0
- package/lib/esm/components/buttons-disabler.js +84 -0
- package/lib/esm/components/buttons-disabler.js.map +1 -0
- package/lib/esm/components/carousel.d.ts +10 -0
- package/lib/esm/components/carousel.js +105 -0
- package/lib/esm/components/carousel.js.map +1 -0
- package/lib/esm/components/components.d.ts +12 -0
- package/lib/esm/components/components.js +17 -0
- package/lib/esm/components/components.js.map +1 -0
- package/lib/esm/components/custom-message.d.ts +16 -0
- package/lib/esm/components/custom-message.js +50 -0
- package/lib/esm/components/custom-message.js.map +1 -0
- package/lib/esm/components/document.d.ts +9 -0
- package/lib/esm/components/document.js +42 -0
- package/lib/esm/components/document.js.map +1 -0
- package/lib/esm/components/element.d.ts +4 -0
- package/lib/esm/components/element.js +51 -0
- package/lib/esm/components/element.js.map +1 -0
- package/lib/esm/components/handoff.d.ts +1 -0
- package/lib/esm/components/handoff.js +49 -0
- package/lib/esm/components/handoff.js.map +1 -0
- package/lib/esm/components/image.d.ts +9 -0
- package/lib/esm/components/image.js +35 -0
- package/lib/esm/components/image.js.map +1 -0
- package/lib/esm/components/index-types.d.ts +89 -0
- package/lib/esm/components/index-types.js +2 -0
- package/lib/esm/components/index-types.js.map +1 -0
- package/lib/esm/components/index.d.ts +30 -0
- package/lib/esm/components/index.js +31 -0
- package/lib/esm/components/index.js.map +1 -0
- package/lib/esm/components/location.d.ts +11 -0
- package/lib/esm/components/location.js +27 -0
- package/lib/esm/components/location.js.map +1 -0
- package/lib/esm/components/markdown.d.ts +7 -0
- package/lib/esm/components/markdown.js +152 -0
- package/lib/esm/components/markdown.js.map +1 -0
- package/lib/esm/components/message/index.d.ts +1 -0
- package/lib/esm/components/message/index.js +147 -0
- package/lib/esm/components/message/index.js.map +1 -0
- package/lib/esm/components/message/message-feedback.d.ts +7 -0
- package/lib/esm/components/message/message-feedback.js +59 -0
- package/lib/esm/components/message/message-feedback.js.map +1 -0
- package/lib/esm/components/message/message-footer.d.ts +11 -0
- package/lib/esm/components/message/message-footer.js +17 -0
- package/lib/esm/components/message/message-footer.js.map +1 -0
- package/lib/esm/components/message/message-image.d.ts +7 -0
- package/lib/esm/components/message/message-image.js +19 -0
- package/lib/esm/components/message/message-image.js.map +1 -0
- package/lib/esm/components/message/styles.d.ts +33 -0
- package/lib/esm/components/message/styles.js +118 -0
- package/lib/esm/components/message/styles.js.map +1 -0
- package/lib/esm/components/message/timestamps.d.ts +13 -0
- package/lib/esm/components/message/timestamps.js +40 -0
- package/lib/esm/components/message/timestamps.js.map +1 -0
- package/lib/esm/components/message-template.d.ts +1 -0
- package/lib/esm/components/message-template.js +9 -0
- package/lib/esm/components/message-template.js.map +1 -0
- package/lib/esm/components/multichannel/facebook/facebook.d.ts +17 -0
- package/lib/esm/components/multichannel/facebook/facebook.js +43 -0
- package/lib/esm/components/multichannel/facebook/facebook.js.map +1 -0
- package/lib/esm/components/multichannel/index-types.d.ts +46 -0
- package/lib/esm/components/multichannel/index-types.js +2 -0
- package/lib/esm/components/multichannel/index-types.js.map +1 -0
- package/lib/esm/components/multichannel/index.d.ts +11 -0
- package/lib/esm/components/multichannel/index.js +12 -0
- package/lib/esm/components/multichannel/index.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel-button.d.ts +1 -0
- package/lib/esm/components/multichannel/multichannel-button.js +67 -0
- package/lib/esm/components/multichannel/multichannel-button.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel-carousel.d.ts +1 -0
- package/lib/esm/components/multichannel/multichannel-carousel.js +74 -0
- package/lib/esm/components/multichannel/multichannel-carousel.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel-context.d.ts +11 -0
- package/lib/esm/components/multichannel/multichannel-context.js +12 -0
- package/lib/esm/components/multichannel/multichannel-context.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel-reply.d.ts +1 -0
- package/lib/esm/components/multichannel/multichannel-reply.js +20 -0
- package/lib/esm/components/multichannel/multichannel-reply.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel-text.d.ts +1 -0
- package/lib/esm/components/multichannel/multichannel-text.js +160 -0
- package/lib/esm/components/multichannel/multichannel-text.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel-utils.d.ts +21 -0
- package/lib/esm/components/multichannel/multichannel-utils.js +81 -0
- package/lib/esm/components/multichannel/multichannel-utils.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel.d.ts +1 -0
- package/lib/esm/components/multichannel/multichannel.js +57 -0
- package/lib/esm/components/multichannel/multichannel.js.map +1 -0
- 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/multichannel/whatsapp/markdown-meta.d.ts +1 -0
- package/lib/esm/components/multichannel/whatsapp/markdown-meta.js +38 -0
- package/lib/esm/components/multichannel/whatsapp/markdown-meta.js.map +1 -0
- package/lib/esm/components/pic.d.ts +6 -0
- package/lib/esm/components/pic.js +25 -0
- package/lib/esm/components/pic.js.map +1 -0
- package/lib/esm/components/raw.d.ts +9 -0
- package/lib/esm/components/raw.js +39 -0
- package/lib/esm/components/raw.js.map +1 -0
- package/lib/esm/components/reply.d.ts +10 -0
- package/lib/esm/components/reply.js +53 -0
- package/lib/esm/components/reply.js.map +1 -0
- package/lib/esm/components/share-button.d.ts +1 -0
- package/lib/esm/components/share-button.js +9 -0
- package/lib/esm/components/share-button.js.map +1 -0
- package/lib/esm/components/subtitle.d.ts +6 -0
- package/lib/esm/components/subtitle.js +19 -0
- package/lib/esm/components/subtitle.js.map +1 -0
- package/lib/esm/components/text.d.ts +7 -0
- package/lib/esm/components/text.js +40 -0
- package/lib/esm/components/text.js.map +1 -0
- package/lib/esm/components/title.d.ts +6 -0
- package/lib/esm/components/title.js +17 -0
- package/lib/esm/components/title.js.map +1 -0
- package/lib/esm/components/video.d.ts +9 -0
- package/lib/esm/components/video.js +25 -0
- package/lib/esm/components/video.js.map +1 -0
- package/lib/esm/components/webchat-settings.d.ts +16 -0
- package/lib/esm/components/webchat-settings.js +69 -0
- package/lib/esm/components/webchat-settings.js.map +1 -0
- package/lib/esm/components/whatsapp-button-list.d.ts +20 -0
- package/lib/esm/components/whatsapp-button-list.js +47 -0
- package/lib/esm/components/whatsapp-button-list.js.map +1 -0
- 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.d.ts +15 -0
- package/lib/esm/components/whatsapp-cta-url-button.js +33 -0
- package/lib/esm/components/whatsapp-cta-url-button.js.map +1 -0
- 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/components/whatsapp-template.d.ts +1 -0
- package/lib/esm/components/whatsapp-template.js +20 -0
- package/lib/esm/components/whatsapp-template.js.map +1 -0
- package/lib/esm/constants.d.ts +165 -0
- package/lib/esm/constants.js +187 -0
- package/lib/esm/constants.js.map +1 -0
- package/lib/esm/contexts.d.ts +18 -0
- package/lib/esm/contexts.js +18 -0
- package/lib/esm/contexts.js.map +1 -0
- package/lib/esm/dev-app.d.ts +38 -0
- package/lib/esm/dev-app.js +81 -0
- package/lib/esm/dev-app.js.map +1 -0
- package/lib/esm/index-types.d.ts +178 -0
- package/lib/esm/index-types.js +12 -0
- package/lib/esm/index-types.js.map +1 -0
- package/lib/esm/index.d.ts +11 -0
- package/lib/esm/index.js +12 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/message-utils.d.ts +19 -0
- package/lib/esm/message-utils.js +41 -0
- package/lib/esm/message-utils.js.map +1 -0
- package/lib/esm/msg-to-botonic.d.ts +18 -0
- package/lib/esm/msg-to-botonic.js +132 -0
- package/lib/esm/msg-to-botonic.js.map +1 -0
- package/lib/esm/node-app.d.ts +7 -0
- package/lib/esm/node-app.js +19 -0
- package/lib/esm/node-app.js.map +1 -0
- package/lib/esm/react-bot.d.ts +8 -0
- package/lib/esm/react-bot.js +32 -0
- package/lib/esm/react-bot.js.map +1 -0
- package/lib/esm/shared/styles.d.ts +2 -0
- package/lib/esm/shared/styles.js +28 -0
- package/lib/esm/shared/styles.js.map +1 -0
- package/lib/esm/util/dom.d.ts +4 -0
- package/lib/esm/util/dom.js +24 -0
- package/lib/esm/util/dom.js.map +1 -0
- package/lib/esm/util/environment.d.ts +6 -0
- package/lib/esm/util/environment.js +61 -0
- package/lib/esm/util/environment.js.map +1 -0
- package/lib/esm/util/error-boundary.d.ts +7 -0
- package/lib/esm/util/error-boundary.js +28 -0
- package/lib/esm/util/error-boundary.js.map +1 -0
- 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/index.d.ts +9 -0
- package/lib/esm/util/index.js +10 -0
- package/lib/esm/util/index.js.map +1 -0
- package/lib/esm/util/logs.d.ts +2 -0
- package/lib/esm/util/logs.js +15 -0
- package/lib/esm/util/logs.js.map +1 -0
- package/lib/esm/util/objects.d.ts +3 -0
- package/lib/esm/util/objects.js +38 -0
- package/lib/esm/util/objects.js.map +1 -0
- package/lib/esm/util/react.d.ts +12 -0
- package/lib/esm/util/react.js +34 -0
- package/lib/esm/util/react.js.map +1 -0
- package/lib/esm/util/regexs.d.ts +2 -0
- package/lib/esm/util/regexs.js +18 -0
- package/lib/esm/util/regexs.js.map +1 -0
- package/lib/esm/util/strings.d.ts +1 -0
- package/lib/esm/util/strings.js +7 -0
- package/lib/esm/util/strings.js.map +1 -0
- package/lib/esm/util/webchat.d.ts +22 -0
- package/lib/esm/util/webchat.js +55 -0
- package/lib/esm/util/webchat.js.map +1 -0
- package/lib/esm/util/webviews.d.ts +1 -0
- package/lib/esm/util/webviews.js +6 -0
- package/lib/esm/util/webviews.js.map +1 -0
- package/lib/esm/webchat/chat-area/index.d.ts +1 -0
- package/lib/esm/webchat/chat-area/index.js +18 -0
- package/lib/esm/webchat/chat-area/index.js.map +1 -0
- package/lib/esm/webchat/chat-area/styles.d.ts +3 -0
- package/lib/esm/webchat/chat-area/styles.js +9 -0
- package/lib/esm/webchat/chat-area/styles.js.map +1 -0
- package/lib/esm/webchat/components/common.d.ts +1 -0
- package/lib/esm/webchat/components/common.js +9 -0
- package/lib/esm/webchat/components/common.js.map +1 -0
- package/lib/esm/webchat/components/conditional-animation.d.ts +1 -0
- package/lib/esm/webchat/components/conditional-animation.js +12 -0
- package/lib/esm/webchat/components/conditional-animation.js.map +1 -0
- package/lib/esm/webchat/components/opened-persistent-menu.d.ts +6 -0
- package/lib/esm/webchat/components/opened-persistent-menu.js +30 -0
- package/lib/esm/webchat/components/opened-persistent-menu.js.map +1 -0
- package/lib/esm/webchat/constants.d.ts +8 -0
- package/lib/esm/webchat/constants.js +10 -0
- package/lib/esm/webchat/constants.js.map +1 -0
- package/lib/esm/webchat/context/actions.d.ts +29 -0
- package/lib/esm/webchat/context/actions.js +32 -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 +78 -0
- package/lib/esm/webchat/context/index.js.map +1 -0
- package/lib/esm/webchat/context/messages-reducer.d.ts +6 -0
- package/lib/esm/webchat/context/messages-reducer.js +85 -0
- package/lib/esm/webchat/context/messages-reducer.js.map +1 -0
- package/lib/esm/webchat/context/types.d.ts +74 -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 +47 -0
- package/lib/esm/webchat/context/use-webchat.js +195 -0
- package/lib/esm/webchat/context/use-webchat.js.map +1 -0
- package/lib/esm/webchat/context/webchat-reducer.d.ts +6 -0
- package/lib/esm/webchat/context/webchat-reducer.js +48 -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/devices/index.d.ts +11 -0
- package/lib/esm/webchat/devices/index.js +18 -0
- package/lib/esm/webchat/devices/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 +55 -0
- package/lib/esm/webchat/header/styles.js.map +1 -0
- package/lib/esm/webchat/hooks/index.d.ts +10 -0
- package/lib/esm/webchat/hooks/index.js +11 -0
- package/lib/esm/webchat/hooks/index.js.map +1 -0
- package/lib/esm/webchat/hooks/use-component-visible.d.ts +8 -0
- package/lib/esm/webchat/hooks/use-component-visible.js +20 -0
- package/lib/esm/webchat/hooks/use-component-visible.js.map +1 -0
- package/lib/esm/webchat/hooks/use-component-will-mount.d.ts +1 -0
- package/lib/esm/webchat/hooks/use-component-will-mount.js +5 -0
- package/lib/esm/webchat/hooks/use-component-will-mount.js.map +1 -0
- package/lib/esm/webchat/hooks/use-device-adapter.d.ts +3 -0
- package/lib/esm/webchat/hooks/use-device-adapter.js +42 -0
- package/lib/esm/webchat/hooks/use-device-adapter.js.map +1 -0
- package/lib/esm/webchat/hooks/use-previous.d.ts +1 -0
- package/lib/esm/webchat/hooks/use-previous.js +9 -0
- package/lib/esm/webchat/hooks/use-previous.js.map +1 -0
- package/lib/esm/webchat/hooks/use-scroll-to-bottom.d.ts +9 -0
- package/lib/esm/webchat/hooks/use-scroll-to-bottom.js +19 -0
- package/lib/esm/webchat/hooks/use-scroll-to-bottom.js.map +1 -0
- package/lib/esm/webchat/hooks/use-scrollbar-controller.d.ts +6 -0
- package/lib/esm/webchat/hooks/use-scrollbar-controller.js +136 -0
- package/lib/esm/webchat/hooks/use-scrollbar-controller.js.map +1 -0
- package/lib/esm/webchat/hooks/use-typing.d.ts +10 -0
- package/lib/esm/webchat/hooks/use-typing.js +28 -0
- package/lib/esm/webchat/hooks/use-typing.js.map +1 -0
- package/lib/esm/webchat/hooks/use-virtual-keyboard-detection.d.ts +3 -0
- package/lib/esm/webchat/hooks/use-virtual-keyboard-detection.js +24 -0
- package/lib/esm/webchat/hooks/use-virtual-keyboard-detection.js.map +1 -0
- package/lib/esm/webchat/hooks/use-webchat-dimensions.d.ts +4 -0
- package/lib/esm/webchat/hooks/use-webchat-dimensions.js +36 -0
- package/lib/esm/webchat/hooks/use-webchat-dimensions.js.map +1 -0
- package/lib/esm/webchat/hooks/use-webchat-resizer.d.ts +4 -0
- package/lib/esm/webchat/hooks/use-webchat-resizer.js +30 -0
- package/lib/esm/webchat/hooks/use-webchat-resizer.js.map +1 -0
- package/lib/esm/webchat/index-types.d.ts +18 -0
- package/lib/esm/webchat/index-types.js +2 -0
- package/lib/esm/webchat/index-types.js.map +1 -0
- package/lib/esm/webchat/index.d.ts +5 -0
- package/lib/esm/webchat/index.js +11 -0
- package/lib/esm/webchat/index.js.map +1 -0
- package/lib/esm/webchat/input-panel/attachment.d.ts +7 -0
- package/lib/esm/webchat/input-panel/attachment.js +26 -0
- package/lib/esm/webchat/input-panel/attachment.js.map +1 -0
- package/lib/esm/webchat/input-panel/emoji-picker.d.ts +6 -0
- package/lib/esm/webchat/input-panel/emoji-picker.js +23 -0
- package/lib/esm/webchat/input-panel/emoji-picker.js.map +1 -0
- package/lib/esm/webchat/input-panel/index.d.ts +12 -0
- package/lib/esm/webchat/input-panel/index.js +55 -0
- package/lib/esm/webchat/input-panel/index.js.map +1 -0
- package/lib/esm/webchat/input-panel/opened-emoji-picker.d.ts +6 -0
- package/lib/esm/webchat/input-panel/opened-emoji-picker.js +10 -0
- package/lib/esm/webchat/input-panel/opened-emoji-picker.js.map +1 -0
- package/lib/esm/webchat/input-panel/persistent-menu.d.ts +6 -0
- package/lib/esm/webchat/input-panel/persistent-menu.js +14 -0
- package/lib/esm/webchat/input-panel/persistent-menu.js.map +1 -0
- package/lib/esm/webchat/input-panel/send-button.d.ts +5 -0
- package/lib/esm/webchat/input-panel/send-button.js +14 -0
- package/lib/esm/webchat/input-panel/send-button.js.map +1 -0
- package/lib/esm/webchat/input-panel/styles.d.ts +3 -0
- package/lib/esm/webchat/input-panel/styles.js +27 -0
- package/lib/esm/webchat/input-panel/styles.js.map +1 -0
- package/lib/esm/webchat/input-panel/textarea.d.ts +11 -0
- package/lib/esm/webchat/input-panel/textarea.js +58 -0
- package/lib/esm/webchat/input-panel/textarea.js.map +1 -0
- package/lib/esm/webchat/message-list/index.d.ts +1 -0
- package/lib/esm/webchat/message-list/index.js +107 -0
- package/lib/esm/webchat/message-list/index.js.map +1 -0
- package/lib/esm/webchat/message-list/intro-message.d.ts +1 -0
- package/lib/esm/webchat/message-list/intro-message.js +18 -0
- package/lib/esm/webchat/message-list/intro-message.js.map +1 -0
- package/lib/esm/webchat/message-list/scroll-button.d.ts +6 -0
- package/lib/esm/webchat/message-list/scroll-button.js +12 -0
- package/lib/esm/webchat/message-list/scroll-button.js.map +1 -0
- package/lib/esm/webchat/message-list/styles.d.ts +5 -0
- package/lib/esm/webchat/message-list/styles.js +56 -0
- package/lib/esm/webchat/message-list/styles.js.map +1 -0
- package/lib/esm/webchat/message-list/unread-messages-banner.d.ts +6 -0
- package/lib/esm/webchat/message-list/unread-messages-banner.js +13 -0
- package/lib/esm/webchat/message-list/unread-messages-banner.js.map +1 -0
- package/lib/esm/webchat/message-list/use-debounce.d.ts +1 -0
- package/lib/esm/webchat/message-list/use-debounce.js +14 -0
- package/lib/esm/webchat/message-list/use-debounce.js.map +1 -0
- package/lib/esm/webchat/message-list/use-notifications.d.ts +7 -0
- package/lib/esm/webchat/message-list/use-notifications.js +20 -0
- package/lib/esm/webchat/message-list/use-notifications.js.map +1 -0
- 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 -0
- package/lib/esm/webchat/session-view.js +96 -0
- package/lib/esm/webchat/session-view.js.map +1 -0
- package/lib/esm/webchat/styles.d.ts +9 -0
- package/lib/esm/webchat/styles.js +50 -0
- package/lib/esm/webchat/styles.js.map +1 -0
- package/lib/esm/webchat/theme/types.d.ts +167 -0
- package/lib/esm/webchat/theme/types.js +2 -0
- package/lib/esm/webchat/theme/types.js.map +1 -0
- package/lib/esm/webchat/tracking.d.ts +7 -0
- package/lib/esm/webchat/tracking.js +10 -0
- package/lib/esm/webchat/tracking.js.map +1 -0
- package/lib/esm/webchat/trigger-button/index.d.ts +2 -0
- package/lib/esm/webchat/trigger-button/index.js +28 -0
- package/lib/esm/webchat/trigger-button/index.js.map +1 -0
- package/lib/esm/webchat/trigger-button/styles.d.ts +3 -0
- package/lib/esm/webchat/trigger-button/styles.js +36 -0
- package/lib/esm/webchat/trigger-button/styles.js.map +1 -0
- package/lib/esm/webchat/typing-indicator/index.d.ts +3 -0
- package/lib/esm/webchat/typing-indicator/index.js +8 -0
- package/lib/esm/webchat/typing-indicator/index.js.map +1 -0
- package/lib/esm/webchat/typing-indicator/styles.d.ts +7 -0
- package/lib/esm/webchat/typing-indicator/styles.js +46 -0
- package/lib/esm/webchat/typing-indicator/styles.js.map +1 -0
- package/lib/esm/webchat/use-storage-state-hook.d.ts +1 -0
- package/lib/esm/webchat/use-storage-state-hook.js +38 -0
- package/lib/esm/webchat/use-storage-state-hook.js.map +1 -0
- package/lib/esm/webchat/utils.d.ts +2 -0
- package/lib/esm/webchat/utils.js +8 -0
- package/lib/esm/webchat/utils.js.map +1 -0
- package/lib/esm/webchat/webchat-dev.d.ts +7 -0
- package/lib/esm/webchat/webchat-dev.js +56 -0
- package/lib/esm/webchat/webchat-dev.js.map +1 -0
- package/lib/esm/webchat/webchat.d.ts +4 -0
- package/lib/esm/webchat/webchat.js +522 -0
- package/lib/esm/webchat/webchat.js.map +1 -0
- package/lib/esm/webchat/webview.d.ts +2 -0
- package/lib/esm/webchat/webview.js +71 -0
- package/lib/esm/webchat/webview.js.map +1 -0
- package/lib/esm/webchat-app.d.ts +78 -0
- package/lib/esm/webchat-app.js +363 -0
- package/lib/esm/webchat-app.js.map +1 -0
- package/lib/esm/webview-app.d.ts +7 -0
- package/lib/esm/webview-app.js +105 -0
- package/lib/esm/webview-app.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CustomMessageType } from './index-types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* name: as it appears at ThemeProps' message.customTypes key
|
|
6
|
+
* CustomMessageComponent
|
|
7
|
+
* defaultProps: Props for the wrapper Message
|
|
8
|
+
* ErrorBoundary: to recover in case it fails
|
|
9
|
+
*/
|
|
10
|
+
export interface CustomMessageArgs {
|
|
11
|
+
name: string;
|
|
12
|
+
component: React.ComponentType;
|
|
13
|
+
defaultProps?: Record<string, any>;
|
|
14
|
+
errorBoundary?: any;
|
|
15
|
+
}
|
|
16
|
+
export declare const customMessage: ({ name, component: CustomMessageComponent, defaultProps, errorBoundary, }: CustomMessageArgs) => CustomMessageType;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { INPUT } from '@botonic/core';
|
|
4
|
+
import merge from 'lodash.merge';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { SENDERS } from '../index-types';
|
|
7
|
+
import { createErrorBoundary } from '../util/error-boundary';
|
|
8
|
+
import { warnDeprecatedProps } from '../util/logs';
|
|
9
|
+
import { mapObjectNonBooleanValues } from '../util/react';
|
|
10
|
+
import { Message } from './message';
|
|
11
|
+
import { Reply } from './reply';
|
|
12
|
+
export const customMessage = ({ name, component: CustomMessageComponent, defaultProps = {}, errorBoundary = createErrorBoundary(), }) => {
|
|
13
|
+
const CustomMessage = props => {
|
|
14
|
+
warnDeprecatedProps(defaultProps, 'customMessage:');
|
|
15
|
+
if (defaultProps.sentBy === SENDERS.user) {
|
|
16
|
+
defaultProps.ack = 1;
|
|
17
|
+
}
|
|
18
|
+
return (_jsx(Message, Object.assign({}, merge(mapObjectNonBooleanValues(defaultProps), props), { type: INPUT.CUSTOM })));
|
|
19
|
+
};
|
|
20
|
+
const splitChildren = props => {
|
|
21
|
+
const { children } = props;
|
|
22
|
+
const isReply = e => e.type === Reply;
|
|
23
|
+
try {
|
|
24
|
+
if (!Array.isArray(children) && !isReply(children)) {
|
|
25
|
+
return { replies: null, childrenWithoutReplies: children };
|
|
26
|
+
}
|
|
27
|
+
const childrenArray = React.Children.toArray(children);
|
|
28
|
+
const replies = childrenArray.filter(isReply);
|
|
29
|
+
const childrenWithoutReplies = childrenArray.filter(e => !isReply(e));
|
|
30
|
+
return {
|
|
31
|
+
replies: replies,
|
|
32
|
+
childrenWithoutReplies,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
return { replies: null, childrenWithoutReplies: children };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const WrappedComponent = props => {
|
|
40
|
+
const { id, children } = props, customMessageProps = __rest(props, ["id", "children"]);
|
|
41
|
+
const { replies, childrenWithoutReplies } = splitChildren(props);
|
|
42
|
+
const ErrorBoundary = errorBoundary;
|
|
43
|
+
return (_jsxs(CustomMessage, Object.assign({ id: id, json: Object.assign(Object.assign({}, customMessageProps), { id, children: childrenWithoutReplies, customTypeName: name }), sentBy: props.sentBy || SENDERS.bot, isUnread: props.isUnread }, { children: [_jsx(ErrorBoundary, Object.assign({}, customMessageProps, { children: _jsx(CustomMessageComponent, Object.assign({}, customMessageProps, { children: childrenWithoutReplies })) }), 'errorBoundary'), replies] })));
|
|
44
|
+
};
|
|
45
|
+
WrappedComponent.customTypeName = name;
|
|
46
|
+
// eslint-disable-next-line react/display-name
|
|
47
|
+
WrappedComponent.deserialize = (msg) => (_jsx(WrappedComponent, Object.assign({ id: msg.id, json: msg.data }, msg.data, { sentBy: msg.sentBy || SENDERS.bot, isUnread: msg.isUnread }), msg.key));
|
|
48
|
+
return WrappedComponent;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=custom-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-message.js","sourceRoot":"","sources":["../../../src/components/custom-message.ts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,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAA;IACtC,8CAA8C;IAC9C,gBAAgB,CAAC,WAAW,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,CAC3C,KAAC,gBAAgB,kBACf,EAAE,EAAE,GAAG,CAAC,EAAE,EAEV,IAAI,EAAE,GAAG,CAAC,IAAI,IACV,GAAG,CAAC,IAAI,IACZ,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,EACjC,QAAQ,EAAE,GAAG,CAAC,QAAQ,KAJjB,GAAG,CAAC,GAAG,CAKZ,CACH,CAAA;IACD,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { INPUT, isBrowser } from '@botonic/core';
|
|
3
|
+
import { useContext } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { ROLES, WEBCHAT } from '../constants';
|
|
6
|
+
import { staticAsset } from '../util/environment';
|
|
7
|
+
import { WebchatContext } from '../webchat/context';
|
|
8
|
+
import { Message } from './message';
|
|
9
|
+
const StyledButton = styled.a `
|
|
10
|
+
display: block;
|
|
11
|
+
height: 25px;
|
|
12
|
+
background-color: #f0f0f0;
|
|
13
|
+
padding: 10px;
|
|
14
|
+
text-align: center;
|
|
15
|
+
border-radius: 5px;
|
|
16
|
+
color: black;
|
|
17
|
+
font-weight: bold;
|
|
18
|
+
line-height: 25px;
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
border: 1px solid black;
|
|
21
|
+
opacity: 0.9;
|
|
22
|
+
&:hover {
|
|
23
|
+
opacity: 1;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const serialize = (documentProps) => {
|
|
27
|
+
return { document: documentProps.src };
|
|
28
|
+
};
|
|
29
|
+
export const Document = (props) => {
|
|
30
|
+
props = Object.assign(Object.assign({}, props), { src: staticAsset(props.src) });
|
|
31
|
+
let content = props.children;
|
|
32
|
+
const { getThemeProperty } = useContext(WebchatContext);
|
|
33
|
+
let documentDownload = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.documentDownload, {});
|
|
34
|
+
if (typeof documentDownload === 'function')
|
|
35
|
+
documentDownload = documentDownload(props.from);
|
|
36
|
+
if (isBrowser()) {
|
|
37
|
+
content = (_jsx(StyledButton, Object.assign({ href: props.src, target: '_blank', rel: 'noreferrer', style: Object.assign({}, documentDownload.style) }, { children: documentDownload.text || 'Download' })));
|
|
38
|
+
}
|
|
39
|
+
return (_jsx(Message, Object.assign({ role: ROLES.DOCUMENT_MESSAGE, json: serialize(props) }, props, { type: INPUT.DOCUMENT }, { children: content })));
|
|
40
|
+
};
|
|
41
|
+
Document.serialize = serialize;
|
|
42
|
+
//# sourceMappingURL=document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../../src/components/document.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAChD,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAA;;;;;;;;;;;;;;;;CAgB5B,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,aAA8B,EAAE,EAAE;IACnD,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC,GAAG,EAAE,CAAA;AACxC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAE,EAAE;IAC/C,KAAK,mCAAQ,KAAK,KAAE,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,GAAE,CAAA;IAEjD,IAAI,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAA;IAE5B,MAAM,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAA;IACvD,IAAI,gBAAgB,GAAG,gBAAgB,CACrC,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,EAC1C,EAAE,CACH,CAAA;IACD,IAAI,OAAO,gBAAgB,KAAK,UAAU;QACxC,gBAAgB,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAEjD,IAAI,SAAS,EAAE,EAAE;QACf,OAAO,GAAG,CACR,KAAC,YAAY,kBACX,IAAI,EAAE,KAAK,CAAC,GAAG,EACf,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,YAAY,EAChB,KAAK,oBACA,gBAAgB,CAAC,KAAK,iBAG1B,gBAAgB,CAAC,IAAI,IAAI,UAAU,IACvB,CAChB,CAAA;KACF;IAED,OAAO,CACL,KAAC,OAAO,kBACN,IAAI,EAAE,KAAK,CAAC,gBAAgB,EAC5B,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,IAClB,KAAK,IACT,IAAI,EAAE,KAAK,CAAC,QAAQ,gBAEnB,OAAO,IACA,CACX,CAAA;AACH,CAAC,CAAA;AAED,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { COLORS, WEBCHAT } from '../constants';
|
|
5
|
+
import { renderComponent } from '../util/react';
|
|
6
|
+
import { Button } from './button';
|
|
7
|
+
const ElementContainer = styled.div `
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
width: ${WEBCHAT.DEFAULTS.ELEMENT_WIDTH}px;
|
|
11
|
+
margin-right: ${WEBCHAT.DEFAULTS.ELEMENT_MARGIN_RIGHT}px;
|
|
12
|
+
border-radius: 6px;
|
|
13
|
+
border: 1px solid ${COLORS.SEASHELL_WHITE};
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
justify-content: space-between;
|
|
16
|
+
`;
|
|
17
|
+
export const Element = props => {
|
|
18
|
+
const renderBrowser = () => (_jsx(ElementContainer, { children: props.children }));
|
|
19
|
+
const renderNode = () => _jsx("element", { children: props.children });
|
|
20
|
+
return renderComponent({ renderBrowser, renderNode });
|
|
21
|
+
};
|
|
22
|
+
Element.serialize = elementProps => {
|
|
23
|
+
const element = Object.assign({}, ...elementProps.children
|
|
24
|
+
.filter(c => c && c.type && c.type.name != 'Button')
|
|
25
|
+
.map(c => c.type.serialize && c.type.serialize(c.props)));
|
|
26
|
+
// When we are serializer buttons from backend, we are receiving the data
|
|
27
|
+
// as an array of buttons, so we have to keep robust with serve and deal with arrays
|
|
28
|
+
element.buttons = [
|
|
29
|
+
...elementProps.children
|
|
30
|
+
.filter(c => {
|
|
31
|
+
var _a;
|
|
32
|
+
if (c instanceof Array)
|
|
33
|
+
return true;
|
|
34
|
+
return ((_a = c === null || c === void 0 ? void 0 : c.type) === null || _a === void 0 ? void 0 : _a.name) === Button.name;
|
|
35
|
+
})
|
|
36
|
+
.map(b => {
|
|
37
|
+
var _a;
|
|
38
|
+
if (b instanceof Array) {
|
|
39
|
+
b.map(bb => { var _a, _b, _c; return (_c = (_b = (_a = bb === null || bb === void 0 ? void 0 : bb.type) === null || _a === void 0 ? void 0 : _a.serialize) === null || _b === void 0 ? void 0 : _b.call(_a, bb.props)) === null || _c === void 0 ? void 0 : _c.button; });
|
|
40
|
+
}
|
|
41
|
+
return (_a = b === null || b === void 0 ? void 0 : b.type) === null || _a === void 0 ? void 0 : _a.serialize(b.props).button;
|
|
42
|
+
}),
|
|
43
|
+
];
|
|
44
|
+
// When we have the buttons from backend, we have all buttons inside an array on the first position
|
|
45
|
+
// of another array in element['buttons'] we want that element['buttons'] to be an array of buttons,
|
|
46
|
+
// not an array of another array of buttons
|
|
47
|
+
if (element.buttons[0] instanceof Array)
|
|
48
|
+
element.buttons = element.buttons[0];
|
|
49
|
+
return element;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/components/element.jsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;;;WAGxB,OAAO,CAAC,QAAQ,CAAC,aAAa;kBACvB,OAAO,CAAC,QAAQ,CAAC,oBAAoB;;sBAEjC,MAAM,CAAC,cAAc;;;CAG1C,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAC,EAAE;IAC7B,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,CAC1B,KAAC,gBAAgB,cAAE,KAAK,CAAC,QAAQ,GAAoB,CACtD,CAAA;IAED,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,4BAAU,KAAK,CAAC,QAAQ,GAAW,CAAA;IAE5D,OAAO,eAAe,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AAED,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC,EAAE;IACjC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAC3B,EAAE,EACF,GAAG,YAAY,CAAC,QAAQ;SACrB,MAAM,CAAC,CAAC,CAAC,EAA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|
|
|
1
|
+
export function Handoff(props: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useContext, useState } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { COLORS } from '../constants';
|
|
5
|
+
import { WebchatContext } from '../webchat/context';
|
|
6
|
+
const Container = styled.div `
|
|
7
|
+
display: flex;
|
|
8
|
+
font-family: inherit;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
padding: 24px;
|
|
13
|
+
`;
|
|
14
|
+
const TransferredContainer = styled.div `
|
|
15
|
+
text-align: center;
|
|
16
|
+
white-space: normal;
|
|
17
|
+
`;
|
|
18
|
+
const EndedContainer = styled.div `
|
|
19
|
+
text-align: center;
|
|
20
|
+
white-space: normal;
|
|
21
|
+
`;
|
|
22
|
+
const StyledButton = styled.button `
|
|
23
|
+
max-width: 60%;
|
|
24
|
+
padding: 12px 24px;
|
|
25
|
+
background-color: ${COLORS.SOLID_WHITE};
|
|
26
|
+
border: none;
|
|
27
|
+
border-radius: 4px;
|
|
28
|
+
margin-top: 8px;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
`;
|
|
31
|
+
export const Handoff = props => {
|
|
32
|
+
const { resolveCase } = useContext(WebchatContext);
|
|
33
|
+
const [state, setState] = useState({ showContinue: true });
|
|
34
|
+
const continueClick = () => {
|
|
35
|
+
setState({ showContinue: false });
|
|
36
|
+
resolveCase();
|
|
37
|
+
};
|
|
38
|
+
const bgColor = state.showContinue
|
|
39
|
+
? COLORS.FRINGY_FLOWER_GREEN
|
|
40
|
+
: COLORS.TASMAN_GRAY;
|
|
41
|
+
const fontColor = state.showContinue
|
|
42
|
+
? COLORS.APPLE_GREEN
|
|
43
|
+
: COLORS.CACTUS_GREEN;
|
|
44
|
+
return (_jsxs(Container, Object.assign({ style: {
|
|
45
|
+
color: fontColor,
|
|
46
|
+
backgroundColor: bgColor,
|
|
47
|
+
} }, { children: [state.showContinue ? (_jsx(TransferredContainer, { children: "Conversation transferred to a human agent..." })) : (_jsx(EndedContainer, { children: "Human handoff ended" })), state.showContinue && (_jsx(StyledButton, Object.assign({ onClick: continueClick }, { children: "Continue" })))] })));
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=handoff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff.js","sourceRoot":"","sources":["../../../src/components/handoff.jsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;CAO3B,CAAA;AAED,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGtC,CAAA;AAED,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGhC,CAAA;AAED,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAA;;;sBAGZ,MAAM,CAAC,WAAW;;;;;CAKvC,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAC,EAAE;IAC7B,MAAM,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAA;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAA;IAE1D,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,QAAQ,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAA;QACjC,WAAW,EAAE,CAAA;IACf,CAAC,CAAA;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,YAAY;QAChC,CAAC,CAAC,MAAM,CAAC,mBAAmB;QAC5B,CAAC,CAAC,MAAM,CAAC,WAAW,CAAA;IACtB,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY;QAClC,CAAC,CAAC,MAAM,CAAC,WAAW;QACpB,CAAC,CAAC,MAAM,CAAC,YAAY,CAAA;IACvB,OAAO,CACL,MAAC,SAAS,kBACR,KAAK,EAAE;YACL,KAAK,EAAE,SAAS;YAChB,eAAe,EAAE,OAAO;SACzB,iBAEA,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CACpB,KAAC,oBAAoB,+DAEE,CACxB,CAAC,CAAC,CAAC,CACF,KAAC,cAAc,sCAAqC,CACrD,EACA,KAAK,CAAC,YAAY,IAAI,CACrB,KAAC,YAAY,kBAAC,OAAO,EAAE,aAAa,8BAAyB,CAC9D,KACS,CACb,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { INPUT, isBrowser } from '@botonic/core';
|
|
3
|
+
import { useContext, useState } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { ROLES, WEBCHAT } from '../constants';
|
|
6
|
+
import { staticAsset } from '../util/environment';
|
|
7
|
+
import { WebchatContext } from '../webchat/context';
|
|
8
|
+
import { Message } from './message';
|
|
9
|
+
const StyledImage = styled.img `
|
|
10
|
+
border-radius: 8px;
|
|
11
|
+
max-width: 150px;
|
|
12
|
+
max-height: 150px;
|
|
13
|
+
margin: -3px -6px;
|
|
14
|
+
cursor: ${({ hasPreviewer }) => (hasPreviewer ? 'pointer' : 'auto')};
|
|
15
|
+
`;
|
|
16
|
+
const serialize = (imageProps) => {
|
|
17
|
+
return { image: imageProps.src };
|
|
18
|
+
};
|
|
19
|
+
export const Image = (props) => {
|
|
20
|
+
var _a;
|
|
21
|
+
props = ((_a = props.input) === null || _a === void 0 ? void 0 : _a.data)
|
|
22
|
+
? Object.assign(Object.assign({}, props), { src: props.input.data }) : Object.assign(Object.assign({}, props), { src: staticAsset(props.src) });
|
|
23
|
+
let content = props.children;
|
|
24
|
+
const [isPreviewerOpened, setIsPreviewerOpened] = useState(false);
|
|
25
|
+
const openPreviewer = () => setIsPreviewerOpened(true);
|
|
26
|
+
const closePreviewer = () => setIsPreviewerOpened(false);
|
|
27
|
+
const { getThemeProperty } = useContext(WebchatContext);
|
|
28
|
+
const ImagePreviewer = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.imagePreviewer, null);
|
|
29
|
+
if (isBrowser()) {
|
|
30
|
+
content = (_jsxs(_Fragment, { children: [_jsx(StyledImage, { src: props.src, onClick: openPreviewer, hasPreviewer: Boolean(ImagePreviewer) }), ImagePreviewer && (_jsx(ImagePreviewer, { src: props.src, isPreviewerOpened: isPreviewerOpened, openPreviewer: openPreviewer, closePreviewer: closePreviewer }))] }));
|
|
31
|
+
}
|
|
32
|
+
return (_jsx(Message, Object.assign({ role: ROLES.IMAGE_MESSAGE, json: serialize(props) }, props, { type: INPUT.IMAGE }, { children: content })));
|
|
33
|
+
};
|
|
34
|
+
Image.serialize = serialize;
|
|
35
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/components/image.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAChD,OAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CA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AY,EAAE,OAAO,CAAC,cAAc,CAAC,GACrC,EACD,cAAc,IAAI,CACjB,KAAC,cAAc,IACb,GAAG,EAAE,KAAK,CAAC,GAAG,EACd,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B,CACH,IACA,CACJ,CAAA;KACF;IACD,OAAO,CACL,KAAC,OAAO,kBACN,IAAI,EAAE,KAAK,CAAC,aAAa,EACzB,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,IAClB,KAAK,IACT,IAAI,EAAE,KAAK,CAAC,KAAK,gBAEhB,OAAO,IACA,CACX,CAAA;AACH,CAAC,CAAA;AAED,KAAK,CAAC,SAAS,GAAG,SAAS,CAAA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SENDERS } from '../index-types';
|
|
3
|
+
export type MessageType = 'audio' | 'buttonmessage' | 'carousel' | 'custom' | 'document' | 'image' | 'location' | 'text' | 'video';
|
|
4
|
+
export interface MessageProps {
|
|
5
|
+
blob?: boolean;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
delay?: number;
|
|
8
|
+
enabletimestamps?: boolean;
|
|
9
|
+
sentBy?: SENDERS;
|
|
10
|
+
json?: Record<string, unknown>;
|
|
11
|
+
style?: Record<string, unknown>;
|
|
12
|
+
type?: MessageType;
|
|
13
|
+
typing?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface TextProps extends MessageProps {
|
|
16
|
+
markdown?: boolean;
|
|
17
|
+
feedbackEnabled?: boolean;
|
|
18
|
+
inferenceId?: string;
|
|
19
|
+
botInteractionId?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface Webview {
|
|
22
|
+
name: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ButtonProps {
|
|
25
|
+
params?: any;
|
|
26
|
+
path?: string;
|
|
27
|
+
payload?: string;
|
|
28
|
+
target?: string;
|
|
29
|
+
url?: string;
|
|
30
|
+
webview?: Webview;
|
|
31
|
+
onClick?: () => void;
|
|
32
|
+
autodisable?: boolean;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
disabledstyle?: boolean;
|
|
35
|
+
children: string;
|
|
36
|
+
setDisabled?: (disabled: boolean) => void;
|
|
37
|
+
parentId?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ReplyProps {
|
|
40
|
+
path?: string;
|
|
41
|
+
payload?: string;
|
|
42
|
+
children: string;
|
|
43
|
+
}
|
|
44
|
+
export interface PicProps {
|
|
45
|
+
src: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ImageProps extends MessageProps {
|
|
48
|
+
src: string;
|
|
49
|
+
input?: {
|
|
50
|
+
data: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface VideoProps extends MessageProps {
|
|
54
|
+
src: string;
|
|
55
|
+
input?: {
|
|
56
|
+
data: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface AudioProps extends MessageProps {
|
|
60
|
+
src: string;
|
|
61
|
+
input?: {
|
|
62
|
+
data: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export interface DocumentProps extends MessageProps {
|
|
66
|
+
src: string;
|
|
67
|
+
input?: {
|
|
68
|
+
data: string;
|
|
69
|
+
};
|
|
70
|
+
from?: any;
|
|
71
|
+
}
|
|
72
|
+
export interface TitleProps {
|
|
73
|
+
children: React.ReactNode;
|
|
74
|
+
style: string;
|
|
75
|
+
}
|
|
76
|
+
export type SubtitleProps = TitleProps;
|
|
77
|
+
export interface CustomMessageType {
|
|
78
|
+
(props: any): JSX.Element;
|
|
79
|
+
customTypeName: string;
|
|
80
|
+
deserialize(msg: any): JSX.Element;
|
|
81
|
+
}
|
|
82
|
+
export type BlockInputOption = {
|
|
83
|
+
preprocess?: (message: string) => string;
|
|
84
|
+
match: RegExp[];
|
|
85
|
+
message: string;
|
|
86
|
+
};
|
|
87
|
+
export type WrappedComponent<Props> = React.FunctionComponent<Props> & {
|
|
88
|
+
customTypeName: string;
|
|
89
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-types.js","sourceRoot":"","sources":["../../../src/components/index-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { Audio } from './audio';
|
|
2
|
+
export { Button } from './button';
|
|
3
|
+
export { Carousel } from './carousel';
|
|
4
|
+
export { customMessage } from './custom-message';
|
|
5
|
+
export { Document } from './document';
|
|
6
|
+
export { Element } from './element';
|
|
7
|
+
export { Handoff } from './handoff';
|
|
8
|
+
export { Image } from './image';
|
|
9
|
+
export * from './index-types';
|
|
10
|
+
export { Location } from './location';
|
|
11
|
+
export { Message } from './message';
|
|
12
|
+
export { MessageTemplate } from './message-template';
|
|
13
|
+
export * from './multichannel';
|
|
14
|
+
export { Pic } from './pic';
|
|
15
|
+
export { Raw } from './raw';
|
|
16
|
+
export { Reply } from './reply';
|
|
17
|
+
export { ShareButton } from './share-button';
|
|
18
|
+
export { Subtitle } from './subtitle';
|
|
19
|
+
export { Text } from './text';
|
|
20
|
+
export { Title } from './title';
|
|
21
|
+
export { Video } from './video';
|
|
22
|
+
export { normalizeWebchatSettings, WebchatSettings, WebchatSettingsProps, } from './webchat-settings';
|
|
23
|
+
export { WhatsappButtonList, WhatsappButtonListProps, WhatsappButtonListRowProps, WhatsappButtonListSectionProps, } from './whatsapp-button-list';
|
|
24
|
+
export { WhatsappCatalog, WhatsappCatalogProps } from './whatsapp-catalog';
|
|
25
|
+
export { WhatsappCTAUrlButton, WhatsappCTAUrlButtonProps, } from './whatsapp-cta-url-button';
|
|
26
|
+
export { WhatsappMediaCarousel, WhatsappMediaCarouselProps, } from './whatsapp-media-carousel';
|
|
27
|
+
export { WhatsappProduct } from './whatsapp-product';
|
|
28
|
+
export { WhatsappProductCarousel, WhatsappProductCarouselProps, } from './whatsapp-product-carousel';
|
|
29
|
+
export { ProductItem, WhatsappProductList, WhatsappProductListProps, WhatsappProductListSection, } from './whatsapp-product-list';
|
|
30
|
+
export { WhatsappTemplate } from './whatsapp-template';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export { Audio } from './audio';
|
|
2
|
+
export { Button } from './button';
|
|
3
|
+
export { Carousel } from './carousel';
|
|
4
|
+
export { customMessage } from './custom-message';
|
|
5
|
+
export { Document } from './document';
|
|
6
|
+
export { Element } from './element';
|
|
7
|
+
export { Handoff } from './handoff';
|
|
8
|
+
export { Image } from './image';
|
|
9
|
+
export * from './index-types';
|
|
10
|
+
export { Location } from './location';
|
|
11
|
+
export { Message } from './message';
|
|
12
|
+
export { MessageTemplate } from './message-template';
|
|
13
|
+
export * from './multichannel';
|
|
14
|
+
export { Pic } from './pic';
|
|
15
|
+
export { Raw } from './raw';
|
|
16
|
+
export { Reply } from './reply';
|
|
17
|
+
export { ShareButton } from './share-button';
|
|
18
|
+
export { Subtitle } from './subtitle';
|
|
19
|
+
export { Text } from './text';
|
|
20
|
+
export { Title } from './title';
|
|
21
|
+
export { Video } from './video';
|
|
22
|
+
export { normalizeWebchatSettings, WebchatSettings, } from './webchat-settings';
|
|
23
|
+
export { WhatsappButtonList, } from './whatsapp-button-list';
|
|
24
|
+
export { WhatsappCatalog } from './whatsapp-catalog';
|
|
25
|
+
export { WhatsappCTAUrlButton, } from './whatsapp-cta-url-button';
|
|
26
|
+
export { WhatsappMediaCarousel, } from './whatsapp-media-carousel';
|
|
27
|
+
export { WhatsappProduct } from './whatsapp-product';
|
|
28
|
+
export { WhatsappProductCarousel, } from './whatsapp-product-carousel';
|
|
29
|
+
export { WhatsappProductList, } from './whatsapp-product-list';
|
|
30
|
+
export { WhatsappTemplate } from './whatsapp-template';
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/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,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EACL,uBAAuB,GAExB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAEL,mBAAmB,GAGpB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { INPUT } from '@botonic/core';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { renderComponent } from '../util/react';
|
|
6
|
+
import { Message } from './message';
|
|
7
|
+
const Link = styled.a `
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
font-weight: bold;
|
|
10
|
+
target: blank;
|
|
11
|
+
`;
|
|
12
|
+
const serialize = locationProps => {
|
|
13
|
+
return { location: { lat: locationProps.lat, long: locationProps.long } };
|
|
14
|
+
};
|
|
15
|
+
export const Location = props => {
|
|
16
|
+
const { lat, long } = props;
|
|
17
|
+
const renderBrowser = () => {
|
|
18
|
+
const locationUrl = `https://www.google.com/maps/search/?api=1&query=${lat},${long}`;
|
|
19
|
+
return (_jsx(Message, Object.assign({ json: serialize(props) }, props, { type: INPUT.LOCATION }, { children: _jsx(Link, Object.assign({ href: locationUrl, target: '_blank', rel: 'noopener noreferrer' }, { children: props.text || 'Open Location' })) })));
|
|
20
|
+
};
|
|
21
|
+
const renderNode = () => {
|
|
22
|
+
return (_jsxs("message", Object.assign({ type: INPUT.LOCATION }, { children: [_jsx("lat", { children: lat }), _jsx("long", { children: long })] })));
|
|
23
|
+
};
|
|
24
|
+
return renderComponent({ renderBrowser, renderNode });
|
|
25
|
+
};
|
|
26
|
+
Location.serialize = serialize;
|
|
27
|
+
//# sourceMappingURL=location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location.js","sourceRoot":"","sources":["../../../src/components/location.jsx"],"names":[],"mappings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AAC,CAAA;AAED,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const ESCAPED_LINE_BREAK: "<br>";
|
|
2
|
+
export function renderMarkdown(text: any): string;
|
|
3
|
+
export function renderLinks(text: any): string;
|
|
4
|
+
export function serializeMarkdown(children: any): any;
|
|
5
|
+
export function toMarkdownChildren(children: any): any;
|
|
6
|
+
export function getMarkdownStyle(getThemeFn: any, defaultColor: any): any;
|
|
7
|
+
export function getDefaultMarkdownStyle(color: any): string;
|