@schibsted/pulse-sdk 8.0.0-rc.2 → 8.0.0-rc.20
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 +578 -303
- package/dist/cjs/app-integration.js +3 -3
- package/dist/cjs/builders/actor.js +6 -6
- package/dist/cjs/builders/consents.js +8 -8
- package/dist/cjs/builders/device-browser.js +8 -8
- package/dist/cjs/builders/device-node.js +3 -3
- package/dist/cjs/builders/events-anonymous-node.js +3 -3
- package/dist/cjs/builders/events-node.js +7 -7
- package/dist/cjs/builders/experimentMetadata.js +2 -2
- package/dist/cjs/builders/experiments.js +1 -0
- package/dist/cjs/builders/objects/objects-anonymous-browser.js +2 -2
- package/dist/cjs/builders/objects/objects-anonymous-node.js +9 -9
- package/dist/cjs/builders/objects/objects-browser.js +2 -2
- package/dist/cjs/builders/objects/objects-node.js +10 -10
- package/dist/cjs/builders/objects/utils.js +3 -3
- package/dist/cjs/builders/origin-browser.js +2 -2
- package/dist/cjs/builders/origin-node.js +4 -4
- package/dist/cjs/builders/session-browser.js +6 -5
- package/dist/cjs/cis-sync/cis-browser.js +219 -0
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/cis-sync}/cis.js +0 -1
- package/dist/cjs/cis-sync/eventEmitter.js +37 -0
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/cis-sync}/index.js +0 -1
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/cis-sync}/pulse-cookie.js +53 -63
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/cis-sync}/storage/pulseStorage.js +28 -21
- package/dist/cjs/cis-sync/storage/storage.js +24 -0
- package/dist/cjs/createPulseTracker.js +4 -4
- package/dist/cjs/identity/actor.js +20 -8
- package/dist/cjs/identity/advertising.js +1 -1
- package/dist/cjs/identity/cis.js +7 -6
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/leaveTracking/index.js +10 -10
- package/dist/cjs/leaveTrackingTpaas/constants.js +2 -7
- package/dist/cjs/leaveTrackingTpaas/index.js +70 -46
- package/dist/cjs/network-browser.js +3 -3
- package/dist/cjs/remoteConfig/index.js +5 -5
- package/dist/cjs/tpaas-builders/builders/catalogVersion.js +9 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/device.js +11 -5
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/navigationType.js +2 -3
- package/dist/cjs/tpaas-builders/builders/pageContent.js +7 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/pageInfo.js +2 -2
- package/dist/cjs/tpaas-builders/builders/pageSports.js +7 -0
- package/dist/cjs/tpaas-builders/builders/provider.js +19 -0
- package/dist/cjs/tpaas-builders/builders/referrer.js +17 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/session.js +23 -20
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/trackerBuilder.js +2 -3
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/user.js +1 -1
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/utm.js +3 -3
- package/dist/cjs/tpaas-builders/builders.js +339 -0
- package/dist/cjs/tpaas-builders/guards.js +7 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/index.js +3 -0
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/tpaas-builders}/types.js +0 -1
- package/{node_modules/@schibsted/tpaas-schemas/dist/cjs → dist/cjs/tpaas-schemas}/constants.js +193 -155
- package/{node_modules/@schibsted/tpaas-schemas/dist/cjs → dist/cjs/tpaas-schemas}/index.js +1 -0
- package/dist/cjs/tpaas-schemas/types.js +2 -0
- package/dist/cjs/tracker-proxy/consts.js +29 -6
- package/dist/cjs/tracker-proxy/proxy-provider.js +2 -2
- package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/index.js +4 -1
- package/dist/cjs/utils/xDomainId.js +15 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/visibility-observer/index.js +9 -7
- package/dist/cjs/wrapper/types/event.js +5 -0
- package/dist/cjs/wrapper/utils/map-page-to-page-ref.js +13 -0
- package/dist/ejs/Tracker.js +510 -235
- package/dist/ejs/app-integration.js +1 -1
- package/dist/ejs/builders/actor.js +3 -3
- package/dist/ejs/builders/consents.js +4 -4
- package/dist/ejs/builders/device-browser.js +2 -2
- package/dist/ejs/builders/device-node.js +1 -1
- package/dist/ejs/builders/events-anonymous-node.js +1 -1
- package/dist/ejs/builders/events-node.js +4 -4
- package/dist/ejs/builders/experimentMetadata.js +1 -1
- package/dist/ejs/builders/experiments.js +1 -1
- package/dist/ejs/builders/objects/objects-anonymous-browser.js +1 -1
- package/dist/ejs/builders/objects/objects-anonymous-node.js +1 -1
- package/dist/ejs/builders/objects/objects-browser.js +1 -1
- package/dist/ejs/builders/objects/objects-node.js +1 -1
- package/dist/ejs/builders/objects/utils.js +1 -1
- package/dist/ejs/builders/origin-browser.js +1 -1
- package/dist/ejs/builders/origin-node.js +1 -1
- package/dist/ejs/builders/session-browser.js +2 -1
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/cis-browser.js +17 -4
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/cis.js +0 -1
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/eventEmitter.js +0 -1
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/index.js +0 -1
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/pulse-cookie.js +1 -2
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/storage/pulseStorage.js +12 -4
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/storage/storage.js +6 -2
- package/dist/ejs/createPulseTracker.js +1 -1
- package/dist/ejs/identity/actor.js +21 -9
- package/dist/ejs/identity/advertising.js +1 -1
- package/dist/ejs/identity/cis.js +4 -3
- package/dist/ejs/index.js +4 -3
- package/dist/ejs/leaveTracking/index.js +1 -1
- package/dist/ejs/leaveTrackingTpaas/constants.js +1 -5
- package/dist/ejs/leaveTrackingTpaas/index.js +65 -41
- package/dist/ejs/network-browser.js +1 -1
- package/dist/ejs/remoteConfig/index.js +1 -1
- package/dist/ejs/tpaas-builders/builders/catalogVersion.js +6 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/device.js +10 -4
- package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/navigationType.js +2 -3
- package/dist/ejs/tpaas-builders/builders/pageContent.js +3 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/pageInfo.js +1 -1
- package/dist/ejs/tpaas-builders/builders/pageSports.js +3 -0
- package/dist/ejs/tpaas-builders/builders/provider.js +16 -0
- package/dist/ejs/tpaas-builders/builders/referrer.js +13 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/session.js +18 -15
- package/dist/ejs/tpaas-builders/builders/trackerBuilder.js +10 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/user.js +1 -1
- package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/utm.js +2 -2
- package/dist/ejs/tpaas-builders/builders.js +271 -0
- package/dist/ejs/tpaas-builders/guards.js +4 -0
- package/dist/ejs/tpaas-builders/index.js +2 -0
- package/{node_modules/@schibsted/tpaas-schemas/dist/ejs → dist/ejs/tpaas-schemas}/constants.js +191 -153
- package/{node_modules/@schibsted/tpaas-schemas/dist/ejs → dist/ejs/tpaas-schemas}/index.js +1 -0
- package/dist/ejs/tpaas-schemas/types.js +1 -0
- package/dist/ejs/tracker-proxy/consts.js +29 -6
- package/dist/ejs/tracker-proxy/proxy-provider.js +1 -1
- package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/index.js +1 -0
- package/dist/ejs/utils/xDomainId.js +11 -0
- package/dist/ejs/version.js +1 -1
- package/dist/ejs/visibility-observer/index.js +9 -7
- package/dist/ejs/wrapper/types/event.js +4 -1
- package/dist/ejs/wrapper/utils/map-page-to-page-ref.js +10 -0
- package/dist/types/Tracker.d.ts +178 -77
- package/dist/types/builders/actor.d.ts +3 -2
- package/dist/types/builders/consents.d.ts +3 -3
- package/dist/types/builders/device-node.d.ts +2 -2
- package/dist/types/builders/events-anonymous-node.d.ts +4 -4
- package/dist/types/builders/events-node.d.ts +5 -5
- package/dist/types/builders/experiments.d.ts +1 -0
- package/dist/types/builders/index.d.ts +1 -1
- package/dist/types/builders/objects/objects-anonymous-node.d.ts +1 -1
- package/dist/types/builders/objects/objects-node.d.ts +1 -1
- package/dist/types/builders/origin-node.d.ts +1 -1
- package/dist/types/builders/session-browser.d.ts +1 -0
- package/{node_modules/@schibsted/pulse-cis-sync/dist/types → dist/types/cis-sync}/cis-browser.d.ts +1 -0
- package/{node_modules/@schibsted/pulse-cis-sync/dist/types → dist/types/cis-sync}/storage/pulseStorage.d.ts +12 -4
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/storage/storage.d.ts +2 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/createPulseTracker.d.ts +1 -1
- package/dist/types/identity/actor.d.ts +3 -3
- package/dist/types/identity/advertising.d.ts +2 -2
- package/dist/types/identity/cis.d.ts +4 -4
- package/dist/types/index.d.ts +7 -8
- package/dist/types/leaveTrackingTpaas/constants.d.ts +1 -5
- package/dist/types/leaveTrackingTpaas/index.d.ts +6 -6
- package/dist/types/leaveTrackingTpaas/types.d.ts +2 -10
- package/dist/types/tpaas-builders/builders/anonymous.d.ts +3 -0
- package/dist/types/tpaas-builders/builders/baseEvent.d.ts +3 -0
- package/dist/types/tpaas-builders/builders/catalogVersion.d.ts +3 -0
- package/dist/types/tpaas-builders/builders/consents.d.ts +5 -0
- package/dist/types/tpaas-builders/builders/device.d.ts +5 -0
- package/dist/types/tpaas-builders/builders/experiments.d.ts +9 -0
- package/dist/types/tpaas-builders/builders/navigationType.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/pageContent.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/pageInfo.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/pageSports.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/pageviewId.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/provider.d.ts +5 -0
- package/dist/types/tpaas-builders/builders/referrer.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/session.d.ts +15 -0
- package/dist/types/tpaas-builders/builders/time.d.ts +4 -0
- package/dist/types/tpaas-builders/builders/trackerBuilder.d.ts +5 -0
- package/dist/types/tpaas-builders/builders/user.d.ts +5 -0
- package/dist/types/tpaas-builders/builders/utm.d.ts +6 -0
- package/dist/types/tpaas-builders/builders.d.ts +141 -0
- package/dist/types/tpaas-builders/guards.d.ts +2 -0
- package/dist/types/tpaas-builders/index.d.ts +3 -0
- package/dist/types/tpaas-builders/types.d.ts +36 -0
- package/dist/types/tpaas-schemas/constants.d.ts +478 -0
- package/dist/types/tpaas-schemas/index.d.ts +5 -0
- package/dist/types/tpaas-schemas/types/ITpaasEvent.d.ts +132 -0
- package/dist/types/tpaas-schemas/types/schemas/IAnonymousViewUIElement.d.ts +58 -0
- package/dist/types/tpaas-schemas/types/schemas/ICompletedHealthAction.d.ts +139 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementAd.d.ts +117 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementAffiliate.d.ts +144 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementAudio.d.ts +209 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementForm.d.ts +111 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementHealthUIElement.d.ts +133 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementOffer.d.ts +107 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementSchoolUIElement.d.ts +107 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementSportsUIElement.d.ts +157 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementTeaser.d.ts +114 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementTvModule.d.ts +130 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementTvSearch.d.ts +142 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementUIElement.d.ts +105 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementVideo.d.ts +234 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementVideoAd.d.ts +145 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementWidget.d.ts +91 -0
- package/dist/types/tpaas-schemas/types/schemas/IHeartbeatCommercialArticle.d.ts +96 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionAd.d.ts +115 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionAdSlot.d.ts +89 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionAffiliate.d.ts +142 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionForm.d.ts +113 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionHealthUIElement.d.ts +138 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionOffer.d.ts +109 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionPlayer.d.ts +108 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionSchoolUIElement.d.ts +109 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionSportsUIElement.d.ts +159 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionTeaser.d.ts +112 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionUIElement.d.ts +107 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionWidget.d.ts +89 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveArticle.d.ts +133 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveAudioPage.d.ts +88 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveError.d.ts +95 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveFrontpage.d.ts +83 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveLandingpage.d.ts +90 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveListing.d.ts +123 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedArticle.d.ts +139 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedAudioPage.d.ts +97 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedPage.d.ts +90 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedVideoPage.d.ts +97 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeavePage.d.ts +82 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveSchoolPage.d.ts +84 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveSportsPage.d.ts +137 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveVideoPage.d.ts +91 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveWeather.d.ts +94 -0
- package/dist/types/tpaas-schemas/types/schemas/ILoadAd.d.ts +119 -0
- package/dist/types/tpaas-schemas/types/schemas/IRequestAd.d.ts +95 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewArticle.d.ts +133 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewAudioPage.d.ts +87 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewError.d.ts +90 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewFrontpage.d.ts +80 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewHealthPage.d.ts +119 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewLandingpage.d.ts +76 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewListing.d.ts +118 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewLockedArticle.d.ts +139 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewLockedAudioPage.d.ts +95 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewLockedPage.d.ts +94 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewLockedVideoPage.d.ts +95 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewPage.d.ts +86 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewSchoolPage.d.ts +88 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewSportsPage.d.ts +135 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewTitle.d.ts +92 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewVideoPage.d.ts +87 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewWeather.d.ts +94 -0
- package/dist/types/tpaas-schemas/types/schemas/index.d.ts +64 -0
- package/dist/types/tpaas-schemas/types/templates/IBranded.d.ts +42 -0
- package/dist/types/tpaas-schemas/types/templates/IConsents.d.ts +34 -0
- package/dist/types/tpaas-schemas/types/templates/IContent.d.ts +56 -0
- package/dist/types/tpaas-schemas/types/templates/IDevice.d.ts +62 -0
- package/dist/types/tpaas-schemas/types/templates/IEngagement.d.ts +21 -0
- package/dist/types/tpaas-schemas/types/templates/IExperiments.d.ts +35 -0
- package/dist/types/tpaas-schemas/types/templates/IHealthFood.d.ts +55 -0
- package/dist/types/tpaas-schemas/types/templates/IHealthOrigin.d.ts +27 -0
- package/dist/types/tpaas-schemas/types/templates/IHealthPhysicalActivity.d.ts +36 -0
- package/dist/types/tpaas-schemas/types/templates/IHealthTraining.d.ts +74 -0
- package/dist/types/tpaas-schemas/types/templates/IHealthUserData.d.ts +25 -0
- package/dist/types/tpaas-schemas/types/templates/ILeave.d.ts +54 -0
- package/dist/types/tpaas-schemas/types/templates/ILeaveAudio.d.ts +37 -0
- package/dist/types/tpaas-schemas/types/templates/ILeaveStories.d.ts +34 -0
- package/dist/types/tpaas-schemas/types/templates/ILocation.d.ts +21 -0
- package/dist/types/tpaas-schemas/types/templates/IMetrics.d.ts +32 -0
- package/dist/types/tpaas-schemas/types/templates/IPageRef.d.ts +46 -0
- package/dist/types/tpaas-schemas/types/templates/IPlacement.d.ts +45 -0
- package/dist/types/tpaas-schemas/types/templates/IProvider.d.ts +73 -0
- package/dist/types/tpaas-schemas/types/templates/ISchool.d.ts +74 -0
- package/dist/types/tpaas-schemas/types/templates/ISession.d.ts +33 -0
- package/dist/types/tpaas-schemas/types/templates/ISports.d.ts +98 -0
- package/dist/types/tpaas-schemas/types/templates/ISportsUserFeatures.d.ts +28 -0
- package/dist/types/tpaas-schemas/types/templates/ITime.d.ts +32 -0
- package/dist/types/tpaas-schemas/types/templates/ITracker.d.ts +37 -0
- package/dist/types/tpaas-schemas/types/templates/IUser.d.ts +34 -0
- package/dist/types/tpaas-schemas/types/templates/IUtmTags.d.ts +38 -0
- package/dist/types/tpaas-schemas/types/templates/index.d.ts +27 -0
- package/dist/types/tpaas-schemas/types.d.ts +42 -0
- package/dist/types/tracker-proxy/consts.d.ts +2 -2
- package/dist/types/types.d.ts +19 -13
- package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/index.d.ts +1 -0
- package/dist/types/utils/xDomainId.d.ts +2 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/visibility-observer/index.d.ts +6 -1
- package/dist/types/wrapper/engagement/ui-element/types.d.ts +1 -1
- package/dist/types/wrapper/types/base-event.d.ts +1 -1
- package/dist/types/wrapper/types/event.d.ts +4 -2
- package/dist/types/wrapper/types/utils.d.ts +1 -1
- package/dist/types/wrapper/utils/map-page-to-page-ref.d.ts +3 -0
- package/dist/types/wrapper/view/article/types.d.ts +1 -1
- package/dist/types/wrapper/view/frontpage/types.d.ts +1 -1
- package/dist/types/wrapper/view/listing/types.d.ts +1 -1
- package/dist/types/wrapper/view/loginposter/types.d.ts +1 -1
- package/dist/types/wrapper/view/page/types.d.ts +1 -1
- package/dist/types/wrapper/view/salesposter/types.d.ts +1 -1
- package/dist/types/wrapper/view/ui-element/types.d.ts +1 -1
- package/package.json +21 -20
- package/dist/cjs/Tracker.test-d.js +0 -76
- package/dist/ejs/Tracker.test-d.js +0 -71
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.d.ts +0 -26
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.js +0 -273
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.js +0 -39
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/index.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/pulse-cookie.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.d.ts +0 -36
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.js +0 -21
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/types.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.d.ts +0 -26
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.d.ts +0 -10
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.d.ts +0 -14
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.d.ts +0 -4
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.d.ts +0 -55
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.d.ts +0 -36
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.d.ts +0 -6
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.d.ts +0 -24
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.js +0 -2
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/cis.d.ts +0 -10
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/eventEmitter.d.ts +0 -14
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/index.d.ts +0 -4
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/pulse-cookie.d.ts +0 -55
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/storage/storage.d.ts +0 -6
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/types.d.ts +0 -24
- package/node_modules/@schibsted/pulse-cis-sync/package.json +0 -44
- package/node_modules/@schibsted/pulse-utils/package.json +0 -36
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/provider.js +0 -12
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/referrer.js +0 -19
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders.js +0 -272
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/provider.js +0 -9
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/referrer.js +0 -15
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/trackerBuilder.js +0 -11
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders.js +0 -215
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/index.js +0 -1
- package/node_modules/@schibsted/tpaas-event-builder/dist/index.d.ts +0 -5403
- package/node_modules/@schibsted/tpaas-event-builder/package.json +0 -40
- package/node_modules/@schibsted/tpaas-schemas/dist/index.d.ts +0 -6176
- package/node_modules/@schibsted/tpaas-schemas/package.json +0 -35
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/cis-sync}/types.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/anonymous.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/baseEvent.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/consents.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/experiments.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/pageviewId.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/time.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/cookie-config.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/cookie.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/events.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/get.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/getRootDomain.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/merge.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/objects.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/omit.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/randomString.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/throttle.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/webApi.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/cis-sync}/types.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/anonymous.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/baseEvent.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/consents.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/experiments.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/pageviewId.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/time.js +0 -0
- /package/dist/{types/Tracker.test-d.d.ts → ejs/tpaas-builders/types.js} +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/cookie-config.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/cookie.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/events.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/get.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/getRootDomain.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/merge.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/objects.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/omit.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/randomString.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/throttle.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/webApi.js +0 -0
- /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/cis.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/eventEmitter.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/index.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/pulse-cookie.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/types.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/cookie-config.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/cookie.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/events.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/get.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/getRootDomain.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/merge.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/objects.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/omit.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/randomString.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/throttle.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/webApi.d.ts +0 -0
package/dist/cjs/Tracker.js
CHANGED
|
@@ -41,10 +41,6 @@ exports.subscribe = subscribe;
|
|
|
41
41
|
exports.subscribeOnce = subscribeOnce;
|
|
42
42
|
exports.subscribeWithState = subscribeWithState;
|
|
43
43
|
exports.unsubscribe = unsubscribe;
|
|
44
|
-
const pulse_cis_sync_1 = require("@schibsted/pulse-cis-sync");
|
|
45
|
-
const pulse_utils_1 = require("@schibsted/pulse-utils");
|
|
46
|
-
const tpaas_event_builder_1 = require("@schibsted/tpaas-event-builder");
|
|
47
|
-
const tpaas_schemas_1 = require("@schibsted/tpaas-schemas");
|
|
48
44
|
const loglevel_1 = __importDefault(require("loglevel"));
|
|
49
45
|
const uuid_1 = require("uuid");
|
|
50
46
|
const app_integration_1 = require("./app-integration");
|
|
@@ -53,7 +49,9 @@ const consent_manager_1 = require("./builders/consent-manager");
|
|
|
53
49
|
const consents_1 = require("./builders/consents");
|
|
54
50
|
const events_1 = require("./builders/events");
|
|
55
51
|
const events_anonymous_node_1 = require("./builders/events-anonymous-node");
|
|
52
|
+
const experiments_1 = require("./builders/experiments");
|
|
56
53
|
const session_browser_1 = require("./builders/session-browser");
|
|
54
|
+
const cis_sync_1 = require("./cis-sync");
|
|
57
55
|
const config_1 = require("./config");
|
|
58
56
|
const config_browser_1 = require("./config-browser");
|
|
59
57
|
const defer_1 = __importDefault(require("./defer"));
|
|
@@ -63,11 +61,16 @@ const leaveTracking_1 = require("./leaveTracking");
|
|
|
63
61
|
const leaveTrackingTpaas_1 = require("./leaveTrackingTpaas");
|
|
64
62
|
const network_1 = __importDefault(require("./network"));
|
|
65
63
|
const config = __importStar(require("./remoteConfig"));
|
|
64
|
+
const tpaas_builders_1 = require("./tpaas-builders");
|
|
65
|
+
const tpaas_schemas_1 = require("./tpaas-schemas");
|
|
66
66
|
const proxy_provider_1 = require("./tracker-proxy/proxy-provider");
|
|
67
|
+
const utils_1 = require("./utils");
|
|
67
68
|
const version_1 = require("./version");
|
|
68
69
|
const visibility_observer_1 = require("./visibility-observer");
|
|
69
70
|
const warnOnce_1 = __importDefault(require("./warnOnce"));
|
|
70
71
|
const event_builder_1 = require("./wrapper/engagement/ui-element/event-builder");
|
|
72
|
+
const types_1 = require("./wrapper/types");
|
|
73
|
+
const map_page_to_page_ref_1 = require("./wrapper/utils/map-page-to-page-ref");
|
|
71
74
|
const page_from_page_view_1 = require("./wrapper/utils/page-from-page-view");
|
|
72
75
|
const event_builder_2 = require("./wrapper/view/article/event-builder");
|
|
73
76
|
const event_builder_3 = require("./wrapper/view/frontpage/event-builder");
|
|
@@ -103,6 +106,7 @@ const anonymousEvents = {
|
|
|
103
106
|
trackerEvent: events_anonymous_node_1.anonymousTrackerEvent,
|
|
104
107
|
engagementEvent: events_anonymous_node_1.anonymousEngagementEvent,
|
|
105
108
|
};
|
|
109
|
+
const ANONYMOUS_EVENT_FORBIDDEN_FIELDS = ['session', 'actor', 'device', 'location', 'pageViewId'];
|
|
106
110
|
/**
|
|
107
111
|
* @typeParam T Type of event to track
|
|
108
112
|
* @param name
|
|
@@ -111,6 +115,17 @@ const anonymousEvents = {
|
|
|
111
115
|
function getAnonymousEventBuilder(name) {
|
|
112
116
|
return name in anonymousEvents ? anonymousEvents[name] : anonymousEvents.trackerEvent;
|
|
113
117
|
}
|
|
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
|
+
};
|
|
114
129
|
/**
|
|
115
130
|
* Determines if the SDK is running in a Hybrid (WebView) environment.
|
|
116
131
|
*
|
|
@@ -157,6 +172,21 @@ function unsubscribe(eventName, callback) {
|
|
|
157
172
|
* @class Tracker
|
|
158
173
|
*/
|
|
159
174
|
class Tracker {
|
|
175
|
+
async getCurrentTpaasPage(currentPageInfo = this.currentPageContext.info) {
|
|
176
|
+
const { id, type, url } = await currentPageInfo;
|
|
177
|
+
return (0, map_page_to_page_ref_1.mapPageToPageRef)(id, type, url);
|
|
178
|
+
}
|
|
179
|
+
async getCurrentLegacyPage() {
|
|
180
|
+
const { id, type, url } = await this.currentPageContext.info;
|
|
181
|
+
// make sure the pageType is valid for legacy events
|
|
182
|
+
const validatedType = (0, types_1.isLegacyPageType)(type) ? type : 'Page';
|
|
183
|
+
return {
|
|
184
|
+
// add the SDRN prefix if it's not there, legacy events expect the full SDRN format
|
|
185
|
+
id: id.startsWith('sdrn:') ? id : `sdrn:${this.state.providerId}:${validatedType.toLowerCase()}:${id}`,
|
|
186
|
+
type: validatedType,
|
|
187
|
+
url,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
160
190
|
/**
|
|
161
191
|
* > [!WARNING]
|
|
162
192
|
* >
|
|
@@ -175,12 +205,36 @@ class Tracker {
|
|
|
175
205
|
// the tracking of the same element with both old and new events at the same time
|
|
176
206
|
this.legacyVisibilityObservers = new Map();
|
|
177
207
|
this.visibilityObservers = new Map();
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
208
|
+
/**
|
|
209
|
+
* Current page state shared by legacy and TPaaS tracking. See CurrentPageContext for
|
|
210
|
+
* which properties are shared and which are exclusively TPaaS metadata.
|
|
211
|
+
*/
|
|
212
|
+
this.currentPageContext = {
|
|
213
|
+
info: {
|
|
214
|
+
id: 'unknown',
|
|
215
|
+
type: 'Page',
|
|
216
|
+
url: utils_1.isBrowser ? window.location.href : undefined,
|
|
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,
|
|
236
|
+
};
|
|
182
237
|
};
|
|
183
|
-
this.currentPage = undefined;
|
|
184
238
|
/**
|
|
185
239
|
* Promise that resolves when a session ID becomes available
|
|
186
240
|
* @private
|
|
@@ -192,32 +246,30 @@ class Tracker {
|
|
|
192
246
|
*/
|
|
193
247
|
this.hasProxyListener = false;
|
|
194
248
|
this.setPageDefaults = (pageViewEvent) => {
|
|
195
|
-
|
|
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));
|
|
196
252
|
if (pageViewEvent.origin) {
|
|
197
253
|
const pageDefaults = { origin: pageViewEvent.origin };
|
|
198
254
|
this.update(pageDefaults, true);
|
|
199
255
|
}
|
|
200
256
|
};
|
|
201
|
-
this.setCurrentPage = (id, type) => {
|
|
202
|
-
this.currentPage = {
|
|
203
|
-
pageId: id,
|
|
204
|
-
pageType: type,
|
|
205
|
-
url: pulse_utils_1.isBrowser ? window.location.href : undefined,
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
257
|
loglevel_1.default.setLevel(config?.logLevel ?? loglevel_1.default.levels.ERROR);
|
|
209
258
|
// runtime check for providerId inconsistency
|
|
210
259
|
if (!providerId || !(typeof providerId === 'string')) {
|
|
211
260
|
throw new Error('Required parameter `providerId` missing');
|
|
212
261
|
}
|
|
262
|
+
if (config?.componentVersion !== undefined && config?.component === undefined) {
|
|
263
|
+
throw new Error('`componentVersion` cannot be provided without `component`');
|
|
264
|
+
}
|
|
213
265
|
let includeAdvertising;
|
|
214
|
-
if (
|
|
266
|
+
if (utils_1.isBrowser && config?.autoCreateConsents) {
|
|
215
267
|
config.consents = (0, consent_manager_1.getConsentsWaitForAnalytics)((consents) => {
|
|
216
268
|
loglevel_1.default.debug('Consents received from CMP', consents);
|
|
217
269
|
return this.setConsentsInternal(consents);
|
|
218
270
|
});
|
|
219
271
|
}
|
|
220
|
-
if ((0,
|
|
272
|
+
if ((0, utils_1.isPromise)(config?.consents)) {
|
|
221
273
|
includeAdvertising = (0, consents_1.applyAdvertisingConsent)(config?.consents, config?.requireAdvertisingOptIn);
|
|
222
274
|
}
|
|
223
275
|
else {
|
|
@@ -233,7 +285,7 @@ class Tracker {
|
|
|
233
285
|
identity.clearCookieJweIfStale(config?.nativeJwe);
|
|
234
286
|
const deployStage = config?.deployStage || 'pro';
|
|
235
287
|
const deployStageTpaas = config?.deployStageTpaas || 'pre';
|
|
236
|
-
this.state = (0,
|
|
288
|
+
this.state = (0, utils_1.pulseMerge)({}, config_1.baseConfig, {
|
|
237
289
|
collectorBaseUrl: config_browser_1.collectorEndpoints[deployStage],
|
|
238
290
|
deployStage,
|
|
239
291
|
deployStageTpaas,
|
|
@@ -248,11 +300,15 @@ class Tracker {
|
|
|
248
300
|
tpaasCollectorBaseUrl: config_browser_1.collectorEndpoints[deployStageTpaas],
|
|
249
301
|
trackerId: (0, uuid_1.v4)(),
|
|
250
302
|
vendors: config?.vendors?.length ? [] : ['xandr'],
|
|
303
|
+
useBeacon: true,
|
|
304
|
+
useBeaconWhenAvailable: true,
|
|
251
305
|
}, config);
|
|
252
306
|
// Move to default config?
|
|
253
|
-
this.builders = (0,
|
|
307
|
+
this.builders = (0, utils_1.pulseMerge)({}, builders, {
|
|
254
308
|
provider: {
|
|
255
309
|
id: providerId,
|
|
310
|
+
...(config?.component !== undefined && { component: config.component }),
|
|
311
|
+
...(config?.componentVersion !== undefined && { componentVersion: config.componentVersion }),
|
|
256
312
|
},
|
|
257
313
|
tracker: {
|
|
258
314
|
version: version_1.SDK_VERSION,
|
|
@@ -268,7 +324,7 @@ class Tracker {
|
|
|
268
324
|
this.retryTpaasEventQueue = [];
|
|
269
325
|
if (this.state.environment === 'browser') {
|
|
270
326
|
// @ts-expect-error
|
|
271
|
-
if (
|
|
327
|
+
if (utils_1.isBrowser && window.navigator?.sendBeacon) {
|
|
272
328
|
const originalUseBeacon = this.state.useBeacon;
|
|
273
329
|
window.addEventListener('pagehide', () => {
|
|
274
330
|
this.state.useBeacon = true;
|
|
@@ -282,7 +338,7 @@ class Tracker {
|
|
|
282
338
|
}
|
|
283
339
|
}
|
|
284
340
|
// @ts-expect-error
|
|
285
|
-
this.debouncedSend = (0,
|
|
341
|
+
this.debouncedSend = (0, utils_1.throttle)(async () => {
|
|
286
342
|
try {
|
|
287
343
|
return await this._sendImmediately();
|
|
288
344
|
}
|
|
@@ -291,7 +347,7 @@ class Tracker {
|
|
|
291
347
|
}
|
|
292
348
|
}, this.state.eventDebounce);
|
|
293
349
|
// @ts-expect-error
|
|
294
|
-
this.debouncedSendAnonymous = (0,
|
|
350
|
+
this.debouncedSendAnonymous = (0, utils_1.throttle)(async () => {
|
|
295
351
|
try {
|
|
296
352
|
return await this._sendImmediatelyAnonymous();
|
|
297
353
|
}
|
|
@@ -300,7 +356,7 @@ class Tracker {
|
|
|
300
356
|
}
|
|
301
357
|
}, this.state.eventDebounce);
|
|
302
358
|
// @ts-expect-error
|
|
303
|
-
this.debouncedSendTpaas = (0,
|
|
359
|
+
this.debouncedSendTpaas = (0, utils_1.throttle)(async () => {
|
|
304
360
|
try {
|
|
305
361
|
return await this._sendImmediatelyTpaas();
|
|
306
362
|
}
|
|
@@ -369,6 +425,11 @@ class Tracker {
|
|
|
369
425
|
return queuedEvent.then((result) => result);
|
|
370
426
|
});
|
|
371
427
|
};
|
|
428
|
+
/*
|
|
429
|
+
* Casting `input` as `Partial<Builders>` to formalise the intention of processing the event input in relation to the properties in
|
|
430
|
+
* the Builders type. It would justify changing the public api for `.track`, but as this deals with legacy code, we
|
|
431
|
+
* keep it internal, so dependencies from now on can count on objects being a Partial<Builder>
|
|
432
|
+
*/
|
|
372
433
|
return this.syncRemoteResources(input, currentBuilders).then(_track, _track);
|
|
373
434
|
}
|
|
374
435
|
/**
|
|
@@ -401,12 +462,12 @@ class Tracker {
|
|
|
401
462
|
*/
|
|
402
463
|
async trackAnonymous(eventType, input, options) {
|
|
403
464
|
// We must create the event as soon as possible, as it defines the creationDate.
|
|
404
|
-
const newEvent = this.createAnonymousEvent(input);
|
|
465
|
+
const newEvent = (0, utils_1.omit)(this.createAnonymousEvent(input), ANONYMOUS_EVENT_FORBIDDEN_FIELDS);
|
|
405
466
|
// Remote config values ----------------
|
|
406
467
|
await this._applyRemoteConfigEndpoints();
|
|
407
468
|
// Resolve all available properties ----------------
|
|
408
|
-
const resolvedOutput = await Promise.all([this.resolveTrackInput(newEvent), this.
|
|
409
|
-
let eventOutput = resolvedOutput.reduce((acc, p) => (0,
|
|
469
|
+
const resolvedOutput = await Promise.all([this.resolveTrackInput(newEvent), this.resolveAnonymousTrackGlobals()]);
|
|
470
|
+
let eventOutput = resolvedOutput.reduce((acc, p) => (0, utils_1.pulseMerge)(acc, p), {});
|
|
410
471
|
eventOutput = this.applyAnonymousEventTypeDefaults(eventOutput, eventType);
|
|
411
472
|
// Leave Events ----------------
|
|
412
473
|
// they require (most) properties of the previous PageView event, which was saved under a bookmark key when tracked
|
|
@@ -419,6 +480,7 @@ class Tracker {
|
|
|
419
480
|
eventInput: eventOutput,
|
|
420
481
|
sdkConfig: this.state,
|
|
421
482
|
});
|
|
483
|
+
eventOutput = (0, utils_1.omit)(eventOutput, ANONYMOUS_EVENT_FORBIDDEN_FIELDS);
|
|
422
484
|
if (options?.bookmarkKey) {
|
|
423
485
|
this.bookmark.set(options.bookmarkKey, eventOutput);
|
|
424
486
|
}
|
|
@@ -438,6 +500,11 @@ class Tracker {
|
|
|
438
500
|
return {
|
|
439
501
|
name: exp.name || exp.id,
|
|
440
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,
|
|
441
508
|
};
|
|
442
509
|
});
|
|
443
510
|
}
|
|
@@ -447,29 +514,52 @@ class Tracker {
|
|
|
447
514
|
* @category TPaaS Tracking
|
|
448
515
|
*/
|
|
449
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;
|
|
450
522
|
try {
|
|
451
523
|
await this._applyRemoteConfigEndpoints();
|
|
452
524
|
}
|
|
453
525
|
catch (ex) {
|
|
454
526
|
loglevel_1.default.trace('Failed to sync remote config', ex);
|
|
455
527
|
}
|
|
528
|
+
const [experiments, currentPageReferrer] = await Promise.all([
|
|
529
|
+
this.adaptExperiments(experimentsInput),
|
|
530
|
+
currentPageReferrerInput,
|
|
531
|
+
]);
|
|
456
532
|
return {
|
|
457
|
-
autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
|
|
458
533
|
version: version_1.SDK_VERSION,
|
|
459
|
-
isHybrid: !!
|
|
460
|
-
pageviewId:
|
|
461
|
-
providerId
|
|
462
|
-
|
|
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,
|
|
463
547
|
};
|
|
464
548
|
}
|
|
465
549
|
/**
|
|
466
|
-
*
|
|
467
550
|
* @private
|
|
468
551
|
* @category TPaaS Tracking
|
|
469
552
|
*/
|
|
470
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;
|
|
471
561
|
try {
|
|
472
|
-
await this.syncRemoteResources(undefined,
|
|
562
|
+
await this.syncRemoteResources(undefined, builders);
|
|
473
563
|
}
|
|
474
564
|
catch (ex) {
|
|
475
565
|
loglevel_1.default.trace('Failed to sync remote resources', ex);
|
|
@@ -485,7 +575,7 @@ class Tracker {
|
|
|
485
575
|
id: actor.id?.toString() || '',
|
|
486
576
|
realm: actor.realm || '',
|
|
487
577
|
hasAnySubscription: !!actor.hasAnySubscription,
|
|
488
|
-
region: (0,
|
|
578
|
+
region: (0, utils_1.isString)(actor.region) ? actor.region : undefined,
|
|
489
579
|
};
|
|
490
580
|
}
|
|
491
581
|
function adaptConsentsToNewFormat(consents) {
|
|
@@ -523,42 +613,40 @@ class Tracker {
|
|
|
523
613
|
source: source || 'unknown',
|
|
524
614
|
};
|
|
525
615
|
}
|
|
526
|
-
|
|
527
|
-
|
|
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),
|
|
528
620
|
this.getConsents(),
|
|
529
|
-
this.adaptExperiments(
|
|
621
|
+
this.adaptExperiments(builders.experiments),
|
|
622
|
+
this.getCurrentTpaasPage(currentPageInfoInput),
|
|
623
|
+
currentPageReferrerInput,
|
|
530
624
|
]);
|
|
531
|
-
const { environmentId, jwe } = (0,
|
|
625
|
+
const { environmentId, jwe } = (0, cis_sync_1.parsePulseCookies)();
|
|
532
626
|
return {
|
|
533
|
-
autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
|
|
534
627
|
version: version_1.SDK_VERSION,
|
|
535
|
-
isHybrid: !!
|
|
628
|
+
isHybrid: !!isHybrid,
|
|
536
629
|
user: adaptActorToNewFormat(actor),
|
|
537
630
|
consents: adaptConsentsToNewFormat(consents),
|
|
538
|
-
providerId
|
|
539
|
-
|
|
540
|
-
|
|
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,
|
|
541
645
|
experiments,
|
|
542
646
|
environmentId,
|
|
543
647
|
jwe,
|
|
544
648
|
};
|
|
545
649
|
}
|
|
546
|
-
/**
|
|
547
|
-
* Generate a generic TPaaS event with common builders output
|
|
548
|
-
* The method should be used for experiments, not for real production work.
|
|
549
|
-
* It doesn't have any real TPaaS schema associated with it.
|
|
550
|
-
* The method doesn't queue or send the event, it just returns the merged object.
|
|
551
|
-
* The method can be removed at any time in the future, so use it with caution.
|
|
552
|
-
*
|
|
553
|
-
* @param input - The input object to merge with the common builders output
|
|
554
|
-
* @returns A promise that resolves to the merged object
|
|
555
|
-
* @private
|
|
556
|
-
* @category TPaaS Tracking
|
|
557
|
-
*/
|
|
558
|
-
async generateGenericTpaasEvent(input) {
|
|
559
|
-
const dependencies = await this.prepareTpaasEvent();
|
|
560
|
-
return (0, pulse_utils_1.pulseMerge)({}, input, (0, tpaas_event_builder_1.getCommonBuildersOutput)(new Date(), dependencies));
|
|
561
|
-
}
|
|
562
650
|
/**
|
|
563
651
|
* This method extends the list of base experiments that will be automatically included in every event sent by the tracker.
|
|
564
652
|
*
|
|
@@ -580,6 +668,9 @@ class Tracker {
|
|
|
580
668
|
* @category Tracking
|
|
581
669
|
*/
|
|
582
670
|
addExperiments(experiments) {
|
|
671
|
+
if (experiments.some((experiment) => experiment.id.startsWith('sdrn:'))) {
|
|
672
|
+
loglevel_1.default.warn('Pulse - addExperiments received an experiment id starting with "sdrn:"; pass the raw experiment id instead. The SDK will generate the sdrn automatically.');
|
|
673
|
+
}
|
|
583
674
|
this.update({ experiments }, true);
|
|
584
675
|
}
|
|
585
676
|
/**
|
|
@@ -614,7 +705,7 @@ class Tracker {
|
|
|
614
705
|
const viewUIElementInputProperties = buildEventFromElement(element);
|
|
615
706
|
this.trackLegacyViewUIElement(viewUIElementInputProperties);
|
|
616
707
|
}));
|
|
617
|
-
this.legacyVisibilityObservers.get(selector)?.observe(selector);
|
|
708
|
+
this.legacyVisibilityObservers.get(selector)?.observe(selector, {});
|
|
618
709
|
}
|
|
619
710
|
/**
|
|
620
711
|
* The `addUIElementVisibilityTracking` function provides an interface for sending tracking events when specific UI elements become visible within the viewport.
|
|
@@ -646,7 +737,38 @@ class Tracker {
|
|
|
646
737
|
const eventInput = buildEventFromElement(element);
|
|
647
738
|
this.trackImpressionUIElement(eventInput);
|
|
648
739
|
}));
|
|
649
|
-
this.visibilityObservers.get(selector)?.observe(selector);
|
|
740
|
+
this.visibilityObservers.get(selector)?.observe(selector, {});
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* The `addElementVisibilityObserver` function provides an interface for executing arbitrary code when specific DOM Elements become visible within the viewport.
|
|
744
|
+
* It is built on the `VisibilityObserver` class, which efficiently detects visibility changes in DOM elements.
|
|
745
|
+
* When an element becomes at least 2/3 visible, a callback is triggered, with the Element that invoked the callback call as argument.
|
|
746
|
+
* It leverages the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) for viewport tracking
|
|
747
|
+
* and the [Mutation Observer API](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) to monitor lazy-loaded elements.
|
|
748
|
+
*
|
|
749
|
+
* Example usage:
|
|
750
|
+
*
|
|
751
|
+
* ```ts
|
|
752
|
+
* tracker.addElementVisibilityObserver('[data-pulse-entity-id]', (element) => {
|
|
753
|
+
* const eventInput = parseElementIntoEventInput(element); // user-defined function
|
|
754
|
+
* tracker.trackImpressionTeaser(eventInput); // can be anything actually, not necessarily a Teaser tracking call
|
|
755
|
+
* });
|
|
756
|
+
* ```
|
|
757
|
+
* @param selector
|
|
758
|
+
* @param callback
|
|
759
|
+
* @param options {ObserverOptions}
|
|
760
|
+
* @param options.threshold - A number between 0 and 1 indicating how much of the element should be visible to trigger
|
|
761
|
+
* the callback. Default is 0.67 (2/3 of the element).
|
|
762
|
+
*/
|
|
763
|
+
addElementVisibilityObserver(selector, callback, options = {}) {
|
|
764
|
+
if (this.visibilityObservers.has(selector)) {
|
|
765
|
+
console.warn(`Cannot add UI Element visibility tracking for selector "${selector}" as it is already being tracked.`);
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
this.visibilityObservers.set(selector, new visibility_observer_1.VisibilityObserver((element) => {
|
|
769
|
+
callback(element);
|
|
770
|
+
}));
|
|
771
|
+
this.visibilityObservers.get(selector)?.observe(selector, options);
|
|
650
772
|
}
|
|
651
773
|
/**
|
|
652
774
|
* The old trackViewArticle method from the Media Wrapper.
|
|
@@ -740,7 +862,7 @@ class Tracker {
|
|
|
740
862
|
* @category Legacy Tracking
|
|
741
863
|
*/
|
|
742
864
|
trackLegacyViewUIElement(inputProperties, trackOptions) {
|
|
743
|
-
const viewUIElementEventData = (0, event_builder_8.buildLegacyViewUIElementEvent)(inputProperties, this.
|
|
865
|
+
const viewUIElementEventData = (0, event_builder_8.buildLegacyViewUIElementEvent)(inputProperties, this.getCurrentLegacyPage());
|
|
744
866
|
return this.track('trackerEvent', viewUIElementEventData, trackOptions);
|
|
745
867
|
}
|
|
746
868
|
/**
|
|
@@ -751,7 +873,7 @@ class Tracker {
|
|
|
751
873
|
* @category Legacy Tracking
|
|
752
874
|
*/
|
|
753
875
|
trackLegacyClickUIElement(inputProperties, trackOptions) {
|
|
754
|
-
const clickUIElementEventData = (0, event_builder_1.buildClickUIElementEvent)(inputProperties, this.
|
|
876
|
+
const clickUIElementEventData = (0, event_builder_1.buildClickUIElementEvent)(inputProperties, this.getCurrentLegacyPage());
|
|
755
877
|
return this.track('trackerEvent', clickUIElementEventData, trackOptions);
|
|
756
878
|
}
|
|
757
879
|
/**
|
|
@@ -763,34 +885,37 @@ class Tracker {
|
|
|
763
885
|
*/
|
|
764
886
|
async trackAnonymousViewUIElement(input) {
|
|
765
887
|
const dependencies = await this.prepareAnonymousTpaasEvent();
|
|
766
|
-
const event = (0,
|
|
888
|
+
const event = (0, tpaas_builders_1.buildAnonymousViewUIElementEvent)(input, dependencies);
|
|
767
889
|
return this.sendTpaasEvent(event);
|
|
768
890
|
}
|
|
769
891
|
async trackCompletedHealthAction(input) {
|
|
770
892
|
const dependencies = await this.prepareTpaasEvent();
|
|
771
|
-
const event = (0,
|
|
893
|
+
const event = (0, tpaas_builders_1.buildCompletedHealthActionEvent)(input, dependencies);
|
|
772
894
|
return this.sendTpaasEvent(event);
|
|
773
895
|
}
|
|
774
896
|
async trackEngagementHealthUIElement(input) {
|
|
775
897
|
const dependencies = await this.prepareTpaasEvent();
|
|
776
|
-
const event = (0,
|
|
898
|
+
const event = (0, tpaas_builders_1.buildEngagementHealthUIElementEvent)(input, dependencies);
|
|
777
899
|
return this.sendTpaasEvent(event);
|
|
778
900
|
}
|
|
779
901
|
async trackViewHealthPage(input, options) {
|
|
780
902
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
781
|
-
this.
|
|
903
|
+
this.setCurrentTpaasPageData({
|
|
904
|
+
id: input.object.objectId,
|
|
905
|
+
type: tpaas_schemas_1.ViewHealthPage.object.objectType,
|
|
906
|
+
referrer: input.page?.referrer,
|
|
907
|
+
});
|
|
782
908
|
const dependencies = await this.prepareTpaasEvent();
|
|
783
|
-
const event = (0,
|
|
909
|
+
const event = (0, tpaas_builders_1.buildViewHealthPageEvent)(input, dependencies);
|
|
784
910
|
const result = this.sendTpaasEvent(event);
|
|
785
911
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
this.trackLeavePage({
|
|
912
|
+
const leavePageCallback = async (leave) => {
|
|
913
|
+
// HealthView Page is a bit special, in the sense that in doesn't have a dedicated Leave event.
|
|
914
|
+
// Instead, we need to reuse the generic Leave Page event, but adapt the input accordingly.
|
|
915
|
+
// 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;
|
|
918
|
+
await this.trackLeavePage({
|
|
794
919
|
leave,
|
|
795
920
|
...restInput,
|
|
796
921
|
object: {
|
|
@@ -800,10 +925,7 @@ class Tracker {
|
|
|
800
925
|
});
|
|
801
926
|
};
|
|
802
927
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
803
|
-
|
|
804
|
-
pageElement,
|
|
805
|
-
objectResizable,
|
|
806
|
-
heightBuilder,
|
|
928
|
+
...options.leaveTracking,
|
|
807
929
|
schema: tpaas_schemas_1.LeavePage.object.objectType,
|
|
808
930
|
trackMethod: leavePageCallback,
|
|
809
931
|
});
|
|
@@ -812,7 +934,7 @@ class Tracker {
|
|
|
812
934
|
}
|
|
813
935
|
async trackImpressionHealthUIElement(input) {
|
|
814
936
|
const dependencies = await this.prepareTpaasEvent();
|
|
815
|
-
const event = (0,
|
|
937
|
+
const event = (0, tpaas_builders_1.buildImpressionHealthUIElementEvent)(input, dependencies);
|
|
816
938
|
return this.sendTpaasEvent(event);
|
|
817
939
|
}
|
|
818
940
|
/**
|
|
@@ -822,23 +944,23 @@ class Tracker {
|
|
|
822
944
|
*/
|
|
823
945
|
async trackViewPage(input, options) {
|
|
824
946
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
825
|
-
this.
|
|
947
|
+
this.setCurrentTpaasPageData({
|
|
948
|
+
id: input.object.objectId,
|
|
949
|
+
type: tpaas_schemas_1.ViewPage.object.objectType,
|
|
950
|
+
referrer: input.page?.referrer,
|
|
951
|
+
});
|
|
826
952
|
const dependencies = await this.prepareTpaasEvent();
|
|
827
|
-
const event = (0,
|
|
953
|
+
const event = (0, tpaas_builders_1.buildViewPageEvent)(input, dependencies);
|
|
828
954
|
const result = this.sendTpaasEvent(event);
|
|
829
955
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
830
|
-
const
|
|
831
|
-
|
|
832
|
-
this.trackLeavePage({
|
|
956
|
+
const leavePageCallback = async (leave) => {
|
|
957
|
+
await this.trackLeavePage({
|
|
833
958
|
leave,
|
|
834
959
|
...input,
|
|
835
960
|
});
|
|
836
961
|
};
|
|
837
962
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
838
|
-
|
|
839
|
-
pageElement,
|
|
840
|
-
objectResizable,
|
|
841
|
-
heightBuilder,
|
|
963
|
+
...options.leaveTracking,
|
|
842
964
|
schema: tpaas_schemas_1.LeavePage.object.objectType,
|
|
843
965
|
trackMethod: leavePageCallback,
|
|
844
966
|
});
|
|
@@ -852,38 +974,79 @@ class Tracker {
|
|
|
852
974
|
*/
|
|
853
975
|
async trackViewSportsPage(input, options) {
|
|
854
976
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
855
|
-
this.
|
|
977
|
+
this.setCurrentTpaasPageData({
|
|
978
|
+
id: input.object.objectId,
|
|
979
|
+
type: tpaas_schemas_1.ViewSportsPage.object.objectType,
|
|
980
|
+
referrer: input.page?.referrer,
|
|
981
|
+
sports: {
|
|
982
|
+
sportName: input.object.sportName,
|
|
983
|
+
sportSubview: input.object.sportSubview,
|
|
984
|
+
sportView: input.object.sportView,
|
|
985
|
+
sports: input.object.sports,
|
|
986
|
+
},
|
|
987
|
+
});
|
|
856
988
|
const dependencies = await this.prepareTpaasEvent();
|
|
857
|
-
const event = (0,
|
|
989
|
+
const event = (0, tpaas_builders_1.buildViewSportsPageEvent)(input, dependencies);
|
|
858
990
|
const result = this.sendTpaasEvent(event);
|
|
859
991
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
this.trackLeaveSportsPage({
|
|
992
|
+
const leaveSportsPageCallback = async (leave) => {
|
|
993
|
+
await this.trackLeaveSportsPage({
|
|
863
994
|
leave,
|
|
864
995
|
...input,
|
|
865
996
|
});
|
|
866
997
|
};
|
|
867
998
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
868
|
-
|
|
869
|
-
pageElement,
|
|
870
|
-
objectResizable,
|
|
871
|
-
heightBuilder,
|
|
999
|
+
...options.leaveTracking,
|
|
872
1000
|
schema: tpaas_schemas_1.LeaveSportsPage.object.objectType,
|
|
873
1001
|
trackMethod: leaveSportsPageCallback,
|
|
874
1002
|
});
|
|
875
1003
|
}
|
|
876
1004
|
return result;
|
|
877
1005
|
}
|
|
1006
|
+
/**
|
|
1007
|
+
* @param input
|
|
1008
|
+
* @param options
|
|
1009
|
+
* @category TPaaS Tracking
|
|
1010
|
+
*/
|
|
1011
|
+
async trackViewSchoolPage(input, options) {
|
|
1012
|
+
this.newPageView();
|
|
1013
|
+
// TODO: SchoolPage is not currently part of the catalog's PageRef.pageType enum.
|
|
1014
|
+
this.setCurrentTpaasPageData({
|
|
1015
|
+
id: input.object.objectId,
|
|
1016
|
+
type: 'Page',
|
|
1017
|
+
referrer: input.page?.referrer,
|
|
1018
|
+
});
|
|
1019
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1020
|
+
const event = (0, tpaas_builders_1.buildViewSchoolPageEvent)(input, dependencies);
|
|
1021
|
+
const result = this.sendTpaasEvent(event);
|
|
1022
|
+
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1023
|
+
const leaveSchoolPageCallback = async (leave) => {
|
|
1024
|
+
await this.trackLeaveSchoolPage({
|
|
1025
|
+
leave,
|
|
1026
|
+
...input,
|
|
1027
|
+
});
|
|
1028
|
+
};
|
|
1029
|
+
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1030
|
+
...options.leaveTracking,
|
|
1031
|
+
schema: tpaas_schemas_1.LeaveSchoolPage.object.objectType,
|
|
1032
|
+
trackMethod: leaveSchoolPageCallback,
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
return result;
|
|
1036
|
+
}
|
|
878
1037
|
/**
|
|
879
1038
|
* @param input
|
|
880
1039
|
* @category TPaaS Tracking
|
|
881
1040
|
*/
|
|
882
1041
|
async trackViewTitle(input) {
|
|
883
1042
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
884
|
-
this.
|
|
1043
|
+
this.setCurrentTpaasPageData({
|
|
1044
|
+
id: input.object.objectId,
|
|
1045
|
+
type: tpaas_schemas_1.ViewTitle.object.objectType,
|
|
1046
|
+
referrer: input.page?.referrer,
|
|
1047
|
+
});
|
|
885
1048
|
const dependencies = await this.prepareTpaasEvent();
|
|
886
|
-
const event = (0,
|
|
1049
|
+
const event = (0, tpaas_builders_1.buildViewTitleEvent)(input, dependencies);
|
|
887
1050
|
return this.sendTpaasEvent(event);
|
|
888
1051
|
// there's no Leave Title event
|
|
889
1052
|
}
|
|
@@ -893,16 +1056,25 @@ class Tracker {
|
|
|
893
1056
|
*/
|
|
894
1057
|
async trackImpressionWidget(input) {
|
|
895
1058
|
const dependencies = await this.prepareTpaasEvent();
|
|
896
|
-
const event = (0,
|
|
1059
|
+
const event = (0, tpaas_builders_1.buildImpressionWidgetEvent)(input, dependencies);
|
|
897
1060
|
return this.sendTpaasEvent(event);
|
|
898
1061
|
}
|
|
899
1062
|
/**
|
|
900
1063
|
* @param input
|
|
901
1064
|
* @category TPaaS Tracking
|
|
902
1065
|
*/
|
|
903
|
-
async
|
|
1066
|
+
async trackLoadAd(input) {
|
|
1067
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1068
|
+
const event = (0, tpaas_builders_1.buildLoadAdEvent)(input, dependencies);
|
|
1069
|
+
return this.sendTpaasEvent(event);
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* @param input
|
|
1073
|
+
* @category TPaaS Tracking
|
|
1074
|
+
*/
|
|
1075
|
+
async trackRequestAd(input) {
|
|
904
1076
|
const dependencies = await this.prepareTpaasEvent();
|
|
905
|
-
const event = (0,
|
|
1077
|
+
const event = (0, tpaas_builders_1.buildRequestAdEvent)(input, dependencies);
|
|
906
1078
|
return this.sendTpaasEvent(event);
|
|
907
1079
|
}
|
|
908
1080
|
/**
|
|
@@ -912,41 +1084,30 @@ class Tracker {
|
|
|
912
1084
|
*/
|
|
913
1085
|
async trackViewArticle(input, options) {
|
|
914
1086
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
915
|
-
this.
|
|
1087
|
+
this.setCurrentTpaasPageData({
|
|
1088
|
+
id: input.object.objectId,
|
|
1089
|
+
type: tpaas_schemas_1.ViewArticle.object.objectType,
|
|
1090
|
+
referrer: input.page?.referrer,
|
|
1091
|
+
content: input.page?.content,
|
|
1092
|
+
});
|
|
916
1093
|
const dependencies = await this.prepareTpaasEvent();
|
|
917
|
-
const event = (0,
|
|
1094
|
+
const event = (0, tpaas_builders_1.buildViewArticleEvent)(input, dependencies);
|
|
918
1095
|
const result = this.sendTpaasEvent(event);
|
|
919
1096
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
920
|
-
const
|
|
921
|
-
|
|
922
|
-
this.trackLeaveArticle({
|
|
1097
|
+
const leaveArticleCallback = async (leave) => {
|
|
1098
|
+
await this.trackLeaveArticle({
|
|
923
1099
|
leave,
|
|
924
1100
|
...input,
|
|
925
1101
|
});
|
|
926
1102
|
};
|
|
927
1103
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
928
|
-
|
|
929
|
-
pageElement,
|
|
930
|
-
heightBuilder,
|
|
931
|
-
objectResizable,
|
|
1104
|
+
...options.leaveTracking,
|
|
932
1105
|
schema: tpaas_schemas_1.LeaveArticle.object.objectType,
|
|
933
1106
|
trackMethod: leaveArticleCallback,
|
|
934
1107
|
});
|
|
935
1108
|
}
|
|
936
1109
|
return result;
|
|
937
1110
|
}
|
|
938
|
-
/**
|
|
939
|
-
* @param input
|
|
940
|
-
* @param options
|
|
941
|
-
* @category TPaaS Tracking
|
|
942
|
-
*/
|
|
943
|
-
async trackViewAudio(input) {
|
|
944
|
-
// despite the View event type, this is not a page view event, but rather a media object view event
|
|
945
|
-
// so we shouldn't reset the page view ID here or enable leave tracking
|
|
946
|
-
const dependencies = await this.prepareTpaasEvent();
|
|
947
|
-
const event = (0, tpaas_event_builder_1.buildViewAudioEvent)(input, dependencies);
|
|
948
|
-
return this.sendTpaasEvent(event);
|
|
949
|
-
}
|
|
950
1111
|
/**
|
|
951
1112
|
* Tracks a View AudioPage event and automatically fires a Leave AudioPage event when the user
|
|
952
1113
|
* navigates away.
|
|
@@ -989,20 +1150,25 @@ class Tracker {
|
|
|
989
1150
|
*/
|
|
990
1151
|
async trackViewAudioPage(input, options) {
|
|
991
1152
|
this.newPageView();
|
|
992
|
-
this.
|
|
1153
|
+
this.setCurrentTpaasPageData({
|
|
1154
|
+
id: input.object.objectId,
|
|
1155
|
+
type: tpaas_schemas_1.ViewAudioPage.object.objectType,
|
|
1156
|
+
referrer: input.page?.referrer,
|
|
1157
|
+
content: input.page?.content,
|
|
1158
|
+
});
|
|
993
1159
|
const dependencies = await this.prepareTpaasEvent();
|
|
994
|
-
const event = (0,
|
|
1160
|
+
const event = (0, tpaas_builders_1.buildViewAudioPageEvent)(input, dependencies);
|
|
995
1161
|
const result = this.sendTpaasEvent(event);
|
|
996
1162
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
997
|
-
const {
|
|
998
|
-
const leaveAudioPageCallback = (leave) => {
|
|
1163
|
+
const { leaveAudioBuilder, ...restLeaveTrackingOptions } = options.leaveTracking;
|
|
1164
|
+
const leaveAudioPageCallback = async (leave) => {
|
|
999
1165
|
const leaveAudioInput = leaveAudioBuilder?.() ?? {
|
|
1000
1166
|
audioCompleted: 0,
|
|
1001
1167
|
audioStarted: 0,
|
|
1002
1168
|
maxPlaylistPosition: 0,
|
|
1003
1169
|
playlistPositionPercentage: 0,
|
|
1004
1170
|
};
|
|
1005
|
-
this.trackLeaveAudioPage({
|
|
1171
|
+
await this.trackLeaveAudioPage({
|
|
1006
1172
|
leave,
|
|
1007
1173
|
leaveAudio: {
|
|
1008
1174
|
...leaveAudioInput,
|
|
@@ -1013,10 +1179,7 @@ class Tracker {
|
|
|
1013
1179
|
});
|
|
1014
1180
|
};
|
|
1015
1181
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1016
|
-
|
|
1017
|
-
pageElement,
|
|
1018
|
-
heightBuilder,
|
|
1019
|
-
objectResizable,
|
|
1182
|
+
...restLeaveTrackingOptions,
|
|
1020
1183
|
schema: tpaas_schemas_1.LeaveAudioPage.object.objectType,
|
|
1021
1184
|
trackMethod: leaveAudioPageCallback,
|
|
1022
1185
|
});
|
|
@@ -1030,36 +1193,63 @@ class Tracker {
|
|
|
1030
1193
|
*/
|
|
1031
1194
|
async trackViewError(input, options) {
|
|
1032
1195
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1033
|
-
this.
|
|
1196
|
+
this.setCurrentTpaasPageData({
|
|
1197
|
+
id: input.object.objectId,
|
|
1198
|
+
type: tpaas_schemas_1.ViewError.object.objectType,
|
|
1199
|
+
referrer: input.page?.referrer,
|
|
1200
|
+
});
|
|
1034
1201
|
const dependencies = await this.prepareTpaasEvent();
|
|
1035
|
-
const event = (0,
|
|
1202
|
+
const event = (0, tpaas_builders_1.buildViewErrorEvent)(input, dependencies);
|
|
1036
1203
|
const result = this.sendTpaasEvent(event);
|
|
1037
1204
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1040
|
-
this.trackLeaveError({
|
|
1205
|
+
const leaveErrorCallback = async (leave) => {
|
|
1206
|
+
await this.trackLeaveError({
|
|
1041
1207
|
leave,
|
|
1042
1208
|
...input,
|
|
1043
1209
|
});
|
|
1044
1210
|
};
|
|
1045
1211
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1046
|
-
|
|
1047
|
-
pageElement,
|
|
1048
|
-
heightBuilder,
|
|
1049
|
-
objectResizable,
|
|
1212
|
+
...options.leaveTracking,
|
|
1050
1213
|
schema: tpaas_schemas_1.LeaveError.object.objectType,
|
|
1051
1214
|
trackMethod: leaveErrorCallback,
|
|
1052
1215
|
});
|
|
1053
1216
|
}
|
|
1054
1217
|
return result;
|
|
1055
1218
|
}
|
|
1219
|
+
/**
|
|
1220
|
+
* @param input
|
|
1221
|
+
* @category TPaaS Tracking
|
|
1222
|
+
*/
|
|
1223
|
+
async trackImpressionAd(input) {
|
|
1224
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1225
|
+
const event = (0, tpaas_builders_1.buildImpressionAdEvent)(input, dependencies);
|
|
1226
|
+
return this.sendTpaasEvent(event);
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* @param input
|
|
1230
|
+
* @category TPaaS Tracking
|
|
1231
|
+
*/
|
|
1232
|
+
async trackImpressionAdSlot(input) {
|
|
1233
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1234
|
+
const event = (0, tpaas_builders_1.buildImpressionAdSlotEvent)(input, dependencies);
|
|
1235
|
+
return this.sendTpaasEvent(event);
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* @param input
|
|
1239
|
+
* @category TPaaS Tracking
|
|
1240
|
+
*/
|
|
1241
|
+
async trackImpressionAffiliate(input) {
|
|
1242
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1243
|
+
const event = (0, tpaas_builders_1.buildImpressionAffiliateEvent)(input, dependencies);
|
|
1244
|
+
return this.sendTpaasEvent(event);
|
|
1245
|
+
}
|
|
1056
1246
|
/**
|
|
1057
1247
|
* @param input
|
|
1058
1248
|
* @category TPaaS Tracking
|
|
1059
1249
|
*/
|
|
1060
1250
|
async trackImpressionForm(input) {
|
|
1061
1251
|
const dependencies = await this.prepareTpaasEvent();
|
|
1062
|
-
const event = (0,
|
|
1252
|
+
const event = (0, tpaas_builders_1.buildImpressionFormEvent)(input, dependencies);
|
|
1063
1253
|
return this.sendTpaasEvent(event);
|
|
1064
1254
|
}
|
|
1065
1255
|
/**
|
|
@@ -1068,7 +1258,7 @@ class Tracker {
|
|
|
1068
1258
|
*/
|
|
1069
1259
|
async trackImpressionOffer(input) {
|
|
1070
1260
|
const dependencies = await this.prepareTpaasEvent();
|
|
1071
|
-
const event = (0,
|
|
1261
|
+
const event = (0, tpaas_builders_1.buildImpressionOfferEvent)(input, dependencies);
|
|
1072
1262
|
return this.sendTpaasEvent(event);
|
|
1073
1263
|
}
|
|
1074
1264
|
/**
|
|
@@ -1077,7 +1267,25 @@ class Tracker {
|
|
|
1077
1267
|
*/
|
|
1078
1268
|
async trackImpressionPlayer(input) {
|
|
1079
1269
|
const dependencies = await this.prepareTpaasEvent();
|
|
1080
|
-
const event = (0,
|
|
1270
|
+
const event = (0, tpaas_builders_1.buildImpressionPlayerEvent)(input, dependencies);
|
|
1271
|
+
return this.sendTpaasEvent(event);
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* @param input
|
|
1275
|
+
* @category TPaaS Tracking
|
|
1276
|
+
*/
|
|
1277
|
+
async trackImpressionSportsUIElement(input) {
|
|
1278
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1279
|
+
const event = (0, tpaas_builders_1.buildImpressionSportsUIElementEvent)(input, dependencies);
|
|
1280
|
+
return this.sendTpaasEvent(event);
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* @param input
|
|
1284
|
+
* @category TPaaS Tracking
|
|
1285
|
+
*/
|
|
1286
|
+
async trackImpressionSchoolUIElement(input) {
|
|
1287
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1288
|
+
const event = (0, tpaas_builders_1.buildImpressionSchoolUIElementEvent)(input, dependencies);
|
|
1081
1289
|
return this.sendTpaasEvent(event);
|
|
1082
1290
|
}
|
|
1083
1291
|
/**
|
|
@@ -1086,7 +1294,7 @@ class Tracker {
|
|
|
1086
1294
|
*/
|
|
1087
1295
|
async trackImpressionTeaser(input) {
|
|
1088
1296
|
const dependencies = await this.prepareTpaasEvent();
|
|
1089
|
-
const event = (0,
|
|
1297
|
+
const event = (0, tpaas_builders_1.buildImpressionTeaserEvent)(input, dependencies);
|
|
1090
1298
|
return this.sendTpaasEvent(event);
|
|
1091
1299
|
}
|
|
1092
1300
|
/**
|
|
@@ -1095,7 +1303,7 @@ class Tracker {
|
|
|
1095
1303
|
*/
|
|
1096
1304
|
async trackImpressionUIElement(input) {
|
|
1097
1305
|
const dependencies = await this.prepareTpaasEvent();
|
|
1098
|
-
const event = (0,
|
|
1306
|
+
const event = (0, tpaas_builders_1.buildImpressionUIElementEvent)(input, dependencies);
|
|
1099
1307
|
return this.sendTpaasEvent(event);
|
|
1100
1308
|
}
|
|
1101
1309
|
/**
|
|
@@ -1105,23 +1313,23 @@ class Tracker {
|
|
|
1105
1313
|
*/
|
|
1106
1314
|
async trackViewFrontpage(input, options) {
|
|
1107
1315
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1108
|
-
this.
|
|
1316
|
+
this.setCurrentTpaasPageData({
|
|
1317
|
+
id: input.object.objectId,
|
|
1318
|
+
type: tpaas_schemas_1.ViewFrontpage.object.objectType,
|
|
1319
|
+
referrer: input.page?.referrer,
|
|
1320
|
+
});
|
|
1109
1321
|
const dependencies = await this.prepareTpaasEvent();
|
|
1110
|
-
const event = (0,
|
|
1322
|
+
const event = (0, tpaas_builders_1.buildViewFrontpageEvent)(input, dependencies);
|
|
1111
1323
|
const result = this.sendTpaasEvent(event);
|
|
1112
1324
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1115
|
-
this.trackLeaveFrontpage({
|
|
1325
|
+
const leaveFrontpageCallback = async (leave) => {
|
|
1326
|
+
await this.trackLeaveFrontpage({
|
|
1116
1327
|
leave,
|
|
1117
1328
|
...input,
|
|
1118
1329
|
});
|
|
1119
1330
|
};
|
|
1120
1331
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1121
|
-
|
|
1122
|
-
pageElement,
|
|
1123
|
-
objectResizable,
|
|
1124
|
-
heightBuilder,
|
|
1332
|
+
...options.leaveTracking,
|
|
1125
1333
|
schema: tpaas_schemas_1.LeaveFrontpage.object.objectType,
|
|
1126
1334
|
trackMethod: leaveFrontpageCallback,
|
|
1127
1335
|
});
|
|
@@ -1135,23 +1343,23 @@ class Tracker {
|
|
|
1135
1343
|
*/
|
|
1136
1344
|
async trackViewLandingpage(input, options) {
|
|
1137
1345
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1138
|
-
this.
|
|
1346
|
+
this.setCurrentTpaasPageData({
|
|
1347
|
+
id: input.object.objectId,
|
|
1348
|
+
type: tpaas_schemas_1.ViewLandingpage.object.objectType,
|
|
1349
|
+
referrer: input.page?.referrer,
|
|
1350
|
+
});
|
|
1139
1351
|
const dependencies = await this.prepareTpaasEvent();
|
|
1140
|
-
const event = (0,
|
|
1352
|
+
const event = (0, tpaas_builders_1.buildViewLandingpageEvent)(input, dependencies);
|
|
1141
1353
|
const result = this.sendTpaasEvent(event);
|
|
1142
1354
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1143
|
-
const
|
|
1144
|
-
|
|
1145
|
-
this.trackLeaveLandingpage({
|
|
1355
|
+
const leaveLandingpageCallback = async (leave) => {
|
|
1356
|
+
await this.trackLeaveLandingpage({
|
|
1146
1357
|
leave,
|
|
1147
1358
|
...input,
|
|
1148
1359
|
});
|
|
1149
1360
|
};
|
|
1150
1361
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1151
|
-
|
|
1152
|
-
pageElement,
|
|
1153
|
-
heightBuilder,
|
|
1154
|
-
objectResizable,
|
|
1362
|
+
...options.leaveTracking,
|
|
1155
1363
|
schema: tpaas_schemas_1.LeaveLandingpage.object.objectType,
|
|
1156
1364
|
trackMethod: leaveLandingpageCallback,
|
|
1157
1365
|
});
|
|
@@ -1165,23 +1373,23 @@ class Tracker {
|
|
|
1165
1373
|
*/
|
|
1166
1374
|
async trackViewListing(input, options) {
|
|
1167
1375
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1168
|
-
this.
|
|
1376
|
+
this.setCurrentTpaasPageData({
|
|
1377
|
+
id: input.object.objectId,
|
|
1378
|
+
type: tpaas_schemas_1.ViewListing.object.objectType,
|
|
1379
|
+
referrer: input.page?.referrer,
|
|
1380
|
+
});
|
|
1169
1381
|
const dependencies = await this.prepareTpaasEvent();
|
|
1170
|
-
const event = (0,
|
|
1382
|
+
const event = (0, tpaas_builders_1.buildViewListingEvent)(input, dependencies);
|
|
1171
1383
|
const result = this.sendTpaasEvent(event);
|
|
1172
1384
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
this.trackLeaveListing({
|
|
1385
|
+
const leaveListingCallback = async (leave) => {
|
|
1386
|
+
await this.trackLeaveListing({
|
|
1176
1387
|
leave,
|
|
1177
1388
|
...input,
|
|
1178
1389
|
});
|
|
1179
1390
|
};
|
|
1180
1391
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1181
|
-
|
|
1182
|
-
pageElement,
|
|
1183
|
-
heightBuilder,
|
|
1184
|
-
objectResizable,
|
|
1392
|
+
...options.leaveTracking,
|
|
1185
1393
|
schema: tpaas_schemas_1.LeaveListing.object.objectType,
|
|
1186
1394
|
trackMethod: leaveListingCallback,
|
|
1187
1395
|
});
|
|
@@ -1195,41 +1403,30 @@ class Tracker {
|
|
|
1195
1403
|
*/
|
|
1196
1404
|
async trackViewLockedArticle(input, options) {
|
|
1197
1405
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1198
|
-
this.
|
|
1406
|
+
this.setCurrentTpaasPageData({
|
|
1407
|
+
id: input.object.objectId,
|
|
1408
|
+
type: tpaas_schemas_1.ViewLockedArticle.object.objectType,
|
|
1409
|
+
referrer: input.page?.referrer,
|
|
1410
|
+
content: input.page?.content,
|
|
1411
|
+
});
|
|
1199
1412
|
const dependencies = await this.prepareTpaasEvent();
|
|
1200
|
-
const event = (0,
|
|
1413
|
+
const event = (0, tpaas_builders_1.buildViewLockedArticleEvent)(input, dependencies);
|
|
1201
1414
|
const result = this.sendTpaasEvent(event);
|
|
1202
1415
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1203
|
-
const
|
|
1204
|
-
|
|
1205
|
-
this.trackLeaveLockedArticle({
|
|
1416
|
+
const leaveLockedArticleCallback = async (leave) => {
|
|
1417
|
+
await this.trackLeaveLockedArticle({
|
|
1206
1418
|
leave,
|
|
1207
1419
|
...input,
|
|
1208
1420
|
});
|
|
1209
1421
|
};
|
|
1210
1422
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1211
|
-
|
|
1212
|
-
pageElement,
|
|
1213
|
-
objectResizable,
|
|
1214
|
-
heightBuilder,
|
|
1423
|
+
...options.leaveTracking,
|
|
1215
1424
|
schema: tpaas_schemas_1.LeaveLockedArticle.object.objectType,
|
|
1216
1425
|
trackMethod: leaveLockedArticleCallback,
|
|
1217
1426
|
});
|
|
1218
1427
|
}
|
|
1219
1428
|
return result;
|
|
1220
1429
|
}
|
|
1221
|
-
/**
|
|
1222
|
-
* @param input
|
|
1223
|
-
* @param options
|
|
1224
|
-
* @category TPaaS Tracking
|
|
1225
|
-
*/
|
|
1226
|
-
async trackViewLockedAudio(input) {
|
|
1227
|
-
// despite the View event type, this is not a page view event, but rather a media object view event
|
|
1228
|
-
// so we shouldn't reset the page view ID here or enable leave tracking
|
|
1229
|
-
const dependencies = await this.prepareTpaasEvent();
|
|
1230
|
-
const event = (0, tpaas_event_builder_1.buildViewLockedAudioEvent)(input, dependencies);
|
|
1231
|
-
return this.sendTpaasEvent(event);
|
|
1232
|
-
}
|
|
1233
1430
|
/**
|
|
1234
1431
|
* @param input
|
|
1235
1432
|
* @param options
|
|
@@ -1237,23 +1434,24 @@ class Tracker {
|
|
|
1237
1434
|
*/
|
|
1238
1435
|
async trackViewLockedAudioPage(input, options) {
|
|
1239
1436
|
this.newPageView();
|
|
1240
|
-
this.
|
|
1437
|
+
this.setCurrentTpaasPageData({
|
|
1438
|
+
id: input.object.objectId,
|
|
1439
|
+
type: tpaas_schemas_1.ViewLockedAudioPage.object.objectType,
|
|
1440
|
+
referrer: input.page?.referrer,
|
|
1441
|
+
content: input.page?.content,
|
|
1442
|
+
});
|
|
1241
1443
|
const dependencies = await this.prepareTpaasEvent();
|
|
1242
|
-
const event = (0,
|
|
1444
|
+
const event = (0, tpaas_builders_1.buildViewLockedAudioPageEvent)(input, dependencies);
|
|
1243
1445
|
const result = this.sendTpaasEvent(event);
|
|
1244
1446
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1245
|
-
const
|
|
1246
|
-
|
|
1247
|
-
this.trackLeaveLockedAudioPage({
|
|
1447
|
+
const leaveLockedAudioPageCallback = async (leave) => {
|
|
1448
|
+
await this.trackLeaveLockedAudioPage({
|
|
1248
1449
|
leave,
|
|
1249
1450
|
...input,
|
|
1250
1451
|
});
|
|
1251
1452
|
};
|
|
1252
1453
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1253
|
-
|
|
1254
|
-
pageElement,
|
|
1255
|
-
heightBuilder,
|
|
1256
|
-
objectResizable,
|
|
1454
|
+
...options.leaveTracking,
|
|
1257
1455
|
schema: tpaas_schemas_1.LeaveLockedAudioPage.object.objectType,
|
|
1258
1456
|
trackMethod: leaveLockedAudioPageCallback,
|
|
1259
1457
|
});
|
|
@@ -1262,14 +1460,33 @@ class Tracker {
|
|
|
1262
1460
|
}
|
|
1263
1461
|
/**
|
|
1264
1462
|
* @param input
|
|
1463
|
+
* @param options
|
|
1265
1464
|
* @category TPaaS Tracking
|
|
1266
1465
|
*/
|
|
1267
|
-
async
|
|
1268
|
-
|
|
1269
|
-
|
|
1466
|
+
async trackViewLockedPage(input, options) {
|
|
1467
|
+
this.newPageView();
|
|
1468
|
+
this.setCurrentTpaasPageData({
|
|
1469
|
+
id: input.object.objectId,
|
|
1470
|
+
type: tpaas_schemas_1.ViewLockedPage.object.objectType,
|
|
1471
|
+
referrer: input.page?.referrer,
|
|
1472
|
+
});
|
|
1270
1473
|
const dependencies = await this.prepareTpaasEvent();
|
|
1271
|
-
const event = (0,
|
|
1272
|
-
|
|
1474
|
+
const event = (0, tpaas_builders_1.buildViewLockedPageEvent)(input, dependencies);
|
|
1475
|
+
const result = this.sendTpaasEvent(event);
|
|
1476
|
+
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1477
|
+
const leaveLockedPageCallback = async (leave) => {
|
|
1478
|
+
await this.trackLeaveLockedPage({
|
|
1479
|
+
leave,
|
|
1480
|
+
...input,
|
|
1481
|
+
});
|
|
1482
|
+
};
|
|
1483
|
+
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1484
|
+
...options.leaveTracking,
|
|
1485
|
+
schema: tpaas_schemas_1.LeaveLockedPage.object.objectType,
|
|
1486
|
+
trackMethod: leaveLockedPageCallback,
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
return result;
|
|
1273
1490
|
}
|
|
1274
1491
|
/**
|
|
1275
1492
|
* @param input
|
|
@@ -1278,40 +1495,30 @@ class Tracker {
|
|
|
1278
1495
|
*/
|
|
1279
1496
|
async trackViewLockedVideoPage(input, options) {
|
|
1280
1497
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1281
|
-
this.
|
|
1498
|
+
this.setCurrentTpaasPageData({
|
|
1499
|
+
id: input.object.objectId,
|
|
1500
|
+
type: tpaas_schemas_1.ViewLockedVideoPage.object.objectType,
|
|
1501
|
+
referrer: input.page?.referrer,
|
|
1502
|
+
content: input.page?.content,
|
|
1503
|
+
});
|
|
1282
1504
|
const dependencies = await this.prepareTpaasEvent();
|
|
1283
|
-
const event = (0,
|
|
1505
|
+
const event = (0, tpaas_builders_1.buildViewLockedVideoPageEvent)(input, dependencies);
|
|
1284
1506
|
const result = this.sendTpaasEvent(event);
|
|
1285
1507
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1288
|
-
this.trackLeaveLockedVideoPage({
|
|
1508
|
+
const leaveLockedVideoPageCallback = async (leave) => {
|
|
1509
|
+
await this.trackLeaveLockedVideoPage({
|
|
1289
1510
|
leave,
|
|
1290
1511
|
...input,
|
|
1291
1512
|
});
|
|
1292
1513
|
};
|
|
1293
1514
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1294
|
-
|
|
1295
|
-
pageElement,
|
|
1296
|
-
heightBuilder,
|
|
1297
|
-
objectResizable,
|
|
1515
|
+
...options.leaveTracking,
|
|
1298
1516
|
schema: tpaas_schemas_1.LeaveLockedVideoPage.object.objectType,
|
|
1299
1517
|
trackMethod: leaveLockedVideoPageCallback,
|
|
1300
1518
|
});
|
|
1301
1519
|
}
|
|
1302
1520
|
return result;
|
|
1303
1521
|
}
|
|
1304
|
-
/**
|
|
1305
|
-
* @param input
|
|
1306
|
-
* @category TPaaS Tracking
|
|
1307
|
-
*/
|
|
1308
|
-
async trackViewVideo(input) {
|
|
1309
|
-
// despite the View event type, this is not a page view event, but rather a media object view event
|
|
1310
|
-
// so we shouldn't reset the page view ID here or enable leave tracking
|
|
1311
|
-
const dependencies = await this.prepareTpaasEvent();
|
|
1312
|
-
const event = (0, tpaas_event_builder_1.buildViewVideoEvent)(input, dependencies);
|
|
1313
|
-
return this.sendTpaasEvent(event);
|
|
1314
|
-
}
|
|
1315
1522
|
/**
|
|
1316
1523
|
* Tracks a View VideoPage event and automatically fires a Leave VideoPage event when the user
|
|
1317
1524
|
* navigates away.
|
|
@@ -1356,29 +1563,27 @@ class Tracker {
|
|
|
1356
1563
|
*/
|
|
1357
1564
|
async trackViewVideoPage(input, options) {
|
|
1358
1565
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1359
|
-
this.
|
|
1566
|
+
this.setCurrentTpaasPageData({
|
|
1567
|
+
id: input.object.objectId,
|
|
1568
|
+
type: tpaas_schemas_1.ViewVideoPage.object.objectType,
|
|
1569
|
+
referrer: input.page?.referrer,
|
|
1570
|
+
content: input.page?.content,
|
|
1571
|
+
});
|
|
1360
1572
|
const dependencies = await this.prepareTpaasEvent();
|
|
1361
|
-
const event = (0,
|
|
1573
|
+
const event = (0, tpaas_builders_1.buildViewVideoPageEvent)(input, dependencies);
|
|
1362
1574
|
const result = this.sendTpaasEvent(event);
|
|
1363
1575
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1364
|
-
const {
|
|
1365
|
-
const leaveVideoCallback = (leave) => {
|
|
1576
|
+
const { leaveStoriesBuilder, ...restLeaveTrackingOptions } = options.leaveTracking;
|
|
1577
|
+
const leaveVideoCallback = async (leave) => {
|
|
1366
1578
|
const leaveStoriesInput = leaveStoriesBuilder?.();
|
|
1367
|
-
this.trackLeaveVideoPage({
|
|
1579
|
+
await this.trackLeaveVideoPage({
|
|
1368
1580
|
leave,
|
|
1369
|
-
leaveStories: leaveStoriesInput
|
|
1370
|
-
...leaveStoriesInput,
|
|
1371
|
-
activityDurationMs: leave.activityDurationMs,
|
|
1372
|
-
durationMs: leave.durationMs,
|
|
1373
|
-
},
|
|
1581
|
+
leaveStories: leaveStoriesInput,
|
|
1374
1582
|
...input,
|
|
1375
1583
|
});
|
|
1376
1584
|
};
|
|
1377
1585
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1378
|
-
|
|
1379
|
-
pageElement,
|
|
1380
|
-
heightBuilder,
|
|
1381
|
-
objectResizable,
|
|
1586
|
+
...restLeaveTrackingOptions,
|
|
1382
1587
|
schema: tpaas_schemas_1.LeaveVideoPage.object.objectType,
|
|
1383
1588
|
trackMethod: leaveVideoCallback,
|
|
1384
1589
|
});
|
|
@@ -1392,23 +1597,23 @@ class Tracker {
|
|
|
1392
1597
|
*/
|
|
1393
1598
|
async trackViewWeather(input, options) {
|
|
1394
1599
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1395
|
-
this.
|
|
1600
|
+
this.setCurrentTpaasPageData({
|
|
1601
|
+
id: input.object.objectId,
|
|
1602
|
+
type: tpaas_schemas_1.ViewWeather.object.objectType,
|
|
1603
|
+
referrer: input.page?.referrer,
|
|
1604
|
+
});
|
|
1396
1605
|
const dependencies = await this.prepareTpaasEvent();
|
|
1397
|
-
const event = (0,
|
|
1606
|
+
const event = (0, tpaas_builders_1.buildViewWeatherEvent)(input, dependencies);
|
|
1398
1607
|
const result = this.sendTpaasEvent(event);
|
|
1399
1608
|
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1400
|
-
const
|
|
1401
|
-
|
|
1402
|
-
this.trackLeaveWeather({
|
|
1609
|
+
const leaveWeatherCallback = async (leave) => {
|
|
1610
|
+
await this.trackLeaveWeather({
|
|
1403
1611
|
leave,
|
|
1404
1612
|
...input,
|
|
1405
1613
|
});
|
|
1406
1614
|
};
|
|
1407
1615
|
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1408
|
-
|
|
1409
|
-
pageElement,
|
|
1410
|
-
heightBuilder,
|
|
1411
|
-
objectResizable,
|
|
1616
|
+
...options.leaveTracking,
|
|
1412
1617
|
schema: tpaas_schemas_1.LeaveWeather.object.objectType,
|
|
1413
1618
|
trackMethod: leaveWeatherCallback,
|
|
1414
1619
|
});
|
|
@@ -1421,7 +1626,7 @@ class Tracker {
|
|
|
1421
1626
|
*/
|
|
1422
1627
|
async trackLeaveArticle(input) {
|
|
1423
1628
|
const dependencies = await this.prepareTpaasEvent();
|
|
1424
|
-
const event = (0,
|
|
1629
|
+
const event = (0, tpaas_builders_1.buildLeaveArticleEvent)(input, dependencies);
|
|
1425
1630
|
return this.sendTpaasEvent(event);
|
|
1426
1631
|
}
|
|
1427
1632
|
/**
|
|
@@ -1430,7 +1635,7 @@ class Tracker {
|
|
|
1430
1635
|
*/
|
|
1431
1636
|
async trackLeaveAudioPage(input) {
|
|
1432
1637
|
const dependencies = await this.prepareTpaasEvent();
|
|
1433
|
-
const event = (0,
|
|
1638
|
+
const event = (0, tpaas_builders_1.buildLeaveAudioPageEvent)(input, dependencies);
|
|
1434
1639
|
return this.sendTpaasEvent(event);
|
|
1435
1640
|
}
|
|
1436
1641
|
/**
|
|
@@ -1439,7 +1644,7 @@ class Tracker {
|
|
|
1439
1644
|
*/
|
|
1440
1645
|
async trackLeaveError(input) {
|
|
1441
1646
|
const dependencies = await this.prepareTpaasEvent();
|
|
1442
|
-
const event = (0,
|
|
1647
|
+
const event = (0, tpaas_builders_1.buildLeaveErrorEvent)(input, dependencies);
|
|
1443
1648
|
return this.sendTpaasEvent(event);
|
|
1444
1649
|
}
|
|
1445
1650
|
/**
|
|
@@ -1448,7 +1653,7 @@ class Tracker {
|
|
|
1448
1653
|
*/
|
|
1449
1654
|
async trackLeaveFrontpage(input) {
|
|
1450
1655
|
const dependencies = await this.prepareTpaasEvent();
|
|
1451
|
-
const event = (0,
|
|
1656
|
+
const event = (0, tpaas_builders_1.buildLeaveFrontpageEvent)(input, dependencies);
|
|
1452
1657
|
return this.sendTpaasEvent(event);
|
|
1453
1658
|
}
|
|
1454
1659
|
/**
|
|
@@ -1457,7 +1662,7 @@ class Tracker {
|
|
|
1457
1662
|
*/
|
|
1458
1663
|
async trackLeaveLandingpage(input) {
|
|
1459
1664
|
const dependencies = await this.prepareTpaasEvent();
|
|
1460
|
-
const event = (0,
|
|
1665
|
+
const event = (0, tpaas_builders_1.buildLeaveLandingpageEvent)(input, dependencies);
|
|
1461
1666
|
return this.sendTpaasEvent(event);
|
|
1462
1667
|
}
|
|
1463
1668
|
/**
|
|
@@ -1466,7 +1671,7 @@ class Tracker {
|
|
|
1466
1671
|
*/
|
|
1467
1672
|
async trackLeaveListing(input) {
|
|
1468
1673
|
const dependencies = await this.prepareTpaasEvent();
|
|
1469
|
-
const event = (0,
|
|
1674
|
+
const event = (0, tpaas_builders_1.buildLeaveListingEvent)(input, dependencies);
|
|
1470
1675
|
return this.sendTpaasEvent(event);
|
|
1471
1676
|
}
|
|
1472
1677
|
/**
|
|
@@ -1475,61 +1680,61 @@ class Tracker {
|
|
|
1475
1680
|
*/
|
|
1476
1681
|
async trackLeaveLockedArticle(input) {
|
|
1477
1682
|
const dependencies = await this.prepareTpaasEvent();
|
|
1478
|
-
const event = (0,
|
|
1683
|
+
const event = (0, tpaas_builders_1.buildLeaveLockedArticleEvent)(input, dependencies);
|
|
1479
1684
|
return this.sendTpaasEvent(event);
|
|
1480
1685
|
}
|
|
1481
1686
|
/**
|
|
1482
1687
|
* @param input
|
|
1483
1688
|
* @category TPaaS Tracking
|
|
1484
1689
|
*/
|
|
1485
|
-
async
|
|
1690
|
+
async trackLeaveLockedAudioPage(input) {
|
|
1486
1691
|
const dependencies = await this.prepareTpaasEvent();
|
|
1487
|
-
const event = (0,
|
|
1692
|
+
const event = (0, tpaas_builders_1.buildLeaveLockedAudioPageEvent)(input, dependencies);
|
|
1488
1693
|
return this.sendTpaasEvent(event);
|
|
1489
1694
|
}
|
|
1490
1695
|
/**
|
|
1491
1696
|
* @param input
|
|
1492
1697
|
* @category TPaaS Tracking
|
|
1493
1698
|
*/
|
|
1494
|
-
async
|
|
1699
|
+
async trackLeaveLockedPage(input) {
|
|
1495
1700
|
const dependencies = await this.prepareTpaasEvent();
|
|
1496
|
-
const event = (0,
|
|
1701
|
+
const event = (0, tpaas_builders_1.buildLeaveLockedPageEvent)(input, dependencies);
|
|
1497
1702
|
return this.sendTpaasEvent(event);
|
|
1498
1703
|
}
|
|
1499
1704
|
/**
|
|
1500
1705
|
* @param input
|
|
1501
1706
|
* @category TPaaS Tracking
|
|
1502
1707
|
*/
|
|
1503
|
-
async
|
|
1708
|
+
async trackLeaveLockedVideoPage(input) {
|
|
1504
1709
|
const dependencies = await this.prepareTpaasEvent();
|
|
1505
|
-
const event = (0,
|
|
1710
|
+
const event = (0, tpaas_builders_1.buildLeaveLockedVideoPageEvent)(input, dependencies);
|
|
1506
1711
|
return this.sendTpaasEvent(event);
|
|
1507
1712
|
}
|
|
1508
1713
|
/**
|
|
1509
1714
|
* @param input
|
|
1510
1715
|
* @category TPaaS Tracking
|
|
1511
1716
|
*/
|
|
1512
|
-
async
|
|
1717
|
+
async trackLeavePage(input) {
|
|
1513
1718
|
const dependencies = await this.prepareTpaasEvent();
|
|
1514
|
-
const event = (0,
|
|
1719
|
+
const event = (0, tpaas_builders_1.buildLeavePageEvent)(input, dependencies);
|
|
1515
1720
|
return this.sendTpaasEvent(event);
|
|
1516
1721
|
}
|
|
1517
1722
|
/**
|
|
1518
1723
|
* @param input
|
|
1519
1724
|
* @category TPaaS Tracking
|
|
1520
1725
|
*/
|
|
1521
|
-
async
|
|
1726
|
+
async trackLeaveSportsPage(input) {
|
|
1522
1727
|
const dependencies = await this.prepareTpaasEvent();
|
|
1523
|
-
const event = (0,
|
|
1728
|
+
const event = (0, tpaas_builders_1.buildLeaveSportsPageEvent)(input, dependencies);
|
|
1524
1729
|
return this.sendTpaasEvent(event);
|
|
1525
1730
|
}
|
|
1526
1731
|
/**
|
|
1527
1732
|
* @param input
|
|
1528
1733
|
* @category TPaaS Tracking
|
|
1529
1734
|
*/
|
|
1530
|
-
async
|
|
1735
|
+
async trackLeaveSchoolPage(input) {
|
|
1531
1736
|
const dependencies = await this.prepareTpaasEvent();
|
|
1532
|
-
const event = (0,
|
|
1737
|
+
const event = (0, tpaas_builders_1.buildLeaveSchoolPageEvent)(input, dependencies);
|
|
1533
1738
|
return this.sendTpaasEvent(event);
|
|
1534
1739
|
}
|
|
1535
1740
|
/**
|
|
@@ -1538,7 +1743,7 @@ class Tracker {
|
|
|
1538
1743
|
*/
|
|
1539
1744
|
async trackLeaveVideoPage(input) {
|
|
1540
1745
|
const dependencies = await this.prepareTpaasEvent();
|
|
1541
|
-
const event = (0,
|
|
1746
|
+
const event = (0, tpaas_builders_1.buildLeaveVideoPageEvent)(input, dependencies);
|
|
1542
1747
|
return this.sendTpaasEvent(event);
|
|
1543
1748
|
}
|
|
1544
1749
|
/**
|
|
@@ -1547,7 +1752,25 @@ class Tracker {
|
|
|
1547
1752
|
*/
|
|
1548
1753
|
async trackLeaveWeather(input) {
|
|
1549
1754
|
const dependencies = await this.prepareTpaasEvent();
|
|
1550
|
-
const event = (0,
|
|
1755
|
+
const event = (0, tpaas_builders_1.buildLeaveWeatherEvent)(input, dependencies);
|
|
1756
|
+
return this.sendTpaasEvent(event);
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* @param input
|
|
1760
|
+
* @category TPaaS Tracking
|
|
1761
|
+
*/
|
|
1762
|
+
async trackEngagementAd(input) {
|
|
1763
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1764
|
+
const event = (0, tpaas_builders_1.buildEngagementAdEvent)(input, dependencies);
|
|
1765
|
+
return this.sendTpaasEvent(event);
|
|
1766
|
+
}
|
|
1767
|
+
/**
|
|
1768
|
+
* @param input
|
|
1769
|
+
* @category TPaaS Tracking
|
|
1770
|
+
*/
|
|
1771
|
+
async trackEngagementAffiliate(input) {
|
|
1772
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1773
|
+
const event = (0, tpaas_builders_1.buildEngagementAffiliateEvent)(input, dependencies);
|
|
1551
1774
|
return this.sendTpaasEvent(event);
|
|
1552
1775
|
}
|
|
1553
1776
|
/**
|
|
@@ -1556,7 +1779,7 @@ class Tracker {
|
|
|
1556
1779
|
*/
|
|
1557
1780
|
async trackEngagementAudio(input) {
|
|
1558
1781
|
const dependencies = await this.prepareTpaasEvent();
|
|
1559
|
-
const event = (0,
|
|
1782
|
+
const event = (0, tpaas_builders_1.buildEngagementAudioEvent)(input, dependencies);
|
|
1560
1783
|
return this.sendTpaasEvent(event);
|
|
1561
1784
|
}
|
|
1562
1785
|
/**
|
|
@@ -1565,7 +1788,7 @@ class Tracker {
|
|
|
1565
1788
|
*/
|
|
1566
1789
|
async trackEngagementForm(input) {
|
|
1567
1790
|
const dependencies = await this.prepareTpaasEvent();
|
|
1568
|
-
const event = (0,
|
|
1791
|
+
const event = (0, tpaas_builders_1.buildEngagementFormEvent)(input, dependencies);
|
|
1569
1792
|
return this.sendTpaasEvent(event);
|
|
1570
1793
|
}
|
|
1571
1794
|
/**
|
|
@@ -1574,7 +1797,25 @@ class Tracker {
|
|
|
1574
1797
|
*/
|
|
1575
1798
|
async trackEngagementOffer(input) {
|
|
1576
1799
|
const dependencies = await this.prepareTpaasEvent();
|
|
1577
|
-
const event = (0,
|
|
1800
|
+
const event = (0, tpaas_builders_1.buildEngagementOfferEvent)(input, dependencies);
|
|
1801
|
+
return this.sendTpaasEvent(event);
|
|
1802
|
+
}
|
|
1803
|
+
/**
|
|
1804
|
+
* @param input
|
|
1805
|
+
* @category TPaaS Tracking
|
|
1806
|
+
*/
|
|
1807
|
+
async trackEngagementSportsUIElement(input) {
|
|
1808
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1809
|
+
const event = (0, tpaas_builders_1.buildEngagementSportsUIElementEvent)(input, dependencies);
|
|
1810
|
+
return this.sendTpaasEvent(event);
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* @param input
|
|
1814
|
+
* @category TPaaS Tracking
|
|
1815
|
+
*/
|
|
1816
|
+
async trackEngagementSchoolUIElement(input) {
|
|
1817
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1818
|
+
const event = (0, tpaas_builders_1.buildEngagementSchoolUIElementEvent)(input, dependencies);
|
|
1578
1819
|
return this.sendTpaasEvent(event);
|
|
1579
1820
|
}
|
|
1580
1821
|
/**
|
|
@@ -1583,7 +1824,25 @@ class Tracker {
|
|
|
1583
1824
|
*/
|
|
1584
1825
|
async trackEngagementTeaser(input) {
|
|
1585
1826
|
const dependencies = await this.prepareTpaasEvent();
|
|
1586
|
-
const event = (0,
|
|
1827
|
+
const event = (0, tpaas_builders_1.buildEngagementTeaserEvent)(input, dependencies);
|
|
1828
|
+
return this.sendTpaasEvent(event);
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* @param input
|
|
1832
|
+
* @category TPaaS Tracking
|
|
1833
|
+
*/
|
|
1834
|
+
async trackEngagementTvModule(input) {
|
|
1835
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1836
|
+
const event = (0, tpaas_builders_1.buildEngagementTvModuleEvent)(input, dependencies);
|
|
1837
|
+
return this.sendTpaasEvent(event);
|
|
1838
|
+
}
|
|
1839
|
+
/**
|
|
1840
|
+
* @param input
|
|
1841
|
+
* @category TPaaS Tracking
|
|
1842
|
+
*/
|
|
1843
|
+
async trackEngagementTvSearch(input) {
|
|
1844
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1845
|
+
const event = (0, tpaas_builders_1.buildEngagementTvSearchEvent)(input, dependencies);
|
|
1587
1846
|
return this.sendTpaasEvent(event);
|
|
1588
1847
|
}
|
|
1589
1848
|
/**
|
|
@@ -1592,7 +1851,7 @@ class Tracker {
|
|
|
1592
1851
|
*/
|
|
1593
1852
|
async trackEngagementUIElement(input) {
|
|
1594
1853
|
const dependencies = await this.prepareTpaasEvent();
|
|
1595
|
-
const event = (0,
|
|
1854
|
+
const event = (0, tpaas_builders_1.buildEngagementUIElementEvent)(input, dependencies);
|
|
1596
1855
|
return this.sendTpaasEvent(event);
|
|
1597
1856
|
}
|
|
1598
1857
|
/**
|
|
@@ -1601,7 +1860,7 @@ class Tracker {
|
|
|
1601
1860
|
*/
|
|
1602
1861
|
async trackEngagementVideo(input) {
|
|
1603
1862
|
const dependencies = await this.prepareTpaasEvent();
|
|
1604
|
-
const event = (0,
|
|
1863
|
+
const event = (0, tpaas_builders_1.buildEngagementVideoEvent)(input, dependencies);
|
|
1605
1864
|
return this.sendTpaasEvent(event);
|
|
1606
1865
|
}
|
|
1607
1866
|
/**
|
|
@@ -1610,7 +1869,7 @@ class Tracker {
|
|
|
1610
1869
|
*/
|
|
1611
1870
|
async trackEngagementVideoAd(input) {
|
|
1612
1871
|
const dependencies = await this.prepareTpaasEvent();
|
|
1613
|
-
const event = (0,
|
|
1872
|
+
const event = (0, tpaas_builders_1.buildEngagementVideoAdEvent)(input, dependencies);
|
|
1614
1873
|
return this.sendTpaasEvent(event);
|
|
1615
1874
|
}
|
|
1616
1875
|
/**
|
|
@@ -1619,7 +1878,16 @@ class Tracker {
|
|
|
1619
1878
|
*/
|
|
1620
1879
|
async trackEngagementWidget(input) {
|
|
1621
1880
|
const dependencies = await this.prepareTpaasEvent();
|
|
1622
|
-
const event = (0,
|
|
1881
|
+
const event = (0, tpaas_builders_1.buildEngagementWidgetEvent)(input, dependencies);
|
|
1882
|
+
return this.sendTpaasEvent(event);
|
|
1883
|
+
}
|
|
1884
|
+
/**
|
|
1885
|
+
* @param input
|
|
1886
|
+
* @category TPaaS Tracking
|
|
1887
|
+
*/
|
|
1888
|
+
async trackHeartbeatCommercialArticle(input) {
|
|
1889
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1890
|
+
const event = (0, tpaas_builders_1.buildHeartbeatCommercialArticleEvent)(input, dependencies);
|
|
1623
1891
|
return this.sendTpaasEvent(event);
|
|
1624
1892
|
}
|
|
1625
1893
|
/**
|
|
@@ -1633,7 +1901,7 @@ class Tracker {
|
|
|
1633
1901
|
this.resolveSessionIdPromise();
|
|
1634
1902
|
// The Hybrid use case implements a "bridged" event method, injected into the window scope,
|
|
1635
1903
|
// which is used to send events through the native app.
|
|
1636
|
-
if ((0,
|
|
1904
|
+
if ((0, utils_1.isFunction)(this.state.altEventHandler)) {
|
|
1637
1905
|
this.state.altEventHandler(JSON.stringify(event));
|
|
1638
1906
|
return event;
|
|
1639
1907
|
}
|
|
@@ -1716,7 +1984,7 @@ class Tracker {
|
|
|
1716
1984
|
eventInput: evaluatedInput,
|
|
1717
1985
|
sdkConfig: this.state,
|
|
1718
1986
|
});
|
|
1719
|
-
return (0,
|
|
1987
|
+
return (0, utils_1.evaluateAndFlatten)(data);
|
|
1720
1988
|
});
|
|
1721
1989
|
}
|
|
1722
1990
|
/**
|
|
@@ -1728,8 +1996,8 @@ class Tracker {
|
|
|
1728
1996
|
* @category Legacy Tracking
|
|
1729
1997
|
*/
|
|
1730
1998
|
async evaluateEventInputs(eventType, eventInput, builders = this.builders, options) {
|
|
1731
|
-
const buildersOutput = await Promise.all([(0,
|
|
1732
|
-
let eventOutput = buildersOutput.reduce((acc, p) => (0,
|
|
1999
|
+
const buildersOutput = await Promise.all([(0, utils_1.evaluateAndFlatten)(builders), (0, utils_1.evaluateAndFlatten)(eventInput)]);
|
|
2000
|
+
let eventOutput = buildersOutput.reduce((acc, p) => (0, utils_1.pulseMerge)(acc, p), {});
|
|
1733
2001
|
eventOutput = this.applyEventTypeDefaults(eventOutput, eventType);
|
|
1734
2002
|
eventOutput = this.applyBookmarkedEvent(eventOutput, options?.applyBookmarkKey);
|
|
1735
2003
|
eventOutput = await this.applyConsents(eventOutput);
|
|
@@ -1797,7 +2065,7 @@ class Tracker {
|
|
|
1797
2065
|
*/
|
|
1798
2066
|
update(builder, mergeBuilder = false) {
|
|
1799
2067
|
if (mergeBuilder) {
|
|
1800
|
-
this.builders = (0,
|
|
2068
|
+
this.builders = (0, utils_1.pulseMerge)({}, this.builders, builder);
|
|
1801
2069
|
}
|
|
1802
2070
|
else {
|
|
1803
2071
|
this.builders = Object.assign({}, this.builders, builder);
|
|
@@ -2265,8 +2533,8 @@ class Tracker {
|
|
|
2265
2533
|
* with the added guarantee that a second Leave event will not be triggered if one already has been sent.
|
|
2266
2534
|
* @category TPaaS Leave Tracking
|
|
2267
2535
|
*/
|
|
2268
|
-
trackTpaasActiveLeave() {
|
|
2269
|
-
(0, leaveTrackingTpaas_1.trackTpaasActiveLeave)();
|
|
2536
|
+
async trackTpaasActiveLeave() {
|
|
2537
|
+
await (0, leaveTrackingTpaas_1.trackTpaasActiveLeave)();
|
|
2270
2538
|
}
|
|
2271
2539
|
/**
|
|
2272
2540
|
* Check if leave tracking is enabled (if an event will be sent when the user leaves the page)
|
|
@@ -2290,13 +2558,14 @@ class Tracker {
|
|
|
2290
2558
|
* @private
|
|
2291
2559
|
*/
|
|
2292
2560
|
async resolveTrackInput(input) {
|
|
2293
|
-
return (0,
|
|
2561
|
+
return (0, utils_1.evaluateAndFlatten)(input);
|
|
2294
2562
|
}
|
|
2295
2563
|
/**
|
|
2296
2564
|
* @private
|
|
2297
2565
|
*/
|
|
2298
|
-
async
|
|
2299
|
-
|
|
2566
|
+
async resolveAnonymousTrackGlobals() {
|
|
2567
|
+
// Omit before evaluation so forbidden promise/function builders cannot delay or fail anonymous tracking.
|
|
2568
|
+
return (0, utils_1.evaluateAndFlatten)((0, utils_1.omit)(this.builders, ANONYMOUS_EVENT_FORBIDDEN_FIELDS));
|
|
2300
2569
|
}
|
|
2301
2570
|
/**
|
|
2302
2571
|
* Send all anonymous events that are in the internal anonymous event queue.
|
|
@@ -2360,12 +2629,18 @@ class Tracker {
|
|
|
2360
2629
|
async prepareQueuesAndSend(eventQueue, retryEventQueue) {
|
|
2361
2630
|
const promisesToBeSent = eventQueue.splice(0);
|
|
2362
2631
|
const eventsToBeSent = promisesToBeSent.map((p) => p.inputValue);
|
|
2363
|
-
const eventsToRetry = retryEventQueue;
|
|
2632
|
+
const eventsToRetry = retryEventQueue.splice(0);
|
|
2364
2633
|
eventQueue.length = 0;
|
|
2365
2634
|
retryEventQueue.length = 0;
|
|
2366
2635
|
const evaluatedEvents = await Promise.all(eventsToBeSent);
|
|
2367
2636
|
const url = this._getCollectorPath();
|
|
2368
2637
|
const data = [...evaluatedEvents, ...eventsToRetry];
|
|
2638
|
+
// in some cases, _sendImmediately executes an asynchronous operation (cisSync) after checking for empty array
|
|
2639
|
+
// due to that, it's still possible for this function to be called with an empty array, so we need to check for that again before sending
|
|
2640
|
+
// in order to avoid making an empty request to collector
|
|
2641
|
+
if (data.length === 0) {
|
|
2642
|
+
return [];
|
|
2643
|
+
}
|
|
2369
2644
|
// biome-ignore lint/suspicious/noExplicitAny: -
|
|
2370
2645
|
async function onFailedSend(response) {
|
|
2371
2646
|
// We retry an event once, but discard already retried events
|
|
@@ -2402,7 +2677,7 @@ class Tracker {
|
|
|
2402
2677
|
const session = (0, builders_1.session)({}, creationDate);
|
|
2403
2678
|
// Resolve any pending session ID promises
|
|
2404
2679
|
this.resolveSessionIdPromise();
|
|
2405
|
-
return (0,
|
|
2680
|
+
return (0, utils_1.pulseMerge)({}, eventInput, {
|
|
2406
2681
|
'@id': (0, uuid_1.v4)(),
|
|
2407
2682
|
creationDate: creationDate.toISOString(),
|
|
2408
2683
|
session,
|
|
@@ -2431,7 +2706,7 @@ class Tracker {
|
|
|
2431
2706
|
*/
|
|
2432
2707
|
createAnonymousEvent(eventInput) {
|
|
2433
2708
|
const creationDate = new Date();
|
|
2434
|
-
return (0,
|
|
2709
|
+
return (0, utils_1.pulseMerge)({}, eventInput, {
|
|
2435
2710
|
'@id': (0, uuid_1.v4)(),
|
|
2436
2711
|
creationDate: creationDate.toISOString(),
|
|
2437
2712
|
});
|
|
@@ -2444,7 +2719,7 @@ class Tracker {
|
|
|
2444
2719
|
*/
|
|
2445
2720
|
applyEventTypeDefaults(eventInput, eventType) {
|
|
2446
2721
|
const eventDefaults = getEventBuilder(eventType).defaults;
|
|
2447
|
-
return (0,
|
|
2722
|
+
return (0, utils_1.pulseMerge)({}, eventDefaults(), eventInput);
|
|
2448
2723
|
}
|
|
2449
2724
|
/**
|
|
2450
2725
|
* @param eventInput
|
|
@@ -2453,7 +2728,7 @@ class Tracker {
|
|
|
2453
2728
|
*/
|
|
2454
2729
|
applyAnonymousEventTypeDefaults(eventInput, eventType) {
|
|
2455
2730
|
const eventDefaults = getAnonymousEventBuilder(eventType).defaults;
|
|
2456
|
-
return (0,
|
|
2731
|
+
return (0, utils_1.pulseMerge)({}, eventDefaults(), eventInput);
|
|
2457
2732
|
}
|
|
2458
2733
|
/**
|
|
2459
2734
|
* applyBookmarkedEvent
|
|
@@ -2468,7 +2743,7 @@ class Tracker {
|
|
|
2468
2743
|
const eventOutput = Object.assign({}, eventInput);
|
|
2469
2744
|
const bookmarkedPageViewEvent = this.bookmark.get(bookmarkKey) ?? {};
|
|
2470
2745
|
const { '@id': _id, '@type': _type, creationDate: _creationDate, ...coreEvent } = bookmarkedPageViewEvent;
|
|
2471
|
-
return (0,
|
|
2746
|
+
return (0, utils_1.pulseMerge)({}, eventOutput, coreEvent);
|
|
2472
2747
|
}
|
|
2473
2748
|
/**
|
|
2474
2749
|
* applyConsents
|
|
@@ -2476,7 +2751,7 @@ class Tracker {
|
|
|
2476
2751
|
* @private
|
|
2477
2752
|
*/
|
|
2478
2753
|
async applyConsents(eventInput) {
|
|
2479
|
-
return (0,
|
|
2754
|
+
return (0, utils_1.pulseMerge)({}, eventInput, await this.evaluateConsents());
|
|
2480
2755
|
}
|
|
2481
2756
|
/**
|
|
2482
2757
|
* applyConsentsAnonymous
|
|
@@ -2484,7 +2759,7 @@ class Tracker {
|
|
|
2484
2759
|
* @private
|
|
2485
2760
|
*/
|
|
2486
2761
|
applyConsentsAnonymous(eventInput) {
|
|
2487
|
-
return (0,
|
|
2762
|
+
return (0, utils_1.pulseMerge)({}, eventInput, this.evaluateConsentsAnonymous());
|
|
2488
2763
|
}
|
|
2489
2764
|
/**
|
|
2490
2765
|
* Enriches the event with consent data saved in state.
|
|
@@ -2506,7 +2781,7 @@ class Tracker {
|
|
|
2506
2781
|
* @category Consents
|
|
2507
2782
|
*/
|
|
2508
2783
|
evaluateConsentsAnonymous() {
|
|
2509
|
-
const consents = (0,
|
|
2784
|
+
const consents = (0, utils_1.isPromise)(this.state.consents) ? (0, consent_manager_1.getFallbackConsents)() : this.state.consents;
|
|
2510
2785
|
return {
|
|
2511
2786
|
...(consents && { consents }),
|
|
2512
2787
|
};
|