wingbot 3.46.0-alpha.7 → 3.46.0-alpha.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.46.0-alpha.7",
3
+ "version": "3.46.0-alpha.9",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,7 +32,6 @@ const {
32
32
  * @prop {string} [label]
33
33
  * @prop {number} [value]
34
34
  * @prop {string} [lang]
35
- * @prop {number} [sessionStart]
36
35
  */
37
36
 
38
37
  /**
@@ -53,7 +52,6 @@ const {
53
52
  * @prop {boolean} withUser
54
53
  * @prop {string} [userId]
55
54
  * @prop {number} [feedback]
56
- * @prop {number} sessionDuration
57
55
  * @prop {string} [winnerAction]
58
56
  * @prop {string} [winnerIntent]
59
57
  * @prop {string[]|string} [winnerEntities]
@@ -64,8 +62,6 @@ const {
64
62
  * @prop {string[]|string} [entities]
65
63
  * @prop {string[]|string} allActions
66
64
  * @prop {boolean} nonInteractive
67
- * @prop {string} [snapshot]
68
- * @prop {string} [botId]
69
65
  *
70
66
  * @typedef {Event & ConversationEventExtension} ConversationEvent
71
67
  */
@@ -75,7 +71,6 @@ const {
75
71
  * @prop {string} [lastAction]
76
72
  * @prop {string} [prevAction]
77
73
  * @prop {string} [skill]
78
- * @prop {number} sessionDuration
79
74
  * @prop {string[]|string} allActions
80
75
  * @prop {boolean} nonInteractive
81
76
  * @prop {boolean} isGoto
@@ -97,6 +92,10 @@ const {
97
92
  * @prop {string} [action]
98
93
  * @prop {string} [snapshot]
99
94
  * @prop {string} [botId]
95
+ * @prop {boolean} [didHandover]
96
+ * @prop {number|null} [feedback]
97
+ * @prop {string} [timeZone]
98
+ * @prop {number} [sessionStart]
100
99
  */
101
100
 
102
101
  /**
@@ -107,7 +106,6 @@ const {
107
106
  * @param {SessionMetadata} [metadata]
108
107
  * @param {number} [ts]
109
108
  * @param {boolean} [nonInteractive]
110
- * @param {string} [timeZone]
111
109
  * @returns {Promise}
112
110
  */
113
111
 
@@ -121,7 +119,7 @@ const {
121
119
  * @param {number} [ts]
122
120
  * @param {boolean} [nonInteractive]
123
121
  * @param {boolean} [sessionStarted]
124
- * @param {string} [timeZone]
122
+ * @param {SessionMetadata} [metadata]
125
123
  * @returns {Promise}
126
124
  */
127
125
 
@@ -285,26 +283,28 @@ function onInteractionHandler (
285
283
  didHandover = true;
286
284
  }
287
285
 
286
+ const metadata = {
287
+ sessionCount,
288
+ lang,
289
+ action,
290
+ snapshot,
291
+ botId,
292
+ didHandover,
293
+ feedback,
294
+ timeZone,
295
+ sessionStart,
296
+ sessionDuration: sessionTs - sessionStart
297
+ };
298
+
288
299
  let sessionPromise;
289
300
  if (createSession) {
290
- const metadata = {
291
- sessionCount,
292
- lang,
293
- action,
294
- snapshot,
295
- botId,
296
- didHandover,
297
- feedback
298
- };
299
-
300
301
  sessionPromise = analyticsStorage.createUserSession(
301
302
  pageId,
302
303
  senderId,
303
304
  sessionId,
304
305
  metadata,
305
306
  timestamp,
306
- nonInteractive,
307
- timeZone
307
+ nonInteractive
308
308
  );
309
309
 
310
310
  if (!parallelSessionInsert) {
@@ -376,12 +376,8 @@ function onInteractionHandler (
376
376
  isPostback,
377
377
  didHandover,
378
378
  withUser,
379
- sessionStart,
380
- sessionDuration: sessionTs - sessionStart,
381
379
  feedback,
382
380
  skill: useSkill,
383
- snapshot,
384
- botId,
385
381
  winnerAction,
386
382
  winnerIntent,
387
383
  winnerEntities: asArray(winnerEntities.map((e) => e.entity)),
@@ -410,11 +406,7 @@ function onInteractionHandler (
410
406
  prevAction: lastAction,
411
407
  skill: useSkill,
412
408
  isGoto: false,
413
- sessionStart,
414
- sessionDuration: timestamp - sessionStart,
415
409
  withUser,
416
- snapshot,
417
- botId,
418
410
  ...langsExtension,
419
411
  ...(hasExtendedEvents ? {} : actionMeta)
420
412
  });
@@ -434,10 +426,6 @@ function onInteractionHandler (
434
426
  prevAction,
435
427
  skill: useSkill,
436
428
  isGoto: true,
437
- sessionStart,
438
- sessionDuration: timestamp - sessionStart,
439
- snapshot,
440
- botId,
441
429
  ...langsExtension
442
430
  };
443
431
 
@@ -456,7 +444,6 @@ function onInteractionHandler (
456
444
  action: eventAction,
457
445
  label,
458
446
  value: eVal,
459
- sessionStart,
460
447
  ...langsExtension
461
448
  }))
462
449
  );
@@ -473,7 +460,6 @@ function onInteractionHandler (
473
460
  action,
474
461
  label: text,
475
462
  value: score >= ai.confidence ? 0 : 1,
476
- sessionStart,
477
463
  ...langsExtension
478
464
  });
479
465
  }
@@ -521,7 +507,6 @@ function onInteractionHandler (
521
507
  action,
522
508
  label,
523
509
  value,
524
- sessionStart,
525
510
  ...langsExtension
526
511
  });
527
512
  }
@@ -537,7 +522,7 @@ function onInteractionHandler (
537
522
  timestamp,
538
523
  nonInteractive,
539
524
  createSession,
540
- timeZone
525
+ metadata
541
526
  ),
542
527
  sessionPromise
543
528
  ]);