@botonic/react 0.22.0-alpha.0 → 0.22.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/app.d.ts +2 -0
- package/lib/cjs/app.js +10 -0
- package/lib/cjs/app.js.map +1 -0
- package/lib/cjs/botonic-tester.d.ts +18 -0
- package/lib/cjs/botonic-tester.js +70 -0
- package/lib/cjs/botonic-tester.js.map +1 -0
- package/lib/cjs/components/audio.d.ts +8 -0
- package/lib/cjs/components/audio.js +27 -0
- package/lib/cjs/components/audio.js.map +1 -0
- package/lib/cjs/components/button.d.ts +15 -0
- package/lib/cjs/components/button.js +156 -0
- package/lib/cjs/components/button.js.map +1 -0
- package/lib/cjs/components/buttons-disabler.d.ts +24 -0
- package/lib/cjs/components/buttons-disabler.js +88 -0
- package/lib/cjs/components/buttons-disabler.js.map +1 -0
- package/lib/cjs/components/carousel.d.ts +10 -0
- package/lib/cjs/components/carousel.js +120 -0
- package/lib/cjs/components/carousel.js.map +1 -0
- package/lib/cjs/components/components.d.ts +12 -0
- package/lib/{components → cjs/components}/components.js +6 -11
- package/lib/cjs/components/components.js.map +1 -0
- package/lib/cjs/components/custom-message.d.ts +43 -0
- package/lib/cjs/components/custom-message.js +65 -0
- package/lib/cjs/components/custom-message.js.map +1 -0
- package/lib/cjs/components/document.d.ts +8 -0
- package/lib/cjs/components/document.js +50 -0
- package/lib/cjs/components/document.js.map +1 -0
- package/lib/cjs/components/element.d.ts +4 -0
- package/lib/cjs/components/element.js +55 -0
- package/lib/cjs/components/element.js.map +1 -0
- package/lib/cjs/components/handoff.d.ts +1 -0
- package/lib/cjs/components/handoff.js +58 -0
- package/lib/cjs/components/handoff.js.map +1 -0
- package/lib/cjs/components/image.d.ts +8 -0
- package/lib/cjs/components/image.js +42 -0
- package/lib/cjs/components/image.js.map +1 -0
- package/lib/cjs/components/index.d.ts +20 -0
- package/lib/cjs/components/index.js +44 -0
- package/lib/cjs/components/index.js.map +1 -0
- package/lib/cjs/components/location.d.ts +11 -0
- package/lib/cjs/components/location.js +38 -0
- package/lib/cjs/components/location.js.map +1 -0
- package/lib/cjs/components/markdown.d.ts +7 -0
- package/lib/cjs/components/markdown.js +162 -0
- package/lib/cjs/components/markdown.js.map +1 -0
- package/lib/cjs/components/message-template.d.ts +1 -0
- package/lib/cjs/components/message-template.js +15 -0
- package/lib/cjs/components/message-template.js.map +1 -0
- package/lib/cjs/components/message.d.ts +1 -0
- package/lib/cjs/components/message.js +206 -0
- package/lib/cjs/components/message.js.map +1 -0
- package/lib/cjs/components/multichannel/facebook/facebook.d.ts +17 -0
- package/lib/cjs/components/multichannel/facebook/facebook.js +47 -0
- package/lib/cjs/components/multichannel/facebook/facebook.js.map +1 -0
- package/lib/cjs/components/multichannel/index.d.ts +6 -0
- package/lib/cjs/components/multichannel/index.js +14 -0
- package/lib/cjs/components/multichannel/index.js.map +1 -0
- package/lib/cjs/components/multichannel/multichannel-button.d.ts +1 -0
- package/lib/cjs/components/multichannel/multichannel-button.js +77 -0
- package/lib/cjs/components/multichannel/multichannel-button.js.map +1 -0
- package/lib/cjs/components/multichannel/multichannel-carousel.d.ts +1 -0
- package/lib/cjs/components/multichannel/multichannel-carousel.js +95 -0
- package/lib/cjs/components/multichannel/multichannel-carousel.js.map +1 -0
- package/lib/cjs/components/multichannel/multichannel-context.d.ts +11 -0
- package/lib/cjs/components/multichannel/multichannel-context.js +16 -0
- package/lib/cjs/components/multichannel/multichannel-context.js.map +1 -0
- package/lib/cjs/components/multichannel/multichannel-reply.d.ts +1 -0
- package/lib/cjs/components/multichannel/multichannel-reply.js +24 -0
- package/lib/cjs/components/multichannel/multichannel-reply.js.map +1 -0
- package/lib/cjs/components/multichannel/multichannel-text.d.ts +1 -0
- package/lib/cjs/components/multichannel/multichannel-text.js +147 -0
- package/lib/cjs/components/multichannel/multichannel-text.js.map +1 -0
- package/lib/cjs/components/multichannel/multichannel-utils.d.ts +24 -0
- package/lib/cjs/components/multichannel/multichannel-utils.js +83 -0
- package/lib/cjs/components/multichannel/multichannel-utils.js.map +1 -0
- package/lib/cjs/components/multichannel/multichannel.d.ts +1 -0
- package/lib/cjs/components/multichannel/multichannel.js +72 -0
- package/lib/cjs/components/multichannel/multichannel.js.map +1 -0
- package/lib/cjs/components/pic.d.ts +6 -0
- package/lib/cjs/components/pic.js +29 -0
- package/lib/cjs/components/pic.js.map +1 -0
- package/lib/cjs/components/raw.d.ts +9 -0
- package/lib/cjs/components/raw.js +53 -0
- package/lib/cjs/components/raw.js.map +1 -0
- package/lib/cjs/components/reply.d.ts +9 -0
- package/lib/cjs/components/reply.js +57 -0
- package/lib/cjs/components/reply.js.map +1 -0
- package/lib/cjs/components/share-button.d.ts +1 -0
- package/lib/cjs/components/share-button.js +15 -0
- package/lib/cjs/components/share-button.js.map +1 -0
- package/lib/cjs/components/subtitle.d.ts +6 -0
- package/lib/cjs/components/subtitle.js +25 -0
- package/lib/cjs/components/subtitle.js.map +1 -0
- package/lib/cjs/components/text.d.ts +8 -0
- package/lib/cjs/components/text.js +50 -0
- package/lib/cjs/components/text.js.map +1 -0
- package/lib/cjs/components/timestamps.d.ts +10 -0
- package/lib/cjs/components/timestamps.js +54 -0
- package/lib/cjs/components/timestamps.js.map +1 -0
- package/lib/cjs/components/title.d.ts +6 -0
- package/lib/cjs/components/title.js +21 -0
- package/lib/cjs/components/title.js.map +1 -0
- package/lib/cjs/components/video.d.ts +8 -0
- package/lib/cjs/components/video.js +34 -0
- package/lib/cjs/components/video.js.map +1 -0
- package/lib/cjs/components/webchat-settings.d.ts +10 -0
- package/lib/cjs/components/webchat-settings.js +78 -0
- package/lib/cjs/components/webchat-settings.js.map +1 -0
- package/lib/cjs/components/whatsapp-template.d.ts +1 -0
- package/lib/cjs/components/whatsapp-template.js +26 -0
- package/lib/cjs/components/whatsapp-template.js.map +1 -0
- package/lib/cjs/constants.d.ts +168 -0
- package/lib/cjs/constants.js +190 -0
- package/lib/cjs/constants.js.map +1 -0
- package/lib/cjs/contexts.d.ts +69 -0
- package/lib/cjs/contexts.js +38 -0
- package/lib/cjs/contexts.js.map +1 -0
- package/lib/cjs/dev-app.d.ts +30 -0
- package/lib/cjs/dev-app.js +71 -0
- package/lib/cjs/dev-app.js.map +1 -0
- package/lib/cjs/index.d.ts +10 -0
- package/lib/cjs/index.js +28 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/message-utils.d.ts +19 -0
- package/lib/cjs/message-utils.js +61 -0
- package/lib/cjs/message-utils.js.map +1 -0
- package/lib/cjs/msg-to-botonic.d.ts +18 -0
- package/lib/cjs/msg-to-botonic.js +160 -0
- package/lib/cjs/msg-to-botonic.js.map +1 -0
- package/lib/cjs/node-app.d.ts +12 -0
- package/lib/cjs/node-app.js +25 -0
- package/lib/cjs/node-app.js.map +1 -0
- package/lib/cjs/react-bot.d.ts +8 -0
- package/lib/cjs/react-bot.js +35 -0
- package/lib/cjs/react-bot.js.map +1 -0
- package/lib/cjs/util/dom.d.ts +13 -0
- package/lib/cjs/util/dom.js +55 -0
- package/lib/cjs/util/dom.js.map +1 -0
- package/lib/cjs/util/environment.d.ts +6 -0
- package/lib/cjs/util/environment.js +68 -0
- package/lib/cjs/util/environment.js.map +1 -0
- package/lib/cjs/util/error-boundary.d.ts +40 -0
- package/lib/cjs/util/error-boundary.js +46 -0
- package/lib/cjs/util/error-boundary.js.map +1 -0
- package/lib/cjs/util/index.d.ts +0 -0
- package/lib/cjs/util/index.js +2 -0
- package/lib/cjs/util/index.js.map +1 -0
- package/lib/cjs/util/logs.d.ts +2 -0
- package/lib/cjs/util/logs.js +20 -0
- package/lib/cjs/util/logs.js.map +1 -0
- package/lib/cjs/util/objects.d.ts +3 -0
- package/lib/cjs/util/objects.js +44 -0
- package/lib/cjs/util/objects.js.map +1 -0
- package/lib/cjs/util/react.d.ts +12 -0
- package/lib/cjs/util/react.js +42 -0
- package/lib/cjs/util/react.js.map +1 -0
- package/lib/cjs/util/regexs.d.ts +2 -0
- package/lib/cjs/util/regexs.js +23 -0
- package/lib/cjs/util/regexs.js.map +1 -0
- package/lib/cjs/util/webchat.d.ts +11 -0
- package/lib/cjs/util/webchat.js +62 -0
- package/lib/cjs/util/webchat.js.map +1 -0
- package/lib/cjs/webchat/actions.d.ts +23 -0
- package/lib/cjs/webchat/actions.js +27 -0
- package/lib/cjs/webchat/actions.js.map +1 -0
- package/lib/cjs/webchat/components/attachment.d.ts +5 -0
- package/lib/cjs/webchat/components/attachment.js +32 -0
- package/lib/cjs/webchat/components/attachment.js.map +1 -0
- package/lib/cjs/webchat/components/common.d.ts +1 -0
- package/lib/cjs/webchat/components/common.js +13 -0
- package/lib/cjs/webchat/components/common.js.map +1 -0
- package/lib/cjs/webchat/components/conditional-animation.d.ts +1 -0
- package/lib/cjs/webchat/components/conditional-animation.js +18 -0
- package/lib/cjs/webchat/components/conditional-animation.js.map +1 -0
- package/lib/cjs/webchat/components/emoji-picker.d.ts +5 -0
- package/lib/cjs/webchat/components/emoji-picker.js +52 -0
- package/lib/cjs/webchat/components/emoji-picker.js.map +1 -0
- package/lib/cjs/webchat/components/persistent-menu.d.ts +10 -0
- package/lib/cjs/webchat/components/persistent-menu.js +59 -0
- package/lib/cjs/webchat/components/persistent-menu.js.map +1 -0
- package/lib/cjs/webchat/components/send-button.d.ts +3 -0
- package/lib/cjs/webchat/components/send-button.js +24 -0
- package/lib/cjs/webchat/components/send-button.js.map +1 -0
- package/lib/cjs/webchat/components/styled-scrollbar.d.ts +1 -0
- package/lib/cjs/webchat/components/styled-scrollbar.js +54 -0
- package/lib/cjs/webchat/components/styled-scrollbar.js.map +1 -0
- package/lib/cjs/webchat/components/typing-indicator.d.ts +1 -0
- package/lib/cjs/webchat/components/typing-indicator.js +14 -0
- package/lib/cjs/webchat/components/typing-indicator.js.map +1 -0
- package/lib/cjs/webchat/devices/device-adapter.d.ts +12 -0
- package/lib/cjs/webchat/devices/device-adapter.js +47 -0
- package/lib/cjs/webchat/devices/device-adapter.js.map +1 -0
- package/lib/cjs/webchat/devices/index.d.ts +11 -0
- package/lib/cjs/webchat/devices/index.js +23 -0
- package/lib/cjs/webchat/devices/index.js.map +1 -0
- package/lib/cjs/webchat/devices/scrollbar-controller.d.ts +12 -0
- package/lib/cjs/webchat/devices/scrollbar-controller.js +103 -0
- package/lib/cjs/webchat/devices/scrollbar-controller.js.map +1 -0
- package/lib/cjs/webchat/devices/webchat-resizer.d.ts +9 -0
- package/lib/cjs/webchat/devices/webchat-resizer.js +47 -0
- package/lib/cjs/webchat/devices/webchat-resizer.js.map +1 -0
- package/lib/cjs/webchat/header.d.ts +3 -0
- package/lib/cjs/webchat/header.js +95 -0
- package/lib/cjs/webchat/header.js.map +1 -0
- package/lib/cjs/webchat/hooks.d.ts +80 -0
- package/lib/cjs/webchat/hooks.js +218 -0
- package/lib/cjs/webchat/hooks.js.map +1 -0
- package/lib/cjs/webchat/index.d.ts +6 -0
- package/lib/cjs/webchat/index.js +17 -0
- package/lib/cjs/webchat/index.js.map +1 -0
- package/lib/cjs/webchat/message-list.d.ts +1 -0
- package/lib/cjs/webchat/message-list.js +46 -0
- package/lib/cjs/webchat/message-list.js.map +1 -0
- package/lib/cjs/webchat/messages-reducer.d.ts +1 -0
- package/lib/cjs/webchat/messages-reducer.js +58 -0
- package/lib/cjs/webchat/messages-reducer.js.map +1 -0
- package/lib/cjs/webchat/replies.d.ts +1 -0
- package/lib/cjs/webchat/replies.js +46 -0
- package/lib/cjs/webchat/replies.js.map +1 -0
- package/lib/cjs/webchat/session-view.d.ts +1 -0
- package/lib/cjs/webchat/session-view.js +124 -0
- package/lib/cjs/webchat/session-view.js.map +1 -0
- package/lib/cjs/webchat/use-storage-state-hook.d.ts +1 -0
- package/lib/cjs/webchat/use-storage-state-hook.js +32 -0
- package/lib/cjs/webchat/use-storage-state-hook.js.map +1 -0
- package/lib/cjs/webchat/webchat-dev.d.ts +7 -0
- package/lib/cjs/webchat/webchat-dev.js +64 -0
- package/lib/cjs/webchat/webchat-dev.js.map +1 -0
- package/lib/cjs/webchat/webchat-reducer.d.ts +1 -0
- package/lib/cjs/webchat/webchat-reducer.js +48 -0
- package/lib/cjs/webchat/webchat-reducer.js.map +1 -0
- package/lib/cjs/webchat/webchat.d.ts +3 -0
- package/lib/cjs/webchat/webchat.js +704 -0
- package/lib/cjs/webchat/webchat.js.map +1 -0
- package/lib/cjs/webchat/webview.d.ts +2 -0
- package/lib/cjs/webchat/webview.js +92 -0
- package/lib/cjs/webchat/webview.js.map +1 -0
- package/lib/cjs/webchat-app.d.ts +99 -0
- package/lib/cjs/webchat-app.js +269 -0
- package/lib/cjs/webchat-app.js.map +1 -0
- package/lib/cjs/webview-app.d.ts +7 -0
- package/lib/cjs/webview-app.js +103 -0
- package/lib/cjs/webview-app.js.map +1 -0
- 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/assets/attachment-icon.svg +7 -0
- package/lib/esm/assets/audio.svg +4 -0
- package/lib/esm/assets/botonic_react_logo100x100.png +0 -0
- package/lib/esm/assets/document.svg +3 -0
- package/lib/esm/assets/emojiButton.svg +6 -0
- package/lib/esm/assets/image.svg +4 -0
- package/lib/esm/assets/leftArrow.svg +3 -0
- package/lib/esm/assets/menuButton.svg +3 -0
- package/lib/esm/assets/rightArrow.svg +3 -0
- package/lib/esm/assets/send-button.svg +1 -0
- package/lib/esm/assets/video.svg +3 -0
- package/lib/esm/botonic-tester.d.ts +18 -0
- package/lib/esm/botonic-tester.js +64 -0
- package/lib/esm/botonic-tester.js.map +1 -0
- package/lib/esm/components/audio.d.ts +8 -0
- package/lib/esm/components/audio.js +22 -0
- package/lib/esm/components/audio.js.map +1 -0
- package/lib/esm/components/button.d.ts +15 -0
- package/lib/esm/components/button.js +151 -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 +9 -0
- package/lib/esm/components/carousel.js +115 -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 +43 -0
- package/lib/esm/components/custom-message.js +61 -0
- package/lib/esm/components/custom-message.js.map +1 -0
- package/lib/esm/components/document.d.ts +8 -0
- package/lib/esm/components/document.js +45 -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 +50 -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 +53 -0
- package/lib/esm/components/handoff.js.map +1 -0
- package/lib/esm/components/image.d.ts +8 -0
- package/lib/esm/components/image.js +37 -0
- package/lib/esm/components/image.js.map +1 -0
- package/lib/esm/components/index.d.ts +19 -0
- package/lib/esm/components/index.js +21 -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 +33 -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-template.d.ts +1 -0
- package/lib/esm/components/message-template.js +10 -0
- package/lib/esm/components/message-template.js.map +1 -0
- package/lib/esm/components/message.d.ts +1 -0
- package/lib/esm/components/message.js +202 -0
- package/lib/esm/components/message.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.d.ts +6 -0
- package/lib/esm/components/multichannel/index.js +11 -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 +72 -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 +90 -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 +19 -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 +142 -0
- package/lib/esm/components/multichannel/multichannel-text.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel-utils.d.ts +24 -0
- package/lib/esm/components/multichannel/multichannel-utils.js +67 -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 +67 -0
- package/lib/esm/components/multichannel/multichannel.js.map +1 -0
- package/lib/esm/components/pic.d.ts +6 -0
- package/lib/esm/components/pic.js +24 -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 +48 -0
- package/lib/esm/components/raw.js.map +1 -0
- package/lib/esm/components/reply.d.ts +9 -0
- package/lib/esm/components/reply.js +52 -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 +10 -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 +20 -0
- package/lib/esm/components/subtitle.js.map +1 -0
- package/lib/esm/components/text.d.ts +8 -0
- package/lib/esm/components/text.js +45 -0
- package/lib/esm/components/text.js.map +1 -0
- package/lib/esm/components/timestamps.d.ts +10 -0
- package/lib/esm/components/timestamps.js +48 -0
- package/lib/esm/components/timestamps.js.map +1 -0
- package/lib/esm/components/title.d.ts +6 -0
- package/lib/esm/components/title.js +16 -0
- package/lib/esm/components/title.js.map +1 -0
- package/lib/esm/components/video.d.ts +8 -0
- package/lib/esm/components/video.js +29 -0
- package/lib/esm/components/video.js.map +1 -0
- package/lib/esm/components/webchat-settings.d.ts +10 -0
- package/lib/esm/components/webchat-settings.js +72 -0
- package/lib/esm/components/webchat-settings.js.map +1 -0
- package/lib/esm/components/whatsapp-template.d.ts +1 -0
- package/lib/esm/components/whatsapp-template.js +21 -0
- package/lib/esm/components/whatsapp-template.js.map +1 -0
- package/lib/esm/constants.d.ts +168 -0
- package/lib/esm/constants.js +186 -0
- package/lib/esm/constants.js.map +1 -0
- package/lib/esm/contexts.d.ts +69 -0
- package/lib/esm/contexts.js +34 -0
- package/lib/esm/contexts.js.map +1 -0
- package/lib/esm/dev-app.d.ts +30 -0
- package/lib/esm/dev-app.js +67 -0
- package/lib/esm/dev-app.js.map +1 -0
- package/lib/esm/index.d.ts +9 -0
- package/lib/esm/index.js +11 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/message-utils.d.ts +18 -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 +154 -0
- package/lib/esm/msg-to-botonic.js.map +1 -0
- package/lib/esm/node-app.d.ts +12 -0
- package/lib/esm/node-app.js +21 -0
- package/lib/esm/node-app.js.map +1 -0
- package/lib/esm/react-bot.d.ts +7 -0
- package/lib/esm/react-bot.js +30 -0
- package/lib/esm/react-bot.js.map +1 -0
- package/lib/esm/util/dom.d.ts +13 -0
- package/lib/esm/util/dom.js +46 -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 +40 -0
- package/lib/esm/util/error-boundary.js +41 -0
- package/lib/esm/util/error-boundary.js.map +1 -0
- package/lib/esm/util/index.d.ts +0 -0
- package/lib/esm/util/index.js +2 -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/webchat.d.ts +11 -0
- package/lib/esm/util/webchat.js +53 -0
- package/lib/esm/util/webchat.js.map +1 -0
- package/lib/esm/webchat/actions.d.ts +23 -0
- package/lib/esm/webchat/actions.js +24 -0
- package/lib/esm/webchat/actions.js.map +1 -0
- package/lib/esm/webchat/components/attachment.d.ts +5 -0
- package/lib/esm/webchat/components/attachment.js +27 -0
- package/lib/esm/webchat/components/attachment.js.map +1 -0
- package/lib/esm/webchat/components/common.d.ts +1 -0
- package/lib/esm/webchat/components/common.js +8 -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 +13 -0
- package/lib/esm/webchat/components/conditional-animation.js.map +1 -0
- package/lib/esm/webchat/components/emoji-picker.d.ts +5 -0
- package/lib/esm/webchat/components/emoji-picker.js +46 -0
- package/lib/esm/webchat/components/emoji-picker.js.map +1 -0
- package/lib/esm/webchat/components/persistent-menu.d.ts +10 -0
- package/lib/esm/webchat/components/persistent-menu.js +53 -0
- package/lib/esm/webchat/components/persistent-menu.js.map +1 -0
- package/lib/esm/webchat/components/send-button.d.ts +3 -0
- package/lib/esm/webchat/components/send-button.js +19 -0
- package/lib/esm/webchat/components/send-button.js.map +1 -0
- package/lib/esm/webchat/components/styled-scrollbar.d.ts +1 -0
- package/lib/esm/webchat/components/styled-scrollbar.js +50 -0
- package/lib/esm/webchat/components/styled-scrollbar.js.map +1 -0
- package/lib/esm/webchat/components/styled-scrollbar.scss +12 -0
- package/lib/esm/webchat/components/typing-indicator.d.ts +1 -0
- package/lib/esm/webchat/components/typing-indicator.js +9 -0
- package/lib/esm/webchat/components/typing-indicator.js.map +1 -0
- package/lib/esm/webchat/components/typing-indicator.scss +38 -0
- package/lib/esm/webchat/devices/device-adapter.d.ts +12 -0
- package/lib/esm/webchat/devices/device-adapter.js +43 -0
- package/lib/esm/webchat/devices/device-adapter.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/devices/scrollbar-controller.d.ts +12 -0
- package/lib/esm/webchat/devices/scrollbar-controller.js +99 -0
- package/lib/esm/webchat/devices/scrollbar-controller.js.map +1 -0
- package/lib/esm/webchat/devices/webchat-resizer.d.ts +9 -0
- package/lib/esm/webchat/devices/webchat-resizer.js +43 -0
- package/lib/esm/webchat/devices/webchat-resizer.js.map +1 -0
- package/lib/esm/webchat/header.d.ts +3 -0
- package/lib/esm/webchat/header.js +89 -0
- package/lib/esm/webchat/header.js.map +1 -0
- package/lib/esm/webchat/hooks.d.ts +80 -0
- package/lib/esm/webchat/hooks.js +210 -0
- package/lib/esm/webchat/hooks.js.map +1 -0
- package/lib/esm/webchat/index.d.ts +6 -0
- package/lib/esm/webchat/index.js +11 -0
- package/lib/esm/webchat/index.js.map +1 -0
- package/lib/esm/webchat/message-list.d.ts +1 -0
- package/lib/esm/webchat/message-list.js +41 -0
- package/lib/esm/webchat/message-list.js.map +1 -0
- package/lib/esm/webchat/messages-reducer.d.ts +1 -0
- package/lib/esm/webchat/messages-reducer.js +54 -0
- package/lib/esm/webchat/messages-reducer.js.map +1 -0
- package/lib/esm/webchat/replies.d.ts +1 -0
- package/lib/esm/webchat/replies.js +41 -0
- package/lib/esm/webchat/replies.js.map +1 -0
- package/lib/esm/webchat/session-view.d.ts +1 -0
- package/lib/esm/webchat/session-view.js +119 -0
- package/lib/esm/webchat/session-view.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 +28 -0
- package/lib/esm/webchat/use-storage-state-hook.js.map +1 -0
- package/lib/esm/webchat/webchat-dev.d.ts +7 -0
- package/lib/esm/webchat/webchat-dev.js +60 -0
- package/lib/esm/webchat/webchat-dev.js.map +1 -0
- package/lib/esm/webchat/webchat-reducer.d.ts +1 -0
- package/lib/esm/webchat/webchat-reducer.js +44 -0
- package/lib/esm/webchat/webchat-reducer.js.map +1 -0
- package/lib/esm/webchat/webchat.d.ts +3 -0
- package/lib/esm/webchat/webchat.js +699 -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 +86 -0
- package/lib/esm/webchat/webview.js.map +1 -0
- package/lib/esm/webchat-app.d.ts +98 -0
- package/lib/esm/webchat-app.js +265 -0
- package/lib/esm/webchat-app.js.map +1 -0
- package/lib/esm/webchat.template.html +37 -0
- package/lib/esm/webview-app.d.ts +7 -0
- package/lib/esm/webview-app.js +98 -0
- package/lib/esm/webview-app.js.map +1 -0
- package/lib/esm/webview.template.html +39 -0
- package/package.json +27 -20
- package/src/components/audio.jsx +2 -0
- package/src/components/document.jsx +2 -0
- package/src/components/image.jsx +2 -0
- package/src/components/location.jsx +2 -2
- package/src/components/pic.jsx +3 -1
- package/src/components/video.jsx +2 -0
- package/src/index.js +1 -1
- package/src/msg-to-botonic.jsx +1 -1
- package/src/util/environment.js +31 -2
- package/src/{webview.jsx → webview-app.tsx} +7 -1
- package/lib/app.js +0 -19
- package/lib/app.js.map +0 -1
- package/lib/botonic-tester.js +0 -224
- package/lib/botonic-tester.js.map +0 -1
- package/lib/components/audio.js +0 -48
- package/lib/components/audio.js.map +0 -1
- package/lib/components/button.js +0 -224
- package/lib/components/button.js.map +0 -1
- package/lib/components/buttons-disabler.js +0 -133
- package/lib/components/buttons-disabler.js.map +0 -1
- package/lib/components/carousel.js +0 -194
- package/lib/components/carousel.js.map +0 -1
- package/lib/components/components.js.map +0 -1
- package/lib/components/custom-message.js +0 -131
- package/lib/components/custom-message.js.map +0 -1
- package/lib/components/document.js +0 -76
- package/lib/components/document.js.map +0 -1
- package/lib/components/element.js +0 -69
- package/lib/components/element.js.map +0 -1
- package/lib/components/handoff.js +0 -69
- package/lib/components/handoff.js.map +0 -1
- package/lib/components/image.js +0 -91
- package/lib/components/image.js.map +0 -1
- package/lib/components/index.d.ts +0 -228
- package/lib/components/index.js +0 -193
- package/lib/components/index.js.map +0 -1
- package/lib/components/location.js +0 -69
- package/lib/components/location.js.map +0 -1
- package/lib/components/markdown.js +0 -108
- package/lib/components/markdown.js.map +0 -1
- package/lib/components/message-template.js +0 -36
- package/lib/components/message-template.js.map +0 -1
- package/lib/components/message.js +0 -351
- package/lib/components/message.js.map +0 -1
- package/lib/components/multichannel/facebook/facebook.js +0 -96
- package/lib/components/multichannel/facebook/facebook.js.map +0 -1
- package/lib/components/multichannel/index.d.ts +0 -65
- package/lib/components/multichannel/index.js +0 -46
- package/lib/components/multichannel/index.js.map +0 -1
- package/lib/components/multichannel/multichannel-button.js +0 -119
- package/lib/components/multichannel/multichannel-button.js.map +0 -1
- package/lib/components/multichannel/multichannel-carousel.js +0 -143
- package/lib/components/multichannel/multichannel-carousel.js.map +0 -1
- package/lib/components/multichannel/multichannel-context.js +0 -24
- package/lib/components/multichannel/multichannel-context.js.map +0 -1
- package/lib/components/multichannel/multichannel-reply.js +0 -46
- package/lib/components/multichannel/multichannel-reply.js.map +0 -1
- package/lib/components/multichannel/multichannel-text.js +0 -222
- package/lib/components/multichannel/multichannel-text.js.map +0 -1
- package/lib/components/multichannel/multichannel-utils.js +0 -126
- package/lib/components/multichannel/multichannel-utils.js.map +0 -1
- package/lib/components/multichannel/multichannel.js +0 -111
- package/lib/components/multichannel/multichannel.js.map +0 -1
- package/lib/components/pic.js +0 -50
- package/lib/components/pic.js.map +0 -1
- package/lib/components/raw.js +0 -70
- package/lib/components/raw.js.map +0 -1
- package/lib/components/reply.js +0 -107
- package/lib/components/reply.js.map +0 -1
- package/lib/components/share-button.js +0 -36
- package/lib/components/share-button.js.map +0 -1
- package/lib/components/subtitle.js +0 -54
- package/lib/components/subtitle.js.map +0 -1
- package/lib/components/text.js +0 -80
- package/lib/components/text.js.map +0 -1
- package/lib/components/timestamps.js +0 -69
- package/lib/components/timestamps.js.map +0 -1
- package/lib/components/title.js +0 -52
- package/lib/components/title.js.map +0 -1
- package/lib/components/video.js +0 -51
- package/lib/components/video.js.map +0 -1
- package/lib/components/webchat-settings.js +0 -118
- package/lib/components/webchat-settings.js.map +0 -1
- package/lib/components/whatsapp-template.js +0 -53
- package/lib/components/whatsapp-template.js.map +0 -1
- package/lib/constants.js +0 -203
- package/lib/constants.js.map +0 -1
- package/lib/contexts.js +0 -57
- package/lib/contexts.js.map +0 -1
- package/lib/dev-app.js +0 -241
- package/lib/dev-app.js.map +0 -1
- package/lib/index.d.ts +0 -238
- package/lib/index.js +0 -131
- package/lib/index.js.map +0 -1
- package/lib/message-utils.js +0 -149
- package/lib/message-utils.js.map +0 -1
- package/lib/msg-to-botonic.js +0 -199
- package/lib/msg-to-botonic.js.map +0 -1
- package/lib/node-app.js +0 -97
- package/lib/node-app.js.map +0 -1
- package/lib/react-bot.js +0 -167
- package/lib/react-bot.js.map +0 -1
- package/lib/util/dom.js +0 -84
- package/lib/util/dom.js.map +0 -1
- package/lib/util/environment.js +0 -42
- package/lib/util/environment.js.map +0 -1
- package/lib/util/error-boundary.js +0 -105
- package/lib/util/error-boundary.js.map +0 -1
- package/lib/util/index.d.ts +0 -9
- package/lib/util/index.js +0 -2
- package/lib/util/index.js.map +0 -1
- package/lib/util/logs.js +0 -28
- package/lib/util/logs.js.map +0 -1
- package/lib/util/objects.js +0 -60
- package/lib/util/objects.js.map +0 -1
- package/lib/util/react.js +0 -75
- package/lib/util/react.js.map +0 -1
- package/lib/util/regexs.js +0 -31
- package/lib/util/regexs.js.map +0 -1
- package/lib/util/webchat.js +0 -92
- package/lib/util/webchat.js.map +0 -1
- package/lib/webchat/actions.js +0 -53
- package/lib/webchat/actions.js.map +0 -1
- package/lib/webchat/components/attachment.js +0 -68
- package/lib/webchat/components/attachment.js.map +0 -1
- package/lib/webchat/components/common.js +0 -29
- package/lib/webchat/components/common.js.map +0 -1
- package/lib/webchat/components/conditional-animation.js +0 -42
- package/lib/webchat/components/conditional-animation.js.map +0 -1
- package/lib/webchat/components/emoji-picker.js +0 -89
- package/lib/webchat/components/emoji-picker.js.map +0 -1
- package/lib/webchat/components/persistent-menu.js +0 -104
- package/lib/webchat/components/persistent-menu.js.map +0 -1
- package/lib/webchat/components/send-button.js +0 -45
- package/lib/webchat/components/send-button.js.map +0 -1
- package/lib/webchat/components/styled-scrollbar.js +0 -55
- package/lib/webchat/components/styled-scrollbar.js.map +0 -1
- package/lib/webchat/components/typing-indicator.js +0 -27
- package/lib/webchat/components/typing-indicator.js.map +0 -1
- package/lib/webchat/devices/device-adapter.js +0 -82
- package/lib/webchat/devices/device-adapter.js.map +0 -1
- package/lib/webchat/devices/index.js +0 -32
- package/lib/webchat/devices/index.js.map +0 -1
- package/lib/webchat/devices/scrollbar-controller.js +0 -152
- package/lib/webchat/devices/scrollbar-controller.js.map +0 -1
- package/lib/webchat/devices/webchat-resizer.js +0 -76
- package/lib/webchat/devices/webchat-resizer.js.map +0 -1
- package/lib/webchat/header.js +0 -116
- package/lib/webchat/header.js.map +0 -1
- package/lib/webchat/hooks.js +0 -359
- package/lib/webchat/hooks.js.map +0 -1
- package/lib/webchat/index.d.ts +0 -62
- package/lib/webchat/index.js +0 -32
- package/lib/webchat/index.js.map +0 -1
- package/lib/webchat/message-list.js +0 -88
- package/lib/webchat/message-list.js.map +0 -1
- package/lib/webchat/messages-reducer.js +0 -93
- package/lib/webchat/messages-reducer.js.map +0 -1
- package/lib/webchat/replies.js +0 -78
- package/lib/webchat/replies.js.map +0 -1
- package/lib/webchat/session-view.js +0 -106
- package/lib/webchat/session-view.js.map +0 -1
- package/lib/webchat/use-storage-state-hook.js +0 -60
- package/lib/webchat/use-storage-state-hook.js.map +0 -1
- package/lib/webchat/webchat-dev.js +0 -109
- package/lib/webchat/webchat-dev.js.map +0 -1
- package/lib/webchat/webchat-reducer.js +0 -108
- package/lib/webchat/webchat-reducer.js.map +0 -1
- package/lib/webchat/webchat.js +0 -1108
- package/lib/webchat/webchat.js.map +0 -1
- package/lib/webchat/webview.js +0 -122
- package/lib/webchat/webview.js.map +0 -1
- package/lib/webchat-app.js +0 -660
- package/lib/webchat-app.js.map +0 -1
- package/lib/webview.js +0 -231
- package/lib/webview.js.map +0 -1
- /package/lib/{assets → cjs/assets}/attachment-icon.svg +0 -0
- /package/lib/{assets → cjs/assets}/audio.svg +0 -0
- /package/lib/{assets → cjs/assets}/botonic_react_logo100x100.png +0 -0
- /package/lib/{assets → cjs/assets}/document.svg +0 -0
- /package/lib/{assets → cjs/assets}/emojiButton.svg +0 -0
- /package/lib/{assets → cjs/assets}/image.svg +0 -0
- /package/lib/{assets → cjs/assets}/leftArrow.svg +0 -0
- /package/lib/{assets → cjs/assets}/menuButton.svg +0 -0
- /package/lib/{assets → cjs/assets}/rightArrow.svg +0 -0
- /package/lib/{assets → cjs/assets}/send-button.svg +0 -0
- /package/lib/{assets → cjs/assets}/video.svg +0 -0
- /package/lib/{webchat → cjs/webchat}/components/styled-scrollbar.scss +0 -0
- /package/lib/{webchat → cjs/webchat}/components/typing-indicator.scss +0 -0
- /package/lib/{webchat.template.html → cjs/webchat.template.html} +0 -0
- /package/lib/{webview.template.html → cjs/webview.template.html} +0 -0
package/lib/webchat-app.js
DELETED
|
@@ -1,660 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.WebchatApp = void 0;
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
17
|
-
|
|
18
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
19
|
-
|
|
20
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
21
|
-
|
|
22
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
23
|
-
|
|
24
|
-
var _core = require("@botonic/core");
|
|
25
|
-
|
|
26
|
-
var _lodash = _interopRequireDefault(require("lodash.merge"));
|
|
27
|
-
|
|
28
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
29
|
-
|
|
30
|
-
var _reactDom = require("react-dom");
|
|
31
|
-
|
|
32
|
-
var _constants = require("./constants");
|
|
33
|
-
|
|
34
|
-
var _msgToBotonic = require("./msg-to-botonic");
|
|
35
|
-
|
|
36
|
-
var _dom = require("./util/dom");
|
|
37
|
-
|
|
38
|
-
var _webchat = require("./webchat/webchat");
|
|
39
|
-
|
|
40
|
-
var _excluded = ["theme", "persistentMenu", "coverComponent", "blockInputs", "enableAttachments", "enableUserInput", "enableAnimations", "enableEmojiPicker", "defaultDelay", "defaultTyping", "storage", "storageKey", "onInit", "onOpen", "onClose", "onMessage", "onConnectionChange", "appId", "visibility", "server", "hostId"];
|
|
41
|
-
|
|
42
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
43
|
-
|
|
44
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
45
|
-
|
|
46
|
-
var WebchatApp = /*#__PURE__*/function () {
|
|
47
|
-
function WebchatApp(_ref) {
|
|
48
|
-
var _ref$theme = _ref.theme,
|
|
49
|
-
theme = _ref$theme === void 0 ? {} : _ref$theme,
|
|
50
|
-
persistentMenu = _ref.persistentMenu,
|
|
51
|
-
coverComponent = _ref.coverComponent,
|
|
52
|
-
blockInputs = _ref.blockInputs,
|
|
53
|
-
enableEmojiPicker = _ref.enableEmojiPicker,
|
|
54
|
-
enableAttachments = _ref.enableAttachments,
|
|
55
|
-
enableUserInput = _ref.enableUserInput,
|
|
56
|
-
enableAnimations = _ref.enableAnimations,
|
|
57
|
-
hostId = _ref.hostId,
|
|
58
|
-
shadowDOM = _ref.shadowDOM,
|
|
59
|
-
defaultDelay = _ref.defaultDelay,
|
|
60
|
-
defaultTyping = _ref.defaultTyping,
|
|
61
|
-
storage = _ref.storage,
|
|
62
|
-
storageKey = _ref.storageKey,
|
|
63
|
-
onInit = _ref.onInit,
|
|
64
|
-
onOpen = _ref.onOpen,
|
|
65
|
-
onClose = _ref.onClose,
|
|
66
|
-
onMessage = _ref.onMessage,
|
|
67
|
-
onConnectionChange = _ref.onConnectionChange,
|
|
68
|
-
appId = _ref.appId,
|
|
69
|
-
visibility = _ref.visibility,
|
|
70
|
-
server = _ref.server;
|
|
71
|
-
(0, _classCallCheck2["default"])(this, WebchatApp);
|
|
72
|
-
this.theme = theme;
|
|
73
|
-
this.persistentMenu = persistentMenu;
|
|
74
|
-
this.coverComponent = coverComponent;
|
|
75
|
-
this.blockInputs = blockInputs;
|
|
76
|
-
this.enableEmojiPicker = enableEmojiPicker;
|
|
77
|
-
this.enableAttachments = enableAttachments;
|
|
78
|
-
this.enableUserInput = enableUserInput;
|
|
79
|
-
this.enableAnimations = enableAnimations;
|
|
80
|
-
this.shadowDOM = Boolean(typeof shadowDOM === 'function' ? shadowDOM() : shadowDOM);
|
|
81
|
-
|
|
82
|
-
if (this.shadowDOM && !(0, _dom.isShadowDOMSupported)()) {
|
|
83
|
-
console.warn('[botonic] ShadowDOM not supported on this browser');
|
|
84
|
-
this.shadowDOM = false;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
this.hostId = hostId || _constants.WEBCHAT.DEFAULTS.HOST_ID;
|
|
88
|
-
this.defaultDelay = defaultDelay;
|
|
89
|
-
this.defaultTyping = defaultTyping;
|
|
90
|
-
this.storage = storage === undefined ? localStorage : storage;
|
|
91
|
-
this.storageKey = storageKey || _constants.WEBCHAT.DEFAULTS.STORAGE_KEY;
|
|
92
|
-
this.onInit = onInit;
|
|
93
|
-
this.onOpen = onOpen;
|
|
94
|
-
this.onClose = onClose;
|
|
95
|
-
this.onMessage = onMessage;
|
|
96
|
-
this.onConnectionChange = onConnectionChange;
|
|
97
|
-
this.visibility = visibility;
|
|
98
|
-
this.server = server;
|
|
99
|
-
this.webchatRef = /*#__PURE__*/(0, _react.createRef)();
|
|
100
|
-
this.appId = appId;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
(0, _createClass2["default"])(WebchatApp, [{
|
|
104
|
-
key: "createRootElement",
|
|
105
|
-
value: function createRootElement(host) {
|
|
106
|
-
// Create root element <div id='root'> if not exists
|
|
107
|
-
// Create shadowDOM to root element if needed
|
|
108
|
-
if (host) {
|
|
109
|
-
if (host.id && this.hostId) {
|
|
110
|
-
if (host.id != this.hostId) {
|
|
111
|
-
console.warn("[botonic] Host ID \"".concat(host.id, "\" don't match 'hostId' option: ").concat(this.hostId, ". Using value: ").concat(host.id, "."));
|
|
112
|
-
this.hostId = host.id;
|
|
113
|
-
}
|
|
114
|
-
} else if (host.id) this.hostId = host.id;else if (this.hostId) host.id = this.hostId;
|
|
115
|
-
} else {
|
|
116
|
-
host = document.getElementById(this.hostId);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (!host) {
|
|
120
|
-
host = document.createElement('div');
|
|
121
|
-
host.id = this.hostId;
|
|
122
|
-
if (document.body.firstChild) document.body.insertBefore(host, document.body.firstChild);else document.body.appendChild(host);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
this.host = this.shadowDOM ? host.attachShadow({
|
|
126
|
-
mode: 'open'
|
|
127
|
-
}) : host;
|
|
128
|
-
}
|
|
129
|
-
}, {
|
|
130
|
-
key: "getReactMountNode",
|
|
131
|
-
value: function getReactMountNode(node) {
|
|
132
|
-
if (!node) node = this.host;
|
|
133
|
-
return node.shadowRoot ? node.shadowRoot : node;
|
|
134
|
-
}
|
|
135
|
-
}, {
|
|
136
|
-
key: "onInitWebchat",
|
|
137
|
-
value: function onInitWebchat() {
|
|
138
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
139
|
-
args[_key] = arguments[_key];
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
this.onInit && this.onInit.apply(this, [this].concat(args));
|
|
143
|
-
}
|
|
144
|
-
}, {
|
|
145
|
-
key: "onOpenWebchat",
|
|
146
|
-
value: function onOpenWebchat() {
|
|
147
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
148
|
-
args[_key2] = arguments[_key2];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
this.onOpen && this.onOpen.apply(this, [this].concat(args));
|
|
152
|
-
}
|
|
153
|
-
}, {
|
|
154
|
-
key: "onCloseWebchat",
|
|
155
|
-
value: function onCloseWebchat() {
|
|
156
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
157
|
-
args[_key3] = arguments[_key3];
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
this.onClose && this.onClose.apply(this, [this].concat(args));
|
|
161
|
-
}
|
|
162
|
-
}, {
|
|
163
|
-
key: "onUserInput",
|
|
164
|
-
value: function () {
|
|
165
|
-
var _onUserInput = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref2) {
|
|
166
|
-
var user, input;
|
|
167
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
168
|
-
while (1) {
|
|
169
|
-
switch (_context.prev = _context.next) {
|
|
170
|
-
case 0:
|
|
171
|
-
user = _ref2.user, input = _ref2.input;
|
|
172
|
-
this.onMessage && this.onMessage(this, {
|
|
173
|
-
from: _constants.SENDERS.user,
|
|
174
|
-
message: input
|
|
175
|
-
});
|
|
176
|
-
return _context.abrupt("return", this.hubtypeService.postMessage(user, input));
|
|
177
|
-
|
|
178
|
-
case 3:
|
|
179
|
-
case "end":
|
|
180
|
-
return _context.stop();
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}, _callee, this);
|
|
184
|
-
}));
|
|
185
|
-
|
|
186
|
-
function onUserInput(_x) {
|
|
187
|
-
return _onUserInput.apply(this, arguments);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return onUserInput;
|
|
191
|
-
}()
|
|
192
|
-
}, {
|
|
193
|
-
key: "onConnectionRegained",
|
|
194
|
-
value: function () {
|
|
195
|
-
var _onConnectionRegained = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
196
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
197
|
-
while (1) {
|
|
198
|
-
switch (_context2.prev = _context2.next) {
|
|
199
|
-
case 0:
|
|
200
|
-
return _context2.abrupt("return", this.hubtypeService.onConnectionRegained());
|
|
201
|
-
|
|
202
|
-
case 1:
|
|
203
|
-
case "end":
|
|
204
|
-
return _context2.stop();
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}, _callee2, this);
|
|
208
|
-
}));
|
|
209
|
-
|
|
210
|
-
function onConnectionRegained() {
|
|
211
|
-
return _onConnectionRegained.apply(this, arguments);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return onConnectionRegained;
|
|
215
|
-
}()
|
|
216
|
-
}, {
|
|
217
|
-
key: "onStateChange",
|
|
218
|
-
value: function onStateChange(_ref3) {
|
|
219
|
-
var _this = this;
|
|
220
|
-
|
|
221
|
-
var user = _ref3.session.user,
|
|
222
|
-
messagesJSON = _ref3.messagesJSON;
|
|
223
|
-
var lastMessage = messagesJSON[messagesJSON.length - 1];
|
|
224
|
-
var lastMessageId = lastMessage && lastMessage.id;
|
|
225
|
-
var lastMessageUpdateDate = this.getLastMessageUpdate();
|
|
226
|
-
|
|
227
|
-
if (this.hubtypeService) {
|
|
228
|
-
this.hubtypeService.lastMessageId = lastMessageId;
|
|
229
|
-
this.hubtypeService.lastMessageUpdateDate = lastMessageUpdateDate;
|
|
230
|
-
} else if (!this.hubtypeService && user) {
|
|
231
|
-
this.hubtypeService = new _core.HubtypeService({
|
|
232
|
-
appId: this.appId,
|
|
233
|
-
user: user,
|
|
234
|
-
lastMessageId: lastMessageId,
|
|
235
|
-
lastMessageUpdateDate: lastMessageUpdateDate,
|
|
236
|
-
onEvent: function onEvent(event) {
|
|
237
|
-
return _this.onServiceEvent(event);
|
|
238
|
-
},
|
|
239
|
-
unsentInputs: function unsentInputs() {
|
|
240
|
-
return _this.webchatRef.current.getMessages().filter(function (msg) {
|
|
241
|
-
return msg.ack === 0 && msg.unsentInput;
|
|
242
|
-
});
|
|
243
|
-
},
|
|
244
|
-
server: this.server
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}, {
|
|
249
|
-
key: "onServiceEvent",
|
|
250
|
-
value: function onServiceEvent(event) {
|
|
251
|
-
if (event.action === 'connectionChange') {
|
|
252
|
-
this.onConnectionChange && this.onConnectionChange(this, event.online);
|
|
253
|
-
this.webchatRef.current.setOnline(event.online);
|
|
254
|
-
} else if (event.action === 'update_message_info') this.updateMessageInfo(event.message.id, event.message);else if (event.message.type === 'update_webchat_settings') this.updateWebchatSettings(event.message.data);else if (event.message.type === 'sender_action') this.setTyping(event.message.data === 'typing_on');else {
|
|
255
|
-
this.onMessage && this.onMessage(this, {
|
|
256
|
-
from: _constants.SENDERS.bot,
|
|
257
|
-
message: event.message
|
|
258
|
-
});
|
|
259
|
-
this.addBotMessage(event.message);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}, {
|
|
263
|
-
key: "updateUser",
|
|
264
|
-
value: function updateUser(user) {
|
|
265
|
-
this.webchatRef.current.updateUser(user);
|
|
266
|
-
}
|
|
267
|
-
}, {
|
|
268
|
-
key: "addBotMessage",
|
|
269
|
-
value: function addBotMessage(message) {
|
|
270
|
-
this.webchatRef.current.addBotResponse({
|
|
271
|
-
response: (0, _msgToBotonic.msgToBotonic)(message, this.theme.message && this.theme.message.customTypes || this.theme.customMessageTypes)
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
}, {
|
|
275
|
-
key: "addBotText",
|
|
276
|
-
value: function addBotText(text) {
|
|
277
|
-
this.addBotMessage({
|
|
278
|
-
type: _core.INPUT.TEXT,
|
|
279
|
-
data: text
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
}, {
|
|
283
|
-
key: "addUserMessage",
|
|
284
|
-
value: function addUserMessage(message) {
|
|
285
|
-
this.webchatRef.current.addUserMessage(message);
|
|
286
|
-
}
|
|
287
|
-
}, {
|
|
288
|
-
key: "addUserText",
|
|
289
|
-
value: function addUserText(text) {
|
|
290
|
-
this.webchatRef.current.addUserMessage({
|
|
291
|
-
type: _core.INPUT.TEXT,
|
|
292
|
-
data: text
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
}, {
|
|
296
|
-
key: "addUserPayload",
|
|
297
|
-
value: function addUserPayload(payload) {
|
|
298
|
-
this.webchatRef.current.addUserMessage({
|
|
299
|
-
type: _core.INPUT.POSTBACK,
|
|
300
|
-
payload: payload
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
}, {
|
|
304
|
-
key: "setTyping",
|
|
305
|
-
value: function setTyping(typing) {
|
|
306
|
-
this.webchatRef.current.setTyping(typing);
|
|
307
|
-
}
|
|
308
|
-
}, {
|
|
309
|
-
key: "open",
|
|
310
|
-
value: function open() {
|
|
311
|
-
this.webchatRef.current.openWebchat();
|
|
312
|
-
}
|
|
313
|
-
}, {
|
|
314
|
-
key: "close",
|
|
315
|
-
value: function close() {
|
|
316
|
-
this.webchatRef.current.closeWebchat();
|
|
317
|
-
}
|
|
318
|
-
}, {
|
|
319
|
-
key: "toggle",
|
|
320
|
-
value: function toggle() {
|
|
321
|
-
this.webchatRef.current.toggleWebchat();
|
|
322
|
-
}
|
|
323
|
-
}, {
|
|
324
|
-
key: "openCoverComponent",
|
|
325
|
-
value: function openCoverComponent() {
|
|
326
|
-
this.webchatRef.current.openCoverComponent();
|
|
327
|
-
}
|
|
328
|
-
}, {
|
|
329
|
-
key: "closeCoverComponent",
|
|
330
|
-
value: function closeCoverComponent() {
|
|
331
|
-
this.webchatRef.current.closeCoverComponent();
|
|
332
|
-
}
|
|
333
|
-
}, {
|
|
334
|
-
key: "renderCustomComponent",
|
|
335
|
-
value: function renderCustomComponent(_customComponent) {
|
|
336
|
-
this.webchatRef.current.renderCustomComponent(_customComponent);
|
|
337
|
-
}
|
|
338
|
-
}, {
|
|
339
|
-
key: "unmountCustomComponent",
|
|
340
|
-
value: function unmountCustomComponent() {
|
|
341
|
-
this.webchatRef.current.unmountCustomComponent();
|
|
342
|
-
}
|
|
343
|
-
}, {
|
|
344
|
-
key: "toggleCoverComponent",
|
|
345
|
-
value: function toggleCoverComponent() {
|
|
346
|
-
this.webchatRef.current.toggleCoverComponent();
|
|
347
|
-
}
|
|
348
|
-
}, {
|
|
349
|
-
key: "getMessages",
|
|
350
|
-
value: function getMessages() {
|
|
351
|
-
return this.webchatRef.current.getMessages();
|
|
352
|
-
}
|
|
353
|
-
}, {
|
|
354
|
-
key: "clearMessages",
|
|
355
|
-
value: function clearMessages() {
|
|
356
|
-
this.webchatRef.current.clearMessages();
|
|
357
|
-
}
|
|
358
|
-
}, {
|
|
359
|
-
key: "getVisibility",
|
|
360
|
-
value: function () {
|
|
361
|
-
var _getVisibility = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
362
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
363
|
-
while (1) {
|
|
364
|
-
switch (_context3.prev = _context3.next) {
|
|
365
|
-
case 0:
|
|
366
|
-
return _context3.abrupt("return", this.resolveWebchatVisibility({
|
|
367
|
-
appId: this.appId,
|
|
368
|
-
visibility: this.visibility
|
|
369
|
-
}));
|
|
370
|
-
|
|
371
|
-
case 1:
|
|
372
|
-
case "end":
|
|
373
|
-
return _context3.stop();
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}, _callee3, this);
|
|
377
|
-
}));
|
|
378
|
-
|
|
379
|
-
function getVisibility() {
|
|
380
|
-
return _getVisibility.apply(this, arguments);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
return getVisibility;
|
|
384
|
-
}()
|
|
385
|
-
}, {
|
|
386
|
-
key: "getLastMessageUpdate",
|
|
387
|
-
value: function getLastMessageUpdate() {
|
|
388
|
-
return this.webchatRef.current.getLastMessageUpdate();
|
|
389
|
-
}
|
|
390
|
-
}, {
|
|
391
|
-
key: "updateMessageInfo",
|
|
392
|
-
value: function updateMessageInfo(msgId, messageInfo) {
|
|
393
|
-
return this.webchatRef.current.updateMessageInfo(msgId, messageInfo);
|
|
394
|
-
}
|
|
395
|
-
}, {
|
|
396
|
-
key: "updateWebchatSettings",
|
|
397
|
-
value: function updateWebchatSettings(settings) {
|
|
398
|
-
return this.webchatRef.current.updateWebchatSettings(settings);
|
|
399
|
-
} // eslint-disable-next-line complexity
|
|
400
|
-
|
|
401
|
-
}, {
|
|
402
|
-
key: "getComponent",
|
|
403
|
-
value: function getComponent(host) {
|
|
404
|
-
var _this2 = this;
|
|
405
|
-
|
|
406
|
-
var optionsAtRuntime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
407
|
-
var _optionsAtRuntime$the = optionsAtRuntime.theme,
|
|
408
|
-
theme = _optionsAtRuntime$the === void 0 ? {} : _optionsAtRuntime$the,
|
|
409
|
-
persistentMenu = optionsAtRuntime.persistentMenu,
|
|
410
|
-
coverComponent = optionsAtRuntime.coverComponent,
|
|
411
|
-
blockInputs = optionsAtRuntime.blockInputs,
|
|
412
|
-
enableAttachments = optionsAtRuntime.enableAttachments,
|
|
413
|
-
enableUserInput = optionsAtRuntime.enableUserInput,
|
|
414
|
-
enableAnimations = optionsAtRuntime.enableAnimations,
|
|
415
|
-
enableEmojiPicker = optionsAtRuntime.enableEmojiPicker,
|
|
416
|
-
defaultDelay = optionsAtRuntime.defaultDelay,
|
|
417
|
-
defaultTyping = optionsAtRuntime.defaultTyping,
|
|
418
|
-
storage = optionsAtRuntime.storage,
|
|
419
|
-
storageKey = optionsAtRuntime.storageKey,
|
|
420
|
-
onInit = optionsAtRuntime.onInit,
|
|
421
|
-
onOpen = optionsAtRuntime.onOpen,
|
|
422
|
-
onClose = optionsAtRuntime.onClose,
|
|
423
|
-
onMessage = optionsAtRuntime.onMessage,
|
|
424
|
-
onConnectionChange = optionsAtRuntime.onConnectionChange,
|
|
425
|
-
appId = optionsAtRuntime.appId,
|
|
426
|
-
visibility = optionsAtRuntime.visibility,
|
|
427
|
-
server = optionsAtRuntime.server,
|
|
428
|
-
hostId = optionsAtRuntime.hostId,
|
|
429
|
-
webchatOptions = (0, _objectWithoutProperties2["default"])(optionsAtRuntime, _excluded);
|
|
430
|
-
theme = (0, _lodash["default"])(this.theme, theme);
|
|
431
|
-
persistentMenu = persistentMenu || this.persistentMenu;
|
|
432
|
-
coverComponent = coverComponent || this.coverComponent;
|
|
433
|
-
blockInputs = blockInputs || this.blockInputs;
|
|
434
|
-
enableEmojiPicker = enableEmojiPicker || this.enableEmojiPicker;
|
|
435
|
-
enableAttachments = enableAttachments || this.enableAttachments;
|
|
436
|
-
enableUserInput = enableUserInput || this.enableUserInput;
|
|
437
|
-
enableAnimations = enableAnimations || this.enableAnimations;
|
|
438
|
-
defaultDelay = defaultDelay || this.defaultDelay;
|
|
439
|
-
defaultTyping = defaultTyping || this.defaultTyping;
|
|
440
|
-
server = server || this.server;
|
|
441
|
-
this.storage = storage || this.storage;
|
|
442
|
-
this.storageKey = storageKey || this.storageKey;
|
|
443
|
-
this.onInit = onInit || this.onInit;
|
|
444
|
-
this.onOpen = onOpen || this.onOpen;
|
|
445
|
-
this.onClose = onClose || this.onClose;
|
|
446
|
-
this.onMessage = onMessage || this.onMessage;
|
|
447
|
-
this.onConnectionChange = onConnectionChange || this.onConnectionChange;
|
|
448
|
-
this.visibility = visibility || this.visibility;
|
|
449
|
-
this.appId = appId || this.appId;
|
|
450
|
-
this.hostId = hostId || this.hostId;
|
|
451
|
-
this.createRootElement(host);
|
|
452
|
-
return /*#__PURE__*/_react["default"].createElement(_webchat.Webchat, (0, _extends2["default"])({}, webchatOptions, {
|
|
453
|
-
ref: this.webchatRef,
|
|
454
|
-
host: this.host,
|
|
455
|
-
shadowDOM: this.shadowDOM,
|
|
456
|
-
theme: theme,
|
|
457
|
-
persistentMenu: persistentMenu,
|
|
458
|
-
coverComponent: coverComponent,
|
|
459
|
-
blockInputs: blockInputs,
|
|
460
|
-
enableEmojiPicker: enableEmojiPicker,
|
|
461
|
-
enableAttachments: enableAttachments,
|
|
462
|
-
enableUserInput: enableUserInput,
|
|
463
|
-
enableAnimations: enableAnimations,
|
|
464
|
-
storage: this.storage,
|
|
465
|
-
storageKey: this.storageKey,
|
|
466
|
-
defaultDelay: defaultDelay,
|
|
467
|
-
defaultTyping: defaultTyping,
|
|
468
|
-
onInit: function onInit() {
|
|
469
|
-
return _this2.onInitWebchat.apply(_this2, arguments);
|
|
470
|
-
},
|
|
471
|
-
onOpen: function onOpen() {
|
|
472
|
-
return _this2.onOpenWebchat.apply(_this2, arguments);
|
|
473
|
-
},
|
|
474
|
-
onClose: function onClose() {
|
|
475
|
-
return _this2.onCloseWebchat.apply(_this2, arguments);
|
|
476
|
-
},
|
|
477
|
-
onUserInput: function onUserInput() {
|
|
478
|
-
return _this2.onUserInput.apply(_this2, arguments);
|
|
479
|
-
},
|
|
480
|
-
onStateChange: function onStateChange(webchatState) {
|
|
481
|
-
return _this2.onStateChange(webchatState);
|
|
482
|
-
},
|
|
483
|
-
server: server
|
|
484
|
-
}));
|
|
485
|
-
}
|
|
486
|
-
}, {
|
|
487
|
-
key: "isWebchatVisible",
|
|
488
|
-
value: function () {
|
|
489
|
-
var _isWebchatVisible = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_ref4) {
|
|
490
|
-
var appId, _yield$HubtypeService, status;
|
|
491
|
-
|
|
492
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
493
|
-
while (1) {
|
|
494
|
-
switch (_context4.prev = _context4.next) {
|
|
495
|
-
case 0:
|
|
496
|
-
appId = _ref4.appId;
|
|
497
|
-
_context4.prev = 1;
|
|
498
|
-
_context4.next = 4;
|
|
499
|
-
return _core.HubtypeService.getWebchatVisibility({
|
|
500
|
-
appId: appId
|
|
501
|
-
});
|
|
502
|
-
|
|
503
|
-
case 4:
|
|
504
|
-
_yield$HubtypeService = _context4.sent;
|
|
505
|
-
status = _yield$HubtypeService.status;
|
|
506
|
-
return _context4.abrupt("return", status === 200);
|
|
507
|
-
|
|
508
|
-
case 9:
|
|
509
|
-
_context4.prev = 9;
|
|
510
|
-
_context4.t0 = _context4["catch"](1);
|
|
511
|
-
return _context4.abrupt("return", false);
|
|
512
|
-
|
|
513
|
-
case 12:
|
|
514
|
-
case "end":
|
|
515
|
-
return _context4.stop();
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}, _callee4, null, [[1, 9]]);
|
|
519
|
-
}));
|
|
520
|
-
|
|
521
|
-
function isWebchatVisible(_x2) {
|
|
522
|
-
return _isWebchatVisible.apply(this, arguments);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
return isWebchatVisible;
|
|
526
|
-
}()
|
|
527
|
-
}, {
|
|
528
|
-
key: "isOnline",
|
|
529
|
-
value: function isOnline() {
|
|
530
|
-
return this.webchatRef.current.isOnline();
|
|
531
|
-
}
|
|
532
|
-
}, {
|
|
533
|
-
key: "resolveWebchatVisibility",
|
|
534
|
-
value: function () {
|
|
535
|
-
var _resolveWebchatVisibility = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(optionsAtRuntime) {
|
|
536
|
-
var appId, visibility;
|
|
537
|
-
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
538
|
-
while (1) {
|
|
539
|
-
switch (_context5.prev = _context5.next) {
|
|
540
|
-
case 0:
|
|
541
|
-
appId = optionsAtRuntime.appId, visibility = optionsAtRuntime.visibility;
|
|
542
|
-
visibility = visibility || this.visibility;
|
|
543
|
-
|
|
544
|
-
if (!(visibility === undefined || visibility === true)) {
|
|
545
|
-
_context5.next = 4;
|
|
546
|
-
break;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
return _context5.abrupt("return", true);
|
|
550
|
-
|
|
551
|
-
case 4:
|
|
552
|
-
if (!(typeof visibility === 'function' && visibility())) {
|
|
553
|
-
_context5.next = 6;
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
return _context5.abrupt("return", true);
|
|
558
|
-
|
|
559
|
-
case 6:
|
|
560
|
-
_context5.t0 = visibility === 'dynamic';
|
|
561
|
-
|
|
562
|
-
if (!_context5.t0) {
|
|
563
|
-
_context5.next = 11;
|
|
564
|
-
break;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
_context5.next = 10;
|
|
568
|
-
return this.isWebchatVisible({
|
|
569
|
-
appId: appId
|
|
570
|
-
});
|
|
571
|
-
|
|
572
|
-
case 10:
|
|
573
|
-
_context5.t0 = _context5.sent;
|
|
574
|
-
|
|
575
|
-
case 11:
|
|
576
|
-
if (!_context5.t0) {
|
|
577
|
-
_context5.next = 13;
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
return _context5.abrupt("return", true);
|
|
582
|
-
|
|
583
|
-
case 13:
|
|
584
|
-
return _context5.abrupt("return", false);
|
|
585
|
-
|
|
586
|
-
case 14:
|
|
587
|
-
case "end":
|
|
588
|
-
return _context5.stop();
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
}, _callee5, this);
|
|
592
|
-
}));
|
|
593
|
-
|
|
594
|
-
function resolveWebchatVisibility(_x3) {
|
|
595
|
-
return _resolveWebchatVisibility.apply(this, arguments);
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
return resolveWebchatVisibility;
|
|
599
|
-
}()
|
|
600
|
-
}, {
|
|
601
|
-
key: "destroy",
|
|
602
|
-
value: function destroy() {
|
|
603
|
-
if (this.hubtypeService) this.hubtypeService.destroyPusher();
|
|
604
|
-
(0, _reactDom.unmountComponentAtNode)(this.host);
|
|
605
|
-
if (this.storage) this.storage.removeItem(this.storageKey);
|
|
606
|
-
}
|
|
607
|
-
}, {
|
|
608
|
-
key: "render",
|
|
609
|
-
value: function () {
|
|
610
|
-
var _render2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(dest) {
|
|
611
|
-
var _this3 = this;
|
|
612
|
-
|
|
613
|
-
var optionsAtRuntime,
|
|
614
|
-
_args7 = arguments;
|
|
615
|
-
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
616
|
-
while (1) {
|
|
617
|
-
switch (_context7.prev = _context7.next) {
|
|
618
|
-
case 0:
|
|
619
|
-
optionsAtRuntime = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
620
|
-
(0, _dom.onDOMLoaded)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
621
|
-
var isVisible;
|
|
622
|
-
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
623
|
-
while (1) {
|
|
624
|
-
switch (_context6.prev = _context6.next) {
|
|
625
|
-
case 0:
|
|
626
|
-
_context6.next = 2;
|
|
627
|
-
return _this3.resolveWebchatVisibility(optionsAtRuntime);
|
|
628
|
-
|
|
629
|
-
case 2:
|
|
630
|
-
isVisible = _context6.sent;
|
|
631
|
-
if (isVisible) (0, _reactDom.render)(_this3.getComponent(dest, optionsAtRuntime), _this3.getReactMountNode(dest));
|
|
632
|
-
|
|
633
|
-
case 4:
|
|
634
|
-
case "end":
|
|
635
|
-
return _context6.stop();
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
}, _callee6);
|
|
639
|
-
})));
|
|
640
|
-
|
|
641
|
-
case 2:
|
|
642
|
-
case "end":
|
|
643
|
-
return _context7.stop();
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}, _callee7);
|
|
647
|
-
}));
|
|
648
|
-
|
|
649
|
-
function render(_x4) {
|
|
650
|
-
return _render2.apply(this, arguments);
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
return render;
|
|
654
|
-
}()
|
|
655
|
-
}]);
|
|
656
|
-
return WebchatApp;
|
|
657
|
-
}();
|
|
658
|
-
|
|
659
|
-
exports.WebchatApp = WebchatApp;
|
|
660
|
-
//# sourceMappingURL=webchat-app.js.map
|