mixpanel-browser 2.79.0 → 2.80.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.
Files changed (31) hide show
  1. package/.github/workflows/integration-tests.yml +1 -0
  2. package/CHANGELOG.md +6 -0
  3. package/dist/async-modules/{mixpanel-recorder-D5HJyV2E.min.js → mixpanel-recorder-B61POiHc.min.js} +2 -2
  4. package/dist/async-modules/{mixpanel-recorder-D5HJyV2E.min.js.map → mixpanel-recorder-B61POiHc.min.js.map} +1 -1
  5. package/dist/async-modules/{mixpanel-recorder-P6SEnnPV.js → mixpanel-recorder-C3AW7mPl.js} +7 -3
  6. package/dist/async-modules/{mixpanel-targeting-BBMVbgJF.js → mixpanel-targeting-CBwOQJZw.js} +1 -1
  7. package/dist/async-modules/{mixpanel-targeting-1L9FyetZ.min.js → mixpanel-targeting-kdl-eE-1.min.js} +2 -2
  8. package/dist/async-modules/{mixpanel-targeting-1L9FyetZ.min.js.map → mixpanel-targeting-kdl-eE-1.min.js.map} +1 -1
  9. package/dist/mixpanel-core.cjs.js +13 -13
  10. package/dist/mixpanel-recorder.js +7 -3
  11. package/dist/mixpanel-recorder.min.js +1 -1
  12. package/dist/mixpanel-recorder.min.js.map +1 -1
  13. package/dist/mixpanel-targeting.js +1 -1
  14. package/dist/mixpanel-targeting.min.js +1 -1
  15. package/dist/mixpanel-targeting.min.js.map +1 -1
  16. package/dist/mixpanel-with-async-modules.cjs.js +15 -15
  17. package/dist/mixpanel-with-async-recorder.cjs.js +15 -15
  18. package/dist/mixpanel-with-recorder.js +19 -15
  19. package/dist/mixpanel-with-recorder.min.js +1 -1
  20. package/dist/mixpanel.amd.js +19 -15
  21. package/dist/mixpanel.cjs.js +19 -15
  22. package/dist/mixpanel.globals.js +15 -15
  23. package/dist/mixpanel.min.js +104 -104
  24. package/dist/mixpanel.module.js +19 -15
  25. package/dist/mixpanel.umd.js +19 -15
  26. package/package.json +1 -1
  27. package/src/autocapture/index.js +10 -10
  28. package/src/config.js +1 -1
  29. package/src/flags/index.js +2 -2
  30. package/src/recorder/session-recording.js +6 -2
  31. package/.claude/settings.local.json +0 -11
