Skip to content

Commit 67bd268

Browse files
committed
build
1 parent 2ea667f commit 67bd268

File tree

4 files changed

+50
-13
lines changed

4 files changed

+50
-13
lines changed

examples/commonjs-browserify/bundle.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8337,7 +8337,7 @@ SessionRecording.prototype._sendRequest = function(currentReplayId, reqParams, r
83378337
retryAfter: response.headers.get('Retry-After')
83388338
});
83398339
}.bind(this);
8340-
const apiHost = this.getConfig('session_recording_use_proxy') ? this.getConfig('api_host') : 'https://api.mixpanel.com';
8340+
const apiHost = this.getConfig('session_recording_use_proxy') ? this._mixpanel._getApiHost("record") : 'https://api.mixpanel.com';
83418341

83428342
win['fetch'](apiHost + '/' + this.getConfig('api_routes')['record'] + '?' + new URLSearchParams(reqParams), {
83438343
'method': 'POST',
@@ -9924,7 +9924,7 @@ MixpanelGroup.prototype._send_request = function(data, callback) {
99249924
return this._mixpanel._track_or_batch({
99259925
type: 'groups',
99269926
data: date_encoded_data,
9927-
endpoint: this._get_config('api_host') + '/' + this._get_config('api_routes')['groups'],
9927+
endpoint: this._mixpanel._getApiHost('groups') + '/' + this._get_config('api_routes')['groups'],
99289928
batcher: this._mixpanel.request_batchers.groups
99299929
}, callback);
99309930
};
@@ -10286,7 +10286,7 @@ MixpanelPeople.prototype._send_request = function(data, callback) {
1028610286
return this._mixpanel._track_or_batch({
1028710287
type: 'people',
1028810288
data: date_encoded_data,
10289-
endpoint: this._get_config('api_host') + '/' + this._get_config('api_routes')['engage'],
10289+
endpoint: this._mixpanel._getApiHost('people') + '/' + this._get_config('api_routes')['engage'],
1029010290
batcher: this._mixpanel.request_batchers.people
1029110291
}, callback);
1029210292
};
@@ -10921,6 +10921,7 @@ var DEFAULT_API_ROUTES = {
1092110921
*/
1092210922
var DEFAULT_CONFIG = {
1092310923
'api_host': 'https://api-js.mixpanel.com',
10924+
'api_hosts': {},
1092410925
'api_routes': DEFAULT_API_ROUTES,
1092510926
'api_method': 'POST',
1092610927
'api_transport': 'XHR',
@@ -11903,7 +11904,7 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
1190311904
var ret = this._track_or_batch({
1190411905
type: 'events',
1190511906
data: data,
11906-
endpoint: this.get_config('api_host') + '/' + this.get_config('api_routes')['track'],
11907+
endpoint: this._getApiHost('events') + '/' + this.get_config('api_routes')['track'],
1190711908
batcher: this.request_batchers.events,
1190811909
should_send_immediately: should_send_immediately,
1190911910
send_request_options: options
@@ -12717,6 +12718,17 @@ MixpanelLib.prototype.get_property = function(property_name) {
1271712718
return this['persistence'].load_prop([property_name]);
1271812719
};
1271912720

12721+
/**
12722+
* Get the API host for a specific endpoint type, falling back to the default api_host if not specified
12723+
*
12724+
* @param {String} endpoint_type The type of endpoint (e.g., "events", "people", "groups")
12725+
* @returns {String} The API host to use for this endpoint
12726+
* @private
12727+
*/
12728+
MixpanelLib.prototype._getApiHost = function(endpoint_type) {
12729+
return this.get_config('api_hosts')[endpoint_type] || this.get_config('api_host');
12730+
};
12731+
1272012732
MixpanelLib.prototype.toString = function() {
1272112733
var name = this.get_config('name');
1272212734
if (name !== PRIMARY_INSTANCE_NAME) {

examples/es2015-babelify/bundle.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12496,6 +12496,7 @@ var DEFAULT_API_ROUTES = {
1249612496
*/
1249712497
var DEFAULT_CONFIG = {
1249812498
'api_host': 'https://api-js.mixpanel.com',
12499+
'api_hosts': {},
1249912500
'api_routes': DEFAULT_API_ROUTES,
1250012501
'api_method': 'POST',
1250112502
'api_transport': 'XHR',
@@ -13458,7 +13459,7 @@ MixpanelLib.prototype.track = (0, _gdprUtils.addOptOutCheckMixpanelLib)(function
1345813459
var ret = this._track_or_batch({
1345913460
type: 'events',
1346013461
data: data,
13461-
endpoint: this.get_config('api_host') + '/' + this.get_config('api_routes')['track'],
13462+
endpoint: this._getApiHost('events') + '/' + this.get_config('api_routes')['track'],
1346213463
batcher: this.request_batchers.events,
1346313464
should_send_immediately: should_send_immediately,
1346413465
send_request_options: options
@@ -14262,6 +14263,17 @@ MixpanelLib.prototype.get_property = function (property_name) {
1426214263
return this['persistence'].load_prop([property_name]);
1426314264
};
1426414265

14266+
/**
14267+
* Get the API host for a specific endpoint type, falling back to the default api_host if not specified
14268+
*
14269+
* @param {String} endpoint_type The type of endpoint (e.g., "events", "people", "groups")
14270+
* @returns {String} The API host to use for this endpoint
14271+
* @private
14272+
*/
14273+
MixpanelLib.prototype._getApiHost = function (endpoint_type) {
14274+
return this.get_config('api_hosts')[endpoint_type] || this.get_config('api_host');
14275+
};
14276+
1426514277
MixpanelLib.prototype.toString = function () {
1426614278
var name = this.get_config('name');
1426714279
if (name !== PRIMARY_INSTANCE_NAME) {
@@ -14902,7 +14914,7 @@ MixpanelGroup.prototype._send_request = function (data, callback) {
1490214914
return this._mixpanel._track_or_batch({
1490314915
type: 'groups',
1490414916
data: date_encoded_data,
14905-
endpoint: this._get_config('api_host') + '/' + this._get_config('api_routes')['groups'],
14917+
endpoint: this._mixpanel._getApiHost('groups') + '/' + this._get_config('api_routes')['groups'],
1490614918
batcher: this._mixpanel.request_batchers.groups
1490714919
}, callback);
1490814920
};
@@ -15274,7 +15286,7 @@ MixpanelPeople.prototype._send_request = function (data, callback) {
1527415286
return this._mixpanel._track_or_batch({
1527515287
type: 'people',
1527615288
data: date_encoded_data,
15277-
endpoint: this._get_config('api_host') + '/' + this._get_config('api_routes')['engage'],
15289+
endpoint: this._mixpanel._getApiHost('people') + '/' + this._get_config('api_routes')['engage'],
1527815290
batcher: this._mixpanel.request_batchers.people
1527915291
}, callback);
1528015292
};
@@ -16827,7 +16839,7 @@ SessionRecording.prototype._sendRequest = function (currentReplayId, reqParams,
1682716839
retryAfter: response.headers.get('Retry-After')
1682816840
});
1682916841
}).bind(this);
16830-
var apiHost = this.getConfig('session_recording_use_proxy') ? this.getConfig('api_host') : 'https://api.mixpanel.com';
16842+
var apiHost = this.getConfig('session_recording_use_proxy') ? this._mixpanel._getApiHost("record") : 'https://api.mixpanel.com';
1683116843

1683216844
_window.window['fetch'](apiHost + '/' + this.getConfig('api_routes')['record'] + '?' + new URLSearchParams(reqParams), {
1683316845
'method': 'POST',

examples/umd-webpack/bundle.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8403,7 +8403,7 @@
84038403
retryAfter: response.headers.get('Retry-After')
84048404
});
84058405
}.bind(this);
8406-
const apiHost = this.getConfig('session_recording_use_proxy') ? this.getConfig('api_host') : 'https://api.mixpanel.com';
8406+
const apiHost = this.getConfig('session_recording_use_proxy') ? this._mixpanel._getApiHost("record") : 'https://api.mixpanel.com';
84078407

84088408
win['fetch'](apiHost + '/' + this.getConfig('api_routes')['record'] + '?' + new URLSearchParams(reqParams), {
84098409
'method': 'POST',
@@ -9990,7 +9990,7 @@
99909990
return this._mixpanel._track_or_batch({
99919991
type: 'groups',
99929992
data: date_encoded_data,
9993-
endpoint: this._get_config('api_host') + '/' + this._get_config('api_routes')['groups'],
9993+
endpoint: this._mixpanel._getApiHost('groups') + '/' + this._get_config('api_routes')['groups'],
99949994
batcher: this._mixpanel.request_batchers.groups
99959995
}, callback);
99969996
};
@@ -10352,7 +10352,7 @@
1035210352
return this._mixpanel._track_or_batch({
1035310353
type: 'people',
1035410354
data: date_encoded_data,
10355-
endpoint: this._get_config('api_host') + '/' + this._get_config('api_routes')['engage'],
10355+
endpoint: this._mixpanel._getApiHost('people') + '/' + this._get_config('api_routes')['engage'],
1035610356
batcher: this._mixpanel.request_batchers.people
1035710357
}, callback);
1035810358
};
@@ -10987,6 +10987,7 @@
1098710987
*/
1098810988
var DEFAULT_CONFIG = {
1098910989
'api_host': 'https://api-js.mixpanel.com',
10990+
'api_hosts': {},
1099010991
'api_routes': DEFAULT_API_ROUTES,
1099110992
'api_method': 'POST',
1099210993
'api_transport': 'XHR',
@@ -11969,7 +11970,7 @@
1196911970
var ret = this._track_or_batch({
1197011971
type: 'events',
1197111972
data: data,
11972-
endpoint: this.get_config('api_host') + '/' + this.get_config('api_routes')['track'],
11973+
endpoint: this._getApiHost('events') + '/' + this.get_config('api_routes')['track'],
1197311974
batcher: this.request_batchers.events,
1197411975
should_send_immediately: should_send_immediately,
1197511976
send_request_options: options
@@ -12783,6 +12784,17 @@
1278312784
return this['persistence'].load_prop([property_name]);
1278412785
};
1278512786

12787+
/**
12788+
* Get the API host for a specific endpoint type, falling back to the default api_host if not specified
12789+
*
12790+
* @param {String} endpoint_type The type of endpoint (e.g., "events", "people", "groups")
12791+
* @returns {String} The API host to use for this endpoint
12792+
* @private
12793+
*/
12794+
MixpanelLib.prototype._getApiHost = function(endpoint_type) {
12795+
return this.get_config('api_hosts')[endpoint_type] || this.get_config('api_host');
12796+
};
12797+
1278612798
MixpanelLib.prototype.toString = function() {
1278712799
var name = this.get_config('name');
1278812800
if (name !== PRIMARY_INSTANCE_NAME) {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@
6262
},
6363
"dependencies": {
6464
"rrweb": "2.0.0-alpha.13"
65-
}
65+
},
66+
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
6667
}

0 commit comments

Comments
 (0)