@rudderstack/analytics-js 3.35.0 → 3.35.2

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,29 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [3.35.2](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.35.1...@rudderstack/analytics-js@3.35.2) (2026-10-26)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@rudderstack/analytics-js-cookies` updated to version `0.5.17`
10
+ * `@rudderstack/analytics-js-common` updated to version `3.30.3`
11
+ * `@rudderstack/analytics-js-plugins` updated to version `3.18.7`
12
+
13
+ ### Bug Fixes
14
+
15
+ * **analytics-js:** don't warn on omitted session ID ([#3294](https://github.com/rudderlabs/rudder-sdk-js/issues/3294)) ([0794bfe](https://github.com/rudderlabs/rudder-sdk-js/commit/0794bfe3472d041df8991f44e7b3da76ad40695d))
16
+ * **analytics-js:** make published types self-contained ([#3310](https://github.com/rudderlabs/rudder-sdk-js/issues/3310)) ([902a0ae](https://github.com/rudderlabs/rudder-sdk-js/commit/902a0ae3ae0978b64da0b059ed87b70c8e4ec006))
17
+
18
+ ## [3.35.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.35.0...@rudderstack/analytics-js@3.35.1) (2026-10-19)
19
+
20
+ ### Dependency Updates
21
+
22
+ * `@rudderstack/analytics-js-plugins` updated to version `3.18.6`
23
+
24
+ ### Bug Fixes
25
+
26
+ * **analytics-js:** send buffered calls in invocation order ([#3282](https://github.com/rudderlabs/rudder-sdk-js/issues/3282)) ([e792f2e](https://github.com/rudderlabs/rudder-sdk-js/commit/e792f2e38d7c9177e363e7242de4e6cba0f2c411))
27
+
5
28
  ## [3.35.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.34.3...@rudderstack/analytics-js@3.35.0) (2026-10-12)
6
29
 
7
30
  ### Dependency Updates
@@ -0,0 +1,10 @@
1
+ import type * as Esm from './index.mjs';
2
+ import type * as Cjs from './index.cjs';
3
+
4
+ declare global {
5
+ interface Window {
6
+ rudderanalytics: Esm.RudderAnalytics | Cjs.RudderAnalytics | Esm.RudderAnalyticsPreloader | Cjs.RudderAnalyticsPreloader | undefined;
7
+ }
8
+ }
9
+
10
+ export {};
@@ -1,5 +1,4 @@
1
- import { Signal } from '@preact/signals-core';
2
-
1
+ /// <reference path="./global.d.ts" />
3
2
  type LoggerProvider$1 = Record<Exclude<Lowercase<LogLevel>, Lowercase<'NONE'>>, (...data: any[]) => void>;
4
3
  interface ILogger {
5
4
  minLogLevel: number;
@@ -483,6 +482,24 @@ type ScreenInfo = {
483
482
  readonly innerHeight: number;
484
483
  };
485
484
  type UTMParameters = Record<string, string>;
485
+ type UABrandVersion = {
486
+ readonly brand: string;
487
+ readonly version: string;
488
+ };
489
+ type UADataValues = {
490
+ readonly brands?: UABrandVersion[];
491
+ readonly mobile?: boolean;
492
+ readonly platform?: string;
493
+ readonly architecture?: string;
494
+ readonly bitness?: string;
495
+ readonly formFactors?: string[];
496
+ readonly model?: string;
497
+ readonly platformVersion?: string;
498
+ /** @deprecated in favour of fullVersionList */
499
+ readonly uaFullVersion?: string;
500
+ readonly fullVersionList?: UABrandVersion[];
501
+ readonly wow64?: boolean;
502
+ };
486
503
 
487
504
  type PageCallOptions = {
488
505
  category?: string;
@@ -1078,6 +1095,28 @@ declare class Store implements IStore {
1078
1095
  onError(error: unknown, customMessage?: string, groupingHash?: string): void;
1079
1096
  }
1080
1097
 
1098
+ declare const BRAND_SYMBOL: unique symbol;
1099
+ /**
1100
+ * The base class for plain and computed signals.
1101
+ */
1102
+ declare class Signal<T = any> {
1103
+ constructor(value?: T, options?: SignalOptions<T>);
1104
+ subscribe(fn: (value: T) => void): () => void;
1105
+ name?: string;
1106
+ valueOf(): T;
1107
+ toString(): string;
1108
+ toJSON(): T;
1109
+ peek(): T;
1110
+ brand: typeof BRAND_SYMBOL;
1111
+ get value(): T;
1112
+ set value(value: T);
1113
+ }
1114
+ interface SignalOptions<T = any> {
1115
+ watched?: (this: Signal<T>) => void;
1116
+ unwatched?: (this: Signal<T>) => void;
1117
+ name?: string;
1118
+ }
1119
+
1081
1120
  type StatsCollection = {
1082
1121
  errors: {
1083
1122
  enabled: boolean;
@@ -1347,7 +1386,7 @@ interface IAnalytics {
1347
1386
  /**
1348
1387
  * Merge fields into the current custom context
1349
1388
  */
1350
- setCustomContext(context: InputCustomContext): void;
1389
+ setCustomContext(context: InputCustomContext, isBufferedInvocation?: boolean): void;
1351
1390
  /**
1352
1391
  * Get a defensive snapshot of the current custom context
1353
1392
  */
@@ -1355,7 +1394,7 @@ interface IAnalytics {
1355
1394
  /**
1356
1395
  * Clear the current custom context
1357
1396
  */
1358
- clearCustomContext(): void;
1397
+ clearCustomContext(isBufferedInvocation?: boolean): void;
1359
1398
  /**
1360
1399
  * To manually start user session in the SDK
1361
1400
  */
@@ -1528,11 +1567,6 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
1528
1567
  addCustomIntegration(destinationId: string, integration: RSACustomIntegration): void;
1529
1568
  }
1530
1569
 
1531
- declare global {
1532
- interface Window {
1533
- rudderanalytics: RudderAnalytics | RudderAnalyticsPreloader | undefined;
1534
- }
1535
- }
1536
1570
 
1537
1571
  export { RudderAnalytics };
1538
1572
  export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, CustomContext, CustomContextValue, CustomDestinationConfig, DestinationsQueueOpts, IdentifyTraits, InputCustomContext, InputCustomContextValue, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RSACustomIntegration, RSAEvent, RSALogger, RSAnalytics, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };
@@ -1,5 +1,4 @@
1
- import { Signal } from '@preact/signals-core';
2
-
1
+ /// <reference path="./global.d.ts" />
3
2
  type LoggerProvider$1 = Record<Exclude<Lowercase<LogLevel>, Lowercase<'NONE'>>, (...data: any[]) => void>;
4
3
  interface ILogger {
5
4
  minLogLevel: number;
@@ -483,6 +482,24 @@ type ScreenInfo = {
483
482
  readonly innerHeight: number;
484
483
  };
485
484
  type UTMParameters = Record<string, string>;
485
+ type UABrandVersion = {
486
+ readonly brand: string;
487
+ readonly version: string;
488
+ };
489
+ type UADataValues = {
490
+ readonly brands?: UABrandVersion[];
491
+ readonly mobile?: boolean;
492
+ readonly platform?: string;
493
+ readonly architecture?: string;
494
+ readonly bitness?: string;
495
+ readonly formFactors?: string[];
496
+ readonly model?: string;
497
+ readonly platformVersion?: string;
498
+ /** @deprecated in favour of fullVersionList */
499
+ readonly uaFullVersion?: string;
500
+ readonly fullVersionList?: UABrandVersion[];
501
+ readonly wow64?: boolean;
502
+ };
486
503
 
487
504
  type PageCallOptions = {
488
505
  category?: string;
@@ -1078,6 +1095,28 @@ declare class Store implements IStore {
1078
1095
  onError(error: unknown, customMessage?: string, groupingHash?: string): void;
1079
1096
  }
1080
1097
 
1098
+ declare const BRAND_SYMBOL: unique symbol;
1099
+ /**
1100
+ * The base class for plain and computed signals.
1101
+ */
1102
+ declare class Signal<T = any> {
1103
+ constructor(value?: T, options?: SignalOptions<T>);
1104
+ subscribe(fn: (value: T) => void): () => void;
1105
+ name?: string;
1106
+ valueOf(): T;
1107
+ toString(): string;
1108
+ toJSON(): T;
1109
+ peek(): T;
1110
+ brand: typeof BRAND_SYMBOL;
1111
+ get value(): T;
1112
+ set value(value: T);
1113
+ }
1114
+ interface SignalOptions<T = any> {
1115
+ watched?: (this: Signal<T>) => void;
1116
+ unwatched?: (this: Signal<T>) => void;
1117
+ name?: string;
1118
+ }
1119
+
1081
1120
  type StatsCollection = {
1082
1121
  errors: {
1083
1122
  enabled: boolean;
@@ -1347,7 +1386,7 @@ interface IAnalytics {
1347
1386
  /**
1348
1387
  * Merge fields into the current custom context
1349
1388
  */
1350
- setCustomContext(context: InputCustomContext): void;
1389
+ setCustomContext(context: InputCustomContext, isBufferedInvocation?: boolean): void;
1351
1390
  /**
1352
1391
  * Get a defensive snapshot of the current custom context
1353
1392
  */
@@ -1355,7 +1394,7 @@ interface IAnalytics {
1355
1394
  /**
1356
1395
  * Clear the current custom context
1357
1396
  */
1358
- clearCustomContext(): void;
1397
+ clearCustomContext(isBufferedInvocation?: boolean): void;
1359
1398
  /**
1360
1399
  * To manually start user session in the SDK
1361
1400
  */
@@ -1528,11 +1567,6 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
1528
1567
  addCustomIntegration(destinationId: string, integration: RSACustomIntegration): void;
1529
1568
  }
1530
1569
 
1531
- declare global {
1532
- interface Window {
1533
- rudderanalytics: RudderAnalytics | RudderAnalyticsPreloader | undefined;
1534
- }
1535
- }
1536
1570
 
1537
1571
  export { RudderAnalytics };
1538
1572
  export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, CustomContext, CustomContextValue, CustomDestinationConfig, DestinationsQueueOpts, IdentifyTraits, InputCustomContext, InputCustomContextValue, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RSACustomIntegration, RSAEvent, RSALogger, RSAnalytics, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };
@@ -365,11 +365,11 @@ function _superPropGet(t, o, e, r) {
365
365
  function _toConsumableArray(r) {
366
366
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
367
367
  }
368
- function _toPrimitive(t, r) {
368
+ function _toPrimitive(t, e) {
369
369
  if ("object" != typeof t || !t) return t;
370
- var e = t[Symbol.toPrimitive];
371
- if (void 0 !== e) {
372
- var i = e.call(t, r);
370
+ var r;
371
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
372
+ var i = r.call(t, e);
373
373
  if ("object" != typeof i) return i;
374
374
  throw new TypeError("@@toPrimitive must return a primitive value.");
375
375
  }
@@ -913,7 +913,7 @@ Object.getOwnPropertyNames(err).forEach(function(key){if(key!=='message'&&key!==
913
913
  }}});return newError;}catch(_unused2){return new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var errStack=getStacktrace(error);if(errStack){// eslint-disable-next-line no-param-reassign
914
914
  error.stack="".concat(errStack,"\n").concat(MANUAL_ERROR_IDENTIFIER);}}globalThis.dispatchEvent(new ErrorEvent('error',{error:error,bubbles:true,cancelable:true,composed:true}));};
915
915
 
916
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.35.0';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var BUILD_VARIANT='legacy-bundled';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';var CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
916
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.35.2';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var BUILD_VARIANT='legacy-bundled';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';var CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
917
917
 
918
918
  var QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';var QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';var QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';var QUERY_PARAM_USER_ID_KEY='ajs_uid';var QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
919
919
 
@@ -1045,8 +1045,8 @@ var CDN_INT_DIR='js-integrations';var CDN_PLUGINS_DIR='plugins';var URL_PATTERN=
1045
1045
  ')'+'(\\:\\d+)?'+// port
1046
1046
  '(\\/[-a-zA-Z\\d%_.~+]*)*'+// path
1047
1047
  '(\\?[;&a-zA-Z\\d%_.~+=-]*)?'+// query string
1048
- '(\\#[-a-zA-Z\\d_]*)?$')// fragment locator
1049
- ;
1048
+ '(\\#[-a-zA-Z\\d_]*)?$'// fragment locator
1049
+ );
1050
1050
 
1051
1051
  var BUILD_TYPE='legacy';var SDK_CDN_BASE_URL='https://cdn.rudderlabs.com';var CDN_ARCH_VERSION_DIR='v3';var DEFAULT_INTEGRATION_SDKS_URL="".concat(SDK_CDN_BASE_URL,"/").concat(CDN_ARCH_VERSION_DIR,"/").concat(BUILD_TYPE,"/").concat(CDN_INT_DIR);var DEFAULT_PLUGINS_URL="".concat(SDK_CDN_BASE_URL,"/").concat(CDN_ARCH_VERSION_DIR,"/").concat(BUILD_TYPE,"/").concat(CDN_PLUGINS_DIR);var DEFAULT_CONFIG_BE_URL='https://api.rudderstack.com';// Mirrors remotePluginsExportsFilename in rollup.config.mjs, which builds the URL
1052
1052
  // the generated federation code requests at runtime.
@@ -1427,7 +1427,7 @@ var runningQueueIdsByName=new Map();var RetryQueue=/*#__PURE__*/function(){/**
1427
1427
  * Constructs a RetryQueue backed by localStorage
1428
1428
  *
1429
1429
  * @param {String} name The name of the queue. Will be used to find abandoned queues and retry their items
1430
- * @param {QueueOpts} [options] Optional argument to override `maxItems`, `maxAttempts`, `minRetryDelay, `maxRetryDelay`, `backoffFactor` and `backoffJitter`.
1430
+ * @param {QueueOpts} [options] Optional argument to override `maxItems`, `maxAttempts`, `minRetryDelay`, `maxRetryDelay`, `backoffFactor` and `backoffJitter`.
1431
1431
  * @param {QueueProcessCallback} queueProcessCb The function to call in order to process an item added to the queue
