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

@databeat/tracker

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@databeat/tracker - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

15

dist/databeat-tracker.d.ts

@@ -30,2 +30,9 @@ declare enum EventType {

interface Auth {
jwt?: string;
headers?: {
[key: string]: string;
};
}
interface Event<K extends string = any> extends Event$1 {

@@ -41,2 +48,3 @@ event: keyof typeof EventType | K;

flushInterval?: number;
noop?: boolean;
initProps?: () => {};

@@ -56,2 +64,3 @@ }

private rpc;
private auth;
private options;

@@ -67,6 +76,5 @@ private enabled;

private defaultProps;
private authToken;
private previousPageKey;
private ts?;
constructor(host: string, authToken: string, options?: DatabeatOptions);
constructor(host: string, auth: Auth, options?: DatabeatOptions);
private init;

@@ -95,2 +103,3 @@ reset(skipInit?: boolean): void;

}
declare const isBrowser: () => boolean;
interface StorageVal {

@@ -110,2 +119,2 @@ on: boolean;

export { Databeat, DatabeatOptions, Event, Ident, PrivacyOptions, genSessionId, genUserId, getStorageVal };
export { type Auth, Databeat, type DatabeatOptions, type Event, Ident, type PrivacyOptions, genSessionId, genUserId, getStorageVal, isBrowser };

45

dist/databeat-tracker.js

@@ -242,12 +242,15 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class; var _class2; var _class3;// src/rpc/proto/databeat.gen.ts

var DatabeatRpcClient = (_class2 = class extends Databeat {
constructor(hostname, authToken) {
constructor(hostname, auth) {
super(hostname.endsWith("/") ? hostname.slice(0, -1) : hostname, fetch);_class2.prototype.__init7.call(this);;
this.authToken = authToken;
this.auth = auth;
this.fetch = this._fetch;
}
__init7() {this._fetch = (input, init) => {
const headers = {};
if (this.authToken && this.authToken.length > 0) {
headers["Authorization"] = `BEARER ${this.authToken}`;
let headers = {};
if (this.auth.jwt && this.auth.jwt.length > 0) {
headers["Authorization"] = `BEARER ${this.auth.jwt}`;
}
if (this.auth.headers) {
headers = { ...headers, ...this.auth.headers };
}
init.headers = { ...init.headers, ...headers };

@@ -270,2 +273,3 @@ return fetch(input, init);

defaultEnabled: true,
noop: false,
privacy: { userIdHash: true, userAgentSalt: false },

@@ -294,5 +298,5 @@ userIdentTracking: false,

constructor(host, authToken, options) {;_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);
this.authToken = authToken;
this.rpc = new DatabeatRpcClient(host, authToken);
constructor(host, auth, options) {;_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);
this.auth = auth;
this.rpc = new DatabeatRpcClient(host, auth);
this.options = defaultDatabeatOptions;

@@ -307,2 +311,3 @@ if (options) {

flushInterval: options.flushInterval || defaultDatabeatOptions.flushInterval,
noop: options.noop || false,
initProps: options.initProps || defaultDatabeatOptions.initProps

@@ -315,3 +320,3 @@ };

init() {
this.enabled = isEnabled(this.options.defaultEnabled, this.authToken);
this.enabled = isEnabled(this.options.defaultEnabled, this.auth);
this.projectId = this.options.projectId || null;

@@ -327,3 +332,3 @@ this.userId = null;

reset(skipInit) {
this.enabled = isEnabled(this.options.defaultEnabled, this.authToken);
this.enabled = isEnabled(this.options.defaultEnabled, this.auth);
if (this.userId && !this.isAnon()) {

@@ -439,2 +444,4 @@ this.userId = null;

return;
if (this.options.noop)
return;
if (this.options.strictMode && !this.allowUserTracking)

@@ -479,3 +486,3 @@ return;

enable() {
if (this.authToken === "") {
if (!isAuthEnabled(this.auth)) {
this.enabled = false;

@@ -511,4 +518,4 @@ return;

};
var isEnabled = (defaultEnabled, authToken) => {
if (!authToken || authToken === "") {
var isEnabled = (defaultEnabled, auth) => {
if (!isAuthEnabled(auth)) {
return false;

@@ -530,2 +537,11 @@ }

};
var isAuthEnabled = (auth) => {
if (auth && auth.jwt.length > 0) {
return true;
}
if (auth && auth.headers && Object.keys(auth.headers).length > 0) {
return true;
}
return false;
};
var getPagePath = () => {

@@ -642,3 +658,4 @@ try {

exports.Databeat = Databeat2; exports.Ident = Ident; exports.genSessionId = genSessionId; exports.genUserId = genUserId; exports.getStorageVal = getStorageVal;
exports.Databeat = Databeat2; exports.Ident = Ident; exports.genSessionId = genSessionId; exports.genUserId = genUserId; exports.getStorageVal = getStorageVal; exports.isBrowser = isBrowser;
//# sourceMappingURL=databeat-tracker.js.map
{
"name": "@databeat/tracker",
"version": "0.7.0",
"version": "0.8.0",
"description": "databeat tracker client for Web browsers and node.js",

@@ -12,6 +12,2 @@ "main": "dist/databeat-tracker.js",

"license": "Apache 2.0",
"scripts": {
"build": "tsup",
"clean": "rimraf ./dist"
},
"files": [

@@ -30,10 +26,14 @@ "dist"

"dependencies": {
"@noble/hashes": "^1.3.1"
"@noble/hashes": "^1.3.2"
},
"devDependencies": {
"@types/node": "^20.4.1",
"rimraf": "^5.0.1",
"tsup": "^7.1.0",
"typescript": "^5.1.6"
"@types/node": "^20.10.4",
"rimraf": "^5.0.5",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
},
"scripts": {
"build": "tsup",
"clean": "rimraf ./dist"
}
}
}

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