Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@esri/telemetry

Package Overview
Dependencies
Maintainers
44
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esri/telemetry - npm Package Compare versions

Comparing version 7.0.5 to 7.0.6

44

dist/esm/index.js

@@ -29,2 +29,6 @@ import sha256 from 'crypto-js/sha256.js';

];
/**
* Telemetry class
* Main entrypoint for the telemetry library
*/
export class Telemetry {

@@ -68,27 +72,21 @@ constructor(options) {

}
shouldInitializeTrackers(userSettings, requireConsent, trackerNames) {
const userHasNotGivenOrDeniedConsent = !requireConsent && !(userSettings === null || userSettings === void 0 ? void 0 : userSettings.accepted);
const userHasAcceptedAllTrackers = trackerNames.every(name => userSettings === null || userSettings === void 0 ? void 0 : userSettings[name]);
return userHasNotGivenOrDeniedConsent || userHasAcceptedAllTrackers;
}
filterTrackers(trackerNames) {
return this.options.plugins.filter(tracker => trackerNames.includes(tracker.name));
}
initializeTrackers() {
const userSettings = this._userPrivacySettings;
// Reset trackers
const requireConsent = this.options.requireConsent;
this.trackers = [];
// Depending on the user settings, we may not want to load all trackers
if (this.options.plugins) {
if (userSettings) {
// ------------------------------------------------------
// Rules:
// if settings.performance: true, we can load the Esri Tracker
// if settings.{performance,targeting,functional}: true, we can load the 3rd party trackers
// ------------------------------------------------------
if (userSettings === null || userSettings === void 0 ? void 0 : userSettings.performance) {
this.trackers.push(...this.options.plugins.filter((tracker) => tracker.name === 'amazon'));
if (this.shouldInitializeTrackers(userSettings, requireConsent, ['performance'])) {
this.trackers.push(...this.filterTrackers(['amazon']));
}
if ((userSettings === null || userSettings === void 0 ? void 0 : userSettings.performance) &&
(userSettings === null || userSettings === void 0 ? void 0 : userSettings.targeting) &&
(userSettings === null || userSettings === void 0 ? void 0 : userSettings.functional)) {
const thirdPartyTrackers = [
'adobe-analytics',
'google',
'googleAnalytics',
'siteimprove',
];
this.trackers.push(...this.options.plugins.filter((tracker) => thirdPartyTrackers.includes(tracker.name)));
if (this.shouldInitializeTrackers(userSettings, requireConsent, ['performance', 'targeting', 'functional'])) {
this.trackers.push(...this.filterTrackers(['adobe-analytics', 'googleAnalytics', 'siteimprove']));
}

@@ -104,3 +102,2 @@ }

// this is likely due to the user privacy settings
// this.logger.error(new Error('No trackers configured'));
this.logger.info('No trackers configured');

@@ -146,7 +143,10 @@ }

async updateUserPrivacySettings(newSettings) {
const { performance, targeting, functional } = this._userPrivacySettings;
const { accepted, performance, targeting, functional } = this._userPrivacySettings;
// decide if the new settings are more restrictive than the previous ones
// if so we need to return `{reload: true}` so that the page can be reloaded
// to ensure that the trackers are re-initialized
const reload = (!newSettings.performance && performance) ||
const reload =
// this first case says, if they just accepted tracking and consent is not required (meaning we are currently tracking) but denied any of the categories
(newSettings.accepted && !accepted && !this.options.requireConsent && (!newSettings.performance || !newSettings.targeting || !newSettings.functional)) ||
(!newSettings.performance && performance) ||
(!newSettings.targeting && targeting) ||

@@ -153,0 +153,0 @@ (!newSettings.functional && functional);

export function shouldDisableTracking(options = {}) {
const { disabled, portal, userPrivacySettings } = options;
const { disabled, portal, requireConsent, userPrivacySettings } = options;
if (!!requireConsent) {
if (!(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.accepted)) {
// consent is required but not provided
return true;
}
else {
// consent is required and provided
// if the user has turned off all tracking, then we disable tracking
if ((userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.performance) === false &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.targeting) === false) {
return true;
}
}
}
// if user has turned off all tracking, then we disable tracking
if ((userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false &&
if (
// if accepted were false, it would mean that the user didn't actually deny these, just that they have not made a selection
// so we only pay attention to functional, performance, and targeting if accepted is true
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.accepted) === true &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.performance) === false &&

@@ -6,0 +25,0 @@ (userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.targeting) === false) {

@@ -33,2 +33,6 @@ "use strict";

];
/**
* Telemetry class
* Main entrypoint for the telemetry library
*/
class Telemetry {

@@ -72,27 +76,21 @@ constructor(options) {

}
shouldInitializeTrackers(userSettings, requireConsent, trackerNames) {
const userHasNotGivenOrDeniedConsent = !requireConsent && !(userSettings === null || userSettings === void 0 ? void 0 : userSettings.accepted);
const userHasAcceptedAllTrackers = trackerNames.every(name => userSettings === null || userSettings === void 0 ? void 0 : userSettings[name]);
return userHasNotGivenOrDeniedConsent || userHasAcceptedAllTrackers;
}
filterTrackers(trackerNames) {
return this.options.plugins.filter(tracker => trackerNames.includes(tracker.name));
}
initializeTrackers() {
const userSettings = this._userPrivacySettings;
// Reset trackers
const requireConsent = this.options.requireConsent;
this.trackers = [];
// Depending on the user settings, we may not want to load all trackers
if (this.options.plugins) {
if (userSettings) {
// ------------------------------------------------------
// Rules:
// if settings.performance: true, we can load the Esri Tracker
// if settings.{performance,targeting,functional}: true, we can load the 3rd party trackers
// ------------------------------------------------------
if (userSettings === null || userSettings === void 0 ? void 0 : userSettings.performance) {
this.trackers.push(...this.options.plugins.filter((tracker) => tracker.name === 'amazon'));
if (this.shouldInitializeTrackers(userSettings, requireConsent, ['performance'])) {
this.trackers.push(...this.filterTrackers(['amazon']));
}
if ((userSettings === null || userSettings === void 0 ? void 0 : userSettings.performance) &&
(userSettings === null || userSettings === void 0 ? void 0 : userSettings.targeting) &&
(userSettings === null || userSettings === void 0 ? void 0 : userSettings.functional)) {
const thirdPartyTrackers = [
'adobe-analytics',
'google',
'googleAnalytics',
'siteimprove',
];
this.trackers.push(...this.options.plugins.filter((tracker) => thirdPartyTrackers.includes(tracker.name)));
if (this.shouldInitializeTrackers(userSettings, requireConsent, ['performance', 'targeting', 'functional'])) {
this.trackers.push(...this.filterTrackers(['adobe-analytics', 'googleAnalytics', 'siteimprove']));
}

@@ -108,3 +106,2 @@ }

// this is likely due to the user privacy settings
// this.logger.error(new Error('No trackers configured'));
this.logger.info('No trackers configured');

@@ -150,7 +147,10 @@ }

async updateUserPrivacySettings(newSettings) {
const { performance, targeting, functional } = this._userPrivacySettings;
const { accepted, performance, targeting, functional } = this._userPrivacySettings;
// decide if the new settings are more restrictive than the previous ones
// if so we need to return `{reload: true}` so that the page can be reloaded
// to ensure that the trackers are re-initialized
const reload = (!newSettings.performance && performance) ||
const reload =
// this first case says, if they just accepted tracking and consent is not required (meaning we are currently tracking) but denied any of the categories
(newSettings.accepted && !accepted && !this.options.requireConsent && (!newSettings.performance || !newSettings.targeting || !newSettings.functional)) ||
(!newSettings.performance && performance) ||
(!newSettings.targeting && targeting) ||

@@ -157,0 +157,0 @@ (!newSettings.functional && functional);

@@ -5,5 +5,24 @@ "use strict";

function shouldDisableTracking(options = {}) {
const { disabled, portal, userPrivacySettings } = options;
const { disabled, portal, requireConsent, userPrivacySettings } = options;
if (!!requireConsent) {
if (!(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.accepted)) {
// consent is required but not provided
return true;
}
else {
// consent is required and provided
// if the user has turned off all tracking, then we disable tracking
if ((userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.performance) === false &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.targeting) === false) {
return true;
}
}
}
// if user has turned off all tracking, then we disable tracking
if ((userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false &&
if (
// if accepted were false, it would mean that the user didn't actually deny these, just that they have not made a selection
// so we only pay attention to functional, performance, and targeting if accepted is true
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.accepted) === true &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.performance) === false &&

@@ -10,0 +29,0 @@ (userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.targeting) === false) {

import { Attributes, EventData, IPrivacySettings, TelemetryOptions, User, Workflow } from './types';
export * from './utils';
/**
* Telemetry class
* Main entrypoint for the telemetry library
*/
export declare class Telemetry implements TelemetryCore<TelemetryOptions> {

@@ -13,2 +17,4 @@ user: User;

constructor(options: TelemetryOptions);
private shouldInitializeTrackers;
private filterTrackers;
private initializeTrackers;

@@ -15,0 +21,0 @@ getScriptTags(): string;

@@ -1033,5 +1033,24 @@ (function (global, factory) {

function shouldDisableTracking(options = {}) {
const { disabled, portal, userPrivacySettings } = options;
const { disabled, portal, requireConsent, userPrivacySettings } = options;
if (!!requireConsent) {
if (!(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.accepted)) {
// consent is required but not provided
return true;
}
else {
// consent is required and provided
// if the user has turned off all tracking, then we disable tracking
if ((userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.performance) === false &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.targeting) === false) {
return true;
}
}
}
// if user has turned off all tracking, then we disable tracking
if ((userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false &&
if (
// if accepted were false, it would mean that the user didn't actually deny these, just that they have not made a selection
// so we only pay attention to functional, performance, and targeting if accepted is true
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.accepted) === true &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.performance) === false &&

@@ -1220,2 +1239,6 @@ (userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.targeting) === false) {

];
/**
* Telemetry class
* Main entrypoint for the telemetry library
*/
class Telemetry {

@@ -1259,27 +1282,21 @@ constructor(options) {

}
shouldInitializeTrackers(userSettings, requireConsent, trackerNames) {
const userHasNotGivenOrDeniedConsent = !requireConsent && !(userSettings === null || userSettings === void 0 ? void 0 : userSettings.accepted);
const userHasAcceptedAllTrackers = trackerNames.every(name => userSettings === null || userSettings === void 0 ? void 0 : userSettings[name]);
return userHasNotGivenOrDeniedConsent || userHasAcceptedAllTrackers;
}
filterTrackers(trackerNames) {
return this.options.plugins.filter(tracker => trackerNames.includes(tracker.name));
}
initializeTrackers() {
const userSettings = this._userPrivacySettings;
// Reset trackers
const requireConsent = this.options.requireConsent;
this.trackers = [];
// Depending on the user settings, we may not want to load all trackers
if (this.options.plugins) {
if (userSettings) {
// ------------------------------------------------------
// Rules:
// if settings.performance: true, we can load the Esri Tracker
// if settings.{performance,targeting,functional}: true, we can load the 3rd party trackers
// ------------------------------------------------------
if (userSettings === null || userSettings === void 0 ? void 0 : userSettings.performance) {
this.trackers.push(...this.options.plugins.filter((tracker) => tracker.name === 'amazon'));
if (this.shouldInitializeTrackers(userSettings, requireConsent, ['performance'])) {
this.trackers.push(...this.filterTrackers(['amazon']));
}
if ((userSettings === null || userSettings === void 0 ? void 0 : userSettings.performance) &&
(userSettings === null || userSettings === void 0 ? void 0 : userSettings.targeting) &&
(userSettings === null || userSettings === void 0 ? void 0 : userSettings.functional)) {
const thirdPartyTrackers = [
'adobe-analytics',
'google',
'googleAnalytics',
'siteimprove',
];
this.trackers.push(...this.options.plugins.filter((tracker) => thirdPartyTrackers.includes(tracker.name)));
if (this.shouldInitializeTrackers(userSettings, requireConsent, ['performance', 'targeting', 'functional'])) {
this.trackers.push(...this.filterTrackers(['adobe-analytics', 'googleAnalytics', 'siteimprove']));
}

@@ -1295,3 +1312,2 @@ }

// this is likely due to the user privacy settings
// this.logger.error(new Error('No trackers configured'));
this.logger.info('No trackers configured');

@@ -1337,7 +1353,10 @@ }

async updateUserPrivacySettings(newSettings) {
const { performance, targeting, functional } = this._userPrivacySettings;
const { accepted, performance, targeting, functional } = this._userPrivacySettings;
// decide if the new settings are more restrictive than the previous ones
// if so we need to return `{reload: true}` so that the page can be reloaded
// to ensure that the trackers are re-initialized
const reload = (!newSettings.performance && performance) ||
const reload =
// this first case says, if they just accepted tracking and consent is not required (meaning we are currently tracking) but denied any of the categories
(newSettings.accepted && !accepted && !this.options.requireConsent && (!newSettings.performance || !newSettings.targeting || !newSettings.functional)) ||
(!newSettings.performance && performance) ||
(!newSettings.targeting && targeting) ||

@@ -1344,0 +1363,0 @@ (!newSettings.functional && functional);

@@ -1033,5 +1033,24 @@ (function (global, factory) {

function shouldDisableTracking(options = {}) {
const { disabled, portal, userPrivacySettings } = options;
const { disabled, portal, requireConsent, userPrivacySettings } = options;
if (!!requireConsent) {
if (!(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.accepted)) {
// consent is required but not provided
return true;
}
else {
// consent is required and provided
// if the user has turned off all tracking, then we disable tracking
if ((userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.performance) === false &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.targeting) === false) {
return true;
}
}
}
// if user has turned off all tracking, then we disable tracking
if ((userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false &&
if (
// if accepted were false, it would mean that the user didn't actually deny these, just that they have not made a selection
// so we only pay attention to functional, performance, and targeting if accepted is true
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.accepted) === true &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false &&
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.performance) === false &&

@@ -1220,2 +1239,6 @@ (userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.targeting) === false) {

];
/**
* Telemetry class
* Main entrypoint for the telemetry library
*/
class Telemetry {

@@ -1259,27 +1282,21 @@ constructor(options) {

}
shouldInitializeTrackers(userSettings, requireConsent, trackerNames) {
const userHasNotGivenOrDeniedConsent = !requireConsent && !(userSettings === null || userSettings === void 0 ? void 0 : userSettings.accepted);
const userHasAcceptedAllTrackers = trackerNames.every(name => userSettings === null || userSettings === void 0 ? void 0 : userSettings[name]);
return userHasNotGivenOrDeniedConsent || userHasAcceptedAllTrackers;
}
filterTrackers(trackerNames) {
return this.options.plugins.filter(tracker => trackerNames.includes(tracker.name));
}
initializeTrackers() {
const userSettings = this._userPrivacySettings;
// Reset trackers
const requireConsent = this.options.requireConsent;
this.trackers = [];
// Depending on the user settings, we may not want to load all trackers
if (this.options.plugins) {
if (userSettings) {
// ------------------------------------------------------
// Rules:
// if settings.performance: true, we can load the Esri Tracker
// if settings.{performance,targeting,functional}: true, we can load the 3rd party trackers
// ------------------------------------------------------
if (userSettings === null || userSettings === void 0 ? void 0 : userSettings.performance) {
this.trackers.push(...this.options.plugins.filter((tracker) => tracker.name === 'amazon'));
if (this.shouldInitializeTrackers(userSettings, requireConsent, ['performance'])) {
this.trackers.push(...this.filterTrackers(['amazon']));
}
if ((userSettings === null || userSettings === void 0 ? void 0 : userSettings.performance) &&
(userSettings === null || userSettings === void 0 ? void 0 : userSettings.targeting) &&
(userSettings === null || userSettings === void 0 ? void 0 : userSettings.functional)) {
const thirdPartyTrackers = [
'adobe-analytics',
'google',
'googleAnalytics',
'siteimprove',
];
this.trackers.push(...this.options.plugins.filter((tracker) => thirdPartyTrackers.includes(tracker.name)));
if (this.shouldInitializeTrackers(userSettings, requireConsent, ['performance', 'targeting', 'functional'])) {
this.trackers.push(...this.filterTrackers(['adobe-analytics', 'googleAnalytics', 'siteimprove']));
}

@@ -1295,3 +1312,2 @@ }

// this is likely due to the user privacy settings
// this.logger.error(new Error('No trackers configured'));
this.logger.info('No trackers configured');

@@ -1337,7 +1353,10 @@ }

async updateUserPrivacySettings(newSettings) {
const { performance, targeting, functional } = this._userPrivacySettings;
const { accepted, performance, targeting, functional } = this._userPrivacySettings;
// decide if the new settings are more restrictive than the previous ones
// if so we need to return `{reload: true}` so that the page can be reloaded
// to ensure that the trackers are re-initialized
const reload = (!newSettings.performance && performance) ||
const reload =
// this first case says, if they just accepted tracking and consent is not required (meaning we are currently tracking) but denied any of the categories
(newSettings.accepted && !accepted && !this.options.requireConsent && (!newSettings.performance || !newSettings.targeting || !newSettings.functional)) ||
(!newSettings.performance && performance) ||
(!newSettings.targeting && targeting) ||

@@ -1344,0 +1363,0 @@ (!newSettings.functional && functional);

{
"name": "@esri/telemetry",
"version": "7.0.5",
"version": "7.0.6",
"description": "A JavaScript Implementation of the ArcGIS Telemetry Specification",

@@ -46,3 +46,3 @@ "main": "dist/node/index.js",

},
"gitHead": "3dadf9f6667e714661ebb630db4d4f3e9e537ead"
"gitHead": "c7ad962a268cf3849f7f604c3a5e3a226ef0f3b2"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc