wingbot 3.46.0-alpha.2 → 3.46.0-alpha.3
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
|
@@ -122,6 +122,7 @@ const {
|
|
|
122
122
|
* @prop {boolean} [supportsArrays]
|
|
123
123
|
* @prop {boolean} [useDescriptiveCategories]
|
|
124
124
|
* @prop {boolean} [useExtendedScalars]
|
|
125
|
+
* @prop {boolean} [parallelSessionInsert]
|
|
125
126
|
*/
|
|
126
127
|
|
|
127
128
|
/**
|
|
@@ -200,7 +201,8 @@ function onInteractionHandler (
|
|
|
200
201
|
supportsArrays = false,
|
|
201
202
|
useExtendedScalars = false,
|
|
202
203
|
hasExtendedEvents = false,
|
|
203
|
-
useDescriptiveCategories = true
|
|
204
|
+
useDescriptiveCategories = true,
|
|
205
|
+
parallelSessionInsert = false
|
|
204
206
|
} = analyticsStorage;
|
|
205
207
|
|
|
206
208
|
const asArray = (data = []) => (supportsArrays ? data : data.join(','));
|
|
@@ -243,6 +245,7 @@ function onInteractionHandler (
|
|
|
243
245
|
|
|
244
246
|
const [action = noneAction, ...otherActions] = actions;
|
|
245
247
|
|
|
248
|
+
let sessionPromise;
|
|
246
249
|
if (createSession) {
|
|
247
250
|
const metadata = {
|
|
248
251
|
sessionCount,
|
|
@@ -252,7 +255,7 @@ function onInteractionHandler (
|
|
|
252
255
|
botId
|
|
253
256
|
};
|
|
254
257
|
|
|
255
|
-
|
|
258
|
+
sessionPromise = analyticsStorage.createUserSession(
|
|
256
259
|
pageId,
|
|
257
260
|
senderId,
|
|
258
261
|
sessionId,
|
|
@@ -261,6 +264,11 @@ function onInteractionHandler (
|
|
|
261
264
|
nonInteractive,
|
|
262
265
|
timeZone
|
|
263
266
|
);
|
|
267
|
+
|
|
268
|
+
if (!parallelSessionInsert) {
|
|
269
|
+
await sessionPromise;
|
|
270
|
+
sessionPromise = null;
|
|
271
|
+
}
|
|
264
272
|
}
|
|
265
273
|
|
|
266
274
|
const [{
|
|
@@ -450,7 +458,7 @@ function onInteractionHandler (
|
|
|
450
458
|
actionCategory = TrackingCategory.REFERRAL;
|
|
451
459
|
} else if (isPostback) {
|
|
452
460
|
actionCategory = TrackingCategory.POSTBACK_BUTTON;
|
|
453
|
-
label = req.
|
|
461
|
+
label = req.event.postback.title || '(unknown)';
|
|
454
462
|
} else {
|
|
455
463
|
actionCategory = TrackingCategory.OTHER;
|
|
456
464
|
}
|
|
@@ -468,18 +476,21 @@ function onInteractionHandler (
|
|
|
468
476
|
});
|
|
469
477
|
}
|
|
470
478
|
|
|
471
|
-
await
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
479
|
+
await Promise.all([
|
|
480
|
+
analyticsStorage.storeEvents(
|
|
481
|
+
pageId,
|
|
482
|
+
senderId,
|
|
483
|
+
sessionId,
|
|
484
|
+
// @ts-ignore
|
|
485
|
+
trackEvents,
|
|
486
|
+
user,
|
|
487
|
+
timestamp,
|
|
488
|
+
nonInteractive,
|
|
489
|
+
createSession,
|
|
490
|
+
timeZone
|
|
491
|
+
),
|
|
492
|
+
sessionPromise
|
|
493
|
+
]);
|
|
483
494
|
} catch (e) {
|
|
484
495
|
if (throwException) {
|
|
485
496
|
throw e;
|