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

@0no-co/mixpanel-micro

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0no-co/mixpanel-micro - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

dist/mixpanel-micro.d.ts

@@ -28,3 +28,3 @@ interface State {

declare function init(token: string): void;
declare function init(token: string): () => void;
declare function getProperty<Key extends keyof State>(key: Key): State[Key];

@@ -31,0 +31,0 @@ declare function track(eventName: string, data: Partial<State>): void;

@@ -216,12 +216,16 @@ Object.defineProperty(exports, "__esModule", {

async function flushQueue() {
var e;
while ((e = i.shift()) && isOnline()) {
if (!await flushPayload(e)) {
i.unshift(e);
if (function hasState() {
return !!e;
}()) {
var t;
while ((t = i.shift()) && isOnline()) {
if (!await flushPayload(t)) {
i.unshift(t);
}
}
o = !1;
if (i.length) {
setTimeout(send, 5e3);
}
}
o = !1;
if (i.length) {
setTimeout(send, 5e3);
}
}

@@ -281,4 +285,4 @@

init$2(e);
!function init$1() {
window.addEventListener("online", (function onOnline() {
return function init$1() {
function onOnline() {
if (!o) {

@@ -288,6 +292,4 @@ o = !0;

}
}), {
passive: !0
});
document.addEventListener("visibilitychange", (function onVisibilityChange(e) {
}
function onVisibilityChange(e) {
if (!o && "hidden" === document.visibilityState) {

@@ -297,3 +299,10 @@ o = !0;

}
}));
}
window.addEventListener("online", onOnline);
document.addEventListener("visibilitychange", onVisibilityChange);
return () => {
onOnline();
window.removeEventListener("online", onOnline);
document.removeEventListener("visibilitychange", onVisibilityChange);
};
}();

@@ -300,0 +309,0 @@ };

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

function e(e){return/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/Android/.test(e)?"Android":null}function t(e){return/Windows/i.test(e)?"Windows":/iPhone|iPad|iPod/.test(e)?"iOS":/Android/.test(e)?"Android":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":null}function n(e,t){var n;return(n=t.match("Konqueror"===e?/Konqueror:(\d+(\.\d+)?)/:"Android Mobile"===e?/android\s(\d+(\.\d+)?)/:"Internet Explorer"===e?/(rv:|MSIE )(\d+(\.\d+)?)/:"Mozilla"===e?/rv:(\d+(\.\d+)?)/:/(?:SamsungBrowser|Edge|Chrome|FxiOS|CriOS|UCBrowser|UCWEB|Version|Opera|OPR|Firefox|FxiOS)\/(\d+(\.\d+)?)/))&&parseFloat(n[n.length-2])||null}var r;function i(){if(r)return r.$current_url=window.location.href,r.referrer=document.referrer,r.time=Math.round(Date.now()/1e3),r}function o(e){for(var t in e)e[t]?r[t]=e[t]:delete r[t]}Object.defineProperty(exports,"__esModule",{value:!0});var a="https://api.mixpanel.com/track?ip=1&verbose=1&data=",s="https://api.mixpanel.com/engage?ip=1&verbose=1&data=",d=3;function u(){return!1!==navigator.onLine}function c(e,t){return null==t||""===t?void 0:t}var f=[],l=!1,h=!1;async function p(e){var t,n="$set"in e?s:a,r=(t=JSON.stringify(e,c),btoa(unescape(encodeURIComponent(t)))),i=Date.now();if(n+=`${encodeURIComponent(r)}&_=${i}`,!navigator.sendBeacon(n)){for(var o=0;o<d&&u();o++){try{if((await fetch(n,{method:"POST",keepalive:!0})).status<500)return!0}catch(e){}await new Promise((e=>{setTimeout(e,500+1e3*Math.random())}))}return!1}return!0}async function v(){for(var e;(e=f.shift())&&u();)await p(e)||f.unshift(e);l=!1,f.length&&setTimeout(g,5e3)}function g(e){h||(e&&f.push(e),!l&&u()&&(l=!0,"function"==typeof requestIdleCallback?requestIdleCallback(v):setTimeout(v,200)))}var m=()=>Math.random().toString(36).slice(2,10);function S(e){return(i()||{})[e]}function $(e,t){var n=m()+m();g({event:e,properties:{...i(),...t,$insert_id:n}})}exports.getProperty=S,exports.identify=function(e){var t=S("distinct_id");o({distinct_id:e,$user_id:e}),$("$identify",{$anon_distinct_id:t,distinct_id:e,$user_id:e})},exports.init=function(i){(function(i){var o,a=navigator.userAgent||"",s=function(){function e(){for(var e=Date.now(),t=0;e===Date.now();)t++;return e.toString(16)+t.toString(16)}var t=(screen.height*screen.width).toString(16);return`${e()}-${Math.random().toString(16).replace(".","")}-${function(){var e,t=navigator.userAgent,n=[];function r(e,t){for(var r=0,i=0;i<t.length;i++)r|=n[i]<<8*i;return e^r}for(var i=0,o=0;o<t.length;o++)e=t.charCodeAt(o),n.unshift(255&e),n.length>=4&&(i=r(i,n),n.length=0);return n.length>0&&(i=r(i,n)),i.toString(16)}()}-${t}-${e()}`}(),d=function(e){return"opera"in window||/ OPR\//.test(e)?/Mini/.test(e)?"Opera Mini":"Opera":/Edge/.test(e)?"Microsoft Edge":/FBIOS/.test(e)?"Facebook Mobile":/Chrome/.test(e)?"Chrome":/SamsungBrowser\//.test(e)?"Samsung Internet":/CriOS/.test(e)?"Chrome iOS":/UC(?:WEB|Browser)/.test(e)?"UC Browser":/FxiOS/.test(e)?"Firefox iOS":/Safari/.test(e)?/Mobile/.test(e)?"Mobile Safari":"Safari":/Android/.test(e)?"Android Mobile":/Konqueror/.test(e)?"Konqueror":/Firefox/.test(e)?"Firefox":/MSIE|Trident\//.test(e)?"Internet Explorer":/Gecko/.test(e)?"Mozilla":null}(a);r={token:i,$os:t(a),$browser:d,$browser_version:n(d,a),$device:e(a),$screen_height:screen.height,$screen_width:screen.width,$referrer:document.referrer,$referring_domain:(o=(document.referrer||"").split("/"),o.length>=3?o[2]:null),$current_url:window.location.href,distinct_id:s,$device_id:s,mp_lib:"mixpanel-lite",$lib_version:"0.0.0",doNotTrack:"1"==`${navigator.doNotTrack}`}})(i),window.addEventListener("online",(function(){l||(l=!0,v())}),{passive:!0}),document.addEventListener("visibilitychange",(function(e){l||"hidden"!==document.visibilityState||(l=!0,v())}))},exports.mute=function(){h=!0,l=!0},exports.register=o,exports.setPeople=function(e){g({$token:S("token"),$distinct_id:S("distinct_id"),$set:e})},exports.track=$,exports.unmute=function(){h=!1,l=!1,g()};
function e(e){return/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/Android/.test(e)?"Android":null}function t(e){return/Windows/i.test(e)?"Windows":/iPhone|iPad|iPod/.test(e)?"iOS":/Android/.test(e)?"Android":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":null}function n(e,t){var n;return(n=t.match("Konqueror"===e?/Konqueror:(\d+(\.\d+)?)/:"Android Mobile"===e?/android\s(\d+(\.\d+)?)/:"Internet Explorer"===e?/(rv:|MSIE )(\d+(\.\d+)?)/:"Mozilla"===e?/rv:(\d+(\.\d+)?)/:/(?:SamsungBrowser|Edge|Chrome|FxiOS|CriOS|UCBrowser|UCWEB|Version|Opera|OPR|Firefox|FxiOS)\/(\d+(\.\d+)?)/))&&parseFloat(n[n.length-2])||null}var r;function i(){if(r)return r.$current_url=window.location.href,r.referrer=document.referrer,r.time=Math.round(Date.now()/1e3),r}function o(e){for(var t in e)e[t]?r[t]=e[t]:delete r[t]}Object.defineProperty(exports,"__esModule",{value:!0});var s="https://api.mixpanel.com/track?ip=1&verbose=1&data=",a="https://api.mixpanel.com/engage?ip=1&verbose=1&data=",d=3;function u(){return!1!==navigator.onLine}function c(e,t){return null==t||""===t?void 0:t}var f=[],l=!1,h=!1;async function v(e){var t,n="$set"in e?a:s,r=(t=JSON.stringify(e,c),btoa(unescape(encodeURIComponent(t)))),i=Date.now();if(n+=`${encodeURIComponent(r)}&_=${i}`,!navigator.sendBeacon(n)){for(var o=0;o<d&&u();o++){try{if((await fetch(n,{method:"POST",keepalive:!0})).status<500)return!0}catch(e){}await new Promise((e=>{setTimeout(e,500+1e3*Math.random())}))}return!1}return!0}async function p(){if(r){for(var e;(e=f.shift())&&u();)await v(e)||f.unshift(e);l=!1,f.length&&setTimeout(g,5e3)}}function g(e){h||(e&&f.push(e),!l&&u()&&(l=!0,"function"==typeof requestIdleCallback?requestIdleCallback(p):setTimeout(p,200)))}var m=()=>Math.random().toString(36).slice(2,10);function w(e){return(i()||{})[e]}function S(e,t){var n=m()+m();g({event:e,properties:{...i(),...t,$insert_id:n}})}exports.getProperty=w,exports.identify=function(e){var t=w("distinct_id");o({distinct_id:e,$user_id:e}),S("$identify",{$anon_distinct_id:t,distinct_id:e,$user_id:e})},exports.init=function(i){return function(i){var o,s=navigator.userAgent||"",a=function(){function e(){for(var e=Date.now(),t=0;e===Date.now();)t++;return e.toString(16)+t.toString(16)}var t=(screen.height*screen.width).toString(16);return`${e()}-${Math.random().toString(16).replace(".","")}-${function(){var e,t=navigator.userAgent,n=[];function r(e,t){for(var r=0,i=0;i<t.length;i++)r|=n[i]<<8*i;return e^r}for(var i=0,o=0;o<t.length;o++)e=t.charCodeAt(o),n.unshift(255&e),n.length>=4&&(i=r(i,n),n.length=0);return n.length>0&&(i=r(i,n)),i.toString(16)}()}-${t}-${e()}`}(),d=function(e){return"opera"in window||/ OPR\//.test(e)?/Mini/.test(e)?"Opera Mini":"Opera":/Edge/.test(e)?"Microsoft Edge":/FBIOS/.test(e)?"Facebook Mobile":/Chrome/.test(e)?"Chrome":/SamsungBrowser\//.test(e)?"Samsung Internet":/CriOS/.test(e)?"Chrome iOS":/UC(?:WEB|Browser)/.test(e)?"UC Browser":/FxiOS/.test(e)?"Firefox iOS":/Safari/.test(e)?/Mobile/.test(e)?"Mobile Safari":"Safari":/Android/.test(e)?"Android Mobile":/Konqueror/.test(e)?"Konqueror":/Firefox/.test(e)?"Firefox":/MSIE|Trident\//.test(e)?"Internet Explorer":/Gecko/.test(e)?"Mozilla":null}(s);r={token:i,$os:t(s),$browser:d,$browser_version:n(d,s),$device:e(s),$screen_height:screen.height,$screen_width:screen.width,$referrer:document.referrer,$referring_domain:(o=(document.referrer||"").split("/"),o.length>=3?o[2]:null),$current_url:window.location.href,distinct_id:a,$device_id:a,mp_lib:"mixpanel-lite",$lib_version:"0.0.0",doNotTrack:"1"==`${navigator.doNotTrack}`}}(i),function(){function e(){l||(l=!0,p())}function t(e){l||"hidden"!==document.visibilityState||(l=!0,p())}return window.addEventListener("online",e),document.addEventListener("visibilitychange",t),()=>{e(),window.removeEventListener("online",e),document.removeEventListener("visibilitychange",t)}}()},exports.mute=function(){h=!0,l=!0},exports.register=o,exports.setPeople=function(e){g({$token:w("token"),$distinct_id:w("distinct_id"),$set:e})},exports.track=S,exports.unmute=function(){h=!1,l=!1,g()};
//# sourceMappingURL=mixpanel-micro.min.js.map
{
"name": "@0no-co/mixpanel-micro",
"description": "Tiny implementation of the Mixpanel browser API for modern browsers",
"version": "1.0.0",
"version": "1.1.0",
"sideEffects": false,

@@ -6,0 +6,0 @@ "public": true,

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

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