mixpanel-browser 2.69.1 → 2.70.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixpanel-browser",
3
- "version": "2.69.1",
3
+ "version": "2.70.0",
4
4
  "description": "The official Mixpanel JavaScript browser client library",
5
5
  "main": "dist/mixpanel.cjs.js",
6
6
  "module": "dist/mixpanel.module.js",
package/src/config.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var Config = {
2
2
  DEBUG: false,
3
- LIB_VERSION: '2.69.0'
3
+ LIB_VERSION: '2.70.0'
4
4
  };
5
5
 
6
6
  export default Config;
@@ -1,5 +1,6 @@
1
1
  import { _, console_with_prefix, safewrapClass } from '../utils'; // eslint-disable-line camelcase
2
2
  import { window } from '../window';
3
+ import Config from '../config';
3
4
 
4
5
  var fetch = window['fetch'];
5
6
  var logger = console_with_prefix('flags');
@@ -87,17 +88,21 @@ FeatureFlagManager.prototype.fetchFlags = function() {
87
88
  var distinctId = this.getMpProperty('distinct_id');
88
89
  var deviceId = this.getMpProperty('$device_id');
89
90
  logger.log('Fetching flags for distinct ID: ' + distinctId);
90
- var reqParams = {
91
- 'context': _.extend({'distinct_id': distinctId, 'device_id': deviceId}, this.getConfig(CONFIG_CONTEXT))
92
- };
91
+
92
+ var context = _.extend({'distinct_id': distinctId, 'device_id': deviceId}, this.getConfig(CONFIG_CONTEXT));
93
+ var searchParams = new URLSearchParams();
94
+ searchParams.set('context', JSON.stringify(context));
95
+ searchParams.set('token', this.getMpConfig('token'));
96
+ searchParams.set('mp_lib', 'web');
97
+ searchParams.set('$lib_version', Config.LIB_VERSION);
98
+ var url = this.getFullApiRoute() + '?' + searchParams.toString();
99
+
93
100
  this._fetchInProgressStartTime = Date.now();
94
- this.fetchPromise = window['fetch'](this.getFullApiRoute(), {
95
- 'method': 'POST',
101
+ this.fetchPromise = window['fetch'](url, {
102
+ 'method': 'GET',
96
103
  'headers': {
97
- 'Authorization': 'Basic ' + btoa(this.getMpConfig('token') + ':'),
98
- 'Content-Type': 'application/octet-stream'
99
- },
100
- 'body': JSON.stringify(reqParams)
104
+ 'Authorization': 'Basic ' + btoa(this.getMpConfig('token') + ':')
105
+ }
101
106
  }).then(function(response) {
102
107
  this.markFetchComplete();
103
108
  return response.json().then(function(responseBody) {