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 1.2.9 to 1.2.10

dist/esnext/App.d.ts

1

dist/insights-js.cjs.js

@@ -160,2 +160,3 @@ 'use strict';

var parameters = /*#__PURE__*/Object.freeze({
__proto__: null,
locale: locale,

@@ -162,0 +163,0 @@ screenType: screenType,

@@ -156,2 +156,3 @@ function isInBrowser() {

var parameters = /*#__PURE__*/Object.freeze({
__proto__: null,
locale: locale,

@@ -158,0 +159,0 @@ screenType: screenType,

5

dist/insights-js.umd.js

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = global || self, factory(global.insights = {}));
}(this, function (exports) { 'use strict';
}(this, (function (exports) { 'use strict';

@@ -163,2 +163,3 @@ function isInBrowser() {

var parameters = /*#__PURE__*/Object.freeze({
__proto__: null,
locale: locale,

@@ -408,2 +409,2 @@ screenType: screenType,

}));
})));

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).insights={})}(this,function(a){"use strict";function s(){return"undefined"!=typeof window}function u(){return location.protocol+"//"+location.host}function c(){if(!s())return!1;var t=document.referrer||"",e=u();return t.substr(0,e.length)===e}function p(){return s()?{type:"locale",value:function(){var t=void 0!==navigator.languages?navigator.languages[0]:navigator.language;return'"'===t[0]&&(t=t.substr(1)),0<t.length&&'"'===t[t.length-1]&&(t=t.substr(0,t.length-1)),t&&5===t.length&&"-"===t[2]?t.substr(0,3)+t.substr(3).toLocaleUpperCase():t}()||"<none>"}:{type:"locale",value:"<not-in-browser>"}}function h(){return s()?{type:"screen-type",value:function(){var t=window.innerWidth;return t<=414?"XS":t<=800?"S":t<=1200?"M":t<=1600?"L":"XL"}()}:{type:"screen-type",value:"<not-in-browser>"}}function g(){return s()?c()?{type:"referrer",value:"<none>"}:{type:"referrer",value:document.referrer||"<none>"}:{type:"referrer",value:"<not-in-browser>"}}function l(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=!1),!s())return{type:"path",value:"<not-in-browser>"};var a=window.location.pathname,r=window.location.hash,n=window.location.search;return t&&e?a+=r:t?a+=r.substr(0,r.length-n.length):e&&(a+=n),{type:"path",value:a}}function v(t,e){return{type:"transition",value:t+" -> "+e}}function d(t,e){return void 0===e&&(e=""),t<5e3?{type:"duration-interval",value:e+"< 5s"}:t<15e3?{type:"duration-interval",value:e+"< 15s"}:t<3e4?{type:"duration-interval",value:e+"< 30s"}:t<6e4?{type:"duration-interval",value:e+"< 1m"}:t<3e5?{type:"duration-interval",value:e+"< 5m"}:{type:"duration-interval",value:e+"> 5m"}}var t=Object.freeze({locale:p,screenType:h,referrer:g,path:l,transition:v,durationInterval:d}),r={},n=(e.prototype.track=function(t){if(this.options.disabled||!s())return Promise.resolve();if(t.unique){var e=JSON.stringify(t);if(this.uniques[e])return Promise.resolve();this.uniques[e]=!0}var a={id:t.id,projectId:this.projectId,ignoreErrors:this.options.ignoreErrors||!1};t.remove&&(a.remove=!0),t.parameters&&(a.parameters=t.parameters),t.update&&(a.update=!0);var r=new XMLHttpRequest;r.open("post","https://getinsights.io/app/tics",!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(a))},e.prototype.trackPages=function(t){if(!s())return{stop:function(){}};if(this.trackPageData)return this.trackPageData.result;var e=setInterval(this.trackPageChange,2e3),a=t||{},r=a.hash,n=void 0!==r&&r,i=a.search,o=void 0!==i&&i;return this.trackPageData={hash:n,search:o,path:l(n,o).value,isOnFirstPage:!0,time:Date.now(),result:{stop:function(){clearInterval(e)}}},this.trackSinglePage(!0,this.trackPageData.path),window.addEventListener("unload",this.trackLastPageTimeSpent),this.trackPageData.result},e.prototype.getPreviousPage=function(t){var e=this.trackPageData&&this.trackPageData.path;return!t&&e?e:c()?document.referrer.replace(u(),""):document.referrer},e.prototype.trackPageChange=function(){if(this.trackPageData){var t=this.trackPageData,e=l(t.hash,t.search).value;e!==this.trackPageData.path&&this.trackSinglePage(!1,e)}},e.prototype.trackSinglePage=function(t,e){if(this.trackPageData){this.trackPageData.isOnFirstPage=t&&!c();var a=this.trackPageData,r=a.time,n=a.isOnFirstPage,i={path:e};n&&(i.uniqueViews=e,i.referrer=g(),i.locale=p(),i.screenType=h());var o=this.getPreviousPage(t);if(o&&o!==e&&(i.transitions=v(o,e),!n)){var s=Date.now();this.trackPageData.time=s,i.duration=d(s-r,o+" - ")}this.trackPageData.path=e,this.track({id:"page-views",parameters:i})}},e.prototype.trackLastPageTimeSpent=function(){var t=this.trackPageData&&this.trackPageData.time;if(t&&"function"==typeof navigator.sendBeacon&&!this.options.disabled&&this.trackPageData){var e=this.trackPageData,a=e.isOnFirstPage,r=e.path,n={};n.duration=d(Date.now()-t,r+" - ");var i=document.activeElement&&document.activeElement.href||"",o=u();i?"/"!==i[0]&&i.substr(0,o.length)!==u()&&(n.transitions=v(r,i)):n.bounces=a?"Yes":"No",navigator.sendBeacon=navigator.sendBeacon||function(t,e){var a=new XMLHttpRequest;a.open("post",t,!1),a.send(e)},navigator.sendBeacon("https://getinsights.io/app/tics",JSON.stringify({id:"page-views",projectId:this.projectId,parameters:n,ignoreErrors:this.options.ignoreErrors||!1,update:!0}))}},e);function e(t,e){void 0===e&&(e=r),this.projectId=t,this.options=e,this.uniques={},this.trackPageData=null,this.trackPageChange=this.trackPageChange.bind(this),this.trackLastPageTimeSpent=this.trackLastPageTimeSpent.bind(this)}a.DEFAULT_APP=null,a.App=n,a.init=function(t,e){if(!s()||a.DEFAULT_APP)throw new Error("Already initialized!");return a.DEFAULT_APP=new n(t,e),a.DEFAULT_APP},a.parameters=t,a.track=function(t){a.DEFAULT_APP&&s()&&a.DEFAULT_APP.track(t)},a.trackPages=function(t){return a.DEFAULT_APP&&s()?a.DEFAULT_APP.trackPages(t):{stop:function(){}}},Object.defineProperty(a,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).insights={})}(this,function(a){"use strict";function s(){return"undefined"!=typeof window}function u(){return location.protocol+"//"+location.host}function c(){if(s()){var t=document.referrer||"",e=u();return t.substr(0,e.length)===e}}function p(){return s()?{type:"locale",value:('"'===(t=void 0!==navigator.languages?navigator.languages[0]:navigator.language)[0]&&(t=t.substr(1)),0<t.length&&'"'===t[t.length-1]&&(t=t.substr(0,t.length-1)),(t&&5===t.length&&"-"===t[2]?t.substr(0,3)+t.substr(3).toLocaleUpperCase():t)||"<none>")}:{type:"locale",value:"<not-in-browser>"};var t}function h(){return s()?{type:"screen-type",value:(t=window.innerWidth)<=414?"XS":t<=800?"S":t<=1200?"M":t<=1600?"L":"XL"}:{type:"screen-type",value:"<not-in-browser>"};var t}function g(){return s()?c()?{type:"referrer",value:"<none>"}:{type:"referrer",value:document.referrer||"<none>"}:{type:"referrer",value:"<not-in-browser>"}}function l(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=!1),!s())return{type:"path",value:"<not-in-browser>"};var a=window.location.pathname,r=window.location.hash,n=window.location.search;return t&&e?a+=r:t?a+=r.substr(0,r.length-n.length):e&&(a+=n),{type:"path",value:a}}function v(t,e){return{type:"transition",value:t+" -> "+e}}function d(t,e){return void 0===e&&(e=""),t<5e3?{type:"duration-interval",value:e+"< 5s"}:t<15e3?{type:"duration-interval",value:e+"< 15s"}:t<3e4?{type:"duration-interval",value:e+"< 30s"}:t<6e4?{type:"duration-interval",value:e+"< 1m"}:t<3e5?{type:"duration-interval",value:e+"< 5m"}:{type:"duration-interval",value:e+"> 5m"}}var t=Object.freeze({__proto__:null,locale:p,screenType:h,referrer:g,path:l,transition:v,durationInterval:d}),r={},n=(e.prototype.track=function(t){if(this.options.disabled||!s())return Promise.resolve();if(t.unique){var e=JSON.stringify(t);if(this.uniques[e])return Promise.resolve();this.uniques[e]=!0}var a={id:t.id,projectId:this.projectId,ignoreErrors:this.options.ignoreErrors||!1};t.remove&&(a.remove=!0),t.parameters&&(a.parameters=t.parameters),t.update&&(a.update=!0);var r=new XMLHttpRequest;r.open("post","https://getinsights.io/app/tics",!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(a))},e.prototype.trackPages=function(t){if(!s())return{stop:function(){}};if(this.trackPageData)return this.trackPageData.result;var e=setInterval(this.trackPageChange,2e3),a=t||{},r=a.hash,n=void 0!==r&&r,i=a.search,o=void 0!==i&&i;return this.trackPageData={hash:n,search:o,path:l(n,o).value,isOnFirstPage:!0,time:Date.now(),result:{stop:function(){clearInterval(e)}}},this.trackSinglePage(!0,this.trackPageData.path),window.addEventListener("unload",this.trackLastPageTimeSpent),this.trackPageData.result},e.prototype.getPreviousPage=function(t){var e=this.trackPageData&&this.trackPageData.path;return!t&&e?e:c()?document.referrer.replace(u(),""):document.referrer},e.prototype.trackPageChange=function(){if(this.trackPageData){var t=this.trackPageData,e=l(t.hash,t.search).value;e!==this.trackPageData.path&&this.trackSinglePage(!1,e)}},e.prototype.trackSinglePage=function(t,e){if(this.trackPageData){this.trackPageData.isOnFirstPage=t&&!c();var a=this.trackPageData,r=a.time,n=a.isOnFirstPage,i={path:e};n&&(i.uniqueViews=e,i.referrer=g(),i.locale=p(),i.screenType=h());var o=this.getPreviousPage(t);if(o&&o!==e&&(i.transitions=v(o,e),!n)){var s=Date.now();this.trackPageData.time=s,i.duration=d(s-r,o+" - ")}this.trackPageData.path=e,this.track({id:"page-views",parameters:i})}},e.prototype.trackLastPageTimeSpent=function(){var t=this.trackPageData&&this.trackPageData.time;if(t&&"function"==typeof navigator.sendBeacon&&!this.options.disabled&&this.trackPageData){var e=this.trackPageData,a=e.isOnFirstPage,r=e.path,n={};n.duration=d(Date.now()-t,r+" - ");var i=document.activeElement&&document.activeElement.href||"",o=u();i?"/"!==i[0]&&i.substr(0,o.length)!==u()&&(n.transitions=v(r,i)):n.bounces=a?"Yes":"No",navigator.sendBeacon=navigator.sendBeacon||function(t,e){var a=new XMLHttpRequest;a.open("post",t,!1),a.send(e)},navigator.sendBeacon("https://getinsights.io/app/tics",JSON.stringify({id:"page-views",projectId:this.projectId,parameters:n,ignoreErrors:this.options.ignoreErrors||!1,update:!0}))}},e);function e(t,e){void 0===e&&(e=r),this.projectId=t,this.options=e,this.uniques={},this.trackPageData=null,this.trackPageChange=this.trackPageChange.bind(this),this.trackLastPageTimeSpent=this.trackLastPageTimeSpent.bind(this)}a.DEFAULT_APP=null,a.App=n,a.init=function(t,e){if(!s()||a.DEFAULT_APP)throw new Error("Already initialized!");return a.DEFAULT_APP=new n(t,e),a.DEFAULT_APP},a.parameters=t,a.track=function(t){a.DEFAULT_APP&&s()&&a.DEFAULT_APP.track(t)},a.trackPages=function(t){return a.DEFAULT_APP&&s()?a.DEFAULT_APP.trackPages(t):{stop:function(){}}},Object.defineProperty(a,"__esModule",{value:!0})});
{
"name": "insights-js",
"version": "1.2.9",
"version": "1.2.10",
"description": "Javascript client for getinsights.io",

@@ -9,3 +9,4 @@ "keywords": [],

"browser": "dist/insights-js.umd.js",
"typings": "dist/types/index.d.ts",
"esnext": "dist/esnext/index.js",
"typings": "dist/esnext/index.d.ts",
"files": [

@@ -22,6 +23,7 @@ "dist"

"prepublish": "npm run build",
"build": "rollup -c",
"build": "rollup -c && tsc -p tsconfig.esnext.json",
"start": "rollup -c -w",
"doc": "npm run docs",
"docs": "rimraf docs && typedoc src/index.ts"
"docs": "rimraf docs && typedoc src/index.ts",
"tsc": "tsc -p tsconfig.esnext.json"
},

@@ -34,17 +36,17 @@ "prettier": {

"devDependencies": {
"@types/node": "12.7.4",
"@types/node-fetch": "2.5.0",
"prettier": "1.18.2",
"rimraf": "3.0.0",
"rollup": "1.20.3",
"@types/node": "13.7.4",
"@types/node-fetch": "2.5.4",
"prettier": "1.19.1",
"rimraf": "3.0.2",
"rollup": "1.31.1",
"rollup-plugin-commonjs": "10.1.0",
"rollup-plugin-json": "4.0.0",
"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-sourcemaps": "0.4.2",
"rollup-plugin-typescript2": "0.24.0",
"rollup-plugin-uglify": "^6.0.3",
"typedoc": "^0.15.0",
"typedoc-plugin-markdown": "^2.1.11",
"typescript": "3.6.2"
"rollup-plugin-sourcemaps": "0.5.0",
"rollup-plugin-typescript2": "0.26.0",
"rollup-plugin-uglify": "6.0.4",
"typedoc": "0.16.10",
"typedoc-plugin-markdown": "2.2.16",
"typescript": "3.8.2"
}
}
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