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

insights-js

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

insights-js - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

dist/types/utils.d.ts

35

dist/insights-js.cjs.js

@@ -5,6 +5,6 @@ 'use strict';

// not supported by the server just yet!
// export function number(amount: number, value: string) {
// return { type: "number", value, amount }
// }
function isInBrowser() {
return typeof window !== "undefined";
}
/**

@@ -14,2 +14,5 @@ * Logs the default locale of the current user.

function locale() {
if (!isInBrowser()) {
return { type: "locale", value: "<not-in-browser>" };
}
var value = typeof navigator.languages !== "undefined" ? navigator.languages[0] : navigator.language;

@@ -40,2 +43,5 @@ return { type: "locale", value: value || "<none>" };

function screenType() {
if (!isInBrowser()) {
return { type: "screen-type", value: "<not-in-browser>" };
}
return { type: "screen-type", value: getScreenType() };

@@ -47,2 +53,5 @@ }

function referrer() {
if (!isInBrowser()) {
return { type: "referrer", value: "<not-in-browser>" };
}
return { type: "referrer", value: document.referrer || "<none>" };

@@ -60,2 +69,5 @@ }

if (search === void 0) { search = false; }
if (!isInBrowser()) {
return { type: "path", value: "<not-in-browser>" };
}
var value = window.location.pathname;

@@ -112,3 +124,3 @@ var _hash = window.location.hash;

App.prototype.track = function (event) {
if (this.options.disabled) {
if (this.options.disabled || !isInBrowser()) {
return Promise.resolve();

@@ -153,2 +165,5 @@ }

App.prototype.trackPages = function (options) {
if (!isInBrowser()) {
return { stop: function () { } };
}
if (this.trackPageData) {

@@ -219,3 +234,3 @@ return this.trackPageData.result;

function init(projectId, options) {
if (apps.length > 0) {
if (!isInBrowser() || apps.length > 0) {
throw new Error("Already initialized!");

@@ -234,4 +249,4 @@ }

var app = apps[0];
if (!app)
throw new Error("No intialized apps!");
if (!app || !isInBrowser())
return;
app.track(event);

@@ -258,4 +273,4 @@ }

var app = apps[0];
if (!app)
throw new Error("No intialized apps!");
if (!app || !isInBrowser())
return { stop: function () { } };
return app.trackPages(options);

@@ -262,0 +277,0 @@ }

@@ -1,5 +0,5 @@

// not supported by the server just yet!
// export function number(amount: number, value: string) {
// return { type: "number", value, amount }
// }
function isInBrowser() {
return typeof window !== "undefined";
}
/**

@@ -9,2 +9,5 @@ * Logs the default locale of the current user.

function locale() {
if (!isInBrowser()) {
return { type: "locale", value: "<not-in-browser>" };
}
var value = typeof navigator.languages !== "undefined" ? navigator.languages[0] : navigator.language;

@@ -35,2 +38,5 @@ return { type: "locale", value: value || "<none>" };

function screenType() {
if (!isInBrowser()) {
return { type: "screen-type", value: "<not-in-browser>" };
}
return { type: "screen-type", value: getScreenType() };

@@ -42,2 +48,5 @@ }

function referrer() {
if (!isInBrowser()) {
return { type: "referrer", value: "<not-in-browser>" };
}
return { type: "referrer", value: document.referrer || "<none>" };

@@ -55,2 +64,5 @@ }

if (search === void 0) { search = false; }
if (!isInBrowser()) {
return { type: "path", value: "<not-in-browser>" };
}
var value = window.location.pathname;

@@ -107,3 +119,3 @@ var _hash = window.location.hash;

App.prototype.track = function (event) {
if (this.options.disabled) {
if (this.options.disabled || !isInBrowser()) {
return Promise.resolve();

@@ -148,2 +160,5 @@ }

App.prototype.trackPages = function (options) {
if (!isInBrowser()) {
return { stop: function () { } };
}
if (this.trackPageData) {

@@ -214,3 +229,3 @@ return this.trackPageData.result;

function init(projectId, options) {
if (apps.length > 0) {
if (!isInBrowser() || apps.length > 0) {
throw new Error("Already initialized!");

@@ -229,4 +244,4 @@ }

var app = apps[0];
if (!app)
throw new Error("No intialized apps!");
if (!app || !isInBrowser())
return;
app.track(event);

@@ -253,4 +268,4 @@ }

var app = apps[0];
if (!app)
throw new Error("No intialized apps!");
if (!app || !isInBrowser())
return { stop: function () { } };
return app.trackPages(options);

@@ -257,0 +272,0 @@ }

@@ -7,6 +7,6 @@ (function (global, factory) {

// not supported by the server just yet!
// export function number(amount: number, value: string) {
// return { type: "number", value, amount }
// }
function isInBrowser() {
return typeof window !== "undefined";
}
/**

@@ -16,2 +16,5 @@ * Logs the default locale of the current user.

function locale() {
if (!isInBrowser()) {
return { type: "locale", value: "<not-in-browser>" };
}
var value = typeof navigator.languages !== "undefined" ? navigator.languages[0] : navigator.language;

@@ -42,2 +45,5 @@ return { type: "locale", value: value || "<none>" };

function screenType() {
if (!isInBrowser()) {
return { type: "screen-type", value: "<not-in-browser>" };
}
return { type: "screen-type", value: getScreenType() };

@@ -49,2 +55,5 @@ }

function referrer() {
if (!isInBrowser()) {
return { type: "referrer", value: "<not-in-browser>" };
}
return { type: "referrer", value: document.referrer || "<none>" };

@@ -62,2 +71,5 @@ }

if (search === void 0) { search = false; }
if (!isInBrowser()) {
return { type: "path", value: "<not-in-browser>" };
}
var value = window.location.pathname;

@@ -114,3 +126,3 @@ var _hash = window.location.hash;

App.prototype.track = function (event) {
if (this.options.disabled) {
if (this.options.disabled || !isInBrowser()) {
return Promise.resolve();

@@ -155,2 +167,5 @@ }

App.prototype.trackPages = function (options) {
if (!isInBrowser()) {
return { stop: function () { } };
}
if (this.trackPageData) {

@@ -221,3 +236,3 @@ return this.trackPageData.result;

function init(projectId, options) {
if (apps.length > 0) {
if (!isInBrowser() || apps.length > 0) {
throw new Error("Already initialized!");

@@ -236,4 +251,4 @@ }

var app = apps[0];
if (!app)
throw new Error("No intialized apps!");
if (!app || !isInBrowser())
return;
app.track(event);

@@ -260,4 +275,4 @@ }

var app = apps[0];
if (!app)
throw new Error("No intialized apps!");
if (!app || !isInBrowser())
return { stop: function () { } };
return app.trackPages(options);

@@ -264,0 +279,0 @@ }

import * as parameters from "./parameters";
import { App, AppOptions, TrackEventPayload, TrackPagesOptions, TrackPagesResult } from "./App";
export { parameters };
export { App };
export { App, AppOptions, TrackEventPayload, TrackPagesOptions, TrackPagesResult };
export declare const apps: App[];

@@ -6,0 +6,0 @@ /**

{
"name": "insights-js",
"version": "0.3.0",
"version": "0.4.0",
"description": "Javascript client for getinsights.io",

@@ -5,0 +5,0 @@ "keywords": [],

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