mixpanel-browser 2.64.0 → 2.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/mixpanel-core.cjs.js +50 -40
- package/dist/mixpanel-recorder.js +6 -2
- package/dist/mixpanel-recorder.min.js +1 -1
- package/dist/mixpanel-recorder.min.js.map +1 -1
- package/dist/mixpanel-with-async-recorder.cjs.js +50 -40
- package/dist/mixpanel-with-recorder.js +50 -40
- package/dist/mixpanel-with-recorder.min.js +1 -1
- package/dist/mixpanel.amd.js +50 -40
- package/dist/mixpanel.cjs.js +50 -40
- package/dist/mixpanel.globals.js +50 -40
- package/dist/mixpanel.min.js +145 -144
- package/dist/mixpanel.module.js +50 -40
- package/dist/mixpanel.umd.js +50 -40
- package/package.json +1 -1
- package/src/autocapture/utils.js +3 -1
- package/src/config.js +1 -1
- package/src/flags/index.js +34 -25
- package/src/mixpanel-core.js +5 -0
- package/src/mixpanel-people.js +2 -12
- package/src/utils.js +5 -1
package/dist/mixpanel.amd.js
CHANGED
|
@@ -13944,7 +13944,7 @@ define((function () { 'use strict';
|
|
|
13944
13944
|
|
|
13945
13945
|
var Config = {
|
|
13946
13946
|
DEBUG: false,
|
|
13947
|
-
LIB_VERSION: '2.
|
|
13947
|
+
LIB_VERSION: '2.65.0'
|
|
13948
13948
|
};
|
|
13949
13949
|
|
|
13950
13950
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -15429,6 +15429,9 @@ define((function () { 'use strict';
|
|
|
15429
15429
|
return 'Microsoft Edge';
|
|
15430
15430
|
} else if (_.includes(user_agent, 'FBIOS')) {
|
|
15431
15431
|
return 'Facebook Mobile';
|
|
15432
|
+
} else if (_.includes(user_agent, 'Whale/')) {
|
|
15433
|
+
// https://user-agents.net/browsers/whale-browser
|
|
15434
|
+
return 'Whale Browser';
|
|
15432
15435
|
} else if (_.includes(user_agent, 'Chrome')) {
|
|
15433
15436
|
return 'Chrome';
|
|
15434
15437
|
} else if (_.includes(user_agent, 'CriOS')) {
|
|
@@ -15480,7 +15483,8 @@ define((function () { 'use strict';
|
|
|
15480
15483
|
'Android Mobile': /android\s(\d+(\.\d+)?)/,
|
|
15481
15484
|
'Samsung Internet': /SamsungBrowser\/(\d+(\.\d+)?)/,
|
|
15482
15485
|
'Internet Explorer': /(rv:|MSIE )(\d+(\.\d+)?)/,
|
|
15483
|
-
'Mozilla': /rv:(\d+(\.\d+)?)
|
|
15486
|
+
'Mozilla': /rv:(\d+(\.\d+)?)/,
|
|
15487
|
+
'Whale Browser': /Whale\/(\d+(\.\d+)?)/
|
|
15484
15488
|
};
|
|
15485
15489
|
var regex = versionRegexs[browser];
|
|
15486
15490
|
if (regex === undefined) {
|
|
@@ -17842,7 +17846,9 @@ define((function () { 'use strict';
|
|
|
17842
17846
|
'$elements': elementsJson,
|
|
17843
17847
|
'$el_attr__href': href,
|
|
17844
17848
|
'$viewportHeight': Math.max(docElement['clientHeight'], win['innerHeight'] || 0),
|
|
17845
|
-
'$viewportWidth': Math.max(docElement['clientWidth'], win['innerWidth'] || 0)
|
|
17849
|
+
'$viewportWidth': Math.max(docElement['clientWidth'], win['innerWidth'] || 0),
|
|
17850
|
+
'$pageHeight': document$1['body']['offsetHeight'] || 0,
|
|
17851
|
+
'$pageWidth': document$1['body']['offsetWidth'] || 0,
|
|
17846
17852
|
};
|
|
17847
17853
|
_.each(captureExtraAttrs, function(attr) {
|
|
17848
17854
|
if (!blockAttrsSet[attr] && target.hasAttribute(attr)) {
|
|
@@ -18573,19 +18579,19 @@ define((function () { 'use strict';
|
|
|
18573
18579
|
return this.getFullConfig()[key];
|
|
18574
18580
|
};
|
|
18575
18581
|
|
|
18576
|
-
FeatureFlagManager.prototype.
|
|
18582
|
+
FeatureFlagManager.prototype.isSystemEnabled = function() {
|
|
18577
18583
|
return !!this.getMpConfig(FLAGS_CONFIG_KEY);
|
|
18578
18584
|
};
|
|
18579
18585
|
|
|
18580
|
-
FeatureFlagManager.prototype.
|
|
18581
|
-
if (!this.
|
|
18586
|
+
FeatureFlagManager.prototype.areFlagsReady = function() {
|
|
18587
|
+
if (!this.isSystemEnabled()) {
|
|
18582
18588
|
logger.error('Feature Flags not enabled');
|
|
18583
18589
|
}
|
|
18584
18590
|
return !!this.flags;
|
|
18585
18591
|
};
|
|
18586
18592
|
|
|
18587
18593
|
FeatureFlagManager.prototype.fetchFlags = function() {
|
|
18588
|
-
if (!this.
|
|
18594
|
+
if (!this.isSystemEnabled()) {
|
|
18589
18595
|
return;
|
|
18590
18596
|
}
|
|
18591
18597
|
|
|
@@ -18611,7 +18617,7 @@ define((function () { 'use strict';
|
|
|
18611
18617
|
_.each(responseFlags, function(data, key) {
|
|
18612
18618
|
flags.set(key, {
|
|
18613
18619
|
'key': data['variant_key'],
|
|
18614
|
-
'
|
|
18620
|
+
'value': data['variant_value']
|
|
18615
18621
|
});
|
|
18616
18622
|
});
|
|
18617
18623
|
this.flags = flags;
|
|
@@ -18621,7 +18627,7 @@ define((function () { 'use strict';
|
|
|
18621
18627
|
}.bind(this)).catch(function() {});
|
|
18622
18628
|
};
|
|
18623
18629
|
|
|
18624
|
-
FeatureFlagManager.prototype.
|
|
18630
|
+
FeatureFlagManager.prototype.getVariant = function(featureName, fallback) {
|
|
18625
18631
|
if (!this.fetchPromise) {
|
|
18626
18632
|
return new Promise(function(resolve) {
|
|
18627
18633
|
logger.critical('Feature Flags not initialized');
|
|
@@ -18630,15 +18636,15 @@ define((function () { 'use strict';
|
|
|
18630
18636
|
}
|
|
18631
18637
|
|
|
18632
18638
|
return this.fetchPromise.then(function() {
|
|
18633
|
-
return this.
|
|
18639
|
+
return this.getVariantSync(featureName, fallback);
|
|
18634
18640
|
}.bind(this)).catch(function(error) {
|
|
18635
18641
|
logger.error(error);
|
|
18636
18642
|
return fallback;
|
|
18637
18643
|
});
|
|
18638
18644
|
};
|
|
18639
18645
|
|
|
18640
|
-
FeatureFlagManager.prototype.
|
|
18641
|
-
if (!this.
|
|
18646
|
+
FeatureFlagManager.prototype.getVariantSync = function(featureName, fallback) {
|
|
18647
|
+
if (!this.areFlagsReady()) {
|
|
18642
18648
|
logger.log('Flags not loaded yet');
|
|
18643
18649
|
return fallback;
|
|
18644
18650
|
}
|
|
@@ -18651,31 +18657,37 @@ define((function () { 'use strict';
|
|
|
18651
18657
|
return feature;
|
|
18652
18658
|
};
|
|
18653
18659
|
|
|
18654
|
-
FeatureFlagManager.prototype.
|
|
18655
|
-
return this.
|
|
18656
|
-
return feature['
|
|
18660
|
+
FeatureFlagManager.prototype.getVariantValue = function(featureName, fallbackValue) {
|
|
18661
|
+
return this.getVariant(featureName, {'value': fallbackValue}).then(function(feature) {
|
|
18662
|
+
return feature['value'];
|
|
18657
18663
|
}).catch(function(error) {
|
|
18658
18664
|
logger.error(error);
|
|
18659
18665
|
return fallbackValue;
|
|
18660
18666
|
});
|
|
18661
18667
|
};
|
|
18662
18668
|
|
|
18663
|
-
|
|
18664
|
-
|
|
18669
|
+
// TODO remove deprecated method
|
|
18670
|
+
FeatureFlagManager.prototype.getFeatureData = function(featureName, fallbackValue) {
|
|
18671
|
+
logger.critical('mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead.');
|
|
18672
|
+
return this.getVariantValue(featureName, fallbackValue);
|
|
18673
|
+
};
|
|
18674
|
+
|
|
18675
|
+
FeatureFlagManager.prototype.getVariantValueSync = function(featureName, fallbackValue) {
|
|
18676
|
+
return this.getVariantSync(featureName, {'value': fallbackValue})['value'];
|
|
18665
18677
|
};
|
|
18666
18678
|
|
|
18667
|
-
FeatureFlagManager.prototype.
|
|
18668
|
-
return this.
|
|
18669
|
-
return this.
|
|
18679
|
+
FeatureFlagManager.prototype.isEnabled = function(featureName, fallbackValue) {
|
|
18680
|
+
return this.getVariantValue(featureName).then(function() {
|
|
18681
|
+
return this.isEnabledSync(featureName, fallbackValue);
|
|
18670
18682
|
}.bind(this)).catch(function(error) {
|
|
18671
18683
|
logger.error(error);
|
|
18672
18684
|
return fallbackValue;
|
|
18673
18685
|
});
|
|
18674
18686
|
};
|
|
18675
18687
|
|
|
18676
|
-
FeatureFlagManager.prototype.
|
|
18688
|
+
FeatureFlagManager.prototype.isEnabledSync = function(featureName, fallbackValue) {
|
|
18677
18689
|
fallbackValue = fallbackValue || false;
|
|
18678
|
-
var val = this.
|
|
18690
|
+
var val = this.getVariantValueSync(featureName, fallbackValue);
|
|
18679
18691
|
if (val !== true && val !== false) {
|
|
18680
18692
|
logger.error('Feature flag "' + featureName + '" value: ' + val + ' is not a boolean; returning fallback value: ' + fallbackValue);
|
|
18681
18693
|
val = fallbackValue;
|
|
@@ -18704,13 +18716,16 @@ define((function () { 'use strict';
|
|
|
18704
18716
|
|
|
18705
18717
|
safewrapClass(FeatureFlagManager);
|
|
18706
18718
|
|
|
18707
|
-
FeatureFlagManager.prototype['
|
|
18708
|
-
FeatureFlagManager.prototype['
|
|
18719
|
+
FeatureFlagManager.prototype['are_flags_ready'] = FeatureFlagManager.prototype.areFlagsReady;
|
|
18720
|
+
FeatureFlagManager.prototype['get_variant'] = FeatureFlagManager.prototype.getVariant;
|
|
18721
|
+
FeatureFlagManager.prototype['get_variant_sync'] = FeatureFlagManager.prototype.getVariantSync;
|
|
18722
|
+
FeatureFlagManager.prototype['get_variant_value'] = FeatureFlagManager.prototype.getVariantValue;
|
|
18723
|
+
FeatureFlagManager.prototype['get_variant_value_sync'] = FeatureFlagManager.prototype.getVariantValueSync;
|
|
18724
|
+
FeatureFlagManager.prototype['is_enabled'] = FeatureFlagManager.prototype.isEnabled;
|
|
18725
|
+
FeatureFlagManager.prototype['is_enabled_sync'] = FeatureFlagManager.prototype.isEnabledSync;
|
|
18726
|
+
|
|
18727
|
+
// Deprecated method
|
|
18709
18728
|
FeatureFlagManager.prototype['get_feature_data'] = FeatureFlagManager.prototype.getFeatureData;
|
|
18710
|
-
FeatureFlagManager.prototype['get_feature_data_sync'] = FeatureFlagManager.prototype.getFeatureDataSync;
|
|
18711
|
-
FeatureFlagManager.prototype['get_feature_sync'] = FeatureFlagManager.prototype.getFeatureSync;
|
|
18712
|
-
FeatureFlagManager.prototype['is_feature_enabled'] = FeatureFlagManager.prototype.isFeatureEnabled;
|
|
18713
|
-
FeatureFlagManager.prototype['is_feature_enabled_sync'] = FeatureFlagManager.prototype.isFeatureEnabledSync;
|
|
18714
18729
|
|
|
18715
18730
|
/* eslint camelcase: "off" */
|
|
18716
18731
|
|
|
@@ -19406,18 +19421,8 @@ define((function () { 'use strict';
|
|
|
19406
19421
|
* @param {Function} [callback] If provided, the callback will be called when the server responds
|
|
19407
19422
|
* @deprecated
|
|
19408
19423
|
*/
|
|
19409
|
-
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(
|
|
19410
|
-
|
|
19411
|
-
amount = parseFloat(amount);
|
|
19412
|
-
if (isNaN(amount)) {
|
|
19413
|
-
console$1.error('Invalid value passed to mixpanel.people.track_charge - must be a number');
|
|
19414
|
-
return;
|
|
19415
|
-
}
|
|
19416
|
-
}
|
|
19417
|
-
|
|
19418
|
-
return this.append('$transactions', _.extend({
|
|
19419
|
-
'$amount': amount
|
|
19420
|
-
}, properties), callback);
|
|
19424
|
+
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function() {
|
|
19425
|
+
console$1.error('mixpanel.people.track_charge() is deprecated and no longer has any effect.');
|
|
19421
19426
|
});
|
|
19422
19427
|
|
|
19423
19428
|
/*
|
|
@@ -20129,6 +20134,7 @@ define((function () { 'use strict';
|
|
|
20129
20134
|
var DEFAULT_CONFIG = {
|
|
20130
20135
|
'api_host': 'https://api-js.mixpanel.com',
|
|
20131
20136
|
'api_routes': DEFAULT_API_ROUTES,
|
|
20137
|
+
'api_extra_query_params': {},
|
|
20132
20138
|
'api_method': 'POST',
|
|
20133
20139
|
'api_transport': 'XHR',
|
|
20134
20140
|
'api_payload_format': PAYLOAD_TYPE_BASE64,
|
|
@@ -20716,6 +20722,8 @@ define((function () { 'use strict';
|
|
|
20716
20722
|
delete data['data'];
|
|
20717
20723
|
}
|
|
20718
20724
|
|
|
20725
|
+
_.extend(data, this.get_config('api_extra_query_params'));
|
|
20726
|
+
|
|
20719
20727
|
url += '?' + _.HTTPBuildQuery(data);
|
|
20720
20728
|
|
|
20721
20729
|
var lib = this;
|
|
@@ -21632,6 +21640,8 @@ define((function () { 'use strict';
|
|
|
21632
21640
|
'distinct_id': DEVICE_ID_PREFIX + uuid,
|
|
21633
21641
|
'$device_id': uuid
|
|
21634
21642
|
}, '');
|
|
21643
|
+
this.stop_session_recording();
|
|
21644
|
+
this._check_and_start_session_recording();
|
|
21635
21645
|
};
|
|
21636
21646
|
|
|
21637
21647
|
/**
|
package/dist/mixpanel.cjs.js
CHANGED
|
@@ -13944,7 +13944,7 @@ if (typeof Promise !== 'undefined' && Promise.toString().indexOf('[native code]'
|
|
|
13944
13944
|
|
|
13945
13945
|
var Config = {
|
|
13946
13946
|
DEBUG: false,
|
|
13947
|
-
LIB_VERSION: '2.
|
|
13947
|
+
LIB_VERSION: '2.65.0'
|
|
13948
13948
|
};
|
|
13949
13949
|
|
|
13950
13950
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -15429,6 +15429,9 @@ _.info = {
|
|
|
15429
15429
|
return 'Microsoft Edge';
|
|
15430
15430
|
} else if (_.includes(user_agent, 'FBIOS')) {
|
|
15431
15431
|
return 'Facebook Mobile';
|
|
15432
|
+
} else if (_.includes(user_agent, 'Whale/')) {
|
|
15433
|
+
// https://user-agents.net/browsers/whale-browser
|
|
15434
|
+
return 'Whale Browser';
|
|
15432
15435
|
} else if (_.includes(user_agent, 'Chrome')) {
|
|
15433
15436
|
return 'Chrome';
|
|
15434
15437
|
} else if (_.includes(user_agent, 'CriOS')) {
|
|
@@ -15480,7 +15483,8 @@ _.info = {
|
|
|
15480
15483
|
'Android Mobile': /android\s(\d+(\.\d+)?)/,
|
|
15481
15484
|
'Samsung Internet': /SamsungBrowser\/(\d+(\.\d+)?)/,
|
|
15482
15485
|
'Internet Explorer': /(rv:|MSIE )(\d+(\.\d+)?)/,
|
|
15483
|
-
'Mozilla': /rv:(\d+(\.\d+)?)
|
|
15486
|
+
'Mozilla': /rv:(\d+(\.\d+)?)/,
|
|
15487
|
+
'Whale Browser': /Whale\/(\d+(\.\d+)?)/
|
|
15484
15488
|
};
|
|
15485
15489
|
var regex = versionRegexs[browser];
|
|
15486
15490
|
if (regex === undefined) {
|
|
@@ -17842,7 +17846,9 @@ function getPropsForDOMEvent(ev, config) {
|
|
|
17842
17846
|
'$elements': elementsJson,
|
|
17843
17847
|
'$el_attr__href': href,
|
|
17844
17848
|
'$viewportHeight': Math.max(docElement['clientHeight'], win['innerHeight'] || 0),
|
|
17845
|
-
'$viewportWidth': Math.max(docElement['clientWidth'], win['innerWidth'] || 0)
|
|
17849
|
+
'$viewportWidth': Math.max(docElement['clientWidth'], win['innerWidth'] || 0),
|
|
17850
|
+
'$pageHeight': document$1['body']['offsetHeight'] || 0,
|
|
17851
|
+
'$pageWidth': document$1['body']['offsetWidth'] || 0,
|
|
17846
17852
|
};
|
|
17847
17853
|
_.each(captureExtraAttrs, function(attr) {
|
|
17848
17854
|
if (!blockAttrsSet[attr] && target.hasAttribute(attr)) {
|
|
@@ -18573,19 +18579,19 @@ FeatureFlagManager.prototype.getConfig = function(key) {
|
|
|
18573
18579
|
return this.getFullConfig()[key];
|
|
18574
18580
|
};
|
|
18575
18581
|
|
|
18576
|
-
FeatureFlagManager.prototype.
|
|
18582
|
+
FeatureFlagManager.prototype.isSystemEnabled = function() {
|
|
18577
18583
|
return !!this.getMpConfig(FLAGS_CONFIG_KEY);
|
|
18578
18584
|
};
|
|
18579
18585
|
|
|
18580
|
-
FeatureFlagManager.prototype.
|
|
18581
|
-
if (!this.
|
|
18586
|
+
FeatureFlagManager.prototype.areFlagsReady = function() {
|
|
18587
|
+
if (!this.isSystemEnabled()) {
|
|
18582
18588
|
logger.error('Feature Flags not enabled');
|
|
18583
18589
|
}
|
|
18584
18590
|
return !!this.flags;
|
|
18585
18591
|
};
|
|
18586
18592
|
|
|
18587
18593
|
FeatureFlagManager.prototype.fetchFlags = function() {
|
|
18588
|
-
if (!this.
|
|
18594
|
+
if (!this.isSystemEnabled()) {
|
|
18589
18595
|
return;
|
|
18590
18596
|
}
|
|
18591
18597
|
|
|
@@ -18611,7 +18617,7 @@ FeatureFlagManager.prototype.fetchFlags = function() {
|
|
|
18611
18617
|
_.each(responseFlags, function(data, key) {
|
|
18612
18618
|
flags.set(key, {
|
|
18613
18619
|
'key': data['variant_key'],
|
|
18614
|
-
'
|
|
18620
|
+
'value': data['variant_value']
|
|
18615
18621
|
});
|
|
18616
18622
|
});
|
|
18617
18623
|
this.flags = flags;
|
|
@@ -18621,7 +18627,7 @@ FeatureFlagManager.prototype.fetchFlags = function() {
|
|
|
18621
18627
|
}.bind(this)).catch(function() {});
|
|
18622
18628
|
};
|
|
18623
18629
|
|
|
18624
|
-
FeatureFlagManager.prototype.
|
|
18630
|
+
FeatureFlagManager.prototype.getVariant = function(featureName, fallback) {
|
|
18625
18631
|
if (!this.fetchPromise) {
|
|
18626
18632
|
return new Promise(function(resolve) {
|
|
18627
18633
|
logger.critical('Feature Flags not initialized');
|
|
@@ -18630,15 +18636,15 @@ FeatureFlagManager.prototype.getFeature = function(featureName, fallback) {
|
|
|
18630
18636
|
}
|
|
18631
18637
|
|
|
18632
18638
|
return this.fetchPromise.then(function() {
|
|
18633
|
-
return this.
|
|
18639
|
+
return this.getVariantSync(featureName, fallback);
|
|
18634
18640
|
}.bind(this)).catch(function(error) {
|
|
18635
18641
|
logger.error(error);
|
|
18636
18642
|
return fallback;
|
|
18637
18643
|
});
|
|
18638
18644
|
};
|
|
18639
18645
|
|
|
18640
|
-
FeatureFlagManager.prototype.
|
|
18641
|
-
if (!this.
|
|
18646
|
+
FeatureFlagManager.prototype.getVariantSync = function(featureName, fallback) {
|
|
18647
|
+
if (!this.areFlagsReady()) {
|
|
18642
18648
|
logger.log('Flags not loaded yet');
|
|
18643
18649
|
return fallback;
|
|
18644
18650
|
}
|
|
@@ -18651,31 +18657,37 @@ FeatureFlagManager.prototype.getFeatureSync = function(featureName, fallback) {
|
|
|
18651
18657
|
return feature;
|
|
18652
18658
|
};
|
|
18653
18659
|
|
|
18654
|
-
FeatureFlagManager.prototype.
|
|
18655
|
-
return this.
|
|
18656
|
-
return feature['
|
|
18660
|
+
FeatureFlagManager.prototype.getVariantValue = function(featureName, fallbackValue) {
|
|
18661
|
+
return this.getVariant(featureName, {'value': fallbackValue}).then(function(feature) {
|
|
18662
|
+
return feature['value'];
|
|
18657
18663
|
}).catch(function(error) {
|
|
18658
18664
|
logger.error(error);
|
|
18659
18665
|
return fallbackValue;
|
|
18660
18666
|
});
|
|
18661
18667
|
};
|
|
18662
18668
|
|
|
18663
|
-
|
|
18664
|
-
|
|
18669
|
+
// TODO remove deprecated method
|
|
18670
|
+
FeatureFlagManager.prototype.getFeatureData = function(featureName, fallbackValue) {
|
|
18671
|
+
logger.critical('mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead.');
|
|
18672
|
+
return this.getVariantValue(featureName, fallbackValue);
|
|
18673
|
+
};
|
|
18674
|
+
|
|
18675
|
+
FeatureFlagManager.prototype.getVariantValueSync = function(featureName, fallbackValue) {
|
|
18676
|
+
return this.getVariantSync(featureName, {'value': fallbackValue})['value'];
|
|
18665
18677
|
};
|
|
18666
18678
|
|
|
18667
|
-
FeatureFlagManager.prototype.
|
|
18668
|
-
return this.
|
|
18669
|
-
return this.
|
|
18679
|
+
FeatureFlagManager.prototype.isEnabled = function(featureName, fallbackValue) {
|
|
18680
|
+
return this.getVariantValue(featureName).then(function() {
|
|
18681
|
+
return this.isEnabledSync(featureName, fallbackValue);
|
|
18670
18682
|
}.bind(this)).catch(function(error) {
|
|
18671
18683
|
logger.error(error);
|
|
18672
18684
|
return fallbackValue;
|
|
18673
18685
|
});
|
|
18674
18686
|
};
|
|
18675
18687
|
|
|
18676
|
-
FeatureFlagManager.prototype.
|
|
18688
|
+
FeatureFlagManager.prototype.isEnabledSync = function(featureName, fallbackValue) {
|
|
18677
18689
|
fallbackValue = fallbackValue || false;
|
|
18678
|
-
var val = this.
|
|
18690
|
+
var val = this.getVariantValueSync(featureName, fallbackValue);
|
|
18679
18691
|
if (val !== true && val !== false) {
|
|
18680
18692
|
logger.error('Feature flag "' + featureName + '" value: ' + val + ' is not a boolean; returning fallback value: ' + fallbackValue);
|
|
18681
18693
|
val = fallbackValue;
|
|
@@ -18704,13 +18716,16 @@ function minApisSupported() {
|
|
|
18704
18716
|
|
|
18705
18717
|
safewrapClass(FeatureFlagManager);
|
|
18706
18718
|
|
|
18707
|
-
FeatureFlagManager.prototype['
|
|
18708
|
-
FeatureFlagManager.prototype['
|
|
18719
|
+
FeatureFlagManager.prototype['are_flags_ready'] = FeatureFlagManager.prototype.areFlagsReady;
|
|
18720
|
+
FeatureFlagManager.prototype['get_variant'] = FeatureFlagManager.prototype.getVariant;
|
|
18721
|
+
FeatureFlagManager.prototype['get_variant_sync'] = FeatureFlagManager.prototype.getVariantSync;
|
|
18722
|
+
FeatureFlagManager.prototype['get_variant_value'] = FeatureFlagManager.prototype.getVariantValue;
|
|
18723
|
+
FeatureFlagManager.prototype['get_variant_value_sync'] = FeatureFlagManager.prototype.getVariantValueSync;
|
|
18724
|
+
FeatureFlagManager.prototype['is_enabled'] = FeatureFlagManager.prototype.isEnabled;
|
|
18725
|
+
FeatureFlagManager.prototype['is_enabled_sync'] = FeatureFlagManager.prototype.isEnabledSync;
|
|
18726
|
+
|
|
18727
|
+
// Deprecated method
|
|
18709
18728
|
FeatureFlagManager.prototype['get_feature_data'] = FeatureFlagManager.prototype.getFeatureData;
|
|
18710
|
-
FeatureFlagManager.prototype['get_feature_data_sync'] = FeatureFlagManager.prototype.getFeatureDataSync;
|
|
18711
|
-
FeatureFlagManager.prototype['get_feature_sync'] = FeatureFlagManager.prototype.getFeatureSync;
|
|
18712
|
-
FeatureFlagManager.prototype['is_feature_enabled'] = FeatureFlagManager.prototype.isFeatureEnabled;
|
|
18713
|
-
FeatureFlagManager.prototype['is_feature_enabled_sync'] = FeatureFlagManager.prototype.isFeatureEnabledSync;
|
|
18714
18729
|
|
|
18715
18730
|
/* eslint camelcase: "off" */
|
|
18716
18731
|
|
|
@@ -19406,18 +19421,8 @@ MixpanelPeople.prototype.union = addOptOutCheckMixpanelPeople(function(list_name
|
|
|
19406
19421
|
* @param {Function} [callback] If provided, the callback will be called when the server responds
|
|
19407
19422
|
* @deprecated
|
|
19408
19423
|
*/
|
|
19409
|
-
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(
|
|
19410
|
-
|
|
19411
|
-
amount = parseFloat(amount);
|
|
19412
|
-
if (isNaN(amount)) {
|
|
19413
|
-
console$1.error('Invalid value passed to mixpanel.people.track_charge - must be a number');
|
|
19414
|
-
return;
|
|
19415
|
-
}
|
|
19416
|
-
}
|
|
19417
|
-
|
|
19418
|
-
return this.append('$transactions', _.extend({
|
|
19419
|
-
'$amount': amount
|
|
19420
|
-
}, properties), callback);
|
|
19424
|
+
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function() {
|
|
19425
|
+
console$1.error('mixpanel.people.track_charge() is deprecated and no longer has any effect.');
|
|
19421
19426
|
});
|
|
19422
19427
|
|
|
19423
19428
|
/*
|
|
@@ -20129,6 +20134,7 @@ var DEFAULT_API_ROUTES = {
|
|
|
20129
20134
|
var DEFAULT_CONFIG = {
|
|
20130
20135
|
'api_host': 'https://api-js.mixpanel.com',
|
|
20131
20136
|
'api_routes': DEFAULT_API_ROUTES,
|
|
20137
|
+
'api_extra_query_params': {},
|
|
20132
20138
|
'api_method': 'POST',
|
|
20133
20139
|
'api_transport': 'XHR',
|
|
20134
20140
|
'api_payload_format': PAYLOAD_TYPE_BASE64,
|
|
@@ -20716,6 +20722,8 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
|
|
|
20716
20722
|
delete data['data'];
|
|
20717
20723
|
}
|
|
20718
20724
|
|
|
20725
|
+
_.extend(data, this.get_config('api_extra_query_params'));
|
|
20726
|
+
|
|
20719
20727
|
url += '?' + _.HTTPBuildQuery(data);
|
|
20720
20728
|
|
|
20721
20729
|
var lib = this;
|
|
@@ -21632,6 +21640,8 @@ MixpanelLib.prototype.reset = function() {
|
|
|
21632
21640
|
'distinct_id': DEVICE_ID_PREFIX + uuid,
|
|
21633
21641
|
'$device_id': uuid
|
|
21634
21642
|
}, '');
|
|
21643
|
+
this.stop_session_recording();
|
|
21644
|
+
this._check_and_start_session_recording();
|
|
21635
21645
|
};
|
|
21636
21646
|
|
|
21637
21647
|
/**
|
package/dist/mixpanel.globals.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var Config = {
|
|
5
5
|
DEBUG: false,
|
|
6
|
-
LIB_VERSION: '2.
|
|
6
|
+
LIB_VERSION: '2.65.0'
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
// since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
|
|
@@ -1871,6 +1871,9 @@
|
|
|
1871
1871
|
return 'Microsoft Edge';
|
|
1872
1872
|
} else if (_.includes(user_agent, 'FBIOS')) {
|
|
1873
1873
|
return 'Facebook Mobile';
|
|
1874
|
+
} else if (_.includes(user_agent, 'Whale/')) {
|
|
1875
|
+
// https://user-agents.net/browsers/whale-browser
|
|
1876
|
+
return 'Whale Browser';
|
|
1874
1877
|
} else if (_.includes(user_agent, 'Chrome')) {
|
|
1875
1878
|
return 'Chrome';
|
|
1876
1879
|
} else if (_.includes(user_agent, 'CriOS')) {
|
|
@@ -1922,7 +1925,8 @@
|
|
|
1922
1925
|
'Android Mobile': /android\s(\d+(\.\d+)?)/,
|
|
1923
1926
|
'Samsung Internet': /SamsungBrowser\/(\d+(\.\d+)?)/,
|
|
1924
1927
|
'Internet Explorer': /(rv:|MSIE )(\d+(\.\d+)?)/,
|
|
1925
|
-
'Mozilla': /rv:(\d+(\.\d+)?)
|
|
1928
|
+
'Mozilla': /rv:(\d+(\.\d+)?)/,
|
|
1929
|
+
'Whale Browser': /Whale\/(\d+(\.\d+)?)/
|
|
1926
1930
|
};
|
|
1927
1931
|
var regex = versionRegexs[browser];
|
|
1928
1932
|
if (regex === undefined) {
|
|
@@ -2300,7 +2304,9 @@
|
|
|
2300
2304
|
'$elements': elementsJson,
|
|
2301
2305
|
'$el_attr__href': href,
|
|
2302
2306
|
'$viewportHeight': Math.max(docElement['clientHeight'], win['innerHeight'] || 0),
|
|
2303
|
-
'$viewportWidth': Math.max(docElement['clientWidth'], win['innerWidth'] || 0)
|
|
2307
|
+
'$viewportWidth': Math.max(docElement['clientWidth'], win['innerWidth'] || 0),
|
|
2308
|
+
'$pageHeight': document$1['body']['offsetHeight'] || 0,
|
|
2309
|
+
'$pageWidth': document$1['body']['offsetWidth'] || 0,
|
|
2304
2310
|
};
|
|
2305
2311
|
_.each(captureExtraAttrs, function(attr) {
|
|
2306
2312
|
if (!blockAttrsSet[attr] && target.hasAttribute(attr)) {
|
|
@@ -3031,19 +3037,19 @@
|
|
|
3031
3037
|
return this.getFullConfig()[key];
|
|
3032
3038
|
};
|
|
3033
3039
|
|
|
3034
|
-
FeatureFlagManager.prototype.
|
|
3040
|
+
FeatureFlagManager.prototype.isSystemEnabled = function() {
|
|
3035
3041
|
return !!this.getMpConfig(FLAGS_CONFIG_KEY);
|
|
3036
3042
|
};
|
|
3037
3043
|
|
|
3038
|
-
FeatureFlagManager.prototype.
|
|
3039
|
-
if (!this.
|
|
3044
|
+
FeatureFlagManager.prototype.areFlagsReady = function() {
|
|
3045
|
+
if (!this.isSystemEnabled()) {
|
|
3040
3046
|
logger$3.error('Feature Flags not enabled');
|
|
3041
3047
|
}
|
|
3042
3048
|
return !!this.flags;
|
|
3043
3049
|
};
|
|
3044
3050
|
|
|
3045
3051
|
FeatureFlagManager.prototype.fetchFlags = function() {
|
|
3046
|
-
if (!this.
|
|
3052
|
+
if (!this.isSystemEnabled()) {
|
|
3047
3053
|
return;
|
|
3048
3054
|
}
|
|
3049
3055
|
|
|
@@ -3069,7 +3075,7 @@
|
|
|
3069
3075
|
_.each(responseFlags, function(data, key) {
|
|
3070
3076
|
flags.set(key, {
|
|
3071
3077
|
'key': data['variant_key'],
|
|
3072
|
-
'
|
|
3078
|
+
'value': data['variant_value']
|
|
3073
3079
|
});
|
|
3074
3080
|
});
|
|
3075
3081
|
this.flags = flags;
|
|
@@ -3079,7 +3085,7 @@
|
|
|
3079
3085
|
}.bind(this)).catch(function() {});
|
|
3080
3086
|
};
|
|
3081
3087
|
|
|
3082
|
-
FeatureFlagManager.prototype.
|
|
3088
|
+
FeatureFlagManager.prototype.getVariant = function(featureName, fallback) {
|
|
3083
3089
|
if (!this.fetchPromise) {
|
|
3084
3090
|
return new Promise(function(resolve) {
|
|
3085
3091
|
logger$3.critical('Feature Flags not initialized');
|
|
@@ -3088,15 +3094,15 @@
|
|
|
3088
3094
|
}
|
|
3089
3095
|
|
|
3090
3096
|
return this.fetchPromise.then(function() {
|
|
3091
|
-
return this.
|
|
3097
|
+
return this.getVariantSync(featureName, fallback);
|
|
3092
3098
|
}.bind(this)).catch(function(error) {
|
|
3093
3099
|
logger$3.error(error);
|
|
3094
3100
|
return fallback;
|
|
3095
3101
|
});
|
|
3096
3102
|
};
|
|
3097
3103
|
|
|
3098
|
-
FeatureFlagManager.prototype.
|
|
3099
|
-
if (!this.
|
|
3104
|
+
FeatureFlagManager.prototype.getVariantSync = function(featureName, fallback) {
|
|
3105
|
+
if (!this.areFlagsReady()) {
|
|
3100
3106
|
logger$3.log('Flags not loaded yet');
|
|
3101
3107
|
return fallback;
|
|
3102
3108
|
}
|
|
@@ -3109,31 +3115,37 @@
|
|
|
3109
3115
|
return feature;
|
|
3110
3116
|
};
|
|
3111
3117
|
|
|
3112
|
-
FeatureFlagManager.prototype.
|
|
3113
|
-
return this.
|
|
3114
|
-
return feature['
|
|
3118
|
+
FeatureFlagManager.prototype.getVariantValue = function(featureName, fallbackValue) {
|
|
3119
|
+
return this.getVariant(featureName, {'value': fallbackValue}).then(function(feature) {
|
|
3120
|
+
return feature['value'];
|
|
3115
3121
|
}).catch(function(error) {
|
|
3116
3122
|
logger$3.error(error);
|
|
3117
3123
|
return fallbackValue;
|
|
3118
3124
|
});
|
|
3119
3125
|
};
|
|
3120
3126
|
|
|
3121
|
-
|
|
3122
|
-
|
|
3127
|
+
// TODO remove deprecated method
|
|
3128
|
+
FeatureFlagManager.prototype.getFeatureData = function(featureName, fallbackValue) {
|
|
3129
|
+
logger$3.critical('mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead.');
|
|
3130
|
+
return this.getVariantValue(featureName, fallbackValue);
|
|
3131
|
+
};
|
|
3132
|
+
|
|
3133
|
+
FeatureFlagManager.prototype.getVariantValueSync = function(featureName, fallbackValue) {
|
|
3134
|
+
return this.getVariantSync(featureName, {'value': fallbackValue})['value'];
|
|
3123
3135
|
};
|
|
3124
3136
|
|
|
3125
|
-
FeatureFlagManager.prototype.
|
|
3126
|
-
return this.
|
|
3127
|
-
return this.
|
|
3137
|
+
FeatureFlagManager.prototype.isEnabled = function(featureName, fallbackValue) {
|
|
3138
|
+
return this.getVariantValue(featureName).then(function() {
|
|
3139
|
+
return this.isEnabledSync(featureName, fallbackValue);
|
|
3128
3140
|
}.bind(this)).catch(function(error) {
|
|
3129
3141
|
logger$3.error(error);
|
|
3130
3142
|
return fallbackValue;
|
|
3131
3143
|
});
|
|
3132
3144
|
};
|
|
3133
3145
|
|
|
3134
|
-
FeatureFlagManager.prototype.
|
|
3146
|
+
FeatureFlagManager.prototype.isEnabledSync = function(featureName, fallbackValue) {
|
|
3135
3147
|
fallbackValue = fallbackValue || false;
|
|
3136
|
-
var val = this.
|
|
3148
|
+
var val = this.getVariantValueSync(featureName, fallbackValue);
|
|
3137
3149
|
if (val !== true && val !== false) {
|
|
3138
3150
|
logger$3.error('Feature flag "' + featureName + '" value: ' + val + ' is not a boolean; returning fallback value: ' + fallbackValue);
|
|
3139
3151
|
val = fallbackValue;
|
|
@@ -3162,13 +3174,16 @@
|
|
|
3162
3174
|
|
|
3163
3175
|
safewrapClass(FeatureFlagManager);
|
|
3164
3176
|
|
|
3165
|
-
FeatureFlagManager.prototype['
|
|
3166
|
-
FeatureFlagManager.prototype['
|
|
3177
|
+
FeatureFlagManager.prototype['are_flags_ready'] = FeatureFlagManager.prototype.areFlagsReady;
|
|
3178
|
+
FeatureFlagManager.prototype['get_variant'] = FeatureFlagManager.prototype.getVariant;
|
|
3179
|
+
FeatureFlagManager.prototype['get_variant_sync'] = FeatureFlagManager.prototype.getVariantSync;
|
|
3180
|
+
FeatureFlagManager.prototype['get_variant_value'] = FeatureFlagManager.prototype.getVariantValue;
|
|
3181
|
+
FeatureFlagManager.prototype['get_variant_value_sync'] = FeatureFlagManager.prototype.getVariantValueSync;
|
|
3182
|
+
FeatureFlagManager.prototype['is_enabled'] = FeatureFlagManager.prototype.isEnabled;
|
|
3183
|
+
FeatureFlagManager.prototype['is_enabled_sync'] = FeatureFlagManager.prototype.isEnabledSync;
|
|
3184
|
+
|
|
3185
|
+
// Deprecated method
|
|
3167
3186
|
FeatureFlagManager.prototype['get_feature_data'] = FeatureFlagManager.prototype.getFeatureData;
|
|
3168
|
-
FeatureFlagManager.prototype['get_feature_data_sync'] = FeatureFlagManager.prototype.getFeatureDataSync;
|
|
3169
|
-
FeatureFlagManager.prototype['get_feature_sync'] = FeatureFlagManager.prototype.getFeatureSync;
|
|
3170
|
-
FeatureFlagManager.prototype['is_feature_enabled'] = FeatureFlagManager.prototype.isFeatureEnabled;
|
|
3171
|
-
FeatureFlagManager.prototype['is_feature_enabled_sync'] = FeatureFlagManager.prototype.isFeatureEnabledSync;
|
|
3172
3187
|
|
|
3173
3188
|
/* eslint camelcase: "off" */
|
|
3174
3189
|
|
|
@@ -5052,18 +5067,8 @@
|
|
|
5052
5067
|
* @param {Function} [callback] If provided, the callback will be called when the server responds
|
|
5053
5068
|
* @deprecated
|
|
5054
5069
|
*/
|
|
5055
|
-
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(
|
|
5056
|
-
|
|
5057
|
-
amount = parseFloat(amount);
|
|
5058
|
-
if (isNaN(amount)) {
|
|
5059
|
-
console.error('Invalid value passed to mixpanel.people.track_charge - must be a number');
|
|
5060
|
-
return;
|
|
5061
|
-
}
|
|
5062
|
-
}
|
|
5063
|
-
|
|
5064
|
-
return this.append('$transactions', _.extend({
|
|
5065
|
-
'$amount': amount
|
|
5066
|
-
}, properties), callback);
|
|
5070
|
+
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function() {
|
|
5071
|
+
console.error('mixpanel.people.track_charge() is deprecated and no longer has any effect.');
|
|
5067
5072
|
});
|
|
5068
5073
|
|
|
5069
5074
|
/*
|
|
@@ -5898,6 +5903,7 @@
|
|
|
5898
5903
|
var DEFAULT_CONFIG = {
|
|
5899
5904
|
'api_host': 'https://api-js.mixpanel.com',
|
|
5900
5905
|
'api_routes': DEFAULT_API_ROUTES,
|
|
5906
|
+
'api_extra_query_params': {},
|
|
5901
5907
|
'api_method': 'POST',
|
|
5902
5908
|
'api_transport': 'XHR',
|
|
5903
5909
|
'api_payload_format': PAYLOAD_TYPE_BASE64,
|
|
@@ -6485,6 +6491,8 @@
|
|
|
6485
6491
|
delete data['data'];
|
|
6486
6492
|
}
|
|
6487
6493
|
|
|
6494
|
+
_.extend(data, this.get_config('api_extra_query_params'));
|
|
6495
|
+
|
|
6488
6496
|
url += '?' + _.HTTPBuildQuery(data);
|
|
6489
6497
|
|
|
6490
6498
|
var lib = this;
|
|
@@ -7401,6 +7409,8 @@
|
|
|
7401
7409
|
'distinct_id': DEVICE_ID_PREFIX + uuid,
|
|
7402
7410
|
'$device_id': uuid
|
|
7403
7411
|
}, '');
|
|
7412
|
+
this.stop_session_recording();
|
|
7413
|
+
this._check_and_start_session_recording();
|
|
7404
7414
|
};
|
|
7405
7415
|
|
|
7406
7416
|
/**
|