wingbot 3.61.5 → 3.62.1

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.61.5",
3
+ "version": "3.62.1",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -536,69 +536,68 @@ function onInteractionHandler (
536
536
  }))
537
537
  );
538
538
 
539
- if (!nonInteractive) {
540
- if (req.isText()) {
541
- trackEvents.push({
542
- type: TrackingType.TRAINING,
543
- // @ts-ignore
544
- lastAction,
545
- category: asCategory(TrackingCategory.INTENT_DETECTION),
546
- intent,
547
- action,
548
- label: text,
549
- value: score >= ai.confidence ? 0 : 1,
550
- ...langsExtension
551
- });
552
- }
553
-
554
- let actionCategory;
555
- let label = noneAction;
556
-
557
- if (isPassThread) {
558
- actionCategory = TrackingCategory.HANDOVER_TO_BOT;
559
- } else if (req.isSticker()) {
560
- actionCategory = TrackingCategory.STICKER;
561
- label = req.attachmentUrl(0);
562
- } else if (req.isImage()) {
563
- actionCategory = TrackingCategory.IMAGE;
564
- label = req.attachmentUrl(0);
565
- } else if (req.hasLocation()) {
566
- actionCategory = TrackingCategory.LOCATION;
567
- const { lat, long } = req.getLocation();
568
- label = `${lat}, ${long}`;
569
- } else if (isAttachment) {
570
- actionCategory = TrackingCategory.ATTACHMENT;
571
- label = req.attachment(0).type;
572
- } else if (isText) {
573
- actionCategory = TrackingCategory.TEXT;
574
- label = text;
575
- } else if (isQuickReply) {
576
- actionCategory = TrackingCategory.QUICK_REPLY;
577
- label = text;
578
- } else if (req.isOptin()) {
579
- actionCategory = TrackingCategory.OPT_IN;
580
- } else if (req.isReferral()) {
581
- actionCategory = TrackingCategory.REFERRAL;
582
- } else if (isPostback) {
583
- actionCategory = TrackingCategory.POSTBACK_BUTTON;
584
- label = req.event.postback.title || (useExtendedScalars ? null : '(unknown)');
585
- } else {
586
- actionCategory = TrackingCategory.OTHER;
587
- }
588
-
539
+ if (req.isText()) {
589
540
  trackEvents.push({
590
- ...(analyticsStorage.hasExtendedEvents ? actionMeta : {}),
591
- type: TrackingType.CONVERSATION_EVENT,
541
+ type: TrackingType.TRAINING,
542
+ // @ts-ignore
592
543
  lastAction,
593
- category: asCategory(actionCategory),
544
+ category: asCategory(TrackingCategory.INTENT_DETECTION),
545
+ intent,
594
546
  action,
595
- label,
596
- value,
597
- pageCategory,
547
+ label: text,
548
+ value: score >= ai.confidence ? 0 : 1,
598
549
  ...langsExtension
599
550
  });
600
551
  }
601
552
 
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
+
602
601
  await Promise.all([
603
602
  analyticsStorage.storeEvents(
604
603
  pageId,
@@ -151,7 +151,13 @@ class Notifications extends EventEmitter {
151
151
 
152
152
  this._storage = notificationStorage;
153
153
  this._log = options.log || console;
154
+
155
+ /** @type {number} */
154
156
  this.limit = DEFAULT_LIMIT;
157
+
158
+ /** @type {number} */
159
+ this.sendLimit = DEFAULT_LIMIT;
160
+
155
161
  this._default24Clearance = options.default24Clearance || DEFAULT_24_CLEARANCE;
156
162
  this._allAudienceTag = typeof options.allAudienceTag !== 'undefined'
157
163
  ? options.allAudienceTag
@@ -824,7 +830,7 @@ class Notifications extends EventEmitter {
824
830
 
825
831
  while (run) {
826
832
  const now = timeStart + (Date.now() - begin);
827
- const pop = await this._storage.popTasks(this.limit, now);
833
+ const pop = await this._storage.popTasks(this.sendLimit, now);
828
834
  await this._processPoppedTasks(pop, processor);
829
835
 
830
836
  run = pop.length !== 0 && (timeStart + timeLimit) > Date.now();