@botfabrik/engine-webclient 4.104.16 → 4.104.18-alpha.0
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 +13 -6
- package/dist/types.d.ts +15 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -52,14 +52,21 @@ 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
|
+
.startsWith(bot.webserver.baseUrl.toLowerCase());
|
|
65
|
+
const isFromVisibleUrl = visibleUrls.some((url) => referer?.toLowerCase().includes(url.toLowerCase()));
|
|
66
|
+
console.log('referer', referer);
|
|
67
|
+
console.log('visibleUrls', visibleUrls);
|
|
68
|
+
console.log('isFromVisibleUrl', isFromVisibleUrl);
|
|
69
|
+
if (caller === 'bookmarklet' || isFromBaseUrl || isFromVisibleUrl) {
|
|
63
70
|
res.sendFile(`${__dirname}/embed/bundle.js`);
|
|
64
71
|
}
|
|
65
72
|
else {
|
|
@@ -126,7 +133,7 @@ const serveStaticOptions = {
|
|
|
126
133
|
}
|
|
127
134
|
},
|
|
128
135
|
};
|
|
129
|
-
const
|
|
136
|
+
const isFabAlwaysVisible = ({ fabVisible = true }) => typeof fabVisible === 'boolean' ? fabVisible : false;
|
|
130
137
|
const onTerminateSession = (socket, bot) => async ({ sessionId, // passed if the user wants to restart the chat
|
|
131
138
|
}) => {
|
|
132
139
|
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.18-alpha.0",
|
|
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": "01ba242091424bd04e574c807e33da12cb272238"
|
|
54
54
|
}
|