@tracelog/lib 2.0.3 → 2.1.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.
@@ -477,6 +477,24 @@ declare enum DeviceType {
477
477
  /** Unable to determine device type */
478
478
  Unknown = "unknown"
479
479
  }
480
+ /**
481
+ * Comprehensive device and environment information
482
+ *
483
+ * **Purpose**: Provides rich device context for analytics segmentation,
484
+ * debugging, and user experience optimization.
485
+ *
486
+ * **Detection**: Uses navigator.userAgentData (modern) with UA string fallback.
487
+ *
488
+ * @see src/utils/browser/device-detector.utils.ts for detection implementation
489
+ */
490
+ interface DeviceInfo {
491
+ /** Device form factor classification */
492
+ type: DeviceType;
493
+ /** OS name: "Windows", "macOS", "iOS", "Android", "Linux", "ChromeOS", "Unknown" */
494
+ os: string;
495
+ /** Browser name: "Chrome", "Firefox", "Safari", "Edge", "Opera", "Unknown" */
496
+ browser: string;
497
+ }
480
498
 
481
499
  /**
482
500
  * Event queue structure sent to backend.
@@ -489,7 +507,7 @@ interface EventsQueue {
489
507
  /** Current session identifier (UUID) */
490
508
  session_id: string;
491
509
  /** Device information (type, OS, browser) */
492
- device: DeviceType;
510
+ device: DeviceInfo;
493
511
  /** Array of events to send */
494
512
  events: EventData[];
495
513
  /** Optional metadata attached to all events in this batch */
@@ -568,13 +586,10 @@ declare class PermanentError extends Error {
568
586
  constructor(message: string, statusCode?: number | undefined);
569
587
  }
570
588
 
571
- /**
572
- * Log levels for the dual logging system
573
- */
574
- type LogLevel = 'CLIENT_ERROR' | 'CLIENT_WARN' | 'INFO' | 'ERROR' | 'WARN' | 'DEBUG' | 'VERBOSE';
575
-
576
589
  /**
577
590
  * App modes for the TraceLog Library
591
+ *
592
+ * - QA: Quality Assurance mode - logs custom events to console for verification
578
593
  */
