New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.7 to 7.1.0

dist/esm/utils/getTrackersToInitialize.js

10

dist/esm/index.js

@@ -301,12 +301,2 @@ import sha256 from 'crypto-js/sha256.js';

}
disable() {
this.disabled = true;
this.trackers.forEach((tracker) => {
var _a;
if (!tracker.hasError) {
tracker.disabled = true;
(_a = tracker.disable) === null || _a === void 0 ? void 0 : _a.call(tracker);
}
});
}
/**

@@ -313,0 +303,0 @@ * Disable a tracker. This does not deterministically unload

1

dist/esm/utils/index.js
export * from './inject-script-element';
export * from './create-script-tags';
export * from './storage';
export * from './getTrackersToInitialize';
//# sourceMappingURL=index.js.map

@@ -305,12 +305,2 @@ "use strict";

}
disable() {
this.disabled = true;
this.trackers.forEach((tracker) => {
var _a;
if (!tracker.hasError) {
tracker.disabled = true;
(_a = tracker.disable) === null || _a === void 0 ? void 0 : _a.call(tracker);
}
});
}
/**

@@ -317,0 +307,0 @@ * Disable a tracker. This does not deterministically unload

@@ -7,2 +7,3 @@ "use strict";

tslib_1.__exportStar(require("./storage"), exports);
tslib_1.__exportStar(require("./getTrackersToInitialize"), exports);
//# sourceMappingURL=index.js.map

@@ -44,3 +44,2 @@ import { Attributes, EventData, IPrivacySettings, TelemetryOptions, User, Workflow } from './types';

preProcess(event?: EventData, options?: TelemetryOptions): Record<string, any>;
disable(): void;
/**

@@ -83,4 +82,3 @@ * Disable a tracker. This does not deterministically unload

interface TelemetryCore<TelemetryOptions> extends TelemetryLogMethods, TelemetryWorkflowMethods, TelemetryTrackerMethods, TelemetryScriptMethods {
disable(): void;
preProcess?(event: EventData, options: TelemetryOptions): EventData;
}
export * from './inject-script-element';
export * from './create-script-tags';
export * from './storage';
export * from './getTrackersToInitialize';

@@ -1215,2 +1215,59 @@ (function (global, factory) {

/**
* Given privacy settings, list of configured trackers, and the portal, return the trackers
* which we can initialize.
*
* @param privacySettings - The privacy settings object.
* @param config - Minimal site configuration object - likely needs to be constructed based on the app
* @param portal - The portal object (optional, but should be passed in if the user is authenticated).
* @returns An array of WellKnownTrackers representing the trackers to initialize.
*/
function getTrackersToInitialize(privacySettings, config, portal) {
const trackersToInitialize = [];
// Given privacy settings, list of configured trackers, and the portal, return the trackers which we can initialize.
// Does the org allow tracking?
// If no portal is passed in, we assume this to be true.
let orgOptsIntoTracking = true;
// if a portal is passed in and eueiEnabled is false, the org has opted out of all tracking.
if (portal && portal.eueiEnabled === false) {
orgOptsIntoTracking = false;
}
// compute some states so logic is simpler to read
const consentNotRequired = !config.requireConsent;
const consentRequiredAndGiven = config.requireConsent && privacySettings.accepted;
// If the org has explicitly opted out of tracking, we don't initialize any trackers.
// This may change in the future with "functional" tracking, but we don't have that yet.
if (orgOptsIntoTracking) {
// tracker rules
const rules = {
amazon: {
required: ['performance'],
},
'adobe-analytics': {
required: ['targeting'],
},
googleAnalytics: {
required: ['targeting'],
},
siteimprove: {
required: ['targeting'],
},
};
// iterate the keys of the rules object
Object.keys(rules).forEach((tracker) => {
const rule = rules[tracker];
if (config.configuredTrackers.includes(tracker)) {
const requirementsMet = rule.required.reduce((acc, req) => {
return acc && privacySettings[req];
}, true);
if ((consentRequiredAndGiven && requirementsMet) ||
consentNotRequired) {
trackersToInitialize.push(tracker);
}
}
});
}
return trackersToInitialize;
}
const INTERNAL_ORGS = [

@@ -1511,12 +1568,2 @@ 'esri.com',

}
disable() {
this.disabled = true;
this.trackers.forEach((tracker) => {
var _a;
if (!tracker.hasError) {
tracker.disabled = true;
(_a = tracker.disable) === null || _a === void 0 ? void 0 : _a.call(tracker);
}
});
}
/**

@@ -1614,2 +1661,3 @@ * Disable a tracker. This does not deterministically unload

exports.createScriptTags = createScriptTags;
exports.getTrackersToInitialize = getTrackersToInitialize;
exports.injectScriptElement = injectScriptElement;

@@ -1616,0 +1664,0 @@ exports.injectScriptElementAsync = injectScriptElementAsync;

@@ -1215,2 +1215,59 @@ (function (global, factory) {

/**
* Given privacy settings, list of configured trackers, and the portal, return the trackers
* which we can initialize.
*
* @param privacySettings - The privacy settings object.
* @param config - Minimal site configuration object - likely needs to be constructed based on the app
* @param portal - The portal object (optional, but should be passed in if the user is authenticated).
* @returns An array of WellKnownTrackers representing the trackers to initialize.
*/
function getTrackersToInitialize(privacySettings, config, portal) {
const trackersToInitialize = [];
// Given privacy settings, list of configured trackers, and the portal, return the trackers which we can initialize.
// Does the org allow tracking?
// If no portal is passed in, we assume this to be true.
let orgOptsIntoTracking = true;
// if a portal is passed in and eueiEnabled is false, the org has opted out of all tracking.
if (portal && portal.eueiEnabled === false) {
orgOptsIntoTracking = false;
}
// compute some states so logic is simpler to read
const consentNotRequired = !config.requireConsent;
const consentRequiredAndGiven = config.requireConsent && privacySettings.accepted;
// If the org has explicitly opted out of tracking, we don't initialize any trackers.
// This may change in the future with "functional" tracking, but we don't have that yet.
if (orgOptsIntoTracking) {
// tracker rules
const rules = {
amazon: {
required: ['performance'],
},
'adobe-analytics': {
required: ['targeting'],
},
googleAnalytics: {
required: ['targeting'],
},
siteimprove: {
required: ['targeting'],
},
};
// iterate the keys of the rules object
Object.keys(rules).forEach((tracker) => {
const rule = rules[tracker];
if (config.configuredTrackers.includes(tracker)) {
const requirementsMet = rule.required.reduce((acc, req) => {
return acc && privacySettings[req];
}, true);
if ((consentRequiredAndGiven && requirementsMet) ||
consentNotRequired) {
trackersToInitialize.push(tracker);
}
}
});
}
return trackersToInitialize;
}
const INTERNAL_ORGS = [

@@ -1511,12 +1568,2 @@ 'esri.com',

}
disable() {
this.disabled = true;
this.trackers.forEach((tracker) => {
var _a;
if (!tracker.hasError) {
tracker.disabled = true;
(_a = tracker.disable) === null || _a === void 0 ? void 0 : _a.call(tracker);
}
});
}
/**

@@ -1614,2 +1661,3 @@ * Disable a tracker. This does not deterministically unload

exports.createScriptTags = createScriptTags;
exports.getTrackersToInitialize = getTrackersToInitialize;
exports.injectScriptElement = injectScriptElement;

@@ -1616,0 +1664,0 @@ exports.injectScriptElementAsync = injectScriptElementAsync;

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

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

},
"gitHead": "f95021bd5cae9a070b23b729738818473def6830"
"gitHead": "02f579ece59980044a4b92b3e110eec2a408aa23"
}

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