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.
Files changed (38) hide show
  1. package/.github/workflows/tests.yml +1 -0
  2. package/CHANGELOG.md +7 -0
  3. package/dist/mixpanel-core.cjs.d.ts +47 -10
  4. package/dist/mixpanel-core.cjs.js +51 -17
  5. package/dist/mixpanel-recorder.js +681 -113
  6. package/dist/mixpanel-recorder.min.js +1 -1
  7. package/dist/mixpanel-recorder.min.js.map +1 -1
  8. package/dist/mixpanel-with-async-recorder.cjs.d.ts +47 -10
  9. package/dist/mixpanel-with-async-recorder.cjs.js +51 -17
  10. package/dist/mixpanel-with-recorder.d.ts +47 -10
  11. package/dist/mixpanel-with-recorder.js +731 -129
  12. package/dist/mixpanel-with-recorder.min.d.ts +47 -10
  13. package/dist/mixpanel-with-recorder.min.js +1 -1
  14. package/dist/mixpanel.amd.d.ts +47 -10
  15. package/dist/mixpanel.amd.js +731 -129
  16. package/dist/mixpanel.cjs.d.ts +47 -10
  17. package/dist/mixpanel.cjs.js +731 -129
  18. package/dist/mixpanel.globals.js +51 -17
  19. package/dist/mixpanel.min.js +144 -144
  20. package/dist/mixpanel.module.d.ts +47 -10
  21. package/dist/mixpanel.module.js +731 -129
  22. package/dist/mixpanel.umd.d.ts +47 -10
  23. package/dist/mixpanel.umd.js +731 -129
  24. package/dist/rrweb-bundled.js +12760 -0
  25. package/dist/rrweb-compiled.js +2496 -7176
  26. package/package.json +3 -2
  27. package/rollup.config.mjs +15 -4
  28. package/src/autocapture/index.js +1 -1
  29. package/src/autocapture/rageclick.js +20 -1
  30. package/src/autocapture/shadow-dom-observer.js +3 -15
  31. package/src/autocapture/utils.js +30 -0
  32. package/src/config.js +1 -1
  33. package/src/index.d.ts +47 -10
  34. package/src/mixpanel-core.js +1 -0
  35. package/src/recorder/recorder.js +1 -1
  36. package/src/recorder/rrweb-entrypoint.js +6 -0
  37. package/src/recorder/session-recording.js +69 -12
  38. package/src/utils.js +24 -0
@@ -43,20 +43,22 @@ export interface OutTrackingOptions extends ClearOptOutInOutOptions {
43
43
  export type RageClickConfig =
44
44
  | boolean
45
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
- };
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
- /** Time in milliseconds to wait after a click before qualifying it as dead (default: 500) */
58
- timeout_ms?: number;
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,10 @@ 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
+
152
158
  export interface Config {
153
159
  api_host: string;
154
160
  api_routes: {
@@ -165,6 +171,7 @@ export interface Config {
165
171
  cookie_domain: string;
166
172
  cross_site_cookie: boolean;
167
173
  cross_subdomain_cookie: boolean;
174
+ flags: boolean | FlagsConfig;
168
175
  persistence: Persistence;
169
176
  persistence_name: string;
170
177
  cookie_name: string;
@@ -277,11 +284,41 @@ export interface Group {
277
284
  unset(prop: string, callback?: Callback): void;
278
285
  }
279
286
 
287
+ export interface FlagsVariant {
288
+ key: string;
289
+ value: any;
290
+ experiment_id?: string;
291
+ is_experiment_active?: boolean;
292
+ is_qa_tester?: boolean;
293
+ }
294
+
295
+ export interface FlagsUpdateContextOptions {
296
+ replace?: boolean;
297
+ }
298
+
299
+ export interface FlagsManager {
300
+ are_flags_ready(): boolean;
301
+ get_variant(
302
+ featureName: string,
303
+ fallback: FlagsVariant
304
+ ): Promise<FlagsVariant>;
305
+ get_variant_sync(featureName: string, fallback: FlagsVariant): FlagsVariant;
306
+ get_variant_value(featureName: string, fallbackValue: any): Promise<any>;
307
+ get_variant_value_sync(featureName: string, fallbackValue: any): any;
308
+ is_enabled(featureName: string, fallbackValue?: boolean): Promise<boolean>;
309
+ is_enabled_sync(featureName: string, fallbackValue?: boolean): boolean;
310
+ update_context(
311
+ context: Dict,
312
+ options?: FlagsUpdateContextOptions
313
+ ): Promise<void>;
314
+ }
315
+
280
316
  export interface Mixpanel {
281
317
  add_group(group_key: string, group_id: string, callback?: Callback): void;
282
318
  alias(alias: string, original?: string): void;
283
319
  clear_opt_in_out_tracking(options?: Partial<ClearOptOutInOutOptions>): void;
284
320
  disable(events?: string[]): void;
321
+ flags: FlagsManager;
285
322
  get_config(prop_name?: string): any;
286
323
  get_distinct_id(): any;
287
324
  get_group(group_key: string, group_id: string): Group;