@@ -27,7 +27,7 @@ define((function () { 'use strict';
27
27
 
28
28
  var Config = {
29
29
  DEBUG: false,
30
- LIB_VERSION: '2.79.0'
30
+ LIB_VERSION: '2.80.0'
31
31
  };
32
32
 
33
33
  // Window global names for async modules
@@ -23896,6 +23896,7 @@ define((function () { 'use strict';
23896
23896
 
23897
23897
  this.recordMaxMs = MAX_RECORDING_MS;
23898
23898
  this.recordMinMs = 0;
23899
+ this._recordMinMsCheckStart = null;
23899
23900
 
23900
23901
  // disable persistence if localStorage is not supported
23901
23902
  // request-queue will automatically disable persistence if indexedDB fails to initialize
@@ -24011,6 +24012,7 @@ define((function () { 'use strict';
24011
24012
  // this also applies if the minimum recording length has not been hit yet
24012
24013
  // so that we don't send data until we know the recording will be long enough
24013
24014
  this.batcher.stop();
24015
+ this._recordMinMsCheckStart = null;
24014
24016
  } else {
24015
24017
  this.batcher.start();
24016
24018
  }
@@ -24062,9 +24064,11 @@ define((function () { 'use strict';
24062
24064
  this._onIdleTimeout();
24063
24065
  return;
24064
24066
  }
24067
+ if (this._recordMinMsCheckStart === null) {
24068
+ this._recordMinMsCheckStart = ev.timestamp;
24069
+ }
24065
24070
  if (isUserEvent(ev)) {
24066
- if (this.batcher.stopped && new Date().getTime() - this.replayStartTime >= this.recordMinMs) {
24067
- // start flushing again after user activity
24071
+ if (this.batcher.stopped && ev.timestamp - this._recordMinMsCheckStart >= this.recordMinMs) {
24068
24072
  this.batcher.start();
24069
24073
  }
24070
24074
  resetIdleTimeout();
@@ -25852,7 +25856,7 @@ define((function () { 'use strict';
25852
25856
  };
25853
25857
 
25854
25858
  Autocapture.prototype.initClickTracking = function() {
25855
- win.removeEventListener(EV_CLICK, this.listenerClick);
25859
+ win.removeEventListener(EV_CLICK, this.listenerClick, true);
25856
25860
 
25857
25861
  if (!this.getConfig(CONFIG_TRACK_CLICK) && !this.mp.get_config('record_heatmap_data')) {
25858
25862
  return;
@@ -25865,7 +25869,7 @@ define((function () { 'use strict';
25865
25869
  }
25866
25870
  this.trackDomEvent(ev, MP_EV_CLICK);
25867
25871
  }.bind(this);
25868
- win.addEventListener(EV_CLICK, this.listenerClick);
25872
+ win.addEventListener(EV_CLICK, this.listenerClick, true);
25869
25873
  };
25870
25874
 
25871
25875
  Autocapture.prototype.initDeadClickTracking = function() {
@@ -25900,12 +25904,12 @@ define((function () { 'use strict';
25900
25904
  }
25901
25905
  this._deadClickTracker.trackClick(ev, normalizedConfig);
25902
25906
  }.bind(this);
25903
- win.addEventListener(EV_CLICK, this.listenerDeadClick);
25907
+ win.addEventListener(EV_CLICK, this.listenerDeadClick, true);
25904
25908
  }
25905
25909
  };
25906
25910
 
25907
25911
  Autocapture.prototype.initInputTracking = function() {
25908
- win.removeEventListener(EV_CHANGE, this.listenerChange);
25912
+ win.removeEventListener(EV_CHANGE, this.listenerChange, true);
25909
25913
 
25910
25914
  if (!this.getConfig(CONFIG_TRACK_INPUT)) {
25911
25915
  return;
@@ -25918,7 +25922,7 @@ define((function () { 'use strict';
25918
25922
  }
25919
25923
  this.trackDomEvent(ev, MP_EV_INPUT);
25920
25924
  }.bind(this);
25921
- win.addEventListener(EV_CHANGE, this.listenerChange);
25925
+ win.addEventListener(EV_CHANGE, this.listenerChange, true);
25922
25926
  };
25923
25927
 
25924
25928
  Autocapture.prototype.initPageviewTracking = function() {
@@ -25975,7 +25979,7 @@ define((function () { 'use strict';
25975
25979
  };
25976
25980
 
25977
25981
  Autocapture.prototype.initRageClickTracking = function() {
25978
- win.removeEventListener(EV_CLICK, this.listenerRageClick);
25982
+ win.removeEventListener(EV_CLICK, this.listenerRageClick, true);
25979
25983
 
25980
25984
  var rageClickConfig = this._getClickTrackingConfig(CONFIG_TRACK_RAGE_CLICK);
25981
25985
  if (!rageClickConfig && !this.mp.get_config('record_heatmap_data')) {
@@ -26001,7 +26005,7 @@ define((function () { 'use strict';
26001
26005
  this.trackDomEvent(ev, MP_EV_RAGE_CLICK);
26002
26006
  }
26003
26007
  }.bind(this);
26004
- win.addEventListener(EV_CLICK, this.listenerRageClick);
26008
+ win.addEventListener(EV_CLICK, this.listenerRageClick, true);
26005
26009
  };
26006
26010
 
26007
26011
  Autocapture.prototype.initScrollTracking = function() {
@@ -26062,7 +26066,7 @@ define((function () { 'use strict';
26062
26066
  };
26063
26067
 
26064
26068
  Autocapture.prototype.initSubmitTracking = function() {
26065
- win.removeEventListener(EV_SUBMIT, this.listenerSubmit);
26069
+ win.removeEventListener(EV_SUBMIT, this.listenerSubmit, true);
26066
26070
 
26067
26071
  if (!this.getConfig(CONFIG_TRACK_SUBMIT)) {
26068
26072
  return;
@@ -26075,7 +26079,7 @@ define((function () { 'use strict';
26075
26079
  }
26076
26080
  this.trackDomEvent(ev, MP_EV_SUBMIT);
26077
26081
  }.bind(this);
26078
- win.addEventListener(EV_SUBMIT, this.listenerSubmit);
26082
+ win.addEventListener(EV_SUBMIT, this.listenerSubmit, true);
26079
26083
  };
26080
26084
 
26081
26085
  Autocapture.prototype.initPageLeaveTracking = function() {
@@ -26131,7 +26135,7 @@ define((function () { 'use strict';
26131
26135
 
26132
26136
  Autocapture.prototype.stopDeadClickTracking = function() {
26133
26137
  if (this.listenerDeadClick) {
26134
- win.removeEventListener(EV_CLICK, this.listenerDeadClick);
26138
+ win.removeEventListener(EV_CLICK, this.listenerDeadClick, true);
26135
26139
  this.listenerDeadClick = null;
26136
26140
  }
26137
26141
 
@@ -26792,8 +26796,8 @@ define((function () { 'use strict';
26792
26796
  };
26793
26797
 
26794
26798
  FeatureFlagManager.prototype.getFirstTimeEventApiRoute = function(flagId) {
26795
- // Construct URL: {api_host}/flags/{flagId}/first-time-events
26796
- return this.getFullApiRoute() + '/' + flagId + '/first-time-events';
26799
+ var base = this.getFullApiRoute().replace(/\/$/, '');
26800
+ return base + '/' + flagId + '/first-time-events';
26797
26801
  };
26798
26802
 
26799
26803
  FeatureFlagManager.prototype.recordFirstTimeEvent = function(flagId, projectId, firstTimeEventHash) {
@@ -27,7 +27,7 @@ if (typeof(window) === 'undefined') {
27
27
 
28
28
  var Config = {
29
29
  DEBUG: false,
30
- LIB_VERSION: '2.79.0'
30
+ LIB_VERSION: '2.80.0'
31
31
  };
32
32
 
33
33
  // Window global names for async modules
@@ -23896,6 +23896,7 @@ var SessionRecording = function(options) {
23896
23896
 
23897
23897
  this.recordMaxMs = MAX_RECORDING_MS;
23898
23898
  this.recordMinMs = 0;
23899
+ this._recordMinMsCheckStart = null;
23899
23900
 
23900
23901
  // disable persistence if localStorage is not supported
23901
23902
  // request-queue will automatically disable persistence if indexedDB fails to initialize
@@ -24011,6 +24012,7 @@ SessionRecording.prototype.startRecording = function (shouldStopBatcher) {
24011
24012
  // this also applies if the minimum recording length has not been hit yet
24012
24013
  // so that we don't send data until we know the recording will be long enough
24013
24014
  this.batcher.stop();
24015
+ this._recordMinMsCheckStart = null;
24014
24016
  } else {
24015
24017
  this.batcher.start();
24016
24018
  }
@@ -24062,9 +24064,11 @@ SessionRecording.prototype.startRecording = function (shouldStopBatcher) {
24062
24064
  this._onIdleTimeout();
24063
24065
  return;
24064
24066
  }
24067
+ if (this._recordMinMsCheckStart === null) {
24068
+ this._recordMinMsCheckStart = ev.timestamp;
24069
+ }
24065
24070
  if (isUserEvent(ev)) {
24066
- if (this.batcher.stopped && new Date().getTime() - this.replayStartTime >= this.recordMinMs) {
24067
- // start flushing again after user activity
24071
+ if (this.batcher.stopped && ev.timestamp - this._recordMinMsCheckStart >= this.recordMinMs) {
24068
24072
  this.batcher.start();
24069
24073
  }
24070
24074
  resetIdleTimeout();
@@ -25852,7 +25856,7 @@ Autocapture.prototype._initScrollDepthTracking = function() {
25852
25856
  };
25853
25857
 
25854
25858
  Autocapture.prototype.initClickTracking = function() {
25855
- win.removeEventListener(EV_CLICK, this.listenerClick);
25859
+ win.removeEventListener(EV_CLICK, this.listenerClick, true);
25856
25860
 
25857
25861
  if (!this.getConfig(CONFIG_TRACK_CLICK) && !this.mp.get_config('record_heatmap_data')) {
25858
25862
  return;
@@ -25865,7 +25869,7 @@ Autocapture.prototype.initClickTracking = function() {
25865
25869
  }
25866
25870
  this.trackDomEvent(ev, MP_EV_CLICK);
25867
25871
  }.bind(this);
25868
- win.addEventListener(EV_CLICK, this.listenerClick);
25872
+ win.addEventListener(EV_CLICK, this.listenerClick, true);
25869
25873
  };
25870
25874
 
25871
25875
  Autocapture.prototype.initDeadClickTracking = function() {
@@ -25900,12 +25904,12 @@ Autocapture.prototype.initDeadClickTracking = function() {
25900
25904
  }
25901
25905
  this._deadClickTracker.trackClick(ev, normalizedConfig);
25902
25906
  }.bind(this);
25903
- win.addEventListener(EV_CLICK, this.listenerDeadClick);
25907
+ win.addEventListener(EV_CLICK, this.listenerDeadClick, true);
25904
25908
  }
25905
25909
  };
25906
25910
 
25907
25911
  Autocapture.prototype.initInputTracking = function() {
25908
- win.removeEventListener(EV_CHANGE, this.listenerChange);
25912
+ win.removeEventListener(EV_CHANGE, this.listenerChange, true);
25909
25913
 
25910
25914
  if (!this.getConfig(CONFIG_TRACK_INPUT)) {
25911
25915
  return;
@@ -25918,7 +25922,7 @@ Autocapture.prototype.initInputTracking = function() {
25918
25922
  }
25919
25923
  this.trackDomEvent(ev, MP_EV_INPUT);
25920
25924
  }.bind(this);
25921
- win.addEventListener(EV_CHANGE, this.listenerChange);
25925
+ win.addEventListener(EV_CHANGE, this.listenerChange, true);
25922
25926
  };
25923
25927
 
25924
25928
  Autocapture.prototype.initPageviewTracking = function() {
@@ -25975,7 +25979,7 @@ Autocapture.prototype.initPageviewTracking = function() {
25975
25979
  };
25976
25980
 
25977
25981
  Autocapture.prototype.initRageClickTracking = function() {
25978
- win.removeEventListener(EV_CLICK, this.listenerRageClick);
25982
+ win.removeEventListener(EV_CLICK, this.listenerRageClick, true);
25979
25983
 
25980
25984
  var rageClickConfig = this._getClickTrackingConfig(CONFIG_TRACK_RAGE_CLICK);
25981
25985
  if (!rageClickConfig && !this.mp.get_config('record_heatmap_data')) {
@@ -26001,7 +26005,7 @@ Autocapture.prototype.initRageClickTracking = function() {
26001
26005
  this.trackDomEvent(ev, MP_EV_RAGE_CLICK);
26002
26006
  }
26003
26007
  }.bind(this);
26004
- win.addEventListener(EV_CLICK, this.listenerRageClick);
26008
+ win.addEventListener(EV_CLICK, this.listenerRageClick, true);
26005
26009
  };
26006
26010
 
26007
26011
  Autocapture.prototype.initScrollTracking = function() {
@@ -26062,7 +26066,7 @@ Autocapture.prototype.initScrollTracking = function() {
26062
26066
  };
26063
26067
 
26064
26068
  Autocapture.prototype.initSubmitTracking = function() {
26065
- win.removeEventListener(EV_SUBMIT, this.listenerSubmit);
26069
+ win.removeEventListener(EV_SUBMIT, this.listenerSubmit, true);
26066
26070
 
26067
26071
  if (!this.getConfig(CONFIG_TRACK_SUBMIT)) {
26068
26072
  return;
@@ -26075,7 +26079,7 @@ Autocapture.prototype.initSubmitTracking = function() {
26075
26079
  }
26076
26080
  this.trackDomEvent(ev, MP_EV_SUBMIT);
26077
26081
  }.bind(this);
26078
- win.addEventListener(EV_SUBMIT, this.listenerSubmit);
26082
+ win.addEventListener(EV_SUBMIT, this.listenerSubmit, true);
26079
26083
  };
26080
26084
 
26081
26085
  Autocapture.prototype.initPageLeaveTracking = function() {
@@ -26131,7 +26135,7 @@ Autocapture.prototype.initPageLeaveTracking = function() {
26131
26135
 
26132
26136
  Autocapture.prototype.stopDeadClickTracking = function() {
26133
26137
  if (this.listenerDeadClick) {
26134
- win.removeEventListener(EV_CLICK, this.listenerDeadClick);
26138
+ win.removeEventListener(EV_CLICK, this.listenerDeadClick, true);
26135
26139
  this.listenerDeadClick = null;
26136
26140
  }
26137
26141
 
@@ -26792,8 +26796,8 @@ FeatureFlagManager.prototype._processFirstTimeEventCheck = function(eventName, p
26792
26796
  };
26793
26797
 
26794
26798
  FeatureFlagManager.prototype.getFirstTimeEventApiRoute = function(flagId) {
26795
- // Construct URL: {api_host}/flags/{flagId}/first-time-events
26796
- return this.getFullApiRoute() + '/' + flagId + '/first-time-events';
26799
+ var base = this.getFullApiRoute().replace(/\/$/, '');
26800
+ return base + '/' + flagId + '/first-time-events';
26797
26801
  };
26798
26802
 
26799
26803
  FeatureFlagManager.prototype.recordFirstTimeEvent = function(flagId, projectId, firstTimeEventHash) {
@@ -3,7 +3,7 @@
3
3
 
4
4
  var Config = {
5
5
  DEBUG: false,
6
- LIB_VERSION: '2.79.0'
6
+ LIB_VERSION: '2.80.0'
7
7
  };
8
8
 
9
9
  // Window global names for async modules
@@ -11,8 +11,8 @@
11
11
  var RECORDER_GLOBAL_NAME = '__mp_recorder';
12
12
 
13
13
  // Constants that are injected at build-time for the names of async modules.
14
- var RECORDER_FILENAME = 'mixpanel-recorder-P6SEnnPV.js';
15
- var TARGETING_FILENAME = 'mixpanel-targeting-BBMVbgJF.js';
14
+ var RECORDER_FILENAME = 'mixpanel-recorder-C3AW7mPl.js';
15
+ var TARGETING_FILENAME = 'mixpanel-targeting-CBwOQJZw.js';
16
16
 
17
17
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
18
18
  var win;
@@ -3619,7 +3619,7 @@
3619
3619
  };
3620
3620
 
3621
3621
  Autocapture.prototype.initClickTracking = function() {
3622
- win.removeEventListener(EV_CLICK, this.listenerClick);
3622
+ win.removeEventListener(EV_CLICK, this.listenerClick, true);
3623
3623
 
3624
3624
  if (!this.getConfig(CONFIG_TRACK_CLICK) && !this.mp.get_config('record_heatmap_data')) {
3625
3625
  return;
@@ -3632,7 +3632,7 @@
3632
3632
  }
3633
3633
  this.trackDomEvent(ev, MP_EV_CLICK);
3634
3634
  }.bind(this);
3635
- win.addEventListener(EV_CLICK, this.listenerClick);
3635
+ win.addEventListener(EV_CLICK, this.listenerClick, true);
3636
3636
  };
3637
3637
 
3638
3638
  Autocapture.prototype.initDeadClickTracking = function() {
@@ -3667,12 +3667,12 @@
3667
3667
  }
3668
3668
  this._deadClickTracker.trackClick(ev, normalizedConfig);
3669
3669
  }.bind(this);
3670
- win.addEventListener(EV_CLICK, this.listenerDeadClick);
3670
+ win.addEventListener(EV_CLICK, this.listenerDeadClick, true);
3671
3671
  }
3672
3672
  };
3673
3673
 
3674
3674
  Autocapture.prototype.initInputTracking = function() {
3675
- win.removeEventListener(EV_CHANGE, this.listenerChange);
3675
+ win.removeEventListener(EV_CHANGE, this.listenerChange, true);
3676
3676
 
3677
3677
  if (!this.getConfig(CONFIG_TRACK_INPUT)) {
3678
3678
  return;
@@ -3685,7 +3685,7 @@
3685
3685
  }
3686
3686
  this.trackDomEvent(ev, MP_EV_INPUT);
3687
3687
  }.bind(this);
3688
- win.addEventListener(EV_CHANGE, this.listenerChange);
3688
+ win.addEventListener(EV_CHANGE, this.listenerChange, true);
3689
3689
  };
3690
3690
 
3691
3691
  Autocapture.prototype.initPageviewTracking = function() {
@@ -3742,7 +3742,7 @@
3742
3742
  };
3743
3743
 
3744
3744
  Autocapture.prototype.initRageClickTracking = function() {
3745
- win.removeEventListener(EV_CLICK, this.listenerRageClick);
3745
+ win.removeEventListener(EV_CLICK, this.listenerRageClick, true);
3746
3746
 
3747
3747
  var rageClickConfig = this._getClickTrackingConfig(CONFIG_TRACK_RAGE_CLICK);
3748
3748
  if (!rageClickConfig && !this.mp.get_config('record_heatmap_data')) {
@@ -3768,7 +3768,7 @@
3768
3768
  this.trackDomEvent(ev, MP_EV_RAGE_CLICK);
3769
3769
  }
3770
3770
  }.bind(this);
3771
- win.addEventListener(EV_CLICK, this.listenerRageClick);
3771
+ win.addEventListener(EV_CLICK, this.listenerRageClick, true);
3772
3772
  };
3773
3773
 
3774
3774
  Autocapture.prototype.initScrollTracking = function() {
@@ -3829,7 +3829,7 @@
3829
3829
  };
3830
3830
 
3831
3831
  Autocapture.prototype.initSubmitTracking = function() {
3832
- win.removeEventListener(EV_SUBMIT, this.listenerSubmit);
3832
+ win.removeEventListener(EV_SUBMIT, this.listenerSubmit, true);
3833
3833
 
3834
3834
  if (!this.getConfig(CONFIG_TRACK_SUBMIT)) {
3835
3835
  return;
@@ -3842,7 +3842,7 @@
3842
3842
  }
3843
3843
  this.trackDomEvent(ev, MP_EV_SUBMIT);
3844
3844
  }.bind(this);
3845
- win.addEventListener(EV_SUBMIT, this.listenerSubmit);
3845
+ win.addEventListener(EV_SUBMIT, this.listenerSubmit, true);
3846
3846
  };
3847
3847
 
3848
3848
  Autocapture.prototype.initPageLeaveTracking = function() {
@@ -3898,7 +3898,7 @@
3898
3898
 
3899
3899
  Autocapture.prototype.stopDeadClickTracking = function() {
3900
3900
  if (this.listenerDeadClick) {
3901
- win.removeEventListener(EV_CLICK, this.listenerDeadClick);
3901
+ win.removeEventListener(EV_CLICK, this.listenerDeadClick, true);
3902
3902
  this.listenerDeadClick = null;
3903
3903
  }
3904
3904
 
@@ -4685,8 +4685,8 @@
4685
4685
  };
4686
4686
 
4687
4687
  FeatureFlagManager.prototype.getFirstTimeEventApiRoute = function(flagId) {
4688
- // Construct URL: {api_host}/flags/{flagId}/first-time-events
4689
- return this.getFullApiRoute() + '/' + flagId + '/first-time-events';
4688
+ var base = this.getFullApiRoute().replace(/\/$/, '');
4689
+ return base + '/' + flagId + '/first-time-events';
4690
4690
  };
4691
4691
 
4692
4692
  FeatureFlagManager.prototype.recordFirstTimeEvent = function(flagId, projectId, firstTimeEventHash) {