@schibsted/pulse-sdk 8.0.0-rc.20 → 8.0.0-rc.21
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 +170 -334
- package/dist/cjs/builders/session-browser.js +4 -79
- package/dist/cjs/session/store.js +96 -0
- package/dist/cjs/tpaas-builders/builders/device.js +42 -70
- package/dist/cjs/tpaas-builders/builders/pageInfo.js +2 -3
- package/dist/cjs/tpaas-builders/builders/session.js +2 -114
- package/dist/cjs/tpaas-builders/builders/utm.js +2 -8
- package/dist/cjs/tpaas-builders/builders.js +135 -148
- package/dist/cjs/tpaas-context/adapters.js +85 -0
- package/dist/cjs/tpaas-context/browser.js +51 -0
- package/dist/cjs/tpaas-context/index.js +6 -0
- package/dist/cjs/tpaas-context/prepare.js +177 -0
- package/dist/cjs/tpaas-context/session.js +23 -0
- package/dist/cjs/tpaas-schemas/constants.js +68 -75
- package/dist/cjs/tracker-proxy/consts.js +1 -2
- package/dist/cjs/version.js +1 -1
- package/dist/ejs/Tracker.js +171 -335
- package/dist/ejs/builders/session-browser.js +4 -77
- package/dist/ejs/session/store.js +90 -0
- package/dist/ejs/tpaas-builders/builders/device.js +42 -70
- package/dist/ejs/tpaas-builders/builders/pageInfo.js +2 -3
- package/dist/ejs/tpaas-builders/builders/session.js +1 -111
- package/dist/ejs/tpaas-builders/builders/utm.js +2 -8
- package/dist/ejs/tpaas-builders/builders.js +135 -147
- package/dist/ejs/tpaas-context/adapters.js +80 -0
- package/dist/ejs/tpaas-context/browser.js +47 -0
- package/dist/ejs/tpaas-context/index.js +1 -0
- package/dist/ejs/tpaas-context/prepare.js +137 -0
- package/dist/ejs/tpaas-context/session.js +19 -0
- package/dist/ejs/tpaas-schemas/constants.js +66 -73
- package/dist/ejs/tracker-proxy/consts.js +1 -2
- package/dist/ejs/version.js +1 -1
- package/dist/types/Tracker.d.ts +27 -23
- package/dist/types/builders/session-browser.d.ts +0 -13
- package/dist/types/session/store.d.ts +34 -0
- package/dist/types/tpaas-builders/builders/consents.d.ts +2 -2
- package/dist/types/tpaas-builders/builders/device.d.ts +2 -2
- package/dist/types/tpaas-builders/builders/experiments.d.ts +2 -2
- package/dist/types/tpaas-builders/builders/pageInfo.d.ts +2 -1
- package/dist/types/tpaas-builders/builders/pageviewId.d.ts +2 -2
- package/dist/types/tpaas-builders/builders/provider.d.ts +2 -2
- package/dist/types/tpaas-builders/builders/session.d.ts +1 -12
- package/dist/types/tpaas-builders/builders/trackerBuilder.d.ts +2 -2
- package/dist/types/tpaas-builders/builders/user.d.ts +2 -2
- package/dist/types/tpaas-builders/builders/utm.d.ts +2 -1
- package/dist/types/tpaas-builders/builders.d.ts +70 -70
- package/dist/types/tpaas-builders/index.d.ts +0 -1
- package/dist/types/tpaas-context/adapters.d.ts +26 -0
- package/dist/types/tpaas-context/browser.d.ts +8 -0
- package/dist/types/tpaas-context/index.d.ts +2 -0
- package/dist/types/tpaas-context/prepare.d.ts +38 -0
- package/dist/types/tpaas-context/session.d.ts +10 -0
- package/dist/types/tpaas-context/types.d.ts +66 -0
- package/dist/types/tpaas-schemas/constants.d.ts +66 -73
- package/dist/types/tpaas-schemas/types/ITpaasEvent.d.ts +2 -4
- package/dist/types/tpaas-schemas/types/schemas/{IAnonymousViewUIElement.d.ts → IAnonymousImpressionUIElement.d.ts} +2 -2
- package/dist/types/tpaas-schemas/types/schemas/IEngagementAudio.d.ts +6 -2
- package/dist/types/tpaas-schemas/types/schemas/IEngagementTeaser.d.ts +2 -2
- package/dist/types/tpaas-schemas/types/schemas/IEngagementTvModule.d.ts +4 -1
- package/dist/types/tpaas-schemas/types/schemas/IEngagementTvSearch.d.ts +4 -4
- package/dist/types/tpaas-schemas/types/schemas/IEngagementVideo.d.ts +6 -2
- package/dist/types/tpaas-schemas/types/schemas/IEngagementVideoAd.d.ts +10 -8
- package/dist/types/tpaas-schemas/types/schemas/IImpressionTeaser.d.ts +2 -2
- package/dist/types/tpaas-schemas/types/schemas/ILeaveWeather.d.ts +2 -0
- package/dist/types/tpaas-schemas/types/schemas/index.d.ts +1 -2
- package/dist/types/tpaas-schemas/types.d.ts +2 -2
- package/dist/types/tracker-proxy/consts.d.ts +1 -1
- package/dist/types/types.d.ts +2 -4
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/tpaas-builders/types.d.ts +0 -36
- package/dist/types/tpaas-schemas/types/schemas/IRequestAd.d.ts +0 -95
- /package/dist/cjs/{tpaas-builders → tpaas-context}/types.js +0 -0
- /package/dist/ejs/{tpaas-builders → tpaas-context}/types.js +0 -0
package/dist/cjs/Tracker.js
CHANGED
|
@@ -49,9 +49,6 @@ const consent_manager_1 = require("./builders/consent-manager");
|
|
|
49
49
|
const consents_1 = require("./builders/consents");
|
|
50
50
|
const events_1 = require("./builders/events");
|
|
51
51
|
const events_anonymous_node_1 = require("./builders/events-anonymous-node");
|
|
52
|
-
const experiments_1 = require("./builders/experiments");
|
|
53
|
-
const session_browser_1 = require("./builders/session-browser");
|
|
54
|
-
const cis_sync_1 = require("./cis-sync");
|
|
55
52
|
const config_1 = require("./config");
|
|
56
53
|
const config_browser_1 = require("./config-browser");
|
|
57
54
|
const defer_1 = __importDefault(require("./defer"));
|
|
@@ -61,7 +58,9 @@ const leaveTracking_1 = require("./leaveTracking");
|
|
|
61
58
|
const leaveTrackingTpaas_1 = require("./leaveTrackingTpaas");
|
|
62
59
|
const network_1 = __importDefault(require("./network"));
|
|
63
60
|
const config = __importStar(require("./remoteConfig"));
|
|
61
|
+
const store_1 = require("./session/store");
|
|
64
62
|
const tpaas_builders_1 = require("./tpaas-builders");
|
|
63
|
+
const tpaas_context_1 = require("./tpaas-context");
|
|
65
64
|
const tpaas_schemas_1 = require("./tpaas-schemas");
|
|
66
65
|
const proxy_provider_1 = require("./tracker-proxy/proxy-provider");
|
|
67
66
|
const utils_1 = require("./utils");
|
|
@@ -115,17 +114,6 @@ const ANONYMOUS_EVENT_FORBIDDEN_FIELDS = ['session', 'actor', 'device', 'locatio
|
|
|
115
114
|
function getAnonymousEventBuilder(name) {
|
|
116
115
|
return name in anonymousEvents ? anonymousEvents[name] : anonymousEvents.trackerEvent;
|
|
117
116
|
}
|
|
118
|
-
// This looks overkill, but a mapping feels safer than doing string operations (capitalize) with javascript
|
|
119
|
-
const mapDeployStageToTpaasStage = (deployStage) => {
|
|
120
|
-
switch (deployStage) {
|
|
121
|
-
case 'dev':
|
|
122
|
-
return 'Dev';
|
|
123
|
-
case 'pre':
|
|
124
|
-
return 'Pre';
|
|
125
|
-
case 'pro':
|
|
126
|
-
return 'Pro';
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
117
|
/**
|
|
130
118
|
* Determines if the SDK is running in a Hybrid (WebView) environment.
|
|
131
119
|
*
|
|
@@ -172,9 +160,20 @@ function unsubscribe(eventName, callback) {
|
|
|
172
160
|
* @class Tracker
|
|
173
161
|
*/
|
|
174
162
|
class Tracker {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
163
|
+
/**
|
|
164
|
+
* What the TPaaS context module reads to resolve the context of an event.
|
|
165
|
+
* Built on every call, so it always reflects the current state.
|
|
166
|
+
*/
|
|
167
|
+
get tpaasContextSource() {
|
|
168
|
+
return {
|
|
169
|
+
state: this.state,
|
|
170
|
+
builders: this.builders,
|
|
171
|
+
currentPage: this.currentPageContext,
|
|
172
|
+
applyRemoteConfig: () => this._applyRemoteConfigEndpoints(),
|
|
173
|
+
syncRemoteResources: (builders) => this.syncRemoteResources(undefined, builders),
|
|
174
|
+
getConsents: () => this.getConsents(),
|
|
175
|
+
onSessionResolved: () => this.resolveSessionIdPromise(),
|
|
176
|
+
};
|
|
178
177
|
}
|
|
179
178
|
async getCurrentLegacyPage() {
|
|
180
179
|
const { id, type, url } = await this.currentPageContext.info;
|
|
@@ -231,8 +230,9 @@ class Tracker {
|
|
|
231
230
|
...referrer,
|
|
232
231
|
url: referrer?.url ?? (utils_1.isBrowser ? document.referrer || undefined : undefined),
|
|
233
232
|
},
|
|
234
|
-
content
|
|
235
|
-
|
|
233
|
+
// destructure and copy content and sports to avoid mutations from outside
|
|
234
|
+
content: content && { ...content },
|
|
235
|
+
sports: sports && { ...sports },
|
|
236
236
|
};
|
|
237
237
|
};
|
|
238
238
|
/**
|
|
@@ -495,158 +495,6 @@ class Tracker {
|
|
|
495
495
|
await this.sendAnonymous();
|
|
496
496
|
return queuedEvent;
|
|
497
497
|
}
|
|
498
|
-
async adaptExperiments(baseExperiments = []) {
|
|
499
|
-
return baseExperiments.map((exp) => {
|
|
500
|
-
return {
|
|
501
|
-
name: exp.name || exp.id,
|
|
502
|
-
variant: exp.variant || '',
|
|
503
|
-
// nobody should be sending experiment id with an sdrn format, but in case they do
|
|
504
|
-
// we want to be able to handle it and not generate an invalid sdrn by adding another layer to it
|
|
505
|
-
experimentSdrn: exp.id.startsWith('sdrn:') ? exp.id : (0, experiments_1.generateExperimentSDRN)(exp.id, exp.platform),
|
|
506
|
-
platform: exp.platform || '',
|
|
507
|
-
testId: exp.custom?.testId,
|
|
508
|
-
};
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
*
|
|
513
|
-
* @private
|
|
514
|
-
* @category TPaaS Tracking
|
|
515
|
-
*/
|
|
516
|
-
async prepareAnonymousTpaasEvent() {
|
|
517
|
-
const { isHybrid, pageViewId, providerId, component, componentVersion, stage: providerStage, product: providerProduct, version: providerVersion, 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;
|
|
522
|
-
try {
|
|
523
|
-
await this._applyRemoteConfigEndpoints();
|
|
524
|
-
}
|
|
525
|
-
catch (ex) {
|
|
526
|
-
loglevel_1.default.trace('Failed to sync remote config', ex);
|
|
527
|
-
}
|
|
528
|
-
const [experiments, currentPageReferrer] = await Promise.all([
|
|
529
|
-
this.adaptExperiments(experimentsInput),
|
|
530
|
-
currentPageReferrerInput,
|
|
531
|
-
]);
|
|
532
|
-
return {
|
|
533
|
-
version: version_1.SDK_VERSION,
|
|
534
|
-
isHybrid: !!isHybrid,
|
|
535
|
-
pageviewId: pageViewId,
|
|
536
|
-
providerId,
|
|
537
|
-
providerName,
|
|
538
|
-
providerGroup,
|
|
539
|
-
providerStage,
|
|
540
|
-
providerProduct,
|
|
541
|
-
providerVersion,
|
|
542
|
-
component,
|
|
543
|
-
componentVersion,
|
|
544
|
-
routingStage: mapDeployStageToTpaasStage(deployStageTpaas),
|
|
545
|
-
experiments,
|
|
546
|
-
currentPageReferrer,
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
/**
|
|
550
|
-
* @private
|
|
551
|
-
* @category TPaaS Tracking
|
|
552
|
-
*/
|
|
553
|
-
async prepareTpaasEvent() {
|
|
554
|
-
// Capture event context before any asynchronous work so a concurrent update or View
|
|
555
|
-
// event cannot change the dependencies used to finish building this event.
|
|
556
|
-
const builders = { ...this.builders };
|
|
557
|
-
const { isHybrid, providerId, component, componentVersion, stage: providerStage, product: providerProduct, version: providerVersion, pageViewId, deployStageTpaas, } = this.state;
|
|
558
|
-
const providerName = this.state.provider?.name;
|
|
559
|
-
const providerGroup = this.state.provider?.group;
|
|
560
|
-
const { info: currentPageInfoInput, content: currentPageContent, sports: currentPageSports, referrer: currentPageReferrerInput, } = this.currentPageContext;
|
|
561
|
-
try {
|
|
562
|
-
await this.syncRemoteResources(undefined, builders);
|
|
563
|
-
}
|
|
564
|
-
catch (ex) {
|
|
565
|
-
loglevel_1.default.trace('Failed to sync remote resources', ex);
|
|
566
|
-
// remote config and CIS failures are also ignored for the old track() method. doing the same here
|
|
567
|
-
}
|
|
568
|
-
function adaptActorToNewFormat(actor) {
|
|
569
|
-
// this is a temporary solution to adapt the actor to the new format
|
|
570
|
-
// it should be removed once we have new methods in place to get the actor
|
|
571
|
-
if (!actor) {
|
|
572
|
-
return;
|
|
573
|
-
}
|
|
574
|
-
return {
|
|
575
|
-
id: actor.id?.toString() || '',
|
|
576
|
-
realm: actor.realm || '',
|
|
577
|
-
hasAnySubscription: !!actor.hasAnySubscription,
|
|
578
|
-
region: (0, utils_1.isString)(actor.region) ? actor.region : undefined,
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
function adaptConsentsToNewFormat(consents) {
|
|
582
|
-
if (!consents) {
|
|
583
|
-
return;
|
|
584
|
-
}
|
|
585
|
-
const { purposes, source } = consents;
|
|
586
|
-
const { CMP_ADVERTISING, CMP_ANALYTICS, CMP_MARKETING, CMP_PERSONALIZATION } = purposes;
|
|
587
|
-
function adaptStatusOrOptIn({ status, optIn }) {
|
|
588
|
-
// doing an unnecessary check for status here
|
|
589
|
-
// because otherwise the code after the switch will be marked as unreachable in the IDE
|
|
590
|
-
if (status) {
|
|
591
|
-
switch (status) {
|
|
592
|
-
case 'accepted':
|
|
593
|
-
return 'Accepted';
|
|
594
|
-
case 'rejected':
|
|
595
|
-
return 'Rejected';
|
|
596
|
-
case 'unknown':
|
|
597
|
-
return 'Unknown';
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
if (optIn === true) {
|
|
601
|
-
return 'Accepted';
|
|
602
|
-
}
|
|
603
|
-
if (optIn === false) {
|
|
604
|
-
return 'Rejected';
|
|
605
|
-
}
|
|
606
|
-
return 'Unknown';
|
|
607
|
-
}
|
|
608
|
-
return {
|
|
609
|
-
advertising: adaptStatusOrOptIn(CMP_ADVERTISING),
|
|
610
|
-
analytics: adaptStatusOrOptIn(CMP_ANALYTICS),
|
|
611
|
-
marketing: adaptStatusOrOptIn(CMP_MARKETING),
|
|
612
|
-
personalization: adaptStatusOrOptIn(CMP_PERSONALIZATION),
|
|
613
|
-
source: source || 'unknown',
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
// Consents are intentionally not part of the event-context snapshot. Read them after
|
|
617
|
-
// remote synchronization so a blocking tracking call can use newly resolved consents.
|
|
618
|
-
const [actor, consents, experiments, currentPage, currentPageReferrer] = await Promise.all([
|
|
619
|
-
identity.getActor(builders),
|
|
620
|
-
this.getConsents(),
|
|
621
|
-
this.adaptExperiments(builders.experiments),
|
|
622
|
-
this.getCurrentTpaasPage(currentPageInfoInput),
|
|
623
|
-
currentPageReferrerInput,
|
|
624
|
-
]);
|
|
625
|
-
const { environmentId, jwe } = (0, cis_sync_1.parsePulseCookies)();
|
|
626
|
-
return {
|
|
627
|
-
version: version_1.SDK_VERSION,
|
|
628
|
-
isHybrid: !!isHybrid,
|
|
629
|
-
user: adaptActorToNewFormat(actor),
|
|
630
|
-
consents: adaptConsentsToNewFormat(consents),
|
|
631
|
-
providerId,
|
|
632
|
-
providerName,
|
|
633
|
-
providerGroup,
|
|
634
|
-
providerStage,
|
|
635
|
-
providerProduct,
|
|
636
|
-
providerVersion,
|
|
637
|
-
component,
|
|
638
|
-
componentVersion,
|
|
639
|
-
pageviewId: pageViewId,
|
|
640
|
-
routingStage: mapDeployStageToTpaasStage(deployStageTpaas),
|
|
641
|
-
currentPage,
|
|
642
|
-
currentPageContent,
|
|
643
|
-
currentPageSports,
|
|
644
|
-
currentPageReferrer,
|
|
645
|
-
experiments,
|
|
646
|
-
environmentId,
|
|
647
|
-
jwe,
|
|
648
|
-
};
|
|
649
|
-
}
|
|
650
498
|
/**
|
|
651
499
|
* This method extends the list of base experiments that will be automatically included in every event sent by the tracker.
|
|
652
500
|
*
|
|
@@ -883,19 +731,19 @@ class Tracker {
|
|
|
883
731
|
* @param input
|
|
884
732
|
* @category TPaaS Tracking
|
|
885
733
|
*/
|
|
886
|
-
async
|
|
887
|
-
const
|
|
888
|
-
const event = (0, tpaas_builders_1.
|
|
734
|
+
async trackAnonymousImpressionUIElement(input) {
|
|
735
|
+
const context = await (0, tpaas_context_1.prepareAnonymousTpaasEventContext)(this.tpaasContextSource, input);
|
|
736
|
+
const event = (0, tpaas_builders_1.buildAnonymousImpressionUIElementEvent)(context);
|
|
889
737
|
return this.sendTpaasEvent(event);
|
|
890
738
|
}
|
|
891
739
|
async trackCompletedHealthAction(input) {
|
|
892
|
-
const
|
|
893
|
-
const event = (0, tpaas_builders_1.buildCompletedHealthActionEvent)(
|
|
740
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
741
|
+
const event = (0, tpaas_builders_1.buildCompletedHealthActionEvent)(context);
|
|
894
742
|
return this.sendTpaasEvent(event);
|
|
895
743
|
}
|
|
896
744
|
async trackEngagementHealthUIElement(input) {
|
|
897
|
-
const
|
|
898
|
-
const event = (0, tpaas_builders_1.buildEngagementHealthUIElementEvent)(
|
|
745
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
746
|
+
const event = (0, tpaas_builders_1.buildEngagementHealthUIElementEvent)(context);
|
|
899
747
|
return this.sendTpaasEvent(event);
|
|
900
748
|
}
|
|
901
749
|
async trackViewHealthPage(input, options) {
|
|
@@ -905,16 +753,16 @@ class Tracker {
|
|
|
905
753
|
type: tpaas_schemas_1.ViewHealthPage.object.objectType,
|
|
906
754
|
referrer: input.page?.referrer,
|
|
907
755
|
});
|
|
908
|
-
const
|
|
909
|
-
const event = (0, tpaas_builders_1.buildViewHealthPageEvent)(
|
|
756
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
757
|
+
const event = (0, tpaas_builders_1.buildViewHealthPageEvent)(context);
|
|
910
758
|
const result = this.sendTpaasEvent(event);
|
|
911
759
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
912
760
|
const leavePageCallback = async (leave) => {
|
|
913
761
|
// HealthView Page is a bit special, in the sense that in doesn't have a dedicated Leave event.
|
|
914
762
|
// Instead, we need to reuse the generic Leave Page event, but adapt the input accordingly.
|
|
915
763
|
// This means omitting some fields from HealthView Page that are not part of Leave Page schema.
|
|
916
|
-
const { experiments, metrics, object, origin, userHealthData, ...restInput } = input;
|
|
917
|
-
const { category, custom, name, tags, food, physicalActivity, training, ...restObject } = input.object;
|
|
764
|
+
const { experiments, metrics, object, origin, userHealthData, ...restInput } = context.input;
|
|
765
|
+
const { category, custom, name, tags, food, physicalActivity, training, ...restObject } = context.input.object;
|
|
918
766
|
await this.trackLeavePage({
|
|
919
767
|
leave,
|
|
920
768
|
...restInput,
|
|
@@ -933,8 +781,8 @@ class Tracker {
|
|
|
933
781
|
return result;
|
|
934
782
|
}
|
|
935
783
|
async trackImpressionHealthUIElement(input) {
|
|
936
|
-
const
|
|
937
|
-
const event = (0, tpaas_builders_1.buildImpressionHealthUIElementEvent)(
|
|
784
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
785
|
+
const event = (0, tpaas_builders_1.buildImpressionHealthUIElementEvent)(context);
|
|
938
786
|
return this.sendTpaasEvent(event);
|
|
939
787
|
}
|
|
940
788
|
/**
|
|
@@ -949,14 +797,14 @@ class Tracker {
|
|
|
949
797
|
type: tpaas_schemas_1.ViewPage.object.objectType,
|
|
950
798
|
referrer: input.page?.referrer,
|
|
951
799
|
});
|
|
952
|
-
const
|
|
953
|
-
const event = (0, tpaas_builders_1.buildViewPageEvent)(
|
|
800
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
801
|
+
const event = (0, tpaas_builders_1.buildViewPageEvent)(context);
|
|
954
802
|
const result = this.sendTpaasEvent(event);
|
|
955
803
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
956
804
|
const leavePageCallback = async (leave) => {
|
|
957
805
|
await this.trackLeavePage({
|
|
958
806
|
leave,
|
|
959
|
-
...input,
|
|
807
|
+
...context.input,
|
|
960
808
|
});
|
|
961
809
|
};
|
|
962
810
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -985,14 +833,14 @@ class Tracker {
|
|
|
985
833
|
sports: input.object.sports,
|
|
986
834
|
},
|
|
987
835
|
});
|
|
988
|
-
const
|
|
989
|
-
const event = (0, tpaas_builders_1.buildViewSportsPageEvent)(
|
|
836
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
837
|
+
const event = (0, tpaas_builders_1.buildViewSportsPageEvent)(context);
|
|
990
838
|
const result = this.sendTpaasEvent(event);
|
|
991
839
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
992
840
|
const leaveSportsPageCallback = async (leave) => {
|
|
993
841
|
await this.trackLeaveSportsPage({
|
|
994
842
|
leave,
|
|
995
|
-
...input,
|
|
843
|
+
...context.input,
|
|
996
844
|
});
|
|
997
845
|
};
|
|
998
846
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1016,14 +864,14 @@ class Tracker {
|
|
|
1016
864
|
type: 'Page',
|
|
1017
865
|
referrer: input.page?.referrer,
|
|
1018
866
|
});
|
|
1019
|
-
const
|
|
1020
|
-
const event = (0, tpaas_builders_1.buildViewSchoolPageEvent)(
|
|
867
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
868
|
+
const event = (0, tpaas_builders_1.buildViewSchoolPageEvent)(context);
|
|
1021
869
|
const result = this.sendTpaasEvent(event);
|
|
1022
870
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1023
871
|
const leaveSchoolPageCallback = async (leave) => {
|
|
1024
872
|
await this.trackLeaveSchoolPage({
|
|
1025
873
|
leave,
|
|
1026
|
-
...input,
|
|
874
|
+
...context.input,
|
|
1027
875
|
});
|
|
1028
876
|
};
|
|
1029
877
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1045,8 +893,8 @@ class Tracker {
|
|
|
1045
893
|
type: tpaas_schemas_1.ViewTitle.object.objectType,
|
|
1046
894
|
referrer: input.page?.referrer,
|
|
1047
895
|
});
|
|
1048
|
-
const
|
|
1049
|
-
const event = (0, tpaas_builders_1.buildViewTitleEvent)(
|
|
896
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
897
|
+
const event = (0, tpaas_builders_1.buildViewTitleEvent)(context);
|
|
1050
898
|
return this.sendTpaasEvent(event);
|
|
1051
899
|
// there's no Leave Title event
|
|
1052
900
|
}
|
|
@@ -1055,8 +903,8 @@ class Tracker {
|
|
|
1055
903
|
* @category TPaaS Tracking
|
|
1056
904
|
*/
|
|
1057
905
|
async trackImpressionWidget(input) {
|
|
1058
|
-
const
|
|
1059
|
-
const event = (0, tpaas_builders_1.buildImpressionWidgetEvent)(
|
|
906
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
907
|
+
const event = (0, tpaas_builders_1.buildImpressionWidgetEvent)(context);
|
|
1060
908
|
return this.sendTpaasEvent(event);
|
|
1061
909
|
}
|
|
1062
910
|
/**
|
|
@@ -1064,17 +912,8 @@ class Tracker {
|
|
|
1064
912
|
* @category TPaaS Tracking
|
|
1065
913
|
*/
|
|
1066
914
|
async trackLoadAd(input) {
|
|
1067
|
-
const
|
|
1068
|
-
const event = (0, tpaas_builders_1.buildLoadAdEvent)(
|
|
1069
|
-
return this.sendTpaasEvent(event);
|
|
1070
|
-
}
|
|
1071
|
-
/**
|
|
1072
|
-
* @param input
|
|
1073
|
-
* @category TPaaS Tracking
|
|
1074
|
-
*/
|
|
1075
|
-
async trackRequestAd(input) {
|
|
1076
|
-
const dependencies = await this.prepareTpaasEvent();
|
|
1077
|
-
const event = (0, tpaas_builders_1.buildRequestAdEvent)(input, dependencies);
|
|
915
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
916
|
+
const event = (0, tpaas_builders_1.buildLoadAdEvent)(context);
|
|
1078
917
|
return this.sendTpaasEvent(event);
|
|
1079
918
|
}
|
|
1080
919
|
/**
|
|
@@ -1090,14 +929,14 @@ class Tracker {
|
|
|
1090
929
|
referrer: input.page?.referrer,
|
|
1091
930
|
content: input.page?.content,
|
|
1092
931
|
});
|
|
1093
|
-
const
|
|
1094
|
-
const event = (0, tpaas_builders_1.buildViewArticleEvent)(
|
|
932
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
933
|
+
const event = (0, tpaas_builders_1.buildViewArticleEvent)(context);
|
|
1095
934
|
const result = this.sendTpaasEvent(event);
|
|
1096
935
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1097
936
|
const leaveArticleCallback = async (leave) => {
|
|
1098
937
|
await this.trackLeaveArticle({
|
|
1099
938
|
leave,
|
|
1100
|
-
...input,
|
|
939
|
+
...context.input,
|
|
1101
940
|
});
|
|
1102
941
|
};
|
|
1103
942
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1156,8 +995,8 @@ class Tracker {
|
|
|
1156
995
|
referrer: input.page?.referrer,
|
|
1157
996
|
content: input.page?.content,
|
|
1158
997
|
});
|
|
1159
|
-
const
|
|
1160
|
-
const event = (0, tpaas_builders_1.buildViewAudioPageEvent)(
|
|
998
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
999
|
+
const event = (0, tpaas_builders_1.buildViewAudioPageEvent)(context);
|
|
1161
1000
|
const result = this.sendTpaasEvent(event);
|
|
1162
1001
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1163
1002
|
const { leaveAudioBuilder, ...restLeaveTrackingOptions } = options.leaveTracking;
|
|
@@ -1175,7 +1014,7 @@ class Tracker {
|
|
|
1175
1014
|
activityDurationMs: leave.activityDurationMs,
|
|
1176
1015
|
durationMs: leave.durationMs,
|
|
1177
1016
|
},
|
|
1178
|
-
...input,
|
|
1017
|
+
...context.input,
|
|
1179
1018
|
});
|
|
1180
1019
|
};
|
|
1181
1020
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1198,14 +1037,14 @@ class Tracker {
|
|
|
1198
1037
|
type: tpaas_schemas_1.ViewError.object.objectType,
|
|
1199
1038
|
referrer: input.page?.referrer,
|
|
1200
1039
|
});
|
|
1201
|
-
const
|
|
1202
|
-
const event = (0, tpaas_builders_1.buildViewErrorEvent)(
|
|
1040
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1041
|
+
const event = (0, tpaas_builders_1.buildViewErrorEvent)(context);
|
|
1203
1042
|
const result = this.sendTpaasEvent(event);
|
|
1204
1043
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1205
1044
|
const leaveErrorCallback = async (leave) => {
|
|
1206
1045
|
await this.trackLeaveError({
|
|
1207
1046
|
leave,
|
|
1208
|
-
...input,
|
|
1047
|
+
...context.input,
|
|
1209
1048
|
});
|
|
1210
1049
|
};
|
|
1211
1050
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1221,8 +1060,8 @@ class Tracker {
|
|
|
1221
1060
|
* @category TPaaS Tracking
|
|
1222
1061
|
*/
|
|
1223
1062
|
async trackImpressionAd(input) {
|
|
1224
|
-
const
|
|
1225
|
-
const event = (0, tpaas_builders_1.buildImpressionAdEvent)(
|
|
1063
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1064
|
+
const event = (0, tpaas_builders_1.buildImpressionAdEvent)(context);
|
|
1226
1065
|
return this.sendTpaasEvent(event);
|
|
1227
1066
|
}
|
|
1228
1067
|
/**
|
|
@@ -1230,8 +1069,8 @@ class Tracker {
|
|
|
1230
1069
|
* @category TPaaS Tracking
|
|
1231
1070
|
*/
|
|
1232
1071
|
async trackImpressionAdSlot(input) {
|
|
1233
|
-
const
|
|
1234
|
-
const event = (0, tpaas_builders_1.buildImpressionAdSlotEvent)(
|
|
1072
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1073
|
+
const event = (0, tpaas_builders_1.buildImpressionAdSlotEvent)(context);
|
|
1235
1074
|
return this.sendTpaasEvent(event);
|
|
1236
1075
|
}
|
|
1237
1076
|
/**
|
|
@@ -1239,8 +1078,8 @@ class Tracker {
|
|
|
1239
1078
|
* @category TPaaS Tracking
|
|
1240
1079
|
*/
|
|
1241
1080
|
async trackImpressionAffiliate(input) {
|
|
1242
|
-
const
|
|
1243
|
-
const event = (0, tpaas_builders_1.buildImpressionAffiliateEvent)(
|
|
1081
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1082
|
+
const event = (0, tpaas_builders_1.buildImpressionAffiliateEvent)(context);
|
|
1244
1083
|
return this.sendTpaasEvent(event);
|
|
1245
1084
|
}
|
|
1246
1085
|
/**
|
|
@@ -1248,8 +1087,8 @@ class Tracker {
|
|
|
1248
1087
|
* @category TPaaS Tracking
|
|
1249
1088
|
*/
|
|
1250
1089
|
async trackImpressionForm(input) {
|
|
1251
|
-
const
|
|
1252
|
-
const event = (0, tpaas_builders_1.buildImpressionFormEvent)(
|
|
1090
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1091
|
+
const event = (0, tpaas_builders_1.buildImpressionFormEvent)(context);
|
|
1253
1092
|
return this.sendTpaasEvent(event);
|
|
1254
1093
|
}
|
|
1255
1094
|
/**
|
|
@@ -1257,8 +1096,8 @@ class Tracker {
|
|
|
1257
1096
|
* @category TPaaS Tracking
|
|
1258
1097
|
*/
|
|
1259
1098
|
async trackImpressionOffer(input) {
|
|
1260
|
-
const
|
|
1261
|
-
const event = (0, tpaas_builders_1.buildImpressionOfferEvent)(
|
|
1099
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1100
|
+
const event = (0, tpaas_builders_1.buildImpressionOfferEvent)(context);
|
|
1262
1101
|
return this.sendTpaasEvent(event);
|
|
1263
1102
|
}
|
|
1264
1103
|
/**
|
|
@@ -1266,8 +1105,8 @@ class Tracker {
|
|
|
1266
1105
|
* @category TPaaS Tracking
|
|
1267
1106
|
*/
|
|
1268
1107
|
async trackImpressionPlayer(input) {
|
|
1269
|
-
const
|
|
1270
|
-
const event = (0, tpaas_builders_1.buildImpressionPlayerEvent)(
|
|
1108
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1109
|
+
const event = (0, tpaas_builders_1.buildImpressionPlayerEvent)(context);
|
|
1271
1110
|
return this.sendTpaasEvent(event);
|
|
1272
1111
|
}
|
|
1273
1112
|
/**
|
|
@@ -1275,8 +1114,8 @@ class Tracker {
|
|
|
1275
1114
|
* @category TPaaS Tracking
|
|
1276
1115
|
*/
|
|
1277
1116
|
async trackImpressionSportsUIElement(input) {
|
|
1278
|
-
const
|
|
1279
|
-
const event = (0, tpaas_builders_1.buildImpressionSportsUIElementEvent)(
|
|
1117
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1118
|
+
const event = (0, tpaas_builders_1.buildImpressionSportsUIElementEvent)(context);
|
|
1280
1119
|
return this.sendTpaasEvent(event);
|
|
1281
1120
|
}
|
|
1282
1121
|
/**
|
|
@@ -1284,8 +1123,8 @@ class Tracker {
|
|
|
1284
1123
|
* @category TPaaS Tracking
|
|
1285
1124
|
*/
|
|
1286
1125
|
async trackImpressionSchoolUIElement(input) {
|
|
1287
|
-
const
|
|
1288
|
-
const event = (0, tpaas_builders_1.buildImpressionSchoolUIElementEvent)(
|
|
1126
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1127
|
+
const event = (0, tpaas_builders_1.buildImpressionSchoolUIElementEvent)(context);
|
|
1289
1128
|
return this.sendTpaasEvent(event);
|
|
1290
1129
|
}
|
|
1291
1130
|
/**
|
|
@@ -1293,8 +1132,8 @@ class Tracker {
|
|
|
1293
1132
|
* @category TPaaS Tracking
|
|
1294
1133
|
*/
|
|
1295
1134
|
async trackImpressionTeaser(input) {
|
|
1296
|
-
const
|
|
1297
|
-
const event = (0, tpaas_builders_1.buildImpressionTeaserEvent)(
|
|
1135
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1136
|
+
const event = (0, tpaas_builders_1.buildImpressionTeaserEvent)(context);
|
|
1298
1137
|
return this.sendTpaasEvent(event);
|
|
1299
1138
|
}
|
|
1300
1139
|
/**
|
|
@@ -1302,8 +1141,8 @@ class Tracker {
|
|
|
1302
1141
|
* @category TPaaS Tracking
|
|
1303
1142
|
*/
|
|
1304
1143
|
async trackImpressionUIElement(input) {
|
|
1305
|
-
const
|
|
1306
|
-
const event = (0, tpaas_builders_1.buildImpressionUIElementEvent)(
|
|
1144
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1145
|
+
const event = (0, tpaas_builders_1.buildImpressionUIElementEvent)(context);
|
|
1307
1146
|
return this.sendTpaasEvent(event);
|
|
1308
1147
|
}
|
|
1309
1148
|
/**
|
|
@@ -1318,14 +1157,14 @@ class Tracker {
|
|
|
1318
1157
|
type: tpaas_schemas_1.ViewFrontpage.object.objectType,
|
|
1319
1158
|
referrer: input.page?.referrer,
|
|
1320
1159
|
});
|
|
1321
|
-
const
|
|
1322
|
-
const event = (0, tpaas_builders_1.buildViewFrontpageEvent)(
|
|
1160
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1161
|
+
const event = (0, tpaas_builders_1.buildViewFrontpageEvent)(context);
|
|
1323
1162
|
const result = this.sendTpaasEvent(event);
|
|
1324
1163
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1325
1164
|
const leaveFrontpageCallback = async (leave) => {
|
|
1326
1165
|
await this.trackLeaveFrontpage({
|
|
1327
1166
|
leave,
|
|
1328
|
-
...input,
|
|
1167
|
+
...context.input,
|
|
1329
1168
|
});
|
|
1330
1169
|
};
|
|
1331
1170
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1348,14 +1187,14 @@ class Tracker {
|
|
|
1348
1187
|
type: tpaas_schemas_1.ViewLandingpage.object.objectType,
|
|
1349
1188
|
referrer: input.page?.referrer,
|
|
1350
1189
|
});
|
|
1351
|
-
const
|
|
1352
|
-
const event = (0, tpaas_builders_1.buildViewLandingpageEvent)(
|
|
1190
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1191
|
+
const event = (0, tpaas_builders_1.buildViewLandingpageEvent)(context);
|
|
1353
1192
|
const result = this.sendTpaasEvent(event);
|
|
1354
1193
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1355
1194
|
const leaveLandingpageCallback = async (leave) => {
|
|
1356
1195
|
await this.trackLeaveLandingpage({
|
|
1357
1196
|
leave,
|
|
1358
|
-
...input,
|
|
1197
|
+
...context.input,
|
|
1359
1198
|
});
|
|
1360
1199
|
};
|
|
1361
1200
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1378,14 +1217,14 @@ class Tracker {
|
|
|
1378
1217
|
type: tpaas_schemas_1.ViewListing.object.objectType,
|
|
1379
1218
|
referrer: input.page?.referrer,
|
|
1380
1219
|
});
|
|
1381
|
-
const
|
|
1382
|
-
const event = (0, tpaas_builders_1.buildViewListingEvent)(
|
|
1220
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1221
|
+
const event = (0, tpaas_builders_1.buildViewListingEvent)(context);
|
|
1383
1222
|
const result = this.sendTpaasEvent(event);
|
|
1384
1223
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1385
1224
|
const leaveListingCallback = async (leave) => {
|
|
1386
1225
|
await this.trackLeaveListing({
|
|
1387
1226
|
leave,
|
|
1388
|
-
...input,
|
|
1227
|
+
...context.input,
|
|
1389
1228
|
});
|
|
1390
1229
|
};
|
|
1391
1230
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1409,14 +1248,14 @@ class Tracker {
|
|
|
1409
1248
|
referrer: input.page?.referrer,
|
|
1410
1249
|
content: input.page?.content,
|
|
1411
1250
|
});
|
|
1412
|
-
const
|
|
1413
|
-
const event = (0, tpaas_builders_1.buildViewLockedArticleEvent)(
|
|
1251
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1252
|
+
const event = (0, tpaas_builders_1.buildViewLockedArticleEvent)(context);
|
|
1414
1253
|
const result = this.sendTpaasEvent(event);
|
|
1415
1254
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1416
1255
|
const leaveLockedArticleCallback = async (leave) => {
|
|
1417
1256
|
await this.trackLeaveLockedArticle({
|
|
1418
1257
|
leave,
|
|
1419
|
-
...input,
|
|
1258
|
+
...context.input,
|
|
1420
1259
|
});
|
|
1421
1260
|
};
|
|
1422
1261
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1440,14 +1279,14 @@ class Tracker {
|
|
|
1440
1279
|
referrer: input.page?.referrer,
|
|
1441
1280
|
content: input.page?.content,
|
|
1442
1281
|
});
|
|
1443
|
-
const
|
|
1444
|
-
const event = (0, tpaas_builders_1.buildViewLockedAudioPageEvent)(
|
|
1282
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1283
|
+
const event = (0, tpaas_builders_1.buildViewLockedAudioPageEvent)(context);
|
|
1445
1284
|
const result = this.sendTpaasEvent(event);
|
|
1446
1285
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1447
1286
|
const leaveLockedAudioPageCallback = async (leave) => {
|
|
1448
1287
|
await this.trackLeaveLockedAudioPage({
|
|
1449
1288
|
leave,
|
|
1450
|
-
...input,
|
|
1289
|
+
...context.input,
|
|
1451
1290
|
});
|
|
1452
1291
|
};
|
|
1453
1292
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1470,14 +1309,14 @@ class Tracker {
|
|
|
1470
1309
|
type: tpaas_schemas_1.ViewLockedPage.object.objectType,
|
|
1471
1310
|
referrer: input.page?.referrer,
|
|
1472
1311
|
});
|
|
1473
|
-
const
|
|
1474
|
-
const event = (0, tpaas_builders_1.buildViewLockedPageEvent)(
|
|
1312
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1313
|
+
const event = (0, tpaas_builders_1.buildViewLockedPageEvent)(context);
|
|
1475
1314
|
const result = this.sendTpaasEvent(event);
|
|
1476
1315
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1477
1316
|
const leaveLockedPageCallback = async (leave) => {
|
|
1478
1317
|
await this.trackLeaveLockedPage({
|
|
1479
1318
|
leave,
|
|
1480
|
-
...input,
|
|
1319
|
+
...context.input,
|
|
1481
1320
|
});
|
|
1482
1321
|
};
|
|
1483
1322
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1501,14 +1340,14 @@ class Tracker {
|
|
|
1501
1340
|
referrer: input.page?.referrer,
|
|
1502
1341
|
content: input.page?.content,
|
|
1503
1342
|
});
|
|
1504
|
-
const
|
|
1505
|
-
const event = (0, tpaas_builders_1.buildViewLockedVideoPageEvent)(
|
|
1343
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1344
|
+
const event = (0, tpaas_builders_1.buildViewLockedVideoPageEvent)(context);
|
|
1506
1345
|
const result = this.sendTpaasEvent(event);
|
|
1507
1346
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1508
1347
|
const leaveLockedVideoPageCallback = async (leave) => {
|
|
1509
1348
|
await this.trackLeaveLockedVideoPage({
|
|
1510
1349
|
leave,
|
|
1511
|
-
...input,
|
|
1350
|
+
...context.input,
|
|
1512
1351
|
});
|
|
1513
1352
|
};
|
|
1514
1353
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1569,8 +1408,8 @@ class Tracker {
|
|
|
1569
1408
|
referrer: input.page?.referrer,
|
|
1570
1409
|
content: input.page?.content,
|
|
1571
1410
|
});
|
|
1572
|
-
const
|
|
1573
|
-
const event = (0, tpaas_builders_1.buildViewVideoPageEvent)(
|
|
1411
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1412
|
+
const event = (0, tpaas_builders_1.buildViewVideoPageEvent)(context);
|
|
1574
1413
|
const result = this.sendTpaasEvent(event);
|
|
1575
1414
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1576
1415
|
const { leaveStoriesBuilder, ...restLeaveTrackingOptions } = options.leaveTracking;
|
|
@@ -1579,7 +1418,7 @@ class Tracker {
|
|
|
1579
1418
|
await this.trackLeaveVideoPage({
|
|
1580
1419
|
leave,
|
|
1581
1420
|
leaveStories: leaveStoriesInput,
|
|
1582
|
-
...input,
|
|
1421
|
+
...context.input,
|
|
1583
1422
|
});
|
|
1584
1423
|
};
|
|
1585
1424
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1602,14 +1441,14 @@ class Tracker {
|
|
|
1602
1441
|
type: tpaas_schemas_1.ViewWeather.object.objectType,
|
|
1603
1442
|
referrer: input.page?.referrer,
|
|
1604
1443
|
});
|
|
1605
|
-
const
|
|
1606
|
-
const event = (0, tpaas_builders_1.buildViewWeatherEvent)(
|
|
1444
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1445
|
+
const event = (0, tpaas_builders_1.buildViewWeatherEvent)(context);
|
|
1607
1446
|
const result = this.sendTpaasEvent(event);
|
|
1608
1447
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1609
1448
|
const leaveWeatherCallback = async (leave) => {
|
|
1610
1449
|
await this.trackLeaveWeather({
|
|
1611
1450
|
leave,
|
|
1612
|
-
...input,
|
|
1451
|
+
...context.input,
|
|
1613
1452
|
});
|
|
1614
1453
|
};
|
|
1615
1454
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
@@ -1625,8 +1464,8 @@ class Tracker {
|
|
|
1625
1464
|
* @category TPaaS Tracking
|
|
1626
1465
|
*/
|
|
1627
1466
|
async trackLeaveArticle(input) {
|
|
1628
|
-
const
|
|
1629
|
-
const event = (0, tpaas_builders_1.buildLeaveArticleEvent)(
|
|
1467
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1468
|
+
const event = (0, tpaas_builders_1.buildLeaveArticleEvent)(context);
|
|
1630
1469
|
return this.sendTpaasEvent(event);
|
|
1631
1470
|
}
|
|
1632
1471
|
/**
|
|
@@ -1634,8 +1473,8 @@ class Tracker {
|
|
|
1634
1473
|
* @category TPaaS Tracking
|
|
1635
1474
|
*/
|
|
1636
1475
|
async trackLeaveAudioPage(input) {
|
|
1637
|
-
const
|
|
1638
|
-
const event = (0, tpaas_builders_1.buildLeaveAudioPageEvent)(
|
|
1476
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1477
|
+
const event = (0, tpaas_builders_1.buildLeaveAudioPageEvent)(context);
|
|
1639
1478
|
return this.sendTpaasEvent(event);
|
|
1640
1479
|
}
|
|
1641
1480
|
/**
|
|
@@ -1643,8 +1482,8 @@ class Tracker {
|
|
|
1643
1482
|
* @category TPaaS Tracking
|
|
1644
1483
|
*/
|
|
1645
1484
|
async trackLeaveError(input) {
|
|
1646
|
-
const
|
|
1647
|
-
const event = (0, tpaas_builders_1.buildLeaveErrorEvent)(
|
|
1485
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1486
|
+
const event = (0, tpaas_builders_1.buildLeaveErrorEvent)(context);
|
|
1648
1487
|
return this.sendTpaasEvent(event);
|
|
1649
1488
|
}
|
|
1650
1489
|
/**
|
|
@@ -1652,8 +1491,8 @@ class Tracker {
|
|
|
1652
1491
|
* @category TPaaS Tracking
|
|
1653
1492
|
*/
|
|
1654
1493
|
async trackLeaveFrontpage(input) {
|
|
1655
|
-
const
|
|
1656
|
-
const event = (0, tpaas_builders_1.buildLeaveFrontpageEvent)(
|
|
1494
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1495
|
+
const event = (0, tpaas_builders_1.buildLeaveFrontpageEvent)(context);
|
|
1657
1496
|
return this.sendTpaasEvent(event);
|
|
1658
1497
|
}
|
|
1659
1498
|
/**
|
|
@@ -1661,8 +1500,8 @@ class Tracker {
|
|
|
1661
1500
|
* @category TPaaS Tracking
|
|
1662
1501
|
*/
|
|
1663
1502
|
async trackLeaveLandingpage(input) {
|
|
1664
|
-
const
|
|
1665
|
-
const event = (0, tpaas_builders_1.buildLeaveLandingpageEvent)(
|
|
1503
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1504
|
+
const event = (0, tpaas_builders_1.buildLeaveLandingpageEvent)(context);
|
|
1666
1505
|
return this.sendTpaasEvent(event);
|
|
1667
1506
|
}
|
|
1668
1507
|
/**
|
|
@@ -1670,8 +1509,8 @@ class Tracker {
|
|
|
1670
1509
|
* @category TPaaS Tracking
|
|
1671
1510
|
*/
|
|
1672
1511
|
async trackLeaveListing(input) {
|
|
1673
|
-
const
|
|
1674
|
-
const event = (0, tpaas_builders_1.buildLeaveListingEvent)(
|
|
1512
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1513
|
+
const event = (0, tpaas_builders_1.buildLeaveListingEvent)(context);
|
|
1675
1514
|
return this.sendTpaasEvent(event);
|
|
1676
1515
|
}
|
|
1677
1516
|
/**
|
|
@@ -1679,8 +1518,8 @@ class Tracker {
|
|
|
1679
1518
|
* @category TPaaS Tracking
|
|
1680
1519
|
*/
|
|
1681
1520
|
async trackLeaveLockedArticle(input) {
|
|
1682
|
-
const
|
|
1683
|
-
const event = (0, tpaas_builders_1.buildLeaveLockedArticleEvent)(
|
|
1521
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1522
|
+
const event = (0, tpaas_builders_1.buildLeaveLockedArticleEvent)(context);
|
|
1684
1523
|
return this.sendTpaasEvent(event);
|
|
1685
1524
|
}
|
|
1686
1525
|
/**
|
|
@@ -1688,8 +1527,8 @@ class Tracker {
|
|
|
1688
1527
|
* @category TPaaS Tracking
|
|
1689
1528
|
*/
|
|
1690
1529
|
async trackLeaveLockedAudioPage(input) {
|
|
1691
|
-
const
|
|
1692
|
-
const event = (0, tpaas_builders_1.buildLeaveLockedAudioPageEvent)(
|
|
1530
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1531
|
+
const event = (0, tpaas_builders_1.buildLeaveLockedAudioPageEvent)(context);
|
|
1693
1532
|
return this.sendTpaasEvent(event);
|
|
1694
1533
|
}
|
|
1695
1534
|
/**
|
|
@@ -1697,8 +1536,8 @@ class Tracker {
|
|
|
1697
1536
|
* @category TPaaS Tracking
|
|
1698
1537
|
*/
|
|
1699
1538
|
async trackLeaveLockedPage(input) {
|
|
1700
|
-
const
|
|
1701
|
-
const event = (0, tpaas_builders_1.buildLeaveLockedPageEvent)(
|
|
1539
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1540
|
+
const event = (0, tpaas_builders_1.buildLeaveLockedPageEvent)(context);
|
|
1702
1541
|
return this.sendTpaasEvent(event);
|
|
1703
1542
|
}
|
|
1704
1543
|
/**
|
|
@@ -1706,8 +1545,8 @@ class Tracker {
|
|
|
1706
1545
|
* @category TPaaS Tracking
|
|
1707
1546
|
*/
|
|
1708
1547
|
async trackLeaveLockedVideoPage(input) {
|
|
1709
|
-
const
|
|
1710
|
-
const event = (0, tpaas_builders_1.buildLeaveLockedVideoPageEvent)(
|
|
1548
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1549
|
+
const event = (0, tpaas_builders_1.buildLeaveLockedVideoPageEvent)(context);
|
|
1711
1550
|
return this.sendTpaasEvent(event);
|
|
1712
1551
|
}
|
|
1713
1552
|
/**
|
|
@@ -1715,8 +1554,8 @@ class Tracker {
|
|
|
1715
1554
|
* @category TPaaS Tracking
|
|
1716
1555
|
*/
|
|
1717
1556
|
async trackLeavePage(input) {
|
|
1718
|
-
const
|
|
1719
|
-
const event = (0, tpaas_builders_1.buildLeavePageEvent)(
|
|
1557
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1558
|
+
const event = (0, tpaas_builders_1.buildLeavePageEvent)(context);
|
|
1720
1559
|
return this.sendTpaasEvent(event);
|
|
1721
1560
|
}
|
|
1722
1561
|
/**
|
|
@@ -1724,8 +1563,8 @@ class Tracker {
|
|
|
1724
1563
|
* @category TPaaS Tracking
|
|
1725
1564
|
*/
|
|
1726
1565
|
async trackLeaveSportsPage(input) {
|
|
1727
|
-
const
|
|
1728
|
-
const event = (0, tpaas_builders_1.buildLeaveSportsPageEvent)(
|
|
1566
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1567
|
+
const event = (0, tpaas_builders_1.buildLeaveSportsPageEvent)(context);
|
|
1729
1568
|
return this.sendTpaasEvent(event);
|
|
1730
1569
|
}
|
|
1731
1570
|
/**
|
|
@@ -1733,8 +1572,8 @@ class Tracker {
|
|
|
1733
1572
|
* @category TPaaS Tracking
|
|
1734
1573
|
*/
|
|
1735
1574
|
async trackLeaveSchoolPage(input) {
|
|
1736
|
-
const
|
|
1737
|
-
const event = (0, tpaas_builders_1.buildLeaveSchoolPageEvent)(
|
|
1575
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1576
|
+
const event = (0, tpaas_builders_1.buildLeaveSchoolPageEvent)(context);
|
|
1738
1577
|
return this.sendTpaasEvent(event);
|
|
1739
1578
|
}
|
|
1740
1579
|
/**
|
|
@@ -1742,8 +1581,8 @@ class Tracker {
|
|
|
1742
1581
|
* @category TPaaS Tracking
|
|
1743
1582
|
*/
|
|
1744
1583
|
async trackLeaveVideoPage(input) {
|
|
1745
|
-
const
|
|
1746
|
-
const event = (0, tpaas_builders_1.buildLeaveVideoPageEvent)(
|
|
1584
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1585
|
+
const event = (0, tpaas_builders_1.buildLeaveVideoPageEvent)(context);
|
|
1747
1586
|
return this.sendTpaasEvent(event);
|
|
1748
1587
|
}
|
|
1749
1588
|
/**
|
|
@@ -1751,8 +1590,8 @@ class Tracker {
|
|
|
1751
1590
|
* @category TPaaS Tracking
|
|
1752
1591
|
*/
|
|
1753
1592
|
async trackLeaveWeather(input) {
|
|
1754
|
-
const
|
|
1755
|
-
const event = (0, tpaas_builders_1.buildLeaveWeatherEvent)(
|
|
1593
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1594
|
+
const event = (0, tpaas_builders_1.buildLeaveWeatherEvent)(context);
|
|
1756
1595
|
return this.sendTpaasEvent(event);
|
|
1757
1596
|
}
|
|
1758
1597
|
/**
|
|
@@ -1760,8 +1599,8 @@ class Tracker {
|
|
|
1760
1599
|
* @category TPaaS Tracking
|
|
1761
1600
|
*/
|
|
1762
1601
|
async trackEngagementAd(input) {
|
|
1763
|
-
const
|
|
1764
|
-
const event = (0, tpaas_builders_1.buildEngagementAdEvent)(
|
|
1602
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1603
|
+
const event = (0, tpaas_builders_1.buildEngagementAdEvent)(context);
|
|
1765
1604
|
return this.sendTpaasEvent(event);
|
|
1766
1605
|
}
|
|
1767
1606
|
/**
|
|
@@ -1769,8 +1608,8 @@ class Tracker {
|
|
|
1769
1608
|
* @category TPaaS Tracking
|
|
1770
1609
|
*/
|
|
1771
1610
|
async trackEngagementAffiliate(input) {
|
|
1772
|
-
const
|
|
1773
|
-
const event = (0, tpaas_builders_1.buildEngagementAffiliateEvent)(
|
|
1611
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1612
|
+
const event = (0, tpaas_builders_1.buildEngagementAffiliateEvent)(context);
|
|
1774
1613
|
return this.sendTpaasEvent(event);
|
|
1775
1614
|
}
|
|
1776
1615
|
/**
|
|
@@ -1778,8 +1617,8 @@ class Tracker {
|
|
|
1778
1617
|
* @category TPaaS Tracking
|
|
1779
1618
|
*/
|
|
1780
1619
|
async trackEngagementAudio(input) {
|
|
1781
|
-
const
|
|
1782
|
-
const event = (0, tpaas_builders_1.buildEngagementAudioEvent)(
|
|
1620
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1621
|
+
const event = (0, tpaas_builders_1.buildEngagementAudioEvent)(context);
|
|
1783
1622
|
return this.sendTpaasEvent(event);
|
|
1784
1623
|
}
|
|
1785
1624
|
/**
|
|
@@ -1787,8 +1626,8 @@ class Tracker {
|
|
|
1787
1626
|
* @category TPaaS Tracking
|
|
1788
1627
|
*/
|
|
1789
1628
|
async trackEngagementForm(input) {
|
|
1790
|
-
const
|
|
1791
|
-
const event = (0, tpaas_builders_1.buildEngagementFormEvent)(
|
|
1629
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1630
|
+
const event = (0, tpaas_builders_1.buildEngagementFormEvent)(context);
|
|
1792
1631
|
return this.sendTpaasEvent(event);
|
|
1793
1632
|
}
|
|
1794
1633
|
/**
|
|
@@ -1796,8 +1635,8 @@ class Tracker {
|
|
|
1796
1635
|
* @category TPaaS Tracking
|
|
1797
1636
|
*/
|
|
1798
1637
|
async trackEngagementOffer(input) {
|
|
1799
|
-
const
|
|
1800
|
-
const event = (0, tpaas_builders_1.buildEngagementOfferEvent)(
|
|
1638
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1639
|
+
const event = (0, tpaas_builders_1.buildEngagementOfferEvent)(context);
|
|
1801
1640
|
return this.sendTpaasEvent(event);
|
|
1802
1641
|
}
|
|
1803
1642
|
/**
|
|
@@ -1805,8 +1644,8 @@ class Tracker {
|
|
|
1805
1644
|
* @category TPaaS Tracking
|
|
1806
1645
|
*/
|
|
1807
1646
|
async trackEngagementSportsUIElement(input) {
|
|
1808
|
-
const
|
|
1809
|
-
const event = (0, tpaas_builders_1.buildEngagementSportsUIElementEvent)(
|
|
1647
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1648
|
+
const event = (0, tpaas_builders_1.buildEngagementSportsUIElementEvent)(context);
|
|
1810
1649
|
return this.sendTpaasEvent(event);
|
|
1811
1650
|
}
|
|
1812
1651
|
/**
|
|
@@ -1814,8 +1653,8 @@ class Tracker {
|
|
|
1814
1653
|
* @category TPaaS Tracking
|
|
1815
1654
|
*/
|
|
1816
1655
|
async trackEngagementSchoolUIElement(input) {
|
|
1817
|
-
const
|
|
1818
|
-
const event = (0, tpaas_builders_1.buildEngagementSchoolUIElementEvent)(
|
|
1656
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1657
|
+
const event = (0, tpaas_builders_1.buildEngagementSchoolUIElementEvent)(context);
|
|
1819
1658
|
return this.sendTpaasEvent(event);
|
|
1820
1659
|
}
|
|
1821
1660
|
/**
|
|
@@ -1823,8 +1662,8 @@ class Tracker {
|
|
|
1823
1662
|
* @category TPaaS Tracking
|
|
1824
1663
|
*/
|
|
1825
1664
|
async trackEngagementTeaser(input) {
|
|
1826
|
-
const
|
|
1827
|
-
const event = (0, tpaas_builders_1.buildEngagementTeaserEvent)(
|
|
1665
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1666
|
+
const event = (0, tpaas_builders_1.buildEngagementTeaserEvent)(context);
|
|
1828
1667
|
return this.sendTpaasEvent(event);
|
|
1829
1668
|
}
|
|
1830
1669
|
/**
|
|
@@ -1832,8 +1671,8 @@ class Tracker {
|
|
|
1832
1671
|
* @category TPaaS Tracking
|
|
1833
1672
|
*/
|
|
1834
1673
|
async trackEngagementTvModule(input) {
|
|
1835
|
-
const
|
|
1836
|
-
const event = (0, tpaas_builders_1.buildEngagementTvModuleEvent)(
|
|
1674
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1675
|
+
const event = (0, tpaas_builders_1.buildEngagementTvModuleEvent)(context);
|
|
1837
1676
|
return this.sendTpaasEvent(event);
|
|
1838
1677
|
}
|
|
1839
1678
|
/**
|
|
@@ -1841,8 +1680,8 @@ class Tracker {
|
|
|
1841
1680
|
* @category TPaaS Tracking
|
|
1842
1681
|
*/
|
|
1843
1682
|
async trackEngagementTvSearch(input) {
|
|
1844
|
-
const
|
|
1845
|
-
const event = (0, tpaas_builders_1.buildEngagementTvSearchEvent)(
|
|
1683
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1684
|
+
const event = (0, tpaas_builders_1.buildEngagementTvSearchEvent)(context);
|
|
1846
1685
|
return this.sendTpaasEvent(event);
|
|
1847
1686
|
}
|
|
1848
1687
|
/**
|
|
@@ -1850,8 +1689,8 @@ class Tracker {
|
|
|
1850
1689
|
* @category TPaaS Tracking
|
|
1851
1690
|
*/
|
|
1852
1691
|
async trackEngagementUIElement(input) {
|
|
1853
|
-
const
|
|
1854
|
-
const event = (0, tpaas_builders_1.buildEngagementUIElementEvent)(
|
|
1692
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1693
|
+
const event = (0, tpaas_builders_1.buildEngagementUIElementEvent)(context);
|
|
1855
1694
|
return this.sendTpaasEvent(event);
|
|
1856
1695
|
}
|
|
1857
1696
|
/**
|
|
@@ -1859,8 +1698,8 @@ class Tracker {
|
|
|
1859
1698
|
* @category TPaaS Tracking
|
|
1860
1699
|
*/
|
|
1861
1700
|
async trackEngagementVideo(input) {
|
|
1862
|
-
const
|
|
1863
|
-
const event = (0, tpaas_builders_1.buildEngagementVideoEvent)(
|
|
1701
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1702
|
+
const event = (0, tpaas_builders_1.buildEngagementVideoEvent)(context);
|
|
1864
1703
|
return this.sendTpaasEvent(event);
|
|
1865
1704
|
}
|
|
1866
1705
|
/**
|
|
@@ -1868,8 +1707,8 @@ class Tracker {
|
|
|
1868
1707
|
* @category TPaaS Tracking
|
|
1869
1708
|
*/
|
|
1870
1709
|
async trackEngagementVideoAd(input) {
|
|
1871
|
-
const
|
|
1872
|
-
const event = (0, tpaas_builders_1.buildEngagementVideoAdEvent)(
|
|
1710
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1711
|
+
const event = (0, tpaas_builders_1.buildEngagementVideoAdEvent)(context);
|
|
1873
1712
|
return this.sendTpaasEvent(event);
|
|
1874
1713
|
}
|
|
1875
1714
|
/**
|
|
@@ -1877,8 +1716,8 @@ class Tracker {
|
|
|
1877
1716
|
* @category TPaaS Tracking
|
|
1878
1717
|
*/
|
|
1879
1718
|
async trackEngagementWidget(input) {
|
|
1880
|
-
const
|
|
1881
|
-
const event = (0, tpaas_builders_1.buildEngagementWidgetEvent)(
|
|
1719
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1720
|
+
const event = (0, tpaas_builders_1.buildEngagementWidgetEvent)(context);
|
|
1882
1721
|
return this.sendTpaasEvent(event);
|
|
1883
1722
|
}
|
|
1884
1723
|
/**
|
|
@@ -1886,8 +1725,8 @@ class Tracker {
|
|
|
1886
1725
|
* @category TPaaS Tracking
|
|
1887
1726
|
*/
|
|
1888
1727
|
async trackHeartbeatCommercialArticle(input) {
|
|
1889
|
-
const
|
|
1890
|
-
const event = (0, tpaas_builders_1.buildHeartbeatCommercialArticleEvent)(
|
|
1728
|
+
const context = await (0, tpaas_context_1.prepareTpaasEventContext)(this.tpaasContextSource, input);
|
|
1729
|
+
const event = (0, tpaas_builders_1.buildHeartbeatCommercialArticleEvent)(context);
|
|
1891
1730
|
return this.sendTpaasEvent(event);
|
|
1892
1731
|
}
|
|
1893
1732
|
/**
|
|
@@ -1896,9 +1735,6 @@ class Tracker {
|
|
|
1896
1735
|
* @category TPaaS Tracking
|
|
1897
1736
|
*/
|
|
1898
1737
|
async sendTpaasEvent(event) {
|
|
1899
|
-
// Resolve any pending session ID promises
|
|
1900
|
-
// (session was created when the event was built)
|
|
1901
|
-
this.resolveSessionIdPromise();
|
|
1902
1738
|
// The Hybrid use case implements a "bridged" event method, injected into the window scope,
|
|
1903
1739
|
// which is used to send events through the native app.
|
|
1904
1740
|
if ((0, utils_1.isFunction)(this.state.altEventHandler)) {
|
|
@@ -2162,7 +1998,7 @@ class Tracker {
|
|
|
2162
1998
|
* If no session exists yet, returns a promise that resolves with the session ID
|
|
2163
1999
|
* when it gets created (typically when the first non-anonymous tracking event is sent).
|
|
2164
2000
|
*
|
|
2165
|
-
* Note: Anonymous events (such as those sent via {@link trackAnonymous} or {@link
|
|
2001
|
+
* Note: Anonymous events (such as those sent via {@link trackAnonymous} or {@link trackAnonymousImpressionUIElement})
|
|
2166
2002
|
* do not create sessions and will not resolve pending session ID promises. The promise will only resolve when a
|
|
2167
2003
|
* non-anonymous tracking event is sent.
|
|
2168
2004
|
*
|
|
@@ -2172,9 +2008,9 @@ class Tracker {
|
|
|
2172
2008
|
* @returns The session ID, or a promise that resolves to the session ID
|
|
2173
2009
|
*/
|
|
2174
2010
|
getSessionId() {
|
|
2175
|
-
const session = (0,
|
|
2176
|
-
if (session
|
|
2177
|
-
return Promise.resolve(session.
|
|
2011
|
+
const session = (0, store_1.readSession)();
|
|
2012
|
+
if (session) {
|
|
2013
|
+
return Promise.resolve((0, store_1.generateSessionSDRN)(session.sessionId));
|
|
2178
2014
|
}
|
|
2179
2015
|
// No session exists yet, create or return existing promise
|
|
2180
2016
|
if (!this.sessionIdPromise) {
|
|
@@ -2688,10 +2524,10 @@ class Tracker {
|
|
|
2688
2524
|
* @private
|
|
2689
2525
|
*/
|
|
2690
2526
|
resolveSessionIdPromise() {
|
|
2691
|
-
const session = (0,
|
|
2692
|
-
if (session
|
|
2527
|
+
const session = (0, store_1.readSession)();
|
|
2528
|
+
if (session) {
|
|
2693
2529
|
eventBus.emit('tracker:session:new', {
|
|
2694
|
-
sessionId: session.
|
|
2530
|
+
sessionId: (0, store_1.generateSessionSDRN)(session.sessionId),
|
|
2695
2531
|
});
|
|
2696
2532
|
}
|
|
2697
2533
|
}
|