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

@mozilla/glean

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mozilla/glean - npm Package Compare versions

Comparing version 4.1.0-pre.0 to 5.0.0-pre.0

2

dist/core/constants.js
export const GLEAN_SCHEMA_VERSION = 1;
export const GLEAN_VERSION = "4.1.0-pre.0";
export const GLEAN_VERSION = "5.0.0-pre.0";
export const PING_INFO_STORAGE = "glean_ping_info";

@@ -4,0 +4,0 @@ export const CLIENT_INFO_STORAGE = "glean_client_info";

@@ -43,14 +43,19 @@ import { Context } from "./context.js";

GleanMetrics.pageLoad = pageLoad;
function constructClickEventContextForElement(element) {
const dataset = element.dataset;
const elementClickEventContext = {
...(dataset.gleanId && { id: dataset.gleanId }),
...(dataset.gleanType && { type: dataset.gleanType }),
...(dataset.gleanLabel && { label: dataset.gleanLabel })
};
return elementClickEventContext;
}
function handleClickEvent(event) {
var _a, _b, _c, _d, _e, _f;
const htmlElement = event.target;
const elementClickEventContext = {};
if ((_a = htmlElement === null || htmlElement === void 0 ? void 0 : htmlElement.dataset) === null || _a === void 0 ? void 0 : _a.gleanId)
elementClickEventContext.id = (_b = htmlElement === null || htmlElement === void 0 ? void 0 : htmlElement.dataset) === null || _b === void 0 ? void 0 : _b.gleanId;
if ((_c = htmlElement === null || htmlElement === void 0 ? void 0 : htmlElement.dataset) === null || _c === void 0 ? void 0 : _c.gleanType)
elementClickEventContext.type = (_d = htmlElement === null || htmlElement === void 0 ? void 0 : htmlElement.dataset) === null || _d === void 0 ? void 0 : _d.gleanType;
if ((_e = htmlElement === null || htmlElement === void 0 ? void 0 : htmlElement.dataset) === null || _e === void 0 ? void 0 : _e.gleanLabel)
elementClickEventContext.label = (_f = htmlElement === null || htmlElement === void 0 ? void 0 : htmlElement.dataset) === null || _f === void 0 ? void 0 : _f.gleanLabel;
if (Object.keys(elementClickEventContext).length > 0)
recordElementClick(elementClickEventContext);
const clickedElement = event.target;
const closestElementWithClickAttributes = clickedElement.closest("[data-glean-id], [data-glean-type], [data-glean-label]");
if (!closestElementWithClickAttributes) {
return;
}
const elementClickEventContext = constructClickEventContextForElement(closestElementWithClickAttributes);
recordElementClick(elementClickEventContext);
}

@@ -57,0 +62,0 @@ GleanMetrics.handleClickEvent = handleClickEvent;

@@ -30,2 +30,3 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {

}
const ts = Date.now();
try {

@@ -38,5 +39,4 @@ const metric = new RecordedEvent({

});
let truncatedExtra = undefined;
const truncatedExtra = {};
if (extra && this.allowedExtraKeys) {
truncatedExtra = {};
for (const [name, value] of Object.entries(extra)) {

@@ -57,2 +57,3 @@ if (this.allowedExtraKeys.includes(name)) {

}
truncatedExtra["glean_timestamp"] = ts.toString();
metric.set({

@@ -72,3 +73,14 @@ ...metric.get(),

if (testOnlyCheck("testGetValue", LOG_TAG)) {
return Context.eventsDatabase.getEvents(ping, this);
const events = Context.eventsDatabase.getEvents(ping, this);
if (!events)
return events;
events.forEach((ev) => {
if (ev.extra) {
delete ev.extra["glean_timestamp"];
if (Object.keys(ev.extra).length == 0) {
ev.extra = undefined;
}
}
});
return events;
}

@@ -75,0 +87,0 @@ }

export declare const GLEAN_SCHEMA_VERSION = 1;
export declare const GLEAN_VERSION = "4.1.0-pre.0";
export declare const GLEAN_VERSION = "5.0.0-pre.0";
export declare const PING_INFO_STORAGE = "glean_ping_info";

@@ -4,0 +4,0 @@ export declare const CLIENT_INFO_STORAGE = "glean_client_info";

{
"name": "@mozilla/glean",
"version": "4.1.0-pre.0",
"version": "5.0.0-pre.0",
"description": "An implementation of the Glean SDK, a modern cross-platform telemetry client, for JavaScript environments.",

@@ -98,3 +98,3 @@ "type": "module",

"eslint": "^8.0.1",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^48.0.4",

@@ -107,3 +107,3 @@ "eslint-plugin-json": "^3.0.0",

"gh-pages": "^6.0.0",
"jsdom": "23.0.1",
"jsdom": "24.0.0",
"jsdom-global": "3.0.2",

@@ -110,0 +110,0 @@ "jsonschema": "^1.4.0",

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