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.3.0 to 1.3.1

47

dist/mixpanel-micro.js

@@ -180,13 +180,28 @@ Object.defineProperty(exports, "__esModule", {

var _assemblePayload = e => "$set" in e ? {
...e,
$distinct_id: getBaseState().distinct_id,
$token: t || void 0
} : {
event: e.event,
properties: {
...getBaseState(),
...e.properties,
token: t || void 0
var _assemblePayload = e => {
if ("$set" in e) {
return {
...e,
$distinct_id: getBaseState().distinct_id,
$token: t || void 0
};
}
var n = {
...getBaseState()
};
for (var i in r) {
if (null != r[i]) {
n[i] = r[i];
}
}
for (var o in e.properties) {
if (null != e.properties[o]) {
n[o] = e.properties[o];
}
}
n.token = t || void 0;
return {
event: e.event,
properties: n
};
};

@@ -259,14 +274,12 @@

function track(e, t) {
var n = {
...r
};
var r = {};
if (t) {
for (var i in t) {
n[i] = t[i] || n[i] || null;
for (var n in t) {
r[n] = t[n] || r[n] || null;
}
}
n.$insert_id = rand16() + rand16();
r.$insert_id = rand16() + rand16();
send({
event: e,
properties: n
properties: r
});

@@ -273,0 +286,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,i;Object.defineProperty(exports,"__esModule",{value:!0});var o={};function s(){if(!r){var i=navigator.userAgent||"",o=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()}`}(),s=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}(i);r={$os:t(i),$browser:s,$browser_version:n(s,i),$device:e(i),$screen_height:screen.height,$screen_width:screen.width,$referrer:document.referrer,$referring_domain:(a=(document.referrer||"").split("/"),a.length>=3?a[2]:null),$current_url:window.location.href,distinct_id:o,$device_id:o,mp_lib:"mixpanel-lite",$lib_version:"0.0.0",doNotTrack:"1"==`${navigator.doNotTrack}`}}var a;return r}function a(e){for(var t in e)o[t]=e[t]||null}var d="https://api.mixpanel.com/track",u="https://api.mixpanel.com/engage",c=3;function l(){return!1!==navigator.onLine}function f(e,t){return null==t||""===t?void 0:t}var v=[],h=!1,p=!1,g=e=>"$set"in e?{...e,$distinct_id:s().distinct_id,$token:i||void 0}:{event:e.event,properties:{...s(),...e.properties,token:i||void 0}};async function m(e){var t,n="$set"in e?u:d,r=g(e),i=(t=JSON.stringify(r,f),btoa(unescape(encodeURIComponent(t)))),o=Date.now(),s=n+`?ip=1&verbose=1&data=${encodeURIComponent(i)}&_=${o}`;if(!navigator.sendBeacon(s)){for(var a=0;a<c&&l();a++){await new Promise((e=>{setTimeout(e,500+1e3*Math.random())}));try{if((await fetch(s,{method:"POST",keepalive:!0})).status<500)return!0}catch(e){}}return!1}return!0}async function S(){if(null!=i){for(var e;(e=v.shift())&&l();)await m(e)||v.unshift(e);h=!1,v.length&&setTimeout($,5e3)}}function $(e){p||(e&&v.push(e),!h&&l()&&(h=!0,"function"==typeof requestIdleCallback?requestIdleCallback(S):setTimeout(S,200)))}var w=()=>Math.random().toString(36).slice(2,10);function x(e,t){var n={...o};if(t)for(var r in t)n[r]=t[r]||n[r]||null;n.$insert_id=w()+w(),$({event:e,properties:n})}exports.getProperty=function(e){return o[e]?o[e]:s()[e]},exports.identify=function(e){a({$anon_distinct_id:s().distinct_id,distinct_id:e,$user_id:e}),x("$identify")},exports.init=function(e){return function(e){s(),i=e}(e),function(){function e(){h||(h=!0,S())}function t(e){h||"hidden"!==document.visibilityState||(h=!0,S())}return window.addEventListener("online",e),document.addEventListener("visibilitychange",t),()=>{e(),window.removeEventListener("online",e),document.removeEventListener("visibilitychange",t)}}()},exports.mute=function(){p=!0,h=!0},exports.register=a,exports.setPeople=function(e){$({$set:e})},exports.track=x,exports.unmute=function(){p=!1,h=!1,$()};
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,i;Object.defineProperty(exports,"__esModule",{value:!0});var o={};function s(){if(!r){var i=navigator.userAgent||"",o=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()}`}(),s=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}(i);r={$os:t(i),$browser:s,$browser_version:n(s,i),$device:e(i),$screen_height:screen.height,$screen_width:screen.width,$referrer:document.referrer,$referring_domain:(a=(document.referrer||"").split("/"),a.length>=3?a[2]:null),$current_url:window.location.href,distinct_id:o,$device_id:o,mp_lib:"mixpanel-lite",$lib_version:"0.0.0",doNotTrack:"1"==`${navigator.doNotTrack}`}}var a;return r}function a(e){for(var t in e)o[t]=e[t]||null}var d="https://api.mixpanel.com/track",u="https://api.mixpanel.com/engage",c=3;function l(){return!1!==navigator.onLine}function f(e,t){return null==t||""===t?void 0:t}var v=[],p=!1,h=!1,g=e=>{if("$set"in e)return{...e,$distinct_id:s().distinct_id,$token:i||void 0};var t={...s()};for(var n in o)null!=o[n]&&(t[n]=o[n]);for(var r in e.properties)null!=e.properties[r]&&(t[r]=e.properties[r]);return t.token=i||void 0,{event:e.event,properties:t}};async function m(e){var t,n="$set"in e?u:d,r=g(e),i=(t=JSON.stringify(r,f),btoa(unescape(encodeURIComponent(t)))),o=Date.now(),s=n+`?ip=1&verbose=1&data=${encodeURIComponent(i)}&_=${o}`;if(!navigator.sendBeacon(s)){for(var a=0;a<c&&l();a++){await new Promise((e=>{setTimeout(e,500+1e3*Math.random())}));try{if((await fetch(s,{method:"POST",keepalive:!0})).status<500)return!0}catch(e){}}return!1}return!0}async function S(){if(null!=i){for(var e;(e=v.shift())&&l();)await m(e)||v.unshift(e);p=!1,v.length&&setTimeout($,5e3)}}function $(e){h||(e&&v.push(e),!p&&l()&&(p=!0,"function"==typeof requestIdleCallback?requestIdleCallback(S):setTimeout(S,200)))}var w=()=>Math.random().toString(36).slice(2,10);function x(e,t){var n={};if(t)for(var r in t)n[r]=t[r]||n[r]||null;n.$insert_id=w()+w(),$({event:e,properties:n})}exports.getProperty=function(e){return o[e]?o[e]:s()[e]},exports.identify=function(e){a({$anon_distinct_id:s().distinct_id,distinct_id:e,$user_id:e}),x("$identify")},exports.init=function(e){return function(e){s(),i=e}(e),function(){function e(){p||(p=!0,S())}function t(e){p||"hidden"!==document.visibilityState||(p=!0,S())}return window.addEventListener("online",e),document.addEventListener("visibilitychange",t),()=>{e(),window.removeEventListener("online",e),document.removeEventListener("visibilitychange",t)}}()},exports.mute=function(){h=!0,p=!0},exports.register=a,exports.setPeople=function(e){$({$set:e})},exports.track=x,exports.unmute=function(){h=!1,p=!1,$()};
//# sourceMappingURL=mixpanel-micro.min.js.map
{
"name": "@0no-co/mixpanel-micro",
"description": "Tiny implementation of the Mixpanel browser API for modern browsers",
"version": "1.3.0",
"version": "1.3.1",
"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