@botfabrik/engine-webclient 4.104.15 → 4.104.17
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 +10 -6
- package/dist/types.d.ts +15 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -52,14 +52,18 @@ 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
|
-
if (!
|
|
55
|
+
if (!isFabAlwaysVisible(props)) {
|
|
56
56
|
bot.webserver.express.get(`/${clientName}/embed/bundle.js`, (req, res) => {
|
|
57
57
|
const caller = req.query['caller'];
|
|
58
58
|
const referer = req.get('referer');
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
const visibleUrls = Array.isArray(props.fabVisible)
|
|
60
|
+
? props.fabVisible
|
|
61
|
+
: [];
|
|
62
|
+
const isFromBaseUrl = referer
|
|
63
|
+
?.toLowerCase()
|
|
64
|
+
.includes(bot.webserver.baseUrl.toLowerCase());
|
|
65
|
+
const isFromVisibleUrl = visibleUrls.some((url) => referer?.toLowerCase().startsWith(url.toLowerCase()));
|
|
66
|
+
if (caller === 'bookmarklet' || isFromBaseUrl || isFromVisibleUrl) {
|
|
63
67
|
res.sendFile(`${__dirname}/embed/bundle.js`);
|
|
64
68
|
}
|
|
65
69
|
else {
|
|
@@ -126,7 +130,7 @@ const serveStaticOptions = {
|
|
|
126
130
|
}
|
|
127
131
|
},
|
|
128
132
|
};
|
|
129
|
-
const
|
|
133
|
+
const isFabAlwaysVisible = ({ fabVisible = true }) => typeof fabVisible === 'boolean' ? fabVisible : false;
|
|
130
134
|
const onTerminateSession = (socket, bot) => async ({ sessionId, // passed if the user wants to restart the chat
|
|
131
135
|
}) => {
|
|
132
136
|
const session = await bot.createSession(sessionId);
|
package/dist/types.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export type ConversationRating = {
|
|
|
8
8
|
value: number;
|
|
9
9
|
feedback: string;
|
|
10
10
|
};
|
|
11
|
-
export type SessionInfoUserPayload =
|
|
12
|
-
export type WebclientMiddlewareState =
|
|
11
|
+
export type SessionInfoUserPayload = object;
|
|
12
|
+
export type WebclientMiddlewareState = object;
|
|
13
13
|
export type RequestUserInfos = (querystrings: any) => Promise<Partial<SessionInfoUser<SessionInfoUserPayload>>>;
|
|
14
14
|
export type RequestSessionRecordQuery = (params: {
|
|
15
15
|
querystrings: any;
|
|
@@ -91,7 +91,19 @@ export interface WebClientProps {
|
|
|
91
91
|
requestSessionRecordQuery?: RequestSessionRecordQuery;
|
|
92
92
|
speech?: SpeechToTextProps | undefined;
|
|
93
93
|
expandChatWindowAtStart?: Devices;
|
|
94
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Controls the visibility of the FAB.
|
|
96
|
+
*
|
|
97
|
+
* - If set to `true`, the FAB is always visible.
|
|
98
|
+
* - If set to `false`, the FAB is hidden.
|
|
99
|
+
* - If set to an array of strings, the FAB will only be visible when the web client is accessed from a page
|
|
100
|
+
* whose URL includes one of the specified strings.
|
|
101
|
+
*
|
|
102
|
+
* The FAB is always visible on the base URL pages and bookmarklet.
|
|
103
|
+
*
|
|
104
|
+
* @default true
|
|
105
|
+
*/
|
|
106
|
+
fabVisible?: boolean | string[];
|
|
95
107
|
/**
|
|
96
108
|
* SAML authentication configuration for the web client.
|
|
97
109
|
* If set, users must authenticate via SAML before accessing the chat.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botfabrik/engine-webclient",
|
|
3
|
-
"version": "4.104.
|
|
3
|
+
"version": "4.104.17",
|
|
4
4
|
"description": "Webclient for Botfabriks Bot Engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@botfabrik/engine-domain": "^4.104.14",
|
|
35
|
-
"@botfabrik/engine-transcript-export": "^4.104.
|
|
35
|
+
"@botfabrik/engine-transcript-export": "^4.104.16",
|
|
36
36
|
"@botfabrik/engine-utils": "^4.104.14",
|
|
37
37
|
"@google-cloud/speech": "^7.2.1",
|
|
38
38
|
"@node-saml/passport-saml": "^5.1.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"tsx": "^4.21.0",
|
|
51
51
|
"typescript": "5.9.3"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "517482ad1f063dbdfdf50d855b72049af97d94d5"
|
|
54
54
|
}
|