@rudderstack/analytics-js 3.21.0-beta.pr.2309.bb541e7 → 3.22.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/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [3.22.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.21.0...@rudderstack/analytics-js@3.22.0) (2025-07-21)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@rudderstack/analytics-js-cookies` updated to version `0.5.0`
10
+ * `@rudderstack/analytics-js-common` updated to version `3.22.0`
11
+ * `@rudderstack/analytics-js-plugins` updated to version `3.11.0`
12
+
13
+ ### Features
14
+
15
+ * add legacy utils package ([#2323](https://github.com/rudderlabs/rudder-sdk-js/issues/2323)) ([32a90c4](https://github.com/rudderlabs/rudder-sdk-js/commit/32a90c4417b747f4da2b1027249ccfbab1d075fd))
16
+ * categorize integration errors ([#2331](https://github.com/rudderlabs/rudder-sdk-js/issues/2331)) ([c64df64](https://github.com/rudderlabs/rudder-sdk-js/commit/c64df64a585108dafc2cbd459806ab3506395dc7))
17
+ * relocate destination constants ([#2325](https://github.com/rudderlabs/rudder-sdk-js/issues/2325)) ([0a421ae](https://github.com/rudderlabs/rudder-sdk-js/commit/0a421ae9f5c38556a3fa9487f16cdcea66921064))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * error handle property access and instance mutation ([#2316](https://github.com/rudderlabs/rudder-sdk-js/issues/2316)) ([99f2788](https://github.com/rudderlabs/rudder-sdk-js/commit/99f278812ee832350e7a0afc807bf38d86bdce9f))
23
+ * remove unnecessary bugsnag dependency in declaration files ([#2341](https://github.com/rudderlabs/rudder-sdk-js/issues/2341)) ([0e17aa2](https://github.com/rudderlabs/rudder-sdk-js/commit/0e17aa2651697f3d8a37d729704bf1530ebe925f))
24
+
5
25
  ## [3.21.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.20.1...@rudderstack/analytics-js@3.21.0) (2025-06-20)
6
26
 
7
27
  ### Dependency Updates
@@ -1,5 +1,3 @@
1
- import { Event } from '@bugsnag/js';
2
-
3
1
  type LoggerProvider$1 = Record<Exclude<Lowercase<LogLevel>, Lowercase<'NONE'>>, (...data: any[]) => void>;
4
2
  interface ILogger {
5
3
  minLogLevel: number;
@@ -14,7 +12,6 @@ interface ILogger {
14
12
  setMinLogLevel(logLevel: LogLevel): void;
15
13
  }
16
14
  type LogLevel = 'LOG' | 'INFO' | 'DEBUG' | 'WARN' | 'ERROR' | 'NONE';
17
- type RSALogger = Pick<ILogger, 'log' | 'info' | 'debug' | 'warn' | 'error' | 'setMinLogLevel'>;
18
15
 
19
16
  type LoggerProvider = Record<Exclude<Lowercase<LogLevel>, Lowercase<'NONE'>>, (...data: any[]) => void>;
20
17
 
@@ -63,7 +60,6 @@ type IntegrationOpts = {
63
60
  [index: string]: DestinationIntgConfig;
64
61
  };
65
62
 
66
- type Traits = Nullable<ApiObject>;
67
63
  type ApiCallback = (data?: any) => void;
68
64
  /**
69
65
  * Represents the options parameter in the APIs
@@ -163,11 +159,6 @@ type CookieSameSite = 'Strict' | 'Lax' | 'None';
163
159
  type OneTrustCookieCategory = {
164
160
  oneTrustCookieCategory: string;
165
161
  };
166
- type ConsentManagement = {
167
- deniedConsentIds: Consents;
168
- allowedConsentIds: Consents;
169
- provider: ConsentManagementProvider;
170
- };
171
162
  type ConsentManagementMetadata = {
172
163
  providers: ConsentManagementProviderMetadata[];
173
164
  };
@@ -428,76 +419,6 @@ type IdentifyTraits = {
428
419
  [index: string]: string | number | boolean | ApiObject | null | Date | (string | number | boolean | null | Date | ApiObject)[] | undefined;
429
420
  };
430
421
 
431
- type AppInfo = {
432
- readonly name: string;
433
- readonly version: string;
434
- readonly namespace: string;
435
- readonly installType: string;
436
- };
437
- type LibraryInfo = {
438
- readonly name: string;
439
- readonly version: string;
440
- readonly snippetVersion?: string;
441
- };
442
- type OSInfo = {
443
- readonly name: string;
444
- readonly version: string;
445
- };
446
- type ScreenInfo = {
447
- readonly density: number;
448
- readonly width: number;
449
- readonly height: number;
450
- readonly innerWidth: number;
451
- readonly innerHeight: number;
452
- };
453
- type UTMParameters = Record<string, string>;
454
-
455
- type PageLifecycle = {
456
- pageViewId: string;
457
- };
458
- type AutoTrack = {
459
- page: PageLifecycle;
460
- };
461
- type RudderContext = {
462
- [index: string]: string | number | boolean | ApiObject | UADataValues | Nullable<string> | (string | number | boolean | ApiObject)[] | undefined;
463
- traits?: Nullable<ApiObject>;
464
- sessionId?: number;
465
- sessionStart?: boolean;
466
- consentManagement?: ConsentManagement;
467
- 'ua-ch'?: UADataValues;
468
- app: AppInfo;
469
- library: LibraryInfo;
470
- userAgent: Nullable<string>;
471
- os: OSInfo;
472
- locale: Nullable<string>;
473
- screen: ScreenInfo;
474
- campaign?: UTMParameters;
475
- trulyAnonymousTracking?: boolean;
476
- timezone: string;
477
- autoTrack?: AutoTrack;
478
- };
479
- type RudderEvent = {
480
- type: RudderEventType;
481
- channel: string;
482
- anonymousId: string;
483
- context: RudderContext;
484
- originalTimestamp: string;
485
- integrations: IntegrationOpts;
486
- messageId: string;
487
- event: Nullable<string>;
488
- previousId?: string;
489
- userId?: Nullable<string>;
490
- sentAt?: string;
491
- properties?: Nullable<ApiObject>;
492
- name?: Nullable<string>;
493
- category?: Nullable<string>;
494
- traits?: Traits;
495
- groupId?: Nullable<string>;
496
- };
497
- type RSAEvent = {
498
- message: RudderEvent;
499
- };
500
-
501
422
  type AnalyticsIdentifyMethod = {
502
423
  (userId: string, traits?: Nullable<IdentifyTraits>, options?: Nullable<ApiOptions>, callback?: ApiCallback): void;
503
424
  (userId: string, traits?: Nullable<IdentifyTraits>, callback?: ApiCallback): void;
@@ -635,75 +556,7 @@ interface IRudderAnalytics<T = any> {
635
556
  * @param options Consent API options
636
557
  */
637
558
  consent(options?: ConsentOptions): void;
638
- /**
639
- * To add a custom integration
640
- * @param name The name of the custom integration
641
- * @param integration The custom integration object
642
- */
643
- addCustomIntegration(name: string, integration: RSACustomIntegration): void;
644
559
  }
645
- type RSAnalytics = Pick<IRudderAnalytics, 'track' | 'page' | 'identify' | 'group' | 'alias' | 'getAnonymousId' | 'getUserId' | 'getUserTraits' | 'getGroupId' | 'getGroupTraits' | 'getSessionId'>;
646
- /**
647
- * Type for the custom integration to be used in addCustomIntegration API
648
- * Defines the contract that all custom integrations must implement
649
- */
650
- type RSACustomIntegration = {
651
- /**
652
- * Initialize the integration
653
- * @param analytics - The RudderStack analytics instance
654
- * @param logger - The logger instance for this integration
655
- * @optional
656
- */
657
- init?: (analytics: RSAnalytics, logger: RSALogger) => void;
658
- /**
659
- * Check if the integration is ready to process events
660
- * @param analytics - The RudderStack analytics instance
661
- * @param logger - The logger instance for this integration
662
- * @returns boolean indicating whether the integration is ready
663
- * @required
664
- */
665
- isReady: (analytics: RSAnalytics, logger: RSALogger) => boolean;
666
- /**
667
- * Process track events
668
- * @param analytics - The RudderStack analytics instance
669
- * @param logger - The logger instance for this integration
670
- * @param event - The track event payload to process
671
- * @optional
672
- */
673
- track?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
674
- /**
675
- * Process page events
676
- * @param analytics - The RudderStack analytics instance
677
- * @param logger - The logger instance for this integration
678
- * @param event - The page event payload to process
679
- * @optional
680
- */
681
- page?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
682
- /**
683
- * Process identify events
684
- * @param analytics - The RudderStack analytics instance
685
- * @param logger - The logger instance for this integration
686
- * @param event - The identify event payload to process
687
- * @optional
688
- */
689
- identify?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
690
- /**
691
- * Process group events
692
- * @param analytics - The RudderStack analytics instance
693
- * @param logger - The logger instance for this integration
694
- * @param event - The group event payload to process
695
- * @optional
696
- */
697
- group?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
698
- /**
699
- * Process alias events
700
- * @param analytics - The RudderStack analytics instance
701
- * @param logger - The logger instance for this integration
702
- * @param event - The alias event payload to process
703
- * @optional
704
- */
705
- alias?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
706
- };
707
560
 
708
561
  type SDKError = unknown | Error | ErrorEvent | Event | PromiseRejectionEvent;
709
562
  type ErrorInfo = {
@@ -712,6 +565,7 @@ type ErrorInfo = {
712
565
  customMessage?: string;
713
566
  errorType?: ErrorType;
714
567
  groupingHash?: string | SDKError;
568
+ category?: 'sdk' | 'integrations';
715
569
  };
716
570
  interface IErrorHandler {
717
571
  httpClient: IHttpClient;
@@ -1278,13 +1132,6 @@ interface IAnalytics {
1278
1132
  * To set auth token
1279
1133
  */
1280
1134
  setAuthToken(token: string): void;
1281
- /**
1282
- * Add a custom integration to the SDK
1283
- * @param name - Unique name for the custom integration
1284
- * @param integration - The custom integration instance implementing RSACustomIntegration
1285
- * @param isBufferedInvocation - Internal flag to indicate if this is a buffered call
1286
- */
1287
- addCustomIntegration(name: string, integration: RSACustomIntegration, isBufferedInvocation?: boolean): void;
1288
1135
  }
1289
1136
 
1290
1137
  declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
@@ -1293,12 +1140,6 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
1293
1140
  defaultAnalyticsKey: string;
1294
1141
  logger: Logger;
1295
1142
  constructor();
1296
- /**
1297
- * Create an instance of the current instance that can be used
1298
- * to call a subset of methods of the current instance.
1299
- * It is typically used to expose the analytics instance to the integrations (standard and custom)
1300
- */
1301
- createSafeAnalyticsInstance(): void;
1302
1143
  static initializeGlobalResources(): void;
1303
1144
  /**
1304
1145
  * Set instance to use if no specific writeKey is provided in methods
@@ -1393,7 +1234,6 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
1393
1234
  getSessionId(): Nullable<number> | undefined;
1394
1235
  setAuthToken(token: string): void;
1395
1236
  consent(options?: ConsentOptions): void;
1396
- addCustomIntegration(name: string, integration: RSACustomIntegration): void;
1397
1237
  }
1398
1238
  //# sourceMappingURL=RudderAnalytics.d.ts.map
1399
1239
 
@@ -1405,4 +1245,4 @@ declare global {
1405
1245
  //# sourceMappingURL=index.d.ts.map
1406
1246
 
1407
1247
  export { RudderAnalytics };
1408
- export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, DestinationsQueueOpts, IdentifyTraits, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RSACustomIntegration, RSAEvent, RSALogger, RSAnalytics, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };
1248
+ export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, DestinationsQueueOpts, IdentifyTraits, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };
@@ -1,5 +1,3 @@
1
- import { Event } from '@bugsnag/js';
2
-
3
1
  type LoggerProvider$1 = Record<Exclude<Lowercase<LogLevel>, Lowercase<'NONE'>>, (...data: any[]) => void>;
4
2
  interface ILogger {
5
3
  minLogLevel: number;
@@ -14,7 +12,6 @@ interface ILogger {
14
12
  setMinLogLevel(logLevel: LogLevel): void;
15
13
  }
16
14
  type LogLevel = 'LOG' | 'INFO' | 'DEBUG' | 'WARN' | 'ERROR' | 'NONE';
17
- type RSALogger = Pick<ILogger, 'log' | 'info' | 'debug' | 'warn' | 'error' | 'setMinLogLevel'>;
18
15
 
19
16
  type LoggerProvider = Record<Exclude<Lowercase<LogLevel>, Lowercase<'NONE'>>, (...data: any[]) => void>;
20
17
 
@@ -63,7 +60,6 @@ type IntegrationOpts = {
63
60
  [index: string]: DestinationIntgConfig;
64
61
  };
65
62
 
66
- type Traits = Nullable<ApiObject>;
67
63
  type ApiCallback = (data?: any) => void;
68
64
  /**
69
65
  * Represents the options parameter in the APIs
@@ -163,11 +159,6 @@ type CookieSameSite = 'Strict' | 'Lax' | 'None';
163
159
  type OneTrustCookieCategory = {
164
160
  oneTrustCookieCategory: string;
165
161
  };
166
- type ConsentManagement = {
167
- deniedConsentIds: Consents;
168
- allowedConsentIds: Consents;
169
- provider: ConsentManagementProvider;
170
- };
171
162
  type ConsentManagementMetadata = {
172
163
  providers: ConsentManagementProviderMetadata[];
173
164
  };
@@ -428,76 +419,6 @@ type IdentifyTraits = {
428
419
  [index: string]: string | number | boolean | ApiObject | null | Date | (string | number | boolean | null | Date | ApiObject)[] | undefined;
429
420
  };
430
421
 
431
- type AppInfo = {
432
- readonly name: string;
433
- readonly version: string;
434
- readonly namespace: string;
435
- readonly installType: string;
436
- };
437
- type LibraryInfo = {
438
- readonly name: string;
439
- readonly version: string;
440
- readonly snippetVersion?: string;
441
- };
442
- type OSInfo = {
443
- readonly name: string;
444
- readonly version: string;
445
- };
446
- type ScreenInfo = {
447
- readonly density: number;
448
- readonly width: number;
449
- readonly height: number;
450
- readonly innerWidth: number;
451
- readonly innerHeight: number;
452
- };
453
- type UTMParameters = Record<string, string>;
454
-
455
- type PageLifecycle = {
456
- pageViewId: string;
457
- };
458
- type AutoTrack = {
459
- page: PageLifecycle;
460
- };
461
- type RudderContext = {
462
- [index: string]: string | number | boolean | ApiObject | UADataValues | Nullable<string> | (string | number | boolean | ApiObject)[] | undefined;
463
- traits?: Nullable<ApiObject>;
464
- sessionId?: number;
465
- sessionStart?: boolean;
466
- consentManagement?: ConsentManagement;
467
- 'ua-ch'?: UADataValues;
468
- app: AppInfo;
469
- library: LibraryInfo;
470
- userAgent: Nullable<string>;
471
- os: OSInfo;
472
- locale: Nullable<string>;
473
- screen: ScreenInfo;
474
- campaign?: UTMParameters;
475
- trulyAnonymousTracking?: boolean;
476
- timezone: string;
477
- autoTrack?: AutoTrack;
478
- };
479
- type RudderEvent = {
480
- type: RudderEventType;
481
- channel: string;
482
- anonymousId: string;
483
- context: RudderContext;
484
- originalTimestamp: string;
485
- integrations: IntegrationOpts;
486
- messageId: string;
487
- event: Nullable<string>;
488
- previousId?: string;
489
- userId?: Nullable<string>;
490
- sentAt?: string;
491
- properties?: Nullable<ApiObject>;
492
- name?: Nullable<string>;
493
- category?: Nullable<string>;
494
- traits?: Traits;
495
- groupId?: Nullable<string>;
496
- };
497
- type RSAEvent = {
498
- message: RudderEvent;
499
- };
500
-
501
422
  type AnalyticsIdentifyMethod = {
502
423
  (userId: string, traits?: Nullable<IdentifyTraits>, options?: Nullable<ApiOptions>, callback?: ApiCallback): void;
503
424
  (userId: string, traits?: Nullable<IdentifyTraits>, callback?: ApiCallback): void;
@@ -635,75 +556,7 @@ interface IRudderAnalytics<T = any> {
635
556
  * @param options Consent API options
636
557
  */
637
558
  consent(options?: ConsentOptions): void;
638
- /**
639
- * To add a custom integration
640
- * @param name The name of the custom integration
641
- * @param integration The custom integration object
642
- */
643
- addCustomIntegration(name: string, integration: RSACustomIntegration): void;
644
559
  }
645
- type RSAnalytics = Pick<IRudderAnalytics, 'track' | 'page' | 'identify' | 'group' | 'alias' | 'getAnonymousId' | 'getUserId' | 'getUserTraits' | 'getGroupId' | 'getGroupTraits' | 'getSessionId'>;
646
- /**
647
- * Type for the custom integration to be used in addCustomIntegration API
648
- * Defines the contract that all custom integrations must implement
649
- */
650
- type RSACustomIntegration = {
651
- /**
652
- * Initialize the integration
653
- * @param analytics - The RudderStack analytics instance
654
- * @param logger - The logger instance for this integration
655
- * @optional
656
- */
657
- init?: (analytics: RSAnalytics, logger: RSALogger) => void;
658
- /**
659
- * Check if the integration is ready to process events
660
- * @param analytics - The RudderStack analytics instance
661
- * @param logger - The logger instance for this integration
662
- * @returns boolean indicating whether the integration is ready
663
- * @required
664
- */
665
- isReady: (analytics: RSAnalytics, logger: RSALogger) => boolean;
666
- /**
667
- * Process track events
668
- * @param analytics - The RudderStack analytics instance
669
- * @param logger - The logger instance for this integration
670
- * @param event - The track event payload to process
671
- * @optional
672
- */
673
- track?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
674
- /**
675
- * Process page events
676
- * @param analytics - The RudderStack analytics instance
677
- * @param logger - The logger instance for this integration
678
- * @param event - The page event payload to process
679
- * @optional
680
- */
681
- page?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
682
- /**
683
- * Process identify events
684
- * @param analytics - The RudderStack analytics instance
685
- * @param logger - The logger instance for this integration
686
- * @param event - The identify event payload to process
687
- * @optional
688
- */
689
- identify?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
690
- /**
691
- * Process group events
692
- * @param analytics - The RudderStack analytics instance
693
- * @param logger - The logger instance for this integration
694
- * @param event - The group event payload to process
695
- * @optional
696
- */
697
- group?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
698
- /**
699
- * Process alias events
700
- * @param analytics - The RudderStack analytics instance
701
- * @param logger - The logger instance for this integration
702
- * @param event - The alias event payload to process
703
- * @optional
704
- */
705
- alias?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
706
- };
707
560
 
708
561
  type SDKError = unknown | Error | ErrorEvent | Event | PromiseRejectionEvent;
709
562
  type ErrorInfo = {
@@ -712,6 +565,7 @@ type ErrorInfo = {
712
565
  customMessage?: string;
713
566
  errorType?: ErrorType;
714
567
  groupingHash?: string | SDKError;
568
+ category?: 'sdk' | 'integrations';
715
569
  };
716
570
  interface IErrorHandler {
717
571
  httpClient: IHttpClient;
@@ -1278,13 +1132,6 @@ interface IAnalytics {
1278
1132
  * To set auth token
1279
1133
  */
1280
1134
  setAuthToken(token: string): void;
1281
- /**
1282
- * Add a custom integration to the SDK
1283
- * @param name - Unique name for the custom integration
1284
- * @param integration - The custom integration instance implementing RSACustomIntegration
1285
- * @param isBufferedInvocation - Internal flag to indicate if this is a buffered call
1286
- */
1287
- addCustomIntegration(name: string, integration: RSACustomIntegration, isBufferedInvocation?: boolean): void;
1288
1135
  }
1289
1136
 
1290
1137
  declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
@@ -1293,12 +1140,6 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
1293
1140
  defaultAnalyticsKey: string;
1294
1141
  logger: Logger;
1295
1142
  constructor();
1296
- /**
1297
- * Create an instance of the current instance that can be used
1298
- * to call a subset of methods of the current instance.
1299
- * It is typically used to expose the analytics instance to the integrations (standard and custom)
1300
- */
1301
- createSafeAnalyticsInstance(): void;
1302
1143
  static initializeGlobalResources(): void;
1303
1144
  /**
1304
1145
  * Set instance to use if no specific writeKey is provided in methods
@@ -1393,7 +1234,6 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
1393
1234
  getSessionId(): Nullable<number> | undefined;
1394
1235
  setAuthToken(token: string): void;
1395
1236
  consent(options?: ConsentOptions): void;
1396
- addCustomIntegration(name: string, integration: RSACustomIntegration): void;
1397
1237
  }
1398
1238
  //# sourceMappingURL=RudderAnalytics.d.ts.map
1399
1239
 
@@ -1405,4 +1245,4 @@ declare global {
1405
1245
  //# sourceMappingURL=index.d.ts.map
1406
1246
 
1407
1247
  export { RudderAnalytics };
1408
- export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, DestinationsQueueOpts, IdentifyTraits, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RSACustomIntegration, RSAEvent, RSALogger, RSAnalytics, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };
1248
+ export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, DestinationsQueueOpts, IdentifyTraits, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };