Socket
Socket
Sign inDemoInstall

@openreplay/tracker

Package Overview
Dependencies
Maintainers
4
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openreplay/tracker - npm Package Compare versions

Comparing version 3.5.14 to 3.5.15-beta.0

2

cjs/app/index.js

@@ -35,3 +35,3 @@ "use strict";

this.activityState = ActivityState.NotActive;
this.version = '3.5.14'; // TODO: version compatability check inside each plugin.
this.version = '3.5.15-beta.0'; // TODO: version compatability check inside each plugin.
this.projectKey = projectKey;

@@ -38,0 +38,0 @@ this.options = Object.assign({

declare type NodeCallback = (node: Node, isStart: boolean) => void;
export default class Nodes {
private readonly node_id;
private readonly nodes;
private nodes;
private readonly nodeCallbacks;

@@ -12,2 +12,3 @@ private readonly elementListeners;

unregisterNode(node: Node): number | undefined;
cleanTree(): (Node | undefined)[];
callNodeCallbacks(node: Node, isStart: boolean): void;

@@ -14,0 +15,0 @@ getID(node: Node): number | undefined;

@@ -50,2 +50,5 @@ "use strict";

}
cleanTree() {
return this.nodes = this.nodes.filter((n) => n !== undefined);
}
callNodeCallbacks(node, isStart) {

@@ -52,0 +55,0 @@ this.nodeCallbacks.forEach((cb) => cb(node, isStart));

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

const type = mutation.type;
// const deleted: number[] = [];
if (!isObservable(target)) {

@@ -60,3 +61,6 @@ continue;

for (let i = 0; i < mutation.removedNodes.length; i++) {
this.bindTree(mutation.removedNodes[i]);
// this.bindTree(mutation.removedNodes[i]);
const id = this.unbindNode(mutation.removedNodes[i]);
// id && this.recents.delete(id)
// id && deleted.push(id)
}

@@ -93,2 +97,3 @@ for (let i = 0; i < mutation.addedNodes.length; i++) {

this.commitNodes();
this.app.nodes.cleanTree();
}));

@@ -163,3 +168,3 @@ }

}
else if (!this.recents.has(id)) {
else if (this.recents.get(id) !== RecentsType.New) { // can we do just `else` here?
this.recents.set(id, RecentsType.Removed);

@@ -189,2 +194,3 @@ }

}
return id;
}

@@ -203,2 +209,4 @@ // A top-consumption function on the infinite lists test. (~1% of performance resources)

