@esri/telemetry
Advanced tools
Comparing version 7.0.4 to 7.0.5
@@ -67,21 +67,27 @@ import sha256 from 'crypto-js/sha256.js'; | ||
} | ||
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; | ||
const requireConsent = this.options.requireConsent; | ||
// Reset trackers | ||
this.trackers = []; | ||
// Depending on the user settings, we may not want to load all trackers | ||
if (this.options.plugins) { | ||
if (userSettings) { | ||
if (this.shouldInitializeTrackers(userSettings, requireConsent, ['performance'])) { | ||
this.trackers.push(...this.filterTrackers(['amazon'])); | ||
// ------------------------------------------------------ | ||
// 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', 'targeting', 'functional'])) { | ||
this.trackers.push(...this.filterTrackers(['adobe-analytics', 'googleAnalytics', 'siteimprove'])); | ||
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))); | ||
} | ||
@@ -97,2 +103,3 @@ } | ||
// this is likely due to the user privacy settings | ||
// this.logger.error(new Error('No trackers configured')); | ||
this.logger.info('No trackers configured'); | ||
@@ -99,0 +106,0 @@ } |
export function shouldDisableTracking(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; | ||
} | ||
} | ||
} | ||
const { disabled, portal, userPrivacySettings } = options; | ||
// if user has turned off all tracking, then we disable tracking | ||
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 && | ||
if ((userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false && | ||
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.performance) === false && | ||
@@ -25,0 +6,0 @@ (userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.targeting) === false) { |
@@ -71,21 +71,27 @@ "use strict"; | ||
} | ||
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; | ||
const requireConsent = this.options.requireConsent; | ||
// Reset trackers | ||
this.trackers = []; | ||
// Depending on the user settings, we may not want to load all trackers | ||
if (this.options.plugins) { | ||
if (userSettings) { | ||
if (this.shouldInitializeTrackers(userSettings, requireConsent, ['performance'])) { | ||
this.trackers.push(...this.filterTrackers(['amazon'])); | ||
// ------------------------------------------------------ | ||
// 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', 'targeting', 'functional'])) { | ||
this.trackers.push(...this.filterTrackers(['adobe-analytics', 'googleAnalytics', 'siteimprove'])); | ||
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))); | ||
} | ||
@@ -101,2 +107,3 @@ } | ||
// this is likely due to the user privacy settings | ||
// this.logger.error(new Error('No trackers configured')); | ||
this.logger.info('No trackers configured'); | ||
@@ -103,0 +110,0 @@ } |
@@ -5,24 +5,5 @@ "use strict"; | ||
function shouldDisableTracking(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; | ||
} | ||
} | ||
} | ||
const { disabled, portal, userPrivacySettings } = options; | ||
// if user has turned off all tracking, then we disable tracking | ||
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 && | ||
if ((userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false && | ||
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.performance) === false && | ||
@@ -29,0 +10,0 @@ (userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.targeting) === false) { |
@@ -13,4 +13,2 @@ import { Attributes, EventData, IPrivacySettings, TelemetryOptions, User, Workflow } from './types'; | ||
constructor(options: TelemetryOptions); | ||
private shouldInitializeTrackers; | ||
private filterTrackers; | ||
private initializeTrackers; | ||
@@ -17,0 +15,0 @@ getScriptTags(): string; |
@@ -1033,24 +1033,5 @@ (function (global, factory) { | ||
function shouldDisableTracking(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; | ||
} | ||
} | ||
} | ||
const { disabled, portal, userPrivacySettings } = options; | ||
// if user has turned off all tracking, then we disable tracking | ||
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 && | ||
if ((userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false && | ||
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.performance) === false && | ||
@@ -1277,21 +1258,27 @@ (userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.targeting) === false) { | ||
} | ||
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; | ||
const requireConsent = this.options.requireConsent; | ||
// Reset trackers | ||
this.trackers = []; | ||
// Depending on the user settings, we may not want to load all trackers | ||
if (this.options.plugins) { | ||
if (userSettings) { | ||
if (this.shouldInitializeTrackers(userSettings, requireConsent, ['performance'])) { | ||
this.trackers.push(...this.filterTrackers(['amazon'])); | ||
// ------------------------------------------------------ | ||
// 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', 'targeting', 'functional'])) { | ||
this.trackers.push(...this.filterTrackers(['adobe-analytics', 'googleAnalytics', 'siteimprove'])); | ||
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))); | ||
} | ||
@@ -1307,2 +1294,3 @@ } | ||
// this is likely due to the user privacy settings | ||
// this.logger.error(new Error('No trackers configured')); | ||
this.logger.info('No trackers configured'); | ||
@@ -1309,0 +1297,0 @@ } |
@@ -1033,24 +1033,5 @@ (function (global, factory) { | ||
function shouldDisableTracking(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; | ||
} | ||
} | ||
} | ||
const { disabled, portal, userPrivacySettings } = options; | ||
// if user has turned off all tracking, then we disable tracking | ||
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 && | ||
if ((userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.functional) === false && | ||
(userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.performance) === false && | ||
@@ -1277,21 +1258,27 @@ (userPrivacySettings === null || userPrivacySettings === void 0 ? void 0 : userPrivacySettings.targeting) === false) { | ||
} | ||
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; | ||
const requireConsent = this.options.requireConsent; | ||
// Reset trackers | ||
this.trackers = []; | ||
// Depending on the user settings, we may not want to load all trackers | ||
if (this.options.plugins) { | ||
if (userSettings) { | ||
if (this.shouldInitializeTrackers(userSettings, requireConsent, ['performance'])) { | ||
this.trackers.push(...this.filterTrackers(['amazon'])); | ||
// ------------------------------------------------------ | ||
// 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', 'targeting', 'functional'])) { | ||
this.trackers.push(...this.filterTrackers(['adobe-analytics', 'googleAnalytics', 'siteimprove'])); | ||
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))); | ||
} | ||
@@ -1307,2 +1294,3 @@ } | ||
// this is likely due to the user privacy settings | ||
// this.logger.error(new Error('No trackers configured')); | ||
this.logger.info('No trackers configured'); | ||
@@ -1309,0 +1297,0 @@ } |
{ | ||
"name": "@esri/telemetry", | ||
"version": "7.0.4", | ||
"version": "7.0.5", | ||
"description": "A JavaScript Implementation of the ArcGIS Telemetry Specification", | ||
@@ -10,11 +10,6 @@ "main": "dist/node/index.js", | ||
{ | ||
"name": "Rich Gwozdz", | ||
"email": "rgwozdz@esri.com" | ||
"name": "Esri DC" | ||
}, | ||
{ | ||
"name": "Daniel Fenton" | ||
}, | ||
{ | ||
"name": "Bob Vo", | ||
"email": "rvo@esri.com" | ||
"name": "ArcGIS Hub" | ||
} | ||
@@ -42,6 +37,2 @@ ], | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://devtopia.esri.com/WebGIS/arcgis-telemetry.js/issues" | ||
}, | ||
"homepage": "https://devtopia.esri.com/WebGIS/arcgis-telemetry.js#readme", | ||
"files": [ | ||
@@ -57,3 +48,3 @@ "dist/*" | ||
}, | ||
"gitHead": "cd630e1e3e5347824cf5e7c9b28fe82ff075116d" | ||
"gitHead": "3dadf9f6667e714661ebb630db4d4f3e9e537ead" | ||
} |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
383050
4251