🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

mixpanel-browser

Package Overview
Dependencies
Maintainers
3
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mixpanel-browser - npm Package Compare versions

Comparing version

to
2.65.0

8

CHANGELOG.md

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

**2.65.0** (20 May 2025)
- `mixpanel.people.track_charge()` (deprecated) no longer sets profile property
- Adds page height and width tracking to autocapture click tracking
- Session recording now stops when mixpanel.reset() is called
- Support for adding arbitrary query string params to tracking requests (thanks @dylan-asos)
- Feature flagging API revisions
- Whale Browser detection
**2.64.0** (15 Apr 2025)

@@ -2,0 +10,0 @@ - Add `record_heatmap_data` init option for Session Recording to ensure click events are captured for Heat Maps

2

package.json
{
"name": "mixpanel-browser",
"version": "2.64.0",
"version": "2.65.0",
"description": "The official Mixpanel JavaScript browser client library",

@@ -5,0 +5,0 @@ "main": "dist/mixpanel.cjs.js",

@@ -81,2 +81,2 @@

## Thanks
For patches and support: @bohanyang, @dehau, @drubin, @D1plo1d, @feychenie, @mogstad, @pfhayes, @sandorfr, @stefansedich, @gfx, @pkaminski, @austince, @danielbaker, @mkdai, @wolever, @dpraul, @chriszamierowski, @JoaoGomesTW, @@aliyalcinkaya, @chrisdeely
For patches and support: @bohanyang, @dehau, @drubin, @D1plo1d, @feychenie, @mogstad, @pfhayes, @sandorfr, @stefansedich, @gfx, @pkaminski, @austince, @danielbaker, @mkdai, @wolever, @dpraul, @chriszamierowski, @JoaoGomesTW, @@aliyalcinkaya, @chrisdeely, @dylan-asos

@@ -172,3 +172,5 @@ // stateless utils

'$viewportHeight': Math.max(docElement['clientHeight'], window['innerHeight'] || 0),
'$viewportWidth': Math.max(docElement['clientWidth'], window['innerWidth'] || 0)
'$viewportWidth': Math.max(docElement['clientWidth'], window['innerWidth'] || 0),
'$pageHeight': document['body']['offsetHeight'] || 0,
'$pageWidth': document['body']['offsetWidth'] || 0,
};

