alphana-sdk 1.9.0 → 2.0.2

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/dist/index.d.mts CHANGED
@@ -93,6 +93,12 @@ interface TrackerConfig {
93
93
  sessionReplayMaskTextClass?: string;
94
94
  /** CSS class name for DOM subtrees that rrweb should not capture. */
95
95
  sessionReplayBlockClass?: string;
96
+ /**
97
+ * Cookie consent mode.
98
+ * - `auto` (default): honor the dashboard cookie-consent widget when enabled.
99
+ * - `disabled`: never show the consent banner; track immediately.
100
+ */
101
+ consentMode?: "auto" | "disabled";
96
102
  /** Called synchronously for every emitted event. */
97
103
  onEvent?: (event: TrackerEvent) => void;
98
104
  }
@@ -431,6 +437,10 @@ declare class UserTracker {
431
437
  /** Public so consumers can call logCapture.capture() for manual log entries. */
432
438
  logCapture?: LogCapture;
433
439
  private initialized;
440
+ private trackingAllowed;
441
+ private trackingBlocked;
442
+ private visitorPersisted;
443
+ private elementBindings?;
434
444
  private readonly subscribers;
435
445
  /** In-memory queue of events waiting to be flushed. */
436
446
  private queue;
@@ -448,8 +458,17 @@ declare class UserTracker {
448
458
  * Attach event listeners and start tracking.
449
459
  * Safe to call during SSR — returns `this` immediately if `window` is
450
460
  * undefined so it can be chained: `const tracker = new UserTracker(cfg).init()`.
461
+ *
462
+ * When the dashboard cookie-consent widget is enabled, tracking waits until
463
+ * the visitor accepts (or resumes a prior decision for the same config version).
451
464
  */
452
465
  init(): this;
466
+ private bootstrapRuntime;
467
+ private applyElementBindings;
468
+ private persistVisitorIfNeeded;
469
+ /** Start plugins, network flush, and element listeners after consent is OK. */
470
+ private startTracking;
471
+ private blockTracking;
453
472
  /** Remove all event listeners, flush remaining queue, and reset state. */
454
473
  destroy(): void;
455
474
  private handleVisibilityChange;
@@ -569,6 +588,7 @@ declare class UserTracker {
569
588
  /** Heatmap points for all tracked paths. */
570
589
  getHeatmapData(): Record<string, HeatmapPoint[]>;
571
590
  private get collectUrl();
591
+ private fetchRuntimeConfig;
572
592
  private currentPath;
573
593
  /**
574
594
  * Immediately drain the event queue and POST pending events to `/batch`.
@@ -606,7 +626,7 @@ declare class UserTracker {
606
626
  */
607
627
  declare function renderHeatmap(canvas: HTMLCanvasElement, points: HeatmapPoint[], options?: HeatmapRenderOptions): void;
608
628
 
609
- declare const ALPHANA_SDK_VERSION = "1.0.2";
629
+ declare const ALPHANA_SDK_VERSION = "2.0.2";
610
630
 
611
631
  /**
612
632
  * Canonical URL path (+ optional query) for analytics / heatmap matching.
package/dist/index.d.ts CHANGED
@@ -93,6 +93,12 @@ interface TrackerConfig {
93
93
  sessionReplayMaskTextClass?: string;
94
94
  /** CSS class name for DOM subtrees that rrweb should not capture. */
95
95
  sessionReplayBlockClass?: string;
96
+ /**
97
+ * Cookie consent mode.
98
+ * - `auto` (default): honor the dashboard cookie-consent widget when enabled.
99
+ * - `disabled`: never show the consent banner; track immediately.
100
+ */
101
+ consentMode?: "auto" | "disabled";
96
102
  /** Called synchronously for every emitted event. */
97
103
  onEvent?: (event: TrackerEvent) => void;
98
104
  }
@@ -431,6 +437,10 @@ declare class UserTracker {
431
437
  /** Public so consumers can call logCapture.capture() for manual log entries. */
432
438
  logCapture?: LogCapture;
433
439
  private initialized;
440
+ private trackingAllowed;
441
+ private trackingBlocked;
442
+ private visitorPersisted;
443
+ private elementBindings?;
434
444
  private readonly subscribers;
435
445
  /** In-memory queue of events waiting to be flushed. */
436
446
  private queue;
@@ -448,8 +458,17 @@ declare class UserTracker {
448
458
  * Attach event listeners and start tracking.
449
459
  * Safe to call during SSR — returns `this` immediately if `window` is
450
460
  * undefined so it can be chained: `const tracker = new UserTracker(cfg).init()`.
461
+ *
462
+ * When the dashboard cookie-consent widget is enabled, tracking waits until
463
+ * the visitor accepts (or resumes a prior decision for the same config version).
451
464
  */
452
465
  init(): this;
466
+ private bootstrapRuntime;
467
+ private applyElementBindings;
468
+ private persistVisitorIfNeeded;
469
+ /** Start plugins, network flush, and element listeners after consent is OK. */
470
+ private startTracking;
471
+ private blockTracking;
453
472
  /** Remove all event listeners, flush remaining queue, and reset state. */
454
473
  destroy(): void;
455
474
  private handleVisibilityChange;
@@ -569,6 +588,7 @@ declare class UserTracker {
569
588
  /** Heatmap points for all tracked paths. */
570
589
  getHeatmapData(): Record<string, HeatmapPoint[]>;
571
590
  private get collectUrl();
591
+ private fetchRuntimeConfig;
572
592
  private currentPath;
573
593
  /**
574
594
  * Immediately drain the event queue and POST pending events to `/batch`.
@@ -606,7 +626,7 @@ declare class UserTracker {
606
626
  */
607
627
  declare function renderHeatmap(canvas: HTMLCanvasElement, points: HeatmapPoint[], options?: HeatmapRenderOptions): void;
608
628
 
609
- declare const ALPHANA_SDK_VERSION = "1.0.2";
629
+ declare const ALPHANA_SDK_VERSION = "2.0.2";
610
630
 
611
631
  /**
612
632
  * Canonical URL path (+ optional query) for analytics / heatmap matching.