@botpress/webchat 0.5.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.d.ts +10 -0
- package/dist/Utils/colors.d.ts +18 -0
- package/dist/Utils/eventEmitter.d.ts +12 -0
- package/dist/Utils/index.d.ts +2 -0
- package/dist/client/MessagingClient.d.ts +27 -0
- package/dist/client/adapters/Audio.d.ts +19 -0
- package/dist/client/adapters/Card.d.ts +188 -0
- package/dist/client/adapters/Carousel.d.ts +147 -0
- package/dist/client/adapters/Choice.d.ts +45 -0
- package/dist/client/adapters/Dropdown.d.ts +46 -0
- package/dist/client/adapters/File.d.ts +19 -0
- package/dist/client/adapters/Image.d.ts +19 -0
- package/dist/client/adapters/Location.d.ts +27 -0
- package/dist/client/adapters/Message.d.ts +433 -0
- package/dist/client/adapters/Text.d.ts +20 -0
- package/dist/client/adapters/Utils.d.ts +5 -0
- package/dist/client/adapters/Video.d.ts +19 -0
- package/dist/client/adapters/Voice.d.ts +15 -0
- package/dist/client/adapters/index.d.ts +12 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/components/Avatar.d.ts +6 -0
- package/dist/components/Block.d.ts +4 -0
- package/dist/components/Composer.d.ts +12 -14
- package/dist/components/Container.d.ts +2 -12
- package/dist/components/Header.d.ts +36 -26
- package/dist/components/LoadingIndicator.d.ts +2 -0
- package/dist/components/Message.d.ts +7 -0
- package/dist/components/MessageList.d.ts +2 -0
- package/dist/components/Modal.d.ts +17 -0
- package/dist/components/RestartConversation.d.ts +5 -0
- package/dist/components/Webchat.d.ts +6 -0
- package/dist/components/dev-tools/DevTools.d.ts +1 -0
- package/dist/components/dev-tools/configuration.d.ts +2 -0
- package/dist/components/dev-tools/helpers.d.ts +5 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/renderers/Audio.d.ts +3 -0
- package/dist/components/renderers/Bubble.d.ts +5 -0
- package/dist/components/renderers/Button.d.ts +4 -0
- package/dist/components/renderers/Carousel.d.ts +3 -0
- package/dist/components/renderers/Column.d.ts +5 -0
- package/dist/components/renderers/Dropdown.d.ts +5 -0
- package/dist/components/renderers/File.d.ts +3 -0
- package/dist/components/renderers/Image.d.ts +3 -0
- package/dist/components/renderers/Location.d.ts +3 -0
- package/dist/components/renderers/Row.d.ts +5 -0
- package/dist/components/renderers/Text.d.ts +4 -0
- package/dist/components/renderers/Video.d.ts +3 -0
- package/dist/components/renderers/index.d.ts +2 -0
- package/dist/contexts/ComposerContext.d.ts +8 -0
- package/dist/contexts/MessageContext.d.ts +8 -0
- package/dist/contexts/ModalContext.d.ts +14 -0
- package/dist/contexts/WebchatContext.d.ts +56 -0
- package/dist/contexts/index.d.ts +4 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/useImageSize.d.ts +2 -0
- package/dist/hooks/useRefresh.d.ts +10 -0
- package/dist/hooks/useWebchatStore.d.ts +30 -0
- package/dist/index.d.ts +3 -17
- package/dist/index.js +43569 -48
- package/dist/index.umd.cjs +702 -0
- package/dist/main.d.ts +11 -13
- package/dist/providers/ModalProvider.d.ts +8 -0
- package/dist/providers/WebchatProvider.d.ts +13 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/theme.d.ts +3371 -0
- package/dist/services/clipboard.d.ts +1 -0
- package/dist/services/images.d.ts +2 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/toast.d.ts +17 -0
- package/dist/themes/dawn.d.ts +2 -0
- package/dist/themes/duskTheme.d.ts +2 -0
- package/dist/themes/eggplant.d.ts +2 -0
- package/dist/themes/galaxy.d.ts +2 -0
- package/dist/themes/index.d.ts +6 -0
- package/dist/themes/midnight.d.ts +2 -0
- package/dist/themes/prism.d.ts +2 -0
- package/dist/twind.config.d.ts +9 -0
- package/dist/types/block-type.d.ts +93 -0
- package/dist/types/image.d.ts +11 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/vite.svg +1 -0
- package/index.html +18 -0
- package/package.json +60 -48
- package/public/vite.svg +1 -0
- package/src/App.tsx +41 -0
- package/src/Utils/colors.ts +45 -0
- package/src/Utils/eventEmitter.ts +31 -0
- package/src/Utils/index.ts +2 -0
- package/src/assets/check-circle-bold.svg +5 -0
- package/src/assets/chevron-up.svg +3 -0
- package/src/assets/file-05.svg +6 -0
- package/src/assets/globe-02.svg +6 -0
- package/src/assets/help-circle.svg +3 -0
- package/src/assets/info-circle.svg +3 -0
- package/src/assets/lock-01.svg +4 -0
- package/src/assets/mail-01.svg +6 -0
- package/src/assets/minus-circle.svg +3 -0
- package/src/assets/phone.svg +6 -0
- package/src/assets/send-03.svg +4 -0
- package/src/assets/share-04.svg +5 -0
- package/src/assets/slash-circle-01.svg +3 -0
- package/src/assets/x-circle-bold.svg +5 -0
- package/src/assets/x-close.svg +3 -0
- package/src/assets/x.svg +3 -0
- package/src/client/MessagingClient.ts +87 -0
- package/src/client/adapters/Audio.ts +10 -0
- package/src/client/adapters/Card.ts +104 -0
- package/src/client/adapters/Carousel.ts +11 -0
- package/src/client/adapters/Choice.ts +48 -0
- package/src/client/adapters/Dropdown.ts +39 -0
- package/src/client/adapters/File.ts +10 -0
- package/src/client/adapters/Image.ts +10 -0
- package/src/client/adapters/Location.ts +18 -0
- package/src/client/adapters/Message.ts +26 -0
- package/src/client/adapters/Text.ts +11 -0
- package/src/client/adapters/Utils.ts +11 -0
- package/src/client/adapters/Video.ts +10 -0
- package/src/client/adapters/Voice.ts +9 -0
- package/src/client/adapters/index.ts +12 -0
- package/src/client/index.ts +2 -0
- package/src/components/Avatar.tsx +22 -0
- package/src/components/Block.tsx +17 -0
- package/src/components/Composer.tsx +115 -0
- package/src/components/Container.tsx +17 -0
- package/src/components/Header.tsx +141 -0
- package/src/components/LoadingIndicator.tsx +15 -0
- package/src/components/Message.tsx +52 -0
- package/src/components/MessageList.tsx +75 -0
- package/src/components/Modal.tsx +49 -0
- package/src/components/RestartConversation.tsx +52 -0
- package/src/components/Webchat.tsx +68 -0
- package/src/components/dev-tools/DevTools.tsx +496 -0
- package/src/components/dev-tools/configuration.tsx +27 -0
- package/src/components/dev-tools/helpers.ts +21 -0
- package/src/components/index.ts +12 -0
- package/src/components/renderers/Audio.tsx +11 -0
- package/src/components/renderers/Bubble.tsx +12 -0
- package/src/components/renderers/Button.tsx +59 -0
- package/src/components/renderers/Carousel.tsx +51 -0
- package/src/components/renderers/Column.tsx +22 -0
- package/src/components/renderers/Dropdown.tsx +170 -0
- package/src/components/renderers/File.tsx +13 -0
- package/src/components/renderers/Image.tsx +63 -0
- package/src/components/renderers/Location.tsx +16 -0
- package/src/components/renderers/Row.tsx +22 -0
- package/src/components/renderers/Text.tsx +32 -0
- package/src/components/renderers/Video.tsx +11 -0
- package/src/components/renderers/index.ts +28 -0
- package/src/contexts/ComposerContext.ts +16 -0
- package/src/contexts/MessageContext.ts +16 -0
- package/src/contexts/ModalContext.ts +19 -0
- package/src/contexts/WebchatContext.ts +61 -0
- package/src/contexts/index.ts +4 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useImageSize.ts +30 -0
- package/src/hooks/useRefresh.ts +33 -0
- package/src/hooks/useWebchatStore.ts +45 -0
- package/src/index.css +18 -0
- package/src/index.ts +3 -0
- package/src/main.tsx +33 -0
- package/src/providers/ModalProvider.tsx +35 -0
- package/src/providers/WebchatProvider.tsx +107 -0
- package/src/providers/index.ts +2 -0
- package/src/schemas/index.ts +1 -0
- package/src/schemas/theme.ts +188 -0
- package/src/services/clipboard.ts +8 -0
- package/src/services/images.ts +39 -0
- package/src/services/index.ts +3 -0
- package/src/services/toast.tsx +71 -0
- package/src/themes/dawn.ts +277 -0
- package/src/themes/duskTheme.ts +349 -0
- package/src/themes/eggplant.ts +353 -0
- package/src/themes/galaxy.ts +323 -0
- package/src/themes/index.ts +6 -0
- package/src/themes/midnight.ts +276 -0
- package/src/themes/prism.ts +349 -0
- package/src/twind.config.ts +31 -0
- package/src/types/block-type.ts +150 -0
- package/src/types/image.ts +10 -0
- package/src/types/index.ts +2 -0
- package/src/vite-env.d.ts +1 -0
- package/tailwind.config.js +0 -0
- package/tsconfig.json +30 -0
- package/tsconfig.node.json +10 -0
- package/vite.config.ts +31 -0
- package/README.md +0 -31
- package/assets/fonts/roboto/roboto.woff2 +0 -0
- package/assets/fonts/roboto/roboto500.woff2 +0 -0
- package/assets/fonts/roboto.css +0 -128
- package/assets/notification.mp3 +0 -0
- package/dist/components/Composer.js +0 -118
- package/dist/components/Container.js +0 -62
- package/dist/components/ConversationList.d.ts +0 -10
- package/dist/components/ConversationList.js +0 -41
- package/dist/components/Footer.d.ts +0 -3
- package/dist/components/Footer.js +0 -21
- package/dist/components/Header.js +0 -181
- package/dist/components/VoiceRecorder.d.ts +0 -10
- package/dist/components/VoiceRecorder.js +0 -137
- package/dist/components/common/Avatar/index.d.ts +0 -9
- package/dist/components/common/Avatar/index.js +0 -13
- package/dist/components/common/BotInfo/index.d.ts +0 -10
- package/dist/components/common/BotInfo/index.js +0 -102
- package/dist/components/common/BotInfo/style.scss +0 -88
- package/dist/components/common/ConfirmDialog/index.d.ts +0 -11
- package/dist/components/common/ConfirmDialog/index.js +0 -78
- package/dist/components/common/ConfirmDialog/style.module.scss +0 -48
- package/dist/components/common/Dialog/index.d.ts +0 -17
- package/dist/components/common/Dialog/index.js +0 -57
- package/dist/components/common/Dialog/style.module.scss +0 -29
- package/dist/components/common/ToolTip/index.d.ts +0 -10
- package/dist/components/common/ToolTip/index.js +0 -163
- package/dist/components/common/ToolTip/style.module.scss +0 -108
- package/dist/components/common/ToolTip/utils.d.ts +0 -15
- package/dist/components/common/ToolTip/utils.js +0 -78
- package/dist/components/common/variables.scss +0 -38
- package/dist/components/messages/InlineFeedback.d.ts +0 -11
- package/dist/components/messages/InlineFeedback.js +0 -56
- package/dist/components/messages/Message.d.ts +0 -11
- package/dist/components/messages/Message.js +0 -106
- package/dist/components/messages/MessageGroup.d.ts +0 -23
- package/dist/components/messages/MessageGroup.js +0 -63
- package/dist/components/messages/MessageList.d.ts +0 -10
- package/dist/components/messages/MessageList.js +0 -154
- package/dist/core/api.d.ts +0 -23
- package/dist/core/api.js +0 -117
- package/dist/core/constants.d.ts +0 -14
- package/dist/core/constants.js +0 -29
- package/dist/core/socket.d.ts +0 -14
- package/dist/core/socket.js +0 -57
- package/dist/declaration.d.ts +0 -1
- package/dist/declaration.js +0 -1
- package/dist/fonts/roboto.d.ts +0 -4
- package/dist/fonts/roboto.js +0 -9
- package/dist/globals.d.ts +0 -7
- package/dist/globals.js +0 -2
- package/dist/icons/Add.d.ts +0 -6
- package/dist/icons/Add.js +0 -10
- package/dist/icons/Cancel.d.ts +0 -5
- package/dist/icons/Cancel.js +0 -10
- package/dist/icons/Chat.d.ts +0 -6
- package/dist/icons/Chat.js +0 -9
- package/dist/icons/Close.d.ts +0 -3
- package/dist/icons/Close.js +0 -10
- package/dist/icons/Delete.d.ts +0 -3
- package/dist/icons/Delete.js +0 -11
- package/dist/icons/Download.d.ts +0 -3
- package/dist/icons/Download.js +0 -10
- package/dist/icons/Email.d.ts +0 -3
- package/dist/icons/Email.js +0 -8
- package/dist/icons/Information.d.ts +0 -3
- package/dist/icons/Information.js +0 -12
- package/dist/icons/List.d.ts +0 -3
- package/dist/icons/List.js +0 -15
- package/dist/icons/Microphone.d.ts +0 -5
- package/dist/icons/Microphone.js +0 -12
- package/dist/icons/Phone.d.ts +0 -3
- package/dist/icons/Phone.js +0 -8
- package/dist/icons/Reload.d.ts +0 -3
- package/dist/icons/Reload.js +0 -10
- package/dist/icons/ThumbsDown.d.ts +0 -3
- package/dist/icons/ThumbsDown.js +0 -11
- package/dist/icons/ThumbsUp.d.ts +0 -3
- package/dist/icons/ThumbsUp.js +0 -11
- package/dist/icons/Website.d.ts +0 -3
- package/dist/icons/Website.js +0 -8
- package/dist/main.js +0 -336
- package/dist/store/composer.d.ts +0 -17
- package/dist/store/composer.js +0 -98
- package/dist/store/index.d.ts +0 -82
- package/dist/store/index.js +0 -576
- package/dist/store/view.d.ts +0 -61
- package/dist/store/view.js +0 -361
- package/dist/translations/ar.json +0 -30
- package/dist/translations/de.json +0 -32
- package/dist/translations/en.json +0 -40
- package/dist/translations/es.json +0 -19
- package/dist/translations/fr.json +0 -40
- package/dist/translations/index.d.ts +0 -9
- package/dist/translations/index.js +0 -95
- package/dist/translations/it.json +0 -38
- package/dist/translations/pt.json +0 -19
- package/dist/translations/ru.json +0 -24
- package/dist/translations/uk.json +0 -24
- package/dist/typings.d.ts +0 -378
- package/dist/typings.js +0 -2
- package/dist/utils/analytics.d.ts +0 -5
- package/dist/utils/analytics.js +0 -37
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.js +0 -27
- package/dist/utils/storage.d.ts +0 -16
- package/dist/utils/storage.js +0 -129
- package/dist/utils/webchatEvents.d.ts +0 -2
- package/dist/utils/webchatEvents.js +0 -14
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const mobx_1 = require("mobx");
|
|
16
|
-
const mobx_react_1 = require("mobx-react");
|
|
17
|
-
const react_1 = __importDefault(require("react"));
|
|
18
|
-
const Close_1 = __importDefault(require("../icons/Close"));
|
|
19
|
-
const Delete_1 = __importDefault(require("../icons/Delete"));
|
|
20
|
-
const Download_1 = __importDefault(require("../icons/Download"));
|
|
21
|
-
const Information_1 = __importDefault(require("../icons/Information"));
|
|
22
|
-
const List_1 = __importDefault(require("../icons/List"));
|
|
23
|
-
const Avatar_1 = __importDefault(require("./common/Avatar"));
|
|
24
|
-
const ConfirmDialog_1 = __importDefault(require("./common/ConfirmDialog"));
|
|
25
|
-
class Header extends react_1.default.Component {
|
|
26
|
-
constructor() {
|
|
27
|
-
super(...arguments);
|
|
28
|
-
this.btnEls = {};
|
|
29
|
-
this.state = {
|
|
30
|
-
currentFocusIdx: undefined,
|
|
31
|
-
showingOption: false
|
|
32
|
-
};
|
|
33
|
-
this.onBlur = () => {
|
|
34
|
-
this.setCurrentFocusIdx(undefined);
|
|
35
|
-
};
|
|
36
|
-
this.setCurrentFocusIdx = (currentFocusIdx) => {
|
|
37
|
-
this.setState({ currentFocusIdx });
|
|
38
|
-
};
|
|
39
|
-
this.changeButtonFocus = (step) => {
|
|
40
|
-
let idx = this.state.currentFocusIdx !== null ? this.state.currentFocusIdx + step : 0;
|
|
41
|
-
if (idx < 0) {
|
|
42
|
-
this.onBlur();
|
|
43
|
-
this.props.focusPrevious();
|
|
44
|
-
}
|
|
45
|
-
for (idx; idx < Object.keys(this.btnEls).length; idx++) {
|
|
46
|
-
if (this.btnEls[idx]) {
|
|
47
|
-
this.btnEls[idx].focus();
|
|
48
|
-
this.setCurrentFocusIdx(idx);
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (idx === Object.keys(this.btnEls).length) {
|
|
53
|
-
this.onBlur();
|
|
54
|
-
this.props.focusNext();
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
this.renderTitle = () => {
|
|
58
|
-
const title = this.props.isConversationsDisplayed
|
|
59
|
-
? this.props.intl.formatMessage({ id: 'header.conversations' })
|
|
60
|
-
: this.props.botName;
|
|
61
|
-
return (react_1.default.createElement("div", { className: 'bpw-header-title' },
|
|
62
|
-
react_1.default.createElement("div", { className: 'bpw-header-name' },
|
|
63
|
-
title,
|
|
64
|
-
this.props.hasUnreadMessages && react_1.default.createElement("span", { className: 'bpw-header-unread' }, this.props.unreadCount)),
|
|
65
|
-
this.props.hasBotInfoDescription && (react_1.default.createElement("div", { className: 'bpw-header-subtitle' }, this.props.botConversationDescription))));
|
|
66
|
-
};
|
|
67
|
-
this.handleDeleteConversation = () => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
if (yield (0, ConfirmDialog_1.default)(this.props.intl.formatMessage({
|
|
69
|
-
id: 'header.deleteConversation'
|
|
70
|
-
}), {
|
|
71
|
-
acceptLabel: this.props.intl.formatMessage({
|
|
72
|
-
id: 'header.deleteConversationYes'
|
|
73
|
-
}),
|
|
74
|
-
declineLabel: this.props.intl.formatMessage({
|
|
75
|
-
id: 'header.deleteConversationNo'
|
|
76
|
-
})
|
|
77
|
-
})) {
|
|
78
|
-
yield this.props.deleteConversation();
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
this.setShowingOption = (val) => {
|
|
82
|
-
this.setState({ showingOption: val });
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
componentDidMount() {
|
|
86
|
-
(0, mobx_1.observe)(this.props.focusedArea, (focus) => {
|
|
87
|
-
focus.newValue === 'header' && this.changeButtonFocus(1);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
renderDeleteConversationButton() {
|
|
91
|
-
return (react_1.default.createElement("button", { type: "button", tabIndex: -1, id: "btn-delete", ref: (el) => (this.btnEls[0] = el), className: 'bpw-header-icon bpw-header-icon-delete', onClick: this.handleDeleteConversation, onBlur: this.onBlur },
|
|
92
|
-
react_1.default.createElement(Delete_1.default, null)));
|
|
93
|
-
}
|
|
94
|
-
renderDownloadButton() {
|
|
95
|
-
return (react_1.default.createElement("button", { type: "button", tabIndex: -1, id: "btn-download", ref: (el) => (this.btnEls[2] = el), className: 'bpw-header-icon bpw-header-icon-download', onClick: this.props.downloadConversation, onBlur: this.onBlur },
|
|
96
|
-
react_1.default.createElement(Download_1.default, null)));
|
|
97
|
-
}
|
|
98
|
-
renderConvoButton() {
|
|
99
|
-
return (react_1.default.createElement("button", { type: "button", tabIndex: -1, id: "btn-conversations", ref: (el) => (this.btnEls[3] = el), className: 'bpw-header-icon bpw-header-icon-convo', onClick: this.props.toggleConversations, onBlur: this.onBlur },
|
|
100
|
-
react_1.default.createElement(List_1.default, null)));
|
|
101
|
-
}
|
|
102
|
-
renderBotInfoButton() {
|
|
103
|
-
return (react_1.default.createElement("button", { type: "button", tabIndex: -1, id: "btn-botinfo", ref: (el) => (this.btnEls[4] = el), className: 'bpw-header-icon bpw-header-icon-botinfo', onClick: this.props.toggleBotInfo, onBlur: this.onBlur },
|
|
104
|
-
react_1.default.createElement(Information_1.default, null)));
|
|
105
|
-
}
|
|
106
|
-
renderCloseButton() {
|
|
107
|
-
return (react_1.default.createElement("button", { type: "button", id: "btn-close", "aria-label": this.props.intl.formatMessage({
|
|
108
|
-
id: 'header.hideChatWindow',
|
|
109
|
-
defaultMessage: 'Hide the chat window'
|
|
110
|
-
}), ref: (el) => (this.btnEls[5] = el), className: 'bpw-header-icon bpw-header-icon-close', onClick: this.props.hideChat, onBlur: this.onBlur },
|
|
111
|
-
react_1.default.createElement(Close_1.default, null)));
|
|
112
|
-
}
|
|
113
|
-
renderCustomButtons() {
|
|
114
|
-
return this.props.customButtons.map((btn) => {
|
|
115
|
-
const Icon = btn.icon;
|
|
116
|
-
return (react_1.default.createElement("button", { type: "button", key: btn.id, id: `btn-${btn.id}`, tabIndex: -1, className: 'bpw-header-icon', onClick: btn.onClick.bind(this, btn.id, this), title: btn.label || '' }, typeof Icon === 'function' ? react_1.default.createElement(Icon, null) : Icon));
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
render() {
|
|
120
|
-
const optionsItems = [];
|
|
121
|
-
if (this.props.showDownloadButton) {
|
|
122
|
-
optionsItems.push({
|
|
123
|
-
label: 'Download Conversation',
|
|
124
|
-
action: this.props.downloadConversation
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
if (this.props.showConversationsButton) {
|
|
128
|
-
optionsItems.push({
|
|
129
|
-
label: 'Toggle List View',
|
|
130
|
-
action: this.props.toggleConversations
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
if (this.props.showBotInfoButton) {
|
|
134
|
-
optionsItems.push({
|
|
135
|
-
label: 'Toggle Bot Info',
|
|
136
|
-
action: this.props.toggleBotInfo
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
if (this.props.showDeleteConversationButton) {
|
|
140
|
-
optionsItems.push({
|
|
141
|
-
label: 'Delete conversation',
|
|
142
|
-
action: this.props.deleteConversation
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
return (react_1.default.createElement("div", { className: 'bpw-header-container' },
|
|
146
|
-
react_1.default.createElement("div", { className: 'bpw-header-title-flexbox' },
|
|
147
|
-
react_1.default.createElement("div", { className: 'bpw-header-title-container' },
|
|
148
|
-
react_1.default.createElement(Avatar_1.default, { name: this.props.botName, avatarUrl: this.props.botAvatarUrl, height: 40, width: 40 }),
|
|
149
|
-
this.renderTitle())),
|
|
150
|
-
!!this.props.customButtons.length && this.renderCustomButtons(),
|
|
151
|
-
this.props.showDeleteConversationButton && this.renderDeleteConversationButton(),
|
|
152
|
-
this.props.showDownloadButton && this.renderDownloadButton(),
|
|
153
|
-
this.props.showConversationsButton && this.renderConvoButton(),
|
|
154
|
-
this.props.showBotInfoButton && this.renderBotInfoButton(),
|
|
155
|
-
this.props.showCloseButton && this.renderCloseButton()));
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
exports.default = (0, mobx_react_1.inject)(({ store }) => ({
|
|
159
|
-
intl: store.intl,
|
|
160
|
-
isConversationsDisplayed: store.view.isConversationsDisplayed,
|
|
161
|
-
showDeleteConversationButton: store.view.showDeleteConversationButton,
|
|
162
|
-
showDownloadButton: store.view.showDownloadButton,
|
|
163
|
-
showBotInfoButton: store.view.showBotInfoButton,
|
|
164
|
-
showConversationsButton: store.view.showConversationsButton,
|
|
165
|
-
showCloseButton: store.view.showCloseButton,
|
|
166
|
-
hasUnreadMessages: store.view.hasUnreadMessages,
|
|
167
|
-
unreadCount: store.view.unreadCount,
|
|
168
|
-
focusPrevious: store.view.focusPrevious,
|
|
169
|
-
focusNext: store.view.focusNext,
|
|
170
|
-
focusedArea: store.view.focusedArea,
|
|
171
|
-
hideChat: store.view.hideChat,
|
|
172
|
-
toggleConversations: store.view.toggleConversations,
|
|
173
|
-
toggleBotInfo: store.view.toggleBotInfo,
|
|
174
|
-
customButtons: store.view.customButtons,
|
|
175
|
-
deleteConversation: store.deleteConversation,
|
|
176
|
-
downloadConversation: store.downloadConversation,
|
|
177
|
-
botName: store.botName,
|
|
178
|
-
botAvatarUrl: store.botAvatarUrl,
|
|
179
|
-
hasBotInfoDescription: store.hasBotInfoDescription,
|
|
180
|
-
botConversationDescription: store.config.botConversationDescription
|
|
181
|
-
}))((0, mobx_react_1.observer)(Header));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { FC } from 'react';
|
|
3
|
-
interface Props {
|
|
4
|
-
onDone: (voice: Buffer, ext: string) => Promise<void>;
|
|
5
|
-
onStart?: () => void;
|
|
6
|
-
onNotAvailable?: () => void;
|
|
7
|
-
className?: string;
|
|
8
|
-
}
|
|
9
|
-
declare const VoiceRecorder: FC<Props>;
|
|
10
|
-
export default VoiceRecorder;
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
-
};
|
|
33
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
35
|
-
const lite_1 = __importDefault(require("mime/lite"));
|
|
36
|
-
const react_1 = __importStar(require("react"));
|
|
37
|
-
const Cancel_1 = __importDefault(require("../icons/Cancel"));
|
|
38
|
-
const Microphone_1 = __importDefault(require("../icons/Microphone"));
|
|
39
|
-
const VoiceRecorder = (props) => {
|
|
40
|
-
var _a;
|
|
41
|
-
const [isRecording, setIsRecording] = (0, react_1.useState)(false);
|
|
42
|
-
const mediaRecorder = (0, react_1.useRef)(null);
|
|
43
|
-
const mediaChunks = (0, react_1.useRef)([]);
|
|
44
|
-
const mediaStream = (0, react_1.useRef)(null);
|
|
45
|
-
const isCancelled = (0, react_1.useRef)(false);
|
|
46
|
-
const getMediaStream = (0, react_1.useCallback)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
-
var _b;
|
|
48
|
-
try {
|
|
49
|
-
const stream = yield window.navigator.mediaDevices.getUserMedia({ audio: true, video: false });
|
|
50
|
-
mediaStream.current = stream;
|
|
51
|
-
}
|
|
52
|
-
catch (err) {
|
|
53
|
-
console.error('[VoiceRecorder] - Error while creating MediaStream', err);
|
|
54
|
-
(_b = props.onNotAvailable) === null || _b === void 0 ? void 0 : _b.call(props);
|
|
55
|
-
}
|
|
56
|
-
}), []);
|
|
57
|
-
(0, react_1.useEffect)(() => {
|
|
58
|
-
return () => {
|
|
59
|
-
var _a, _b, _c, _d;
|
|
60
|
-
(_a = mediaRecorder.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('dataavailable', onResult);
|
|
61
|
-
props.onStart && ((_b = mediaRecorder.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('start', props.onStart));
|
|
62
|
-
(_c = mediaRecorder.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('stop', onStop);
|
|
63
|
-
(_d = mediaRecorder.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('error', onError);
|
|
64
|
-
};
|
|
65
|
-
}, []);
|
|
66
|
-
const onError = (ev) => {
|
|
67
|
-
var _a;
|
|
68
|
-
console.error(`[VoiceRecorder] - Error while recording audio: ${ev.error.name} (${ev.error.code}) - ${ev.error.message}`);
|
|
69
|
-
(_a = props.onNotAvailable) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
70
|
-
};
|
|
71
|
-
const onResult = (e) => {
|
|
72
|
-
if (e.data.size > 0) {
|
|
73
|
-
mediaChunks.current.push(e.data);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
const onStop = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
-
if (isCancelled.current) {
|
|
78
|
-
isCancelled.current = false;
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
try {
|
|
82
|
-
if (mediaChunks.current.length) {
|
|
83
|
-
const firstBlob = mediaChunks.current[0];
|
|
84
|
-
// Fallback to ogg when detecting the extension since it's the most common
|
|
85
|
-
// audio format supported by modern browsers
|
|
86
|
-
const ext = lite_1.default.getExtension(firstBlob.type) || 'ogg';
|
|
87
|
-
const blob = new Blob(mediaChunks.current);
|
|
88
|
-
const arrayBuffer = yield blob.arrayBuffer();
|
|
89
|
-
const buffer = Buffer.from(arrayBuffer);
|
|
90
|
-
yield props.onDone(buffer, ext);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (err) {
|
|
94
|
-
console.error('[VoiceRecorder] - Error converting the audio blob into a buffer', err);
|
|
95
|
-
}
|
|
96
|
-
finally {
|
|
97
|
-
setIsRecording(false);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
const stopRecording = () => {
|
|
101
|
-
var _a, _b;
|
|
102
|
-
if (((_a = mediaRecorder.current) === null || _a === void 0 ? void 0 : _a.state) !== 'inactive') {
|
|
103
|
-
(_b = mediaRecorder.current) === null || _b === void 0 ? void 0 : _b.stop();
|
|
104
|
-
mediaStream.current && mediaStream.current.getTracks().forEach((track) => track.stop());
|
|
105
|
-
mediaChunks.current = [];
|
|
106
|
-
setIsRecording(false);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
const cancelRecording = () => {
|
|
110
|
-
isCancelled.current = true;
|
|
111
|
-
stopRecording();
|
|
112
|
-
};
|
|
113
|
-
const startRecording = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
-
if (!mediaStream.current || mediaStream.current.getTracks().some((track) => track.readyState === 'ended')) {
|
|
115
|
-
yield getMediaStream();
|
|
116
|
-
}
|
|
117
|
-
if (mediaStream.current) {
|
|
118
|
-
mediaRecorder.current = new MediaRecorder(mediaStream.current);
|
|
119
|
-
mediaRecorder.current.addEventListener('dataavailable', onResult);
|
|
120
|
-
props.onStart && mediaRecorder.current.addEventListener('start', props.onStart);
|
|
121
|
-
mediaRecorder.current.addEventListener('stop', onStop);
|
|
122
|
-
mediaRecorder.current.addEventListener('error', onError);
|
|
123
|
-
mediaRecorder.current.start();
|
|
124
|
-
setIsRecording(true);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
if (!window.MediaRecorder) {
|
|
128
|
-
(_a = props.onNotAvailable) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
return (react_1.default.createElement(react_1.Fragment, null,
|
|
132
|
-
isRecording && (react_1.default.createElement("button", { className: (0, classnames_1.default)('bpw-send-button', props.className), onClick: cancelRecording },
|
|
133
|
-
react_1.default.createElement(Cancel_1.default, { fill: "#ff0000" }))),
|
|
134
|
-
react_1.default.createElement("button", { className: (0, classnames_1.default)('bpw-send-button', props.className), onClick: isRecording ? stopRecording : startRecording },
|
|
135
|
-
react_1.default.createElement(Microphone_1.default, { fill: isRecording ? '#f1f1f1' : 'black' }))));
|
|
136
|
-
};
|
|
137
|
-
exports.default = VoiceRecorder;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const Avatar = ({ name, avatarUrl, height, width }) => {
|
|
8
|
-
return (react_1.default.createElement("div", { className: 'bpw-bot-avatar' },
|
|
9
|
-
avatarUrl && react_1.default.createElement("img", { height: height, width: width, src: avatarUrl }),
|
|
10
|
-
!avatarUrl && (react_1.default.createElement("svg", { width: width, height: width },
|
|
11
|
-
react_1.default.createElement("text", { textAnchor: 'middle', x: '50%', y: '50%', dy: '0.35em', fill: '#ffffff', fontSize: 15 }, name && name[0])))));
|
|
12
|
-
};
|
|
13
|
-
exports.default = Avatar;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { WrappedComponentProps } from 'react-intl';
|
|
3
|
-
import { StoreDef } from '../../../store';
|
|
4
|
-
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<BotInfoProps, "intl"> & {
|
|
5
|
-
forwardedRef?: React.Ref<any> | undefined;
|
|
6
|
-
} & React.RefAttributes<any>> & {
|
|
7
|
-
WrappedComponent: React.ComponentType<BotInfoProps>;
|
|
8
|
-
} & import("mobx-react").IWrappedComponent<unknown>;
|
|
9
|
-
export default _default;
|
|
10
|
-
declare type BotInfoProps = WrappedComponentProps & Pick<StoreDef, 'botInfo' | 'botName' | 'avatarUrl' | 'toggleBotInfo' | 'startConversation' | 'isConversationStarted' | 'updatePreferredLanguage' | 'preferredLanguage' | 'escapeHTML' | 'rtl'>;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
26
|
-
const mobx_react_1 = require("mobx-react");
|
|
27
|
-
const react_1 = __importStar(require("react"));
|
|
28
|
-
const react_intl_1 = require("react-intl");
|
|
29
|
-
const Email_1 = __importDefault(require("../../../icons/Email"));
|
|
30
|
-
const Phone_1 = __importDefault(require("../../../icons/Phone"));
|
|
31
|
-
const Website_1 = __importDefault(require("../../../icons/Website"));
|
|
32
|
-
const utils_1 = require("../../../utils");
|
|
33
|
-
const Avatar_1 = __importDefault(require("../Avatar"));
|
|
34
|
-
const CoverPicture = ({ botInfo }) => (react_1.default.createElement("div", { className: 'bpw-botinfo-cover-picture-wrapper' },
|
|
35
|
-
react_1.default.createElement("img", { className: 'bpw-botinfo-cover-picture', src: (botInfo === null || botInfo === void 0 ? void 0 : botInfo.details.coverPictureUrl) || `https://via.placeholder.com/400x175?text=${(botInfo === null || botInfo === void 0 ? void 0 : botInfo.name) || ''}` })));
|
|
36
|
-
class BotInfoPage extends react_1.default.Component {
|
|
37
|
-
constructor() {
|
|
38
|
-
super(...arguments);
|
|
39
|
-
this.changeLanguage = (e) => {
|
|
40
|
-
const lang = e.target.value;
|
|
41
|
-
this.props.updatePreferredLanguage(lang);
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
componentDidMount() {
|
|
45
|
-
var _a;
|
|
46
|
-
(_a = this.btnEl) === null || _a === void 0 ? void 0 : _a.focus();
|
|
47
|
-
}
|
|
48
|
-
renderDescription(text) {
|
|
49
|
-
const html = (0, utils_1.renderUnsafeHTML)(text, this.props.escapeHTML);
|
|
50
|
-
return react_1.default.createElement("div", { className: 'bpw-botinfo-description', dangerouslySetInnerHTML: { __html: html } });
|
|
51
|
-
}
|
|
52
|
-
render() {
|
|
53
|
-
const { botInfo, botName, avatarUrl } = this.props;
|
|
54
|
-
const onDismiss = this.props.isConversationStarted ? this.props.toggleBotInfo : this.props.startConversation;
|
|
55
|
-
return (react_1.default.createElement(react_1.Fragment, null,
|
|
56
|
-
react_1.default.createElement("link", { rel: "stylesheet", href: "style.scss" }),
|
|
57
|
-
react_1.default.createElement("div", { className: (0, classnames_1.default)('bpw-botinfo-container', {
|
|
58
|
-
'bpw-rtl': this.props.rtl
|
|
59
|
-
}) },
|
|
60
|
-
react_1.default.createElement(CoverPicture, { botInfo: botInfo }),
|
|
61
|
-
react_1.default.createElement("div", { className: 'bpw-botinfo-summary' },
|
|
62
|
-
react_1.default.createElement(Avatar_1.default, { name: botName, avatarUrl: avatarUrl, height: 64, width: 64 }),
|
|
63
|
-
react_1.default.createElement("h3", null, botName),
|
|
64
|
-
this.renderDescription(botInfo.description)),
|
|
65
|
-
botInfo.details && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
66
|
-
react_1.default.createElement("div", { className: 'bpw-botinfo-links' },
|
|
67
|
-
botInfo.details.phoneNumber && (react_1.default.createElement("div", { className: 'bpw-botinfo-link' },
|
|
68
|
-
react_1.default.createElement("i", null,
|
|
69
|
-
react_1.default.createElement(Phone_1.default, null)),
|
|
70
|
-
react_1.default.createElement("a", { target: '_blank', href: `tel:${botInfo.details.phoneNumber}` }, botInfo.details.phoneNumber))),
|
|
71
|
-
botInfo.details.website && (react_1.default.createElement("div", { className: 'bpw-botinfo-link' },
|
|
72
|
-
react_1.default.createElement("i", null,
|
|
73
|
-
react_1.default.createElement(Website_1.default, null)),
|
|
74
|
-
react_1.default.createElement("a", { target: '_blank', href: botInfo.details.website }, botInfo.details.website))),
|
|
75
|
-
botInfo.details.emailAddress && (react_1.default.createElement("div", { className: 'bpw-botinfo-link' },
|
|
76
|
-
react_1.default.createElement("i", null,
|
|
77
|
-
react_1.default.createElement(Email_1.default, null)),
|
|
78
|
-
react_1.default.createElement("a", { target: '_blank', href: `mailto:${botInfo.details.emailAddress}` }, botInfo.details.emailAddress)))),
|
|
79
|
-
botInfo.details.termsConditions && (react_1.default.createElement("div", { className: 'bpw-botinfo-terms' },
|
|
80
|
-
react_1.default.createElement("a", { target: '_blank', href: botInfo.details.termsConditions },
|
|
81
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: 'botInfo.termsAndConditions' })))),
|
|
82
|
-
botInfo.details.privacyPolicy && (react_1.default.createElement("div", { className: 'bpw-botinfo-terms' },
|
|
83
|
-
react_1.default.createElement("a", { target: '_blank', href: botInfo.details.privacyPolicy },
|
|
84
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: 'botInfo.privacyPolicy' })))))),
|
|
85
|
-
botInfo.languages.length > 1 && (react_1.default.createElement("div", { className: 'bpw-botinfo-preferred-language' },
|
|
86
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: 'botInfo.preferredLanguage' }),
|
|
87
|
-
react_1.default.createElement("select", { value: this.props.preferredLanguage, onChange: this.changeLanguage }, botInfo.languages.map((lang) => (react_1.default.createElement("option", { key: lang, value: lang }, lang.toUpperCase())))))),
|
|
88
|
-
react_1.default.createElement("button", { tabIndex: 1, ref: (el) => (this.btnEl = el), className: 'bpw-botinfo-start-button', onClick: onDismiss.bind(this, undefined) }, this.props.isConversationStarted ? (react_1.default.createElement(react_intl_1.FormattedMessage, { id: 'botInfo.backToConversation' })) : (react_1.default.createElement(react_intl_1.FormattedMessage, { id: 'botInfo.startConversation' }))))));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.default = (0, mobx_react_1.inject)(({ store }) => ({
|
|
92
|
-
botName: store.botName,
|
|
93
|
-
botInfo: store.botInfo,
|
|
94
|
-
avatarUrl: store.botAvatarUrl,
|
|
95
|
-
startConversation: store.startConversation,
|
|
96
|
-
toggleBotInfo: store.view.toggleBotInfo,
|
|
97
|
-
isConversationStarted: store.isConversationStarted,
|
|
98
|
-
updatePreferredLanguage: store.updatePreferredLanguage,
|
|
99
|
-
preferredLanguage: store.preferredLanguage,
|
|
100
|
-
escapeHTML: store.escapeHTML,
|
|
101
|
-
rtl: store.rtl
|
|
102
|
-
}))((0, react_intl_1.injectIntl)((0, mobx_react_1.observer)(BotInfoPage)));
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// TODO: This seems completely outdated. Does not match classes used by the component
|
|
2
|
-
|
|
3
|
-
@mixin bottomBorder() {
|
|
4
|
-
border-bottom: solid 1px rgba(0, 0, 0, 0.1);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
$charcoal: #1e1e1e;
|
|
8
|
-
|
|
9
|
-
// Fix for IE which has trouble with the max-width property
|
|
10
|
-
@media only screen and (min-width: 800px) {
|
|
11
|
-
.bot-info-container {
|
|
12
|
-
width: 800px;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.bot-info-container {
|
|
17
|
-
margin: 0 auto;
|
|
18
|
-
max-width: 800px;
|
|
19
|
-
text-align: center;
|
|
20
|
-
color: $charcoal;
|
|
21
|
-
overflow-y: auto;
|
|
22
|
-
svg {
|
|
23
|
-
fill: $charcoal;
|
|
24
|
-
}
|
|
25
|
-
& > img {
|
|
26
|
-
width: 100%;
|
|
27
|
-
}
|
|
28
|
-
p,
|
|
29
|
-
a,
|
|
30
|
-
button {
|
|
31
|
-
font-size: 0.9em;
|
|
32
|
-
color: rgb(102, 102, 102);
|
|
33
|
-
text-decoration: none;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.summary {
|
|
38
|
-
margin-top: -32px;
|
|
39
|
-
@include bottomBorder();
|
|
40
|
-
box-shadow: 0px 4px 5px -5px #ccc;
|
|
41
|
-
h3 {
|
|
42
|
-
margin: 0;
|
|
43
|
-
}
|
|
44
|
-
p {
|
|
45
|
-
margin-top: 0.4em;
|
|
46
|
-
margin-block-end: 1em;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.links {
|
|
51
|
-
@include bottomBorder();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.icon-link {
|
|
55
|
-
padding-left: 25%;
|
|
56
|
-
display: flex;
|
|
57
|
-
margin: 20px 0;
|
|
58
|
-
i {
|
|
59
|
-
margin-right: 10px;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.terms {
|
|
64
|
-
padding: 0px 20px;
|
|
65
|
-
text-align: left;
|
|
66
|
-
a {
|
|
67
|
-
display: inline-block;
|
|
68
|
-
width: 100%;
|
|
69
|
-
line-height: 2.5;
|
|
70
|
-
@include bottomBorder();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.startBtn {
|
|
75
|
-
font: inherit;
|
|
76
|
-
color: inherit;
|
|
77
|
-
background-color: transparent;
|
|
78
|
-
cursor: pointer;
|
|
79
|
-
border-radius: 20px;
|
|
80
|
-
line-height: 24px;
|
|
81
|
-
padding: 5px 10px;
|
|
82
|
-
margin-top: 25px;
|
|
83
|
-
border: 1px solid rgb(100, 100, 100);
|
|
84
|
-
&:focus {
|
|
85
|
-
border: 1px solid black;
|
|
86
|
-
color: black;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export interface ConfirmDialogOptions {
|
|
3
|
-
title?: string;
|
|
4
|
-
accept?: () => void;
|
|
5
|
-
decline?: () => void;
|
|
6
|
-
acceptLabel: string;
|
|
7
|
-
declineLabel: string;
|
|
8
|
-
body?: JSX.Element;
|
|
9
|
-
}
|
|
10
|
-
declare const confirmDialog: (message: string, options: ConfirmDialogOptions) => Promise<boolean>;
|
|
11
|
-
export default confirmDialog;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const core_1 = require("@blueprintjs/core");
|
|
26
|
-
const react_1 = __importDefault(require("react"));
|
|
27
|
-
const react_dom_1 = __importDefault(require("react-dom"));
|
|
28
|
-
const Dialog_1 = require("../Dialog");
|
|
29
|
-
const styles = __importStar(require("./style.module.scss"));
|
|
30
|
-
const ConfirmDialogComponent = (props) => {
|
|
31
|
-
const onAccept = () => {
|
|
32
|
-
var _a;
|
|
33
|
-
removeDialog();
|
|
34
|
-
(_a = props.accept) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
35
|
-
props.resolve(true);
|
|
36
|
-
};
|
|
37
|
-
const onDecline = () => {
|
|
38
|
-
var _a;
|
|
39
|
-
removeDialog();
|
|
40
|
-
(_a = props.decline) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
41
|
-
props.resolve(false);
|
|
42
|
-
};
|
|
43
|
-
return (react_1.default.createElement(Dialog_1.Wrapper, { icon: "warning-sign", usePortal: false, isOpen: true, onClose: onDecline, size: "sm" },
|
|
44
|
-
react_1.default.createElement(Dialog_1.Body, null,
|
|
45
|
-
react_1.default.createElement(core_1.Icon, { icon: "warning-sign", iconSize: 32, className: styles.icon }),
|
|
46
|
-
react_1.default.createElement("div", null,
|
|
47
|
-
props.message,
|
|
48
|
-
props.body)),
|
|
49
|
-
react_1.default.createElement(Dialog_1.Footer, null,
|
|
50
|
-
react_1.default.createElement(core_1.Button, { id: "confirm-dialog-decline", className: core_1.Classes.BUTTON, type: "button", onClick: onDecline, text: props.declineLabel, tabIndex: 2, intent: core_1.Intent.NONE }),
|
|
51
|
-
react_1.default.createElement(core_1.Button, { id: "confirm-dialog-accept", className: core_1.Classes.BUTTON, type: "button", autoFocus: true, onClick: onAccept, text: props.acceptLabel, tabIndex: 3, intent: core_1.Intent.WARNING }))));
|
|
52
|
-
};
|
|
53
|
-
const defaultConfirmOptions = {
|
|
54
|
-
title: '',
|
|
55
|
-
accept: () => { },
|
|
56
|
-
acceptLabel: 'Confirm',
|
|
57
|
-
decline: () => { },
|
|
58
|
-
declineLabel: 'Decline'
|
|
59
|
-
};
|
|
60
|
-
const confirmDialog = (message, options) => {
|
|
61
|
-
return new Promise((resolve, _reject) => {
|
|
62
|
-
addDialog(Object.assign(Object.assign(Object.assign({ message }, defaultConfirmOptions), options), { isOpen: false, resolve }));
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
function addDialog(props) {
|
|
66
|
-
const body = document.getElementsByTagName('body')[0];
|
|
67
|
-
const div = document.createElement('div');
|
|
68
|
-
div.setAttribute('id', 'confirmDialog-container');
|
|
69
|
-
div.setAttribute('class', styles.ConfirmDialogContainer);
|
|
70
|
-
body.appendChild(div);
|
|
71
|
-
react_dom_1.default.render(react_1.default.createElement(ConfirmDialogComponent, Object.assign({}, props)), div);
|
|
72
|
-
}
|
|
73
|
-
function removeDialog() {
|
|
74
|
-
const div = document.getElementById('confirmDialog-container');
|
|
75
|
-
const body = document.getElementsByTagName('body')[0];
|
|
76
|
-
body.removeChild(div);
|
|
77
|
-
}
|
|
78
|
-
exports.default = confirmDialog;
|