@botonic/react 0.24.0-alpha.3 → 0.24.0-alpha.4
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/index-types.d.ts +1 -0
- package/lib/cjs/components/index-types.js.map +1 -1
- package/lib/cjs/components/{message.js → message/index.js} +20 -65
- package/lib/cjs/components/message/index.js.map +1 -0
- package/lib/cjs/components/message/message-image.d.ts +7 -0
- package/lib/cjs/components/message/message-image.js +18 -0
- package/lib/cjs/components/message/message-image.js.map +1 -0
- package/lib/cjs/components/message/styles.d.ts +8 -0
- package/lib/cjs/components/message/styles.js +69 -0
- package/lib/cjs/components/message/styles.js.map +1 -0
- package/lib/cjs/components/{timestamps.d.ts → message/timestamps.d.ts} +2 -1
- package/lib/cjs/components/message/timestamps.js +36 -0
- package/lib/cjs/components/message/timestamps.js.map +1 -0
- package/lib/cjs/constants.d.ts +1 -0
- package/lib/cjs/constants.js +2 -0
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/webchat/trigger-button/index.js +3 -2
- package/lib/cjs/webchat/trigger-button/index.js.map +1 -1
- 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/index-types.d.ts +4 -0
- package/lib/esm/assets/index-types.js +2 -0
- package/lib/esm/assets/index-types.js.map +1 -0
- package/lib/esm/botonic-tester.d.ts +18 -0
- package/lib/esm/botonic-tester.js +62 -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 +18 -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 +140 -0
- package/lib/esm/components/button.js.map +1 -0
- package/lib/esm/components/buttons-disabler.d.ts +24 -0
- package/lib/esm/components/buttons-disabler.js +84 -0
- package/lib/esm/components/buttons-disabler.js.map +1 -0
- package/lib/esm/components/carousel.d.ts +10 -0
- package/lib/esm/components/carousel.js +102 -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 +12 -0
- package/lib/esm/components/custom-message.js +55 -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 +42 -0
- package/lib/esm/components/document.js.map +1 -0
- package/lib/esm/components/element.d.ts +4 -0
- package/lib/esm/components/element.js +51 -0
- package/lib/esm/components/element.js.map +1 -0
- package/lib/esm/components/handoff.d.ts +1 -0
- package/lib/esm/components/handoff.js +49 -0
- package/lib/esm/components/handoff.js.map +1 -0
- package/lib/esm/components/image.d.ts +8 -0
- package/lib/esm/components/image.js +35 -0
- package/lib/esm/components/image.js.map +1 -0
- package/lib/esm/components/index-types.d.ts +190 -0
- package/lib/esm/components/index-types.js +16 -0
- package/lib/esm/components/index-types.js.map +1 -0
- package/lib/esm/components/index.d.ts +23 -0
- package/lib/esm/components/index.js +24 -0
- package/lib/esm/components/index.js.map +1 -0
- package/lib/esm/components/location.d.ts +11 -0
- package/lib/esm/components/location.js +27 -0
- package/lib/esm/components/location.js.map +1 -0
- package/lib/esm/components/markdown.d.ts +7 -0
- package/lib/esm/components/markdown.js +152 -0
- package/lib/esm/components/markdown.js.map +1 -0
- package/lib/esm/components/message/index.d.ts +1 -0
- package/lib/esm/components/message/index.js +143 -0
- package/lib/esm/components/message/index.js.map +1 -0
- package/lib/esm/components/message/message-image.d.ts +7 -0
- package/lib/esm/components/message/message-image.js +14 -0
- package/lib/esm/components/message/message-image.js.map +1 -0
- package/lib/esm/components/message/styles.d.ts +8 -0
- package/lib/esm/components/message/styles.js +65 -0
- package/lib/esm/components/message/styles.js.map +1 -0
- package/lib/esm/components/message/timestamps.d.ts +11 -0
- package/lib/esm/components/message/timestamps.js +30 -0
- package/lib/esm/components/message/timestamps.js.map +1 -0
- package/lib/esm/components/message-template.d.ts +1 -0
- package/lib/esm/components/message-template.js +9 -0
- package/lib/esm/components/message-template.js.map +1 -0
- package/lib/esm/components/multichannel/facebook/facebook.d.ts +17 -0
- package/lib/esm/components/multichannel/facebook/facebook.js +43 -0
- package/lib/esm/components/multichannel/facebook/facebook.js.map +1 -0
- package/lib/esm/components/multichannel/index-types.d.ts +46 -0
- package/lib/esm/components/multichannel/index-types.js +2 -0
- package/lib/esm/components/multichannel/index-types.js.map +1 -0
- package/lib/esm/components/multichannel/index.d.ts +11 -0
- package/lib/esm/components/multichannel/index.js +12 -0
- package/lib/esm/components/multichannel/index.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel-button.d.ts +1 -0
- package/lib/esm/components/multichannel/multichannel-button.js +71 -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 +73 -0
- package/lib/esm/components/multichannel/multichannel-carousel.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel-context.d.ts +11 -0
- package/lib/esm/components/multichannel/multichannel-context.js +12 -0
- package/lib/esm/components/multichannel/multichannel-context.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel-reply.d.ts +1 -0
- package/lib/esm/components/multichannel/multichannel-reply.js +20 -0
- package/lib/esm/components/multichannel/multichannel-reply.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel-text.d.ts +1 -0
- package/lib/esm/components/multichannel/multichannel-text.js +153 -0
- package/lib/esm/components/multichannel/multichannel-text.js.map +1 -0
- package/lib/esm/components/multichannel/multichannel-utils.d.ts +26 -0
- package/lib/esm/components/multichannel/multichannel-utils.js +69 -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 +55 -0
- package/lib/esm/components/multichannel/multichannel.js.map +1 -0
- package/lib/esm/components/multichannel/whatsapp/markdown.d.ts +1 -0
- package/lib/esm/components/multichannel/whatsapp/markdown.js +53 -0
- package/lib/esm/components/multichannel/whatsapp/markdown.js.map +1 -0
- package/lib/esm/components/pic.d.ts +6 -0
- package/lib/esm/components/pic.js +25 -0
- package/lib/esm/components/pic.js.map +1 -0
- package/lib/esm/components/raw.d.ts +9 -0
- package/lib/esm/components/raw.js +39 -0
- package/lib/esm/components/raw.js.map +1 -0
- package/lib/esm/components/reply.d.ts +9 -0
- package/lib/esm/components/reply.js +49 -0
- package/lib/esm/components/reply.js.map +1 -0
- package/lib/esm/components/share-button.d.ts +1 -0
- package/lib/esm/components/share-button.js +9 -0
- package/lib/esm/components/share-button.js.map +1 -0
- package/lib/esm/components/subtitle.d.ts +6 -0
- package/lib/esm/components/subtitle.js +19 -0
- package/lib/esm/components/subtitle.js.map +1 -0
- package/lib/esm/components/text.d.ts +8 -0
- package/lib/esm/components/text.js +42 -0
- package/lib/esm/components/text.js.map +1 -0
- package/lib/esm/components/title.d.ts +6 -0
- package/lib/esm/components/title.js +17 -0
- package/lib/esm/components/title.js.map +1 -0
- package/lib/esm/components/video.d.ts +8 -0
- package/lib/esm/components/video.js +26 -0
- package/lib/esm/components/video.js.map +1 -0
- package/lib/esm/components/webchat-settings.d.ts +3 -0
- package/lib/esm/components/webchat-settings.js +69 -0
- package/lib/esm/components/webchat-settings.js.map +1 -0
- package/lib/esm/components/whatsapp-button-list.d.ts +17 -0
- package/lib/esm/components/whatsapp-button-list.js +22 -0
- package/lib/esm/components/whatsapp-button-list.js.map +1 -0
- package/lib/esm/components/whatsapp-template.d.ts +1 -0
- package/lib/esm/components/whatsapp-template.js +20 -0
- package/lib/esm/components/whatsapp-template.js.map +1 -0
- package/lib/esm/constants.d.ts +173 -0
- package/lib/esm/constants.js +194 -0
- package/lib/esm/constants.js.map +1 -0
- package/lib/esm/contexts.d.ts +12 -0
- package/lib/esm/contexts.js +67 -0
- package/lib/esm/contexts.js.map +1 -0
- package/lib/esm/dev-app.d.ts +30 -0
- package/lib/esm/dev-app.js +74 -0
- package/lib/esm/dev-app.js.map +1 -0
- package/lib/esm/index-types.d.ts +128 -0
- package/lib/esm/index-types.js +12 -0
- package/lib/esm/index-types.js.map +1 -0
- package/lib/esm/index.d.ts +11 -0
- package/lib/esm/index.js +12 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/message-utils.d.ts +19 -0
- package/lib/esm/message-utils.js +41 -0
- package/lib/esm/message-utils.js.map +1 -0
- package/lib/esm/msg-to-botonic.d.ts +18 -0
- package/lib/esm/msg-to-botonic.js +135 -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 +8 -0
- package/lib/esm/react-bot.js +29 -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 +7 -0
- package/lib/esm/util/error-boundary.js +28 -0
- package/lib/esm/util/error-boundary.js.map +1 -0
- package/lib/esm/util/index.d.ts +8 -0
- package/lib/esm/util/index.js +9 -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 +27 -0
- package/lib/esm/webchat/actions.js +29 -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 +24 -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 +9 -0
- package/lib/esm/webchat/components/common.js.map +1 -0
- package/lib/esm/webchat/components/conditional-animation.d.ts +1 -0
- package/lib/esm/webchat/components/conditional-animation.js +12 -0
- package/lib/esm/webchat/components/conditional-animation.js.map +1 -0
- package/lib/esm/webchat/components/emoji-picker.d.ts +5 -0
- package/lib/esm/webchat/components/emoji-picker.js +37 -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 +39 -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 +14 -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/typing-indicator.d.ts +1 -0
- package/lib/esm/webchat/components/typing-indicator.js +6 -0
- package/lib/esm/webchat/components/typing-indicator.js.map +1 -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 +79 -0
- package/lib/esm/webchat/header.js.map +1 -0
- package/lib/esm/webchat/hooks/index.d.ts +5 -0
- package/lib/esm/webchat/hooks/index.js +6 -0
- package/lib/esm/webchat/hooks/index.js.map +1 -0
- package/lib/esm/webchat/hooks/use-component-visible.d.ts +8 -0
- package/lib/esm/webchat/hooks/use-component-visible.js +20 -0
- package/lib/esm/webchat/hooks/use-component-visible.js.map +1 -0
- package/lib/esm/webchat/hooks/use-component-will-mount.d.ts +1 -0
- package/lib/esm/webchat/hooks/use-component-will-mount.js +5 -0
- package/lib/esm/webchat/hooks/use-component-will-mount.js.map +1 -0
- package/lib/esm/webchat/hooks/use-previous.d.ts +1 -0
- package/lib/esm/webchat/hooks/use-previous.js +9 -0
- package/lib/esm/webchat/hooks/use-previous.js.map +1 -0
- package/lib/esm/webchat/hooks/use-typing.d.ts +10 -0
- package/lib/esm/webchat/hooks/use-typing.js +26 -0
- package/lib/esm/webchat/hooks/use-typing.js.map +1 -0
- package/lib/esm/webchat/hooks/use-webchat.d.ts +41 -0
- package/lib/esm/webchat/hooks/use-webchat.js +177 -0
- package/lib/esm/webchat/hooks/use-webchat.js.map +1 -0
- package/lib/esm/webchat/index-types.d.ts +62 -0
- package/lib/esm/webchat/index-types.js +2 -0
- package/lib/esm/webchat/index-types.js.map +1 -0
- package/lib/esm/webchat/index.d.ts +4 -0
- package/lib/esm/webchat/index.js +10 -0
- package/lib/esm/webchat/index.js.map +1 -0
- package/lib/esm/webchat/message-list/index.d.ts +1 -0
- package/lib/esm/webchat/message-list/index.js +73 -0
- package/lib/esm/webchat/message-list/index.js.map +1 -0
- package/lib/esm/webchat/message-list/intro-message.d.ts +1 -0
- package/lib/esm/webchat/message-list/intro-message.js +18 -0
- package/lib/esm/webchat/message-list/intro-message.js.map +1 -0
- package/lib/esm/webchat/message-list/scroll-button.d.ts +5 -0
- package/lib/esm/webchat/message-list/scroll-button.js +17 -0
- package/lib/esm/webchat/message-list/scroll-button.js.map +1 -0
- package/lib/esm/webchat/message-list/styles.d.ts +4 -0
- package/lib/esm/webchat/message-list/styles.js +46 -0
- package/lib/esm/webchat/message-list/styles.js.map +1 -0
- package/lib/esm/webchat/message-list/unread-messages-banner.d.ts +6 -0
- package/lib/esm/webchat/message-list/unread-messages-banner.js +16 -0
- package/lib/esm/webchat/message-list/unread-messages-banner.js.map +1 -0
- package/lib/esm/webchat/message-list/use-debounce.d.ts +1 -0
- package/lib/esm/webchat/message-list/use-debounce.js +14 -0
- package/lib/esm/webchat/message-list/use-debounce.js.map +1 -0
- package/lib/esm/webchat/messages-reducer.d.ts +6 -0
- package/lib/esm/webchat/messages-reducer.js +82 -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 +38 -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 +96 -0
- package/lib/esm/webchat/session-view.js.map +1 -0
- package/lib/esm/webchat/trigger-button/index.d.ts +1 -0
- package/lib/esm/webchat/trigger-button/index.js +28 -0
- package/lib/esm/webchat/trigger-button/index.js.map +1 -0
- package/lib/esm/webchat/trigger-button/styles.d.ts +3 -0
- package/lib/esm/webchat/trigger-button/styles.js +36 -0
- package/lib/esm/webchat/trigger-button/styles.js.map +1 -0
- package/lib/esm/webchat/use-storage-state-hook.d.ts +1 -0
- package/lib/esm/webchat/use-storage-state-hook.js +38 -0
- package/lib/esm/webchat/use-storage-state-hook.js.map +1 -0
- package/lib/esm/webchat/webchat-dev.d.ts +7 -0
- package/lib/esm/webchat/webchat-dev.js +56 -0
- package/lib/esm/webchat/webchat-dev.js.map +1 -0
- package/lib/esm/webchat/webchat-reducer.d.ts +6 -0
- package/lib/esm/webchat/webchat-reducer.js +46 -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 +637 -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 +78 -0
- package/lib/esm/webchat/webview.js.map +1 -0
- package/lib/esm/webchat-app.d.ts +99 -0
- package/lib/esm/webchat-app.js +281 -0
- package/lib/esm/webchat-app.js.map +1 -0
- package/lib/esm/webview-app.d.ts +7 -0
- package/lib/esm/webview-app.js +95 -0
- package/lib/esm/webview-app.js.map +1 -0
- package/package.json +2 -2
- package/src/.DS_Store +0 -0
- package/src/components/index-types.ts +1 -0
- package/src/components/{message.jsx → message/index.jsx} +32 -92
- package/src/components/message/message-image.tsx +52 -0
- package/src/components/message/styles.ts +73 -0
- package/src/components/message/timestamps.jsx +62 -0
- package/src/constants.js +2 -0
- package/src/webchat/trigger-button/index.tsx +10 -5
- package/lib/cjs/components/message.js.map +0 -1
- package/lib/cjs/components/timestamps.js +0 -51
- package/lib/cjs/components/timestamps.js.map +0 -1
- package/src/components/timestamps.jsx +0 -68
- /package/lib/cjs/components/{message.d.ts → message/index.d.ts} +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { INPUT, params2queryString } from '@botonic/core';
|
|
3
|
+
import React, { useContext, useState } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { COLORS, WEBCHAT } from '../constants';
|
|
6
|
+
import { WebchatContext } from '../contexts';
|
|
7
|
+
import { renderComponent } from '../util/react';
|
|
8
|
+
import { ButtonsDisabler } from './buttons-disabler';
|
|
9
|
+
const StyledButton = styled.button `
|
|
10
|
+
display: flex;
|
|
11
|
+
width: 100%;
|
|
12
|
+
max-height: 80px;
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
text-align: center;
|
|
15
|
+
align-content: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
padding: 12px 32px;
|
|
18
|
+
font-family: inherit;
|
|
19
|
+
border: none;
|
|
20
|
+
border: 1px solid ${COLORS.SEASHELL_WHITE};
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
outline: 0;
|
|
23
|
+
border-top-right-radius: ${props => props.top || '0px'};
|
|
24
|
+
border-top-left-radius: ${props => props.top || '0px'};
|
|
25
|
+
border-bottom-right-radius: ${props => props.bottom || '0px'};
|
|
26
|
+
border-bottom-left-radius: ${props => props.bottom || '0px'};
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
`;
|
|
29
|
+
export const Button = props => {
|
|
30
|
+
const { webchatState, openWebview, sendPayload, sendInput, getThemeProperty, updateMessage, } = useContext(WebchatContext);
|
|
31
|
+
const [hover, setHover] = useState(false);
|
|
32
|
+
const { theme } = webchatState;
|
|
33
|
+
const { autoDisable, disabledStyle } = ButtonsDisabler.resolveDisabling(webchatState.theme, props);
|
|
34
|
+
const handleClick = event => {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
const type = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.buttonMessageType, INPUT.TEXT);
|
|
37
|
+
if (props.webview)
|
|
38
|
+
openWebview(props.webview, props.params);
|
|
39
|
+
else if (props.path) {
|
|
40
|
+
type == INPUT.POSTBACK
|
|
41
|
+
? sendPayload(`__PATH_PAYLOAD__${props.path}`)
|
|
42
|
+
: sendInput({
|
|
43
|
+
type: INPUT.TEXT,
|
|
44
|
+
data: String(props.children),
|
|
45
|
+
text: String(props.children),
|
|
46
|
+
payload: `__PATH_PAYLOAD__${props.path}`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else if (props.payload) {
|
|
50
|
+
type == INPUT.POSTBACK
|
|
51
|
+
? sendPayload(props.payload)
|
|
52
|
+
: sendInput({
|
|
53
|
+
type: INPUT.TEXT,
|
|
54
|
+
data: String(props.children),
|
|
55
|
+
text: String(props.children),
|
|
56
|
+
payload: props.payload,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else if (props.url) {
|
|
60
|
+
window.open(props.url, props.target || '_blank');
|
|
61
|
+
}
|
|
62
|
+
if (props.onClick)
|
|
63
|
+
props.onClick();
|
|
64
|
+
if (props.setDisabled) {
|
|
65
|
+
props.setDisabled(true);
|
|
66
|
+
const messageToUpdate = webchatState.messagesJSON.filter(m => m.id == props.parentId)[0];
|
|
67
|
+
const updatedMsg = ButtonsDisabler.getUpdatedMessage(messageToUpdate, {
|
|
68
|
+
autoDisable,
|
|
69
|
+
disabledStyle,
|
|
70
|
+
});
|
|
71
|
+
updateMessage(updatedMsg);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const getClassName = (isCustom = false) => {
|
|
75
|
+
if (isCustom) {
|
|
76
|
+
return 'button-custom';
|
|
77
|
+
}
|
|
78
|
+
if (props.payload) {
|
|
79
|
+
return 'button-payload';
|
|
80
|
+
}
|
|
81
|
+
if (props.url) {
|
|
82
|
+
return 'button-url';
|
|
83
|
+
}
|
|
84
|
+
if (props.webview) {
|
|
85
|
+
return 'button-webview';
|
|
86
|
+
}
|
|
87
|
+
if (props.path) {
|
|
88
|
+
return 'button-path';
|
|
89
|
+
}
|
|
90
|
+
return '';
|
|
91
|
+
};
|
|
92
|
+
const renderBrowser = () => {
|
|
93
|
+
const buttonStyle = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.buttonStyle);
|
|
94
|
+
const CustomButton = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.customButton);
|
|
95
|
+
if (CustomButton) {
|
|
96
|
+
return (_jsx("div", Object.assign({ className: getClassName(true), onClick: e => handleClick(e) }, { children: _jsx(CustomButton, { children: props.children }) })));
|
|
97
|
+
}
|
|
98
|
+
const buttonBgColor = hover
|
|
99
|
+
? getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.buttonHoverBackground, COLORS.CONCRETE_WHITE)
|
|
100
|
+
: getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.buttonStyleBackground, COLORS.SOLID_WHITE);
|
|
101
|
+
const buttonTextColor = hover
|
|
102
|
+
? getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.buttonHoverTextColor, COLORS.SOLID_BLACK)
|
|
103
|
+
: getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.buttonStyleColor, COLORS.SOLID_BLACK);
|
|
104
|
+
return (_jsx(StyledButton, Object.assign({ className: getClassName(), theme: theme, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), onClick: e => handleClick(e), style: Object.assign(Object.assign(Object.assign({}, buttonStyle), { color: buttonTextColor, backgroundColor: buttonBgColor }), (props.disabled && autoDisable && disabledStyle)), bottom: props.bottomRadius }, { children: props.children })));
|
|
105
|
+
};
|
|
106
|
+
const renderNode = () => {
|
|
107
|
+
const disabledProps = ButtonsDisabler.constructNodeProps(props);
|
|
108
|
+
if (props.webview) {
|
|
109
|
+
const Webview = props.webview;
|
|
110
|
+
let params = '';
|
|
111
|
+
if (props.params)
|
|
112
|
+
params = params2queryString(props.params);
|
|
113
|
+
return (_jsx("button", Object.assign({ url: `/webviews/${Webview.name}?${params}` }, disabledProps, { children: props.children })));
|
|
114
|
+
}
|
|
115
|
+
else if (props.path) {
|
|
116
|
+
const payload = `__PATH_PAYLOAD__${props.path}`;
|
|
117
|
+
return (_jsx("button", Object.assign({ payload: payload }, disabledProps, { children: props.children })));
|
|
118
|
+
}
|
|
119
|
+
else if (props.payload) {
|
|
120
|
+
return (_jsx("button", Object.assign({ payload: props.payload }, disabledProps, { children: props.children })));
|
|
121
|
+
}
|
|
122
|
+
else if (props.url) {
|
|
123
|
+
return (_jsx("button", Object.assign({ url: props.url, target: props.target }, disabledProps, { children: props.children })));
|
|
124
|
+
}
|
|
125
|
+
else if (props.onClick) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
throw new Error('Button missing payload, path, webviews, url or onClick');
|
|
129
|
+
};
|
|
130
|
+
return renderComponent({ renderBrowser, renderNode });
|
|
131
|
+
};
|
|
132
|
+
Button.serialize = buttonProps => {
|
|
133
|
+
let payload = buttonProps.payload;
|
|
134
|
+
if (buttonProps.path)
|
|
135
|
+
payload = `__PATH_PAYLOAD__${buttonProps.path}`;
|
|
136
|
+
return {
|
|
137
|
+
button: Object.assign({ payload, url: buttonProps.url, target: buttonProps.target, webview: buttonProps.webview && String(buttonProps.webview), title: buttonProps.children && String(buttonProps.children) }, ButtonsDisabler.withDisabledProps(buttonProps)),
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"src/","sources":["components/button.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;;;;;;sBAWZ,MAAM,CAAC,cAAc;;;6BAGd,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK;4BAC5B,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK;gCACvB,KAAK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,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,IAAM,aAAa,cAC5D,KAAK,CAAC,QAAQ,IACR,CACV,CAAA;SACF;aAAM,IAAI,KAAK,CAAC,OAAO,EAAE;YACxB,OAAO,IAAI,CAAA;SACZ;QACD,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;IAC3E,CAAC,CAAA;IAED,OAAO,eAAe,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AAED,MAAM,CAAC,SAAS,GAAG,WAAW,CAAC,EAAE;IAC/B,IAAI,OAAO,GAAG,WAAW,CAAC,OAAO,CAAA;IACjC,IAAI,WAAW,CAAC,IAAI;QAAE,OAAO,GAAG,mBAAmB,WAAW,CAAC,IAAI,EAAE,CAAA;IACrE,OAAO;QACL,MAAM,kBACJ,OAAO,EACP,GAAG,EAAE,WAAW,CAAC,GAAG,EACpB,MAAM,EAAE,WAAW,CAAC,MAAM,EAC1B,OAAO,EAAE,WAAW,CAAC,OAAO,IAAI,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,EAC3D,KAAK,EAAE,WAAW,CAAC,QAAQ,IAAI,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,IACxD,eAAe,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAClD;KACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class ButtonsDisabler {
|
|
2
|
+
static constructBrowserProps(props: any): {
|
|
3
|
+
disabled: any;
|
|
4
|
+
};
|
|
5
|
+
static constructNodeProps(props: any): {
|
|
6
|
+
autodisable: string;
|
|
7
|
+
disabledstyle: string;
|
|
8
|
+
};
|
|
9
|
+
static withDisabledProps(props: any): {
|
|
10
|
+
disabled: any;
|
|
11
|
+
autodisable: any;
|
|
12
|
+
disabledstyle: any;
|
|
13
|
+
};
|
|
14
|
+
static resolveDisabling(theme: any, props: any): {
|
|
15
|
+
autoDisable: any;
|
|
16
|
+
disabledStyle: any;
|
|
17
|
+
};
|
|
18
|
+
static updateChildrenButtons(children: any, additionalProps?: undefined): any;
|
|
19
|
+
static updateButtons(node: any, additionalProps: any): any;
|
|
20
|
+
static getUpdatedMessage(messageToUpdate: any, { autoDisable, disabledStyle }: {
|
|
21
|
+
autoDisable: any;
|
|
22
|
+
disabledStyle: any;
|
|
23
|
+
}): any;
|
|
24
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Button } from '../components/button';
|
|
2
|
+
import { WEBCHAT } from '../constants';
|
|
3
|
+
import { isCarousel } from '../message-utils';
|
|
4
|
+
import { strToBool } from '../util/objects';
|
|
5
|
+
import { deepMapWithIndex } from '../util/react';
|
|
6
|
+
import { _getThemeProperty } from '../util/webchat';
|
|
7
|
+
export class ButtonsDisabler {
|
|
8
|
+
static constructBrowserProps(props) {
|
|
9
|
+
const disabledProps = { disabled: props.disabled };
|
|
10
|
+
if (props.autodisable !== undefined)
|
|
11
|
+
disabledProps.autodisable = strToBool(props.autodisable);
|
|
12
|
+
if (props.disabledstyle !== undefined)
|
|
13
|
+
disabledProps.disabledstyle = props.disabledstyle;
|
|
14
|
+
return disabledProps;
|
|
15
|
+
}
|
|
16
|
+
static constructNodeProps(props) {
|
|
17
|
+
const disabledProps = {};
|
|
18
|
+
if (props.autodisable !== undefined)
|
|
19
|
+
disabledProps.autodisable = String(props.autodisable);
|
|
20
|
+
if (props.disabledstyle !== undefined)
|
|
21
|
+
disabledProps.disabledstyle = JSON.stringify(props.disabledstyle);
|
|
22
|
+
return disabledProps;
|
|
23
|
+
}
|
|
24
|
+
static withDisabledProps(props) {
|
|
25
|
+
return {
|
|
26
|
+
disabled: props.disabled,
|
|
27
|
+
autodisable: props.autodisable,
|
|
28
|
+
disabledstyle: props.disabledstyle,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
static resolveDisabling(theme, props) {
|
|
32
|
+
const getThemeProperty = _getThemeProperty(theme);
|
|
33
|
+
const autoDisable = props.autodisable !== undefined
|
|
34
|
+
? props.autodisable
|
|
35
|
+
: getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.buttonAutoDisable, WEBCHAT.DEFAULTS.BUTTON_AUTO_DISABLE);
|
|
36
|
+
const computedDisabledStyle = props.disabledstyle !== undefined
|
|
37
|
+
? props.disabledstyle
|
|
38
|
+
: getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.buttonDisabledStyle, {});
|
|
39
|
+
const disabledStyle = Object.assign(Object.assign({}, WEBCHAT.DEFAULTS.BUTTON_DISABLED_STYLE), computedDisabledStyle);
|
|
40
|
+
return { autoDisable, disabledStyle };
|
|
41
|
+
}
|
|
42
|
+
static updateChildrenButtons(children, additionalProps = undefined) {
|
|
43
|
+
return deepMapWithIndex(children, n => {
|
|
44
|
+
if (n.type === Button)
|
|
45
|
+
return this.updateButtons(n, additionalProps);
|
|
46
|
+
return n;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
static updateButtons(node, additionalProps) {
|
|
50
|
+
if (!additionalProps)
|
|
51
|
+
additionalProps = {};
|
|
52
|
+
else {
|
|
53
|
+
additionalProps = {
|
|
54
|
+
disabled: node.props.disabled === true
|
|
55
|
+
? node.props.disabled
|
|
56
|
+
: additionalProps.disabled,
|
|
57
|
+
setDisabled: additionalProps.setDisabled,
|
|
58
|
+
parentId: additionalProps.parentId,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return Object.assign(Object.assign({}, node), { props: Object.assign(Object.assign({}, node.props), additionalProps) });
|
|
62
|
+
}
|
|
63
|
+
static getUpdatedMessage(messageToUpdate, { autoDisable, disabledStyle }) {
|
|
64
|
+
const updateMsgButton = button => {
|
|
65
|
+
return Object.assign(Object.assign({}, button), {
|
|
66
|
+
disabled: true,
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
if (isCarousel(messageToUpdate) &&
|
|
70
|
+
messageToUpdate.data &&
|
|
71
|
+
messageToUpdate.data.elements) {
|
|
72
|
+
messageToUpdate.data.elements = messageToUpdate.data.elements.map(e => (Object.assign(Object.assign({}, e), {
|
|
73
|
+
buttons: e.buttons.map(updateMsgButton),
|
|
74
|
+
})));
|
|
75
|
+
return messageToUpdate;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return Object.assign(Object.assign({}, messageToUpdate), {
|
|
79
|
+
buttons: messageToUpdate.buttons.map(updateMsgButton),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=buttons-disabler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buttons-disabler.js","sourceRoot":"src/","sources":["components/buttons-disabler.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEnD,MAAM,OAAO,eAAe;IAC1B,MAAM,CAAC,qBAAqB,CAAC,KAAK;QAChC,MAAM,aAAa,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAA;QAClD,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;YACjC,aAAa,CAAC,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QAC1D,IAAI,KAAK,CAAC,aAAa,KAAK,SAAS;YACnC,aAAa,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAA;QACnD,OAAO,aAAa,CAAA;IACtB,CAAC;IACD,MAAM,CAAC,kBAAkB,CAAC,KAAK;QAC7B,MAAM,aAAa,GAAG,EAAE,CAAA;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AAG,CAAC,eAAe,CAAC;aACtD,EACF;SACF;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function Carousel(props: MessageProps): JSX.Element;
|
|
2
|
+
export namespace Carousel {
|
|
3
|
+
export { serialize };
|
|
4
|
+
}
|
|
5
|
+
declare function serialize(carouselProps: any): {
|
|
6
|
+
type: INPUT;
|
|
7
|
+
elements: any;
|
|
8
|
+
};
|
|
9
|
+
import { INPUT } from '@botonic/core';
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { INPUT, isBrowser } from '@botonic/core';
|
|
3
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import LeftArrow from '../assets/leftArrow.svg';
|
|
6
|
+
import RightArrow from '../assets/rightArrow.svg';
|
|
7
|
+
import { COLORS, WEBCHAT } from '../constants';
|
|
8
|
+
import { WebchatContext } from '../contexts';
|
|
9
|
+
import { resolveImage } from '../util/environment';
|
|
10
|
+
import { StyledScrollbar } from '../webchat/components/styled-scrollbar';
|
|
11
|
+
import { ButtonsDisabler } from './buttons-disabler';
|
|
12
|
+
import { Message } from './message';
|
|
13
|
+
const StyledCarousel = styled.div `
|
|
14
|
+
padding: 10px 0px;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
${props => props.carouselArrowsEnabled && 'overflow-x: auto;'}
|
|
19
|
+
`;
|
|
20
|
+
const StyledItems = styled.div `
|
|
21
|
+
display: flex;
|
|
22
|
+
`;
|
|
23
|
+
const StyledArrowContainer = styled.div `
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: calc(50% - 20px);
|
|
26
|
+
height: 40px;
|
|
27
|
+
width: 25px;
|
|
28
|
+
background: ${COLORS.SILVER};
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
justify-content: ${props => props.justifyContent};
|
|
33
|
+
left: ${props => props.left}px;
|
|
34
|
+
right: ${props => props.right}px;
|
|
35
|
+
border-top-${props => props.arrow}-radius: 30px;
|
|
36
|
+
border-bottom-${props => props.arrow}-radius: 30px;
|
|
37
|
+
`;
|
|
38
|
+
const StyledArrow = styled.img `
|
|
39
|
+
width: 20px;
|
|
40
|
+
height: 20px;
|
|
41
|
+
`;
|
|
42
|
+
const serialize = carouselProps => {
|
|
43
|
+
let carouselChildren = carouselProps.children;
|
|
44
|
+
if (!Array.isArray(carouselChildren))
|
|
45
|
+
carouselChildren = [carouselChildren];
|
|
46
|
+
return {
|
|
47
|
+
type: INPUT.CAROUSEL,
|
|
48
|
+
elements: carouselChildren.map(e => e && e.type && e.type.serialize && e.type.serialize(e.props)),
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @param {MessageProps} props
|
|
54
|
+
* @returns {JSX.Element}
|
|
55
|
+
*/
|
|
56
|
+
export const Carousel = props => {
|
|
57
|
+
const { getThemeProperty } = useContext(WebchatContext);
|
|
58
|
+
let content = props.children;
|
|
59
|
+
const scrollbarOptions = Object.assign({ enable: true, autoHide: true }, getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.scrollbar));
|
|
60
|
+
const [hasLeftArrow, setLeftArrow] = useState(false);
|
|
61
|
+
const [hasRightArrow, setRightArrow] = useState(true);
|
|
62
|
+
const carouselRef = useRef(null);
|
|
63
|
+
const CustomCarouselLeftArrow = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.customCarouselLeftArrow, undefined);
|
|
64
|
+
const CustomCarouselRightArrow = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.customCarouselRightArrow, undefined);
|
|
65
|
+
const carouselArrowsEnabled = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.enableCarouselArrows, true);
|
|
66
|
+
const scrollCarouselBy = value => {
|
|
67
|
+
carouselRef.current.scrollBy({
|
|
68
|
+
left: value,
|
|
69
|
+
behavior: 'smooth',
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const setArrowsVisibility = event => {
|
|
73
|
+
const carousel = event.currentTarget;
|
|
74
|
+
const maxRightScroll = carousel.scrollWidth -
|
|
75
|
+
carousel.offsetWidth -
|
|
76
|
+
WEBCHAT.DEFAULTS.ELEMENT_MARGIN_RIGHT;
|
|
77
|
+
setLeftArrow(carousel.scrollLeft !== 0);
|
|
78
|
+
setRightArrow(carousel.scrollLeft < maxRightScroll);
|
|
79
|
+
};
|
|
80
|
+
const getArrows = () => {
|
|
81
|
+
const scrollBy = WEBCHAT.DEFAULTS.ELEMENT_WIDTH + WEBCHAT.DEFAULTS.ELEMENT_MARGIN_RIGHT;
|
|
82
|
+
return (_jsxs(_Fragment, { children: [hasLeftArrow &&
|
|
83
|
+
(CustomCarouselLeftArrow ? (_jsx(CustomCarouselLeftArrow, { scrollCarouselBy: scrollCarouselBy })) : (_jsx(StyledArrowContainer, Object.assign({ left: 0, arrow: 'right', justifyContent: 'flex-start', onClick: () => scrollCarouselBy(-scrollBy) }, { children: _jsx(StyledArrow, { src: resolveImage(LeftArrow) }) })))), hasRightArrow &&
|
|
84
|
+
(CustomCarouselRightArrow ? (_jsx(CustomCarouselRightArrow, { scrollCarouselBy: scrollCarouselBy })) : (_jsx(StyledArrowContainer, Object.assign({ right: 0, arrow: 'left', justifyContent: 'flex-end', onClick: () => scrollCarouselBy(scrollBy) }, { children: _jsx(StyledArrow, { src: resolveImage(RightArrow) }) }))))] }));
|
|
85
|
+
};
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
const carousel = carouselRef.current;
|
|
88
|
+
if (carousel && carousel.addEventListener) {
|
|
89
|
+
carousel.addEventListener('scroll', setArrowsVisibility, false);
|
|
90
|
+
}
|
|
91
|
+
else if (carousel && carousel.attachEvent) {
|
|
92
|
+
carousel.attachEvent('scroll', setArrowsVisibility);
|
|
93
|
+
}
|
|
94
|
+
}, [carouselRef.current]);
|
|
95
|
+
const carouselProps = Object.assign(Object.assign({}, props), { children: ButtonsDisabler.updateChildrenButtons(props.children) });
|
|
96
|
+
if (isBrowser()) {
|
|
97
|
+
content = (_jsx(StyledScrollbar, Object.assign({ scrollbar: scrollbarOptions, autoHide: scrollbarOptions.autoHide }, { children: _jsxs(StyledCarousel, Object.assign({ ref: carouselRef, carouselArrowsEnabled: carouselArrowsEnabled }, { children: [_jsx(StyledItems, { children: carouselProps.children }), carouselArrowsEnabled && getArrows()] })) })));
|
|
98
|
+
}
|
|
99
|
+
return (_jsx(Message, Object.assign({ style: { width: '85%', padding: 0, backgroundColor: COLORS.TRANSPARENT }, blob: false, json: serialize(carouselProps), type: INPUT.CAROUSEL }, carouselProps, { children: content })));
|
|
100
|
+
};
|
|
101
|
+
Carousel.serialize = serialize;
|
|
102
|
+
//# sourceMappingURL=carousel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.js","sourceRoot":"src/","sources":["components/carousel.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACtE,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,SAAS,MAAM,yBAAyB,CAAA;AAC/C,OAAO,UAAU,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,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CAAC,WAAW,EAAE;YAC3C,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAA;SACpD;IACH,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IAEzB,MAAM,aAAa,mCACd,KAAK,KACR,QAAQ,EAAE,eAAe,CAAC,qBAAqB,CAAC,KAAK,CAAC,QAAQ,CAAC,GAChE,CAAA;IAED,IAAI,SAAS,EAAE,EAAE;QACf,OAAO,GAAG,CACR,KAAC,eAAe,kBACd,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,gBAEnC,MAAC,cAAc,kBACb,GAAG,EAAE,WAAW,EAChB,qBAAqB,EAAE,qBAAqB,iBAE5C,KAAC,WAAW,cAAE,aAAa,CAAC,QAAQ,GAAe,EAClD,qBAAqB,IAAI,SAAS,EAAE,KACtB,IACD,CACnB,CAAA;KACF;IAED,OAAO,CACL,KAAC,OAAO,kBACN,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,EACxE,IAAI,EAAE,KAAK,EACX,IAAI,EAAE,SAAS,CAAC,aAAa,CAAC,EAC9B,IAAI,EAAE,KAAK,CAAC,QAAQ,IAChB,aAAa,cAEhB,OAAO,IACA,CACX,CAAA;AACH,CAAC,CAAA;AAED,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the name of an element (instantiated component)
|
|
3
|
+
* @param {React.Element} component
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*/
|
|
6
|
+
export function getElementName(component: React.Element): string;
|
|
7
|
+
/**
|
|
8
|
+
* Get the name of a component TYPE
|
|
9
|
+
* @param {React.ComponentType} component
|
|
10
|
+
* @returns {string}
|
|
11
|
+
*/
|
|
12
|
+
export function getComponentTypeName(component: React.ComponentType): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the name of an element (instantiated component)
|
|
3
|
+
* @param {React.Element} component
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*/
|
|
6
|
+
export function getElementName(component) {
|
|
7
|
+
return component.type.name;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get the name of a component TYPE
|
|
11
|
+
* @param {React.ComponentType} component
|
|
12
|
+
* @returns {string}
|
|
13
|
+
*/
|
|
14
|
+
export function getComponentTypeName(component) {
|
|
15
|
+
return component.displayName || component.name || 'Component';
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"src/","sources":["components/components.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,SAAS;IACtC,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA;AAC5B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAS;IAC5C,OAAO,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAAW,CAAA;AAC/D,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function customMessage({ name, component: CustomMessageComponent, defaultProps, errorBoundary: ErrorBoundary, }: {
|
|
2
|
+
name: any;
|
|
3
|
+
component: any;
|
|
4
|
+
defaultProps?: {} | undefined;
|
|
5
|
+
errorBoundary?: (({ children }: {
|
|
6
|
+
children: any;
|
|
7
|
+
}) => any) | undefined;
|
|
8
|
+
}): {
|
|
9
|
+
(props: any): JSX.Element;
|
|
10
|
+
customTypeName: any;
|
|
11
|
+
deserialize(msg: any): JSX.Element;
|
|
12
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { INPUT } from '@botonic/core';
|
|
4
|
+
import merge from 'lodash.merge';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { SENDERS } from '../index-types';
|
|
7
|
+
import { createErrorBoundary } from '../util/error-boundary';
|
|
8
|
+
import { warnDeprecatedProps } from '../util/logs';
|
|
9
|
+
import { mapObjectNonBooleanValues } from '../util/react';
|
|
10
|
+
import { Message } from './message';
|
|
11
|
+
import { Reply } from './reply';
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param name as it appears at ThemeProps' message.customTypes key
|
|
15
|
+
* @param CustomMessageComponent
|
|
16
|
+
* @param defaultProps Props for the wrapper Message
|
|
17
|
+
* @param ErrorBoundary to recover in case it fails
|
|
18
|
+
*/
|
|
19
|
+
export const customMessage = ({ name, component: CustomMessageComponent, defaultProps = {}, errorBoundary: ErrorBoundary = createErrorBoundary(), }) => {
|
|
20
|
+
const CustomMessage = props => {
|
|
21
|
+
warnDeprecatedProps(defaultProps, 'customMessage:');
|
|
22
|
+
if (defaultProps.sentBy === SENDERS.user)
|
|
23
|
+
defaultProps.ack = 1;
|
|
24
|
+
return (_jsx(Message, Object.assign({}, merge(mapObjectNonBooleanValues(defaultProps), props), { type: INPUT.CUSTOM })));
|
|
25
|
+
};
|
|
26
|
+
const splitChildren = props => {
|
|
27
|
+
const { children } = props;
|
|
28
|
+
const isReply = e => e.type === Reply;
|
|
29
|
+
try {
|
|
30
|
+
if (!Array.isArray(children) && !isReply(children)) {
|
|
31
|
+
return { replies: null, childrenWithoutReplies: children };
|
|
32
|
+
}
|
|
33
|
+
const childrenArray = React.Children.toArray(children);
|
|
34
|
+
const replies = childrenArray.filter(isReply);
|
|
35
|
+
const childrenWithoutReplies = childrenArray.filter(e => !isReply(e));
|
|
36
|
+
return {
|
|
37
|
+
replies: replies,
|
|
38
|
+
childrenWithoutReplies,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
return { replies: null, childrenWithoutReplies: children };
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const WrappedComponent = props => {
|
|
46
|
+
const { id, children } = props, customMessageProps = __rest(props, ["id", "children"]);
|
|
47
|
+
const { replies, childrenWithoutReplies } = splitChildren(props);
|
|
48
|
+
return (_jsxs(CustomMessage, Object.assign({ id: id, json: Object.assign(Object.assign({}, customMessageProps), { id, children: childrenWithoutReplies, customTypeName: name }) }, { children: [_jsx(ErrorBoundary, Object.assign({}, customMessageProps, { children: _jsx(CustomMessageComponent, Object.assign({}, customMessageProps, { children: childrenWithoutReplies })) }), 'errorBoundary'), replies] })));
|
|
49
|
+
};
|
|
50
|
+
WrappedComponent.customTypeName = name;
|
|
51
|
+
// eslint-disable-next-line react/display-name
|
|
52
|
+
WrappedComponent.deserialize = msg => (_jsx(WrappedComponent, Object.assign({ id: msg.id, json: msg.data }, msg.data), msg.key));
|
|
53
|
+
return WrappedComponent;
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=custom-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-message.js","sourceRoot":"src/","sources":["components/custom-message.jsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,MAAM,cAAc,CAAA;AAChC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC5B,IAAI,EACJ,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AsB,EAAE,QAAQ,EAAE,CAAA;SAC3D;IACH,CAAC,CAAA;IAED,MAAM,gBAAgB,GAAG,KAAK,CAAC,EAAE;QAC/B,MAAM,EAAE,EAAE,EAAE,QAAQ,KAA4B,KAAK,EAA5B,kBAAkB,UAAK,KAAK,EAA/C,kBAAuC,CAAQ,CAAA;QACrD,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAA;QAChE,OAAO,CACL,MAAC,aAAa,kBACZ,EAAE,EAAE,EAAE,EACN,IAAI,kCACC,kBAAkB,KACrB,EAAE,EACF,QAAQ,EAAE,sBAAsB,EAChC,cAAc,EAAE,IAAI,oBAGtB,KAAC,aAAa,oBAA2B,kBAAkB,cACzD,KAAC,sBAAsB,oBAAK,kBAAkB,cAC3C,sBAAsB,IACA,KAHP,eAAe,CAInB,EACf,OAAO,KACM,CACjB,CAAA;IACH,CAAC,CAAA;IACD,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAA;IACtC,8CAA8C;IAC9C,gBAAgB,CAAC,WAAW,GAAG,GAAG,CAAC,EAAE,CAAC,CACpC,KAAC,gBAAgB,kBAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAgB,IAAI,EAAE,GAAG,CAAC,IAAI,IAAM,GAAG,CAAC,IAAI,GAArC,GAAG,CAAC,GAAG,CAAkC,CAC7E,CAAA;IACD,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { INPUT, isBrowser } from '@botonic/core';
|
|
3
|
+
import React, { useContext } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { ROLES, WEBCHAT } from '../constants';
|
|
6
|
+
import { WebchatContext } from '../contexts';
|
|
7
|
+
import { staticAsset } from '../util/environment';
|
|
8
|
+
import { Message } from './message';
|
|
9
|
+
const StyledButton = styled.a `
|
|
10
|
+
display: block;
|
|
11
|
+
height: 25px;
|
|
12
|
+
background-color: #f0f0f0;
|
|
13
|
+
padding: 10px;
|
|
14
|
+
text-align: center;
|
|
15
|
+
border-radius: 5px;
|
|
16
|
+
color: black;
|
|
17
|
+
font-weight: bold;
|
|
18
|
+
line-height: 25px;
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
border: 1px solid black;
|
|
21
|
+
opacity: 0.9;
|
|
22
|
+
&:hover {
|
|
23
|
+
opacity: 1;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const serialize = documentProps => {
|
|
27
|
+
return { document: documentProps.src };
|
|
28
|
+
};
|
|
29
|
+
export const Document = props => {
|
|
30
|
+
props = Object.assign(Object.assign({}, props), { src: staticAsset(props.src) });
|
|
31
|
+
let content = props.children;
|
|
32
|
+
const { getThemeProperty } = useContext(WebchatContext);
|
|
33
|
+
let documentDownload = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.documentDownload, {});
|
|
34
|
+
if (typeof documentDownload === 'function')
|
|
35
|
+
documentDownload = documentDownload(props.from);
|
|
36
|
+
if (isBrowser()) {
|
|
37
|
+
content = (_jsx(StyledButton, Object.assign({ href: props.src, target: '_blank', rel: 'noreferrer', style: Object.assign({}, documentDownload.style) }, { children: documentDownload.text || 'Download' })));
|
|
38
|
+
}
|
|
39
|
+
return (_jsx(Message, Object.assign({ role: ROLES.DOCUMENT_MESSAGE, json: serialize(props) }, props, { type: INPUT.DOCUMENT }, { children: content })));
|
|
40
|
+
};
|
|
41
|
+
Document.serialize = serialize;
|
|
42
|
+
//# sourceMappingURL=document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"src/","sources":["components/document.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,MAAM,M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AAE,SAAS,CAAC,KAAK,CAAC,IAClB,KAAK,IACT,IAAI,EAAE,KAAK,CAAC,QAAQ,gBAEnB,OAAO,IACA,CACX,CAAA;AACH,CAAC,CAAA;AAED,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { COLORS, WEBCHAT } from '../constants';
|
|
5
|
+
import { renderComponent } from '../util/react';
|
|
6
|
+
const ElementContainer = styled.div `
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
width: ${WEBCHAT.DEFAULTS.ELEMENT_WIDTH}px;
|
|
10
|
+
margin-right: ${WEBCHAT.DEFAULTS.ELEMENT_MARGIN_RIGHT}px;
|
|
11
|
+
border-radius: 6px;
|
|
12
|
+
border: 1px solid ${COLORS.SEASHELL_WHITE};
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
`;
|
|
16
|
+
export const Element = props => {
|
|
17
|
+
const renderBrowser = () => (_jsx(ElementContainer, { children: props.children }));
|
|
18
|
+
const renderNode = () => _jsx("element", { children: props.children });
|
|
19
|
+
return renderComponent({ renderBrowser, renderNode });
|
|
20
|
+
};
|
|
21
|
+
Element.serialize = elementProps => {
|
|
22
|
+
const element = Object.assign({}, ...elementProps.children
|
|
23
|
+
.filter(c => c && c.type && c.type.name != 'Button')
|
|
24
|
+
.map(c => c.type.serialize && c.type.serialize(c.props)));
|
|
25
|
+
// When we are serializer buttons from backend, we are receiving the data
|
|
26
|
+
// as an array of buttons, so we have to keep robust with serve and deal with arrays
|
|
27
|
+
element.buttons = [
|
|
28
|
+
...elementProps.children
|
|
29
|
+
.filter(c => {
|
|
30
|
+
if (c instanceof Array)
|
|
31
|
+
return true;
|
|
32
|
+
return c && c.type && c.type.name == 'Button';
|
|
33
|
+
})
|
|
34
|
+
.map(b => {
|
|
35
|
+
if (b instanceof Array) {
|
|
36
|
+
return b.map(bb => bb &&
|
|
37
|
+
bb.type &&
|
|
38
|
+
bb.type.serialize &&
|
|
39
|
+
bb.type.serialize(bb.props).button);
|
|
40
|
+
}
|
|
41
|
+
return (b && b.type && b.type.serialize && b.type.serialize(b.props).button);
|
|
42
|
+
}),
|
|
43
|
+
];
|
|
44
|
+
// When we have the buttons from backend, we have all buttons inside an array on the first position
|
|
45
|
+
// of another array in element['buttons'] we want that element['buttons'] to be an array of buttons,
|
|
46
|
+
// not an array of another array of buttons
|
|
47
|
+
if (element.buttons[0] instanceof Array)
|
|
48
|
+
element.buttons = element.buttons[0];
|
|
49
|
+
return element;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"src/","sources":["components/element.jsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;;;WAGxB,OAAO,CAAC,QAAQ,CAAC,aAAa;kBACvB,OAAO,CAAC,QAAQ,CAAC,oBAAoB;;sBAEjC,MAAM,CAAC,cAAc;;;CAG1C,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAC,EAAE;IAC7B,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,CAC1B,KAAC,gBAAgB,cAAE,KAAK,CAAC,QAAQ,GAAoB,CACtD,CAAA;IAED,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,4BAAU,KAAK,CAAC,QAAQ,GAAW,CAAA;IAE5D,OAAO,eAAe,CAAC,EAAE,aAAa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