@@ -175,0 +177,0 @@ _.each(captureExtraAttrs, function(attr) {

var Config = {
DEBUG: false,
LIB_VERSION: '2.64.0'
LIB_VERSION: '2.65.0'
};
export default Config;

@@ -52,8 +52,8 @@ import { _, console_with_prefix, safewrapClass } from '../utils'; // eslint-disable-line camelcase

FeatureFlagManager.prototype.isEnabled = function() {
FeatureFlagManager.prototype.isSystemEnabled = function() {
return !!this.getMpConfig(FLAGS_CONFIG_KEY);
};
FeatureFlagManager.prototype.areFeaturesReady = function() {
if (!this.isEnabled()) {
FeatureFlagManager.prototype.areFlagsReady = function() {
if (!this.isSystemEnabled()) {
logger.error('Feature Flags not enabled');

@@ -65,3 +65,3 @@ }

FeatureFlagManager.prototype.fetchFlags = function() {
if (!this.isEnabled()) {
if (!this.isSystemEnabled()) {
return;

@@ -92,3 +92,3 @@ }

'key': data['variant_key'],
'data': data['variant_value']
'value': data['variant_value']
});

@@ -103,3 +103,3 @@ });

FeatureFlagManager.prototype.getFeature = function(featureName, fallback) {
FeatureFlagManager.prototype.getVariant = function(featureName, fallback) {
if (!this.fetchPromise) {

@@ -113,3 +113,3 @@ return new Promise(function(resolve) {

return this.fetchPromise.then(function() {
return this.getFeatureSync(featureName, fallback);
return this.getVariantSync(featureName, fallback);
}.bind(this)).catch(function(error) {

@@ -121,4 +121,4 @@ logger.error(error);

FeatureFlagManager.prototype.getFeatureSync = function(featureName, fallback) {
if (!this.areFeaturesReady()) {
FeatureFlagManager.prototype.getVariantSync = function(featureName, fallback) {
if (!this.areFlagsReady()) {
logger.log('Flags not loaded yet');

@@ -136,5 +136,5 @@ return fallback;

FeatureFlagManager.prototype.getFeatureData = function(featureName, fallbackValue) {
return this.getFeature(featureName, {'data': fallbackValue}).then(function(feature) {
return feature['data'];
FeatureFlagManager.prototype.getVariantValue = function(featureName, fallbackValue) {
return this.getVariant(featureName, {'value': fallbackValue}).then(function(feature) {
return feature['value'];
}).catch(function(error) {

@@ -146,9 +146,15 @@ logger.error(error);

FeatureFlagManager.prototype.getFeatureDataSync = function(featureName, fallbackValue) {
return this.getFeatureSync(featureName, {'data': fallbackValue})['data'];
// TODO remove deprecated method
FeatureFlagManager.prototype.getFeatureData = function(featureName, fallbackValue) {
logger.critical('mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead.');
return this.getVariantValue(featureName, fallbackValue);
};
FeatureFlagManager.prototype.isFeatureEnabled = function(featureName, fallbackValue) {
return this.getFeatureData(featureName).then(function() {
return this.isFeatureEnabledSync(featureName, fallbackValue);
FeatureFlagManager.prototype.getVariantValueSync = function(featureName, fallbackValue) {
return this.getVariantSync(featureName, {'value': fallbackValue})['value'];
};
FeatureFlagManager.prototype.isEnabled = function(featureName, fallbackValue) {
return this.getVariantValue(featureName).then(function() {
return this.isEnabledSync(featureName, fallbackValue);
}.bind(this)).catch(function(error) {

@@ -160,5 +166,5 @@ logger.error(error);

FeatureFlagManager.prototype.isFeatureEnabledSync = function(featureName, fallbackValue) {
FeatureFlagManager.prototype.isEnabledSync = function(featureName, fallbackValue) {
fallbackValue = fallbackValue || false;
var val = this.getFeatureDataSync(featureName, fallbackValue);
var val = this.getVariantValueSync(featureName, fallbackValue);
if (val !== true && val !== false) {

@@ -192,10 +198,13 @@ logger.error('Feature flag "' + featureName + '" value: ' + val + ' is not a boolean; returning fallback value: ' + fallbackValue);

FeatureFlagManager.prototype['are_features_ready'] = FeatureFlagManager.prototype.areFeaturesReady;
FeatureFlagManager.prototype['get_feature'] = FeatureFlagManager.prototype.getFeature;
FeatureFlagManager.prototype['are_flags_ready'] = FeatureFlagManager.prototype.areFlagsReady;
FeatureFlagManager.prototype['get_variant'] = FeatureFlagManager.prototype.getVariant;
FeatureFlagManager.prototype['get_variant_sync'] = FeatureFlagManager.prototype.getVariantSync;
FeatureFlagManager.prototype['get_variant_value'] = FeatureFlagManager.prototype.getVariantValue;
FeatureFlagManager.prototype['get_variant_value_sync'] = FeatureFlagManager.prototype.getVariantValueSync;
FeatureFlagManager.prototype['is_enabled'] = FeatureFlagManager.prototype.isEnabled;
FeatureFlagManager.prototype['is_enabled_sync'] = FeatureFlagManager.prototype.isEnabledSync;
// Deprecated method
FeatureFlagManager.prototype['get_feature_data'] = FeatureFlagManager.prototype.getFeatureData;
FeatureFlagManager.prototype['get_feature_data_sync'] = FeatureFlagManager.prototype.getFeatureDataSync;
FeatureFlagManager.prototype['get_feature_sync'] = FeatureFlagManager.prototype.getFeatureSync;
FeatureFlagManager.prototype['is_feature_enabled'] = FeatureFlagManager.prototype.isFeatureEnabled;
FeatureFlagManager.prototype['is_feature_enabled_sync'] = FeatureFlagManager.prototype.isFeatureEnabledSync;
export { FeatureFlagManager };

@@ -265,14 +265,4 @@ /* eslint camelcase: "off" */

*/
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(amount, properties, callback) {
if (!_.isNumber(amount)) {
amount = parseFloat(amount);
if (isNaN(amount)) {
console.error('Invalid value passed to mixpanel.people.track_charge - must be a number');
return;
}
}
return this.append('$transactions', _.extend({
'$amount': amount
}, properties), callback);
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function() {
console.error('mixpanel.people.track_charge() is deprecated and no longer has any effect.');
});

@@ -279,0 +269,0 @@

@@ -1486,2 +1486,5 @@ /* eslint camelcase: "off", eqeqeq: "off" */

return 'Facebook Mobile';
} else if (_.includes(user_agent, 'Whale/')) {
// https://user-agents.net/browsers/whale-browser
return 'Whale Browser';
} else if (_.includes(user_agent, 'Chrome')) {

@@ -1538,3 +1541,4 @@ return 'Chrome';

'Internet Explorer': /(rv:|MSIE )(\d+(\.\d+)?)/,
'Mozilla': /rv:(\d+(\.\d+)?)/
'Mozilla': /rv:(\d+(\.\d+)?)/,
'Whale Browser': /Whale\/(\d+(\.\d+)?)/
};

@@ -1541,0 +1545,0 @@ var regex = versionRegexs[browser];

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display