@tracelog/lib 2.0.2 → 2.0.3-rc.73.6
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.
Potentially problematic release.
This version of @tracelog/lib might be problematic. Click here for more details.
- package/README.md +70 -25
- package/dist/browser/tracelog.esm.js +915 -874
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +1 -1
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/public-api.cjs +253 -177
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +83 -86
- package/dist/public-api.d.ts +83 -86
- package/dist/public-api.js +253 -177
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
package/dist/public-api.d.mts
CHANGED
|
@@ -390,72 +390,6 @@ interface EventData {
|
|
|
390
390
|
utm?: UTM;
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
-
/**
|
|
394
|
-
* Consolidated configuration constants for TraceLog
|
|
395
|
-
* This file centralizes all timing, limits, browser, and initialization constants
|
|
396
|
-
*/
|
|
397
|
-
declare const DEFAULT_SESSION_TIMEOUT: number;
|
|
398
|
-
declare const MAX_CUSTOM_EVENT_NAME_LENGTH = 120;
|
|
399
|
-
declare const MAX_CUSTOM_EVENT_STRING_SIZE: number;
|
|
400
|
-
declare const MAX_CUSTOM_EVENT_KEYS = 10;
|
|
401
|
-
declare const MAX_CUSTOM_EVENT_ARRAY_SIZE = 10;
|
|
402
|
-
declare const MAX_NESTED_OBJECT_KEYS = 20;
|
|
403
|
-
declare const MAX_METADATA_NESTING_DEPTH = 1;
|
|
404
|
-
declare const MAX_STRING_LENGTH = 1000;
|
|
405
|
-
declare const MAX_STRING_LENGTH_IN_ARRAY = 500;
|
|
406
|
-
declare const MAX_ARRAY_LENGTH = 100;
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Event types that can be disabled from auto-tracking
|
|
410
|
-
* Core events (PAGE_VIEW, CLICK, SESSION_*) cannot be disabled as they are essential for analytics
|
|
411
|
-
*/
|
|
412
|
-
declare const DISABLEABLE_EVENT_TYPES: readonly ["scroll", "web_vitals", "error"];
|
|
413
|
-
type DisabledEventType = (typeof DISABLEABLE_EVENT_TYPES)[number];
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Error handling and PII sanitization constants for TraceLog
|
|
417
|
-
* Centralizes patterns and limits for error tracking and data protection
|
|
418
|
-
*/
|
|
419
|
-
/**
|
|
420
|
-
* Regular expressions for detecting and sanitizing Personally Identifiable Information (PII)
|
|
421
|
-
* These patterns are used to replace sensitive information with [REDACTED] in error messages
|
|
422
|
-
*/
|
|
423
|
-
declare const PII_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* Performance monitoring and web vitals constants for TraceLog
|
|
427
|
-
* Centralizes thresholds and configuration for performance tracking
|
|
428
|
-
*/
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Web Vitals "good" thresholds (75th percentile boundaries)
|
|
432
|
-
* Metrics below or equal to these values are considered good performance.
|
|
433
|
-
* Reference: https://web.dev/articles/vitals
|
|
434
|
-
*/
|
|
435
|
-
declare const WEB_VITALS_GOOD_THRESHOLDS: Record<WebVitalType, number>;
|
|
436
|
-
/**
|
|
437
|
-
* Web Vitals "needs improvement" thresholds
|
|
438
|
-
* Metrics exceeding these values need attention but aren't critically poor.
|
|
439
|
-
* Reference: https://web.dev/articles/vitals
|
|
440
|
-
*/
|
|
441
|
-
declare const WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS: Record<WebVitalType, number>;
|
|
442
|
-
/**
|
|
443
|
-
* Web Vitals "poor" thresholds
|
|
444
|
-
* Metrics exceeding these values indicate poor performance requiring immediate attention.
|
|
445
|
-
* Reference: https://web.dev/articles/vitals
|
|
446
|
-
*/
|
|
447
|
-
declare const WEB_VITALS_POOR_THRESHOLDS: Record<WebVitalType, number>;
|
|
448
|
-
/**
|
|
449
|
-
* Default Web Vitals mode
|
|
450
|
-
* 'needs-improvement' provides balanced approach - captures metrics that need attention
|
|
451
|
-
* while filtering out good performance (reduces noise and costs)
|
|
452
|
-
*/
|
|
453
|
-
declare const DEFAULT_WEB_VITALS_MODE: WebVitalsMode;
|
|
454
|
-
/**
|
|
455
|
-
* Get Web Vitals thresholds for the specified mode
|
|
456
|
-
*/
|
|
457
|
-
declare const getWebVitalsThresholds: (mode?: WebVitalsMode) => Record<WebVitalType, number>;
|
|
458
|
-
|
|
459
393
|
/**
|
|
460
394
|
* Web Vitals filtering mode
|
|
461
395
|
* - 'all': Track all Web Vitals metrics (full analytics)
|
|
@@ -496,18 +430,6 @@ interface Config {
|
|
|
496
430
|
* Only applies when webVitalsMode is set. Overrides default thresholds for the selected mode.
|
|
497
431
|
*/
|
|
498
432
|
webVitalsThresholds?: Partial<Record<WebVitalType, number>>;
|
|
499
|
-
/**
|
|
500
|
-
* Event types to disable from auto-tracking.
|
|
501
|
-
* Core events (PAGE_VIEW, CLICK, SESSION_*) cannot be disabled as they are essential for analytics.
|
|
502
|
-
* @default []
|
|
503
|
-
* @example
|
|
504
|
-
* // Disable scroll tracking only
|
|
505
|
-
* disabledEvents: ['scroll']
|
|
506
|
-
* @example
|
|
507
|
-
* // Disable performance and error tracking
|
|
508
|
-
* disabledEvents: ['web_vitals', 'error']
|
|
509
|
-
*/
|
|
510
|
-
disabledEvents?: DisabledEventType[];
|
|
511
433
|
/** Optional configuration for third-party integrations. */
|
|
512
434
|
integrations?: {
|
|
513
435
|
/** TraceLog integration options. */
|
|
@@ -555,6 +477,24 @@ declare enum DeviceType {
|
|
|
555
477
|
/** Unable to determine device type */
|
|
556
478
|
Unknown = "unknown"
|
|
557
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
|
+
}
|
|
558
498
|
|
|
559
499
|
/**
|
|
560
500
|
* Event queue structure sent to backend.
|
|
@@ -567,7 +507,7 @@ interface EventsQueue {
|
|
|
567
507
|
/** Current session identifier (UUID) */
|
|
568
508
|
session_id: string;
|
|
569
509
|
/** Device information (type, OS, browser) */
|
|
570
|
-
device:
|
|
510
|
+
device: DeviceInfo;
|
|
571
511
|
/** Array of events to send */
|
|
572
512
|
events: EventData[];
|
|
573
513
|
/** Optional metadata attached to all events in this batch */
|
|
@@ -646,13 +586,10 @@ declare class PermanentError extends Error {
|
|
|
646
586
|
constructor(message: string, statusCode?: number | undefined);
|
|
647
587
|
}
|
|
648
588
|
|
|
649
|
-
/**
|
|
650
|
-
* Log levels for the dual logging system
|
|
651
|
-
*/
|
|
652
|
-
type LogLevel = 'CLIENT_ERROR' | 'CLIENT_WARN' | 'INFO' | 'ERROR' | 'WARN' | 'DEBUG' | 'VERBOSE';
|
|
653
|
-
|
|
654
589
|
/**
|
|
655
590
|
* App modes for the TraceLog Library
|
|
591
|
+
*
|
|
592
|
+
* - QA: Quality Assurance mode - logs custom events to console for verification
|
|
656
593
|
*/
|
|
657
594
|
declare enum Mode {
|
|
658
595
|
QA = "qa"
|
|
@@ -732,6 +669,7 @@ declare const isPrimaryScrollEvent: (event: EventData) => event is PrimaryScroll
|
|
|
732
669
|
declare const isSecondaryScrollEvent: (event: EventData) => event is SecondaryScrollEvent;
|
|
733
670
|
|
|
734
671
|
interface State {
|
|
672
|
+
/** QA mode flag - when true, custom events are logged to console */
|
|
735
673
|
mode?: Mode;
|
|
736
674
|
/**
|
|
737
675
|
* Collection of API URLs for different integrations.
|
|
@@ -745,7 +683,7 @@ interface State {
|
|
|
745
683
|
config: Config;
|
|
746
684
|
sessionId: string | null;
|
|
747
685
|
userId: string;
|
|
748
|
-
device:
|
|
686
|
+
device: DeviceInfo;
|
|
749
687
|
pageUrl: string;
|
|
750
688
|
hasStartSession: boolean;
|
|
751
689
|
suppressNextScroll: boolean;
|
|
@@ -2434,6 +2372,65 @@ declare global {
|
|
|
2434
2372
|
declare function setTransformer(hook: 'beforeSend', fn: BeforeSendTransformer): void;
|
|
2435
2373
|
declare function setTransformer(hook: 'beforeBatch', fn: BeforeBatchTransformer): void;
|
|
2436
2374
|
|
|
2375
|
+
/**
|
|
2376
|
+
* Consolidated configuration constants for TraceLog
|
|
2377
|
+
* This file centralizes all timing, limits, browser, and initialization constants
|
|
2378
|
+
*/
|
|
2379
|
+
declare const DEFAULT_SESSION_TIMEOUT: number;
|
|
2380
|
+
declare const MAX_CUSTOM_EVENT_NAME_LENGTH = 120;
|
|
2381
|
+
declare const MAX_CUSTOM_EVENT_STRING_SIZE: number;
|
|
2382
|
+
declare const MAX_CUSTOM_EVENT_KEYS = 10;
|
|
2383
|
+
declare const MAX_CUSTOM_EVENT_ARRAY_SIZE = 10;
|
|
2384
|
+
declare const MAX_NESTED_OBJECT_KEYS = 20;
|
|
2385
|
+
declare const MAX_METADATA_NESTING_DEPTH = 1;
|
|
2386
|
+
declare const MAX_STRING_LENGTH = 1000;
|
|
2387
|
+
declare const MAX_STRING_LENGTH_IN_ARRAY = 500;
|
|
2388
|
+
declare const MAX_ARRAY_LENGTH = 100;
|
|
2389
|
+
|
|
2390
|
+
/**
|
|
2391
|
+
* Error handling and PII sanitization constants for TraceLog
|
|
2392
|
+
* Centralizes patterns and limits for error tracking and data protection
|
|
2393
|
+
*/
|
|
2394
|
+
/**
|
|
2395
|
+
* Regular expressions for detecting and sanitizing Personally Identifiable Information (PII)
|
|
2396
|
+
* These patterns are used to replace sensitive information with [REDACTED] in error messages
|
|
2397
|
+
*/
|
|
2398
|
+
declare const PII_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
2399
|
+
|
|
2400
|
+
/**
|
|
2401
|
+
* Performance monitoring and web vitals constants for TraceLog
|
|
2402
|
+
* Centralizes thresholds and configuration for performance tracking
|
|
2403
|
+
*/
|
|
2404
|
+
|
|
2405
|
+
/**
|
|
2406
|
+
* Web Vitals "good" thresholds (75th percentile boundaries)
|
|
2407
|
+
* Metrics below or equal to these values are considered good performance.
|
|
2408
|
+
* Reference: https://web.dev/articles/vitals
|
|
2409
|
+
*/
|
|
2410
|
+
declare const WEB_VITALS_GOOD_THRESHOLDS: Record<WebVitalType, number>;
|
|
2411
|
+
/**
|
|
2412
|
+
* Web Vitals "needs improvement" thresholds
|
|
2413
|
+
* Metrics exceeding these values need attention but aren't critically poor.
|
|
2414
|
+
* Reference: https://web.dev/articles/vitals
|
|
2415
|
+
*/
|
|
2416
|
+
declare const WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS: Record<WebVitalType, number>;
|
|
2417
|
+
/**
|
|
2418
|
+
* Web Vitals "poor" thresholds
|
|
2419
|
+
* Metrics exceeding these values indicate poor performance requiring immediate attention.
|
|
2420
|
+
* Reference: https://web.dev/articles/vitals
|
|
2421
|
+
*/
|
|
2422
|
+
declare const WEB_VITALS_POOR_THRESHOLDS: Record<WebVitalType, number>;
|
|
2423
|
+
/**
|
|
2424
|
+
* Default Web Vitals mode
|
|
2425
|
+
* 'needs-improvement' provides balanced approach - captures metrics that need attention
|
|
2426
|
+
* while filtering out good performance (reduces noise and costs)
|
|
2427
|
+
*/
|
|
2428
|
+
declare const DEFAULT_WEB_VITALS_MODE: WebVitalsMode;
|
|
2429
|
+
/**
|
|
2430
|
+
* Get Web Vitals thresholds for the specified mode
|
|
2431
|
+
*/
|
|
2432
|
+
declare const getWebVitalsThresholds: (mode?: WebVitalsMode) => Record<WebVitalType, number>;
|
|
2433
|
+
|
|
2437
2434
|
declare const tracelog: {
|
|
2438
2435
|
init: (config?: Config) => Promise<void>;
|
|
2439
2436
|
event: (name: string, metadata?: Record<string, MetadataType> | Record<string, MetadataType>[]) => void;
|
|
@@ -2448,4 +2445,4 @@ declare const tracelog: {
|
|
|
2448
2445
|
mergeGlobalMetadata: (metadata: Record<string, MetadataType>) => void;
|
|
2449
2446
|
};
|
|
2450
2447
|
|
|
2451
|
-
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,
|
|
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 };
|
package/dist/public-api.d.ts
CHANGED
|
@@ -390,72 +390,6 @@ interface EventData {
|
|
|
390
390
|
utm?: UTM;
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
-
/**
|
|
394
|
-
* Consolidated configuration constants for TraceLog
|
|
395
|
-
* This file centralizes all timing, limits, browser, and initialization constants
|
|
396
|
-
*/
|
|
397
|
-
declare const DEFAULT_SESSION_TIMEOUT: number;
|
|
398
|
-
declare const MAX_CUSTOM_EVENT_NAME_LENGTH = 120;
|
|
399
|
-
declare const MAX_CUSTOM_EVENT_STRING_SIZE: number;
|
|
400
|
-
declare const MAX_CUSTOM_EVENT_KEYS = 10;
|
|
401
|
-
declare const MAX_CUSTOM_EVENT_ARRAY_SIZE = 10;
|
|
402
|
-
declare const MAX_NESTED_OBJECT_KEYS = 20;
|
|
403
|
-
declare const MAX_METADATA_NESTING_DEPTH = 1;
|
|
404
|
-
declare const MAX_STRING_LENGTH = 1000;
|
|
405
|
-
declare const MAX_STRING_LENGTH_IN_ARRAY = 500;
|
|
406
|
-
declare const MAX_ARRAY_LENGTH = 100;
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Event types that can be disabled from auto-tracking
|
|
410
|
-
* Core events (PAGE_VIEW, CLICK, SESSION_*) cannot be disabled as they are essential for analytics
|
|
411
|
-
*/
|
|
412
|
-
declare const DISABLEABLE_EVENT_TYPES: readonly ["scroll", "web_vitals", "error"];
|
|
413
|
-
type DisabledEventType = (typeof DISABLEABLE_EVENT_TYPES)[number];
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Error handling and PII sanitization constants for TraceLog
|
|
417
|
-
* Centralizes patterns and limits for error tracking and data protection
|
|
418
|
-
*/
|
|
419
|
-
/**
|
|
420
|
-
* Regular expressions for detecting and sanitizing Personally Identifiable Information (PII)
|
|
421
|
-
* These patterns are used to replace sensitive information with [REDACTED] in error messages
|
|
422
|
-
*/
|
|
423
|
-
declare const PII_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* Performance monitoring and web vitals constants for TraceLog
|
|
427
|
-
* Centralizes thresholds and configuration for performance tracking
|
|
428
|
-
*/
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Web Vitals "good" thresholds (75th percentile boundaries)
|
|
432
|
-
* Metrics below or equal to these values are considered good performance.
|
|
433
|
-
* Reference: https://web.dev/articles/vitals
|
|
434
|
-
*/
|
|
435
|
-
declare const WEB_VITALS_GOOD_THRESHOLDS: Record<WebVitalType, number>;
|
|
436
|
-
/**
|
|
437
|
-
* Web Vitals "needs improvement" thresholds
|
|
438
|
-
* Metrics exceeding these values need attention but aren't critically poor.
|
|
439
|
-
* Reference: https://web.dev/articles/vitals
|
|
440
|
-
*/
|
|
441
|
-
declare const WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS: Record<WebVitalType, number>;
|
|
442
|
-
/**
|
|
443
|
-
* Web Vitals "poor" thresholds
|
|
444
|
-
* Metrics exceeding these values indicate poor performance requiring immediate attention.
|
|
445
|
-
* Reference: https://web.dev/articles/vitals
|
|
446
|
-
*/
|
|
447
|
-
declare const WEB_VITALS_POOR_THRESHOLDS: Record<WebVitalType, number>;
|
|
448
|
-
/**
|
|
449
|
-
* Default Web Vitals mode
|
|
450
|
-
* 'needs-improvement' provides balanced approach - captures metrics that need attention
|
|
451
|
-
* while filtering out good performance (reduces noise and costs)
|
|
452
|
-
*/
|
|
453
|
-
declare const DEFAULT_WEB_VITALS_MODE: WebVitalsMode;
|
|
454
|
-
/**
|
|
455
|
-
* Get Web Vitals thresholds for the specified mode
|
|
456
|
-
*/
|
|
457
|
-
declare const getWebVitalsThresholds: (mode?: WebVitalsMode) => Record<WebVitalType, number>;
|
|
458
|
-
|
|
459
393
|
/**
|
|
460
394
|
* Web Vitals filtering mode
|
|
461
395
|
* - 'all': Track all Web Vitals metrics (full analytics)
|
|
@@ -496,18 +430,6 @@ interface Config {
|
|
|
496
430
|
* Only applies when webVitalsMode is set. Overrides default thresholds for the selected mode.
|
|
497
431
|
*/
|
|
498
432
|
webVitalsThresholds?: Partial<Record<WebVitalType, number>>;
|
|
499
|
-
/**
|
|
500
|
-
* Event types to disable from auto-tracking.
|
|
501
|
-
* Core events (PAGE_VIEW, CLICK, SESSION_*) cannot be disabled as they are essential for analytics.
|
|
502
|
-
* @default []
|
|
503
|
-
* @example
|
|
504
|
-
* // Disable scroll tracking only
|
|
505
|
-
* disabledEvents: ['scroll']
|
|
506
|
-
* @example
|
|
507
|
-
* // Disable performance and error tracking
|
|
508
|
-
* disabledEvents: ['web_vitals', 'error']
|
|
509
|
-
*/
|
|
510
|
-
disabledEvents?: DisabledEventType[];
|
|
511
433
|
/** Optional configuration for third-party integrations. */
|
|
512
434
|
integrations?: {
|
|
513
435
|
/** TraceLog integration options. */
|
|
@@ -555,6 +477,24 @@ declare enum DeviceType {
|
|
|
555
477
|
/** Unable to determine device type */
|
|
556
478
|
Unknown = "unknown"
|
|
557
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
|
+
}
|
|
558
498
|
|
|
559
499
|
/**
|
|
560
500
|
* Event queue structure sent to backend.
|
|
@@ -567,7 +507,7 @@ interface EventsQueue {
|
|
|
567
507
|
/** Current session identifier (UUID) */
|
|
568
508
|
session_id: string;
|
|
569
509
|
/** Device information (type, OS, browser) */
|
|
570
|
-
device:
|
|
510
|
+
device: DeviceInfo;
|
|
571
511
|
/** Array of events to send */
|
|
572
512
|
events: EventData[];
|
|
573
513
|
/** Optional metadata attached to all events in this batch */
|
|
@@ -646,13 +586,10 @@ declare class PermanentError extends Error {
|
|
|
646
586
|
constructor(message: string, statusCode?: number | undefined);
|
|
647
587
|
}
|
|
648
588
|
|
|
649
|
-
/**
|
|
650
|
-
* Log levels for the dual logging system
|
|
651
|
-
*/
|
|
652
|
-
type LogLevel = 'CLIENT_ERROR' | 'CLIENT_WARN' | 'INFO' | 'ERROR' | 'WARN' | 'DEBUG' | 'VERBOSE';
|
|
653
|
-
|
|
654
589
|
/**
|
|
655
590
|
* App modes for the TraceLog Library
|
|
591
|
+
*
|
|
592
|
+
* - QA: Quality Assurance mode - logs custom events to console for verification
|
|
656
593
|
*/
|
|
657
594
|
declare enum Mode {
|
|
658
595
|
QA = "qa"
|
|
@@ -732,6 +669,7 @@ declare const isPrimaryScrollEvent: (event: EventData) => event is PrimaryScroll
|
|
|
732
669
|
declare const isSecondaryScrollEvent: (event: EventData) => event is SecondaryScrollEvent;
|
|
733
670
|
|
|
734
671
|
interface State {
|
|
672
|
+
/** QA mode flag - when true, custom events are logged to console */
|
|
735
673
|
mode?: Mode;
|
|
736
674
|
/**
|
|
737
675
|
* Collection of API URLs for different integrations.
|
|
@@ -745,7 +683,7 @@ interface State {
|
|
|
745
683
|
config: Config;
|
|
746
684
|
sessionId: string | null;
|
|
747
685
|
userId: string;
|
|
748
|
-
device:
|
|
686
|
+
device: DeviceInfo;
|
|
749
687
|
pageUrl: string;
|
|
750
688
|
hasStartSession: boolean;
|
|
751
689
|
suppressNextScroll: boolean;
|
|
@@ -2434,6 +2372,65 @@ declare global {
|
|
|
2434
2372
|
declare function setTransformer(hook: 'beforeSend', fn: BeforeSendTransformer): void;
|
|
2435
2373
|
declare function setTransformer(hook: 'beforeBatch', fn: BeforeBatchTransformer): void;
|
|
2436
2374
|
|
|
2375
|
+
/**
|
|
2376
|
+
* Consolidated configuration constants for TraceLog
|
|
2377
|
+
* This file centralizes all timing, limits, browser, and initialization constants
|
|
2378
|
+
*/
|
|
2379
|
+
declare const DEFAULT_SESSION_TIMEOUT: number;
|
|
2380
|
+
declare const MAX_CUSTOM_EVENT_NAME_LENGTH = 120;
|
|
2381
|
+
declare const MAX_CUSTOM_EVENT_STRING_SIZE: number;
|
|
2382
|
+
declare const MAX_CUSTOM_EVENT_KEYS = 10;
|
|
2383
|
+
declare const MAX_CUSTOM_EVENT_ARRAY_SIZE = 10;
|
|
2384
|
+
declare const MAX_NESTED_OBJECT_KEYS = 20;
|
|
2385
|
+
declare const MAX_METADATA_NESTING_DEPTH = 1;
|
|
2386
|
+
declare const MAX_STRING_LENGTH = 1000;
|
|
2387
|
+
declare const MAX_STRING_LENGTH_IN_ARRAY = 500;
|
|
2388
|
+
declare const MAX_ARRAY_LENGTH = 100;
|
|
2389
|
+
|
|
2390
|
+
/**
|
|
2391
|
+
* Error handling and PII sanitization constants for TraceLog
|
|
2392
|
+
* Centralizes patterns and limits for error tracking and data protection
|
|
2393
|
+
*/
|
|
2394
|
+
/**
|
|
2395
|
+
* Regular expressions for detecting and sanitizing Personally Identifiable Information (PII)
|
|
2396
|
+
* These patterns are used to replace sensitive information with [REDACTED] in error messages
|
|
2397
|
+
*/
|
|
2398
|
+
declare const PII_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
2399
|
+
|
|
2400
|
+
/**
|
|
2401
|
+
* Performance monitoring and web vitals constants for TraceLog
|
|
2402
|
+
* Centralizes thresholds and configuration for performance tracking
|
|
2403
|
+
*/
|
|
2404
|
+
|
|
2405
|
+
/**
|
|
2406
|
+
* Web Vitals "good" thresholds (75th percentile boundaries)
|
|
2407
|
+
* Metrics below or equal to these values are considered good performance.
|
|
2408
|
+
* Reference: https://web.dev/articles/vitals
|
|
2409
|
+
*/
|
|
2410
|
+
declare const WEB_VITALS_GOOD_THRESHOLDS: Record<WebVitalType, number>;
|
|
2411
|
+
/**
|
|
2412
|
+
* Web Vitals "needs improvement" thresholds
|
|
2413
|
+
* Metrics exceeding these values need attention but aren't critically poor.
|
|
2414
|
+
* Reference: https://web.dev/articles/vitals
|
|
2415
|
+
*/
|
|
2416
|
+
declare const WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS: Record<WebVitalType, number>;
|
|
2417
|
+
/**
|
|
2418
|
+
* Web Vitals "poor" thresholds
|
|
2419
|
+
* Metrics exceeding these values indicate poor performance requiring immediate attention.
|
|
2420
|
+
* Reference: https://web.dev/articles/vitals
|
|
2421
|
+
*/
|
|
2422
|
+
declare const WEB_VITALS_POOR_THRESHOLDS: Record<WebVitalType, number>;
|
|
2423
|
+
/**
|
|
2424
|
+
* Default Web Vitals mode
|
|
2425
|
+
* 'needs-improvement' provides balanced approach - captures metrics that need attention
|
|
2426
|
+
* while filtering out good performance (reduces noise and costs)
|
|
2427
|
+
*/
|
|
2428
|
+
declare const DEFAULT_WEB_VITALS_MODE: WebVitalsMode;
|
|
2429
|
+
/**
|
|
2430
|
+
* Get Web Vitals thresholds for the specified mode
|
|
2431
|
+
*/
|
|
2432
|
+
declare const getWebVitalsThresholds: (mode?: WebVitalsMode) => Record<WebVitalType, number>;
|
|
2433
|
+
|
|
2437
2434
|
declare const tracelog: {
|
|
2438
2435
|
init: (config?: Config) => Promise<void>;
|
|
2439
2436
|
event: (name: string, metadata?: Record<string, MetadataType> | Record<string, MetadataType>[]) => void;
|
|
@@ -2448,4 +2445,4 @@ declare const tracelog: {
|
|
|
2448
2445
|
mergeGlobalMetadata: (metadata: Record<string, MetadataType>) => void;
|
|
2449
2446
|
};
|
|
2450
2447
|
|
|
2451
|
-
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,
|
|
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 };
|