@rudderstack/analytics-js 3.16.1 → 3.17.0-beta.pr.2209.5f649f4

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,28 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [3.17.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.16.1...@rudderstack/analytics-js@3.17.0) (2025-04-25)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@rudderstack/analytics-js-cookies` updated to version `0.4.24`
10
+ * `@rudderstack/analytics-js-common` updated to version `3.18.0`
11
+ * `@rudderstack/analytics-js-plugins` updated to version `3.8.1`
12
+
13
+ ### Features
14
+
15
+ * pre-consent event buffering works now for anonymousId pre-consent storage strategy ([#2100](https://github.com/rudderlabs/rudder-sdk-js/issues/2100)) ([6336925](https://github.com/rudderlabs/rudder-sdk-js/commit/6336925ccfdf66623ca98c4a44b7bf0a13ef54dc))
16
+ * remove page loaded event ([#2088](https://github.com/rudderlabs/rudder-sdk-js/issues/2088)) ([ec1d604](https://github.com/rudderlabs/rudder-sdk-js/commit/ec1d604f70d4e476a751f5207df09eef69220be2))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * consent api race condition to load integrations ([#2178](https://github.com/rudderlabs/rudder-sdk-js/issues/2178)) ([30149ad](https://github.com/rudderlabs/rudder-sdk-js/commit/30149adff3eddd628022f511374e9072d087db89))
22
+ * consider local page urls as dev release stage in error reporting ([#2174](https://github.com/rudderlabs/rudder-sdk-js/issues/2174)) ([ae53449](https://github.com/rudderlabs/rudder-sdk-js/commit/ae53449af2289113182c602971340afdad39d13d))
23
+ * recursively migrate persisted entries ([#2187](https://github.com/rudderlabs/rudder-sdk-js/issues/2187)) ([3dd07ea](https://github.com/rudderlabs/rudder-sdk-js/commit/3dd07ea1bde4655124fc02850a022bcb550b8c07))
24
+ * rename view id to visit id ([#2086](https://github.com/rudderlabs/rudder-sdk-js/issues/2086)) ([51c8dd9](https://github.com/rudderlabs/rudder-sdk-js/commit/51c8dd94b2e25f42a116cb72d209d41729c165c0))
25
+ * rename visit duration to time on page ([#2087](https://github.com/rudderlabs/rudder-sdk-js/issues/2087)) ([569846d](https://github.com/rudderlabs/rudder-sdk-js/commit/569846d992fd01105e880e67ca004d1e9f52688a))
26
+
5
27
  ## [3.16.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.16.0...@rudderstack/analytics-js@3.16.1) (2025-03-03)
6
28
 
7
29
 
@@ -129,32 +129,6 @@ interface IPluginsManager {
129
129
  }
130
130
  type PluginName = 'BeaconQueue' | 'CustomConsentManager' | 'DeviceModeDestinations' | 'DeviceModeTransformation' | 'ExternalAnonymousId' | 'GoogleLinker' | 'IubendaConsentManager' | 'KetchConsentManager' | 'NativeDestinationQueue' | 'OneTrustConsentManager' | 'StorageEncryption' | 'StorageEncryptionLegacy' | 'StorageMigrator' | 'XhrQueue';
131
131
 
132
- type OneTrustCookieCategory = {
133
- oneTrustCookieCategory: string;
134
- };
135
- type ConsentManagementMetadata = {
136
- providers: ConsentManagementProviderMetadata[];
137
- };
138
- type ConsentManagementProviderMetadata = {
139
- provider: ConsentManagementProvider;
140
- resolutionStrategy: ConsentResolutionStrategy;
141
- };
142
- type ConsentManagementProvider = 'iubenda' | 'oneTrust' | 'ketch' | 'custom';
143
- type ConsentResolutionStrategy = 'and' | 'or';
144
- type Consents = string[];
145
- type ConsentManagementOptions = {
146
- enabled?: boolean;
147
- provider?: ConsentManagementProvider;
148
- allowedConsentIds?: Consents;
149
- deniedConsentIds?: Consents;
150
- };
151
- type KetchConsentPurpose = {
152
- purpose: string;
153
- };
154
- type IubendaConsentPurpose = {
155
- purpose: string;
156
- };
157
-
158
132
  type UserSessionKey = 'userId' | 'userTraits' | 'anonymousId' | 'groupId' | 'groupTraits' | 'initialReferrer' | 'initialReferringDomain' | 'sessionInfo' | 'authToken';
159
133
 
160
134
  type StorageEncryptionVersion = 'legacy' | 'v3';
@@ -184,6 +158,40 @@ type CookieOptions = {
184
158
  };
185
159
  type CookieSameSite = 'Strict' | 'Lax' | 'None';
186
160
 
161
+ type OneTrustCookieCategory = {
162
+ oneTrustCookieCategory: string;
163
+ };
164
+ type ConsentManagementMetadata = {
165
+ providers: ConsentManagementProviderMetadata[];
166
+ };
167
+ type ConsentManagementProviderMetadata = {
168
+ provider: ConsentManagementProvider;
169
+ resolutionStrategy: ConsentResolutionStrategy;
170
+ };
171
+ type ConsentManagementProvider = 'iubenda' | 'oneTrust' | 'ketch' | 'custom';
172
+ type ConsentResolutionStrategy = 'and' | 'or';
173
+ type Consents = string[];
174
+ type ConsentManagementOptions = {
175
+ enabled?: boolean;
176
+ provider?: ConsentManagementProvider;
177
+ allowedConsentIds?: Consents;
178
+ deniedConsentIds?: Consents;
179
+ };
180
+ type KetchConsentPurpose = {
181
+ purpose: string;
182
+ };
183
+ type IubendaConsentPurpose = {
184
+ purpose: string;
185
+ };
186
+ type ConsentOptions = {
187
+ storage?: StorageOpts;
188
+ consentManagement?: ConsentManagementOptions;
189
+ integrations?: IntegrationOpts;
190
+ discardPreConsentEvents?: boolean;
191
+ sendPageEvent?: boolean;
192
+ trackConsent?: boolean;
193
+ };
194
+
187
195
  type UaChTrackLevel = 'none' | 'default' | 'full';
188
196
  /**
189
197
  * Represents the options parameter for anonymousId
@@ -194,9 +202,14 @@ type AnonymousIdOptions = {
194
202
  source?: string;
195
203
  };
196
204
  };
205
+ type SessionCutOffOptions = {
206
+ enabled: boolean;
207
+ duration?: number;
208
+ };
197
209
  type SessionOpts = {
198
210
  autoTrack?: boolean;
199
211
  timeout?: number;
212
+ cutOff?: SessionCutOffOptions;
200
213
  };
201
214
  type EventMapping = {
202
215
  from: string;
@@ -255,7 +268,6 @@ type PreConsentOptions = {
255
268
  events?: PreConsentEventsOptions;
256
269
  };
257
270
  declare enum PageLifecycleEvents {
258
- LOADED = "Page Loaded",
259
271
  UNLOADED = "Page Unloaded"
260
272
  }
261
273
  type PageLifecycleOptions = {
@@ -316,14 +328,6 @@ type LoadOptions = {
316
328
  dataServiceEndpoint?: string;
317
329
  autoTrack?: AutoTrackOptions;
318
330
  };
319
- type ConsentOptions = {
320
- storage?: StorageOpts;
321
- consentManagement?: ConsentManagementOptions;
322
- integrations?: IntegrationOpts;
323
- discardPreConsentEvents?: boolean;
324
- sendPageEvent?: boolean;
325
- trackConsent?: boolean;
326
- };
327
331
 
328
332
  type Address = {
329
333
  city?: string;
@@ -544,11 +548,6 @@ interface IRudderAnalytics<T = any> {
544
548
  consent(options?: ConsentOptions): void;
545
549
  }
546
550
 
547
- type PreloadedEventCall = Array<string | any>;
548
- type RudderAnalyticsPreloader = {
549
- [index: string]: (...args: any[]) => any;
550
- };
551
-
552
551
  type SDKError = unknown | Error | ErrorEvent | Event | PromiseRejectionEvent;
553
552
  interface IErrorHandler {
554
553
  httpClient: IHttpClient;
@@ -959,6 +958,11 @@ interface ICapabilitiesManager {
959
958
  onReady(): void;
960
959
  }
961
960
 
961
+ type PreloadedEventCall = Array<string | any>;
962
+ type RudderAnalyticsPreloader = {
963
+ [index: string]: (...args: any[]) => any;
964
+ };
965
+
962
966
  interface IAnalytics {
963
967
  preloadBuffer: BufferQueue<PreloadedEventCall>;
964
968
  initialized: boolean;
@@ -1135,18 +1139,10 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
1135
1139
  load(writeKey: string, dataPlaneUrl: string, loadOptions?: Partial<LoadOptions>): void;
1136
1140
  /**
1137
1141
  * A function to track page lifecycle events like page loaded and page unloaded
1138
- * @param preloadedEventsArray
1139
1142
  * @param loadOptions
1140
1143
  * @returns
1141
1144
  */
1142
- trackPageLifecycleEvents(preloadedEventsArray: PreloadedEventCall[], loadOptions?: Partial<LoadOptions>): void;
1143
- /**
1144
- * Buffer the page loaded event in the preloaded events array
1145
- * @param events
1146
- * @param options
1147
- * @param preloadedEventsArray
1148
- */
1149
- trackPageLoadedEvent(events: PageLifecycleEvents[], options: ApiOptions, preloadedEventsArray: PreloadedEventCall[]): void;
1145
+ trackPageLifecycleEvents(loadOptions?: Partial<LoadOptions>): void;
1150
1146
  /**
1151
1147
  * Setup page unload tracking if enabled
1152
1148
  * @param events
@@ -1226,4 +1222,5 @@ declare global {
1226
1222
  }
1227
1223
  //# sourceMappingURL=index.d.ts.map
1228
1224
 
1229
- export { type AnonymousIdOptions, type ApiCallback, type ApiObject, type ApiOptions, type BeaconQueueOpts, type ConsentOptions, type CookieSameSite, type DestinationsQueueOpts, type IdentifyTraits, type IntegrationOpts, type LoadOptions, type LogLevel, type PluginName, type PreloadedEventCall, type QueueOpts, RudderAnalytics, type RudderAnalyticsPreloader, type SessionOpts, type UaChTrackLevel };
1225
+ export { RudderAnalytics };
1226
+ export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, DestinationsQueueOpts, IdentifyTraits, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };
@@ -129,32 +129,6 @@ interface IPluginsManager {
129
129
  }
130
130
  type PluginName = 'BeaconQueue' | 'CustomConsentManager' | 'DeviceModeDestinations' | 'DeviceModeTransformation' | 'ExternalAnonymousId' | 'GoogleLinker' | 'IubendaConsentManager' | 'KetchConsentManager' | 'NativeDestinationQueue' | 'OneTrustConsentManager' | 'StorageEncryption' | 'StorageEncryptionLegacy' | 'StorageMigrator' | 'XhrQueue';
131
131
 
132
- type OneTrustCookieCategory = {
133
- oneTrustCookieCategory: string;
134
- };
135
- type ConsentManagementMetadata = {
136
- providers: ConsentManagementProviderMetadata[];
137
- };
138
- type ConsentManagementProviderMetadata = {
139
- provider: ConsentManagementProvider;
140
- resolutionStrategy: ConsentResolutionStrategy;
141
- };
142
- type ConsentManagementProvider = 'iubenda' | 'oneTrust' | 'ketch' | 'custom';
143
- type ConsentResolutionStrategy = 'and' | 'or';
144
- type Consents = string[];
145
- type ConsentManagementOptions = {
146
- enabled?: boolean;
147
- provider?: ConsentManagementProvider;
148
- allowedConsentIds?: Consents;
149
- deniedConsentIds?: Consents;
150
- };
151
- type KetchConsentPurpose = {
152
- purpose: string;
153
- };
154
- type IubendaConsentPurpose = {
155
- purpose: string;
156
- };
157
-
158
132
  type UserSessionKey = 'userId' | 'userTraits' | 'anonymousId' | 'groupId' | 'groupTraits' | 'initialReferrer' | 'initialReferringDomain' | 'sessionInfo' | 'authToken';
159
133
 
160
134
  type StorageEncryptionVersion = 'legacy' | 'v3';
@@ -184,6 +158,40 @@ type CookieOptions = {
184
158
  };
185
159
  type CookieSameSite = 'Strict' | 'Lax' | 'None';
186
160
 
161
+ type OneTrustCookieCategory = {
162
+ oneTrustCookieCategory: string;
163
+ };
164
+ type ConsentManagementMetadata = {
165
+ providers: ConsentManagementProviderMetadata[];
166
+ };
167
+ type ConsentManagementProviderMetadata = {
168
+ provider: ConsentManagementProvider;
169
+ resolutionStrategy: ConsentResolutionStrategy;
170
+ };
171
+ type ConsentManagementProvider = 'iubenda' | 'oneTrust' | 'ketch' | 'custom';
172
+ type ConsentResolutionStrategy = 'and' | 'or';
173
+ type Consents = string[];
174
+ type ConsentManagementOptions = {
175
+ enabled?: boolean;
176
+ provider?: ConsentManagementProvider;
177
+ allowedConsentIds?: Consents;
178
+ deniedConsentIds?: Consents;
179
+ };
180
+ type KetchConsentPurpose = {
181
+ purpose: string;
182
+ };
183
+ type IubendaConsentPurpose = {
184
+ purpose: string;
185
+ };
186
+ type ConsentOptions = {
187
+ storage?: StorageOpts;
188
+ consentManagement?: ConsentManagementOptions;
189
+ integrations?: IntegrationOpts;
190
+ discardPreConsentEvents?: boolean;
191
+ sendPageEvent?: boolean;
192
+ trackConsent?: boolean;
193
+ };
194
+
187
195
  type UaChTrackLevel = 'none' | 'default' | 'full';
188
196
  /**
189
197
  * Represents the options parameter for anonymousId
@@ -194,9 +202,14 @@ type AnonymousIdOptions = {
194
202
  source?: string;
195
203
  };
196
204
  };
205
+ type SessionCutOffOptions = {
206
+ enabled: boolean;
207
+ duration?: number;
208
+ };
197
209
  type SessionOpts = {
198
210
  autoTrack?: boolean;
199
211
  timeout?: number;
212
+ cutOff?: SessionCutOffOptions;
200
213
  };
201
214
  type EventMapping = {
202
215
  from: string;
@@ -255,7 +268,6 @@ type PreConsentOptions = {
255
268
  events?: PreConsentEventsOptions;
256
269
  };
257
270
  declare enum PageLifecycleEvents {
258
- LOADED = "Page Loaded",
259
271
  UNLOADED = "Page Unloaded"
260
272
  }
261
273
  type PageLifecycleOptions = {
@@ -316,14 +328,6 @@ type LoadOptions = {
316
328
  dataServiceEndpoint?: string;
317
329
  autoTrack?: AutoTrackOptions;
318
330
  };
319
- type ConsentOptions = {
320
- storage?: StorageOpts;
321
- consentManagement?: ConsentManagementOptions;
322
- integrations?: IntegrationOpts;
323
- discardPreConsentEvents?: boolean;
324
- sendPageEvent?: boolean;
325
- trackConsent?: boolean;
326
- };
327
331
 
328
332
  type Address = {
329
333
  city?: string;
@@ -544,11 +548,6 @@ interface IRudderAnalytics<T = any> {
544
548
  consent(options?: ConsentOptions): void;
545
549
  }
546
550
 
547
- type PreloadedEventCall = Array<string | any>;
548
- type RudderAnalyticsPreloader = {
549
- [index: string]: (...args: any[]) => any;
550
- };
551
-
552
551
  type SDKError = unknown | Error | ErrorEvent | Event | PromiseRejectionEvent;
553
552
  interface IErrorHandler {
554
553
  httpClient: IHttpClient;
@@ -959,6 +958,11 @@ interface ICapabilitiesManager {
959
958
  onReady(): void;
960
959
  }
961
960
 
961
+ type PreloadedEventCall = Array<string | any>;
962
+ type RudderAnalyticsPreloader = {
963
+ [index: string]: (...args: any[]) => any;
964
+ };
965
+
962
966
  interface IAnalytics {
963
967
  preloadBuffer: BufferQueue<PreloadedEventCall>;
964
968
  initialized: boolean;
@@ -1135,18 +1139,10 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
1135
1139
  load(writeKey: string, dataPlaneUrl: string, loadOptions?: Partial<LoadOptions>): void;
1136
1140
  /**
1137
1141
  * A function to track page lifecycle events like page loaded and page unloaded
1138
- * @param preloadedEventsArray
1139
1142
  * @param loadOptions
1140
1143
  * @returns
1141
1144
  */
1142
- trackPageLifecycleEvents(preloadedEventsArray: PreloadedEventCall[], loadOptions?: Partial<LoadOptions>): void;
1143
- /**
1144
- * Buffer the page loaded event in the preloaded events array
1145
- * @param events
1146
- * @param options
1147
- * @param preloadedEventsArray
1148
- */
1149
- trackPageLoadedEvent(events: PageLifecycleEvents[], options: ApiOptions, preloadedEventsArray: PreloadedEventCall[]): void;
1145
+ trackPageLifecycleEvents(loadOptions?: Partial<LoadOptions>): void;
1150
1146
  /**
1151
1147
  * Setup page unload tracking if enabled
1152
1148
  * @param events
@@ -1226,4 +1222,5 @@ declare global {
1226
1222
  }
1227
1223
  //# sourceMappingURL=index.d.ts.map
1228
1224
 
1229
- export { type AnonymousIdOptions, type ApiCallback, type ApiObject, type ApiOptions, type BeaconQueueOpts, type ConsentOptions, type CookieSameSite, type DestinationsQueueOpts, type IdentifyTraits, type IntegrationOpts, type LoadOptions, type LogLevel, type PluginName, type PreloadedEventCall, type QueueOpts, RudderAnalytics, type RudderAnalyticsPreloader, type SessionOpts, type UaChTrackLevel };
1225
+ export { RudderAnalytics };
1226
+ export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, DestinationsQueueOpts, IdentifyTraits, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };