@schibsted/pulse-sdk 8.0.0-alpha.16 → 8.0.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/EventBus/EventBus.js +146 -0
- package/dist/cjs/Tracker.js +2499 -0
- package/dist/cjs/Tracker.test-d.js +76 -0
- package/dist/cjs/app-integration.js +40 -0
- package/dist/cjs/builders/actor.js +60 -0
- package/dist/cjs/builders/consent-manager.js +134 -0
- package/dist/cjs/builders/consents.js +149 -0
- package/dist/cjs/builders/device-browser.js +89 -0
- package/dist/cjs/builders/device-node.js +63 -0
- package/dist/cjs/builders/device.js +23 -0
- package/dist/cjs/builders/events-anonymous-browser.js +6 -0
- package/dist/cjs/builders/events-anonymous-node.js +88 -0
- package/dist/cjs/builders/events-anonymous.js +17 -0
- package/dist/cjs/builders/events-browser.js +8 -0
- package/dist/cjs/builders/events-node.js +127 -0
- package/dist/cjs/builders/events.js +17 -0
- package/dist/cjs/builders/experimentMetadata.js +25 -0
- package/dist/cjs/builders/experiments.js +32 -0
- package/dist/cjs/builders/index.js +52 -0
- package/dist/cjs/builders/location.js +38 -0
- package/dist/cjs/builders/objects/objects-anonymous-browser.js +36 -0
- package/dist/cjs/builders/objects/objects-anonymous-node.js +95 -0
- package/dist/cjs/builders/objects/objects-anonymous.js +23 -0
- package/dist/cjs/builders/objects/objects-browser.js +36 -0
- package/dist/cjs/builders/objects/objects-node.js +126 -0
- package/dist/cjs/builders/objects/objects.js +23 -0
- package/dist/cjs/builders/objects/utils.js +23 -0
- package/dist/cjs/builders/origin-browser.js +28 -0
- package/dist/cjs/builders/origin-node.js +29 -0
- package/dist/cjs/builders/origin.js +23 -0
- package/dist/cjs/builders/provider.js +24 -0
- package/dist/cjs/builders/session-browser.js +97 -0
- package/dist/cjs/builders/session-node.js +9 -0
- package/dist/cjs/builders/session.js +23 -0
- package/dist/cjs/builders/tracker-browser.js +34 -0
- package/dist/cjs/builders/tracker-node.js +22 -0
- package/dist/cjs/builders/trackerBuilder.js +23 -0
- package/dist/cjs/config-browser.js +26 -0
- package/dist/cjs/config.js +9 -0
- package/dist/cjs/createPulseTracker.js +50 -0
- package/dist/cjs/defer.js +20 -0
- package/dist/cjs/getPulseTracker.js +74 -0
- package/dist/cjs/identity/actor.js +60 -0
- package/dist/cjs/identity/advertising.js +62 -0
- package/dist/cjs/identity/cis.js +66 -0
- package/dist/cjs/identity/device.js +20 -0
- package/dist/cjs/identity/index.js +20 -0
- package/dist/cjs/index.js +57 -0
- package/dist/cjs/leaveTracking/constants.js +26 -0
- package/dist/cjs/leaveTracking/index.js +368 -0
- package/dist/cjs/leaveTracking/types.js +19 -0
- package/dist/cjs/leaveTrackingTpaas/constants.js +18 -0
- package/dist/cjs/leaveTrackingTpaas/index.js +341 -0
- package/dist/cjs/leaveTrackingTpaas/types.js +19 -0
- package/dist/cjs/network-browser.js +35 -0
- package/dist/cjs/network.js +15 -0
- package/dist/cjs/remoteConfig/index.js +124 -0
- package/dist/cjs/tracker-proxy/consts.js +72 -0
- package/dist/cjs/tracker-proxy/proxy-provider.js +68 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/version.json +1 -0
- package/dist/cjs/visibility-observer/index.js +101 -0
- package/dist/cjs/warnOnce.js +11 -0
- package/dist/cjs/wrapper/engagement/ui-element/event-builder.js +21 -0
- package/dist/cjs/wrapper/engagement/ui-element/types.js +2 -0
- package/dist/cjs/wrapper/types/base-event.js +2 -0
- package/dist/cjs/wrapper/types/engagement-event.js +2 -0
- package/dist/cjs/wrapper/types/event.js +2 -0
- package/dist/cjs/wrapper/types/index.js +19 -0
- package/dist/cjs/wrapper/types/utils.js +2 -0
- package/dist/cjs/wrapper/utils/get-navigation-type.js +32 -0
- package/dist/cjs/wrapper/utils/page-from-page-view.js +9 -0
- package/dist/cjs/wrapper/view/article/event-builder.js +19 -0
- package/dist/cjs/wrapper/view/article/types.js +2 -0
- package/dist/cjs/wrapper/view/frontpage/event-builder.js +16 -0
- package/dist/cjs/wrapper/view/frontpage/types.js +2 -0
- package/dist/cjs/wrapper/view/listing/event-builder.js +14 -0
- package/dist/cjs/wrapper/view/listing/types.js +2 -0
- package/dist/cjs/wrapper/view/loginposter/event-builder.js +11 -0
- package/dist/cjs/wrapper/view/loginposter/types.js +2 -0
- package/dist/cjs/wrapper/view/page/event-builder.js +18 -0
- package/dist/cjs/wrapper/view/page/types.js +2 -0
- package/dist/cjs/wrapper/view/salesposter/event-builder.js +18 -0
- package/dist/cjs/wrapper/view/salesposter/types.js +2 -0
- package/dist/cjs/wrapper/view/ui-element/event-builder.js +15 -0
- package/dist/cjs/wrapper/view/ui-element/types.js +2 -0
- package/dist/ejs/EventBus/EventBus.js +140 -0
- package/dist/ejs/Tracker.js +2455 -0
- package/dist/ejs/Tracker.test-d.js +71 -0
- package/dist/ejs/app-integration.js +33 -0
- package/dist/ejs/builders/actor.js +53 -0
- package/dist/ejs/builders/consent-manager.js +125 -0
- package/dist/ejs/builders/consents.js +138 -0
- package/dist/ejs/builders/device-browser.js +69 -0
- package/dist/ejs/builders/device-node.js +57 -0
- package/dist/ejs/builders/device.js +2 -0
- package/dist/ejs/builders/events-anonymous-browser.js +1 -0
- package/dist/ejs/builders/events-anonymous-node.js +48 -0
- package/dist/ejs/builders/events-anonymous.js +1 -0
- package/dist/ejs/builders/events-browser.js +1 -0
- package/dist/ejs/builders/events-node.js +84 -0
- package/dist/ejs/builders/events.js +1 -0
- package/dist/ejs/builders/experimentMetadata.js +21 -0
- package/dist/ejs/builders/experiments.js +27 -0
- package/dist/ejs/builders/index.js +12 -0
- package/dist/ejs/builders/location.js +34 -0
- package/dist/ejs/builders/objects/objects-anonymous-browser.js +14 -0
- package/dist/ejs/builders/objects/objects-anonymous-node.js +90 -0
- package/dist/ejs/builders/objects/objects-anonymous.js +2 -0
- package/dist/ejs/builders/objects/objects-browser.js +14 -0
- package/dist/ejs/builders/objects/objects-node.js +121 -0
- package/dist/ejs/builders/objects/objects.js +2 -0
- package/dist/ejs/builders/objects/utils.js +20 -0
- package/dist/ejs/builders/origin-browser.js +6 -0
- package/dist/ejs/builders/origin-node.js +24 -0
- package/dist/ejs/builders/origin.js +2 -0
- package/dist/ejs/builders/provider.js +18 -0
- package/dist/ejs/builders/session-browser.js +90 -0
- package/dist/ejs/builders/session-node.js +4 -0
- package/dist/ejs/builders/session.js +2 -0
- package/dist/ejs/builders/tracker-browser.js +13 -0
- package/dist/ejs/builders/tracker-node.js +14 -0
- package/dist/ejs/builders/trackerBuilder.js +2 -0
- package/dist/ejs/config-browser.js +23 -0
- package/dist/ejs/config.js +6 -0
- package/dist/ejs/createPulseTracker.js +44 -0
- package/dist/ejs/defer.js +17 -0
- package/dist/ejs/getPulseTracker.js +71 -0
- package/dist/ejs/identity/actor.js +51 -0
- package/dist/ejs/identity/advertising.js +57 -0
- package/dist/ejs/identity/cis.js +58 -0
- package/dist/ejs/identity/device.js +17 -0
- package/dist/ejs/identity/index.js +4 -0
- package/dist/ejs/index.js +9 -0
- package/dist/ejs/leaveTracking/constants.js +19 -0
- package/dist/ejs/leaveTracking/index.js +319 -0
- package/dist/ejs/leaveTracking/types.js +16 -0
- package/dist/ejs/leaveTrackingTpaas/constants.js +13 -0
- package/dist/ejs/leaveTrackingTpaas/index.js +291 -0
- package/dist/ejs/leaveTrackingTpaas/types.js +16 -0
- package/dist/ejs/network-browser.js +32 -0
- package/dist/ejs/network.js +12 -0
- package/dist/ejs/remoteConfig/index.js +111 -0
- package/dist/ejs/tracker-proxy/consts.js +68 -0
- package/dist/ejs/tracker-proxy/proxy-provider.js +62 -0
- package/dist/ejs/types.js +1 -0
- package/dist/ejs/version.json +1 -0
- package/dist/ejs/visibility-observer/index.js +97 -0
- package/dist/ejs/warnOnce.js +9 -0
- package/dist/ejs/wrapper/engagement/ui-element/event-builder.js +17 -0
- package/dist/ejs/wrapper/engagement/ui-element/types.js +1 -0
- package/dist/ejs/wrapper/types/base-event.js +1 -0
- package/dist/ejs/wrapper/types/engagement-event.js +1 -0
- package/dist/ejs/wrapper/types/event.js +1 -0
- package/dist/ejs/wrapper/types/index.js +3 -0
- package/dist/ejs/wrapper/types/utils.js +1 -0
- package/dist/ejs/wrapper/utils/get-navigation-type.js +29 -0
- package/dist/ejs/wrapper/utils/page-from-page-view.js +6 -0
- package/dist/ejs/wrapper/view/article/event-builder.js +15 -0
- package/dist/ejs/wrapper/view/article/types.js +1 -0
- package/dist/ejs/wrapper/view/frontpage/event-builder.js +12 -0
- package/dist/ejs/wrapper/view/frontpage/types.js +1 -0
- package/dist/ejs/wrapper/view/listing/event-builder.js +10 -0
- package/dist/ejs/wrapper/view/listing/types.js +1 -0
- package/dist/ejs/wrapper/view/loginposter/event-builder.js +7 -0
- package/dist/ejs/wrapper/view/loginposter/types.js +1 -0
- package/dist/ejs/wrapper/view/page/event-builder.js +14 -0
- package/dist/ejs/wrapper/view/page/types.js +1 -0
- package/dist/ejs/wrapper/view/salesposter/event-builder.js +14 -0
- package/dist/ejs/wrapper/view/salesposter/types.js +1 -0
- package/dist/ejs/wrapper/view/ui-element/event-builder.js +11 -0
- package/dist/ejs/wrapper/view/ui-element/types.js +1 -0
- package/dist/types/EventBus/EventBus.d.ts +106 -0
- package/dist/types/Tracker.d.ts +1418 -0
- package/dist/types/Tracker.test-d.d.ts +1 -0
- package/dist/types/app-integration.d.ts +10 -0
- package/dist/types/builders/actor.d.ts +39 -0
- package/dist/types/builders/consent-manager.d.ts +49 -0
- package/dist/types/builders/consents.d.ts +107 -0
- package/dist/types/builders/device-browser.d.ts +6 -0
- package/dist/types/builders/device-node.d.ts +65 -0
- package/dist/types/builders/device.d.ts +2 -0
- package/dist/types/builders/events-anonymous-browser.d.ts +1 -0
- package/dist/types/builders/events-anonymous-node.d.ts +82 -0
- package/dist/types/builders/events-anonymous.d.ts +1 -0
- package/dist/types/builders/events-browser.d.ts +1 -0
- package/dist/types/builders/events-node.d.ts +130 -0
- package/dist/types/builders/events.d.ts +1 -0
- package/dist/types/builders/experimentMetadata.d.ts +25 -0
- package/dist/types/builders/experiments.d.ts +24 -0
- package/dist/types/builders/index.d.ts +23 -0
- package/dist/types/builders/location.d.ts +34 -0
- package/dist/types/builders/objects/objects-anonymous-browser.d.ts +11 -0
- package/dist/types/builders/objects/objects-anonymous-node.d.ts +52 -0
- package/dist/types/builders/objects/objects-anonymous.d.ts +2 -0
- package/dist/types/builders/objects/objects-browser.d.ts +11 -0
- package/dist/types/builders/objects/objects-node.d.ts +60 -0
- package/dist/types/builders/objects/objects.d.ts +2 -0
- package/dist/types/builders/objects/utils.d.ts +1 -0
- package/dist/types/builders/origin-browser.d.ts +5 -0
- package/dist/types/builders/origin-node.d.ts +18 -0
- package/dist/types/builders/origin.d.ts +2 -0
- package/dist/types/builders/provider.d.ts +14 -0
- package/dist/types/builders/session-browser.d.ts +20 -0
- package/dist/types/builders/session-node.d.ts +3 -0
- package/dist/types/builders/session.d.ts +2 -0
- package/dist/types/builders/tracker-browser.d.ts +2 -0
- package/dist/types/builders/tracker-node.d.ts +14 -0
- package/dist/types/builders/trackerBuilder.d.ts +2 -0
- package/dist/types/config-browser.d.ts +23 -0
- package/dist/types/config.d.ts +6 -0
- package/dist/types/createPulseTracker.d.ts +21 -0
- package/dist/types/defer.d.ts +28 -0
- package/dist/types/getPulseTracker.d.ts +59 -0
- package/dist/types/identity/actor.d.ts +28 -0
- package/dist/types/identity/advertising.d.ts +30 -0
- package/dist/types/identity/cis.d.ts +21 -0
- package/dist/types/identity/device.d.ts +12 -0
- package/dist/types/identity/index.d.ts +4 -0
- package/dist/types/index.d.ts +31 -0
- package/dist/types/leaveTracking/constants.d.ts +26 -0
- package/dist/types/leaveTracking/index.d.ts +23 -0
- package/dist/types/leaveTracking/types.d.ts +78 -0
- package/dist/types/leaveTrackingTpaas/constants.d.ts +13 -0
- package/dist/types/leaveTrackingTpaas/index.d.ts +28 -0
- package/dist/types/leaveTrackingTpaas/types.d.ts +45 -0
- package/dist/types/network-browser.d.ts +5 -0
- package/dist/types/network.d.ts +4 -0
- package/dist/types/remoteConfig/index.d.ts +32 -0
- package/dist/types/tracker-proxy/consts.d.ts +45 -0
- package/dist/types/tracker-proxy/proxy-provider.d.ts +2 -0
- package/dist/types/types.d.ts +93 -0
- package/dist/types/visibility-observer/index.d.ts +38 -0
- package/dist/types/warnOnce.d.ts +2 -0
- package/dist/types/wrapper/engagement/ui-element/event-builder.d.ts +3 -0
- package/dist/types/wrapper/engagement/ui-element/types.d.ts +29 -0
- package/dist/types/wrapper/types/base-event.d.ts +74 -0
- package/dist/types/wrapper/types/engagement-event.d.ts +5 -0
- package/dist/types/wrapper/types/event.d.ts +41 -0
- package/dist/types/wrapper/types/index.d.ts +3 -0
- package/dist/types/wrapper/types/utils.d.ts +5 -0
- package/dist/types/wrapper/utils/get-navigation-type.d.ts +3 -0
- package/dist/types/wrapper/utils/page-from-page-view.d.ts +3 -0
- package/dist/types/wrapper/view/article/event-builder.d.ts +2 -0
- package/dist/types/wrapper/view/article/types.d.ts +27 -0
- package/dist/types/wrapper/view/frontpage/event-builder.d.ts +2 -0
- package/dist/types/wrapper/view/frontpage/types.d.ts +18 -0
- package/dist/types/wrapper/view/listing/event-builder.d.ts +2 -0
- package/dist/types/wrapper/view/listing/types.d.ts +27 -0
- package/dist/types/wrapper/view/loginposter/event-builder.d.ts +2 -0
- package/dist/types/wrapper/view/loginposter/types.d.ts +14 -0
- package/dist/types/wrapper/view/page/event-builder.d.ts +2 -0
- package/dist/types/wrapper/view/page/types.d.ts +16 -0
- package/dist/types/wrapper/view/salesposter/event-builder.d.ts +2 -0
- package/dist/types/wrapper/view/salesposter/types.d.ts +15 -0
- package/dist/types/wrapper/view/ui-element/event-builder.d.ts +3 -0
- package/dist/types/wrapper/view/ui-element/types.d.ts +28 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.d.ts +26 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.js +273 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis.d.ts +10 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis.js +7 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.d.ts +14 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.js +39 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/index.d.ts +4 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/index.js +12 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/index.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/pulse-cookie.d.ts +55 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/pulse-cookie.js +276 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/pulse-cookie.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.d.ts +36 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.js +87 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.d.ts +6 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.js +21 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/types.d.ts +24 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/types.js +3 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/types.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.d.ts +26 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.js +203 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.d.ts +10 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.js +4 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.d.ts +14 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.js +35 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.d.ts +4 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.js +3 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.d.ts +55 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.js +254 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.d.ts +36 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.js +50 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.d.ts +6 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.js +17 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.d.ts +24 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.js +2 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.js.map +1 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/cis-browser.d.ts +26 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/cis.d.ts +10 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/eventEmitter.d.ts +14 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/index.d.ts +4 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/pulse-cookie.d.ts +55 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/storage/pulseStorage.d.ts +36 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/storage/storage.d.ts +6 -0
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/types.d.ts +24 -0
- package/node_modules/@schibsted/pulse-cis-sync/package.json +44 -0
- package/node_modules/@schibsted/pulse-utils/dist/cjs/cookie-config.js +10 -0
- package/node_modules/@schibsted/pulse-utils/dist/cjs/cookie.js +86 -0
- package/node_modules/@schibsted/pulse-utils/dist/cjs/events.js +109 -0
- package/node_modules/@schibsted/pulse-utils/dist/cjs/get.js +18 -0
- package/node_modules/@schibsted/pulse-utils/dist/cjs/getRootDomain.js +54 -0
- package/node_modules/@schibsted/pulse-utils/dist/cjs/index.js +38 -0
- package/node_modules/@schibsted/pulse-utils/dist/cjs/merge.js +38 -0
- package/node_modules/@schibsted/pulse-utils/dist/cjs/objects.js +34 -0
- package/node_modules/@schibsted/pulse-utils/dist/cjs/omit.js +9 -0
- package/node_modules/@schibsted/pulse-utils/dist/cjs/randomString.js +18 -0
- package/node_modules/@schibsted/pulse-utils/dist/cjs/throttle.js +34 -0
- package/node_modules/@schibsted/pulse-utils/dist/cjs/webApi.js +21 -0
- package/node_modules/@schibsted/pulse-utils/dist/ejs/cookie-config.js +7 -0
- package/node_modules/@schibsted/pulse-utils/dist/ejs/cookie.js +81 -0
- package/node_modules/@schibsted/pulse-utils/dist/ejs/events.js +103 -0
- package/node_modules/@schibsted/pulse-utils/dist/ejs/get.js +15 -0
- package/node_modules/@schibsted/pulse-utils/dist/ejs/getRootDomain.js +49 -0
- package/node_modules/@schibsted/pulse-utils/dist/ejs/index.js +11 -0
- package/node_modules/@schibsted/pulse-utils/dist/ejs/merge.js +35 -0
- package/node_modules/@schibsted/pulse-utils/dist/ejs/objects.js +26 -0
- package/node_modules/@schibsted/pulse-utils/dist/ejs/omit.js +6 -0
- package/node_modules/@schibsted/pulse-utils/dist/ejs/randomString.js +15 -0
- package/node_modules/@schibsted/pulse-utils/dist/ejs/throttle.js +31 -0
- package/node_modules/@schibsted/pulse-utils/dist/ejs/webApi.js +17 -0
- package/node_modules/@schibsted/pulse-utils/dist/types/cookie-config.d.ts +7 -0
- package/node_modules/@schibsted/pulse-utils/dist/types/cookie.d.ts +23 -0
- package/node_modules/@schibsted/pulse-utils/dist/types/events.d.ts +17 -0
- package/node_modules/@schibsted/pulse-utils/dist/types/get.d.ts +1 -0
- package/node_modules/@schibsted/pulse-utils/dist/types/getRootDomain.d.ts +13 -0
- package/node_modules/@schibsted/pulse-utils/dist/types/index.d.ts +11 -0
- package/node_modules/@schibsted/pulse-utils/dist/types/merge.d.ts +4 -0
- package/node_modules/@schibsted/pulse-utils/dist/types/objects.d.ts +6 -0
- package/node_modules/@schibsted/pulse-utils/dist/types/omit.d.ts +3 -0
- package/node_modules/@schibsted/pulse-utils/dist/types/randomString.d.ts +1 -0
- package/node_modules/@schibsted/pulse-utils/dist/types/throttle.d.ts +3 -0
- package/node_modules/@schibsted/pulse-utils/dist/types/webApi.d.ts +10 -0
- package/node_modules/@schibsted/pulse-utils/package.json +36 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/anonymous.js +8 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/baseEvent.js +9 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/consents.js +15 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/device.js +211 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/experiments.js +11 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/navigationType.js +52 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/pageInfo.js +24 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/pageviewId.js +11 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/provider.js +12 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/referrer.js +19 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/session.js +114 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/time.js +15 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/trackerBuilder.js +15 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/user.js +26 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/utm.js +35 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders.js +264 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/index.js +17 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/types.js +2 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/anonymous.js +5 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/baseEvent.js +6 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/consents.js +12 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/device.js +174 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/experiments.js +7 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/navigationType.js +48 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/pageInfo.js +20 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/pageviewId.js +7 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/provider.js +9 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/referrer.js +15 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/session.js +108 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/time.js +11 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/trackerBuilder.js +11 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/user.js +22 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/utm.js +31 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders.js +209 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/index.js +1 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/types.js +1 -0
- package/node_modules/@schibsted/tpaas-event-builder/dist/index.d.ts +5171 -0
- package/node_modules/@schibsted/tpaas-event-builder/package.json +40 -0
- package/node_modules/@schibsted/tpaas-schemas/dist/cjs/constants.js +62 -1
- package/node_modules/@schibsted/tpaas-schemas/dist/ejs/constants.js +61 -0
- package/node_modules/@schibsted/tpaas-schemas/dist/index.d.ts +128 -0
- package/package.json +58 -13
- package/CHANGELOG.md +0 -1035
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -47
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default function send(url, data, state) {
|
|
2
|
+
const { username, password } = state;
|
|
3
|
+
const headers = {
|
|
4
|
+
'Content-Type': 'application/json',
|
|
5
|
+
Authorization: `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`,
|
|
6
|
+
};
|
|
7
|
+
return fetch(url, {
|
|
8
|
+
headers,
|
|
9
|
+
method: 'POST',
|
|
10
|
+
body: JSON.stringify(data),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { isString, webApi } from '@schibsted/pulse-utils';
|
|
2
|
+
import logger from 'loglevel';
|
|
3
|
+
const CIS_KEY = 'cis';
|
|
4
|
+
const COLLECTOR_KEY = 'collector';
|
|
5
|
+
const getRemoteConfigStorageKey = '_pulse.internal.remote.config';
|
|
6
|
+
let inMemoryConfig = null;
|
|
7
|
+
export async function fetchRemoteConfig(url) {
|
|
8
|
+
const response = await fetch(url, {
|
|
9
|
+
method: 'GET',
|
|
10
|
+
});
|
|
11
|
+
return response.json();
|
|
12
|
+
}
|
|
13
|
+
export async function fetchRemoteConfigWithRetry(url, retries = 3) {
|
|
14
|
+
try {
|
|
15
|
+
return await fetchRemoteConfig(url);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
if (retries > 1) {
|
|
19
|
+
return fetchRemoteConfigWithRetry(url, retries - 1);
|
|
20
|
+
}
|
|
21
|
+
throw err;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function readConfigFromStorage() {
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(webApi.localStorage?.getItem(getRemoteConfigStorageKey) ?? '');
|
|
27
|
+
}
|
|
28
|
+
catch (_err) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function writeConfigToStorage(config, url) {
|
|
33
|
+
try {
|
|
34
|
+
const configPersistence = {
|
|
35
|
+
config,
|
|
36
|
+
metadata: {
|
|
37
|
+
remoteConfigUrl: url,
|
|
38
|
+
updatedAt: new Date().toISOString(),
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
webApi.localStorage?.setItem(getRemoteConfigStorageKey, JSON.stringify(configPersistence));
|
|
42
|
+
return configPersistence;
|
|
43
|
+
}
|
|
44
|
+
catch (_err) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function clearConfigFromStorage() {
|
|
49
|
+
try {
|
|
50
|
+
webApi.localStorage?.removeItem(getRemoteConfigStorageKey);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
catch (_err) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export function clearInMemoryConfig() {
|
|
58
|
+
inMemoryConfig = null;
|
|
59
|
+
}
|
|
60
|
+
function isConfigValid(config) {
|
|
61
|
+
const isConfigValid = !!config;
|
|
62
|
+
logger.debug(`RemoteConfig: isConfigValid: ${isConfigValid}`);
|
|
63
|
+
return isConfigValid;
|
|
64
|
+
}
|
|
65
|
+
function isConfigExpired(updatedAt, ttlMinutes) {
|
|
66
|
+
const isConfigExpired = !updatedAt || !ttlMinutes || new Date(updatedAt).getTime() + Math.min(ttlMinutes, 10080) * 60000 <= Date.now();
|
|
67
|
+
logger.debug(`RemoteConfig: isConfigExpired: ${isConfigExpired}`);
|
|
68
|
+
return isConfigExpired;
|
|
69
|
+
}
|
|
70
|
+
export function shouldSyncRemoteConfig(url, config, metadata) {
|
|
71
|
+
return (!isConfigValid(config) ||
|
|
72
|
+
isConfigExpired(metadata?.updatedAt, config?.['ttl-minutes']) ||
|
|
73
|
+
url !== metadata?.remoteConfigUrl);
|
|
74
|
+
}
|
|
75
|
+
export function resolveConfigServicesByTag(tag, config) {
|
|
76
|
+
if (isString(tag) && config) {
|
|
77
|
+
let services = config.scopes?.[tag]?.services || null;
|
|
78
|
+
if (!services && tag !== 'default') {
|
|
79
|
+
services = config.scopes.default.services;
|
|
80
|
+
}
|
|
81
|
+
return services;
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
let onGoingSync = null;
|
|
86
|
+
// biome-ignore lint/style/useDefaultParameterLast: -
|
|
87
|
+
export async function syncRemoteConfig(tag = 'default', url) {
|
|
88
|
+
try {
|
|
89
|
+
if (!inMemoryConfig) {
|
|
90
|
+
inMemoryConfig = readConfigFromStorage();
|
|
91
|
+
}
|
|
92
|
+
if (!inMemoryConfig || shouldSyncRemoteConfig(url, inMemoryConfig.config, inMemoryConfig.metadata)) {
|
|
93
|
+
let remoteConfig;
|
|
94
|
+
if (onGoingSync) {
|
|
95
|
+
remoteConfig = await onGoingSync;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
onGoingSync = fetchRemoteConfigWithRetry(url);
|
|
99
|
+
remoteConfig = await onGoingSync;
|
|
100
|
+
onGoingSync = null;
|
|
101
|
+
}
|
|
102
|
+
inMemoryConfig = writeConfigToStorage(remoteConfig, url);
|
|
103
|
+
}
|
|
104
|
+
return resolveConfigServicesByTag(tag, inMemoryConfig?.config);
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
logger.debug(err);
|
|
108
|
+
onGoingSync = null;
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Sync the content between files below this line:
|
|
2
|
+
export const MESSAGE_PREFIX = 'pulse-tracker-proxy';
|
|
3
|
+
export const MESSAGE_TYPE_REQUEST = `${MESSAGE_PREFIX}:request`;
|
|
4
|
+
export const MESSAGE_TYPE_ACK = `${MESSAGE_PREFIX}:ack`;
|
|
5
|
+
export const MESSAGE_TYPE_INVOKE = `${MESSAGE_PREFIX}:invoke`;
|
|
6
|
+
export const MESSAGE_TYPE_RETURN = `${MESSAGE_PREFIX}:return`;
|
|
7
|
+
export const MESSAGE_TYPE_RETURN_ERROR = `${MESSAGE_PREFIX}:return-error`;
|
|
8
|
+
export const ALLOWED_METHODS = ['track'];
|
|
9
|
+
export const TPAAS_ALLOWED_METHODS = [
|
|
10
|
+
'trackAnonymousViewUIElement',
|
|
11
|
+
'trackEngagementAudio',
|
|
12
|
+
'trackEngagementForm',
|
|
13
|
+
'trackEngagementHealthUIElement',
|
|
14
|
+
'trackEngagementOffer',
|
|
15
|
+
'trackEngagementTeaser',
|
|
16
|
+
'trackEngagementUIElement',
|
|
17
|
+
'trackEngagementVideo',
|
|
18
|
+
'trackEngagementVideoAd',
|
|
19
|
+
'trackEngagementWidget',
|
|
20
|
+
'trackCompletedHealthAction',
|
|
21
|
+
'trackImpressionAdSlot',
|
|
22
|
+
'trackImpressionForm',
|
|
23
|
+
'trackImpressionHealthUIElement',
|
|
24
|
+
'trackImpressionOffer',
|
|
25
|
+
'trackImpressionPlayer',
|
|
26
|
+
'trackImpressionTeaser',
|
|
27
|
+
'trackImpressionUIElement',
|
|
28
|
+
'trackImpressionWidget',
|
|
29
|
+
'trackLeaveArticle',
|
|
30
|
+
'trackLeaveAudioPage',
|
|
31
|
+
'trackLeaveError',
|
|
32
|
+
'trackLeaveFrontpage',
|
|
33
|
+
'trackLeaveLandingpage',
|
|
34
|
+
'trackLeaveListing',
|
|
35
|
+
'trackLeaveLockedArticle',
|
|
36
|
+
'trackLeaveLockedAudio',
|
|
37
|
+
'trackLeaveLockedAudioPage',
|
|
38
|
+
'trackLeaveLockedVideo',
|
|
39
|
+
'trackLeaveLockedVideoPage',
|
|
40
|
+
'trackLeavePage',
|
|
41
|
+
'trackLeaveVideoPage',
|
|
42
|
+
'trackLeaveWeather',
|
|
43
|
+
'trackViewArticle',
|
|
44
|
+
'trackViewAudio',
|
|
45
|
+
'trackViewAudioPage',
|
|
46
|
+
'trackViewError',
|
|
47
|
+
'trackViewFrontpage',
|
|
48
|
+
'trackViewHealthPage',
|
|
49
|
+
'trackViewLandingpage',
|
|
50
|
+
'trackViewListing',
|
|
51
|
+
'trackViewLockedArticle',
|
|
52
|
+
'trackViewLockedAudio',
|
|
53
|
+
'trackViewLockedAudioPage',
|
|
54
|
+
'trackViewLockedVideo',
|
|
55
|
+
'trackViewLockedVideoPage',
|
|
56
|
+
'trackViewPage',
|
|
57
|
+
'trackViewTitle',
|
|
58
|
+
'trackViewVideo',
|
|
59
|
+
'trackViewVideoPage',
|
|
60
|
+
'trackViewWeather',
|
|
61
|
+
];
|
|
62
|
+
export function isPulseProxyMessage(message) {
|
|
63
|
+
return (message !== null &&
|
|
64
|
+
typeof message === 'object' &&
|
|
65
|
+
'type' in message &&
|
|
66
|
+
typeof message.type === 'string' &&
|
|
67
|
+
message.type.startsWith(MESSAGE_PREFIX));
|
|
68
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { isBrowser } from '@schibsted/pulse-utils';
|
|
2
|
+
import logger from 'loglevel';
|
|
3
|
+
import { ALLOWED_METHODS, isPulseProxyMessage, MESSAGE_TYPE_ACK, MESSAGE_TYPE_INVOKE, MESSAGE_TYPE_REQUEST, MESSAGE_TYPE_RETURN, MESSAGE_TYPE_RETURN_ERROR, TPAAS_ALLOWED_METHODS, } from './consts';
|
|
4
|
+
const ALLOWED_METHODS_SET = new Set([...ALLOWED_METHODS, ...TPAAS_ALLOWED_METHODS]);
|
|
5
|
+
export function startProxyProviderListener(tracker) {
|
|
6
|
+
if (!isBrowser) {
|
|
7
|
+
logger.debug('Proxy Provider - Not in browser environment, skipping message listener');
|
|
8
|
+
return () => { };
|
|
9
|
+
}
|
|
10
|
+
logger.debug('Proxy Provider - Added message listener for proxy provider');
|
|
11
|
+
const listener = async (event) => {
|
|
12
|
+
logger.debug('Proxy Provider - message received', event.data);
|
|
13
|
+
if (!event.ports.length || !isPulseProxyMessage(event.data)) {
|
|
14
|
+
logger.debug('Proxy Provider - message is not for us, skipping. Data:', event.data, 'Ports:', event.ports);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const respond = (message) => {
|
|
18
|
+
logger.debug(`Proxy Provider - response to (${event.origin}): `, message);
|
|
19
|
+
event.ports[0].postMessage(message);
|
|
20
|
+
};
|
|
21
|
+
if (event.data.type === MESSAGE_TYPE_REQUEST) {
|
|
22
|
+
respond({ type: MESSAGE_TYPE_ACK });
|
|
23
|
+
}
|
|
24
|
+
else if (event.data.type === MESSAGE_TYPE_INVOKE) {
|
|
25
|
+
/**
|
|
26
|
+
* @privateRemarks This is where the polymorphism between .track and tpaas methods break,
|
|
27
|
+
* because args can be an array with 2 or 3 arguments, and it cannot be spread in the call
|
|
28
|
+
* when the callee interface does not spread the arguments itself.
|
|
29
|
+
* In the end, almost all the implementation would have to be forked between TrackInvocation and TpaasInvocation,
|
|
30
|
+
* and it was best to stick with am undesired casting, knowing that until this point we are
|
|
31
|
+
* satisfying both implementations.
|
|
32
|
+
* @see TrackInvocation
|
|
33
|
+
* @see TpaasInvocation
|
|
34
|
+
*/
|
|
35
|
+
const { method, args } = event.data.payload;
|
|
36
|
+
try {
|
|
37
|
+
if (!ALLOWED_METHODS_SET.has(method)) {
|
|
38
|
+
respond({
|
|
39
|
+
type: MESSAGE_TYPE_RETURN_ERROR,
|
|
40
|
+
error: `Method ${method} is not allowed`,
|
|
41
|
+
});
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const result = await tracker[method](...args);
|
|
45
|
+
respond({
|
|
46
|
+
type: MESSAGE_TYPE_RETURN,
|
|
47
|
+
payload: result,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
respond({
|
|
52
|
+
type: MESSAGE_TYPE_RETURN_ERROR,
|
|
53
|
+
error: `${error}`,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
window.addEventListener('message', listener);
|
|
59
|
+
return () => {
|
|
60
|
+
window.removeEventListener('message', listener);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "SDK_VERSION": "8.0.0-alpha.18", "GIT_COMMIT": "beb7e832" }
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observes visibility of elements matching a selector using MutationObserver and IntersectionObserver.
|
|
3
|
+
*/
|
|
4
|
+
export class VisibilityObserver {
|
|
5
|
+
/**
|
|
6
|
+
* @param callback The callback function to be executed when an element becomes visible.
|
|
7
|
+
*/
|
|
8
|
+
constructor(callback) {
|
|
9
|
+
this.callback = callback;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Tracks visibility of elements matching {@link selector}, triggering {@link callback} when an element is over 2/3 visible.
|
|
13
|
+
* Uses {@link https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver | MutationObserver} to monitor the DOM for dynamically loaded content.
|
|
14
|
+
* Callback is invoked only once per element.
|
|
15
|
+
* @param selector The CSS selector for elements to track.
|
|
16
|
+
* @throws Error if called more than once.
|
|
17
|
+
*/
|
|
18
|
+
observe(selector) {
|
|
19
|
+
if (this.selector) {
|
|
20
|
+
throw new Error(`Cannot observe selector ${selector}. A visibility observer has already been set up for selector ${this.selector}.`);
|
|
21
|
+
}
|
|
22
|
+
this.selector = selector;
|
|
23
|
+
this.setupObservers();
|
|
24
|
+
// biome-ignore lint/suspicious/useIterableCallbackReturn: -
|
|
25
|
+
this.elements().forEach((elementToTrack) => this.observeIntersection(elementToTrack));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @returns {HTMLElement[]} An array of elements that match the selector in the document.
|
|
29
|
+
*/
|
|
30
|
+
elements() {
|
|
31
|
+
return Array.from(document.querySelectorAll(this.selector));
|
|
32
|
+
}
|
|
33
|
+
// Initialize both observers and start watching for DOM changes
|
|
34
|
+
setupObservers() {
|
|
35
|
+
this.setupIntersectionObserver();
|
|
36
|
+
this.setupMutationObserver();
|
|
37
|
+
this.observeMutations();
|
|
38
|
+
}
|
|
39
|
+
// Create observer to detect when elements become visible in the viewport
|
|
40
|
+
setupIntersectionObserver() {
|
|
41
|
+
this.intersectionObserver = new IntersectionObserver((entries) => {
|
|
42
|
+
entries.forEach((entry) => {
|
|
43
|
+
if (entry.isIntersecting) {
|
|
44
|
+
const node = entry.target;
|
|
45
|
+
this.callback(node);
|
|
46
|
+
this.intersectionObserver.unobserve(node);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}, { threshold: 2 / 3 });
|
|
50
|
+
}
|
|
51
|
+
// Create observer to detect DOM changes that may add/remove tracked elements
|
|
52
|
+
setupMutationObserver() {
|
|
53
|
+
this.mutationObserver = new MutationObserver((mutations) => {
|
|
54
|
+
mutations.forEach((mutation) => {
|
|
55
|
+
this.handleAddedNodes(mutation.addedNodes);
|
|
56
|
+
this.handleRemovedNodes(mutation.removedNodes);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
handleAddedNodes(nodes) {
|
|
61
|
+
this.processHtmlNodes(nodes, (element) => this.observeIntersection(element));
|
|
62
|
+
}
|
|
63
|
+
handleRemovedNodes(nodes) {
|
|
64
|
+
this.processHtmlNodes(nodes, (element) => this.intersectionObserver.unobserve(element));
|
|
65
|
+
}
|
|
66
|
+
processHtmlNodes(nodes, action) {
|
|
67
|
+
nodes.forEach((node) => {
|
|
68
|
+
if (node instanceof HTMLElement && this.nodeMatchesOrContainsSelector(node)) {
|
|
69
|
+
this.processMatchingElements(node, action);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
processMatchingElements(node, action) {
|
|
74
|
+
const elementsToTrack = this.extractElementsToTrack(node);
|
|
75
|
+
elementsToTrack.forEach(action);
|
|
76
|
+
}
|
|
77
|
+
nodeMatchesOrContainsSelector(node) {
|
|
78
|
+
return node.matches(this.selector) || node.querySelector(this.selector) !== null;
|
|
79
|
+
}
|
|
80
|
+
// Get matching descendants and the node itself if it matches the selector
|
|
81
|
+
extractElementsToTrack(node) {
|
|
82
|
+
const elements = Array.from(node.querySelectorAll(this.selector));
|
|
83
|
+
if (node.matches(this.selector)) {
|
|
84
|
+
elements.push(node);
|
|
85
|
+
}
|
|
86
|
+
return elements;
|
|
87
|
+
}
|
|
88
|
+
observeIntersection(node) {
|
|
89
|
+
this.intersectionObserver.observe(node);
|
|
90
|
+
}
|
|
91
|
+
observeMutations() {
|
|
92
|
+
this.mutationObserver.observe(document.body, {
|
|
93
|
+
childList: true,
|
|
94
|
+
subtree: true,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getNavigationType } from '../../utils/get-navigation-type.js';
|
|
2
|
+
export const buildClickUIElementEvent = (inputProperties, currentPage) => ({
|
|
3
|
+
...inputProperties,
|
|
4
|
+
type: 'Engagement',
|
|
5
|
+
action: 'Click',
|
|
6
|
+
object: Promise.resolve(currentPage).then((page) => ({
|
|
7
|
+
page,
|
|
8
|
+
...inputProperties.object,
|
|
9
|
+
navigationType: getNavigationType(),
|
|
10
|
+
type: 'UIElement',
|
|
11
|
+
url: window.location.href,
|
|
12
|
+
})),
|
|
13
|
+
...(inputProperties.metrics && { metrics: inputProperties.metrics }),
|
|
14
|
+
...(inputProperties.experiments && {
|
|
15
|
+
experiments: inputProperties.experiments,
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// implementation "copy-pasted" from the wrapper
|
|
2
|
+
const modernNavigationMap = {
|
|
3
|
+
navigate: 'navigation',
|
|
4
|
+
reload: 'refresh',
|
|
5
|
+
};
|
|
6
|
+
const legacyNavigationMap = {
|
|
7
|
+
0: 'navigation',
|
|
8
|
+
1: 'refresh',
|
|
9
|
+
};
|
|
10
|
+
const getModernNavigationType = (entryType) => {
|
|
11
|
+
return modernNavigationMap[entryType] || 'alternative';
|
|
12
|
+
};
|
|
13
|
+
const getLegacyNavigationType = (entryType) => {
|
|
14
|
+
return legacyNavigationMap[entryType] || 'alternative';
|
|
15
|
+
};
|
|
16
|
+
const getNavigationType = () => {
|
|
17
|
+
if (typeof window === 'undefined' || typeof window.performance === 'undefined') {
|
|
18
|
+
return 'unknown';
|
|
19
|
+
}
|
|
20
|
+
const [navigationEntry] = window.performance.getEntriesByType('navigation');
|
|
21
|
+
if (navigationEntry) {
|
|
22
|
+
return getModernNavigationType(navigationEntry.type);
|
|
23
|
+
}
|
|
24
|
+
if (performance.navigation?.type !== undefined) {
|
|
25
|
+
return getLegacyNavigationType(performance.navigation.type);
|
|
26
|
+
}
|
|
27
|
+
return 'unknown';
|
|
28
|
+
};
|
|
29
|
+
export { getNavigationType };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getNavigationType } from '../../utils/get-navigation-type.js';
|
|
2
|
+
export const buildLegacyViewArticleEvent = (inputProperties) => ({
|
|
3
|
+
...inputProperties,
|
|
4
|
+
object: Promise.resolve(inputProperties.object).then((objectProperties) => {
|
|
5
|
+
const { articleId, ...rest } = objectProperties;
|
|
6
|
+
return {
|
|
7
|
+
...rest,
|
|
8
|
+
id: articleId,
|
|
9
|
+
navigationType: getNavigationType(),
|
|
10
|
+
type: 'Article',
|
|
11
|
+
contentId: articleId,
|
|
12
|
+
url: window.location.href,
|
|
13
|
+
};
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getNavigationType } from '../../utils/get-navigation-type.js';
|
|
2
|
+
export const buildLegacyViewFrontpageEvent = (inputProperties) => ({
|
|
3
|
+
...inputProperties,
|
|
4
|
+
object: Promise.resolve(inputProperties.object).then((objectProperties) => {
|
|
5
|
+
return {
|
|
6
|
+
...objectProperties,
|
|
7
|
+
navigationType: getNavigationType(),
|
|
8
|
+
type: 'Frontpage',
|
|
9
|
+
url: window.location.href,
|
|
10
|
+
};
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getNavigationType } from '../../utils/get-navigation-type.js';
|
|
2
|
+
export const buildLegacyViewListingEvent = (inputProperties) => ({
|
|
3
|
+
...inputProperties,
|
|
4
|
+
object: Promise.resolve(inputProperties.object).then((objectProperties) => ({
|
|
5
|
+
...objectProperties,
|
|
6
|
+
navigationType: getNavigationType(),
|
|
7
|
+
type: 'Listing',
|
|
8
|
+
url: window.location.href,
|
|
9
|
+
})),
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getNavigationType } from '../../utils/get-navigation-type.js';
|
|
2
|
+
export const buildLegacyViewPageEvent = (inputProperties) => ({
|
|
3
|
+
...inputProperties,
|
|
4
|
+
object: Promise.resolve(inputProperties.object).then((objectProperties) => {
|
|
5
|
+
const { pageId, ...rest } = objectProperties;
|
|
6
|
+
return {
|
|
7
|
+
...rest,
|
|
8
|
+
id: pageId,
|
|
9
|
+
navigationType: getNavigationType(),
|
|
10
|
+
type: 'Page',
|
|
11
|
+
url: window.location.href,
|
|
12
|
+
};
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getNavigationType } from '../../utils/get-navigation-type.js';
|
|
2
|
+
export const buildViewSalesPosterEvent = (inputProperties) => ({
|
|
3
|
+
...inputProperties,
|
|
4
|
+
object: Promise.resolve(inputProperties.object).then((objectProperties) => {
|
|
5
|
+
const { articleId, ...rest } = objectProperties;
|
|
6
|
+
return {
|
|
7
|
+
...rest,
|
|
8
|
+
id: articleId,
|
|
9
|
+
navigationType: getNavigationType(),
|
|
10
|
+
type: 'SalesPoster',
|
|
11
|
+
url: window.location.href,
|
|
12
|
+
};
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getNavigationType } from '../../utils/get-navigation-type.js';
|
|
2
|
+
export const buildLegacyViewUIElementEvent = (inputProperties, currentPage) => ({
|
|
3
|
+
...inputProperties,
|
|
4
|
+
object: Promise.all([inputProperties.object, currentPage]).then(([objectProperties, page]) => ({
|
|
5
|
+
page,
|
|
6
|
+
...objectProperties,
|
|
7
|
+
navigationType: getNavigationType(),
|
|
8
|
+
type: 'UIElement',
|
|
9
|
+
url: window.location.href,
|
|
10
|
+
})),
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|