@botfabrik/engine-webclient 4.104.18-alpha.2 → 4.104.18
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/index.js +7 -15
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -52,25 +52,17 @@ export default (clientName, environment, props) => async (bot) => {
|
|
|
52
52
|
res.write(index(serverUrl.toString(), `${server}/embed/bundle.js`));
|
|
53
53
|
res.end();
|
|
54
54
|
});
|
|
55
|
-
|
|
56
|
-
console.log('isFabAlwaysVisible', isFabAlwaysVisible(props));
|
|
57
|
-
if (!isFabAlwaysVisible(props)) {
|
|
55
|
+
if (fabVisibilityIsConditional(props)) {
|
|
58
56
|
bot.webserver.express.get(`/${clientName}/embed/bundle.js`, (req, res) => {
|
|
59
57
|
const caller = req.query['caller'];
|
|
60
|
-
const referer = req.get('referer');
|
|
58
|
+
const referer = req.get('referer')?.toLowerCase();
|
|
61
59
|
const visibleUrls = Array.isArray(props.fabVisible)
|
|
62
60
|
? props.fabVisible
|
|
63
61
|
: [];
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
.startsWith(
|
|
67
|
-
|
|
68
|
-
console.log('referer', referer);
|
|
69
|
-
console.log('visibleUrls', visibleUrls);
|
|
70
|
-
console.log('isFromVisibleUrl', isFromVisibleUrl);
|
|
71
|
-
console.log('baseUrl', bot.webserver.baseUrl);
|
|
72
|
-
console.log('isFromBaseUrl', isFromBaseUrl);
|
|
73
|
-
if (caller === 'bookmarklet' || isFromBaseUrl || isFromVisibleUrl) {
|
|
62
|
+
const isEmbedPage = !!referer?.startsWith(bot.webserver.baseUrl.toLowerCase());
|
|
63
|
+
const isFromVisibleUrl = isEmbedPage ||
|
|
64
|
+
visibleUrls.some((url) => referer?.startsWith(url.toLowerCase()));
|
|
65
|
+
if (caller === 'bookmarklet' || isFromVisibleUrl) {
|
|
74
66
|
res.sendFile(`${__dirname}/embed/bundle.js`);
|
|
75
67
|
}
|
|
76
68
|
else {
|
|
@@ -137,7 +129,7 @@ const serveStaticOptions = {
|
|
|
137
129
|
}
|
|
138
130
|
},
|
|
139
131
|
};
|
|
140
|
-
const
|
|
132
|
+
const fabVisibilityIsConditional = ({ fabVisible = true }) => fabVisible !== true;
|
|
141
133
|
const onTerminateSession = (socket, bot) => async ({ sessionId, // passed if the user wants to restart the chat
|
|
142
134
|
}) => {
|
|
143
135
|
const session = await bot.createSession(sessionId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botfabrik/engine-webclient",
|
|
3
|
-
"version": "4.104.18
|
|
3
|
+
"version": "4.104.18",
|
|
4
4
|
"description": "Webclient for Botfabriks Bot Engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"tsx": "^4.21.0",
|
|
51
51
|
"typescript": "5.9.3"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "0847fa3ec971ea318e772e2d98b1975ab715a3b1"
|
|
54
54
|
}
|