1432
1432
  * @param {IStoreManager} storeManager The store manager instance to use
1433
1433
  * @param {StorageType} [storageType] The storage type to use. Defaults to LOCAL_STORAGE
@@ -1591,7 +1591,7 @@ var isDestIntgConfigTruthy=function isDestIntgConfigTruthy(destIntgConfig){retur
1591
1591
  /*
1592
1592
  GENERATED - DO NOT EDIT
1593
1593
  This file is generated from the templates/Destinations.ts.template file.
1594
- Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.ts
1594
+ Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/main/generated/Destinations.ts
1595
1595
 
1596
1596
  NOTE: Contains only constants for device mode destinations
1597
1597
  */var ACTIVE_CAMPAIGN_NAME='ACTIVE_CAMPAIGN';var ACTIVE_CAMPAIGN_DISPLAY_NAME='ActiveCampaign';var ADOBE_ANALYTICS_NAME='ADOBE_ANALYTICS';var ADOBE_ANALYTICS_DISPLAY_NAME='Adobe Analytics';var ADROLL_NAME='ADROLL';var ADROLL_DISPLAY_NAME='Adroll';var AM_NAME='AM';var AM_DISPLAY_NAME='Amplitude';var APPCUES_NAME='APPCUES';var APPCUES_DISPLAY_NAME='Appcues';var AXEPTIO_NAME='AXEPTIO';var AXEPTIO_DISPLAY_NAME='Axeptio';var BINGADS_NAME='BINGADS';var BINGADS_DISPLAY_NAME='Bing Ads';var BRAZE_NAME='BRAZE';var BRAZE_DISPLAY_NAME='Braze';var BUGSNAG_NAME='BUGSNAG';var BUGSNAG_DISPLAY_NAME='Bugsnag';var CHARTBEAT_NAME='CHARTBEAT';var CHARTBEAT_DISPLAY_NAME='Chartbeat';var CLEVERTAP_NAME='CLEVERTAP';var CLEVERTAP_DISPLAY_NAME='CleverTap';var COMMANDBAR_NAME='COMMANDBAR';var COMMANDBAR_DISPLAY_NAME='CommandBar';var COMSCORE_NAME='COMSCORE';var COMSCORE_DISPLAY_NAME='Comscore';var CONVERTFLOW_NAME='CONVERTFLOW';var CONVERTFLOW_DISPLAY_NAME='Convertflow';var CRITEO_NAME='CRITEO';var CRITEO_DISPLAY_NAME='Criteo';var CUSTOMERIO_NAME='CUSTOMERIO';var CUSTOMERIO_DISPLAY_NAME='Customer IO';var DCM_FLOODLIGHT_NAME='DCM_FLOODLIGHT';var DCM_FLOODLIGHT_DISPLAY_NAME='DCM Floodlight';var DRIP_NAME='DRIP';var DRIP_DISPLAY_NAME='Drip';var ENGAGE_NAME='ENGAGE';var ENGAGE_DISPLAY_NAME='Engage';var FACEBOOK_PIXEL_NAME='FACEBOOK_PIXEL';var FACEBOOK_PIXEL_DISPLAY_NAME='Facebook Pixel';var FULLSTORY_NAME='FULLSTORY';var FULLSTORY_DISPLAY_NAME='Fullstory';var GA_NAME='GA';var GA_DISPLAY_NAME='Google Analytics';var GA360_NAME='GA360';var GA360_DISPLAY_NAME='Google Analytics 360';var GA4_NAME='GA4';var GA4_DISPLAY_NAME='Google Analytics 4 (GA4)';var GA4_V2_NAME='GA4_V2';var GA4_V2_DISPLAY_NAME='Google Analytics 4 (GA4) V2';var GAINSIGHT_PX_NAME='GAINSIGHT_PX';var GAINSIGHT_PX_DISPLAY_NAME='Gainsight PX';var GOOGLE_OPTIMIZE_NAME='GOOGLE_OPTIMIZE';var GOOGLE_OPTIMIZE_DISPLAY_NAME='Google Optimize';var GOOGLEADS_NAME='GOOGLEADS';var GOOGLEADS_DISPLAY_NAME='Google Ads';var GTM_NAME='GTM';var GTM_DISPLAY_NAME='Google Tag Manager';var HEAP_NAME='HEAP';var HEAP_DISPLAY_NAME='Heap.io';var HOTJAR_NAME='HOTJAR';var HOTJAR_DISPLAY_NAME='Hotjar';var HS_NAME='HS';var HS_DISPLAY_NAME='HubSpot';var INTERCOM_NAME='INTERCOM';var INTERCOM_DISPLAY_NAME='Intercom';var ITERABLE_NAME='ITERABLE';var ITERABLE_DISPLAY_NAME='Iterable';var JUNE_NAME='JUNE';var JUNE_DISPLAY_NAME='JUNE';var KEEN_NAME='KEEN';var KEEN_DISPLAY_NAME='Keen';var KISSMETRICS_NAME='KISSMETRICS';var KISSMETRICS_DISPLAY_NAME='Kiss Metrics';var KLAVIYO_NAME='KLAVIYO';var KLAVIYO_DISPLAY_NAME='Klaviyo';var LAUNCHDARKLY_NAME='LAUNCHDARKLY';var LAUNCHDARKLY_DISPLAY_NAME='LaunchDarkly';var LEMNISK_NAME='LEMNISK';var LEMNISK_DISPLAY_NAME='Lemnisk Marketing Automation';var LINKEDIN_INSIGHT_TAG_NAME='LINKEDIN_INSIGHT_TAG';var LINKEDIN_INSIGHT_TAG_DISPLAY_NAME='Linkedin Insight Tag';var LIVECHAT_NAME='LIVECHAT';var LIVECHAT_DISPLAY_NAME='livechat';var LOTAME_NAME='LOTAME';var LOTAME_DISPLAY_NAME='Lotame';var LYTICS_NAME='LYTICS';var LYTICS_DISPLAY_NAME='Lytics';var MATOMO_NAME='MATOMO';var MATOMO_DISPLAY_NAME='Matomo';var MICROSOFT_CLARITY_NAME='MICROSOFT_CLARITY';var MICROSOFT_CLARITY_DISPLAY_NAME='Microsoft Clarity';var MOENGAGE_NAME='MOENGAGE';var MOENGAGE_DISPLAY_NAME='MoEngage';var MOUSEFLOW_NAME='MOUSEFLOW';var MOUSEFLOW_DISPLAY_NAME='Mouseflow';var MP_NAME='MP';var MP_DISPLAY_NAME='Mixpanel';var NINETAILED_NAME='NINETAILED';var NINETAILED_DISPLAY_NAME='Ninetailed';var OLARK_NAME='OLARK';var OLARK_DISPLAY_NAME='Olark';var OPENAI_ADS_DISPLAY_NAME='OpenAI Ads';var OPTIMIZELY_NAME='OPTIMIZELY';var OPTIMIZELY_DISPLAY_NAME='Optimizely Web';var PENDO_NAME='PENDO';var PENDO_DISPLAY_NAME='Pendo';var PINTEREST_TAG_NAME='PINTEREST_TAG';var PINTEREST_TAG_DISPLAY_NAME='Pinterest Tag';var PODSIGHTS_NAME='PODSIGHTS';var PODSIGHTS_DISPLAY_NAME='Podsights';var POST_AFFILIATE_PRO_NAME='POST_AFFILIATE_PRO';var POST_AFFILIATE_PRO_DISPLAY_NAME='Post Affiliate Pro';var POSTHOG_NAME='POSTHOG';var POSTHOG_DISPLAY_NAME='PostHog';var PROFITWELL_NAME='PROFITWELL';var PROFITWELL_DISPLAY_NAME='ProfitWell';var QUALAROO_NAME='QUALAROO';var QUALAROO_DISPLAY_NAME='Qualaroo';var QUALTRICS_NAME='QUALTRICS';var QUALTRICS_DISPLAY_NAME='Qualtrics';var QUANTUMMETRIC_NAME='QUANTUMMETRIC';var QUANTUMMETRIC_DISPLAY_NAME='Quantum Metric';var QUORA_PIXEL_NAME='QUORA_PIXEL';var QUORA_PIXEL_DISPLAY_NAME='Quora Pixel';var REDDIT_PIXEL_NAME='REDDIT_PIXEL';var REDDIT_PIXEL_DISPLAY_NAME='Reddit Pixel';var REFINER_NAME='REFINER';var REFINER_DISPLAY_NAME='Refiner';var ROCKERBOX_NAME='ROCKERBOX';var ROCKERBOX_DISPLAY_NAME='Rockerbox';var ROLLBAR_NAME='ROLLBAR';var ROLLBAR_DISPLAY_NAME='rollbar';var SATISMETER_NAME='SATISMETER';var SATISMETER_DISPLAY_NAME='SatisMeter';var SENDINBLUE_NAME='SENDINBLUE';var SENDINBLUE_DISPLAY_NAME='Sendinblue';var SENTRY_NAME='SENTRY';var SENTRY_DISPLAY_NAME='Sentry';var SHYNET_NAME='SHYNET';var SHYNET_DISPLAY_NAME='Shynet';var SNAP_PIXEL_NAME='SNAP_PIXEL';var SNAP_PIXEL_DISPLAY_NAME='Snap Pixel';var SNAPENGAGE_NAME='SNAPENGAGE';var SNAPENGAGE_DISPLAY_NAME='SnapEngage';var SPOTIFYPIXEL_NAME='SPOTIFYPIXEL';var SPOTIFYPIXEL_DISPLAY_NAME='Spotify Pixel';var SPRIG_NAME='SPRIG';var SPRIG_DISPLAY_NAME='Sprig';var TIKTOK_ADS_NAME='TIKTOK_ADS';var TIKTOK_ADS_DISPLAY_NAME='TikTok Ads';var TVSQUARED_NAME='TVSQUARED';var TVSQUARED_DISPLAY_NAME='TVSquared';var USERPILOT_NAME='USERPILOT';var USERPILOT_DISPLAY_NAME='Userpilot';var VERO_NAME='VERO';var VERO_DISPLAY_NAME='Vero';var VWO_NAME='VWO';var VWO_DISPLAY_NAME='VWO';var WOOPRA_NAME='WOOPRA';var WOOPRA_DISPLAY_NAME='WOOPRA';var XPIXEL_NAME='XPIXEL';var XPIXEL_DISPLAY_NAME='XPixel';var YANDEX_METRICA_NAME='YANDEX_METRICA';var YANDEX_METRICA_DISPLAY_NAME='Yandex.Metrica';
@@ -3769,7 +3769,8 @@ var _excluded$1=["entries"];var MIN_SESSION_ID_LENGTH=10;var isCutOffTimeExceede
3769
3769
  * @param {number} sessionId
3770
3770
  * @param logger logger
3771
3771
  * @returns
3772
- */var isManualSessionIdValid=function isManualSessionIdValid(sessionId,logger){if(!sessionId||!isPositiveInteger(sessionId)||!hasMinLength(MIN_SESSION_ID_LENGTH,sessionId)){logger.warn(INVALID_SESSION_ID_WARNING(USER_SESSION_MANAGER,sessionId,MIN_SESSION_ID_LENGTH));return false;}return true;};var getCutOffExpirationTimestamp=function getCutOffExpirationTimestamp(cutOff){var _cutOff$expiresAt;if(!(cutOff!==null&&cutOff!==void 0&&cutOff.enabled)){return undefined;}return (_cutOff$expiresAt=cutOff.expiresAt)!==null&&_cutOff$expiresAt!==void 0?_cutOff$expiresAt:isPositiveInteger(cutOff.duration)?Date.now()+cutOff.duration:undefined;};/**
3772
+ */var isManualSessionIdValid=function isManualSessionIdValid(sessionId,logger){// Omitting the ID is the documented way to get an auto-generated one
3773
+ if(isUndefined(sessionId)){return false;}if(!sessionId||!isPositiveInteger(sessionId)||!hasMinLength(MIN_SESSION_ID_LENGTH,sessionId)){logger.warn(INVALID_SESSION_ID_WARNING(USER_SESSION_MANAGER,sessionId,MIN_SESSION_ID_LENGTH));return false;}return true;};var getCutOffExpirationTimestamp=function getCutOffExpirationTimestamp(cutOff){var _cutOff$expiresAt;if(!(cutOff!==null&&cutOff!==void 0&&cutOff.enabled)){return undefined;}return (_cutOff$expiresAt=cutOff.expiresAt)!==null&&_cutOff$expiresAt!==void 0?_cutOff$expiresAt:isPositiveInteger(cutOff.duration)?Date.now()+cutOff.duration:undefined;};/**
3773
3774
  * A function to generate new auto tracking session
3774
3775
  * @param sessionInfo session info
3775
3776
  * @returns SessionInfo
@@ -4161,18 +4162,18 @@ var _excluded=["context"];/*
4161
4162
  * Analytics class with lifecycle based on state ad user triggered events
4162
4163
  */var Analytics=/*#__PURE__*/function(){/**
4163
4164
  * Initialize services and components or use default ones if singletons
4164
- */function Analytics(){_classCallCheck(this,Analytics);this.preloadBuffer=new BufferQueue();this.initialized=false;this.errorHandler=defaultErrorHandler;this.logger=defaultLogger;this.customContextStore=new CustomContextStore(state.customContext,this.logger);this.externalSrcLoader=new ExternalSrcLoader(this.logger);this.httpClient=defaultHttpClient;this.httpClient.init(this.errorHandler);this.capabilitiesManager=new CapabilitiesManager(this.httpClient,this.errorHandler,this.logger);}/**
4165
+ */function Analytics(){_classCallCheck(this,Analytics);this.preloadBuffer=new BufferQueue();this.initialized=false;this.isDrainingBuffer=false;this.errorHandler=defaultErrorHandler;this.logger=defaultLogger;this.customContextStore=new CustomContextStore(state.customContext,this.logger);this.externalSrcLoader=new ExternalSrcLoader(this.logger);this.httpClient=defaultHttpClient;this.httpClient.init(this.errorHandler);this.capabilitiesManager=new CapabilitiesManager(this.httpClient,this.errorHandler,this.logger);}/**
4165
4166
  * Start application lifecycle if not already started
4166
4167
  */return _createClass(Analytics,[{key:"load",value:function load(writeKey,dataPlaneUrl){var _state$loadOptions$va;var loadOptions=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(state.lifecycle.status.value){return;}if(!isWriteKeyValid(writeKey)){this.logger.error(WRITE_KEY_VALIDATION_ERROR(ANALYTICS_CORE,writeKey));return;}if(!isDataPlaneUrlValid(dataPlaneUrl)){this.logger.error(DATA_PLANE_URL_VALIDATION_ERROR(ANALYTICS_CORE,dataPlaneUrl));return;}var customContext=loadOptions.context,loadOptionsWithoutContext=_objectWithoutProperties(loadOptions,_excluded);var sanitizedLoadOptions=getSanitizedValue(loadOptionsWithoutContext);if(customContext!==undefined){this.customContextStore.set(customContext);}// Set initial state values
4167
4168
  n(function(){state.lifecycle.writeKey.value=clone(writeKey);state.lifecycle.dataPlaneUrl.value=clone(dataPlaneUrl);state.loadOptions.value=normalizeLoadOptions(state.loadOptions.value,sanitizedLoadOptions);state.lifecycle.status.value='mounted';});// set log level as early as possible
4168
4169
  this.logger.setMinLogLevel((_state$loadOptions$va=state.loadOptions.value.logLevel)!==null&&_state$loadOptions$va!==void 0?_state$loadOptions$va:POST_LOAD_LOG_LEVEL);// Expose state to global objects
4169
4170
  setExposedGlobal('state',state,writeKey);// Configure initial config of any services or components here
4170
4171
  // State application lifecycle
4171
- this.startLifecycle();}},{key:"setCustomContext",value:function setCustomContext(context){if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[['setCustomContext',context]]);return;}this.customContextStore.set(context);}},{key:"getCustomContext",value:function getCustomContext(){return this.customContextStore.get();}},{key:"clearCustomContext",value:function clearCustomContext(){if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[['clearCustomContext']]);return;}this.customContextStore.clear();}// Start lifecycle methods
4172
+ this.startLifecycle();}},{key:"setCustomContext",value:function setCustomContext(context){var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[['setCustomContext',context]]);return;}this.customContextStore.set(context);}},{key:"getCustomContext",value:function getCustomContext(){return this.customContextStore.get();}},{key:"clearCustomContext",value:function clearCustomContext(){var isBufferedInvocation=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[['clearCustomContext']]);return;}this.customContextStore.clear();}// Start lifecycle methods
4172
4173
  /**
4173
4174
  * Orchestrate the lifecycle of the application phases/status
4174
- */},{key:"startLifecycle",value:function startLifecycle(){var _this=this;j(function(){try{switch(state.lifecycle.status.value){case 'mounted':_this.onMounted();break;case 'browserCapabilitiesReady':_this.onBrowserCapabilitiesReady();break;case 'configured':_this.onConfigured();break;case 'pluginsLoading':break;case 'pluginsReady':_this.onPluginsReady();break;case 'initialized':_this.onInitialized();break;case 'loaded':_this.onLoaded();break;case 'destinationsLoading':break;case 'destinationsReady':_this.onDestinationsReady();break;case 'ready':_this.onReady();break;case 'readyExecuted':default:break;}}catch(err){var issue='Failed to load the SDK';_this.errorHandler.onError({error:err,context:ANALYTICS_CORE,customMessage:issue,groupingHash:issue});}});}},{key:"onBrowserCapabilitiesReady",value:function onBrowserCapabilitiesReady(){// initialize the preloaded events enqueuing
4175
- retrievePreloadBufferEvents(this);this.prepareInternalServices();this.loadConfig();}},{key:"onLoaded",value:function onLoaded(){this.processBufferedEvents();// Short-circuit the life cycle and move to the ready state if pre-consent behavior is enabled
4175
+ */},{key:"startLifecycle",value:function startLifecycle(){var _this=this;j(function(){try{switch(state.lifecycle.status.value){case 'mounted':_this.onMounted();break;case 'browserCapabilitiesReady':_this.onBrowserCapabilitiesReady();break;case 'configured':_this.onConfigured();break;case 'pluginsLoading':break;case 'pluginsReady':_this.onPluginsReady();break;case 'initialized':_this.onInitialized();break;case 'loaded':_this.onLoaded();break;case 'destinationsLoading':break;case 'destinationsReady':_this.onDestinationsReady();break;case 'ready':_this.onReady();break;case 'readyExecuted':default:break;}}catch(err){var issue='Failed to load the SDK';void _this.errorHandler.onError({error:err,context:ANALYTICS_CORE,customMessage:issue,groupingHash:issue});}});}},{key:"onBrowserCapabilitiesReady",value:function onBrowserCapabilitiesReady(){// initialize the preloaded events enqueuing
4176
+ retrievePreloadBufferEvents(this);this.prepareInternalServices();this.loadConfig();}},{key:"onLoaded",value:function onLoaded(){// Short-circuit the life cycle and move to the ready state if pre-consent behavior is enabled
4176
4177
  if(state.consents.preConsent.value.enabled===true){state.lifecycle.status.value='ready';}else {this.loadDestinations();}}/**
4177
4178
  * Load browser polyfill if required
4178
4179
  */},{key:"onMounted",value:function onMounted(){this.capabilitiesManager.init();}/**
@@ -4193,9 +4194,12 @@ state.lifecycle.status.value='initialized';}/**
4193
4194
  // registerCustomPlugins(state.loadOptions.value.customPlugins);
4194
4195
  }/**
4195
4196
  * Trigger onLoaded callback if any is provided in config & emit initialised event
4196
- */},{key:"onInitialized",value:function onInitialized(){// Process any preloaded events
4197
- this.processDataInPreloadBuffer();// Set lifecycle state
4198
- n(function(){state.lifecycle.loaded.value=true;state.lifecycle.status.value='loaded';});this.initialized=true;// Execute onLoaded callback if provided in load options
4197
+ */},{key:"onInitialized",value:function onInitialized(){// Preloaded calls were made before the ones buffered while initializing, so queue them first.
4198
+ // Exception: they stay behind any consent call made while initializing, so that consent still
4199
+ // applies to them as it always has (see SDK-5623)
4200
+ var callsDuringInitialization=state.eventBuffer.toBeProcessedArray.value;state.eventBuffer.toBeProcessedArray.value=[];this.processDataInPreloadBuffer();var lastConsentIndex=callsDuringInitialization.map(function(_ref){var _ref2=_slicedToArray(_ref,1),type=_ref2[0];return type;}).lastIndexOf('consent');state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(callsDuringInitialization.slice(0,lastConsentIndex+1)),_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),_toConsumableArray(callsDuringInitialization.slice(lastConsentIndex+1)));// Set lifecycle state
4201
+ n(function(){state.lifecycle.loaded.value=true;state.lifecycle.status.value='loaded';});this.initialized=true;// Calls made while draining (e.g., from event callbacks) are queued behind the buffered ones
4202
+ this.isDrainingBuffer=true;try{this.processBufferedEvents();}finally{this.isDrainingBuffer=false;}// Execute onLoaded callback if provided in load options
4199
4203
  var onLoadedCallbackFn=state.loadOptions.value.onLoaded;// TODO: we need to avoid passing the window object to the callback function
4200
4204
  // as this will prevent us from supporting multiple SDK instances in the same page
4201
4205
  safelyInvokeCallback(onLoadedCallbackFn,[globalThis.rudderanalytics],LOAD_API,this.logger);// Emit an event to use as substitute to the onLoaded callback
@@ -4208,7 +4212,11 @@ dispatchSDKEvent('RSA_Ready');}/**
4208
4212
  */},{key:"processBufferedEvents",value:function processBufferedEvents(){// This logic has been intentionally implemented without a simple
4209
4213
  // for-loop as the individual events that are processed may
4210
4214
  // add more events to the buffer (this is needed for the consent API)
4211
- var bufferedEvents=state.eventBuffer.toBeProcessedArray.value;while(bufferedEvents.length>0){var bufferedEvent=bufferedEvents.shift();state.eventBuffer.toBeProcessedArray.value=bufferedEvents;if(bufferedEvent){this.processBufferedEvent(bufferedEvent);}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}},{key:"processBufferedEvent",value:function processBufferedEvent(bufferedEvent){switch(bufferedEvent[0]){case 'setCustomContext':this.setCustomContext(bufferedEvent[1]);break;case 'clearCustomContext':this.clearCustomContext();break;case 'ready':this.ready(bufferedEvent[1],true);break;case 'page':this.page(bufferedEvent[1],true,bufferedEvent[2]);break;case 'track':this.track(bufferedEvent[1],true,bufferedEvent[2]);break;case 'identify':this.identify(bufferedEvent[1],true,bufferedEvent[2]);break;case 'alias':this.alias(bufferedEvent[1],true,bufferedEvent[2]);break;case 'group':this.group(bufferedEvent[1],true,bufferedEvent[2]);break;case 'reset':this.reset(bufferedEvent[1],true);break;case 'setAnonymousId':this.setAnonymousId(bufferedEvent[1],bufferedEvent[2],true);break;case 'startSession':this.startSession(bufferedEvent[1],true);break;case 'endSession':this.endSession(true);break;case 'consent':this.consent(bufferedEvent[1],true);break;case 'addCustomIntegration':this.addCustomIntegration(bufferedEvent[1],bufferedEvent[2],true);break;default:{var unsupportedEvent=bufferedEvent;return unsupportedEvent;}}}},{key:"getInvocationContext",value:function getInvocationContext(preservedCustomContext){var _ref;if(preservedCustomContext===undefined){return this.customContextStore.get();}var preparedContext=prepareCustomContextUpdate(preservedCustomContext,this.logger);return (_ref=preparedContext)!==null&&_ref!==void 0?_ref:{};}/**
4215
+ var bufferedEvents=state.eventBuffer.toBeProcessedArray.value;while(bufferedEvents.length>0){var bufferedEvent=bufferedEvents.shift();state.eventBuffer.toBeProcessedArray.value=bufferedEvents;if(bufferedEvent){// A failing call must not stop the rest of the buffer or the load notifications
4216
+ try{this.processBufferedEvent(bufferedEvent);}catch(err){var issue='Failed to process a buffered API call';void this.errorHandler.onError({error:err,context:ANALYTICS_CORE,customMessage:issue,groupingHash:issue});}}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}},{key:"processBufferedEvent",value:function processBufferedEvent(bufferedEvent){switch(bufferedEvent[0]){case 'setCustomContext':this.setCustomContext(bufferedEvent[1],true);break;case 'clearCustomContext':this.clearCustomContext(true);break;case 'ready':this.ready(bufferedEvent[1],true);break;case 'page':this.page(bufferedEvent[1],true,bufferedEvent[2]);break;case 'track':this.track(bufferedEvent[1],true,bufferedEvent[2]);break;case 'identify':this.identify(bufferedEvent[1],true,bufferedEvent[2]);break;case 'alias':this.alias(bufferedEvent[1],true,bufferedEvent[2]);break;case 'group':this.group(bufferedEvent[1],true,bufferedEvent[2]);break;case 'reset':this.reset(bufferedEvent[1],true);break;case 'setAnonymousId':this.setAnonymousId(bufferedEvent[1],bufferedEvent[2],true);break;case 'startSession':this.startSession(bufferedEvent[1],true);break;case 'endSession':this.endSession(true);break;case 'consent':this.consent(bufferedEvent[1],true);break;case 'addCustomIntegration':this.addCustomIntegration(bufferedEvent[1],bufferedEvent[2],true);break;default:{var unsupportedEvent=bufferedEvent;return unsupportedEvent;}}}/**
4217
+ * Whether an API call must be queued instead of executed now: either the SDK is not loaded yet,
4218
+ * or the buffer is being drained and this call was not replayed from it
4219
+ */},{key:"shouldBuffer",value:function shouldBuffer(isBufferedInvocation){return !state.lifecycle.loaded.value||this.isDrainingBuffer&&!isBufferedInvocation;}},{key:"getInvocationContext",value:function getInvocationContext(preservedCustomContext){var _ref3;if(preservedCustomContext===undefined){return this.customContextStore.get();}var preparedContext=prepareCustomContextUpdate(preservedCustomContext,this.logger);return (_ref3=preparedContext)!==null&&_ref3!==void 0?_ref3:{};}/**
4212
4220
  * Load device mode destinations
4213
4221
  */},{key:"loadDestinations",value:function loadDestinations(){var _this$pluginsManager4,_this$pluginsManager5;// If the integrations load is already triggered or completed, skip the rest of the logic
4214
4222
  if(state.lifecycle.status.value==='destinationsLoading'||state.nativeDestinations.clientDestinationsReady.value===true){return;}// Set in state the desired activeDestinations to inject in DOM
@@ -4221,28 +4229,31 @@ j(function(){var areAllDestinationsReady=state.nativeDestinations.initializedDes
4221
4229
  // Mark the ready status if not already done
4222
4230
  if(state.lifecycle.status.value!=='ready'){n(function(){state.lifecycle.status.value='ready';});}}// End lifecycle methods
4223
4231
  // Start consumer exposed methods
4224
- },{key:"ready",value:function ready(callback){var type='ready';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,callback]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));if(!isFunction(callback)){this.logger.error(INVALID_CALLBACK_FN_ERROR(READY_API));return;}/**
4232
+ },{key:"ready",value:function ready(callback){var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var type='ready';if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,callback]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));if(!isFunction(callback)){this.logger.error(INVALID_CALLBACK_FN_ERROR(READY_API));return;}/**
4225
4233
  * If destinations are loaded or no integration is available for loading
4226
4234
  * execute the callback immediately else push the callbacks to a queue that
4227
4235
  * will be executed after loading completes
4228
- */if(state.lifecycle.status.value==='readyExecuted'){safelyInvokeCallback(callback,[],READY_API,this.logger);}else {state.eventBuffer.readyCallbacksArray.value=[].concat(_toConsumableArray(state.eventBuffer.readyCallbacksArray.value),[callback]);}}},{key:"page",value:function page(payload){var _this$eventManager2;var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var preservedCustomContext=arguments.length>2?arguments[2]:undefined;var type='page';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}var invocationContext=this.getInvocationContext(preservedCustomContext);this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;(_this$eventManager2=this.eventManager)===null||_this$eventManager2===void 0||_this$eventManager2.addEvent({type:'page',category:payload.category,name:payload.name,properties:payload.properties,options:payload.options,callback:payload.callback},invocationContext);// TODO: Maybe we should alter the behavior to send the ad-block page event even if the SDK is still loaded. It'll be pushed into the to be processed queue.
4236
+ */if(state.lifecycle.status.value==='readyExecuted'){safelyInvokeCallback(callback,[],READY_API,this.logger);}else {state.eventBuffer.readyCallbacksArray.value=[].concat(_toConsumableArray(state.eventBuffer.readyCallbacksArray.value),[callback]);}}},{key:"page",value:function page(payload){var _this$eventManager2;var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var preservedCustomContext=arguments.length>2?arguments[2]:undefined;var type='page';if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}var invocationContext=this.getInvocationContext(preservedCustomContext);this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;(_this$eventManager2=this.eventManager)===null||_this$eventManager2===void 0||_this$eventManager2.addEvent({type:'page',category:payload.category,name:payload.name,properties:payload.properties,options:payload.options,callback:payload.callback},invocationContext);// TODO: Maybe we should alter the behavior to send the ad-block page event even if the SDK is still loaded. It'll be pushed into the to be processed queue.
4229
4237
  // Send automatic ad blocked page event if ad-blockers are detected on the page
4230
4238
  // Check page category to avoid infinite loop
4231
4239
  if(state.capabilities.isAdBlocked.value===true&&payload.category!==ADBLOCK_PAGE_CATEGORY){this.page(pageArgumentsToCallOptions(ADBLOCK_PAGE_CATEGORY,ADBLOCK_PAGE_NAME,{// 'title' is intentionally omitted as it does not make sense
4232
4240
  // in v3 implementation
4233
- path:ADBLOCK_PAGE_PATH},state.loadOptions.value.sendAdblockPageOptions),isBufferedInvocation,invocationContext);}}},{key:"track",value:function track(payload){var _this$eventManager3;var preservedCustomContext=arguments.length>2?arguments[2]:undefined;var type='track';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}var invocationContext=this.getInvocationContext(preservedCustomContext);this.errorHandler.leaveBreadcrumb("New ".concat(type," event - ").concat(payload.name));state.metrics.triggered.value+=1;(_this$eventManager3=this.eventManager)===null||_this$eventManager3===void 0||_this$eventManager3.addEvent({type:type,name:payload.name||undefined,properties:payload.properties,options:payload.options,callback:payload.callback},invocationContext);}},{key:"identify",value:function identify(payload){var _this$userSessionMana3,_this$eventManager4;var preservedCustomContext=arguments.length>2?arguments[2]:undefined;var type='identify';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}var invocationContext=this.getInvocationContext(preservedCustomContext);this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;var shouldResetSession=Boolean(payload.userId&&state.session.userId.value&&payload.userId!==state.session.userId.value);if(shouldResetSession){this.reset();}// `null` value indicates that previous user ID needs to be retained
4234
- if(!isNull(payload.userId)){var _this$userSessionMana2;(_this$userSessionMana2=this.userSessionManager)===null||_this$userSessionMana2===void 0||_this$userSessionMana2.setUserId(payload.userId);}(_this$userSessionMana3=this.userSessionManager)===null||_this$userSessionMana3===void 0||_this$userSessionMana3.setUserTraits(payload.traits);(_this$eventManager4=this.eventManager)===null||_this$eventManager4===void 0||_this$eventManager4.addEvent({type:type,userId:payload.userId,traits:payload.traits,options:payload.options,callback:payload.callback},invocationContext);}},{key:"alias",value:function alias(payload){var _payload$from,_this$userSessionMana4,_this$eventManager5;var preservedCustomContext=arguments.length>2?arguments[2]:undefined;var type='alias';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}var invocationContext=this.getInvocationContext(preservedCustomContext);this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;var previousId=(_payload$from=payload.from)!==null&&_payload$from!==void 0?_payload$from:this.getUserId()||((_this$userSessionMana4=this.userSessionManager)===null||_this$userSessionMana4===void 0?void 0:_this$userSessionMana4.getAnonymousId());(_this$eventManager5=this.eventManager)===null||_this$eventManager5===void 0||_this$eventManager5.addEvent({type:type,to:payload.to,from:previousId,options:payload.options,callback:payload.callback},invocationContext);}},{key:"group",value:function group(payload){var _this$userSessionMana6,_this$eventManager6;var preservedCustomContext=arguments.length>2?arguments[2]:undefined;var type='group';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}var invocationContext=this.getInvocationContext(preservedCustomContext);this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;// `null` value indicates that previous group ID needs to be retained
4235
- if(!isNull(payload.groupId)){var _this$userSessionMana5;(_this$userSessionMana5=this.userSessionManager)===null||_this$userSessionMana5===void 0||_this$userSessionMana5.setGroupId(payload.groupId);}(_this$userSessionMana6=this.userSessionManager)===null||_this$userSessionMana6===void 0||_this$userSessionMana6.setGroupTraits(payload.traits);(_this$eventManager6=this.eventManager)===null||_this$eventManager6===void 0||_this$eventManager6.addEvent({type:type,groupId:payload.groupId,traits:payload.traits,options:payload.options,callback:payload.callback},invocationContext);}},{key:"reset",value:function reset(options){var _this$userSessionMana7;var type='reset';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,options]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));(_this$userSessionMana7=this.userSessionManager)===null||_this$userSessionMana7===void 0||_this$userSessionMana7.reset(options);}},{key:"getAnonymousId",value:function getAnonymousId(options){var _this$userSessionMana8;return (_this$userSessionMana8=this.userSessionManager)===null||_this$userSessionMana8===void 0?void 0:_this$userSessionMana8.getAnonymousId(options);}},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){var _this$userSessionMana9;var type='setAnonymousId';// Buffering is needed as setting the anonymous ID may require invoking the GoogleLinker plugin
4236
- if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,anonymousId,rudderAmpLinkerParam]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));(_this$userSessionMana9=this.userSessionManager)===null||_this$userSessionMana9===void 0||_this$userSessionMana9.setAnonymousId(anonymousId,rudderAmpLinkerParam);}// eslint-disable-next-line class-methods-use-this
4241
+ path:ADBLOCK_PAGE_PATH},state.loadOptions.value.sendAdblockPageOptions),isBufferedInvocation,invocationContext);}}},{key:"track",value:function track(payload){var _this$eventManager3;var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var preservedCustomContext=arguments.length>2?arguments[2]:undefined;var type='track';if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}var invocationContext=this.getInvocationContext(preservedCustomContext);this.errorHandler.leaveBreadcrumb("New ".concat(type," event - ").concat(payload.name));state.metrics.triggered.value+=1;(_this$eventManager3=this.eventManager)===null||_this$eventManager3===void 0||_this$eventManager3.addEvent({type:type,name:payload.name||undefined,properties:payload.properties,options:payload.options,callback:payload.callback},invocationContext);}},{key:"identify",value:function identify(payload){var _this$userSessionMana3,_this$eventManager4;var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var preservedCustomContext=arguments.length>2?arguments[2]:undefined;var type='identify';if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}var invocationContext=this.getInvocationContext(preservedCustomContext);this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;var shouldResetSession=Boolean(payload.userId&&state.session.userId.value&&payload.userId!==state.session.userId.value);if(shouldResetSession){// Part of this identify call, so it must not be deferred behind other buffered calls
4242
+ this.reset(undefined,true);}// `null` value indicates that previous user ID needs to be retained
4243
+ if(!isNull(payload.userId)){var _this$userSessionMana2;(_this$userSessionMana2=this.userSessionManager)===null||_this$userSessionMana2===void 0||_this$userSessionMana2.setUserId(payload.userId);}(_this$userSessionMana3=this.userSessionManager)===null||_this$userSessionMana3===void 0||_this$userSessionMana3.setUserTraits(payload.traits);(_this$eventManager4=this.eventManager)===null||_this$eventManager4===void 0||_this$eventManager4.addEvent({type:type,userId:payload.userId,traits:payload.traits,options:payload.options,callback:payload.callback},invocationContext);}},{key:"alias",value:function alias(payload){var _payload$from,_this$userSessionMana4,_this$eventManager5;var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var preservedCustomContext=arguments.length>2?arguments[2]:undefined;var type='alias';if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}var invocationContext=this.getInvocationContext(preservedCustomContext);this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;var previousId=(_payload$from=payload.from)!==null&&_payload$from!==void 0?_payload$from:this.getUserId()||((_this$userSessionMana4=this.userSessionManager)===null||_this$userSessionMana4===void 0?void 0:_this$userSessionMana4.getAnonymousId());(_this$eventManager5=this.eventManager)===null||_this$eventManager5===void 0||_this$eventManager5.addEvent({type:type,to:payload.to,from:previousId,options:payload.options,callback:payload.callback},invocationContext);}},{key:"group",value:function group(payload){var _this$userSessionMana6,_this$eventManager6;var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var preservedCustomContext=arguments.length>2?arguments[2]:undefined;var type='group';if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}var invocationContext=this.getInvocationContext(preservedCustomContext);this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;// `null` value indicates that previous group ID needs to be retained
4244
+ if(!isNull(payload.groupId)){var _this$userSessionMana5;(_this$userSessionMana5=this.userSessionManager)===null||_this$userSessionMana5===void 0||_this$userSessionMana5.setGroupId(payload.groupId);}(_this$userSessionMana6=this.userSessionManager)===null||_this$userSessionMana6===void 0||_this$userSessionMana6.setGroupTraits(payload.traits);(_this$eventManager6=this.eventManager)===null||_this$eventManager6===void 0||_this$eventManager6.addEvent({type:type,groupId:payload.groupId,traits:payload.traits,options:payload.options,callback:payload.callback},invocationContext);}},{key:"reset",value:function reset(options){var _this$userSessionMana7;var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var type='reset';if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,options]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));(_this$userSessionMana7=this.userSessionManager)===null||_this$userSessionMana7===void 0||_this$userSessionMana7.reset(options);}},{key:"getAnonymousId",value:function getAnonymousId(options){var _this$userSessionMana8;return (_this$userSessionMana8=this.userSessionManager)===null||_this$userSessionMana8===void 0?void 0:_this$userSessionMana8.getAnonymousId(options);}},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){var _this$userSessionMana9;var isBufferedInvocation=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var type='setAnonymousId';// Buffering is needed as setting the anonymous ID may require invoking the GoogleLinker plugin
4245
+ if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,anonymousId,rudderAmpLinkerParam]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));(_this$userSessionMana9=this.userSessionManager)===null||_this$userSessionMana9===void 0||_this$userSessionMana9.setAnonymousId(anonymousId,rudderAmpLinkerParam);}// eslint-disable-next-line class-methods-use-this
4237
4246
  },{key:"getUserId",value:function getUserId(){return state.session.userId.value;}// eslint-disable-next-line class-methods-use-this
4238
4247
  },{key:"getUserTraits",value:function getUserTraits(){return state.session.userTraits.value;}// eslint-disable-next-line class-methods-use-this
4239
4248
  },{key:"getGroupId",value:function getGroupId(){return state.session.groupId.value;}// eslint-disable-next-line class-methods-use-this
4240
- },{key:"getGroupTraits",value:function getGroupTraits(){return state.session.groupTraits.value;}},{key:"startSession",value:function startSession(sessionId){var _this$userSessionMana0;var type='startSession';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,sessionId]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));(_this$userSessionMana0=this.userSessionManager)===null||_this$userSessionMana0===void 0||_this$userSessionMana0.start(sessionId);}},{key:"endSession",value:function endSession(){var _this$userSessionMana1;var type='endSession';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));(_this$userSessionMana1=this.userSessionManager)===null||_this$userSessionMana1===void 0||_this$userSessionMana1.end();}// eslint-disable-next-line class-methods-use-this
4241
- },{key:"getSessionId",value:function getSessionId(){var _this$userSessionMana10;var sessionId=(_this$userSessionMana10=this.userSessionManager)===null||_this$userSessionMana10===void 0?void 0:_this$userSessionMana10.getSessionId();return sessionId!==null&&sessionId!==void 0?sessionId:null;}},{key:"consent",value:function consent(options){var _this4=this,_this$storeManager2,_this$userSessionMana11,_this$eventManager7;var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var type='consent';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,options]]);return;}this.errorHandler.leaveBreadcrumb("New consent invocation");n(function(){state.consents.preConsent.value=_objectSpread2(_objectSpread2({},state.consents.preConsent.value),{},{enabled:false});state.consents.postConsent.value=getValidPostConsentOptions(options,_this4.logger);var _getConsentManagement=getConsentManagementData(state.consents.postConsent.value.consentManagement,_this4.logger),initialized=_getConsentManagement.initialized,consentsData=_getConsentManagement.consentsData;state.consents.initialized.value=initialized;state.consents.data.value=consentsData;});// Update consents data in state
4249
+ },{key:"getGroupTraits",value:function getGroupTraits(){return state.session.groupTraits.value;}},{key:"startSession",value:function startSession(sessionId){var _this$userSessionMana0;var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var type='startSession';if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,sessionId]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));(_this$userSessionMana0=this.userSessionManager)===null||_this$userSessionMana0===void 0||_this$userSessionMana0.start(sessionId);}},{key:"endSession",value:function endSession(){var _this$userSessionMana1;var isBufferedInvocation=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var type='endSession';if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));(_this$userSessionMana1=this.userSessionManager)===null||_this$userSessionMana1===void 0||_this$userSessionMana1.end();}// eslint-disable-next-line class-methods-use-this
4250
+ },{key:"getSessionId",value:function getSessionId(){var _this$userSessionMana10;var sessionId=(_this$userSessionMana10=this.userSessionManager)===null||_this$userSessionMana10===void 0?void 0:_this$userSessionMana10.getSessionId();return sessionId!==null&&sessionId!==void 0?sessionId:null;}},{key:"consent",value:function consent(options){var _this4=this,_this$storeManager2,_this$userSessionMana11,_this$eventManager7;var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var type='consent';if(this.shouldBuffer(isBufferedInvocation)){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,options]]);return;}this.errorHandler.leaveBreadcrumb("New consent invocation");n(function(){state.consents.preConsent.value=_objectSpread2(_objectSpread2({},state.consents.preConsent.value),{},{enabled:false});state.consents.postConsent.value=getValidPostConsentOptions(options,_this4.logger);var _getConsentManagement=getConsentManagementData(state.consents.postConsent.value.consentManagement,_this4.logger),initialized=_getConsentManagement.initialized,consentsData=_getConsentManagement.consentsData;state.consents.initialized.value=initialized;state.consents.data.value=consentsData;});// Update consents data in state
4242
4251
  if(state.consents.enabled.value&&!state.consents.initialized.value){var _this$pluginsManager6;(_this$pluginsManager6=this.pluginsManager)===null||_this$pluginsManager6===void 0||_this$pluginsManager6.invokeSingle("consentManager.updateConsentsInfo",state,this.storeManager,this.logger);}// Re-init store manager
