mixpanel-browser 2.71.1 → 2.72.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/.github/workflows/tests.yml +1 -0
- package/CHANGELOG.md +7 -0
- package/dist/mixpanel-core.cjs.d.ts +47 -10
- package/dist/mixpanel-core.cjs.js +51 -17
- package/dist/mixpanel-recorder.js +681 -113
- package/dist/mixpanel-recorder.min.js +1 -1
- package/dist/mixpanel-recorder.min.js.map +1 -1
- package/dist/mixpanel-with-async-recorder.cjs.d.ts +47 -10
- package/dist/mixpanel-with-async-recorder.cjs.js +51 -17
- package/dist/mixpanel-with-recorder.d.ts +47 -10
- package/dist/mixpanel-with-recorder.js +731 -129
- package/dist/mixpanel-with-recorder.min.d.ts +47 -10
- package/dist/mixpanel-with-recorder.min.js +1 -1
- package/dist/mixpanel.amd.d.ts +47 -10
- package/dist/mixpanel.amd.js +731 -129
- package/dist/mixpanel.cjs.d.ts +47 -10
- package/dist/mixpanel.cjs.js +731 -129
- package/dist/mixpanel.globals.js +51 -17
- package/dist/mixpanel.min.js +144 -144
- package/dist/mixpanel.module.d.ts +47 -10
- package/dist/mixpanel.module.js +731 -129
- package/dist/mixpanel.umd.d.ts +47 -10
- package/dist/mixpanel.umd.js +731 -129
- package/dist/rrweb-bundled.js +12760 -0
- package/dist/rrweb-compiled.js +2496 -7176
- package/package.json +3 -2
- package/rollup.config.mjs +15 -4
- package/src/autocapture/index.js +1 -1
- package/src/autocapture/rageclick.js +20 -1
- package/src/autocapture/shadow-dom-observer.js +3 -15
- package/src/autocapture/utils.js +30 -0
- package/src/config.js +1 -1
- package/src/index.d.ts +47 -10
- package/src/mixpanel-core.js +1 -0
- package/src/recorder/recorder.js +1 -1
- package/src/recorder/rrweb-entrypoint.js +6 -0
- package/src/recorder/session-recording.js +69 -12
- package/src/utils.js +24 -0
package/dist/mixpanel.globals.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var Config = {
|
|
5
5
|
DEBUG: false,
|
|
6
|
-
LIB_VERSION: '2.
|
|
6
|
+
LIB_VERSION: '2.72.0'
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
// since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
|
|
@@ -2893,20 +2893,65 @@
|
|
|
2893
2893
|
return false;
|
|
2894
2894
|
}
|
|
2895
2895
|
|
|
2896
|
+
/**
|
|
2897
|
+
* Get the composed path of a click event for elements embedded in shadow DOM.
|
|
2898
|
+
* @param {Event} event - event to get the composed path from
|
|
2899
|
+
* @returns {Array} the composed path of the click event
|
|
2900
|
+
*/
|
|
2901
|
+
function getClickEventComposedPath(event) {
|
|
2902
|
+
if ('composedPath' in event) {
|
|
2903
|
+
return event['composedPath']();
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
return [];
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
/**
|
|
2910
|
+
* Get the element from a click event, accounting for elements embedded in shadow DOM.
|
|
2911
|
+
* @param {Event} event - event to get the target from
|
|
2912
|
+
* @returns {Element | null} the element that was the target of the click event
|
|
2913
|
+
*/
|
|
2914
|
+
function getClickEventTargetElement(event) {
|
|
2915
|
+
var path = getClickEventComposedPath(event);
|
|
2916
|
+
|
|
2917
|
+
if (path && path.length > 0) {
|
|
2918
|
+
return path[0];
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
return event['target'] || event['srcElement'];
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2896
2924
|
/** @const */ var DEFAULT_RAGE_CLICK_THRESHOLD_PX = 30;
|
|
2897
2925
|
/** @const */ var DEFAULT_RAGE_CLICK_TIMEOUT_MS = 1000;
|
|
2898
2926
|
/** @const */ var DEFAULT_RAGE_CLICK_CLICK_COUNT = 4;
|
|
2927
|
+
/** @const */ var DEFAULT_RAGE_CLICK_INTERACTIVE_ELEMENTS_ONLY = false;
|
|
2899
2928
|
|
|
2900
2929
|
function RageClickTracker() {
|
|
2901
2930
|
this.clicks = [];
|
|
2902
2931
|
}
|
|
2903
2932
|
|
|
2904
|
-
|
|
2933
|
+
/**
|
|
2934
|
+
* Determines if a click event is part of a rage click sequence.
|
|
2935
|
+
* @param {Event} event - the original click event.
|
|
2936
|
+
* @param {import('../index.d.ts').RageClickConfig} options - configuration options for rage click detection.
|
|
2937
|
+
* @returns {boolean} - true if the click is considered a rage click, false otherwise.
|
|
2938
|
+
*/
|
|
2939
|
+
RageClickTracker.prototype.isRageClick = function(event, options) {
|
|
2905
2940
|
options = options || {};
|
|
2906
2941
|
var thresholdPx = options['threshold_px'] || DEFAULT_RAGE_CLICK_THRESHOLD_PX;
|
|
2907
2942
|
var timeoutMs = options['timeout_ms'] || DEFAULT_RAGE_CLICK_TIMEOUT_MS;
|
|
2908
2943
|
var clickCount = options['click_count'] || DEFAULT_RAGE_CLICK_CLICK_COUNT;
|
|
2944
|
+
var interactiveElementsOnly = options['interactive_elements_only'] || DEFAULT_RAGE_CLICK_INTERACTIVE_ELEMENTS_ONLY;
|
|
2945
|
+
|
|
2946
|
+
if (interactiveElementsOnly) {
|
|
2947
|
+
var target = getClickEventTargetElement(event);
|
|
2948
|
+
if (!target || isDefinitelyNonInteractive(target)) {
|
|
2949
|
+
return false;
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2909
2953
|
var timestamp = Date.now();
|
|
2954
|
+
var x = event['pageX'], y = event['pageY'];
|
|
2910
2955
|
|
|
2911
2956
|
var lastClick = this.clicks[this.clicks.length - 1];
|
|
2912
2957
|
if (
|
|
@@ -2937,28 +2982,16 @@
|
|
|
2937
2982
|
if (!this.observedShadowRoots) {
|
|
2938
2983
|
return;
|
|
2939
2984
|
}
|
|
2940
|
-
var path = this.getComposedPath(event);
|
|
2941
|
-
if (path && path.length) {
|
|
2942
|
-
return path[0];
|
|
2943
|
-
}
|
|
2944
2985
|
|
|
2945
|
-
return event
|
|
2986
|
+
return getClickEventTargetElement(event);
|
|
2946
2987
|
};
|
|
2947
2988
|
|
|
2948
|
-
|
|
2949
|
-
ShadowDOMObserver.prototype.getComposedPath = function(event) {
|
|
2950
|
-
if ('composedPath' in event) {
|
|
2951
|
-
return event['composedPath']();
|
|
2952
|
-
}
|
|
2953
|
-
|
|
2954
|
-
return [];
|
|
2955
|
-
};
|
|
2956
2989
|
ShadowDOMObserver.prototype.observeFromEvent = function(event) {
|
|
2957
2990
|
if (!this.observedShadowRoots) {
|
|
2958
2991
|
return;
|
|
2959
2992
|
}
|
|
2960
2993
|
|
|
2961
|
-
var path =
|
|
2994
|
+
var path = getClickEventComposedPath(event);
|
|
2962
2995
|
|
|
2963
2996
|
// Check each element in path for shadow roots
|
|
2964
2997
|
for (var i = 0; i < path.length; i++) {
|
|
@@ -3710,7 +3743,7 @@
|
|
|
3710
3743
|
return;
|
|
3711
3744
|
}
|
|
3712
3745
|
|
|
3713
|
-
if (this._rageClickTracker.isRageClick(ev
|
|
3746
|
+
if (this._rageClickTracker.isRageClick(ev, currentRageClickConfig)) {
|
|
3714
3747
|
this.trackDomEvent(ev, MP_EV_RAGE_CLICK);
|
|
3715
3748
|
}
|
|
3716
3749
|
}.bind(this);
|
|
@@ -6898,6 +6931,7 @@
|
|
|
6898
6931
|
'record_block_selector': 'img, video, audio',
|
|
6899
6932
|
'record_canvas': false,
|
|
6900
6933
|
'record_collect_fonts': false,
|
|
6934
|
+
'record_console': true,
|
|
6901
6935
|
'record_heatmap_data': false,
|
|
6902
6936
|
'record_idle_timeout_ms': 30 * 60 * 1000, // 30 minutes
|
|
6903
6937
|
'record_mask_text_class': new RegExp('^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$'),
|