@schibsted/pulse-sdk 8.0.0-rc.2 → 8.0.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Tracker.js +582 -471
- 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 -80
- 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/session/store.js +96 -0
- 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 +50 -72
- 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 -3
- 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/dist/cjs/tpaas-builders/builders/session.js +5 -0
- 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 -9
- package/dist/cjs/tpaas-builders/builders.js +326 -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/dist/cjs/tpaas-context/adapters.js +85 -0
- package/dist/cjs/tpaas-context/browser.js +51 -0
- package/dist/cjs/tpaas-context/index.js +6 -0
- package/dist/cjs/tpaas-context/prepare.js +177 -0
- package/dist/cjs/tpaas-context/session.js +23 -0
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/tpaas-context}/types.js +0 -1
- package/{node_modules/@schibsted/tpaas-schemas/dist/cjs → dist/cjs/tpaas-schemas}/constants.js +189 -158
- 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 -7
- 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 +558 -447
- 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 +5 -77
- 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/session/store.js +90 -0
- 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 +50 -72
- 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 +2 -3
- 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/dist/ejs/tpaas-builders/builders/session.js +1 -0
- 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 +3 -9
- package/dist/ejs/tpaas-builders/builders.js +259 -0
- package/dist/ejs/tpaas-builders/guards.js +4 -0
- package/dist/ejs/tpaas-builders/index.js +2 -0
- package/dist/ejs/tpaas-context/adapters.js +80 -0
- package/dist/ejs/tpaas-context/browser.js +47 -0
- package/dist/ejs/tpaas-context/index.js +1 -0
- package/dist/ejs/tpaas-context/prepare.js +137 -0
- package/dist/ejs/tpaas-context/session.js +19 -0
- package/{node_modules/@schibsted/tpaas-schemas/dist/ejs → dist/ejs/tpaas-schemas}/constants.js +187 -156
- 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 -7
- 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 +198 -93
- 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 -13
- 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/session/store.d.ts +34 -0
- 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 +7 -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 +4 -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 +7 -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 +2 -0
- package/dist/types/tpaas-context/adapters.d.ts +26 -0
- package/dist/types/tpaas-context/browser.d.ts +8 -0
- package/dist/types/tpaas-context/index.d.ts +2 -0
- package/dist/types/tpaas-context/prepare.d.ts +38 -0
- package/dist/types/tpaas-context/session.d.ts +10 -0
- package/dist/types/tpaas-context/types.d.ts +66 -0
- package/dist/types/tpaas-schemas/constants.d.ts +471 -0
- package/dist/types/tpaas-schemas/index.d.ts +5 -0
- package/dist/types/tpaas-schemas/types/ITpaasEvent.d.ts +130 -0
- package/dist/types/tpaas-schemas/types/schemas/IAnonymousImpressionUIElement.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 +213 -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 +133 -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 +238 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementVideoAd.d.ts +147 -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 +96 -0
- package/dist/types/tpaas-schemas/types/schemas/ILoadAd.d.ts +119 -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 +63 -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 +21 -17
- 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/session.js +0 -114
- 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/session.js +0 -108
- 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-context/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
|
@@ -5,14 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getDefaultNativeJwe = getDefaultNativeJwe;
|
|
7
7
|
exports.getDefaultAltHandler = getDefaultAltHandler;
|
|
8
|
-
const pulse_utils_1 = require("@schibsted/pulse-utils");
|
|
9
8
|
const loglevel_1 = __importDefault(require("loglevel"));
|
|
9
|
+
const utils_1 = require("./utils");
|
|
10
10
|
function getDefaultNativeJwe(config) {
|
|
11
11
|
if (config.nativeJwe) {
|
|
12
12
|
loglevel_1.default.debug('Using nativeJwe from config');
|
|
13
13
|
return config.nativeJwe;
|
|
14
14
|
}
|
|
15
|
-
if (!
|
|
15
|
+
if (!utils_1.isBrowser) {
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
if (!window.__nativeJwe__ && !window.hermesJwe) {
|
|
@@ -27,7 +27,7 @@ function getDefaultAltHandler(config) {
|
|
|
27
27
|
loglevel_1.default.debug('Using altEventHandler from config');
|
|
28
28
|
return config.altEventHandler;
|
|
29
29
|
}
|
|
30
|
-
if (!
|
|
30
|
+
if (!utils_1.isBrowser) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
if (!window.pulseEventHandler) {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultValue = void 0;
|
|
4
4
|
exports.generateActorSDRN = generateActorSDRN;
|
|
5
|
-
exports.
|
|
5
|
+
exports.hasActorBuilder = hasActorBuilder;
|
|
6
6
|
exports.default = actor;
|
|
7
|
-
const
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
8
|
/**
|
|
9
9
|
* generateActorSDRN
|
|
10
10
|
* Generates a well-formed sdrn for an actor, based on id, realm inputs
|
|
@@ -18,16 +18,16 @@ function generateActorSDRN(id, realm = '__REALM_NOT_SET__') {
|
|
|
18
18
|
return `sdrn:${realm}:user:${outputId}`;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Type guard to check if the input
|
|
21
|
+
* Type guard to check if the input has an Actor Builder
|
|
22
22
|
* @param input
|
|
23
23
|
* @internal
|
|
24
24
|
*/
|
|
25
|
-
function
|
|
25
|
+
function hasActorBuilder(input) {
|
|
26
26
|
// biome-ignore lint/suspicious/noPrototypeBuiltins: Object.hasOwn is not available in ES2020
|
|
27
|
-
return (0,
|
|
27
|
+
return (0, utils_1.isPlainObject)(input) && Object.prototype.hasOwnProperty.call(input, 'actor');
|
|
28
28
|
}
|
|
29
29
|
function formatActorInput(input) {
|
|
30
|
-
if ((0,
|
|
30
|
+
if ((0, utils_1.isString)(input)) {
|
|
31
31
|
return { id: input };
|
|
32
32
|
}
|
|
33
33
|
const { id, realm, ...rest } = input || {};
|
|
@@ -9,12 +9,12 @@ exports.applyAdvertisingConsentSync = applyAdvertisingConsentSync;
|
|
|
9
9
|
exports.resolveIncludeAdvertising = resolveIncludeAdvertising;
|
|
10
10
|
exports.resolveIncludeAdvertisingSync = resolveIncludeAdvertisingSync;
|
|
11
11
|
exports.default = consents;
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const cis_sync_1 = require("../cis-sync");
|
|
13
|
+
const utils_1 = require("../utils");
|
|
14
14
|
const warnOnce_1 = __importDefault(require("../warnOnce"));
|
|
15
15
|
const consent_manager_1 = require("./consent-manager");
|
|
16
16
|
/**
|
|
17
|
-
* @enum
|
|
17
|
+
* @enum ConsentsCategory
|
|
18
18
|
*/
|
|
19
19
|
var ConsentsCategory;
|
|
20
20
|
(function (ConsentsCategory) {
|
|
@@ -23,14 +23,14 @@ var ConsentsCategory;
|
|
|
23
23
|
ConsentsCategory["CMP_ADVERTISING"] = "CMP_ADVERTISING";
|
|
24
24
|
ConsentsCategory["CMP_PERSONALIZATION"] = "CMP_PERSONALIZATION";
|
|
25
25
|
})(ConsentsCategory || (exports.ConsentsCategory = ConsentsCategory = {}));
|
|
26
|
-
exports.ConsentsSourceValues = ['default', 'cmp', 'cache'];
|
|
26
|
+
exports.ConsentsSourceValues = ['default', 'cmp', 'cache', 'url'];
|
|
27
27
|
exports.ConsentsPurposeCategoryStatusValues = ['accepted', 'rejected', 'unknown'];
|
|
28
28
|
const isLegacyConsentsPurpose = (consentsPurposeCategory) => {
|
|
29
29
|
return !consentsPurposeCategory?.status;
|
|
30
30
|
};
|
|
31
31
|
const isLegacyConsents = (consents) => {
|
|
32
32
|
return !!(consents &&
|
|
33
|
-
!(0,
|
|
33
|
+
!(0, utils_1.isPromise)(consents) &&
|
|
34
34
|
consents?.purposes &&
|
|
35
35
|
Object.values(consents.purposes).every((purpose) => isLegacyConsentsPurpose(purpose)));
|
|
36
36
|
};
|
|
@@ -49,7 +49,7 @@ async function applyAdvertisingConsent(consents, requireAdvertisingOptIn) {
|
|
|
49
49
|
}
|
|
50
50
|
const includeAdvertising = await resolveIncludeAdvertising(consents, requireAdvertisingOptIn);
|
|
51
51
|
if (!includeAdvertising) {
|
|
52
|
-
(0,
|
|
52
|
+
(0, cis_sync_1.clearCookieAdvertisingIds)();
|
|
53
53
|
}
|
|
54
54
|
return includeAdvertising;
|
|
55
55
|
}
|
|
@@ -67,7 +67,7 @@ function applyAdvertisingConsentSync(consents, requireAdvertisingOptIn) {
|
|
|
67
67
|
}
|
|
68
68
|
const includeAdvertising = resolveIncludeAdvertisingSync(consents, requireAdvertisingOptIn);
|
|
69
69
|
if (!includeAdvertising) {
|
|
70
|
-
(0,
|
|
70
|
+
(0, cis_sync_1.clearCookieAdvertisingIds)();
|
|
71
71
|
}
|
|
72
72
|
return includeAdvertising;
|
|
73
73
|
}
|
|
@@ -84,7 +84,7 @@ async function resolveIncludeAdvertising(consents, requireAdvertisingOptIn) {
|
|
|
84
84
|
if (!resolvedRequireAdvertisingOptIn) {
|
|
85
85
|
return true;
|
|
86
86
|
}
|
|
87
|
-
if ((0,
|
|
87
|
+
if ((0, utils_1.isPromise)(consents)) {
|
|
88
88
|
const resolvedConsents = await consents;
|
|
89
89
|
return resolvedConsents?.purposes?.[ConsentsCategory.CMP_ADVERTISING]?.status === 'accepted';
|
|
90
90
|
}
|
|
@@ -17,8 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.defaultValue = void 0;
|
|
18
18
|
exports.getXEnvironmentId = getXEnvironmentId;
|
|
19
19
|
exports.default = default_1;
|
|
20
|
-
const
|
|
21
|
-
const
|
|
20
|
+
const cis_sync_1 = require("../cis-sync");
|
|
21
|
+
const utils_1 = require("../utils");
|
|
22
22
|
const device_node_1 = require("./device-node");
|
|
23
23
|
__exportStar(require("./device-node"), exports);
|
|
24
24
|
function supportsLocalStorage() {
|
|
@@ -33,7 +33,7 @@ function supportsLocalStorage() {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
function getViewportDimensions() {
|
|
36
|
-
if (!
|
|
36
|
+
if (!utils_1.isBrowser) {
|
|
37
37
|
return '';
|
|
38
38
|
}
|
|
39
39
|
let viewportWidth;
|
|
@@ -55,14 +55,14 @@ function getViewportDimensions() {
|
|
|
55
55
|
return `${viewportWidth}x${viewportHeight}`;
|
|
56
56
|
}
|
|
57
57
|
function getXEnvironmentId() {
|
|
58
|
-
if (!
|
|
58
|
+
if (!utils_1.isBrowser) {
|
|
59
59
|
return undefined;
|
|
60
60
|
}
|
|
61
61
|
const urlParams = new URLSearchParams(window?.location?.search ?? '');
|
|
62
62
|
return urlParams.get('x_env_id') || undefined;
|
|
63
63
|
}
|
|
64
64
|
const defaultValue = () => {
|
|
65
|
-
if (!
|
|
65
|
+
if (!utils_1.isBrowser) {
|
|
66
66
|
return {};
|
|
67
67
|
}
|
|
68
68
|
const { navigator, screen } = window;
|
|
@@ -70,7 +70,7 @@ const defaultValue = () => {
|
|
|
70
70
|
acceptLanguage: navigator.userLanguage || navigator.language,
|
|
71
71
|
screenSize: `${screen.width}x${screen.height}`,
|
|
72
72
|
userAgent: navigator.userAgent,
|
|
73
|
-
deviceType: (0,
|
|
73
|
+
deviceType: (0, utils_1.deviceType)(window.navigator.userAgent),
|
|
74
74
|
viewportSize: getViewportDimensions(),
|
|
75
75
|
localStorageEnabled: supportsLocalStorage(),
|
|
76
76
|
xEnvironmentId: getXEnvironmentId(),
|
|
@@ -79,11 +79,11 @@ const defaultValue = () => {
|
|
|
79
79
|
exports.defaultValue = defaultValue;
|
|
80
80
|
function default_1(input) {
|
|
81
81
|
const { device: deviceInput } = input || {};
|
|
82
|
-
const { environmentId, jwe } = (0,
|
|
82
|
+
const { environmentId, jwe } = (0, cis_sync_1.parsePulseCookies)();
|
|
83
83
|
const data = {
|
|
84
84
|
id: environmentId,
|
|
85
85
|
jweIds: jwe,
|
|
86
|
-
...((0,
|
|
86
|
+
...((0, utils_1.isString)(deviceInput) ? { id: deviceInput } : deviceInput),
|
|
87
87
|
};
|
|
88
88
|
return (0, device_node_1.device)(exports.defaultValue)({ device: data });
|
|
89
89
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultValue = exports.device = void 0;
|
|
4
4
|
exports.generateEnvironmentSDRN = generateEnvironmentSDRN;
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
6
|
/**
|
|
7
7
|
* Generate a well-formed environment SDRN from an ID
|
|
8
8
|
* @param id
|
|
@@ -12,7 +12,7 @@ function generateEnvironmentSDRN(id) {
|
|
|
12
12
|
return `sdrn:schibsted:environment:${id}`;
|
|
13
13
|
}
|
|
14
14
|
function formatDeviceInput(input) {
|
|
15
|
-
if ((0,
|
|
15
|
+
if ((0, utils_1.isString)(input)) {
|
|
16
16
|
return { id: input };
|
|
17
17
|
}
|
|
18
18
|
const { id, ...rest } = input || {};
|
|
@@ -37,7 +37,7 @@ const device = (defaultValueHandler) => (input) => {
|
|
|
37
37
|
if (!deviceInput) {
|
|
38
38
|
return undefined;
|
|
39
39
|
}
|
|
40
|
-
const formattedInput = (0,
|
|
40
|
+
const formattedInput = (0, utils_1.pulseMerge)({}, defaultValueHandler(), formatDeviceInput(deviceInput));
|
|
41
41
|
const { id, additionalIds, ...props } = formattedInput;
|
|
42
42
|
if (!id) {
|
|
43
43
|
return undefined;
|
|
@@ -38,7 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.anonymousTrackerEvent = anonymousTrackerEvent;
|
|
40
40
|
exports.anonymousEngagementEvent = anonymousEngagementEvent;
|
|
41
|
-
const
|
|
41
|
+
const utils_1 = require("../utils");
|
|
42
42
|
const consents_1 = __importDefault(require("./consents"));
|
|
43
43
|
const events_node_1 = require("./events-node");
|
|
44
44
|
const experimentMetadata_1 = __importStar(require("./experimentMetadata"));
|
|
@@ -51,7 +51,7 @@ const trackerBuilder_1 = __importStar(require("./trackerBuilder"));
|
|
|
51
51
|
* Add default values to AnonymousTrackerEventInput.
|
|
52
52
|
*/
|
|
53
53
|
function trackerAnonymousEventInput(eventInput) {
|
|
54
|
-
return (0,
|
|
54
|
+
return (0, utils_1.pulseMerge)({
|
|
55
55
|
experiments: (0, experiments_1.defaultValue)(),
|
|
56
56
|
experimentMetadata: (0, experimentMetadata_1.defaultValue)(),
|
|
57
57
|
object: (0, objects_anonymous_1.defaultValue)(),
|
|
@@ -62,7 +62,7 @@ function trackerAnonymousEventInput(eventInput) {
|
|
|
62
62
|
}
|
|
63
63
|
function anonymousTrackerEvent({ eventInput, sdkConfig } = {}) {
|
|
64
64
|
const parentInput = trackerAnonymousEventInput(eventInput);
|
|
65
|
-
return Object.assign({}, (0,
|
|
65
|
+
return Object.assign({}, (0, utils_1.omit)(eventInput, ['type']), {
|
|
66
66
|
'@type': eventInput?.type || 'View',
|
|
67
67
|
schema: eventInput?.schema ||
|
|
68
68
|
`http://${sdkConfig?.schemaLocation || events_node_1.DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/360.json`,
|
|
@@ -41,7 +41,7 @@ exports.routableEvent = routableEvent;
|
|
|
41
41
|
exports.trackerEvent = trackerEvent;
|
|
42
42
|
exports.engagementEvent = engagementEvent;
|
|
43
43
|
exports.identityEvent = identityEvent;
|
|
44
|
-
const
|
|
44
|
+
const utils_1 = require("../utils");
|
|
45
45
|
const actor_1 = __importStar(require("./actor"));
|
|
46
46
|
const consents_1 = __importDefault(require("./consents"));
|
|
47
47
|
const device_1 = __importStar(require("./device"));
|
|
@@ -54,7 +54,7 @@ const provider_1 = __importStar(require("./provider"));
|
|
|
54
54
|
const trackerBuilder_1 = __importStar(require("./trackerBuilder"));
|
|
55
55
|
exports.DEFAULT_SCHEMA_LOCATION = 'schema.schibsted.com';
|
|
56
56
|
function routableEventDefaults(eventInput) {
|
|
57
|
-
return (0,
|
|
57
|
+
return (0, utils_1.pulseMerge)({
|
|
58
58
|
actor: (0, actor_1.defaultValue)(),
|
|
59
59
|
provider: (0, provider_1.defaultValue)(),
|
|
60
60
|
}, eventInput);
|
|
@@ -65,7 +65,7 @@ function routableEventDefaults(eventInput) {
|
|
|
65
65
|
function routableEvent({ eventInput, sdkConfig } = {}) {
|
|
66
66
|
return Object.assign({}, eventInput, {
|
|
67
67
|
schema: eventInput?.schema ||
|
|
68
|
-
`http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/base-routable-event.json/
|
|
68
|
+
`http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/base-routable-event.json/248.json#`,
|
|
69
69
|
provider: (0, provider_1.default)(eventInput),
|
|
70
70
|
actor: (0, actor_1.default)(eventInput),
|
|
71
71
|
});
|
|
@@ -75,7 +75,7 @@ routableEvent.defaults = routableEventDefaults;
|
|
|
75
75
|
* Add default value to TrackerEventInput.
|
|
76
76
|
*/
|
|
77
77
|
function trackerEventInput(eventInput) {
|
|
78
|
-
return (0,
|
|
78
|
+
return (0, utils_1.pulseMerge)({
|
|
79
79
|
actor: (0, actor_1.defaultValue)(),
|
|
80
80
|
experiments: (0, experiments_1.defaultValue)(),
|
|
81
81
|
experimentMetadata: (0, experimentMetadata_1.defaultValue)(),
|
|
@@ -94,11 +94,11 @@ function trackerEvent({ eventInput, sdkConfig } = {}) {
|
|
|
94
94
|
const parentInput = trackerEventInput(eventInput);
|
|
95
95
|
const pageViewIdInput = eventInput?.pageViewId;
|
|
96
96
|
const pageViewIdSdk = sdkConfig?.pageViewId;
|
|
97
|
-
return Object.assign({}, (0,
|
|
97
|
+
return Object.assign({}, (0, utils_1.omit)(eventInput, ['type']), {
|
|
98
98
|
'@type': eventInput?.type || 'View',
|
|
99
99
|
pageViewId: pageViewIdInput || pageViewIdSdk,
|
|
100
100
|
schema: eventInput?.schema ||
|
|
101
|
-
`http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/
|
|
101
|
+
`http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/361.json`,
|
|
102
102
|
actor: (0, actor_1.default)(parentInput),
|
|
103
103
|
consents: (0, consents_1.default)(parentInput),
|
|
104
104
|
experiments: (0, experiments_1.default)(parentInput),
|
|
@@ -116,7 +116,7 @@ trackerEvent.defaults = trackerEventInput;
|
|
|
116
116
|
function engagementEvent({ eventInput, sdkConfig } = {}) {
|
|
117
117
|
return Object.assign(trackerEvent({ eventInput, sdkConfig }), {
|
|
118
118
|
schema: eventInput?.schema ||
|
|
119
|
-
`http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/engagement-event.json/
|
|
119
|
+
`http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/engagement-event.json/388.json`,
|
|
120
120
|
'@type': 'Engagement',
|
|
121
121
|
});
|
|
122
122
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = experimentMetadata;
|
|
4
4
|
exports.defaultValue = defaultValue;
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
6
|
/**
|
|
7
7
|
* Format experiment metadata
|
|
8
8
|
*/
|
|
@@ -18,7 +18,7 @@ function experimentMetadata(input) {
|
|
|
18
18
|
if (requestTimestamp) {
|
|
19
19
|
formattedExperimentMetadata.requestTimestamp = requestTimestamp;
|
|
20
20
|
}
|
|
21
|
-
return (0,
|
|
21
|
+
return (0, utils_1.isObjectEmpty)(formattedExperimentMetadata) ? undefined : formattedExperimentMetadata;
|
|
22
22
|
}
|
|
23
23
|
function defaultValue() {
|
|
24
24
|
return undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultValue = void 0;
|
|
4
|
+
exports.generateExperimentSDRN = generateExperimentSDRN;
|
|
4
5
|
exports.default = experiments;
|
|
5
6
|
function generateExperimentSDRN(id, experimentationPlatform) {
|
|
6
7
|
return `sdrn:${experimentationPlatform}:experiment:${id}`;
|
|
@@ -18,12 +18,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.defaultValue = exports.default = void 0;
|
|
21
|
-
const
|
|
21
|
+
const utils_1 = require("../../utils");
|
|
22
22
|
__exportStar(require("./objects-anonymous-node"), exports);
|
|
23
23
|
var objects_anonymous_node_1 = require("./objects-anonymous-node");
|
|
24
24
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(objects_anonymous_node_1).default; } });
|
|
25
25
|
const defaultValue = () => {
|
|
26
|
-
if (!
|
|
26
|
+
if (!utils_1.isBrowser) {
|
|
27
27
|
return {};
|
|
28
28
|
}
|
|
29
29
|
const { location = { href: undefined } } = window;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultValue = exports.formatObject = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
6
6
|
/**
|
|
7
7
|
* Format UIElement.
|
|
8
8
|
*
|
|
@@ -23,18 +23,18 @@ function formatUIElement({ object, provider, page, target }) {
|
|
|
23
23
|
const { id: targetId, type: targetType } = target || {};
|
|
24
24
|
const { id: providerId } = provider || {};
|
|
25
25
|
const uiElementId = pageType || targetType
|
|
26
|
-
? `${(0,
|
|
27
|
-
: (0,
|
|
26
|
+
? `${(0, utils_2.generateObjectSDRN)(pageId || targetId, providerId, pageType || targetType) || ''}:element:${id}`
|
|
27
|
+
: (0, utils_2.generateObjectSDRN)(id, providerId, type);
|
|
28
28
|
const baseObject = {
|
|
29
29
|
'@id': uiElementId,
|
|
30
30
|
'@type': type,
|
|
31
31
|
};
|
|
32
|
-
return (0,
|
|
32
|
+
return (0, utils_1.pulseMerge)({}, baseObject, rest);
|
|
33
33
|
}
|
|
34
34
|
function formatDefaultObject({ object, provider }) {
|
|
35
35
|
const { id, type = 'Content', custom, 'spt:custom': _, ...rest } = object || {};
|
|
36
36
|
const { id: providerId } = provider || {};
|
|
37
|
-
const objectId = (0,
|
|
37
|
+
const objectId = (0, utils_2.generateObjectSDRN)(id, providerId, type);
|
|
38
38
|
let baseObject = {};
|
|
39
39
|
if (objectId) {
|
|
40
40
|
baseObject = {
|
|
@@ -42,7 +42,7 @@ function formatDefaultObject({ object, provider }) {
|
|
|
42
42
|
'@type': type,
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
return (0,
|
|
45
|
+
return (0, utils_1.pulseMerge)({}, baseObject, rest);
|
|
46
46
|
}
|
|
47
47
|
function getObjectFormatter(type) {
|
|
48
48
|
return type === 'UIElement' ? formatUIElement : formatDefaultObject;
|
|
@@ -69,14 +69,14 @@ const formatObject = (input, pageInput) => {
|
|
|
69
69
|
// biome-ignore lint/performance/noAccumulatingSpread: -
|
|
70
70
|
...accl,
|
|
71
71
|
[key]: prop.map((o) => {
|
|
72
|
-
if ((0,
|
|
72
|
+
if ((0, utils_1.isPlainObject)(o)) {
|
|
73
73
|
return (0, exports.formatObject)(Object.assign({}, input, { object: o }), page);
|
|
74
74
|
}
|
|
75
75
|
return o;
|
|
76
76
|
}),
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
if ((0,
|
|
79
|
+
if ((0, utils_1.isObject)(prop)) {
|
|
80
80
|
return {
|
|
81
81
|
// biome-ignore lint/performance/noAccumulatingSpread: -
|
|
82
82
|
...accl,
|
|
@@ -18,12 +18,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.defaultValue = exports.default = void 0;
|
|
21
|
-
const
|
|
21
|
+
const utils_1 = require("../../utils");
|
|
22
22
|
__exportStar(require("./objects-node"), exports);
|
|
23
23
|
var objects_node_1 = require("./objects-node");
|
|
24
24
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(objects_node_1).default; } });
|
|
25
25
|
const defaultValue = () => {
|
|
26
|
-
if (!
|
|
26
|
+
if (!utils_1.isBrowser) {
|
|
27
27
|
return {};
|
|
28
28
|
}
|
|
29
29
|
const { location = { href: undefined } } = window;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultValue = exports.formatObject = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
6
6
|
/**
|
|
7
7
|
* Format UIElement.
|
|
8
8
|
*
|
|
@@ -23,8 +23,8 @@ function formatUIElement({ object, provider, page, target }) {
|
|
|
23
23
|
const { id: targetId, type: targetType } = target || {};
|
|
24
24
|
const { id: providerId } = provider || {};
|
|
25
25
|
const uiElementId = pageType || targetType
|
|
26
|
-
? `${(0,
|
|
27
|
-
: (0,
|
|
26
|
+
? `${(0, utils_2.generateObjectSDRN)(pageId || targetId, providerId, pageType || targetType) || ''}:element:${id}`
|
|
27
|
+
: (0, utils_2.generateObjectSDRN)(id, providerId, type);
|
|
28
28
|
const baseObject = {
|
|
29
29
|
'@id': uiElementId,
|
|
30
30
|
'@type': type,
|
|
@@ -32,12 +32,12 @@ function formatUIElement({ object, provider, page, target }) {
|
|
|
32
32
|
if (custom) {
|
|
33
33
|
baseObject['spt:custom'] = custom;
|
|
34
34
|
}
|
|
35
|
-
return (0,
|
|
35
|
+
return (0, utils_1.pulseMerge)({}, baseObject, rest);
|
|
36
36
|
}
|
|
37
37
|
function formatDefaultObject({ object, provider }) {
|
|
38
38
|
const { id, type = 'Content', custom, ...rest } = object || {};
|
|
39
39
|
const { id: providerId } = provider || {};
|
|
40
|
-
const objectId = (0,
|
|
40
|
+
const objectId = (0, utils_2.generateObjectSDRN)(id, providerId, type);
|
|
41
41
|
let baseObject = {};
|
|
42
42
|
if (objectId) {
|
|
43
43
|
baseObject = {
|
|
@@ -48,7 +48,7 @@ function formatDefaultObject({ object, provider }) {
|
|
|
48
48
|
if (custom) {
|
|
49
49
|
baseObject['spt:custom'] = custom;
|
|
50
50
|
}
|
|
51
|
-
return (0,
|
|
51
|
+
return (0, utils_1.pulseMerge)({}, baseObject, rest);
|
|
52
52
|
}
|
|
53
53
|
function formatAccount({ object }) {
|
|
54
54
|
const { id, realm = 'schibsted.com', type: _, custom, ...rest } = object || {}; // type is dropped
|
|
@@ -63,7 +63,7 @@ function formatAccount({ object }) {
|
|
|
63
63
|
if (custom) {
|
|
64
64
|
baseObject['spt:custom'] = custom;
|
|
65
65
|
}
|
|
66
|
-
return (0,
|
|
66
|
+
return (0, utils_1.pulseMerge)({}, baseObject, rest);
|
|
67
67
|
}
|
|
68
68
|
const objectFormatterMapping = {
|
|
69
69
|
UIElement: formatUIElement,
|
|
@@ -94,14 +94,14 @@ const formatObject = (input, pageInput) => {
|
|
|
94
94
|
// biome-ignore lint/performance/noAccumulatingSpread: -
|
|
95
95
|
...accl,
|
|
96
96
|
[key]: prop.map((o) => {
|
|
97
|
-
if ((0,
|
|
97
|
+
if ((0, utils_1.isPlainObject)(o)) {
|
|
98
98
|
return (0, exports.formatObject)(Object.assign({}, input, { object: o }), page);
|
|
99
99
|
}
|
|
100
100
|
return o;
|
|
101
101
|
}),
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
if ((0,
|
|
104
|
+
if ((0, utils_1.isObject)(prop)) {
|
|
105
105
|
return {
|
|
106
106
|
// biome-ignore lint/performance/noAccumulatingSpread: -
|
|
107
107
|
...accl,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateObjectSDRN = generateObjectSDRN;
|
|
4
|
-
const
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
5
|
const objectTypeContentMapping = {
|
|
6
6
|
classifiedad: 'classified',
|
|
7
7
|
notificationcontent: 'notification',
|
|
@@ -10,13 +10,13 @@ const objectTypeContentMapping = {
|
|
|
10
10
|
};
|
|
11
11
|
const getObjectContentByType = (type = '') => objectTypeContentMapping[type.toLowerCase()] ?? type.toLowerCase();
|
|
12
12
|
function idIsFormatted(id) {
|
|
13
|
-
return (0,
|
|
13
|
+
return (0, utils_1.isString)(id) && id?.startsWith('sdrn:');
|
|
14
14
|
}
|
|
15
15
|
function generateObjectSDRN(id, providerId, type) {
|
|
16
16
|
if (idIsFormatted(id)) {
|
|
17
17
|
return id;
|
|
18
18
|
}
|
|
19
|
-
if (((0,
|
|
19
|
+
if (((0, utils_1.isString)(id) || Number.isFinite(id)) && (0, utils_1.isString)(providerId) && (0, utils_1.isString)(type)) {
|
|
20
20
|
const contentType = getObjectContentByType(type);
|
|
21
21
|
return `sdrn:${providerId}:${contentType}:${id}`;
|
|
22
22
|
}
|
|
@@ -18,11 +18,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.defaultValue = exports.default = void 0;
|
|
21
|
-
const
|
|
21
|
+
const utils_1 = require("../utils");
|
|
22
22
|
__exportStar(require("./origin-node"), exports);
|
|
23
23
|
var origin_node_1 = require("./origin-node");
|
|
24
24
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(origin_node_1).default; } });
|
|
25
25
|
const defaultValue = () => ({
|
|
26
|
-
url:
|
|
26
|
+
url: utils_1.isBrowser ? document.referrer : '',
|
|
27
27
|
});
|
|
28
28
|
exports.defaultValue = defaultValue;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultValue = void 0;
|
|
4
4
|
exports.default = origin;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const utils_2 = require("./objects/utils");
|
|
7
7
|
// https://schibsted.ghe.com/data-platform/event-formats/blob/master/schema/master/common-definitions.json
|
|
8
8
|
const originIdRegex = /^unknown$|^sdrn:(.*)$/;
|
|
9
9
|
function isOriginSDRN(originId) {
|
|
10
|
-
return (0,
|
|
10
|
+
return (0, utils_1.isString)(originId) && originIdRegex.test(originId);
|
|
11
11
|
}
|
|
12
12
|
function origin(input) {
|
|
13
13
|
const { origin: originInput, provider } = input || {};
|
|
@@ -18,7 +18,7 @@ function origin(input) {
|
|
|
18
18
|
// brands had to do it on their end to get it correctly.
|
|
19
19
|
const formattedOriginId = isOriginSDRN(originInputId)
|
|
20
20
|
? originInputId
|
|
21
|
-
: (0,
|
|
21
|
+
: (0, utils_2.generateObjectSDRN)(originInputId, providerId, originInputType);
|
|
22
22
|
const base = {
|
|
23
23
|
...(formattedOriginId && { '@id': formattedOriginId }),
|
|
24
24
|
...(originInputType && { '@type': originInputType }),
|
|
@@ -1,81 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultValue =
|
|
3
|
+
exports.defaultValue = void 0;
|
|
4
4
|
exports.default = session;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const { USE_LOCALSTORAGE } = pulse_utils_1.cookieConfig;
|
|
8
|
-
const SESSION_STORAGE_KEY = '_pulsesession';
|
|
9
|
-
const generateSessionSDRN = (sessionId) => `sdrn:schibsted:session:${sessionId}`;
|
|
10
|
-
// Return parsed json from cookie (or localStorage if enabled), or undefined.
|
|
11
|
-
const readAndParse = (storageKey) => {
|
|
12
|
-
try {
|
|
13
|
-
const storedSession = (0, pulse_utils_1.readCookie)(storageKey);
|
|
14
|
-
if (storedSession) {
|
|
15
|
-
return JSON.parse(storedSession);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
catch (_e) {
|
|
19
|
-
// If localStorage/cookie is not available, we treat it as if
|
|
20
|
-
// the value is undefined.
|
|
21
|
-
// If data is unparseable, we also ignore it.
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
return undefined;
|
|
25
|
-
};
|
|
26
|
-
exports.readAndParse = readAndParse;
|
|
27
|
-
// Read and parse session data from localStorage.
|
|
28
|
-
// Any invalid or unreadable data is ignored.
|
|
29
|
-
const readSession = () => {
|
|
30
|
-
const storedSession = (0, exports.readAndParse)(SESSION_STORAGE_KEY);
|
|
31
|
-
if (storedSession) {
|
|
32
|
-
const [id, startTimeMs, lastEventTimeMs] = storedSession;
|
|
33
|
-
const startTime = new Date(startTimeMs);
|
|
34
|
-
const lastEventTime = new Date(lastEventTimeMs);
|
|
35
|
-
if (id &&
|
|
36
|
-
startTime &&
|
|
37
|
-
lastEventTime &&
|
|
38
|
-
!Number.isNaN(startTime.getTime()) &&
|
|
39
|
-
!Number.isNaN(lastEventTime.getTime())) {
|
|
40
|
-
return { id, startTime, lastEventTime };
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return undefined;
|
|
44
|
-
};
|
|
45
|
-
exports.readSession = readSession;
|
|
46
|
-
// Write session data to localStorage
|
|
47
|
-
const writeSession = (session) => {
|
|
48
|
-
const { id, startTime, lastEventTime } = session;
|
|
49
|
-
try {
|
|
50
|
-
const sessionToStore = [id, startTime.getTime(), lastEventTime.getTime()];
|
|
51
|
-
const halfHourInDays = 1.0 / (24 * 2);
|
|
52
|
-
(0, pulse_utils_1.writeCookie)(SESSION_STORAGE_KEY, JSON.stringify(sessionToStore), (0, pulse_utils_1.getRootDomain)(), halfHourInDays);
|
|
53
|
-
// Delete old localStorage-based session if needed
|
|
54
|
-
if (!USE_LOCALSTORAGE && pulse_utils_1.isBrowser && window.localStorage) {
|
|
55
|
-
// removeItem will do nothing to a non-existing item.
|
|
56
|
-
window.localStorage.removeItem(SESSION_STORAGE_KEY);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
catch (_e) {
|
|
60
|
-
// If we can't write the session, we just move on in life
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const createSession = (eventCreationDate) => {
|
|
64
|
-
const now = eventCreationDate ?? new Date();
|
|
65
|
-
return {
|
|
66
|
-
id: generateSessionSDRN((0, uuid_1.v4)()),
|
|
67
|
-
startTime: now,
|
|
68
|
-
lastEventTime: now,
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
const updateSession = (session, eventCreationDate) => {
|
|
72
|
-
const now = eventCreationDate ?? new Date();
|
|
73
|
-
const sessionMaxInterval = 30 * 60 * 1000; // 30 minutes in milliseconds
|
|
74
|
-
if (!session || session.lastEventTime.getTime() < now.getTime() - sessionMaxInterval) {
|
|
75
|
-
return createSession(now);
|
|
76
|
-
}
|
|
77
|
-
return { ...session, lastEventTime: now };
|
|
78
|
-
};
|
|
5
|
+
const store_1 = require("../session/store");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
79
7
|
const defaultValue = () => undefined;
|
|
80
8
|
exports.defaultValue = defaultValue;
|
|
81
9
|
// Add session information to an event
|
|
@@ -86,12 +14,10 @@ exports.defaultValue = defaultValue;
|
|
|
86
14
|
// }
|
|
87
15
|
// }
|
|
88
16
|
function session(_input, eventCreationDate) {
|
|
89
|
-
const
|
|
90
|
-
const newSession = updateSession(oldSession, eventCreationDate);
|
|
91
|
-
writeSession(newSession);
|
|
92
|
-
const { id, startTime } = newSession;
|
|
17
|
+
const { sessionId, startTime } = (0, store_1.touchSession)(eventCreationDate ?? new Date());
|
|
93
18
|
return {
|
|
94
|
-
'@id':
|
|
19
|
+
'@id': (0, store_1.generateSessionSDRN)(sessionId),
|
|
95
20
|
startTime: startTime.toISOString(),
|
|
21
|
+
xDomainId: (0, utils_1.getXDomainId)(),
|
|
96
22
|
};
|
|
97
23
|
}
|