@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,50 @@
|
|
|
1
|
+
import * as storage from './storage';
|
|
2
|
+
const pulseStorageKeys = {
|
|
3
|
+
PULSE_PPID_STORAGE_KEY: '_pulse.internal.identity.ppid',
|
|
4
|
+
PULSE_CIS_CACHE_STORAGE_KEY: '_pulse.internal.identity.cis',
|
|
5
|
+
};
|
|
6
|
+
const getPPIDsFromStorage = () => {
|
|
7
|
+
try {
|
|
8
|
+
const webStorage = storage.getStorage();
|
|
9
|
+
return JSON.parse(webStorage.getItem(pulseStorageKeys.PULSE_PPID_STORAGE_KEY) ?? '');
|
|
10
|
+
}
|
|
11
|
+
catch (_err) {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const setPPIDsToStorage = (ppid) => {
|
|
16
|
+
try {
|
|
17
|
+
const webStorage = storage.getStorage();
|
|
18
|
+
webStorage.setItem(pulseStorageKeys.PULSE_PPID_STORAGE_KEY, JSON.stringify(ppid));
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
catch (_err) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const getCisCacheFromStorage = () => {
|
|
26
|
+
try {
|
|
27
|
+
const webStorage = storage.getStorage();
|
|
28
|
+
return JSON.parse(webStorage.getItem(pulseStorageKeys.PULSE_CIS_CACHE_STORAGE_KEY) ?? '');
|
|
29
|
+
}
|
|
30
|
+
catch (_err) {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const setCisCacheToStorage = (cisPayload) => {
|
|
35
|
+
try {
|
|
36
|
+
const webStorage = storage.getStorage();
|
|
37
|
+
webStorage.setItem(pulseStorageKeys.PULSE_CIS_CACHE_STORAGE_KEY, JSON.stringify(cisPayload));
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
catch (_err) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
export default {
|
|
45
|
+
getCisCacheFromStorage,
|
|
46
|
+
setCisCacheToStorage,
|
|
47
|
+
getPPIDsFromStorage,
|
|
48
|
+
setPPIDsToStorage,
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=pulseStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pulseStorage.js","sourceRoot":"","sources":["../../../src/storage/pulseStorage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAkCrC,MAAM,gBAAgB,GAAG;IACvB,sBAAsB,EAAE,+BAA+B;IACvD,2BAA2B,EAAE,8BAA8B;CAC5D,CAAC;AAEF,MAAM,mBAAmB,GAAG,GAA2B,EAAE;IACvD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,IAAI,EAAE,CAAC,CAAC;IACvF,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,IAA4B,EAAW,EAAE;IAClE,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACxC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,GAAa,EAAE;IAC5C,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,2BAA2B,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5F,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,UAAoB,EAAW,EAAE;IAC7D,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACxC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,2BAA2B,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAEF,eAAe;IACb,sBAAsB;IACtB,oBAAoB;IACpB,mBAAmB;IACnB,iBAAiB;CAClB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isBrowser, webApi } from '@schibsted/pulse-utils';
|
|
2
|
+
const getStorage = (storageType = 'localStorage') => {
|
|
3
|
+
const storage = webApi[storageType];
|
|
4
|
+
const getItem = (key) => {
|
|
5
|
+
return isBrowser && storage ? storage.getItem(key) : undefined;
|
|
6
|
+
};
|
|
7
|
+
const setItem = (key, value) => {
|
|
8
|
+
if (isBrowser && storage)
|
|
9
|
+
storage.setItem(key, value);
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
getItem,
|
|
13
|
+
setItem,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export { getStorage };
|
|
17
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/storage/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE7E,MAAM,UAAU,GAAG,CAAC,cAA2B,cAAc,EAAE,EAAE;IAC/D,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;IAEpC,MAAM,OAAO,GAAG,CAAC,GAAW,EAA6B,EAAE;QACzD,OAAO,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjE,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,KAAa,EAAQ,EAAE;QACnD,IAAI,SAAS,IAAI,OAAO;YAAE,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC,CAAC;IAEF,OAAO;QACL,OAAO;QACP,OAAO;KACR,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
3
|
+
*/
|
|
4
|
+
export type AdvertisingVendor = 'xandr' | 'delta' | 'adform' | (string & {});
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
7
|
+
*/
|
|
8
|
+
type PPIDs = {
|
|
9
|
+
ppId1?: string;
|
|
10
|
+
ppId2: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
14
|
+
*/
|
|
15
|
+
export type PPIDsByVendor = Partial<Record<AdvertisingVendor, PPIDs>>;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
18
|
+
*/
|
|
19
|
+
export type AdvertisingIdentifiers = PPIDsByVendor & {
|
|
20
|
+
xandr?: PPIDs & {
|
|
21
|
+
adId?: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PulseStorage } from './storage/pulseStorage';
|
|
2
|
+
import type { AdvertisingVendor } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Sync with CIS
|
|
5
|
+
*
|
|
6
|
+
* This method deals with all communication and communication with dependent systems (currently AppNexus and Norstat).
|
|
7
|
+
*
|
|
8
|
+
* An optional user id should be provided if a tracker have received a logged in state. Providing a new user id
|
|
9
|
+
* (different from a previous user id, serialized to the pulse cookie) will cause a "blocking call" to CIS (the
|
|
10
|
+
* returned promise will not resolve before the communication is done). This is done because CIS could provide new data
|
|
11
|
+
* regarding opt-out.
|
|
12
|
+
*
|
|
13
|
+
* The returned promise will also be blocking if no pulse cookie is found. Pulse requires environmentIds generated
|
|
14
|
+
* server side so one have to wait to be allocated to one.
|
|
15
|
+
*
|
|
16
|
+
* In other context CIS could or could not be called but the returned promise will resolve immediately. If CIS have
|
|
17
|
+
* been called recently there is no point in calling it again. In a different case, if a refresh call to CIS is required
|
|
18
|
+
* it doesn't mean that other systems have to wait of it. Both cases will return a promise that resolves more or less
|
|
19
|
+
* immediately.
|
|
20
|
+
*/
|
|
21
|
+
export declare function syncWithCis(shortUserId?: string, nativeJwe?: string, userServiceLocation?: string, realm?: string, clientId?: string, trackerType?: string, trackerVersion?: string, options?: {
|
|
22
|
+
forceSync: boolean;
|
|
23
|
+
includeAdvertising: boolean;
|
|
24
|
+
trackerId: string;
|
|
25
|
+
vendors?: AdvertisingVendor[];
|
|
26
|
+
}): Promise<PulseStorage>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry point to module on Node.js
|
|
3
|
+
*
|
|
4
|
+
* This **have not been implemented** on Node.js because CIS expects a normal
|
|
5
|
+
* browser environment with cookies.
|
|
6
|
+
*
|
|
7
|
+
* @returns rejected promise
|
|
8
|
+
*/
|
|
9
|
+
import type { PulseStorage } from './storage/pulseStorage';
|
|
10
|
+
export declare function syncWithCis(): Promise<PulseStorage>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type EventType = 'environmentIdSet' | 'jweSet';
|
|
2
|
+
type EventCallback = (event: string) => void;
|
|
3
|
+
export default class EventEmitter {
|
|
4
|
+
events: {
|
|
5
|
+
[key: string]: unknown[];
|
|
6
|
+
};
|
|
7
|
+
constructor();
|
|
8
|
+
on(event: EventType, callback: EventCallback): void;
|
|
9
|
+
off(event: EventType, callback: EventCallback): void;
|
|
10
|
+
removeListener(event: EventType, callback: EventCallback): void;
|
|
11
|
+
removeAllListeners(): void;
|
|
12
|
+
emit(event: EventType, value: string): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { syncWithCis } from './cis';
|
|
2
|
+
export { clearCookieAdvertisingIds, clearCookieJweIfStale, eventEmitter, parsePulseCookies, resetRefreshAfter, } from './pulse-cookie';
|
|
3
|
+
export type { PulseCookie, PulseStorage } from './storage/pulseStorage';
|
|
4
|
+
export type { AdvertisingIdentifiers, AdvertisingVendor, PPIDsByVendor } from './types';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import EventEmitter from './eventEmitter';
|
|
2
|
+
import type { PulseStorage } from './storage/pulseStorage';
|
|
3
|
+
import type { AdvertisingVendor } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Responsible for subscribing to, and emitting events.
|
|
6
|
+
*/
|
|
7
|
+
export declare const eventEmitter: EventEmitter;
|
|
8
|
+
export declare function cacheOldEnvironmentId(id: string): void;
|
|
9
|
+
export declare function parsePulseCookies(cookie?: string): PulseStorage;
|
|
10
|
+
export declare function serializePulseCookie(input?: PulseStorage): void;
|
|
11
|
+
export declare enum CisSyncReason {
|
|
12
|
+
Initialise = "initialise",
|
|
13
|
+
Login = "login",
|
|
14
|
+
Logout = "logout",
|
|
15
|
+
Refresh = "refresh",
|
|
16
|
+
includeAdvertisingChange = "includeAdvertisingChange"
|
|
17
|
+
}
|
|
18
|
+
export type SyncState = {
|
|
19
|
+
syncWithCis: boolean;
|
|
20
|
+
waitForCis?: boolean;
|
|
21
|
+
syncWithCisReason?: CisSyncReason;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Clears all relevant advertisement identifiers from cookie storage, returning the new storage state
|
|
25
|
+
* @returns {PulseCookie}
|
|
26
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
27
|
+
*/
|
|
28
|
+
export declare function clearCookieAdvertisingIds(): PulseStorage;
|
|
29
|
+
/**
|
|
30
|
+
* Runs actions related to a new JWE, divergent from the one persisted in the browser storage
|
|
31
|
+
* @param jwe
|
|
32
|
+
*
|
|
33
|
+
* @privateRemarks
|
|
34
|
+
* if there is no jwe, or in other words, no nativeJwe was provided in config, no action will be taken. That's the
|
|
35
|
+
* behaviour with plain Web applications. The scenario not covered here is when we do have a hybrid app, and they don't
|
|
36
|
+
* send any nativeJwe in config.
|
|
37
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
38
|
+
*/
|
|
39
|
+
export declare function clearCookieJweIfStale(jwe?: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Runs actions related to a new JWE, divergent from the one persisted in the browser storage
|
|
42
|
+
* @param refreshAfterDateTime
|
|
43
|
+
*/
|
|
44
|
+
export declare function resetRefreshAfter(refreshAfterDateTime?: Date): PulseStorage;
|
|
45
|
+
/**
|
|
46
|
+
* Determines whether CIS should be called to update identity values.
|
|
47
|
+
* @param userId
|
|
48
|
+
* @param options
|
|
49
|
+
* @returns {SyncState}
|
|
50
|
+
*/
|
|
51
|
+
export declare function getSyncState(userId?: string | number, options?: {
|
|
52
|
+
cookie?: string;
|
|
53
|
+
includeAdvertising?: boolean;
|
|
54
|
+
vendors?: AdvertisingVendor[];
|
|
55
|
+
}): SyncState;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AdvertisingIdentifiers, PPIDsByVendor } from '../types';
|
|
2
|
+
export type PulseCookie = {
|
|
3
|
+
environmentId: string;
|
|
4
|
+
prevUserId?: string;
|
|
5
|
+
refreshAfterTimestamp?: number;
|
|
6
|
+
jwe: string;
|
|
7
|
+
anId?: string;
|
|
8
|
+
syncWithAppNexus?: number;
|
|
9
|
+
doTracking?: boolean;
|
|
10
|
+
pixelInjected?: boolean;
|
|
11
|
+
adId: string;
|
|
12
|
+
altEnvIds?: string[];
|
|
13
|
+
visitorIdPlaceholder?: string;
|
|
14
|
+
};
|
|
15
|
+
type PPID = {
|
|
16
|
+
ppId: PPIDsByVendor;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Defines properties from the CIS response that are persisted as state/cache in the browser.
|
|
20
|
+
*
|
|
21
|
+
* @privateRemarks
|
|
22
|
+
* Only "includeAdvertising" is considered now for this increment. Some work needs to be done to redefine the role of
|
|
23
|
+
* "_pulse2data" cookie, and the impact of caching more things to "avoid state mismatch between components" (namely CIS,
|
|
24
|
+
* PulseSDK, SchibstedAccount and CMP).
|
|
25
|
+
*/
|
|
26
|
+
export type CisCache = {
|
|
27
|
+
includeAdvertising?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export type PulseStorage = PulseCookie & PPID & CisCache;
|
|
30
|
+
declare const _default: {
|
|
31
|
+
getCisCacheFromStorage: () => CisCache;
|
|
32
|
+
setCisCacheToStorage: (cisPayload: CisCache) => boolean;
|
|
33
|
+
getPPIDsFromStorage: () => AdvertisingIdentifiers;
|
|
34
|
+
setPPIDsToStorage: (ppid: AdvertisingIdentifiers) => boolean;
|
|
35
|
+
};
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
3
|
+
*/
|
|
4
|
+
export type AdvertisingVendor = 'xandr' | 'delta' | 'adform' | (string & {});
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
7
|
+
*/
|
|
8
|
+
type PPIDs = {
|
|
9
|
+
ppId1?: string;
|
|
10
|
+
ppId2: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
14
|
+
*/
|
|
15
|
+
export type PPIDsByVendor = Partial<Record<AdvertisingVendor, PPIDs>>;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Advertising Identifiers methods will be removed in the next major version.
|
|
18
|
+
*/
|
|
19
|
+
export type AdvertisingIdentifiers = PPIDsByVendor & {
|
|
20
|
+
xandr?: PPIDs & {
|
|
21
|
+
adId?: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@schibsted/pulse-cis-sync",
|
|
3
|
+
"version": "2.0.18",
|
|
4
|
+
"author": "Schibsted Data&Tech",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://schibsted.ghe.com/data-platform/pulse-sdk-js.git",
|
|
9
|
+
"directory": "workspaces/cis-sync"
|
|
10
|
+
},
|
|
11
|
+
"main": "dist/cjs/index.js",
|
|
12
|
+
"module": "dist/ejs/index.js",
|
|
13
|
+
"types": "./dist/types/index.d.ts",
|
|
14
|
+
"browser": {
|
|
15
|
+
"./dist/cjs/cis.js": "./dist/cjs/cis-browser.js",
|
|
16
|
+
"./dist/ejs/cis.js": "./dist/ejs/cis-browser.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@schibsted/pulse-utils": "workspace:*",
|
|
23
|
+
"loglevel": "1.9.2"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "24.10.13",
|
|
27
|
+
"typescript": "5.9.3"
|
|
28
|
+
},
|
|
29
|
+
"bundledDependencies": [
|
|
30
|
+
"@schibsted/pulse-utils"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "pnpm run build:ejs && pnpm run build:cjs && pnpm run build:types",
|
|
34
|
+
"build:clean": "rm -rf dist/",
|
|
35
|
+
"build:ejs": "tsc --project tsconfig.ejs.json",
|
|
36
|
+
"build:cjs": "tsc",
|
|
37
|
+
"build:types": "tsc --project tsconfig.types.json",
|
|
38
|
+
"dev": "tsc --watch",
|
|
39
|
+
"test": "pnpm run test:lint && pnpm run test:unit",
|
|
40
|
+
"test:lint": "biome check",
|
|
41
|
+
"test:lint:fix": "biome check --write",
|
|
42
|
+
"test:unit": "vitest run"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cookieConfig = void 0;
|
|
4
|
+
exports.cookieConfig = {
|
|
5
|
+
PULSE_COOKIE_KEY: '_pulse2data',
|
|
6
|
+
TEST_COOKIE_KEY: '_pulse2test',
|
|
7
|
+
ENV_COOKIE_KEY: '_pulse2env',
|
|
8
|
+
USE_SECURE_COOKIES: true,
|
|
9
|
+
USE_LOCALSTORAGE: false,
|
|
10
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readCookie = readCookie;
|
|
4
|
+
exports.writeCookie = writeCookie;
|
|
5
|
+
exports.deleteCookie = deleteCookie;
|
|
6
|
+
const cookie_config_1 = require("./cookie-config");
|
|
7
|
+
const webApi_1 = require("./webApi");
|
|
8
|
+
const { USE_SECURE_COOKIES, USE_LOCALSTORAGE } = cookie_config_1.cookieConfig;
|
|
9
|
+
/**
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
function getExpiryDate(expiresInDays = 1) {
|
|
13
|
+
const expireTimestamp = Date.now() + expiresInDays * 1000 * 60 * 60 * 24;
|
|
14
|
+
return new Date(expireTimestamp);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Read a cookie from localStorage or document.cookie.
|
|
18
|
+
*/
|
|
19
|
+
function readCookie(key, useLocalStorage = USE_LOCALSTORAGE) {
|
|
20
|
+
if (!webApi_1.isBrowser) {
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
if (useLocalStorage) {
|
|
24
|
+
const fromLocalStorage = localStorage.getItem(key) || '';
|
|
25
|
+
if (fromLocalStorage) {
|
|
26
|
+
return fromLocalStorage;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return decodeURIComponent(document.cookie.replace(new RegExp(`(?:(?:^|.*;)\\s*${encodeURIComponent(key).replace(/[-.+*]/g, '\\$&')}\\s*\\=\\s*([^;]*).*$)|^.*$`), '$1'));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Write a cookie to document.cookie and/or localStorage
|
|
33
|
+
*
|
|
34
|
+
* @param key The key for the cookie
|
|
35
|
+
* @param value The value for the cookie
|
|
36
|
+
* @param domain The domain for the cookie. You might want to use `getRootDomain()`
|
|
37
|
+
* for this to set the cookie at the "best" domain.
|
|
38
|
+
* @param expiresInDays The number of days until the cookie should expire. Defaults to 1.
|
|
39
|
+
* @param useLocalStorage Whether to use localStorage *in addition* to setting a cookie.
|
|
40
|
+
* Note that localStorage has the specific origin of the current window.location, so
|
|
41
|
+
* if you set `domain` to something more general, then other subdomains will not be able
|
|
42
|
+
* to read back from the same localStorage, but will be able to read back the cookie only.
|
|
43
|
+
* @param useSecureCookies Whether to write that have SameSite=None and Secure set. You usually want this.
|
|
44
|
+
*/
|
|
45
|
+
function writeCookie(key, value, domain, expiresInDays = 1, useLocalStorage = USE_LOCALSTORAGE, useSecureCookies = USE_SECURE_COOKIES) {
|
|
46
|
+
if (webApi_1.isBrowser) {
|
|
47
|
+
const expires = getExpiryDate(expiresInDays).toUTCString();
|
|
48
|
+
let cookieString;
|
|
49
|
+
cookieString = `${key}=${encodeURIComponent(value)}`;
|
|
50
|
+
cookieString += ';path=/';
|
|
51
|
+
if (domain) {
|
|
52
|
+
cookieString += `;domain=${domain}`;
|
|
53
|
+
}
|
|
54
|
+
if (expiresInDays) {
|
|
55
|
+
cookieString += `;expires=${expires}`;
|
|
56
|
+
}
|
|
57
|
+
if (useSecureCookies &&
|
|
58
|
+
window.location.protocol === 'https:' &&
|
|
59
|
+
// 20200303
|
|
60
|
+
// This only detects safari on desktop
|
|
61
|
+
// (already fixed)
|
|
62
|
+
// https://bugs.webkit.org/show_bug.cgi?id=198181
|
|
63
|
+
// TODO: Remove this when market share with this
|
|
64
|
+
// bug is low.. maybe 2020-08-ish.
|
|
65
|
+
// biome-ignore lint/suspicious/noExplicitAny: -
|
|
66
|
+
window.safari === undefined) {
|
|
67
|
+
cookieString += ';SameSite=None;Secure';
|
|
68
|
+
}
|
|
69
|
+
// biome-ignore lint/suspicious/noDocumentCookie: -
|
|
70
|
+
document.cookie = cookieString;
|
|
71
|
+
if (useLocalStorage) {
|
|
72
|
+
if (value === '') {
|
|
73
|
+
localStorage.removeItem(key);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
localStorage.setItem(key, value);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Delete a cookie
|
|
83
|
+
*/
|
|
84
|
+
function deleteCookie(key, domain) {
|
|
85
|
+
writeCookie(key, '', domain, -1);
|
|
86
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.evaluateEventInput = evaluateEventInput;
|
|
4
|
+
exports.evaluateAndFlatten = evaluateAndFlatten;
|
|
5
|
+
exports.deviceType = deviceType;
|
|
6
|
+
exports.dateTime = dateTime;
|
|
7
|
+
const merge_1 = require("./merge");
|
|
8
|
+
const objects_1 = require("./objects");
|
|
9
|
+
/**
|
|
10
|
+
* @recursive
|
|
11
|
+
* @param eventInput
|
|
12
|
+
*/
|
|
13
|
+
async function evaluateEventInput(eventInput) {
|
|
14
|
+
if ((0, objects_1.isPromise)(eventInput)) {
|
|
15
|
+
return evaluateEventInput(await eventInput);
|
|
16
|
+
}
|
|
17
|
+
if (Array.isArray(eventInput)) {
|
|
18
|
+
return Promise.all(eventInput.map(evaluateEventInput));
|
|
19
|
+
}
|
|
20
|
+
if ((0, objects_1.isFunction)(eventInput)) {
|
|
21
|
+
return evaluateEventInput(eventInput());
|
|
22
|
+
}
|
|
23
|
+
if ((0, objects_1.isObject)(eventInput)) {
|
|
24
|
+
const eventKeys = Object.getOwnPropertyNames(eventInput);
|
|
25
|
+
const evaluatedEventKeys = eventKeys.reduce((acc, key) => {
|
|
26
|
+
const eventInputProperty = eventInput[key];
|
|
27
|
+
if ((0, objects_1.isObject)(eventInputProperty) || (0, objects_1.isFunction)(eventInputProperty) || (0, objects_1.isPromise)(eventInputProperty)) {
|
|
28
|
+
return acc.concat(evaluateEventInput(eventInputProperty));
|
|
29
|
+
}
|
|
30
|
+
return acc.concat([eventInputProperty]);
|
|
31
|
+
}, []);
|
|
32
|
+
const resolvedEventKeys = await Promise.all(evaluatedEventKeys);
|
|
33
|
+
return resolvedEventKeys.reduce((evaluatedEventInput, resolvedEventKey, index) => (0, merge_1.pulseMerge)(evaluatedEventInput, { [eventKeys[index]]: resolvedEventKey }), {});
|
|
34
|
+
}
|
|
35
|
+
return eventInput;
|
|
36
|
+
}
|
|
37
|
+
async function evaluateAndFlatten(builder) {
|
|
38
|
+
const builders = Array.isArray(builder) ? builder : [builder];
|
|
39
|
+
const results = await Promise.all(builders.map(evaluateEventInput));
|
|
40
|
+
return (0, merge_1.pulseMerge)({}, ...results.filter(objects_1.isObject));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Function for getting device type taken from the old SDK. It performs as well
|
|
44
|
+
* as one could expect from the size. It could be replaced with 'ua-parser-js'
|
|
45
|
+
* at the cost of 11kb minimized.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} userAgent
|
|
48
|
+
*
|
|
49
|
+
* @returns {string} the device type the user is using
|
|
50
|
+
*/
|
|
51
|
+
function deviceType(userAgent) {
|
|
52
|
+
const knownDevices = {
|
|
53
|
+
mobile: [
|
|
54
|
+
/iPhone;/,
|
|
55
|
+
/iPod;/,
|
|
56
|
+
/iPod touch;/,
|
|
57
|
+
/^HTC/,
|
|
58
|
+
/Fennec/,
|
|
59
|
+
/IEMobile/,
|
|
60
|
+
/BB10;/,
|
|
61
|
+
/BlackBerry/,
|
|
62
|
+
/SymbianOS.*AppleWebKit/,
|
|
63
|
+
/^Mozilla.*Mobile.*Firefox/,
|
|
64
|
+
/^Mozilla.*Chrome.*Mobile/,
|
|
65
|
+
/Opera Mobi/,
|
|
66
|
+
/Android.*Mobile/,
|
|
67
|
+
/Android.*Mini/,
|
|
68
|
+
/Symbian/,
|
|
69
|
+
/^SonyEricsson/,
|
|
70
|
+
/^Nokia/,
|
|
71
|
+
/^SAMSUNG/,
|
|
72
|
+
/^LG/,
|
|
73
|
+
],
|
|
74
|
+
tablet: [/iPad/, /Android/],
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Hermes' apps (Shared app-platform for media) return "Hermes"&"_app_" as part of the user-agent
|
|
78
|
+
* Example UA: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6)
|
|
79
|
+
* AppleWebKit/605.1.15 (KHTML, like Gecko) iOS AP Hermes/64.0.0 _app_`
|
|
80
|
+
* @returns {boolean} Returns true if the user is inside the app.
|
|
81
|
+
*/
|
|
82
|
+
function isHermesApp() {
|
|
83
|
+
return userAgent.search(/Hermes.*_app_/) !== -1;
|
|
84
|
+
}
|
|
85
|
+
function isDeviceIn(devicesList) {
|
|
86
|
+
for (let i = 0; i < devicesList.length; i += 1) {
|
|
87
|
+
if (devicesList[i].test(userAgent)) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
if (userAgent) {
|
|
94
|
+
if (isDeviceIn(knownDevices.mobile)) {
|
|
95
|
+
return 'mobile';
|
|
96
|
+
}
|
|
97
|
+
if (isDeviceIn(knownDevices.tablet)) {
|
|
98
|
+
return 'tablet';
|
|
99
|
+
}
|
|
100
|
+
if (isHermesApp()) {
|
|
101
|
+
// If not a detected device but inside app it's most likely a tablet masking itself as desktop
|
|
102
|
+
return 'tablet';
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return 'desktop';
|
|
106
|
+
}
|
|
107
|
+
function dateTime() {
|
|
108
|
+
return new Date().toISOString();
|
|
109
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.get = get;
|
|
4
|
+
const objects_1 = require("./objects");
|
|
5
|
+
// biome-ignore lint/suspicious/noExplicitAny: -
|
|
6
|
+
function get(object, path, defaultValue) {
|
|
7
|
+
if (!path || !(0, objects_1.isString)(path)) {
|
|
8
|
+
return defaultValue;
|
|
9
|
+
}
|
|
10
|
+
const parts = path.split('.');
|
|
11
|
+
for (const part of parts) {
|
|
12
|
+
if (!object)
|
|
13
|
+
return defaultValue;
|
|
14
|
+
// biome-ignore lint/style/noParameterAssign: -
|
|
15
|
+
object = object[part];
|
|
16
|
+
}
|
|
17
|
+
return object ?? defaultValue;
|
|
18
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRootDomain = exports.resetGetRootDomain = void 0;
|
|
4
|
+
exports.makeGetRootDomainCached = makeGetRootDomainCached;
|
|
5
|
+
const cookie_1 = require("./cookie");
|
|
6
|
+
const cookie_config_1 = require("./cookie-config");
|
|
7
|
+
const randomString_1 = require("./randomString");
|
|
8
|
+
const webApi_1 = require("./webApi");
|
|
9
|
+
const { TEST_COOKIE_KEY } = cookie_config_1.cookieConfig;
|
|
10
|
+
// Exported for testing
|
|
11
|
+
function makeGetRootDomainCached() {
|
|
12
|
+
let cache;
|
|
13
|
+
return () => {
|
|
14
|
+
if (!webApi_1.isBrowser) {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
if (cache) {
|
|
18
|
+
return cache;
|
|
19
|
+
}
|
|
20
|
+
const parts = `${window.location.hostname}`.split('.');
|
|
21
|
+
const testValue = (0, randomString_1.randomString)();
|
|
22
|
+
let domain = window.location.hostname;
|
|
23
|
+
let test = '';
|
|
24
|
+
for (let i = 0; i < parts.length; i += 1) {
|
|
25
|
+
try {
|
|
26
|
+
domain = parts.slice(-(i + 1)).join('.');
|
|
27
|
+
(0, cookie_1.writeCookie)(TEST_COOKIE_KEY, testValue, domain, 1);
|
|
28
|
+
test = (0, cookie_1.readCookie)(TEST_COOKIE_KEY);
|
|
29
|
+
(0, cookie_1.deleteCookie)(TEST_COOKIE_KEY, domain);
|
|
30
|
+
if (test === testValue) {
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (_e) { }
|
|
35
|
+
}
|
|
36
|
+
cache = domain;
|
|
37
|
+
return domain;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const resetGetRootDomain = () => {
|
|
41
|
+
exports.getRootDomain = makeGetRootDomainCached();
|
|
42
|
+
};
|
|
43
|
+
exports.resetGetRootDomain = resetGetRootDomain;
|
|
44
|
+
/**
|
|
45
|
+
* Function for getting the highest cookie domain where a cookie can be placed.
|
|
46
|
+
* This is done by trying to set and then read back a cookie at the tld, and
|
|
47
|
+
* then working downwards.
|
|
48
|
+
*
|
|
49
|
+
* This function is memoized as `window.location.hostname` is supposed to be
|
|
50
|
+
* immutable during the lifetime of the code.
|
|
51
|
+
*
|
|
52
|
+
* @returns {string} the top domain for setting cookies. Example: aftonbladet.se
|
|
53
|
+
*/
|
|
54
|
+
exports.getRootDomain = makeGetRootDomainCached();
|