@botpress/webchat 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21,6 +21,12 @@ const VoiceRecorder_1 = __importDefault(require("./VoiceRecorder"));
|
|
|
21
21
|
class Composer extends react_1.default.Component {
|
|
22
22
|
constructor(props) {
|
|
23
23
|
super(props);
|
|
24
|
+
this.focus = () => {
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
var _a;
|
|
27
|
+
(_a = this.textInput.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
28
|
+
}, 50);
|
|
29
|
+
};
|
|
24
30
|
this.handleKeyPress = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
25
31
|
if (e.key === 'Enter') {
|
|
26
32
|
e.preventDefault();
|
|
@@ -51,13 +57,18 @@ class Composer extends react_1.default.Component {
|
|
|
51
57
|
this.state = { isRecording: false };
|
|
52
58
|
}
|
|
53
59
|
componentDidMount() {
|
|
54
|
-
|
|
55
|
-
this.textInput.current.focus();
|
|
56
|
-
}, 50);
|
|
60
|
+
this.focus();
|
|
57
61
|
(0, mobx_1.observe)(this.props.focusedArea, (focus) => {
|
|
58
|
-
|
|
62
|
+
var _a;
|
|
63
|
+
focus.newValue === 'input' && ((_a = this.textInput.current) === null || _a === void 0 ? void 0 : _a.focus());
|
|
59
64
|
});
|
|
60
65
|
}
|
|
66
|
+
componentWillReceiveProps(newProps) {
|
|
67
|
+
// Focus on the composer when it's unlocked
|
|
68
|
+
if (this.props.composerLocked === true && newProps.composerLocked === false) {
|
|
69
|
+
this.focus();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
61
72
|
render() {
|
|
62
73
|
if (this.props.composerHidden) {
|
|
63
74
|
return null;
|
|
@@ -63,7 +63,8 @@ class Message extends react_1.Component {
|
|
|
63
63
|
shouldPlay: this.props.shouldPlay,
|
|
64
64
|
intl: this.props.store.intl,
|
|
65
65
|
escapeHTML: true,
|
|
66
|
-
showTimestamp: this.props.store.config.showTimestamp
|
|
66
|
+
showTimestamp: this.props.store.config.showTimestamp,
|
|
67
|
+
googleMapsAPIKey: this.props.store.config.googleMapsAPIKey
|
|
67
68
|
} }));
|
|
68
69
|
if (rendered === null) {
|
|
69
70
|
return null;
|
package/dist/core/socket.js
CHANGED
|
@@ -18,6 +18,7 @@ class BpSocket {
|
|
|
18
18
|
};
|
|
19
19
|
this.chatId = config.chatId;
|
|
20
20
|
this.socket = new messaging_socket_1.MessagingSocket({ url: config.messagingUrl, clientId: config.clientId });
|
|
21
|
+
window.websocket = this.socket;
|
|
21
22
|
}
|
|
22
23
|
setup() {
|
|
23
24
|
this.socket.on('message', this.onMessage);
|
package/dist/store/composer.js
CHANGED
package/dist/typings.d.ts
CHANGED
|
@@ -268,9 +268,15 @@ export interface Config {
|
|
|
268
268
|
chatId?: string;
|
|
269
269
|
/**
|
|
270
270
|
* CSS class to be applied to iframe
|
|
271
|
-
* @default ''
|
|
271
|
+
* @default ''
|
|
272
272
|
*/
|
|
273
273
|
className?: string;
|
|
274
|
+
/**
|
|
275
|
+
* Google Maps API Key required to display the map.
|
|
276
|
+
* Will display a link to Google Maps otherwise
|
|
277
|
+
* @default ''
|
|
278
|
+
*/
|
|
279
|
+
googleMapsAPIKey?: string;
|
|
274
280
|
}
|
|
275
281
|
export interface BotDetails {
|
|
276
282
|
website?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/webchat",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"source": "src/index.tsx",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "yarn && yarn run -T tsc --build",
|
|
10
10
|
"watch": "yarn && yarn run -T tsc --build --watch",
|
|
11
|
+
"dev": "yarn run -T parcel test/index.html",
|
|
11
12
|
"prepublish": "yarn run -T rimraf dist && yarn --immutable && yarn run -T tsc --build && yarn run -T rimraf dist/.tsbuildinfo"
|
|
12
13
|
},
|
|
13
14
|
"files": [
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"@blueprintjs/core": "^3.23.1",
|
|
29
30
|
"@botpress/messaging-components": "0.3.0",
|
|
30
|
-
"@botpress/messaging-socket": "1.1.
|
|
31
|
+
"@botpress/messaging-socket": "1.1.1",
|
|
31
32
|
"@formatjs/intl-pluralrules": "^4.1.6",
|
|
32
33
|
"@formatjs/intl-utils": "^3.8.4",
|
|
33
34
|
"@juggle/resize-observer": "^3.0.2",
|