if (parent === null) {
// Sometimes one observation contains attribute mutations for the removimg node, which gets ignored here.
// That shouldn't affect the visual rendering ( should it? )
this.unbindNode(node);

@@ -205,0 +213,0 @@ return false;

@@ -130,3 +130,3 @@ "use strict";

req.send(JSON.stringify({
trackerVersion: '3.5.14',
trackerVersion: '3.5.15-beta.0',
projectKey: options.projectKey,

@@ -133,0 +133,0 @@ doNotTrack,

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

const guards_js_1 = require("../app/guards.js");
function resolveURL(url, location = document.location) {
url = url.trim();
if (url.startsWith('/')) {
return location.origin + url;
}
else if (url.startsWith('http://') ||
url.startsWith('https://') ||
url.startsWith('data:') // any other possible value here?
) {
return url;
}
else {
return location.origin + location.pathname + url;
}
}
const PLACEHOLDER_SRC = "https://static.openreplay.com/tracker/placeholder.jpeg";

@@ -28,13 +43,17 @@ function default_1(app) {

}
const resolvedSrc = resolveURL(src || ''); // Src type is null sometimes. - is it true?
if (naturalWidth === 0 && naturalHeight === 0) {
if (src != null && (0, utils_js_1.isURL)(src)) { // TODO: How about relative urls ? Src type is null sometimes.
app.send(new messages_js_1.ResourceTiming((0, utils_js_1.timestamp)(), 0, 0, 0, 0, 0, src, 'img'));
if ((0, utils_js_1.isURL)(resolvedSrc)) {
app.send(new messages_js_1.ResourceTiming((0, utils_js_1.timestamp)(), 0, 0, 0, 0, 0, resolvedSrc, 'img'));
}
}
else if (src.length >= 1e5 || app.sanitizer.isMasked(id)) {
else if (resolvedSrc.length >= 1e5 || app.sanitizer.isMasked(id)) {
sendPlaceholder(id, this);
}
else {
app.send(new messages_js_1.SetNodeAttributeURLBased(id, 'src', src, app.getBaseHref()));
srcset && app.send(new messages_js_1.SetNodeAttribute(id, 'srcset', srcset));
app.send(new messages_js_1.SetNodeAttribute(id, 'src', resolvedSrc));
if (srcset) {
const resolvedSrcset = srcset.split(',').map(str => resolveURL(str)).join(',');
app.send(new messages_js_1.SetNodeAttribute(id, 'srcset', resolvedSrcset));
}
}

@@ -41,0 +60,0 @@ });

@@ -17,3 +17,3 @@ "use strict";

function isURL(s) {
return s.substr(0, 8) === 'https://' || s.substr(0, 7) === 'http://';
return s.startsWith('https://') || s.startsWith('http://');
}

@@ -20,0 +20,0 @@ exports.isURL = isURL;

@@ -32,3 +32,3 @@ import { Timestamp, Metadata, UserID } from "../common/messages.js";

this.activityState = ActivityState.NotActive;
this.version = '3.5.14'; // TODO: version compatability check inside each plugin.
this.version = '3.5.15-beta.0'; // TODO: version compatability check inside each plugin.
this.projectKey = projectKey;

@@ -35,0 +35,0 @@ this.options = Object.assign({

declare type NodeCallback = (node: Node, isStart: boolean) => void;
export default class Nodes {
private readonly node_id;
private readonly nodes;
private nodes;
private readonly nodeCallbacks;

@@ -12,2 +12,3 @@ private readonly elementListeners;

unregisterNode(node: Node): number | undefined;
cleanTree(): (Node | undefined)[];
callNodeCallbacks(node: Node, isStart: boolean): void;

@@ -14,0 +15,0 @@ getID(node: Node): number | undefined;

@@ -48,2 +48,5 @@ export default class Nodes {

}
cleanTree() {
return this.nodes = this.nodes.filter((n) => n !== undefined);
}
callNodeCallbacks(node, isStart) {

@@ -50,0 +53,0 @@ this.nodeCallbacks.forEach((cb) => cb(node, isStart));

@@ -52,2 +52,3 @@ import { RemoveNodeAttribute, SetNodeAttribute, SetNodeAttributeURLBased, SetCSSDataURLBased, SetNodeData, CreateTextNode, CreateElementNode, MoveNode, RemoveNode, } from "../../common/messages.js";

const type = mutation.type;
// const deleted: number[] = [];
if (!isObservable(target)) {

@@ -58,3 +59,6 @@ continue;

for (let i = 0; i < mutation.removedNodes.length; i++) {
this.bindTree(mutation.removedNodes[i]);
// this.bindTree(mutation.removedNodes[i]);
const id = this.unbindNode(mutation.removedNodes[i]);
// id && this.recents.delete(id)
// id && deleted.push(id)
}

@@ -91,2 +95,3 @@ for (let i = 0; i < mutation.addedNodes.length; i++) {

this.commitNodes();
this.app.nodes.cleanTree();
}));

@@ -161,3 +166,3 @@ }

}
else if (!this.recents.has(id)) {
else if (this.recents.get(id) !== RecentsType.New) { // can we do just `else` here?
this.recents.set(id, RecentsType.Removed);

@@ -187,2 +192,3 @@ }

}
return id;
}

@@ -201,2 +207,4 @@ // A top-consumption function on the infinite lists test. (~1% of performance resources)

if (parent === null) {
// Sometimes one observation contains attribute mutations for the removimg node, which gets ignored here.
// That shouldn't affect the visual rendering ( should it? )
this.unbindNode(node);

@@ -203,0 +211,0 @@ return false;

@@ -126,3 +126,3 @@ import App, { DEFAULT_INGEST_POINT } from "./app/index.js";

req.send(JSON.stringify({
trackerVersion: '3.5.14',
trackerVersion: '3.5.15-beta.0',
projectKey: options.projectKey,

@@ -129,0 +129,0 @@ doNotTrack,

import { timestamp, isURL } from "../utils.js";
import { ResourceTiming, SetNodeAttributeURLBased, SetNodeAttribute } from "../common/messages.js";
import { hasTag } from "../app/guards.js";
function resolveURL(url, location = document.location) {
url = url.trim();
if (url.startsWith('/')) {
return location.origin + url;
}
else if (url.startsWith('http://') ||
url.startsWith('https://') ||
url.startsWith('data:') // any other possible value here?
) {
return url;
}
else {
return location.origin + location.pathname + url;
}
}
const PLACEHOLDER_SRC = "https://static.openreplay.com/tracker/placeholder.jpeg";

@@ -25,13 +40,17 @@ export default function (app) {

}
const resolvedSrc = resolveURL(src || ''); // Src type is null sometimes. - is it true?
if (naturalWidth === 0 && naturalHeight === 0) {
if (src != null && isURL(src)) { // TODO: How about relative urls ? Src type is null sometimes.
app.send(new ResourceTiming(timestamp(), 0, 0, 0, 0, 0, src, 'img'));
if (isURL(resolvedSrc)) {
app.send(new ResourceTiming(timestamp(), 0, 0, 0, 0, 0, resolvedSrc, 'img'));
}
}
else if (src.length >= 1e5 || app.sanitizer.isMasked(id)) {
else if (resolvedSrc.length >= 1e5 || app.sanitizer.isMasked(id)) {
sendPlaceholder(id, this);
}
else {
app.send(new SetNodeAttributeURLBased(id, 'src', src, app.getBaseHref()));
srcset && app.send(new SetNodeAttribute(id, 'srcset', srcset));
app.send(new SetNodeAttribute(id, 'src', resolvedSrc));
if (srcset) {
const resolvedSrcset = srcset.split(',').map(str => resolveURL(str)).join(',');
app.send(new SetNodeAttribute(id, 'srcset', resolvedSrcset));
}
}

@@ -38,0 +57,0 @@ });

@@ -12,3 +12,3 @@ export function timestamp() {

export function isURL(s) {
return s.substr(0, 8) === 'https://' || s.substr(0, 7) === 'http://';
return s.startsWith('https://') || s.startsWith('http://');
}

@@ -15,0 +15,0 @@ export const IN_BROWSER = !(typeof window === "undefined");

{
"name": "@openreplay/tracker",
"description": "The OpenReplay tracker main package",
"version": "3.5.14",
"version": "3.5.15-beta.0",
"keywords": [

@@ -21,3 +21,3 @@ "logging",

"rollup": "rollup --config rollup.config.js",
"compile": "node --experimental-modules --experimental-json-modules scripts/compile.js",
"compile": "node --experimental-modules --experimental-json-modules scripts/compile.cjs",
"build": "npm run clean && npm run tsc && npm run rollup && npm run compile",

@@ -45,4 +45,4 @@ "prepare": "node scripts/checkver.cjs && npm run build"

"engines": {
"node": ">=14.15"
"node": ">=14.0"
}
}

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