wingbot 3.46.0-alpha.1 → 3.46.0-alpha.2

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.1",
3
+ "version": "3.46.0-alpha.2",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -42,6 +42,10 @@ const TrackingType = { // max length 12
42
42
  * @enum {string} TrackingCategory
43
43
  */
44
44
  const TrackingCategory = { // max length 3
45
+ // PAGE_VIEW: 'page_view'
46
+ PAGE_VIEW_FIRST: 'pf',
47
+ PAGE_VIEW_SUBSEQUENT: 'pp',
48
+
45
49
  // CONVERSATION_EVENT: 'conversation'
46
50
  STICKER: 'sti',
47
51
  IMAGE: 'img',
@@ -70,6 +74,10 @@ const TrackingCategory = { // max length 3
70
74
  * @type {Object<TrackingCategory,string>}
71
75
  */
72
76
  const CATEGORY_LABELS = {
77
+ // PAGE_VIEW: 'page_view'
78
+ [TrackingCategory.PAGE_VIEW_FIRST]: 'Bot: Interaction',
79
+ [TrackingCategory.PAGE_VIEW_SUBSEQUENT]: 'Bot: Sub-interaction',
80
+
73
81
  // CONVERSATION_EVENT: 'conversation'
74
82
  [TrackingCategory.STICKER]: 'User: Sticker',
75
83
  [TrackingCategory.IMAGE]: 'User: Image',
@@ -31,6 +31,46 @@ const {
31
31
  * @prop {string} [action]
32
32
  * @prop {string} [label]
33
33
  * @prop {number} [value]
34
+ * @prop {string} [lang]
35
+ */
36
+
37
+ /**
38
+ * @typedef {object} ConversationEventExtension
39
+ * @prop {string} [skill]
40
+ * @prop {string} [text]
41
+ * @prop {string} [expected]
42
+ * @prop {boolean} expectedTaken
43
+ * @prop {boolean} isContextUpdate
44
+ * @prop {boolean} isAttachment
45
+ * @prop {boolean} isNotification
46
+ * @prop {boolean} isQuickReply
47
+ * @prop {boolean} isPassThread
48
+ * @prop {boolean} isPostback
49
+ * @prop {boolean} isText
50
+ * @prop {boolean} didHandover
51
+ * @prop {boolean} withUser
52
+ * @prop {string} [userId]
53
+ * @prop {number} [feedback]
54
+ * @prop {number} sessionStart
55
+ * @prop {number} sessionDuration
56
+ * @prop {string} [winnerAction]
57
+ * @prop {string} [winnerIntent]
58
+ * @prop {string[]|string} [winnerEntities]
59
+ * @prop {number} [winnerScore]
60
+ * @prop {boolean} [winnerTaken]
61
+ * @prop {string} [intent]
62
+ * @prop {number} [intentScore]
63
+ * @prop {string[]|string} [entities]
64
+ * @prop {string[]|string} allActions
65
+ * @prop {boolean} nonInteractive
66
+ * @prop {string} [snapshot]
67
+ * @prop {string} [botId]
68
+ *
69
+ * @typedef {Event & ConversationEventExtension} ConversationEvent
70
+ */
71
+
72
+ /**
73
+ * @typedef {ConversationEvent | Event} TrackingEvent
34
74
  */
35
75
 
36
76
  /**
@@ -59,7 +99,7 @@ const {
59
99
  * @param {string} pageId
60
100
  * @param {string} senderId
61
101
  * @param {string} sessionId
62
- * @param {Event[]} events
102
+ * @param {TrackingEvent[]} events
63
103
  * @param {GAUser} [user]
64
104
  * @param {number} [ts]
65
105
  * @param {boolean} [nonInteractive]
@@ -98,7 +138,7 @@ const {
98
138
 
99
139
  /**
100
140
  * @typedef {object} TrackingEvents
101
- * @prop {Event[]} events
141
+ * @prop {TrackingEvent[]} events
102
142
  */
103
143
 
104
144
  /**
@@ -313,6 +353,7 @@ function onInteractionHandler (
313
353
 
314
354
  trackEvents.push({
315
355
  type: TrackingType.PAGE_VIEW,
356
+ category: asCategory(TrackingCategory.PAGE_VIEW_FIRST),
316
357
  action,
317
358
  allActions,
318
359
  nonInteractive,
@@ -330,6 +371,7 @@ function onInteractionHandler (
330
371
  ...otherActions.map((a) => {
331
372
  const r = {
332
373
  type: TrackingType.PAGE_VIEW,
374
+ category: asCategory(TrackingCategory.PAGE_VIEW_SUBSEQUENT),
333
375
  action: a,
334
376
  allActions,
335
377
  nonInteractive: false,