@botfabrik/engine-webclient 4.75.9 → 4.75.11

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 CHANGED
@@ -143,7 +143,7 @@ const onTerminateSession = (socket, bot) => async ({ sessionId, // passed if the
143
143
  const onStartChat = (socket, props, bot, clientName, environment, logger) => async ({ sessionId: sessionIdFromClient, userId: defaultUserId, querystrings, }) => {
144
144
  const locale = (0, extractLocale_1.default)(querystrings, socket.request.headers['accept-language']);
145
145
  const sessionsCollection = bot.store.db.collection('sessions');
146
- const { sessionId, sessionInfo: defaultSessionInfo, isNew, } = await (0, requestSessionData_1.default)(sessionIdFromClient, querystrings, sessionsCollection, clientName, locale, props);
146
+ const { sessionId, sessionInfo: defaultSessionInfo, isNew, } = await (0, requestSessionData_1.default)(sessionIdFromClient, querystrings, sessionsCollection, clientName, props);
147
147
  // create a channel for each session
148
148
  socket.join(sessionId);
149
149
  const sessionInfo = await (0, createSessionInfo_1.default)(socket, clientName, environment, defaultSessionInfo, defaultUserId, locale, querystrings, props)();
@@ -6,5 +6,5 @@ interface SessionData {
6
6
  sessionInfo: SessionInfo<SessionInfoClientPayload, SessionInfoUserPayload>;
7
7
  isNew: boolean;
8
8
  }
9
- declare const requestSessionData: (sessionId: string, querystrings: any, sessionsCollection: any, clientName: string, locale: string | undefined, props: WebClientProps) => Promise<SessionData>;
9
+ declare const requestSessionData: (sessionId: string, querystrings: any, sessionsCollection: any, clientName: string, props: WebClientProps) => Promise<SessionData>;
10
10
  export default requestSessionData;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const crypto_1 = require("crypto");
4
4
  const index_1 = require("./index");
5
- const requestSessionData = async (sessionId, querystrings, sessionsCollection, clientName, locale, props) => {
5
+ const requestSessionData = async (sessionId, querystrings, sessionsCollection, clientName, props) => {
6
6
  const baseQuery = {
7
7
  'sessionInfo.client.type': index_1.CLIENT_TYPE,
8
8
  'sessionInfo.client.name': clientName,
@@ -18,7 +18,6 @@ const requestSessionData = async (sessionId, querystrings, sessionsCollection, c
18
18
  else {
19
19
  findSessionRecordQuery = {
20
20
  _id: sessionId,
21
- 'sessionInfo.user.locale': locale,
22
21
  ...baseQuery,
23
22
  };
24
23
  }
@@ -26,13 +26,12 @@ globals_1.jest.mock('crypto', () => {
26
26
  const sessionsCollection = {
27
27
  findOne,
28
28
  };
29
- const { sessionId, isNew } = await (0, requestSessionData_1.default)('session-id', querystrings, sessionsCollection, 'test-bot', 'de_DE', {});
29
+ const { sessionId, isNew } = await (0, requestSessionData_1.default)('session-id', querystrings, sessionsCollection, 'test-bot', {});
30
30
  (0, globals_1.expect)(findOne).toHaveBeenCalledTimes(1);
31
31
  (0, globals_1.expect)(findOne).toHaveBeenCalledWith({
32
32
  _id: 'session-id',
33
33
  'sessionInfo.client.name': 'test-bot',
34
34
  'sessionInfo.client.type': 'webclient',
35
- 'sessionInfo.user.locale': 'de_DE',
36
35
  }, { _id: 1, sessionInfo: 1 });
37
36
  (0, globals_1.expect)(sessionId).toBe('some-uuid');
38
37
  (0, globals_1.expect)(isNew).toBe(true);
@@ -43,13 +42,12 @@ globals_1.jest.mock('crypto', () => {
43
42
  const sessionsCollection = {
44
43
  findOne,
45
44
  };
46
- const { sessionId, isNew } = await (0, requestSessionData_1.default)('session-id', querystrings, sessionsCollection, 'test-bot', 'de_DE', {});
45
+ const { sessionId, isNew } = await (0, requestSessionData_1.default)('session-id', querystrings, sessionsCollection, 'test-bot', {});
47
46
  (0, globals_1.expect)(findOne).toHaveBeenCalledTimes(1);
48
47
  (0, globals_1.expect)(findOne).toHaveBeenCalledWith({
49
48
  _id: 'session-id',
50
49
  'sessionInfo.client.name': 'test-bot',
51
50
  'sessionInfo.client.type': 'webclient',
52
- 'sessionInfo.user.locale': 'de_DE',
53
51
  }, { _id: 1, sessionInfo: 1 });
54
52
  (0, globals_1.expect)(sessionId).toBe('session-id');
55
53
  (0, globals_1.expect)(isNew).toBe(false);
@@ -65,7 +63,7 @@ globals_1.jest.mock('crypto', () => {
65
63
  requestSessionRecordQuery,
66
64
  };
67
65
  requestSessionRecordQuery.mockReturnValueOnce(Promise.resolve({ 'sessionInfo.user.id': 'hans@apptiva.ch' }));
68
- const { sessionId, isNew } = await (0, requestSessionData_1.default)('session-id', querystrings, sessionsCollection, 'test-bot', 'de_DE', props);
66
+ const { sessionId, isNew } = await (0, requestSessionData_1.default)('session-id', querystrings, sessionsCollection, 'test-bot', props);
69
67
  (0, globals_1.expect)(requestSessionRecordQuery).toHaveBeenCalledTimes(1);
70
68
  (0, globals_1.expect)(requestSessionRecordQuery).toHaveBeenCalledWith({
71
69
  querystrings,
@@ -91,7 +89,7 @@ globals_1.jest.mock('crypto', () => {
91
89
  requestSessionRecordQuery,
92
90
  };
93
91
  requestSessionRecordQuery.mockReturnValueOnce(Promise.resolve({ 'sessionInfo.user.id': 'hans@apptiva.ch' }));
94
- const { sessionId, isNew } = await (0, requestSessionData_1.default)('session-id', querystrings, sessionsCollection, 'test-bot', 'de_DE', props);
92
+ const { sessionId, isNew } = await (0, requestSessionData_1.default)('session-id', querystrings, sessionsCollection, 'test-bot', props);
95
93
  (0, globals_1.expect)(requestSessionRecordQuery).toHaveBeenCalledTimes(1);
96
94
  (0, globals_1.expect)(requestSessionRecordQuery).toHaveBeenCalledWith({
97
95
  querystrings,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botfabrik/engine-webclient",
3
- "version": "4.75.9",
3
+ "version": "4.75.11",
4
4
  "description": "Webclient for Botfabriks Bot Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -40,5 +40,5 @@
40
40
  "tsx": "^4.19.1",
41
41
  "typescript": "5.1.6"
42
42
  },
43
- "gitHead": "fa68f8e96fb69e22178352346241c609b4bbb677"
43
+ "gitHead": "3a7fc99201a0672b2b3544f21b67e9efe46b2961"
44
44
  }