mixpanel-browser 2.65.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 +5 -0
- package/README.md +1 -1
- package/dist/mixpanel-core.cjs.js +47 -16
- package/dist/mixpanel-recorder.js +18 -10
- 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 +47 -16
- package/dist/mixpanel-with-recorder.js +64 -25
- package/dist/mixpanel-with-recorder.min.js +1 -1
- package/dist/mixpanel.amd.js +64 -25
- package/dist/mixpanel.cjs.js +64 -25
- package/dist/mixpanel.globals.js +47 -16
- package/dist/mixpanel.min.js +130 -129
- package/dist/mixpanel.module.js +64 -25
- package/dist/mixpanel.umd.js +64 -25
- package/package.json +2 -1
- package/src/config.js +1 -1
- package/src/index.d.ts +408 -0
- package/src/mixpanel-core.js +44 -13
- package/src/mixpanel-group.js +1 -1
- package/src/mixpanel-people.js +1 -1
- package/src/recorder/recorder.js +15 -7
- package/src/recorder/session-recording.js +2 -2
- package/tunnel.log +0 -0
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.66.0'
|
|
13948
13948
|
};
|
|
13949
13949
|
|
|
13950
13950
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -17351,8 +17351,8 @@ define((function () { 'use strict';
|
|
|
17351
17351
|
retryAfter: response.headers.get('Retry-After')
|
|
17352
17352
|
});
|
|
17353
17353
|
}.bind(this);
|
|
17354
|
-
|
|
17355
|
-
win['fetch'](
|
|
17354
|
+
var apiHost = (this._mixpanel.get_api_host && this._mixpanel.get_api_host('record')) || this.getConfig('api_host');
|
|
17355
|
+
win['fetch'](apiHost + '/' + this.getConfig('api_routes')['record'] + '?' + new URLSearchParams(reqParams), {
|
|
17356
17356
|
'method': 'POST',
|
|
17357
17357
|
'headers': {
|
|
17358
17358
|
'Authorization': 'Basic ' + btoa(this.getConfig('token') + ':'),
|
|
@@ -17569,6 +17569,7 @@ define((function () { 'use strict';
|
|
|
17569
17569
|
this._flushInactivePromise = this.recordingRegistry.flushInactiveRecordings();
|
|
17570
17570
|
|
|
17571
17571
|
this.activeRecording = null;
|
|
17572
|
+
this.stopRecordingInProgress = false;
|
|
17572
17573
|
};
|
|
17573
17574
|
|
|
17574
17575
|
MixpanelRecorder.prototype.startRecording = function(options) {
|
|
@@ -17617,19 +17618,26 @@ define((function () { 'use strict';
|
|
|
17617
17618
|
};
|
|
17618
17619
|
|
|
17619
17620
|
MixpanelRecorder.prototype.stopRecording = function() {
|
|
17620
|
-
|
|
17621
|
-
this.
|
|
17622
|
-
this.
|
|
17623
|
-
|
|
17621
|
+
// Prevents activeSerializedRecording from being reused when stopping the recording.
|
|
17622
|
+
this.stopRecordingInProgress = true;
|
|
17623
|
+
return this._stopCurrentRecording(false, true).then(function() {
|
|
17624
|
+
return this.recordingRegistry.clearActiveRecording();
|
|
17625
|
+
}.bind(this)).then(function() {
|
|
17626
|
+
this.stopRecordingInProgress = false;
|
|
17627
|
+
}.bind(this));
|
|
17624
17628
|
};
|
|
17625
17629
|
|
|
17626
17630
|
MixpanelRecorder.prototype.pauseRecording = function() {
|
|
17627
17631
|
return this._stopCurrentRecording(false);
|
|
17628
17632
|
};
|
|
17629
17633
|
|
|
17630
|
-
MixpanelRecorder.prototype._stopCurrentRecording = function(skipFlush) {
|
|
17634
|
+
MixpanelRecorder.prototype._stopCurrentRecording = function(skipFlush, disableActiveRecording) {
|
|
17631
17635
|
if (this.activeRecording) {
|
|
17632
|
-
|
|
17636
|
+
var stopRecordingPromise = this.activeRecording.stopRecording(skipFlush);
|
|
17637
|
+
if (disableActiveRecording) {
|
|
17638
|
+
this.activeRecording = null;
|
|
17639
|
+
}
|
|
17640
|
+
return stopRecordingPromise;
|
|
17633
17641
|
}
|
|
17634
17642
|
return PromisePolyfill.resolve();
|
|
17635
17643
|
};
|
|
@@ -17642,7 +17650,7 @@ define((function () { 'use strict';
|
|
|
17642
17650
|
|
|
17643
17651
|
return this.recordingRegistry.getActiveRecording()
|
|
17644
17652
|
.then(function (activeSerializedRecording) {
|
|
17645
|
-
if (activeSerializedRecording) {
|
|
17653
|
+
if (activeSerializedRecording && !this.stopRecordingInProgress) {
|
|
17646
17654
|
return this.startRecording({activeSerializedRecording: activeSerializedRecording});
|
|
17647
17655
|
} else if (startNewIfInactive) {
|
|
17648
17656
|
return this.startRecording({shouldStopBatcher: false});
|
|
@@ -19144,7 +19152,7 @@ define((function () { 'use strict';
|
|
|
19144
19152
|
return this._mixpanel._track_or_batch({
|
|
19145
19153
|
type: 'groups',
|
|
19146
19154
|
data: date_encoded_data,
|
|
19147
|
-
endpoint: this.
|
|
19155
|
+
endpoint: this._mixpanel.get_api_host('groups') + '/' + this._get_config('api_routes')['groups'],
|
|
19148
19156
|
batcher: this._mixpanel.request_batchers.groups
|
|
19149
19157
|
}, callback);
|
|
19150
19158
|
};
|
|
@@ -19496,7 +19504,7 @@ define((function () { 'use strict';
|
|
|
19496
19504
|
return this._mixpanel._track_or_batch({
|
|
19497
19505
|
type: 'people',
|
|
19498
19506
|
data: date_encoded_data,
|
|
19499
|
-
endpoint: this.
|
|
19507
|
+
endpoint: this._mixpanel.get_api_host('people') + '/' + this._get_config('api_routes')['engage'],
|
|
19500
19508
|
batcher: this._mixpanel.request_batchers.people
|
|
19501
19509
|
}, callback);
|
|
19502
19510
|
};
|
|
@@ -20133,6 +20141,7 @@ define((function () { 'use strict';
|
|
|
20133
20141
|
*/
|
|
20134
20142
|
var DEFAULT_CONFIG = {
|
|
20135
20143
|
'api_host': 'https://api-js.mixpanel.com',
|
|
20144
|
+
'api_hosts': {},
|
|
20136
20145
|
'api_routes': DEFAULT_API_ROUTES,
|
|
20137
20146
|
'api_extra_query_params': {},
|
|
20138
20147
|
'api_method': 'POST',
|
|
@@ -20518,20 +20527,23 @@ define((function () { 'use strict';
|
|
|
20518
20527
|
|
|
20519
20528
|
MixpanelLib.prototype.stop_session_recording = function () {
|
|
20520
20529
|
if (this._recorder) {
|
|
20521
|
-
this._recorder['stopRecording']();
|
|
20530
|
+
return this._recorder['stopRecording']();
|
|
20522
20531
|
}
|
|
20532
|
+
return Promise.resolve();
|
|
20523
20533
|
};
|
|
20524
20534
|
|
|
20525
20535
|
MixpanelLib.prototype.pause_session_recording = function () {
|
|
20526
20536
|
if (this._recorder) {
|
|
20527
|
-
this._recorder['pauseRecording']();
|
|
20537
|
+
return this._recorder['pauseRecording']();
|
|
20528
20538
|
}
|
|
20539
|
+
return Promise.resolve();
|
|
20529
20540
|
};
|
|
20530
20541
|
|
|
20531
20542
|
MixpanelLib.prototype.resume_session_recording = function () {
|
|
20532
20543
|
if (this._recorder) {
|
|
20533
|
-
this._recorder['resumeRecording']();
|
|
20544
|
+
return this._recorder['resumeRecording']();
|
|
20534
20545
|
}
|
|
20546
|
+
return Promise.resolve();
|
|
20535
20547
|
};
|
|
20536
20548
|
|
|
20537
20549
|
MixpanelLib.prototype.is_recording_heatmap_data = function () {
|
|
@@ -21131,7 +21143,7 @@ define((function () { 'use strict';
|
|
|
21131
21143
|
var ret = this._track_or_batch({
|
|
21132
21144
|
type: 'events',
|
|
21133
21145
|
data: data,
|
|
21134
|
-
endpoint: this.
|
|
21146
|
+
endpoint: this.get_api_host('events') + '/' + this.get_config('api_routes')['track'],
|
|
21135
21147
|
batcher: this.request_batchers.events,
|
|
21136
21148
|
should_send_immediately: should_send_immediately,
|
|
21137
21149
|
send_request_options: options
|
|
@@ -21633,15 +21645,31 @@ define((function () { 'use strict';
|
|
|
21633
21645
|
* Useful for clearing data when a user logs out.
|
|
21634
21646
|
*/
|
|
21635
21647
|
MixpanelLib.prototype.reset = function() {
|
|
21636
|
-
this
|
|
21637
|
-
|
|
21638
|
-
var
|
|
21639
|
-
|
|
21640
|
-
|
|
21641
|
-
|
|
21642
|
-
|
|
21643
|
-
|
|
21644
|
-
|
|
21648
|
+
var self = this;
|
|
21649
|
+
|
|
21650
|
+
var reset = function () {
|
|
21651
|
+
self['persistence'].clear();
|
|
21652
|
+
self._flags.identify_called = false;
|
|
21653
|
+
var uuid = _.UUID();
|
|
21654
|
+
self.register_once({
|
|
21655
|
+
'distinct_id': DEVICE_ID_PREFIX + uuid,
|
|
21656
|
+
'$device_id': uuid
|
|
21657
|
+
}, '');
|
|
21658
|
+
};
|
|
21659
|
+
|
|
21660
|
+
if (self._recorder) {
|
|
21661
|
+
self.stop_session_recording()
|
|
21662
|
+
.then(function () {
|
|
21663
|
+
reset();
|
|
21664
|
+
self._check_and_start_session_recording();
|
|
21665
|
+
})
|
|
21666
|
+
.catch(_.bind(function (err) {
|
|
21667
|
+
reset();
|
|
21668
|
+
this.report_error('Error restarting recording session', err);
|
|
21669
|
+
}, this));
|
|
21670
|
+
} else {
|
|
21671
|
+
reset();
|
|
21672
|
+
}
|
|
21645
21673
|
};
|
|
21646
21674
|
|
|
21647
21675
|
/**
|
|
@@ -21952,6 +21980,16 @@ define((function () { 'use strict';
|
|
|
21952
21980
|
return this['persistence'].load_prop([property_name]);
|
|
21953
21981
|
};
|
|
21954
21982
|
|
|
21983
|
+
/**
|
|
21984
|
+
* Get the API host for a specific endpoint type, falling back to the default api_host if not specified
|
|
21985
|
+
*
|
|
21986
|
+
* @param {String} endpoint_type The type of endpoint (e.g., "events", "people", "groups")
|
|
21987
|
+
* @returns {String} The API host to use for this endpoint
|
|
21988
|
+
*/
|
|
21989
|
+
MixpanelLib.prototype.get_api_host = function(endpoint_type) {
|
|
21990
|
+
return this.get_config('api_hosts')[endpoint_type] || this.get_config('api_host');
|
|
21991
|
+
};
|
|
21992
|
+
|
|
21955
21993
|
MixpanelLib.prototype.toString = function() {
|
|
21956
21994
|
var name = this.get_config('name');
|
|
21957
21995
|
if (name !== PRIMARY_INSTANCE_NAME) {
|
|
@@ -22247,6 +22285,7 @@ define((function () { 'use strict';
|
|
|
22247
22285
|
MixpanelLib.prototype['name_tag'] = MixpanelLib.prototype.name_tag;
|
|
22248
22286
|
MixpanelLib.prototype['set_config'] = MixpanelLib.prototype.set_config;
|
|
22249
22287
|
MixpanelLib.prototype['get_config'] = MixpanelLib.prototype.get_config;
|
|
22288
|
+
MixpanelLib.prototype['get_api_host'] = MixpanelLib.prototype.get_api_host;
|
|
22250
22289
|
MixpanelLib.prototype['get_property'] = MixpanelLib.prototype.get_property;
|
|
22251
22290
|
MixpanelLib.prototype['get_distinct_id'] = MixpanelLib.prototype.get_distinct_id;
|
|
22252
22291
|
MixpanelLib.prototype['toString'] = MixpanelLib.prototype.toString;
|
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.66.0'
|
|
13948
13948
|
};
|
|
13949
13949
|
|
|
13950
13950
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -17351,8 +17351,8 @@ SessionRecording.prototype._sendRequest = function(currentReplayId, reqParams, r
|
|
|
17351
17351
|
retryAfter: response.headers.get('Retry-After')
|
|
17352
17352
|
});
|
|
17353
17353
|
}.bind(this);
|
|
17354
|
-
|
|
17355
|
-
win['fetch'](
|
|
17354
|
+
var apiHost = (this._mixpanel.get_api_host && this._mixpanel.get_api_host('record')) || this.getConfig('api_host');
|
|
17355
|
+
win['fetch'](apiHost + '/' + this.getConfig('api_routes')['record'] + '?' + new URLSearchParams(reqParams), {
|
|
17356
17356
|
'method': 'POST',
|
|
17357
17357
|
'headers': {
|
|
17358
17358
|
'Authorization': 'Basic ' + btoa(this.getConfig('token') + ':'),
|
|
@@ -17569,6 +17569,7 @@ var MixpanelRecorder = function(mixpanelInstance, rrwebRecord, sharedLockStorage
|
|
|
17569
17569
|
this._flushInactivePromise = this.recordingRegistry.flushInactiveRecordings();
|
|
17570
17570
|
|
|
17571
17571
|
this.activeRecording = null;
|
|
17572
|
+
this.stopRecordingInProgress = false;
|
|
17572
17573
|
};
|
|
17573
17574
|
|
|
17574
17575
|
MixpanelRecorder.prototype.startRecording = function(options) {
|
|
@@ -17617,19 +17618,26 @@ MixpanelRecorder.prototype.startRecording = function(options) {
|
|
|
17617
17618
|
};
|
|
17618
17619
|
|
|
17619
17620
|
MixpanelRecorder.prototype.stopRecording = function() {
|
|
17620
|
-
|
|
17621
|
-
this.
|
|
17622
|
-
this.
|
|
17623
|
-
|
|
17621
|
+
// Prevents activeSerializedRecording from being reused when stopping the recording.
|
|
17622
|
+
this.stopRecordingInProgress = true;
|
|
17623
|
+
return this._stopCurrentRecording(false, true).then(function() {
|
|
17624
|
+
return this.recordingRegistry.clearActiveRecording();
|
|
17625
|
+
}.bind(this)).then(function() {
|
|
17626
|
+
this.stopRecordingInProgress = false;
|
|
17627
|
+
}.bind(this));
|
|
17624
17628
|
};
|
|
17625
17629
|
|
|
17626
17630
|
MixpanelRecorder.prototype.pauseRecording = function() {
|
|
17627
17631
|
return this._stopCurrentRecording(false);
|
|
17628
17632
|
};
|
|
17629
17633
|
|
|
17630
|
-
MixpanelRecorder.prototype._stopCurrentRecording = function(skipFlush) {
|
|
17634
|
+
MixpanelRecorder.prototype._stopCurrentRecording = function(skipFlush, disableActiveRecording) {
|
|
17631
17635
|
if (this.activeRecording) {
|
|
17632
|
-
|
|
17636
|
+
var stopRecordingPromise = this.activeRecording.stopRecording(skipFlush);
|
|
17637
|
+
if (disableActiveRecording) {
|
|
17638
|
+
this.activeRecording = null;
|
|
17639
|
+
}
|
|
17640
|
+
return stopRecordingPromise;
|
|
17633
17641
|
}
|
|
17634
17642
|
return PromisePolyfill.resolve();
|
|
17635
17643
|
};
|
|
@@ -17642,7 +17650,7 @@ MixpanelRecorder.prototype.resumeRecording = function (startNewIfInactive) {
|
|
|
17642
17650
|
|
|
17643
17651
|
return this.recordingRegistry.getActiveRecording()
|
|
17644
17652
|
.then(function (activeSerializedRecording) {
|
|
17645
|
-
if (activeSerializedRecording) {
|
|
17653
|
+
if (activeSerializedRecording && !this.stopRecordingInProgress) {
|
|
17646
17654
|
return this.startRecording({activeSerializedRecording: activeSerializedRecording});
|
|
17647
17655
|
} else if (startNewIfInactive) {
|
|
17648
17656
|
return this.startRecording({shouldStopBatcher: false});
|
|
@@ -19144,7 +19152,7 @@ MixpanelGroup.prototype._send_request = function(data, callback) {
|
|
|
19144
19152
|
return this._mixpanel._track_or_batch({
|
|
19145
19153
|
type: 'groups',
|
|
19146
19154
|
data: date_encoded_data,
|
|
19147
|
-
endpoint: this.
|
|
19155
|
+
endpoint: this._mixpanel.get_api_host('groups') + '/' + this._get_config('api_routes')['groups'],
|
|
19148
19156
|
batcher: this._mixpanel.request_batchers.groups
|
|
19149
19157
|
}, callback);
|
|
19150
19158
|
};
|
|
@@ -19496,7 +19504,7 @@ MixpanelPeople.prototype._send_request = function(data, callback) {
|
|
|
19496
19504
|
return this._mixpanel._track_or_batch({
|
|
19497
19505
|
type: 'people',
|
|
19498
19506
|
data: date_encoded_data,
|
|
19499
|
-
endpoint: this.
|
|
19507
|
+
endpoint: this._mixpanel.get_api_host('people') + '/' + this._get_config('api_routes')['engage'],
|
|
19500
19508
|
batcher: this._mixpanel.request_batchers.people
|
|
19501
19509
|
}, callback);
|
|
19502
19510
|
};
|
|
@@ -20133,6 +20141,7 @@ var DEFAULT_API_ROUTES = {
|
|
|
20133
20141
|
*/
|
|
20134
20142
|
var DEFAULT_CONFIG = {
|
|
20135
20143
|
'api_host': 'https://api-js.mixpanel.com',
|
|
20144
|
+
'api_hosts': {},
|
|
20136
20145
|
'api_routes': DEFAULT_API_ROUTES,
|
|
20137
20146
|
'api_extra_query_params': {},
|
|
20138
20147
|
'api_method': 'POST',
|
|
@@ -20518,20 +20527,23 @@ MixpanelLib.prototype.start_session_recording = function () {
|
|
|
20518
20527
|
|
|
20519
20528
|
MixpanelLib.prototype.stop_session_recording = function () {
|
|
20520
20529
|
if (this._recorder) {
|
|
20521
|
-
this._recorder['stopRecording']();
|
|
20530
|
+
return this._recorder['stopRecording']();
|
|
20522
20531
|
}
|
|
20532
|
+
return Promise.resolve();
|
|
20523
20533
|
};
|
|
20524
20534
|
|
|
20525
20535
|
MixpanelLib.prototype.pause_session_recording = function () {
|
|
20526
20536
|
if (this._recorder) {
|
|
20527
|
-
this._recorder['pauseRecording']();
|
|
20537
|
+
return this._recorder['pauseRecording']();
|
|
20528
20538
|
}
|
|
20539
|
+
return Promise.resolve();
|
|
20529
20540
|
};
|
|
20530
20541
|
|
|
20531
20542
|
MixpanelLib.prototype.resume_session_recording = function () {
|
|
20532
20543
|
if (this._recorder) {
|
|
20533
|
-
this._recorder['resumeRecording']();
|
|
20544
|
+
return this._recorder['resumeRecording']();
|
|
20534
20545
|
}
|
|
20546
|
+
return Promise.resolve();
|
|
20535
20547
|
};
|
|
20536
20548
|
|
|
20537
20549
|
MixpanelLib.prototype.is_recording_heatmap_data = function () {
|
|
@@ -21131,7 +21143,7 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
|
|
|
21131
21143
|
var ret = this._track_or_batch({
|
|
21132
21144
|
type: 'events',
|
|
21133
21145
|
data: data,
|
|
21134
|
-
endpoint: this.
|
|
21146
|
+
endpoint: this.get_api_host('events') + '/' + this.get_config('api_routes')['track'],
|
|
21135
21147
|
batcher: this.request_batchers.events,
|
|
21136
21148
|
should_send_immediately: should_send_immediately,
|
|
21137
21149
|
send_request_options: options
|
|
@@ -21633,15 +21645,31 @@ MixpanelLib.prototype.identify = function(
|
|
|
21633
21645
|
* Useful for clearing data when a user logs out.
|
|
21634
21646
|
*/
|
|
21635
21647
|
MixpanelLib.prototype.reset = function() {
|
|
21636
|
-
this
|
|
21637
|
-
|
|
21638
|
-
var
|
|
21639
|
-
|
|
21640
|
-
|
|
21641
|
-
|
|
21642
|
-
|
|
21643
|
-
|
|
21644
|
-
|
|
21648
|
+
var self = this;
|
|
21649
|
+
|
|
21650
|
+
var reset = function () {
|
|
21651
|
+
self['persistence'].clear();
|
|
21652
|
+
self._flags.identify_called = false;
|
|
21653
|
+
var uuid = _.UUID();
|
|
21654
|
+
self.register_once({
|
|
21655
|
+
'distinct_id': DEVICE_ID_PREFIX + uuid,
|
|
21656
|
+
'$device_id': uuid
|
|
21657
|
+
}, '');
|
|
21658
|
+
};
|
|
21659
|
+
|
|
21660
|
+
if (self._recorder) {
|
|
21661
|
+
self.stop_session_recording()
|
|
21662
|
+
.then(function () {
|
|
21663
|
+
reset();
|
|
21664
|
+
self._check_and_start_session_recording();
|
|
21665
|
+
})
|
|
21666
|
+
.catch(_.bind(function (err) {
|
|
21667
|
+
reset();
|
|
21668
|
+
this.report_error('Error restarting recording session', err);
|
|
21669
|
+
}, this));
|
|
21670
|
+
} else {
|
|
21671
|
+
reset();
|
|
21672
|
+
}
|
|
21645
21673
|
};
|
|
21646
21674
|
|
|
21647
21675
|
/**
|
|
@@ -21952,6 +21980,16 @@ MixpanelLib.prototype.get_property = function(property_name) {
|
|
|
21952
21980
|
return this['persistence'].load_prop([property_name]);
|
|
21953
21981
|
};
|
|
21954
21982
|
|
|
21983
|
+
/**
|
|
21984
|
+
* Get the API host for a specific endpoint type, falling back to the default api_host if not specified
|
|
21985
|
+
*
|
|
21986
|
+
* @param {String} endpoint_type The type of endpoint (e.g., "events", "people", "groups")
|
|
21987
|
+
* @returns {String} The API host to use for this endpoint
|
|
21988
|
+
*/
|
|
21989
|
+
MixpanelLib.prototype.get_api_host = function(endpoint_type) {
|
|
21990
|
+
return this.get_config('api_hosts')[endpoint_type] || this.get_config('api_host');
|
|
21991
|
+
};
|
|
21992
|
+
|
|
21955
21993
|
MixpanelLib.prototype.toString = function() {
|
|
21956
21994
|
var name = this.get_config('name');
|
|
21957
21995
|
if (name !== PRIMARY_INSTANCE_NAME) {
|
|
@@ -22247,6 +22285,7 @@ MixpanelLib.prototype['alias'] = MixpanelLib.protot
|
|
|
22247
22285
|
MixpanelLib.prototype['name_tag'] = MixpanelLib.prototype.name_tag;
|
|
22248
22286
|
MixpanelLib.prototype['set_config'] = MixpanelLib.prototype.set_config;
|
|
22249
22287
|
MixpanelLib.prototype['get_config'] = MixpanelLib.prototype.get_config;
|
|
22288
|
+
MixpanelLib.prototype['get_api_host'] = MixpanelLib.prototype.get_api_host;
|
|
22250
22289
|
MixpanelLib.prototype['get_property'] = MixpanelLib.prototype.get_property;
|
|
22251
22290
|
MixpanelLib.prototype['get_distinct_id'] = MixpanelLib.prototype.get_distinct_id;
|
|
22252
22291
|
MixpanelLib.prototype['toString'] = MixpanelLib.prototype.toString;
|
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.66.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
|
|
@@ -4790,7 +4790,7 @@
|
|
|
4790
4790
|
return this._mixpanel._track_or_batch({
|
|
4791
4791
|
type: 'groups',
|
|
4792
4792
|
data: date_encoded_data,
|
|
4793
|
-
endpoint: this.
|
|
4793
|
+
endpoint: this._mixpanel.get_api_host('groups') + '/' + this._get_config('api_routes')['groups'],
|
|
4794
4794
|
batcher: this._mixpanel.request_batchers.groups
|
|
4795
4795
|
}, callback);
|
|
4796
4796
|
};
|
|
@@ -5142,7 +5142,7 @@
|
|
|
5142
5142
|
return this._mixpanel._track_or_batch({
|
|
5143
5143
|
type: 'people',
|
|
5144
5144
|
data: date_encoded_data,
|
|
5145
|
-
endpoint: this.
|
|
5145
|
+
endpoint: this._mixpanel.get_api_host('people') + '/' + this._get_config('api_routes')['engage'],
|
|
5146
5146
|
batcher: this._mixpanel.request_batchers.people
|
|
5147
5147
|
}, callback);
|
|
5148
5148
|
};
|
|
@@ -5902,6 +5902,7 @@
|
|
|
5902
5902
|
*/
|
|
5903
5903
|
var DEFAULT_CONFIG = {
|
|
5904
5904
|
'api_host': 'https://api-js.mixpanel.com',
|
|
5905
|
+
'api_hosts': {},
|
|
5905
5906
|
'api_routes': DEFAULT_API_ROUTES,
|
|
5906
5907
|
'api_extra_query_params': {},
|
|
5907
5908
|
'api_method': 'POST',
|
|
@@ -6287,20 +6288,23 @@
|
|
|
6287
6288
|
|
|
6288
6289
|
MixpanelLib.prototype.stop_session_recording = function () {
|
|
6289
6290
|
if (this._recorder) {
|
|
6290
|
-
this._recorder['stopRecording']();
|
|
6291
|
+
return this._recorder['stopRecording']();
|
|
6291
6292
|
}
|
|
6293
|
+
return Promise.resolve();
|
|
6292
6294
|
};
|
|
6293
6295
|
|
|
6294
6296
|
MixpanelLib.prototype.pause_session_recording = function () {
|
|
6295
6297
|
if (this._recorder) {
|
|
6296
|
-
this._recorder['pauseRecording']();
|
|
6298
|
+
return this._recorder['pauseRecording']();
|
|
6297
6299
|
}
|
|
6300
|
+
return Promise.resolve();
|
|
6298
6301
|
};
|
|
6299
6302
|
|
|
6300
6303
|
MixpanelLib.prototype.resume_session_recording = function () {
|
|
6301
6304
|
if (this._recorder) {
|
|
6302
|
-
this._recorder['resumeRecording']();
|
|
6305
|
+
return this._recorder['resumeRecording']();
|
|
6303
6306
|
}
|
|
6307
|
+
return Promise.resolve();
|
|
6304
6308
|
};
|
|
6305
6309
|
|
|
6306
6310
|
MixpanelLib.prototype.is_recording_heatmap_data = function () {
|
|
@@ -6900,7 +6904,7 @@
|
|
|
6900
6904
|
var ret = this._track_or_batch({
|
|
6901
6905
|
type: 'events',
|
|
6902
6906
|
data: data,
|
|
6903
|
-
endpoint: this.
|
|
6907
|
+
endpoint: this.get_api_host('events') + '/' + this.get_config('api_routes')['track'],
|
|
6904
6908
|
batcher: this.request_batchers.events,
|
|
6905
6909
|
should_send_immediately: should_send_immediately,
|
|
6906
6910
|
send_request_options: options
|
|
@@ -7402,15 +7406,31 @@
|
|
|
7402
7406
|
* Useful for clearing data when a user logs out.
|
|
7403
7407
|
*/
|
|
7404
7408
|
MixpanelLib.prototype.reset = function() {
|
|
7405
|
-
this
|
|
7406
|
-
|
|
7407
|
-
var
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7409
|
+
var self = this;
|
|
7410
|
+
|
|
7411
|
+
var reset = function () {
|
|
7412
|
+
self['persistence'].clear();
|
|
7413
|
+
self._flags.identify_called = false;
|
|
7414
|
+
var uuid = _.UUID();
|
|
7415
|
+
self.register_once({
|
|
7416
|
+
'distinct_id': DEVICE_ID_PREFIX + uuid,
|
|
7417
|
+
'$device_id': uuid
|
|
7418
|
+
}, '');
|
|
7419
|
+
};
|
|
7420
|
+
|
|
7421
|
+
if (self._recorder) {
|
|
7422
|
+
self.stop_session_recording()
|
|
7423
|
+
.then(function () {
|
|
7424
|
+
reset();
|
|
7425
|
+
self._check_and_start_session_recording();
|
|
7426
|
+
})
|
|
7427
|
+
.catch(_.bind(function (err) {
|
|
7428
|
+
reset();
|
|
7429
|
+
this.report_error('Error restarting recording session', err);
|
|
7430
|
+
}, this));
|
|
7431
|
+
} else {
|
|
7432
|
+
reset();
|
|
7433
|
+
}
|
|
7414
7434
|
};
|
|
7415
7435
|
|
|
7416
7436
|
/**
|
|
@@ -7721,6 +7741,16 @@
|
|
|
7721
7741
|
return this['persistence'].load_prop([property_name]);
|
|
7722
7742
|
};
|
|
7723
7743
|
|
|
7744
|
+
/**
|
|
7745
|
+
* Get the API host for a specific endpoint type, falling back to the default api_host if not specified
|
|
7746
|
+
*
|
|
7747
|
+
* @param {String} endpoint_type The type of endpoint (e.g., "events", "people", "groups")
|
|
7748
|
+
* @returns {String} The API host to use for this endpoint
|
|
7749
|
+
*/
|
|
7750
|
+
MixpanelLib.prototype.get_api_host = function(endpoint_type) {
|
|
7751
|
+
return this.get_config('api_hosts')[endpoint_type] || this.get_config('api_host');
|
|
7752
|
+
};
|
|
7753
|
+
|
|
7724
7754
|
MixpanelLib.prototype.toString = function() {
|
|
7725
7755
|
var name = this.get_config('name');
|
|
7726
7756
|
if (name !== PRIMARY_INSTANCE_NAME) {
|
|
@@ -8016,6 +8046,7 @@
|
|
|
8016
8046
|
MixpanelLib.prototype['name_tag'] = MixpanelLib.prototype.name_tag;
|
|
8017
8047
|
MixpanelLib.prototype['set_config'] = MixpanelLib.prototype.set_config;
|
|
8018
8048
|
MixpanelLib.prototype['get_config'] = MixpanelLib.prototype.get_config;
|
|
8049
|
+
MixpanelLib.prototype['get_api_host'] = MixpanelLib.prototype.get_api_host;
|
|
8019
8050
|
MixpanelLib.prototype['get_property'] = MixpanelLib.prototype.get_property;
|
|
8020
8051
|
MixpanelLib.prototype['get_distinct_id'] = MixpanelLib.prototype.get_distinct_id;
|
|
8021
8052
|
MixpanelLib.prototype['toString'] = MixpanelLib.prototype.toString;
|