@botonic/react 0.31.0-alpha.4 → 0.31.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/audio.d.ts +8 -7
- package/lib/cjs/components/audio.js +7 -4
- package/lib/cjs/components/audio.js.map +1 -1
- package/lib/cjs/components/button.js +3 -4
- package/lib/cjs/components/button.js.map +1 -1
- package/lib/cjs/components/carousel.js +2 -2
- package/lib/cjs/components/carousel.js.map +1 -1
- package/lib/cjs/components/custom-message.d.ts +16 -12
- package/lib/cjs/components/custom-message.js +3 -9
- package/lib/cjs/components/custom-message.js.map +1 -1
- package/lib/cjs/components/document.d.ts +8 -7
- package/lib/cjs/components/document.js +5 -5
- package/lib/cjs/components/document.js.map +1 -1
- package/lib/cjs/components/handoff.js +2 -2
- package/lib/cjs/components/handoff.js.map +1 -1
- package/lib/cjs/components/image.d.ts +8 -7
- package/lib/cjs/components/image.js +5 -5
- package/lib/cjs/components/image.js.map +1 -1
- package/lib/cjs/components/index-types.d.ts +30 -128
- package/lib/cjs/components/index.d.ts +2 -1
- package/lib/cjs/components/index.js +4 -1
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/components/message/index.js +2 -1
- package/lib/cjs/components/message/index.js.map +1 -1
- package/lib/cjs/components/message/message-feedback.js +2 -2
- package/lib/cjs/components/message/message-feedback.js.map +1 -1
- package/lib/cjs/components/message/message-footer.js +2 -2
- package/lib/cjs/components/message/message-footer.js.map +1 -1
- package/lib/cjs/components/message/message-image.js +2 -2
- package/lib/cjs/components/message/message-image.js.map +1 -1
- package/lib/cjs/components/message/timestamps.js +2 -2
- package/lib/cjs/components/message/timestamps.js.map +1 -1
- package/lib/cjs/components/reply.d.ts +7 -6
- package/lib/cjs/components/reply.js +10 -6
- package/lib/cjs/components/reply.js.map +1 -1
- package/lib/cjs/components/video.d.ts +8 -7
- package/lib/cjs/components/video.js +2 -3
- package/lib/cjs/components/video.js.map +1 -1
- package/lib/cjs/components/webchat-settings.d.ts +15 -2
- package/lib/cjs/components/webchat-settings.js +2 -2
- package/lib/cjs/components/webchat-settings.js.map +1 -1
- package/lib/cjs/contexts.d.ts +3 -4
- package/lib/cjs/contexts.js +2 -79
- package/lib/cjs/contexts.js.map +1 -1
- package/lib/cjs/index-types.d.ts +89 -56
- package/lib/cjs/index-types.js.map +1 -1
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.js +1 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/msg-to-botonic.d.ts +1 -1
- package/lib/cjs/msg-to-botonic.js +5 -8
- package/lib/cjs/msg-to-botonic.js.map +1 -1
- package/lib/cjs/util/webchat.d.ts +17 -6
- package/lib/cjs/util/webchat.js +9 -7
- package/lib/cjs/util/webchat.js.map +1 -1
- package/lib/cjs/webchat/chat-area/index.js +3 -3
- package/lib/cjs/webchat/chat-area/index.js.map +1 -1
- package/lib/cjs/webchat/components/conditional-animation.js +2 -2
- package/lib/cjs/webchat/components/conditional-animation.js.map +1 -1
- package/lib/cjs/webchat/components/opened-persistent-menu.js +2 -2
- package/lib/cjs/webchat/components/opened-persistent-menu.js.map +1 -1
- package/lib/cjs/webchat/{actions.d.ts → context/actions.d.ts} +2 -0
- package/lib/cjs/webchat/{actions.js → context/actions.js} +3 -0
- package/lib/cjs/webchat/context/actions.js.map +1 -0
- package/lib/cjs/webchat/context/index.d.ts +5 -0
- package/lib/cjs/webchat/context/index.js +83 -0
- package/lib/cjs/webchat/context/index.js.map +1 -0
- package/lib/cjs/webchat/{messages-reducer.d.ts → context/messages-reducer.d.ts} +1 -1
- package/lib/cjs/webchat/{messages-reducer.js → context/messages-reducer.js} +3 -1
- package/lib/cjs/webchat/context/messages-reducer.js.map +1 -0
- package/lib/cjs/webchat/context/types.d.ts +74 -0
- package/lib/cjs/webchat/context/types.js +3 -0
- package/lib/cjs/webchat/context/types.js.map +1 -0
- package/lib/cjs/webchat/{hooks → context}/use-webchat.d.ts +20 -20
- package/lib/cjs/webchat/{hooks → context}/use-webchat.js +11 -5
- package/lib/cjs/webchat/context/use-webchat.js.map +1 -0
- package/lib/cjs/webchat/{webchat-reducer.d.ts → context/webchat-reducer.d.ts} +1 -1
- package/lib/cjs/webchat/{webchat-reducer.js → context/webchat-reducer.js} +2 -0
- package/lib/cjs/webchat/context/webchat-reducer.js.map +1 -0
- package/lib/cjs/webchat/cover-component/index.js +2 -2
- package/lib/cjs/webchat/cover-component/index.js.map +1 -1
- package/lib/cjs/webchat/header/default-header.d.ts +1 -0
- package/lib/cjs/webchat/header/default-header.js +25 -0
- package/lib/cjs/webchat/header/default-header.js.map +1 -0
- package/lib/cjs/webchat/header/index.d.ts +2 -0
- package/lib/cjs/webchat/header/index.js +23 -0
- package/lib/cjs/webchat/header/index.js.map +1 -0
- package/lib/cjs/webchat/header/styles.d.ts +7 -0
- package/lib/cjs/webchat/header/styles.js +59 -0
- package/lib/cjs/webchat/header/styles.js.map +1 -0
- package/lib/cjs/webchat/hooks/index.d.ts +0 -1
- package/lib/cjs/webchat/hooks/index.js +1 -4
- package/lib/cjs/webchat/hooks/index.js.map +1 -1
- package/lib/cjs/webchat/hooks/use-previous.d.ts +1 -1
- package/lib/cjs/webchat/hooks/use-previous.js.map +1 -1
- package/lib/cjs/webchat/hooks/use-scrollbar-controller.js +3 -3
- package/lib/cjs/webchat/hooks/use-scrollbar-controller.js.map +1 -1
- package/lib/cjs/webchat/hooks/use-typing.d.ts +1 -1
- package/lib/cjs/webchat/hooks/use-webchat-dimensions.js +2 -2
- package/lib/cjs/webchat/hooks/use-webchat-dimensions.js.map +1 -1
- package/lib/cjs/webchat/hooks/use-webchat-resizer.js +2 -2
- package/lib/cjs/webchat/hooks/use-webchat-resizer.js.map +1 -1
- package/lib/cjs/webchat/index-types.d.ts +3 -47
- package/lib/cjs/webchat/index.d.ts +1 -0
- package/lib/cjs/webchat/index.js +3 -1
- package/lib/cjs/webchat/index.js.map +1 -1
- package/lib/cjs/webchat/input-panel/attachment.d.ts +1 -1
- package/lib/cjs/webchat/input-panel/attachment.js +2 -2
- package/lib/cjs/webchat/input-panel/attachment.js.map +1 -1
- package/lib/cjs/webchat/input-panel/emoji-picker.d.ts +1 -1
- package/lib/cjs/webchat/input-panel/emoji-picker.js +2 -2
- package/lib/cjs/webchat/input-panel/emoji-picker.js.map +1 -1
- package/lib/cjs/webchat/input-panel/index.d.ts +3 -3
- package/lib/cjs/webchat/input-panel/index.js +8 -3
- package/lib/cjs/webchat/input-panel/index.js.map +1 -1
- package/lib/cjs/webchat/input-panel/persistent-menu.js +2 -2
- package/lib/cjs/webchat/input-panel/persistent-menu.js.map +1 -1
- package/lib/cjs/webchat/input-panel/send-button.js +2 -2
- package/lib/cjs/webchat/input-panel/send-button.js.map +1 -1
- package/lib/cjs/webchat/input-panel/textarea.d.ts +3 -3
- package/lib/cjs/webchat/input-panel/textarea.js +4 -2
- package/lib/cjs/webchat/input-panel/textarea.js.map +1 -1
- package/lib/cjs/webchat/message-list/index.js +5 -7
- package/lib/cjs/webchat/message-list/index.js.map +1 -1
- package/lib/cjs/webchat/message-list/intro-message.js +2 -2
- package/lib/cjs/webchat/message-list/intro-message.js.map +1 -1
- package/lib/cjs/webchat/message-list/styles.js +1 -0
- package/lib/cjs/webchat/message-list/styles.js.map +1 -1
- package/lib/cjs/webchat/message-list/unread-messages-banner.js +2 -2
- package/lib/cjs/webchat/message-list/unread-messages-banner.js.map +1 -1
- package/lib/cjs/webchat/message-list/use-notifications.js +2 -2
- package/lib/cjs/webchat/message-list/use-notifications.js.map +1 -1
- package/lib/cjs/webchat/replies/index.d.ts +1 -0
- package/lib/cjs/webchat/replies/index.js +32 -0
- package/lib/cjs/webchat/replies/index.js.map +1 -0
- package/lib/cjs/webchat/replies/styles.d.ts +8 -0
- package/lib/cjs/webchat/replies/styles.js +25 -0
- package/lib/cjs/webchat/replies/styles.js.map +1 -0
- package/lib/cjs/webchat/session-view.js +2 -2
- package/lib/cjs/webchat/session-view.js.map +1 -1
- package/lib/cjs/webchat/{webchat-typed/styles.d.ts → styles.d.ts} +6 -4
- package/lib/cjs/webchat/{webchat-typed/styles.js → styles.js} +1 -1
- package/lib/cjs/webchat/styles.js.map +1 -0
- package/lib/cjs/webchat/theme/types.d.ts +167 -0
- package/lib/cjs/webchat/theme/types.js +3 -0
- package/lib/cjs/webchat/theme/types.js.map +1 -0
- package/lib/cjs/webchat/trigger-button/index.js +2 -2
- package/lib/cjs/webchat/trigger-button/index.js.map +1 -1
- package/lib/cjs/webchat/webchat-dev.js +2 -2
- package/lib/cjs/webchat/webchat-dev.js.map +1 -1
- package/lib/cjs/webchat/webchat.d.ts +4 -2
- package/lib/cjs/webchat/webchat.js +85 -108
- package/lib/cjs/webchat/webchat.js.map +1 -1
- package/lib/cjs/webchat/webview.js +3 -2
- package/lib/cjs/webchat/webview.js.map +1 -1
- package/lib/cjs/webchat-app.d.ts +14 -80
- package/lib/cjs/webchat-app.js +28 -14
- package/lib/cjs/webchat-app.js.map +1 -1
- package/lib/esm/components/audio.d.ts +8 -7
- package/lib/esm/components/audio.js +7 -4
- package/lib/esm/components/audio.js.map +1 -1
- package/lib/esm/components/button.js +2 -3
- package/lib/esm/components/button.js.map +1 -1
- package/lib/esm/components/carousel.js +1 -1
- package/lib/esm/components/carousel.js.map +1 -1
- package/lib/esm/components/custom-message.d.ts +16 -12
- package/lib/esm/components/custom-message.js +3 -9
- package/lib/esm/components/custom-message.js.map +1 -1
- package/lib/esm/components/document.d.ts +8 -7
- package/lib/esm/components/document.js +4 -4
- package/lib/esm/components/document.js.map +1 -1
- package/lib/esm/components/handoff.js +1 -1
- package/lib/esm/components/handoff.js.map +1 -1
- package/lib/esm/components/image.d.ts +8 -7
- package/lib/esm/components/image.js +4 -4
- package/lib/esm/components/image.js.map +1 -1
- package/lib/esm/components/index-types.d.ts +30 -128
- package/lib/esm/components/index.d.ts +2 -1
- package/lib/esm/components/index.js +2 -1
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/components/message/index.js +2 -1
- package/lib/esm/components/message/index.js.map +1 -1
- package/lib/esm/components/message/message-feedback.js +1 -1
- package/lib/esm/components/message/message-feedback.js.map +1 -1
- package/lib/esm/components/message/message-footer.js +1 -1
- package/lib/esm/components/message/message-footer.js.map +1 -1
- package/lib/esm/components/message/message-image.js +1 -1
- package/lib/esm/components/message/message-image.js.map +1 -1
- package/lib/esm/components/message/timestamps.js +1 -1
- package/lib/esm/components/message/timestamps.js.map +1 -1
- package/lib/esm/components/reply.d.ts +7 -6
- package/lib/esm/components/reply.js +9 -5
- package/lib/esm/components/reply.js.map +1 -1
- package/lib/esm/components/video.d.ts +8 -7
- package/lib/esm/components/video.js +2 -3
- package/lib/esm/components/video.js.map +1 -1
- package/lib/esm/components/webchat-settings.d.ts +15 -2
- package/lib/esm/components/webchat-settings.js +1 -1
- package/lib/esm/components/webchat-settings.js.map +1 -1
- package/lib/esm/contexts.d.ts +3 -4
- package/lib/esm/contexts.js +1 -78
- package/lib/esm/contexts.js.map +1 -1
- package/lib/esm/index-types.d.ts +89 -56
- package/lib/esm/index-types.js.map +1 -1
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/msg-to-botonic.d.ts +1 -1
- package/lib/esm/msg-to-botonic.js +5 -8
- package/lib/esm/msg-to-botonic.js.map +1 -1
- package/lib/esm/util/webchat.d.ts +17 -6
- package/lib/esm/util/webchat.js +9 -7
- package/lib/esm/util/webchat.js.map +1 -1
- package/lib/esm/webchat/chat-area/index.js +2 -2
- package/lib/esm/webchat/chat-area/index.js.map +1 -1
- package/lib/esm/webchat/components/conditional-animation.js +1 -1
- package/lib/esm/webchat/components/conditional-animation.js.map +1 -1
- package/lib/esm/webchat/components/opened-persistent-menu.js +1 -1
- package/lib/esm/webchat/components/opened-persistent-menu.js.map +1 -1
- package/lib/esm/webchat/{actions.d.ts → context/actions.d.ts} +2 -0
- package/lib/esm/webchat/{actions.js → context/actions.js} +3 -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/{messages-reducer.d.ts → context/messages-reducer.d.ts} +1 -1
- package/lib/esm/webchat/{messages-reducer.js → context/messages-reducer.js} +3 -1
- package/lib/esm/webchat/context/messages-reducer.js.map +1 -0
- package/lib/esm/webchat/context/types.d.ts +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/{hooks → context}/use-webchat.d.ts +20 -20
- package/lib/esm/webchat/{hooks → context}/use-webchat.js +11 -5
- package/lib/esm/webchat/context/use-webchat.js.map +1 -0
- package/lib/esm/webchat/{webchat-reducer.d.ts → context/webchat-reducer.d.ts} +1 -1
- package/lib/esm/webchat/{webchat-reducer.js → context/webchat-reducer.js} +2 -0
- package/lib/esm/webchat/context/webchat-reducer.js.map +1 -0
- package/lib/esm/webchat/cover-component/index.js +1 -1
- package/lib/esm/webchat/cover-component/index.js.map +1 -1
- 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 +0 -1
- package/lib/esm/webchat/hooks/index.js +0 -1
- package/lib/esm/webchat/hooks/index.js.map +1 -1
- package/lib/esm/webchat/hooks/use-previous.d.ts +1 -1
- package/lib/esm/webchat/hooks/use-previous.js.map +1 -1
- package/lib/esm/webchat/hooks/use-scrollbar-controller.js +2 -2
- package/lib/esm/webchat/hooks/use-scrollbar-controller.js.map +1 -1
- package/lib/esm/webchat/hooks/use-typing.d.ts +1 -1
- package/lib/esm/webchat/hooks/use-webchat-dimensions.js +1 -1
- package/lib/esm/webchat/hooks/use-webchat-dimensions.js.map +1 -1
- package/lib/esm/webchat/hooks/use-webchat-resizer.js +1 -1
- package/lib/esm/webchat/hooks/use-webchat-resizer.js.map +1 -1
- package/lib/esm/webchat/index-types.d.ts +3 -47
- package/lib/esm/webchat/index.d.ts +1 -0
- package/lib/esm/webchat/index.js +1 -0
- package/lib/esm/webchat/index.js.map +1 -1
- package/lib/esm/webchat/input-panel/attachment.d.ts +1 -1
- package/lib/esm/webchat/input-panel/attachment.js +1 -1
- package/lib/esm/webchat/input-panel/attachment.js.map +1 -1
- package/lib/esm/webchat/input-panel/emoji-picker.d.ts +1 -1
- package/lib/esm/webchat/input-panel/emoji-picker.js +1 -1
- package/lib/esm/webchat/input-panel/emoji-picker.js.map +1 -1
- package/lib/esm/webchat/input-panel/index.d.ts +3 -3
- package/lib/esm/webchat/input-panel/index.js +7 -2
- package/lib/esm/webchat/input-panel/index.js.map +1 -1
- package/lib/esm/webchat/input-panel/persistent-menu.js +1 -1
- package/lib/esm/webchat/input-panel/persistent-menu.js.map +1 -1
- package/lib/esm/webchat/input-panel/send-button.js +1 -1
- package/lib/esm/webchat/input-panel/send-button.js.map +1 -1
- package/lib/esm/webchat/input-panel/textarea.d.ts +3 -3
- package/lib/esm/webchat/input-panel/textarea.js +3 -1
- package/lib/esm/webchat/input-panel/textarea.js.map +1 -1
- package/lib/esm/webchat/message-list/index.js +4 -6
- package/lib/esm/webchat/message-list/index.js.map +1 -1
- package/lib/esm/webchat/message-list/intro-message.js +1 -1
- package/lib/esm/webchat/message-list/intro-message.js.map +1 -1
- package/lib/esm/webchat/message-list/styles.js +1 -0
- package/lib/esm/webchat/message-list/styles.js.map +1 -1
- package/lib/esm/webchat/message-list/unread-messages-banner.js +1 -1
- package/lib/esm/webchat/message-list/unread-messages-banner.js.map +1 -1
- package/lib/esm/webchat/message-list/use-notifications.js +1 -1
- package/lib/esm/webchat/message-list/use-notifications.js.map +1 -1
- package/lib/esm/webchat/replies/index.d.ts +1 -0
- package/lib/esm/webchat/replies/index.js +28 -0
- package/lib/esm/webchat/replies/index.js.map +1 -0
- package/lib/esm/webchat/replies/styles.d.ts +8 -0
- package/lib/esm/webchat/replies/styles.js +21 -0
- package/lib/esm/webchat/replies/styles.js.map +1 -0
- package/lib/esm/webchat/session-view.js +1 -1
- package/lib/esm/webchat/session-view.js.map +1 -1
- package/lib/esm/webchat/{webchat-typed/styles.d.ts → styles.d.ts} +6 -4
- package/lib/esm/webchat/{webchat-typed/styles.js → styles.js} +1 -1
- 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/trigger-button/index.js +1 -1
- package/lib/esm/webchat/trigger-button/index.js.map +1 -1
- package/lib/esm/webchat/webchat-dev.js +1 -1
- package/lib/esm/webchat/webchat-dev.js.map +1 -1
- package/lib/esm/webchat/webchat.d.ts +4 -2
- package/lib/esm/webchat/webchat.js +81 -104
- package/lib/esm/webchat/webchat.js.map +1 -1
- package/lib/esm/webchat/webview.js +2 -1
- package/lib/esm/webchat/webview.js.map +1 -1
- package/lib/esm/webchat-app.d.ts +14 -80
- package/lib/esm/webchat-app.js +28 -14
- package/lib/esm/webchat-app.js.map +1 -1
- package/package.json +2 -1
- package/src/components/{audio.jsx → audio.tsx} +10 -4
- package/src/components/button.tsx +1 -3
- package/src/components/carousel.jsx +1 -1
- package/src/components/{custom-message.jsx → custom-message.tsx} +19 -7
- package/src/components/{document.jsx → document.tsx} +5 -3
- package/src/components/handoff.jsx +1 -1
- package/src/components/{image.jsx → image.tsx} +10 -4
- package/src/components/index-types.ts +25 -117
- package/src/components/index.ts +6 -1
- package/src/components/message/index.jsx +2 -1
- package/src/components/message/message-feedback.tsx +1 -1
- package/src/components/message/message-footer.tsx +1 -1
- package/src/components/message/message-image.tsx +1 -1
- package/src/components/message/timestamps.tsx +1 -1
- package/src/components/{reply.jsx → reply.tsx} +10 -4
- package/src/components/{video.jsx → video.tsx} +3 -2
- package/src/components/webchat-settings.tsx +14 -2
- package/src/contexts.tsx +5 -83
- package/src/index-types.ts +99 -64
- package/src/index.ts +2 -6
- package/src/msg-to-botonic.jsx +5 -9
- package/src/util/{webchat.js → webchat.ts} +15 -9
- package/src/webchat/chat-area/index.tsx +2 -4
- package/src/webchat/components/conditional-animation.jsx +1 -1
- package/src/webchat/components/opened-persistent-menu.jsx +1 -1
- package/src/webchat/{actions.ts → context/actions.ts} +3 -0
- package/src/webchat/context/index.tsx +81 -0
- package/src/webchat/{messages-reducer.ts → context/messages-reducer.ts} +4 -2
- package/src/webchat/context/types.ts +84 -0
- package/src/webchat/{hooks → context}/use-webchat.ts +62 -13
- package/src/webchat/{webchat-reducer.ts → context/webchat-reducer.ts} +3 -1
- package/src/webchat/cover-component/index.tsx +1 -1
- package/src/webchat/global.d.ts +3 -0
- package/src/webchat/header/default-header.tsx +75 -0
- package/src/webchat/header/index.tsx +37 -0
- package/src/webchat/header/styles.ts +62 -0
- package/src/webchat/hooks/index.ts +0 -1
- package/src/webchat/hooks/use-previous.ts +1 -1
- package/src/webchat/hooks/use-scrollbar-controller.ts +2 -2
- package/src/webchat/hooks/use-typing.ts +1 -1
- package/src/webchat/hooks/use-webchat-dimensions.ts +1 -1
- package/src/webchat/hooks/use-webchat-resizer.ts +1 -1
- package/src/webchat/index-types.ts +3 -53
- package/src/webchat/index.ts +1 -0
- package/src/webchat/input-panel/attachment.tsx +2 -2
- package/src/webchat/input-panel/emoji-picker.tsx +2 -2
- package/src/webchat/input-panel/index.tsx +9 -5
- package/src/webchat/input-panel/persistent-menu.tsx +1 -1
- package/src/webchat/input-panel/send-button.tsx +1 -1
- package/src/webchat/input-panel/textarea.tsx +6 -4
- package/src/webchat/message-list/index.tsx +4 -6
- package/src/webchat/message-list/intro-message.tsx +1 -1
- package/src/webchat/message-list/styles.ts +1 -0
- package/src/webchat/message-list/unread-messages-banner.tsx +1 -1
- package/src/webchat/message-list/use-notifications.ts +1 -1
- package/src/webchat/replies/index.tsx +47 -0
- package/src/webchat/replies/styles.ts +28 -0
- package/src/webchat/session-view.jsx +1 -1
- package/src/webchat/{webchat-typed/styles.ts → styles.ts} +7 -2
- package/src/webchat/theme/types.ts +119 -0
- package/src/webchat/trigger-button/index.tsx +1 -1
- package/src/webchat/webchat-dev.jsx +1 -1
- package/src/webchat/{webchat.jsx → webchat.tsx} +114 -124
- package/src/webchat/webview.jsx +2 -1
- package/src/webchat-app.tsx +55 -95
- package/lib/cjs/webchat/actions.js.map +0 -1
- package/lib/cjs/webchat/header.d.ts +0 -3
- package/lib/cjs/webchat/header.js +0 -86
- package/lib/cjs/webchat/header.js.map +0 -1
- package/lib/cjs/webchat/hooks/use-webchat.js.map +0 -1
- package/lib/cjs/webchat/messages-reducer.js.map +0 -1
- package/lib/cjs/webchat/replies.d.ts +0 -1
- package/lib/cjs/webchat/replies.js +0 -47
- package/lib/cjs/webchat/replies.js.map +0 -1
- package/lib/cjs/webchat/webchat-reducer.js.map +0 -1
- package/lib/cjs/webchat/webchat-typed/styles.js.map +0 -1
- package/lib/cjs/webchat/webchat-typed/webchat-typed.d.ts +0 -0
- package/lib/cjs/webchat/webchat-typed/webchat-typed.js +0 -663
- package/lib/cjs/webchat/webchat-typed/webchat-typed.js.map +0 -1
- package/lib/esm/webchat/actions.js.map +0 -1
- package/lib/esm/webchat/header.d.ts +0 -3
- package/lib/esm/webchat/header.js +0 -81
- package/lib/esm/webchat/header.js.map +0 -1
- package/lib/esm/webchat/hooks/use-webchat.js.map +0 -1
- package/lib/esm/webchat/messages-reducer.js.map +0 -1
- package/lib/esm/webchat/replies.d.ts +0 -1
- package/lib/esm/webchat/replies.js +0 -42
- package/lib/esm/webchat/replies.js.map +0 -1
- package/lib/esm/webchat/webchat-reducer.js.map +0 -1
- package/lib/esm/webchat/webchat-typed/styles.js.map +0 -1
- package/lib/esm/webchat/webchat-typed/webchat-typed.d.ts +0 -0
- package/lib/esm/webchat/webchat-typed/webchat-typed.js +0 -663
- package/lib/esm/webchat/webchat-typed/webchat-typed.js.map +0 -1
- package/src/webchat/header.jsx +0 -149
- package/src/webchat/replies.jsx +0 -64
- package/src/webchat/webchat-typed/webchat-typed.tsx +0 -728
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Session } from '@botonic/core'
|
|
2
2
|
import { useReducer, useRef } from 'react'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Reply } from '../../components'
|
|
5
|
+
import { Webview } from '../../components/index-types'
|
|
5
6
|
import { COLORS, WEBCHAT } from '../../constants'
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { WebchatMessage } from '../../index-types'
|
|
8
|
+
import { ThemeProps } from '../theme/types'
|
|
9
|
+
import { WebchatAction } from './actions'
|
|
10
|
+
import { ClientInput, DevSettings, ErrorMessage, WebchatState } from './types'
|
|
11
|
+
import { webchatReducer } from './webchat-reducer'
|
|
10
12
|
|
|
11
13
|
export const webchatInitialState: WebchatState = {
|
|
12
14
|
width: WEBCHAT.DEFAULTS.WIDTH,
|
|
@@ -19,8 +21,9 @@ export const webchatInitialState: WebchatState = {
|
|
|
19
21
|
webview: null,
|
|
20
22
|
webviewParams: null,
|
|
21
23
|
session: { user: undefined },
|
|
22
|
-
lastRoutePath:
|
|
24
|
+
lastRoutePath: undefined,
|
|
23
25
|
handoff: false,
|
|
26
|
+
// TODO: type create a defaultTheme using ThemeProps, and put this in initialState
|
|
24
27
|
theme: {
|
|
25
28
|
headerTitle: WEBCHAT.DEFAULTS.TITLE,
|
|
26
29
|
brandColor: COLORS.BOTONIC_BLUE,
|
|
@@ -47,7 +50,44 @@ export const webchatInitialState: WebchatState = {
|
|
|
47
50
|
isInputFocused: false,
|
|
48
51
|
}
|
|
49
52
|
|
|
50
|
-
export
|
|
53
|
+
export interface UseWebchat {
|
|
54
|
+
addMessage: (message: WebchatMessage) => void
|
|
55
|
+
addMessageComponent: (message: { props: WebchatMessage }) => void
|
|
56
|
+
clearMessages: () => void
|
|
57
|
+
doRenderCustomComponent: (toggle: boolean) => void
|
|
58
|
+
resetUnreadMessages: () => void
|
|
59
|
+
setCurrentAttachment: (attachment?: File) => void
|
|
60
|
+
setError: (error?: ErrorMessage) => void
|
|
61
|
+
setIsInputFocused: (isInputFocused: boolean) => void
|
|
62
|
+
setLastMessageVisible: (isLastMessageVisible: boolean) => void
|
|
63
|
+
setOnline: (online: boolean) => void
|
|
64
|
+
toggleCoverComponent: (toggle: boolean) => void
|
|
65
|
+
toggleEmojiPicker: (toggle: boolean) => void
|
|
66
|
+
togglePersistentMenu: (toggle: boolean) => void
|
|
67
|
+
toggleWebchat: (toggle: boolean) => void
|
|
68
|
+
updateDevSettings: (settings: DevSettings) => void
|
|
69
|
+
updateHandoff: (handoff: boolean) => void
|
|
70
|
+
updateLastMessageDate: (date: string) => void
|
|
71
|
+
updateLastRoutePath: (path: string) => void
|
|
72
|
+
updateLatestInput: (input: ClientInput) => void
|
|
73
|
+
updateMessage: (message: WebchatMessage) => void
|
|
74
|
+
updateReplies: (replies: (typeof Reply)[]) => void
|
|
75
|
+
updateSession: (session: Partial<Session>) => void
|
|
76
|
+
updateTheme: (theme: ThemeProps, themeUpdates?: ThemeProps) => void
|
|
77
|
+
updateTyping: (typing: boolean) => void
|
|
78
|
+
updateWebview: (webview: Webview, params: Record<string, string>) => void
|
|
79
|
+
removeReplies: () => void
|
|
80
|
+
removeWebview: () => void
|
|
81
|
+
webchatState: WebchatState
|
|
82
|
+
webchatRef: React.MutableRefObject<HTMLDivElement | null> // TODO: Change name, already exists WebchatRef for useImperativeHandle
|
|
83
|
+
headerRef: React.MutableRefObject<HTMLDivElement | null>
|
|
84
|
+
chatAreaRef: React.MutableRefObject<HTMLDivElement | null>
|
|
85
|
+
scrollableMessagesListRef: React.MutableRefObject<HTMLDivElement | null>
|
|
86
|
+
repliesRef: React.MutableRefObject<HTMLDivElement | null>
|
|
87
|
+
inputPanelRef: React.MutableRefObject<HTMLDivElement | null>
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function useWebchat(): UseWebchat {
|
|
51
91
|
const [webchatState, webchatDispatch] = useReducer(
|
|
52
92
|
webchatReducer,
|
|
53
93
|
webchatInitialState
|
|
@@ -72,9 +112,12 @@ export function useWebchat() {
|
|
|
72
112
|
const updateMessage = (message: WebchatMessage) =>
|
|
73
113
|
webchatDispatch({ type: WebchatAction.UPDATE_MESSAGE, payload: message })
|
|
74
114
|
|
|
75
|
-
const updateReplies = replies =>
|
|
115
|
+
const updateReplies = (replies: (typeof Reply)[]) =>
|
|
76
116
|
webchatDispatch({ type: WebchatAction.UPDATE_REPLIES, payload: replies })
|
|
77
117
|
|
|
118
|
+
const removeReplies = () =>
|
|
119
|
+
webchatDispatch({ type: WebchatAction.REMOVE_REPLIES, payload: [] })
|
|
120
|
+
|
|
78
121
|
const updateLatestInput = (input: ClientInput) =>
|
|
79
122
|
webchatDispatch({ type: WebchatAction.UPDATE_LATEST_INPUT, payload: input })
|
|
80
123
|
|
|
@@ -87,7 +130,12 @@ export function useWebchat() {
|
|
|
87
130
|
payload: { webview, webviewParams: params },
|
|
88
131
|
})
|
|
89
132
|
|
|
90
|
-
const
|
|
133
|
+
const removeWebview = () =>
|
|
134
|
+
webchatDispatch({
|
|
135
|
+
type: WebchatAction.REMOVE_WEBVIEW,
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
const updateSession = (session: Partial<Session>) => {
|
|
91
139
|
webchatDispatch({
|
|
92
140
|
type: WebchatAction.UPDATE_SESSION,
|
|
93
141
|
payload: session,
|
|
@@ -152,7 +200,7 @@ export function useWebchat() {
|
|
|
152
200
|
payload: toggle,
|
|
153
201
|
})
|
|
154
202
|
|
|
155
|
-
const setError = (error
|
|
203
|
+
const setError = (error?: ErrorMessage) =>
|
|
156
204
|
webchatDispatch({
|
|
157
205
|
type: WebchatAction.SET_ERROR,
|
|
158
206
|
payload: error,
|
|
@@ -177,7 +225,7 @@ export function useWebchat() {
|
|
|
177
225
|
})
|
|
178
226
|
}
|
|
179
227
|
|
|
180
|
-
const setCurrentAttachment = (attachment
|
|
228
|
+
const setCurrentAttachment = (attachment?: File) => {
|
|
181
229
|
webchatDispatch({
|
|
182
230
|
type: WebchatAction.SET_CURRENT_ATTACHMENT,
|
|
183
231
|
payload: attachment,
|
|
@@ -230,7 +278,8 @@ export function useWebchat() {
|
|
|
230
278
|
updateTheme,
|
|
231
279
|
updateTyping,
|
|
232
280
|
updateWebview,
|
|
233
|
-
|
|
281
|
+
removeReplies,
|
|
282
|
+
removeWebview,
|
|
234
283
|
webchatState,
|
|
235
284
|
webchatRef,
|
|
236
285
|
headerRef,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WebchatAction } from './actions'
|
|
2
|
-
import { WebchatState } from './index-types'
|
|
3
2
|
import { messagesReducer } from './messages-reducer'
|
|
3
|
+
import { WebchatState } from './types'
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line complexity
|
|
6
6
|
export function webchatReducer(
|
|
@@ -10,6 +10,8 @@ export function webchatReducer(
|
|
|
10
10
|
switch (action.type) {
|
|
11
11
|
case WebchatAction.UPDATE_WEBVIEW:
|
|
12
12
|
return { ...state, ...action.payload }
|
|
13
|
+
case WebchatAction.REMOVE_WEBVIEW:
|
|
14
|
+
return { ...state, webview: null, webviewParams: null }
|
|
13
15
|
case WebchatAction.UPDATE_SESSION:
|
|
14
16
|
return { ...state, session: { ...action.payload } }
|
|
15
17
|
case WebchatAction.UPDATE_TYPING:
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { useContext } from 'react'
|
|
2
|
+
|
|
3
|
+
import { COLORS, ROLES, WEBCHAT } from '../../constants'
|
|
4
|
+
import { Scale } from '../../shared/styles'
|
|
5
|
+
import { resolveImage } from '../../util/environment'
|
|
6
|
+
import { ConditionalWrapper } from '../../util/react'
|
|
7
|
+
import { WebchatContext } from '../../webchat/context'
|
|
8
|
+
import {
|
|
9
|
+
CloseHeader,
|
|
10
|
+
HeaderContainer,
|
|
11
|
+
ImageContainer,
|
|
12
|
+
Subtitle,
|
|
13
|
+
TextContainer,
|
|
14
|
+
Title,
|
|
15
|
+
} from './styles'
|
|
16
|
+
|
|
17
|
+
export const DefaultHeader = () => {
|
|
18
|
+
const { getThemeProperty, toggleWebchat } = useContext(WebchatContext)
|
|
19
|
+
|
|
20
|
+
const animationsEnabled = getThemeProperty(
|
|
21
|
+
WEBCHAT.CUSTOM_PROPERTIES.enableAnimations,
|
|
22
|
+
true
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const headerImage = getThemeProperty(
|
|
26
|
+
WEBCHAT.CUSTOM_PROPERTIES.headerImage,
|
|
27
|
+
getThemeProperty(
|
|
28
|
+
WEBCHAT.CUSTOM_PROPERTIES.brandImage,
|
|
29
|
+
WEBCHAT.DEFAULTS.LOGO
|
|
30
|
+
)
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
const headerTitle = getThemeProperty(
|
|
34
|
+
WEBCHAT.CUSTOM_PROPERTIES.headerTitle,
|
|
35
|
+
WEBCHAT.DEFAULTS.TITLE
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
const headerSubtitle = getThemeProperty(
|
|
39
|
+
WEBCHAT.CUSTOM_PROPERTIES.headerSubtitle,
|
|
40
|
+
''
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
const handleCloseWebchat = () => {
|
|
44
|
+
toggleWebchat(false)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const color = getThemeProperty(
|
|
48
|
+
WEBCHAT.CUSTOM_PROPERTIES.brandColor,
|
|
49
|
+
COLORS.BOTONIC_BLUE
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<HeaderContainer
|
|
54
|
+
role={ROLES.HEADER}
|
|
55
|
+
color={color}
|
|
56
|
+
style={{ ...getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.headerStyle) }}
|
|
57
|
+
>
|
|
58
|
+
{headerImage && (
|
|
59
|
+
<ImageContainer>
|
|
60
|
+
<img src={resolveImage(headerImage)} />
|
|
61
|
+
</ImageContainer>
|
|
62
|
+
)}
|
|
63
|
+
<TextContainer>
|
|
64
|
+
<Title>{headerTitle}</Title>
|
|
65
|
+
{headerSubtitle ? <Subtitle>{headerSubtitle}</Subtitle> : null}
|
|
66
|
+
</TextContainer>
|
|
67
|
+
<ConditionalWrapper
|
|
68
|
+
condition={animationsEnabled}
|
|
69
|
+
wrapper={children => <Scale>{children}</Scale>}
|
|
70
|
+
>
|
|
71
|
+
<CloseHeader onClick={handleCloseWebchat}>⨯</CloseHeader>
|
|
72
|
+
</ConditionalWrapper>
|
|
73
|
+
</HeaderContainer>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { ForwardedRef, forwardRef, useContext } from 'react'
|
|
2
|
+
|
|
3
|
+
import { WEBCHAT } from '../../constants'
|
|
4
|
+
import { WebchatContext } from '../../webchat/context'
|
|
5
|
+
import { BotonicContainerId } from '../constants'
|
|
6
|
+
import { DefaultHeader } from './default-header'
|
|
7
|
+
import { StyledWebchatHeader } from './styles'
|
|
8
|
+
|
|
9
|
+
export const WebchatHeader = forwardRef(
|
|
10
|
+
(_, ref: ForwardedRef<HTMLDivElement>) => {
|
|
11
|
+
const { getThemeProperty, toggleWebchat } = useContext(WebchatContext)
|
|
12
|
+
|
|
13
|
+
const handleCloseWebchat = () => {
|
|
14
|
+
toggleWebchat(false)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const CustomHeader = getThemeProperty(
|
|
18
|
+
WEBCHAT.CUSTOM_PROPERTIES.customHeader
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
if (CustomHeader) {
|
|
22
|
+
return (
|
|
23
|
+
<div id={BotonicContainerId.Header} ref={ref}>
|
|
24
|
+
<CustomHeader onCloseClick={handleCloseWebchat} />
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<StyledWebchatHeader id={BotonicContainerId.Header} ref={ref}>
|
|
31
|
+
<DefaultHeader />
|
|
32
|
+
</StyledWebchatHeader>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
WebchatHeader.displayName = 'WebchatHeader'
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
|
|
3
|
+
import { COLORS, WEBCHAT } from '../../constants'
|
|
4
|
+
|
|
5
|
+
export const HeaderContainer = styled.div`
|
|
6
|
+
display: flex;
|
|
7
|
+
background: linear-gradient(
|
|
8
|
+
90deg,
|
|
9
|
+
${COLORS.BLEACHED_CEDAR_PURPLE} 0%,
|
|
10
|
+
${props => props.color} 100%
|
|
11
|
+
);
|
|
12
|
+
border-radius: ${WEBCHAT.DEFAULTS.BORDER_RADIUS_TOP_CORNERS};
|
|
13
|
+
z-index: 2;
|
|
14
|
+
height: inherit;
|
|
15
|
+
`
|
|
16
|
+
|
|
17
|
+
export const ImageContainer = styled.div`
|
|
18
|
+
padding: 10px;
|
|
19
|
+
align-items: center;
|
|
20
|
+
|
|
21
|
+
img {
|
|
22
|
+
width: 32px;
|
|
23
|
+
border-radius: 50%;
|
|
24
|
+
}
|
|
25
|
+
`
|
|
26
|
+
|
|
27
|
+
export const TextContainer = styled.div`
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
flex: 1 1 auto;
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
export const Title = styled.div`
|
|
35
|
+
display: flex;
|
|
36
|
+
font-family: inherit;
|
|
37
|
+
font-size: 15px;
|
|
38
|
+
font-weight: bold;
|
|
39
|
+
color: ${COLORS.SOLID_WHITE};
|
|
40
|
+
`
|
|
41
|
+
|
|
42
|
+
export const Subtitle = styled.div`
|
|
43
|
+
display: flex;
|
|
44
|
+
font-family: inherit;
|
|
45
|
+
font-size: 11px;
|
|
46
|
+
color: ${COLORS.SOLID_WHITE};
|
|
47
|
+
`
|
|
48
|
+
|
|
49
|
+
export const CloseHeader = styled.div`
|
|
50
|
+
padding: 0px 16px;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
color: ${COLORS.SOLID_WHITE};
|
|
53
|
+
font-family: inherit;
|
|
54
|
+
font-size: 36px;
|
|
55
|
+
`
|
|
56
|
+
|
|
57
|
+
export const StyledWebchatHeader = styled.div`
|
|
58
|
+
border-radius: 8px 8px 0px 0px;
|
|
59
|
+
box-shadow: ${COLORS.PIGEON_POST_BLUE_ALPHA_0_5} 0px 2px 5px;
|
|
60
|
+
height: 55px;
|
|
61
|
+
flex: none;
|
|
62
|
+
`
|
|
@@ -6,6 +6,5 @@ export { useScrollToBottom } from './use-scroll-to-bottom'
|
|
|
6
6
|
export { useScrollbarController } from './use-scrollbar-controller'
|
|
7
7
|
export { useTyping } from './use-typing'
|
|
8
8
|
export { useVirtualKeyboardDetection } from './use-virtual-keyboard-detection'
|
|
9
|
-
export { useWebchat, webchatInitialState } from './use-webchat'
|
|
10
9
|
export { useWebchatDimensions } from './use-webchat-dimensions'
|
|
11
10
|
export { useWebchatResizer } from './use-webchat-resizer'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext, useEffect } from 'react'
|
|
2
2
|
|
|
3
|
-
import { WebchatContext } from '../../
|
|
3
|
+
import { WebchatContext } from '../../webchat/context'
|
|
4
4
|
import { DEVICES, isMobileDevice } from '../devices'
|
|
5
5
|
|
|
6
6
|
// TODO: Investigate why when we have some messages, scroll actions are not disabled properly
|
|
@@ -30,7 +30,7 @@ export const useScrollbarController = (currentDevice, host) => {
|
|
|
30
30
|
|
|
31
31
|
const hasScrollbar = () => {
|
|
32
32
|
if (chatAreaRef.current && scrollableMessagesListRef.current) {
|
|
33
|
-
if (!repliesRef) {
|
|
33
|
+
if (!repliesRef?.current) {
|
|
34
34
|
return (
|
|
35
35
|
scrollableMessagesListRef.current?.scrollHeight >
|
|
36
36
|
chatAreaRef.current?.clientHeight
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { RefObject } from 'react'
|
|
3
|
-
|
|
4
|
-
import { Webview } from '../components/index-types'
|
|
1
|
+
import { WebchatArgs } from '../index-types'
|
|
5
2
|
|
|
6
3
|
export interface WebchatStateTheme {
|
|
7
4
|
headerTitle: string
|
|
@@ -11,60 +8,13 @@ export interface WebchatStateTheme {
|
|
|
11
8
|
textPlaceholder: string
|
|
12
9
|
style: {
|
|
13
10
|
fontFamily: string
|
|
11
|
+
borderRadius?: string
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
export interface
|
|
18
|
-
message?: string
|
|
19
|
-
}
|
|
20
|
-
export interface DevSettings {
|
|
21
|
-
keepSessionOnReload?: boolean
|
|
22
|
-
showSessionView?: boolean
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface WebchatState {
|
|
26
|
-
width: number
|
|
27
|
-
height: number
|
|
28
|
-
messagesJSON: any[]
|
|
29
|
-
messagesComponents: any[]
|
|
30
|
-
replies: any[]
|
|
31
|
-
latestInput: Partial<CoreInput>
|
|
32
|
-
typing: boolean
|
|
33
|
-
webview: Webview | null
|
|
34
|
-
webviewParams: null
|
|
35
|
-
session: Partial<CoreSession>
|
|
36
|
-
lastRoutePath: string | null
|
|
37
|
-
handoff: boolean
|
|
38
|
-
theme: WebchatStateTheme
|
|
39
|
-
themeUpdates: Partial<WebchatStateTheme>
|
|
40
|
-
error: ErrorMessage
|
|
41
|
-
online: boolean
|
|
42
|
-
devSettings: DevSettings
|
|
43
|
-
isWebchatOpen: boolean
|
|
44
|
-
isEmojiPickerOpen: boolean
|
|
45
|
-
isPersistentMenuOpen: boolean
|
|
46
|
-
isCoverComponentOpen: boolean
|
|
47
|
-
isCustomComponentRendered: boolean
|
|
48
|
-
lastMessageUpdate?: string
|
|
49
|
-
currentAttachment?: File
|
|
50
|
-
numUnreadMessages: number
|
|
51
|
-
isLastMessageVisible: boolean
|
|
52
|
-
isInputFocused: boolean
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// export interface WebchatProps extends WebchatArgs {
|
|
56
|
-
export interface WebchatProps {
|
|
57
|
-
ref: RefObject<any>
|
|
58
|
-
onConnectionRegained?: () => Promise<void>
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface WebchatDevProps extends WebchatProps {
|
|
15
|
+
export interface WebchatDevProps extends WebchatArgs {
|
|
62
16
|
initialDevSettings?: {
|
|
63
17
|
keepSessionOnReload?: boolean
|
|
64
18
|
showSessionView?: boolean
|
|
65
19
|
}
|
|
66
20
|
}
|
|
67
|
-
|
|
68
|
-
export interface CoverComponentProps {
|
|
69
|
-
closeComponent: () => void
|
|
70
|
-
}
|
package/src/webchat/index.ts
CHANGED
|
@@ -2,13 +2,13 @@ import React, { useContext, useRef } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import AttachmentIcon from '../../assets/attachment-icon.svg'
|
|
4
4
|
import { ROLES, WEBCHAT } from '../../constants'
|
|
5
|
-
import { WebchatContext } from '../../
|
|
5
|
+
import { WebchatContext } from '../../webchat/context'
|
|
6
6
|
import { Icon } from '../components/common'
|
|
7
7
|
import { ConditionalAnimation } from '../components/conditional-animation'
|
|
8
8
|
|
|
9
9
|
interface AttachmentProps {
|
|
10
10
|
accept: string
|
|
11
|
-
enableAttachments
|
|
11
|
+
enableAttachments?: boolean
|
|
12
12
|
onChange: (event: any) => void
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -2,12 +2,12 @@ import React, { useContext } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import LogoEmoji from '../../assets/emojiButton.svg'
|
|
4
4
|
import { ROLES, WEBCHAT } from '../../constants'
|
|
5
|
-
import { WebchatContext } from '../../
|
|
5
|
+
import { WebchatContext } from '../../webchat/context'
|
|
6
6
|
import { Icon } from '../components/common'
|
|
7
7
|
import { ConditionalAnimation } from '../components/conditional-animation'
|
|
8
8
|
|
|
9
9
|
interface EmojiPickerProps {
|
|
10
|
-
enableEmojiPicker
|
|
10
|
+
enableEmojiPicker?: boolean
|
|
11
11
|
onClick: () => void
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -3,8 +3,8 @@ import React, { useContext } from 'react'
|
|
|
3
3
|
import { v7 as uuidv7 } from 'uuid'
|
|
4
4
|
|
|
5
5
|
import { WEBCHAT } from '../../constants'
|
|
6
|
-
import { WebchatContext } from '../../contexts'
|
|
7
6
|
import { getFullMimeWhitelist } from '../../message-utils'
|
|
7
|
+
import { WebchatContext } from '../../webchat/context'
|
|
8
8
|
import { BotonicContainerId } from '../constants'
|
|
9
9
|
import { Attachment } from './attachment'
|
|
10
10
|
import { EmojiPicker } from './emoji-picker'
|
|
@@ -16,10 +16,10 @@ import { Textarea } from './textarea'
|
|
|
16
16
|
|
|
17
17
|
interface InputPanelProps {
|
|
18
18
|
persistentMenu: any
|
|
19
|
-
enableEmojiPicker
|
|
20
|
-
enableAttachments
|
|
19
|
+
enableEmojiPicker?: boolean
|
|
20
|
+
enableAttachments?: boolean
|
|
21
21
|
handleAttachment: (event: any) => void
|
|
22
|
-
textareaRef: React.MutableRefObject<HTMLTextAreaElement>
|
|
22
|
+
textareaRef: React.MutableRefObject<HTMLTextAreaElement | undefined>
|
|
23
23
|
host: HTMLElement
|
|
24
24
|
onUserInput?: (event: any) => Promise<void>
|
|
25
25
|
}
|
|
@@ -43,6 +43,8 @@ export const InputPanel = ({
|
|
|
43
43
|
} = useContext(WebchatContext)
|
|
44
44
|
|
|
45
45
|
const handleSelectedEmoji = event => {
|
|
46
|
+
if (!textareaRef.current) return
|
|
47
|
+
|
|
46
48
|
textareaRef.current.value += event.emoji
|
|
47
49
|
textareaRef.current.focus()
|
|
48
50
|
}
|
|
@@ -56,7 +58,9 @@ export const InputPanel = ({
|
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
const sendTextAreaText = async () => {
|
|
59
|
-
|
|
61
|
+
if (!textareaRef.current) return
|
|
62
|
+
|
|
63
|
+
await sendText(textareaRef.current?.value)
|
|
60
64
|
textareaRef.current.value = ''
|
|
61
65
|
}
|
|
62
66
|
|
|
@@ -2,7 +2,7 @@ import React, { useContext } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import LogoMenu from '../../assets/menuButton.svg'
|
|
4
4
|
import { ROLES, WEBCHAT } from '../../constants'
|
|
5
|
-
import { WebchatContext } from '../../
|
|
5
|
+
import { WebchatContext } from '../../webchat/context'
|
|
6
6
|
import { Icon } from '../components/common'
|
|
7
7
|
import { ConditionalAnimation } from '../components/conditional-animation'
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import React, { useContext } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import SendButtonIcon from '../../assets/send-button.svg'
|
|
4
4
|
import { ROLES, WEBCHAT } from '../../constants'
|
|
5
|
-
import { WebchatContext } from '../../
|
|
5
|
+
import { WebchatContext } from '../../webchat/context'
|
|
6
6
|
import { Icon } from '../components/common'
|
|
7
7
|
import { ConditionalAnimation } from '../components/conditional-animation'
|
|
8
8
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React, { useContext } from 'react'
|
|
2
2
|
import TextareaAutosize from 'react-textarea-autosize'
|
|
3
3
|
|
|
4
|
-
import { PersistentMenuTheme } from '../../components/index-types'
|
|
5
4
|
import { WEBCHAT } from '../../constants'
|
|
6
|
-
import { WebchatContext } from '../../contexts'
|
|
7
5
|
import { Typing } from '../../index-types'
|
|
6
|
+
import { WebchatContext } from '../../webchat/context'
|
|
8
7
|
import { useDeviceAdapter } from '../hooks'
|
|
8
|
+
import { PersistentMenuOptionsTheme } from '../theme/types'
|
|
9
9
|
import { TextAreaContainer } from './styles'
|
|
10
10
|
|
|
11
11
|
interface TextareaProps {
|
|
12
12
|
host: HTMLElement
|
|
13
|
-
persistentMenu:
|
|
14
|
-
textareaRef: React.MutableRefObject<HTMLTextAreaElement>
|
|
13
|
+
persistentMenu: PersistentMenuOptionsTheme
|
|
14
|
+
textareaRef: React.MutableRefObject<HTMLTextAreaElement | undefined>
|
|
15
15
|
sendChatEvent: (event: string) => Promise<void>
|
|
16
16
|
sendTextAreaText: () => Promise<void>
|
|
17
17
|
}
|
|
@@ -45,6 +45,8 @@ export const Textarea = ({
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const onKeyUp = () => {
|
|
48
|
+
if (!textareaRef.current) return
|
|
49
|
+
|
|
48
50
|
if (textareaRef.current.value === '') {
|
|
49
51
|
stopTyping()
|
|
50
52
|
return
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useRef, useState } from 'react'
|
|
2
2
|
|
|
3
3
|
import { ROLES } from '../../constants'
|
|
4
|
-
import { WebchatContext } from '../../
|
|
4
|
+
import { WebchatContext } from '../../webchat/context'
|
|
5
5
|
import { BotonicContainerId } from '../constants'
|
|
6
6
|
import TypingIndicator from '../typing-indicator'
|
|
7
7
|
import { IntroMessage } from './intro-message'
|
|
@@ -12,11 +12,9 @@ import { useNotifications } from './use-notifications'
|
|
|
12
12
|
|
|
13
13
|
const SCROLL_TIMEOUT = 200
|
|
14
14
|
const scrollOptionsEnd: ScrollIntoViewOptions = {
|
|
15
|
-
behavior: 'smooth',
|
|
16
15
|
block: 'end',
|
|
17
16
|
}
|
|
18
17
|
const scrollOptionsCenter: ScrollIntoViewOptions = {
|
|
19
|
-
behavior: 'smooth',
|
|
20
18
|
block: 'center',
|
|
21
19
|
}
|
|
22
20
|
|
|
@@ -136,8 +134,8 @@ export const WebchatMessageList = () => {
|
|
|
136
134
|
<IntroMessage />
|
|
137
135
|
{webchatState.messagesComponents.map((messageComponent, index) => {
|
|
138
136
|
return (
|
|
139
|
-
|
|
140
|
-
<ContainerMessage role={ROLES.MESSAGE}
|
|
137
|
+
<React.Fragment key={messageComponent.props.id}>
|
|
138
|
+
<ContainerMessage role={ROLES.MESSAGE}>
|
|
141
139
|
{showUnreadMessagesBanner(messageComponent.props.id) && (
|
|
142
140
|
<UnreadMessagesBanner
|
|
143
141
|
unreadMessagesBannerRef={unreadMessagesBannerRef}
|
|
@@ -153,7 +151,7 @@ export const WebchatMessageList = () => {
|
|
|
153
151
|
}}
|
|
154
152
|
></div>
|
|
155
153
|
)}
|
|
156
|
-
|
|
154
|
+
</React.Fragment>
|
|
157
155
|
)
|
|
158
156
|
})}
|
|
159
157
|
{webchatState.typing && <TypingIndicator ref={typingRef} />}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useContext } from 'react'
|
|
2
2
|
|
|
3
3
|
import { WEBCHAT } from '../../constants'
|
|
4
|
-
import { WebchatContext } from '../../contexts'
|
|
5
4
|
import { Fade } from '../../shared/styles'
|
|
6
5
|
import { resolveImage } from '../../util/environment'
|
|
7
6
|
import { ConditionalWrapper } from '../../util/react'
|
|
7
|
+
import { WebchatContext } from '../../webchat/context'
|
|
8
8
|
import { DefaultIntroImage } from './styles'
|
|
9
9
|
|
|
10
10
|
export const IntroMessage = () => {
|