@rudderstack/analytics-js 3.28.1-beta.pr.2745.7302a89 → 3.29.0-beta.pr.2744.4ae3336
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/npm/legacy/bundled/cjs/index.cjs +19 -15
- package/dist/npm/legacy/bundled/esm/index.mjs +19 -15
- package/dist/npm/legacy/bundled/umd/index.js +19 -15
- package/dist/npm/legacy/cjs/index.cjs +19 -15
- package/dist/npm/legacy/content-script/cjs/index.cjs +19 -15
- package/dist/npm/legacy/content-script/esm/index.mjs +19 -15
- package/dist/npm/legacy/content-script/umd/index.js +19 -15
- package/dist/npm/legacy/esm/index.mjs +19 -15
- package/dist/npm/legacy/lite/cjs/index.cjs +19 -15
- package/dist/npm/legacy/lite/esm/index.mjs +19 -15
- package/dist/npm/legacy/lite/umd/index.js +19 -15
- package/dist/npm/legacy/umd/index.js +19 -15
- package/dist/npm/modern/bundled/cjs/index.cjs +18 -14
- package/dist/npm/modern/bundled/esm/index.mjs +18 -14
- package/dist/npm/modern/bundled/umd/index.js +18 -14
- package/dist/npm/modern/cjs/index.cjs +18 -14
- package/dist/npm/modern/content-script/cjs/index.cjs +18 -14
- package/dist/npm/modern/content-script/esm/index.mjs +18 -14
- package/dist/npm/modern/content-script/umd/index.js +18 -14
- package/dist/npm/modern/esm/index.mjs +18 -14
- package/dist/npm/modern/lite/cjs/index.cjs +18 -14
- package/dist/npm/modern/lite/esm/index.mjs +18 -14
- package/dist/npm/modern/lite/umd/index.js +18 -14
- package/dist/npm/modern/umd/index.js +18 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [3.29.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.28.1...@rudderstack/analytics-js@3.29.0) (2026-02-16)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `@rudderstack/analytics-js-cookies` updated to version `0.5.7`
|
|
10
|
+
* `@rudderstack/analytics-js-common` updated to version `3.28.0`
|
|
11
|
+
* `@rudderstack/analytics-js-plugins` updated to version `3.15.2`
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **analytics-js:** create lite named export ([#2745](https://github.com/rudderlabs/rudder-sdk-js/issues/2745)) ([8f900f4](https://github.com/rudderlabs/rudder-sdk-js/commit/8f900f4fa2797aa0160f40a0966ac2f0f4be9068))
|
|
16
|
+
|
|
5
17
|
## [3.28.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.28.0...@rudderstack/analytics-js@3.28.1) (2026-01-23)
|
|
6
18
|
|
|
7
19
|
### Dependency Updates
|
|
@@ -913,7 +913,7 @@ error.stack="".concat(stack,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;case sta
|
|
|
913
913
|
error.stacktrace="".concat(stacktrace,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;case operaSourceloc:default:// eslint-disable-next-line no-param-reassign
|
|
914
914
|
error['opera#sourceloc']="".concat(operaSourceloc,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;}}}globalThis.dispatchEvent(new ErrorEvent('error',{error:error,bubbles:true,cancelable:true,composed:true}));};
|
|
915
915
|
|
|
916
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.
|
|
916
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.29.0-beta.pr.2744.4ae3336';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var BUILD_VARIANT='legacy-bundled';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';var CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
|
917
917
|
|
|
918
918
|
var QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';var QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';var QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';var QUERY_PARAM_USER_ID_KEY='ajs_uid';var QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
|
919
919
|
|
|
@@ -3915,19 +3915,21 @@ var safelyInvokeCallback=function safelyInvokeCallback(callback,args,apiName,log
|
|
|
3915
3915
|
* @param storeManager Store Manager instance
|
|
3916
3916
|
* @param errorHandler Error handler object
|
|
3917
3917
|
* @param logger Logger object
|
|
3918
|
-
*/function EventRepository(pluginsManager,storeManager,httpClient,errorHandler,logger){_classCallCheck(this,EventRepository);this.pluginsManager=pluginsManager;this.errorHandler=errorHandler;this.httpClient=httpClient;this.logger=logger;this.storeManager=storeManager;}/**
|
|
3918
|
+
*/function EventRepository(pluginsManager,storeManager,httpClient,errorHandler,logger){_classCallCheck(this,EventRepository);this.pluginsManager=pluginsManager;this.errorHandler=errorHandler;this.httpClient=httpClient;this.logger=logger;this.storeManager=storeManager;this.eventsBuffer=[];this.isEventBufferingActive=true;}/**
|
|
3919
3919
|
* Initializes the event repository
|
|
3920
3920
|
*/return _createClass(EventRepository,[{key:"init",value:function init(){var _this=this;this.dataplaneEventsQueue=this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".init"),state,this.httpClient,this.storeManager,this.errorHandler,this.logger);this.dmtEventsQueue=this.pluginsManager.invokeSingle("".concat(DMT_EXT_POINT_PREFIX,".init"),state,this.pluginsManager,this.httpClient,this.storeManager,this.errorHandler,this.logger);this.destinationsEventsQueue=this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".init"),state,this.pluginsManager,this.storeManager,this.dmtEventsQueue,this.errorHandler,this.logger);// Start the queue once the client destinations are ready
|
|
3921
|
-
m(function(){if(state.nativeDestinations.clientDestinationsReady.value===true){var _this$destinationsEve,_this$dmtEventsQueue;(_this$destinationsEve=_this.destinationsEventsQueue)===null||_this$destinationsEve===void 0||_this$destinationsEve.start();(_this$dmtEventsQueue=_this.dmtEventsQueue)===null||_this$dmtEventsQueue===void 0||_this$dmtEventsQueue.start();}});var bufferEventsBeforeConsent=shouldBufferEventsForPreConsent(state);// Start the
|
|
3922
|
-
//
|
|
3923
|
-
//
|
|
3924
|
-
//
|
|
3925
|
-
var
|
|
3926
|
-
|
|
3921
|
+
m(function(){if(state.nativeDestinations.clientDestinationsReady.value===true){var _this$destinationsEve,_this$dmtEventsQueue;(_this$destinationsEve=_this.destinationsEventsQueue)===null||_this$destinationsEve===void 0||_this$destinationsEve.start();(_this$dmtEventsQueue=_this.dmtEventsQueue)===null||_this$dmtEventsQueue===void 0||_this$dmtEventsQueue.start();}});var bufferEventsBeforeConsent=shouldBufferEventsForPreConsent(state);if(!bufferEventsBeforeConsent){this.startDpEventsQueue();}}},{key:"startDpEventsQueue",value:function startDpEventsQueue(){var _this2=this;var bufferEventsUntilReady=state.loadOptions.value.bufferDataPlaneEventsUntilReady;var hybridDestExist=state.nativeDestinations.activeDestinations.value.some(function(dest){return isHybridModeDestination(dest);});var shouldBufferEvents=bufferEventsUntilReady&&hybridDestExist;// Start the data plane events queue and replay the events from the buffer
|
|
3922
|
+
// This function is called when the client destinations are ready
|
|
3923
|
+
// or when the timeout expires
|
|
3924
|
+
// or when no buffering is required
|
|
3925
|
+
var startDpQueueAndReplayEvents=function startDpQueueAndReplayEvents(){var _this2$dataplaneEvent;_this2.isEventBufferingActive=false;_this2.eventsBuffer.forEach(function(event){_this2.enqueue(event);});if(((_this2$dataplaneEvent=_this2.dataplaneEventsQueue)===null||_this2$dataplaneEvent===void 0?void 0:_this2$dataplaneEvent.scheduleTimeoutActive)!==true){var _this2$dataplaneEvent2;(_this2$dataplaneEvent2=_this2.dataplaneEventsQueue)===null||_this2$dataplaneEvent2===void 0||_this2$dataplaneEvent2.start();}_this2.eventsBuffer=[];};var timeoutId;// Start the queue when no event buffering is required
|
|
3926
|
+
// or when buffering is required and the client destinations are ready
|
|
3927
|
+
m(function(){if(!shouldBufferEvents||state.nativeDestinations.clientDestinationsReady.value){globalThis.clearTimeout(timeoutId);startDpQueueAndReplayEvents();}});// Force start the data plane events queue processing after a timeout
|
|
3928
|
+
if(shouldBufferEvents){this.isEventBufferingActive=true;timeoutId=globalThis.setTimeout(function(){startDpQueueAndReplayEvents();},state.loadOptions.value.dataPlaneEventsBufferTimeout);}}},{key:"resume",value:function resume(){var _this$dataplaneEvents;if(((_this$dataplaneEvents=this.dataplaneEventsQueue)===null||_this$dataplaneEvents===void 0?void 0:_this$dataplaneEvents.scheduleTimeoutActive)!==true&&state.consents.postConsent.value.discardPreConsentEvents){var _this$dataplaneEvents2,_this$destinationsEve2;(_this$dataplaneEvents2=this.dataplaneEventsQueue)===null||_this$dataplaneEvents2===void 0||_this$dataplaneEvents2.clear();(_this$destinationsEve2=this.destinationsEventsQueue)===null||_this$destinationsEve2===void 0||_this$destinationsEve2.clear();}this.startDpEventsQueue();}/**
|
|
3927
3929
|
* Enqueues the event for processing
|
|
3928
3930
|
* @param event RudderEvent object
|
|
3929
3931
|
* @param callback API callback function
|
|
3930
|
-
*/},{key:"enqueue",value:function enqueue(event,callback){var dpQEvent=getFinalEvent(event,state);this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.dataplaneEventsQueue,dpQEvent,this.errorHandler,this.logger);var dQEvent=clone(event);this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.destinationsEventsQueue,dQEvent,this.errorHandler,this.logger)
|
|
3932
|
+
*/},{key:"enqueue",value:function enqueue(event,callback){var dpQEvent=getFinalEvent(event,state);if(this.isEventBufferingActive){this.eventsBuffer.push(dpQEvent);}else {this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.dataplaneEventsQueue,dpQEvent,this.errorHandler,this.logger);var dQEvent=clone(event);this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.destinationsEventsQueue,dQEvent,this.errorHandler,this.logger);}// Invoke the callback if it exists
|
|
3931
3933
|
var apiName="".concat(event.type.charAt(0).toUpperCase()).concat(event.type.slice(1)).concat(API_SUFFIX);safelyInvokeCallback(callback,[dpQEvent],apiName,this.logger);}}]);}();
|
|
3932
3934
|
|
|
3933
3935
|
var dispatchSDKEvent=function dispatchSDKEvent(event){var customEvent=new CustomEvent(event,{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:true,cancelable:true,composed:true});globalThis.document.dispatchEvent(customEvent);};var isWriteKeyValid=function isWriteKeyValid(writeKey){return isString(writeKey)&&writeKey.trim().length>0;};var isDataPlaneUrlValid=function isDataPlaneUrlValid(dataPlaneUrl){return isValidURL(dataPlaneUrl);};
|
|
@@ -3960,7 +3962,9 @@ if(state.consents.preConsent.value.enabled===true){state.lifecycle.status.value=
|
|
|
3960
3962
|
* Initialize the storage and event queue
|
|
3961
3963
|
*/},{key:"onPluginsReady",value:function onPluginsReady(){var _this$storeManager,_this$userSessionMana,_this$eventManager;// Initialize storage
|
|
3962
3964
|
(_this$storeManager=this.storeManager)===null||_this$storeManager===void 0||_this$storeManager.init();(_this$userSessionMana=this.userSessionManager)===null||_this$userSessionMana===void 0||_this$userSessionMana.init();// Initialize the appropriate consent manager plugin
|
|
3963
|
-
if(state.consents.enabled.value&&!state.consents.initialized.value){var _this$pluginsManager;(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0||_this$pluginsManager.invokeSingle("consentManager.init",state,this.logger);if(state.consents.preConsent.value.enabled===false){var _this$pluginsManager2;(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0||_this$pluginsManager2.invokeSingle("consentManager.updateConsentsInfo",state,this.storeManager,this.logger);}}//
|
|
3965
|
+
if(state.consents.enabled.value&&!state.consents.initialized.value){var _this$pluginsManager;(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0||_this$pluginsManager.invokeSingle("consentManager.init",state,this.logger);if(state.consents.preConsent.value.enabled===false){var _this$pluginsManager2;(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0||_this$pluginsManager2.invokeSingle("consentManager.updateConsentsInfo",state,this.storeManager,this.logger);}}// Setting the active destinations is important for the events processing.
|
|
3966
|
+
// So, it should be done before initializing the event manager.
|
|
3967
|
+
this.setActiveDestinations();// Initialize event manager
|
|
3964
3968
|
(_this$eventManager=this.eventManager)===null||_this$eventManager===void 0||_this$eventManager.init();// Mark the SDK as initialized
|
|
3965
3969
|
state.lifecycle.status.value='initialized';}/**
|
|
3966
3970
|
* Load plugins
|
|
@@ -3984,13 +3988,13 @@ dispatchSDKEvent('RSA_Ready');}/**
|
|
|
3984
3988
|
// for-loop as the individual events that are processed may
|
|
3985
3989
|
// add more events to the buffer (this is needed for the consent API)
|
|
3986
3990
|
var bufferedEvents=state.eventBuffer.toBeProcessedArray.value;while(bufferedEvents.length>0){var bufferedEvent=bufferedEvents.shift();state.eventBuffer.toBeProcessedArray.value=bufferedEvents;if(bufferedEvent){var methodName=bufferedEvent[0];if(isFunction(this[methodName])){var _ref;// Send additional arg 'true' to indicate that this is a buffered invocation
|
|
3987
|
-
(_ref=this)[methodName].apply(_ref,_toConsumableArray(bufferedEvent.slice(1)).concat([true]));}}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}/**
|
|
3991
|
+
(_ref=this)[methodName].apply(_ref,_toConsumableArray(bufferedEvent.slice(1)).concat([true]));}}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}},{key:"setActiveDestinations",value:function setActiveDestinations(){var _this$pluginsManager4;(_this$pluginsManager4=this.pluginsManager)===null||_this$pluginsManager4===void 0||_this$pluginsManager4.invokeSingle('nativeDestinations.setActiveDestinations',state,this.pluginsManager,this.errorHandler,this.logger);}/**
|
|
3988
3992
|
* Load device mode destinations
|
|
3989
|
-
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$
|
|
3990
|
-
if(state.lifecycle.status.value==='destinationsLoading'||state.
|
|
3991
|
-
|
|
3993
|
+
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$pluginsManager5;// If the integrations load is already triggered or completed, skip the rest of the logic
|
|
3994
|
+
if(state.lifecycle.status.value==='destinationsLoading'||state.nativeDestinations.clientDestinationsReady.value===true){return;}// Set in state the desired activeDestinations to inject in DOM
|
|
3995
|
+
this.setActiveDestinations();var totalDestinationsToLoad=state.nativeDestinations.activeDestinations.value.length;if(totalDestinationsToLoad===0){n(function(){state.nativeDestinations.clientDestinationsReady.value=true;state.lifecycle.status.value='destinationsReady';});return;}// Start loading native integration scripts and create instances
|
|
3992
3996
|
state.lifecycle.status.value='destinationsLoading';(_this$pluginsManager5=this.pluginsManager)===null||_this$pluginsManager5===void 0||_this$pluginsManager5.invokeSingle('nativeDestinations.load',state,this.externalSrcLoader,this.errorHandler,this.logger);// Progress to next lifecycle phase if all native destinations are initialized or failed
|
|
3993
|
-
m(function(){var areAllDestinationsReady=
|
|
3997
|
+
m(function(){var areAllDestinationsReady=state.nativeDestinations.initializedDestinations.value.length+state.nativeDestinations.failedDestinations.value.length===totalDestinationsToLoad;if(areAllDestinationsReady){n(function(){state.lifecycle.status.value='destinationsReady';state.nativeDestinations.clientDestinationsReady.value=true;});}});}/**
|
|
3994
3998
|
* Move to the ready state
|
|
3995
3999
|
*/// eslint-disable-next-line class-methods-use-this
|
|
3996
4000
|
},{key:"onDestinationsReady",value:function onDestinationsReady(){// May be do any destination specific actions here
|
|
@@ -911,7 +911,7 @@ error.stack="".concat(stack,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;case sta
|
|
|
911
911
|
error.stacktrace="".concat(stacktrace,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;case operaSourceloc:default:// eslint-disable-next-line no-param-reassign
|
|
912
912
|
error['opera#sourceloc']="".concat(operaSourceloc,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;}}}globalThis.dispatchEvent(new ErrorEvent('error',{error:error,bubbles:true,cancelable:true,composed:true}));};
|
|
913
913
|
|
|
914
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.
|
|
914
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.29.0-beta.pr.2744.4ae3336';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var BUILD_VARIANT='legacy-bundled';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';var CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
|
915
915
|
|
|
916
916
|
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';
|
|
917
917
|
|
|
@@ -3913,19 +3913,21 @@ var safelyInvokeCallback=function safelyInvokeCallback(callback,args,apiName,log
|
|
|
3913
3913
|
* @param storeManager Store Manager instance
|
|
3914
3914
|
* @param errorHandler Error handler object
|
|
3915
3915
|
* @param logger Logger object
|
|
3916
|
-
*/function EventRepository(pluginsManager,storeManager,httpClient,errorHandler,logger){_classCallCheck(this,EventRepository);this.pluginsManager=pluginsManager;this.errorHandler=errorHandler;this.httpClient=httpClient;this.logger=logger;this.storeManager=storeManager;}/**
|
|
3916
|
+
*/function EventRepository(pluginsManager,storeManager,httpClient,errorHandler,logger){_classCallCheck(this,EventRepository);this.pluginsManager=pluginsManager;this.errorHandler=errorHandler;this.httpClient=httpClient;this.logger=logger;this.storeManager=storeManager;this.eventsBuffer=[];this.isEventBufferingActive=true;}/**
|
|
3917
3917
|
* Initializes the event repository
|
|
3918
3918
|
*/return _createClass(EventRepository,[{key:"init",value:function init(){var _this=this;this.dataplaneEventsQueue=this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".init"),state,this.httpClient,this.storeManager,this.errorHandler,this.logger);this.dmtEventsQueue=this.pluginsManager.invokeSingle("".concat(DMT_EXT_POINT_PREFIX,".init"),state,this.pluginsManager,this.httpClient,this.storeManager,this.errorHandler,this.logger);this.destinationsEventsQueue=this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".init"),state,this.pluginsManager,this.storeManager,this.dmtEventsQueue,this.errorHandler,this.logger);// Start the queue once the client destinations are ready
|
|
3919
|
-
m(function(){if(state.nativeDestinations.clientDestinationsReady.value===true){var _this$destinationsEve,_this$dmtEventsQueue;(_this$destinationsEve=_this.destinationsEventsQueue)===null||_this$destinationsEve===void 0||_this$destinationsEve.start();(_this$dmtEventsQueue=_this.dmtEventsQueue)===null||_this$dmtEventsQueue===void 0||_this$dmtEventsQueue.start();}});var bufferEventsBeforeConsent=shouldBufferEventsForPreConsent(state);// Start the
|
|
3920
|
-
//
|
|
3921
|
-
//
|
|
3922
|
-
//
|
|
3923
|
-
var
|
|
3924
|
-
|
|
3919
|
+
m(function(){if(state.nativeDestinations.clientDestinationsReady.value===true){var _this$destinationsEve,_this$dmtEventsQueue;(_this$destinationsEve=_this.destinationsEventsQueue)===null||_this$destinationsEve===void 0||_this$destinationsEve.start();(_this$dmtEventsQueue=_this.dmtEventsQueue)===null||_this$dmtEventsQueue===void 0||_this$dmtEventsQueue.start();}});var bufferEventsBeforeConsent=shouldBufferEventsForPreConsent(state);if(!bufferEventsBeforeConsent){this.startDpEventsQueue();}}},{key:"startDpEventsQueue",value:function startDpEventsQueue(){var _this2=this;var bufferEventsUntilReady=state.loadOptions.value.bufferDataPlaneEventsUntilReady;var hybridDestExist=state.nativeDestinations.activeDestinations.value.some(function(dest){return isHybridModeDestination(dest);});var shouldBufferEvents=bufferEventsUntilReady&&hybridDestExist;// Start the data plane events queue and replay the events from the buffer
|
|
3920
|
+
// This function is called when the client destinations are ready
|
|
3921
|
+
// or when the timeout expires
|
|
3922
|
+
// or when no buffering is required
|
|
3923
|
+
var startDpQueueAndReplayEvents=function startDpQueueAndReplayEvents(){var _this2$dataplaneEvent;_this2.isEventBufferingActive=false;_this2.eventsBuffer.forEach(function(event){_this2.enqueue(event);});if(((_this2$dataplaneEvent=_this2.dataplaneEventsQueue)===null||_this2$dataplaneEvent===void 0?void 0:_this2$dataplaneEvent.scheduleTimeoutActive)!==true){var _this2$dataplaneEvent2;(_this2$dataplaneEvent2=_this2.dataplaneEventsQueue)===null||_this2$dataplaneEvent2===void 0||_this2$dataplaneEvent2.start();}_this2.eventsBuffer=[];};var timeoutId;// Start the queue when no event buffering is required
|
|
3924
|
+
// or when buffering is required and the client destinations are ready
|
|
3925
|
+
m(function(){if(!shouldBufferEvents||state.nativeDestinations.clientDestinationsReady.value){globalThis.clearTimeout(timeoutId);startDpQueueAndReplayEvents();}});// Force start the data plane events queue processing after a timeout
|
|
3926
|
+
if(shouldBufferEvents){this.isEventBufferingActive=true;timeoutId=globalThis.setTimeout(function(){startDpQueueAndReplayEvents();},state.loadOptions.value.dataPlaneEventsBufferTimeout);}}},{key:"resume",value:function resume(){var _this$dataplaneEvents;if(((_this$dataplaneEvents=this.dataplaneEventsQueue)===null||_this$dataplaneEvents===void 0?void 0:_this$dataplaneEvents.scheduleTimeoutActive)!==true&&state.consents.postConsent.value.discardPreConsentEvents){var _this$dataplaneEvents2,_this$destinationsEve2;(_this$dataplaneEvents2=this.dataplaneEventsQueue)===null||_this$dataplaneEvents2===void 0||_this$dataplaneEvents2.clear();(_this$destinationsEve2=this.destinationsEventsQueue)===null||_this$destinationsEve2===void 0||_this$destinationsEve2.clear();}this.startDpEventsQueue();}/**
|
|
3925
3927
|
* Enqueues the event for processing
|
|
3926
3928
|
* @param event RudderEvent object
|
|
3927
3929
|
* @param callback API callback function
|
|
3928
|
-
*/},{key:"enqueue",value:function enqueue(event,callback){var dpQEvent=getFinalEvent(event,state);this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.dataplaneEventsQueue,dpQEvent,this.errorHandler,this.logger);var dQEvent=clone(event);this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.destinationsEventsQueue,dQEvent,this.errorHandler,this.logger)
|
|
3930
|
+
*/},{key:"enqueue",value:function enqueue(event,callback){var dpQEvent=getFinalEvent(event,state);if(this.isEventBufferingActive){this.eventsBuffer.push(dpQEvent);}else {this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.dataplaneEventsQueue,dpQEvent,this.errorHandler,this.logger);var dQEvent=clone(event);this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.destinationsEventsQueue,dQEvent,this.errorHandler,this.logger);}// Invoke the callback if it exists
|
|
3929
3931
|
var apiName="".concat(event.type.charAt(0).toUpperCase()).concat(event.type.slice(1)).concat(API_SUFFIX);safelyInvokeCallback(callback,[dpQEvent],apiName,this.logger);}}]);}();
|
|
3930
3932
|
|
|
3931
3933
|
var dispatchSDKEvent=function dispatchSDKEvent(event){var customEvent=new CustomEvent(event,{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:true,cancelable:true,composed:true});globalThis.document.dispatchEvent(customEvent);};var isWriteKeyValid=function isWriteKeyValid(writeKey){return isString(writeKey)&&writeKey.trim().length>0;};var isDataPlaneUrlValid=function isDataPlaneUrlValid(dataPlaneUrl){return isValidURL(dataPlaneUrl);};
|
|
@@ -3958,7 +3960,9 @@ if(state.consents.preConsent.value.enabled===true){state.lifecycle.status.value=
|
|
|
3958
3960
|
* Initialize the storage and event queue
|
|
3959
3961
|
*/},{key:"onPluginsReady",value:function onPluginsReady(){var _this$storeManager,_this$userSessionMana,_this$eventManager;// Initialize storage
|
|
3960
3962
|
(_this$storeManager=this.storeManager)===null||_this$storeManager===void 0||_this$storeManager.init();(_this$userSessionMana=this.userSessionManager)===null||_this$userSessionMana===void 0||_this$userSessionMana.init();// Initialize the appropriate consent manager plugin
|
|
3961
|
-
if(state.consents.enabled.value&&!state.consents.initialized.value){var _this$pluginsManager;(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0||_this$pluginsManager.invokeSingle("consentManager.init",state,this.logger);if(state.consents.preConsent.value.enabled===false){var _this$pluginsManager2;(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0||_this$pluginsManager2.invokeSingle("consentManager.updateConsentsInfo",state,this.storeManager,this.logger);}}//
|
|
3963
|
+
if(state.consents.enabled.value&&!state.consents.initialized.value){var _this$pluginsManager;(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0||_this$pluginsManager.invokeSingle("consentManager.init",state,this.logger);if(state.consents.preConsent.value.enabled===false){var _this$pluginsManager2;(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0||_this$pluginsManager2.invokeSingle("consentManager.updateConsentsInfo",state,this.storeManager,this.logger);}}// Setting the active destinations is important for the events processing.
|
|
3964
|
+
// So, it should be done before initializing the event manager.
|
|
3965
|
+
this.setActiveDestinations();// Initialize event manager
|
|
3962
3966
|
(_this$eventManager=this.eventManager)===null||_this$eventManager===void 0||_this$eventManager.init();// Mark the SDK as initialized
|
|
3963
3967
|
state.lifecycle.status.value='initialized';}/**
|
|
3964
3968
|
* Load plugins
|
|
@@ -3982,13 +3986,13 @@ dispatchSDKEvent('RSA_Ready');}/**
|
|
|
3982
3986
|
// for-loop as the individual events that are processed may
|
|
3983
3987
|
// add more events to the buffer (this is needed for the consent API)
|
|
3984
3988
|
var bufferedEvents=state.eventBuffer.toBeProcessedArray.value;while(bufferedEvents.length>0){var bufferedEvent=bufferedEvents.shift();state.eventBuffer.toBeProcessedArray.value=bufferedEvents;if(bufferedEvent){var methodName=bufferedEvent[0];if(isFunction(this[methodName])){var _ref;// Send additional arg 'true' to indicate that this is a buffered invocation
|
|
3985
|
-
(_ref=this)[methodName].apply(_ref,_toConsumableArray(bufferedEvent.slice(1)).concat([true]));}}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}/**
|
|
3989
|
+
(_ref=this)[methodName].apply(_ref,_toConsumableArray(bufferedEvent.slice(1)).concat([true]));}}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}},{key:"setActiveDestinations",value:function setActiveDestinations(){var _this$pluginsManager4;(_this$pluginsManager4=this.pluginsManager)===null||_this$pluginsManager4===void 0||_this$pluginsManager4.invokeSingle('nativeDestinations.setActiveDestinations',state,this.pluginsManager,this.errorHandler,this.logger);}/**
|
|
3986
3990
|
* Load device mode destinations
|
|
3987
|
-
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$
|
|
3988
|
-
if(state.lifecycle.status.value==='destinationsLoading'||state.
|
|
3989
|
-
|
|
3991
|
+
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$pluginsManager5;// If the integrations load is already triggered or completed, skip the rest of the logic
|
|
3992
|
+
if(state.lifecycle.status.value==='destinationsLoading'||state.nativeDestinations.clientDestinationsReady.value===true){return;}// Set in state the desired activeDestinations to inject in DOM
|
|
3993
|
+
this.setActiveDestinations();var totalDestinationsToLoad=state.nativeDestinations.activeDestinations.value.length;if(totalDestinationsToLoad===0){n(function(){state.nativeDestinations.clientDestinationsReady.value=true;state.lifecycle.status.value='destinationsReady';});return;}// Start loading native integration scripts and create instances
|
|
3990
3994
|
state.lifecycle.status.value='destinationsLoading';(_this$pluginsManager5=this.pluginsManager)===null||_this$pluginsManager5===void 0||_this$pluginsManager5.invokeSingle('nativeDestinations.load',state,this.externalSrcLoader,this.errorHandler,this.logger);// Progress to next lifecycle phase if all native destinations are initialized or failed
|
|
3991
|
-
m(function(){var areAllDestinationsReady=
|
|
3995
|
+
m(function(){var areAllDestinationsReady=state.nativeDestinations.initializedDestinations.value.length+state.nativeDestinations.failedDestinations.value.length===totalDestinationsToLoad;if(areAllDestinationsReady){n(function(){state.lifecycle.status.value='destinationsReady';state.nativeDestinations.clientDestinationsReady.value=true;});}});}/**
|
|
3992
3996
|
* Move to the ready state
|
|
3993
3997
|
*/// eslint-disable-next-line class-methods-use-this
|
|
3994
3998
|
},{key:"onDestinationsReady",value:function onDestinationsReady(){// May be do any destination specific actions here
|
|
@@ -917,7 +917,7 @@
|
|
|
917
917
|
error.stacktrace="".concat(stacktrace,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;case operaSourceloc:default:// eslint-disable-next-line no-param-reassign
|
|
918
918
|
error['opera#sourceloc']="".concat(operaSourceloc,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;}}}globalThis.dispatchEvent(new ErrorEvent('error',{error:error,bubbles:true,cancelable:true,composed:true}));};
|
|
919
919
|
|
|
920
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.
|
|
920
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.29.0-beta.pr.2744.4ae3336';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var BUILD_VARIANT='legacy-bundled';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';var CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
|
921
921
|
|
|
922
922
|
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';
|
|
923
923
|
|
|
@@ -3919,19 +3919,21 @@
|
|
|
3919
3919
|
* @param storeManager Store Manager instance
|
|
3920
3920
|
* @param errorHandler Error handler object
|
|
3921
3921
|
* @param logger Logger object
|
|
3922
|
-
*/function EventRepository(pluginsManager,storeManager,httpClient,errorHandler,logger){_classCallCheck(this,EventRepository);this.pluginsManager=pluginsManager;this.errorHandler=errorHandler;this.httpClient=httpClient;this.logger=logger;this.storeManager=storeManager;}/**
|
|
3922
|
+
*/function EventRepository(pluginsManager,storeManager,httpClient,errorHandler,logger){_classCallCheck(this,EventRepository);this.pluginsManager=pluginsManager;this.errorHandler=errorHandler;this.httpClient=httpClient;this.logger=logger;this.storeManager=storeManager;this.eventsBuffer=[];this.isEventBufferingActive=true;}/**
|
|
3923
3923
|
* Initializes the event repository
|
|
3924
3924
|
*/return _createClass(EventRepository,[{key:"init",value:function init(){var _this=this;this.dataplaneEventsQueue=this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".init"),state,this.httpClient,this.storeManager,this.errorHandler,this.logger);this.dmtEventsQueue=this.pluginsManager.invokeSingle("".concat(DMT_EXT_POINT_PREFIX,".init"),state,this.pluginsManager,this.httpClient,this.storeManager,this.errorHandler,this.logger);this.destinationsEventsQueue=this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".init"),state,this.pluginsManager,this.storeManager,this.dmtEventsQueue,this.errorHandler,this.logger);// Start the queue once the client destinations are ready
|
|
3925
|
-
m(function(){if(state.nativeDestinations.clientDestinationsReady.value===true){var _this$destinationsEve,_this$dmtEventsQueue;(_this$destinationsEve=_this.destinationsEventsQueue)===null||_this$destinationsEve===void 0||_this$destinationsEve.start();(_this$dmtEventsQueue=_this.dmtEventsQueue)===null||_this$dmtEventsQueue===void 0||_this$dmtEventsQueue.start();}});var bufferEventsBeforeConsent=shouldBufferEventsForPreConsent(state);// Start the
|
|
3926
|
-
//
|
|
3927
|
-
//
|
|
3928
|
-
//
|
|
3929
|
-
var
|
|
3930
|
-
|
|
3925
|
+
m(function(){if(state.nativeDestinations.clientDestinationsReady.value===true){var _this$destinationsEve,_this$dmtEventsQueue;(_this$destinationsEve=_this.destinationsEventsQueue)===null||_this$destinationsEve===void 0||_this$destinationsEve.start();(_this$dmtEventsQueue=_this.dmtEventsQueue)===null||_this$dmtEventsQueue===void 0||_this$dmtEventsQueue.start();}});var bufferEventsBeforeConsent=shouldBufferEventsForPreConsent(state);if(!bufferEventsBeforeConsent){this.startDpEventsQueue();}}},{key:"startDpEventsQueue",value:function startDpEventsQueue(){var _this2=this;var bufferEventsUntilReady=state.loadOptions.value.bufferDataPlaneEventsUntilReady;var hybridDestExist=state.nativeDestinations.activeDestinations.value.some(function(dest){return isHybridModeDestination(dest);});var shouldBufferEvents=bufferEventsUntilReady&&hybridDestExist;// Start the data plane events queue and replay the events from the buffer
|
|
3926
|
+
// This function is called when the client destinations are ready
|
|
3927
|
+
// or when the timeout expires
|
|
3928
|
+
// or when no buffering is required
|
|
3929
|
+
var startDpQueueAndReplayEvents=function startDpQueueAndReplayEvents(){var _this2$dataplaneEvent;_this2.isEventBufferingActive=false;_this2.eventsBuffer.forEach(function(event){_this2.enqueue(event);});if(((_this2$dataplaneEvent=_this2.dataplaneEventsQueue)===null||_this2$dataplaneEvent===void 0?void 0:_this2$dataplaneEvent.scheduleTimeoutActive)!==true){var _this2$dataplaneEvent2;(_this2$dataplaneEvent2=_this2.dataplaneEventsQueue)===null||_this2$dataplaneEvent2===void 0||_this2$dataplaneEvent2.start();}_this2.eventsBuffer=[];};var timeoutId;// Start the queue when no event buffering is required
|
|
3930
|
+
// or when buffering is required and the client destinations are ready
|
|
3931
|
+
m(function(){if(!shouldBufferEvents||state.nativeDestinations.clientDestinationsReady.value){globalThis.clearTimeout(timeoutId);startDpQueueAndReplayEvents();}});// Force start the data plane events queue processing after a timeout
|
|
3932
|
+
if(shouldBufferEvents){this.isEventBufferingActive=true;timeoutId=globalThis.setTimeout(function(){startDpQueueAndReplayEvents();},state.loadOptions.value.dataPlaneEventsBufferTimeout);}}},{key:"resume",value:function resume(){var _this$dataplaneEvents;if(((_this$dataplaneEvents=this.dataplaneEventsQueue)===null||_this$dataplaneEvents===void 0?void 0:_this$dataplaneEvents.scheduleTimeoutActive)!==true&&state.consents.postConsent.value.discardPreConsentEvents){var _this$dataplaneEvents2,_this$destinationsEve2;(_this$dataplaneEvents2=this.dataplaneEventsQueue)===null||_this$dataplaneEvents2===void 0||_this$dataplaneEvents2.clear();(_this$destinationsEve2=this.destinationsEventsQueue)===null||_this$destinationsEve2===void 0||_this$destinationsEve2.clear();}this.startDpEventsQueue();}/**
|
|
3931
3933
|
* Enqueues the event for processing
|
|
3932
3934
|
* @param event RudderEvent object
|
|
3933
3935
|
* @param callback API callback function
|
|
3934
|
-
*/},{key:"enqueue",value:function enqueue(event,callback){var dpQEvent=getFinalEvent(event,state);this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.dataplaneEventsQueue,dpQEvent,this.errorHandler,this.logger);var dQEvent=clone(event);this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.destinationsEventsQueue,dQEvent,this.errorHandler,this.logger)
|
|
3936
|
+
*/},{key:"enqueue",value:function enqueue(event,callback){var dpQEvent=getFinalEvent(event,state);if(this.isEventBufferingActive){this.eventsBuffer.push(dpQEvent);}else {this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.dataplaneEventsQueue,dpQEvent,this.errorHandler,this.logger);var dQEvent=clone(event);this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.destinationsEventsQueue,dQEvent,this.errorHandler,this.logger);}// Invoke the callback if it exists
|
|
3935
3937
|
var apiName="".concat(event.type.charAt(0).toUpperCase()).concat(event.type.slice(1)).concat(API_SUFFIX);safelyInvokeCallback(callback,[dpQEvent],apiName,this.logger);}}]);}();
|
|
3936
3938
|
|
|
3937
3939
|
var dispatchSDKEvent=function dispatchSDKEvent(event){var customEvent=new CustomEvent(event,{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:true,cancelable:true,composed:true});globalThis.document.dispatchEvent(customEvent);};var isWriteKeyValid=function isWriteKeyValid(writeKey){return isString(writeKey)&&writeKey.trim().length>0;};var isDataPlaneUrlValid=function isDataPlaneUrlValid(dataPlaneUrl){return isValidURL(dataPlaneUrl);};
|
|
@@ -3964,7 +3966,9 @@
|
|
|
3964
3966
|
* Initialize the storage and event queue
|
|
3965
3967
|
*/},{key:"onPluginsReady",value:function onPluginsReady(){var _this$storeManager,_this$userSessionMana,_this$eventManager;// Initialize storage
|
|
3966
3968
|
(_this$storeManager=this.storeManager)===null||_this$storeManager===void 0||_this$storeManager.init();(_this$userSessionMana=this.userSessionManager)===null||_this$userSessionMana===void 0||_this$userSessionMana.init();// Initialize the appropriate consent manager plugin
|
|
3967
|
-
if(state.consents.enabled.value&&!state.consents.initialized.value){var _this$pluginsManager;(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0||_this$pluginsManager.invokeSingle("consentManager.init",state,this.logger);if(state.consents.preConsent.value.enabled===false){var _this$pluginsManager2;(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0||_this$pluginsManager2.invokeSingle("consentManager.updateConsentsInfo",state,this.storeManager,this.logger);}}//
|
|
3969
|
+
if(state.consents.enabled.value&&!state.consents.initialized.value){var _this$pluginsManager;(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0||_this$pluginsManager.invokeSingle("consentManager.init",state,this.logger);if(state.consents.preConsent.value.enabled===false){var _this$pluginsManager2;(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0||_this$pluginsManager2.invokeSingle("consentManager.updateConsentsInfo",state,this.storeManager,this.logger);}}// Setting the active destinations is important for the events processing.
|
|
3970
|
+
// So, it should be done before initializing the event manager.
|
|
3971
|
+
this.setActiveDestinations();// Initialize event manager
|
|
3968
3972
|
(_this$eventManager=this.eventManager)===null||_this$eventManager===void 0||_this$eventManager.init();// Mark the SDK as initialized
|
|
3969
3973
|
state.lifecycle.status.value='initialized';}/**
|
|
3970
3974
|
* Load plugins
|
|
@@ -3988,13 +3992,13 @@
|
|
|
3988
3992
|
// for-loop as the individual events that are processed may
|
|
3989
3993
|
// add more events to the buffer (this is needed for the consent API)
|
|
3990
3994
|
var bufferedEvents=state.eventBuffer.toBeProcessedArray.value;while(bufferedEvents.length>0){var bufferedEvent=bufferedEvents.shift();state.eventBuffer.toBeProcessedArray.value=bufferedEvents;if(bufferedEvent){var methodName=bufferedEvent[0];if(isFunction(this[methodName])){var _ref;// Send additional arg 'true' to indicate that this is a buffered invocation
|
|
3991
|
-
(_ref=this)[methodName].apply(_ref,_toConsumableArray(bufferedEvent.slice(1)).concat([true]));}}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}/**
|
|
3995
|
+
(_ref=this)[methodName].apply(_ref,_toConsumableArray(bufferedEvent.slice(1)).concat([true]));}}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}},{key:"setActiveDestinations",value:function setActiveDestinations(){var _this$pluginsManager4;(_this$pluginsManager4=this.pluginsManager)===null||_this$pluginsManager4===void 0||_this$pluginsManager4.invokeSingle('nativeDestinations.setActiveDestinations',state,this.pluginsManager,this.errorHandler,this.logger);}/**
|
|
3992
3996
|
* Load device mode destinations
|
|
3993
|
-
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$
|
|
3994
|
-
if(state.lifecycle.status.value==='destinationsLoading'||state.
|
|
3995
|
-
|
|
3997
|
+
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$pluginsManager5;// If the integrations load is already triggered or completed, skip the rest of the logic
|
|
3998
|
+
if(state.lifecycle.status.value==='destinationsLoading'||state.nativeDestinations.clientDestinationsReady.value===true){return;}// Set in state the desired activeDestinations to inject in DOM
|
|
3999
|
+
this.setActiveDestinations();var totalDestinationsToLoad=state.nativeDestinations.activeDestinations.value.length;if(totalDestinationsToLoad===0){n(function(){state.nativeDestinations.clientDestinationsReady.value=true;state.lifecycle.status.value='destinationsReady';});return;}// Start loading native integration scripts and create instances
|
|
3996
4000
|
state.lifecycle.status.value='destinationsLoading';(_this$pluginsManager5=this.pluginsManager)===null||_this$pluginsManager5===void 0||_this$pluginsManager5.invokeSingle('nativeDestinations.load',state,this.externalSrcLoader,this.errorHandler,this.logger);// Progress to next lifecycle phase if all native destinations are initialized or failed
|
|
3997
|
-
m(function(){var areAllDestinationsReady=
|
|
4001
|
+
m(function(){var areAllDestinationsReady=state.nativeDestinations.initializedDestinations.value.length+state.nativeDestinations.failedDestinations.value.length===totalDestinationsToLoad;if(areAllDestinationsReady){n(function(){state.lifecycle.status.value='destinationsReady';state.nativeDestinations.clientDestinationsReady.value=true;});}});}/**
|
|
3998
4002
|
* Move to the ready state
|
|
3999
4003
|
*/// eslint-disable-next-line class-methods-use-this
|
|
4000
4004
|
},{key:"onDestinationsReady",value:function onDestinationsReady(){// May be do any destination specific actions here
|
|
@@ -913,7 +913,7 @@ error.stack="".concat(stack,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;case sta
|
|
|
913
913
|
error.stacktrace="".concat(stacktrace,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;case operaSourceloc:default:// eslint-disable-next-line no-param-reassign
|
|
914
914
|
error['opera#sourceloc']="".concat(operaSourceloc,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;}}}globalThis.dispatchEvent(new ErrorEvent('error',{error:error,bubbles:true,cancelable:true,composed:true}));};
|
|
915
915
|
|
|
916
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.
|
|
916
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.29.0-beta.pr.2744.4ae3336';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var BUILD_VARIANT='legacy';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';var CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
|
917
917
|
|
|
918
918
|
var QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';var QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';var QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';var QUERY_PARAM_USER_ID_KEY='ajs_uid';var QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
|
919
919
|
|
|
@@ -3915,19 +3915,21 @@ var safelyInvokeCallback=function safelyInvokeCallback(callback,args,apiName,log
|
|
|
3915
3915
|
* @param storeManager Store Manager instance
|
|
3916
3916
|
* @param errorHandler Error handler object
|
|
3917
3917
|
* @param logger Logger object
|
|
3918
|
-
*/function EventRepository(pluginsManager,storeManager,httpClient,errorHandler,logger){_classCallCheck(this,EventRepository);this.pluginsManager=pluginsManager;this.errorHandler=errorHandler;this.httpClient=httpClient;this.logger=logger;this.storeManager=storeManager;}/**
|
|
3918
|
+
*/function EventRepository(pluginsManager,storeManager,httpClient,errorHandler,logger){_classCallCheck(this,EventRepository);this.pluginsManager=pluginsManager;this.errorHandler=errorHandler;this.httpClient=httpClient;this.logger=logger;this.storeManager=storeManager;this.eventsBuffer=[];this.isEventBufferingActive=true;}/**
|
|
3919
3919
|
* Initializes the event repository
|
|
3920
3920
|
*/return _createClass(EventRepository,[{key:"init",value:function init(){var _this=this;this.dataplaneEventsQueue=this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".init"),state,this.httpClient,this.storeManager,this.errorHandler,this.logger);this.dmtEventsQueue=this.pluginsManager.invokeSingle("".concat(DMT_EXT_POINT_PREFIX,".init"),state,this.pluginsManager,this.httpClient,this.storeManager,this.errorHandler,this.logger);this.destinationsEventsQueue=this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".init"),state,this.pluginsManager,this.storeManager,this.dmtEventsQueue,this.errorHandler,this.logger);// Start the queue once the client destinations are ready
|
|
3921
|
-
m(function(){if(state.nativeDestinations.clientDestinationsReady.value===true){var _this$destinationsEve,_this$dmtEventsQueue;(_this$destinationsEve=_this.destinationsEventsQueue)===null||_this$destinationsEve===void 0||_this$destinationsEve.start();(_this$dmtEventsQueue=_this.dmtEventsQueue)===null||_this$dmtEventsQueue===void 0||_this$dmtEventsQueue.start();}});var bufferEventsBeforeConsent=shouldBufferEventsForPreConsent(state);// Start the
|
|
3922
|
-
//
|
|
3923
|
-
//
|
|
3924
|
-
//
|
|
3925
|
-
var
|
|
3926
|
-
|
|
3921
|
+
m(function(){if(state.nativeDestinations.clientDestinationsReady.value===true){var _this$destinationsEve,_this$dmtEventsQueue;(_this$destinationsEve=_this.destinationsEventsQueue)===null||_this$destinationsEve===void 0||_this$destinationsEve.start();(_this$dmtEventsQueue=_this.dmtEventsQueue)===null||_this$dmtEventsQueue===void 0||_this$dmtEventsQueue.start();}});var bufferEventsBeforeConsent=shouldBufferEventsForPreConsent(state);if(!bufferEventsBeforeConsent){this.startDpEventsQueue();}}},{key:"startDpEventsQueue",value:function startDpEventsQueue(){var _this2=this;var bufferEventsUntilReady=state.loadOptions.value.bufferDataPlaneEventsUntilReady;var hybridDestExist=state.nativeDestinations.activeDestinations.value.some(function(dest){return isHybridModeDestination(dest);});var shouldBufferEvents=bufferEventsUntilReady&&hybridDestExist;// Start the data plane events queue and replay the events from the buffer
|
|
3922
|
+
// This function is called when the client destinations are ready
|
|
3923
|
+
// or when the timeout expires
|
|
3924
|
+
// or when no buffering is required
|
|
3925
|
+
var startDpQueueAndReplayEvents=function startDpQueueAndReplayEvents(){var _this2$dataplaneEvent;_this2.isEventBufferingActive=false;_this2.eventsBuffer.forEach(function(event){_this2.enqueue(event);});if(((_this2$dataplaneEvent=_this2.dataplaneEventsQueue)===null||_this2$dataplaneEvent===void 0?void 0:_this2$dataplaneEvent.scheduleTimeoutActive)!==true){var _this2$dataplaneEvent2;(_this2$dataplaneEvent2=_this2.dataplaneEventsQueue)===null||_this2$dataplaneEvent2===void 0||_this2$dataplaneEvent2.start();}_this2.eventsBuffer=[];};var timeoutId;// Start the queue when no event buffering is required
|
|
3926
|
+
// or when buffering is required and the client destinations are ready
|
|
3927
|
+
m(function(){if(!shouldBufferEvents||state.nativeDestinations.clientDestinationsReady.value){globalThis.clearTimeout(timeoutId);startDpQueueAndReplayEvents();}});// Force start the data plane events queue processing after a timeout
|
|
3928
|
+
if(shouldBufferEvents){this.isEventBufferingActive=true;timeoutId=globalThis.setTimeout(function(){startDpQueueAndReplayEvents();},state.loadOptions.value.dataPlaneEventsBufferTimeout);}}},{key:"resume",value:function resume(){var _this$dataplaneEvents;if(((_this$dataplaneEvents=this.dataplaneEventsQueue)===null||_this$dataplaneEvents===void 0?void 0:_this$dataplaneEvents.scheduleTimeoutActive)!==true&&state.consents.postConsent.value.discardPreConsentEvents){var _this$dataplaneEvents2,_this$destinationsEve2;(_this$dataplaneEvents2=this.dataplaneEventsQueue)===null||_this$dataplaneEvents2===void 0||_this$dataplaneEvents2.clear();(_this$destinationsEve2=this.destinationsEventsQueue)===null||_this$destinationsEve2===void 0||_this$destinationsEve2.clear();}this.startDpEventsQueue();}/**
|
|
3927
3929
|
* Enqueues the event for processing
|
|
3928
3930
|
* @param event RudderEvent object
|
|
3929
3931
|
* @param callback API callback function
|
|
3930
|
-
*/},{key:"enqueue",value:function enqueue(event,callback){var dpQEvent=getFinalEvent(event,state);this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.dataplaneEventsQueue,dpQEvent,this.errorHandler,this.logger);var dQEvent=clone(event);this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.destinationsEventsQueue,dQEvent,this.errorHandler,this.logger)
|
|
3932
|
+
*/},{key:"enqueue",value:function enqueue(event,callback){var dpQEvent=getFinalEvent(event,state);if(this.isEventBufferingActive){this.eventsBuffer.push(dpQEvent);}else {this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.dataplaneEventsQueue,dpQEvent,this.errorHandler,this.logger);var dQEvent=clone(event);this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.destinationsEventsQueue,dQEvent,this.errorHandler,this.logger);}// Invoke the callback if it exists
|
|
3931
3933
|
var apiName="".concat(event.type.charAt(0).toUpperCase()).concat(event.type.slice(1)).concat(API_SUFFIX);safelyInvokeCallback(callback,[dpQEvent],apiName,this.logger);}}]);}();
|
|
3932
3934
|
|
|
3933
3935
|
var dispatchSDKEvent=function dispatchSDKEvent(event){var customEvent=new CustomEvent(event,{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:true,cancelable:true,composed:true});globalThis.document.dispatchEvent(customEvent);};var isWriteKeyValid=function isWriteKeyValid(writeKey){return isString(writeKey)&&writeKey.trim().length>0;};var isDataPlaneUrlValid=function isDataPlaneUrlValid(dataPlaneUrl){return isValidURL(dataPlaneUrl);};
|
|
@@ -3960,7 +3962,9 @@ if(state.consents.preConsent.value.enabled===true){state.lifecycle.status.value=
|
|
|
3960
3962
|
* Initialize the storage and event queue
|
|
3961
3963
|
*/},{key:"onPluginsReady",value:function onPluginsReady(){var _this$storeManager,_this$userSessionMana,_this$eventManager;// Initialize storage
|
|
3962
3964
|
(_this$storeManager=this.storeManager)===null||_this$storeManager===void 0||_this$storeManager.init();(_this$userSessionMana=this.userSessionManager)===null||_this$userSessionMana===void 0||_this$userSessionMana.init();// Initialize the appropriate consent manager plugin
|
|
3963
|
-
if(state.consents.enabled.value&&!state.consents.initialized.value){var _this$pluginsManager;(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0||_this$pluginsManager.invokeSingle("consentManager.init",state,this.logger);if(state.consents.preConsent.value.enabled===false){var _this$pluginsManager2;(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0||_this$pluginsManager2.invokeSingle("consentManager.updateConsentsInfo",state,this.storeManager,this.logger);}}//
|
|
3965
|
+
if(state.consents.enabled.value&&!state.consents.initialized.value){var _this$pluginsManager;(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0||_this$pluginsManager.invokeSingle("consentManager.init",state,this.logger);if(state.consents.preConsent.value.enabled===false){var _this$pluginsManager2;(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0||_this$pluginsManager2.invokeSingle("consentManager.updateConsentsInfo",state,this.storeManager,this.logger);}}// Setting the active destinations is important for the events processing.
|
|
3966
|
+
// So, it should be done before initializing the event manager.
|
|
3967
|
+
this.setActiveDestinations();// Initialize event manager
|
|
3964
3968
|
(_this$eventManager=this.eventManager)===null||_this$eventManager===void 0||_this$eventManager.init();// Mark the SDK as initialized
|
|
3965
3969
|
state.lifecycle.status.value='initialized';}/**
|
|
3966
3970
|
* Load plugins
|
|
@@ -3984,13 +3988,13 @@ dispatchSDKEvent('RSA_Ready');}/**
|
|
|
3984
3988
|
// for-loop as the individual events that are processed may
|
|
3985
3989
|
// add more events to the buffer (this is needed for the consent API)
|
|
3986
3990
|
var bufferedEvents=state.eventBuffer.toBeProcessedArray.value;while(bufferedEvents.length>0){var bufferedEvent=bufferedEvents.shift();state.eventBuffer.toBeProcessedArray.value=bufferedEvents;if(bufferedEvent){var methodName=bufferedEvent[0];if(isFunction(this[methodName])){var _ref;// Send additional arg 'true' to indicate that this is a buffered invocation
|
|
3987
|
-
(_ref=this)[methodName].apply(_ref,_toConsumableArray(bufferedEvent.slice(1)).concat([true]));}}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}/**
|
|
3991
|
+
(_ref=this)[methodName].apply(_ref,_toConsumableArray(bufferedEvent.slice(1)).concat([true]));}}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}},{key:"setActiveDestinations",value:function setActiveDestinations(){var _this$pluginsManager4;(_this$pluginsManager4=this.pluginsManager)===null||_this$pluginsManager4===void 0||_this$pluginsManager4.invokeSingle('nativeDestinations.setActiveDestinations',state,this.pluginsManager,this.errorHandler,this.logger);}/**
|
|
3988
3992
|
* Load device mode destinations
|
|
3989
|
-
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$
|
|
3990
|
-
if(state.lifecycle.status.value==='destinationsLoading'||state.
|
|
3991
|
-
|
|
3993
|
+
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$pluginsManager5;// If the integrations load is already triggered or completed, skip the rest of the logic
|
|
3994
|
+
if(state.lifecycle.status.value==='destinationsLoading'||state.nativeDestinations.clientDestinationsReady.value===true){return;}// Set in state the desired activeDestinations to inject in DOM
|
|
3995
|
+
this.setActiveDestinations();var totalDestinationsToLoad=state.nativeDestinations.activeDestinations.value.length;if(totalDestinationsToLoad===0){n(function(){state.nativeDestinations.clientDestinationsReady.value=true;state.lifecycle.status.value='destinationsReady';});return;}// Start loading native integration scripts and create instances
|
|
3992
3996
|
state.lifecycle.status.value='destinationsLoading';(_this$pluginsManager5=this.pluginsManager)===null||_this$pluginsManager5===void 0||_this$pluginsManager5.invokeSingle('nativeDestinations.load',state,this.externalSrcLoader,this.errorHandler,this.logger);// Progress to next lifecycle phase if all native destinations are initialized or failed
|
|
3993
|
-
m(function(){var areAllDestinationsReady=
|
|
3997
|
+
m(function(){var areAllDestinationsReady=state.nativeDestinations.initializedDestinations.value.length+state.nativeDestinations.failedDestinations.value.length===totalDestinationsToLoad;if(areAllDestinationsReady){n(function(){state.lifecycle.status.value='destinationsReady';state.nativeDestinations.clientDestinationsReady.value=true;});}});}/**
|
|
3994
3998
|
* Move to the ready state
|
|
3995
3999
|
*/// eslint-disable-next-line class-methods-use-this
|
|
3996
4000
|
},{key:"onDestinationsReady",value:function onDestinationsReady(){// May be do any destination specific actions here
|
|
@@ -913,7 +913,7 @@ error.stack="".concat(stack,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;case sta
|
|
|
913
913
|
error.stacktrace="".concat(stacktrace,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;case operaSourceloc:default:// eslint-disable-next-line no-param-reassign
|
|
914
914
|
error['opera#sourceloc']="".concat(operaSourceloc,"\n").concat(MANUAL_ERROR_IDENTIFIER);break;}}}globalThis.dispatchEvent(new ErrorEvent('error',{error:error,bubbles:true,cancelable:true,composed:true}));};
|
|
915
915
|
|
|
916
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.
|
|
916
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.29.0-beta.pr.2744.4ae3336';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var BUILD_VARIANT='legacy-content-script';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';var CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
|
917
917
|
|
|
918
918
|
var QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';var QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';var QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';var QUERY_PARAM_USER_ID_KEY='ajs_uid';var QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
|
919
919
|
|
|
@@ -3915,19 +3915,21 @@ var safelyInvokeCallback=function safelyInvokeCallback(callback,args,apiName,log
|
|
|
3915
3915
|
* @param storeManager Store Manager instance
|
|
3916
3916
|
* @param errorHandler Error handler object
|
|
3917
3917
|
* @param logger Logger object
|
|
3918
|
-
*/function EventRepository(pluginsManager,storeManager,httpClient,errorHandler,logger){_classCallCheck(this,EventRepository);this.pluginsManager=pluginsManager;this.errorHandler=errorHandler;this.httpClient=httpClient;this.logger=logger;this.storeManager=storeManager;}/**
|
|
3918
|
+
*/function EventRepository(pluginsManager,storeManager,httpClient,errorHandler,logger){_classCallCheck(this,EventRepository);this.pluginsManager=pluginsManager;this.errorHandler=errorHandler;this.httpClient=httpClient;this.logger=logger;this.storeManager=storeManager;this.eventsBuffer=[];this.isEventBufferingActive=true;}/**
|
|
3919
3919
|
* Initializes the event repository
|
|
3920
3920
|
*/return _createClass(EventRepository,[{key:"init",value:function init(){var _this=this;this.dataplaneEventsQueue=this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".init"),state,this.httpClient,this.storeManager,this.errorHandler,this.logger);this.dmtEventsQueue=this.pluginsManager.invokeSingle("".concat(DMT_EXT_POINT_PREFIX,".init"),state,this.pluginsManager,this.httpClient,this.storeManager,this.errorHandler,this.logger);this.destinationsEventsQueue=this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".init"),state,this.pluginsManager,this.storeManager,this.dmtEventsQueue,this.errorHandler,this.logger);// Start the queue once the client destinations are ready
|
|
3921
|
-
m(function(){if(state.nativeDestinations.clientDestinationsReady.value===true){var _this$destinationsEve,_this$dmtEventsQueue;(_this$destinationsEve=_this.destinationsEventsQueue)===null||_this$destinationsEve===void 0||_this$destinationsEve.start();(_this$dmtEventsQueue=_this.dmtEventsQueue)===null||_this$dmtEventsQueue===void 0||_this$dmtEventsQueue.start();}});var bufferEventsBeforeConsent=shouldBufferEventsForPreConsent(state);// Start the
|
|
3922
|
-
//
|
|
3923
|
-
//
|
|
3924
|
-
//
|
|
3925
|
-
var
|
|
3926
|
-
|
|
3921
|
+
m(function(){if(state.nativeDestinations.clientDestinationsReady.value===true){var _this$destinationsEve,_this$dmtEventsQueue;(_this$destinationsEve=_this.destinationsEventsQueue)===null||_this$destinationsEve===void 0||_this$destinationsEve.start();(_this$dmtEventsQueue=_this.dmtEventsQueue)===null||_this$dmtEventsQueue===void 0||_this$dmtEventsQueue.start();}});var bufferEventsBeforeConsent=shouldBufferEventsForPreConsent(state);if(!bufferEventsBeforeConsent){this.startDpEventsQueue();}}},{key:"startDpEventsQueue",value:function startDpEventsQueue(){var _this2=this;var bufferEventsUntilReady=state.loadOptions.value.bufferDataPlaneEventsUntilReady;var hybridDestExist=state.nativeDestinations.activeDestinations.value.some(function(dest){return isHybridModeDestination(dest);});var shouldBufferEvents=bufferEventsUntilReady&&hybridDestExist;// Start the data plane events queue and replay the events from the buffer
|
|
3922
|
+
// This function is called when the client destinations are ready
|
|
3923
|
+
// or when the timeout expires
|
|
3924
|
+
// or when no buffering is required
|
|
3925
|
+
var startDpQueueAndReplayEvents=function startDpQueueAndReplayEvents(){var _this2$dataplaneEvent;_this2.isEventBufferingActive=false;_this2.eventsBuffer.forEach(function(event){_this2.enqueue(event);});if(((_this2$dataplaneEvent=_this2.dataplaneEventsQueue)===null||_this2$dataplaneEvent===void 0?void 0:_this2$dataplaneEvent.scheduleTimeoutActive)!==true){var _this2$dataplaneEvent2;(_this2$dataplaneEvent2=_this2.dataplaneEventsQueue)===null||_this2$dataplaneEvent2===void 0||_this2$dataplaneEvent2.start();}_this2.eventsBuffer=[];};var timeoutId;// Start the queue when no event buffering is required
|
|
3926
|
+
// or when buffering is required and the client destinations are ready
|
|
3927
|
+
m(function(){if(!shouldBufferEvents||state.nativeDestinations.clientDestinationsReady.value){globalThis.clearTimeout(timeoutId);startDpQueueAndReplayEvents();}});// Force start the data plane events queue processing after a timeout
|
|
3928
|
+
if(shouldBufferEvents){this.isEventBufferingActive=true;timeoutId=globalThis.setTimeout(function(){startDpQueueAndReplayEvents();},state.loadOptions.value.dataPlaneEventsBufferTimeout);}}},{key:"resume",value:function resume(){var _this$dataplaneEvents;if(((_this$dataplaneEvents=this.dataplaneEventsQueue)===null||_this$dataplaneEvents===void 0?void 0:_this$dataplaneEvents.scheduleTimeoutActive)!==true&&state.consents.postConsent.value.discardPreConsentEvents){var _this$dataplaneEvents2,_this$destinationsEve2;(_this$dataplaneEvents2=this.dataplaneEventsQueue)===null||_this$dataplaneEvents2===void 0||_this$dataplaneEvents2.clear();(_this$destinationsEve2=this.destinationsEventsQueue)===null||_this$destinationsEve2===void 0||_this$destinationsEve2.clear();}this.startDpEventsQueue();}/**
|
|
3927
3929
|
* Enqueues the event for processing
|
|
3928
3930
|
* @param event RudderEvent object
|
|
3929
3931
|
* @param callback API callback function
|
|
3930
|
-
*/},{key:"enqueue",value:function enqueue(event,callback){var dpQEvent=getFinalEvent(event,state);this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.dataplaneEventsQueue,dpQEvent,this.errorHandler,this.logger);var dQEvent=clone(event);this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.destinationsEventsQueue,dQEvent,this.errorHandler,this.logger)
|
|
3932
|
+
*/},{key:"enqueue",value:function enqueue(event,callback){var dpQEvent=getFinalEvent(event,state);if(this.isEventBufferingActive){this.eventsBuffer.push(dpQEvent);}else {this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.dataplaneEventsQueue,dpQEvent,this.errorHandler,this.logger);var dQEvent=clone(event);this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.destinationsEventsQueue,dQEvent,this.errorHandler,this.logger);}// Invoke the callback if it exists
|
|
3931
3933
|
var apiName="".concat(event.type.charAt(0).toUpperCase()).concat(event.type.slice(1)).concat(API_SUFFIX);safelyInvokeCallback(callback,[dpQEvent],apiName,this.logger);}}]);}();
|
|
3932
3934
|
|
|
3933
3935
|
var dispatchSDKEvent=function dispatchSDKEvent(event){var customEvent=new CustomEvent(event,{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:true,cancelable:true,composed:true});globalThis.document.dispatchEvent(customEvent);};var isWriteKeyValid=function isWriteKeyValid(writeKey){return isString(writeKey)&&writeKey.trim().length>0;};var isDataPlaneUrlValid=function isDataPlaneUrlValid(dataPlaneUrl){return isValidURL(dataPlaneUrl);};
|
|
@@ -3960,7 +3962,9 @@ if(state.consents.preConsent.value.enabled===true){state.lifecycle.status.value=
|
|
|
3960
3962
|
* Initialize the storage and event queue
|
|
3961
3963
|
*/},{key:"onPluginsReady",value:function onPluginsReady(){var _this$storeManager,_this$userSessionMana,_this$eventManager;// Initialize storage
|
|
3962
3964
|
(_this$storeManager=this.storeManager)===null||_this$storeManager===void 0||_this$storeManager.init();(_this$userSessionMana=this.userSessionManager)===null||_this$userSessionMana===void 0||_this$userSessionMana.init();// Initialize the appropriate consent manager plugin
|
|
3963
|
-
if(state.consents.enabled.value&&!state.consents.initialized.value){var _this$pluginsManager;(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0||_this$pluginsManager.invokeSingle("consentManager.init",state,this.logger);if(state.consents.preConsent.value.enabled===false){var _this$pluginsManager2;(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0||_this$pluginsManager2.invokeSingle("consentManager.updateConsentsInfo",state,this.storeManager,this.logger);}}//
|
|
3965
|
+
if(state.consents.enabled.value&&!state.consents.initialized.value){var _this$pluginsManager;(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0||_this$pluginsManager.invokeSingle("consentManager.init",state,this.logger);if(state.consents.preConsent.value.enabled===false){var _this$pluginsManager2;(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0||_this$pluginsManager2.invokeSingle("consentManager.updateConsentsInfo",state,this.storeManager,this.logger);}}// Setting the active destinations is important for the events processing.
|
|
3966
|
+
// So, it should be done before initializing the event manager.
|
|
3967
|
+
this.setActiveDestinations();// Initialize event manager
|
|
3964
3968
|
(_this$eventManager=this.eventManager)===null||_this$eventManager===void 0||_this$eventManager.init();// Mark the SDK as initialized
|
|
3965
3969
|
state.lifecycle.status.value='initialized';}/**
|
|
3966
3970
|
* Load plugins
|
|
@@ -3984,13 +3988,13 @@ dispatchSDKEvent('RSA_Ready');}/**
|
|
|
3984
3988
|
// for-loop as the individual events that are processed may
|
|
3985
3989
|
// add more events to the buffer (this is needed for the consent API)
|
|
3986
3990
|
var bufferedEvents=state.eventBuffer.toBeProcessedArray.value;while(bufferedEvents.length>0){var bufferedEvent=bufferedEvents.shift();state.eventBuffer.toBeProcessedArray.value=bufferedEvents;if(bufferedEvent){var methodName=bufferedEvent[0];if(isFunction(this[methodName])){var _ref;// Send additional arg 'true' to indicate that this is a buffered invocation
|
|
3987
|
-
(_ref=this)[methodName].apply(_ref,_toConsumableArray(bufferedEvent.slice(1)).concat([true]));}}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}/**
|
|
3991
|
+
(_ref=this)[methodName].apply(_ref,_toConsumableArray(bufferedEvent.slice(1)).concat([true]));}}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}},{key:"setActiveDestinations",value:function setActiveDestinations(){var _this$pluginsManager4;(_this$pluginsManager4=this.pluginsManager)===null||_this$pluginsManager4===void 0||_this$pluginsManager4.invokeSingle('nativeDestinations.setActiveDestinations',state,this.pluginsManager,this.errorHandler,this.logger);}/**
|
|
3988
3992
|
* Load device mode destinations
|
|
3989
|
-
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$
|
|
3990
|
-
if(state.lifecycle.status.value==='destinationsLoading'||state.
|
|
3991
|
-
|
|
3993
|
+
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$pluginsManager5;// If the integrations load is already triggered or completed, skip the rest of the logic
|
|
3994
|
+
if(state.lifecycle.status.value==='destinationsLoading'||state.nativeDestinations.clientDestinationsReady.value===true){return;}// Set in state the desired activeDestinations to inject in DOM
|
|
3995
|
+
this.setActiveDestinations();var totalDestinationsToLoad=state.nativeDestinations.activeDestinations.value.length;if(totalDestinationsToLoad===0){n(function(){state.nativeDestinations.clientDestinationsReady.value=true;state.lifecycle.status.value='destinationsReady';});return;}// Start loading native integration scripts and create instances
|
|
3992
3996
|
state.lifecycle.status.value='destinationsLoading';(_this$pluginsManager5=this.pluginsManager)===null||_this$pluginsManager5===void 0||_this$pluginsManager5.invokeSingle('nativeDestinations.load',state,this.externalSrcLoader,this.errorHandler,this.logger);// Progress to next lifecycle phase if all native destinations are initialized or failed
|
|
3993
|
-
m(function(){var areAllDestinationsReady=
|
|
3997
|
+
m(function(){var areAllDestinationsReady=state.nativeDestinations.initializedDestinations.value.length+state.nativeDestinations.failedDestinations.value.length===totalDestinationsToLoad;if(areAllDestinationsReady){n(function(){state.lifecycle.status.value='destinationsReady';state.nativeDestinations.clientDestinationsReady.value=true;});}});}/**
|
|
3994
3998
|
* Move to the ready state
|
|
3995
3999
|
*/// eslint-disable-next-line class-methods-use-this
|
|
3996
4000
|
},{key:"onDestinationsReady",value:function onDestinationsReady(){// May be do any destination specific actions here
|