@schibsted/pulse-sdk 8.0.0-rc.15 → 8.0.0-rc.16
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/dist/cjs/Tracker.js +7 -4
- package/dist/cjs/version.js +1 -1
- package/dist/ejs/Tracker.js +8 -5
- package/dist/ejs/version.js +1 -1
- package/dist/types/Tracker.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/Tracker.js
CHANGED
|
@@ -106,6 +106,7 @@ const anonymousEvents = {
|
|
|
106
106
|
trackerEvent: events_anonymous_node_1.anonymousTrackerEvent,
|
|
107
107
|
engagementEvent: events_anonymous_node_1.anonymousEngagementEvent,
|
|
108
108
|
};
|
|
109
|
+
const ANONYMOUS_EVENT_FORBIDDEN_FIELDS = ['session', 'actor', 'device', 'location', 'pageViewId'];
|
|
109
110
|
/**
|
|
110
111
|
* @typeParam T Type of event to track
|
|
111
112
|
* @param name
|
|
@@ -464,11 +465,11 @@ class Tracker {
|
|
|
464
465
|
*/
|
|
465
466
|
async trackAnonymous(eventType, input, options) {
|
|
466
467
|
// We must create the event as soon as possible, as it defines the creationDate.
|
|
467
|
-
const newEvent = this.createAnonymousEvent(input);
|
|
468
|
+
const newEvent = (0, utils_1.omit)(this.createAnonymousEvent(input), ANONYMOUS_EVENT_FORBIDDEN_FIELDS);
|
|
468
469
|
// Remote config values ----------------
|
|
469
470
|
await this._applyRemoteConfigEndpoints();
|
|
470
471
|
// Resolve all available properties ----------------
|
|
471
|
-
const resolvedOutput = await Promise.all([this.resolveTrackInput(newEvent), this.
|
|
472
|
+
const resolvedOutput = await Promise.all([this.resolveTrackInput(newEvent), this.resolveAnonymousTrackGlobals()]);
|
|
472
473
|
let eventOutput = resolvedOutput.reduce((acc, p) => (0, utils_1.pulseMerge)(acc, p), {});
|
|
473
474
|
eventOutput = this.applyAnonymousEventTypeDefaults(eventOutput, eventType);
|
|
474
475
|
// Leave Events ----------------
|
|
@@ -482,6 +483,7 @@ class Tracker {
|
|
|
482
483
|
eventInput: eventOutput,
|
|
483
484
|
sdkConfig: this.state,
|
|
484
485
|
});
|
|
486
|
+
eventOutput = (0, utils_1.omit)(eventOutput, ANONYMOUS_EVENT_FORBIDDEN_FIELDS);
|
|
485
487
|
if (options?.bookmarkKey) {
|
|
486
488
|
this.bookmark.set(options.bookmarkKey, eventOutput);
|
|
487
489
|
}
|
|
@@ -2307,8 +2309,9 @@ class Tracker {
|
|
|
2307
2309
|
/**
|
|
2308
2310
|
* @private
|
|
2309
2311
|
*/
|
|
2310
|
-
async
|
|
2311
|
-
|
|
2312
|
+
async resolveAnonymousTrackGlobals() {
|
|
2313
|
+
// Omit before evaluation so forbidden promise/function builders cannot delay or fail anonymous tracking.
|
|
2314
|
+
return (0, utils_1.evaluateAndFlatten)((0, utils_1.omit)(this.builders, ANONYMOUS_EVENT_FORBIDDEN_FIELDS));
|
|
2312
2315
|
}
|
|
2313
2316
|
/**
|
|
2314
2317
|
* Send all anonymous events that are in the internal anonymous event queue.
|
package/dist/cjs/version.js
CHANGED
package/dist/ejs/Tracker.js
CHANGED
|
@@ -21,7 +21,7 @@ import * as config from './remoteConfig';
|
|
|
21
21
|
import { buildAnonymousViewUIElementEvent, buildCompletedHealthActionEvent, buildEngagementAffiliateEvent, buildEngagementAudioEvent, buildEngagementFormEvent, buildEngagementHealthUIElementEvent, buildEngagementOfferEvent, buildEngagementTeaserEvent, buildEngagementTvModuleEvent, buildEngagementUIElementEvent, buildEngagementVideoAdEvent, buildEngagementVideoEvent, buildEngagementWidgetEvent, buildImpressionAdSlotEvent, buildImpressionAffiliateEvent, buildImpressionFormEvent, buildImpressionHealthUIElementEvent, buildImpressionOfferEvent, buildImpressionPlayerEvent, buildImpressionTeaserEvent, buildImpressionUIElementEvent, buildImpressionWidgetEvent, buildLeaveArticleEvent, buildLeaveAudioPageEvent, buildLeaveErrorEvent, buildLeaveFrontpageEvent, buildLeaveLandingpageEvent, buildLeaveListingEvent, buildLeaveLockedArticleEvent, buildLeaveLockedAudioPageEvent, buildLeaveLockedVideoPageEvent, buildLeavePageEvent, buildLeaveSportsPageEvent, buildLeaveVideoPageEvent, buildLeaveWeatherEvent, buildViewArticleEvent, buildViewAudioPageEvent, buildViewErrorEvent, buildViewFrontpageEvent, buildViewHealthPageEvent, buildViewLandingpageEvent, buildViewListingEvent, buildViewLockedArticleEvent, buildViewLockedAudioPageEvent, buildViewLockedVideoPageEvent, buildViewPageEvent, buildViewSportsPageEvent, buildViewTitleEvent, buildViewVideoPageEvent, buildViewWeatherEvent, } from './tpaas-builders';
|
|
22
22
|
import { LeaveArticle, LeaveAudioPage, LeaveError, LeaveFrontpage, LeaveLandingpage, LeaveListing, LeaveLockedArticle, LeaveLockedAudioPage, LeaveLockedVideoPage, LeavePage, LeaveSportsPage, LeaveVideoPage, LeaveWeather, ViewArticle, ViewAudioPage, ViewError, ViewFrontpage, ViewHealthPage, ViewLandingpage, ViewListing, ViewLockedArticle, ViewLockedAudioPage, ViewLockedVideoPage, ViewPage, ViewSportsPage, ViewTitle, ViewVideoPage, ViewWeather, } from './tpaas-schemas';
|
|
23
23
|
import { startProxyProviderListener } from './tracker-proxy/proxy-provider';
|
|
24
|
-
import { evaluateAndFlatten, isBrowser, isFunction, isPromise, isString, pulseMerge, throttle } from './utils';
|
|
24
|
+
import { evaluateAndFlatten, isBrowser, isFunction, isPromise, isString, omit, pulseMerge, throttle } from './utils';
|
|
25
25
|
import { SDK_VERSION } from './version';
|
|
26
26
|
import { VisibilityObserver } from './visibility-observer';
|
|
27
27
|
import warnOnce from './warnOnce';
|
|
@@ -63,6 +63,7 @@ const anonymousEvents = {
|
|
|
63
63
|
trackerEvent: anonymousTrackerEvent,
|
|
64
64
|
engagementEvent: anonymousEngagementEvent,
|
|
65
65
|
};
|
|
66
|
+
const ANONYMOUS_EVENT_FORBIDDEN_FIELDS = ['session', 'actor', 'device', 'location', 'pageViewId'];
|
|
66
67
|
/**
|
|
67
68
|
* @typeParam T Type of event to track
|
|
68
69
|
* @param name
|
|
@@ -421,11 +422,11 @@ export default class Tracker {
|
|
|
421
422
|
*/
|
|
422
423
|
async trackAnonymous(eventType, input, options) {
|
|
423
424
|
// We must create the event as soon as possible, as it defines the creationDate.
|
|
424
|
-
const newEvent = this.createAnonymousEvent(input);
|
|
425
|
+
const newEvent = omit(this.createAnonymousEvent(input), ANONYMOUS_EVENT_FORBIDDEN_FIELDS);
|
|
425
426
|
// Remote config values ----------------
|
|
426
427
|
await this._applyRemoteConfigEndpoints();
|
|
427
428
|
// Resolve all available properties ----------------
|
|
428
|
-
const resolvedOutput = await Promise.all([this.resolveTrackInput(newEvent), this.
|
|
429
|
+
const resolvedOutput = await Promise.all([this.resolveTrackInput(newEvent), this.resolveAnonymousTrackGlobals()]);
|
|
429
430
|
let eventOutput = resolvedOutput.reduce((acc, p) => pulseMerge(acc, p), {});
|
|
430
431
|
eventOutput = this.applyAnonymousEventTypeDefaults(eventOutput, eventType);
|
|
431
432
|
// Leave Events ----------------
|
|
@@ -439,6 +440,7 @@ export default class Tracker {
|
|
|
439
440
|
eventInput: eventOutput,
|
|
440
441
|
sdkConfig: this.state,
|
|
441
442
|
});
|
|
443
|
+
eventOutput = omit(eventOutput, ANONYMOUS_EVENT_FORBIDDEN_FIELDS);
|
|
442
444
|
if (options?.bookmarkKey) {
|
|
443
445
|
this.bookmark.set(options.bookmarkKey, eventOutput);
|
|
444
446
|
}
|
|
@@ -2264,8 +2266,9 @@ export default class Tracker {
|
|
|
2264
2266
|
/**
|
|
2265
2267
|
* @private
|
|
2266
2268
|
*/
|
|
2267
|
-
async
|
|
2268
|
-
|
|
2269
|
+
async resolveAnonymousTrackGlobals() {
|
|
2270
|
+
// Omit before evaluation so forbidden promise/function builders cannot delay or fail anonymous tracking.
|
|
2271
|
+
return evaluateAndFlatten(omit(this.builders, ANONYMOUS_EVENT_FORBIDDEN_FIELDS));
|
|
2269
2272
|
}
|
|
2270
2273
|
/**
|
|
2271
2274
|
* Send all anonymous events that are in the internal anonymous event queue.
|
package/dist/ejs/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated by bin/generate-version.js. Do not edit manually.
|
|
2
|
-
export const SDK_VERSION = '8.0.0-rc.
|
|
2
|
+
export const SDK_VERSION = '8.0.0-rc.16';
|
package/dist/types/Tracker.d.ts
CHANGED
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "8.0.0-rc.
|
|
1
|
+
export declare const SDK_VERSION = "8.0.0-rc.16";
|