mixpanel-browser 2.67.0 → 2.68.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 +5 -0
- package/dist/mixpanel-core.cjs.js +115 -4
- package/dist/mixpanel-recorder.js +1 -1
- package/dist/mixpanel-recorder.min.js +1 -1
- package/dist/mixpanel-recorder.min.js.map +1 -1
- package/dist/mixpanel-with-async-recorder.cjs.js +115 -4
- package/dist/mixpanel-with-recorder.js +115 -4
- package/dist/mixpanel-with-recorder.min.js +1 -1
- package/dist/mixpanel.amd.js +115 -4
- package/dist/mixpanel.cjs.js +115 -4
- package/dist/mixpanel.globals.js +115 -4
- package/dist/mixpanel.min.js +148 -146
- package/dist/mixpanel.module.js +115 -4
- package/dist/mixpanel.umd.js +115 -4
- package/package.json +1 -1
- package/src/autocapture/index.js +59 -1
- package/src/autocapture/rageclick.js +38 -0
- package/src/config.js +1 -1
- package/src/flags/index.js +22 -1
- package/src/index.d.ts +18 -0
- package/src/mixpanel-core.js +2 -1
package/src/flags/index.js
CHANGED
|
@@ -17,6 +17,7 @@ CONFIG_DEFAULTS[CONFIG_CONTEXT] = {};
|
|
|
17
17
|
var FeatureFlagManager = function(initOptions) {
|
|
18
18
|
this.getFullApiRoute = initOptions.getFullApiRoute;
|
|
19
19
|
this.getMpConfig = initOptions.getConfigFunc;
|
|
20
|
+
this.setMpConfig = initOptions.setConfigFunc;
|
|
20
21
|
this.getMpProperty = initOptions.getPropertyFunc;
|
|
21
22
|
this.track = initOptions.trackingFunc;
|
|
22
23
|
};
|
|
@@ -54,6 +55,23 @@ FeatureFlagManager.prototype.isSystemEnabled = function() {
|
|
|
54
55
|
return !!this.getMpConfig(FLAGS_CONFIG_KEY);
|
|
55
56
|
};
|
|
56
57
|
|
|
58
|
+
FeatureFlagManager.prototype.updateContext = function(newContext, options) {
|
|
59
|
+
if (!this.isSystemEnabled()) {
|
|
60
|
+
logger.critical('Feature Flags not enabled, cannot update context');
|
|
61
|
+
return Promise.resolve();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var ffConfig = this.getMpConfig(FLAGS_CONFIG_KEY);
|
|
65
|
+
if (!_.isObject(ffConfig)) {
|
|
66
|
+
ffConfig = {};
|
|
67
|
+
}
|
|
68
|
+
var oldContext = (options && options['replace']) ? {} : this.getConfig(CONFIG_CONTEXT);
|
|
69
|
+
ffConfig[CONFIG_CONTEXT] = _.extend({}, oldContext, newContext);
|
|
70
|
+
|
|
71
|
+
this.setMpConfig(FLAGS_CONFIG_KEY, ffConfig);
|
|
72
|
+
return this.fetchFlags();
|
|
73
|
+
};
|
|
74
|
+
|
|
57
75
|
FeatureFlagManager.prototype.areFlagsReady = function() {
|
|
58
76
|
if (!this.isSystemEnabled()) {
|
|
59
77
|
logger.error('Feature Flags not enabled');
|
|
@@ -63,7 +81,7 @@ FeatureFlagManager.prototype.areFlagsReady = function() {
|
|
|
63
81
|
|
|
64
82
|
FeatureFlagManager.prototype.fetchFlags = function() {
|
|
65
83
|
if (!this.isSystemEnabled()) {
|
|
66
|
-
return;
|
|
84
|
+
return Promise.resolve();
|
|
67
85
|
}
|
|
68
86
|
|
|
69
87
|
var distinctId = this.getMpProperty('distinct_id');
|
|
@@ -103,6 +121,8 @@ FeatureFlagManager.prototype.fetchFlags = function() {
|
|
|
103
121
|
this.markFetchComplete();
|
|
104
122
|
logger.error(error);
|
|
105
123
|
}.bind(this));
|
|
124
|
+
|
|
125
|
+
return this.fetchPromise;
|
|
106
126
|
};
|
|
107
127
|
|
|
108
128
|
FeatureFlagManager.prototype.markFetchComplete = function() {
|
|
@@ -215,6 +235,7 @@ FeatureFlagManager.prototype['get_variant_value'] = FeatureFlagManager.prototype
|
|
|
215
235
|
FeatureFlagManager.prototype['get_variant_value_sync'] = FeatureFlagManager.prototype.getVariantValueSync;
|
|
216
236
|
FeatureFlagManager.prototype['is_enabled'] = FeatureFlagManager.prototype.isEnabled;
|
|
217
237
|
FeatureFlagManager.prototype['is_enabled_sync'] = FeatureFlagManager.prototype.isEnabledSync;
|
|
238
|
+
FeatureFlagManager.prototype['update_context'] = FeatureFlagManager.prototype.updateContext;
|
|
218
239
|
|
|
219
240
|
// Deprecated method
|
|
220
241
|
FeatureFlagManager.prototype['get_feature_data'] = FeatureFlagManager.prototype.getFeatureData;
|
package/src/index.d.ts
CHANGED
|
@@ -40,6 +40,17 @@ export interface OutTrackingOptions extends ClearOptOutInOutOptions {
|
|
|
40
40
|
delete_user: boolean;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
export type RageClickConfig =
|
|
44
|
+
| boolean
|
|
45
|
+
| {
|
|
46
|
+
/** Distance threshold in pixels for clicks to be considered within the same area (default: 30) */
|
|
47
|
+
threshold_px?: number;
|
|
48
|
+
/** Time window in milliseconds for clicks to be considered rapid (default: 1000) */
|
|
49
|
+
timeout_ms?: number;
|
|
50
|
+
/** Number of clicks required to trigger a rage click event (default: 3) */
|
|
51
|
+
click_count?: number;
|
|
52
|
+
};
|
|
53
|
+
|
|
43
54
|
export interface RegisterOptions {
|
|
44
55
|
persistent: boolean;
|
|
45
56
|
}
|
|
@@ -66,6 +77,12 @@ export interface AutocaptureConfig {
|
|
|
66
77
|
* @default 'full-url'
|
|
67
78
|
*/
|
|
68
79
|
pageview?: TrackPageView;
|
|
80
|
+
/**
|
|
81
|
+
* When set to `true`, Mixpanel will track rage clicks (multiple clicks in a short time on the same element).
|
|
82
|
+
* Can also be configured as an object to customize rage click detection parameters.
|
|
83
|
+
* @default true
|
|
84
|
+
*/
|
|
85
|
+
rage_click?: RageClickConfig;
|
|
69
86
|
/**
|
|
70
87
|
* When set, Mixpanel will collect page scrolls at specified scroll intervals.
|
|
71
88
|
* @default true
|
|
@@ -184,6 +201,7 @@ export interface Config {
|
|
|
184
201
|
record_max_ms: number;
|
|
185
202
|
record_sessions_percent: number;
|
|
186
203
|
record_canvas: boolean;
|
|
204
|
+
record_heatmap_data: boolean;
|
|
187
205
|
}
|
|
188
206
|
|
|
189
207
|
export type VerboseResponse =
|
package/src/mixpanel-core.js
CHANGED
|
@@ -149,7 +149,7 @@ var DEFAULT_CONFIG = {
|
|
|
149
149
|
'batch_autostart': true,
|
|
150
150
|
'hooks': {},
|
|
151
151
|
'record_block_class': new RegExp('^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$'),
|
|
152
|
-
'record_block_selector': 'img, video',
|
|
152
|
+
'record_block_selector': 'img, video, audio',
|
|
153
153
|
'record_canvas': false,
|
|
154
154
|
'record_collect_fonts': false,
|
|
155
155
|
'record_heatmap_data': false,
|
|
@@ -373,6 +373,7 @@ MixpanelLib.prototype._init = function(token, config, name) {
|
|
|
373
373
|
return this.get_api_host('flags') + '/' + this.get_config('api_routes')['flags'];
|
|
374
374
|
}, this),
|
|
375
375
|
getConfigFunc: _.bind(this.get_config, this),
|
|
376
|
+
setConfigFunc: _.bind(this.set_config, this),
|
|
376
377
|
getPropertyFunc: _.bind(this.get_property, this),
|
|
377
378
|
trackingFunc: _.bind(this.track, this)
|
|
378
379
|
});
|