alphana-sdk 1.6.6 → 1.8.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/dist/index.d.mts CHANGED
@@ -4,6 +4,11 @@ interface TrackerConfig {
4
4
  * Defaults to `https://api.alphana.ir/api/events` (Alphana Cloud).
5
5
  */
6
6
  endpoint?: string;
7
+ /**
8
+ * Override unified ingest URL. When omitted, derived from `endpoint` as
9
+ * `…/api/collect`.
10
+ */
11
+ collectEndpoint?: string;
7
12
  /**
8
13
  * App ID obtained from the UserTracker dashboard.
9
14
  * Sent in every request body so the backend associates events with the correct app.
@@ -39,6 +44,16 @@ interface TrackerConfig {
39
44
  * Default: 5000 (5 s)
40
45
  */
41
46
  flushInterval?: number;
47
+ /**
48
+ * Gzip-compress large ingest payloads before upload when the browser supports
49
+ * `CompressionStream`. Default: true
50
+ */
51
+ compressPayloads?: boolean;
52
+ /**
53
+ * Minimum UTF-8 JSON size (bytes) before gzip compression is attempted.
54
+ * Default: 1024
55
+ */
56
+ compressionThresholdBytes?: number;
42
57
  /**
43
58
  * Automatically capture console.info/warn/error, window.onerror, and
44
59
  * unhandledrejection events and send them to the backend log endpoint.
@@ -357,15 +372,17 @@ interface LogEntry {
357
372
  }
358
373
  /**
359
374
  * Automatically captures console.info/warn/error output and unhandled errors,
360
- * then ships them to the backend `/logs/ingest` endpoint.
375
+ * then ships them to the unified `/api/collect` ingest endpoint.
361
376
  *
362
377
  * All console methods are restored exactly in `destroy()`.
363
378
  */
364
379
  declare class LogCapture {
365
- private readonly endpoint;
380
+ private readonly collectUrl;
366
381
  private readonly sessionId;
367
382
  private readonly appId?;
368
383
  private readonly authHeaders;
384
+ private readonly compressPayloads;
385
+ private readonly compressionThresholdBytes;
369
386
  private origInfo;
370
387
  private origWarn;
371
388
  private origError;
@@ -374,9 +391,12 @@ declare class LogCapture {
374
391
  private initialized;
375
392
  constructor(options: {
376
393
  endpoint: string;
394
+ collectEndpoint?: string;
377
395
  sessionId: string;
378
396
  secretKey?: string;
379
397
  appId?: string;
398
+ compressPayloads?: boolean;
399
+ compressionThresholdBytes?: number;
380
400
  });
381
401
  init(): void;
382
402
  destroy(): void;
@@ -540,6 +560,8 @@ declare class UserTracker {
540
560
  getHeatmapData(path: string): HeatmapPoint[];
541
561
  /** Heatmap points for all tracked paths. */
542
562
  getHeatmapData(): Record<string, HeatmapPoint[]>;
563
+ private get collectUrl();
564
+ private currentPath;
543
565
  /**
544
566
  * Immediately drain the event queue and POST pending events to `/batch`.
545
567
  * Fire-and-forget; errors are intentionally swallowed like other analytics calls.
@@ -553,7 +575,6 @@ declare class UserTracker {
553
575
  * cancelled by the browser before it completes.
554
576
  */
555
577
  private flushBeacon;
556
- private buildBatchBody;
557
578
  private sendBatch;
558
579
  }
559
580
 
package/dist/index.d.ts CHANGED
@@ -4,6 +4,11 @@ interface TrackerConfig {
4
4
  * Defaults to `https://api.alphana.ir/api/events` (Alphana Cloud).
5
5
  */
6
6
  endpoint?: string;
7
+ /**
8
+ * Override unified ingest URL. When omitted, derived from `endpoint` as
9
+ * `…/api/collect`.
10
+ */
11
+ collectEndpoint?: string;
7
12
  /**
8
13
  * App ID obtained from the UserTracker dashboard.
9
14
  * Sent in every request body so the backend associates events with the correct app.
@@ -39,6 +44,16 @@ interface TrackerConfig {
39
44
  * Default: 5000 (5 s)
40
45
  */
41
46
  flushInterval?: number;
47
+ /**
48
+ * Gzip-compress large ingest payloads before upload when the browser supports
49
+ * `CompressionStream`. Default: true
50
+ */
51
+ compressPayloads?: boolean;
52
+ /**
53
+ * Minimum UTF-8 JSON size (bytes) before gzip compression is attempted.
54
+ * Default: 1024
55
+ */
56
+ compressionThresholdBytes?: number;
42
57
  /**
43
58
  * Automatically capture console.info/warn/error, window.onerror, and
44
59
  * unhandledrejection events and send them to the backend log endpoint.
@@ -357,15 +372,17 @@ interface LogEntry {
357
372
  }
358
373
  /**
359
374
  * Automatically captures console.info/warn/error output and unhandled errors,
360
- * then ships them to the backend `/logs/ingest` endpoint.
375
+ * then ships them to the unified `/api/collect` ingest endpoint.
361
376
  *
362
377
  * All console methods are restored exactly in `destroy()`.
363
378
  */
364
379
  declare class LogCapture {
365
- private readonly endpoint;
380
+ private readonly collectUrl;
366
381
  private readonly sessionId;
367
382
  private readonly appId?;
368
383
  private readonly authHeaders;
384
+ private readonly compressPayloads;
385
+ private readonly compressionThresholdBytes;
369
386
  private origInfo;
370
387
  private origWarn;
371
388
  private origError;
@@ -374,9 +391,12 @@ declare class LogCapture {
374
391
  private initialized;
375
392
  constructor(options: {
376
393
  endpoint: string;
394
+ collectEndpoint?: string;
377
395
  sessionId: string;
378
396
  secretKey?: string;
379
397
  appId?: string;
398
+ compressPayloads?: boolean;
399
+ compressionThresholdBytes?: number;
380
400
  });
381
401
  init(): void;
382
402
  destroy(): void;
@@ -540,6 +560,8 @@ declare class UserTracker {
540
560
  getHeatmapData(path: string): HeatmapPoint[];
541
561
  /** Heatmap points for all tracked paths. */
542
562
  getHeatmapData(): Record<string, HeatmapPoint[]>;
563
+ private get collectUrl();
564
+ private currentPath;
543
565
  /**
544
566
  * Immediately drain the event queue and POST pending events to `/batch`.
545
567
  * Fire-and-forget; errors are intentionally swallowed like other analytics calls.
@@ -553,7 +575,6 @@ declare class UserTracker {
553
575
  * cancelled by the browser before it completes.
554
576
  */
555
577
  private flushBeacon;
556
- private buildBatchBody;
557
578
  private sendBatch;
558
579
  }
559
580