wingbot 3.65.6 → 3.65.8

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.65.6",
3
+ "version": "3.65.8",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -536,68 +536,72 @@ function onInteractionHandler (
536
536
  }))
537
537
  );
538
538
 
539
- if (req.isText()) {
539
+ const skipThisInteraction = responseTexts.length === 0 && nonInteractive;
540
+
541
+ if (!skipThisInteraction) {
542
+ if (req.isText()) {
543
+ trackEvents.push({
544
+ type: TrackingType.TRAINING,
545
+ // @ts-ignore
546
+ lastAction,
547
+ category: asCategory(TrackingCategory.INTENT_DETECTION),
548
+ intent,
549
+ action,
550
+ label: text,
551
+ value: score >= ai.confidence ? 0 : 1,
552
+ ...langsExtension
553
+ });
554
+ }
555
+
556
+ let actionCategory;
557
+ let label = noneAction;
558
+
559
+ if (isPassThread) {
560
+ actionCategory = TrackingCategory.HANDOVER_TO_BOT;
561
+ } else if (req.isSticker()) {
562
+ actionCategory = TrackingCategory.STICKER;
563
+ label = req.attachmentUrl(0);
564
+ } else if (req.isImage()) {
565
+ actionCategory = TrackingCategory.IMAGE;
566
+ label = req.attachmentUrl(0);
567
+ } else if (req.hasLocation()) {
568
+ actionCategory = TrackingCategory.LOCATION;
569
+ const { lat, long } = req.getLocation();
570
+ label = `${lat}, ${long}`;
571
+ } else if (isAttachment) {
572
+ actionCategory = TrackingCategory.ATTACHMENT;
573
+ label = req.attachment(0).type;
574
+ } else if (isText) {
575
+ actionCategory = TrackingCategory.TEXT;
576
+ label = text;
577
+ } else if (isQuickReply) {
578
+ actionCategory = TrackingCategory.QUICK_REPLY;
579
+ label = text;
580
+ } else if (req.isOptin()) {
581
+ actionCategory = TrackingCategory.OPT_IN;
582
+ } else if (req.isReferral()) {
583
+ actionCategory = TrackingCategory.REFERRAL;
584
+ } else if (isPostback) {
585
+ actionCategory = TrackingCategory.POSTBACK_BUTTON;
586
+ label = req.event.postback.title || (useExtendedScalars ? null : '(unknown)');
587
+ } else {
588
+ actionCategory = TrackingCategory.OTHER;
589
+ }
590
+
540
591
  trackEvents.push({
541
- type: TrackingType.TRAINING,
542
- // @ts-ignore
592
+ ...(analyticsStorage.hasExtendedEvents ? actionMeta : {}),
593
+ type: TrackingType.CONVERSATION_EVENT,
543
594
  lastAction,
544
- category: asCategory(TrackingCategory.INTENT_DETECTION),
545
- intent,
595
+ category: asCategory(actionCategory),
546
596
  action,
547
- label: text,
548
- value: score >= ai.confidence ? 0 : 1,
597
+ label,
598
+ value,
599
+ pageCategory,
600
+ nonInteractive,
549
601
  ...langsExtension
550
602
  });
551
603
  }
552
604
 
553
- let actionCategory;
554
- let label = noneAction;
555
-
556
- if (isPassThread) {
557
- actionCategory = TrackingCategory.HANDOVER_TO_BOT;
558
- } else if (req.isSticker()) {
559
- actionCategory = TrackingCategory.STICKER;
560
- label = req.attachmentUrl(0);
561
- } else if (req.isImage()) {
562
- actionCategory = TrackingCategory.IMAGE;
563
- label = req.attachmentUrl(0);
564
- } else if (req.hasLocation()) {
565
- actionCategory = TrackingCategory.LOCATION;
566
- const { lat, long } = req.getLocation();
567
- label = `${lat}, ${long}`;
568
- } else if (isAttachment) {
569
- actionCategory = TrackingCategory.ATTACHMENT;
570
- label = req.attachment(0).type;
571
- } else if (isText) {
572
- actionCategory = TrackingCategory.TEXT;
573
- label = text;
574
- } else if (isQuickReply) {
575
- actionCategory = TrackingCategory.QUICK_REPLY;
576
- label = text;
577
- } else if (req.isOptin()) {
578
- actionCategory = TrackingCategory.OPT_IN;
579
- } else if (req.isReferral()) {
580
- actionCategory = TrackingCategory.REFERRAL;
581
- } else if (isPostback) {
582
- actionCategory = TrackingCategory.POSTBACK_BUTTON;
583
- label = req.event.postback.title || (useExtendedScalars ? null : '(unknown)');
584
- } else {
585
- actionCategory = TrackingCategory.OTHER;
586
- }
587
-
588
- trackEvents.push({
589
- ...(analyticsStorage.hasExtendedEvents ? actionMeta : {}),
590
- type: TrackingType.CONVERSATION_EVENT,
591
- lastAction,
592
- category: asCategory(actionCategory),
593
- action,
594
- label,
595
- value,
596
- pageCategory,
597
- nonInteractive,
598
- ...langsExtension
599
- });
600
-
601
605
  await Promise.all([
602
606
  analyticsStorage.storeEvents(
603
607
  pageId,
@@ -10,6 +10,8 @@ const { dateToISO8601String, zeroHourDate } = require('./datetime');
10
10
 
11
11
  /**
12
12
  * @typedef {object} IStateRequest
13
+ * @prop {string} [senderId]
14
+ * @prop {string} [pageId]
13
15
  * @prop {object} [state]
14
16
  * @prop {object} [configuration]
15
17
  * @prop {Function} text
@@ -38,7 +40,14 @@ module.exports = function stateData (req, res = null, configuration = null, stat
38
40
  now.setDate(now.getDate() - 2);
39
41
  const $yesterday = dateToISO8601String(zeroHourDate(now), true);
40
42
 
43
+ const {
44
+ senderId,
45
+ pageId
46
+ } = req;
47
+
41
48
  return {
49
+ senderId,
50
+ pageId,
42
51
  c,
43
52
  configuration: c,
44
53
  ...req.state,