mixpanel-browser 2.49.0 → 2.51.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.
@@ -1,21 +1,23 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
3
  typeof define === 'function' && define.amd ? define(factory) :
4
- (global.mixpanel = factory());
5
- }(this, function () { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.mixpanel = factory());
5
+ })(this, (function () { 'use strict';
6
6
 
7
7
  var Config = {
8
8
  DEBUG: false,
9
- LIB_VERSION: '2.49.0'
9
+ LIB_VERSION: '2.51.0'
10
10
  };
11
11
 
12
+ /* eslint camelcase: "off", eqeqeq: "off" */
13
+
12
14
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
13
- var window$1;
15
+ var win;
14
16
  if (typeof(window) === 'undefined') {
15
17
  var loc = {
16
18
  hostname: ''
17
19
  };
18
- window$1 = {
20
+ win = {
19
21
  navigator: { userAgent: '' },
20
22
  document: {
21
23
  location: loc,
@@ -25,32 +27,37 @@
25
27
  location: loc
26
28
  };
27
29
  } else {
28
- window$1 = window;
30
+ win = window;
29
31
  }
30
32
 
33
+ // Maximum allowed session recording length
34
+ var MAX_RECORDING_MS = 24 * 60 * 60 * 1000; // 24 hours
35
+
31
36
  /*
32
37
  * Saved references to long variable names, so that closure compiler can
33
38
  * minimize file size.
34
39
  */
35
40
 
36
- var ArrayProto = Array.prototype;
37
- var FuncProto = Function.prototype;
38
- var ObjProto = Object.prototype;
39
- var slice = ArrayProto.slice;
40
- var toString = ObjProto.toString;
41
- var hasOwnProperty = ObjProto.hasOwnProperty;
42
- var windowConsole = window$1.console;
43
- var navigator = window$1.navigator;
44
- var document$1 = window$1.document;
45
- var windowOpera = window$1.opera;
46
- var screen = window$1.screen;
47
- var userAgent = navigator.userAgent;
48
- var nativeBind = FuncProto.bind;
49
- var nativeForEach = ArrayProto.forEach;
50
- var nativeIndexOf = ArrayProto.indexOf;
51
- var nativeMap = ArrayProto.map;
52
- var nativeIsArray = Array.isArray;
53
- var breaker = {};
41
+ var ArrayProto = Array.prototype,
42
+ FuncProto = Function.prototype,
43
+ ObjProto = Object.prototype,
44
+ slice = ArrayProto.slice,
45
+ toString = ObjProto.toString,
46
+ hasOwnProperty = ObjProto.hasOwnProperty,
47
+ windowConsole = win.console,
48
+ navigator = win.navigator,
49
+ document$1 = win.document,
50
+ windowOpera = win.opera,
51
+ screen = win.screen,
52
+ userAgent = navigator.userAgent;
53
+
54
+ var nativeBind = FuncProto.bind,
55
+ nativeForEach = ArrayProto.forEach,
56
+ nativeIndexOf = ArrayProto.indexOf,
57
+ nativeMap = ArrayProto.map,
58
+ nativeIsArray = Array.isArray,
59
+ breaker = {};
60
+
54
61
  var _ = {
55
62
  trim: function(str) {
56
63
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
@@ -840,8 +847,8 @@
840
847
  var T = function() {
841
848
  var time = 1 * new Date(); // cross-browser version of Date.now()
842
849
  var ticks;
843
- if (window$1.performance && window$1.performance.now) {
844
- ticks = window$1.performance.now();
850
+ if (win.performance && win.performance.now) {
851
+ ticks = win.performance.now();
845
852
  } else {
846
853
  // fall back to busy loop
847
854
  ticks = 0;
@@ -1627,7 +1634,7 @@
1627
1634
  },
1628
1635
 
1629
1636
  currentUrl: function() {
1630
- return window$1.location.href;
1637
+ return win.location.href;
1631
1638
  },
1632
1639
 
1633
1640
  properties: function(extra_props) {
@@ -1664,10 +1671,10 @@
1664
1671
  mpPageViewProperties: function() {
1665
1672
  return _.strip_empty_properties({
1666
1673
  'current_page_title': document$1.title,
1667
- 'current_domain': window$1.location.hostname,
1668
- 'current_url_path': window$1.location.pathname,
1669
- 'current_url_protocol': window$1.location.protocol,
1670
- 'current_url_search': window$1.location.search
1674
+ 'current_domain': win.location.hostname,
1675
+ 'current_url_path': win.location.pathname,
1676
+ 'current_url_protocol': win.location.protocol,
1677
+ 'current_url_search': win.location.search
1671
1678
  });
1672
1679
  }
1673
1680
  };
@@ -1705,8 +1712,7 @@
1705
1712
  return matches ? matches[0] : '';
1706
1713
  };
1707
1714
 
1708
- var JSONStringify = null;
1709
- var JSONParse = null;
1715
+ var JSONStringify = null, JSONParse = null;
1710
1716
  if (typeof JSON !== 'undefined') {
1711
1717
  JSONStringify = JSON.stringify;
1712
1718
  JSONParse = JSON.parse;
@@ -1727,6 +1733,8 @@
1727
1733
  _['info']['browserVersion'] = _.info.browserVersion;
1728
1734
  _['info']['properties'] = _.info.properties;
1729
1735
 
1736
+ /* eslint camelcase: "off" */
1737
+
1730
1738
  /**
1731
1739
  * DomTracker Object
1732
1740
  * @constructor
@@ -1876,8 +1884,6 @@
1876
1884
  }, 0);
1877
1885
  };
1878
1886
 
1879
- // eslint-disable-line camelcase
1880
-
1881
1887
  var logger$2 = console_with_prefix('lock');
1882
1888
 
1883
1889
  /**
@@ -2024,8 +2030,6 @@
2024
2030
  }
2025
2031
  };
2026
2032
 
2027
- // eslint-disable-line camelcase
2028
-
2029
2033
  var logger$1 = console_with_prefix('batch');
2030
2034
 
2031
2035
  /**
@@ -2303,8 +2307,6 @@
2303
2307
  this.storage.removeItem(this.storageKey);
2304
2308
  };
2305
2309
 
2306
- // eslint-disable-line camelcase
2307
-
2308
2310
  // maximum interval between request retries after exponential backoff
2309
2311
  var MAX_RETRY_INTERVAL_MS = 10 * 60 * 1000; // 10 minutes
2310
2312
 
@@ -2599,6 +2601,19 @@
2599
2601
  }
2600
2602
  };
2601
2603
 
2604
+ /**
2605
+ * GDPR utils
2606
+ *
2607
+ * The General Data Protection Regulation (GDPR) is a regulation in EU law on data protection
2608
+ * and privacy for all individuals within the European Union. It addresses the export of personal
2609
+ * data outside the EU. The GDPR aims primarily to give control back to citizens and residents
2610
+ * over their personal data and to simplify the regulatory environment for international business
2611
+ * by unifying the regulation within the EU.
2612
+ *
2613
+ * This set of utilities is intended to enable opt in/out functionality in the Mixpanel JS SDK.
2614
+ * These functions are used internally by the SDK and are not intended to be publicly exposed.
2615
+ */
2616
+
2602
2617
  /**
2603
2618
  * A function used to track a Mixpanel event (e.g. MixpanelLib.track)
2604
2619
  * @callback trackFunction
@@ -2784,14 +2799,14 @@
2784
2799
  if (options && options.ignoreDnt) {
2785
2800
  return false;
2786
2801
  }
2787
- var win = (options && options.window) || window$1;
2788
- var nav = win['navigator'] || {};
2802
+ var win$1 = (options && options.window) || win;
2803
+ var nav = win$1['navigator'] || {};
2789
2804
  var hasDntOn = false;
2790
2805
 
2791
2806
  _.each([
2792
2807
  nav['doNotTrack'], // standard
2793
2808
  nav['msDoNotTrack'],
2794
- win['doNotTrack']
2809
+ win$1['doNotTrack']
2795
2810
  ], function(dntValue) {
2796
2811
  if (_.includes([true, 1, '1', 'yes'], dntValue)) {
2797
2812
  hasDntOn = true;
@@ -2885,6 +2900,8 @@
2885
2900
  };
2886
2901
  }
2887
2902
 
2903
+ /* eslint camelcase: "off" */
2904
+
2888
2905
  /** @const */ var SET_ACTION = '$set';
2889
2906
  /** @const */ var SET_ONCE_ACTION = '$set_once';
2890
2907
  /** @const */ var UNSET_ACTION = '$unset';
@@ -3002,6 +3019,8 @@
3002
3019
  }
3003
3020
  };
3004
3021
 
3022
+ /* eslint camelcase: "off" */
3023
+
3005
3024
  /**
3006
3025
  * Mixpanel Group Object
3007
3026
  * @constructor
@@ -3170,6 +3189,8 @@
3170
3189
  MixpanelGroup.prototype['unset'] = MixpanelGroup.prototype.unset;
3171
3190
  MixpanelGroup.prototype['toString'] = MixpanelGroup.prototype.toString;
3172
3191
 
3192
+ /* eslint camelcase: "off" */
3193
+
3173
3194
  /**
3174
3195
  * Mixpanel People Object
3175
3196
  * @constructor
@@ -3638,6 +3659,8 @@
3638
3659
  MixpanelPeople.prototype['delete_user'] = MixpanelPeople.prototype.delete_user;
3639
3660
  MixpanelPeople.prototype['toString'] = MixpanelPeople.prototype.toString;
3640
3661
 
3662
+ /* eslint camelcase: "off" */
3663
+
3641
3664
  /*
3642
3665
  * Constants
3643
3666
  */
@@ -3693,7 +3716,7 @@
3693
3716
 
3694
3717
  this.load();
3695
3718
  this.update_config(config);
3696
- this.upgrade(config);
3719
+ this.upgrade();
3697
3720
  this.save();
3698
3721
  };
3699
3722
 
@@ -3721,49 +3744,12 @@
3721
3744
  }
3722
3745
  };
3723
3746
 
3724
- MixpanelPersistence.prototype.upgrade = function(config) {
3725
- var upgrade_from_old_lib = config['upgrade'],
3726
- old_cookie_name,
3727
- old_cookie;
3728
-
3729
- if (upgrade_from_old_lib) {
3730
- old_cookie_name = 'mp_super_properties';
3731
- // Case where they had a custom cookie name before.
3732
- if (typeof(upgrade_from_old_lib) === 'string') {
3733
- old_cookie_name = upgrade_from_old_lib;
3734
- }
3735
-
3736
- old_cookie = this.storage.parse(old_cookie_name);
3737
-
3738
- // remove the cookie
3739
- this.storage.remove(old_cookie_name);
3740
- this.storage.remove(old_cookie_name, true);
3741
-
3742
- if (old_cookie) {
3743
- this['props'] = _.extend(
3744
- this['props'],
3745
- old_cookie['all'],
3746
- old_cookie['events']
3747
- );
3748
- }
3749
- }
3750
-
3751
- if (!config['cookie_name'] && config['name'] !== 'mixpanel') {
3752
- // special case to handle people with cookies of the form
3753
- // mp_TOKEN_INSTANCENAME from the first release of this library
3754
- old_cookie_name = 'mp_' + config['token'] + '_' + config['name'];
3755
- old_cookie = this.storage.parse(old_cookie_name);
3756
-
3757
- if (old_cookie) {
3758
- this.storage.remove(old_cookie_name);
3759
- this.storage.remove(old_cookie_name, true);
3760
-
3761
- // Save the prop values that were in the cookie from before -
3762
- // this should only happen once as we delete the old one.
3763
- this.register_once(old_cookie);
3764
- }
3765
- }
3747
+ MixpanelPersistence.prototype.upgrade = function() {
3748
+ var old_cookie,
3749
+ old_localstorage;
3766
3750
 
3751
+ // if transferring from cookie to localStorage or vice-versa, copy existing
3752
+ // super properties over to new storage mode
3767
3753
  if (this.storage === _.localStorage) {
3768
3754
  old_cookie = _.cookie.parse(this.name);
3769
3755
 
@@ -3773,6 +3759,14 @@
3773
3759
  if (old_cookie) {
3774
3760
  this.register_once(old_cookie);
3775
3761
  }
3762
+ } else if (this.storage === _.cookie) {
3763
+ old_localstorage = _.localStorage.parse(this.name);
3764
+
3765
+ _.localStorage.remove(this.name);
3766
+
3767
+ if (old_localstorage) {
3768
+ this.register_once(old_localstorage);
3769
+ }
3776
3770
  }
3777
3771
  };
3778
3772
 
@@ -4087,6 +4081,8 @@
4087
4081
  return timestamp;
4088
4082
  };
4089
4083
 
4084
+ /* eslint camelcase: "off" */
4085
+
4090
4086
  /*
4091
4087
  * Mixpanel JS Library
4092
4088
  *
@@ -4133,7 +4129,7 @@
4133
4129
  */
4134
4130
  // http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
4135
4131
  // https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#withCredentials
4136
- var USE_XHR = (window$1.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest());
4132
+ var USE_XHR = (win.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest());
4137
4133
 
4138
4134
  // IE<10 does not support cross-origin XHR's but script tags
4139
4135
  // with defer won't block window.onload; ENQUEUE_REQUESTS
@@ -4152,7 +4148,8 @@
4152
4148
  var DEFAULT_API_ROUTES = {
4153
4149
  'track': 'track/',
4154
4150
  'engage': 'engage/',
4155
- 'groups': 'groups/'
4151
+ 'groups': 'groups/',
4152
+ 'record': 'record/'
4156
4153
  };
4157
4154
 
4158
4155
  /*
@@ -4179,7 +4176,7 @@
4179
4176
  'track_pageview': false,
4180
4177
  'skip_first_touch_marketing': false,
4181
4178
  'store_google': true,
4182
- 'stop_utm_persistence': false,
4179
+ 'stop_utm_persistence': true,
4183
4180
  'save_referrer': true,
4184
4181
  'test': false,
4185
4182
  'verbose': false,
@@ -4204,7 +4201,15 @@
4204
4201
  'batch_flush_interval_ms': 5000,
4205
4202
  'batch_request_timeout_ms': 90000,
4206
4203
  'batch_autostart': true,
4207
- 'hooks': {}
4204
+ 'hooks': {},
4205
+ 'record_block_class': new RegExp('^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$'),
4206
+ 'record_block_selector': 'img, video',
4207
+ 'record_idle_timeout_ms': 30 * 60 * 1000, // 30 minutes
4208
+ 'record_mask_text_class': new RegExp('^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$'),
4209
+ 'record_mask_text_selector': '*',
4210
+ 'record_max_ms': MAX_RECORDING_MS,
4211
+ 'record_sessions_percent': 0,
4212
+ 'recorder_src': 'https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js'
4208
4213
  };
4209
4214
 
4210
4215
  var DOM_LOADED = false;
@@ -4367,7 +4372,7 @@
4367
4372
  });
4368
4373
  } else {
4369
4374
  this.init_batchers();
4370
- if (sendBeacon && window$1.addEventListener) {
4375
+ if (sendBeacon && win.addEventListener) {
4371
4376
  // Before page closes or hides (user tabs away etc), attempt to flush any events
4372
4377
  // queued up via navigator.sendBeacon. Since sendBeacon doesn't report success/failure,
4373
4378
  // events will not be removed from the persistent store; if the site is loaded again,
@@ -4384,12 +4389,12 @@
4384
4389
  this.request_batchers.events.flush({unloading: true});
4385
4390
  }
4386
4391
  }, this);
4387
- window$1.addEventListener('pagehide', function(ev) {
4392
+ win.addEventListener('pagehide', function(ev) {
4388
4393
  if (ev['persisted']) {
4389
4394
  flush_on_unload();
4390
4395
  }
4391
4396
  });
4392
- window$1.addEventListener('visibilitychange', function() {
4397
+ win.addEventListener('visibilitychange', function() {
4393
4398
  if (document$1['visibilityState'] === 'hidden') {
4394
4399
  flush_on_unload();
4395
4400
  }
@@ -4417,6 +4422,52 @@
4417
4422
  if (track_pageview_option) {
4418
4423
  this._init_url_change_tracking(track_pageview_option);
4419
4424
  }
4425
+
4426
+ if (this.get_config('record_sessions_percent') > 0 && Math.random() * 100 <= this.get_config('record_sessions_percent')) {
4427
+ this.start_session_recording();
4428
+ }
4429
+ };
4430
+
4431
+ MixpanelLib.prototype.start_session_recording = addOptOutCheckMixpanelLib(function () {
4432
+ if (!win['MutationObserver']) {
4433
+ console.critical('Browser does not support MutationObserver; skipping session recording');
4434
+ return;
4435
+ }
4436
+
4437
+ var handleLoadedRecorder = _.bind(function() {
4438
+ this._recorder = this._recorder || new win['__mp_recorder'](this);
4439
+ this._recorder['startRecording']();
4440
+ }, this);
4441
+
4442
+ if (_.isUndefined(win['__mp_recorder'])) {
4443
+ var scriptEl = document$1.createElement('script');
4444
+ scriptEl.type = 'text/javascript';
4445
+ scriptEl.async = true;
4446
+ scriptEl.onload = handleLoadedRecorder;
4447
+ scriptEl.src = this.get_config('recorder_src');
4448
+ document$1.head.appendChild(scriptEl);
4449
+ } else {
4450
+ handleLoadedRecorder();
4451
+ }
4452
+ });
4453
+
4454
+ MixpanelLib.prototype.stop_session_recording = function () {
4455
+ if (this._recorder) {
4456
+ this._recorder['stopRecording']();
4457
+ } else {
4458
+ console.critical('Session recorder module not loaded');
4459
+ }
4460
+ };
4461
+
4462
+ MixpanelLib.prototype.get_session_recording_properties = function () {
4463
+ var props = {};
4464
+ if (this._recorder) {
4465
+ var replay_id = this._recorder['replayId'];
4466
+ if (replay_id) {
4467
+ props['$mp_replay_id'] = replay_id;
4468
+ }
4469
+ }
4470
+ return props;
4420
4471
  };
4421
4472
 
4422
4473
  // Private methods
@@ -4426,9 +4477,8 @@
4426
4477
  this._set_default_superprops();
4427
4478
  this['people'].set_once(this['persistence'].get_referrer_info());
4428
4479
 
4429
- // The original 'store_google' functionality will be deprecated and the config will be
4430
- // used to clear previously managed UTM parameters from persistence.
4431
- // stop_utm_persistence is `false` by default now but will be default `true` in the future.
4480
+ // `store_google` is now deprecated and previously stored UTM parameters are cleared
4481
+ // from persistence by default.
4432
4482
  if (this.get_config('store_google') && this.get_config('stop_utm_persistence')) {
4433
4483
  var utm_params = _.info.campaignParams(null);
4434
4484
  _.each(utm_params, function(_utm_value, utm_key) {
@@ -4442,6 +4492,7 @@
4442
4492
  // update persistence with info on referrer, UTM params, etc
4443
4493
  MixpanelLib.prototype._set_default_superprops = function() {
4444
4494
  this['persistence'].update_search_keyword(document$1.referrer);
4495
+ // Registering super properties for UTM persistence by 'store_google' is deprecated.
4445
4496
  if (this.get_config('store_google') && !this.get_config('stop_utm_persistence')) {
4446
4497
  this.register(_.info.campaignParams());
4447
4498
  }
@@ -4488,27 +4539,27 @@
4488
4539
  }
4489
4540
 
4490
4541
  if (_.include(['full-url', 'url-with-path-and-query-string', 'url-with-path'], track_pageview_option)) {
4491
- window$1.addEventListener('popstate', function() {
4492
- window$1.dispatchEvent(new Event('mp_locationchange'));
4542
+ win.addEventListener('popstate', function() {
4543
+ win.dispatchEvent(new Event('mp_locationchange'));
4493
4544
  });
4494
- window$1.addEventListener('hashchange', function() {
4495
- window$1.dispatchEvent(new Event('mp_locationchange'));
4545
+ win.addEventListener('hashchange', function() {
4546
+ win.dispatchEvent(new Event('mp_locationchange'));
4496
4547
  });
4497
- var nativePushState = window$1.history.pushState;
4548
+ var nativePushState = win.history.pushState;
4498
4549
  if (typeof nativePushState === 'function') {
4499
- window$1.history.pushState = function(state, unused, url) {
4500
- nativePushState.call(window$1.history, state, unused, url);
4501
- window$1.dispatchEvent(new Event('mp_locationchange'));
4550
+ win.history.pushState = function(state, unused, url) {
4551
+ nativePushState.call(win.history, state, unused, url);
4552
+ win.dispatchEvent(new Event('mp_locationchange'));
4502
4553
  };
4503
4554
  }
4504
- var nativeReplaceState = window$1.history.replaceState;
4555
+ var nativeReplaceState = win.history.replaceState;
4505
4556
  if (typeof nativeReplaceState === 'function') {
4506
- window$1.history.replaceState = function(state, unused, url) {
4507
- nativeReplaceState.call(window$1.history, state, unused, url);
4508
- window$1.dispatchEvent(new Event('mp_locationchange'));
4557
+ win.history.replaceState = function(state, unused, url) {
4558
+ nativeReplaceState.call(win.history, state, unused, url);
4559
+ win.dispatchEvent(new Event('mp_locationchange'));
4509
4560
  };
4510
4561
  }
4511
- window$1.addEventListener('mp_locationchange', function() {
4562
+ win.addEventListener('mp_locationchange', function() {
4512
4563
  var current_url = _.info.currentUrl();
4513
4564
  var should_track = false;
4514
4565
  if (track_pageview_option === 'full-url') {
@@ -5001,6 +5052,7 @@
5001
5052
  marketing_properties,
5002
5053
  this['persistence'].properties(),
5003
5054
  this.unpersisted_superprops,
5055
+ this.get_session_recording_properties(),
5004
5056
  properties
5005
5057
  );
5006
5058
 
@@ -6108,38 +6160,41 @@
6108
6160
  // EXPORTS (for closure compiler)
6109
6161
 
6110
6162
  // MixpanelLib Exports
6111
- MixpanelLib.prototype['init'] = MixpanelLib.prototype.init;
6112
- MixpanelLib.prototype['reset'] = MixpanelLib.prototype.reset;
6113
- MixpanelLib.prototype['disable'] = MixpanelLib.prototype.disable;
6114
- MixpanelLib.prototype['time_event'] = MixpanelLib.prototype.time_event;
6115
- MixpanelLib.prototype['track'] = MixpanelLib.prototype.track;
6116
- MixpanelLib.prototype['track_links'] = MixpanelLib.prototype.track_links;
6117
- MixpanelLib.prototype['track_forms'] = MixpanelLib.prototype.track_forms;
6118
- MixpanelLib.prototype['track_pageview'] = MixpanelLib.prototype.track_pageview;
6119
- MixpanelLib.prototype['register'] = MixpanelLib.prototype.register;
6120
- MixpanelLib.prototype['register_once'] = MixpanelLib.prototype.register_once;
6121
- MixpanelLib.prototype['unregister'] = MixpanelLib.prototype.unregister;
6122
- MixpanelLib.prototype['identify'] = MixpanelLib.prototype.identify;
6123
- MixpanelLib.prototype['alias'] = MixpanelLib.prototype.alias;
6124
- MixpanelLib.prototype['name_tag'] = MixpanelLib.prototype.name_tag;
6125
- MixpanelLib.prototype['set_config'] = MixpanelLib.prototype.set_config;
6126
- MixpanelLib.prototype['get_config'] = MixpanelLib.prototype.get_config;
6127
- MixpanelLib.prototype['get_property'] = MixpanelLib.prototype.get_property;
6128
- MixpanelLib.prototype['get_distinct_id'] = MixpanelLib.prototype.get_distinct_id;
6129
- MixpanelLib.prototype['toString'] = MixpanelLib.prototype.toString;
6130
- MixpanelLib.prototype['opt_out_tracking'] = MixpanelLib.prototype.opt_out_tracking;
6131
- MixpanelLib.prototype['opt_in_tracking'] = MixpanelLib.prototype.opt_in_tracking;
6132
- MixpanelLib.prototype['has_opted_out_tracking'] = MixpanelLib.prototype.has_opted_out_tracking;
6133
- MixpanelLib.prototype['has_opted_in_tracking'] = MixpanelLib.prototype.has_opted_in_tracking;
6134
- MixpanelLib.prototype['clear_opt_in_out_tracking'] = MixpanelLib.prototype.clear_opt_in_out_tracking;
6135
- MixpanelLib.prototype['get_group'] = MixpanelLib.prototype.get_group;
6136
- MixpanelLib.prototype['set_group'] = MixpanelLib.prototype.set_group;
6137
- MixpanelLib.prototype['add_group'] = MixpanelLib.prototype.add_group;
6138
- MixpanelLib.prototype['remove_group'] = MixpanelLib.prototype.remove_group;
6139
- MixpanelLib.prototype['track_with_groups'] = MixpanelLib.prototype.track_with_groups;
6140
- MixpanelLib.prototype['start_batch_senders'] = MixpanelLib.prototype.start_batch_senders;
6141
- MixpanelLib.prototype['stop_batch_senders'] = MixpanelLib.prototype.stop_batch_senders;
6142
- MixpanelLib.prototype['DEFAULT_API_ROUTES'] = DEFAULT_API_ROUTES;
6163
+ MixpanelLib.prototype['init'] = MixpanelLib.prototype.init;
6164
+ MixpanelLib.prototype['reset'] = MixpanelLib.prototype.reset;
6165
+ MixpanelLib.prototype['disable'] = MixpanelLib.prototype.disable;
6166
+ MixpanelLib.prototype['time_event'] = MixpanelLib.prototype.time_event;
6167
+ MixpanelLib.prototype['track'] = MixpanelLib.prototype.track;
6168
+ MixpanelLib.prototype['track_links'] = MixpanelLib.prototype.track_links;
6169
+ MixpanelLib.prototype['track_forms'] = MixpanelLib.prototype.track_forms;
6170
+ MixpanelLib.prototype['track_pageview'] = MixpanelLib.prototype.track_pageview;
6171
+ MixpanelLib.prototype['register'] = MixpanelLib.prototype.register;
6172
+ MixpanelLib.prototype['register_once'] = MixpanelLib.prototype.register_once;
6173
+ MixpanelLib.prototype['unregister'] = MixpanelLib.prototype.unregister;
6174
+ MixpanelLib.prototype['identify'] = MixpanelLib.prototype.identify;
6175
+ MixpanelLib.prototype['alias'] = MixpanelLib.prototype.alias;
6176
+ MixpanelLib.prototype['name_tag'] = MixpanelLib.prototype.name_tag;
6177
+ MixpanelLib.prototype['set_config'] = MixpanelLib.prototype.set_config;
6178
+ MixpanelLib.prototype['get_config'] = MixpanelLib.prototype.get_config;
6179
+ MixpanelLib.prototype['get_property'] = MixpanelLib.prototype.get_property;
6180
+ MixpanelLib.prototype['get_distinct_id'] = MixpanelLib.prototype.get_distinct_id;
6181
+ MixpanelLib.prototype['toString'] = MixpanelLib.prototype.toString;
6182
+ MixpanelLib.prototype['opt_out_tracking'] = MixpanelLib.prototype.opt_out_tracking;
6183
+ MixpanelLib.prototype['opt_in_tracking'] = MixpanelLib.prototype.opt_in_tracking;
6184
+ MixpanelLib.prototype['has_opted_out_tracking'] = MixpanelLib.prototype.has_opted_out_tracking;
6185
+ MixpanelLib.prototype['has_opted_in_tracking'] = MixpanelLib.prototype.has_opted_in_tracking;
6186
+ MixpanelLib.prototype['clear_opt_in_out_tracking'] = MixpanelLib.prototype.clear_opt_in_out_tracking;
6187
+ MixpanelLib.prototype['get_group'] = MixpanelLib.prototype.get_group;
6188
+ MixpanelLib.prototype['set_group'] = MixpanelLib.prototype.set_group;
6189
+ MixpanelLib.prototype['add_group'] = MixpanelLib.prototype.add_group;
6190
+ MixpanelLib.prototype['remove_group'] = MixpanelLib.prototype.remove_group;
6191
+ MixpanelLib.prototype['track_with_groups'] = MixpanelLib.prototype.track_with_groups;
6192
+ MixpanelLib.prototype['start_batch_senders'] = MixpanelLib.prototype.start_batch_senders;
6193
+ MixpanelLib.prototype['stop_batch_senders'] = MixpanelLib.prototype.stop_batch_senders;
6194
+ MixpanelLib.prototype['start_session_recording'] = MixpanelLib.prototype.start_session_recording;
6195
+ MixpanelLib.prototype['stop_session_recording'] = MixpanelLib.prototype.stop_session_recording;
6196
+ MixpanelLib.prototype['get_session_recording_properties'] = MixpanelLib.prototype.get_session_recording_properties;
6197
+ MixpanelLib.prototype['DEFAULT_API_ROUTES'] = DEFAULT_API_ROUTES;
6143
6198
 
6144
6199
  // MixpanelPersistence Exports
6145
6200
  MixpanelPersistence.prototype['properties'] = MixpanelPersistence.prototype.properties;
@@ -6186,7 +6241,7 @@
6186
6241
 
6187
6242
  mixpanel_master = instance;
6188
6243
  if (init_type === INIT_SNIPPET) {
6189
- window$1[PRIMARY_INSTANCE_NAME] = mixpanel_master;
6244
+ win[PRIMARY_INSTANCE_NAME] = mixpanel_master;
6190
6245
  }
6191
6246
  extend_mp();
6192
6247
  }
@@ -6236,7 +6291,7 @@
6236
6291
  // check to make sure we arn't in a frame
6237
6292
  var toplevel = false;
6238
6293
  try {
6239
- toplevel = window$1.frameElement === null;
6294
+ toplevel = win.frameElement === null;
6240
6295
  } catch(e) {
6241
6296
  // noop
6242
6297
  }
@@ -6247,7 +6302,7 @@
6247
6302
  }
6248
6303
 
6249
6304
  // fallback handler, always will work
6250
- _.register_event(window$1, 'load', dom_loaded_handler, true);
6305
+ _.register_event(win, 'load', dom_loaded_handler, true);
6251
6306
  };
6252
6307
 
6253
6308
  function init_as_module() {
@@ -6261,8 +6316,10 @@
6261
6316
  return mixpanel_master;
6262
6317
  }
6263
6318
 
6319
+ /* eslint camelcase: "off" */
6320
+
6264
6321
  var mixpanel = init_as_module();
6265
6322
 
6266
6323
  return mixpanel;
6267
6324
 
6268
- }));
6325
+ }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixpanel-browser",
3
- "version": "2.49.0",
3
+ "version": "2.51.0",
4
4
  "description": "The official Mixpanel JavaScript browser client library",
