wingbot 3.46.0-alpha.3 → 3.46.0-alpha.5

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.3",
3
+ "version": "3.46.0-alpha.5",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  "doc": "npm run doc:gql && node ./bin/makeApiDoc.js && cpy ./CHANGELOG.md ./doc && gitbook install ./doc && gitbook build ./doc && rimraf -rf ./docs && rimraf --rf ./doc/CHANGELOG.md && move-cli ./doc/_book ./docs",
10
10
  "test": "npm run test:lint && npm run test:coverage && npm run test:coverage:threshold",
11
11
  "test:coverage": "nyc --reporter=html mocha ./test && nyc report",
12
- "test:coverage:threshold": "nyc check-coverage --lines 90 --functions 90 --branches 80",
12
+ "test:coverage:threshold": "nyc check-coverage --lines 90 --functions 89 --branches 80",
13
13
  "test:backend": "mocha ./test",
14
14
  "test:lint": "eslint --ext .js src test *.js plugins"
15
15
  },
@@ -32,6 +32,7 @@ const {
32
32
  * @prop {string} [label]
33
33
  * @prop {number} [value]
34
34
  * @prop {string} [lang]
35
+ * @prop {number} [sessionStart]
35
36
  */
36
37
 
37
38
  /**
@@ -51,7 +52,6 @@ const {
51
52
  * @prop {boolean} withUser
52
53
  * @prop {string} [userId]
53
54
  * @prop {number} [feedback]
54
- * @prop {number} sessionStart
55
55
  * @prop {number} sessionDuration
56
56
  * @prop {string} [winnerAction]
57
57
  * @prop {string} [winnerIntent]
@@ -344,7 +344,7 @@ function onInteractionHandler (
344
344
  sessionStart,
345
345
  sessionDuration: sessionTs - sessionStart,
346
346
  feedback,
347
- skill: webalize(skill),
347
+ skill: (skill && webalize(skill)) || noneAction,
348
348
  snapshot,
349
349
  botId,
350
350
  winnerAction,
@@ -359,10 +359,15 @@ function onInteractionHandler (
359
359
  allActions
360
360
  };
361
361
 
362
+ const notHandled = actions.some((a) => a.match(/\*$/)) && !req.isQuickReply();
363
+ const value = notHandled ? 1 : 0;
364
+
362
365
  trackEvents.push({
363
366
  type: TrackingType.PAGE_VIEW,
364
367
  category: asCategory(TrackingCategory.PAGE_VIEW_FIRST),
365
368
  action,
369
+ label: (isText || isQuickReply ? text : null),
370
+ value,
366
371
  allActions,
367
372
  nonInteractive,
368
373
  lastAction,
@@ -370,6 +375,8 @@ function onInteractionHandler (
370
375
  skill,
371
376
  lang,
372
377
  cd1: req.state.lang,
378
+ isGoto: false,
379
+ sessionStart,
373
380
  ...(hasExtendedEvents ? {} : actionMeta)
374
381
  });
375
382
 
@@ -381,12 +388,14 @@ function onInteractionHandler (
381
388
  type: TrackingType.PAGE_VIEW,
382
389
  category: asCategory(TrackingCategory.PAGE_VIEW_SUBSEQUENT),
383
390
  action: a,
391
+ value: 0,
384
392
  allActions,
385
393
  nonInteractive: false,
386
394
  lastAction,
387
395
  prevAction,
388
396
  skill,
389
397
  isGoto: true,
398
+ sessionStart,
390
399
  ...langsExtension
391
400
  };
392
401
 
@@ -397,14 +406,15 @@ function onInteractionHandler (
397
406
 
398
407
  trackEvents.push(
399
408
  ...events.map(({
400
- type, category, action: eventAction, label, value
409
+ type, category, action: eventAction, label, value: eVal
401
410
  }) => ({
402
411
  lastAction,
403
412
  type,
404
413
  category,
405
414
  action: eventAction,
406
415
  label,
407
- value,
416
+ value: eVal,
417
+ sessionStart,
408
418
  ...langsExtension
409
419
  }))
410
420
  );
@@ -421,15 +431,13 @@ function onInteractionHandler (
421
431
  action,
422
432
  label: text,
423
433
  value: score >= ai.confidence ? 0 : 1,
434
+ sessionStart,
424
435
  ...langsExtension
425
436
  });
426
437
  }
427
438
 
428
- const notHandled = actions.some((a) => a.match(/\*$/)) && !req.isQuickReply();
429
-
430
439
  let actionCategory;
431
440
  let label = noneAction;
432
- const value = notHandled ? 1 : 0;
433
441
 
434
442
  if (isPassThread) {
435
443
  actionCategory = TrackingCategory.HANDOVER_TO_BOT;
@@ -458,7 +466,7 @@ function onInteractionHandler (
458
466
  actionCategory = TrackingCategory.REFERRAL;
459
467
  } else if (isPostback) {
460
468
  actionCategory = TrackingCategory.POSTBACK_BUTTON;
461
- label = req.event.postback.title || '(unknown)';
469
+ label = req.event.postback.title || (useExtendedScalars ? null : '(unknown)');
462
470
  } else {
463
471
  actionCategory = TrackingCategory.OTHER;
464
472
  }
@@ -472,6 +480,7 @@ function onInteractionHandler (
472
480
  action,
473
481
  label,
474
482
  value,
483
+ sessionStart,
475
484
  ...langsExtension
476
485
  });
477
486
  }