mixpanel-browser 2.64.0 → 2.66.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 +13 -0
- package/README.md +1 -1
- package/dist/mixpanel-core.cjs.js +94 -53
- package/dist/mixpanel-recorder.js +23 -11
- 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 +94 -53
- package/dist/mixpanel-with-recorder.js +111 -62
- package/dist/mixpanel-with-recorder.min.js +1 -1
- package/dist/mixpanel.amd.js +111 -62
- package/dist/mixpanel.cjs.js +111 -62
- package/dist/mixpanel.globals.js +94 -53
- package/dist/mixpanel.min.js +148 -146
- package/dist/mixpanel.module.js +111 -62
- package/dist/mixpanel.umd.js +111 -62
- package/package.json +2 -1
- package/src/autocapture/utils.js +3 -1
- package/src/config.js +1 -1
- package/src/flags/index.js +34 -25
- package/src/index.d.ts +408 -0
- package/src/mixpanel-core.js +47 -11
- package/src/mixpanel-group.js +1 -1
- package/src/mixpanel-people.js +3 -13
- package/src/recorder/recorder.js +15 -7
- package/src/recorder/session-recording.js +2 -2
- package/src/utils.js +5 -1
- package/tunnel.log +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
**2.66.0** (8 Jul 2025)
|
|
2
|
+
- Add `api_host` configuration option to support different hosts/proxies for different endpoints (thanks @chrisknu)
|
|
3
|
+
- Add types.d.ts from existing public repo
|
|
4
|
+
- Fix race condition when calling `mixpanel.reset()` while a session recording is active
|
|
5
|
+
|
|
6
|
+
**2.65.0** (20 May 2025)
|
|
7
|
+
- `mixpanel.people.track_charge()` (deprecated) no longer sets profile property
|
|
8
|
+
- Adds page height and width tracking to autocapture click tracking
|
|
9
|
+
- Session recording now stops when mixpanel.reset() is called
|
|
10
|
+
- Support for adding arbitrary query string params to tracking requests (thanks @dylan-asos)
|
|
11
|
+
- Feature flagging API revisions
|
|
12
|
+
- Whale Browser detection
|
|
13
|
+
|
|
1
14
|
**2.64.0** (15 Apr 2025)
|
|
2
15
|
- Add `record_heatmap_data` init option for Session Recording to ensure click events are captured for Heat Maps
|
|
3
16
|
- Initial support for feature flagging
|
package/README.md
CHANGED
|
@@ -78,4 +78,4 @@ Mixpanel production releases are tested against a large matrix of browsers and o
|
|
|
78
78
|
- Publish to readme.io via the [rdme](https://www.npmjs.com/package/rdme) util: `RDME_API_KEY=<API_KEY> RDME_DOC_VERSION=<version> npm run dox-publish`
|
|
79
79
|
|
|
80
80
|
## Thanks
|
|
81
|
-
For patches and support: @bohanyang, @dehau, @drubin, @D1plo1d, @feychenie, @mogstad, @pfhayes, @sandorfr, @stefansedich, @gfx, @pkaminski, @austince, @danielbaker, @mkdai, @wolever, @dpraul, @chriszamierowski, @JoaoGomesTW, @@aliyalcinkaya, @chrisdeely
|
|
81
|
+
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, @chrisknu
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var Config = {
|
|
4
4
|
DEBUG: false,
|
|
5
|
-
LIB_VERSION: '2.
|
|
5
|
+
LIB_VERSION: '2.66.0'
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
|
|
@@ -1870,6 +1870,9 @@ _.info = {
|
|
|
1870
1870
|
return 'Microsoft Edge';
|
|
1871
1871
|
} else if (_.includes(user_agent, 'FBIOS')) {
|
|
1872
1872
|
return 'Facebook Mobile';
|
|
1873
|
+
} else if (_.includes(user_agent, 'Whale/')) {
|
|
1874
|
+
// https://user-agents.net/browsers/whale-browser
|
|
1875
|
+
return 'Whale Browser';
|
|
1873
1876
|
} else if (_.includes(user_agent, 'Chrome')) {
|
|
1874
1877
|
return 'Chrome';
|
|
1875
1878
|
} else if (_.includes(user_agent, 'CriOS')) {
|
|
@@ -1921,7 +1924,8 @@ _.info = {
|
|
|
1921
1924
|
'Android Mobile': /android\s(\d+(\.\d+)?)/,
|
|
1922
1925
|
'Samsung Internet': /SamsungBrowser\/(\d+(\.\d+)?)/,
|
|
1923
1926
|
'Internet Explorer': /(rv:|MSIE )(\d+(\.\d+)?)/,
|
|
1924
|
-
'Mozilla': /rv:(\d+(\.\d+)?)
|
|
1927
|
+
'Mozilla': /rv:(\d+(\.\d+)?)/,
|
|
1928
|
+
'Whale Browser': /Whale\/(\d+(\.\d+)?)/
|
|
1925
1929
|
};
|
|
1926
1930
|
var regex = versionRegexs[browser];
|
|
1927
1931
|
if (regex === undefined) {
|
|
@@ -2299,7 +2303,9 @@ function getPropsForDOMEvent(ev, config) {
|
|
|
2299
2303
|
'$elements': elementsJson,
|
|
2300
2304
|
'$el_attr__href': href,
|
|
2301
2305
|
'$viewportHeight': Math.max(docElement['clientHeight'], win['innerHeight'] || 0),
|
|
2302
|
-
'$viewportWidth': Math.max(docElement['clientWidth'], win['innerWidth'] || 0)
|
|
2306
|
+
'$viewportWidth': Math.max(docElement['clientWidth'], win['innerWidth'] || 0),
|
|
2307
|
+
'$pageHeight': document$1['body']['offsetHeight'] || 0,
|
|
2308
|
+
'$pageWidth': document$1['body']['offsetWidth'] || 0,
|
|
2303
2309
|
};
|
|
2304
2310
|
_.each(captureExtraAttrs, function(attr) {
|
|
2305
2311
|
if (!blockAttrsSet[attr] && target.hasAttribute(attr)) {
|
|
@@ -3030,19 +3036,19 @@ FeatureFlagManager.prototype.getConfig = function(key) {
|
|
|
3030
3036
|
return this.getFullConfig()[key];
|
|
3031
3037
|
};
|
|
3032
3038
|
|
|
3033
|
-
FeatureFlagManager.prototype.
|
|
3039
|
+
FeatureFlagManager.prototype.isSystemEnabled = function() {
|
|
3034
3040
|
return !!this.getMpConfig(FLAGS_CONFIG_KEY);
|
|
3035
3041
|
};
|
|
3036
3042
|
|
|
3037
|
-
FeatureFlagManager.prototype.
|
|
3038
|
-
if (!this.
|
|
3043
|
+
FeatureFlagManager.prototype.areFlagsReady = function() {
|
|
3044
|
+
if (!this.isSystemEnabled()) {
|
|
3039
3045
|
logger$3.error('Feature Flags not enabled');
|
|
3040
3046
|
}
|
|
3041
3047
|
return !!this.flags;
|
|
3042
3048
|
};
|
|
3043
3049
|
|
|
3044
3050
|
FeatureFlagManager.prototype.fetchFlags = function() {
|
|
3045
|
-
if (!this.
|
|
3051
|
+
if (!this.isSystemEnabled()) {
|
|
3046
3052
|
return;
|
|
3047
3053
|
}
|
|
3048
3054
|
|
|
@@ -3068,7 +3074,7 @@ FeatureFlagManager.prototype.fetchFlags = function() {
|
|
|
3068
3074
|
_.each(responseFlags, function(data, key) {
|
|
3069
3075
|
flags.set(key, {
|
|
3070
3076
|
'key': data['variant_key'],
|
|
3071
|
-
'
|
|
3077
|
+
'value': data['variant_value']
|
|
3072
3078
|
});
|
|
3073
3079
|
});
|
|
3074
3080
|
this.flags = flags;
|
|
@@ -3078,7 +3084,7 @@ FeatureFlagManager.prototype.fetchFlags = function() {
|
|
|
3078
3084
|
}.bind(this)).catch(function() {});
|
|
3079
3085
|
};
|
|
3080
3086
|
|
|
3081
|
-
FeatureFlagManager.prototype.
|
|
3087
|
+
FeatureFlagManager.prototype.getVariant = function(featureName, fallback) {
|
|
3082
3088
|
if (!this.fetchPromise) {
|
|
3083
3089
|
return new Promise(function(resolve) {
|
|
3084
3090
|
logger$3.critical('Feature Flags not initialized');
|
|
@@ -3087,15 +3093,15 @@ FeatureFlagManager.prototype.getFeature = function(featureName, fallback) {
|
|
|
3087
3093
|
}
|
|
3088
3094
|
|
|
3089
3095
|
return this.fetchPromise.then(function() {
|
|
3090
|
-
return this.
|
|
3096
|
+
return this.getVariantSync(featureName, fallback);
|
|
3091
3097
|
}.bind(this)).catch(function(error) {
|
|
3092
3098
|
logger$3.error(error);
|
|
3093
3099
|
return fallback;
|
|
3094
3100
|
});
|
|
3095
3101
|
};
|
|
3096
3102
|
|
|
3097
|
-
FeatureFlagManager.prototype.
|
|
3098
|
-
if (!this.
|
|
3103
|
+
FeatureFlagManager.prototype.getVariantSync = function(featureName, fallback) {
|
|
3104
|
+
if (!this.areFlagsReady()) {
|
|
3099
3105
|
logger$3.log('Flags not loaded yet');
|
|
3100
3106
|
return fallback;
|
|
3101
3107
|
}
|
|
@@ -3108,31 +3114,37 @@ FeatureFlagManager.prototype.getFeatureSync = function(featureName, fallback) {
|
|
|
3108
3114
|
return feature;
|
|
3109
3115
|
};
|
|
3110
3116
|
|
|
3111
|
-
FeatureFlagManager.prototype.
|
|
3112
|
-
return this.
|
|
3113
|
-
return feature['
|
|
3117
|
+
FeatureFlagManager.prototype.getVariantValue = function(featureName, fallbackValue) {
|
|
3118
|
+
return this.getVariant(featureName, {'value': fallbackValue}).then(function(feature) {
|
|
3119
|
+
return feature['value'];
|
|
3114
3120
|
}).catch(function(error) {
|
|
3115
3121
|
logger$3.error(error);
|
|
3116
3122
|
return fallbackValue;
|
|
3117
3123
|
});
|
|
3118
3124
|
};
|
|
3119
3125
|
|
|
3120
|
-
|
|
3121
|
-
|
|
3126
|
+
// TODO remove deprecated method
|
|
3127
|
+
FeatureFlagManager.prototype.getFeatureData = function(featureName, fallbackValue) {
|
|
3128
|
+
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.');
|
|
3129
|
+
return this.getVariantValue(featureName, fallbackValue);
|
|
3130
|
+
};
|
|
3131
|
+
|
|
3132
|
+
FeatureFlagManager.prototype.getVariantValueSync = function(featureName, fallbackValue) {
|
|
3133
|
+
return this.getVariantSync(featureName, {'value': fallbackValue})['value'];
|
|
3122
3134
|
};
|
|
3123
3135
|
|
|
3124
|
-
FeatureFlagManager.prototype.
|
|
3125
|
-
return this.
|
|
3126
|
-
return this.
|
|
3136
|
+
FeatureFlagManager.prototype.isEnabled = function(featureName, fallbackValue) {
|
|
3137
|
+
return this.getVariantValue(featureName).then(function() {
|
|
3138
|
+
return this.isEnabledSync(featureName, fallbackValue);
|
|
3127
3139
|
}.bind(this)).catch(function(error) {
|
|
3128
3140
|
logger$3.error(error);
|
|
3129
3141
|
return fallbackValue;
|
|
3130
3142
|
});
|
|
3131
3143
|
};
|
|
3132
3144
|
|
|
3133
|
-
FeatureFlagManager.prototype.
|
|
3145
|
+
FeatureFlagManager.prototype.isEnabledSync = function(featureName, fallbackValue) {
|
|
3134
3146
|
fallbackValue = fallbackValue || false;
|
|
3135
|
-
var val = this.
|
|
3147
|
+
var val = this.getVariantValueSync(featureName, fallbackValue);
|
|
3136
3148
|
if (val !== true && val !== false) {
|
|
3137
3149
|
logger$3.error('Feature flag "' + featureName + '" value: ' + val + ' is not a boolean; returning fallback value: ' + fallbackValue);
|
|
3138
3150
|
val = fallbackValue;
|
|
@@ -3161,13 +3173,16 @@ function minApisSupported() {
|
|
|
3161
3173
|
|
|
3162
3174
|
safewrapClass(FeatureFlagManager);
|
|
3163
3175
|
|
|
3164
|
-
FeatureFlagManager.prototype['
|
|
3165
|
-
FeatureFlagManager.prototype['
|
|
3176
|
+
FeatureFlagManager.prototype['are_flags_ready'] = FeatureFlagManager.prototype.areFlagsReady;
|
|
3177
|
+
FeatureFlagManager.prototype['get_variant'] = FeatureFlagManager.prototype.getVariant;
|
|
3178
|
+
FeatureFlagManager.prototype['get_variant_sync'] = FeatureFlagManager.prototype.getVariantSync;
|
|
3179
|
+
FeatureFlagManager.prototype['get_variant_value'] = FeatureFlagManager.prototype.getVariantValue;
|
|
3180
|
+
FeatureFlagManager.prototype['get_variant_value_sync'] = FeatureFlagManager.prototype.getVariantValueSync;
|
|
3181
|
+
FeatureFlagManager.prototype['is_enabled'] = FeatureFlagManager.prototype.isEnabled;
|
|
3182
|
+
FeatureFlagManager.prototype['is_enabled_sync'] = FeatureFlagManager.prototype.isEnabledSync;
|
|
3183
|
+
|
|
3184
|
+
// Deprecated method
|
|
3166
3185
|
FeatureFlagManager.prototype['get_feature_data'] = FeatureFlagManager.prototype.getFeatureData;
|
|
3167
|
-
FeatureFlagManager.prototype['get_feature_data_sync'] = FeatureFlagManager.prototype.getFeatureDataSync;
|
|
3168
|
-
FeatureFlagManager.prototype['get_feature_sync'] = FeatureFlagManager.prototype.getFeatureSync;
|
|
3169
|
-
FeatureFlagManager.prototype['is_feature_enabled'] = FeatureFlagManager.prototype.isFeatureEnabled;
|
|
3170
|
-
FeatureFlagManager.prototype['is_feature_enabled_sync'] = FeatureFlagManager.prototype.isFeatureEnabledSync;
|
|
3171
3186
|
|
|
3172
3187
|
/* eslint camelcase: "off" */
|
|
3173
3188
|
|
|
@@ -4774,7 +4789,7 @@ MixpanelGroup.prototype._send_request = function(data, callback) {
|
|
|
4774
4789
|
return this._mixpanel._track_or_batch({
|
|
4775
4790
|
type: 'groups',
|
|
4776
4791
|
data: date_encoded_data,
|
|
4777
|
-
endpoint: this.
|
|
4792
|
+
endpoint: this._mixpanel.get_api_host('groups') + '/' + this._get_config('api_routes')['groups'],
|
|
4778
4793
|
batcher: this._mixpanel.request_batchers.groups
|
|
4779
4794
|
}, callback);
|
|
4780
4795
|
};
|
|
@@ -5051,18 +5066,8 @@ MixpanelPeople.prototype.union = addOptOutCheckMixpanelPeople(function(list_name
|
|
|
5051
5066
|
* @param {Function} [callback] If provided, the callback will be called when the server responds
|
|
5052
5067
|
* @deprecated
|
|
5053
5068
|
*/
|
|
5054
|
-
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(
|
|
5055
|
-
|
|
5056
|
-
amount = parseFloat(amount);
|
|
5057
|
-
if (isNaN(amount)) {
|
|
5058
|
-
console.error('Invalid value passed to mixpanel.people.track_charge - must be a number');
|
|
5059
|
-
return;
|
|
5060
|
-
}
|
|
5061
|
-
}
|
|
5062
|
-
|
|
5063
|
-
return this.append('$transactions', _.extend({
|
|
5064
|
-
'$amount': amount
|
|
5065
|
-
}, properties), callback);
|
|
5069
|
+
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function() {
|
|
5070
|
+
console.error('mixpanel.people.track_charge() is deprecated and no longer has any effect.');
|
|
5066
5071
|
});
|
|
5067
5072
|
|
|
5068
5073
|
/*
|
|
@@ -5136,7 +5141,7 @@ MixpanelPeople.prototype._send_request = function(data, callback) {
|
|
|
5136
5141
|
return this._mixpanel._track_or_batch({
|
|
5137
5142
|
type: 'people',
|
|
5138
5143
|
data: date_encoded_data,
|
|
5139
|
-
endpoint: this.
|
|
5144
|
+
endpoint: this._mixpanel.get_api_host('people') + '/' + this._get_config('api_routes')['engage'],
|
|
5140
5145
|
batcher: this._mixpanel.request_batchers.people
|
|
5141
5146
|
}, callback);
|
|
5142
5147
|
};
|
|
@@ -5896,7 +5901,9 @@ var DEFAULT_API_ROUTES = {
|
|
|
5896
5901
|
*/
|
|
5897
5902
|
var DEFAULT_CONFIG = {
|
|
5898
5903
|
'api_host': 'https://api-js.mixpanel.com',
|
|
5904
|
+
'api_hosts': {},
|
|
5899
5905
|
'api_routes': DEFAULT_API_ROUTES,
|
|
5906
|
+
'api_extra_query_params': {},
|
|
5900
5907
|
'api_method': 'POST',
|
|
5901
5908
|
'api_transport': 'XHR',
|
|
5902
5909
|
'api_payload_format': PAYLOAD_TYPE_BASE64,
|
|
@@ -6280,20 +6287,23 @@ MixpanelLib.prototype.start_session_recording = function () {
|
|
|
6280
6287
|
|
|
6281
6288
|
MixpanelLib.prototype.stop_session_recording = function () {
|
|
6282
6289
|
if (this._recorder) {
|
|
6283
|
-
this._recorder['stopRecording']();
|
|
6290
|
+
return this._recorder['stopRecording']();
|
|
6284
6291
|
}
|
|
6292
|
+
return Promise.resolve();
|
|
6285
6293
|
};
|
|
6286
6294
|
|
|
6287
6295
|
MixpanelLib.prototype.pause_session_recording = function () {
|
|
6288
6296
|
if (this._recorder) {
|
|
6289
|
-
this._recorder['pauseRecording']();
|
|
6297
|
+
return this._recorder['pauseRecording']();
|
|
6290
6298
|
}
|
|
6299
|
+
return Promise.resolve();
|
|
6291
6300
|
};
|
|
6292
6301
|
|
|
6293
6302
|
MixpanelLib.prototype.resume_session_recording = function () {
|
|
6294
6303
|
if (this._recorder) {
|
|
6295
|
-
this._recorder['resumeRecording']();
|
|
6304
|
+
return this._recorder['resumeRecording']();
|
|
6296
6305
|
}
|
|
6306
|
+
return Promise.resolve();
|
|
6297
6307
|
};
|
|
6298
6308
|
|
|
6299
6309
|
MixpanelLib.prototype.is_recording_heatmap_data = function () {
|
|
@@ -6484,6 +6494,8 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
|
|
|
6484
6494
|
delete data['data'];
|
|
6485
6495
|
}
|
|
6486
6496
|
|
|
6497
|
+
_.extend(data, this.get_config('api_extra_query_params'));
|
|
6498
|
+
|
|
6487
6499
|
url += '?' + _.HTTPBuildQuery(data);
|
|
6488
6500
|
|
|
6489
6501
|
var lib = this;
|
|
@@ -6891,7 +6903,7 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
|
|
|
6891
6903
|
var ret = this._track_or_batch({
|
|
6892
6904
|
type: 'events',
|
|
6893
6905
|
data: data,
|
|
6894
|
-
endpoint: this.
|
|
6906
|
+
endpoint: this.get_api_host('events') + '/' + this.get_config('api_routes')['track'],
|
|
6895
6907
|
batcher: this.request_batchers.events,
|
|
6896
6908
|
should_send_immediately: should_send_immediately,
|
|
6897
6909
|
send_request_options: options
|
|
@@ -7393,13 +7405,31 @@ MixpanelLib.prototype.identify = function(
|
|
|
7393
7405
|
* Useful for clearing data when a user logs out.
|
|
7394
7406
|
*/
|
|
7395
7407
|
MixpanelLib.prototype.reset = function() {
|
|
7396
|
-
this
|
|
7397
|
-
|
|
7398
|
-
var
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7408
|
+
var self = this;
|
|
7409
|
+
|
|
7410
|
+
var reset = function () {
|
|
7411
|
+
self['persistence'].clear();
|
|
7412
|
+
self._flags.identify_called = false;
|
|
7413
|
+
var uuid = _.UUID();
|
|
7414
|
+
self.register_once({
|
|
7415
|
+
'distinct_id': DEVICE_ID_PREFIX + uuid,
|
|
7416
|
+
'$device_id': uuid
|
|
7417
|
+
}, '');
|
|
7418
|
+
};
|
|
7419
|
+
|
|
7420
|
+
if (self._recorder) {
|
|
7421
|
+
self.stop_session_recording()
|
|
7422
|
+
.then(function () {
|
|
7423
|
+
reset();
|
|
7424
|
+
self._check_and_start_session_recording();
|
|
7425
|
+
})
|
|
7426
|
+
.catch(_.bind(function (err) {
|
|
7427
|
+
reset();
|
|
7428
|
+
this.report_error('Error restarting recording session', err);
|
|
7429
|
+
}, this));
|
|
7430
|
+
} else {
|
|
7431
|
+
reset();
|
|
7432
|
+
}
|
|
7403
7433
|
};
|
|
7404
7434
|
|
|
7405
7435
|
/**
|
|
@@ -7710,6 +7740,16 @@ MixpanelLib.prototype.get_property = function(property_name) {
|
|
|
7710
7740
|
return this['persistence'].load_prop([property_name]);
|
|
7711
7741
|
};
|
|
7712
7742
|
|
|
7743
|
+
/**
|
|
7744
|
+
* Get the API host for a specific endpoint type, falling back to the default api_host if not specified
|
|
7745
|
+
*
|
|
7746
|
+
* @param {String} endpoint_type The type of endpoint (e.g., "events", "people", "groups")
|
|
7747
|
+
* @returns {String} The API host to use for this endpoint
|
|
7748
|
+
*/
|
|
7749
|
+
MixpanelLib.prototype.get_api_host = function(endpoint_type) {
|
|
7750
|
+
return this.get_config('api_hosts')[endpoint_type] || this.get_config('api_host');
|
|
7751
|
+
};
|
|
7752
|
+
|
|
7713
7753
|
MixpanelLib.prototype.toString = function() {
|
|
7714
7754
|
var name = this.get_config('name');
|
|
7715
7755
|
if (name !== PRIMARY_INSTANCE_NAME) {
|
|
@@ -8005,6 +8045,7 @@ MixpanelLib.prototype['alias'] = MixpanelLib.protot
|
|
|
8005
8045
|
MixpanelLib.prototype['name_tag'] = MixpanelLib.prototype.name_tag;
|
|
8006
8046
|
MixpanelLib.prototype['set_config'] = MixpanelLib.prototype.set_config;
|
|
8007
8047
|
MixpanelLib.prototype['get_config'] = MixpanelLib.prototype.get_config;
|
|
8048
|
+
MixpanelLib.prototype['get_api_host'] = MixpanelLib.prototype.get_api_host;
|
|
8008
8049
|
MixpanelLib.prototype['get_property'] = MixpanelLib.prototype.get_property;
|
|
8009
8050
|
MixpanelLib.prototype['get_distinct_id'] = MixpanelLib.prototype.get_distinct_id;
|
|
8010
8051
|
MixpanelLib.prototype['toString'] = MixpanelLib.prototype.toString;
|
|
@@ -13944,7 +13944,7 @@
|
|
|
13944
13944
|
}
|
|
13945
13945
|
|
|
13946
13946
|
var Config = {
|
|
13947
|
-
LIB_VERSION: '2.
|
|
13947
|
+
LIB_VERSION: '2.66.0'
|
|
13948
13948
|
};
|
|
13949
13949
|
|
|
13950
13950
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -15377,6 +15377,9 @@
|
|
|
15377
15377
|
return 'Microsoft Edge';
|
|
15378
15378
|
} else if (_.includes(user_agent, 'FBIOS')) {
|
|
15379
15379
|
return 'Facebook Mobile';
|
|
15380
|
+
} else if (_.includes(user_agent, 'Whale/')) {
|
|
15381
|
+
// https://user-agents.net/browsers/whale-browser
|
|
15382
|
+
return 'Whale Browser';
|
|
15380
15383
|
} else if (_.includes(user_agent, 'Chrome')) {
|
|
15381
15384
|
return 'Chrome';
|
|
15382
15385
|
} else if (_.includes(user_agent, 'CriOS')) {
|
|
@@ -15428,7 +15431,8 @@
|
|
|
15428
15431
|
'Android Mobile': /android\s(\d+(\.\d+)?)/,
|
|
15429
15432
|
'Samsung Internet': /SamsungBrowser\/(\d+(\.\d+)?)/,
|
|
15430
15433
|
'Internet Explorer': /(rv:|MSIE )(\d+(\.\d+)?)/,
|
|
15431
|
-
'Mozilla': /rv:(\d+(\.\d+)?)
|
|
15434
|
+
'Mozilla': /rv:(\d+(\.\d+)?)/,
|
|
15435
|
+
'Whale Browser': /Whale\/(\d+(\.\d+)?)/
|
|
15432
15436
|
};
|
|
15433
15437
|
var regex = versionRegexs[browser];
|
|
15434
15438
|
if (regex === undefined) {
|
|
@@ -17163,8 +17167,8 @@
|
|
|
17163
17167
|
retryAfter: response.headers.get('Retry-After')
|
|
17164
17168
|
});
|
|
17165
17169
|
}.bind(this);
|
|
17166
|
-
|
|
17167
|
-
win['fetch'](
|
|
17170
|
+
var apiHost = (this._mixpanel.get_api_host && this._mixpanel.get_api_host('record')) || this.getConfig('api_host');
|
|
17171
|
+
win['fetch'](apiHost + '/' + this.getConfig('api_routes')['record'] + '?' + new URLSearchParams(reqParams), {
|
|
17168
17172
|
'method': 'POST',
|
|
17169
17173
|
'headers': {
|
|
17170
17174
|
'Authorization': 'Basic ' + btoa(this.getConfig('token') + ':'),
|
|
@@ -17381,6 +17385,7 @@
|
|
|
17381
17385
|
this._flushInactivePromise = this.recordingRegistry.flushInactiveRecordings();
|
|
17382
17386
|
|
|
17383
17387
|
this.activeRecording = null;
|
|
17388
|
+
this.stopRecordingInProgress = false;
|
|
17384
17389
|
};
|
|
17385
17390
|
|
|
17386
17391
|
MixpanelRecorder.prototype.startRecording = function(options) {
|
|
@@ -17429,19 +17434,26 @@
|
|
|
17429
17434
|
};
|
|
17430
17435
|
|
|
17431
17436
|
MixpanelRecorder.prototype.stopRecording = function() {
|
|
17432
|
-
|
|
17433
|
-
this.
|
|
17434
|
-
this.
|
|
17435
|
-
|
|
17437
|
+
// Prevents activeSerializedRecording from being reused when stopping the recording.
|
|
17438
|
+
this.stopRecordingInProgress = true;
|
|
17439
|
+
return this._stopCurrentRecording(false, true).then(function() {
|
|
17440
|
+
return this.recordingRegistry.clearActiveRecording();
|
|
17441
|
+
}.bind(this)).then(function() {
|
|
17442
|
+
this.stopRecordingInProgress = false;
|
|
17443
|
+
}.bind(this));
|
|
17436
17444
|
};
|
|
17437
17445
|
|
|
17438
17446
|
MixpanelRecorder.prototype.pauseRecording = function() {
|
|
17439
17447
|
return this._stopCurrentRecording(false);
|
|
17440
17448
|
};
|
|
17441
17449
|
|
|
17442
|
-
MixpanelRecorder.prototype._stopCurrentRecording = function(skipFlush) {
|
|
17450
|
+
MixpanelRecorder.prototype._stopCurrentRecording = function(skipFlush, disableActiveRecording) {
|
|
17443
17451
|
if (this.activeRecording) {
|
|
17444
|
-
|
|
17452
|
+
var stopRecordingPromise = this.activeRecording.stopRecording(skipFlush);
|
|
17453
|
+
if (disableActiveRecording) {
|
|
17454
|
+
this.activeRecording = null;
|
|
17455
|
+
}
|
|
17456
|
+
return stopRecordingPromise;
|
|
17445
17457
|
}
|
|
17446
17458
|
return PromisePolyfill.resolve();
|
|
17447
17459
|
};
|
|
@@ -17454,7 +17466,7 @@
|
|
|
17454
17466
|
|
|
17455
17467
|
return this.recordingRegistry.getActiveRecording()
|
|
17456
17468
|
.then(function (activeSerializedRecording) {
|
|
17457
|
-
if (activeSerializedRecording) {
|
|
17469
|
+
if (activeSerializedRecording && !this.stopRecordingInProgress) {
|
|
17458
17470
|
return this.startRecording({activeSerializedRecording: activeSerializedRecording});
|
|
17459
17471
|
} else if (startNewIfInactive) {
|
|
17460
17472
|
return this.startRecording({shouldStopBatcher: false});
|