579
594
  declare enum Mode {
580
595
  QA = "qa"
@@ -654,6 +669,7 @@ declare const isPrimaryScrollEvent: (event: EventData) => event is PrimaryScroll
654
669
  declare const isSecondaryScrollEvent: (event: EventData) => event is SecondaryScrollEvent;
655
670
 
656
671
  interface State {
672
+ /** QA mode flag - when true, custom events are logged to console */
657
673
  mode?: Mode;
658
674
  /**
659
675
  * Collection of API URLs for different integrations.
@@ -667,7 +683,7 @@ interface State {
667
683
  config: Config;
668
684
  sessionId: string | null;
669
685
  userId: string;
670
- device: DeviceType;
686
+ device: DeviceInfo;
671
687
  pageUrl: string;
672
688
  hasStartSession: boolean;
673
689
  suppressNextScroll: boolean;
@@ -1306,7 +1322,7 @@ declare class EventManager extends StateManager {
1306
1322
  *
1307
1323
  * @see src/managers/README.md (lines 5-75) for detailed tracking logic
1308
1324
  */
1309
- track({ type, page_url, from_page_url, scroll_data, click_data, custom_event, web_vitals, error_data, viewport_data, }: Partial<EventData>): void;
1325
+ track({ type, page_url, from_page_url, scroll_data, click_data, custom_event, web_vitals, error_data, viewport_data, page_view, }: Partial<EventData>): void;
1310
1326
  /**
1311
1327
  * Stops event tracking and clears all queues and buffers.
1312
1328
  *
@@ -2429,4 +2445,4 @@ declare const tracelog: {
2429
2445
  mergeGlobalMetadata: (metadata: Record<string, MetadataType>) => void;
2430
2446
  };
2431
2447
 
2432
- export { AppConfigValidationError, type BeforeBatchTransformer, type BeforeSendTransformer, type ClickCoordinates, type ClickData, type ClickTrackingElementData, type Config, type CustomEventData, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, DeviceType, type EmitterCallback, EmitterEvent, type EmitterMap, type ErrorData, ErrorType, type EventData, EventType, type EventTypeName, type EventsQueue, InitializationTimeoutError, IntegrationValidationError, type LogLevel, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_METADATA_NESTING_DEPTH, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, type MetadataType, Mode, PII_PATTERNS, type PageViewData, PermanentError, type PersistedEventsQueue, type PrimaryScrollEvent, SamplingRateValidationError, type ScrollData, ScrollDirection, type SecondaryScrollEvent, type SessionEventCounts, SessionTimeoutValidationError, SpecialApiUrl, type State, type TraceLogTestBridge, TraceLogValidationError, type TransformerHook, type TransformerMap, type UTM, type ViewportConfig, type ViewportElement, type ViewportEventData, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, type WebVitalType, type WebVitalsData, type WebVitalsMode, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
2448
+ export { AppConfigValidationError, type BeforeBatchTransformer, type BeforeSendTransformer, type ClickCoordinates, type ClickData, type ClickTrackingElementData, type Config, type CustomEventData, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, type DeviceInfo, DeviceType, type EmitterCallback, EmitterEvent, type EmitterMap, type ErrorData, ErrorType, type EventData, EventType, type EventTypeName, type EventsQueue, InitializationTimeoutError, IntegrationValidationError, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_METADATA_NESTING_DEPTH, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, type MetadataType, Mode, PII_PATTERNS, type PageViewData, PermanentError, type PersistedEventsQueue, type PrimaryScrollEvent, SamplingRateValidationError, type ScrollData, ScrollDirection, type SecondaryScrollEvent, type SessionEventCounts, SessionTimeoutValidationError, SpecialApiUrl, type State, type TraceLogTestBridge, TraceLogValidationError, type TransformerHook, type TransformerMap, type UTM, type ViewportConfig, type ViewportElement, type ViewportEventData, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, type WebVitalType, type WebVitalsData, type WebVitalsMode, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
@@ -477,6 +477,24 @@ declare enum DeviceType {
477
477
  /** Unable to determine device type */
478
478
  Unknown = "unknown"
479
479
  }
480
+ /**
481
+ * Comprehensive device and environment information
482
+ *
483
+ * **Purpose**: Provides rich device context for analytics segmentation,
484
+ * debugging, and user experience optimization.
485
+ *
486
+ * **Detection**: Uses navigator.userAgentData (modern) with UA string fallback.
487
+ *
488
+ * @see src/utils/browser/device-detector.utils.ts for detection implementation
489
+ */
490
+ interface DeviceInfo {
491
+ /** Device form factor classification */
492
+ type: DeviceType;
493
+ /** OS name: "Windows", "macOS", "iOS", "Android", "Linux", "ChromeOS", "Unknown" */
494
+ os: string;
495
+ /** Browser name: "Chrome", "Firefox", "Safari", "Edge", "Opera", "Unknown" */
496
+ browser: string;
497
+ }
480
498
 
481
499
  /**
482
500
  * Event queue structure sent to backend.
@@ -489,7 +507,7 @@ interface EventsQueue {
489
507
  /** Current session identifier (UUID) */
490
508
  session_id: string;
491
509
  /** Device information (type, OS, browser) */
492
- device: DeviceType;
510
+ device: DeviceInfo;
493
511
  /** Array of events to send */
494
512
  events: EventData[];
495
513
  /** Optional metadata attached to all events in this batch */
@@ -568,13 +586,10 @@ declare class PermanentError extends Error {
568
586
  constructor(message: string, statusCode?: number | undefined);
569
587
  }
570
588
 
571
- /**
572
- * Log levels for the dual logging system
573
- */
574
- type LogLevel = 'CLIENT_ERROR' | 'CLIENT_WARN' | 'INFO' | 'ERROR' | 'WARN' | 'DEBUG' | 'VERBOSE';
575
-
576
589
  /**
577
590
  * App modes for the TraceLog Library
591
+ *
592
+ * - QA: Quality Assurance mode - logs custom events to console for verification
578
593
  */
579
594
  declare enum Mode {
580
595
  QA = "qa"
@@ -654,6 +669,7 @@ declare const isPrimaryScrollEvent: (event: EventData) => event is PrimaryScroll
654
669
  declare const isSecondaryScrollEvent: (event: EventData) => event is SecondaryScrollEvent;
655
670
 
656
671
  interface State {
672
+ /** QA mode flag - when true, custom events are logged to console */
657
673
  mode?: Mode;
658
674
  /**
659
675
  * Collection of API URLs for different integrations.
@@ -667,7 +683,7 @@ interface State {
667
683
  config: Config;
668
684
  sessionId: string | null;
669
685
  userId: string;
670
- device: DeviceType;
686
+ device: DeviceInfo;
671
687
  pageUrl: string;
672
688
  hasStartSession: boolean;
673
689
  suppressNextScroll: boolean;
@@ -1306,7 +1322,7 @@ declare class EventManager extends StateManager {
1306
1322
  *
1307
1323
  * @see src/managers/README.md (lines 5-75) for detailed tracking logic
1308
1324
  */
1309
- track({ type, page_url, from_page_url, scroll_data, click_data, custom_event, web_vitals, error_data, viewport_data, }: Partial<EventData>): void;
1325
+ track({ type, page_url, from_page_url, scroll_data, click_data, custom_event, web_vitals, error_data, viewport_data, page_view, }: Partial<EventData>): void;
1310
1326
  /**
1311
1327
  * Stops event tracking and clears all queues and buffers.
1312
1328
  *
@@ -2429,4 +2445,4 @@ declare const tracelog: {
2429
2445
  mergeGlobalMetadata: (metadata: Record<string, MetadataType>) => void;
2430
2446
  };
2431
2447
 
2432
- export { AppConfigValidationError, type BeforeBatchTransformer, type BeforeSendTransformer, type ClickCoordinates, type ClickData, type ClickTrackingElementData, type Config, type CustomEventData, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, DeviceType, type EmitterCallback, EmitterEvent, type EmitterMap, type ErrorData, ErrorType, type EventData, EventType, type EventTypeName, type EventsQueue, InitializationTimeoutError, IntegrationValidationError, type LogLevel, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_METADATA_NESTING_DEPTH, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, type MetadataType, Mode, PII_PATTERNS, type PageViewData, PermanentError, type PersistedEventsQueue, type PrimaryScrollEvent, SamplingRateValidationError, type ScrollData, ScrollDirection, type SecondaryScrollEvent, type SessionEventCounts, SessionTimeoutValidationError, SpecialApiUrl, type State, type TraceLogTestBridge, TraceLogValidationError, type TransformerHook, type TransformerMap, type UTM, type ViewportConfig, type ViewportElement, type ViewportEventData, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, type WebVitalType, type WebVitalsData, type WebVitalsMode, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
2448
+ export { AppConfigValidationError, type BeforeBatchTransformer, type BeforeSendTransformer, type ClickCoordinates, type ClickData, type ClickTrackingElementData, type Config, type CustomEventData, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, type DeviceInfo, DeviceType, type EmitterCallback, EmitterEvent, type EmitterMap, type ErrorData, ErrorType, type EventData, EventType, type EventTypeName, type EventsQueue, InitializationTimeoutError, IntegrationValidationError, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_METADATA_NESTING_DEPTH, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, type MetadataType, Mode, PII_PATTERNS, type PageViewData, PermanentError, type PersistedEventsQueue, type PrimaryScrollEvent, SamplingRateValidationError, type ScrollData, ScrollDirection, type SecondaryScrollEvent, type SessionEventCounts, SessionTimeoutValidationError, SpecialApiUrl, type State, type TraceLogTestBridge, TraceLogValidationError, type TransformerHook, type TransformerMap, type UTM, type ViewportConfig, type ViewportElement, type ViewportEventData, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, type WebVitalType, type WebVitalsData, type WebVitalsMode, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };