@schibsted/pulse-sdk 8.0.0-rc.17 → 8.0.0-rc.18
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 +210 -74
- package/dist/cjs/tpaas-builders/builders/pageContent.js +7 -0
- package/dist/cjs/tpaas-builders/builders/pageSports.js +7 -0
- package/dist/cjs/tpaas-builders/builders/trackerBuilder.js +1 -3
- package/dist/cjs/tpaas-builders/builders.js +47 -27
- package/dist/cjs/tpaas-schemas/constants.js +85 -57
- package/dist/cjs/tracker-proxy/consts.js +4 -0
- package/dist/cjs/version.js +1 -1
- package/dist/ejs/Tracker.js +212 -76
- package/dist/ejs/tpaas-builders/builders/pageContent.js +3 -0
- package/dist/ejs/tpaas-builders/builders/pageSports.js +3 -0
- package/dist/ejs/tpaas-builders/builders/trackerBuilder.js +1 -3
- package/dist/ejs/tpaas-builders/builders.js +44 -28
- package/dist/ejs/tpaas-schemas/constants.js +83 -55
- package/dist/ejs/tracker-proxy/consts.js +4 -0
- package/dist/ejs/version.js +1 -1
- package/dist/types/Tracker.d.ts +25 -16
- package/dist/types/tpaas-builders/builders/pageContent.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/pageSports.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/trackerBuilder.d.ts +1 -1
- package/dist/types/tpaas-builders/builders.d.ts +5 -3
- package/dist/types/tpaas-builders/types.d.ts +4 -3
- package/dist/types/tpaas-schemas/constants.d.ts +83 -55
- package/dist/types/tpaas-schemas/types/ITpaasEvent.d.ts +8 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementAffiliate.d.ts +5 -1
- package/dist/types/tpaas-schemas/types/schemas/IEngagementSportsUIElement.d.ts +107 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionAffiliate.d.ts +5 -1
- package/dist/types/tpaas-schemas/types/schemas/IImpressionSportsUIElement.d.ts +109 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveListing.d.ts +1 -1
- package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedPage.d.ts +90 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewListing.d.ts +1 -1
- package/dist/types/tpaas-schemas/types/schemas/IViewLockedPage.d.ts +94 -0
- package/dist/types/tpaas-schemas/types/schemas/index.d.ts +4 -0
- package/dist/types/tpaas-schemas/types/templates/ISession.d.ts +1 -1
- package/dist/types/tpaas-schemas/types/templates/ITracker.d.ts +0 -10
- package/dist/types/tpaas-schemas/types.d.ts +6 -3
- package/dist/types/tracker-proxy/consts.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/Tracker.js
CHANGED
|
@@ -172,12 +172,12 @@ function unsubscribe(eventName, callback) {
|
|
|
172
172
|
* @class Tracker
|
|
173
173
|
*/
|
|
174
174
|
class Tracker {
|
|
175
|
-
async getCurrentTpaasPage() {
|
|
176
|
-
const { id, type, url } = await
|
|
175
|
+
async getCurrentTpaasPage(currentPageInfo = this.currentPageContext.info) {
|
|
176
|
+
const { id, type, url } = await currentPageInfo;
|
|
177
177
|
return (0, map_page_to_page_ref_1.mapPageToPageRef)(id, type, url);
|
|
178
178
|
}
|
|
179
179
|
async getCurrentLegacyPage() {
|
|
180
|
-
const { id, type, url } = await this.
|
|
180
|
+
const { id, type, url } = await this.currentPageContext.info;
|
|
181
181
|
// make sure the pageType is valid for legacy events
|
|
182
182
|
const validatedType = (0, types_1.isLegacyPageType)(type) ? type : 'Page';
|
|
183
183
|
return {
|
|
@@ -206,37 +206,33 @@ class Tracker {
|
|
|
206
206
|
this.legacyVisibilityObservers = new Map();
|
|
207
207
|
this.visibilityObservers = new Map();
|
|
208
208
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* This is used as the source of truth for the current page's information, which is updated based on the View Page-level event
|
|
212
|
-
* As a single source of truth for the current page, this needs to be compatible between legacy and TPaaS events, hence the need for a custom data type.
|
|
213
|
-
* Legacy events can provide an id with SDRN, while TPaaS events don't need it
|
|
209
|
+
* Current page state shared by legacy and TPaaS tracking. See CurrentPageContext for
|
|
210
|
+
* which properties are shared and which are exclusively TPaaS metadata.
|
|
214
211
|
*/
|
|
215
|
-
this.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* @private
|
|
222
|
-
*
|
|
223
|
-
* This is used as the source of truth for the current page's referrer information, which is updated based on the View Page-level event
|
|
224
|
-
* !! This is only used in TPaaS events and contexts, as we don't want to risk changing the behaviour of legacy events
|
|
225
|
-
* This is also the reason this is being kept as a separate variable from the currentPageInfo property,
|
|
226
|
-
* which is used for both legacy and TPaaS events
|
|
227
|
-
*/
|
|
228
|
-
this.currentPageReferrer = {
|
|
229
|
-
url: utils_1.isBrowser ? document.referrer || undefined : undefined,
|
|
230
|
-
};
|
|
231
|
-
this.setCurrentTpaasPageData = (id, type, referrer) => {
|
|
232
|
-
this.currentPageInfo = {
|
|
233
|
-
id: id || 'unknown',
|
|
234
|
-
type: type || 'Page',
|
|
212
|
+
this.currentPageContext = {
|
|
213
|
+
info: {
|
|
214
|
+
id: 'unknown',
|
|
215
|
+
type: 'Page',
|
|
235
216
|
url: utils_1.isBrowser ? window.location.href : undefined,
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
217
|
+
},
|
|
218
|
+
referrer: {
|
|
219
|
+
url: utils_1.isBrowser ? document.referrer || undefined : undefined,
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
this.setCurrentTpaasPageData = ({ id, type, referrer, content, sports, }) => {
|
|
223
|
+
// TPaaS Views replace the context, intentionally resetting omitted content and sports.
|
|
224
|
+
this.currentPageContext = {
|
|
225
|
+
info: {
|
|
226
|
+
id: id || 'unknown',
|
|
227
|
+
type: type || 'Page',
|
|
228
|
+
url: utils_1.isBrowser ? window.location.href : undefined,
|
|
229
|
+
},
|
|
230
|
+
referrer: {
|
|
231
|
+
...referrer,
|
|
232
|
+
url: referrer?.url ?? (utils_1.isBrowser ? document.referrer || undefined : undefined),
|
|
233
|
+
},
|
|
234
|
+
content,
|
|
235
|
+
sports,
|
|
240
236
|
};
|
|
241
237
|
};
|
|
242
238
|
/**
|
|
@@ -250,8 +246,9 @@ class Tracker {
|
|
|
250
246
|
*/
|
|
251
247
|
this.hasProxyListener = false;
|
|
252
248
|
this.setPageDefaults = (pageViewEvent) => {
|
|
253
|
-
|
|
254
|
-
this.
|
|
249
|
+
// Legacy Views update only the shared properties, preserving TPaaS-only content and sports.
|
|
250
|
+
this.currentPageContext.info = (0, page_from_page_view_1.pageFromPageView)(pageViewEvent);
|
|
251
|
+
this.currentPageContext.referrer = Promise.resolve(pageViewEvent.origin).then((originProperties) => (0, map_page_to_page_ref_1.mapPageToPageRef)(originProperties?.id, originProperties?.type, originProperties?.url));
|
|
255
252
|
if (pageViewEvent.origin) {
|
|
256
253
|
const pageDefaults = { origin: pageViewEvent.origin };
|
|
257
254
|
this.update(pageDefaults, true);
|
|
@@ -517,6 +514,11 @@ class Tracker {
|
|
|
517
514
|
* @category TPaaS Tracking
|
|
518
515
|
*/
|
|
519
516
|
async prepareAnonymousTpaasEvent() {
|
|
517
|
+
const { isHybrid, pageViewId, providerId, component, componentVersion, deployStageTpaas } = this.state;
|
|
518
|
+
const providerName = this.state.provider?.name;
|
|
519
|
+
const providerGroup = this.state.provider?.group;
|
|
520
|
+
const experimentsInput = this.builders.experiments;
|
|
521
|
+
const currentPageReferrerInput = this.currentPageContext.referrer;
|
|
520
522
|
try {
|
|
521
523
|
await this._applyRemoteConfigEndpoints();
|
|
522
524
|
}
|
|
@@ -524,20 +526,19 @@ class Tracker {
|
|
|
524
526
|
loglevel_1.default.trace('Failed to sync remote config', ex);
|
|
525
527
|
}
|
|
526
528
|
const [experiments, currentPageReferrer] = await Promise.all([
|
|
527
|
-
this.adaptExperiments(
|
|
528
|
-
|
|
529
|
+
this.adaptExperiments(experimentsInput),
|
|
530
|
+
currentPageReferrerInput,
|
|
529
531
|
]);
|
|
530
532
|
return {
|
|
531
|
-
autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
|
|
532
533
|
version: version_1.SDK_VERSION,
|
|
533
|
-
isHybrid: !!
|
|
534
|
-
pageviewId:
|
|
535
|
-
providerId
|
|
536
|
-
providerName
|
|
537
|
-
providerGroup
|
|
538
|
-
component
|
|
539
|
-
componentVersion
|
|
540
|
-
routingStage: mapDeployStageToTpaasStage(
|
|
534
|
+
isHybrid: !!isHybrid,
|
|
535
|
+
pageviewId: pageViewId,
|
|
536
|
+
providerId,
|
|
537
|
+
providerName,
|
|
538
|
+
providerGroup,
|
|
539
|
+
component,
|
|
540
|
+
componentVersion,
|
|
541
|
+
routingStage: mapDeployStageToTpaasStage(deployStageTpaas),
|
|
541
542
|
experiments,
|
|
542
543
|
currentPageReferrer,
|
|
543
544
|
};
|
|
@@ -547,8 +548,15 @@ class Tracker {
|
|
|
547
548
|
* @category TPaaS Tracking
|
|
548
549
|
*/
|
|
549
550
|
async prepareTpaasEvent() {
|
|
551
|
+
// Capture event context before any asynchronous work so a concurrent update or View
|
|
552
|
+
// event cannot change the dependencies used to finish building this event.
|
|
553
|
+
const builders = { ...this.builders };
|
|
554
|
+
const { isHybrid, providerId, component, componentVersion, pageViewId, deployStageTpaas } = this.state;
|
|
555
|
+
const providerName = this.state.provider?.name;
|
|
556
|
+
const providerGroup = this.state.provider?.group;
|
|
557
|
+
const { info: currentPageInfoInput, content: currentPageContent, sports: currentPageSports, referrer: currentPageReferrerInput, } = this.currentPageContext;
|
|
550
558
|
try {
|
|
551
|
-
await this.syncRemoteResources(undefined,
|
|
559
|
+
await this.syncRemoteResources(undefined, builders);
|
|
552
560
|
}
|
|
553
561
|
catch (ex) {
|
|
554
562
|
loglevel_1.default.trace('Failed to sync remote resources', ex);
|
|
@@ -602,28 +610,31 @@ class Tracker {
|
|
|
602
610
|
source: source || 'unknown',
|
|
603
611
|
};
|
|
604
612
|
}
|
|
613
|
+
// Consents are intentionally not part of the event-context snapshot. Read them after
|
|
614
|
+
// remote synchronization so a blocking tracking call can use newly resolved consents.
|
|
605
615
|
const [actor, consents, experiments, currentPage, currentPageReferrer] = await Promise.all([
|
|
606
|
-
|
|
616
|
+
identity.getActor(builders),
|
|
607
617
|
this.getConsents(),
|
|
608
|
-
this.adaptExperiments(
|
|
609
|
-
this.getCurrentTpaasPage(),
|
|
610
|
-
|
|
618
|
+
this.adaptExperiments(builders.experiments),
|
|
619
|
+
this.getCurrentTpaasPage(currentPageInfoInput),
|
|
620
|
+
currentPageReferrerInput,
|
|
611
621
|
]);
|
|
612
622
|
const { environmentId, jwe } = (0, cis_sync_1.parsePulseCookies)();
|
|
613
623
|
return {
|
|
614
|
-
autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
|
|
615
624
|
version: version_1.SDK_VERSION,
|
|
616
|
-
isHybrid: !!
|
|
625
|
+
isHybrid: !!isHybrid,
|
|
617
626
|
user: adaptActorToNewFormat(actor),
|
|
618
627
|
consents: adaptConsentsToNewFormat(consents),
|
|
619
|
-
providerId
|
|
620
|
-
providerName
|
|
621
|
-
providerGroup
|
|
622
|
-
component
|
|
623
|
-
componentVersion
|
|
624
|
-
pageviewId:
|
|
625
|
-
routingStage: mapDeployStageToTpaasStage(
|
|
628
|
+
providerId,
|
|
629
|
+
providerName,
|
|
630
|
+
providerGroup,
|
|
631
|
+
component,
|
|
632
|
+
componentVersion,
|
|
633
|
+
pageviewId: pageViewId,
|
|
634
|
+
routingStage: mapDeployStageToTpaasStage(deployStageTpaas),
|
|
626
635
|
currentPage,
|
|
636
|
+
currentPageContent,
|
|
637
|
+
currentPageSports,
|
|
627
638
|
currentPageReferrer,
|
|
628
639
|
experiments,
|
|
629
640
|
environmentId,
|
|
@@ -883,7 +894,11 @@ class Tracker {
|
|
|
883
894
|
}
|
|
884
895
|
async trackViewHealthPage(input, options) {
|
|
885
896
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
886
|
-
this.setCurrentTpaasPageData(
|
|
897
|
+
this.setCurrentTpaasPageData({
|
|
898
|
+
id: input.object.objectId,
|
|
899
|
+
type: tpaas_schemas_1.ViewHealthPage.object.objectType,
|
|
900
|
+
referrer: input.page?.referrer,
|
|
901
|
+
});
|
|
887
902
|
const dependencies = await this.prepareTpaasEvent();
|
|
888
903
|
const event = (0, tpaas_builders_1.buildViewHealthPageEvent)(input, dependencies);
|
|
889
904
|
const result = this.sendTpaasEvent(event);
|
|
@@ -923,7 +938,11 @@ class Tracker {
|
|
|
923
938
|
*/
|
|
924
939
|
async trackViewPage(input, options) {
|
|
925
940
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
926
|
-
this.setCurrentTpaasPageData(
|
|
941
|
+
this.setCurrentTpaasPageData({
|
|
942
|
+
id: input.object.objectId,
|
|
943
|
+
type: tpaas_schemas_1.ViewPage.object.objectType,
|
|
944
|
+
referrer: input.page?.referrer,
|
|
945
|
+
});
|
|
927
946
|
const dependencies = await this.prepareTpaasEvent();
|
|
928
947
|
const event = (0, tpaas_builders_1.buildViewPageEvent)(input, dependencies);
|
|
929
948
|
const result = this.sendTpaasEvent(event);
|
|
@@ -949,7 +968,12 @@ class Tracker {
|
|
|
949
968
|
*/
|
|
950
969
|
async trackViewSportsPage(input, options) {
|
|
951
970
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
952
|
-
this.setCurrentTpaasPageData(
|
|
971
|
+
this.setCurrentTpaasPageData({
|
|
972
|
+
id: input.object.objectId,
|
|
973
|
+
type: tpaas_schemas_1.ViewSportsPage.object.objectType,
|
|
974
|
+
referrer: input.page?.referrer,
|
|
975
|
+
sports: input.object.sports,
|
|
976
|
+
});
|
|
953
977
|
const dependencies = await this.prepareTpaasEvent();
|
|
954
978
|
const event = (0, tpaas_builders_1.buildViewSportsPageEvent)(input, dependencies);
|
|
955
979
|
const result = this.sendTpaasEvent(event);
|
|
@@ -974,7 +998,11 @@ class Tracker {
|
|
|
974
998
|
*/
|
|
975
999
|
async trackViewTitle(input) {
|
|
976
1000
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
977
|
-
this.setCurrentTpaasPageData(
|
|
1001
|
+
this.setCurrentTpaasPageData({
|
|
1002
|
+
id: input.object.objectId,
|
|
1003
|
+
type: tpaas_schemas_1.ViewTitle.object.objectType,
|
|
1004
|
+
referrer: input.page?.referrer,
|
|
1005
|
+
});
|
|
978
1006
|
const dependencies = await this.prepareTpaasEvent();
|
|
979
1007
|
const event = (0, tpaas_builders_1.buildViewTitleEvent)(input, dependencies);
|
|
980
1008
|
return this.sendTpaasEvent(event);
|
|
@@ -1014,7 +1042,12 @@ class Tracker {
|
|
|
1014
1042
|
*/
|
|
1015
1043
|
async trackViewArticle(input, options) {
|
|
1016
1044
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1017
|
-
this.setCurrentTpaasPageData(
|
|
1045
|
+
this.setCurrentTpaasPageData({
|
|
1046
|
+
id: input.object.objectId,
|
|
1047
|
+
type: tpaas_schemas_1.ViewArticle.object.objectType,
|
|
1048
|
+
referrer: input.page?.referrer,
|
|
1049
|
+
content: input.page?.content,
|
|
1050
|
+
});
|
|
1018
1051
|
const dependencies = await this.prepareTpaasEvent();
|
|
1019
1052
|
const event = (0, tpaas_builders_1.buildViewArticleEvent)(input, dependencies);
|
|
1020
1053
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1075,7 +1108,12 @@ class Tracker {
|
|
|
1075
1108
|
*/
|
|
1076
1109
|
async trackViewAudioPage(input, options) {
|
|
1077
1110
|
this.newPageView();
|
|
1078
|
-
this.setCurrentTpaasPageData(
|
|
1111
|
+
this.setCurrentTpaasPageData({
|
|
1112
|
+
id: input.object.objectId,
|
|
1113
|
+
type: tpaas_schemas_1.ViewAudioPage.object.objectType,
|
|
1114
|
+
referrer: input.page?.referrer,
|
|
1115
|
+
content: input.page?.content,
|
|
1116
|
+
});
|
|
1079
1117
|
const dependencies = await this.prepareTpaasEvent();
|
|
1080
1118
|
const event = (0, tpaas_builders_1.buildViewAudioPageEvent)(input, dependencies);
|
|
1081
1119
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1113,7 +1151,11 @@ class Tracker {
|
|
|
1113
1151
|
*/
|
|
1114
1152
|
async trackViewError(input, options) {
|
|
1115
1153
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1116
|
-
this.setCurrentTpaasPageData(
|
|
1154
|
+
this.setCurrentTpaasPageData({
|
|
1155
|
+
id: input.object.objectId,
|
|
1156
|
+
type: tpaas_schemas_1.ViewError.object.objectType,
|
|
1157
|
+
referrer: input.page?.referrer,
|
|
1158
|
+
});
|
|
1117
1159
|
const dependencies = await this.prepareTpaasEvent();
|
|
1118
1160
|
const event = (0, tpaas_builders_1.buildViewErrorEvent)(input, dependencies);
|
|
1119
1161
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1186,6 +1228,15 @@ class Tracker {
|
|
|
1186
1228
|
const event = (0, tpaas_builders_1.buildImpressionPlayerEvent)(input, dependencies);
|
|
1187
1229
|
return this.sendTpaasEvent(event);
|
|
1188
1230
|
}
|
|
1231
|
+
/**
|
|
1232
|
+
* @param input
|
|
1233
|
+
* @category TPaaS Tracking
|
|
1234
|
+
*/
|
|
1235
|
+
async trackImpressionSportsUIElement(input) {
|
|
1236
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1237
|
+
const event = (0, tpaas_builders_1.buildImpressionSportsUIElementEvent)(input, dependencies);
|
|
1238
|
+
return this.sendTpaasEvent(event);
|
|
1239
|
+
}
|
|
1189
1240
|
/**
|
|
1190
1241
|
* @param input
|
|
1191
1242
|
* @category TPaaS Tracking
|
|
@@ -1211,7 +1262,11 @@ class Tracker {
|
|
|
1211
1262
|
*/
|
|
1212
1263
|
async trackViewFrontpage(input, options) {
|
|
1213
1264
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1214
|
-
this.setCurrentTpaasPageData(
|
|
1265
|
+
this.setCurrentTpaasPageData({
|
|
1266
|
+
id: input.object.objectId,
|
|
1267
|
+
type: tpaas_schemas_1.ViewFrontpage.object.objectType,
|
|
1268
|
+
referrer: input.page?.referrer,
|
|
1269
|
+
});
|
|
1215
1270
|
const dependencies = await this.prepareTpaasEvent();
|
|
1216
1271
|
const event = (0, tpaas_builders_1.buildViewFrontpageEvent)(input, dependencies);
|
|
1217
1272
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1237,7 +1292,11 @@ class Tracker {
|
|
|
1237
1292
|
*/
|
|
1238
1293
|
async trackViewLandingpage(input, options) {
|
|
1239
1294
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1240
|
-
this.setCurrentTpaasPageData(
|
|
1295
|
+
this.setCurrentTpaasPageData({
|
|
1296
|
+
id: input.object.objectId,
|
|
1297
|
+
type: tpaas_schemas_1.ViewLandingpage.object.objectType,
|
|
1298
|
+
referrer: input.page?.referrer,
|
|
1299
|
+
});
|
|
1241
1300
|
const dependencies = await this.prepareTpaasEvent();
|
|
1242
1301
|
const event = (0, tpaas_builders_1.buildViewLandingpageEvent)(input, dependencies);
|
|
1243
1302
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1263,7 +1322,11 @@ class Tracker {
|
|
|
1263
1322
|
*/
|
|
1264
1323
|
async trackViewListing(input, options) {
|
|
1265
1324
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1266
|
-
this.setCurrentTpaasPageData(
|
|
1325
|
+
this.setCurrentTpaasPageData({
|
|
1326
|
+
id: input.object.objectId,
|
|
1327
|
+
type: tpaas_schemas_1.ViewListing.object.objectType,
|
|
1328
|
+
referrer: input.page?.referrer,
|
|
1329
|
+
});
|
|
1267
1330
|
const dependencies = await this.prepareTpaasEvent();
|
|
1268
1331
|
const event = (0, tpaas_builders_1.buildViewListingEvent)(input, dependencies);
|
|
1269
1332
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1289,7 +1352,12 @@ class Tracker {
|
|
|
1289
1352
|
*/
|
|
1290
1353
|
async trackViewLockedArticle(input, options) {
|
|
1291
1354
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1292
|
-
this.setCurrentTpaasPageData(
|
|
1355
|
+
this.setCurrentTpaasPageData({
|
|
1356
|
+
id: input.object.objectId,
|
|
1357
|
+
type: tpaas_schemas_1.ViewLockedArticle.object.objectType,
|
|
1358
|
+
referrer: input.page?.referrer,
|
|
1359
|
+
content: input.page?.content,
|
|
1360
|
+
});
|
|
1293
1361
|
const dependencies = await this.prepareTpaasEvent();
|
|
1294
1362
|
const event = (0, tpaas_builders_1.buildViewLockedArticleEvent)(input, dependencies);
|
|
1295
1363
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1315,7 +1383,12 @@ class Tracker {
|
|
|
1315
1383
|
*/
|
|
1316
1384
|
async trackViewLockedAudioPage(input, options) {
|
|
1317
1385
|
this.newPageView();
|
|
1318
|
-
this.setCurrentTpaasPageData(
|
|
1386
|
+
this.setCurrentTpaasPageData({
|
|
1387
|
+
id: input.object.objectId,
|
|
1388
|
+
type: tpaas_schemas_1.ViewLockedAudioPage.object.objectType,
|
|
1389
|
+
referrer: input.page?.referrer,
|
|
1390
|
+
content: input.page?.content,
|
|
1391
|
+
});
|
|
1319
1392
|
const dependencies = await this.prepareTpaasEvent();
|
|
1320
1393
|
const event = (0, tpaas_builders_1.buildViewLockedAudioPageEvent)(input, dependencies);
|
|
1321
1394
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1334,6 +1407,37 @@ class Tracker {
|
|
|
1334
1407
|
}
|
|
1335
1408
|
return result;
|
|
1336
1409
|
}
|
|
1410
|
+
/**
|
|
1411
|
+
* @param input
|
|
1412
|
+
* @param options
|
|
1413
|
+
* @category TPaaS Tracking
|
|
1414
|
+
*/
|
|
1415
|
+
async trackViewLockedPage(input, options) {
|
|
1416
|
+
this.newPageView();
|
|
1417
|
+
// LockedPage is not currently part of the catalog's PageRef.pageType enum.
|
|
1418
|
+
this.setCurrentTpaasPageData({
|
|
1419
|
+
id: input.object.objectId,
|
|
1420
|
+
type: 'Page',
|
|
1421
|
+
referrer: input.page?.referrer,
|
|
1422
|
+
});
|
|
1423
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1424
|
+
const event = (0, tpaas_builders_1.buildViewLockedPageEvent)(input, dependencies);
|
|
1425
|
+
const result = this.sendTpaasEvent(event);
|
|
1426
|
+
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1427
|
+
const leaveLockedPageCallback = async (leave) => {
|
|
1428
|
+
await this.trackLeaveLockedPage({
|
|
1429
|
+
leave,
|
|
1430
|
+
...input,
|
|
1431
|
+
});
|
|
1432
|
+
};
|
|
1433
|
+
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1434
|
+
...options.leaveTracking,
|
|
1435
|
+
schema: tpaas_schemas_1.LeaveLockedPage.object.objectType,
|
|
1436
|
+
trackMethod: leaveLockedPageCallback,
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
return result;
|
|
1440
|
+
}
|
|
1337
1441
|
/**
|
|
1338
1442
|
* @param input
|
|
1339
1443
|
* @param options
|
|
@@ -1341,7 +1445,12 @@ class Tracker {
|
|
|
1341
1445
|
*/
|
|
1342
1446
|
async trackViewLockedVideoPage(input, options) {
|
|
1343
1447
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1344
|
-
this.setCurrentTpaasPageData(
|
|
1448
|
+
this.setCurrentTpaasPageData({
|
|
1449
|
+
id: input.object.objectId,
|
|
1450
|
+
type: tpaas_schemas_1.ViewLockedVideoPage.object.objectType,
|
|
1451
|
+
referrer: input.page?.referrer,
|
|
1452
|
+
content: input.page?.content,
|
|
1453
|
+
});
|
|
1345
1454
|
const dependencies = await this.prepareTpaasEvent();
|
|
1346
1455
|
const event = (0, tpaas_builders_1.buildViewLockedVideoPageEvent)(input, dependencies);
|
|
1347
1456
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1404,7 +1513,12 @@ class Tracker {
|
|
|
1404
1513
|
*/
|
|
1405
1514
|
async trackViewVideoPage(input, options) {
|
|
1406
1515
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1407
|
-
this.setCurrentTpaasPageData(
|
|
1516
|
+
this.setCurrentTpaasPageData({
|
|
1517
|
+
id: input.object.objectId,
|
|
1518
|
+
type: tpaas_schemas_1.ViewVideoPage.object.objectType,
|
|
1519
|
+
referrer: input.page?.referrer,
|
|
1520
|
+
content: input.page?.content,
|
|
1521
|
+
});
|
|
1408
1522
|
const dependencies = await this.prepareTpaasEvent();
|
|
1409
1523
|
const event = (0, tpaas_builders_1.buildViewVideoPageEvent)(input, dependencies);
|
|
1410
1524
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1437,7 +1551,11 @@ class Tracker {
|
|
|
1437
1551
|
*/
|
|
1438
1552
|
async trackViewWeather(input, options) {
|
|
1439
1553
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1440
|
-
this.setCurrentTpaasPageData(
|
|
1554
|
+
this.setCurrentTpaasPageData({
|
|
1555
|
+
id: input.object.objectId,
|
|
1556
|
+
type: tpaas_schemas_1.ViewWeather.object.objectType,
|
|
1557
|
+
referrer: input.page?.referrer,
|
|
1558
|
+
});
|
|
1441
1559
|
const dependencies = await this.prepareTpaasEvent();
|
|
1442
1560
|
const event = (0, tpaas_builders_1.buildViewWeatherEvent)(input, dependencies);
|
|
1443
1561
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1528,6 +1646,15 @@ class Tracker {
|
|
|
1528
1646
|
const event = (0, tpaas_builders_1.buildLeaveLockedAudioPageEvent)(input, dependencies);
|
|
1529
1647
|
return this.sendTpaasEvent(event);
|
|
1530
1648
|
}
|
|
1649
|
+
/**
|
|
1650
|
+
* @param input
|
|
1651
|
+
* @category TPaaS Tracking
|
|
1652
|
+
*/
|
|
1653
|
+
async trackLeaveLockedPage(input) {
|
|
1654
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1655
|
+
const event = (0, tpaas_builders_1.buildLeaveLockedPageEvent)(input, dependencies);
|
|
1656
|
+
return this.sendTpaasEvent(event);
|
|
1657
|
+
}
|
|
1531
1658
|
/**
|
|
1532
1659
|
* @param input
|
|
1533
1660
|
* @category TPaaS Tracking
|
|
@@ -1618,6 +1745,15 @@ class Tracker {
|
|
|
1618
1745
|
const event = (0, tpaas_builders_1.buildEngagementOfferEvent)(input, dependencies);
|
|
1619
1746
|
return this.sendTpaasEvent(event);
|
|
1620
1747
|
}
|
|
1748
|
+
/**
|
|
1749
|
+
* @param input
|
|
1750
|
+
* @category TPaaS Tracking
|
|
1751
|
+
*/
|
|
1752
|
+
async trackEngagementSportsUIElement(input) {
|
|
1753
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1754
|
+
const event = (0, tpaas_builders_1.buildEngagementSportsUIElementEvent)(input, dependencies);
|
|
1755
|
+
return this.sendTpaasEvent(event);
|
|
1756
|
+
}
|
|
1621
1757
|
/**
|
|
1622
1758
|
* @param input
|
|
1623
1759
|
* @category TPaaS Tracking
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.builder = void 0;
|
|
4
|
-
const builder = ({
|
|
4
|
+
const builder = ({ isHybrid, routingStage, version, }) => {
|
|
5
5
|
return {
|
|
6
6
|
tracker: {
|
|
7
|
-
autoTrackerVersion,
|
|
8
|
-
isAutoTracker: !!autoTrackerVersion,
|
|
9
7
|
isHybrid,
|
|
10
8
|
routingStage,
|
|
11
9
|
trackerType: 'JS',
|