@botfabrik/engine-webclient 4.88.5 → 4.89.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/client/assets/{index-Dudp437V.js → index-Dsewv1TL.js} +37 -37
- package/dist/client/assets/index-Dsewv1TL.js.map +1 -0
- package/dist/client/index.html +1 -1
- package/dist/createSessionInfo.d.ts +3 -4
- package/dist/extractLocale.d.ts +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +8 -41
- package/dist/loadPreviousConversation.d.ts +1 -1
- package/dist/middleware/index.d.ts +1 -1
- package/dist/requestSessionData.d.ts +2 -2
- package/dist/setTranslations.d.ts +2 -2
- package/package.json +8 -9
- package/dist/client/assets/index-Dudp437V.js.map +0 -1
package/dist/client/index.html
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<meta name="theme-color" content="#000000" />
|
|
14
14
|
<meta name="google" content="notranslate" />
|
|
15
15
|
<title>Bubble Chat Client</title>
|
|
16
|
-
<script type="module" crossorigin src="./assets/index-
|
|
16
|
+
<script type="module" crossorigin src="./assets/index-Dsewv1TL.js"></script>
|
|
17
17
|
<link rel="stylesheet" crossorigin href="./assets/index-D5Y4qYek.css">
|
|
18
18
|
</head>
|
|
19
19
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { SessionInfo } from '@botfabrik/engine-
|
|
2
|
-
import type {
|
|
3
|
-
import { ParsedUrlQuery } from 'node:querystring';
|
|
1
|
+
import type { Environment, SessionInfo } from '@botfabrik/engine-domain';
|
|
2
|
+
import type { ParsedUrlQuery } from 'node:querystring';
|
|
4
3
|
import type { Socket } from 'socket.io';
|
|
5
|
-
import { WebClientProps } from './index';
|
|
4
|
+
import { type WebClientProps } from './index';
|
|
6
5
|
import type { SessionInfoClientPayload, SessionInfoUserPayload } from './types';
|
|
7
6
|
declare const createSessionInfo: (socket: Socket, clientName: string, environment: Environment, sessionInfo: SessionInfo<SessionInfoClientPayload, SessionInfoUserPayload>, userId: string, locale: string | undefined, querystrings: ParsedUrlQuery, props: WebClientProps) => () => Promise<SessionInfo<SessionInfoClientPayload, SessionInfoUserPayload>>;
|
|
8
7
|
export default createSessionInfo;
|
package/dist/extractLocale.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { Environment } from '@botfabrik/engine-domain';
|
|
3
|
-
import { Action } from '@botfabrik/engine-domain';
|
|
1
|
+
import { type Action, type Client, type Environment, type SessionInfoUser } from '@botfabrik/engine-domain';
|
|
4
2
|
import { SpeechToTextProps } from './speechToText';
|
|
5
3
|
import type { SessionInfoUserPayload, WebclientMiddlewareState } from './types';
|
|
6
4
|
export type RequestUserInfos = (querystrings: any) => Promise<Partial<SessionInfoUser<SessionInfoUserPayload>>>;
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
@@ -39,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
6
|
exports.CLIENT_TYPE = exports.Devices = void 0;
|
|
40
7
|
const engine_domain_1 = require("@botfabrik/engine-domain");
|
|
41
8
|
const engine_transcript_export_1 = require("@botfabrik/engine-transcript-export");
|
|
42
|
-
const
|
|
9
|
+
const express_1 = require("express");
|
|
43
10
|
const package_json_1 = require("../package.json");
|
|
44
11
|
const createSessionInfo_1 = __importDefault(require("./createSessionInfo"));
|
|
45
12
|
const extractLocale_1 = __importDefault(require("./extractLocale"));
|
|
@@ -93,7 +60,7 @@ exports.default = (clientName, environment, props) => async (bot) => {
|
|
|
93
60
|
}
|
|
94
61
|
});
|
|
95
62
|
}
|
|
96
|
-
bot.webserver.express.use(`/${clientName}/embed`,
|
|
63
|
+
bot.webserver.express.use(`/${clientName}/embed`, (0, express_1.static)(__dirname + '/embed', serveStaticOptions));
|
|
97
64
|
bot.webserver.express.get(`/${clientName}/logo.svg`, (_req, res) => {
|
|
98
65
|
res.redirect(`/cms/chatbot/design/logo.svg?client=${clientName}`);
|
|
99
66
|
});
|
|
@@ -104,7 +71,7 @@ exports.default = (clientName, environment, props) => async (bot) => {
|
|
|
104
71
|
res.redirect(`/cms/chatbot/design/fab.svg?client=${clientName}`);
|
|
105
72
|
});
|
|
106
73
|
// serve chat client resources
|
|
107
|
-
bot.webserver.express.use(`/${clientName}`,
|
|
74
|
+
bot.webserver.express.use(`/${clientName}`, (0, express_1.static)(__dirname + '/client', serveStaticOptions));
|
|
108
75
|
logger.info(`Webclient will be available on route: /${clientName}`);
|
|
109
76
|
const nsp = bot.webserver.socket.of(`/${clientName}/chat`);
|
|
110
77
|
nsp.on('connection', async (socket) => {
|
|
@@ -117,7 +84,7 @@ exports.default = (clientName, environment, props) => async (bot) => {
|
|
|
117
84
|
logger.error('Error while connecting webclient with backend.');
|
|
118
85
|
logger.error(error);
|
|
119
86
|
const errorMessage = new engine_domain_1.TextMessage('Sorry I can’t talk at the moment. Please try again later.', new engine_domain_1.BotUser());
|
|
120
|
-
socket.emit('action',
|
|
87
|
+
socket.emit('action', engine_domain_1.Actions.sendMessageToGuest(errorMessage));
|
|
121
88
|
}
|
|
122
89
|
});
|
|
123
90
|
const client = {
|
|
@@ -147,7 +114,7 @@ const onTerminateSession = (socket, bot) => async ({ sessionId, // passed if the
|
|
|
147
114
|
}) => {
|
|
148
115
|
const session = await bot.createSession(sessionId);
|
|
149
116
|
socket.leave(sessionId);
|
|
150
|
-
await session.dispatch(
|
|
117
|
+
await session.dispatch(engine_domain_1.Actions.guestDisconnected(sessionId));
|
|
151
118
|
};
|
|
152
119
|
const onStartChat = (socket, props, bot, clientName, environment, logger) => async ({ sessionId: sessionIdFromClient, userId: defaultUserId, querystrings, }) => {
|
|
153
120
|
const locale = (0, extractLocale_1.default)(querystrings, socket.request.headers['accept-language']);
|
|
@@ -171,7 +138,7 @@ const onStartChat = (socket, props, bot, clientName, environment, logger) => asy
|
|
|
171
138
|
});
|
|
172
139
|
}
|
|
173
140
|
// Notify middlewares about a connected or reconnected guest
|
|
174
|
-
await session.dispatch(
|
|
141
|
+
await session.dispatch(engine_domain_1.Actions.guestConnected(sessionId));
|
|
175
142
|
if (isNew && props.getStartedAction) {
|
|
176
143
|
await session.dispatch(props.getStartedAction);
|
|
177
144
|
}
|
|
@@ -179,7 +146,7 @@ const onStartChat = (socket, props, bot, clientName, environment, logger) => asy
|
|
|
179
146
|
await session.dispatch(JSON.parse(action));
|
|
180
147
|
});
|
|
181
148
|
registerListener(socket, 'disconnect', async () => {
|
|
182
|
-
await session.dispatch(
|
|
149
|
+
await session.dispatch(engine_domain_1.Actions.guestDisconnected(sessionId));
|
|
183
150
|
});
|
|
184
151
|
registerListener(socket, 'conversation-rating', async (rating) => {
|
|
185
152
|
sessionsCollection.updateOne({ _id: sessionId }, { $set: { 'sessionInfo.client.payload.conversationRating': rating } });
|
|
@@ -194,7 +161,7 @@ const onStartChat = (socket, props, bot, clientName, environment, logger) => asy
|
|
|
194
161
|
const text = await (0, speechToText_1.default)(props.speech, session.translator.locale, buffer);
|
|
195
162
|
if (text && text.length) {
|
|
196
163
|
socket.emit('speech-transcription', text);
|
|
197
|
-
session.dispatch(
|
|
164
|
+
session.dispatch(engine_domain_1.Actions.receiveTextMessageFromGuest(text));
|
|
198
165
|
}
|
|
199
166
|
}
|
|
200
167
|
catch (error) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Middleware } from '@botfabrik/engine-domain';
|
|
2
2
|
import type { Namespace } from 'socket.io';
|
|
3
3
|
import type { WebclientMiddlewareState } from '../types';
|
|
4
4
|
declare const _default: (clientName: string, nsp: Namespace) => Middleware<WebclientMiddlewareState>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SessionInfo } from '@botfabrik/engine-
|
|
2
|
-
import { WebClientProps } from './index';
|
|
1
|
+
import type { SessionInfo } from '@botfabrik/engine-domain';
|
|
2
|
+
import { type WebClientProps } from './index';
|
|
3
3
|
import type { SessionInfoClientPayload, SessionInfoUserPayload } from './types';
|
|
4
4
|
interface SessionData {
|
|
5
5
|
sessionId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BotInstance } from '@botfabrik/engine-
|
|
2
|
-
import { Namespace, Socket } from 'socket.io';
|
|
1
|
+
import type { BotInstance } from '@botfabrik/engine-domain';
|
|
2
|
+
import type { Namespace, Socket } from 'socket.io';
|
|
3
3
|
declare const setTranslations: (socket: Socket | Namespace, bot: BotInstance, clientLocale: string, clientName: string) => void;
|
|
4
4
|
export default setTranslations;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botfabrik/engine-webclient",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.89.1",
|
|
4
4
|
"description": "Webclient for Botfabriks Bot Engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,25 +20,24 @@
|
|
|
20
20
|
"dev:embed": "tsx --watch ./run-embed-local.ts"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@botfabrik/engine-
|
|
24
|
-
"@botfabrik/engine-
|
|
25
|
-
"@botfabrik/engine-
|
|
26
|
-
"@
|
|
27
|
-
"@google-cloud/speech": "^7.0.1",
|
|
23
|
+
"@botfabrik/engine-domain": "^4.89.1",
|
|
24
|
+
"@botfabrik/engine-transcript-export": "^4.89.1",
|
|
25
|
+
"@botfabrik/engine-utils": "^4.89.1",
|
|
26
|
+
"@google-cloud/speech": "^7.1.0",
|
|
28
27
|
"accept-language-parser": "^1.5.0",
|
|
29
28
|
"express": "^5.1.0",
|
|
30
|
-
"socket.io": "^4.8.1",
|
|
31
29
|
"uuid": "^11.1.0"
|
|
32
30
|
},
|
|
33
31
|
"devDependencies": {
|
|
34
32
|
"@types/accept-language-parser": "^1.5.8",
|
|
35
|
-
"@types/express": "^5.0.
|
|
33
|
+
"@types/express": "^5.0.2",
|
|
36
34
|
"@types/serve-static": "^1.15.7",
|
|
37
35
|
"@types/ua-parser-js": "^0.7.39",
|
|
38
36
|
"copyfiles": "^2.4.1",
|
|
39
37
|
"rimraf": "^6.0.1",
|
|
38
|
+
"socket.io": "^4.8.1",
|
|
40
39
|
"tsx": "^4.19.4",
|
|
41
40
|
"typescript": "5.8.3"
|
|
42
41
|
},
|
|
43
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "2abfb872cdd10e62c38220f983af444578ba65a6"
|
|
44
43
|
}
|