wingbot 3.46.0-alpha.6 → 3.46.0-alpha.7

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.6",
3
+ "version": "3.46.0-alpha.7",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -260,8 +260,31 @@ function onInteractionHandler (
260
260
  lang
261
261
  } = req.state;
262
262
 
263
+ const trackEvents = [];
264
+
263
265
  const [action = noneAction, ...otherActions] = actions;
264
266
 
267
+ const feedbackEvent = events.find((e) => e.type === TrackingType.REPORT
268
+ && e.category === TrackingCategory.REPORT_FEEDBACK);
269
+ const feedback = feedbackEvent
270
+ ? feedbackEvent.value
271
+ : noneValue;
272
+ let didHandover = flag === ResponseFlag.HANDOVER;
273
+ const hasHandoverEvent = events
274
+ .some((e) => e.category === TrackingCategory.HANDOVER_OCCURRED);
275
+
276
+ if (didHandover && !hasHandoverEvent) {
277
+ trackEvents.push({
278
+ type: TrackingType.REPORT,
279
+ category: asCategory(TrackingCategory.HANDOVER_OCCURRED),
280
+ action: null,
281
+ label: null,
282
+ value: noneValue
283
+ });
284
+ } else if (hasHandoverEvent) {
285
+ didHandover = true;
286
+ }
287
+
265
288
  let sessionPromise;
266
289
  if (createSession) {
267
290
  const metadata = {
@@ -269,7 +292,9 @@ function onInteractionHandler (
269
292
  lang,
270
293
  action,
271
294
  snapshot,
272
- botId
295
+ botId,
296
+ didHandover,
297
+ feedback
273
298
  };
274
299
 
275
300
  sessionPromise = analyticsStorage.createUserSession(
@@ -318,31 +343,7 @@ function onInteractionHandler (
318
343
  winnerTaken = action === winnerAction;
319
344
  }
320
345
 
321
- const trackEvents = [];
322
-
323
346
  const expected = req.expected() ? req.expected().action : '';
324
-
325
- const feedbackEvent = events.find((e) => e.type === TrackingType.REPORT
326
- && e.category === TrackingCategory.REPORT_FEEDBACK);
327
- const feedback = feedbackEvent
328
- ? feedbackEvent.value
329
- : noneValue;
330
- let didHandover = flag === ResponseFlag.HANDOVER;
331
- const hasHandoverEvent = events
332
- .some((e) => e.category === TrackingCategory.HANDOVER_OCCURRED);
333
-
334
- if (didHandover && !hasHandoverEvent) {
335
- trackEvents.push({
336
- type: TrackingType.REPORT,
337
- category: asCategory(TrackingCategory.HANDOVER_OCCURRED),
338
- action: null,
339
- label: null,
340
- value: noneValue
341
- });
342
- } else if (hasHandoverEvent) {
343
- didHandover = true;
344
- }
345
-
346
347
  const user = userExtractor(req.state);
347
348
 
348
349
  const isContextUpdate = req.isSetContext();