@botfabrik/engine-webclient 4.96.6 → 4.96.9
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 +1 -0
- package/dist/index.js +3 -21
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -7,7 +7,6 @@ exports.CLIENT_TYPE = exports.Devices = void 0;
|
|
|
7
7
|
const engine_domain_1 = require("@botfabrik/engine-domain");
|
|
8
8
|
const engine_transcript_export_1 = require("@botfabrik/engine-transcript-export");
|
|
9
9
|
const express_1 = require("express");
|
|
10
|
-
const node_crypto_1 = require("node:crypto");
|
|
11
10
|
const package_json_1 = require("../package.json");
|
|
12
11
|
const createSessionInfo_1 = __importDefault(require("./createSessionInfo"));
|
|
13
12
|
const extractLocale_1 = __importDefault(require("./extractLocale"));
|
|
@@ -18,8 +17,6 @@ const requestSessionData_1 = __importDefault(require("./requestSessionData"));
|
|
|
18
17
|
const setTranslations_1 = __importDefault(require("./setTranslations"));
|
|
19
18
|
const speechToText_1 = __importDefault(require("./speechToText"));
|
|
20
19
|
const views_1 = __importDefault(require("./views"));
|
|
21
|
-
const SESSION_ID_COOKIE_NAME = 'session-id';
|
|
22
|
-
const USER_ID_COOKIE_NAME = 'user-id';
|
|
23
20
|
var Devices;
|
|
24
21
|
(function (Devices) {
|
|
25
22
|
Devices["All"] = "all";
|
|
@@ -64,21 +61,6 @@ exports.default = (clientName, environment, props) => async (bot) => {
|
|
|
64
61
|
});
|
|
65
62
|
}
|
|
66
63
|
bot.webserver.express.use(`/${clientName}/embed`, (0, express_1.static)(__dirname + '/embed', serveStaticOptions));
|
|
67
|
-
// TODO: remove in future versions
|
|
68
|
-
bot.webserver.express.get(`/${clientName}/me/session`, (req, res) => {
|
|
69
|
-
logger.info(`Old client access get token from ip: ${req.ip}`);
|
|
70
|
-
const cookies = req.cookies || {};
|
|
71
|
-
const sessionId = cookies[SESSION_ID_COOKIE_NAME] || (0, node_crypto_1.randomUUID)();
|
|
72
|
-
const userId = cookies[USER_ID_COOKIE_NAME] ||
|
|
73
|
-
cookies['bubble-chat-user-id'] || // TODO: remove in future versions
|
|
74
|
-
(0, node_crypto_1.randomUUID)();
|
|
75
|
-
res.status(201).json({ sessionIdToken: sessionId, userIdToken: userId });
|
|
76
|
-
});
|
|
77
|
-
// TODO: remove in future versions
|
|
78
|
-
bot.webserver.express.delete(`/${clientName}/me/session`, (req, res) => {
|
|
79
|
-
logger.info(`Old client access delete token from ip: ${req.ip}`);
|
|
80
|
-
res.sendStatus(204);
|
|
81
|
-
});
|
|
82
64
|
bot.webserver.express.get(`/${clientName}/logo.svg`, (_req, res) => {
|
|
83
65
|
res.redirect(`/cms/chatbot/design/logo.svg?client=${clientName}`);
|
|
84
66
|
});
|
|
@@ -134,13 +116,13 @@ const onTerminateSession = (socket, bot) => async ({ sessionId, // passed if the
|
|
|
134
116
|
socket.leave(sessionId);
|
|
135
117
|
await session.dispatch(engine_domain_1.Actions.guestDisconnected(sessionId));
|
|
136
118
|
};
|
|
137
|
-
const onStartChat = (socket, props, bot, clientName, environment, logger) => async ({ sessionId: sessionIdFromClient, userId: defaultUserId, querystrings,
|
|
119
|
+
const onStartChat = (socket, props, bot, clientName, environment, logger) => async ({ sessionId: sessionIdFromClient, userId: defaultUserId, querystrings, }) => {
|
|
138
120
|
const locale = (0, extractLocale_1.default)(querystrings, socket.request.headers['accept-language']);
|
|
139
121
|
const sessionsCollection = bot.store.db.collection('sessions');
|
|
140
|
-
const { sessionId, sessionInfo: defaultSessionInfo, isNew, } = await (0, requestSessionData_1.default)(sessionIdFromClient
|
|
122
|
+
const { sessionId, sessionInfo: defaultSessionInfo, isNew, } = await (0, requestSessionData_1.default)(sessionIdFromClient, querystrings, sessionsCollection, clientName, props);
|
|
141
123
|
// create a channel for each session
|
|
142
124
|
socket.join(sessionId);
|
|
143
|
-
const sessionInfo = await (0, createSessionInfo_1.default)(socket, clientName, environment, defaultSessionInfo, defaultUserId
|
|
125
|
+
const sessionInfo = await (0, createSessionInfo_1.default)(socket, clientName, environment, defaultSessionInfo, defaultUserId, locale, querystrings, props)();
|
|
144
126
|
const session = await bot.createSession(sessionId, sessionInfo);
|
|
145
127
|
sendConfigurationToClient(socket, props, bot, clientName);
|
|
146
128
|
// sending persisted state to client
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botfabrik/engine-webclient",
|
|
3
|
-
"version": "4.96.
|
|
3
|
+
"version": "4.96.9",
|
|
4
4
|
"description": "Webclient for Botfabriks Bot Engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"tsx": "^4.20.3",
|
|
40
40
|
"typescript": "5.8.3"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "4e1e8a3d76989d4ba9000ca580c46236c04dc428"
|
|
43
43
|
}
|