mixpanel-browser 2.71.1 → 2.73.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 +12 -0
- package/dist/mixpanel-core.cjs.d.ts +84 -13
- package/dist/mixpanel-core.cjs.js +180 -28
- package/dist/mixpanel-recorder.js +684 -114
- 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 +84 -13
- package/dist/mixpanel-with-async-recorder.cjs.js +180 -28
- package/dist/mixpanel-with-recorder.d.ts +84 -13
- package/dist/mixpanel-with-recorder.js +860 -140
- package/dist/mixpanel-with-recorder.min.d.ts +84 -13
- package/dist/mixpanel-with-recorder.min.js +1 -1
- package/dist/mixpanel.amd.d.ts +84 -13
- package/dist/mixpanel.amd.js +860 -140
- package/dist/mixpanel.cjs.d.ts +84 -13
- package/dist/mixpanel.cjs.js +860 -140
- package/dist/mixpanel.globals.js +180 -28
- package/dist/mixpanel.min.js +172 -170
- package/dist/mixpanel.module.d.ts +84 -13
- package/dist/mixpanel.module.js +860 -140
- package/dist/mixpanel.umd.d.ts +84 -13
- package/dist/mixpanel.umd.js +860 -140
- 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 +84 -13
- package/src/mixpanel-core.js +127 -10
- 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/src/window.js +3 -1
- package/.claude/settings.local.json +0 -9
package/dist/mixpanel.umd.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export type Persistence = "cookie" | "localStorage";
|
|
|
2
2
|
|
|
3
3
|
export type ApiPayloadFormat = "base64" | "json";
|
|
4
4
|
|
|
5
|
-
export type PushItem = Array<string | Dict>;
|
|
5
|
+
export type PushItem = Array<string | Dict | ((this: Mixpanel) => void)>;
|
|
6
6
|
|
|
7
7
|
export type Query = string | Element | Element[];
|
|
8
8
|
|
|
@@ -43,20 +43,22 @@ export interface OutTrackingOptions extends ClearOptOutInOutOptions {
|
|
|
43
43
|
export type RageClickConfig =
|
|
44
44
|
| boolean
|
|
45
45
|
| {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
+
/** Whether to only track rage clicks on interactive elements like buttons, links, inputs (default: false) */
|
|
53
|
+
interactive_elements_only?: boolean;
|
|
54
|
+
};
|
|
53
55
|
|
|
54
56
|
export type DeadClickConfig =
|
|
55
57
|
| boolean
|
|
56
58
|
| {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
/** Time in milliseconds to wait after a click before qualifying it as dead (default: 500) */
|
|
60
|
+
timeout_ms?: number;
|
|
61
|
+
};
|
|
60
62
|
|
|
61
63
|
export interface RegisterOptions {
|
|
62
64
|
persistent: boolean;
|
|
@@ -149,6 +151,15 @@ export interface AutocaptureConfig {
|
|
|
149
151
|
block_element_callback?: (element: Element, event: Event) => boolean;
|
|
150
152
|
}
|
|
151
153
|
|
|
154
|
+
export interface FlagsConfig {
|
|
155
|
+
context: Dict;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface BeforeSendHookPayload {
|
|
159
|
+
event: string;
|
|
160
|
+
properties: Record<string, any>;
|
|
161
|
+
}
|
|
162
|
+
|
|
152
163
|
export interface Config {
|
|
153
164
|
api_host: string;
|
|
154
165
|
api_routes: {
|
|
@@ -161,10 +172,14 @@ export interface Config {
|
|
|
161
172
|
app_host: string;
|
|
162
173
|
api_payload_format: ApiPayloadFormat;
|
|
163
174
|
autotrack: boolean;
|
|
175
|
+
batch_autostart: boolean;
|
|
176
|
+
batch_requests: boolean;
|
|
164
177
|
cdn: string;
|
|
165
178
|
cookie_domain: string;
|
|
166
179
|
cross_site_cookie: boolean;
|
|
167
180
|
cross_subdomain_cookie: boolean;
|
|
181
|
+
error_reporter: (msg: string, err?: Error) => void;
|
|
182
|
+
flags: boolean | FlagsConfig;
|
|
168
183
|
persistence: Persistence;
|
|
169
184
|
persistence_name: string;
|
|
170
185
|
cookie_name: string;
|
|
@@ -200,10 +215,10 @@ export interface Config {
|
|
|
200
215
|
inapp_protocol: string;
|
|
201
216
|
inapp_link_new_window: boolean;
|
|
202
217
|
ignore_dnt: boolean;
|
|
203
|
-
batch_requests: boolean;
|
|
204
218
|
batch_size: number;
|
|
205
219
|
batch_flush_interval_ms: number;
|
|
206
220
|
batch_request_timeout_ms: number;
|
|
221
|
+
recorder_src: string;
|
|
207
222
|
record_block_class: string | RegExp;
|
|
208
223
|
record_block_selector: string;
|
|
209
224
|
record_collect_fonts: boolean;
|
|
@@ -216,6 +231,29 @@ export interface Config {
|
|
|
216
231
|
record_sessions_percent: number;
|
|
217
232
|
record_canvas: boolean;
|
|
218
233
|
record_heatmap_data: boolean;
|
|
234
|
+
hooks: {
|
|
235
|
+
before_identify?: (new_distinct_id: string) => string | null;
|
|
236
|
+
before_register?: (
|
|
237
|
+
props: Dict,
|
|
238
|
+
days_or_options?: number | Partial<RegisterOptions>
|
|
239
|
+
) => Dict | Array<Dict | number | Partial<RegisterOptions>> | null;
|
|
240
|
+
before_register_once?: (
|
|
241
|
+
props: Dict,
|
|
242
|
+
default_value?: any,
|
|
243
|
+
days_or_options?: number | Partial<RegisterOptions>
|
|
244
|
+
) => Dict | Array<any | Dict | number | Partial<RegisterOptions>> | null;
|
|
245
|
+
before_send_events?: (
|
|
246
|
+
event: BeforeSendHookPayload
|
|
247
|
+
) => BeforeSendHookPayload | null;
|
|
248
|
+
before_track?: (
|
|
249
|
+
event_name: string,
|
|
250
|
+
properties: Dict
|
|
251
|
+
) => string | Array<string | Dict> | null;
|
|
252
|
+
before_unregister?: (
|
|
253
|
+
property: string,
|
|
254
|
+
options?: Partial<RegisterOptions>
|
|
255
|
+
) => string | Partial<RegisterOptions> | null;
|
|
256
|
+
};
|
|
219
257
|
}
|
|
220
258
|
|
|
221
259
|
export type VerboseResponse =
|
|
@@ -277,19 +315,50 @@ export interface Group {
|
|
|
277
315
|
unset(prop: string, callback?: Callback): void;
|
|
278
316
|
}
|
|
279
317
|
|
|
318
|
+
export interface FlagsVariant {
|
|
319
|
+
key: string;
|
|
320
|
+
value: any;
|
|
321
|
+
experiment_id?: string;
|
|
322
|
+
is_experiment_active?: boolean;
|
|
323
|
+
is_qa_tester?: boolean;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export interface FlagsUpdateContextOptions {
|
|
327
|
+
replace?: boolean;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export interface FlagsManager {
|
|
331
|
+
are_flags_ready(): boolean;
|
|
332
|
+
get_variant(
|
|
333
|
+
featureName: string,
|
|
334
|
+
fallback: FlagsVariant
|
|
335
|
+
): Promise<FlagsVariant>;
|
|
336
|
+
get_variant_sync(featureName: string, fallback: FlagsVariant): FlagsVariant;
|
|
337
|
+
get_variant_value(featureName: string, fallbackValue: any): Promise<any>;
|
|
338
|
+
get_variant_value_sync(featureName: string, fallbackValue: any): any;
|
|
339
|
+
is_enabled(featureName: string, fallbackValue?: boolean): Promise<boolean>;
|
|
340
|
+
is_enabled_sync(featureName: string, fallbackValue?: boolean): boolean;
|
|
341
|
+
update_context(
|
|
342
|
+
context: Dict,
|
|
343
|
+
options?: FlagsUpdateContextOptions
|
|
344
|
+
): Promise<void>;
|
|
345
|
+
}
|
|
346
|
+
|
|
280
347
|
export interface Mixpanel {
|
|
281
348
|
add_group(group_key: string, group_id: string, callback?: Callback): void;
|
|
282
349
|
alias(alias: string, original?: string): void;
|
|
283
350
|
clear_opt_in_out_tracking(options?: Partial<ClearOptOutInOutOptions>): void;
|
|
284
351
|
disable(events?: string[]): void;
|
|
352
|
+
flags: FlagsManager;
|
|
285
353
|
get_config(prop_name?: string): any;
|
|
286
354
|
get_distinct_id(): any;
|
|
287
355
|
get_group(group_key: string, group_id: string): Group;
|
|
288
356
|
get_property(property_name: string): any;
|
|
357
|
+
get_session_replay_url(): string;
|
|
289
358
|
has_opted_in_tracking(options?: Partial<HasOptedInOutOptions>): boolean;
|
|
290
359
|
has_opted_out_tracking(options?: Partial<HasOptedInOutOptions>): boolean;
|
|
291
360
|
identify(unique_id?: string): any;
|
|
292
|
-
init(token: string, config: Partial<Config>, name
|
|
361
|
+
init(token: string, config: Partial<Config>, name?: string): Mixpanel;
|
|
293
362
|
opt_in_tracking(options?: Partial<InTrackingOptions>): void;
|
|
294
363
|
opt_out_tracking(options?: Partial<OutTrackingOptions>): void;
|
|
295
364
|
push(item: PushItem): void;
|
|
@@ -314,6 +383,7 @@ export interface Mixpanel {
|
|
|
314
383
|
group_ids: string | string[] | number | number[],
|
|
315
384
|
callback?: Callback
|
|
316
385
|
): void;
|
|
386
|
+
start_batch_senders(): void;
|
|
317
387
|
time_event(event_name: string): void;
|
|
318
388
|
track(
|
|
319
389
|
event_name: string,
|
|
@@ -343,6 +413,7 @@ export interface Mixpanel {
|
|
|
343
413
|
): void;
|
|
344
414
|
unregister(property: string, options?: Partial<RegisterOptions>): void;
|
|
345
415
|
people: People;
|
|
416
|
+
start_batch_senders(): void;
|
|
346
417
|
start_session_recording(): void;
|
|
347
418
|
stop_session_recording(): void;
|
|
348
419
|
get_session_recording_properties(): { $mp_replay_id?: string } | {};
|