@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,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const vitest_1 = require("vitest");
|
|
7
|
+
const Tracker_1 = __importDefault(require("./Tracker"));
|
|
8
|
+
const ARTICLE_PAYLOAD = {
|
|
9
|
+
experiments: [
|
|
10
|
+
{
|
|
11
|
+
name: 'test-experiment',
|
|
12
|
+
variant: 'test-variant',
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
object: {
|
|
16
|
+
category: 'abcd',
|
|
17
|
+
objectId: 'page-123',
|
|
18
|
+
objectSdrn: 'sdrn:the-standard:page:page-123',
|
|
19
|
+
tags: ['tag1', 'tag2'],
|
|
20
|
+
title: 'Test Page',
|
|
21
|
+
},
|
|
22
|
+
metrics: [
|
|
23
|
+
{
|
|
24
|
+
key: 'topKScore',
|
|
25
|
+
name: 'topKScore',
|
|
26
|
+
source: 'Curate',
|
|
27
|
+
value: 0,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
page: {
|
|
31
|
+
navigationType: 'Navigate',
|
|
32
|
+
referrer: {
|
|
33
|
+
pageId: 'referrer-page',
|
|
34
|
+
pageType: 'Article',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
provider: {
|
|
38
|
+
component: 'test-component',
|
|
39
|
+
componentVersion: '1.0.0',
|
|
40
|
+
product: 'test-product',
|
|
41
|
+
stage: 'Dev',
|
|
42
|
+
version: '1.0.0',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
const tracker = new Tracker_1.default('test-site', {});
|
|
46
|
+
(0, vitest_1.describe)('Type tests for Tracker', () => {
|
|
47
|
+
(0, vitest_1.it)('should compile without errors', () => {
|
|
48
|
+
tracker.trackViewPage(ARTICLE_PAYLOAD, { leaveTracking: false });
|
|
49
|
+
tracker.trackViewPage(ARTICLE_PAYLOAD, {
|
|
50
|
+
leaveTracking: {
|
|
51
|
+
objectElement: document.body,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
tracker.trackViewPage(ARTICLE_PAYLOAD, {
|
|
55
|
+
leaveTracking: {
|
|
56
|
+
objectElement: document.body,
|
|
57
|
+
pageElement: document.documentElement,
|
|
58
|
+
objectResizable: true,
|
|
59
|
+
heightBuilder: () => ({
|
|
60
|
+
totalHeight: 0,
|
|
61
|
+
viewedHeight: 0,
|
|
62
|
+
}),
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
(0, vitest_1.it)('expects errors because invalid API calls', () => {
|
|
67
|
+
tracker.trackViewPage(ARTICLE_PAYLOAD, {
|
|
68
|
+
// @ts-expect-error we expect an error here because leaveTracking shouldn't be passed as true
|
|
69
|
+
leaveTracking: true,
|
|
70
|
+
});
|
|
71
|
+
// @ts-expect-error we expect an error here because we're missing the second parameter (options)
|
|
72
|
+
tracker.trackViewPage(ARTICLE_PAYLOAD);
|
|
73
|
+
// @ts-expect-error we expect an error here because we're mising leaveTracking options
|
|
74
|
+
tracker.trackViewPage(ARTICLE_PAYLOAD, {});
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getDefaultNativeJwe = getDefaultNativeJwe;
|
|
7
|
+
exports.getDefaultAltHandler = getDefaultAltHandler;
|
|
8
|
+
const pulse_utils_1 = require("@schibsted/pulse-utils");
|
|
9
|
+
const loglevel_1 = __importDefault(require("loglevel"));
|
|
10
|
+
function getDefaultNativeJwe(config) {
|
|
11
|
+
if (config.nativeJwe) {
|
|
12
|
+
loglevel_1.default.debug('Using nativeJwe from config');
|
|
13
|
+
return config.nativeJwe;
|
|
14
|
+
}
|
|
15
|
+
if (!pulse_utils_1.isBrowser) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (!window.__nativeJwe__ && !window.hermesJwe) {
|
|
19
|
+
loglevel_1.default.debug('No __nativeJwe__ or hermesJwe found in window');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Special support for Hybrid apps, using Pulse tracking and/or ad identifiers within a webview
|
|
23
|
+
return window.__nativeJwe__ || window.hermesJwe;
|
|
24
|
+
}
|
|
25
|
+
function getDefaultAltHandler(config) {
|
|
26
|
+
if (config.altEventHandler) {
|
|
27
|
+
loglevel_1.default.debug('Using altEventHandler from config');
|
|
28
|
+
return config.altEventHandler;
|
|
29
|
+
}
|
|
30
|
+
if (!pulse_utils_1.isBrowser) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!window.pulseEventHandler) {
|
|
34
|
+
loglevel_1.default.debug('No pulseEventHandler found in window');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// If the pulse event handler is set, e.g. by a native app in
|
|
38
|
+
// a hybrid app setup, we pick that as the 'altEventHandler'
|
|
39
|
+
return window.pulseEventHandler;
|
|
40
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultValue = void 0;
|
|
4
|
+
exports.generateActorSDRN = generateActorSDRN;
|
|
5
|
+
exports.isActorInput = isActorInput;
|
|
6
|
+
exports.default = actor;
|
|
7
|
+
const pulse_utils_1 = require("@schibsted/pulse-utils");
|
|
8
|
+
/**
|
|
9
|
+
* generateActorSDRN
|
|
10
|
+
* Generates a well-formed sdrn for an actor, based on id, realm inputs
|
|
11
|
+
* @param id String
|
|
12
|
+
* @param realm String Realm is not required, so, without a fully formed "@id" in the actors input object, the "realm"
|
|
13
|
+
* part of the sdrn is flagged with "__REALM_NOT_SET__", for early noticing implementation/integration errors.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
function generateActorSDRN(id, realm = '__REALM_NOT_SET__') {
|
|
17
|
+
const outputId = id || '__USER_ID_NOT_SET__';
|
|
18
|
+
return `sdrn:${realm}:user:${outputId}`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Type guard to check if the input is an ActorInput
|
|
22
|
+
* @param input
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
function isActorInput(input) {
|
|
26
|
+
// biome-ignore lint/suspicious/noPrototypeBuiltins: Object.hasOwn is not available in ES2020
|
|
27
|
+
return (0, pulse_utils_1.isPlainObject)(input) && Object.prototype.hasOwnProperty.call(input, 'actor');
|
|
28
|
+
}
|
|
29
|
+
function formatActorInput(input) {
|
|
30
|
+
if ((0, pulse_utils_1.isString)(input)) {
|
|
31
|
+
return { id: input };
|
|
32
|
+
}
|
|
33
|
+
const { id, realm, ...rest } = input || {};
|
|
34
|
+
return { id, realm, ...rest };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Function to generate a builder for Actor objects.
|
|
38
|
+
*/
|
|
39
|
+
function actor(input) {
|
|
40
|
+
const { actor: actorInput } = input || {};
|
|
41
|
+
if (!actorInput) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const { id, realm, ...inputProps } = formatActorInput(actorInput);
|
|
45
|
+
// TODO: think in ways that a well-formed SDRN passed as @id in the input can render the "id" not necessary anymore.
|
|
46
|
+
if (!id) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const actorSDRN = generateActorSDRN(id, realm);
|
|
50
|
+
const baseActor = {
|
|
51
|
+
'@id': actorSDRN,
|
|
52
|
+
'spt:userId': actorSDRN,
|
|
53
|
+
};
|
|
54
|
+
return Object.assign(baseActor, inputProps);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
const defaultValue = () => undefined;
|
|
60
|
+
exports.defaultValue = defaultValue;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getConsentsWaitForAnalytics = exports.consentManager = void 0;
|
|
7
|
+
exports.getFallbackConsents = getFallbackConsents;
|
|
8
|
+
const loglevel_1 = __importDefault(require("loglevel"));
|
|
9
|
+
const consents_1 = require("./consents");
|
|
10
|
+
/**
|
|
11
|
+
* Fallback if TCF fails to initialize
|
|
12
|
+
* These should always be "unknown" since we don't know the user's choice
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
function getFallbackConsents() {
|
|
16
|
+
return {
|
|
17
|
+
purposes: {
|
|
18
|
+
[consents_1.ConsentsCategory.CMP_ADVERTISING]: {
|
|
19
|
+
optIn: false,
|
|
20
|
+
status: 'unknown',
|
|
21
|
+
},
|
|
22
|
+
[consents_1.ConsentsCategory.CMP_ANALYTICS]: {
|
|
23
|
+
optIn: false,
|
|
24
|
+
status: 'unknown',
|
|
25
|
+
},
|
|
26
|
+
[consents_1.ConsentsCategory.CMP_MARKETING]: {
|
|
27
|
+
optIn: false,
|
|
28
|
+
status: 'unknown',
|
|
29
|
+
},
|
|
30
|
+
[consents_1.ConsentsCategory.CMP_PERSONALIZATION]: {
|
|
31
|
+
optIn: false,
|
|
32
|
+
status: 'unknown',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
source: 'default',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns the consent manager (`_tcf_`), if available.
|
|
40
|
+
* It will await "cmp:loaded" event if the consent manager is not available yet and return it when it is.
|
|
41
|
+
* @returns The consent manager object.
|
|
42
|
+
* @example
|
|
43
|
+
* const manager = await consentManager();
|
|
44
|
+
*/
|
|
45
|
+
const consentManager = () => {
|
|
46
|
+
// For ConsentManager/window._tcf_ type, either duck type something yourself for now or wait for better types to be exposed from sourcepoint package.
|
|
47
|
+
const getManager = () => window._tcf_;
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
const manager = getManager();
|
|
50
|
+
if (manager) {
|
|
51
|
+
resolve(manager);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
let hasTimedOut = false;
|
|
55
|
+
const timeoutForManager = setTimeout(() => {
|
|
56
|
+
loglevel_1.default.error('Pulse - timed out waiting for consentManager');
|
|
57
|
+
hasTimedOut = true;
|
|
58
|
+
reject(new Error('Pulse - timed out waiting for consentManager'));
|
|
59
|
+
}, 5000);
|
|
60
|
+
document.addEventListener('cmp:loaded', () => {
|
|
61
|
+
if (hasTimedOut) {
|
|
62
|
+
loglevel_1.default.error('Pulse - consentManager triggered after timeout');
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
clearTimeout(timeoutForManager);
|
|
66
|
+
resolve(getManager());
|
|
67
|
+
}, {
|
|
68
|
+
once: true,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
exports.consentManager = consentManager;
|
|
74
|
+
/**
|
|
75
|
+
* Waits for user to reply to consents, then retrieves the cached or default consents for Pulse from the consent manager.
|
|
76
|
+
* Only needed if you want to wait for user to respond to consents rather than sending events with default consent
|
|
77
|
+
* WARNING: Do not use this without analytics consent being activated in TCF or it will never resolve for users without cached consents!
|
|
78
|
+
* @returns A promise with the cached or default consents for Pulse.
|
|
79
|
+
* @example
|
|
80
|
+
* const getConsentsWaitForAnalyticsPromise = getConsentsWaitForAnalytics();
|
|
81
|
+
*/
|
|
82
|
+
const getConsentsWaitForAnalytics = async (callback) => {
|
|
83
|
+
const consents = await getInitialConsentsFromTCF();
|
|
84
|
+
// no need to subscribe if we don't receive a callback to call
|
|
85
|
+
if (callback) {
|
|
86
|
+
await subscribeToConsentUpdates(callback);
|
|
87
|
+
}
|
|
88
|
+
return consents;
|
|
89
|
+
};
|
|
90
|
+
exports.getConsentsWaitForAnalytics = getConsentsWaitForAnalytics;
|
|
91
|
+
const subscribeToConsentUpdates = async (callback) => {
|
|
92
|
+
let manager;
|
|
93
|
+
try {
|
|
94
|
+
manager = await (0, exports.consentManager)();
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
loglevel_1.default.error('Unable to subscribe as tcf manager is not initialized', error);
|
|
98
|
+
// If we can't get the consent manager, we can't subscribe to updates
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
manager.subscribeAny(() => {
|
|
102
|
+
const consents = manager.getCachedOrDefaultConsentsForPulse();
|
|
103
|
+
loglevel_1.default.debug('CMP:subscribeToConsentUpdates:subscribeAny - resolved after user replied to consent dialog', consents);
|
|
104
|
+
callback(consents);
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
const getInitialConsentsFromTCF = async () => {
|
|
108
|
+
let manager;
|
|
109
|
+
try {
|
|
110
|
+
manager = await (0, exports.consentManager)();
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
loglevel_1.default.error('Failed to get consent manager, using pulse default consents', error);
|
|
114
|
+
return getFallbackConsents();
|
|
115
|
+
}
|
|
116
|
+
// Check if analytics consent exists in cache.
|
|
117
|
+
const analyticsConsent = manager.getPermissionSync('CMP:analytics');
|
|
118
|
+
// null analyticsConsent means that the user has not yet replied to the consent dialog.
|
|
119
|
+
if (analyticsConsent === null) {
|
|
120
|
+
// Wait for the user to reply to the consent dialog.
|
|
121
|
+
return new Promise((resolve) => {
|
|
122
|
+
// Need to use subscribeAny since that is the only one resolving after all consents are properly set initially
|
|
123
|
+
const unsubscribe = manager.subscribeAny(() => {
|
|
124
|
+
loglevel_1.default.debug('CMP:getConsentsWaitForAnalytics - resolved after user replied to consent dialog');
|
|
125
|
+
resolve(manager.getCachedOrDefaultConsentsForPulse());
|
|
126
|
+
unsubscribe();
|
|
127
|
+
});
|
|
128
|
+
return;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
// If we have consent in cache or do not need to wait, return the consents immediately.
|
|
132
|
+
loglevel_1.default.debug('CMP:getConsentsWaitForAnalytics - resolved immediately');
|
|
133
|
+
return manager.getCachedOrDefaultConsentsForPulse();
|
|
134
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ConsentsPurposeCategoryStatusValues = exports.ConsentsSourceValues = exports.ConsentsCategory = void 0;
|
|
7
|
+
exports.applyAdvertisingConsent = applyAdvertisingConsent;
|
|
8
|
+
exports.applyAdvertisingConsentSync = applyAdvertisingConsentSync;
|
|
9
|
+
exports.resolveIncludeAdvertising = resolveIncludeAdvertising;
|
|
10
|
+
exports.resolveIncludeAdvertisingSync = resolveIncludeAdvertisingSync;
|
|
11
|
+
exports.default = consents;
|
|
12
|
+
const pulse_cis_sync_1 = require("@schibsted/pulse-cis-sync");
|
|
13
|
+
const pulse_utils_1 = require("@schibsted/pulse-utils");
|
|
14
|
+
const warnOnce_1 = __importDefault(require("../warnOnce"));
|
|
15
|
+
const consent_manager_1 = require("./consent-manager");
|
|
16
|
+
/**
|
|
17
|
+
* @enum ConsentCategory
|
|
18
|
+
*/
|
|
19
|
+
var ConsentsCategory;
|
|
20
|
+
(function (ConsentsCategory) {
|
|
21
|
+
ConsentsCategory["CMP_ANALYTICS"] = "CMP_ANALYTICS";
|
|
22
|
+
ConsentsCategory["CMP_MARKETING"] = "CMP_MARKETING";
|
|
23
|
+
ConsentsCategory["CMP_ADVERTISING"] = "CMP_ADVERTISING";
|
|
24
|
+
ConsentsCategory["CMP_PERSONALIZATION"] = "CMP_PERSONALIZATION";
|
|
25
|
+
})(ConsentsCategory || (exports.ConsentsCategory = ConsentsCategory = {}));
|
|
26
|
+
exports.ConsentsSourceValues = ['default', 'cmp', 'cache'];
|
|
27
|
+
exports.ConsentsPurposeCategoryStatusValues = ['accepted', 'rejected', 'unknown'];
|
|
28
|
+
const isLegacyConsentsPurpose = (consentsPurposeCategory) => {
|
|
29
|
+
return !consentsPurposeCategory?.status;
|
|
30
|
+
};
|
|
31
|
+
const isLegacyConsents = (consents) => {
|
|
32
|
+
return !!(consents &&
|
|
33
|
+
!(0, pulse_utils_1.isPromise)(consents) &&
|
|
34
|
+
consents?.purposes &&
|
|
35
|
+
Object.values(consents.purposes).every((purpose) => isLegacyConsentsPurpose(purpose)));
|
|
36
|
+
};
|
|
37
|
+
const NO_CONSENT_IN_CONFIG = 'Invalid consents passed to the Pulse SDK. "requireAdvertisingOptIn" and no "consents" config param present.';
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @param consents
|
|
41
|
+
* @param requireAdvertisingOptIn
|
|
42
|
+
* @returns The resolved consents and whether advertising is allowed
|
|
43
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
async function applyAdvertisingConsent(consents, requireAdvertisingOptIn) {
|
|
47
|
+
if (!consents && typeof requireAdvertisingOptIn !== 'undefined' && requireAdvertisingOptIn !== undefined) {
|
|
48
|
+
(0, warnOnce_1.default)('NO_CONSENT_IN_CONFIG', NO_CONSENT_IN_CONFIG);
|
|
49
|
+
}
|
|
50
|
+
const includeAdvertising = await resolveIncludeAdvertising(consents, requireAdvertisingOptIn);
|
|
51
|
+
if (!includeAdvertising) {
|
|
52
|
+
(0, pulse_cis_sync_1.clearCookieAdvertisingIds)();
|
|
53
|
+
}
|
|
54
|
+
return includeAdvertising;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @param consents
|
|
59
|
+
* @param requireAdvertisingOptIn
|
|
60
|
+
* @returns The resolved consents and whether advertising is allowed
|
|
61
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
function applyAdvertisingConsentSync(consents, requireAdvertisingOptIn) {
|
|
65
|
+
if (!consents && typeof requireAdvertisingOptIn !== 'undefined' && requireAdvertisingOptIn !== undefined) {
|
|
66
|
+
(0, warnOnce_1.default)('NO_CONSENT_IN_CONFIG', NO_CONSENT_IN_CONFIG);
|
|
67
|
+
}
|
|
68
|
+
const includeAdvertising = resolveIncludeAdvertisingSync(consents, requireAdvertisingOptIn);
|
|
69
|
+
if (!includeAdvertising) {
|
|
70
|
+
(0, pulse_cis_sync_1.clearCookieAdvertisingIds)();
|
|
71
|
+
}
|
|
72
|
+
return includeAdvertising;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @param consents
|
|
77
|
+
* @param requireAdvertisingOptIn
|
|
78
|
+
* @returns whether advertising is allowed
|
|
79
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
async function resolveIncludeAdvertising(consents, requireAdvertisingOptIn) {
|
|
83
|
+
const resolvedRequireAdvertisingOptIn = await requireAdvertisingOptIn;
|
|
84
|
+
if (!resolvedRequireAdvertisingOptIn) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
if ((0, pulse_utils_1.isPromise)(consents)) {
|
|
88
|
+
const resolvedConsents = await consents;
|
|
89
|
+
return resolvedConsents?.purposes?.[ConsentsCategory.CMP_ADVERTISING]?.status === 'accepted';
|
|
90
|
+
}
|
|
91
|
+
if (isLegacyConsents(consents)) {
|
|
92
|
+
return Boolean(consents?.purposes?.[ConsentsCategory.CMP_ADVERTISING]?.optIn);
|
|
93
|
+
}
|
|
94
|
+
return consents?.purposes?.[ConsentsCategory.CMP_ADVERTISING]?.status === 'accepted';
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
* @param consents
|
|
99
|
+
* @param requireAdvertisingOptIn
|
|
100
|
+
* @returns whether advertising is allowed
|
|
101
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
function resolveIncludeAdvertisingSync(consents, requireAdvertisingOptIn) {
|
|
105
|
+
if (!requireAdvertisingOptIn) {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
if (isLegacyConsents(consents)) {
|
|
109
|
+
return Boolean(consents?.purposes?.[ConsentsCategory.CMP_ADVERTISING]?.optIn);
|
|
110
|
+
}
|
|
111
|
+
return consents?.purposes?.[ConsentsCategory.CMP_ADVERTISING]?.status === 'accepted';
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Builds a consents object from input.
|
|
115
|
+
* @param input
|
|
116
|
+
*/
|
|
117
|
+
function consents(input) {
|
|
118
|
+
const { consents: consentsInput } = input || {};
|
|
119
|
+
if (!consentsInput) {
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
const purposesInput = consentsInput?.purposes ?? {};
|
|
123
|
+
return {
|
|
124
|
+
purposes: purposes(purposesInput),
|
|
125
|
+
source: consentsInput?.source,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* This can be removed when we no longer fill purposeInput.optIn: boolean based on status string.
|
|
130
|
+
* isConsentsPurposes can be used to return an unmodified consent object.
|
|
131
|
+
* @see https://schibsted.io.atlassian.net/browse/SDP-11907
|
|
132
|
+
* @internal
|
|
133
|
+
*/
|
|
134
|
+
function purposes(purposesInput) {
|
|
135
|
+
const purposesOutput = (0, consent_manager_1.getFallbackConsents)().purposes;
|
|
136
|
+
for (const categoryInput in purposesInput) {
|
|
137
|
+
const consentCategory = categoryInput;
|
|
138
|
+
const purposeInput = purposesInput[consentCategory];
|
|
139
|
+
const isValidCategory = Boolean(purposesOutput[consentCategory]);
|
|
140
|
+
if (!purposeInput || !isValidCategory) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (!isLegacyConsentsPurpose(purposeInput)) {
|
|
144
|
+
purposeInput.optIn || (purposeInput.optIn = purposeInput.status === 'accepted');
|
|
145
|
+
}
|
|
146
|
+
purposesOutput[consentCategory] = purposeInput;
|
|
147
|
+
}
|
|
148
|
+
return purposesOutput;
|
|
149
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.defaultValue = void 0;
|
|
18
|
+
exports.getXEnvironmentId = getXEnvironmentId;
|
|
19
|
+
exports.default = default_1;
|
|
20
|
+
const pulse_cis_sync_1 = require("@schibsted/pulse-cis-sync");
|
|
21
|
+
const pulse_utils_1 = require("@schibsted/pulse-utils");
|
|
22
|
+
const device_node_1 = require("./device-node");
|
|
23
|
+
__exportStar(require("./device-node"), exports);
|
|
24
|
+
function supportsLocalStorage() {
|
|
25
|
+
try {
|
|
26
|
+
const { localStorage } = window;
|
|
27
|
+
localStorage.setItem('pulse4test', 'check');
|
|
28
|
+
localStorage.removeItem('pulse4test');
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
catch (_e) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function getViewportDimensions() {
|
|
36
|
+
if (!pulse_utils_1.isBrowser) {
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
let viewportWidth;
|
|
40
|
+
let viewportHeight;
|
|
41
|
+
const { document } = window;
|
|
42
|
+
if (typeof window.innerWidth !== 'undefined') {
|
|
43
|
+
viewportWidth = window.innerWidth;
|
|
44
|
+
viewportHeight = window.innerHeight;
|
|
45
|
+
}
|
|
46
|
+
else if (typeof document.documentElement.clientWidth !== 'undefined' &&
|
|
47
|
+
document.documentElement.clientWidth !== 0) {
|
|
48
|
+
viewportWidth = document.documentElement.clientWidth;
|
|
49
|
+
viewportHeight = document.documentElement.clientHeight;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
viewportWidth = document.getElementsByTagName('body')[0].clientWidth;
|
|
53
|
+
viewportHeight = document.getElementsByTagName('body')[0].clientHeight;
|
|
54
|
+
}
|
|
55
|
+
return `${viewportWidth}x${viewportHeight}`;
|
|
56
|
+
}
|
|
57
|
+
function getXEnvironmentId() {
|
|
58
|
+
if (!pulse_utils_1.isBrowser) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const urlParams = new URLSearchParams(window?.location?.search ?? '');
|
|
62
|
+
return urlParams.get('x_env_id') || undefined;
|
|
63
|
+
}
|
|
64
|
+
const defaultValue = () => {
|
|
65
|
+
if (!pulse_utils_1.isBrowser) {
|
|
66
|
+
return {};
|
|
67
|
+
}
|
|
68
|
+
const { navigator, screen } = window;
|
|
69
|
+
return {
|
|
70
|
+
acceptLanguage: navigator.userLanguage || navigator.language,
|
|
71
|
+
screenSize: `${screen.width}x${screen.height}`,
|
|
72
|
+
userAgent: navigator.userAgent,
|
|
73
|
+
deviceType: (0, pulse_utils_1.deviceType)(window.navigator.userAgent),
|
|
74
|
+
viewportSize: getViewportDimensions(),
|
|
75
|
+
localStorageEnabled: supportsLocalStorage(),
|
|
76
|
+
xEnvironmentId: getXEnvironmentId(),
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
exports.defaultValue = defaultValue;
|
|
80
|
+
function default_1(input) {
|
|
81
|
+
const { device: deviceInput } = input || {};
|
|
82
|
+
const { environmentId, jwe } = (0, pulse_cis_sync_1.parsePulseCookies)();
|
|
83
|
+
const data = {
|
|
84
|
+
id: environmentId,
|
|
85
|
+
jweIds: jwe,
|
|
86
|
+
...((0, pulse_utils_1.isString)(deviceInput) ? { id: deviceInput } : deviceInput),
|
|
87
|
+
};
|
|
88
|
+
return (0, device_node_1.device)(exports.defaultValue)({ device: data });
|
|
89
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultValue = exports.device = void 0;
|
|
4
|
+
exports.generateEnvironmentSDRN = generateEnvironmentSDRN;
|
|
5
|
+
const pulse_utils_1 = require("@schibsted/pulse-utils");
|
|
6
|
+
/**
|
|
7
|
+
* Generate a well-formed environment SDRN from an ID
|
|
8
|
+
* @param id
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
function generateEnvironmentSDRN(id) {
|
|
12
|
+
return `sdrn:schibsted:environment:${id}`;
|
|
13
|
+
}
|
|
14
|
+
function formatDeviceInput(input) {
|
|
15
|
+
if ((0, pulse_utils_1.isString)(input)) {
|
|
16
|
+
return { id: input };
|
|
17
|
+
}
|
|
18
|
+
const { id, ...rest } = input || {};
|
|
19
|
+
return { id, ...rest };
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generate a device representation
|
|
23
|
+
*
|
|
24
|
+
* Several default values are used in a browser environment: acceptLanguage,
|
|
25
|
+
* screenSize, userAgent, deviceType, viewportSize, localStorageEnabled. See
|
|
26
|
+
* (device-browser.js)[device-browser.js] for implementation details.
|
|
27
|
+
*
|
|
28
|
+
* The browser implementation will also read the required values from the
|
|
29
|
+
* `_pulse2cookie` and if needed sync with CIS. Note that *this is not
|
|
30
|
+
* implemented for Node.js environments*. There are no default values in
|
|
31
|
+
* Node.js.
|
|
32
|
+
*
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
const device = (defaultValueHandler) => (input) => {
|
|
36
|
+
const { device: deviceInput } = input || {};
|
|
37
|
+
if (!deviceInput) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const formattedInput = (0, pulse_utils_1.pulseMerge)({}, defaultValueHandler(), formatDeviceInput(deviceInput));
|
|
41
|
+
const { id, additionalIds, ...props } = formattedInput;
|
|
42
|
+
if (!id) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const baseDevice = {
|
|
46
|
+
'@type': 'Device',
|
|
47
|
+
environmentId: generateEnvironmentSDRN(id),
|
|
48
|
+
};
|
|
49
|
+
if (additionalIds) {
|
|
50
|
+
baseDevice.additionalEnvironmentIds = additionalIds.map(generateEnvironmentSDRN);
|
|
51
|
+
}
|
|
52
|
+
return Object.assign(baseDevice, props);
|
|
53
|
+
};
|
|
54
|
+
exports.device = device;
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
const defaultValue = () => ({});
|
|
59
|
+
exports.defaultValue = defaultValue;
|
|
60
|
+
/**
|
|
61
|
+
* Builder for Device objects.
|
|
62
|
+
*/
|
|
63
|
+
exports.default = (0, exports.device)(exports.defaultValue);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.default = void 0;
|
|
21
|
+
__exportStar(require("./device-node"), exports);
|
|
22
|
+
var device_node_1 = require("./device-node");
|
|
23
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(device_node_1).default; } });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.anonymousTrackerEvent = exports.anonymousEngagementEvent = void 0;
|
|
4
|
+
var events_anonymous_node_1 = require("./events-anonymous-node");
|
|
5
|
+
Object.defineProperty(exports, "anonymousEngagementEvent", { enumerable: true, get: function () { return events_anonymous_node_1.anonymousEngagementEvent; } });
|
|
6
|
+
Object.defineProperty(exports, "anonymousTrackerEvent", { enumerable: true, get: function () { return events_anonymous_node_1.anonymousTrackerEvent; } });
|