@rudderstack/analytics-js 3.0.0-beta.13 → 3.0.0-beta.15
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 +35 -0
- package/dist/npm/index.d.ts +103 -47
- package/dist/npm/legacy/cjs/index.js +392 -321
- package/dist/npm/legacy/esm/index.js +392 -321
- package/dist/npm/legacy/umd/index.js +392 -321
- package/dist/npm/modern/bundled/cjs/index.js +389 -317
- package/dist/npm/modern/bundled/esm/index.js +389 -317
- package/dist/npm/modern/bundled/umd/index.js +389 -317
- package/dist/npm/modern/cjs/index.js +239 -203
- package/dist/npm/modern/esm/index.js +239 -203
- package/dist/npm/modern/umd/index.js +239 -203
- package/package.json +4 -3
@@ -597,8 +597,9 @@ function _has(prop,obj){return Object.prototype.hasOwnProperty.call(obj,prop);}
|
|
597
597
|
* R.type([]); //=> "Array"
|
598
598
|
* R.type(/[A-z]/); //=> "RegExp"
|
599
599
|
* R.type(() => {}); //=> "Function"
|
600
|
+
* R.type(async () => {}); //=> "AsyncFunction"
|
600
601
|
* R.type(undefined); //=> "Undefined"
|
601
|
-
*/var type=/*#__PURE__*/_curry1(function type(val){return val===null?'Null':val===undefined?'Undefined':Object.prototype.toString.call(val).slice(8,-1);});
|
602
|
+
*/var type=/*#__PURE__*/_curry1(function type(val){return val===null?'Null':val===undefined?'Undefined':Object.prototype.toString.call(val).slice(8,-1);});var type$1 = type;
|
602
603
|
|
603
604
|
function _isObject(x){return Object.prototype.toString.call(x)==='[object Object]';}
|
604
605
|
|
@@ -638,7 +639,7 @@ function _isString(x){return Object.prototype.toString.call(x)==='[object String
|
|
638
639
|
* @symb R.nth(-1, [a, b, c]) = c
|
639
640
|
* @symb R.nth(0, [a, b, c]) = a
|
640
641
|
* @symb R.nth(1, [a, b, c]) = b
|
641
|
-
*/var nth=/*#__PURE__*/_curry2(function nth(offset,list){var idx=offset<0?list.length+offset:offset;return _isString(list)?list.charAt(idx):list[idx];});
|
642
|
+
*/var nth=/*#__PURE__*/_curry2(function nth(offset,list){var idx=offset<0?list.length+offset:offset;return _isString(list)?list.charAt(idx):list[idx];});var nth$1 = nth;
|
642
643
|
|
643
644
|
function _cloneRegExp(pattern){return new RegExp(pattern.source,pattern.flags?pattern.flags:(pattern.global?'g':'')+(pattern.ignoreCase?'i':'')+(pattern.multiline?'m':'')+(pattern.sticky?'y':'')+(pattern.unicode?'u':'')+(pattern.dotAll?'s':''));}
|
644
645
|
|
@@ -651,7 +652,7 @@ function _cloneRegExp(pattern){return new RegExp(pattern.source,pattern.flags?pa
|
|
651
652
|
* @return {*} The copied value.
|
652
653
|
*/function _clone(value,deep,map){map||(map=new _ObjectMap());// this avoids the slower switch with a quick if decision removing some milliseconds in each run.
|
653
654
|
if(_isPrimitive(value)){return value;}var copy=function copy(copiedValue){// Check for circular and same references on the object graph and return its corresponding clone.
|
654
|
-
var cachedCopy=map.get(value);if(cachedCopy){return cachedCopy;}map.set(value,copiedValue);for(var key in value){if(Object.prototype.hasOwnProperty.call(value,key)){copiedValue[key]=deep?_clone(value[key],true,map):value[key];}}return copiedValue;};switch(type(value)){case'Object':return copy(Object.create(Object.getPrototypeOf(value)));case'Array':return copy([]);case'Date':return new Date(value.valueOf());case'RegExp':return _cloneRegExp(value);case'Int8Array':case'Uint8Array':case'Uint8ClampedArray':case'Int16Array':case'Uint16Array':case'Int32Array':case'Uint32Array':case'Float32Array':case'Float64Array':case'BigInt64Array':case'BigUint64Array':return value.slice();default:return value;}}function _isPrimitive(param){var type=_typeof(param);return param==null||type!='object'&&type!='function';}var _ObjectMap=/*#__PURE__*/function(){function _ObjectMap(){this.map={};this.length=0;}_ObjectMap.prototype.set=function(key,value){var hashedKey=this.hash(key);var bucket=this.map[hashedKey];if(!bucket){this.map[hashedKey]=bucket=[];}bucket.push([key,value]);this.length+=1;};_ObjectMap.prototype.hash=function(key){var hashedKey=[];for(var value in key){hashedKey.push(Object.prototype.toString.call(key[value]));}return hashedKey.join();};_ObjectMap.prototype.get=function(key){/**
|
655
|
+
var cachedCopy=map.get(value);if(cachedCopy){return cachedCopy;}map.set(value,copiedValue);for(var key in value){if(Object.prototype.hasOwnProperty.call(value,key)){copiedValue[key]=deep?_clone(value[key],true,map):value[key];}}return copiedValue;};switch(type$1(value)){case'Object':return copy(Object.create(Object.getPrototypeOf(value)));case'Array':return copy([]);case'Date':return new Date(value.valueOf());case'RegExp':return _cloneRegExp(value);case'Int8Array':case'Uint8Array':case'Uint8ClampedArray':case'Int16Array':case'Uint16Array':case'Int32Array':case'Uint32Array':case'Float32Array':case'Float64Array':case'BigInt64Array':case'BigUint64Array':return value.slice();default:return value;}}function _isPrimitive(param){var type=_typeof(param);return param==null||type!='object'&&type!='function';}var _ObjectMap=/*#__PURE__*/function(){function _ObjectMap(){this.map={};this.length=0;}_ObjectMap.prototype.set=function(key,value){var hashedKey=this.hash(key);var bucket=this.map[hashedKey];if(!bucket){this.map[hashedKey]=bucket=[];}bucket.push([key,value]);this.length+=1;};_ObjectMap.prototype.hash=function(key){var hashedKey=[];for(var value in key){hashedKey.push(Object.prototype.toString.call(key[value]));}return hashedKey.join();};_ObjectMap.prototype.get=function(key){/**
|
655
656
|
* depending on the number of objects to be cloned is faster to just iterate over the items in the map just because the hash function is so costly,
|
656
657
|
* on my tests this number is 180, anything above that using the hash function is faster.
|
657
658
|
*/if(this.length<=180){for(var p in this.map){var _bucket=this.map[p];for(var i=0;i<_bucket.length;i+=1){var element=_bucket[i];if(element[0]===key){return element[1];}}}return;}var hashedKey=this.hash(key);var bucket=this.map[hashedKey];if(!bucket){return;}for(var _i=0;_i<bucket.length;_i+=1){var _element=bucket[_i];if(_element[0]===key){return _element[1];}}};return _ObjectMap;}();
|
@@ -701,7 +702,7 @@ var cachedCopy=map.get(value);if(cachedCopy){return cachedCopy;}map.set(value,co
|
|
701
702
|
*
|
702
703
|
* R.paths([['a', 'b'], ['p', 0, 'q']], {a: {b: 2}, p: [{q: 3}]}); //=> [2, 3]
|
703
704
|
* R.paths([['a', 'b'], ['p', 'r']], {a: {b: 2}, p: [{q: 3}]}); //=> [2, undefined]
|
704
|
-
*/var paths=/*#__PURE__*/_curry2(function paths(pathsArray,obj){return pathsArray.map(function(paths){var val=obj;var idx=0;var p;while(idx<paths.length){if(val==null){return;}p=paths[idx];val=_isInteger(p)?nth(p,val):val[p];idx+=1;}return val;});});
|
705
|
+
*/var paths=/*#__PURE__*/_curry2(function paths(pathsArray,obj){return pathsArray.map(function(paths){var val=obj;var idx=0;var p;while(idx<paths.length){if(val==null){return;}p=paths[idx];val=_isInteger(p)?nth$1(p,val):val[p];idx+=1;}return val;});});var paths$1 = paths;
|
705
706
|
|
706
707
|
/**
|
707
708
|
* Retrieves the value at a given path. The nodes of the path can be arbitrary strings or non-negative integers.
|
@@ -726,7 +727,7 @@ var cachedCopy=map.get(value);if(cachedCopy){return cachedCopy;}map.set(value,co
|
|
726
727
|
* R.path(['a', 'b', -2], {a: {b: [1, 2, 3]}}); //=> 2
|
727
728
|
* R.path([2], {'2': 2}); //=> 2
|
728
729
|
* R.path([-2], {'-2': 'a'}); //=> undefined
|
729
|
-
*/var path=/*#__PURE__*/_curry2(function path(pathAr,obj){return paths([pathAr],obj)[0];});var path$1 = path;
|
730
|
+
*/var path=/*#__PURE__*/_curry2(function path(pathAr,obj){return paths$1([pathAr],obj)[0];});var path$1 = path;
|
730
731
|
|
731
732
|
/**
|
732
733
|
* Creates a new object with the own properties of the two provided objects. If
|
@@ -752,7 +753,7 @@ var cachedCopy=map.get(value);if(cachedCopy){return cachedCopy;}map.set(value,co
|
|
752
753
|
* { b: true, thing: 'bar', values: [15, 35] });
|
753
754
|
* //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] }
|
754
755
|
* @symb R.mergeWithKey(f, { x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: f('y', 2, 5), z: 3 }
|
755
|
-
*/var mergeWithKey=/*#__PURE__*/_curry3(function mergeWithKey(fn,l,r){var result={};var k;l=l||{};r=r||{};for(k in l){if(_has(k,l)){result[k]=_has(k,r)?fn(k,l[k],r[k]):l[k];}}for(k in r){if(_has(k,r)&&!_has(k,result)){result[k]=r[k];}}return result;});
|
756
|
+
*/var mergeWithKey=/*#__PURE__*/_curry3(function mergeWithKey(fn,l,r){var result={};var k;l=l||{};r=r||{};for(k in l){if(_has(k,l)){result[k]=_has(k,r)?fn(k,l[k],r[k]):l[k];}}for(k in r){if(_has(k,r)&&!_has(k,result)){result[k]=r[k];}}return result;});var mergeWithKey$1 = mergeWithKey;
|
756
757
|
|
757
758
|
/**
|
758
759
|
* Creates a new object with the own properties of the two provided objects.
|
@@ -781,7 +782,7 @@ var cachedCopy=map.get(value);if(cachedCopy){return cachedCopy;}map.set(value,co
|
|
781
782
|
* { a: true, c: { thing: 'foo', values: [10, 20] }},
|
782
783
|
* { b: true, c: { thing: 'bar', values: [15, 35] }});
|
783
784
|
* //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }}
|
784
|
-
*/var mergeDeepWithKey=/*#__PURE__*/_curry3(function mergeDeepWithKey(fn,lObj,rObj){return mergeWithKey(function(k,lVal,rVal){if(_isObject(lVal)&&_isObject(rVal)){return mergeDeepWithKey(fn,lVal,rVal);}else {return fn(k,lVal,rVal);}},lObj,rObj);});
|
785
|
+
*/var mergeDeepWithKey=/*#__PURE__*/_curry3(function mergeDeepWithKey(fn,lObj,rObj){return mergeWithKey$1(function(k,lVal,rVal){if(_isObject(lVal)&&_isObject(rVal)){return mergeDeepWithKey(fn,lVal,rVal);}else {return fn(k,lVal,rVal);}},lObj,rObj);});var mergeDeepWithKey$1 = mergeDeepWithKey;
|
785
786
|
|
786
787
|
/**
|
787
788
|
* Creates a new object with the own properties of the two provided objects.
|
@@ -809,7 +810,7 @@ var cachedCopy=map.get(value);if(cachedCopy){return cachedCopy;}map.set(value,co
|
|
809
810
|
* { a: true, c: { values: [10, 20] }},
|
810
811
|
* { b: true, c: { values: [15, 35] }});
|
811
812
|
* //=> { a: true, b: true, c: { values: [10, 20, 15, 35] }}
|
812
|
-
*/var mergeDeepWith=/*#__PURE__*/_curry3(function mergeDeepWith(fn,lObj,rObj){return mergeDeepWithKey(function(k,lVal,rVal){return fn(lVal,rVal);},lObj,rObj);});var mergeDeepWith$1 = mergeDeepWith;
|
813
|
+
*/var mergeDeepWith=/*#__PURE__*/_curry3(function mergeDeepWith(fn,lObj,rObj){return mergeDeepWithKey$1(function(k,lVal,rVal){return fn(lVal,rVal);},lObj,rObj);});var mergeDeepWith$1 = mergeDeepWith;
|
813
814
|
|
814
815
|
/**
|
815
816
|
* Returns a partial copy of an object containing only the keys that satisfy
|
@@ -836,7 +837,8 @@ var cachedCopy=map.get(value);if(cachedCopy){return cachedCopy;}map.set(value,co
|
|
836
837
|
* A function to check given value is a function
|
837
838
|
* @param value input value
|
838
839
|
* @returns boolean
|
839
|
-
*/
|
840
|
+
*/ // eslint-disable-next-line @typescript-eslint/ban-types
|
841
|
+
var isFunction=function isFunction(value){return typeof value==='function'&&Boolean(value.constructor&&value.call&&value.apply);};/**
|
840
842
|
* A function to check given value is a string
|
841
843
|
* @param value input value
|
842
844
|
* @returns boolean
|
@@ -954,9 +956,9 @@ payload.groupId=null;payload.traits=groupId;payload.options=!isFunction(traits)?
|
|
954
956
|
// Also, to clone the incoming object type arguments
|
955
957
|
if(isDefined(payload.groupId)){payload.groupId=tryStringify(payload.groupId);}else {delete payload.groupId;}payload.traits=isObjectLiteralAndNotNull(payload.traits)?clone$1(payload.traits):{};if(isDefined(payload.options)){payload.options=clone$1(payload.options);}else {delete payload.options;}return payload;};
|
956
958
|
|
957
|
-
var CAPABILITIES_MANAGER='CapabilitiesManager';var CONFIG_MANAGER='ConfigManager';var EVENT_MANAGER='EventManager';var PLUGINS_MANAGER='PluginsManager';var USER_SESSION_MANAGER='UserSessionManager';var ERROR_HANDLER='ErrorHandler';var PLUGIN_ENGINE='PluginEngine';var STORE_MANAGER='StoreManager';var READY_API='readyApi';var
|
959
|
+
var CAPABILITIES_MANAGER='CapabilitiesManager';var CONFIG_MANAGER='ConfigManager';var EVENT_MANAGER='EventManager';var PLUGINS_MANAGER='PluginsManager';var USER_SESSION_MANAGER='UserSessionManager';var ERROR_HANDLER='ErrorHandler';var PLUGIN_ENGINE='PluginEngine';var STORE_MANAGER='StoreManager';var READY_API='readyApi';var EVENT_REPOSITORY='EventRepository';var EXTERNAL_SRC_LOADER='ExternalSrcLoader';var HTTP_CLIENT='HttpClient';var RS_APP='RudderStackApplication';var ANALYTICS_CORE='AnalyticsCore';
|
958
960
|
|
959
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.0.0-beta.
|
961
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.0.0-beta.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';
|
960
962
|
|
961
963
|
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';
|
962
964
|
|
@@ -989,11 +991,17 @@ if(queryObject.get(QUERY_PARAM_ANONYMOUS_ID_KEY)){argumentsArray.unshift(['setAn
|
|
989
991
|
* Retrieve an existing buffered load method call and remove from the existing array
|
990
992
|
*/var getPreloadedLoadEvent=function getPreloadedLoadEvent(preloadedEventsArray){var loadMethodName='load';var loadEvent=[];/**
|
991
993
|
* Iterate the buffered API calls until we find load call and process it separately
|
992
|
-
*/var i=0;while(i<preloadedEventsArray.length){if(preloadedEventsArray[i]&&preloadedEventsArray[i][0]===loadMethodName){loadEvent=preloadedEventsArray[i];preloadedEventsArray.splice(i,1);break;}i+=1;}return loadEvent;};/**
|
994
|
+
*/var i=0;while(i<preloadedEventsArray.length){if(preloadedEventsArray[i]&&preloadedEventsArray[i][0]===loadMethodName){loadEvent=clone$1(preloadedEventsArray[i]);preloadedEventsArray.splice(i,1);break;}i+=1;}return loadEvent;};/**
|
995
|
+
* Promote consent events to the top of the preloaded events array
|
996
|
+
* @param preloadedEventsArray Preloaded events array
|
997
|
+
* @returns None
|
998
|
+
*/var promotePreloadedConsentEventsToTop=function promotePreloadedConsentEventsToTop(preloadedEventsArray){var consentMethodName='consent';var consentEvents=preloadedEventsArray.filter(function(bufferedEvent){return bufferedEvent[0]===consentMethodName;});var nonConsentEvents=preloadedEventsArray.filter(function(bufferedEvent){return bufferedEvent[0]!==consentMethodName;});// Remove all elements and add consent events first followed by non consent events
|
999
|
+
// eslint-disable-next-line unicorn/no-useless-spread
|
1000
|
+
preloadedEventsArray.splice.apply(preloadedEventsArray,[0,preloadedEventsArray.length].concat(_toConsumableArray(consentEvents),_toConsumableArray(nonConsentEvents)));};/**
|
993
1001
|
* Retrieve any existing events that were triggered before SDK load and enqueue in buffer
|
994
1002
|
*/var retrievePreloadBufferEvents=function retrievePreloadBufferEvents(instance){var preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER)||[];// Get events that are pre-populated via query string params
|
995
|
-
retrieveEventsFromQueryString(preloadedEventsArray)
|
996
|
-
if(
|
1003
|
+
retrieveEventsFromQueryString(preloadedEventsArray);// Enqueue the non load events in the buffer of the global rudder analytics singleton
|
1004
|
+
if(preloadedEventsArray.length>0){instance.enqueuePreloadBufferEvents(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,[]);}};var consumePreloadBufferedEvent=function consumePreloadBufferedEvent(event,analyticsInstance){var _ref;var methodName=event.shift();var callOptions;if(isFunction(analyticsInstance[methodName])){switch(methodName){case'page':callOptions=pageArgumentsToCallOptions.apply(void 0,_toConsumableArray(event));break;case'track':callOptions=trackArgumentsToCallOptions.apply(void 0,_toConsumableArray(event));break;case'identify':callOptions=identifyArgumentsToCallOptions.apply(void 0,_toConsumableArray(event));break;case'alias':callOptions=aliasArgumentsToCallOptions.apply(void 0,_toConsumableArray(event));break;case'group':callOptions=groupArgumentsToCallOptions.apply(void 0,_toConsumableArray(event));break;default:(_ref=analyticsInstance)[methodName].apply(_ref,_toConsumableArray(event));break;}if(callOptions){analyticsInstance[methodName](callOptions);}}};
|
997
1005
|
|
998
1006
|
var DEFAULT_EXT_SRC_LOAD_TIMEOUT_MS=10*1000;// 10 seconds
|
999
1007
|
|
@@ -1039,10 +1047,10 @@ var EXTERNAL_SOURCE_LOAD_ORIGIN='RS_JS_SDK';
|
|
1039
1047
|
* @param {*} newScriptElement the script element to add
|
1040
1048
|
*
|
1041
1049
|
* @returns
|
1042
|
-
*/var insertScript=function insertScript(newScriptElement){
|
1043
|
-
var headElements=document.getElementsByTagName('head');if(headElements.length>0){headElements[0]
|
1044
|
-
var scriptElements=document.getElementsByTagName('script');if(scriptElements.length>0&&scriptElements[0]
|
1045
|
-
var headElement=document.createElement('head');headElement.appendChild(newScriptElement);var htmlElement=document.getElementsByTagName('html')[0];htmlElement.insertBefore(headElement,htmlElement.firstChild);};/**
|
1050
|
+
*/var insertScript=function insertScript(newScriptElement){var _scriptElements$;// First try to add it to the head
|
1051
|
+
var headElements=document.getElementsByTagName('head');if(headElements.length>0){var _headElements$,_headElements$2;(_headElements$=headElements[0])===null||_headElements$===void 0||_headElements$.insertBefore(newScriptElement,(_headElements$2=headElements[0])===null||_headElements$2===void 0?void 0:_headElements$2.firstChild);return;}// Else wise add it before the first script tag
|
1052
|
+
var scriptElements=document.getElementsByTagName('script');if(scriptElements.length>0&&(_scriptElements$=scriptElements[0])!==null&&_scriptElements$!==void 0&&_scriptElements$.parentNode){var _scriptElements$2;(_scriptElements$2=scriptElements[0])===null||_scriptElements$2===void 0||_scriptElements$2.parentNode.insertBefore(newScriptElement,scriptElements[0]);return;}// Create a new head element and add the script as fallback
|
1053
|
+
var headElement=document.createElement('head');headElement.appendChild(newScriptElement);var htmlElement=document.getElementsByTagName('html')[0];htmlElement===null||htmlElement===void 0||htmlElement.insertBefore(headElement,htmlElement.firstChild);};/**
|
1046
1054
|
* Loads external js file as a script html tag
|
1047
1055
|
*
|
1048
1056
|
* @param {*} url The URL of the script to be loaded
|
@@ -1060,7 +1068,7 @@ timeoutID=globalThis.setTimeout(function(){reject(new Error(SCRIPT_LOAD_TIMEOUT_
|
|
1060
1068
|
* Service to load external resources/files
|
1061
1069
|
*/var ExternalSrcLoader=/*#__PURE__*/function(){function ExternalSrcLoader(errorHandler,logger){var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:DEFAULT_EXT_SRC_LOAD_TIMEOUT_MS;_classCallCheck(this,ExternalSrcLoader);_defineProperty(this,"hasErrorHandler",false);this.errorHandler=errorHandler;this.logger=logger;this.timeout=timeout;this.hasErrorHandler=Boolean(this.errorHandler);this.onError=this.onError.bind(this);}/**
|
1062
1070
|
* Load external resource of type javascript
|
1063
|
-
*/_createClass(ExternalSrcLoader,[{key:"loadJSFile",value:function loadJSFile(config){var _this=this;var url=config.url,id=config.id,timeout=config.timeout,async=config.async,callback=config.callback,extraAttributes=config.extraAttributes;var isFireAndForget=!
|
1071
|
+
*/_createClass(ExternalSrcLoader,[{key:"loadJSFile",value:function loadJSFile(config){var _this=this;var url=config.url,id=config.id,timeout=config.timeout,async=config.async,callback=config.callback,extraAttributes=config.extraAttributes;var isFireAndForget=!isFunction(callback);jsFileLoader(url,id,timeout||this.timeout,async,extraAttributes).then(function(id){if(!isFireAndForget){callback(id);}}).catch(function(err){_this.onError(err);if(!isFireAndForget){callback();}});}/**
|
1064
1072
|
* Handle errors
|
1065
1073
|
*/},{key:"onError",value:function onError(error){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0||_this$errorHandler.onError(error,EXTERNAL_SRC_LOADER);}else {throw error;}}}]);return ExternalSrcLoader;}();
|
1066
1074
|
|
@@ -1085,9 +1093,9 @@ styledLogArgs.push.apply(styledLogArgs,_toConsumableArray(data.slice(1)));return
|
|
1085
1093
|
// default is v3
|
1086
1094
|
var SUPPORTED_STORAGE_TYPES=['localStorage','memoryStorage','cookieStorage','sessionStorage','none'];var DEFAULT_STORAGE_TYPE='cookieStorage';
|
1087
1095
|
|
1088
|
-
var SOURCE_CONFIG_OPTION_ERROR="\"getSourceConfig\" must be a function. Please make sure that it is defined and returns a valid source configuration object.";var INTG_CDN_BASE_URL_ERROR="Failed to load the SDK as the CDN base URL for integrations is not valid.";var PLUGINS_CDN_BASE_URL_ERROR="Failed to load the SDK as the CDN base URL for plugins is not valid.";var DATA_PLANE_URL_ERROR="Failed to load the SDK as the data plane URL could not be determined. Please check that the data plane URL is set correctly and try again.";var XHR_PAYLOAD_PREP_ERROR="Failed to prepare data for the request.";var EVENT_OBJECT_GENERATION_ERROR="Failed to generate the event object.";var PLUGIN_EXT_POINT_MISSING_ERROR="Failed to invoke plugin because the extension point name is missing.";var PLUGIN_EXT_POINT_INVALID_ERROR="Failed to invoke plugin because the extension point name is invalid.";// ERROR
|
1096
|
+
var SOURCE_CONFIG_OPTION_ERROR="\"getSourceConfig\" must be a function. Please make sure that it is defined and returns a valid source configuration object.";var INTG_CDN_BASE_URL_ERROR="Failed to load the SDK as the CDN base URL for integrations is not valid.";var PLUGINS_CDN_BASE_URL_ERROR="Failed to load the SDK as the CDN base URL for plugins is not valid.";var DATA_PLANE_URL_ERROR="Failed to load the SDK as the data plane URL could not be determined. Please check that the data plane URL is set correctly and try again.";var SOURCE_CONFIG_RESOLUTION_ERROR="Unable to process/parse source configuration response.";var XHR_PAYLOAD_PREP_ERROR="Failed to prepare data for the request.";var EVENT_OBJECT_GENERATION_ERROR="Failed to generate the event object.";var PLUGIN_EXT_POINT_MISSING_ERROR="Failed to invoke plugin because the extension point name is missing.";var PLUGIN_EXT_POINT_INVALID_ERROR="Failed to invoke plugin because the extension point name is invalid.";// ERROR
|
1089
1097
|
var UNSUPPORTED_CONSENT_MANAGER_ERROR=function UNSUPPORTED_CONSENT_MANAGER_ERROR(context,selectedConsentManager,consentManagersToPluginNameMap){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The consent manager \"").concat(selectedConsentManager,"\" is not supported. Please choose one of the following supported consent managers: \"").concat(Object.keys(consentManagersToPluginNameMap),"\".");};var REPORTING_PLUGIN_INIT_FAILURE_ERROR=function REPORTING_PLUGIN_INIT_FAILURE_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to initialize the error reporting plugin.");};var NOTIFY_FAILURE_ERROR=function NOTIFY_FAILURE_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to notify the error.");};var PLUGIN_NAME_MISSING_ERROR=function PLUGIN_NAME_MISSING_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin name is missing.");};var PLUGIN_ALREADY_EXISTS_ERROR=function PLUGIN_ALREADY_EXISTS_ERROR(context,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin \"").concat(pluginName,"\" already exists.");};var PLUGIN_NOT_FOUND_ERROR=function PLUGIN_NOT_FOUND_ERROR(context,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin \"").concat(pluginName,"\" not found.");};var PLUGIN_ENGINE_BUG_ERROR=function PLUGIN_ENGINE_BUG_ERROR(context,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin \"").concat(pluginName,"\" not found in plugins but found in byName. This indicates a bug in the plugin engine. Please report this issue to the development team.");};var PLUGIN_DEPS_ERROR=function PLUGIN_DEPS_ERROR(context,pluginName,notExistDeps){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin \"").concat(pluginName,"\" could not be loaded because some of its dependencies \"").concat(notExistDeps,"\" do not exist.");};var PLUGIN_INVOCATION_ERROR=function PLUGIN_INVOCATION_ERROR(context,extPoint,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to invoke the \"").concat(extPoint,"\" extension point of plugin \"").concat(pluginName,"\".");};var STORAGE_UNAVAILABILITY_ERROR_PREFIX=function STORAGE_UNAVAILABILITY_ERROR_PREFIX(context,storageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The \"").concat(storageType,"\" storage type is ");};var SOURCE_CONFIG_FETCH_ERROR=function SOURCE_CONFIG_FETCH_ERROR(reason){return "Failed to fetch the source config. Reason: ".concat(reason);};var WRITE_KEY_VALIDATION_ERROR=function WRITE_KEY_VALIDATION_ERROR(writeKey){return "The write key \"".concat(writeKey,"\" is invalid. It must be a non-empty string. Please check that the write key is correct and try again.");};var DATA_PLANE_URL_VALIDATION_ERROR=function DATA_PLANE_URL_VALIDATION_ERROR(dataPlaneUrl){return "The data plane URL \"".concat(dataPlaneUrl,"\" is invalid. It must be a valid URL string. Please check that the data plane URL is correct and try again.");};var READY_API_CALLBACK_ERROR=function READY_API_CALLBACK_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The callback is not a function.");};var XHR_DELIVERY_ERROR=function XHR_DELIVERY_ERROR(prefix,status,statusText,url){return "".concat(prefix," with status: ").concat(status,", ").concat(statusText," for URL: ").concat(url,".");};var XHR_REQUEST_ERROR=function XHR_REQUEST_ERROR(prefix,e,url){return "".concat(prefix," due to timeout or no connection (").concat(e?e.type:'',") for URL: ").concat(url,".");};var XHR_SEND_ERROR=function XHR_SEND_ERROR(prefix,url){return "".concat(prefix," for URL: ").concat(url);};var STORE_DATA_SAVE_ERROR=function STORE_DATA_SAVE_ERROR(key){return "Failed to save the value for \"".concat(key,"\" to storage");};var STORE_DATA_FETCH_ERROR=function STORE_DATA_FETCH_ERROR(key){return "Failed to retrieve or parse data for \"".concat(key,"\" from storage");};// WARNING
|
1090
|
-
var STORAGE_TYPE_VALIDATION_WARNING=function STORAGE_TYPE_VALIDATION_WARNING(context,storageType,defaultStorageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(storageType,"\" is not supported. Please choose one of the following supported types: \"").concat(SUPPORTED_STORAGE_TYPES,"\". The default type \"").concat(defaultStorageType,"\" will be used instead.");};var UNSUPPORTED_ERROR_REPORTING_PROVIDER_WARNING=function UNSUPPORTED_ERROR_REPORTING_PROVIDER_WARNING(context,selectedErrorReportingProvider,errorReportingProvidersToPluginNameMap,defaultProvider){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The error reporting provider \"").concat(selectedErrorReportingProvider,"\" is not supported. Please choose one of the following supported providers: \"").concat(Object.keys(errorReportingProvidersToPluginNameMap),"\". The default provider \"").concat(defaultProvider,"\" will be used instead.");};var UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING=function UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING(context,selectedStorageEncryptionVersion,storageEncryptionVersionsToPluginNameMap,defaultVersion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage encryption version \"").concat(selectedStorageEncryptionVersion,"\" is not supported. Please choose one of the following supported versions: \"").concat(Object.keys(storageEncryptionVersionsToPluginNameMap),"\". The default version \"").concat(defaultVersion,"\" will be used instead.");};var STORAGE_DATA_MIGRATION_OVERRIDE_WARNING=function STORAGE_DATA_MIGRATION_OVERRIDE_WARNING(context,storageEncryptionVersion,defaultVersion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage data migration has been disabled because the configured storage encryption version (").concat(storageEncryptionVersion,") is not the latest (").concat(defaultVersion,"). To enable storage data migration, please update the storage encryption version to the latest version.");};var UNSUPPORTED_RESIDENCY_SERVER_REGION_WARNING=function UNSUPPORTED_RESIDENCY_SERVER_REGION_WARNING(context,selectedResidencyServerRegion,defaultRegion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The residency server region \"").concat(selectedResidencyServerRegion,"\" is not supported. Please choose one of the following supported regions: \"US, EU\". The default region \"").concat(defaultRegion,"\" will be used instead.");};var RESERVED_KEYWORD_WARNING=function RESERVED_KEYWORD_WARNING(context,property,parentKeyPath,reservedElements){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The \"").concat(property,"\" property defined under \"").concat(parentKeyPath,"\" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (").concat(reservedElements,").");};var INVALID_CONTEXT_OBJECT_WARNING=function INVALID_CONTEXT_OBJECT_WARNING(logContext){return "".concat(logContext).concat(LOG_CONTEXT_SEPARATOR,"Please make sure that the \"context\" property in the event API's \"options\" argument is a valid object literal with key-value pairs.");};var UNSUPPORTED_BEACON_API_WARNING=function UNSUPPORTED_BEACON_API_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The Beacon API is not supported by your browser. The events will be sent using XHR instead.");};var TIMEOUT_NOT_NUMBER_WARNING=function TIMEOUT_NOT_NUMBER_WARNING(context,timeout,defaultValue){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value \"").concat(timeout,"\" is not a number. The default timeout of ").concat(defaultValue," ms will be used instead.");};var TIMEOUT_ZERO_WARNING=function TIMEOUT_ZERO_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value is 0, which disables the automatic session tracking feature. If you want to enable session tracking, please provide a positive integer value for the timeout.");};var TIMEOUT_NOT_RECOMMENDED_WARNING=function TIMEOUT_NOT_RECOMMENDED_WARNING(context,timeout,minTimeout){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value ").concat(timeout," ms is less than the recommended minimum of ").concat(minTimeout," ms. Please consider increasing the timeout value to ensure optimal performance and reliability.");};var INVALID_SESSION_ID_WARNING=function INVALID_SESSION_ID_WARNING(context,sessionId,minSessionIdLength){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided session ID (").concat(sessionId,") is either invalid, not a positive integer, or not at least \"").concat(minSessionIdLength,"\" digits long. A new session ID will be auto-generated instead.");};var STORAGE_QUOTA_EXCEEDED_WARNING=function STORAGE_QUOTA_EXCEEDED_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage is either full or unavailable, so the data will not be persisted. Switching to in-memory storage.");};var STORAGE_UNAVAILABLE_WARNING=function STORAGE_UNAVAILABLE_WARNING(context,selectedStorageType,finalStorageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(selectedStorageType,"\" is not available. The SDK will
|
1098
|
+
var STORAGE_TYPE_VALIDATION_WARNING=function STORAGE_TYPE_VALIDATION_WARNING(context,storageType,defaultStorageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(storageType,"\" is not supported. Please choose one of the following supported types: \"").concat(SUPPORTED_STORAGE_TYPES,"\". The default type \"").concat(defaultStorageType,"\" will be used instead.");};var UNSUPPORTED_ERROR_REPORTING_PROVIDER_WARNING=function UNSUPPORTED_ERROR_REPORTING_PROVIDER_WARNING(context,selectedErrorReportingProvider,errorReportingProvidersToPluginNameMap,defaultProvider){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The error reporting provider \"").concat(selectedErrorReportingProvider,"\" is not supported. Please choose one of the following supported providers: \"").concat(Object.keys(errorReportingProvidersToPluginNameMap),"\". The default provider \"").concat(defaultProvider,"\" will be used instead.");};var UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING=function UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING(context,selectedStorageEncryptionVersion,storageEncryptionVersionsToPluginNameMap,defaultVersion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage encryption version \"").concat(selectedStorageEncryptionVersion,"\" is not supported. Please choose one of the following supported versions: \"").concat(Object.keys(storageEncryptionVersionsToPluginNameMap),"\". The default version \"").concat(defaultVersion,"\" will be used instead.");};var STORAGE_DATA_MIGRATION_OVERRIDE_WARNING=function STORAGE_DATA_MIGRATION_OVERRIDE_WARNING(context,storageEncryptionVersion,defaultVersion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage data migration has been disabled because the configured storage encryption version (").concat(storageEncryptionVersion,") is not the latest (").concat(defaultVersion,"). To enable storage data migration, please update the storage encryption version to the latest version.");};var UNSUPPORTED_RESIDENCY_SERVER_REGION_WARNING=function UNSUPPORTED_RESIDENCY_SERVER_REGION_WARNING(context,selectedResidencyServerRegion,defaultRegion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The residency server region \"").concat(selectedResidencyServerRegion,"\" is not supported. Please choose one of the following supported regions: \"US, EU\". The default region \"").concat(defaultRegion,"\" will be used instead.");};var RESERVED_KEYWORD_WARNING=function RESERVED_KEYWORD_WARNING(context,property,parentKeyPath,reservedElements){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The \"").concat(property,"\" property defined under \"").concat(parentKeyPath,"\" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (").concat(reservedElements,").");};var INVALID_CONTEXT_OBJECT_WARNING=function INVALID_CONTEXT_OBJECT_WARNING(logContext){return "".concat(logContext).concat(LOG_CONTEXT_SEPARATOR,"Please make sure that the \"context\" property in the event API's \"options\" argument is a valid object literal with key-value pairs.");};var UNSUPPORTED_BEACON_API_WARNING=function UNSUPPORTED_BEACON_API_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The Beacon API is not supported by your browser. The events will be sent using XHR instead.");};var TIMEOUT_NOT_NUMBER_WARNING=function TIMEOUT_NOT_NUMBER_WARNING(context,timeout,defaultValue){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value \"").concat(timeout,"\" is not a number. The default timeout of ").concat(defaultValue," ms will be used instead.");};var TIMEOUT_ZERO_WARNING=function TIMEOUT_ZERO_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value is 0, which disables the automatic session tracking feature. If you want to enable session tracking, please provide a positive integer value for the timeout.");};var TIMEOUT_NOT_RECOMMENDED_WARNING=function TIMEOUT_NOT_RECOMMENDED_WARNING(context,timeout,minTimeout){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value ").concat(timeout," ms is less than the recommended minimum of ").concat(minTimeout," ms. Please consider increasing the timeout value to ensure optimal performance and reliability.");};var INVALID_SESSION_ID_WARNING=function INVALID_SESSION_ID_WARNING(context,sessionId,minSessionIdLength){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided session ID (").concat(sessionId,") is either invalid, not a positive integer, or not at least \"").concat(minSessionIdLength,"\" digits long. A new session ID will be auto-generated instead.");};var STORAGE_QUOTA_EXCEEDED_WARNING=function STORAGE_QUOTA_EXCEEDED_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage is either full or unavailable, so the data will not be persisted. Switching to in-memory storage.");};var STORAGE_UNAVAILABLE_WARNING=function STORAGE_UNAVAILABLE_WARNING(context,entry,selectedStorageType,finalStorageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(selectedStorageType,"\" is not available for entry \"").concat(entry,"\". The SDK will initialize the entry with \"").concat(finalStorageType,"\" storage type instead.");};var WRITE_KEY_NOT_A_STRING_ERROR=function WRITE_KEY_NOT_A_STRING_ERROR(context,writeKey){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The write key \"").concat(writeKey,"\" is not a string. Please check that the write key is correct and try again.");};var EMPTY_GROUP_CALL_ERROR=function EMPTY_GROUP_CALL_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The group() method must be called with at least one argument.");};var READY_CALLBACK_INVOKE_ERROR="Failed to invoke the ready callback";var API_CALLBACK_INVOKE_ERROR="API Callback Invocation Failed";var INVALID_CONFIG_URL_WARNING=function INVALID_CONFIG_URL_WARNING(context,configUrl){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided config URL \"").concat(configUrl,"\" is invalid. Using the default value instead.");};var POLYFILL_SCRIPT_LOAD_ERROR=function POLYFILL_SCRIPT_LOAD_ERROR(scriptId,url){return "Failed to load the polyfill script with ID \"".concat(scriptId,"\" from URL ").concat(url,".");};var COOKIE_DATA_ENCODING_ERROR="Failed to encode the cookie data.";var UNSUPPORTED_PRE_CONSENT_STORAGE_STRATEGY=function UNSUPPORTED_PRE_CONSENT_STORAGE_STRATEGY(context,selectedStrategy,defaultStrategy){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The pre-consent storage strategy \"").concat(selectedStrategy,"\" is not supported. Please choose one of the following supported strategies: \"none, session, anonymousId\". The default strategy \"").concat(defaultStrategy,"\" will be used instead.");};var UNSUPPORTED_PRE_CONSENT_EVENTS_DELIVERY_TYPE=function UNSUPPORTED_PRE_CONSENT_EVENTS_DELIVERY_TYPE(context,selectedDeliveryType,defaultDeliveryType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The pre-consent events delivery type \"").concat(selectedDeliveryType,"\" is not supported. Please choose one of the following supported types: \"immediate, buffer\". The default type \"").concat(defaultDeliveryType,"\" will be used instead.");};// DEBUG
|
1091
1099
|
|
1092
1100
|
var CDN_INT_DIR='js-integrations';var CDN_PLUGINS_DIR='plugins';
|
1093
1101
|
|
@@ -1096,13 +1104,13 @@ var BUILD_TYPE='legacy';var SDK_CDN_BASE_URL='https://cdn.rudderlabs.com';var CD
|
|
1096
1104
|
// const PLUGINS_BASE_URL = `${SDK_CDN_BASE_URL}/latest/${CDN_ARCH_VERSION_DIR}/${BUILD_TYPE}/${CDN_PLUGINS_DIR}`;
|
1097
1105
|
var DEFAULT_CONFIG_BE_URL='https://api.rudderstack.com';
|
1098
1106
|
|
1099
|
-
var _StorageEncryptionVer;var DEFAULT_ERROR_REPORTING_PROVIDER='bugsnag';var DEFAULT_STORAGE_ENCRYPTION_VERSION='v3';var ConsentManagersToPluginNameMap={oneTrust:'OneTrustConsentManager',ketch:'KetchConsentManager'};var ErrorReportingProvidersToPluginNameMap=_defineProperty({},DEFAULT_ERROR_REPORTING_PROVIDER,'Bugsnag');var StorageEncryptionVersionsToPluginNameMap=(_StorageEncryptionVer={},_defineProperty(_StorageEncryptionVer,DEFAULT_STORAGE_ENCRYPTION_VERSION,'StorageEncryption'),_defineProperty(_StorageEncryptionVer,"legacy",'StorageEncryptionLegacy'),_StorageEncryptionVer);
|
1107
|
+
var _StorageEncryptionVer;var DEFAULT_ERROR_REPORTING_PROVIDER='bugsnag';var DEFAULT_STORAGE_ENCRYPTION_VERSION='v3';var ConsentManagersToPluginNameMap={oneTrust:'OneTrustConsentManager',ketch:'KetchConsentManager',custom:'CustomConsentManager'};var ErrorReportingProvidersToPluginNameMap=_defineProperty({},DEFAULT_ERROR_REPORTING_PROVIDER,'Bugsnag');var StorageEncryptionVersionsToPluginNameMap=(_StorageEncryptionVer={},_defineProperty(_StorageEncryptionVer,DEFAULT_STORAGE_ENCRYPTION_VERSION,'StorageEncryption'),_defineProperty(_StorageEncryptionVer,"legacy",'StorageEncryptionLegacy'),_StorageEncryptionVer);
|
1100
1108
|
|
1101
1109
|
var defaultLoadOptions={logLevel:'ERROR',configUrl:DEFAULT_CONFIG_BE_URL,loadIntegration:true,sessions:{autoTrack:true,timeout:DEFAULT_SESSION_TIMEOUT_MS},sameSiteCookie:'Lax',polyfillIfRequired:true,integrations:{All:true},useBeacon:false,beaconQueueOptions:{},destinationsQueueOptions:{},queueOptions:{},lockIntegrationsVersion:false,uaChTrackLevel:'none',plugins:[],useGlobalIntegrationsConfigInEvents:false,bufferDataPlaneEventsUntilReady:false,dataPlaneEventsBufferTimeout:DEFAULT_DATA_PLANE_EVENTS_BUFFER_TIMEOUT_MS,storage:{encryption:{version:DEFAULT_STORAGE_ENCRYPTION_VERSION},migrate:false},sendAdblockPageOptions:{}};var loadOptionsState=a(clone$1(defaultLoadOptions));
|
1102
1110
|
|
1103
|
-
var
|
1111
|
+
var USER_SESSION_STORAGE_KEYS={userId:'rl_user_id',userTraits:'rl_trait',anonymousId:'rl_anonymous_id',groupId:'rl_group_id',groupTraits:'rl_group_trait',initialReferrer:'rl_page_init_referrer',initialReferringDomain:'rl_page_init_referring_domain',sessionInfo:'rl_session',authToken:'rl_auth_token'};var DEFAULT_USER_SESSION_VALUES={userId:'',userTraits:{},anonymousId:'',groupId:'',groupTraits:{},initialReferrer:'',initialReferringDomain:'',sessionInfo:{},authToken:null};
|
1104
1112
|
|
1105
|
-
var defaultSessionInfo={autoTrack:true,timeout:DEFAULT_SESSION_TIMEOUT_MS};var sessionState={userId:a(
|
1113
|
+
var defaultSessionInfo={autoTrack:true,timeout:DEFAULT_SESSION_TIMEOUT_MS};var sessionState={userId:a(DEFAULT_USER_SESSION_VALUES.userId),userTraits:a(DEFAULT_USER_SESSION_VALUES.userTraits),anonymousId:a(DEFAULT_USER_SESSION_VALUES.anonymousId),groupId:a(DEFAULT_USER_SESSION_VALUES.groupId),groupTraits:a(DEFAULT_USER_SESSION_VALUES.groupTraits),initialReferrer:a(DEFAULT_USER_SESSION_VALUES.initialReferrer),initialReferringDomain:a(DEFAULT_USER_SESSION_VALUES.initialReferringDomain),sessionInfo:a(DEFAULT_USER_SESSION_VALUES.sessionInfo),authToken:a(DEFAULT_USER_SESSION_VALUES.authToken)};
|
1106
1114
|
|
1107
1115
|
var capabilitiesState={isOnline:a(true),storage:{isLocalStorageAvailable:a(false),isCookieStorageAvailable:a(false),isSessionStorageAvailable:a(false)},isBeaconAvailable:a(false),isLegacyDOM:a(false),isUaCHAvailable:a(false),isCryptoAvailable:a(false),isIE11:a(false),isAdBlocked:a(false)};
|
1108
1116
|
|
@@ -1112,11 +1120,11 @@ var sourceConfigState=a(undefined);
|
|
1112
1120
|
|
1113
1121
|
var lifecycleState={activeDataplaneUrl:a(undefined),integrationsCDNPath:a(DEST_SDK_BASE_URL),pluginsCDNPath:a(PLUGINS_BASE_URL),sourceConfigUrl:a(undefined),status:a(undefined),initialized:a(false),logLevel:a('ERROR'),loaded:a(false),readyCallbacks:a([]),writeKey:a(undefined),dataPlaneUrl:a(undefined)};
|
1114
1122
|
|
1115
|
-
var consentsState={
|
1123
|
+
var consentsState={enabled:a(false),initialized:a(false),data:a({}),activeConsentManagerPluginName:a(undefined),preConsent:a({enabled:false}),postConsent:a({}),resolutionStrategy:a('and'),provider:a(undefined),metadata:a(undefined)};
|
1116
1124
|
|
1117
1125
|
var metricsState={retries:a(0),dropped:a(0),sent:a(0),queued:a(0),triggered:a(0)};
|
1118
1126
|
|
1119
|
-
var contextState={app:a({name:APP_NAME,namespace:APP_NAMESPACE,version:APP_VERSION}),traits:a(null),library:a({name:APP_NAME,version:APP_VERSION}),userAgent:a(''),device:a(null),network:a(null),os:a({name:'',version:''}),locale:a(null),screen:a({density:0,width:0,height:0,innerWidth:0,innerHeight:0}),'ua-ch':a(undefined)};
|
1127
|
+
var contextState={app:a({name:APP_NAME,namespace:APP_NAMESPACE,version:APP_VERSION}),traits:a(null),library:a({name:APP_NAME,version:APP_VERSION}),userAgent:a(''),device:a(null),network:a(null),os:a({name:'',version:''}),locale:a(null),screen:a({density:0,width:0,height:0,innerWidth:0,innerHeight:0}),'ua-ch':a(undefined),timezone:a(undefined)};
|
1120
1128
|
|
1121
1129
|
var nativeDestinationsState={configuredDestinations:a([]),activeDestinations:a([]),loadOnlyIntegrations:a({}),failedDestinations:a([]),loadIntegration:a(true),initializedDestinations:a([]),clientDestinationsReady:a(false),integrationsConfig:a({})};
|
1122
1130
|
|
@@ -1131,7 +1139,7 @@ var defaultStateValues={capabilities:capabilitiesState,consents:consentsState,co
|
|
1131
1139
|
// to next or return the value if it is the last one instead of an array per
|
1132
1140
|
// plugin that is the normal invoke
|
1133
1141
|
// TODO: add invoke method for extension point that we know only one plugin can be used. add invokeMultiple and invokeSingle methods
|
1134
|
-
var PluginEngine=/*#__PURE__*/function(){function PluginEngine(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var logger=arguments.length>1?arguments[1]:undefined;_classCallCheck(this,PluginEngine);_defineProperty(this,"plugins",[]);_defineProperty(this,"byName",{});_defineProperty(this,"cache",{});_defineProperty(this,"config",{throws:true});this.config=_objectSpread2({throws:true},options);this.logger=logger;}_createClass(PluginEngine,[{key:"register",value:function register(plugin,state){if(!plugin.name){var errorMessage=PLUGIN_NAME_MISSING_ERROR(PLUGIN_ENGINE);if(this.config.throws){throw new Error(errorMessage);}else {var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0||_this$logger.error(errorMessage,plugin);}}if(this.byName[plugin.name]){var _errorMessage=PLUGIN_ALREADY_EXISTS_ERROR(PLUGIN_ENGINE,plugin.name);if(this.config.throws){throw new Error(_errorMessage);}else {var _this$logger2;(_this$logger2=this.logger)===null||_this$logger2===void 0||_this$logger2.error(_errorMessage);}}this.cache={};this.plugins=this.plugins.slice();var pos=this.plugins.length;this.plugins.forEach(function(pluginItem,index){var _pluginItem$deps;if((_pluginItem$deps=pluginItem.deps)!==null&&_pluginItem$deps!==void 0&&_pluginItem$deps.includes(plugin.name)){pos=Math.min(pos,index);}});this.plugins.splice(pos,0,plugin);this.byName[plugin.name]=plugin;if(
|
1142
|
+
var PluginEngine=/*#__PURE__*/function(){function PluginEngine(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var logger=arguments.length>1?arguments[1]:undefined;_classCallCheck(this,PluginEngine);_defineProperty(this,"plugins",[]);_defineProperty(this,"byName",{});_defineProperty(this,"cache",{});_defineProperty(this,"config",{throws:true});this.config=_objectSpread2({throws:true},options);this.logger=logger;}_createClass(PluginEngine,[{key:"register",value:function register(plugin,state){if(!plugin.name){var errorMessage=PLUGIN_NAME_MISSING_ERROR(PLUGIN_ENGINE);if(this.config.throws){throw new Error(errorMessage);}else {var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0||_this$logger.error(errorMessage,plugin);}}if(this.byName[plugin.name]){var _errorMessage=PLUGIN_ALREADY_EXISTS_ERROR(PLUGIN_ENGINE,plugin.name);if(this.config.throws){throw new Error(_errorMessage);}else {var _this$logger2;(_this$logger2=this.logger)===null||_this$logger2===void 0||_this$logger2.error(_errorMessage);}}this.cache={};this.plugins=this.plugins.slice();var pos=this.plugins.length;this.plugins.forEach(function(pluginItem,index){var _pluginItem$deps;if((_pluginItem$deps=pluginItem.deps)!==null&&_pluginItem$deps!==void 0&&_pluginItem$deps.includes(plugin.name)){pos=Math.min(pos,index);}});this.plugins.splice(pos,0,plugin);this.byName[plugin.name]=plugin;if(isFunction(plugin.initialize)){plugin.initialize(state);}}},{key:"unregister",value:function unregister(name){var plugin=this.byName[name];if(!plugin){var errorMessage=PLUGIN_NOT_FOUND_ERROR(PLUGIN_ENGINE,name);if(this.config.throws){throw new Error(errorMessage);}else {var _this$logger3;(_this$logger3=this.logger)===null||_this$logger3===void 0||_this$logger3.error(errorMessage);}}var index=this.plugins.indexOf(plugin);if(index===-1){var _errorMessage2=PLUGIN_ENGINE_BUG_ERROR(PLUGIN_ENGINE,name);if(this.config.throws){throw new Error(_errorMessage2);}else {var _this$logger4;(_this$logger4=this.logger)===null||_this$logger4===void 0||_this$logger4.error(_errorMessage2);}}this.cache={};delete this.byName[name];this.plugins=this.plugins.slice();this.plugins.splice(index,1);}},{key:"getPlugin",value:function getPlugin(name){return this.byName[name];}},{key:"getPlugins",value:function getPlugins(extPoint){var _this=this;var lifeCycleName=extPoint!==null&&extPoint!==void 0?extPoint:'.';if(!this.cache[lifeCycleName]){this.cache[lifeCycleName]=this.plugins.filter(function(plugin){var _plugin$deps;if((_plugin$deps=plugin.deps)!==null&&_plugin$deps!==void 0&&_plugin$deps.some(function(dependency){return !_this.byName[dependency];})){var _this$logger5;// If deps not exist, then not load it.
|
1135
1143
|
var notExistDeps=plugin.deps.filter(function(dependency){return !_this.byName[dependency];});(_this$logger5=_this.logger)===null||_this$logger5===void 0||_this$logger5.error(PLUGIN_DEPS_ERROR(PLUGIN_ENGINE,plugin.name,notExistDeps));return false;}return lifeCycleName==='.'?true:hasValueByPath(plugin,lifeCycleName);});}return this.cache[lifeCycleName];}// This method allows to process this.plugins so that it could
|
1136
1144
|
// do some unified pre-process before application starts.
|
1137
1145
|
},{key:"processRawPlugins",value:function processRawPlugins(callback){callback(this.plugins);this.cache={};}},{key:"invoke",value:function invoke(extPoint){var _this$config$throws,_this2=this;var allowMultiple=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}var extensionPointName=extPoint;if(!extensionPointName){throw new Error(PLUGIN_EXT_POINT_MISSING_ERROR);}var noCall=extensionPointName.startsWith('!');var throws=(_this$config$throws=this.config.throws)!==null&&_this$config$throws!==void 0?_this$config$throws:extensionPointName.endsWith('!');// eslint-disable-next-line unicorn/better-regex
|
@@ -1181,7 +1189,7 @@ destination.config.useNativeSDK===true);};var isHybridModeDestination=function i
|
|
1181
1189
|
|
1182
1190
|
/**
|
1183
1191
|
* List of plugin names that are loaded as dynamic imports in modern builds
|
1184
|
-
*/var pluginNamesList=['BeaconQueue','Bugsnag','DeviceModeDestinations','DeviceModeTransformation','ErrorReporting','ExternalAnonymousId','GoogleLinker','KetchConsentManager','NativeDestinationQueue','OneTrustConsentManager','StorageEncryption','StorageEncryptionLegacy','StorageMigrator','XhrQueue'];
|
1192
|
+
*/var pluginNamesList=['BeaconQueue','Bugsnag','CustomConsentManager','DeviceModeDestinations','DeviceModeTransformation','ErrorReporting','ExternalAnonymousId','GoogleLinker','KetchConsentManager','NativeDestinationQueue','OneTrustConsentManager','StorageEncryption','StorageEncryptionLegacy','StorageMigrator','XhrQueue'];
|
1185
1193
|
|
1186
1194
|
var COOKIE_STORAGE='cookieStorage';var LOCAL_STORAGE='localStorage';var SESSION_STORAGE='sessionStorage';var MEMORY_STORAGE='memoryStorage';var NO_STORAGE='none';
|
1187
1195
|
|
@@ -1260,11 +1268,11 @@ var sortByTime=function sortByTime(a,b){return a.time-b.time;};var RETRY_QUEUE='
|
|
1260
1268
|
* @param {QueueProcessCallback} fn The function to call in order to process an item added to the queue
|
1261
1269
|
*/var RetryQueue=/*#__PURE__*/function(){function RetryQueue(name,options,queueProcessCb,storeManager){var storageType=arguments.length>4&&arguments[4]!==undefined?arguments[4]:LOCAL_STORAGE;var logger=arguments.length>5?arguments[5]:undefined;var queueBatchItemsSizeCalculatorCb=arguments.length>6?arguments[6]:undefined;_classCallCheck(this,RetryQueue);this.storeManager=storeManager;this.logger=logger;this.name=name;this.id=generateUUID();this.processQueueCb=queueProcessCb;this.batchSizeCalcCb=queueBatchItemsSizeCalculatorCb;this.maxItems=options.maxItems||DEFAULT_MAX_ITEMS;this.maxAttempts=options.maxAttempts||DEFAULT_MAX_RETRY_ATTEMPTS;this.batch={enabled:false};this.configureBatchMode(options);this.backoff={minRetryDelay:options.minRetryDelay||DEFAULT_MIN_RETRY_DELAY_MS,maxRetryDelay:options.maxRetryDelay||DEFAULT_MAX_RETRY_DELAY_MS,factor:options.backoffFactor||DEFAULT_BACKOFF_FACTOR,jitter:options.backoffJitter||DEFAULT_BACKOFF_JITTER};// painstakingly tuned. that's why they're not "easily" configurable
|
1262
1270
|
this.timeouts={ackTimer:DEFAULT_ACK_TIMER_MS,reclaimTimer:DEFAULT_RECLAIM_TIMER_MS,reclaimTimeout:DEFAULT_RECLAIM_TIMEOUT_MS,reclaimWait:DEFAULT_RECLAIM_WAIT_MS};this.schedule=new Schedule();this.processId='0';// Set up our empty queues
|
1263
|
-
this.store=this.storeManager.setStore({id:this.id,name:this.name,validKeys:QueueStatuses,type:storageType});this.
|
1271
|
+
this.store=this.storeManager.setStore({id:this.id,name:this.name,validKeys:QueueStatuses,type:storageType});this.setDefaultQueueEntries();// bind recurring tasks for ease of use
|
1264
1272
|
this.ack=this.ack.bind(this);this.checkReclaim=this.checkReclaim.bind(this);this.processHead=this.processHead.bind(this);this.flushBatch=this.flushBatch.bind(this);// Attach visibility change listener to flush the queue
|
1265
|
-
this.attachListeners();this.scheduleTimeoutActive=false;}_createClass(RetryQueue,[{key:"configureBatchMode",value:function configureBatchMode(options){this.batchingInProgress=false;if(!isObjectLiteralAndNotNull(options.batch)){return;}var batchOptions=options.batch;this.batch.enabled=batchOptions.enabled===true;if(this.batch.enabled){var _batchOptions$maxSize,_batchOptions$maxItem,_batchOptions$flushIn;// Set upper cap on the batch payload size
|
1266
|
-
this.batch.maxSize=Math.min((_batchOptions$maxSize=batchOptions.maxSize)!==null&&_batchOptions$maxSize!==void 0?_batchOptions$maxSize:DEFAULT_MAX_BATCH_SIZE_BYTES,DEFAULT_MAX_BATCH_SIZE_BYTES);this.batch.maxItems=(_batchOptions$maxItem=batchOptions.maxItems)!==null&&_batchOptions$maxItem!==void 0?_batchOptions$maxItem:DEFAULT_MAX_BATCH_ITEMS;this.batch.flushInterval=(_batchOptions$flushIn=batchOptions.flushInterval)!==null&&_batchOptions$flushIn!==void 0?_batchOptions$flushIn:DEFAULT_BATCH_FLUSH_INTERVAL_MS;}}},{key:"attachListeners",value:function attachListeners(){var _this=this;if(this.batch.enabled){globalThis.addEventListener('visibilitychange',function(){if(document.visibilityState==='hidden'){_this.flushBatch();}});}}},{key:"
|
1267
|
-
},{key:"
|
1273
|
+
this.attachListeners();this.scheduleTimeoutActive=false;}_createClass(RetryQueue,[{key:"setDefaultQueueEntries",value:function setDefaultQueueEntries(){this.setStorageEntry(QueueStatuses.IN_PROGRESS,{});this.setStorageEntry(QueueStatuses.QUEUE,[]);this.setStorageEntry(QueueStatuses.BATCH_QUEUE,[]);}},{key:"configureBatchMode",value:function configureBatchMode(options){this.batchingInProgress=false;if(!isObjectLiteralAndNotNull(options.batch)){return;}var batchOptions=options.batch;this.batch.enabled=batchOptions.enabled===true;if(this.batch.enabled){var _batchOptions$maxSize,_batchOptions$maxItem,_batchOptions$flushIn;// Set upper cap on the batch payload size
|
1274
|
+
this.batch.maxSize=Math.min((_batchOptions$maxSize=batchOptions.maxSize)!==null&&_batchOptions$maxSize!==void 0?_batchOptions$maxSize:DEFAULT_MAX_BATCH_SIZE_BYTES,DEFAULT_MAX_BATCH_SIZE_BYTES);this.batch.maxItems=(_batchOptions$maxItem=batchOptions.maxItems)!==null&&_batchOptions$maxItem!==void 0?_batchOptions$maxItem:DEFAULT_MAX_BATCH_ITEMS;this.batch.flushInterval=(_batchOptions$flushIn=batchOptions.flushInterval)!==null&&_batchOptions$flushIn!==void 0?_batchOptions$flushIn:DEFAULT_BATCH_FLUSH_INTERVAL_MS;}}},{key:"attachListeners",value:function attachListeners(){var _this=this;if(this.batch.enabled){globalThis.addEventListener('visibilitychange',function(){if(document.visibilityState==='hidden'){_this.flushBatch();}});}}},{key:"getStorageEntry",value:function getStorageEntry(name){return this.store.get(name!==null&&name!==void 0?name:this.name);}// TODO: fix the type of different queues to be the same if possible
|
1275
|
+
},{key:"setStorageEntry",value:function setStorageEntry(name,value){this.store.set(name!==null&&name!==void 0?name:this.name,value!==null&&value!==void 0?value:[]);}/**
|
1268
1276
|
* Stops processing the queue
|
1269
1277
|
*/},{key:"stop",value:function stop(){this.schedule.cancelAll();this.scheduleTimeoutActive=false;}/**
|
1270
1278
|
* Starts processing the queue
|
@@ -1272,7 +1280,7 @@ this.batch.maxSize=Math.min((_batchOptions$maxSize=batchOptions.maxSize)!==null&
|
|
1272
1280
|
* Configures the timeout handler for flushing the batch queue
|
1273
1281
|
*/},{key:"scheduleFlushBatch",value:function scheduleFlushBatch(){var _this$batch;if(this.batch.enabled&&(_this$batch=this.batch)!==null&&_this$batch!==void 0&&_this$batch.flushInterval){if(this.flushBatchTaskId){this.schedule.cancel(this.flushBatchTaskId);}this.flushBatchTaskId=this.schedule.run(this.flushBatch,this.batch.flushInterval,ScheduleModes.ASAP);}}/**
|
1274
1282
|
* Flushes the batch queue
|
1275
|
-
*/},{key:"flushBatch",value:function flushBatch(){if(!this.batchingInProgress){var _ref;this.batchingInProgress=true;var batchQueue=(_ref=this.
|
1283
|
+
*/},{key:"flushBatch",value:function flushBatch(){if(!this.batchingInProgress){var _ref;this.batchingInProgress=true;var batchQueue=(_ref=this.getStorageEntry(QueueStatuses.BATCH_QUEUE))!==null&&_ref!==void 0?_ref:[];if(batchQueue.length>0){batchQueue=batchQueue.slice(-batchQueue.length);var batchEntry=this.genQueueItem(batchQueue.map(function(queueItem){return queueItem.item;}));this.setStorageEntry(QueueStatuses.BATCH_QUEUE,[]);this.pushToMainQueue(batchEntry);}this.batchingInProgress=false;// Re-schedule the flush task
|
1276
1284
|
this.scheduleFlushBatch();}}/**
|
1277
1285
|
* Decides whether to retry. Overridable.
|
1278
1286
|
*
|
@@ -1289,10 +1297,11 @@ if(curEntry){this.pushToMainQueue(curEntry);}}/**
|
|
1289
1297
|
* Handles a new item added to the retry queue when batching is enabled
|
1290
1298
|
* @param entry New item added to the retry queue
|
1291
1299
|
* @returns Undefined or batch entry object
|
1292
|
-
*/},{key:"handleNewItemForBatch",value:function handleNewItemForBatch(entry){var _ref2;var curEntry;var batchQueue=(_ref2=this.
|
1293
|
-
if(batchDispatchInfo.criteriaMet||batchDispatchInfo.criteriaExceeded){var batchItems;if(batchDispatchInfo.criteriaExceeded){batchItems=batchQueue.slice(0,batchQueue.length-1).map(function(queueItem){return queueItem.item;});batchQueue=[entry];}else {batchItems=batchQueue.map(function(queueItem){return queueItem.item;});batchQueue=[];}
|
1300
|
+
*/},{key:"handleNewItemForBatch",value:function handleNewItemForBatch(entry){var _ref2;var curEntry;var batchQueue=(_ref2=this.getStorageEntry(QueueStatuses.BATCH_QUEUE))!==null&&_ref2!==void 0?_ref2:[];if(!this.batchingInProgress){this.batchingInProgress=true;batchQueue=batchQueue.slice(-batchQueue.length);batchQueue.push(entry);var batchDispatchInfo=this.getBatchDispInfo(batchQueue);// if batch criteria is met, queue the batch events to the main queue and clear batch queue
|
1301
|
+
if(batchDispatchInfo.criteriaMet||batchDispatchInfo.criteriaExceeded){var batchItems;if(batchDispatchInfo.criteriaExceeded){batchItems=batchQueue.slice(0,batchQueue.length-1).map(function(queueItem){return queueItem.item;});batchQueue=[entry];}else {batchItems=batchQueue.map(function(queueItem){return queueItem.item;});batchQueue=[];}// Don't make any batch request if there are no items
|
1302
|
+
if(batchItems.length>0){curEntry=this.genQueueItem(batchItems);}// re-attach the timeout handler
|
1294
1303
|
this.scheduleFlushBatch();}this.batchingInProgress=false;}else {batchQueue.push(entry);}// update the batch queue
|
1295
|
-
this.
|
1304
|
+
this.setStorageEntry(QueueStatuses.BATCH_QUEUE,batchQueue);return curEntry;}},{key:"pushToMainQueue",value:function pushToMainQueue(curEntry){var _ref3;var queue=(_ref3=this.getStorageEntry(QueueStatuses.QUEUE))!==null&&_ref3!==void 0?_ref3:[];queue=queue.slice(-(this.maxItems-1));queue.push(curEntry);queue=queue.sort(sortByTime);this.setStorageEntry(QueueStatuses.QUEUE,queue);if(this.scheduleTimeoutActive){this.processHead();}}/**
|
1296
1305
|
* Adds an item to the queue
|
1297
1306
|
*
|
1298
1307
|
* @param {Object} itemData The item to process
|
@@ -1313,28 +1322,28 @@ this.setQueue(QueueStatuses.BATCH_QUEUE,batchQueue);return curEntry;}},{key:"pus
|
|
1313
1322
|
* @returns Batch dispatch info
|
1314
1323
|
*/},{key:"getBatchDispInfo",value:function getBatchDispInfo(batchItems){var _this$batch2,_this$batch3;var lengthCriteriaMet=false;var lengthCriteriaExceeded=false;var configuredBatchMaxItems=(_this$batch2=this.batch)===null||_this$batch2===void 0?void 0:_this$batch2.maxItems;if(isDefined(configuredBatchMaxItems)){lengthCriteriaMet=batchItems.length===configuredBatchMaxItems;lengthCriteriaExceeded=batchItems.length>configuredBatchMaxItems;}if(lengthCriteriaMet||lengthCriteriaExceeded){return {criteriaMet:lengthCriteriaMet,criteriaExceeded:lengthCriteriaExceeded};}var sizeCriteriaMet=false;var sizeCriteriaExceeded=false;var configuredBatchMaxSize=(_this$batch3=this.batch)===null||_this$batch3===void 0?void 0:_this$batch3.maxSize;if(isDefined(configuredBatchMaxSize)&&isDefined(this.batchSizeCalcCb)){var curBatchSize=this.batchSizeCalcCb(batchItems.map(function(queueItem){return queueItem.item;}));sizeCriteriaMet=curBatchSize===configuredBatchMaxSize;sizeCriteriaExceeded=curBatchSize>configuredBatchMaxSize;}return {criteriaMet:sizeCriteriaMet,criteriaExceeded:sizeCriteriaExceeded};}},{key:"processHead",value:function processHead(){var _ref4,_ref5,_this2=this,_ref7;// cancel the scheduled task if it exists
|
1315
1324
|
this.schedule.cancel(this.processId);// Pop the head off the queue
|
1316
|
-
var queue=(_ref4=this.
|
1317
|
-
var processItemCallback=function processItemCallback(el,id){return function(err,res){var _ref6;var inProgress=(_ref6=_this2.
|
1325
|
+
var queue=(_ref4=this.getStorageEntry(QueueStatuses.QUEUE))!==null&&_ref4!==void 0?_ref4:[];var inProgress=(_ref5=this.getStorageEntry(QueueStatuses.IN_PROGRESS))!==null&&_ref5!==void 0?_ref5:{};var now=this.schedule.now();var toRun=[];// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1326
|
+
var processItemCallback=function processItemCallback(el,id){return function(err,res){var _ref6;var inProgress=(_ref6=_this2.getStorageEntry(QueueStatuses.IN_PROGRESS))!==null&&_ref6!==void 0?_ref6:{};delete inProgress[id];_this2.setStorageEntry(QueueStatuses.IN_PROGRESS,inProgress);if(err){_this2.requeue(el.item,el.attemptNumber+1,err,el.id);}};};var enqueueItem=function enqueueItem(el,id){toRun.push({item:el.item,done:processItemCallback(el,id),attemptNumber:el.attemptNumber});};var inProgressSize=Object.keys(inProgress).length;// eslint-disable-next-line no-plusplus
|
1318
1327
|
while(queue.length>0&&queue[0].time<=now&&inProgressSize++<this.maxItems){var el=queue.shift();if(el){var id=generateUUID();// Save this to the in progress map
|
1319
|
-
inProgress[id]={item:el.item,attemptNumber:el.attemptNumber,time:this.schedule.now()};enqueueItem(el,id);}}this.
|
1328
|
+
inProgress[id]={item:el.item,attemptNumber:el.attemptNumber,time:this.schedule.now()};enqueueItem(el,id);}}this.setStorageEntry(QueueStatuses.QUEUE,queue);this.setStorageEntry(QueueStatuses.IN_PROGRESS,inProgress);toRun.forEach(function(el){// TODO: handle processQueueCb timeout
|
1320
1329
|
try{var willBeRetried=_this2.shouldRetry(el.item,el.attemptNumber+1);_this2.processQueueCb(el.item,el.done,el.attemptNumber,_this2.maxAttempts,willBeRetried);}catch(err){var _this2$logger;(_this2$logger=_this2.logger)===null||_this2$logger===void 0||_this2$logger.error(RETRY_QUEUE_PROCESS_ERROR(RETRY_QUEUE),err);}});// re-read the queue in case the process function finished immediately or added another item
|
1321
|
-
queue=(_ref7=this.
|
1322
|
-
},{key:"ack",value:function ack(){this.
|
1330
|
+
queue=(_ref7=this.getStorageEntry(QueueStatuses.QUEUE))!==null&&_ref7!==void 0?_ref7:[];this.schedule.cancel(this.processId);if(queue.length>0){var nextProcessExecutionTime=queue[0].time-now;this.processId=this.schedule.run(this.processHead,nextProcessExecutionTime,ScheduleModes.ASAP);}}// Ack continuously to prevent other tabs from claiming our queue
|
1331
|
+
},{key:"ack",value:function ack(){this.setStorageEntry(QueueStatuses.ACK,this.schedule.now());this.setStorageEntry(QueueStatuses.RECLAIM_START,null);this.setStorageEntry(QueueStatuses.RECLAIM_END,null);this.schedule.run(this.ack,this.timeouts.ackTimer,ScheduleModes.ASAP);}},{key:"reclaim",value:function reclaim(id){var _this$getStorageEntry,_other$get,_other$get2,_other$get3,_this3=this;var other=this.storeManager.setStore({id:id,name:this.name,validKeys:QueueStatuses,type:LOCAL_STORAGE});var our={queue:(_this$getStorageEntry=this.getStorageEntry(QueueStatuses.QUEUE))!==null&&_this$getStorageEntry!==void 0?_this$getStorageEntry:[]};var their={inProgress:(_other$get=other.get(QueueStatuses.IN_PROGRESS))!==null&&_other$get!==void 0?_other$get:{},batchQueue:(_other$get2=other.get(QueueStatuses.BATCH_QUEUE))!==null&&_other$get2!==void 0?_other$get2:[],queue:(_other$get3=other.get(QueueStatuses.QUEUE))!==null&&_other$get3!==void 0?_other$get3:[]};var trackMessageIds=[];var addConcatQueue=function addConcatQueue(queue,incrementAttemptNumberBy){var concatIterator=function concatIterator(el){var _el$id;var id=(_el$id=el.id)!==null&&_el$id!==void 0?_el$id:generateUUID();if(trackMessageIds.includes(id));else {our.queue.push({item:el.item,attemptNumber:el.attemptNumber+incrementAttemptNumberBy,time:_this3.schedule.now(),id:id});trackMessageIds.push(id);}};if(Array.isArray(queue)){queue.forEach(concatIterator);}else if(queue){Object.values(queue).forEach(concatIterator);}};// add their queue to ours, resetting run-time to immediate and copying the attempt#
|
1323
1332
|
addConcatQueue(their.queue,0);// Process batch queue items
|
1324
1333
|
if(this.batch.enabled){their.batchQueue.forEach(function(el){var _el$id2;var id=(_el$id2=el.id)!==null&&_el$id2!==void 0?_el$id2:generateUUID();if(trackMessageIds.includes(id));else {_this3.enqueue(el);trackMessageIds.push(id);}});}else {// if batching is not enabled in the current instance, add those items to the main queue directly
|
1325
1334
|
addConcatQueue(their.batchQueue,0);}// if the queue is abandoned, all the in-progress are failed. retry them immediately and increment the attempt#
|
1326
|
-
addConcatQueue(their.inProgress,1);our.queue=our.queue.sort(sortByTime);this.
|
1327
|
-
this.
|
1335
|
+
addConcatQueue(their.inProgress,1);our.queue=our.queue.sort(sortByTime);this.setStorageEntry(QueueStatuses.QUEUE,our.queue);// remove all keys one by on next tick to avoid NS_ERROR_STORAGE_BUSY error
|
1336
|
+
this.clearQueueEntries(other,1);// process the new items we claimed
|
1328
1337
|
this.processHead();}// eslint-disable-next-line class-methods-use-this
|
1329
|
-
},{key:"
|
1338
|
+
},{key:"clearQueueEntries",value:function clearQueueEntries(other,localStorageBackoff){this.removeStorageEntry(other,0,localStorageBackoff);}},{key:"removeStorageEntry",value:function removeStorageEntry(store,entryIdx,backoff){var _this4=this;var attempt=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;var maxAttempts=2;globalThis.setTimeout(function(){var queueEntryKeys=Object.keys(QueueStatuses);var entry=QueueStatuses[queueEntryKeys[entryIdx]];try{store.remove(entry);// clear the next entry
|
1330
1339
|
if(entryIdx+1<queueEntryKeys.length){_this4.removeStorageEntry(store,entryIdx+1,backoff);}}catch(err){var storageBusyErr='NS_ERROR_STORAGE_BUSY';var isLocalStorageBusy=err.name===storageBusyErr||err.code===storageBusyErr||err.code===0x80630001;if(isLocalStorageBusy&&attempt<maxAttempts){// Try clearing the same entry again with some extra delay
|
1331
1340
|
_this4.removeStorageEntry(store,entryIdx,backoff+40,attempt+1);}else {var _this4$logger;(_this4$logger=_this4.logger)===null||_this4$logger===void 0||_this4$logger.error(RETRY_QUEUE_ENTRY_REMOVE_ERROR(RETRY_QUEUE,entry,attempt),err);}// clear the next entry
|
1332
1341
|
if(attempt===maxAttempts&&entryIdx+1<queueEntryKeys.length){_this4.removeStorageEntry(store,entryIdx+1,backoff);}}},backoff);}},{key:"checkReclaim",value:function checkReclaim(){var _this5=this;var createReclaimStartTask=function createReclaimStartTask(store){return function(){if(store.get(QueueStatuses.RECLAIM_END)!==_this5.id){return;}if(store.get(QueueStatuses.RECLAIM_START)!==_this5.id){return;}_this5.reclaim(store.id);};};var createReclaimEndTask=function createReclaimEndTask(store){return function(){if(store.get(QueueStatuses.RECLAIM_START)!==_this5.id){return;}store.set(QueueStatuses.RECLAIM_END,_this5.id);_this5.schedule.run(createReclaimStartTask(store),_this5.timeouts.reclaimWait,ScheduleModes.ABANDON);};};var tryReclaim=function tryReclaim(store){store.set(QueueStatuses.RECLAIM_START,_this5.id);store.set(QueueStatuses.ACK,_this5.schedule.now());_this5.schedule.run(createReclaimEndTask(store),_this5.timeouts.reclaimWait,ScheduleModes.ABANDON);};var findOtherQueues=function findOtherQueues(name){var res=[];var storage=_this5.store.getOriginalEngine();for(var i=0;i<storage.length;i++){var k=storage.key(i);var parts=k?k.split('.'):[];if(parts.length!==3){// eslint-disable-next-line no-continue
|
1333
1342
|
continue;}if(parts[0]!==name){// eslint-disable-next-line no-continue
|
1334
1343
|
continue;}if(parts[2]!==QueueStatuses.ACK){// eslint-disable-next-line no-continue
|
1335
|
-
continue;}res.push(_this5.storeManager.setStore({id:parts[1],name:name,validKeys:QueueStatuses,type:LOCAL_STORAGE}));}return res;};findOtherQueues(this.name).forEach(function(store){if(store.id===_this5.id){return;}if(_this5.schedule.now()-store.get(QueueStatuses.ACK)<_this5.timeouts.reclaimTimeout){return;}tryReclaim(store);});this.schedule.run(this.checkReclaim,this.timeouts.reclaimTimer,ScheduleModes.RESCHEDULE);}}]);return RetryQueue;}();
|
1344
|
+
continue;}res.push(_this5.storeManager.setStore({id:parts[1],name:name,validKeys:QueueStatuses,type:LOCAL_STORAGE}));}return res;};findOtherQueues(this.name).forEach(function(store){if(store.id===_this5.id){return;}if(_this5.schedule.now()-store.get(QueueStatuses.ACK)<_this5.timeouts.reclaimTimeout){return;}tryReclaim(store);});this.schedule.run(this.checkReclaim,this.timeouts.reclaimTimer,ScheduleModes.RESCHEDULE);}},{key:"clear",value:function clear(){this.schedule.cancelAll();this.setDefaultQueueEntries();}}]);return RetryQueue;}();
|
1336
1345
|
|
1337
|
-
var pluginName$
|
1346
|
+
var pluginName$e='BeaconQueue';var BeaconQueue=function BeaconQueue(){return {name:pluginName$e,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$e]);},dataplaneEventsQueue:{/**
|
1338
1347
|
* Initialize the queue for delivery
|
1339
1348
|
* @param state Application state
|
1340
1349
|
* @param httpClient http client instance
|
@@ -1385,166 +1394,181 @@ event.context='Script load failures';}// eslint-disable-next-line no-param-reass
|
|
1385
1394
|
event.severity='error';};var onError=function onError(state){var _state$source$value;var metadataSource=(_state$source$value=state.source.value)===null||_state$source$value===void 0?void 0:_state$source$value.id;return function(event){try{// Discard the event if it's not originated at the SDK
|
1386
1395
|
if(!isRudderSDKError(event)){return false;}enhanceErrorEventMutator(event,metadataSource);return true;}catch(_unused){// Drop the error event if it couldn't be filtered as
|
1387
1396
|
// it is most likely a non-SDK error
|
1388
|
-
return false;}};};var getReleaseStage=function getReleaseStage(){var host=globalThis.location.hostname;return host&&DEV_HOSTS.includes(host)?'development':'production';};var getGlobalBugsnagLibInstance=function getGlobalBugsnagLibInstance(){return globalThis[BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME];};var getNewClient=function getNewClient(state,logger){var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();var clientConfig={apiKey:API_KEY,appVersion:'3.0.0-beta.
|
1397
|
+
return false;}};};var getReleaseStage=function getReleaseStage(){var host=globalThis.location.hostname;return host&&DEV_HOSTS.includes(host)?'development':'production';};var getGlobalBugsnagLibInstance=function getGlobalBugsnagLibInstance(){return globalThis[BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME];};var getNewClient=function getNewClient(state,logger){var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();var clientConfig={apiKey:API_KEY,appVersion:'3.0.0-beta.15',// Set SDK version as the app version from build config
|
1389
1398
|
metaData:{SDK:{name:'JS',installType:'npm'}},beforeSend:onError(state),autoCaptureSessions:false,// auto capture sessions is disabled
|
1390
1399
|
collectUserIp:false,// collecting user's IP is disabled
|
1391
1400
|
// enabledBreadcrumbTypes: ['error', 'log', 'user'], // for v7 and above
|
1392
1401
|
maxEvents:100,maxBreadcrumbs:40,releaseStage:getReleaseStage(),user:{id:state.lifecycle.writeKey.value},logger:logger,networkBreadcrumbsEnabled:false};var client=globalBugsnagLibInstance(clientConfig);return client;};var isApiKeyValid=function isApiKeyValid(apiKey){var isAPIKeyValid=!(apiKey.startsWith('{{')||apiKey.endsWith('}}')||apiKey.length===0);return isAPIKeyValid;};var loadBugsnagSDK=function loadBugsnagSDK(externalSrcLoader,logger){var isNotLoaded=GLOBAL_LIBRARY_OBJECT_NAMES.every(function(globalKeyName){return !globalThis[globalKeyName];});if(!isNotLoaded){return;}externalSrcLoader.loadJSFile({url:BUGSNAG_CDN_URL,id:ERROR_REPORT_PROVIDER_NAME_BUGSNAG,callback:function callback(id){if(!id){logger===null||logger===void 0||logger.error(BUGSNAG_SDK_LOAD_ERROR(BUGSNAG_PLUGIN));}}});};var initBugsnagClient=function initBugsnagClient(state,promiseResolve,promiseReject,logger){var time=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();if(typeof globalBugsnagLibInstance==='function'){if(isValidVersion(globalBugsnagLibInstance)){var client=getNewClient(state,logger);promiseResolve(client);}}else if(time>=MAX_WAIT_FOR_SDK_LOAD_MS){promiseReject(new Error(BUGSNAG_SDK_LOAD_TIMEOUT_ERROR(MAX_WAIT_FOR_SDK_LOAD_MS)));}else {// Try to initialize the client after a delay
|
1393
1402
|
globalThis.setTimeout(initBugsnagClient,SDK_LOAD_POLL_INTERVAL_MS,state,promiseResolve,promiseReject,logger,time+SDK_LOAD_POLL_INTERVAL_MS);}};var getAppStateForMetadata=function getAppStateForMetadata(state){var stateStr=stringifyWithoutCircular(state,false,APP_STATE_EXCLUDE_KEYS);return stateStr!==null?JSON.parse(stateStr):undefined;};
|
1394
1403
|
|
1395
|
-
var pluginName$
|
1404
|
+
var pluginName$d='Bugsnag';var Bugsnag=function Bugsnag(){return {name:pluginName$d,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$d]);},errorReportingProvider:{init:function init(state,externalSrcLoader,logger){return new Promise(function(resolve,reject){// If API key token is not parsed or invalid, don't proceed to initialize the client
|
1396
1405
|
if(!isApiKeyValid(API_KEY)){reject(new Error(BUGSNAG_API_KEY_VALIDATION_ERROR(API_KEY)));return;}loadBugsnagSDK(externalSrcLoader,logger);initBugsnagClient(state,resolve,reject,logger);});},notify:function notify(client,error,state,logger){client===null||client===void 0||client.notify(error,{metaData:{state:getAppStateForMetadata(state)}});},breadcrumb:function breadcrumb(client,message,logger){client===null||client===void 0||client.leaveBreadcrumb(message);}}};};
|
1397
1406
|
|
1398
|
-
var
|
1407
|
+
var CUSTOM_CONSENT_MANAGER_PLUGIN='CustomConsentManagerPlugin';
|
1399
1408
|
|
1400
|
-
var
|
1409
|
+
var DESTINATION_CONSENT_STATUS_ERROR$2="Failed to determine the consent status for the destination. Please check the destination configuration and try again.";
|
1401
1410
|
|
1402
|
-
var
|
1411
|
+
var pluginName$c='CustomConsentManager';var CustomConsentManager=function CustomConsentManager(){return {name:pluginName$c,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$c]);},consentManager:{init:function init(state,logger){// Nothing to initialize
|
1412
|
+
},updateConsentsInfo:function updateConsentsInfo(state,storeManager,logger){// Nothing to update. Already provided by the user
|
1413
|
+
},isDestinationConsented:function isDestinationConsented(state,destConfig,errorHandler,logger){if(!state.consents.initialized.value){return true;}var allowedConsentIds=state.consents.data.value.allowedConsentIds;try{var _cmpConfig$resolution;var consentManagement=destConfig.consentManagement;// If the destination does not have consent management config, events should be sent.
|
1414
|
+
if(!consentManagement){return true;}// Get the corresponding consents for the destination
|
1415
|
+
var cmpConfig=consentManagement.find(function(c){return c.provider===state.consents.provider.value;});// If there are no consents configured for the destination for the current provider, events should be sent.
|
1416
|
+
if(!(cmpConfig!==null&&cmpConfig!==void 0&&cmpConfig.consents)){return true;}var configuredConsents=cmpConfig.consents.map(function(c){return c.consent.trim();}).filter(function(n){return n;});var resolutionStrategy=(_cmpConfig$resolution=cmpConfig.resolutionStrategy)!==null&&_cmpConfig$resolution!==void 0?_cmpConfig$resolution:state.consents.resolutionStrategy.value;// match the configured consents with user provided consents as per
|
1417
|
+
// the configured resolution strategy
|
1418
|
+
var matchPredicate=function matchPredicate(consent){return allowedConsentIds.includes(consent);};switch(resolutionStrategy){case'or':return configuredConsents.some(matchPredicate)||configuredConsents.length===0;case'and':default:return configuredConsents.every(matchPredicate);}}catch(err){errorHandler===null||errorHandler===void 0||errorHandler.onError(err,CUSTOM_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR$2);return true;}}}};};
|
1403
1419
|
|
1404
|
-
var _CNameMapping$
|
1420
|
+
var _CNameMapping$1a;var DIR_NAME$1a='AdobeAnalytics';var NAME$1a='ADOBE_ANALYTICS';var DISPLAY_NAME$1a='Adobe Analytics';_defineProperty({},DISPLAY_NAME$1a,DIR_NAME$1a);(_CNameMapping$1a={'Adobe Analytics':NAME$1a,ADOBEANALYTICS:NAME$1a,'ADOBE ANALYTICS':NAME$1a},_defineProperty(_CNameMapping$1a,NAME$1a,NAME$1a),_defineProperty(_CNameMapping$1a,"AdobeAnalytics",NAME$1a),_defineProperty(_CNameMapping$1a,"adobeanalytics",NAME$1a),_defineProperty(_CNameMapping$1a,'adobe analytics',NAME$1a),_defineProperty(_CNameMapping$1a,'Adobe analytics',NAME$1a),_defineProperty(_CNameMapping$1a,'adobe Analytics',NAME$1a),_CNameMapping$1a);
|
1405
1421
|
|
1406
|
-
var _CNameMapping$
|
1422
|
+
var _CNameMapping$19;var DIR_NAME$19='Amplitude';var NAME$19='AM';var DISPLAY_NAME$19='Amplitude';_defineProperty({},DISPLAY_NAME$19,DIR_NAME$19);(_CNameMapping$19={},_defineProperty(_CNameMapping$19,NAME$19,NAME$19),_defineProperty(_CNameMapping$19,"AMPLITUDE",NAME$19),_defineProperty(_CNameMapping$19,"Amplitude",NAME$19),_defineProperty(_CNameMapping$19,"am",NAME$19),_CNameMapping$19);
|
1407
1423
|
|
1408
|
-
var _CNameMapping$
|
1424
|
+
var _CNameMapping$18;var DIR_NAME$18='Appcues';var NAME$18='APPCUES';var DISPLAY_NAME$18='Appcues';_defineProperty({},DISPLAY_NAME$18,DIR_NAME$18);(_CNameMapping$18={},_defineProperty(_CNameMapping$18,NAME$18,NAME$18),_defineProperty(_CNameMapping$18,"Appcues",NAME$18),_defineProperty(_CNameMapping$18,'App Cues',NAME$18),_defineProperty(_CNameMapping$18,"appcues",NAME$18),_CNameMapping$18);
|
1409
1425
|
|
1410
|
-
var _CNameMapping$
|
1426
|
+
var _CNameMapping$17;var DIR_NAME$17='BingAds';var NAME$17='BINGADS';var DISPLAY_NAME$17='Bing Ads';_defineProperty({},DISPLAY_NAME$17,DIR_NAME$17);(_CNameMapping$17={},_defineProperty(_CNameMapping$17,NAME$17,NAME$17),_defineProperty(_CNameMapping$17,"BingAds",NAME$17),_defineProperty(_CNameMapping$17,"bingads",NAME$17),_defineProperty(_CNameMapping$17,'Bing Ads',NAME$17),_defineProperty(_CNameMapping$17,'Bing ads',NAME$17),_defineProperty(_CNameMapping$17,'bing Ads',NAME$17),_defineProperty(_CNameMapping$17,'bing ads',NAME$17),_CNameMapping$17);
|
1411
1427
|
|
1412
|
-
var _CNameMapping$
|
1428
|
+
var _CNameMapping$16;var DIR_NAME$16='Braze';var NAME$16='BRAZE';var DISPLAY_NAME$16='Braze';_defineProperty({},DISPLAY_NAME$16,DIR_NAME$16);(_CNameMapping$16={},_defineProperty(_CNameMapping$16,NAME$16,NAME$16),_defineProperty(_CNameMapping$16,"Braze",NAME$16),_defineProperty(_CNameMapping$16,"braze",NAME$16),_CNameMapping$16);
|
1413
1429
|
|
1414
|
-
var _CNameMapping$
|
1430
|
+
var _CNameMapping$15;var DIR_NAME$15='Bugsnag';var NAME$15='BUGSNAG';var DISPLAY_NAME$15='Bugsnag';_defineProperty({},DISPLAY_NAME$15,DIR_NAME$15);(_CNameMapping$15={},_defineProperty(_CNameMapping$15,NAME$15,NAME$15),_defineProperty(_CNameMapping$15,"bugsnag",NAME$15),_defineProperty(_CNameMapping$15,"Bugsnag",NAME$15),_CNameMapping$15);
|
1415
1431
|
|
1416
|
-
var _CNameMapping$
|
1432
|
+
var _CNameMapping$14;var DIR_NAME$14='Chartbeat';var NAME$14='CHARTBEAT';var DISPLAY_NAME$14='Chartbeat';_defineProperty({},DISPLAY_NAME$14,DIR_NAME$14);(_CNameMapping$14={},_defineProperty(_CNameMapping$14,NAME$14,NAME$14),_defineProperty(_CNameMapping$14,"Chartbeat",NAME$14),_defineProperty(_CNameMapping$14,"chartbeat",NAME$14),_defineProperty(_CNameMapping$14,'Chart Beat',NAME$14),_defineProperty(_CNameMapping$14,'chart beat',NAME$14),_CNameMapping$14);
|
1417
1433
|
|
1418
|
-
var _CNameMapping
|
1434
|
+
var _CNameMapping$13;var DIR_NAME$13='Clevertap';var NAME$13='CLEVERTAP';var DISPLAY_NAME$13='CleverTap';_defineProperty({},DISPLAY_NAME$13,DIR_NAME$13);(_CNameMapping$13={},_defineProperty(_CNameMapping$13,NAME$13,NAME$13),_defineProperty(_CNameMapping$13,"Clevertap",NAME$13),_defineProperty(_CNameMapping$13,"clevertap",NAME$13),_CNameMapping$13);
|
1419
1435
|
|
1420
|
-
var _CNameMapping$
|
1436
|
+
var _CNameMapping$12;var DIR_NAME$12='Comscore';var NAME$12='COMSCORE';var DISPLAY_NAME$12='Comscore';_defineProperty({},DISPLAY_NAME$12,DIR_NAME$12);(_CNameMapping$12={},_defineProperty(_CNameMapping$12,NAME$12,NAME$12),_defineProperty(_CNameMapping$12,"Comscore",NAME$12),_defineProperty(_CNameMapping$12,'Com Score',NAME$12),_defineProperty(_CNameMapping$12,'com Score',NAME$12),_defineProperty(_CNameMapping$12,'com score',NAME$12),_defineProperty(_CNameMapping$12,'Com score',NAME$12),_CNameMapping$12);
|
1421
1437
|
|
1422
|
-
var _CNameMapping$
|
1438
|
+
var _CNameMapping$11;var DIR_NAME$11='Criteo';var NAME$11='CRITEO';var DISPLAY_NAME$11='Criteo';_defineProperty({},DISPLAY_NAME$11,DIR_NAME$11);(_CNameMapping$11={},_defineProperty(_CNameMapping$11,NAME$11,NAME$11),_defineProperty(_CNameMapping$11,"Criteo",NAME$11),_defineProperty(_CNameMapping$11,"criteo",NAME$11),_CNameMapping$11);
|
1423
1439
|
|
1424
|
-
var _CNameMapping$
|
1440
|
+
var _CNameMapping$10;var DIR_NAME$10='CustomerIO';var NAME$10='CUSTOMERIO';var DISPLAY_NAME$10='Customer IO';_defineProperty({},DISPLAY_NAME$10,DIR_NAME$10);(_CNameMapping$10={},_defineProperty(_CNameMapping$10,NAME$10,NAME$10),_defineProperty(_CNameMapping$10,"Customerio",NAME$10),_defineProperty(_CNameMapping$10,'Customer.io',NAME$10),_defineProperty(_CNameMapping$10,'CUSTOMER.IO',NAME$10),_defineProperty(_CNameMapping$10,'customer.io',NAME$10),_CNameMapping$10);
|
1425
1441
|
|
1426
|
-
var _CNameMapping
|
1442
|
+
var _CNameMapping$$;var DIR_NAME$$='Drip';var NAME$$='DRIP';var DISPLAY_NAME$$='Drip';_defineProperty({},DISPLAY_NAME$$,DIR_NAME$$);(_CNameMapping$$={},_defineProperty(_CNameMapping$$,NAME$$,NAME$$),_defineProperty(_CNameMapping$$,"Drip",NAME$$),_defineProperty(_CNameMapping$$,"drip",NAME$$),_CNameMapping$$);
|
1427
1443
|
|
1428
|
-
var _CNameMapping$
|
1444
|
+
var _CNameMapping$_;var DIR_NAME$_='FacebookPixel';var NAME$_='FACEBOOK_PIXEL';var DISPLAY_NAME$_='Facebook Pixel';_defineProperty({},DISPLAY_NAME$_,DIR_NAME$_);(_CNameMapping$_={},_defineProperty(_CNameMapping$_,NAME$_,NAME$_),_defineProperty(_CNameMapping$_,'FB Pixel',NAME$_),_defineProperty(_CNameMapping$_,'Facebook Pixel',NAME$_),_defineProperty(_CNameMapping$_,'facebook pixel',NAME$_),_defineProperty(_CNameMapping$_,"fbpixel",NAME$_),_defineProperty(_CNameMapping$_,"FBPIXEL",NAME$_),_defineProperty(_CNameMapping$_,"FB_PIXEL",NAME$_),_CNameMapping$_);
|
1429
1445
|
|
1430
|
-
var _CNameMapping$
|
1446
|
+
var _CNameMapping$Z;var DIR_NAME$Z='Fullstory';var NAME$Z='FULLSTORY';var DISPLAY_NAME$Z='Fullstory';_defineProperty({},DISPLAY_NAME$Z,DIR_NAME$Z);(_CNameMapping$Z={},_defineProperty(_CNameMapping$Z,NAME$Z,NAME$Z),_defineProperty(_CNameMapping$Z,"Fullstory",NAME$Z),_defineProperty(_CNameMapping$Z,"FullStory",NAME$Z),_defineProperty(_CNameMapping$Z,'full Story',NAME$Z),_defineProperty(_CNameMapping$Z,'Full Story',NAME$Z),_defineProperty(_CNameMapping$Z,'Full story',NAME$Z),_defineProperty(_CNameMapping$Z,'full story',NAME$Z),_defineProperty(_CNameMapping$Z,"fullstory",NAME$Z),_CNameMapping$Z);
|
1431
1447
|
|
1432
|
-
var _CNameMapping$
|
1448
|
+
var _CNameMapping$Y;var DIR_NAME$Y='GA';var NAME$Y='GA';var DISPLAY_NAME$Y='Google Analytics';_defineProperty({},DISPLAY_NAME$Y,DIR_NAME$Y);(_CNameMapping$Y={},_defineProperty(_CNameMapping$Y,NAME$Y,NAME$Y),_defineProperty(_CNameMapping$Y,'Google Analytics',NAME$Y),_defineProperty(_CNameMapping$Y,"GoogleAnalytics",NAME$Y),_defineProperty(_CNameMapping$Y,'GOOGLE ANALYTICS',NAME$Y),_defineProperty(_CNameMapping$Y,'google analytics',NAME$Y),_CNameMapping$Y);
|
1433
1449
|
|
1434
|
-
var _CNameMapping$
|
1450
|
+
var _CNameMapping$X;var DIR_NAME$X='GA4';var NAME$X='GA4';var DISPLAY_NAME$X='Google Analytics 4 (GA4)';_defineProperty({},DISPLAY_NAME$X,DIR_NAME$X);(_CNameMapping$X={},_defineProperty(_CNameMapping$X,NAME$X,NAME$X),_defineProperty(_CNameMapping$X,'Google Analytics 4',NAME$X),_defineProperty(_CNameMapping$X,'Google analytics 4',NAME$X),_defineProperty(_CNameMapping$X,'google analytics 4',NAME$X),_defineProperty(_CNameMapping$X,'Google Analytics4',NAME$X),_defineProperty(_CNameMapping$X,'Google analytics4',NAME$X),_defineProperty(_CNameMapping$X,'google analytics4',NAME$X),_defineProperty(_CNameMapping$X,'Google Analytics 4 (GA4)',NAME$X),_defineProperty(_CNameMapping$X,'google analytics 4 (ga4)',NAME$X),_defineProperty(_CNameMapping$X,"GoogleAnalytics4",NAME$X),_CNameMapping$X);
|
1435
1451
|
|
1436
|
-
var _CNameMapping$
|
1452
|
+
var _CNameMapping$W;var DIR_NAME$W='GoogleAds';var NAME$W='GOOGLEADS';var DISPLAY_NAME$W='Google Ads';_defineProperty({},DISPLAY_NAME$W,DIR_NAME$W);(_CNameMapping$W={},_defineProperty(_CNameMapping$W,NAME$W,NAME$W),_defineProperty(_CNameMapping$W,'Google Ads',NAME$W),_defineProperty(_CNameMapping$W,"GoogleAds",NAME$W),_defineProperty(_CNameMapping$W,'GOOGLE ADS',NAME$W),_defineProperty(_CNameMapping$W,'google ads',NAME$W),_defineProperty(_CNameMapping$W,"googleads",NAME$W),_CNameMapping$W);
|
1437
1453
|
|
1438
|
-
var _CNameMapping$
|
1454
|
+
var _CNameMapping$V;var DIR_NAME$V='GoogleOptimize';var NAME$V='GOOGLE_OPTIMIZE';var DISPLAY_NAME$V='Google Optimize';_defineProperty({},DISPLAY_NAME$V,DIR_NAME$V);(_CNameMapping$V={},_defineProperty(_CNameMapping$V,NAME$V,NAME$V),_defineProperty(_CNameMapping$V,'Google Optimize',NAME$V),_defineProperty(_CNameMapping$V,"GoogleOptimize",NAME$V),_defineProperty(_CNameMapping$V,"Googleoptimize",NAME$V),_defineProperty(_CNameMapping$V,"GOOGLEOPTIMIZE",NAME$V),_defineProperty(_CNameMapping$V,'google optimize',NAME$V),_defineProperty(_CNameMapping$V,'Google optimize',NAME$V),_defineProperty(_CNameMapping$V,'GOOGLE OPTIMIZE',NAME$V),_CNameMapping$V);
|
1439
1455
|
|
1440
|
-
var _CNameMapping$
|
1456
|
+
var _CNameMapping$U;var DIR_NAME$U='GoogleTagManager';var NAME$U='GTM';var DISPLAY_NAME$U='Google Tag Manager';_defineProperty({},DISPLAY_NAME$U,DIR_NAME$U);(_CNameMapping$U={},_defineProperty(_CNameMapping$U,NAME$U,NAME$U),_defineProperty(_CNameMapping$U,'Google Tag Manager',NAME$U),_defineProperty(_CNameMapping$U,'google tag manager',NAME$U),_defineProperty(_CNameMapping$U,'googletag manager',NAME$U),_defineProperty(_CNameMapping$U,"googletagmanager",NAME$U),_CNameMapping$U);
|
1441
1457
|
|
1442
|
-
var _CNameMapping$
|
1458
|
+
var _CNameMapping$T;var DIR_NAME$T='Heap';var NAME$T='HEAP';var DISPLAY_NAME$T='Heap.io';_defineProperty({},DISPLAY_NAME$T,DIR_NAME$T);(_CNameMapping$T={},_defineProperty(_CNameMapping$T,NAME$T,NAME$T),_defineProperty(_CNameMapping$T,"Heap",NAME$T),_defineProperty(_CNameMapping$T,"heap",NAME$T),_defineProperty(_CNameMapping$T,'Heap.io',NAME$T),_CNameMapping$T);
|
1443
1459
|
|
1444
|
-
var _CNameMapping$
|
1460
|
+
var _CNameMapping$S;var DIR_NAME$S='Hotjar';var NAME$S='HOTJAR';var DISPLAY_NAME$S='Hotjar';_defineProperty({},DISPLAY_NAME$S,DIR_NAME$S);(_CNameMapping$S={},_defineProperty(_CNameMapping$S,NAME$S,NAME$S),_defineProperty(_CNameMapping$S,"Hotjar",NAME$S),_defineProperty(_CNameMapping$S,"hotjar",NAME$S),_defineProperty(_CNameMapping$S,'Hot Jar',NAME$S),_defineProperty(_CNameMapping$S,'hot jar',NAME$S),_CNameMapping$S);
|
1445
1461
|
|
1446
|
-
var _CNameMapping$
|
1462
|
+
var _CNameMapping$R;var DIR_NAME$R='HubSpot';var NAME$R='HS';var DISPLAY_NAME$R='HubSpot';_defineProperty({},DISPLAY_NAME$R,DIR_NAME$R);(_CNameMapping$R={},_defineProperty(_CNameMapping$R,NAME$R,NAME$R),_defineProperty(_CNameMapping$R,"Hubspot",NAME$R),_defineProperty(_CNameMapping$R,"HUBSPOT",NAME$R),_defineProperty(_CNameMapping$R,'hub spot',NAME$R),_defineProperty(_CNameMapping$R,'Hub Spot',NAME$R),_defineProperty(_CNameMapping$R,'Hub spot',NAME$R),_CNameMapping$R);
|
1447
1463
|
|
1448
|
-
var _CNameMapping$
|
1464
|
+
var _CNameMapping$Q;var DIR_NAME$Q='INTERCOM';var NAME$Q='INTERCOM';var DISPLAY_NAME$Q='Intercom';_defineProperty({},DISPLAY_NAME$Q,DIR_NAME$Q);(_CNameMapping$Q={},_defineProperty(_CNameMapping$Q,NAME$Q,NAME$Q),_defineProperty(_CNameMapping$Q,"Intercom",NAME$Q),_defineProperty(_CNameMapping$Q,"intercom",NAME$Q),_CNameMapping$Q);
|
1449
1465
|
|
1450
|
-
var _CNameMapping$
|
1466
|
+
var _CNameMapping$P;var DIR_NAME$P='Keen';var NAME$P='KEEN';var DISPLAY_NAME$P='Keen';_defineProperty({},DISPLAY_NAME$P,DIR_NAME$P);(_CNameMapping$P={},_defineProperty(_CNameMapping$P,NAME$P,NAME$P),_defineProperty(_CNameMapping$P,"Keen",NAME$P),_defineProperty(_CNameMapping$P,'Keen.io',NAME$P),_defineProperty(_CNameMapping$P,"keen",NAME$P),_defineProperty(_CNameMapping$P,'keen.io',NAME$P),_CNameMapping$P);
|
1451
1467
|
|
1452
|
-
var _CNameMapping$
|
1468
|
+
var _CNameMapping$O;var DIR_NAME$O='Kissmetrics';var NAME$O='KISSMETRICS';var DISPLAY_NAME$O='Kiss Metrics';_defineProperty({},DISPLAY_NAME$O,DIR_NAME$O);(_CNameMapping$O={},_defineProperty(_CNameMapping$O,NAME$O,NAME$O),_defineProperty(_CNameMapping$O,"Kissmetrics",NAME$O),_defineProperty(_CNameMapping$O,"kissmetrics",NAME$O),_CNameMapping$O);
|
1453
1469
|
|
1454
|
-
var _CNameMapping$
|
1470
|
+
var _CNameMapping$N;var DIR_NAME$N='Klaviyo';var NAME$N='KLAVIYO';var DISPLAY_NAME$N='Klaviyo';_defineProperty({},DISPLAY_NAME$N,DIR_NAME$N);(_CNameMapping$N={},_defineProperty(_CNameMapping$N,NAME$N,NAME$N),_defineProperty(_CNameMapping$N,"Klaviyo",NAME$N),_defineProperty(_CNameMapping$N,"klaviyo",NAME$N),_CNameMapping$N);
|
1455
1471
|
|
1456
|
-
var _CNameMapping$
|
1472
|
+
var _CNameMapping$M;var DIR_NAME$M='LaunchDarkly';var NAME$M='LAUNCHDARKLY';var DISPLAY_NAME$M='LaunchDarkly';_defineProperty({},DISPLAY_NAME$M,DIR_NAME$M);(_CNameMapping$M={},_defineProperty(_CNameMapping$M,NAME$M,NAME$M),_defineProperty(_CNameMapping$M,"LaunchDarkly",NAME$M),_defineProperty(_CNameMapping$M,"Launch_Darkly",NAME$M),_defineProperty(_CNameMapping$M,'Launch Darkly',NAME$M),_defineProperty(_CNameMapping$M,"launchDarkly",NAME$M),_defineProperty(_CNameMapping$M,'launch darkly',NAME$M),_CNameMapping$M);
|
1457
1473
|
|
1458
|
-
var _CNameMapping$
|
1474
|
+
var _CNameMapping$L;var DIR_NAME$L='LinkedInInsightTag';var NAME$L='LINKEDIN_INSIGHT_TAG';var DISPLAY_NAME$L='Linkedin Insight Tag';_defineProperty({},DISPLAY_NAME$L,DIR_NAME$L);(_CNameMapping$L={},_defineProperty(_CNameMapping$L,NAME$L,NAME$L),_defineProperty(_CNameMapping$L,'LinkedIn Insight Tag',NAME$L),_defineProperty(_CNameMapping$L,'LinkedIn insight tag',NAME$L),_defineProperty(_CNameMapping$L,'linkedIn insight tag',NAME$L),_defineProperty(_CNameMapping$L,"Linkedin_insight_tag",NAME$L),_defineProperty(_CNameMapping$L,"LinkedinInsighttag",NAME$L),_defineProperty(_CNameMapping$L,"LinkedinInsightTag",NAME$L),_defineProperty(_CNameMapping$L,"LinkedInInsightTag",NAME$L),_defineProperty(_CNameMapping$L,"Linkedininsighttag",NAME$L),_defineProperty(_CNameMapping$L,"LINKEDININSIGHTTAG",NAME$L),_defineProperty(_CNameMapping$L,"linkedininsighttag",NAME$L),_CNameMapping$L);
|
1459
1475
|
|
1460
|
-
var _CNameMapping$
|
1476
|
+
var _CNameMapping$K;var DIR_NAME$K='Lotame';var NAME$K='LOTAME';var DISPLAY_NAME$K='Lotame';_defineProperty({},DISPLAY_NAME$K,DIR_NAME$K);(_CNameMapping$K={},_defineProperty(_CNameMapping$K,NAME$K,NAME$K),_defineProperty(_CNameMapping$K,"Lotame",NAME$K),_defineProperty(_CNameMapping$K,"lotame",NAME$K),_CNameMapping$K);
|
1461
1477
|
|
1462
|
-
var _CNameMapping$
|
1478
|
+
var _CNameMapping$J;var DIR_NAME$J='Lytics';var NAME$J='LYTICS';var DISPLAY_NAME$J='Lytics';_defineProperty({},DISPLAY_NAME$J,DIR_NAME$J);(_CNameMapping$J={},_defineProperty(_CNameMapping$J,NAME$J,NAME$J),_defineProperty(_CNameMapping$J,"Lytics",NAME$J),_defineProperty(_CNameMapping$J,"lytics",NAME$J),_CNameMapping$J);
|
1463
1479
|
|
1464
|
-
var _CNameMapping$
|
1480
|
+
var _CNameMapping$I;var DIR_NAME$I='Mixpanel';var NAME$I='MP';var DISPLAY_NAME$I='Mixpanel';_defineProperty({},DISPLAY_NAME$I,DIR_NAME$I);(_CNameMapping$I={},_defineProperty(_CNameMapping$I,NAME$I,NAME$I),_defineProperty(_CNameMapping$I,"MIXPANEL",NAME$I),_defineProperty(_CNameMapping$I,"Mixpanel",NAME$I),_defineProperty(_CNameMapping$I,'MIX PANEL',NAME$I),_defineProperty(_CNameMapping$I,'Mix panel',NAME$I),_defineProperty(_CNameMapping$I,'Mix Panel',NAME$I),_CNameMapping$I);
|
1465
1481
|
|
1466
|
-
var _CNameMapping$
|
1482
|
+
var _CNameMapping$H;var DIR_NAME$H='MoEngage';var NAME$H='MOENGAGE';var DISPLAY_NAME$H='MoEngage';_defineProperty({},DISPLAY_NAME$H,DIR_NAME$H);(_CNameMapping$H={},_defineProperty(_CNameMapping$H,NAME$H,NAME$H),_defineProperty(_CNameMapping$H,"MoEngage",NAME$H),_defineProperty(_CNameMapping$H,"moengage",NAME$H),_defineProperty(_CNameMapping$H,"Moengage",NAME$H),_defineProperty(_CNameMapping$H,'Mo Engage',NAME$H),_defineProperty(_CNameMapping$H,'mo engage',NAME$H),_defineProperty(_CNameMapping$H,'Mo engage',NAME$H),_CNameMapping$H);
|
1467
1483
|
|
1468
|
-
var _CNameMapping$
|
1484
|
+
var _CNameMapping$G;var DIR_NAME$G='Optimizely';var NAME$G='OPTIMIZELY';var DISPLAY_NAME$G='Optimizely Web';_defineProperty({},DISPLAY_NAME$G,DIR_NAME$G);(_CNameMapping$G={},_defineProperty(_CNameMapping$G,NAME$G,NAME$G),_defineProperty(_CNameMapping$G,"Optimizely",NAME$G),_defineProperty(_CNameMapping$G,"optimizely",NAME$G),_CNameMapping$G);
|
1469
1485
|
|
1470
|
-
var _CNameMapping$
|
1486
|
+
var _CNameMapping$F;var DIR_NAME$F='Pendo';var NAME$F='PENDO';var DISPLAY_NAME$F='Pendo';_defineProperty({},DISPLAY_NAME$F,DIR_NAME$F);(_CNameMapping$F={},_defineProperty(_CNameMapping$F,NAME$F,NAME$F),_defineProperty(_CNameMapping$F,"Pendo",NAME$F),_defineProperty(_CNameMapping$F,"pendo",NAME$F),_CNameMapping$F);
|
1471
1487
|
|
1472
|
-
var _CNameMapping$
|
1488
|
+
var _CNameMapping$E;var DIR_NAME$E='PinterestTag';var NAME$E='PINTEREST_TAG';var DISPLAY_NAME$E='Pinterest Tag';_defineProperty({},DISPLAY_NAME$E,DIR_NAME$E);(_CNameMapping$E={},_defineProperty(_CNameMapping$E,NAME$E,NAME$E),_defineProperty(_CNameMapping$E,"PinterestTag",NAME$E),_defineProperty(_CNameMapping$E,"Pinterest_Tag",NAME$E),_defineProperty(_CNameMapping$E,"PINTERESTTAG",NAME$E),_defineProperty(_CNameMapping$E,"pinterest",NAME$E),_defineProperty(_CNameMapping$E,"PinterestAds",NAME$E),_defineProperty(_CNameMapping$E,"Pinterest_Ads",NAME$E),_defineProperty(_CNameMapping$E,"Pinterest",NAME$E),_defineProperty(_CNameMapping$E,'Pinterest Tag',NAME$E),_defineProperty(_CNameMapping$E,'Pinterest tag',NAME$E),_defineProperty(_CNameMapping$E,'PINTEREST TAG',NAME$E),_defineProperty(_CNameMapping$E,'pinterest tag',NAME$E),_defineProperty(_CNameMapping$E,'Pinterest Ads',NAME$E),_defineProperty(_CNameMapping$E,'Pinterest ads',NAME$E),_CNameMapping$E);
|
1473
1489
|
|
1474
|
-
var _CNameMapping$
|
1490
|
+
var _CNameMapping$D;var DIR_NAME$D='PostAffiliatePro';var NAME$D='POST_AFFILIATE_PRO';var DISPLAY_NAME$D='Post Affiliate Pro';_defineProperty({},DISPLAY_NAME$D,DIR_NAME$D);(_CNameMapping$D={},_defineProperty(_CNameMapping$D,NAME$D,NAME$D),_defineProperty(_CNameMapping$D,"PostAffiliatePro",NAME$D),_defineProperty(_CNameMapping$D,"Post_affiliate_pro",NAME$D),_defineProperty(_CNameMapping$D,'Post Affiliate Pro',NAME$D),_defineProperty(_CNameMapping$D,'Post affiliate pro',NAME$D),_defineProperty(_CNameMapping$D,'post affiliate pro',NAME$D),_defineProperty(_CNameMapping$D,"postaffiliatepro",NAME$D),_defineProperty(_CNameMapping$D,"POSTAFFILIATEPRO",NAME$D),_CNameMapping$D);
|
1475
1491
|
|
1476
|
-
var _CNameMapping$
|
1492
|
+
var _CNameMapping$C;var DIR_NAME$C='Posthog';var NAME$C='POSTHOG';var DISPLAY_NAME$C='PostHog';_defineProperty({},DISPLAY_NAME$C,DIR_NAME$C);(_CNameMapping$C={},_defineProperty(_CNameMapping$C,NAME$C,NAME$C),_defineProperty(_CNameMapping$C,"PostHog",NAME$C),_defineProperty(_CNameMapping$C,"Posthog",NAME$C),_defineProperty(_CNameMapping$C,"posthog",NAME$C),_defineProperty(_CNameMapping$C,'Post Hog',NAME$C),_defineProperty(_CNameMapping$C,'Post hog',NAME$C),_defineProperty(_CNameMapping$C,'post hog',NAME$C),_CNameMapping$C);
|
1477
1493
|
|
1478
|
-
var _CNameMapping$
|
1494
|
+
var _CNameMapping$B;var DIR_NAME$B='ProfitWell';var NAME$B='PROFITWELL';var DISPLAY_NAME$B='ProfitWell';_defineProperty({},DISPLAY_NAME$B,DIR_NAME$B);(_CNameMapping$B={},_defineProperty(_CNameMapping$B,NAME$B,NAME$B),_defineProperty(_CNameMapping$B,"ProfitWell",NAME$B),_defineProperty(_CNameMapping$B,"profitwell",NAME$B),_defineProperty(_CNameMapping$B,"Profitwell",NAME$B),_defineProperty(_CNameMapping$B,'Profit Well',NAME$B),_defineProperty(_CNameMapping$B,'profit well',NAME$B),_defineProperty(_CNameMapping$B,'Profit well',NAME$B),_CNameMapping$B);
|
1479
1495
|
|
1480
|
-
var _CNameMapping$
|
1496
|
+
var _CNameMapping$A;var DIR_NAME$A='Qualtrics';var NAME$A='QUALTRICS';var DISPLAY_NAME$A='Qualtrics';_defineProperty({},DISPLAY_NAME$A,DIR_NAME$A);(_CNameMapping$A={},_defineProperty(_CNameMapping$A,NAME$A,NAME$A),_defineProperty(_CNameMapping$A,"Qualtrics",NAME$A),_defineProperty(_CNameMapping$A,"qualtrics",NAME$A),_CNameMapping$A);
|
1481
1497
|
|
1482
|
-
var _CNameMapping$
|
1498
|
+
var _CNameMapping$z;var DIR_NAME$z='QuantumMetric';var NAME$z='QUANTUMMETRIC';var DISPLAY_NAME$z='Quantum Metric';_defineProperty({},DISPLAY_NAME$z,DIR_NAME$z);(_CNameMapping$z={},_defineProperty(_CNameMapping$z,NAME$z,NAME$z),_defineProperty(_CNameMapping$z,'Quantum Metric',NAME$z),_defineProperty(_CNameMapping$z,'quantum Metric',NAME$z),_defineProperty(_CNameMapping$z,'quantum metric',NAME$z),_defineProperty(_CNameMapping$z,"QuantumMetric",NAME$z),_defineProperty(_CNameMapping$z,"quantumMetric",NAME$z),_defineProperty(_CNameMapping$z,"quantummetric",NAME$z),_defineProperty(_CNameMapping$z,"Quantum_Metric",NAME$z),_CNameMapping$z);
|
1483
1499
|
|
1484
|
-
var _CNameMapping$
|
1500
|
+
var _CNameMapping$y;var DIR_NAME$y='RedditPixel';var NAME$y='REDDIT_PIXEL';var DISPLAY_NAME$y='Reddit Pixel';_defineProperty({},DISPLAY_NAME$y,DIR_NAME$y);(_CNameMapping$y={},_defineProperty(_CNameMapping$y,NAME$y,NAME$y),_defineProperty(_CNameMapping$y,"Reddit_Pixel",NAME$y),_defineProperty(_CNameMapping$y,"RedditPixel",NAME$y),_defineProperty(_CNameMapping$y,"REDDITPIXEL",NAME$y),_defineProperty(_CNameMapping$y,"redditpixel",NAME$y),_defineProperty(_CNameMapping$y,'Reddit Pixel',NAME$y),_defineProperty(_CNameMapping$y,'REDDIT PIXEL',NAME$y),_defineProperty(_CNameMapping$y,'reddit pixel',NAME$y),_CNameMapping$y);
|
1485
1501
|
|
1486
|
-
var _CNameMapping$
|
1502
|
+
var _CNameMapping$x;var DIR_NAME$x='Sentry';var NAME$x='SENTRY';var DISPLAY_NAME$x='Sentry';_defineProperty({},DISPLAY_NAME$x,DIR_NAME$x);(_CNameMapping$x={},_defineProperty(_CNameMapping$x,NAME$x,NAME$x),_defineProperty(_CNameMapping$x,"sentry",NAME$x),_defineProperty(_CNameMapping$x,"Sentry",NAME$x),_CNameMapping$x);
|
1487
1503
|
|
1488
|
-
var _CNameMapping$
|
1504
|
+
var _CNameMapping$w;var DIR_NAME$w='SnapPixel';var NAME$w='SNAP_PIXEL';var DISPLAY_NAME$w='Snap Pixel';_defineProperty({},DISPLAY_NAME$w,DIR_NAME$w);(_CNameMapping$w={},_defineProperty(_CNameMapping$w,NAME$w,NAME$w),_defineProperty(_CNameMapping$w,"Snap_Pixel",NAME$w),_defineProperty(_CNameMapping$w,"SnapPixel",NAME$w),_defineProperty(_CNameMapping$w,"SNAPPIXEL",NAME$w),_defineProperty(_CNameMapping$w,"snappixel",NAME$w),_defineProperty(_CNameMapping$w,'Snap Pixel',NAME$w),_defineProperty(_CNameMapping$w,'SNAP PIXEL',NAME$w),_defineProperty(_CNameMapping$w,'snap pixel',NAME$w),_CNameMapping$w);
|
1489
1505
|
|
1490
|
-
var _CNameMapping$
|
1506
|
+
var _CNameMapping$v;var DIR_NAME$v='TVSquared';var NAME$v='TVSQUARED';var DISPLAY_NAME$v='TVSquared';_defineProperty({},DISPLAY_NAME$v,DIR_NAME$v);(_CNameMapping$v={},_defineProperty(_CNameMapping$v,NAME$v,NAME$v),_defineProperty(_CNameMapping$v,"TVSquared",NAME$v),_defineProperty(_CNameMapping$v,"tvsquared",NAME$v),_defineProperty(_CNameMapping$v,"tvSquared",NAME$v),_defineProperty(_CNameMapping$v,"TvSquared",NAME$v),_defineProperty(_CNameMapping$v,"Tvsquared",NAME$v),_defineProperty(_CNameMapping$v,'TV Squared',NAME$v),_defineProperty(_CNameMapping$v,'tv squared',NAME$v),_defineProperty(_CNameMapping$v,'tv Squared',NAME$v),_CNameMapping$v);
|
1491
1507
|
|
1492
|
-
var _CNameMapping$
|
1508
|
+
var _CNameMapping$u;var DIR_NAME$u='VWO';var NAME$u='VWO';var DISPLAY_NAME$u='VWO';_defineProperty({},DISPLAY_NAME$u,DIR_NAME$u);(_CNameMapping$u={},_defineProperty(_CNameMapping$u,NAME$u,NAME$u),_defineProperty(_CNameMapping$u,"VisualWebsiteOptimizer",NAME$u),_defineProperty(_CNameMapping$u,"Visualwebsiteoptimizer",NAME$u),_defineProperty(_CNameMapping$u,"visualwebsiteoptimizer",NAME$u),_defineProperty(_CNameMapping$u,"vwo",NAME$u),_defineProperty(_CNameMapping$u,'Visual Website Optimizer',NAME$u),_defineProperty(_CNameMapping$u,'Visual website optimizer',NAME$u),_defineProperty(_CNameMapping$u,'visual website optimizer',NAME$u),_CNameMapping$u);
|
1493
1509
|
|
1494
|
-
var _CNameMapping$
|
1510
|
+
var _CNameMapping$t;var DIR_NAME$t='GA360';var NAME$t='GA360';var DISPLAY_NAME$t='Google Analytics 360';_defineProperty({},DISPLAY_NAME$t,DIR_NAME$t);(_CNameMapping$t={},_defineProperty(_CNameMapping$t,NAME$t,NAME$t),_defineProperty(_CNameMapping$t,'Google Analytics 360',NAME$t),_defineProperty(_CNameMapping$t,'Google analytics 360',NAME$t),_defineProperty(_CNameMapping$t,'google analytics 360',NAME$t),_defineProperty(_CNameMapping$t,'Google Analytics360',NAME$t),_defineProperty(_CNameMapping$t,'Google analytics360',NAME$t),_defineProperty(_CNameMapping$t,'google analytics360',NAME$t),_defineProperty(_CNameMapping$t,"GoogleAnalytics360",NAME$t),_defineProperty(_CNameMapping$t,'GA 360',NAME$t),_CNameMapping$t);
|
1495
1511
|
|
1496
|
-
var _CNameMapping$
|
1512
|
+
var _CNameMapping$s;var DIR_NAME$s='Adroll';var NAME$s='ADROLL';var DISPLAY_NAME$s='Adroll';_defineProperty({},DISPLAY_NAME$s,DIR_NAME$s);(_CNameMapping$s={},_defineProperty(_CNameMapping$s,NAME$s,NAME$s),_defineProperty(_CNameMapping$s,"Adroll",NAME$s),_defineProperty(_CNameMapping$s,'Ad roll',NAME$s),_defineProperty(_CNameMapping$s,'ad roll',NAME$s),_defineProperty(_CNameMapping$s,"adroll",NAME$s),_CNameMapping$s);
|
1497
1513
|
|
1498
|
-
var _CNameMapping$
|
1514
|
+
var _CNameMapping$r;var DIR_NAME$r='DCMFloodlight';var NAME$r='DCM_FLOODLIGHT';var DISPLAY_NAME$r='DCM Floodlight';_defineProperty({},DISPLAY_NAME$r,DIR_NAME$r);(_CNameMapping$r={},_defineProperty(_CNameMapping$r,NAME$r,NAME$r),_defineProperty(_CNameMapping$r,'DCM Floodlight',NAME$r),_defineProperty(_CNameMapping$r,'dcm floodlight',NAME$r),_defineProperty(_CNameMapping$r,'Dcm Floodlight',NAME$r),_defineProperty(_CNameMapping$r,"DCMFloodlight",NAME$r),_defineProperty(_CNameMapping$r,"dcmfloodlight",NAME$r),_defineProperty(_CNameMapping$r,"DcmFloodlight",NAME$r),_defineProperty(_CNameMapping$r,"dcm_floodlight",NAME$r),_defineProperty(_CNameMapping$r,"DCM_Floodlight",NAME$r),_CNameMapping$r);
|
1499
1515
|
|
1500
|
-
var _CNameMapping$
|
1516
|
+
var _CNameMapping$q;var DIR_NAME$q='Matomo';var NAME$q='MATOMO';var DISPLAY_NAME$q='Matomo';_defineProperty({},DISPLAY_NAME$q,DIR_NAME$q);(_CNameMapping$q={},_defineProperty(_CNameMapping$q,NAME$q,NAME$q),_defineProperty(_CNameMapping$q,"Matomo",NAME$q),_defineProperty(_CNameMapping$q,"matomo",NAME$q),_CNameMapping$q);
|
1501
1517
|
|
1502
|
-
var _CNameMapping$
|
1518
|
+
var _CNameMapping$p;var DIR_NAME$p='Vero';var NAME$p='VERO';var DISPLAY_NAME$p='Vero';_defineProperty({},DISPLAY_NAME$p,DIR_NAME$p);(_CNameMapping$p={},_defineProperty(_CNameMapping$p,NAME$p,NAME$p),_defineProperty(_CNameMapping$p,"Vero",NAME$p),_defineProperty(_CNameMapping$p,"vero",NAME$p),_CNameMapping$p);
|
1503
1519
|
|
1504
|
-
var _CNameMapping$
|
1520
|
+
var _CNameMapping$o;var DIR_NAME$o='Mouseflow';var NAME$o='MOUSEFLOW';var DISPLAY_NAME$o='Mouseflow';_defineProperty({},DISPLAY_NAME$o,DIR_NAME$o);(_CNameMapping$o={},_defineProperty(_CNameMapping$o,NAME$o,NAME$o),_defineProperty(_CNameMapping$o,"Mouseflow",NAME$o),_defineProperty(_CNameMapping$o,"mouseflow",NAME$o),_defineProperty(_CNameMapping$o,"mouseFlow",NAME$o),_defineProperty(_CNameMapping$o,"MouseFlow",NAME$o),_defineProperty(_CNameMapping$o,'Mouse flow',NAME$o),_defineProperty(_CNameMapping$o,'mouse flow',NAME$o),_defineProperty(_CNameMapping$o,'mouse Flow',NAME$o),_defineProperty(_CNameMapping$o,'Mouse Flow',NAME$o),_CNameMapping$o);
|
1505
1521
|
|
1506
|
-
var _CNameMapping$
|
1522
|
+
var _CNameMapping$n;var DIR_NAME$n='Rockerbox';var NAME$n='ROCKERBOX';var DISPLAY_NAME$n='Rockerbox';_defineProperty({},DISPLAY_NAME$n,DIR_NAME$n);(_CNameMapping$n={},_defineProperty(_CNameMapping$n,NAME$n,NAME$n),_defineProperty(_CNameMapping$n,"Rockerbox",NAME$n),_defineProperty(_CNameMapping$n,"rockerbox",NAME$n),_defineProperty(_CNameMapping$n,"RockerBox",NAME$n),_defineProperty(_CNameMapping$n,'Rocker box',NAME$n),_defineProperty(_CNameMapping$n,'rocker box',NAME$n),_defineProperty(_CNameMapping$n,'Rocker Box',NAME$n),_CNameMapping$n);
|
1507
1523
|
|
1508
|
-
var _CNameMapping$
|
1524
|
+
var _CNameMapping$m;var DIR_NAME$m='ConvertFlow';var NAME$m='CONVERTFLOW';var DISPLAY_NAME$m='ConvertFlow';_defineProperty({},DISPLAY_NAME$m,DIR_NAME$m);(_CNameMapping$m={},_defineProperty(_CNameMapping$m,NAME$m,NAME$m),_defineProperty(_CNameMapping$m,"Convertflow",NAME$m),_defineProperty(_CNameMapping$m,"convertflow",NAME$m),_defineProperty(_CNameMapping$m,"convertFlow",NAME$m),_defineProperty(_CNameMapping$m,"ConvertFlow",NAME$m),_defineProperty(_CNameMapping$m,'Convert flow',NAME$m),_defineProperty(_CNameMapping$m,'convert flow',NAME$m),_defineProperty(_CNameMapping$m,'convert Flow',NAME$m),_defineProperty(_CNameMapping$m,'Convert Flow',NAME$m),_defineProperty(_CNameMapping$m,'CONVERT FLOW',NAME$m),_CNameMapping$m);
|
1509
1525
|
|
1510
|
-
var _CNameMapping$
|
1526
|
+
var _CNameMapping$l;var DIR_NAME$l='SnapEngage';var NAME$l='SNAPENGAGE';var DISPLAY_NAME$l='SnapEngage';_defineProperty({},DISPLAY_NAME$l,DIR_NAME$l);(_CNameMapping$l={},_defineProperty(_CNameMapping$l,NAME$l,NAME$l),_defineProperty(_CNameMapping$l,"SnapEngage",NAME$l),_defineProperty(_CNameMapping$l,"Snap_Engage",NAME$l),_defineProperty(_CNameMapping$l,"snapengage",NAME$l),_defineProperty(_CNameMapping$l,'SNAP ENGAGE',NAME$l),_defineProperty(_CNameMapping$l,'Snap Engage',NAME$l),_defineProperty(_CNameMapping$l,'snap engage',NAME$l),_CNameMapping$l);
|
1511
1527
|
|
1512
|
-
var _CNameMapping$
|
1528
|
+
var _CNameMapping$k;var DIR_NAME$k='LiveChat';var NAME$k='LIVECHAT';var DISPLAY_NAME$k='LiveChat';_defineProperty({},DISPLAY_NAME$k,DIR_NAME$k);(_CNameMapping$k={},_defineProperty(_CNameMapping$k,NAME$k,NAME$k),_defineProperty(_CNameMapping$k,"LiveChat",NAME$k),_defineProperty(_CNameMapping$k,"Live_Chat",NAME$k),_defineProperty(_CNameMapping$k,"livechat",NAME$k),_defineProperty(_CNameMapping$k,'LIVE CHAT',NAME$k),_defineProperty(_CNameMapping$k,'Live Chat',NAME$k),_defineProperty(_CNameMapping$k,'live chat',NAME$k),_CNameMapping$k);
|
1513
1529
|
|
1514
|
-
var _CNameMapping$
|
1530
|
+
var _CNameMapping$j;var DIR_NAME$j='Shynet';var NAME$j='SHYNET';var DISPLAY_NAME$j='Shynet';_defineProperty({},DISPLAY_NAME$j,DIR_NAME$j);(_CNameMapping$j={},_defineProperty(_CNameMapping$j,NAME$j,NAME$j),_defineProperty(_CNameMapping$j,"shynet",NAME$j),_defineProperty(_CNameMapping$j,"ShyNet",NAME$j),_defineProperty(_CNameMapping$j,"shyNet",NAME$j),_defineProperty(_CNameMapping$j,"Shynet",NAME$j),_defineProperty(_CNameMapping$j,'shy net',NAME$j),_defineProperty(_CNameMapping$j,'Shy Net',NAME$j),_defineProperty(_CNameMapping$j,'shy Net',NAME$j),_defineProperty(_CNameMapping$j,'Shy net',NAME$j),_CNameMapping$j);
|
1515
1531
|
|
1516
|
-
var _CNameMapping$
|
1532
|
+
var _CNameMapping$i;var DIR_NAME$i='Woopra';var NAME$i='WOOPRA';var DISPLAY_NAME$i='Woopra';_defineProperty({},DISPLAY_NAME$i,DIR_NAME$i);(_CNameMapping$i={},_defineProperty(_CNameMapping$i,NAME$i,NAME$i),_defineProperty(_CNameMapping$i,"Woopra",NAME$i),_defineProperty(_CNameMapping$i,"woopra",NAME$i),_CNameMapping$i);
|
1517
1533
|
|
1518
|
-
var _CNameMapping$
|
1534
|
+
var _CNameMapping$h;var DIR_NAME$h='RollBar';var NAME$h='ROLLBAR';var DISPLAY_NAME$h='RollBar';_defineProperty({},DISPLAY_NAME$h,DIR_NAME$h);(_CNameMapping$h={},_defineProperty(_CNameMapping$h,NAME$h,NAME$h),_defineProperty(_CNameMapping$h,"RollBar",NAME$h),_defineProperty(_CNameMapping$h,"Roll_Bar",NAME$h),_defineProperty(_CNameMapping$h,"rollbar",NAME$h),_defineProperty(_CNameMapping$h,"Rollbar",NAME$h),_defineProperty(_CNameMapping$h,'ROLL BAR',NAME$h),_defineProperty(_CNameMapping$h,'Roll Bar',NAME$h),_defineProperty(_CNameMapping$h,'roll bar',NAME$h),_CNameMapping$h);
|
1519
1535
|
|
1520
|
-
var _CNameMapping$
|
1536
|
+
var _CNameMapping$g;var DIR_NAME$g='QuoraPixel';var NAME$g='QUORA_PIXEL';var DISPLAY_NAME$g='Quora Pixel';_defineProperty({},DISPLAY_NAME$g,DIR_NAME$g);(_CNameMapping$g={},_defineProperty(_CNameMapping$g,NAME$g,NAME$g),_defineProperty(_CNameMapping$g,'Quora Pixel',NAME$g),_defineProperty(_CNameMapping$g,'Quora pixel',NAME$g),_defineProperty(_CNameMapping$g,'QUORA PIXEL',NAME$g),_defineProperty(_CNameMapping$g,"QuoraPixel",NAME$g),_defineProperty(_CNameMapping$g,"Quorapixel",NAME$g),_defineProperty(_CNameMapping$g,"QUORAPIXEL",NAME$g),_defineProperty(_CNameMapping$g,"Quora_Pixel",NAME$g),_defineProperty(_CNameMapping$g,"quora_pixel",NAME$g),_defineProperty(_CNameMapping$g,"Quora",NAME$g),_CNameMapping$g);
|
1521
1537
|
|
1522
|
-
var _CNameMapping$
|
1538
|
+
var _CNameMapping$f;var DIR_NAME$f='June';var NAME$f='JUNE';var DISPLAY_NAME$f='June';_defineProperty({},DISPLAY_NAME$f,DIR_NAME$f);(_CNameMapping$f={},_defineProperty(_CNameMapping$f,NAME$f,NAME$f),_defineProperty(_CNameMapping$f,"June",NAME$f),_defineProperty(_CNameMapping$f,"june",NAME$f),_CNameMapping$f);
|
1523
1539
|
|
1524
|
-
var _CNameMapping$
|
1540
|
+
var _CNameMapping$e;var DIR_NAME$e='Engage';var NAME$e='ENGAGE';var DISPLAY_NAME$e='Engage';_defineProperty({},DISPLAY_NAME$e,DIR_NAME$e);(_CNameMapping$e={},_defineProperty(_CNameMapping$e,NAME$e,NAME$e),_defineProperty(_CNameMapping$e,"Engage",NAME$e),_defineProperty(_CNameMapping$e,"engage",NAME$e),_CNameMapping$e);
|
1525
1541
|
|
1526
|
-
var _CNameMapping$
|
1542
|
+
var _CNameMapping$d;var DIR_NAME$d='Iterable';var NAME$d='ITERABLE';var DISPLAY_NAME$d='Iterable';_defineProperty({},DISPLAY_NAME$d,DIR_NAME$d);(_CNameMapping$d={},_defineProperty(_CNameMapping$d,NAME$d,NAME$d),_defineProperty(_CNameMapping$d,"Iterable",NAME$d),_defineProperty(_CNameMapping$d,"iterable",NAME$d),_CNameMapping$d);
|
1527
1543
|
|
1528
|
-
var _CNameMapping$
|
1544
|
+
var _CNameMapping$c;var DIR_NAME$c='YandexMetrica';var NAME$c='YANDEX_METRICA';var DISPLAY_NAME$c='Yandex.Metrica';_defineProperty({},DISPLAY_NAME$c,DIR_NAME$c);(_CNameMapping$c={},_defineProperty(_CNameMapping$c,NAME$c,NAME$c),_defineProperty(_CNameMapping$c,"Yandexmetrica",NAME$c),_defineProperty(_CNameMapping$c,"yandexmetrica",NAME$c),_defineProperty(_CNameMapping$c,"yandexMetrica",NAME$c),_defineProperty(_CNameMapping$c,"YandexMetrica",NAME$c),_CNameMapping$c);
|
1529
1545
|
|
1530
|
-
var _CNameMapping$
|
1546
|
+
var _CNameMapping$b;var DIR_NAME$b='Refiner';var NAME$b='REFINER';var DISPLAY_NAME$b='Refiner';_defineProperty({},DISPLAY_NAME$b,DIR_NAME$b);(_CNameMapping$b={},_defineProperty(_CNameMapping$b,NAME$b,NAME$b),_defineProperty(_CNameMapping$b,"Refiner",NAME$b),_defineProperty(_CNameMapping$b,"refiner",NAME$b),_CNameMapping$b);
|
1531
1547
|
|
1532
|
-
var _CNameMapping$
|
1548
|
+
var _CNameMapping$a;var DIR_NAME$a='Qualaroo';var NAME$a='QUALAROO';var DISPLAY_NAME$a='Qualaroo';_defineProperty({},DISPLAY_NAME$a,DIR_NAME$a);(_CNameMapping$a={},_defineProperty(_CNameMapping$a,NAME$a,NAME$a),_defineProperty(_CNameMapping$a,"Qualaroo",NAME$a),_defineProperty(_CNameMapping$a,"qualaroo",NAME$a),_CNameMapping$a);
|
1533
1549
|
|
1534
|
-
var _CNameMapping$
|
1550
|
+
var _CNameMapping$9;var DIR_NAME$9='Podsights';var NAME$9='PODSIGHTS';var DISPLAY_NAME$9='Podsights';_defineProperty({},DISPLAY_NAME$9,DIR_NAME$9);(_CNameMapping$9={},_defineProperty(_CNameMapping$9,NAME$9,NAME$9),_defineProperty(_CNameMapping$9,"Podsights",NAME$9),_defineProperty(_CNameMapping$9,"PodSights",NAME$9),_defineProperty(_CNameMapping$9,'pod Sights',NAME$9),_defineProperty(_CNameMapping$9,'Pod Sights',NAME$9),_defineProperty(_CNameMapping$9,'pod sights',NAME$9),_defineProperty(_CNameMapping$9,'POD SIGHTS',NAME$9),_defineProperty(_CNameMapping$9,'Pod sights',NAME$9),_CNameMapping$9);// default mapping for the events
|
1535
1551
|
|
1536
|
-
var _CNameMapping$
|
1552
|
+
var _CNameMapping$8;var DIR_NAME$8='Axeptio';var NAME$8='AXEPTIO';var DISPLAY_NAME$8='Axeptio';_defineProperty({},DISPLAY_NAME$8,DIR_NAME$8);(_CNameMapping$8={},_defineProperty(_CNameMapping$8,NAME$8,NAME$8),_defineProperty(_CNameMapping$8,"Axeptio",NAME$8),_defineProperty(_CNameMapping$8,"axeptio",NAME$8),_CNameMapping$8);
|
1537
1553
|
|
1538
|
-
var _CNameMapping$
|
1554
|
+
var _CNameMapping$7;var DIR_NAME$7='Satismeter';var NAME$7='SATISMETER';var DISPLAY_NAME$7='Satismeter';_defineProperty({},DISPLAY_NAME$7,DIR_NAME$7);(_CNameMapping$7={},_defineProperty(_CNameMapping$7,NAME$7,NAME$7),_defineProperty(_CNameMapping$7,"Satismeter",NAME$7),_defineProperty(_CNameMapping$7,"SatisMeter",NAME$7),_CNameMapping$7);
|
1539
1555
|
|
1540
|
-
var _CNameMapping$
|
1556
|
+
var _CNameMapping$6;var DIR_NAME$6='MicrosoftClarity';var NAME$6='MICROSOFT_CLARITY';var DISPLAY_NAME$6='Microsoft Clarity';_defineProperty({},DISPLAY_NAME$6,DIR_NAME$6);(_CNameMapping$6={},_defineProperty(_CNameMapping$6,NAME$6,NAME$6),_defineProperty(_CNameMapping$6,'Microsoft Clarity',NAME$6),_defineProperty(_CNameMapping$6,'Microsoft clarity',NAME$6),_defineProperty(_CNameMapping$6,'microsoft clarity',NAME$6),_defineProperty(_CNameMapping$6,"Microsoft_clarity",NAME$6),_defineProperty(_CNameMapping$6,"MicrosoftClarity",NAME$6),_defineProperty(_CNameMapping$6,"MICROSOFTCLARITY",NAME$6),_defineProperty(_CNameMapping$6,"microsoftclarity",NAME$6),_defineProperty(_CNameMapping$6,"microsoftClarity",NAME$6),_CNameMapping$6);
|
1541
1557
|
|
1542
|
-
var _CNameMapping$
|
1558
|
+
var _CNameMapping$5;var DIR_NAME$5='Sendinblue';var NAME$5='SENDINBLUE';var DISPLAY_NAME$5='Sendinblue';_defineProperty({},DISPLAY_NAME$5,DIR_NAME$5);(_CNameMapping$5={},_defineProperty(_CNameMapping$5,NAME$5,NAME$5),_defineProperty(_CNameMapping$5,"Sendinblue",NAME$5),_defineProperty(_CNameMapping$5,"sendinblue",NAME$5),_defineProperty(_CNameMapping$5,"SendinBlue",NAME$5),_CNameMapping$5);
|
1543
1559
|
|
1544
|
-
var _CNameMapping;var DIR_NAME='
|
1560
|
+
var _CNameMapping$4;var DIR_NAME$4='Olark';var NAME$4='OLARK';var DISPLAY_NAME$4='Olark';_defineProperty({},DISPLAY_NAME$4,DIR_NAME$4);(_CNameMapping$4={},_defineProperty(_CNameMapping$4,NAME$4,NAME$4),_defineProperty(_CNameMapping$4,"Olark",NAME$4),_defineProperty(_CNameMapping$4,"olark",NAME$4),_CNameMapping$4);
|
1561
|
+
|
1562
|
+
var _CNameMapping$3;var DIR_NAME$3='Lemnisk';var NAME$3='LEMNISK';var DISPLAY_NAME$3='Lemnisk';_defineProperty({},DISPLAY_NAME$3,DIR_NAME$3);(_CNameMapping$3={},_defineProperty(_CNameMapping$3,NAME$3,NAME$3),_defineProperty(_CNameMapping$3,"LEMNISK_MARKETING_AUTOMATION",NAME$3),_defineProperty(_CNameMapping$3,'Lemnisk Marketing Automation',NAME$3),_defineProperty(_CNameMapping$3,"LemniskMarketingAutomation",NAME$3),_defineProperty(_CNameMapping$3,"lemniskmarketingautomation",NAME$3),_defineProperty(_CNameMapping$3,"lemniskMarketingAutomation",NAME$3),_defineProperty(_CNameMapping$3,"lemnisk",NAME$3),_defineProperty(_CNameMapping$3,"Lemnisk",NAME$3),_CNameMapping$3);
|
1563
|
+
|
1564
|
+
var _CNameMapping$2;var DIR_NAME$2='TiktokAds';var NAME$2='TIKTOK_ADS';var DISPLAY_NAME$2='TikTok Ads';_defineProperty({},DISPLAY_NAME$2,DIR_NAME$2);(_CNameMapping$2={},_defineProperty(_CNameMapping$2,NAME$2,NAME$2),_defineProperty(_CNameMapping$2,"TiktokAds",NAME$2),_defineProperty(_CNameMapping$2,'Tiktok ads',NAME$2),_defineProperty(_CNameMapping$2,'Tiktok Ads',NAME$2),_defineProperty(_CNameMapping$2,'Tik Tok Ads',NAME$2),_defineProperty(_CNameMapping$2,'tik tok ads',NAME$2),_defineProperty(_CNameMapping$2,"tiktokads",NAME$2),_CNameMapping$2);
|
1565
|
+
|
1566
|
+
var _CNameMapping$1;var DIR_NAME$1='ActiveCampaign';var NAME$1='ACTIVE_CAMPAIGN';var DISPLAY_NAME$1='Active Campaign';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);(_CNameMapping$1={ActiveCampaign:NAME$1,'Active Campaign':NAME$1,'ACTIVE CAMPAIGN':NAME$1},_defineProperty(_CNameMapping$1,NAME$1,NAME$1),_defineProperty(_CNameMapping$1,"activecampaign",NAME$1),_defineProperty(_CNameMapping$1,'active campaign',NAME$1),_defineProperty(_CNameMapping$1,'Active campaign',NAME$1),_defineProperty(_CNameMapping$1,'active Campaign',NAME$1),_defineProperty(_CNameMapping$1,"active_campaign",NAME$1),_CNameMapping$1);
|
1567
|
+
|
1568
|
+
var _CNameMapping;var DIR_NAME='Sprig';var NAME='SPRIG';var DISPLAY_NAME='Sprig';_defineProperty({},DISPLAY_NAME,DIR_NAME);(_CNameMapping={},_defineProperty(_CNameMapping,NAME,NAME),_defineProperty(_CNameMapping,"Sprig",NAME),_defineProperty(_CNameMapping,"sprig",NAME),_CNameMapping);
|
1545
1569
|
|
1546
1570
|
var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
|
1547
|
-
var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$
|
1571
|
+
var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$R,DIR_NAME$R),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$Y,DIR_NAME$Y),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$S,DIR_NAME$S),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$U,DIR_NAME$U),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$Q,DIR_NAME$Q),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$P,DIR_NAME$P),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$O,DIR_NAME$O),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$14,DIR_NAME$14),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$12,DIR_NAME$12),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$_,DIR_NAME$_),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$K,DIR_NAME$K),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$15,DIR_NAME$15),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$Z,DIR_NAME$Z),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$X,DIR_NAME$X),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$H,DIR_NAME$H),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$19,DIR_NAME$19),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$F,DIR_NAME$F),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$18,DIR_NAME$18),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$N,DIR_NAME$N),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$13,DIR_NAME$13),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$17,DIR_NAME$17),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$E,DIR_NAME$E),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$1a,DIR_NAME$1a),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$L,DIR_NAME$L),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$y,DIR_NAME$y),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$$,DIR_NAME$$),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$I,DIR_NAME$I),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$A,DIR_NAME$A),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$B,DIR_NAME$B),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$x,DIR_NAME$x),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$z,DIR_NAME$z),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$w,DIR_NAME$w),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$D,DIR_NAME$D),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$V,DIR_NAME$V),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$M,DIR_NAME$M),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$t,DIR_NAME$t),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$s,DIR_NAME$s),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$r,DIR_NAME$r),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$q,DIR_NAME$q),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$p,DIR_NAME$p),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$o,DIR_NAME$o),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$n,DIR_NAME$n),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$m,DIR_NAME$m),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$j,DIR_NAME$j),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$i,DIR_NAME$i),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$h,DIR_NAME$h),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$g,DIR_NAME$g),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$f,DIR_NAME$f),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$e,DIR_NAME$e),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$d,DIR_NAME$d),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$c,DIR_NAME$c),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$9,DIR_NAME$9),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$8,DIR_NAME$8),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$7,DIR_NAME$7),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$6,DIR_NAME$6),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$5,DIR_NAME$5),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$4,DIR_NAME$4),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$3,DIR_NAME$3),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$2,DIR_NAME$2),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME),_destDisplayNamesToFi);
|
1548
1572
|
|
1549
1573
|
var DEFAULT_INTEGRATIONS_CONFIG={All:true};
|
1550
1574
|
|
@@ -1553,7 +1577,7 @@ var isDestIntgConfigTruthy=function isDestIntgConfigTruthy(destIntgConfig){retur
|
|
1553
1577
|
* @param intgOpts Integration options object
|
1554
1578
|
* @param destinations Destinations array
|
1555
1579
|
* @returns Destinations array filtered based on the integration options
|
1556
|
-
*/var filterDestinations=function filterDestinations(intgOpts,destinations){var allOptVal=intgOpts.All;return destinations.filter(function(dest){var destDisplayName=dest.displayName;var isDestEnabled;if(allOptVal){isDestEnabled=true;if(isDestIntgConfigFalsy(intgOpts[destDisplayName])){isDestEnabled=false;}}else {isDestEnabled=false;if(isDestIntgConfigTruthy(intgOpts[destDisplayName])){isDestEnabled=true;}}return isDestEnabled;});};
|
1580
|
+
*/var filterDestinations=function filterDestinations(intgOpts,destinations){var _intgOpts$All;var allOptVal=(_intgOpts$All=intgOpts.All)!==null&&_intgOpts$All!==void 0?_intgOpts$All:true;return destinations.filter(function(dest){var destDisplayName=dest.displayName;var isDestEnabled;if(allOptVal){isDestEnabled=true;if(isDestIntgConfigFalsy(intgOpts[destDisplayName])){isDestEnabled=false;}}else {isDestEnabled=false;if(isDestIntgConfigTruthy(intgOpts[destDisplayName])){isDestEnabled=true;}}return isDestEnabled;});};
|
1557
1581
|
|
1558
1582
|
var READY_CHECK_TIMEOUT_MS=11*1000;// 11 seconds
|
1559
1583
|
var SCRIPT_LOAD_TIMEOUT_MS=10*1000;// 10 seconds
|
@@ -1567,7 +1591,7 @@ var DESTINATION_NOT_SUPPORTED_ERROR=function DESTINATION_NOT_SUPPORTED_ERROR(des
|
|
1567
1591
|
* @param sdkTypeName The name of the destination SDK type
|
1568
1592
|
* @param logger Logger instance
|
1569
1593
|
* @returns true if the destination SDK code is evaluated, false otherwise
|
1570
|
-
*/var isDestinationSDKMounted=function isDestinationSDKMounted(destSDKIdentifier,sdkTypeName,logger){return Boolean(globalThis[destSDKIdentifier]&&globalThis[destSDKIdentifier][sdkTypeName]&&globalThis[destSDKIdentifier][sdkTypeName].prototype&&typeof globalThis[destSDKIdentifier][sdkTypeName].prototype.constructor!=='undefined');};var createDestinationInstance=function createDestinationInstance(destSDKIdentifier,sdkTypeName,dest,state){var rAnalytics=globalThis.rudderanalytics;var analytics=rAnalytics.getAnalyticsInstance(state.lifecycle.writeKey.value);return new globalThis[destSDKIdentifier][sdkTypeName](clone$1(dest.config),{loadIntegration:state.nativeDestinations.loadIntegration.value,logLevel:state.lifecycle.logLevel.value,loadOnlyIntegrations:state.nativeDestinations.loadOnlyIntegrations.value,page:function page(category,name,properties,options,callback){return analytics.page(pageArgumentsToCallOptions(category,name,properties,options,callback));},track:function track(event,properties,options,callback){return analytics.track(trackArgumentsToCallOptions(event,properties,options,callback));},identify:function identify(userId,traits,options,callback){return analytics.identify(identifyArgumentsToCallOptions(userId,traits,options,callback));},alias:function alias(to,from,options,callback){return analytics.alias(aliasArgumentsToCallOptions(to,from,options,callback));},group:function group(groupId,traits,options,callback){return analytics.group(groupArgumentsToCallOptions(groupId,traits,options,callback));},getAnonymousId:function getAnonymousId(){return analytics.getAnonymousId();},getUserId:function getUserId(){return analytics.getUserId();},getUserTraits:function getUserTraits(){return analytics.getUserTraits();},getGroupId:function getGroupId(){return analytics.getGroupId();},getGroupTraits:function getGroupTraits(){return analytics.getGroupTraits();},getSessionId:function getSessionId(){return analytics.getSessionId();}},{shouldApplyDeviceModeTransformation:dest.shouldApplyDeviceModeTransformation,propagateEventsUntransformedOnError:dest.propagateEventsUntransformedOnError,destinationId:dest.id});};var isDestinationReady=function isDestinationReady(dest){return new Promise(function(resolve,reject){var instance=dest.instance;var handleNumber;var checkReady=function checkReady(){if(instance.isLoaded()&&(!instance.isReady||instance.isReady())){resolve(true);}else {handleNumber=globalThis.requestAnimationFrame(checkReady);}};checkReady();setTimeout(function(){globalThis.cancelAnimationFrame(handleNumber);reject(new Error(DESTINATION_READY_TIMEOUT_ERROR(READY_CHECK_TIMEOUT_MS,dest.userFriendlyId)));},READY_CHECK_TIMEOUT_MS);});};/**
|
1594
|
+
*/var isDestinationSDKMounted=function isDestinationSDKMounted(destSDKIdentifier,sdkTypeName,logger){return Boolean(globalThis[destSDKIdentifier]&&globalThis[destSDKIdentifier][sdkTypeName]&&globalThis[destSDKIdentifier][sdkTypeName].prototype&&typeof globalThis[destSDKIdentifier][sdkTypeName].prototype.constructor!=='undefined');};var createDestinationInstance=function createDestinationInstance(destSDKIdentifier,sdkTypeName,dest,state){var _state$consents$postC,_state$consents$postC2;var rAnalytics=globalThis.rudderanalytics;var analytics=rAnalytics.getAnalyticsInstance(state.lifecycle.writeKey.value);return new globalThis[destSDKIdentifier][sdkTypeName](clone$1(dest.config),{loadIntegration:state.nativeDestinations.loadIntegration.value,logLevel:state.lifecycle.logLevel.value,loadOnlyIntegrations:(_state$consents$postC=(_state$consents$postC2=state.consents.postConsent.value)===null||_state$consents$postC2===void 0?void 0:_state$consents$postC2.integrations)!==null&&_state$consents$postC!==void 0?_state$consents$postC:state.nativeDestinations.loadOnlyIntegrations.value,page:function page(category,name,properties,options,callback){return analytics.page(pageArgumentsToCallOptions(category,name,properties,options,callback));},track:function track(event,properties,options,callback){return analytics.track(trackArgumentsToCallOptions(event,properties,options,callback));},identify:function identify(userId,traits,options,callback){return analytics.identify(identifyArgumentsToCallOptions(userId,traits,options,callback));},alias:function alias(to,from,options,callback){return analytics.alias(aliasArgumentsToCallOptions(to,from,options,callback));},group:function group(groupId,traits,options,callback){return analytics.group(groupArgumentsToCallOptions(groupId,traits,options,callback));},getAnonymousId:function getAnonymousId(){return analytics.getAnonymousId();},getUserId:function getUserId(){return analytics.getUserId();},getUserTraits:function getUserTraits(){return analytics.getUserTraits();},getGroupId:function getGroupId(){return analytics.getGroupId();},getGroupTraits:function getGroupTraits(){return analytics.getGroupTraits();},getSessionId:function getSessionId(){return analytics.getSessionId();}},{shouldApplyDeviceModeTransformation:dest.shouldApplyDeviceModeTransformation,propagateEventsUntransformedOnError:dest.propagateEventsUntransformedOnError,destinationId:dest.id});};var isDestinationReady=function isDestinationReady(dest){return new Promise(function(resolve,reject){var instance=dest.instance;var handleNumber;var checkReady=function checkReady(){if(instance.isLoaded()&&(!instance.isReady||instance.isReady())){resolve(true);}else {handleNumber=globalThis.requestAnimationFrame(checkReady);}};checkReady();setTimeout(function(){globalThis.cancelAnimationFrame(handleNumber);reject(new Error(DESTINATION_READY_TIMEOUT_ERROR(READY_CHECK_TIMEOUT_MS,dest.userFriendlyId)));},READY_CHECK_TIMEOUT_MS);});};/**
|
1571
1595
|
* Extracts the integration config, if any, from the given destination
|
1572
1596
|
* and merges it with the current integrations config
|
1573
1597
|
* @param dest Destination object
|
@@ -1578,12 +1602,12 @@ var DESTINATION_NOT_SUPPORTED_ERROR=function DESTINATION_NOT_SUPPORTED_ERROR(des
|
|
1578
1602
|
if(isHybridModeDestination(initializedDestination)){state.nativeDestinations.integrationsConfig.value=getCumulativeIntegrationsConfig(initializedDestination,state.nativeDestinations.integrationsConfig.value,errorHandler);}state.nativeDestinations.initializedDestinations.value=[].concat(_toConsumableArray(state.nativeDestinations.initializedDestinations.value),[initializedDestination]);}).catch(function(err){state.nativeDestinations.failedDestinations.value=[].concat(_toConsumableArray(state.nativeDestinations.failedDestinations.value),[dest]);// The error message is already formatted in the isDestinationReady function
|
1579
1603
|
logger===null||logger===void 0||logger.error(err);});}catch(err){state.nativeDestinations.failedDestinations.value=[].concat(_toConsumableArray(state.nativeDestinations.failedDestinations.value),[dest]);errorHandler===null||errorHandler===void 0||errorHandler.onError(err,DEVICE_MODE_DESTINATIONS_PLUGIN,DESTINATION_INIT_ERROR(dest.userFriendlyId));}};
|
1580
1604
|
|
1581
|
-
var pluginName$b='DeviceModeDestinations';var DeviceModeDestinations=function DeviceModeDestinations(){return {name:pluginName$b,initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$b]);},nativeDestinations:{setActiveDestinations:function setActiveDestinations(state,pluginsManager,errorHandler,logger){var _clone;// Normalize the integration options from the load API call
|
1605
|
+
var pluginName$b='DeviceModeDestinations';var DeviceModeDestinations=function DeviceModeDestinations(){return {name:pluginName$b,initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$b]);},nativeDestinations:{setActiveDestinations:function setActiveDestinations(state,pluginsManager,errorHandler,logger){var _clone,_state$consents$postC,_state$consents$postC2;// Normalize the integration options from the load API call
|
1582
1606
|
state.nativeDestinations.loadOnlyIntegrations.value=(_clone=clone$1(state.loadOptions.value.integrations))!==null&&_clone!==void 0?_clone:DEFAULT_INTEGRATIONS_CONFIG;state.nativeDestinations.loadIntegration.value=state.loadOptions.value.loadIntegration;// Filter destination that doesn't have mapping config-->Integration names
|
1583
|
-
var configSupportedDestinations=state.nativeDestinations.configuredDestinations.value.filter(function(configDest){if(destDisplayNamesToFileNamesMap[configDest.displayName]){return true;}errorHandler===null||errorHandler===void 0||errorHandler.onError(new Error(DESTINATION_NOT_SUPPORTED_ERROR(configDest.userFriendlyId)),DEVICE_MODE_DESTINATIONS_PLUGIN);return false;});// Filter destinations that are disabled through load options
|
1584
|
-
var destinationsToLoad=filterDestinations(state.nativeDestinations.loadOnlyIntegrations.value,configSupportedDestinations);var consentedDestinations=destinationsToLoad.filter(function(dest){var _pluginsManager$invok;return(// if consent manager is not configured, then default to load the destination
|
1607
|
+
var configSupportedDestinations=state.nativeDestinations.configuredDestinations.value.filter(function(configDest){if(destDisplayNamesToFileNamesMap[configDest.displayName]){return true;}errorHandler===null||errorHandler===void 0||errorHandler.onError(new Error(DESTINATION_NOT_SUPPORTED_ERROR(configDest.userFriendlyId)),DEVICE_MODE_DESTINATIONS_PLUGIN);return false;});// Filter destinations that are disabled through load or consent API options
|
1608
|
+
var destinationsToLoad=filterDestinations((_state$consents$postC=(_state$consents$postC2=state.consents.postConsent.value)===null||_state$consents$postC2===void 0?void 0:_state$consents$postC2.integrations)!==null&&_state$consents$postC!==void 0?_state$consents$postC:state.nativeDestinations.loadOnlyIntegrations.value,configSupportedDestinations);var consentedDestinations=destinationsToLoad.filter(function(dest){var _pluginsManager$invok;return(// if consent manager is not configured, then default to load the destination
|
1585
1609
|
(_pluginsManager$invok=pluginsManager.invokeSingle("consentManager.isDestinationConsented",state,dest.config,errorHandler,logger))!==null&&_pluginsManager$invok!==void 0?_pluginsManager$invok:true);});state.nativeDestinations.activeDestinations.value=consentedDestinations;},load:function load(state,externalSrcLoader,errorHandler,logger,externalScriptOnLoad){var integrationsCDNPath=state.lifecycle.integrationsCDNPath.value;var activeDestinations=state.nativeDestinations.activeDestinations.value;activeDestinations.forEach(function(dest){var sdkName=destDisplayNamesToFileNamesMap[dest.displayName];var destSDKIdentifier="".concat(sdkName,"_RS");// this is the name of the object loaded on the window
|
1586
|
-
var sdkTypeName=sdkName;if(
|
1610
|
+
var sdkTypeName=sdkName;if(sdkTypeName&&!isDestinationSDKMounted(destSDKIdentifier,sdkTypeName)){var destSdkURL="".concat(integrationsCDNPath,"/").concat(sdkName,".min.js");externalSrcLoader.loadJSFile({url:destSdkURL,id:dest.userFriendlyId,callback:externalScriptOnLoad!==null&&externalScriptOnLoad!==void 0?externalScriptOnLoad:function(id){if(!id){logger===null||logger===void 0||logger.error(DESTINATION_SDK_LOAD_ERROR(DEVICE_MODE_DESTINATIONS_PLUGIN,dest.userFriendlyId));state.nativeDestinations.failedDestinations.value=[].concat(_toConsumableArray(state.nativeDestinations.failedDestinations.value),[dest]);}else {initializeDestination(dest,state,destSDKIdentifier,sdkTypeName,errorHandler,logger);}},timeout:SCRIPT_LOAD_TIMEOUT_MS});}else if(sdkTypeName){initializeDestination(dest,state,destSDKIdentifier,sdkTypeName,errorHandler,logger);}else {logger===null||logger===void 0||logger.error(DESTINATION_SDK_LOAD_ERROR(DEVICE_MODE_DESTINATIONS_PLUGIN,dest.displayName));}});}}};};
|
1587
1611
|
|
1588
1612
|
var DEFAULT_TRANSFORMATION_QUEUE_OPTIONS={minRetryDelay:500,backoffFactor:2,maxAttempts:3};var REQUEST_TIMEOUT_MS$1=10*1000;// 10 seconds
|
1589
1613
|
var QUEUE_NAME$2='rudder';var DMT_PLUGIN='DeviceModeTransformationPlugin';
|
@@ -1628,7 +1652,9 @@ var AMP_LINKER_ANONYMOUS_ID_KEY='rs_amp_id';
|
|
1628
1652
|
*
|
1629
1653
|
* @param {string} str
|
1630
1654
|
* @returns {number} crc32
|
1631
|
-
*/var crc32=function crc32(str){var crcTable=makeCRCTable();var crc=0^-1;for(var i=0;i<str.length;i++){
|
1655
|
+
*/var crc32=function crc32(str){var crcTable=makeCRCTable();var crc=0^-1;for(var i=0;i<str.length;i++){// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
1656
|
+
// @ts-ignore
|
1657
|
+
crc=crc>>>8^crcTable[(crc^str.charCodeAt(i))&0xff];}return (crc^-1)>>>0;};
|
1632
1658
|
|
1633
1659
|
/**
|
1634
1660
|
* An interface to fetch user device details.
|
@@ -1668,7 +1694,7 @@ return null;}var version=Number(parts.shift());if(version!==VALID_VERSION){retur
|
|
1668
1694
|
* @param {string} serializedIds
|
1669
1695
|
*
|
1670
1696
|
* @return {!Object<string, string>}
|
1671
|
-
*/var deserialize=function deserialize(serializedIds){var keyValuePairs={};var params=serializedIds.split(DELIMITER);for(var i=0;i<params.length;i+=2){var key=params[i];var valid=KEY_VALIDATOR.test(key);if(valid){keyValuePairs[key]=decode$1(params[i+1]);}}return keyValuePairs;};/**
|
1697
|
+
*/var deserialize=function deserialize(serializedIds){if(!serializedIds){return {};}var keyValuePairs={};var params=serializedIds.split(DELIMITER);for(var i=0;i<params.length;i+=2){var key=params[i];var valid=KEY_VALIDATOR.test(key);if(valid){keyValuePairs[key]=decode$1(params[i+1]);}}return keyValuePairs;};/**
|
1672
1698
|
* Generates a semi-unique value for page visitor.
|
1673
1699
|
*
|
1674
1700
|
* @return {string}
|
@@ -1700,7 +1726,7 @@ return crc.toString(36);};/**
|
|
1700
1726
|
* @param {string} value
|
1701
1727
|
*
|
1702
1728
|
* @return {?Object<string, string>}
|
1703
|
-
*/var parseLinker=function parseLinker(value){var linkerObj=parseLinkerParamValue(value);if(!linkerObj){return null;}var checksum=linkerObj.checksum,serializedIds=linkerObj.serializedIds;if(!isCheckSumValid(serializedIds,checksum)){return null;}return deserialize(serializedIds);};
|
1729
|
+
*/var parseLinker=function parseLinker(value){var linkerObj=parseLinkerParamValue(value);if(!linkerObj){return null;}var checksum=linkerObj.checksum,serializedIds=linkerObj.serializedIds;if(!serializedIds||!checksum||!isCheckSumValid(serializedIds,checksum)){return null;}return deserialize(serializedIds);};
|
1704
1730
|
|
1705
1731
|
var pluginName$7='GoogleLinker';var GoogleLinker=function GoogleLinker(){return {name:pluginName$7,initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$7]);},userSession:{anonymousIdGoogleLinker:function anonymousIdGoogleLinker(rudderAmpLinkerParam){if(!rudderAmpLinkerParam){return null;}var parsedAnonymousIdObj=rudderAmpLinkerParam?parseLinker(rudderAmpLinkerParam):null;return parsedAnonymousIdObj?parsedAnonymousIdObj[AMP_LINKER_ANONYMOUS_ID_KEY]:null;}}};};
|
1706
1732
|
|
@@ -1720,18 +1746,25 @@ var consentPurposes={};Object.entries(consentCookieData).forEach(function(pEntry
|
|
1720
1746
|
* Gets the consent data in the format expected by the application state
|
1721
1747
|
* @param ketchConsentData Consent data derived from the consent cookie
|
1722
1748
|
* @returns Consent data
|
1723
|
-
*/var getConsentData=function getConsentData(ketchConsentData){var
|
1749
|
+
*/var getConsentData=function getConsentData(ketchConsentData){var allowedConsentIds=[];var deniedConsentIds=[];if(ketchConsentData){Object.entries(ketchConsentData).forEach(function(e){var purposeCode=e[0];var isConsented=e[1];if(isConsented){allowedConsentIds.push(purposeCode);}else {deniedConsentIds.push(purposeCode);}});}return {allowedConsentIds:allowedConsentIds,deniedConsentIds:deniedConsentIds};};var updateConsentStateFromData=function updateConsentStateFromData(state,ketchConsentData){var consentData=getConsentData(ketchConsentData);state.consents.initialized.value=isDefined(ketchConsentData);state.consents.data.value=consentData;};
|
1724
1750
|
|
1725
|
-
var pluginName$6='KetchConsentManager';var KetchConsentManager=function KetchConsentManager(){return {name:pluginName$6,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$6]);},consentManager:{init:function init(state,
|
1751
|
+
var pluginName$6='KetchConsentManager';var KetchConsentManager=function KetchConsentManager(){return {name:pluginName$6,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$6]);},consentManager:{init:function init(state,logger){// getKetchUserConsentedPurposes returns current ketch opted-in purposes
|
1726
1752
|
// This will be helpful for debugging
|
1727
|
-
globalThis.getKetchUserConsentedPurposes=function(){var _state$consents$data$;return (_state$consents$data$=state.consents.data.value.
|
1753
|
+
globalThis.getKetchUserConsentedPurposes=function(){var _state$consents$data$;return (_state$consents$data$=state.consents.data.value.allowedConsentIds)===null||_state$consents$data$===void 0?void 0:_state$consents$data$.slice();};// getKetchUserDeniedPurposes returns current ketch opted-out purposes
|
1728
1754
|
// This will be helpful for debugging
|
1729
1755
|
globalThis.getKetchUserDeniedPurposes=function(){var _state$consents$data$2;return (_state$consents$data$2=state.consents.data.value.deniedConsentIds)===null||_state$consents$data$2===void 0?void 0:_state$consents$data$2.slice();};// updateKetchConsent callback function to update current consent purpose state
|
1730
1756
|
// this will be called from ketch rudderstack plugin
|
1731
|
-
globalThis.updateKetchConsent=function(ketchConsentData){updateConsentStateFromData(state,ketchConsentData);}
|
1732
|
-
var ketchConsentData;if(!isUndefined(globalThis.ketchConsent)){ketchConsentData=globalThis.ketchConsent;}else {ketchConsentData=getKetchConsentData(storeManager,logger);}updateConsentStateFromData(state,ketchConsentData);},isDestinationConsented:function isDestinationConsented(state,destConfig,errorHandler,logger){
|
1733
|
-
if(
|
1734
|
-
var
|
1757
|
+
globalThis.updateKetchConsent=function(ketchConsentData){updateConsentStateFromData(state,ketchConsentData);};},updateConsentsInfo:function updateConsentsInfo(state,storeManager,logger){// retrieve consent data and update the state
|
1758
|
+
var ketchConsentData;if(!isUndefined(globalThis.ketchConsent)){ketchConsentData=globalThis.ketchConsent;}else {ketchConsentData=getKetchConsentData(storeManager,logger);}updateConsentStateFromData(state,ketchConsentData);},isDestinationConsented:function isDestinationConsented(state,destConfig,errorHandler,logger){if(!state.consents.initialized.value){return true;}var allowedConsentIds=state.consents.data.value.allowedConsentIds;try{var ketchConsentPurposes=destConfig.ketchConsentPurposes,consentManagement=destConfig.consentManagement;var matchPredicate=function matchPredicate(consent){return allowedConsentIds.includes(consent);};// Generic consent management
|
1759
|
+
if(consentManagement){var _consentManagement$fi;// Get the corresponding consents for the destination
|
1760
|
+
var cmpConsents=(_consentManagement$fi=consentManagement.find(function(c){return c.provider===state.consents.provider.value;}))===null||_consentManagement$fi===void 0?void 0:_consentManagement$fi.consents;// If there are no consents configured for the destination for the current provider, events should be sent.
|
1761
|
+
if(!cmpConsents){return true;}var configuredConsents=cmpConsents.map(function(c){return c.consent.trim();}).filter(function(n){return n;});// match the configured consents with user provided consents as per
|
1762
|
+
// the configured resolution strategy
|
1763
|
+
switch(state.consents.resolutionStrategy.value){case'or':return configuredConsents.some(matchPredicate)||configuredConsents.length===0;case'and':default:return configuredConsents.every(matchPredicate);}// Legacy cookie consent management
|
1764
|
+
// TODO: To be removed once the source config API is updated to support generic consent management
|
1765
|
+
}else if(ketchConsentPurposes){var _configuredConsents=ketchConsentPurposes.map(function(p){return p.purpose.trim();}).filter(function(n){return n;});// Check if any of the destination's mapped ketch purposes are consented by the user in the browser.
|
1766
|
+
return _configuredConsents.some(matchPredicate)||_configuredConsents.length===0;}// If there are no consents configured for the destination for the current provider, events should be sent.
|
1767
|
+
return true;}catch(err){errorHandler===null||errorHandler===void 0||errorHandler.onError(err,KETCH_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR$1);return true;}}}};};
|
1735
1768
|
|
1736
1769
|
var DEFAULT_QUEUE_OPTIONS={maxItems:100};var QUEUE_NAME$1='rudder_destinations_events';var NATIVE_DESTINATION_QUEUE_PLUGIN='NativeDestinationQueuePlugin';
|
1737
1770
|
|
@@ -1781,18 +1814,29 @@ var ONETRUST_ACCESS_ERROR=function ONETRUST_ACCESS_ERROR(context){return "".conc
|
|
1781
1814
|
|
1782
1815
|
var ONETRUST_CONSENT_MANAGER_PLUGIN='OneTrustConsentManagerPlugin';
|
1783
1816
|
|
1784
|
-
var pluginName$4='OneTrustConsentManager';var OneTrustConsentManager=function OneTrustConsentManager(){return {name:pluginName$4,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$4]);},consentManager:{init:function init(state,
|
1817
|
+
var pluginName$4='OneTrustConsentManager';var OneTrustConsentManager=function OneTrustConsentManager(){return {name:pluginName$4,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$4]);},consentManager:{init:function init(state,logger){// Nothing to initialize
|
1818
|
+
},updateConsentsInfo:function updateConsentsInfo(state,storeManager,logger){if(!globalThis.OneTrust||!globalThis.OnetrustActiveGroups){logger===null||logger===void 0||logger.error(ONETRUST_ACCESS_ERROR(ONETRUST_CONSENT_MANAGER_PLUGIN));state.consents.initialized.value=false;return;}// OneTrustConsentManager SDK populates a data layer object OnetrustActiveGroups with
|
1785
1819
|
// the cookie categories Ids that the user has consented to.
|
1786
1820
|
// Eg: ',C0001,C0003,'
|
1787
1821
|
// We split it and save it as an array.
|
1788
|
-
var allowedConsentIds=globalThis.OnetrustActiveGroups.split(',').filter(function(n){return n;});var allowedConsents={};var deniedConsentIds=[];// Get the groups(cookie categorization), user has created in
|
1789
|
-
var oneTrustAllGroupsInfo=globalThis.OneTrust.GetDomainData().Groups;oneTrustAllGroupsInfo.forEach(function(group){var CustomGroupId=group.CustomGroupId,GroupName=group.GroupName;if(allowedConsentIds.includes(CustomGroupId)){allowedConsents[CustomGroupId]=GroupName;}else {deniedConsentIds.push(CustomGroupId);}});state.consents.
|
1790
|
-
|
1791
|
-
if(!
|
1822
|
+
var allowedConsentIds=globalThis.OnetrustActiveGroups.split(',').filter(function(n){return n;});var allowedConsents={};var deniedConsentIds=[];// Get the groups (cookie categorization), user has created in OneTrust account.
|
1823
|
+
var oneTrustAllGroupsInfo=globalThis.OneTrust.GetDomainData().Groups;oneTrustAllGroupsInfo.forEach(function(group){var CustomGroupId=group.CustomGroupId,GroupName=group.GroupName;if(allowedConsentIds.includes(CustomGroupId)){allowedConsents[CustomGroupId]=GroupName;}else {deniedConsentIds.push(CustomGroupId);}});state.consents.initialized.value=true;// In case of OneTrust, as we still support both category names and IDs, the allowed consents
|
1824
|
+
// are stored as an object with key as the category ID and value as the category name.
|
1825
|
+
state.consents.data.value={allowedConsentIds:allowedConsents,deniedConsentIds:deniedConsentIds};},isDestinationConsented:function isDestinationConsented(state,destConfig,errorHandler,logger){if(!state.consents.initialized.value){return true;}var allowedConsents=state.consents.data.value.allowedConsentIds;try{// mapping of the destination with the consent group name
|
1826
|
+
var oneTrustCookieCategories=destConfig.oneTrustCookieCategories,consentManagement=destConfig.consentManagement;var allowedConsentIds=Object.keys(allowedConsents);var allowedConsentNames=Object.values(allowedConsents);// Match the consent in both IDs and names
|
1827
|
+
var matchPredicate=function matchPredicate(consent){return allowedConsentIds.includes(consent)||allowedConsentNames.includes(consent);};// Generic consent management
|
1828
|
+
if(consentManagement){var _consentManagement$fi;// Get the corresponding consents for the destination
|
1829
|
+
var cmpConsents=(_consentManagement$fi=consentManagement.find(function(c){return c.provider===state.consents.provider.value;}))===null||_consentManagement$fi===void 0?void 0:_consentManagement$fi.consents;// If there are no consents configured for the destination for the current provider, events should be sent.
|
1830
|
+
if(!cmpConsents){return true;}var configuredConsents=cmpConsents.map(function(c){return c.consent.trim();}).filter(function(n){return n;});// match the configured consents with user provided consents as per
|
1831
|
+
// the configured resolution strategy
|
1832
|
+
switch(state.consents.resolutionStrategy.value){case'or':return configuredConsents.some(matchPredicate)||configuredConsents.length===0;case'and':default:return configuredConsents.every(matchPredicate);}// Legacy cookie consent management
|
1833
|
+
// TODO: To be removed once the source config API is updated to support generic consent management
|
1834
|
+
}else if(oneTrustCookieCategories){// Change the structure of oneTrustConsentGroup as an array and filter values if empty string
|
1792
1835
|
// Eg:
|
1793
1836
|
// ["Performance Cookies", "Functional Cookies"]
|
1794
|
-
var
|
1795
|
-
|
1837
|
+
var _configuredConsents=oneTrustCookieCategories.map(function(c){return c.oneTrustCookieCategory.trim();}).filter(function(n){return n;});// Check if all the destination's mapped cookie categories are consented by the user in the browser.
|
1838
|
+
return _configuredConsents.every(matchPredicate);}// If there are no consents configured for the destination for the current provider, events should be sent.
|
1839
|
+
return true;}catch(err){errorHandler===null||errorHandler===void 0||errorHandler.onError(err,ONETRUST_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR);return true;}}}};};
|
1796
1840
|
|
1797
1841
|
var pluginName$3='StorageEncryption';var StorageEncryption=function StorageEncryption(){return {name:pluginName$3,initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$3]);},storage:{encrypt:function encrypt(value){return encrypt$1(value);},decrypt:function decrypt(value){return decrypt$1(value);}}};};
|
1798
1842
|
|
@@ -2807,7 +2851,7 @@ var DATA_PLANE_API_VERSION='v1';var QUEUE_NAME='rudder';var XHR_QUEUE_PLUGIN='Xh
|
|
2807
2851
|
|
2808
2852
|
var EVENT_DELIVERY_FAILURE_ERROR_PREFIX=function EVENT_DELIVERY_FAILURE_ERROR_PREFIX(context,url){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to deliver event(s) to ").concat(url,".");};
|
2809
2853
|
|
2810
|
-
var getBatchDeliveryPayload=function getBatchDeliveryPayload(events,logger){var batchPayload={batch:events};return stringifyWithoutCircular(batchPayload,true,undefined,logger);};var getNormalizedQueueOptions=function getNormalizedQueueOptions(queueOpts){return mergeDeepRight(DEFAULT_RETRY_QUEUE_OPTIONS,queueOpts);};var getDeliveryUrl=function getDeliveryUrl(dataplaneUrl,endpoint){var dpUrl=new URL(dataplaneUrl);return new URL(removeDuplicateSlashes([dpUrl.pathname,'/',DATA_PLANE_API_VERSION,'/',endpoint].join('')),dpUrl).href;};var getBatchDeliveryUrl=function getBatchDeliveryUrl(dataplaneUrl){return getDeliveryUrl(dataplaneUrl,'batch');};var logErrorOnFailure=function logErrorOnFailure(details,url,willBeRetried,attemptNumber,maxRetryAttempts,logger){if(isUndefined(details===null||details===void 0?void 0:details.error)||isUndefined(logger)){return;}var isRetryableFailure=isErrRetryable(details);var errMsg=EVENT_DELIVERY_FAILURE_ERROR_PREFIX(XHR_QUEUE_PLUGIN,url);var dropMsg="The event(s) will be dropped.";if(isRetryableFailure){if(willBeRetried){errMsg="".concat(errMsg," It/they will be retried.");if(attemptNumber>0){errMsg="".concat(errMsg," Retry attempt ").concat(attemptNumber," of ").concat(maxRetryAttempts,".");}}else {errMsg="".concat(errMsg," Retries exhausted (").concat(maxRetryAttempts,"). ").concat(dropMsg);}}else {errMsg="".concat(errMsg," ").concat(dropMsg);}logger===null||logger===void 0||logger.error(errMsg);};var getRequestInfo=function getRequestInfo(itemData,state,logger){var data;var headers;var url;if(Array.isArray(itemData)){var finalEvents=itemData.map(function(queueItemData){return getFinalEventForDeliveryMutator(queueItemData.event);});data=getBatchDeliveryPayload(finalEvents,logger);headers=clone$1(itemData[0].headers);url=getBatchDeliveryUrl(state.lifecycle.activeDataplaneUrl.value);}else {var eventUrl=itemData.url,event=itemData.event,eventHeaders=itemData.headers;var finalEvent=getFinalEventForDeliveryMutator(event);data=getDeliveryPayload(finalEvent,logger);headers=clone$1(eventHeaders);url=eventUrl;}return {data:data,headers:headers,url:url};};
|
2854
|
+
var getBatchDeliveryPayload=function getBatchDeliveryPayload(events,logger){var batchPayload={batch:events};return stringifyWithoutCircular(batchPayload,true,undefined,logger);};var getNormalizedQueueOptions=function getNormalizedQueueOptions(queueOpts){return mergeDeepRight(DEFAULT_RETRY_QUEUE_OPTIONS,queueOpts);};var getDeliveryUrl=function getDeliveryUrl(dataplaneUrl,endpoint){var dpUrl=new URL(dataplaneUrl);return new URL(removeDuplicateSlashes([dpUrl.pathname,'/',DATA_PLANE_API_VERSION,'/',endpoint].join('')),dpUrl).href;};var getBatchDeliveryUrl=function getBatchDeliveryUrl(dataplaneUrl){return getDeliveryUrl(dataplaneUrl,'batch');};var logErrorOnFailure=function logErrorOnFailure(details,url,willBeRetried,attemptNumber,maxRetryAttempts,logger){if(isUndefined(details===null||details===void 0?void 0:details.error)||isUndefined(logger)){return;}var isRetryableFailure=isErrRetryable(details);var errMsg=EVENT_DELIVERY_FAILURE_ERROR_PREFIX(XHR_QUEUE_PLUGIN,url);var dropMsg="The event(s) will be dropped.";if(isRetryableFailure){if(willBeRetried){errMsg="".concat(errMsg," It/they will be retried.");if(attemptNumber>0){errMsg="".concat(errMsg," Retry attempt ").concat(attemptNumber," of ").concat(maxRetryAttempts,".");}}else {errMsg="".concat(errMsg," Retries exhausted (").concat(maxRetryAttempts,"). ").concat(dropMsg);}}else {errMsg="".concat(errMsg," ").concat(dropMsg);}logger===null||logger===void 0||logger.error(errMsg);};var getRequestInfo=function getRequestInfo(itemData,state,logger){var data;var headers;var url;if(Array.isArray(itemData)){var finalEvents=itemData.map(function(queueItemData){return getFinalEventForDeliveryMutator(queueItemData.event);});data=getBatchDeliveryPayload(finalEvents,logger);headers=itemData[0]?clone$1(itemData[0].headers):{};url=getBatchDeliveryUrl(state.lifecycle.activeDataplaneUrl.value);}else {var eventUrl=itemData.url,event=itemData.event,eventHeaders=itemData.headers;var finalEvent=getFinalEventForDeliveryMutator(event);data=getDeliveryPayload(finalEvent,logger);headers=clone$1(eventHeaders);url=eventUrl;}return {data:data,headers:headers,url:url};};
|
2811
2855
|
|
2812
2856
|
var pluginName='XhrQueue';var XhrQueue=function XhrQueue(){return {name:pluginName,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName]);},dataplaneEventsQueue:{/**
|
2813
2857
|
* Initialize the queue for delivery
|
@@ -2838,7 +2882,7 @@ AnonymousId:toBase64(event.anonymousId)};eventsQueue.addItem({url:url,headers:he
|
|
2838
2882
|
|
2839
2883
|
/**
|
2840
2884
|
* Map plugin names to direct code imports from plugins package
|
2841
|
-
*/var getBundledBuildPluginImports=function getBundledBuildPluginImports(){return {BeaconQueue:BeaconQueue,Bugsnag:Bugsnag,DeviceModeDestinations:DeviceModeDestinations,DeviceModeTransformation:DeviceModeTransformation,ErrorReporting:ErrorReporting,ExternalAnonymousId:ExternalAnonymousId,GoogleLinker:GoogleLinker,KetchConsentManager:KetchConsentManager,NativeDestinationQueue:NativeDestinationQueue,OneTrustConsentManager:OneTrustConsentManager,StorageEncryption:StorageEncryption,StorageEncryptionLegacy:StorageEncryptionLegacy,StorageMigrator:StorageMigrator,XhrQueue:XhrQueue};};
|
2885
|
+
*/var getBundledBuildPluginImports=function getBundledBuildPluginImports(){return {BeaconQueue:BeaconQueue,Bugsnag:Bugsnag,CustomConsentManager:CustomConsentManager,DeviceModeDestinations:DeviceModeDestinations,DeviceModeTransformation:DeviceModeTransformation,ErrorReporting:ErrorReporting,ExternalAnonymousId:ExternalAnonymousId,GoogleLinker:GoogleLinker,KetchConsentManager:KetchConsentManager,NativeDestinationQueue:NativeDestinationQueue,OneTrustConsentManager:OneTrustConsentManager,StorageEncryption:StorageEncryption,StorageEncryptionLegacy:StorageEncryptionLegacy,StorageMigrator:StorageMigrator,XhrQueue:XhrQueue};};
|
2842
2886
|
|
2843
2887
|
/**
|
2844
2888
|
* Map of mandatory plugin names and direct imports
|
@@ -2867,7 +2911,7 @@ var supportedErrReportingProviderPluginNames=Object.values(ErrorReportingProvide
|
|
2867
2911
|
if(state.loadOptions.value.useBeacon===true&&state.capabilities.isBeaconAvailable.value){pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return pluginName!=='XhrQueue';});}else {if(state.loadOptions.value.useBeacon===true){var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0||_this$logger.warn(UNSUPPORTED_BEACON_API_WARNING(PLUGINS_MANAGER));}pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return pluginName!=='BeaconQueue';});}// Enforce default cloud mode event delivery queue plugin is none exists
|
2868
2912
|
if(!pluginsToLoadFromConfig.includes('XhrQueue')&&!pluginsToLoadFromConfig.includes('BeaconQueue')){pluginsToLoadFromConfig.push('XhrQueue');}// Device mode destinations related plugins
|
2869
2913
|
if(getNonCloudDestinations((_state$nativeDestinat=state.nativeDestinations.configuredDestinations.value)!==null&&_state$nativeDestinat!==void 0?_state$nativeDestinat:[]).length===0){pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return !['DeviceModeDestinations','DeviceModeTransformation','NativeDestinationQueue'].includes(pluginName);});}// Consent Management related plugins
|
2870
|
-
var supportedConsentManagerPlugins=Object.values(ConsentManagersToPluginNameMap);
|
2914
|
+
var supportedConsentManagerPlugins=Object.values(ConsentManagersToPluginNameMap);var filterCondition=function filterCondition(pluginName){return !(pluginName!==state.consents.activeConsentManagerPluginName.value&&supportedConsentManagerPlugins.includes(pluginName));};if(!state.consents.enabled.value){filterCondition=function filterCondition(pluginName){return !supportedConsentManagerPlugins.includes(pluginName);};}pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(filterCondition);// Storage encryption related plugins
|
2871
2915
|
var supportedStorageEncryptionPlugins=Object.values(StorageEncryptionVersionsToPluginNameMap);pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return !(pluginName!==state.storage.encryptionPluginName.value&&supportedStorageEncryptionPlugins.includes(pluginName));});// Storage migrator related plugins
|
2872
2916
|
if(!state.storage.migrate.value){pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return pluginName!=='StorageMigrator';});}return [].concat(_toConsumableArray(Object.keys(getMandatoryPluginsMap())),_toConsumableArray(pluginsToLoadFromConfig));}/**
|
2873
2917
|
* Determine the list of plugins that should be activated
|
@@ -2890,7 +2934,7 @@ state.plugins.failedPlugins.value=[].concat(_toConsumableArray(state.plugins.fai
|
|
2890
2934
|
|
2891
2935
|
/**
|
2892
2936
|
* Utility to parse XHR JSON response
|
2893
|
-
*/var responseTextToJson=function responseTextToJson(responseText,onError){try{return JSON.parse(responseText||'');}catch(err){var error=getMutatedError(err,'Failed to parse response data');if(
|
2937
|
+
*/var responseTextToJson=function responseTextToJson(responseText,onError){try{return JSON.parse(responseText||'');}catch(err){var error=getMutatedError(err,'Failed to parse response data');if(isFunction(onError)){onError(error);}else {throw error;}}return undefined;};
|
2894
2938
|
|
2895
2939
|
var DEFAULT_XHR_REQUEST_OPTIONS={headers:{Accept:'application/json','Content-Type':'application/json;charset=UTF-8'},method:'GET'};/**
|
2896
2940
|
* Utility to create request configuration based on default options
|
@@ -2910,7 +2954,7 @@ xhr.timeout=timeout;Object.keys(options.headers).forEach(function(headerName){if
|
|
2910
2954
|
* Implement requests in a blocking way
|
2911
2955
|
*/_createClass(HttpClient,[{key:"getData",value:function(){var _getData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config){var url,options,timeout,isRawResponse,data,_error;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:url=config.url,options=config.options,timeout=config.timeout,isRawResponse=config.isRawResponse;_context.prev=1;_context.next=4;return xhrRequest(createXhrRequestOptions(url,options,this.basicAuthHeader),timeout,this.logger);case 4:data=_context.sent;return _context.abrupt("return",{data:isRawResponse?data.response:responseTextToJson(data.response,this.onError),details:data});case 8:_context.prev=8;_context.t0=_context["catch"](1);this.onError((_error=_context.t0.error)!==null&&_error!==void 0?_error:_context.t0);return _context.abrupt("return",{data:undefined,details:_context.t0});case 12:case"end":return _context.stop();}},_callee,this,[[1,8]]);}));function getData(_x){return _getData.apply(this,arguments);}return getData;}()/**
|
2912
2956
|
* Implement requests in a non-blocking way
|
2913
|
-
*/},{key:"getAsyncData",value:function getAsyncData(config){var _this=this;var callback=config.callback,url=config.url,options=config.options,timeout=config.timeout,isRawResponse=config.isRawResponse;var isFireAndForget=!
|
2957
|
+
*/},{key:"getAsyncData",value:function getAsyncData(config){var _this=this;var callback=config.callback,url=config.url,options=config.options,timeout=config.timeout,isRawResponse=config.isRawResponse;var isFireAndForget=!isFunction(callback);xhrRequest(createXhrRequestOptions(url,options,this.basicAuthHeader),timeout,this.logger).then(function(data){if(!isFireAndForget){callback(isRawResponse?data.response:responseTextToJson(data.response,_this.onError),data);}}).catch(function(data){var _data$error;_this.onError((_data$error=data.error)!==null&&_data$error!==void 0?_data$error:data);if(!isFireAndForget){callback(undefined,data);}});}/**
|
2914
2958
|
* Handle errors
|
2915
2959
|
*/},{key:"onError",value:function onError(error){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0||_this$errorHandler.onError(error,HTTP_CLIENT);}else {throw error;}}/**
|
2916
2960
|
* Set basic authentication header (eg writekey)
|
@@ -2918,7 +2962,7 @@ xhr.timeout=timeout;Object.keys(options.headers).forEach(function(headerName){if
|
|
2918
2962
|
* Clear basic authentication header
|
2919
2963
|
*/},{key:"resetAuthHeader",value:function resetAuthHeader(){this.basicAuthHeader=undefined;}}]);return HttpClient;}();var defaultHttpClient=new HttpClient(defaultErrorHandler,defaultLogger);
|
2920
2964
|
|
2921
|
-
var STORAGE_TEST_COOKIE='test_rudder_cookie';var STORAGE_TEST_LOCAL_STORAGE='test_rudder_ls';var STORAGE_TEST_SESSION_STORAGE='test_rudder_ss';var STORAGE_TEST_TOP_LEVEL_DOMAIN='__tld__';var CLIENT_DATA_STORE_COOKIE='clientDataInCookie';var CLIENT_DATA_STORE_LS='clientDataInLocalStorage';var CLIENT_DATA_STORE_MEMORY='clientDataInMemory';var CLIENT_DATA_STORE_SESSION='clientDataInSessionStorage';
|
2965
|
+
var STORAGE_TEST_COOKIE='test_rudder_cookie';var STORAGE_TEST_LOCAL_STORAGE='test_rudder_ls';var STORAGE_TEST_SESSION_STORAGE='test_rudder_ss';var STORAGE_TEST_TOP_LEVEL_DOMAIN='__tld__';var CLIENT_DATA_STORE_COOKIE='clientDataInCookie';var CLIENT_DATA_STORE_LS='clientDataInLocalStorage';var CLIENT_DATA_STORE_MEMORY='clientDataInMemory';var CLIENT_DATA_STORE_SESSION='clientDataInSessionStorage';var USER_SESSION_KEYS=['userId','userTraits','anonymousId','groupId','groupTraits','initialReferrer','initialReferringDomain','sessionInfo','authToken'];
|
2922
2966
|
|
2923
2967
|
var _storageClientDataSto;var storageClientDataStoreNameMap=(_storageClientDataSto={},_defineProperty(_storageClientDataSto,COOKIE_STORAGE,CLIENT_DATA_STORE_COOKIE),_defineProperty(_storageClientDataSto,LOCAL_STORAGE,CLIENT_DATA_STORE_LS),_defineProperty(_storageClientDataSto,MEMORY_STORAGE,CLIENT_DATA_STORE_MEMORY),_defineProperty(_storageClientDataSto,SESSION_STORAGE,CLIENT_DATA_STORE_SESSION),_storageClientDataSto);
|
2924
2968
|
|
@@ -2936,7 +2980,7 @@ var hasCrypto=function hasCrypto(){return !isNullOrUndefined(globalThis.crypto)&
|
|
2936
2980
|
|
2937
2981
|
var getUserAgentClientHint=function getUserAgentClientHint(callback){var level=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'none';if(level==='none'){callback(undefined);}if(level==='default'){callback(navigator.userAgentData);}if(level==='full'){var _navigator$userAgentD;(_navigator$userAgentD=navigator.userAgentData)===null||_navigator$userAgentD===void 0||_navigator$userAgentD.getHighEntropyValues(['architecture','bitness','brands','mobile','model','platform','platformVersion','uaFullVersion','fullVersionList','wow64']).then(function(ua){callback(ua);}).catch(function(){callback();});}};
|
2938
2982
|
|
2939
|
-
var isDatasetAvailable=function isDatasetAvailable(){var testElement=document.createElement('div');testElement.setAttribute('data-a-b','c');return testElement.dataset?testElement.dataset.aB==='c':false;};var legacyJSEngineRequiredPolyfills={URLSearchParams:function URLSearchParams(){return !globalThis.URLSearchParams;},URL:function URL(){return !isFunction(globalThis.URL);},MutationObserver:function(_MutationObserver){function MutationObserver(){return _MutationObserver.apply(this,arguments);}MutationObserver.toString=function(){return _MutationObserver.toString();};return MutationObserver;}(function(){return isUndefined(MutationObserver);}),Promise:function(_Promise){function Promise(){return _Promise.apply(this,arguments);}Promise.toString=function(){return _Promise.toString();};return Promise;}(function(){return isUndefined(Promise);}),'Number.isNaN':function NumberIsNaN(){return !Number.isNaN;},'Number.isInteger':function NumberIsInteger(){return !Number.isInteger;},'Array.from':function ArrayFrom(){return !Array.from;},'Array.prototype.find':function ArrayPrototypeFind(){return !Array.prototype.find;},'Array.prototype.includes':function ArrayPrototypeIncludes(){return !Array.prototype.includes;},'String.prototype.endsWith':function StringPrototypeEndsWith(){return !String.prototype.endsWith;},'String.prototype.startsWith':function StringPrototypeStartsWith(){return !String.prototype.startsWith;},'String.prototype.includes':function StringPrototypeIncludes(){return !String.prototype.includes;},'Object.entries':function ObjectEntries(){return !Object.entries;},'Object.values':function ObjectValues(){return !Object.values;},'Object.assign':function ObjectAssign(){return typeof Object.assign!=='function';},'Element.prototype.dataset':function ElementPrototypeDataset(){return !isDatasetAvailable();},'String.prototype.replaceAll':function StringPrototypeReplaceAll(){return !String.prototype.replaceAll;},TextEncoder:function(_TextEncoder){function TextEncoder(){return _TextEncoder.apply(this,arguments);}TextEncoder.toString=function(){return _TextEncoder.toString();};return TextEncoder;}(function(){return isUndefined(TextEncoder);}),TextDecoder:function(_TextDecoder){function TextDecoder(){return _TextDecoder.apply(this,arguments);}TextDecoder.toString=function(){return _TextDecoder.toString();};return TextDecoder;}(function(){return isUndefined(TextDecoder);}),'String.fromCodePoint':function StringFromCodePoint(){return !String.fromCodePoint;},requestAnimationFrame:function requestAnimationFrame(){return !isFunction(globalThis.requestAnimationFrame);},cancelAnimationFrame:function cancelAnimationFrame(){return !isFunction(globalThis.cancelAnimationFrame);},CustomEvent:function CustomEvent(){return !isFunction(globalThis.CustomEvent);}};var isLegacyJSEngine=function isLegacyJSEngine(){var requiredCapabilitiesList=Object.keys(legacyJSEngineRequiredPolyfills);var needsPolyfill=false;/* eslint-disable-next-line unicorn/no-for-loop */for(var i=0;i<requiredCapabilitiesList.length;i++){var isCapabilityMissing=legacyJSEngineRequiredPolyfills[requiredCapabilitiesList[i]];if(isCapabilityMissing()){needsPolyfill=true;break;}}return needsPolyfill;};
|
2983
|
+
var isDatasetAvailable=function isDatasetAvailable(){var testElement=document.createElement('div');testElement.setAttribute('data-a-b','c');return testElement.dataset?testElement.dataset.aB==='c':false;};var legacyJSEngineRequiredPolyfills={URLSearchParams:function URLSearchParams(){return !globalThis.URLSearchParams;},URL:function URL(){return !isFunction(globalThis.URL);},MutationObserver:function(_MutationObserver){function MutationObserver(){return _MutationObserver.apply(this,arguments);}MutationObserver.toString=function(){return _MutationObserver.toString();};return MutationObserver;}(function(){return isUndefined(MutationObserver);}),Promise:function(_Promise){function Promise(){return _Promise.apply(this,arguments);}Promise.toString=function(){return _Promise.toString();};return Promise;}(function(){return isUndefined(Promise);}),'Number.isNaN':function NumberIsNaN(){return !Number.isNaN;},'Number.isInteger':function NumberIsInteger(){return !Number.isInteger;},'Array.from':function ArrayFrom(){return !Array.from;},'Array.prototype.find':function ArrayPrototypeFind(){return !Array.prototype.find;},'Array.prototype.includes':function ArrayPrototypeIncludes(){return !Array.prototype.includes;},'String.prototype.endsWith':function StringPrototypeEndsWith(){return !String.prototype.endsWith;},'String.prototype.startsWith':function StringPrototypeStartsWith(){return !String.prototype.startsWith;},'String.prototype.includes':function StringPrototypeIncludes(){return !String.prototype.includes;},'Object.entries':function ObjectEntries(){return !Object.entries;},'Object.values':function ObjectValues(){return !Object.values;},'Object.assign':function ObjectAssign(){return typeof Object.assign!=='function';},'Element.prototype.dataset':function ElementPrototypeDataset(){return !isDatasetAvailable();},'String.prototype.replaceAll':function StringPrototypeReplaceAll(){return !String.prototype.replaceAll;},TextEncoder:function(_TextEncoder){function TextEncoder(){return _TextEncoder.apply(this,arguments);}TextEncoder.toString=function(){return _TextEncoder.toString();};return TextEncoder;}(function(){return isUndefined(TextEncoder);}),TextDecoder:function(_TextDecoder){function TextDecoder(){return _TextDecoder.apply(this,arguments);}TextDecoder.toString=function(){return _TextDecoder.toString();};return TextDecoder;}(function(){return isUndefined(TextDecoder);}),'String.fromCodePoint':function StringFromCodePoint(){return !String.fromCodePoint;},requestAnimationFrame:function requestAnimationFrame(){return !isFunction(globalThis.requestAnimationFrame);},cancelAnimationFrame:function cancelAnimationFrame(){return !isFunction(globalThis.cancelAnimationFrame);},CustomEvent:function CustomEvent(){return !isFunction(globalThis.CustomEvent);},/* eslint-disable-next-line */'navigator.sendBeacon':function navigatorSendBeacon(){return !isFunction(navigator.sendBeacon);}};var isLegacyJSEngine=function isLegacyJSEngine(){var requiredCapabilitiesList=Object.keys(legacyJSEngineRequiredPolyfills);var needsPolyfill=false;/* eslint-disable-next-line unicorn/no-for-loop */for(var i=0;i<requiredCapabilitiesList.length;i++){var isCapabilityMissing=legacyJSEngineRequiredPolyfills[requiredCapabilitiesList[i]];if(isFunction(isCapabilityMissing)&&isCapabilityMissing()){needsPolyfill=true;break;}}return needsPolyfill;};
|
2940
2984
|
|
2941
2985
|
var getScreenDetails=function getScreenDetails(){var screenDetails={density:0,width:0,height:0,innerWidth:0,innerHeight:0};screenDetails={width:globalThis.screen.width,height:globalThis.screen.height,density:globalThis.devicePixelRatio,innerWidth:globalThis.innerWidth,innerHeight:globalThis.innerHeight};return screenDetails;};
|
2942
2986
|
|
@@ -2955,7 +2999,7 @@ break;case SESSION_STORAGE:storage=storageInstance!==null&&storageInstance!==voi
|
|
2955
2999
|
return undefined;}};/**
|
2956
3000
|
* Parse cookie `str`
|
2957
3001
|
*/var parse=function parse(str){var obj={};var pairs=str.split(/\s*;\s*/);var pair;if(!pairs[0]){return obj;}// TODO: Decode only the cookies that are needed by the SDK
|
2958
|
-
pairs.forEach(function(pairItem){pair=pairItem.split('=');var keyName=decode(pair[0]);if(keyName){obj[keyName]=decode(pair[1]);}});return obj;};/**
|
3002
|
+
pairs.forEach(function(pairItem){pair=pairItem.split('=');var keyName=pair[0]?decode(pair[0]):undefined;if(keyName){obj[keyName]=pair[1]?decode(pair[1]):undefined;}});return obj;};/**
|
2959
3003
|
* Set cookie `name` to `value`
|
2960
3004
|
*/var set=function set(name,value,optionsConfig,logger){var options=_objectSpread2({},optionsConfig)||{};var cookieString="".concat(encode(name,logger),"=").concat(encode(value,logger));if(isNull(value)){options.maxage=-1;}if(options.maxage){options.expires=new Date(+new Date()+options.maxage);}if(options.path){cookieString+="; path=".concat(options.path);}if(options.domain){cookieString+="; domain=".concat(options.domain);}if(options.expires){cookieString+="; expires=".concat(options.expires.toUTCString());}if(options.samesite){cookieString+="; samesite=".concat(options.samesite);}if(options.secure){cookieString+="; secure";}globalThis.document.cookie=cookieString;};/**
|
2961
3005
|
* Return all cookies
|
@@ -2972,9 +3016,9 @@ var legacyGetHostname=function legacyGetHostname(href){var l=document.createElem
|
|
2972
3016
|
* The method returns an empty array when the hostname is an ip.
|
2973
3017
|
*/var levelsFunc=function levelsFunc(url){var _host$split;// This is called before the polyfills load thus new URL cannot be used
|
2974
3018
|
var host=typeof globalThis.URL!=='function'?legacyGetHostname(url):new URL(url).hostname;var parts=(_host$split=host===null||host===void 0?void 0:host.split('.'))!==null&&_host$split!==void 0?_host$split:[];var last=parts[parts.length-1];var levels=[];// Ip address.
|
2975
|
-
if(parts.length===4&&last===parseInt(last,10).toString()){return levels;}// Localhost.
|
3019
|
+
if(parts.length===4&&last&&last===parseInt(last,10).toString()){return levels;}// Localhost.
|
2976
3020
|
if(parts.length<=1){// Fix to support localhost
|
2977
|
-
if(parts[0].indexOf('localhost')!==-1){return ['localhost'];}return levels;}// Create levels.
|
3021
|
+
if(parts[0]&&parts[0].indexOf('localhost')!==-1){return ['localhost'];}return levels;}// Create levels.
|
2978
3022
|
for(var i=parts.length-2;i>=0;i-=1){levels.push(parts.slice(i).join('.'));}return levels;};/**
|
2979
3023
|
* Get the top domain.
|
2980
3024
|
*
|
@@ -2994,7 +3038,7 @@ var getDefaultCookieOptions=function getDefaultCookieOptions(){var topDomain=dom
|
|
2994
3038
|
/**
|
2995
3039
|
* A storage utility to persist values in cookies via Storage interface
|
2996
3040
|
*/var CookieStorage=/*#__PURE__*/function(){function CookieStorage(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var logger=arguments.length>1?arguments[1]:undefined;_classCallCheck(this,CookieStorage);_defineProperty(this,"isSupportAvailable",true);_defineProperty(this,"isEnabled",true);_defineProperty(this,"length",0);if(CookieStorage.globalSingleton){// eslint-disable-next-line no-constructor-return
|
2997
|
-
return CookieStorage.globalSingleton;}this.options=getDefaultCookieOptions();this.logger=logger;this.configure(options);CookieStorage.globalSingleton=this;}_createClass(CookieStorage,[{key:"configure",value:function configure(options){var _this$options;this.options=mergeDeepRight((_this$options=this.options)!==null&&_this$options!==void 0?_this$options:{},options);this.isSupportAvailable=isStorageAvailable(COOKIE_STORAGE,this,this.logger);this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable);return this.options;}},{key:"setItem",value:function setItem(key,value){cookie(key,value,this.options,this.logger);this.length=Object.keys(cookie()).length;return true;}// eslint-disable-next-line class-methods-use-this
|
3041
|
+
return CookieStorage.globalSingleton;}this.options=getDefaultCookieOptions();this.logger=logger;this.configure(options);CookieStorage.globalSingleton=this;}_createClass(CookieStorage,[{key:"configure",value:function configure(options){var _this$options;this.options=mergeDeepRight((_this$options=this.options)!==null&&_this$options!==void 0?_this$options:{},options);if(options.sameDomainCookiesOnly){delete this.options.domain;}this.isSupportAvailable=isStorageAvailable(COOKIE_STORAGE,this,this.logger);this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable);return this.options;}},{key:"setItem",value:function setItem(key,value){cookie(key,value,this.options,this.logger);this.length=Object.keys(cookie()).length;return true;}// eslint-disable-next-line class-methods-use-this
|
2998
3042
|
},{key:"getItem",value:function getItem(key){var value=cookie(key);return isUndefined(value)?null:value;}},{key:"removeItem",value:function removeItem(key){var result=this.setItem(key,null);this.length=Object.keys(cookie()).length;return result;}// eslint-disable-next-line class-methods-use-this
|
2999
3043
|
},{key:"clear",value:function clear(){// Not implemented
|
3000
3044
|
// getting a list of all cookie storage keys and remove all values
|
@@ -3006,7 +3050,7 @@ return CookieStorage.globalSingleton;}this.options=getDefaultCookieOptions();thi
|
|
3006
3050
|
|
3007
3051
|
/**
|
3008
3052
|
* A storage utility to retain values in memory via Storage interface
|
3009
|
-
*/var InMemoryStorage=/*#__PURE__*/function(){function InMemoryStorage(options,logger){_classCallCheck(this,InMemoryStorage);_defineProperty(this,"isEnabled",true);_defineProperty(this,"length",0);_defineProperty(this,"data",{});this.options=getDefaultInMemoryStorageOptions();this.logger=logger;this.configure(options!==null&&options!==void 0?options:{});}_createClass(InMemoryStorage,[{key:"configure",value:function configure(options){this.options=mergeDeepRight(this.options,options);this.isEnabled=Boolean(this.options.enabled);return this.options;}},{key:"setItem",value:function setItem(key,value){this.data[key]=value;this.length=Object.keys(this.data).length;return value;}},{key:"getItem",value:function getItem(key){if(key in this.data){return this.data[key];}return null;}},{key:"removeItem",value:function removeItem(key){if(key in this.data){delete this.data[key];}this.length=Object.keys(this.data).length;return null;}},{key:"clear",value:function clear(){this.data={};this.length=0;}},{key:"key",value:function key(index){return Object.keys(this.data)[index];}}]);return InMemoryStorage;}();var defaultInMemoryStorage=new InMemoryStorage({},defaultLogger);
|
3053
|
+
*/var InMemoryStorage=/*#__PURE__*/function(){function InMemoryStorage(options,logger){_classCallCheck(this,InMemoryStorage);_defineProperty(this,"isEnabled",true);_defineProperty(this,"length",0);_defineProperty(this,"data",{});this.options=getDefaultInMemoryStorageOptions();this.logger=logger;this.configure(options!==null&&options!==void 0?options:{});}_createClass(InMemoryStorage,[{key:"configure",value:function configure(options){this.options=mergeDeepRight(this.options,options);this.isEnabled=Boolean(this.options.enabled);return this.options;}},{key:"setItem",value:function setItem(key,value){this.data[key]=value;this.length=Object.keys(this.data).length;return value;}},{key:"getItem",value:function getItem(key){if(key in this.data){return this.data[key];}return null;}},{key:"removeItem",value:function removeItem(key){if(key in this.data){delete this.data[key];}this.length=Object.keys(this.data).length;return null;}},{key:"clear",value:function clear(){this.data={};this.length=0;}},{key:"key",value:function key(index){return Object.keys(this.data)[index]?Object.keys(this.data)[index]:null;}}]);return InMemoryStorage;}();var defaultInMemoryStorage=new InMemoryStorage({},defaultLogger);
|
3010
3054
|
|
3011
3055
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
3012
3056
|
|
@@ -3030,7 +3074,7 @@ if(key===undefined){var ret={};this.forEach(function(key,val){return ret[key]=va
|
|
3030
3074
|
* A storage utility to persist values in localstorage via Storage interface
|
3031
3075
|
*/var LocalStorage=/*#__PURE__*/function(){function LocalStorage(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var logger=arguments.length>1?arguments[1]:undefined;_classCallCheck(this,LocalStorage);_defineProperty(this,"isSupportAvailable",true);_defineProperty(this,"isEnabled",true);_defineProperty(this,"length",0);this.options=getDefaultLocalStorageOptions();this.logger=logger;this.configure(options);}_createClass(LocalStorage,[{key:"configure",value:function configure(options){this.options=mergeDeepRight(this.options,options);this.isSupportAvailable=isStorageAvailable(LOCAL_STORAGE,this,this.logger);this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable);return this.options;}},{key:"setItem",value:function setItem(key,value){store.set(key,value);this.length=store.keys().length;}// eslint-disable-next-line class-methods-use-this
|
3032
3076
|
},{key:"getItem",value:function getItem(key){var value=store.get(key);return isUndefined(value)?null:value;}},{key:"removeItem",value:function removeItem(key){store.remove(key);this.length=store.keys().length;}},{key:"clear",value:function clear(){store.clear();this.length=0;}// eslint-disable-next-line class-methods-use-this
|
3033
|
-
},{key:"key",value:function key(index){return store.keys()[index];}}]);return LocalStorage;}();var defaultLocalStorage=new LocalStorage({},defaultLogger);
|
3077
|
+
},{key:"key",value:function key(index){return store.keys()[index]?store.keys()[index]:null;}}]);return LocalStorage;}();var defaultLocalStorage=new LocalStorage({},defaultLogger);
|
3034
3078
|
|
3035
3079
|
/**
|
3036
3080
|
* A storage utility to persist values in SessionStorage via Storage interface
|
@@ -3048,7 +3092,7 @@ if(key===undefined){var ret={};this.forEach(function(key,val){return ret[key]=va
|
|
3048
3092
|
* Configure session storage singleton
|
3049
3093
|
*/var configureSessionStorageEngine=function configureSessionStorageEngine(options){defaultSessionStorage.configure(options);};/**
|
3050
3094
|
* Configure all storage singleton instances
|
3051
|
-
*/var configureStorageEngines=function configureStorageEngines(){var
|
3095
|
+
*/var configureStorageEngines=function configureStorageEngines(){var cookieStorageOptions=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var localStorageOptions=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var inMemoryStorageOptions=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var sessionStorageOptions=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};configureCookieStorageEngine(cookieStorageOptions);configureLocalStorageEngine(localStorageOptions);configureInMemoryStorageEngine(inMemoryStorageOptions);configureSessionStorageEngine(sessionStorageOptions);};
|
3052
3096
|
|
3053
3097
|
/**
|
3054
3098
|
* Store Implementation with dedicated storage
|
@@ -3084,18 +3128,22 @@ return JSON.parse(str);}catch(err){this.onError(new Error("".concat(STORE_DATA_F
|
|
3084
3128
|
* Handle errors
|
3085
3129
|
*/},{key:"onError",value:function onError(error){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0||_this$errorHandler.onError(error,"Store ".concat(this.id));}else {throw error;}}}]);return Store;}();
|
3086
3130
|
|
3131
|
+
var getStorageTypeFromPreConsentIfApplicable=function getStorageTypeFromPreConsentIfApplicable(state,sessionKey){var overriddenStorageType;if(state.consents.preConsent.value.enabled){var _state$consents$preCo;switch((_state$consents$preCo=state.consents.preConsent.value.storage)===null||_state$consents$preCo===void 0?void 0:_state$consents$preCo.strategy){case'none':overriddenStorageType=NO_STORAGE;break;case'session':if(sessionKey!=='sessionInfo'){overriddenStorageType=NO_STORAGE;}break;case'anonymousId':if(sessionKey!=='anonymousId'){overriddenStorageType=NO_STORAGE;}break;}}return overriddenStorageType;};
|
3132
|
+
|
3087
3133
|
/**
|
3088
3134
|
* A service to manage stores & available storage client configurations
|
3089
3135
|
*/var StoreManager=/*#__PURE__*/function(){function StoreManager(pluginsManager,errorHandler,logger){_classCallCheck(this,StoreManager);_defineProperty(this,"stores",{});_defineProperty(this,"isInitialized",false);_defineProperty(this,"hasErrorHandler",false);this.errorHandler=errorHandler;this.logger=logger;this.hasErrorHandler=Boolean(this.errorHandler);this.pluginsManager=pluginsManager;this.onError=this.onError.bind(this);}/**
|
3090
3136
|
* Configure available storage client instances
|
3091
|
-
*/_createClass(StoreManager,[{key:"init",value:function init(){var _state$storage$cookie;if(this.isInitialized){return;}var config={
|
3137
|
+
*/_createClass(StoreManager,[{key:"init",value:function init(){var _config$cookieStorage,_state$storage$cookie,_state$storage$cookie2;if(this.isInitialized){return;}var loadOptions=state.loadOptions.value;var config={cookieStorageOptions:{samesite:loadOptions.sameSiteCookie,secure:loadOptions.secureCookie,domain:loadOptions.setCookieDomain,sameDomainCookiesOnly:loadOptions.sameDomainCookiesOnly,enabled:true},localStorageOptions:{enabled:true},inMemoryStorageOptions:{enabled:true},sessionStorageOptions:{enabled:true}};configureStorageEngines(removeUndefinedValues(mergeDeepRight((_config$cookieStorage=config.cookieStorageOptions)!==null&&_config$cookieStorage!==void 0?_config$cookieStorage:{},(_state$storage$cookie=(_state$storage$cookie2=state.storage.cookie)===null||_state$storage$cookie2===void 0?void 0:_state$storage$cookie2.value)!==null&&_state$storage$cookie!==void 0?_state$storage$cookie:{})),removeUndefinedValues(config.localStorageOptions),removeUndefinedValues(config.inMemoryStorageOptions),removeUndefinedValues(config.sessionStorageOptions));this.initClientDataStores();this.isInitialized=true;}/**
|
3092
3138
|
* Create store to persist data used by the SDK like session, used details etc
|
3093
|
-
*/},{key:"
|
3094
|
-
if((_getStorageEngine3=getStorageEngine(COOKIE_STORAGE))!==null&&_getStorageEngine3!==void 0&&_getStorageEngine3.isEnabled){finalStorageType=COOKIE_STORAGE;}else if((_getStorageEngine4=getStorageEngine(LOCAL_STORAGE))!==null&&_getStorageEngine4!==void 0&&_getStorageEngine4.isEnabled){finalStorageType=LOCAL_STORAGE;}else if((_getStorageEngine5=getStorageEngine(SESSION_STORAGE))!==null&&_getStorageEngine5!==void 0&&_getStorageEngine5.isEnabled){finalStorageType=SESSION_STORAGE;}else {finalStorageType=MEMORY_STORAGE;}break;}if(finalStorageType!==storageType){var _this$logger;(_this$logger=_this.logger)===null||_this$logger===void 0||_this$logger.warn(STORAGE_UNAVAILABLE_WARNING(STORE_MANAGER,storageType,finalStorageType));}if(finalStorageType!==NO_STORAGE){trulyAnonymousTracking=false;}var storageState=state.storage.entries.value;state.storage.entries.value=_objectSpread2(_objectSpread2({},storageState),{},_defineProperty({},sessionKey,{type:finalStorageType,key:userSessionStorageKeys[storageKey]}));});state.storage.trulyAnonymousTracking.value=trulyAnonymousTracking;// TODO: fill in extra config values and bring them in from StoreManagerOptions if needed
|
3139
|
+
*/},{key:"initClientDataStores",value:function initClientDataStores(){var _this=this;this.initializeStorageState();// TODO: fill in extra config values and bring them in from StoreManagerOptions if needed
|
3095
3140
|
// TODO: should we pass the keys for all in order to validate or leave free as v1.1?
|
3096
3141
|
// Initializing all the enabled store because previous user data might be in different storage
|
3097
3142
|
// that needs auto migration
|
3098
|
-
var
|
3143
|
+
var storageTypes=[MEMORY_STORAGE,LOCAL_STORAGE,COOKIE_STORAGE,SESSION_STORAGE];storageTypes.forEach(function(storageType){var _getStorageEngine;if((_getStorageEngine=getStorageEngine(storageType))!==null&&_getStorageEngine!==void 0&&_getStorageEngine.isEnabled){_this.setStore({id:storageClientDataStoreNameMap[storageType],name:storageClientDataStoreNameMap[storageType],isEncrypted:true,noCompoundKey:true,type:storageType});}});}},{key:"initializeStorageState",value:function initializeStorageState(){var _state$loadOptions$va,_this2=this;var globalStorageType=state.storage.type.value;var entriesOptions=(_state$loadOptions$va=state.loadOptions.value.storage)===null||_state$loadOptions$va===void 0?void 0:_state$loadOptions$va.entries;// Use the storage options from post consent if anything is defined
|
3144
|
+
var postConsentStorageOpts=state.consents.postConsent.value.storage;if(isDefined(postConsentStorageOpts===null||postConsentStorageOpts===void 0?void 0:postConsentStorageOpts.type)||isDefined(postConsentStorageOpts===null||postConsentStorageOpts===void 0?void 0:postConsentStorageOpts.entries)){globalStorageType=postConsentStorageOpts===null||postConsentStorageOpts===void 0?void 0:postConsentStorageOpts.type;entriesOptions=postConsentStorageOpts===null||postConsentStorageOpts===void 0?void 0:postConsentStorageOpts.entries;}var trulyAnonymousTracking=true;var storageEntries={};USER_SESSION_KEYS.forEach(function(sessionKey){var _entriesOptions,_ref,_ref2;var key=sessionKey;var storageKey=sessionKey;var configuredStorageType=(_entriesOptions=entriesOptions)===null||_entriesOptions===void 0||(_entriesOptions=_entriesOptions[key])===null||_entriesOptions===void 0?void 0:_entriesOptions.type;var preConsentStorageType=getStorageTypeFromPreConsentIfApplicable(state,sessionKey);// Storage type precedence order: pre-consent strategy > entry type > global type > default
|
3145
|
+
var storageType=(_ref=(_ref2=preConsentStorageType!==null&&preConsentStorageType!==void 0?preConsentStorageType:configuredStorageType)!==null&&_ref2!==void 0?_ref2:globalStorageType)!==null&&_ref!==void 0?_ref:DEFAULT_STORAGE_TYPE;var finalStorageType=_this2.getResolvedStorageTypeForEntry(storageType,sessionKey);if(finalStorageType!==NO_STORAGE){trulyAnonymousTracking=false;}storageEntries=_objectSpread2(_objectSpread2({},storageEntries),{},_defineProperty({},sessionKey,{type:finalStorageType,key:USER_SESSION_STORAGE_KEYS[storageKey]}));});n(function(){state.storage.type.value=globalStorageType;state.storage.entries.value=storageEntries;state.storage.trulyAnonymousTracking.value=trulyAnonymousTracking;});}},{key:"getResolvedStorageTypeForEntry",value:function getResolvedStorageTypeForEntry(storageType,sessionKey){var _getStorageEngine2,_getStorageEngine3,_getStorageEngine4,_getStorageEngine5,_getStorageEngine6;var finalStorageType=storageType;switch(storageType){case LOCAL_STORAGE:if(!((_getStorageEngine2=getStorageEngine(LOCAL_STORAGE))!==null&&_getStorageEngine2!==void 0&&_getStorageEngine2.isEnabled)){finalStorageType=MEMORY_STORAGE;}break;case SESSION_STORAGE:if(!((_getStorageEngine3=getStorageEngine(SESSION_STORAGE))!==null&&_getStorageEngine3!==void 0&&_getStorageEngine3.isEnabled)){finalStorageType=MEMORY_STORAGE;}break;case MEMORY_STORAGE:case NO_STORAGE:break;case COOKIE_STORAGE:default:// First try setting the storage to cookie else to local storage
|
3146
|
+
if((_getStorageEngine4=getStorageEngine(COOKIE_STORAGE))!==null&&_getStorageEngine4!==void 0&&_getStorageEngine4.isEnabled){finalStorageType=COOKIE_STORAGE;}else if((_getStorageEngine5=getStorageEngine(LOCAL_STORAGE))!==null&&_getStorageEngine5!==void 0&&_getStorageEngine5.isEnabled){finalStorageType=LOCAL_STORAGE;}else if((_getStorageEngine6=getStorageEngine(SESSION_STORAGE))!==null&&_getStorageEngine6!==void 0&&_getStorageEngine6.isEnabled){finalStorageType=SESSION_STORAGE;}else {finalStorageType=MEMORY_STORAGE;}break;}if(finalStorageType!==storageType){var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0||_this$logger.warn(STORAGE_UNAVAILABLE_WARNING(STORE_MANAGER,sessionKey,storageType,finalStorageType));}return finalStorageType;}/**
|
3099
3147
|
* Create a new store
|
3100
3148
|
*/},{key:"setStore",value:function setStore(storeConfig){var storageEngine=getStorageEngine(storeConfig.type);this.stores[storeConfig.id]=new Store(storeConfig,storageEngine,this.pluginsManager);return this.stores[storeConfig.id];}/**
|
3101
3149
|
* Retrieve a store
|
@@ -3133,7 +3181,7 @@ var validateWriteKey=function validateWriteKey(writeKey){if(!isString(writeKey)|
|
|
3133
3181
|
|
3134
3182
|
/**
|
3135
3183
|
* Plugins to be loaded in the plugins loadOption is not defined
|
3136
|
-
*/var defaultOptionalPluginsList=['BeaconQueue','Bugsnag','DeviceModeDestinations','DeviceModeTransformation','ErrorReporting','ExternalAnonymousId','GoogleLinker','KetchConsentManager','NativeDestinationQueue','OneTrustConsentManager','StorageEncryption','StorageEncryptionLegacy','StorageMigrator','XhrQueue'];
|
3184
|
+
*/var defaultOptionalPluginsList=['BeaconQueue','Bugsnag','CustomConsentManager','DeviceModeDestinations','DeviceModeTransformation','ErrorReporting','ExternalAnonymousId','GoogleLinker','KetchConsentManager','NativeDestinationQueue','OneTrustConsentManager','StorageEncryption','StorageEncryptionLegacy','StorageMigrator','XhrQueue'];
|
3137
3185
|
|
3138
3186
|
/**
|
3139
3187
|
* A function to check given value is a number or not
|
@@ -3184,18 +3232,28 @@ var DEFAULT_PRE_CONSENT_STORAGE_STRATEGY='none';var DEFAULT_PRE_CONSENT_EVENTS_D
|
|
3184
3232
|
var isErrorReportingEnabled=function isErrorReportingEnabled(sourceConfig){var _sourceConfig$statsCo;return (sourceConfig===null||sourceConfig===void 0||(_sourceConfig$statsCo=sourceConfig.statsCollection)===null||_sourceConfig$statsCo===void 0||(_sourceConfig$statsCo=_sourceConfig$statsCo.errors)===null||_sourceConfig$statsCo===void 0?void 0:_sourceConfig$statsCo.enabled)===true;};var getErrorReportingProviderNameFromConfig=function getErrorReportingProviderNameFromConfig(sourceConfig){var _sourceConfig$statsCo2;return sourceConfig===null||sourceConfig===void 0||(_sourceConfig$statsCo2=sourceConfig.statsCollection)===null||_sourceConfig$statsCo2===void 0||(_sourceConfig$statsCo2=_sourceConfig$statsCo2.errors)===null||_sourceConfig$statsCo2===void 0?void 0:_sourceConfig$statsCo2.provider;};var isMetricsReportingEnabled=function isMetricsReportingEnabled(sourceConfig){var _sourceConfig$statsCo3;return (sourceConfig===null||sourceConfig===void 0||(_sourceConfig$statsCo3=sourceConfig.statsCollection)===null||_sourceConfig$statsCo3===void 0||(_sourceConfig$statsCo3=_sourceConfig$statsCo3.metrics)===null||_sourceConfig$statsCo3===void 0?void 0:_sourceConfig$statsCo3.enabled)===true;};
|
3185
3233
|
|
3186
3234
|
/**
|
3187
|
-
*
|
3188
|
-
* @param
|
3189
|
-
* @returns
|
3190
|
-
|
3191
|
-
|
3192
|
-
*
|
3193
|
-
*
|
3194
|
-
*
|
3195
|
-
|
3196
|
-
*
|
3197
|
-
*
|
3198
|
-
|
3235
|
+
* Validates and normalizes the consent options provided by the user
|
3236
|
+
* @param options Consent options provided by the user
|
3237
|
+
* @returns Validated and normalized consent options
|
3238
|
+
*/var getValidPostConsentOptions=function getValidPostConsentOptions(options){var validOptions={sendPageEvent:false,trackConsent:false,discardPreConsentEvents:false};if(isObjectLiteralAndNotNull(options)){var clonedOptions=clone$1(options);validOptions.storage=clonedOptions.storage;if(isDefined(clonedOptions.integrations)){validOptions.integrations=isObjectLiteralAndNotNull(clonedOptions.integrations)?clonedOptions.integrations:DEFAULT_INTEGRATIONS_CONFIG;}validOptions.discardPreConsentEvents=clonedOptions.discardPreConsentEvents===true;validOptions.sendPageEvent=clonedOptions.sendPageEvent===true;validOptions.trackConsent=clonedOptions.trackConsent===true;if(isNonEmptyObject(clonedOptions.consentManagement)){// Override enabled value with the current state value
|
3239
|
+
validOptions.consentManagement=mergeDeepRight(clonedOptions.consentManagement,{enabled:state.consents.enabled.value});}}return validOptions;};/**
|
3240
|
+
* Validates if the input is a valid consents data
|
3241
|
+
* @param value Input consents data
|
3242
|
+
* @returns true if the input is a valid consents data else false
|
3243
|
+
*/var isValidConsentsData=function isValidConsentsData(value){return isNonEmptyObject(value)||Array.isArray(value);};/**
|
3244
|
+
* Retrieves the corresponding provider and plugin name of the selected consent manager from the supported consent managers
|
3245
|
+
* @param consentManagementOpts consent management options
|
3246
|
+
* @param logger logger instance
|
3247
|
+
* @returns Corresponding provider and plugin name of the selected consent manager from the supported consent managers
|
3248
|
+
*/var getConsentManagerInfo=function getConsentManagerInfo(consentManagementOpts,logger){var provider=consentManagementOpts.provider;var consentManagerPluginName=ConsentManagersToPluginNameMap[provider];if(provider&&!consentManagerPluginName){logger===null||logger===void 0||logger.error(UNSUPPORTED_CONSENT_MANAGER_ERROR(CONFIG_MANAGER,provider,ConsentManagersToPluginNameMap));// Reset the provider value
|
3249
|
+
provider=undefined;}return {provider:provider,consentManagerPluginName:consentManagerPluginName};};/**
|
3250
|
+
* Validates and converts the consent management options into a normalized format
|
3251
|
+
* @param consentManagementOpts Consent management options provided by the user
|
3252
|
+
* @param logger logger instance
|
3253
|
+
* @returns An object containing the consent manager plugin name, initialized, enabled and consents data
|
3254
|
+
*/var getConsentManagementData=function getConsentManagementData(consentManagementOpts,logger){var consentManagerPluginName;var allowedConsentIds=[];var deniedConsentIds=[];var initialized=false;var provider;var enabled=(consentManagementOpts===null||consentManagementOpts===void 0?void 0:consentManagementOpts.enabled)===true;if(isNonEmptyObject(consentManagementOpts)&&enabled){// Get the corresponding plugin name of the selected consent manager from the supported consent managers
|
3255
|
+
var _getConsentManagerInf=getConsentManagerInfo(consentManagementOpts,logger);provider=_getConsentManagerInf.provider;consentManagerPluginName=_getConsentManagerInf.consentManagerPluginName;if(isValidConsentsData(consentManagementOpts.allowedConsentIds)){allowedConsentIds=consentManagementOpts.allowedConsentIds;initialized=true;}if(isValidConsentsData(consentManagementOpts.deniedConsentIds)){deniedConsentIds=consentManagementOpts.deniedConsentIds;initialized=true;}}var consentsData={allowedConsentIds:allowedConsentIds,deniedConsentIds:deniedConsentIds};// Enable consent management only if consent manager is supported
|
3256
|
+
enabled=enabled&&Boolean(consentManagerPluginName);return {provider:provider,consentManagerPluginName:consentManagerPluginName,initialized:initialized,enabled:enabled,consentsData:consentsData};};
|
3199
3257
|
|
3200
3258
|
/**
|
3201
3259
|
* Determines the SDK url
|
@@ -3206,12 +3264,18 @@ var isErrorReportingEnabled=function isErrorReportingEnabled(sourceConfig){var _
|
|
3206
3264
|
* @param logger Logger instance
|
3207
3265
|
*/var updateReportingState=function updateReportingState(res,logger){state.reporting.isErrorReportingEnabled.value=isErrorReportingEnabled(res.source.config);state.reporting.isMetricsReportingEnabled.value=isMetricsReportingEnabled(res.source.config);if(state.reporting.isErrorReportingEnabled.value){var errReportingProvider=getErrorReportingProviderNameFromConfig(res.source.config);// Get the corresponding plugin name of the selected error reporting provider from the supported error reporting providers
|
3208
3266
|
var errReportingProviderPlugin=errReportingProvider?ErrorReportingProvidersToPluginNameMap[errReportingProvider]:undefined;if(!isUndefined(errReportingProvider)&&!errReportingProviderPlugin){// set the default error reporting provider
|
3209
|
-
logger===null||logger===void 0||logger.warn(UNSUPPORTED_ERROR_REPORTING_PROVIDER_WARNING(CONFIG_MANAGER,errReportingProvider,ErrorReportingProvidersToPluginNameMap,DEFAULT_ERROR_REPORTING_PROVIDER));}state.reporting.errorReportingProviderPluginName.value=errReportingProviderPlugin!==null&&errReportingProviderPlugin!==void 0?errReportingProviderPlugin:ErrorReportingProvidersToPluginNameMap[DEFAULT_ERROR_REPORTING_PROVIDER];}};var
|
3267
|
+
logger===null||logger===void 0||logger.warn(UNSUPPORTED_ERROR_REPORTING_PROVIDER_WARNING(CONFIG_MANAGER,errReportingProvider,ErrorReportingProvidersToPluginNameMap,DEFAULT_ERROR_REPORTING_PROVIDER));}state.reporting.errorReportingProviderPluginName.value=errReportingProviderPlugin!==null&&errReportingProviderPlugin!==void 0?errReportingProviderPlugin:ErrorReportingProvidersToPluginNameMap[DEFAULT_ERROR_REPORTING_PROVIDER];}};var updateStorageStateFromLoadOptions=function updateStorageStateFromLoadOptions(logger){var _storageOptsFromLoad$;var storageOptsFromLoad=state.loadOptions.value.storage;var storageType=storageOptsFromLoad===null||storageOptsFromLoad===void 0?void 0:storageOptsFromLoad.type;if(isDefined(storageType)&&!isValidStorageType(storageType)){logger===null||logger===void 0||logger.warn(STORAGE_TYPE_VALIDATION_WARNING(CONFIG_MANAGER,storageType,DEFAULT_STORAGE_TYPE));storageType=DEFAULT_STORAGE_TYPE;}var storageEncryptionVersion=storageOptsFromLoad===null||storageOptsFromLoad===void 0||(_storageOptsFromLoad$=storageOptsFromLoad.encryption)===null||_storageOptsFromLoad$===void 0?void 0:_storageOptsFromLoad$.version;var encryptionPluginName=storageEncryptionVersion&&StorageEncryptionVersionsToPluginNameMap[storageEncryptionVersion];if(!isUndefined(storageEncryptionVersion)&&isUndefined(encryptionPluginName)){// set the default encryption plugin
|
3210
3268
|
logger===null||logger===void 0||logger.warn(UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING(CONFIG_MANAGER,storageEncryptionVersion,StorageEncryptionVersionsToPluginNameMap,DEFAULT_STORAGE_ENCRYPTION_VERSION));storageEncryptionVersion=DEFAULT_STORAGE_ENCRYPTION_VERSION;}else if(isUndefined(storageEncryptionVersion)){storageEncryptionVersion=DEFAULT_STORAGE_ENCRYPTION_VERSION;}// Allow migration only if the configured encryption version is the default encryption version
|
3211
|
-
var configuredMigrationValue=storageOptsFromLoad===null||storageOptsFromLoad===void 0?void 0:storageOptsFromLoad.migrate;var finalMigrationVal=configuredMigrationValue&&storageEncryptionVersion===DEFAULT_STORAGE_ENCRYPTION_VERSION;if(configuredMigrationValue===true&&finalMigrationVal!==configuredMigrationValue){logger===null||logger===void 0||logger.warn(STORAGE_DATA_MIGRATION_OVERRIDE_WARNING(CONFIG_MANAGER,storageEncryptionVersion,DEFAULT_STORAGE_ENCRYPTION_VERSION));}n(function(){state.storage.type.value=storageType;state.storage.cookie.value=storageOptsFromLoad===null||storageOptsFromLoad===void 0?void 0:storageOptsFromLoad.cookie;state.storage.encryptionPluginName.value=StorageEncryptionVersionsToPluginNameMap[storageEncryptionVersion];state.storage.migrate.value=finalMigrationVal;});};var
|
3212
|
-
var
|
3213
|
-
|
3214
|
-
|
3269
|
+
var configuredMigrationValue=storageOptsFromLoad===null||storageOptsFromLoad===void 0?void 0:storageOptsFromLoad.migrate;var finalMigrationVal=configuredMigrationValue&&storageEncryptionVersion===DEFAULT_STORAGE_ENCRYPTION_VERSION;if(configuredMigrationValue===true&&finalMigrationVal!==configuredMigrationValue){logger===null||logger===void 0||logger.warn(STORAGE_DATA_MIGRATION_OVERRIDE_WARNING(CONFIG_MANAGER,storageEncryptionVersion,DEFAULT_STORAGE_ENCRYPTION_VERSION));}n(function(){state.storage.type.value=storageType;state.storage.cookie.value=storageOptsFromLoad===null||storageOptsFromLoad===void 0?void 0:storageOptsFromLoad.cookie;state.storage.encryptionPluginName.value=StorageEncryptionVersionsToPluginNameMap[storageEncryptionVersion];state.storage.migrate.value=finalMigrationVal;});};var updateConsentsStateFromLoadOptions=function updateConsentsStateFromLoadOptions(logger){var _preConsentOpts$stora,_preConsentOpts$stora2,_preConsentOpts$event,_preConsentOpts$event2;var _getConsentManagement=getConsentManagementData(state.loadOptions.value.consentManagement,logger),provider=_getConsentManagement.provider,consentManagerPluginName=_getConsentManagement.consentManagerPluginName,initialized=_getConsentManagement.initialized,enabled=_getConsentManagement.enabled,consentsData=_getConsentManagement.consentsData;// Pre-consent
|
3270
|
+
var preConsentOpts=state.loadOptions.value.preConsent;var storageStrategy=(_preConsentOpts$stora=preConsentOpts===null||preConsentOpts===void 0||(_preConsentOpts$stora2=preConsentOpts.storage)===null||_preConsentOpts$stora2===void 0?void 0:_preConsentOpts$stora2.strategy)!==null&&_preConsentOpts$stora!==void 0?_preConsentOpts$stora:DEFAULT_PRE_CONSENT_STORAGE_STRATEGY;var StorageStrategies=['none','session','anonymousId'];if(isDefined(storageStrategy)&&!StorageStrategies.includes(storageStrategy)){var _preConsentOpts$stora3;storageStrategy=DEFAULT_PRE_CONSENT_STORAGE_STRATEGY;logger===null||logger===void 0||logger.warn(UNSUPPORTED_PRE_CONSENT_STORAGE_STRATEGY(CONFIG_MANAGER,preConsentOpts===null||preConsentOpts===void 0||(_preConsentOpts$stora3=preConsentOpts.storage)===null||_preConsentOpts$stora3===void 0?void 0:_preConsentOpts$stora3.strategy,DEFAULT_PRE_CONSENT_STORAGE_STRATEGY));}var eventsDeliveryType=(_preConsentOpts$event=preConsentOpts===null||preConsentOpts===void 0||(_preConsentOpts$event2=preConsentOpts.events)===null||_preConsentOpts$event2===void 0?void 0:_preConsentOpts$event2.delivery)!==null&&_preConsentOpts$event!==void 0?_preConsentOpts$event:DEFAULT_PRE_CONSENT_EVENTS_DELIVERY_TYPE;var deliveryTypes=['immediate','buffer'];if(isDefined(eventsDeliveryType)&&!deliveryTypes.includes(eventsDeliveryType)){var _preConsentOpts$event3;eventsDeliveryType=DEFAULT_PRE_CONSENT_EVENTS_DELIVERY_TYPE;logger===null||logger===void 0||logger.warn(UNSUPPORTED_PRE_CONSENT_EVENTS_DELIVERY_TYPE(CONFIG_MANAGER,preConsentOpts===null||preConsentOpts===void 0||(_preConsentOpts$event3=preConsentOpts.events)===null||_preConsentOpts$event3===void 0?void 0:_preConsentOpts$event3.delivery,DEFAULT_PRE_CONSENT_EVENTS_DELIVERY_TYPE));}n(function(){var _state$loadOptions$va;state.consents.activeConsentManagerPluginName.value=consentManagerPluginName;state.consents.initialized.value=initialized;state.consents.enabled.value=enabled;state.consents.data.value=consentsData;state.consents.provider.value=provider;state.consents.preConsent.value={// Only enable pre-consent if it is explicitly enabled and
|
3271
|
+
// if it is not already initialized and
|
3272
|
+
// if consent management is enabled
|
3273
|
+
enabled:((_state$loadOptions$va=state.loadOptions.value.preConsent)===null||_state$loadOptions$va===void 0?void 0:_state$loadOptions$va.enabled)===true&&initialized===false&&enabled===true,storage:{strategy:storageStrategy},events:{delivery:eventsDeliveryType}};});};/**
|
3274
|
+
* Determines the consent management state variables from the source config data
|
3275
|
+
* @param resp Source config response
|
3276
|
+
* @param logger Logger instance
|
3277
|
+
*/var updateConsentsState=function updateConsentsState(resp){var resolutionStrategy=state.consents.resolutionStrategy.value;var cmpMetadata;if(isObjectLiteralAndNotNull(resp.consentManagementMetadata)){if(state.consents.provider.value){var _resp$consentManageme,_resp$consentManageme2;resolutionStrategy=(_resp$consentManageme=(_resp$consentManageme2=resp.consentManagementMetadata.providers.find(function(p){return p.provider===state.consents.provider.value;}))===null||_resp$consentManageme2===void 0?void 0:_resp$consentManageme2.resolutionStrategy)!==null&&_resp$consentManageme!==void 0?_resp$consentManageme:state.consents.resolutionStrategy.value;}cmpMetadata=resp.consentManagementMetadata;}// If the provider is custom, then the resolution strategy is not applicable
|
3278
|
+
if(state.consents.provider.value==='custom'){resolutionStrategy=undefined;}n(function(){state.consents.metadata.value=clone$1(cmpMetadata);state.consents.resolutionStrategy.value=resolutionStrategy;});};
|
3215
3279
|
|
3216
3280
|
/**
|
3217
3281
|
* A function that determines integration SDK loading path
|
@@ -3233,9 +3297,9 @@ var sdkURL=getSDKUrl();pluginsCDNPath=sdkURL&&isString(sdkURL)?sdkURL.split('/')
|
|
3233
3297
|
var ConfigManager=/*#__PURE__*/function(){function ConfigManager(httpClient,errorHandler,logger){_classCallCheck(this,ConfigManager);_defineProperty(this,"hasErrorHandler",false);this.errorHandler=errorHandler;this.logger=logger;this.httpClient=httpClient;this.hasErrorHandler=Boolean(this.errorHandler);this.onError=this.onError.bind(this);this.processConfig=this.processConfig.bind(this);}_createClass(ConfigManager,[{key:"attachEffects",value:function attachEffects(){var _this=this;O(function(){var _this$logger;(_this$logger=_this.logger)===null||_this$logger===void 0||_this$logger.setMinLogLevel(state.lifecycle.logLevel.value);});}/**
|
3234
3298
|
* A function to validate, construct and store loadOption, lifecycle, source and destination
|
3235
3299
|
* config related information in global state
|
3236
|
-
*/},{key:"init",value:function init(){var _this2=this;this.attachEffects();
|
3300
|
+
*/},{key:"init",value:function init(){var _this2=this;this.attachEffects();validateLoadArgs(state.lifecycle.writeKey.value,state.lifecycle.dataPlaneUrl.value);var lockIntegrationsVersion=state.loadOptions.value.lockIntegrationsVersion;// determine the path to fetch integration SDK from
|
3237
3301
|
var intgCdnUrl=getIntegrationsCDNPath(APP_VERSION,lockIntegrationsVersion,state.loadOptions.value.destSDKBaseURL);// determine the path to fetch remote plugins from
|
3238
|
-
var pluginsCDNPath=getPluginsCDNPath(state.loadOptions.value.pluginsSDKBaseURL);
|
3302
|
+
var pluginsCDNPath=getPluginsCDNPath(state.loadOptions.value.pluginsSDKBaseURL);updateStorageStateFromLoadOptions(this.logger);updateConsentsStateFromLoadOptions(this.logger);// set application lifecycle state in global state
|
3239
3303
|
n(function(){state.lifecycle.integrationsCDNPath.value=intgCdnUrl;state.lifecycle.pluginsCDNPath.value=pluginsCDNPath;if(state.loadOptions.value.logLevel){state.lifecycle.logLevel.value=state.loadOptions.value.logLevel;}state.lifecycle.sourceConfigUrl.value=getSourceConfigURL(state.loadOptions.value.configUrl,state.lifecycle.writeKey.value,lockIntegrationsVersion,_this2.logger);});this.getConfig();}/**
|
3240
3304
|
* Handle errors
|
3241
3305
|
*/},{key:"onError",value:function onError(error,customMessage,shouldAlwaysThrow){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0||_this$errorHandler.onError(error,CONFIG_MANAGER,customMessage,shouldAlwaysThrow);}else {throw error;}}/**
|
@@ -3243,13 +3307,13 @@ n(function(){state.lifecycle.integrationsCDNPath.value=intgCdnUrl;state.lifecycl
|
|
3243
3307
|
* Use to construct and store information that are dependent on the sourceConfig.
|
3244
3308
|
*/},{key:"processConfig",value:function processConfig(response,details){// TODO: add retry logic with backoff based on rejectionDetails.xhr.status
|
3245
3309
|
// We can use isErrRetryable utility method
|
3246
|
-
if(!response){this.onError(SOURCE_CONFIG_FETCH_ERROR(details===null||details===void 0?void 0:details.error));return;}var res;
|
3310
|
+
if(!response){this.onError(SOURCE_CONFIG_FETCH_ERROR(details===null||details===void 0?void 0:details.error));return;}var res;try{if(isString(response)){res=JSON.parse(response);}else {res=response;}}catch(err){this.onError(err,SOURCE_CONFIG_RESOLUTION_ERROR,true);return;}if(!isValidSourceConfig(res)){this.onError(new Error(SOURCE_CONFIG_RESOLUTION_ERROR),undefined,true);return;}// set the values in state for reporting slice
|
3247
3311
|
updateReportingState(res,this.logger);// determine the dataPlane url
|
3248
3312
|
var dataPlaneUrl=resolveDataPlaneUrl(res.source.dataplanes,state.lifecycle.dataPlaneUrl.value,state.loadOptions.value.residencyServer,this.logger);if(!dataPlaneUrl){this.onError(new Error(DATA_PLANE_URL_ERROR),undefined,true);return;}var nativeDestinations=res.source.destinations.length>0?filterEnabledDestination(res.source.destinations):[];// set in the state --> source, destination, lifecycle, reporting
|
3249
3313
|
n(function(){var _state$loadOptions$va;// set source related information in state
|
3250
3314
|
state.source.value={config:res.source.config,id:res.source.id};// set device mode destination related information in state
|
3251
3315
|
state.nativeDestinations.configuredDestinations.value=nativeDestinations;// set the desired optional plugins
|
3252
|
-
state.plugins.pluginsToLoadFromConfig.value=(_state$loadOptions$va=state.loadOptions.value.plugins)!==null&&_state$loadOptions$va!==void 0?_state$loadOptions$va:[];// set application lifecycle state
|
3316
|
+
state.plugins.pluginsToLoadFromConfig.value=(_state$loadOptions$va=state.loadOptions.value.plugins)!==null&&_state$loadOptions$va!==void 0?_state$loadOptions$va:[];updateConsentsState(res);// set application lifecycle state
|
3253
3317
|
// Cast to string as we are sure that the value is not undefined
|
3254
3318
|
state.lifecycle.activeDataplaneUrl.value=removeTrailingSlashes(dataPlaneUrl);state.lifecycle.status.value='configured';});}/**
|
3255
3319
|
* A function to fetch source config either from /sourceConfig endpoint
|
@@ -3259,6 +3323,12 @@ state.lifecycle.activeDataplaneUrl.value=removeTrailingSlashes(dataPlaneUrl);sta
|
|
3259
3323
|
var res=sourceConfigFunc();if(res instanceof Promise){res.then(function(pRes){return _this3.processConfig(pRes);}).catch(function(err){_this3.onError(err,'SourceConfig');});}else {this.processConfig(res);}}else {// fetch source config from config url API
|
3260
3324
|
this.httpClient.getAsyncData({url:state.lifecycle.sourceConfigUrl.value,options:{headers:{'Content-Type':undefined}},callback:this.processConfig});}}}]);return ConfigManager;}();
|
3261
3325
|
|
3326
|
+
/**
|
3327
|
+
* To get the timezone of the user
|
3328
|
+
*
|
3329
|
+
* @returns string
|
3330
|
+
*/var getTimezone=function getTimezone(){var timezone=new Date().toString().match(/([A-Z]+[+-]\d+)/);return timezone&&timezone[1]?timezone[1]:'NA';};
|
3331
|
+
|
3262
3332
|
/**
|
3263
3333
|
* Get the referrer URL
|
3264
3334
|
* @returns The referrer URL
|
@@ -3286,15 +3356,15 @@ var CapabilitiesManager=/*#__PURE__*/function(){function CapabilitiesManager(err
|
|
3286
3356
|
},{key:"detectBrowserCapabilities",value:function detectBrowserCapabilities(){var _this=this;n(function(){// Storage related details
|
3287
3357
|
state.capabilities.storage.isCookieStorageAvailable.value=isStorageAvailable(COOKIE_STORAGE,getStorageEngine(COOKIE_STORAGE),_this.logger);state.capabilities.storage.isLocalStorageAvailable.value=isStorageAvailable(LOCAL_STORAGE,undefined,_this.logger);state.capabilities.storage.isSessionStorageAvailable.value=isStorageAvailable(SESSION_STORAGE,undefined,_this.logger);// Browser feature detection details
|
3288
3358
|
state.capabilities.isBeaconAvailable.value=hasBeacon();state.capabilities.isUaCHAvailable.value=hasUAClientHints();state.capabilities.isCryptoAvailable.value=hasCrypto();state.capabilities.isIE11.value=isIE11();state.capabilities.isOnline.value=globalThis.navigator.onLine;// Get page context details
|
3289
|
-
state.context.userAgent.value=getUserAgent();state.context.locale.value=getLanguage();state.context.screen.value=getScreenDetails();if(hasUAClientHints()){getUserAgentClientHint(function(uach){state.context['ua-ch'].value=uach;},state.loadOptions.value.uaChTrackLevel);}});// Ad blocker detection
|
3359
|
+
state.context.userAgent.value=getUserAgent();state.context.locale.value=getLanguage();state.context.screen.value=getScreenDetails();state.context.timezone.value=getTimezone();if(hasUAClientHints()){getUserAgentClientHint(function(uach){state.context['ua-ch'].value=uach;},state.loadOptions.value.uaChTrackLevel);}});// Ad blocker detection
|
3290
3360
|
O(function(){if(state.loadOptions.value.sendAdblockPage===true&&state.lifecycle.sourceConfigUrl.value!==undefined){detectAdBlockers(_this.errorHandler,_this.logger);}});}/**
|
3291
3361
|
* Detect if polyfills are required and then load script from polyfill URL
|
3292
|
-
*/},{key:"prepareBrowserCapabilities",value:function prepareBrowserCapabilities(){var _state$loadOptions$va,_this2=this;state.capabilities.isLegacyDOM.value=isLegacyJSEngine();var polyfillUrl=(_state$loadOptions$va=state.loadOptions.value.polyfillURL)!==null&&_state$loadOptions$va!==void 0?_state$loadOptions$va:POLYFILL_URL;var shouldLoadPolyfill=state.loadOptions.value.polyfillIfRequired&&state.capabilities.isLegacyDOM.value&&Boolean(polyfillUrl);if(shouldLoadPolyfill){var _this$externalSrcLoad;var isDefaultPolyfillService=polyfillUrl!==state.loadOptions.value.polyfillURL;if(isDefaultPolyfillService){
|
3362
|
+
*/},{key:"prepareBrowserCapabilities",value:function prepareBrowserCapabilities(){var _state$loadOptions$va,_this2=this;state.capabilities.isLegacyDOM.value=isLegacyJSEngine();var polyfillUrl=(_state$loadOptions$va=state.loadOptions.value.polyfillURL)!==null&&_state$loadOptions$va!==void 0?_state$loadOptions$va:POLYFILL_URL;var shouldLoadPolyfill=state.loadOptions.value.polyfillIfRequired&&state.capabilities.isLegacyDOM.value&&Boolean(polyfillUrl);if(shouldLoadPolyfill){var _this$externalSrcLoad;var isDefaultPolyfillService=polyfillUrl!==state.loadOptions.value.polyfillURL;if(isDefaultPolyfillService){// write key specific callback
|
3293
3363
|
// NOTE: we're not putting this into RudderStackGlobals as providing the property path to the callback function in the polyfill URL is not possible
|
3294
|
-
var polyfillCallbackName="RS_polyfillCallback_".concat(state.lifecycle.writeKey.value);
|
3364
|
+
var polyfillCallbackName="RS_polyfillCallback_".concat(state.lifecycle.writeKey.value);var polyfillCallback=function polyfillCallback(){_this2.onReady();// Remove the entry from window so we don't leave room for calling it again
|
3365
|
+
delete globalThis[polyfillCallbackName];};globalThis[polyfillCallbackName]=polyfillCallback;polyfillUrl="".concat(polyfillUrl,"&callback=").concat(polyfillCallbackName);}(_this$externalSrcLoad=this.externalSrcLoader)===null||_this$externalSrcLoad===void 0||_this$externalSrcLoad.loadJSFile({url:polyfillUrl,id:POLYFILL_SCRIPT_ID,async:true,timeout:POLYFILL_LOAD_TIMEOUT,callback:function callback(scriptId){if(!scriptId){_this2.onError(new Error(POLYFILL_SCRIPT_LOAD_ERROR(POLYFILL_SCRIPT_ID,polyfillUrl)));}else if(!isDefaultPolyfillService){_this2.onReady();}}});}else {this.onReady();}}/**
|
3295
3366
|
* Attach listeners to window to observe event that update capabilities state values
|
3296
|
-
*/
|
3297
|
-
},{key:"attachWindowListeners",value:function attachWindowListeners(){globalThis.addEventListener('offline',function(){state.capabilities.isOnline.value=false;});globalThis.addEventListener('online',function(){state.capabilities.isOnline.value=true;});globalThis.addEventListener('resize',debounce(function(){state.context.screen.value=getScreenDetails();},this));}/**
|
3367
|
+
*/},{key:"attachWindowListeners",value:function attachWindowListeners(){globalThis.addEventListener('offline',function(){state.capabilities.isOnline.value=false;});globalThis.addEventListener('online',function(){state.capabilities.isOnline.value=true;});globalThis.addEventListener('resize',debounce(function(){state.context.screen.value=getScreenDetails();},this));}/**
|
3298
3368
|
* Set the lifecycle status to next phase
|
3299
3369
|
*/ // eslint-disable-next-line class-methods-use-this
|
3300
3370
|
},{key:"onReady",value:function onReady(){this.detectBrowserCapabilities();state.lifecycle.status.value='browserCapabilitiesReady';}/**
|
@@ -3308,6 +3378,33 @@ var TOP_LEVEL_ELEMENTS=['integrations','anonymousId','originalTimestamp'];// Res
|
|
3308
3378
|
var CONTEXT_RESERVED_ELEMENTS=['library','consentManagement','userAgent','ua-ch','screen'];// Reserved elements in the standard RudderStack event spec
|
3309
3379
|
var RESERVED_ELEMENTS=['anonymousId','sentAt','receivedAt','timestamp','originalTimestamp','event','messageId','channel'];
|
3310
3380
|
|
3381
|
+
var MIN_SESSION_ID_LENGTH=10;/**
|
3382
|
+
* A function to validate current session and return true/false depending on that
|
3383
|
+
* @returns boolean
|
3384
|
+
*/var hasSessionExpired=function hasSessionExpired(expiresAt){var timestamp=Date.now();return Boolean(!expiresAt||timestamp>expiresAt);};/**
|
3385
|
+
* A function to generate session id
|
3386
|
+
* @returns number
|
3387
|
+
*/var generateSessionId=function generateSessionId(){return Date.now();};/**
|
3388
|
+
* Function to validate user provided sessionId
|
3389
|
+
* @param {number} sessionId
|
3390
|
+
* @param logger logger
|
3391
|
+
* @returns
|
3392
|
+
*/var isManualSessionIdValid=function isManualSessionIdValid(sessionId,logger){if(!sessionId||!isPositiveInteger(sessionId)||!hasMinLength(MIN_SESSION_ID_LENGTH,sessionId)){logger===null||logger===void 0||logger.warn(INVALID_SESSION_ID_WARNING(USER_SESSION_MANAGER,sessionId,MIN_SESSION_ID_LENGTH));return false;}return true;};/**
|
3393
|
+
* A function to generate new auto tracking session
|
3394
|
+
* @param sessionTimeout current timestamp
|
3395
|
+
* @returns SessionInfo
|
3396
|
+
*/var generateAutoTrackingSession=function generateAutoTrackingSession(sessionTimeout){var timestamp=Date.now();var timeout=sessionTimeout||DEFAULT_SESSION_TIMEOUT_MS;return {id:timestamp,// set the current timestamp
|
3397
|
+
expiresAt:timestamp+timeout,// set the expiry time of the session
|
3398
|
+
timeout:timeout,sessionStart:undefined,autoTrack:true};};/**
|
3399
|
+
* A function to generate new manual tracking session
|
3400
|
+
* @param id Provided sessionId
|
3401
|
+
* @param logger Logger module
|
3402
|
+
* @returns SessionInfo
|
3403
|
+
*/var generateManualTrackingSession=function generateManualTrackingSession(id,logger){var sessionId=isManualSessionIdValid(id,logger)?id:generateSessionId();return {id:sessionId,sessionStart:undefined,manualTrack:true};};var isStorageTypeValidForStoringData=function isStorageTypeValidForStoringData(storageType){return Boolean(storageType===COOKIE_STORAGE||storageType===LOCAL_STORAGE||storageType===SESSION_STORAGE||storageType===MEMORY_STORAGE);};/**
|
3404
|
+
* Generate a new anonymousId
|
3405
|
+
* @returns string anonymousID
|
3406
|
+
*/var generateAnonymousId=function generateAnonymousId(){return generateUUID();};
|
3407
|
+
|
3311
3408
|
/**
|
3312
3409
|
* To get the page properties for context object
|
3313
3410
|
* @param pageProps Page properties
|
@@ -3333,7 +3430,7 @@ var properties=rudderEvent.properties,traits=rudderEvent.traits,context=rudderEv
|
|
3333
3430
|
* @param rudderEvent Generated rudder event
|
3334
3431
|
* @param options API options
|
3335
3432
|
*/var updateTopLevelEventElements=function updateTopLevelEventElements(rudderEvent,options){if(options.anonymousId&&isString(options.anonymousId)){// eslint-disable-next-line no-param-reassign
|
3336
|
-
rudderEvent.anonymousId=options.anonymousId;}if(
|
3433
|
+
rudderEvent.anonymousId=options.anonymousId;}if(isObjectLiteralAndNotNull(options.integrations)){// eslint-disable-next-line no-param-reassign
|
3337
3434
|
rudderEvent.integrations=options.integrations;}if(options.originalTimestamp&&isString(options.originalTimestamp)){// eslint-disable-next-line no-param-reassign
|
3338
3435
|
rudderEvent.originalTimestamp=options.originalTimestamp;}};/**
|
3339
3436
|
* To merge the contextual information in API options with existing data
|
@@ -3343,25 +3440,25 @@ rudderEvent.originalTimestamp=options.originalTimestamp;}};/**
|
|
3343
3440
|
*/var getMergedContext=function getMergedContext(rudderContext,options,logger){var context=rudderContext;Object.keys(options).forEach(function(key){if(!TOP_LEVEL_ELEMENTS.includes(key)&&!CONTEXT_RESERVED_ELEMENTS.includes(key)){if(key!=='context'){context=mergeDeepRight(context,_defineProperty({},key,options[key]));}else if(!isUndefined(options[key])&&isObjectLiteralAndNotNull(options[key])){var tempContext={};Object.keys(options[key]).forEach(function(e){if(!CONTEXT_RESERVED_ELEMENTS.includes(e)){tempContext[e]=options[key][e];}});context=mergeDeepRight(context,_objectSpread2({},tempContext));}else {logger===null||logger===void 0||logger.warn(INVALID_CONTEXT_OBJECT_WARNING(EVENT_MANAGER));}}});return context;};/**
|
3344
3441
|
* A function to determine whether SDK should use the integration option provided in load call
|
3345
3442
|
* @returns boolean
|
3346
|
-
*/var shouldUseGlobalIntegrationsConfigInEvents=function shouldUseGlobalIntegrationsConfigInEvents(){return state.loadOptions.value.useGlobalIntegrationsConfigInEvents&&isObjectLiteralAndNotNull(state.nativeDestinations.loadOnlyIntegrations.value);};/**
|
3443
|
+
*/var shouldUseGlobalIntegrationsConfigInEvents=function shouldUseGlobalIntegrationsConfigInEvents(){var _state$consents$postC;return state.loadOptions.value.useGlobalIntegrationsConfigInEvents&&(isObjectLiteralAndNotNull((_state$consents$postC=state.consents.postConsent.value)===null||_state$consents$postC===void 0?void 0:_state$consents$postC.integrations)||isObjectLiteralAndNotNull(state.nativeDestinations.loadOnlyIntegrations.value));};/**
|
3347
3444
|
* Updates rudder event object with data from the API options
|
3348
3445
|
* @param rudderEvent Generated rudder event
|
3349
3446
|
* @param options API options
|
3350
3447
|
*/var processOptions=function processOptions(rudderEvent,options){// Only allow object type for options
|
3351
|
-
if(
|
3448
|
+
if(isObjectLiteralAndNotNull(options)){updateTopLevelEventElements(rudderEvent,options);// eslint-disable-next-line no-param-reassign
|
3352
3449
|
rudderEvent.context=getMergedContext(rudderEvent.context,options);}};/**
|
3353
3450
|
* Returns the final integrations config for the event based on the global config and event's config
|
3354
3451
|
* @param integrationsConfig Event's integrations config
|
3355
3452
|
* @returns Final integrations config
|
3356
|
-
*/var getEventIntegrationsConfig=function getEventIntegrationsConfig(integrationsConfig){var finalIntgConfig;if(shouldUseGlobalIntegrationsConfigInEvents()){finalIntgConfig=state.nativeDestinations.loadOnlyIntegrations.value;}else if(isObjectLiteralAndNotNull(integrationsConfig)){finalIntgConfig=integrationsConfig;}else {finalIntgConfig=DEFAULT_INTEGRATIONS_CONFIG;}return finalIntgConfig;};/**
|
3453
|
+
*/var getEventIntegrationsConfig=function getEventIntegrationsConfig(integrationsConfig){var finalIntgConfig;if(shouldUseGlobalIntegrationsConfigInEvents()){var _state$consents$postC2,_state$consents$postC3;finalIntgConfig=clone$1((_state$consents$postC2=(_state$consents$postC3=state.consents.postConsent.value)===null||_state$consents$postC3===void 0?void 0:_state$consents$postC3.integrations)!==null&&_state$consents$postC2!==void 0?_state$consents$postC2:state.nativeDestinations.loadOnlyIntegrations.value);}else if(isObjectLiteralAndNotNull(integrationsConfig)){finalIntgConfig=integrationsConfig;}else {finalIntgConfig=DEFAULT_INTEGRATIONS_CONFIG;}return finalIntgConfig;};/**
|
3357
3454
|
* Enrich the base event object with data from state and the API options
|
3358
3455
|
* @param rudderEvent RudderEvent object
|
3359
3456
|
* @param options API options
|
3360
3457
|
* @param pageProps Page properties
|
3361
3458
|
* @param logger logger
|
3362
3459
|
* @returns Enriched RudderEvent object
|
3363
|
-
*/var getEnrichedEvent=function getEnrichedEvent(rudderEvent,options,pageProps,logger){var _state$storage$entrie;var commonEventData={channel:CHANNEL,context:{traits:clone$1(state.session.userTraits.value),sessionId:state.session.sessionInfo.value.id||undefined,sessionStart:state.session.sessionInfo.value.sessionStart||undefined,consentManagement:{deniedConsentIds:clone$1(state.consents.data.value.deniedConsentIds)},'ua-ch':state.context['ua-ch'].value,app:state.context.app.value,library:state.context.library.value,userAgent:state.context.userAgent.value,os:state.context.os.value,locale:state.context.locale.value,screen:state.context.screen.value,campaign:extractUTMParameters(globalThis.location.href),page:getContextPageProperties(pageProps)},originalTimestamp:getCurrentTimeFormatted(),integrations:DEFAULT_INTEGRATIONS_CONFIG,messageId:generateUUID(),userId:rudderEvent.userId||state.session.userId.value};if(((_state$storage$entrie=state.storage.entries.value.anonymousId)===null||_state$storage$entrie===void 0?void 0:_state$storage$entrie.type)
|
3364
|
-
commonEventData.anonymousId=
|
3460
|
+
*/var getEnrichedEvent=function getEnrichedEvent(rudderEvent,options,pageProps,logger){var _state$storage$entrie;var commonEventData={channel:CHANNEL,context:_objectSpread2(_objectSpread2({traits:clone$1(state.session.userTraits.value),sessionId:state.session.sessionInfo.value.id||undefined,sessionStart:state.session.sessionInfo.value.sessionStart||undefined},state.consents.enabled.value&&{consentManagement:{deniedConsentIds:clone$1(state.consents.data.value.deniedConsentIds),allowedConsentIds:clone$1(state.consents.data.value.allowedConsentIds),provider:state.consents.provider.value,resolutionStrategy:state.consents.resolutionStrategy.value}}),{},{'ua-ch':state.context['ua-ch'].value,app:state.context.app.value,library:state.context.library.value,userAgent:state.context.userAgent.value,os:state.context.os.value,locale:state.context.locale.value,screen:state.context.screen.value,campaign:extractUTMParameters(globalThis.location.href),page:getContextPageProperties(pageProps),timezone:state.context.timezone.value}),originalTimestamp:getCurrentTimeFormatted(),integrations:DEFAULT_INTEGRATIONS_CONFIG,messageId:generateUUID(),userId:rudderEvent.userId||state.session.userId.value};if(!isStorageTypeValidForStoringData((_state$storage$entrie=state.storage.entries.value.anonymousId)===null||_state$storage$entrie===void 0?void 0:_state$storage$entrie.type)){// Generate new anonymous id for each request
|
3461
|
+
commonEventData.anonymousId=generateAnonymousId();}else {// Type casting to string as the user session manager will take care of initializing the value
|
3365
3462
|
commonEventData.anonymousId=state.session.anonymousId.value;}// set truly anonymous tracking flag
|
3366
3463
|
if(state.storage.trulyAnonymousTracking.value){commonEventData.context.trulyAnonymousTracking=true;}if(rudderEvent.type==='identify'){var _state$storage$entrie2;commonEventData.context.traits=((_state$storage$entrie2=state.storage.entries.value.userTraits)===null||_state$storage$entrie2===void 0?void 0:_state$storage$entrie2.type)!==NO_STORAGE?clone$1(state.session.userTraits.value):rudderEvent.context.traits;}if(rudderEvent.type==='group'){if(rudderEvent.groupId||state.session.groupId.value){commonEventData.groupId=rudderEvent.groupId||state.session.groupId.value;}if(rudderEvent.traits||state.session.groupTraits.value){var _state$storage$entrie3;commonEventData.traits=((_state$storage$entrie3=state.storage.entries.value.groupTraits)===null||_state$storage$entrie3===void 0?void 0:_state$storage$entrie3.type)!==NO_STORAGE?clone$1(state.session.groupTraits.value):rudderEvent.traits;}}var processedEvent=mergeDeepRight(rudderEvent,commonEventData);// Set the default values for the event properties
|
3367
3464
|
// matching with v1.1 payload
|
@@ -3411,7 +3508,7 @@ enrichedEvent.userId=to!==null&&to!==void 0?to:enrichedEvent.userId;return enric
|
|
3411
3508
|
* @param logger Logger object
|
3412
3509
|
*/function EventManager(eventRepository,userSessionManager,errorHandler,logger){_classCallCheck(this,EventManager);this.eventRepository=eventRepository;this.userSessionManager=userSessionManager;this.errorHandler=errorHandler;this.logger=logger;this.eventFactory=new RudderEventFactory(this.logger);this.onError=this.onError.bind(this);}/**
|
3413
3510
|
* Initializes the event manager
|
3414
|
-
*/_createClass(EventManager,[{key:"init",value:function init(){this.eventRepository.init();}/**
|
3511
|
+
*/_createClass(EventManager,[{key:"init",value:function init(){this.eventRepository.init();}},{key:"resume",value:function resume(){this.eventRepository.resume();}/**
|
3415
3512
|
* Consumes a new incoming event
|
3416
3513
|
* @param event Incoming event data
|
3417
3514
|
*/},{key:"addEvent",value:function addEvent(event){this.userSessionManager.refreshSession();var rudderEvent=this.eventFactory.create(event);if(rudderEvent){this.eventRepository.enqueue(rudderEvent,event.callback);}else {this.onError(new Error(EVENT_OBJECT_GENERATION_ERROR));}}/**
|
@@ -3419,139 +3516,98 @@ enrichedEvent.userId=to!==null&&to!==void 0?to:enrichedEvent.userId;return enric
|
|
3419
3516
|
* @param error The error object
|
3420
3517
|
*/},{key:"onError",value:function onError(error,customMessage,shouldAlwaysThrow){if(this.errorHandler){this.errorHandler.onError(error,EVENT_MANAGER,customMessage,shouldAlwaysThrow);}else {throw error;}}}]);return EventManager;}();
|
3421
3518
|
|
3422
|
-
var MIN_SESSION_ID_LENGTH=10;/**
|
3423
|
-
* A function to validate current session and return true/false depending on that
|
3424
|
-
* @returns boolean
|
3425
|
-
*/var hasSessionExpired=function hasSessionExpired(expiresAt){var timestamp=Date.now();return Boolean(!expiresAt||timestamp>expiresAt);};/**
|
3426
|
-
* A function to generate session id
|
3427
|
-
* @returns number
|
3428
|
-
*/var generateSessionId=function generateSessionId(){return Date.now();};/**
|
3429
|
-
* Function to validate user provided sessionId
|
3430
|
-
* @param {number} sessionId
|
3431
|
-
* @param logger logger
|
3432
|
-
* @returns
|
3433
|
-
*/var isManualSessionIdValid=function isManualSessionIdValid(sessionId,logger){if(!sessionId||!isPositiveInteger(sessionId)||!hasMinLength(MIN_SESSION_ID_LENGTH,sessionId)){logger===null||logger===void 0||logger.warn(INVALID_SESSION_ID_WARNING(USER_SESSION_MANAGER,sessionId,MIN_SESSION_ID_LENGTH));return false;}return true;};/**
|
3434
|
-
* A function to generate new auto tracking session
|
3435
|
-
* @param sessionTimeout current timestamp
|
3436
|
-
* @returns SessionInfo
|
3437
|
-
*/var generateAutoTrackingSession=function generateAutoTrackingSession(sessionTimeout){var timestamp=Date.now();var timeout=sessionTimeout||DEFAULT_SESSION_TIMEOUT_MS;return {id:timestamp,// set the current timestamp
|
3438
|
-
expiresAt:timestamp+timeout,// set the expiry time of the session
|
3439
|
-
timeout:timeout,sessionStart:undefined,autoTrack:true};};/**
|
3440
|
-
* A function to generate new manual tracking session
|
3441
|
-
* @param id Provided sessionId
|
3442
|
-
* @param logger Logger module
|
3443
|
-
* @returns SessionInfo
|
3444
|
-
*/var generateManualTrackingSession=function generateManualTrackingSession(id,logger){var sessionId=isManualSessionIdValid(id,logger)?id:generateSessionId();return {id:sessionId,sessionStart:undefined,manualTrack:true};};var isStorageTypeValidForStoringData=function isStorageTypeValidForStoringData(storageType){return Boolean(storageType===COOKIE_STORAGE||storageType===LOCAL_STORAGE||storageType===SESSION_STORAGE||storageType===MEMORY_STORAGE);};
|
3445
|
-
|
3446
3519
|
var UserSessionManager=/*#__PURE__*/function(){function UserSessionManager(errorHandler,logger,pluginsManager,storeManager){_classCallCheck(this,UserSessionManager);this.storeManager=storeManager;this.pluginsManager=pluginsManager;this.logger=logger;this.errorHandler=errorHandler;this.onError=this.onError.bind(this);}/**
|
3447
3520
|
* Initialize User session with values from storage
|
3448
|
-
*/_createClass(UserSessionManager,[{key:"init",value:function init(){this.
|
3449
|
-
|
3450
|
-
if(this.isPersistenceEnabledForStorageEntry('sessionInfo')){this.
|
3451
|
-
|
3452
|
-
|
3453
|
-
|
3521
|
+
*/_createClass(UserSessionManager,[{key:"init",value:function init(){this.syncStorageDataToState();// Register the effect to sync with storage
|
3522
|
+
this.registerEffects();}},{key:"syncStorageDataToState",value:function syncStorageDataToState(){this.migrateStorageIfNeeded();this.migrateDataFromPreviousStorage();// get the values from storage and set it again
|
3523
|
+
this.setUserId(this.getUserId());this.setUserTraits(this.getUserTraits());this.setGroupId(this.getGroupId());this.setGroupTraits(this.getGroupTraits());this.setAnonymousId(this.getAnonymousId(state.loadOptions.value.anonymousIdOptions));this.setAuthToken(this.getAuthToken());this.setInitialReferrerInfo();this.configureSessionTracking();}},{key:"configureSessionTracking",value:function configureSessionTracking(){var sessionInfo=this.getSessionInfo();if(this.isPersistenceEnabledForStorageEntry('sessionInfo')){var _this$getSessionInfo;var configuredSessionTrackingInfo=this.getConfiguredSessionTrackingInfo();var persistedSessionInfo=(_this$getSessionInfo=this.getSessionInfo())!==null&&_this$getSessionInfo!==void 0?_this$getSessionInfo:defaultSessionInfo;sessionInfo=_objectSpread2(_objectSpread2(_objectSpread2({},persistedSessionInfo),configuredSessionTrackingInfo),{},{autoTrack:configuredSessionTrackingInfo.autoTrack&&persistedSessionInfo.manualTrack!==true});}this.setSessionInfo(sessionInfo);}},{key:"setInitialReferrerInfo",value:function setInitialReferrerInfo(){var persistedInitialReferrer=this.getInitialReferrer();var persistedInitialReferringDomain=this.getInitialReferringDomain();if(persistedInitialReferrer&&persistedInitialReferringDomain){this.setInitialReferrer(persistedInitialReferrer);this.setInitialReferringDomain(persistedInitialReferringDomain);}else {var initialReferrer=persistedInitialReferrer||getReferrer();this.setInitialReferrer(initialReferrer);this.setInitialReferringDomain(getReferringDomain(initialReferrer));}}},{key:"isPersistenceEnabledForStorageEntry",value:function isPersistenceEnabledForStorageEntry(entryName){var _state$storage$entrie;return isStorageTypeValidForStoringData((_state$storage$entrie=state.storage.entries.value[entryName])===null||_state$storage$entrie===void 0?void 0:_state$storage$entrie.type);}},{key:"migrateDataFromPreviousStorage",value:function migrateDataFromPreviousStorage(){var _this=this;var entries=state.storage.entries.value;var storageTypesForMigration=[COOKIE_STORAGE,LOCAL_STORAGE,SESSION_STORAGE];Object.keys(entries).forEach(function(entry){var _entries$key,_this$storeManager;var key=entry;var currentStorage=(_entries$key=entries[key])===null||_entries$key===void 0?void 0:_entries$key.type;var curStore=(_this$storeManager=_this.storeManager)===null||_this$storeManager===void 0?void 0:_this$storeManager.getStore(storageClientDataStoreNameMap[currentStorage]);if(curStore){storageTypesForMigration.forEach(function(storage){var _this$storeManager2;var store=(_this$storeManager2=_this.storeManager)===null||_this$storeManager2===void 0?void 0:_this$storeManager2.getStore(storageClientDataStoreNameMap[storage]);if(store&&storage!==currentStorage){var value=store.get(USER_SESSION_STORAGE_KEYS[key]);if(isDefinedNotNullAndNotEmptyString(value)){curStore.set(USER_SESSION_STORAGE_KEYS[key],value);}store.remove(USER_SESSION_STORAGE_KEYS[key]);}});}});}},{key:"migrateStorageIfNeeded",value:function migrateStorageIfNeeded(){var _this2=this;if(!state.storage.migrate.value){return;}var persistentStoreNames=[CLIENT_DATA_STORE_COOKIE,CLIENT_DATA_STORE_LS,CLIENT_DATA_STORE_SESSION];var stores=[];persistentStoreNames.forEach(function(storeName){var _this2$storeManager;var store=(_this2$storeManager=_this2.storeManager)===null||_this2$storeManager===void 0?void 0:_this2$storeManager.getStore(storeName);if(store){stores.push(store);}});Object.keys(USER_SESSION_STORAGE_KEYS).forEach(function(storageKey){var storageEntry=USER_SESSION_STORAGE_KEYS[storageKey];stores.forEach(function(store){var _this2$pluginsManager;var migratedVal=(_this2$pluginsManager=_this2.pluginsManager)===null||_this2$pluginsManager===void 0?void 0:_this2$pluginsManager.invokeSingle('storage.migrate',storageEntry,store.engine,_this2.errorHandler,_this2.logger);// Skip setting the value if it is null or undefined
|
3524
|
+
// as those values indicate there is no need for migration or
|
3525
|
+
// migration failed
|
3526
|
+
if(!isNullOrUndefined(migratedVal)){store.set(storageEntry,migratedVal);}});});}},{key:"getConfiguredSessionTrackingInfo",value:function getConfiguredSessionTrackingInfo(){var _state$loadOptions$va,_state$loadOptions$va2;var autoTrack=((_state$loadOptions$va=state.loadOptions.value.sessions)===null||_state$loadOptions$va===void 0?void 0:_state$loadOptions$va.autoTrack)!==false;// Do not validate any further if autoTrack is disabled
|
3527
|
+
if(!autoTrack){return {autoTrack:autoTrack};}var timeout;var configuredSessionTimeout=(_state$loadOptions$va2=state.loadOptions.value.sessions)===null||_state$loadOptions$va2===void 0?void 0:_state$loadOptions$va2.timeout;if(!isPositiveInteger(configuredSessionTimeout)){var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0||_this$logger.warn(TIMEOUT_NOT_NUMBER_WARNING(USER_SESSION_MANAGER,configuredSessionTimeout,DEFAULT_SESSION_TIMEOUT_MS));timeout=DEFAULT_SESSION_TIMEOUT_MS;}else {timeout=configuredSessionTimeout;}if(timeout===0){var _this$logger2;(_this$logger2=this.logger)===null||_this$logger2===void 0||_this$logger2.warn(TIMEOUT_ZERO_WARNING(USER_SESSION_MANAGER));autoTrack=false;}// In case user provides a timeout value greater than 0 but less than 10 seconds SDK will show a warning
|
3454
3528
|
// and will proceed with it
|
3455
|
-
if(
|
3456
|
-
if(state.session.sessionInfo.value.autoTrack){this.startOrRenewAutoTracking();}}/**
|
3529
|
+
if(timeout>0&&timeout<MIN_SESSION_TIMEOUT_MS){var _this$logger3;(_this$logger3=this.logger)===null||_this$logger3===void 0||_this$logger3.warn(TIMEOUT_NOT_RECOMMENDED_WARNING(USER_SESSION_MANAGER,timeout,MIN_SESSION_TIMEOUT_MS));}return {timeout:timeout,autoTrack:autoTrack};}/**
|
3457
3530
|
* Handles error
|
3458
3531
|
* @param error The error object
|
3459
3532
|
*/},{key:"onError",value:function onError(error){if(this.errorHandler){this.errorHandler.onError(error,USER_SESSION_MANAGER);}else {throw error;}}/**
|
3460
3533
|
* A function to sync values in storage
|
3461
3534
|
* @param sessionKey
|
3462
3535
|
* @param value
|
3463
|
-
*/},{key:"syncValueToStorage",value:function syncValueToStorage(sessionKey,value){var _entries$sessionKey,_entries$sessionKey2;var entries=state.storage.entries.value;var storage=(_entries$sessionKey=entries[sessionKey])===null||_entries$sessionKey===void 0?void 0:_entries$sessionKey.type;var key=(_entries$sessionKey2=entries[sessionKey])===null||_entries$sessionKey2===void 0?void 0:_entries$sessionKey2.key;if(isStorageTypeValidForStoringData(storage)){var _this$
|
3536
|
+
*/},{key:"syncValueToStorage",value:function syncValueToStorage(sessionKey,value){var _entries$sessionKey,_entries$sessionKey2;var entries=state.storage.entries.value;var storage=(_entries$sessionKey=entries[sessionKey])===null||_entries$sessionKey===void 0?void 0:_entries$sessionKey.type;var key=(_entries$sessionKey2=entries[sessionKey])===null||_entries$sessionKey2===void 0?void 0:_entries$sessionKey2.key;if(isStorageTypeValidForStoringData(storage)){var _this$storeManager3;var curStore=(_this$storeManager3=this.storeManager)===null||_this$storeManager3===void 0?void 0:_this$storeManager3.getStore(storageClientDataStoreNameMap[storage]);if(value&&isString(value)||isNonEmptyObject(value)){curStore===null||curStore===void 0||curStore.set(key,value);}else {curStore===null||curStore===void 0||curStore.remove(key);}}}/**
|
3464
3537
|
* Function to update storage whenever state value changes
|
3465
|
-
*/},{key:"registerEffects",value:function registerEffects(){var _this3=this
|
3466
|
-
|
3467
|
-
*/O(function(){_this3.syncValueToStorage('userId',state.session.userId.value);});/**
|
3468
|
-
* Update user traits in storage automatically when it is updated in state
|
3469
|
-
*/O(function(){_this3.syncValueToStorage('userTraits',state.session.userTraits.value);});/**
|
3470
|
-
* Update group id in storage automatically when it is updated in state
|
3471
|
-
*/O(function(){_this3.syncValueToStorage('groupId',state.session.groupId.value);});/**
|
3472
|
-
* Update group traits in storage automatically when it is updated in state
|
3473
|
-
*/O(function(){_this3.syncValueToStorage('groupTraits',state.session.groupTraits.value);});/**
|
3474
|
-
* Update anonymous user id in storage automatically when it is updated in state
|
3475
|
-
*/O(function(){_this3.syncValueToStorage('anonymousId',state.session.anonymousId.value);});/**
|
3476
|
-
* Update initial referrer in storage automatically when it is updated in state
|
3477
|
-
*/O(function(){_this3.syncValueToStorage('initialReferrer',state.session.initialReferrer.value);});/**
|
3478
|
-
* Update initial referring domain in storage automatically when it is updated in state
|
3479
|
-
*/O(function(){_this3.syncValueToStorage('initialReferringDomain',state.session.initialReferringDomain.value);});/**
|
3480
|
-
* Update session tracking info in storage automatically when it is updated in state
|
3481
|
-
*/O(function(){_this3.syncValueToStorage('sessionInfo',state.session.sessionInfo.value);});/**
|
3482
|
-
* Update session tracking info in storage automatically when it is updated in state
|
3483
|
-
*/O(function(){_this3.syncValueToStorage('authToken',state.session.authToken.value);});}/**
|
3538
|
+
*/},{key:"registerEffects",value:function registerEffects(){var _this3=this;// This will work as long as the user session entry key names are same as the state keys
|
3539
|
+
USER_SESSION_KEYS.forEach(function(sessionKey){O(function(){_this3.syncValueToStorage(sessionKey,state.session[sessionKey].value);});});}/**
|
3484
3540
|
* Sets anonymous id in the following precedence:
|
3485
3541
|
*
|
3486
3542
|
* 1. anonymousId: Id directly provided to the function.
|
3487
3543
|
* 2. rudderAmpLinkerParam: value generated from linker query parm (rudderstack)
|
3488
3544
|
* using parseLinker util.
|
3489
3545
|
* 3. generateUUID: A new unique id is generated and assigned.
|
3490
|
-
*/},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){var finalAnonymousId=anonymousId;if(this.isPersistenceEnabledForStorageEntry('anonymousId')){if(!finalAnonymousId&&rudderAmpLinkerParam){var _this$pluginsManager;var linkerPluginsResult=(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0?void 0:_this$pluginsManager.
|
3491
|
-
* Generate a new anonymousId
|
3492
|
-
* @returns string anonymousID
|
3493
|
-
*/},{key:"generateAnonymousId",value:function generateAnonymousId(){return generateUUID();}/**
|
3546
|
+
*/},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){var finalAnonymousId=anonymousId;if(this.isPersistenceEnabledForStorageEntry('anonymousId')){if(!finalAnonymousId&&rudderAmpLinkerParam){var _this$pluginsManager;var linkerPluginsResult=(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0?void 0:_this$pluginsManager.invokeSingle('userSession.anonymousIdGoogleLinker',rudderAmpLinkerParam);finalAnonymousId=linkerPluginsResult;}finalAnonymousId=finalAnonymousId||generateAnonymousId();}else {finalAnonymousId=DEFAULT_USER_SESSION_VALUES.anonymousId;}state.session.anonymousId.value=finalAnonymousId;}/**
|
3494
3547
|
* Fetches anonymousId
|
3495
3548
|
* @param options option to fetch it from external source
|
3496
3549
|
* @returns anonymousId
|
3497
|
-
*/},{key:"getAnonymousId",value:function getAnonymousId(options){var _state$storage$
|
3498
|
-
if(isStorageTypeValidForStoringData(storage)){var
|
3499
|
-
var autoCapturedAnonymousId=(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0?void 0:_this$pluginsManager2.invokeSingle('storage.getAnonymousId',getStorageEngine,options);persistedAnonymousId=autoCapturedAnonymousId;}state.session.anonymousId.value=persistedAnonymousId||
|
3550
|
+
*/},{key:"getAnonymousId",value:function getAnonymousId(options){var _state$storage$entrie2;var storage=(_state$storage$entrie2=state.storage.entries.value.anonymousId)===null||_state$storage$entrie2===void 0?void 0:_state$storage$entrie2.type;// fetch the anonymousId from storage
|
3551
|
+
if(isStorageTypeValidForStoringData(storage)){var persistedAnonymousId=this.getEntryValue('anonymousId');if(!persistedAnonymousId&&options){var _this$pluginsManager2;// fetch anonymousId from external source
|
3552
|
+
var autoCapturedAnonymousId=(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0?void 0:_this$pluginsManager2.invokeSingle('storage.getAnonymousId',getStorageEngine,options);persistedAnonymousId=autoCapturedAnonymousId;}state.session.anonymousId.value=persistedAnonymousId||generateAnonymousId();}return state.session.anonymousId.value;}},{key:"getEntryValue",value:function getEntryValue(sessionKey){var _entries$sessionKey3;var entries=state.storage.entries.value;var storageType=(_entries$sessionKey3=entries[sessionKey])===null||_entries$sessionKey3===void 0?void 0:_entries$sessionKey3.type;if(isStorageTypeValidForStoringData(storageType)){var _this$storeManager4,_entries$sessionKey4,_store$get;var store=(_this$storeManager4=this.storeManager)===null||_this$storeManager4===void 0?void 0:_this$storeManager4.getStore(storageClientDataStoreNameMap[storageType]);var storageKey=(_entries$sessionKey4=entries[sessionKey])===null||_entries$sessionKey4===void 0?void 0:_entries$sessionKey4.key;return (_store$get=store===null||store===void 0?void 0:store.get(storageKey))!==null&&_store$get!==void 0?_store$get:null;}return null;}/**
|
3500
3553
|
* Fetches User Id
|
3501
3554
|
* @returns
|
3502
|
-
*/},{key:"getUserId",value:function getUserId(){return this.
|
3555
|
+
*/},{key:"getUserId",value:function getUserId(){return this.getEntryValue('userId');}/**
|
3503
3556
|
* Fetches User Traits
|
3504
3557
|
* @returns
|
3505
|
-
*/},{key:"getUserTraits",value:function getUserTraits(){return this.
|
3558
|
+
*/},{key:"getUserTraits",value:function getUserTraits(){return this.getEntryValue('userTraits');}/**
|
3506
3559
|
* Fetches Group Id
|
3507
3560
|
* @returns
|
3508
|
-
*/},{key:"getGroupId",value:function getGroupId(){return this.
|
3561
|
+
*/},{key:"getGroupId",value:function getGroupId(){return this.getEntryValue('groupId');}/**
|
3509
3562
|
* Fetches Group Traits
|
3510
3563
|
* @returns
|
3511
|
-
*/},{key:"getGroupTraits",value:function getGroupTraits(){return this.
|
3564
|
+
*/},{key:"getGroupTraits",value:function getGroupTraits(){return this.getEntryValue('groupTraits');}/**
|
3512
3565
|
* Fetches Initial Referrer
|
3513
3566
|
* @returns
|
3514
|
-
*/},{key:"getInitialReferrer",value:function getInitialReferrer(){return this.
|
3567
|
+
*/},{key:"getInitialReferrer",value:function getInitialReferrer(){return this.getEntryValue('initialReferrer');}/**
|
3515
3568
|
* Fetches Initial Referring domain
|
3516
3569
|
* @returns
|
3517
|
-
*/},{key:"getInitialReferringDomain",value:function getInitialReferringDomain(){return this.
|
3570
|
+
*/},{key:"getInitialReferringDomain",value:function getInitialReferringDomain(){return this.getEntryValue('initialReferringDomain');}/**
|
3518
3571
|
* Fetches session tracking information from storage
|
3519
3572
|
* @returns
|
3520
|
-
*/},{key:"
|
3573
|
+
*/},{key:"getSessionInfo",value:function getSessionInfo(){return this.getEntryValue('sessionInfo');}/**
|
3521
3574
|
* Fetches auth token from storage
|
3522
3575
|
* @returns
|
3523
|
-
*/},{key:"getAuthToken",value:function getAuthToken(){return this.
|
3576
|
+
*/},{key:"getAuthToken",value:function getAuthToken(){return this.getEntryValue('authToken');}/**
|
3524
3577
|
* If session is active it returns the sessionId
|
3525
3578
|
* @returns
|
3526
|
-
*/},{key:"getSessionId",value:function getSessionId(){
|
3579
|
+
*/},{key:"getSessionId",value:function getSessionId(){var sessionInfo=state.session.sessionInfo.value;if(sessionInfo.autoTrack&&!hasSessionExpired(sessionInfo.expiresAt)||sessionInfo.manualTrack){var _sessionInfo$id;return (_sessionInfo$id=sessionInfo.id)!==null&&_sessionInfo$id!==void 0?_sessionInfo$id:null;}return null;}/**
|
3527
3580
|
* A function to update current session info after each event call
|
3528
|
-
*/},{key:"refreshSession",value:function refreshSession(){
|
3581
|
+
*/},{key:"refreshSession",value:function refreshSession(){var sessionInfo=state.session.sessionInfo.value;if(sessionInfo.autoTrack||sessionInfo.manualTrack){if(sessionInfo.autoTrack){this.startOrRenewAutoTracking();}// Re-assigning the variable with the same value intentionally as
|
3582
|
+
// startOrRenewAutoTracking() will update the sessionInfo value
|
3583
|
+
sessionInfo=state.session.sessionInfo.value;if(sessionInfo.sessionStart===undefined){state.session.sessionInfo.value=_objectSpread2(_objectSpread2({},sessionInfo),{},{sessionStart:true});}else if(sessionInfo.sessionStart){state.session.sessionInfo.value=_objectSpread2(_objectSpread2({},sessionInfo),{},{sessionStart:false});}}}/**
|
3529
3584
|
* Reset state values
|
3530
3585
|
* @param resetAnonymousId
|
3531
3586
|
* @param noNewSessionStart
|
3532
3587
|
* @returns
|
3533
|
-
*/},{key:"reset",value:function reset(resetAnonymousId,noNewSessionStart){var _this4=this;var
|
3534
|
-
_this4.setAnonymousId();}if(noNewSessionStart){return;}if(autoTrack){
|
3588
|
+
*/},{key:"reset",value:function reset(resetAnonymousId,noNewSessionStart){var _this4=this;var session=state.session;var _session$sessionInfo$=session.sessionInfo.value,manualTrack=_session$sessionInfo$.manualTrack,autoTrack=_session$sessionInfo$.autoTrack;n(function(){session.userId.value=DEFAULT_USER_SESSION_VALUES.userId;session.userTraits.value=DEFAULT_USER_SESSION_VALUES.userTraits;session.groupId.value=DEFAULT_USER_SESSION_VALUES.groupId;session.groupTraits.value=DEFAULT_USER_SESSION_VALUES.groupTraits;session.authToken.value=DEFAULT_USER_SESSION_VALUES.authToken;if(resetAnonymousId){// This will generate a new anonymous ID
|
3589
|
+
_this4.setAnonymousId();}if(noNewSessionStart){return;}if(autoTrack){session.sessionInfo.value=DEFAULT_USER_SESSION_VALUES.sessionInfo;_this4.startOrRenewAutoTracking();}else if(manualTrack){_this4.startManualTrackingInternal();}});}},{key:"setSessionInfo",value:function setSessionInfo(sessionInfo){state.session.sessionInfo.value=this.isPersistenceEnabledForStorageEntry('sessionInfo')?sessionInfo:DEFAULT_USER_SESSION_VALUES.sessionInfo;// If auto session tracking is enabled start the session tracking
|
3590
|
+
if(state.session.sessionInfo.value.autoTrack){this.startOrRenewAutoTracking();}}/**
|
3535
3591
|
* Set user Id
|
3536
3592
|
* @param userId
|
3537
|
-
*/},{key:"setUserId",value:function setUserId(userId){
|
3593
|
+
*/},{key:"setUserId",value:function setUserId(userId){state.session.userId.value=this.isPersistenceEnabledForStorageEntry('userId')&&userId?userId:DEFAULT_USER_SESSION_VALUES.userId;}/**
|
3538
3594
|
* Set user traits
|
3539
3595
|
* @param traits
|
3540
|
-
*/},{key:"setUserTraits",value:function setUserTraits(traits){
|
3596
|
+
*/},{key:"setUserTraits",value:function setUserTraits(traits){var _state$session$userTr;state.session.userTraits.value=this.isPersistenceEnabledForStorageEntry('userTraits')&&traits?mergeDeepRight((_state$session$userTr=state.session.userTraits.value)!==null&&_state$session$userTr!==void 0?_state$session$userTr:{},traits):DEFAULT_USER_SESSION_VALUES.userTraits;}/**
|
3541
3597
|
* Set group Id
|
3542
3598
|
* @param groupId
|
3543
|
-
*/},{key:"setGroupId",value:function setGroupId(groupId){
|
3599
|
+
*/},{key:"setGroupId",value:function setGroupId(groupId){state.session.groupId.value=this.isPersistenceEnabledForStorageEntry('groupId')&&groupId?groupId:DEFAULT_USER_SESSION_VALUES.groupId;}/**
|
3544
3600
|
* Set group traits
|
3545
3601
|
* @param traits
|
3546
|
-
*/},{key:"setGroupTraits",value:function setGroupTraits(traits){
|
3602
|
+
*/},{key:"setGroupTraits",value:function setGroupTraits(traits){var _state$session$groupT;state.session.groupTraits.value=this.isPersistenceEnabledForStorageEntry('groupTraits')&&traits?mergeDeepRight((_state$session$groupT=state.session.groupTraits.value)!==null&&_state$session$groupT!==void 0?_state$session$groupT:{},traits):DEFAULT_USER_SESSION_VALUES.groupTraits;}/**
|
3547
3603
|
* Set initial referrer
|
3548
3604
|
* @param referrer
|
3549
|
-
*/},{key:"setInitialReferrer",value:function setInitialReferrer(referrer){
|
3605
|
+
*/},{key:"setInitialReferrer",value:function setInitialReferrer(referrer){state.session.initialReferrer.value=this.isPersistenceEnabledForStorageEntry('initialReferrer')&&referrer?referrer:DEFAULT_USER_SESSION_VALUES.initialReferrer;}/**
|
3550
3606
|
* Set initial referring domain
|
3551
3607
|
* @param {String} referringDomain
|
3552
|
-
*/},{key:"setInitialReferringDomain",value:function setInitialReferringDomain(referringDomain){
|
3553
|
-
* A function to check for existing session details and depending on that create a new session
|
3554
|
-
*/},{key:"startOrRenewAutoTracking",value:function startOrRenewAutoTracking(){
|
3608
|
+
*/},{key:"setInitialReferringDomain",value:function setInitialReferringDomain(referringDomain){state.session.initialReferringDomain.value=this.isPersistenceEnabledForStorageEntry('initialReferringDomain')&&referringDomain?referringDomain:DEFAULT_USER_SESSION_VALUES.initialReferringDomain;}/**
|
3609
|
+
* A function to check for existing session details and depending on that create a new session
|
3610
|
+
*/},{key:"startOrRenewAutoTracking",value:function startOrRenewAutoTracking(){var sessionInfo=state.session.sessionInfo.value;if(hasSessionExpired(sessionInfo.expiresAt)){state.session.sessionInfo.value=generateAutoTrackingSession(sessionInfo.timeout);}else {var timestamp=Date.now();var timeout=sessionInfo.timeout;state.session.sessionInfo.value=mergeDeepRight(sessionInfo,{expiresAt:timestamp+timeout// set the expiry time of the session
|
3555
3611
|
});}}/**
|
3556
3612
|
* A function method to start a manual session
|
3557
3613
|
* @param {number} id session identifier
|
@@ -3563,7 +3619,7 @@ _this4.setAnonymousId();}if(noNewSessionStart){return;}if(autoTrack){state.sessi
|
|
3563
3619
|
*/},{key:"end",value:function end(){state.session.sessionInfo.value={};}/**
|
3564
3620
|
* Set auth token
|
3565
3621
|
* @param userId
|
3566
|
-
*/},{key:"setAuthToken",value:function setAuthToken(token){
|
3622
|
+
*/},{key:"setAuthToken",value:function setAuthToken(token){state.session.authToken.value=this.isPersistenceEnabledForStorageEntry('authToken')&&token?token:DEFAULT_USER_SESSION_VALUES.authToken;}}]);return UserSessionManager;}();
|
3567
3623
|
|
3568
3624
|
/**
|
3569
3625
|
* A buffer queue to serve as a store for any type of data
|
@@ -3583,7 +3639,7 @@ var DATA_PLANE_QUEUE_EXT_POINT_PREFIX='dataplaneEventsQueue';var DESTINATIONS_QU
|
|
3583
3639
|
* @returns Mutated event with final integrations config
|
3584
3640
|
*/var getFinalEvent=function getFinalEvent(event,state){var _event$integrations;var finalEvent=clone$1(event);// Merge the destination specific integrations config with the event's integrations config
|
3585
3641
|
// In general, the preference is given to the event's integrations config
|
3586
|
-
var eventIntgConfig=(_event$integrations=event.integrations)!==null&&_event$integrations!==void 0?_event$integrations:DEFAULT_INTEGRATIONS_CONFIG;var destinationsIntgConfig=state.nativeDestinations.integrationsConfig.value;var overriddenIntgOpts=getOverriddenIntegrationOptions(eventIntgConfig,destinationsIntgConfig);finalEvent.integrations=mergeDeepRight(destinationsIntgConfig,overriddenIntgOpts);return finalEvent;};
|
3642
|
+
var eventIntgConfig=(_event$integrations=event.integrations)!==null&&_event$integrations!==void 0?_event$integrations:DEFAULT_INTEGRATIONS_CONFIG;var destinationsIntgConfig=state.nativeDestinations.integrationsConfig.value;var overriddenIntgOpts=getOverriddenIntegrationOptions(eventIntgConfig,destinationsIntgConfig);finalEvent.integrations=mergeDeepRight(destinationsIntgConfig,overriddenIntgOpts);return finalEvent;};var shouldBufferEventsForPreConsent=function shouldBufferEventsForPreConsent(state){var _state$consents$preCo,_state$consents$preCo2,_state$consents$preCo3;return state.consents.preConsent.value.enabled&&((_state$consents$preCo=state.consents.preConsent.value.events)===null||_state$consents$preCo===void 0?void 0:_state$consents$preCo.delivery)==='buffer'&&(((_state$consents$preCo2=state.consents.preConsent.value.storage)===null||_state$consents$preCo2===void 0?void 0:_state$consents$preCo2.strategy)==='session'||((_state$consents$preCo3=state.consents.preConsent.value.storage)===null||_state$consents$preCo3===void 0?void 0:_state$consents$preCo3.strategy)==='none');};
|
3587
3643
|
|
3588
3644
|
/**
|
3589
3645
|
* Event repository class responsible for queuing events for further processing and delivery
|
@@ -3596,12 +3652,12 @@ var eventIntgConfig=(_event$integrations=event.integrations)!==null&&_event$inte
|
|
3596
3652
|
*/function EventRepository(pluginsManager,storeManager,errorHandler,logger){_classCallCheck(this,EventRepository);this.pluginsManager=pluginsManager;this.errorHandler=errorHandler;this.logger=logger;this.httpClient=new HttpClient(errorHandler,logger);this.storeManager=storeManager;this.onError=this.onError.bind(this);}/**
|
3597
3653
|
* Initializes the event repository
|
3598
3654
|
*/_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
|
3599
|
-
O(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();}});// Start the queue processing only when the destinations are ready or hybrid mode destinations exist
|
3655
|
+
O(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 queue processing only when the destinations are ready or hybrid mode destinations exist
|
3600
3656
|
// However, events will be enqueued for now.
|
3601
3657
|
// At the time of processing the events, the integrations config data from destinations
|
3602
3658
|
// is merged into the event object
|
3603
|
-
var timeoutId;O(function(){var _this$dataplaneEvents;var shouldBufferDpEvents=state.loadOptions.value.bufferDataPlaneEventsUntilReady===true&&state.nativeDestinations.clientDestinationsReady.value===false;var hybridDestExist=state.nativeDestinations.activeDestinations.value.some(function(dest){return isHybridModeDestination(dest);});if((hybridDestExist===false||shouldBufferDpEvents===false)&&((_this$dataplaneEvents=_this.dataplaneEventsQueue)===null||_this$dataplaneEvents===void 0?void 0:_this$dataplaneEvents.scheduleTimeoutActive)!==true){var _this$dataplaneEvents2;globalThis.clearTimeout(timeoutId);(_this$dataplaneEvents2=_this.dataplaneEventsQueue)===null||_this$dataplaneEvents2===void 0||_this$dataplaneEvents2.start();}});// Force start the data plane events queue processing after a timeout
|
3604
|
-
if(state.loadOptions.value.bufferDataPlaneEventsUntilReady===true){timeoutId=globalThis.setTimeout(function(){var _this$dataplaneEvents3;if(((_this$dataplaneEvents3=_this.dataplaneEventsQueue)===null||_this$dataplaneEvents3===void 0?void 0:_this$dataplaneEvents3.scheduleTimeoutActive)!==true){var _this$dataplaneEvents4;(_this$dataplaneEvents4=_this.dataplaneEventsQueue)===null||_this$dataplaneEvents4===void 0||_this$dataplaneEvents4.start();}},state.loadOptions.value.dataPlaneEventsBufferTimeout);}}/**
|
3659
|
+
var timeoutId;O(function(){var _this$dataplaneEvents;var shouldBufferDpEvents=state.loadOptions.value.bufferDataPlaneEventsUntilReady===true&&state.nativeDestinations.clientDestinationsReady.value===false;var hybridDestExist=state.nativeDestinations.activeDestinations.value.some(function(dest){return isHybridModeDestination(dest);});if((hybridDestExist===false||shouldBufferDpEvents===false)&&!bufferEventsBeforeConsent&&((_this$dataplaneEvents=_this.dataplaneEventsQueue)===null||_this$dataplaneEvents===void 0?void 0:_this$dataplaneEvents.scheduleTimeoutActive)!==true){var _this$dataplaneEvents2;globalThis.clearTimeout(timeoutId);(_this$dataplaneEvents2=_this.dataplaneEventsQueue)===null||_this$dataplaneEvents2===void 0||_this$dataplaneEvents2.start();}});// Force start the data plane events queue processing after a timeout
|
3660
|
+
if(state.loadOptions.value.bufferDataPlaneEventsUntilReady===true){timeoutId=globalThis.setTimeout(function(){var _this$dataplaneEvents3;if(((_this$dataplaneEvents3=_this.dataplaneEventsQueue)===null||_this$dataplaneEvents3===void 0?void 0:_this$dataplaneEvents3.scheduleTimeoutActive)!==true){var _this$dataplaneEvents4;(_this$dataplaneEvents4=_this.dataplaneEventsQueue)===null||_this$dataplaneEvents4===void 0||_this$dataplaneEvents4.start();}},state.loadOptions.value.dataPlaneEventsBufferTimeout);}}},{key:"resume",value:function resume(){var _this$dataplaneEvents5;if(((_this$dataplaneEvents5=this.dataplaneEventsQueue)===null||_this$dataplaneEvents5===void 0?void 0:_this$dataplaneEvents5.scheduleTimeoutActive)!==true){var _this$dataplaneEvents7;if(state.consents.postConsent.value.discardPreConsentEvents){var _this$dataplaneEvents6,_this$destinationsEve2;(_this$dataplaneEvents6=this.dataplaneEventsQueue)===null||_this$dataplaneEvents6===void 0||_this$dataplaneEvents6.clear();(_this$destinationsEve2=this.destinationsEventsQueue)===null||_this$destinationsEve2===void 0||_this$destinationsEve2.clear();}(_this$dataplaneEvents7=this.dataplaneEventsQueue)===null||_this$dataplaneEvents7===void 0||_this$dataplaneEvents7.start();}}/**
|
3605
3661
|
* Enqueues the event for processing
|
3606
3662
|
* @param event RudderEvent object
|
3607
3663
|
* @param callback API callback function
|
@@ -3615,38 +3671,42 @@ callback===null||callback===void 0||callback(dpQEvent);}catch(error){this.onErro
|
|
3615
3671
|
* @param shouldAlwaysThrow if it should throw or use logger
|
3616
3672
|
*/},{key:"onError",value:function onError(error,customMessage,shouldAlwaysThrow){if(this.errorHandler){this.errorHandler.onError(error,EVENT_REPOSITORY,customMessage,shouldAlwaysThrow);}else {throw error;}}}]);return EventRepository;}();
|
3617
3673
|
|
3674
|
+
var dispatchSDKEvent=function dispatchSDKEvent(event){var customEvent=new CustomEvent(event,{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:true,cancelable:true,composed:true});globalThis.document.dispatchEvent(customEvent);};
|
3675
|
+
|
3618
3676
|
/*
|
3619
3677
|
* Analytics class with lifecycle based on state ad user triggered events
|
3620
3678
|
*/var Analytics=/*#__PURE__*/function(){/**
|
3621
3679
|
* Initialize services and components or use default ones if singletons
|
3622
|
-
*/function Analytics(){_classCallCheck(this,Analytics);
|
3680
|
+
*/function Analytics(){_classCallCheck(this,Analytics);this.preloadBuffer=new BufferQueue();this.initialized=false;this.errorHandler=defaultErrorHandler;this.logger=defaultLogger;this.externalSrcLoader=new ExternalSrcLoader(this.errorHandler,this.logger);this.capabilitiesManager=new CapabilitiesManager(this.errorHandler,this.logger);this.httpClient=defaultHttpClient;}/**
|
3623
3681
|
* Start application lifecycle if not already started
|
3624
3682
|
*/_createClass(Analytics,[{key:"load",value:function load(writeKey,dataPlaneUrl){var loadOptions=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(state.lifecycle.status.value){return;}var clonedDataPlaneUrl=clone$1(dataPlaneUrl);var clonedLoadOptions=clone$1(loadOptions);// dataPlaneUrl is not provided
|
3625
3683
|
if(isObjectAndNotNull(dataPlaneUrl)){clonedLoadOptions=dataPlaneUrl;clonedDataPlaneUrl=undefined;}// Set initial state values
|
3626
|
-
n(function(){state.lifecycle.writeKey.value=writeKey;state.lifecycle.dataPlaneUrl.value=clonedDataPlaneUrl;state.loadOptions.value=normalizeLoadOptions(state.loadOptions.value,clonedLoadOptions);state.lifecycle.status.value='mounted';});//
|
3684
|
+
n(function(){state.lifecycle.writeKey.value=writeKey;state.lifecycle.dataPlaneUrl.value=clonedDataPlaneUrl;state.loadOptions.value=normalizeLoadOptions(state.loadOptions.value,clonedLoadOptions);state.lifecycle.status.value='mounted';});// set log level as early as possible
|
3685
|
+
if(state.loadOptions.value.logLevel){var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0||_this$logger.setMinLogLevel(state.loadOptions.value.logLevel);}// Expose state to global objects
|
3627
3686
|
setExposedGlobal('state',state,writeKey);// Configure initial config of any services or components here
|
3628
3687
|
// State application lifecycle
|
3629
3688
|
this.startLifecycle();}// Start lifecycle methods
|
3630
3689
|
/**
|
3631
3690
|
* Orchestrate the lifecycle of the application phases/status
|
3632
|
-
*/},{key:"startLifecycle",value:function startLifecycle(){var _this=this;O(function(){try{switch(state.lifecycle.status.value){case'mounted':_this.
|
3633
|
-
retrievePreloadBufferEvents(
|
3691
|
+
*/},{key:"startLifecycle",value:function startLifecycle(){var _this=this;O(function(){try{switch(state.lifecycle.status.value){case'mounted':_this.onMounted();break;case'browserCapabilitiesReady':_this.onBrowserCapabilitiesReady();break;case'configured':_this.onConfigured();break;case'pluginsLoading':break;case'pluginsReady':_this.onPluginsReady();break;case'initialized':_this.onInitialized();break;case'loaded':_this.onLoaded();break;case'destinationsLoading':break;case'destinationsReady':_this.onDestinationsReady();break;case'ready':_this.onReady();break;default:break;}}catch(err){var issue='Failed to load the SDK';_this.errorHandler.onError(getMutatedError(err,issue),ANALYTICS_CORE);}});}},{key:"onBrowserCapabilitiesReady",value:function onBrowserCapabilitiesReady(){// initialize the preloaded events enqueuing
|
3692
|
+
retrievePreloadBufferEvents(this);this.prepareInternalServices();this.loadConfig();}},{key:"onLoaded",value:function onLoaded(){this.processBufferedEvents();// Short-circuit the life cycle and move to the ready state if pre-consent behavior is enabled
|
3693
|
+
if(state.consents.preConsent.value.enabled===true){state.lifecycle.status.value='ready';}else {this.loadDestinations();}}/**
|
3634
3694
|
* Load browser polyfill if required
|
3635
|
-
*/},{key:"
|
3695
|
+
*/},{key:"onMounted",value:function onMounted(){this.capabilitiesManager.init();}/**
|
3636
3696
|
* Enqueue in SDK preload buffer events, used from preloadBuffer component
|
3637
3697
|
*/},{key:"enqueuePreloadBufferEvents",value:function enqueuePreloadBufferEvents(bufferedEvents){var _this2=this;if(Array.isArray(bufferedEvents)){bufferedEvents.forEach(function(bufferedEvent){return _this2.preloadBuffer.enqueue(clone$1(bufferedEvent));});}}/**
|
3638
3698
|
* Process the buffer preloaded events by passing their arguments to the respective facade methods
|
3639
3699
|
*/},{key:"processDataInPreloadBuffer",value:function processDataInPreloadBuffer(){while(this.preloadBuffer.size()>0){var eventToProcess=this.preloadBuffer.dequeue();if(eventToProcess){consumePreloadBufferedEvent(_toConsumableArray(eventToProcess),this);}}}},{key:"prepareInternalServices",value:function prepareInternalServices(){this.pluginsManager=new PluginsManager(defaultPluginEngine,this.errorHandler,this.logger);this.storeManager=new StoreManager(this.pluginsManager,this.errorHandler,this.logger);this.configManager=new ConfigManager(this.httpClient,this.errorHandler,this.logger);this.userSessionManager=new UserSessionManager(this.errorHandler,this.logger,this.pluginsManager,this.storeManager);this.eventRepository=new EventRepository(this.pluginsManager,this.storeManager,this.errorHandler,this.logger);this.eventManager=new EventManager(this.eventRepository,this.userSessionManager,this.errorHandler,this.logger);}/**
|
3640
3700
|
* Load configuration
|
3641
|
-
*/},{key:"loadConfig",value:function loadConfig(){var _this$configManager;if(
|
3701
|
+
*/},{key:"loadConfig",value:function loadConfig(){var _this$configManager;if(state.lifecycle.writeKey.value){this.httpClient.setAuthHeader(state.lifecycle.writeKey.value);}(_this$configManager=this.configManager)===null||_this$configManager===void 0||_this$configManager.init();}/**
|
3642
3702
|
* Initialize the storage and event queue
|
3643
|
-
*/},{key:"
|
3644
|
-
(_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 consent manager
|
3645
|
-
if(state.consents.
|
3703
|
+
*/},{key:"onPluginsReady",value:function onPluginsReady(){var _this$storeManager,_this$userSessionMana,_this$eventManager;this.errorHandler.init(this.externalSrcLoader);// Initialize storage
|
3704
|
+
(_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
|
3705
|
+
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);}}// Initialize event manager
|
3646
3706
|
(_this$eventManager=this.eventManager)===null||_this$eventManager===void 0||_this$eventManager.init();// Mark the SDK as initialized
|
3647
3707
|
state.lifecycle.status.value='initialized';}/**
|
3648
3708
|
* Load plugins
|
3649
|
-
*/},{key:"
|
3709
|
+
*/},{key:"onConfigured",value:function onConfigured(){var _this$pluginsManager3;(_this$pluginsManager3=this.pluginsManager)===null||_this$pluginsManager3===void 0||_this$pluginsManager3.init();// TODO: are we going to enable custom plugins to be passed as load options?
|
3650
3710
|
// registerCustomPlugins(state.loadOptions.value.customPlugins);
|
3651
3711
|
}/**
|
3652
3712
|
* Trigger onLoaded callback if any is provided in config & emit initialised event
|
@@ -3656,41 +3716,52 @@ this.processDataInPreloadBuffer();// TODO: we need to avoid passing the window o
|
|
3656
3716
|
// Execute onLoaded callback if provided in load options
|
3657
3717
|
if(isFunction(state.loadOptions.value.onLoaded)){state.loadOptions.value.onLoaded(globalThis.rudderanalytics);}// Set lifecycle state
|
3658
3718
|
n(function(){state.lifecycle.loaded.value=true;state.lifecycle.status.value='loaded';});this.initialized=true;// Emit an event to use as substitute to the onLoaded callback
|
3659
|
-
|
3719
|
+
dispatchSDKEvent('RSA_Initialised');}/**
|
3660
3720
|
* Emit ready event
|
3661
3721
|
*/ // eslint-disable-next-line class-methods-use-this
|
3662
|
-
},{key:"onReady",value:function onReady(){
|
3663
|
-
|
3722
|
+
},{key:"onReady",value:function onReady(){var _this3=this;state.eventBuffer.readyCallbacksArray.value.forEach(function(callback){try{callback();}catch(err){_this3.errorHandler.onError(err,ANALYTICS_CORE,READY_CALLBACK_INVOKE_ERROR);}});// Emit an event to use as substitute to the ready callback
|
3723
|
+
dispatchSDKEvent('RSA_Ready');}/**
|
3664
3724
|
* Consume preloaded events buffer
|
3665
|
-
*/},{key:"processBufferedEvents",value:function processBufferedEvents(){
|
3666
|
-
|
3725
|
+
*/},{key:"processBufferedEvents",value:function processBufferedEvents(){// This logic has been intentionally implemented without a simple
|
3726
|
+
// for-loop as the individual events that are processed may
|
3727
|
+
// add more events to the buffer (this is needed for the consent API)
|
3728
|
+
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
|
3729
|
+
(_ref=this)[methodName].apply(_ref,_toConsumableArray(bufferedEvent.slice(1)).concat([true]));}}bufferedEvents=state.eventBuffer.toBeProcessedArray.value;}}/**
|
3667
3730
|
* Load device mode destinations
|
3668
|
-
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$
|
3669
|
-
(_this$
|
3670
|
-
state.lifecycle.status.value='destinationsLoading';(_this$
|
3731
|
+
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$pluginsManager4,_this$pluginsManager5;if(state.nativeDestinations.clientDestinationsReady.value){return;}// Set in state the desired activeDestinations to inject in DOM
|
3732
|
+
(_this$pluginsManager4=this.pluginsManager)===null||_this$pluginsManager4===void 0||_this$pluginsManager4.invokeSingle('nativeDestinations.setActiveDestinations',state,this.pluginsManager,this.errorHandler,this.logger);var totalDestinationsToLoad=state.nativeDestinations.activeDestinations.value.length;if(totalDestinationsToLoad===0){state.lifecycle.status.value='destinationsReady';return;}// Start loading native integration scripts and create instances
|
3733
|
+
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
|
3671
3734
|
O(function(){var areAllDestinationsReady=totalDestinationsToLoad===0||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;});}});}/**
|
3672
|
-
*
|
3735
|
+
* Move to the ready state
|
3673
3736
|
*/ // eslint-disable-next-line class-methods-use-this
|
3674
|
-
},{key:"onDestinationsReady",value:function onDestinationsReady(){
|
3737
|
+
},{key:"onDestinationsReady",value:function onDestinationsReady(){// May be do any destination specific actions here
|
3738
|
+
// Mark the ready status if not already done
|
3739
|
+
if(state.lifecycle.status.value!=='ready'){state.lifecycle.status.value='ready';}}// End lifecycle methods
|
3675
3740
|
// Start consumer exposed methods
|
3676
|
-
},{key:"ready",value:function ready(callback){var type='ready';
|
3741
|
+
},{key:"ready",value:function ready(callback){var type='ready';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,callback]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));if(!isFunction(callback)){this.logger.error(READY_API_CALLBACK_ERROR(READY_API));return;}/**
|
3677
3742
|
* If destinations are loaded or no integration is available for loading
|
3678
3743
|
* execute the callback immediately else push the callbacks to a queue that
|
3679
3744
|
* will be executed after loading completes
|
3680
|
-
*/if(state.lifecycle.status.value==='ready'){try{callback();}catch(err){this.errorHandler.onError(err,ANALYTICS_CORE,READY_CALLBACK_INVOKE_ERROR);}}else {state.eventBuffer.readyCallbacksArray.value.push(callback);}}},{key:"page",value:function page(payload){var _this$eventManager2;var type='page';this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;
|
3745
|
+
*/if(state.lifecycle.status.value==='ready'){try{callback();}catch(err){this.errorHandler.onError(err,ANALYTICS_CORE,READY_CALLBACK_INVOKE_ERROR);}}else {state.eventBuffer.readyCallbacksArray.value.push(callback);}}},{key:"page",value:function page(payload){var _this$eventManager2;var type='page';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;(_this$eventManager2=this.eventManager)===null||_this$eventManager2===void 0||_this$eventManager2.addEvent({type:'page',category:payload.category,name:payload.name,properties:payload.properties,options:payload.options,callback:payload.callback});// TODO: Maybe we should alter the behavior to send the ad-block page event even if the SDK is still loaded. It'll be pushed into the to be processed queue.
|
3681
3746
|
// Send automatic ad blocked page event if ad-blockers are detected on the page
|
3682
3747
|
// Check page category to avoid infinite loop
|
3683
|
-
if(state.capabilities.isAdBlocked.value===true&&payload.category!==ADBLOCK_PAGE_CATEGORY){
|
3748
|
+
if(state.capabilities.isAdBlocked.value===true&&payload.category!==ADBLOCK_PAGE_CATEGORY){this.page(pageArgumentsToCallOptions(ADBLOCK_PAGE_CATEGORY,ADBLOCK_PAGE_NAME,{// 'title' is intentionally omitted as it does not make sense
|
3684
3749
|
// in v3 implementation
|
3685
|
-
path:ADBLOCK_PAGE_PATH},
|
3686
|
-
if(!isNull(payload.userId)){var _this$userSessionMana2;(_this$userSessionMana2=this.userSessionManager)===null||_this$userSessionMana2===void 0||_this$userSessionMana2.setUserId(payload.userId);}(_this$userSessionMana3=this.userSessionManager)===null||_this$userSessionMana3===void 0||_this$userSessionMana3.setUserTraits(payload.traits);(_this$eventManager4=this.eventManager)===null||_this$eventManager4===void 0||_this$eventManager4.addEvent({type:type,userId:payload.userId,traits:payload.traits,options:payload.options,callback:payload.callback});}},{key:"alias",value:function alias(payload){var _ref2,_payload$from,_this$userSessionMana4,_this$userSessionMana5,_this$eventManager5;var type='alias';this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;
|
3687
|
-
if(!isNull(payload.groupId)){var _this$userSessionMana6;(_this$userSessionMana6=this.userSessionManager)===null||_this$userSessionMana6===void 0||_this$userSessionMana6.setGroupId(payload.groupId);}(_this$userSessionMana7=this.userSessionManager)===null||_this$userSessionMana7===void 0||_this$userSessionMana7.setGroupTraits(payload.traits);(_this$eventManager6=this.eventManager)===null||_this$eventManager6===void 0||_this$eventManager6.addEvent({type:type,groupId:payload.groupId,traits:payload.traits,options:payload.options,callback:payload.callback});}},{key:"reset",value:function reset(resetAnonymousId){var _this$userSessionMana8;var type='reset';this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation, resetAnonymousId: ").concat(resetAnonymousId));
|
3688
|
-
if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.
|
3750
|
+
path:ADBLOCK_PAGE_PATH},state.loadOptions.value.sendAdblockPageOptions));}}},{key:"track",value:function track(payload){var _this$eventManager3;var type='track';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;(_this$eventManager3=this.eventManager)===null||_this$eventManager3===void 0||_this$eventManager3.addEvent({type:type,name:payload.name||undefined,properties:payload.properties,options:payload.options,callback:payload.callback});}},{key:"identify",value:function identify(payload){var _this$userSessionMana3,_this$eventManager4;var type='identify';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;var shouldResetSession=Boolean(payload.userId&&state.session.userId.value&&payload.userId!==state.session.userId.value);if(shouldResetSession){this.reset();}// `null` value indicates that previous user ID needs to be retained
|
3751
|
+
if(!isNull(payload.userId)){var _this$userSessionMana2;(_this$userSessionMana2=this.userSessionManager)===null||_this$userSessionMana2===void 0||_this$userSessionMana2.setUserId(payload.userId);}(_this$userSessionMana3=this.userSessionManager)===null||_this$userSessionMana3===void 0||_this$userSessionMana3.setUserTraits(payload.traits);(_this$eventManager4=this.eventManager)===null||_this$eventManager4===void 0||_this$eventManager4.addEvent({type:type,userId:payload.userId,traits:payload.traits,options:payload.options,callback:payload.callback});}},{key:"alias",value:function alias(payload){var _ref2,_payload$from,_this$userSessionMana4,_this$userSessionMana5,_this$eventManager5;var type='alias';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;var previousId=(_ref2=(_payload$from=payload.from)!==null&&_payload$from!==void 0?_payload$from:(_this$userSessionMana4=this.userSessionManager)===null||_this$userSessionMana4===void 0?void 0:_this$userSessionMana4.getUserId())!==null&&_ref2!==void 0?_ref2:(_this$userSessionMana5=this.userSessionManager)===null||_this$userSessionMana5===void 0?void 0:_this$userSessionMana5.getAnonymousId();(_this$eventManager5=this.eventManager)===null||_this$eventManager5===void 0||_this$eventManager5.addEvent({type:type,to:payload.to,from:previousId,options:payload.options,callback:payload.callback});}},{key:"group",value:function group(payload){var _this$userSessionMana7,_this$eventManager6;var type='group';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,payload]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;// `null` value indicates that previous group ID needs to be retained
|
3752
|
+
if(!isNull(payload.groupId)){var _this$userSessionMana6;(_this$userSessionMana6=this.userSessionManager)===null||_this$userSessionMana6===void 0||_this$userSessionMana6.setGroupId(payload.groupId);}(_this$userSessionMana7=this.userSessionManager)===null||_this$userSessionMana7===void 0||_this$userSessionMana7.setGroupTraits(payload.traits);(_this$eventManager6=this.eventManager)===null||_this$eventManager6===void 0||_this$eventManager6.addEvent({type:type,groupId:payload.groupId,traits:payload.traits,options:payload.options,callback:payload.callback});}},{key:"reset",value:function reset(resetAnonymousId){var _this$userSessionMana8;var type='reset';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,resetAnonymousId]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation, resetAnonymousId: ").concat(resetAnonymousId));(_this$userSessionMana8=this.userSessionManager)===null||_this$userSessionMana8===void 0||_this$userSessionMana8.reset(resetAnonymousId);}},{key:"getAnonymousId",value:function getAnonymousId(options){var _this$userSessionMana9;return (_this$userSessionMana9=this.userSessionManager)===null||_this$userSessionMana9===void 0?void 0:_this$userSessionMana9.getAnonymousId(options);}},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){var _this$userSessionMana10;var type='setAnonymousId';// Buffering is needed as setting the anonymous ID may require invoking the GoogleLinker plugin
|
3753
|
+
if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,anonymousId,rudderAmpLinkerParam]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));(_this$userSessionMana10=this.userSessionManager)===null||_this$userSessionMana10===void 0||_this$userSessionMana10.setAnonymousId(anonymousId,rudderAmpLinkerParam);}// eslint-disable-next-line class-methods-use-this
|
3689
3754
|
},{key:"getUserId",value:function getUserId(){return state.session.userId.value;}// eslint-disable-next-line class-methods-use-this
|
3690
3755
|
},{key:"getUserTraits",value:function getUserTraits(){return state.session.userTraits.value;}// eslint-disable-next-line class-methods-use-this
|
3691
3756
|
},{key:"getGroupId",value:function getGroupId(){return state.session.groupId.value;}// eslint-disable-next-line class-methods-use-this
|
3692
|
-
},{key:"getGroupTraits",value:function getGroupTraits(){return state.session.groupTraits.value;}},{key:"startSession",value:function startSession(sessionId){var _this$userSessionMana11;var type='startSession';
|
3693
|
-
},{key:"getSessionId",value:function getSessionId(){var _this$userSessionMana13;var sessionId=(_this$userSessionMana13=this.userSessionManager)===null||_this$userSessionMana13===void 0?void 0:_this$userSessionMana13.getSessionId();return sessionId!==null&&sessionId!==void 0?sessionId:null;}},{key:"
|
3757
|
+
},{key:"getGroupTraits",value:function getGroupTraits(){return state.session.groupTraits.value;}},{key:"startSession",value:function startSession(sessionId){var _this$userSessionMana11;var type='startSession';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,sessionId]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));(_this$userSessionMana11=this.userSessionManager)===null||_this$userSessionMana11===void 0||_this$userSessionMana11.start(sessionId);}},{key:"endSession",value:function endSession(){var _this$userSessionMana12;var type='endSession';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type]]);return;}this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));(_this$userSessionMana12=this.userSessionManager)===null||_this$userSessionMana12===void 0||_this$userSessionMana12.end();}// eslint-disable-next-line class-methods-use-this
|
3758
|
+
},{key:"getSessionId",value:function getSessionId(){var _this$userSessionMana13;var sessionId=(_this$userSessionMana13=this.userSessionManager)===null||_this$userSessionMana13===void 0?void 0:_this$userSessionMana13.getSessionId();return sessionId!==null&&sessionId!==void 0?sessionId:null;}},{key:"consent",value:function consent(options){var _this4=this,_this$storeManager2,_this$userSessionMana14,_this$eventManager7;var isBufferedInvocation=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var type='consent';if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[[type,options]]);return;}this.errorHandler.leaveBreadcrumb("New consent invocation");n(function(){state.consents.preConsent.value=_objectSpread2(_objectSpread2({},state.consents.preConsent.value),{},{enabled:false});state.consents.postConsent.value=getValidPostConsentOptions(options);var _getConsentManagement=getConsentManagementData(state.consents.postConsent.value.consentManagement,_this4.logger),initialized=_getConsentManagement.initialized,consentsData=_getConsentManagement.consentsData;state.consents.initialized.value=initialized||state.consents.initialized.value;state.consents.data.value=consentsData;});// Update consents data in state
|
3759
|
+
if(state.consents.enabled.value&&!state.consents.initialized.value){var _this$pluginsManager6;(_this$pluginsManager6=this.pluginsManager)===null||_this$pluginsManager6===void 0||_this$pluginsManager6.invokeSingle("consentManager.updateConsentsInfo",state,this.storeManager,this.logger);}// Re-init store manager
|
3760
|
+
(_this$storeManager2=this.storeManager)===null||_this$storeManager2===void 0||_this$storeManager2.initializeStorageState();// Re-init user session manager
|
3761
|
+
(_this$userSessionMana14=this.userSessionManager)===null||_this$userSessionMana14===void 0||_this$userSessionMana14.syncStorageDataToState();// Resume event manager to process the events to destinations
|
3762
|
+
(_this$eventManager7=this.eventManager)===null||_this$eventManager7===void 0||_this$eventManager7.resume();this.loadDestinations();this.sendTrackingEvents(isBufferedInvocation);}},{key:"sendTrackingEvents",value:function sendTrackingEvents(isBufferedInvocation){// If isBufferedInvocation is true, then the tracking events will be added to the end of the
|
3763
|
+
// events buffer array so that any other preload events (mainly from query string API) will be processed first.
|
3764
|
+
if(state.consents.postConsent.value.trackConsent){var trackOptions=trackArgumentsToCallOptions(CONSENT_TRACK_EVENT_NAME);if(isBufferedInvocation){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[['track',trackOptions]]);}else {this.track(trackOptions);}}if(state.consents.postConsent.value.sendPageEvent){var pageOptions=pageArgumentsToCallOptions();if(isBufferedInvocation){state.eventBuffer.toBeProcessedArray.value=[].concat(_toConsumableArray(state.eventBuffer.toBeProcessedArray.value),[['page',pageOptions]]);}else {this.page(pageOptions);}}}},{key:"setAuthToken",value:function setAuthToken(token){var _this$userSessionMana15;(_this$userSessionMana15=this.userSessionManager)===null||_this$userSessionMana15===void 0||_this$userSessionMana15.setAuthToken(token);}// End consumer exposed methods
|
3694
3765
|
}]);return Analytics;}();
|
3695
3766
|
|
3696
3767
|
/*
|
@@ -3702,8 +3773,7 @@ if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.pus
|
|
3702
3773
|
function RudderAnalytics(){_classCallCheck(this,RudderAnalytics);_defineProperty(this,"analyticsInstances",{});_defineProperty(this,"defaultAnalyticsKey",'');_defineProperty(this,"logger",defaultLogger);if(RudderAnalytics.globalSingleton){// START-NO-SONAR-SCAN
|
3703
3774
|
// eslint-disable-next-line no-constructor-return
|
3704
3775
|
return RudderAnalytics.globalSingleton;// END-NO-SONAR-SCAN
|
3705
|
-
}this.setDefaultInstanceKey=this.setDefaultInstanceKey.bind(this);this.getAnalyticsInstance=this.getAnalyticsInstance.bind(this);this.load=this.load.bind(this);this.ready=this.ready.bind(this);this.
|
3706
|
-
this.getPreloadBuffer();// start loading if a load event was buffered or wait for explicit load call
|
3776
|
+
}this.setDefaultInstanceKey=this.setDefaultInstanceKey.bind(this);this.getAnalyticsInstance=this.getAnalyticsInstance.bind(this);this.load=this.load.bind(this);this.ready=this.ready.bind(this);this.triggerBufferedLoadEvent=this.triggerBufferedLoadEvent.bind(this);this.page=this.page.bind(this);this.track=this.track.bind(this);this.identify=this.identify.bind(this);this.alias=this.alias.bind(this);this.group=this.group.bind(this);this.reset=this.reset.bind(this);this.getAnonymousId=this.getAnonymousId.bind(this);this.setAnonymousId=this.setAnonymousId.bind(this);this.getUserId=this.getUserId.bind(this);this.getUserTraits=this.getUserTraits.bind(this);this.getGroupId=this.getGroupId.bind(this);this.getGroupTraits=this.getGroupTraits.bind(this);this.startSession=this.startSession.bind(this);this.endSession=this.endSession.bind(this);this.getSessionId=this.getSessionId.bind(this);this.setAuthToken=this.setAuthToken.bind(this);this.consent=this.consent.bind(this);RudderAnalytics.globalSingleton=this;// start loading if a load event was buffered or wait for explicit load call
|
3707
3777
|
this.triggerBufferedLoadEvent();}/**
|
3708
3778
|
* Set instance to use if no specific writeKey is provided in methods
|
3709
3779
|
* automatically for the first created instance
|
@@ -3713,13 +3783,14 @@ this.triggerBufferedLoadEvent();}/**
|
|
3713
3783
|
*/},{key:"getAnalyticsInstance",value:function getAnalyticsInstance(writeKey){var instanceId=writeKey!==null&&writeKey!==void 0?writeKey:this.defaultAnalyticsKey;var analyticsInstanceExists=Boolean(this.analyticsInstances[instanceId]);if(!analyticsInstanceExists){this.analyticsInstances[instanceId]=new Analytics();}return this.analyticsInstances[instanceId];}/**
|
3714
3784
|
* Create new analytics instance and trigger application lifecycle start
|
3715
3785
|
*/},{key:"load",value:function load(writeKey,dataPlaneUrl,loadOptions){if(!isString(writeKey)){this.logger.error(WRITE_KEY_NOT_A_STRING_ERROR(RS_APP,writeKey));return;}if(this.analyticsInstances[writeKey]){return;}this.setDefaultInstanceKey(writeKey);this.analyticsInstances[writeKey]=new Analytics();this.getAnalyticsInstance(writeKey).load(writeKey,dataPlaneUrl,loadOptions);}/**
|
3716
|
-
*
|
3717
|
-
|
3718
|
-
},{key:"
|
3719
|
-
|
3720
|
-
|
3721
|
-
|
3722
|
-
var loadEvent=getPreloadedLoadEvent(preloadedEventsArray);//
|
3786
|
+
* Trigger load event in buffer queue if exists and stores the
|
3787
|
+
* remaining preloaded events array in global object
|
3788
|
+
*/},{key:"triggerBufferedLoadEvent",value:function triggerBufferedLoadEvent(){var preloadedEventsArray=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];// The array will be mutated in the below method
|
3789
|
+
promotePreloadedConsentEventsToTop(preloadedEventsArray);// Get any load method call that is buffered if any
|
3790
|
+
// BTW, load method is also removed from the array
|
3791
|
+
// So, the Analytics object can directly consume the remaining events
|
3792
|
+
var loadEvent=getPreloadedLoadEvent(preloadedEventsArray);// Set the final preloaded events array in global object
|
3793
|
+
setExposedGlobal(GLOBAL_PRELOAD_BUFFER,clone$1(preloadedEventsArray));// Process load method if present in the buffered requests
|
3723
3794
|
if(loadEvent.length>0){// Remove the event name from the Buffered Event array and keep only arguments
|
3724
3795
|
loadEvent.shift();// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
3725
3796
|
// @ts-ignore
|
@@ -3735,6 +3806,6 @@ this.load.apply(null,loadEvent);}}/**
|
|
3735
3806
|
* Process alias arguments and forward to page call
|
3736
3807
|
*/},{key:"alias",value:function alias(to,from,options,callback){this.getAnalyticsInstance().alias(aliasArgumentsToCallOptions(to,from,options,callback));}/**
|
3737
3808
|
* Process group arguments and forward to page call
|
3738
|
-
*/},{key:"group",value:function group(groupId,traits,options,callback){if(arguments.length===0){this.logger.error(EMPTY_GROUP_CALL_ERROR(RS_APP));return;}this.getAnalyticsInstance().group(groupArgumentsToCallOptions(groupId,traits,options,callback));}},{key:"reset",value:function reset(resetAnonymousId){this.getAnalyticsInstance().reset(resetAnonymousId);}},{key:"getAnonymousId",value:function getAnonymousId(options){return this.getAnalyticsInstance().getAnonymousId(options);}},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){this.getAnalyticsInstance().setAnonymousId(anonymousId,rudderAmpLinkerParam);}},{key:"getUserId",value:function getUserId(){return this.getAnalyticsInstance().getUserId();}},{key:"getUserTraits",value:function getUserTraits(){return this.getAnalyticsInstance().getUserTraits();}},{key:"getGroupId",value:function getGroupId(){return this.getAnalyticsInstance().getGroupId();}},{key:"getGroupTraits",value:function getGroupTraits(){return this.getAnalyticsInstance().getGroupTraits();}},{key:"startSession",value:function startSession(sessionId){return this.getAnalyticsInstance().startSession(sessionId);}},{key:"endSession",value:function endSession(){return this.getAnalyticsInstance().endSession();}},{key:"getSessionId",value:function getSessionId(){return this.getAnalyticsInstance().getSessionId();}},{key:"setAuthToken",value:function setAuthToken(token){return this.getAnalyticsInstance().setAuthToken(token);}}]);return RudderAnalytics;}();_defineProperty(RudderAnalytics,"globalSingleton",null);
|
3809
|
+
*/},{key:"group",value:function group(groupId,traits,options,callback){if(arguments.length===0){this.logger.error(EMPTY_GROUP_CALL_ERROR(RS_APP));return;}this.getAnalyticsInstance().group(groupArgumentsToCallOptions(groupId,traits,options,callback));}},{key:"reset",value:function reset(resetAnonymousId){this.getAnalyticsInstance().reset(resetAnonymousId);}},{key:"getAnonymousId",value:function getAnonymousId(options){return this.getAnalyticsInstance().getAnonymousId(options);}},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){this.getAnalyticsInstance().setAnonymousId(anonymousId,rudderAmpLinkerParam);}},{key:"getUserId",value:function getUserId(){return this.getAnalyticsInstance().getUserId();}},{key:"getUserTraits",value:function getUserTraits(){return this.getAnalyticsInstance().getUserTraits();}},{key:"getGroupId",value:function getGroupId(){return this.getAnalyticsInstance().getGroupId();}},{key:"getGroupTraits",value:function getGroupTraits(){return this.getAnalyticsInstance().getGroupTraits();}},{key:"startSession",value:function startSession(sessionId){return this.getAnalyticsInstance().startSession(sessionId);}},{key:"endSession",value:function endSession(){return this.getAnalyticsInstance().endSession();}},{key:"getSessionId",value:function getSessionId(){return this.getAnalyticsInstance().getSessionId();}},{key:"setAuthToken",value:function setAuthToken(token){return this.getAnalyticsInstance().setAuthToken(token);}},{key:"consent",value:function consent(options){return this.getAnalyticsInstance().consent(options);}}]);return RudderAnalytics;}();_defineProperty(RudderAnalytics,"globalSingleton",null);
|
3739
3810
|
|
3740
3811
|
exports.RudderAnalytics = RudderAnalytics;
|