@rudderstack/analytics-js 3.9.1 → 3.10.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,19 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [3.10.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.9.1...@rudderstack/analytics-js@3.10.0) (2024-11-08)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@rudderstack/analytics-js-cookies` updated to version `0.4.0`
10
+ * `@rudderstack/analytics-js-common` updated to version `3.12.0`
11
+ * `@rudderstack/analytics-js-plugins` updated to version `3.6.0`
12
+
13
+ ### Features
14
+
15
+ * add error handling to all public apis ([#1907](https://github.com/rudderlabs/rudder-sdk-js/issues/1907)) ([9fbaf81](https://github.com/rudderlabs/rudder-sdk-js/commit/9fbaf819bb02320d2f8ae82a869ad2b85090ea34))
16
+ * sanitize input data ([#1902](https://github.com/rudderlabs/rudder-sdk-js/issues/1902)) ([b71c44a](https://github.com/rudderlabs/rudder-sdk-js/commit/b71c44ae61f6c35cadc6523b918e1a574e32bc23))
17
+
5
18
  ## [3.9.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.9.0...@rudderstack/analytics-js@3.9.1) (2024-11-07)
6
19
 
7
20
  ### Dependency Updates
@@ -44,7 +44,7 @@ type Nullable<T> = T | null;
44
44
  * Use for parameters like properties, traits etc.
45
45
  */
46
46
  type ApiObject = {
47
- [index: string]: string | number | boolean | ApiObject | null | Date | (string | number | boolean | null | Date | ApiObject)[] | undefined;
47
+ [index: string]: string | number | boolean | ApiObject | null | Date | (string | number | boolean | null | Date | ApiObject | undefined)[] | undefined;
48
48
  };
49
49
 
50
50
  type DestinationIntgConfig = boolean | undefined | ApiObject;
@@ -418,7 +418,7 @@ interface IRudderAnalytics<T = any> {
418
418
  /**
419
419
  * Get the instance of Analytics that is set as default
420
420
  */
421
- getAnalyticsInstance(writeKey?: string): T;
421
+ getAnalyticsInstance(writeKey?: string): T | undefined;
422
422
  /**
423
423
  * Trigger load event in buffer queue if exists
424
424
  */
@@ -502,7 +502,7 @@ interface IRudderAnalytics<T = any> {
502
502
  /**
503
503
  * To fetch the current sessionId
504
504
  */
505
- getSessionId(): Nullable<number>;
505
+ getSessionId(): Nullable<number> | undefined;
506
506
  /**
507
507
  * To provide consent
508
508
  * @param options Consent API options
@@ -978,9 +978,13 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
978
978
  /**
979
979
  * Retrieve an existing analytics instance
980
980
  */
981
- getAnalyticsInstance(writeKey?: string): IAnalytics;
981
+ getAnalyticsInstance(writeKey?: string): IAnalytics | undefined;
982
982
  /**
983
- * Create new analytics instance and trigger application lifecycle start
983
+ * Loads the SDK
984
+ * @param writeKey Source write key
985
+ * @param dataPlaneUrl Data plane URL
986
+ * @param loadOptions Additional options for loading the SDK
987
+ * @returns none
984
988
  */
985
989
  load(writeKey: string, dataPlaneUrl: string, loadOptions?: Partial<LoadOptions>): void;
986
990
  /**
@@ -1001,14 +1005,14 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
1001
1005
  * @param options
1002
1006
  * @param preloadedEventsArray
1003
1007
  */
1004
- private trackPageLoadedEvent;
1008
+ trackPageLoadedEvent(events: PageLifecycleEvents[], options: ApiOptions, preloadedEventsArray: PreloadedEventCall[]): void;
1005
1009
  /**
1006
1010
  * Setup page unload tracking if enabled
1007
1011
  * @param events
1008
1012
  * @param useBeacon
1009
1013
  * @param options
1010
1014
  */
1011
- private setupPageUnloadTracking;
1015
+ setupPageUnloadTracking(events: PageLifecycleEvents[], useBeacon: boolean | undefined, options: ApiOptions): void;
1012
1016
  /**
1013
1017
  * Trigger load event in buffer queue if exists and stores the
1014
1018
  * remaining preloaded events array in global object
@@ -1068,7 +1072,7 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
1068
1072
  getGroupTraits(): Nullable<ApiObject> | undefined;
1069
1073
  startSession(sessionId?: number): void;
1070
1074
  endSession(): void;
1071
- getSessionId(): Nullable<number>;
1075
+ getSessionId(): Nullable<number> | undefined;
1072
1076
  setAuthToken(token: string): void;
1073
1077
  consent(options?: ConsentOptions): void;
1074
1078
  }
@@ -44,7 +44,7 @@ type Nullable<T> = T | null;
44
44
  * Use for parameters like properties, traits etc.
45
45
  */
46
46
  type ApiObject = {
47
- [index: string]: string | number | boolean | ApiObject | null | Date | (string | number | boolean | null | Date | ApiObject)[] | undefined;
47
+ [index: string]: string | number | boolean | ApiObject | null | Date | (string | number | boolean | null | Date | ApiObject | undefined)[] | undefined;
48
48
  };
49
49
 
50
50
  type DestinationIntgConfig = boolean | undefined | ApiObject;
@@ -418,7 +418,7 @@ interface IRudderAnalytics<T = any> {
418
418
  /**
419
419
  * Get the instance of Analytics that is set as default
420
420
  */
421
- getAnalyticsInstance(writeKey?: string): T;
421
+ getAnalyticsInstance(writeKey?: string): T | undefined;
422
422
  /**
423
423
  * Trigger load event in buffer queue if exists
424
424
  */
@@ -502,7 +502,7 @@ interface IRudderAnalytics<T = any> {
502
502
  /**
503
503
  * To fetch the current sessionId
504
504
  */
505
- getSessionId(): Nullable<number>;
505
+ getSessionId(): Nullable<number> | undefined;
506
506
  /**
507
507
  * To provide consent
508
508
  * @param options Consent API options
@@ -978,9 +978,13 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
978
978
  /**
979
979
  * Retrieve an existing analytics instance
980
980
  */
981
- getAnalyticsInstance(writeKey?: string): IAnalytics;
981
+ getAnalyticsInstance(writeKey?: string): IAnalytics | undefined;
982
982
  /**
983
- * Create new analytics instance and trigger application lifecycle start
983
+ * Loads the SDK
984
+ * @param writeKey Source write key
985
+ * @param dataPlaneUrl Data plane URL
986
+ * @param loadOptions Additional options for loading the SDK
987
+ * @returns none
984
988
  */
985
989
  load(writeKey: string, dataPlaneUrl: string, loadOptions?: Partial<LoadOptions>): void;
986
990
  /**
@@ -1001,14 +1005,14 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
1001
1005
  * @param options
1002
1006
  * @param preloadedEventsArray
1003
1007
  */
1004
- private trackPageLoadedEvent;
1008
+ trackPageLoadedEvent(events: PageLifecycleEvents[], options: ApiOptions, preloadedEventsArray: PreloadedEventCall[]): void;
1005
1009
  /**
1006
1010
  * Setup page unload tracking if enabled
1007
1011
  * @param events
1008
1012
  * @param useBeacon
1009
1013
  * @param options
1010
1014
  */
1011
- private setupPageUnloadTracking;
1015
+ setupPageUnloadTracking(events: PageLifecycleEvents[], useBeacon: boolean | undefined, options: ApiOptions): void;
1012
1016
  /**
1013
1017
  * Trigger load event in buffer queue if exists and stores the
1014
1018
  * remaining preloaded events array in global object
@@ -1068,7 +1072,7 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
1068
1072
  getGroupTraits(): Nullable<ApiObject> | undefined;
1069
1073
  startSession(sessionId?: number): void;
1070
1074
  endSession(): void;
1071
- getSessionId(): Nullable<number>;
1075
+ getSessionId(): Nullable<number> | undefined;
1072
1076
  setAuthToken(token: string): void;
1073
1077
  consent(options?: ConsentOptions): void;
1074
1078
  }