@rudderstack/analytics-js 3.11.13 → 3.11.15

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [3.11.15](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.11.14...@rudderstack/analytics-js@3.11.15) (2024-12-06)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@rudderstack/analytics-js-cookies` updated to version `0.4.16`
10
+ * `@rudderstack/analytics-js-common` updated to version `3.14.13`
11
+ * `@rudderstack/analytics-js-plugins` updated to version `3.6.18`
12
+ ## [3.11.14](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.11.13...@rudderstack/analytics-js@3.11.14) (2024-11-30)
13
+
14
+ ### Dependency Updates
15
+
16
+ * `@rudderstack/analytics-js-plugins` updated to version `3.6.17`
17
+
18
+ ### Bug Fixes
19
+
20
+ * preload events not processed with detached load call ([#1953](https://github.com/rudderlabs/rudder-sdk-js/issues/1953)) ([6b0f66f](https://github.com/rudderlabs/rudder-sdk-js/commit/6b0f66f61745542f2b01c02c99b7514fd468db80))
21
+
5
22
  ## [3.11.13](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.11.12...@rudderstack/analytics-js@3.11.13) (2024-11-22)
6
23
 
7
24
  ### Dependency Updates
@@ -987,11 +987,6 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
987
987
  * @returns none
988
988
  */
989
989
  load(writeKey: string, dataPlaneUrl: string, loadOptions?: Partial<LoadOptions>): void;
990
- /**
991
- * A function to get preloaded events array from global object
992
- * @returns preloaded events array
993
- */
994
- getPreloadedEvents(): PreloadedEventCall[];
995
990
  /**
996
991
  * A function to track page lifecycle events like page loaded and page unloaded
997
992
  * @param preloadedEventsArray
@@ -987,11 +987,6 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
987
987
  * @returns none
988
988
  */
989
989
  load(writeKey: string, dataPlaneUrl: string, loadOptions?: Partial<LoadOptions>): void;
990
- /**
991
- * A function to get preloaded events array from global object
992
- * @returns preloaded events array
993
- */
994
- getPreloadedEvents(): PreloadedEventCall[];
995
990
  /**
996
991
  * A function to track page lifecycle events like page loaded and page unloaded
997
992
  * @param preloadedEventsArray
@@ -1027,7 +1027,7 @@ var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
1027
1027
  * @returns Instance of Error with message prepended with issue
1028
1028
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1029
1029
 
1030
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.13';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1030
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.15';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1031
1031
 
1032
1032
  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';
1033
1033
 
@@ -1688,7 +1688,7 @@ var DIR_NAME$2='Ninetailed';var NAME$2='NINETAILED';var DISPLAY_NAME$2='Ninetail
1688
1688
 
1689
1689
  var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
1690
1690
 
1691
- var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPIXEL",NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1691
+ var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1692
1692
 
1693
1693
  var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
1694
1694
  var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
@@ -4014,13 +4014,11 @@ if(isString(writeKey)&&writeKey){this.defaultAnalyticsKey=writeKey;}}/**
4014
4014
  * @param dataPlaneUrl Data plane URL
4015
4015
  * @param loadOptions Additional options for loading the SDK
4016
4016
  * @returns none
4017
- */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);var preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
4017
+ */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
4018
+ // as the constructor must have already pushed the events to the global buffer
4019
+ var preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
4018
4020
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
4019
4021
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();(_this$getAnalyticsIns=this.getAnalyticsInstance(writeKey))===null||_this$getAnalyticsIns===void 0||_this$getAnalyticsIns.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
4020
- * A function to get preloaded events array from global object
4021
- * @returns preloaded events array
4022
- */// eslint-disable-next-line class-methods-use-this
4023
- },{key:"getPreloadedEvents",value:function getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
4024
4022
  * A function to track page lifecycle events like page loaded and page unloaded
4025
4023
  * @param preloadedEventsArray
4026
4024
  * @param loadOptions
@@ -4043,11 +4041,11 @@ state.autoTrack.enabled.value=autoTrackEnabled||pageLifecycleEnabled;if(!pageLif
4043
4041
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
4044
4042
  * Trigger load event in buffer queue if exists and stores the
4045
4043
  * remaining preloaded events array in global object
4046
- */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
4044
+ */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
4047
4045
  // BTW, load method is also removed from the array
4048
4046
  // So, the Analytics object can directly consume the remaining events
4049
4047
  var loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
4050
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
4048
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(_toConsumableArray(preloadedEventsArray)));// Process load method if present in the buffered requests
4051
4049
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
4052
4050
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4053
4051
  // @ts-ignore
@@ -1025,7 +1025,7 @@ var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
1025
1025
  * @returns Instance of Error with message prepended with issue
1026
1026
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1027
1027
 
1028
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.13';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1028
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.15';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1029
1029
 
1030
1030
  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';
1031
1031
 
@@ -1686,7 +1686,7 @@ var DIR_NAME$2='Ninetailed';var NAME$2='NINETAILED';var DISPLAY_NAME$2='Ninetail
1686
1686
 
1687
1687
  var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
1688
1688
 
1689
- var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPIXEL",NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1689
+ var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1690
1690
 
1691
1691
  var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
1692
1692
  var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
@@ -4012,13 +4012,11 @@ if(isString(writeKey)&&writeKey){this.defaultAnalyticsKey=writeKey;}}/**
4012
4012
  * @param dataPlaneUrl Data plane URL
4013
4013
  * @param loadOptions Additional options for loading the SDK
4014
4014
  * @returns none
4015
- */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);var preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
4015
+ */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
4016
+ // as the constructor must have already pushed the events to the global buffer
4017
+ var preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
4016
4018
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
4017
4019
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();(_this$getAnalyticsIns=this.getAnalyticsInstance(writeKey))===null||_this$getAnalyticsIns===void 0||_this$getAnalyticsIns.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
4018
- * A function to get preloaded events array from global object
4019
- * @returns preloaded events array
4020
- */// eslint-disable-next-line class-methods-use-this
4021
- },{key:"getPreloadedEvents",value:function getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
4022
4020
  * A function to track page lifecycle events like page loaded and page unloaded
4023
4021
  * @param preloadedEventsArray
4024
4022
  * @param loadOptions
@@ -4041,11 +4039,11 @@ state.autoTrack.enabled.value=autoTrackEnabled||pageLifecycleEnabled;if(!pageLif
4041
4039
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
4042
4040
  * Trigger load event in buffer queue if exists and stores the
4043
4041
  * remaining preloaded events array in global object
4044
- */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
4042
+ */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
4045
4043
  // BTW, load method is also removed from the array
4046
4044
  // So, the Analytics object can directly consume the remaining events
4047
4045
  var loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
4048
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
4046
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(_toConsumableArray(preloadedEventsArray)));// Process load method if present in the buffered requests
4049
4047
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
4050
4048
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4051
4049
  // @ts-ignore
@@ -1031,7 +1031,7 @@
1031
1031
  * @returns Instance of Error with message prepended with issue
1032
1032
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1033
1033
 
1034
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.13';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1034
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.15';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1035
1035
 
1036
1036
  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';
1037
1037
 
@@ -1692,7 +1692,7 @@
1692
1692
 
1693
1693
  var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
1694
1694
 
1695
- var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPIXEL",NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1695
+ var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1696
1696
 
1697
1697
  var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
1698
1698
  var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
@@ -4018,13 +4018,11 @@
4018
4018
  * @param dataPlaneUrl Data plane URL
4019
4019
  * @param loadOptions Additional options for loading the SDK
4020
4020
  * @returns none
4021
- */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);var preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
4021
+ */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
4022
+ // as the constructor must have already pushed the events to the global buffer
4023
+ var preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
4022
4024
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
4023
4025
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();(_this$getAnalyticsIns=this.getAnalyticsInstance(writeKey))===null||_this$getAnalyticsIns===void 0||_this$getAnalyticsIns.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
4024
- * A function to get preloaded events array from global object
4025
- * @returns preloaded events array
4026
- */// eslint-disable-next-line class-methods-use-this
4027
- },{key:"getPreloadedEvents",value:function getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
4028
4026
  * A function to track page lifecycle events like page loaded and page unloaded
4029
4027
  * @param preloadedEventsArray
4030
4028
  * @param loadOptions
@@ -4047,11 +4045,11 @@
4047
4045
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
4048
4046
  * Trigger load event in buffer queue if exists and stores the
4049
4047
  * remaining preloaded events array in global object
4050
- */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
4048
+ */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
4051
4049
  // BTW, load method is also removed from the array
4052
4050
  // So, the Analytics object can directly consume the remaining events
4053
4051
  var loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
4054
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
4052
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(_toConsumableArray(preloadedEventsArray)));// Process load method if present in the buffered requests
4055
4053
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
4056
4054
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4057
4055
  // @ts-ignore
@@ -1027,7 +1027,7 @@ var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
1027
1027
  * @returns Instance of Error with message prepended with issue
1028
1028
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1029
1029
 
1030
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.13';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1030
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.15';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1031
1031
 
1032
1032
  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';
1033
1033
 
@@ -1688,7 +1688,7 @@ var DIR_NAME$2='Ninetailed';var NAME$2='NINETAILED';var DISPLAY_NAME$2='Ninetail
1688
1688
 
1689
1689
  var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
1690
1690
 
1691
- var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPIXEL",NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1691
+ var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1692
1692
 
1693
1693
  var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
1694
1694
  var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
@@ -4014,13 +4014,11 @@ if(isString(writeKey)&&writeKey){this.defaultAnalyticsKey=writeKey;}}/**
4014
4014
  * @param dataPlaneUrl Data plane URL
4015
4015
  * @param loadOptions Additional options for loading the SDK
4016
4016
  * @returns none
4017
- */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);var preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
4017
+ */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
4018
+ // as the constructor must have already pushed the events to the global buffer
4019
+ var preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
4018
4020
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
4019
4021
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();(_this$getAnalyticsIns=this.getAnalyticsInstance(writeKey))===null||_this$getAnalyticsIns===void 0||_this$getAnalyticsIns.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
4020
- * A function to get preloaded events array from global object
4021
- * @returns preloaded events array
4022
- */// eslint-disable-next-line class-methods-use-this
4023
- },{key:"getPreloadedEvents",value:function getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
4024
4022
  * A function to track page lifecycle events like page loaded and page unloaded
4025
4023
  * @param preloadedEventsArray
4026
4024
  * @param loadOptions
@@ -4043,11 +4041,11 @@ state.autoTrack.enabled.value=autoTrackEnabled||pageLifecycleEnabled;if(!pageLif
4043
4041
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
4044
4042
  * Trigger load event in buffer queue if exists and stores the
4045
4043
  * remaining preloaded events array in global object
4046
- */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
4044
+ */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
4047
4045
  // BTW, load method is also removed from the array
4048
4046
  // So, the Analytics object can directly consume the remaining events
4049
4047
  var loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
4050
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
4048
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(_toConsumableArray(preloadedEventsArray)));// Process load method if present in the buffered requests
4051
4049
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
4052
4050
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4053
4051
  // @ts-ignore
@@ -1027,7 +1027,7 @@ var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
1027
1027
  * @returns Instance of Error with message prepended with issue
1028
1028
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1029
1029
 
1030
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.13';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1030
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.15';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1031
1031
 
1032
1032
  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';
1033
1033
 
@@ -1664,7 +1664,7 @@ var DIR_NAME$2='Ninetailed';var NAME$2='NINETAILED';var DISPLAY_NAME$2='Ninetail
1664
1664
 
1665
1665
  var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
1666
1666
 
1667
- var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPIXEL",NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1667
+ var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1668
1668
 
1669
1669
  var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
1670
1670
  var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
@@ -3990,13 +3990,11 @@ if(isString(writeKey)&&writeKey){this.defaultAnalyticsKey=writeKey;}}/**
3990
3990
  * @param dataPlaneUrl Data plane URL
3991
3991
  * @param loadOptions Additional options for loading the SDK
3992
3992
  * @returns none
3993
- */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);var preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
3993
+ */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
3994
+ // as the constructor must have already pushed the events to the global buffer
3995
+ var preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
3994
3996
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
3995
3997
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();(_this$getAnalyticsIns=this.getAnalyticsInstance(writeKey))===null||_this$getAnalyticsIns===void 0||_this$getAnalyticsIns.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
3996
- * A function to get preloaded events array from global object
3997
- * @returns preloaded events array
3998
- */// eslint-disable-next-line class-methods-use-this
3999
- },{key:"getPreloadedEvents",value:function getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
4000
3998
  * A function to track page lifecycle events like page loaded and page unloaded
4001
3999
  * @param preloadedEventsArray
4002
4000
  * @param loadOptions
@@ -4019,11 +4017,11 @@ state.autoTrack.enabled.value=autoTrackEnabled||pageLifecycleEnabled;if(!pageLif
4019
4017
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
4020
4018
  * Trigger load event in buffer queue if exists and stores the
4021
4019
  * remaining preloaded events array in global object
4022
- */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
4020
+ */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
4023
4021
  // BTW, load method is also removed from the array
4024
4022
  // So, the Analytics object can directly consume the remaining events
4025
4023
  var loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
4026
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
4024
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(_toConsumableArray(preloadedEventsArray)));// Process load method if present in the buffered requests
4027
4025
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
4028
4026
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4029
4027
  // @ts-ignore
@@ -1025,7 +1025,7 @@ var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
1025
1025
  * @returns Instance of Error with message prepended with issue
1026
1026
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1027
1027
 
1028
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.13';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1028
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.15';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1029
1029
 
1030
1030
  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';
1031
1031
 
@@ -1662,7 +1662,7 @@ var DIR_NAME$2='Ninetailed';var NAME$2='NINETAILED';var DISPLAY_NAME$2='Ninetail
1662
1662
 
1663
1663
  var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
1664
1664
 
1665
- var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPIXEL",NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1665
+ var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1666
1666
 
1667
1667
  var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
1668
1668
  var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
@@ -3988,13 +3988,11 @@ if(isString(writeKey)&&writeKey){this.defaultAnalyticsKey=writeKey;}}/**
3988
3988
  * @param dataPlaneUrl Data plane URL
3989
3989
  * @param loadOptions Additional options for loading the SDK
3990
3990
  * @returns none
3991
- */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);var preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
3991
+ */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
3992
+ // as the constructor must have already pushed the events to the global buffer
3993
+ var preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
3992
3994
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
3993
3995
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();(_this$getAnalyticsIns=this.getAnalyticsInstance(writeKey))===null||_this$getAnalyticsIns===void 0||_this$getAnalyticsIns.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
3994
- * A function to get preloaded events array from global object
3995
- * @returns preloaded events array
3996
- */// eslint-disable-next-line class-methods-use-this
3997
- },{key:"getPreloadedEvents",value:function getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
3998
3996
  * A function to track page lifecycle events like page loaded and page unloaded
3999
3997
  * @param preloadedEventsArray
4000
3998
  * @param loadOptions
@@ -4017,11 +4015,11 @@ state.autoTrack.enabled.value=autoTrackEnabled||pageLifecycleEnabled;if(!pageLif
4017
4015
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
4018
4016
  * Trigger load event in buffer queue if exists and stores the
4019
4017
  * remaining preloaded events array in global object
4020
- */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
4018
+ */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
4021
4019
  // BTW, load method is also removed from the array
4022
4020
  // So, the Analytics object can directly consume the remaining events
4023
4021
  var loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
4024
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
4022
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(_toConsumableArray(preloadedEventsArray)));// Process load method if present in the buffered requests
4025
4023
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
4026
4024
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4027
4025
  // @ts-ignore
@@ -1031,7 +1031,7 @@
1031
1031
  * @returns Instance of Error with message prepended with issue
1032
1032
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1033
1033
 
1034
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.13';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1034
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.15';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1035
1035
 
1036
1036
  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';
1037
1037
 
@@ -1668,7 +1668,7 @@
1668
1668
 
1669
1669
  var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
1670
1670
 
1671
- var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPIXEL",NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1671
+ var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1672
1672
 
1673
1673
  var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
1674
1674
  var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
@@ -3994,13 +3994,11 @@
3994
3994
  * @param dataPlaneUrl Data plane URL
3995
3995
  * @param loadOptions Additional options for loading the SDK
3996
3996
  * @returns none
3997
- */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);var preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
3997
+ */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
3998
+ // as the constructor must have already pushed the events to the global buffer
3999
+ var preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
3998
4000
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
3999
4001
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();(_this$getAnalyticsIns=this.getAnalyticsInstance(writeKey))===null||_this$getAnalyticsIns===void 0||_this$getAnalyticsIns.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
4000
- * A function to get preloaded events array from global object
4001
- * @returns preloaded events array
4002
- */// eslint-disable-next-line class-methods-use-this
4003
- },{key:"getPreloadedEvents",value:function getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
4004
4002
  * A function to track page lifecycle events like page loaded and page unloaded
4005
4003
  * @param preloadedEventsArray
4006
4004
  * @param loadOptions
@@ -4023,11 +4021,11 @@
4023
4021
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
4024
4022
  * Trigger load event in buffer queue if exists and stores the
4025
4023
  * remaining preloaded events array in global object
4026
- */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
4024
+ */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
4027
4025
  // BTW, load method is also removed from the array
4028
4026
  // So, the Analytics object can directly consume the remaining events
4029
4027
  var loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
4030
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
4028
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(_toConsumableArray(preloadedEventsArray)));// Process load method if present in the buffered requests
4031
4029
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
4032
4030
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4033
4031
  // @ts-ignore
@@ -1025,7 +1025,7 @@ var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
1025
1025
  * @returns Instance of Error with message prepended with issue
1026
1026
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1027
1027
 
1028
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.13';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1028
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.15';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1029
1029
 
1030
1030
  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';
1031
1031
 
@@ -1686,7 +1686,7 @@ var DIR_NAME$2='Ninetailed';var NAME$2='NINETAILED';var DISPLAY_NAME$2='Ninetail
1686
1686
 
1687
1687
  var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
1688
1688
 
1689
- var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPIXEL",NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1689
+ var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1690
1690
 
1691
1691
  var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
1692
1692
  var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
@@ -4012,13 +4012,11 @@ if(isString(writeKey)&&writeKey){this.defaultAnalyticsKey=writeKey;}}/**
4012
4012
  * @param dataPlaneUrl Data plane URL
4013
4013
  * @param loadOptions Additional options for loading the SDK
4014
4014
  * @returns none
4015
- */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);var preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
4015
+ */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
4016
+ // as the constructor must have already pushed the events to the global buffer
4017
+ var preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
4016
4018
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
4017
4019
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();(_this$getAnalyticsIns=this.getAnalyticsInstance(writeKey))===null||_this$getAnalyticsIns===void 0||_this$getAnalyticsIns.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
4018
- * A function to get preloaded events array from global object
4019
- * @returns preloaded events array
4020
- */// eslint-disable-next-line class-methods-use-this
4021
- },{key:"getPreloadedEvents",value:function getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
4022
4020
  * A function to track page lifecycle events like page loaded and page unloaded
4023
4021
  * @param preloadedEventsArray
4024
4022
  * @param loadOptions
@@ -4041,11 +4039,11 @@ state.autoTrack.enabled.value=autoTrackEnabled||pageLifecycleEnabled;if(!pageLif
4041
4039
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
4042
4040
  * Trigger load event in buffer queue if exists and stores the
4043
4041
  * remaining preloaded events array in global object
4044
- */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
4042
+ */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
4045
4043
  // BTW, load method is also removed from the array
4046
4044
  // So, the Analytics object can directly consume the remaining events
4047
4045
  var loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
4048
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
4046
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(_toConsumableArray(preloadedEventsArray)));// Process load method if present in the buffered requests
4049
4047
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
4050
4048
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4051
4049
  // @ts-ignore
@@ -1031,7 +1031,7 @@
1031
1031
  * @returns Instance of Error with message prepended with issue
1032
1032
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1033
1033
 
1034
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.13';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1034
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.15';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';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';
1035
1035
 
1036
1036
  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';
1037
1037
 
@@ -1692,7 +1692,7 @@
1692
1692
 
1693
1693
  var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
1694
1694
 
1695
- var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPIXEL",NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1695
+ var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
1696
1696
 
1697
1697
  var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
1698
1698
  var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
@@ -4018,13 +4018,11 @@
4018
4018
  * @param dataPlaneUrl Data plane URL
4019
4019
  * @param loadOptions Additional options for loading the SDK
4020
4020
  * @returns none
4021
- */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);var preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
4021
+ */},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){try{var _this$getAnalyticsIns;if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
4022
+ // as the constructor must have already pushed the events to the global buffer
4023
+ var preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
4022
4024
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
4023
4025
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();(_this$getAnalyticsIns=this.getAnalyticsInstance(writeKey))===null||_this$getAnalyticsIns===void 0||_this$getAnalyticsIns.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
4024
- * A function to get preloaded events array from global object
4025
- * @returns preloaded events array
4026
- */// eslint-disable-next-line class-methods-use-this
4027
- },{key:"getPreloadedEvents",value:function getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
4028
4026
  * A function to track page lifecycle events like page loaded and page unloaded
4029
4027
  * @param preloadedEventsArray
4030
4028
  * @param loadOptions
@@ -4047,11 +4045,11 @@
4047
4045
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
4048
4046
  * Trigger load event in buffer queue if exists and stores the
4049
4047
  * remaining preloaded events array in global object
4050
- */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
4048
+ */},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
4051
4049
  // BTW, load method is also removed from the array
4052
4050
  // So, the Analytics object can directly consume the remaining events
4053
4051
  var loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
4054
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
4052
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(_toConsumableArray(preloadedEventsArray)));// Process load method if present in the buffered requests
4055
4053
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
4056
4054
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4057
4055
  // @ts-ignore
@@ -463,7 +463,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
463
463
  * @returns Instance of Error with message prepended with issue
464
464
  */const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
465
465
 
466
- const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.13';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
466
+ const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.15';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
467
467
 
468
468
  const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
469
469
 
@@ -3428,13 +3428,11 @@ if(isString(writeKey)&&writeKey){this.defaultAnalyticsKey=writeKey;}}/**
3428
3428
  * @param dataPlaneUrl Data plane URL
3429
3429
  * @param loadOptions Additional options for loading the SDK
3430
3430
  * @returns none
3431
- */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);const preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
3431
+ */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
3432
+ // as the constructor must have already pushed the events to the global buffer
3433
+ const preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
3432
3434
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
3433
3435
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();this.getAnalyticsInstance(writeKey)?.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
3434
- * A function to get preloaded events array from global object
3435
- * @returns preloaded events array
3436
- */// eslint-disable-next-line class-methods-use-this
3437
- getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
3438
3436
  * A function to track page lifecycle events like page loaded and page unloaded
3439
3437
  * @param preloadedEventsArray
3440
3438
  * @param loadOptions
@@ -3457,11 +3455,11 @@ trackPageLoadedEvent(events,options,preloadedEventsArray){if(events.length===0||
3457
3455
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
3458
3456
  * Trigger load event in buffer queue if exists and stores the
3459
3457
  * remaining preloaded events array in global object
3460
- */triggerBufferedLoadEvent(){const preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
3458
+ */triggerBufferedLoadEvent(){const preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
3461
3459
  // BTW, load method is also removed from the array
3462
3460
  // So, the Analytics object can directly consume the remaining events
3463
3461
  const loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
3464
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
3462
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone([...preloadedEventsArray]));// Process load method if present in the buffered requests
3465
3463
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
3466
3464
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
3467
3465
  // @ts-ignore
@@ -459,7 +459,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
459
459
  * @returns Instance of Error with message prepended with issue
460
460
  */const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
461
461
 
462
- const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.13';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
462
+ const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.15';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
463
463
 
464
464
  const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
465
465
 
@@ -3424,13 +3424,11 @@ if(isString(writeKey)&&writeKey){this.defaultAnalyticsKey=writeKey;}}/**
3424
3424
  * @param dataPlaneUrl Data plane URL
3425
3425
  * @param loadOptions Additional options for loading the SDK
3426
3426
  * @returns none
3427
- */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);const preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
3427
+ */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
3428
+ // as the constructor must have already pushed the events to the global buffer
3429
+ const preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
3428
3430
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
3429
3431
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();this.getAnalyticsInstance(writeKey)?.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
3430
- * A function to get preloaded events array from global object
3431
- * @returns preloaded events array
3432
- */// eslint-disable-next-line class-methods-use-this
3433
- getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
3434
3432
  * A function to track page lifecycle events like page loaded and page unloaded
3435
3433
  * @param preloadedEventsArray
3436
3434
  * @param loadOptions
@@ -3453,11 +3451,11 @@ trackPageLoadedEvent(events,options,preloadedEventsArray){if(events.length===0||
3453
3451
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
3454
3452
  * Trigger load event in buffer queue if exists and stores the
3455
3453
  * remaining preloaded events array in global object
3456
- */triggerBufferedLoadEvent(){const preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
3454
+ */triggerBufferedLoadEvent(){const preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
3457
3455
  // BTW, load method is also removed from the array
3458
3456
  // So, the Analytics object can directly consume the remaining events
3459
3457
  const loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
3460
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
3458
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone([...preloadedEventsArray]));// Process load method if present in the buffered requests
3461
3459
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
3462
3460
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
3463
3461
  // @ts-ignore
@@ -465,7 +465,7 @@
465
465
  * @returns Instance of Error with message prepended with issue
466
466
  */const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
467
467
 
468
- const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.13';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
468
+ const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.15';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
469
469
 
470
470
  const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
471
471
 
@@ -3430,13 +3430,11 @@
3430
3430
  * @param dataPlaneUrl Data plane URL
3431
3431
  * @param loadOptions Additional options for loading the SDK
3432
3432
  * @returns none
3433
- */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);const preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
3433
+ */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
3434
+ // as the constructor must have already pushed the events to the global buffer
3435
+ const preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
3434
3436
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
3435
3437
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();this.getAnalyticsInstance(writeKey)?.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
3436
- * A function to get preloaded events array from global object
3437
- * @returns preloaded events array
3438
- */// eslint-disable-next-line class-methods-use-this
3439
- getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
3440
3438
  * A function to track page lifecycle events like page loaded and page unloaded
3441
3439
  * @param preloadedEventsArray
3442
3440
  * @param loadOptions
@@ -3459,11 +3457,11 @@
3459
3457
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
3460
3458
  * Trigger load event in buffer queue if exists and stores the
3461
3459
  * remaining preloaded events array in global object
3462
- */triggerBufferedLoadEvent(){const preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
3460
+ */triggerBufferedLoadEvent(){const preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
3463
3461
  // BTW, load method is also removed from the array
3464
3462
  // So, the Analytics object can directly consume the remaining events
3465
3463
  const loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
3466
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
3464
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone([...preloadedEventsArray]));// Process load method if present in the buffered requests
3467
3465
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
3468
3466
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
3469
3467
  // @ts-ignore
@@ -454,7 +454,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
454
454
  * @returns Instance of Error with message prepended with issue
455
455
  */const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
456
456
 
457
- const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.13';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
457
+ const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.15';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
458
458
 
459
459
  const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
460
460
 
@@ -1741,13 +1741,11 @@ if(isString(writeKey)&&writeKey){this.defaultAnalyticsKey=writeKey;}}/**
1741
1741
  * @param dataPlaneUrl Data plane URL
1742
1742
  * @param loadOptions Additional options for loading the SDK
1743
1743
  * @returns none
1744
- */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);const preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
1744
+ */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
1745
+ // as the constructor must have already pushed the events to the global buffer
1746
+ const preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
1745
1747
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
1746
1748
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();this.getAnalyticsInstance(writeKey)?.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
1747
- * A function to get preloaded events array from global object
1748
- * @returns preloaded events array
1749
- */// eslint-disable-next-line class-methods-use-this
1750
- getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
1751
1749
  * A function to track page lifecycle events like page loaded and page unloaded
1752
1750
  * @param preloadedEventsArray
1753
1751
  * @param loadOptions
@@ -1770,11 +1768,11 @@ trackPageLoadedEvent(events,options,preloadedEventsArray){if(events.length===0||
1770
1768
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
1771
1769
  * Trigger load event in buffer queue if exists and stores the
1772
1770
  * remaining preloaded events array in global object
1773
- */triggerBufferedLoadEvent(){const preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
1771
+ */triggerBufferedLoadEvent(){const preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
1774
1772
  // BTW, load method is also removed from the array
1775
1773
  // So, the Analytics object can directly consume the remaining events
1776
1774
  const loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
1777
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
1775
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone([...preloadedEventsArray]));// Process load method if present in the buffered requests
1778
1776
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
1779
1777
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1780
1778
  // @ts-ignore
@@ -463,7 +463,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
463
463
  * @returns Instance of Error with message prepended with issue
464
464
  */const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
465
465
 
466
- const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.13';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
466
+ const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.15';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
467
467
 
468
468
  const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
469
469
 
@@ -3404,13 +3404,11 @@ if(isString(writeKey)&&writeKey){this.defaultAnalyticsKey=writeKey;}}/**
3404
3404
  * @param dataPlaneUrl Data plane URL
3405
3405
  * @param loadOptions Additional options for loading the SDK
3406
3406
  * @returns none
3407
- */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);const preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
3407
+ */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
3408
+ // as the constructor must have already pushed the events to the global buffer
3409
+ const preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
3408
3410
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
3409
3411
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();this.getAnalyticsInstance(writeKey)?.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
3410
- * A function to get preloaded events array from global object
3411
- * @returns preloaded events array
3412
- */// eslint-disable-next-line class-methods-use-this
3413
- getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
3414
3412
  * A function to track page lifecycle events like page loaded and page unloaded
3415
3413
  * @param preloadedEventsArray
3416
3414
  * @param loadOptions
@@ -3433,11 +3431,11 @@ trackPageLoadedEvent(events,options,preloadedEventsArray){if(events.length===0||
3433
3431
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
3434
3432
  * Trigger load event in buffer queue if exists and stores the
3435
3433
  * remaining preloaded events array in global object
3436
- */triggerBufferedLoadEvent(){const preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
3434
+ */triggerBufferedLoadEvent(){const preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
3437
3435
  // BTW, load method is also removed from the array
3438
3436
  // So, the Analytics object can directly consume the remaining events
3439
3437
  const loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
3440
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
3438
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone([...preloadedEventsArray]));// Process load method if present in the buffered requests
3441
3439
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
3442
3440
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
3443
3441
  // @ts-ignore
@@ -459,7 +459,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
459
459
  * @returns Instance of Error with message prepended with issue
460
460
  */const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
461
461
 
462
- const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.13';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
462
+ const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.15';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
463
463
 
464
464
  const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
465
465
 
@@ -3400,13 +3400,11 @@ if(isString(writeKey)&&writeKey){this.defaultAnalyticsKey=writeKey;}}/**
3400
3400
  * @param dataPlaneUrl Data plane URL
3401
3401
  * @param loadOptions Additional options for loading the SDK
3402
3402
  * @returns none
3403
- */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);const preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
3403
+ */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
3404
+ // as the constructor must have already pushed the events to the global buffer
3405
+ const preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
3404
3406
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
3405
3407
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();this.getAnalyticsInstance(writeKey)?.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
3406
- * A function to get preloaded events array from global object
3407
- * @returns preloaded events array
3408
- */// eslint-disable-next-line class-methods-use-this
3409
- getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
3410
3408
  * A function to track page lifecycle events like page loaded and page unloaded
3411
3409
  * @param preloadedEventsArray
3412
3410
  * @param loadOptions
@@ -3429,11 +3427,11 @@ trackPageLoadedEvent(events,options,preloadedEventsArray){if(events.length===0||
3429
3427
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
3430
3428
  * Trigger load event in buffer queue if exists and stores the
3431
3429
  * remaining preloaded events array in global object
3432
- */triggerBufferedLoadEvent(){const preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
3430
+ */triggerBufferedLoadEvent(){const preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
3433
3431
  // BTW, load method is also removed from the array
3434
3432
  // So, the Analytics object can directly consume the remaining events
3435
3433
  const loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
3436
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
3434
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone([...preloadedEventsArray]));// Process load method if present in the buffered requests
3437
3435
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
3438
3436
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
3439
3437
  // @ts-ignore
@@ -465,7 +465,7 @@
465
465
  * @returns Instance of Error with message prepended with issue
466
466
  */const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
467
467
 
468
- const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.13';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
468
+ const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.15';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
469
469
 
470
470
  const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
471
471
 
@@ -3406,13 +3406,11 @@
3406
3406
  * @param dataPlaneUrl Data plane URL
3407
3407
  * @param loadOptions Additional options for loading the SDK
3408
3408
  * @returns none
3409
- */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);const preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
3409
+ */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
3410
+ // as the constructor must have already pushed the events to the global buffer
3411
+ const preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
3410
3412
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
3411
3413
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();this.getAnalyticsInstance(writeKey)?.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
3412
- * A function to get preloaded events array from global object
3413
- * @returns preloaded events array
3414
- */// eslint-disable-next-line class-methods-use-this
3415
- getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
3416
3414
  * A function to track page lifecycle events like page loaded and page unloaded
3417
3415
  * @param preloadedEventsArray
3418
3416
  * @param loadOptions
@@ -3435,11 +3433,11 @@
3435
3433
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
3436
3434
  * Trigger load event in buffer queue if exists and stores the
3437
3435
  * remaining preloaded events array in global object
3438
- */triggerBufferedLoadEvent(){const preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
3436
+ */triggerBufferedLoadEvent(){const preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
3439
3437
  // BTW, load method is also removed from the array
3440
3438
  // So, the Analytics object can directly consume the remaining events
3441
3439
  const loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
3442
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
3440
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone([...preloadedEventsArray]));// Process load method if present in the buffered requests
3443
3441
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
3444
3442
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
3445
3443
  // @ts-ignore
@@ -450,7 +450,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
450
450
  * @returns Instance of Error with message prepended with issue
451
451
  */const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
452
452
 
453
- const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.13';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
453
+ const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.15';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
454
454
 
455
455
  const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
456
456
 
@@ -1737,13 +1737,11 @@ if(isString(writeKey)&&writeKey){this.defaultAnalyticsKey=writeKey;}}/**
1737
1737
  * @param dataPlaneUrl Data plane URL
1738
1738
  * @param loadOptions Additional options for loading the SDK
1739
1739
  * @returns none
1740
- */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);const preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
1740
+ */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
1741
+ // as the constructor must have already pushed the events to the global buffer
1742
+ const preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
1741
1743
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
1742
1744
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();this.getAnalyticsInstance(writeKey)?.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
1743
- * A function to get preloaded events array from global object
1744
- * @returns preloaded events array
1745
- */// eslint-disable-next-line class-methods-use-this
1746
- getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
1747
1745
  * A function to track page lifecycle events like page loaded and page unloaded
1748
1746
  * @param preloadedEventsArray
1749
1747
  * @param loadOptions
@@ -1766,11 +1764,11 @@ trackPageLoadedEvent(events,options,preloadedEventsArray){if(events.length===0||
1766
1764
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
1767
1765
  * Trigger load event in buffer queue if exists and stores the
1768
1766
  * remaining preloaded events array in global object
1769
- */triggerBufferedLoadEvent(){const preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
1767
+ */triggerBufferedLoadEvent(){const preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
1770
1768
  // BTW, load method is also removed from the array
1771
1769
  // So, the Analytics object can directly consume the remaining events
1772
1770
  const loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
1773
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
1771
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone([...preloadedEventsArray]));// Process load method if present in the buffered requests
1774
1772
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
1775
1773
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1776
1774
  // @ts-ignore
@@ -456,7 +456,7 @@
456
456
  * @returns Instance of Error with message prepended with issue
457
457
  */const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
458
458
 
459
- const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.13';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
459
+ const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.15';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
460
460
 
461
461
  const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
462
462
 
@@ -1743,13 +1743,11 @@
1743
1743
  * @param dataPlaneUrl Data plane URL
1744
1744
  * @param loadOptions Additional options for loading the SDK
1745
1745
  * @returns none
1746
- */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);const preloadedEventsArray=this.getPreloadedEvents();// Track page loaded lifecycle event if enabled
1746
+ */load(writeKey,dataPlaneUrl,loadOptions){try{if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);// Get the preloaded events array from global buffer instead of window.rudderanalytics
1747
+ // as the constructor must have already pushed the events to the global buffer
1748
+ const preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER);// Track page loaded lifecycle event if enabled
1747
1749
  this.trackPageLifecycleEvents(preloadedEventsArray,loadOptions);// The array will be mutated in the below method
1748
1750
  promotePreloadedConsentEventsToTop(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));this.analyticsInstances[writeKey]=new Analytics();this.getAnalyticsInstance(writeKey)?.load(writeKey,dataPlaneUrl,getSanitizedValue(loadOptions));}catch(error){dispatchErrorEvent(error);}}/**
1749
- * A function to get preloaded events array from global object
1750
- * @returns preloaded events array
1751
- */// eslint-disable-next-line class-methods-use-this
1752
- getPreloadedEvents(){return Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];}/**
1753
1751
  * A function to track page lifecycle events like page loaded and page unloaded
1754
1752
  * @param preloadedEventsArray
1755
1753
  * @param loadOptions
@@ -1772,11 +1770,11 @@
1772
1770
  this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA));}}}/**
1773
1771
  * Trigger load event in buffer queue if exists and stores the
1774
1772
  * remaining preloaded events array in global object
1775
- */triggerBufferedLoadEvent(){const preloadedEventsArray=this.getPreloadedEvents();// Get any load method call that is buffered if any
1773
+ */triggerBufferedLoadEvent(){const preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// Get any load method call that is buffered if any
1776
1774
  // BTW, load method is also removed from the array
1777
1775
  // So, the Analytics object can directly consume the remaining events
1778
1776
  const loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
1779
- setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone(preloadedEventsArray));// Process load method if present in the buffered requests
1777
+ setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone([...preloadedEventsArray]));// Process load method if present in the buffered requests
1780
1778
  if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
1781
1779
  loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1782
1780
  // @ts-ignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rudderstack/analytics-js",
3
- "version": "3.11.13",
3
+ "version": "3.11.15",
4
4
  "description": "RudderStack JavaScript SDK",
5
5
  "main": "dist/npm/modern/cjs/index.cjs",
6
6
  "module": "dist/npm/modern/esm/index.mjs",