4243
4252
  (_this$storeManager2=this.storeManager)===null||_this$storeManager2===void 0||_this$storeManager2.initializeStorageState();// Re-init user session manager
4244
4253
  (_this$userSessionMana11=this.userSessionManager)===null||_this$userSessionMana11===void 0||_this$userSessionMana11.syncStorageDataToState();// Resume event manager to process the events to destinations
4245
- (_this$eventManager7=this.eventManager)===null||_this$eventManager7===void 0||_this$eventManager7.resume();this.loadDestinations();this.sendTrackingEvents(isBufferedInvocation);}},{key:"sendTrackingEvents",value:function sendTrackingEvents(isBufferedInvocation){// If isBufferedInvocation is true, then the tracking events will be added to the end of the
4254
+ (_this$eventManager7=this.eventManager)===null||_this$eventManager7===void 0||_this$eventManager7.resume();// While replaying, defer to the 'loaded' lifecycle handler so that custom integrations
4255
+ // added later in the buffer are registered before destinations are loaded
4256
+ if(!this.isDrainingBuffer){this.loadDestinations();}this.sendTrackingEvents(isBufferedInvocation);}},{key:"sendTrackingEvents",value:function sendTrackingEvents(isBufferedInvocation){// If isBufferedInvocation is true, then the tracking events will be added to the end of the
4246
4257
  // events buffer array so that any other preload events (mainly from query string API) will be processed first.
4247
4258
  if(state.consents.postConsent.value.trackConsent){var trackOptions=trackArgumentsToCallOptions(CONSENT_TRACK_EVENT_NAME);if(isBufferedInvocation){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[['track',trackOptions,this.customContextStore.get()]]);}else {this.track(trackOptions);}}if(state.consents.postConsent.value.sendPageEvent){var pageOptions=pageArgumentsToCallOptions();if(isBufferedInvocation){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[['page',pageOptions,this.customContextStore.get()]]);}else {this.page(pageOptions);}}}},{key:"setAuthToken",value:function setAuthToken(token){var _this$userSessionMana12;(_this$userSessionMana12=this.userSessionManager)===null||_this$userSessionMana12===void 0||_this$userSessionMana12.setAuthToken(token);}/**
4248
4259
  * Add a custom integration for a custom destination.