mixpanel-browser 2.54.0 → 2.55.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 +6 -0
- package/README.md +19 -28
- package/build.sh +1 -0
- package/dist/mixpanel-core.cjs.js +6 -2
- package/dist/mixpanel-recorder.js +29 -7
- package/dist/mixpanel-recorder.min.js +2 -2
- package/dist/mixpanel-with-async-recorder.cjs.js +6 -2
- package/dist/mixpanel.amd.js +29 -7
- package/dist/mixpanel.cjs.js +29 -7
- package/dist/mixpanel.globals.js +6 -2
- package/dist/mixpanel.min.js +56 -56
- package/dist/mixpanel.module.js +11131 -0
- package/dist/mixpanel.umd.js +29 -7
- package/package.json +2 -1
- package/src/config.js +1 -1
- package/src/recorder/index.js +23 -5
- package/src/request-batcher.js +5 -1
package/dist/mixpanel.umd.js
CHANGED
|
@@ -4513,7 +4513,7 @@
|
|
|
4513
4513
|
|
|
4514
4514
|
var Config = {
|
|
4515
4515
|
DEBUG: false,
|
|
4516
|
-
LIB_VERSION: '2.
|
|
4516
|
+
LIB_VERSION: '2.55.0'
|
|
4517
4517
|
};
|
|
4518
4518
|
|
|
4519
4519
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -7081,7 +7081,11 @@
|
|
|
7081
7081
|
RequestBatcher.prototype.scheduleFlush = function(flushMS) {
|
|
7082
7082
|
this.flushInterval = flushMS;
|
|
7083
7083
|
if (!this.stopped) { // don't schedule anymore if batching has been stopped
|
|
7084
|
-
this.timeoutID = setTimeout(_.bind(
|
|
7084
|
+
this.timeoutID = setTimeout(_.bind(function() {
|
|
7085
|
+
if (!this.stopped) {
|
|
7086
|
+
this.flush();
|
|
7087
|
+
}
|
|
7088
|
+
}, this), this.flushInterval);
|
|
7085
7089
|
}
|
|
7086
7090
|
};
|
|
7087
7091
|
|
|
@@ -7310,7 +7314,7 @@
|
|
|
7310
7314
|
]);
|
|
7311
7315
|
|
|
7312
7316
|
function isUserEvent(ev) {
|
|
7313
|
-
return ev.type === EventType.IncrementalSnapshot && ACTIVE_SOURCES.has(ev.source);
|
|
7317
|
+
return ev.type === EventType.IncrementalSnapshot && ACTIVE_SOURCES.has(ev.data.source);
|
|
7314
7318
|
}
|
|
7315
7319
|
|
|
7316
7320
|
var MixpanelRecorder = function(mixpanelInstance) {
|
|
@@ -7348,7 +7352,7 @@
|
|
|
7348
7352
|
return this._mixpanel.get_config(configVar);
|
|
7349
7353
|
};
|
|
7350
7354
|
|
|
7351
|
-
MixpanelRecorder.prototype.startRecording = function () {
|
|
7355
|
+
MixpanelRecorder.prototype.startRecording = function (shouldStopBatcher) {
|
|
7352
7356
|
if (this._stopRecording !== null) {
|
|
7353
7357
|
logger.log('Recording already in progress, skipping startRecording.');
|
|
7354
7358
|
return;
|
|
@@ -7366,7 +7370,14 @@
|
|
|
7366
7370
|
|
|
7367
7371
|
this.replayId = _.UUID();
|
|
7368
7372
|
|
|
7369
|
-
|
|
7373
|
+
if (shouldStopBatcher) {
|
|
7374
|
+
// this is the case when we're starting recording after a reset
|
|
7375
|
+
// and don't want to send anything over the network until there's
|
|
7376
|
+
// actual user activity
|
|
7377
|
+
this.batcher.stop();
|
|
7378
|
+
} else {
|
|
7379
|
+
this.batcher.start();
|
|
7380
|
+
}
|
|
7370
7381
|
|
|
7371
7382
|
var resetIdleTimeout = _.bind(function () {
|
|
7372
7383
|
clearTimeout(this.idleTimeoutId);
|
|
@@ -7380,6 +7391,10 @@
|
|
|
7380
7391
|
'emit': _.bind(function (ev) {
|
|
7381
7392
|
this.batcher.enqueue(ev);
|
|
7382
7393
|
if (isUserEvent(ev)) {
|
|
7394
|
+
if (this.batcher.stopped) {
|
|
7395
|
+
// start flushing again after user activity
|
|
7396
|
+
this.batcher.start();
|
|
7397
|
+
}
|
|
7383
7398
|
resetIdleTimeout();
|
|
7384
7399
|
}
|
|
7385
7400
|
}, this),
|
|
@@ -7399,7 +7414,7 @@
|
|
|
7399
7414
|
|
|
7400
7415
|
MixpanelRecorder.prototype.resetRecording = function () {
|
|
7401
7416
|
this.stopRecording();
|
|
7402
|
-
this.startRecording();
|
|
7417
|
+
this.startRecording(true);
|
|
7403
7418
|
};
|
|
7404
7419
|
|
|
7405
7420
|
MixpanelRecorder.prototype.stopRecording = function () {
|
|
@@ -7408,7 +7423,14 @@
|
|
|
7408
7423
|
this._stopRecording = null;
|
|
7409
7424
|
}
|
|
7410
7425
|
|
|
7411
|
-
this.batcher.
|
|
7426
|
+
if (this.batcher.stopped) {
|
|
7427
|
+
// never got user activity to flush after reset, so just clear the batcher
|
|
7428
|
+
this.batcher.clear();
|
|
7429
|
+
} else {
|
|
7430
|
+
// flush any remaining events from running batcher
|
|
7431
|
+
this.batcher.flush();
|
|
7432
|
+
this.batcher.stop();
|
|
7433
|
+
}
|
|
7412
7434
|
this.replayId = null;
|
|
7413
7435
|
|
|
7414
7436
|
clearTimeout(this.idleTimeoutId);
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mixpanel-browser",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.55.0",
|
|
4
4
|
"description": "The official Mixpanel JavaScript browser client library",
|
|
5
5
|
"main": "dist/mixpanel.cjs.js",
|
|
6
|
+
"module": "dist/mixpanel.module.js",
|
|
6
7
|
"directories": {
|
|
7
8
|
"test": "tests"
|
|
8
9
|
},
|
package/src/config.js
CHANGED
package/src/recorder/index.js
CHANGED
|
@@ -28,7 +28,7 @@ var ACTIVE_SOURCES = new Set([
|
|
|
28
28
|
]);
|
|
29
29
|
|
|
30
30
|
function isUserEvent(ev) {
|
|
31
|
-
return ev.type === EventType.IncrementalSnapshot && ACTIVE_SOURCES.has(ev.source);
|
|
31
|
+
return ev.type === EventType.IncrementalSnapshot && ACTIVE_SOURCES.has(ev.data.source);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
var MixpanelRecorder = function(mixpanelInstance) {
|
|
@@ -66,7 +66,7 @@ MixpanelRecorder.prototype.get_config = function(configVar) {
|
|
|
66
66
|
return this._mixpanel.get_config(configVar);
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
MixpanelRecorder.prototype.startRecording = function () {
|
|
69
|
+
MixpanelRecorder.prototype.startRecording = function (shouldStopBatcher) {
|
|
70
70
|
if (this._stopRecording !== null) {
|
|
71
71
|
logger.log('Recording already in progress, skipping startRecording.');
|
|
72
72
|
return;
|
|
@@ -84,7 +84,14 @@ MixpanelRecorder.prototype.startRecording = function () {
|
|
|
84
84
|
|
|
85
85
|
this.replayId = _.UUID();
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
if (shouldStopBatcher) {
|
|
88
|
+
// this is the case when we're starting recording after a reset
|
|
89
|
+
// and don't want to send anything over the network until there's
|
|
90
|
+
// actual user activity
|
|
91
|
+
this.batcher.stop();
|
|
92
|
+
} else {
|
|
93
|
+
this.batcher.start();
|
|
94
|
+
}
|
|
88
95
|
|
|
89
96
|
var resetIdleTimeout = _.bind(function () {
|
|
90
97
|
clearTimeout(this.idleTimeoutId);
|
|
@@ -98,6 +105,10 @@ MixpanelRecorder.prototype.startRecording = function () {
|
|
|
98
105
|
'emit': _.bind(function (ev) {
|
|
99
106
|
this.batcher.enqueue(ev);
|
|
100
107
|
if (isUserEvent(ev)) {
|
|
108
|
+
if (this.batcher.stopped) {
|
|
109
|
+
// start flushing again after user activity
|
|
110
|
+
this.batcher.start();
|
|
111
|
+
}
|
|
101
112
|
resetIdleTimeout();
|
|
102
113
|
}
|
|
103
114
|
}, this),
|
|
@@ -117,7 +128,7 @@ MixpanelRecorder.prototype.startRecording = function () {
|
|
|
117
128
|
|
|
118
129
|
MixpanelRecorder.prototype.resetRecording = function () {
|
|
119
130
|
this.stopRecording();
|
|
120
|
-
this.startRecording();
|
|
131
|
+
this.startRecording(true);
|
|
121
132
|
};
|
|
122
133
|
|
|
123
134
|
MixpanelRecorder.prototype.stopRecording = function () {
|
|
@@ -126,7 +137,14 @@ MixpanelRecorder.prototype.stopRecording = function () {
|
|
|
126
137
|
this._stopRecording = null;
|
|
127
138
|
}
|
|
128
139
|
|
|
129
|
-
this.batcher.
|
|
140
|
+
if (this.batcher.stopped) {
|
|
141
|
+
// never got user activity to flush after reset, so just clear the batcher
|
|
142
|
+
this.batcher.clear();
|
|
143
|
+
} else {
|
|
144
|
+
// flush any remaining events from running batcher
|
|
145
|
+
this.batcher.flush();
|
|
146
|
+
this.batcher.stop();
|
|
147
|
+
}
|
|
130
148
|
this.replayId = null;
|
|
131
149
|
|
|
132
150
|
clearTimeout(this.idleTimeoutId);
|
package/src/request-batcher.js
CHANGED
|
@@ -97,7 +97,11 @@ RequestBatcher.prototype.resetFlush = function() {
|
|
|
97
97
|
RequestBatcher.prototype.scheduleFlush = function(flushMS) {
|
|
98
98
|
this.flushInterval = flushMS;
|
|
99
99
|
if (!this.stopped) { // don't schedule anymore if batching has been stopped
|
|
100
|
-
this.timeoutID = setTimeout(_.bind(
|
|
100
|
+
this.timeoutID = setTimeout(_.bind(function() {
|
|
101
|
+
if (!this.stopped) {
|
|
102
|
+
this.flush();
|
|
103
|
+
}
|
|
104
|
+
}, this), this.flushInterval);
|
|
101
105
|
}
|
|
102
106
|
};
|
|
103
107
|
|