5
5
  "main": "dist/mixpanel.cjs.js",
6
6
  "directories": {
@@ -32,6 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/mixpanel/mixpanel-js",
34
34
  "devDependencies": {
35
+ "@rollup/plugin-node-resolve": "15.2.3",
35
36
  "babel": "6.5.2",
36
37
  "babel-core": "6.7.2",
37
38
  "babel-preset-es2015": "6.6.0",
@@ -51,10 +52,14 @@
51
52
  "morgan": "1.9.1",
52
53
  "rdme": "7.5.0",
53
54
  "request": "2.88.0",
54
- "rollup": "0.25.8",
55
+ "rollup": "2.79.1",
56
+ "rollup-plugin-esbuild": "4.10.3",
55
57
  "rollup-plugin-npm": "1.4.0",
56
58
  "sinon": "8.1.1",
57
59
  "sinon-chai": "3.5.0",
58
60
  "webpack": "1.12.2"
61
+ },
62
+ "dependencies": {
63
+ "rrweb": "2.0.0-alpha.13"
59
64
  }
60
65
  }
package/src/config.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var Config = {
2
2
  DEBUG: false,
3
- LIB_VERSION: '2.49.0'
3
+ LIB_VERSION: '2.51.0'
4
4
  };
5
5
 
6
6
  export default Config;