@rudderstack/analytics-js 3.11.16 → 3.12.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +19 -0
- package/LICENSE.md +6 -6
- package/dist/npm/index.d.cts +6 -0
- package/dist/npm/index.d.mts +6 -0
- package/dist/npm/legacy/bundled/cjs/index.cjs +384 -341
- package/dist/npm/legacy/bundled/esm/index.mjs +384 -341
- package/dist/npm/legacy/bundled/umd/index.js +384 -341
- package/dist/npm/legacy/cjs/index.cjs +384 -341
- package/dist/npm/legacy/content-script/cjs/index.cjs +379 -336
- package/dist/npm/legacy/content-script/esm/index.mjs +379 -336
- package/dist/npm/legacy/content-script/umd/index.js +379 -336
- package/dist/npm/legacy/esm/index.mjs +384 -341
- package/dist/npm/legacy/umd/index.js +384 -341
- package/dist/npm/modern/bundled/cjs/index.cjs +156 -119
- package/dist/npm/modern/bundled/esm/index.mjs +156 -119
- package/dist/npm/modern/bundled/umd/index.js +156 -119
- package/dist/npm/modern/cjs/index.cjs +64 -27
- package/dist/npm/modern/content-script/cjs/index.cjs +156 -119
- package/dist/npm/modern/content-script/esm/index.mjs +156 -119
- package/dist/npm/modern/content-script/umd/index.js +156 -119
- package/dist/npm/modern/esm/index.mjs +64 -27
- package/dist/npm/modern/umd/index.js +64 -27
- package/package.json +1 -1
@@ -83,7 +83,7 @@ function _cloneRegExp(pattern){return new RegExp(pattern.source,pattern.flags?pa
|
|
83
83
|
* @return {*} The copied value.
|
84
84
|
*/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.
|
85
85
|
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.
|
86
|
-
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]=_clone(value[key],true,map);}}return copiedValue;};switch(type(value)){case'Object':return copy(Object.create(Object.getPrototypeOf(value)));case'Array':return copy(Array(value.length));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){/**
|
86
|
+
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]=_clone(value[key],true,map);}}return copiedValue;};switch(type(value)){case 'Object':return copy(Object.create(Object.getPrototypeOf(value)));case 'Array':return copy(Array(value.length));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){/**
|
87
87
|
* 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,
|
88
88
|
* on my tests this number is 180, anything above that using the hash function is faster.
|
89
89
|
*/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;}();
|
@@ -311,7 +311,22 @@ mergeDeepRight(mergedArray[index],value):value;});return mergedArray;};const mer
|
|
311
311
|
* A utility to recursively remove undefined and null values from an object
|
312
312
|
* @param obj input object
|
313
313
|
* @returns a new object
|
314
|
-
*/const removeUndefinedAndNullValues=obj=>{const result=pickBy(isDefinedAndNotNull,obj);Object.keys(result).forEach(key=>{const value=result[key];if(isObjectLiteralAndNotNull(value)){result[key]=removeUndefinedAndNullValues(value);}});return result;}
|
314
|
+
*/const removeUndefinedAndNullValues=obj=>{const result=pickBy(isDefinedAndNotNull,obj);Object.keys(result).forEach(key=>{const value=result[key];if(isObjectLiteralAndNotNull(value)){result[key]=removeUndefinedAndNullValues(value);}});return result;};/**
|
315
|
+
* Normalizes an object by removing undefined and null values.
|
316
|
+
* @param val - The value to normalize
|
317
|
+
* @returns The normalized object, or undefined if input is not a non-empty object
|
318
|
+
* @example
|
319
|
+
* getNormalizedObjectValue({ a: 1, b: null, c: undefined }) // returns { a: 1 }
|
320
|
+
* getNormalizedObjectValue({}) // returns undefined
|
321
|
+
* getNormalizedObjectValue(null) // returns undefined
|
322
|
+
*/const getNormalizedObjectValue=val=>{if(!isNonEmptyObject(val)){return undefined;}return removeUndefinedAndNullValues(val);};/**
|
323
|
+
* Normalizes a value to a boolean, with support for a default value
|
324
|
+
* @param val Input value
|
325
|
+
* @param defVal Default value
|
326
|
+
* @returns Returns the normalized boolean value
|
327
|
+
* @example
|
328
|
+
* getNormalizedBooleanValue(true, false) // returns true
|
329
|
+
*/const getNormalizedBooleanValue=(val,defVal)=>{if(isDefined(defVal)){return isDefined(val)?val===true:defVal;}return val===true;};
|
315
330
|
|
316
331
|
const trim=value=>value.replace(/^\s+|\s+$/gm,'');const removeDoubleSpaces=value=>value.replace(/ {2,}/g,' ');const removeLeadingPeriod=value=>value.replace(/^\.+/,'');/**
|
317
332
|
* A function to convert values to string
|
@@ -459,7 +474,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
|
459
474
|
* @returns Instance of Error with message prepended with issue
|
460
475
|
*/const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
|
461
476
|
|
462
|
-
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.
|
477
|
+
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.12.0';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
463
478
|
|
464
479
|
const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
465
480
|
|
@@ -502,7 +517,7 @@ preloadedEventsArray.splice(0,preloadedEventsArray.length,...consentEvents,...no
|
|
502
517
|
* Retrieve any existing events that were triggered before SDK load and enqueue in buffer
|
503
518
|
*/const retrievePreloadBufferEvents=instance=>{const preloadedEventsArray=getExposedGlobal(GLOBAL_PRELOAD_BUFFER)||[];// Get events that are pre-populated via query string params
|
504
519
|
retrieveEventsFromQueryString(preloadedEventsArray);// Enqueue the non load events in the buffer of the global rudder analytics singleton
|
505
|
-
if(preloadedEventsArray.length>0){instance.enqueuePreloadBufferEvents(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,[]);}};const consumePreloadBufferedEvent=(event,analyticsInstance)=>{const methodName=event.shift();let callOptions;if(isFunction(analyticsInstance[methodName])){switch(methodName){case'page':callOptions=pageArgumentsToCallOptions(...event);break;case'track':callOptions=trackArgumentsToCallOptions(...event);break;case'identify':callOptions=identifyArgumentsToCallOptions(...event);break;case'alias':callOptions=aliasArgumentsToCallOptions(...event);break;case'group':callOptions=groupArgumentsToCallOptions(...event);break;default:analyticsInstance[methodName](...event);break;}if(callOptions){analyticsInstance[methodName](callOptions);}}};
|
520
|
+
if(preloadedEventsArray.length>0){instance.enqueuePreloadBufferEvents(preloadedEventsArray);setExposedGlobal(GLOBAL_PRELOAD_BUFFER,[]);}};const consumePreloadBufferedEvent=(event,analyticsInstance)=>{const methodName=event.shift();let callOptions;if(isFunction(analyticsInstance[methodName])){switch(methodName){case 'page':callOptions=pageArgumentsToCallOptions(...event);break;case 'track':callOptions=trackArgumentsToCallOptions(...event);break;case 'identify':callOptions=identifyArgumentsToCallOptions(...event);break;case 'alias':callOptions=aliasArgumentsToCallOptions(...event);break;case 'group':callOptions=groupArgumentsToCallOptions(...event);break;default:analyticsInstance[methodName](...event);break;}if(callOptions){analyticsInstance[methodName](callOptions);}}};
|
506
521
|
|
507
522
|
const DEFAULT_EXT_SRC_LOAD_TIMEOUT_MS=10*1000;// 10 seconds
|
508
523
|
|
@@ -550,7 +565,7 @@ timeoutID=globalThis.setTimeout(()=>{reject(new Error(SCRIPT_LOAD_TIMEOUT_ERROR(
|
|
550
565
|
* Handle errors
|
551
566
|
*/onError(error){if(this.hasErrorHandler){this.errorHandler?.onError(error,EXTERNAL_SRC_LOADER);}else {throw error;}}}
|
552
567
|
|
553
|
-
var i=Symbol.for("preact-signals");function t(){if(!(s>1)){var i,t
|
568
|
+
var i=Symbol.for("preact-signals");function t(){if(!(s>1)){var i,t=false;while(undefined!==h){var r=h;h=undefined;f++;while(undefined!==r){var o=r.o;r.o=undefined;r.f&=-3;if(!(8&r.f)&&c(r))try{r.c();}catch(r){if(!t){i=r;t=true;}}r=o;}}f=0;s--;if(t)throw i;}else s--;}function r(i){if(s>0)return i();s++;try{return i();}finally{t();}}var o=undefined;var h=undefined,s=0,f=0,v=0;function e(i){if(undefined!==o){var t=i.n;if(undefined===t||t.t!==o){t={i:0,S:i,p:o.s,n:undefined,t:o,e:undefined,x:undefined,r:t};if(undefined!==o.s)o.s.n=t;o.s=t;i.n=t;if(32&o.f)i.S(t);return t;}else if(-1===t.i){t.i=0;if(undefined!==t.n){t.n.p=t.p;if(undefined!==t.p)t.p.n=t.n;t.p=o.s;t.n=undefined;o.s.n=t;o.s=t;}return t;}}}function u(i){this.v=i;this.i=0;this.n=undefined;this.t=undefined;}u.prototype.brand=i;u.prototype.h=function(){return true;};u.prototype.S=function(i){if(this.t!==i&&undefined===i.e){i.x=this.t;if(undefined!==this.t)this.t.e=i;this.t=i;}};u.prototype.U=function(i){if(undefined!==this.t){var t=i.e,r=i.x;if(undefined!==t){t.x=r;i.e=undefined;}if(undefined!==r){r.e=t;i.x=undefined;}if(i===this.t)this.t=r;}};u.prototype.subscribe=function(i){var t=this;return E(function(){var r=t.value,n=o;o=undefined;try{i(r);}finally{o=n;}});};u.prototype.valueOf=function(){return this.value;};u.prototype.toString=function(){return this.value+"";};u.prototype.toJSON=function(){return this.value;};u.prototype.peek=function(){var i=o;o=undefined;try{return this.value;}finally{o=i;}};Object.defineProperty(u.prototype,"value",{get:function(){var i=e(this);if(undefined!==i)i.i=this.i;return this.v;},set:function(i){if(i!==this.v){if(f>100)throw new Error("Cycle detected");this.v=i;this.i++;v++;s++;try{for(var r=this.t;void 0!==r;r=r.x)r.t.N();}finally{t();}}}});function d$1(i){return new u(i);}function c(i){for(var t=i.s;undefined!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return true;return false;}function a(i){for(var t=i.s;undefined!==t;t=t.n){var r=t.S.n;if(undefined!==r)t.r=r;t.S.n=t;t.i=-1;if(undefined===t.n){i.s=t;break;}}}function l(i){var t=i.s,r=undefined;while(undefined!==t){var o=t.p;if(-1===t.i){t.S.U(t);if(undefined!==o)o.n=t.n;if(undefined!==t.n)t.n.p=o;}else r=t;t.S.n=t.r;if(undefined!==t.r)t.r=undefined;t=o;}i.s=r;}function y(i){u.call(this,undefined);this.x=i;this.s=undefined;this.g=v-1;this.f=4;}(y.prototype=new u()).h=function(){this.f&=-3;if(1&this.f)return false;if(32==(36&this.f))return true;this.f&=-5;if(this.g===v)return true;this.g=v;this.f|=1;if(this.i>0&&!c(this)){this.f&=-2;return true;}var i=o;try{a(this);o=this;var t=this.x();if(16&this.f||this.v!==t||0===this.i){this.v=t;this.f&=-17;this.i++;}}catch(i){this.v=i;this.f|=16;this.i++;}o=i;l(this);this.f&=-2;return true;};y.prototype.S=function(i){if(undefined===this.t){this.f|=36;for(var t=this.s;undefined!==t;t=t.n)t.S.S(t);}u.prototype.S.call(this,i);};y.prototype.U=function(i){if(undefined!==this.t){u.prototype.U.call(this,i);if(undefined===this.t){this.f&=-33;for(var t=this.s;undefined!==t;t=t.n)t.S.U(t);}}};y.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var i=this.t;undefined!==i;i=i.x)i.t.N();}};Object.defineProperty(y.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var i=e(this);this.h();if(undefined!==i)i.i=this.i;if(16&this.f)throw this.v;return this.v;}});function _(i){var r=i.u;i.u=undefined;if("function"==typeof r){s++;var n=o;o=undefined;try{r();}catch(t){i.f&=-2;i.f|=8;g(i);throw t;}finally{o=n;t();}}}function g(i){for(var t=i.s;undefined!==t;t=t.n)t.S.U(t);i.x=undefined;i.s=undefined;_(i);}function p(i){if(o!==this)throw new Error("Out-of-order effect");l(this);o=i;this.f&=-2;if(8&this.f)g(this);t();}function b(i){this.x=i;this.u=undefined;this.s=undefined;this.o=undefined;this.f=32;}b.prototype.c=function(){var i=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();if("function"==typeof t)this.u=t;}finally{i();}};b.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1;this.f&=-9;_(this);a(this);s++;var i=o;o=this;return p.bind(this,i);};b.prototype.N=function(){if(!(2&this.f)){this.f|=2;this.o=h;h=this;}};b.prototype.d=function(){this.f|=8;if(!(1&this.f))g(this);};function E(i){var t=new b(i);try{t.c();}catch(i){t.d();throw i;}return t.d.bind(t);}
|
554
569
|
|
555
570
|
/**
|
556
571
|
* A buffer queue to serve as a store for any type of data
|
@@ -577,7 +592,7 @@ let ErrorType=/*#__PURE__*/function(ErrorType){ErrorType["HANDLEDEXCEPTION"]="ha
|
|
577
592
|
// default is v3
|
578
593
|
const SUPPORTED_STORAGE_TYPES=['localStorage','memoryStorage','cookieStorage','sessionStorage','none'];const DEFAULT_STORAGE_TYPE='cookieStorage';
|
579
594
|
|
580
|
-
const SOURCE_CONFIG_OPTION_ERROR=`"getSourceConfig" must be a function. Please make sure that it is defined and returns a valid source configuration object.`;const SOURCE_CONFIG_RESOLUTION_ERROR=`Unable to process/parse source configuration response.`;const SOURCE_DISABLED_ERROR=`The source is disabled. Please enable the source in the dashboard to send events.`;const XHR_PAYLOAD_PREP_ERROR=`Failed to prepare data for the request.`;const EVENT_OBJECT_GENERATION_ERROR=`Failed to generate the event object.`;const PLUGIN_EXT_POINT_MISSING_ERROR=`Failed to invoke plugin because the extension point name is missing.`;const PLUGIN_EXT_POINT_INVALID_ERROR=`Failed to invoke plugin because the extension point name is invalid.`;const COMPONENT_BASE_URL_ERROR=component=>`Failed to load the SDK as the base URL for ${component} is not valid.`;// ERROR
|
595
|
+
const SOURCE_CONFIG_OPTION_ERROR=`"getSourceConfig" must be a function. Please make sure that it is defined and returns a valid source configuration object.`;const SOURCE_CONFIG_RESOLUTION_ERROR=`Unable to process/parse source configuration response.`;const SOURCE_DISABLED_ERROR=`The source is disabled. Please enable the source in the dashboard to send events.`;const XHR_PAYLOAD_PREP_ERROR=`Failed to prepare data for the request.`;const EVENT_OBJECT_GENERATION_ERROR=`Failed to generate the event object.`;const PLUGIN_EXT_POINT_MISSING_ERROR=`Failed to invoke plugin because the extension point name is missing.`;const PLUGIN_EXT_POINT_INVALID_ERROR=`Failed to invoke plugin because the extension point name is invalid.`;const COMPONENT_BASE_URL_ERROR=(component,url)=>`Failed to load the SDK as the base URL "${url}" for ${component} is not valid.`;// ERROR
|
581
596
|
const UNSUPPORTED_CONSENT_MANAGER_ERROR=(context,selectedConsentManager,consentManagersToPluginNameMap)=>`${context}${LOG_CONTEXT_SEPARATOR}The consent manager "${selectedConsentManager}" is not supported. Please choose one of the following supported consent managers: "${Object.keys(consentManagersToPluginNameMap)}".`;const REPORTING_PLUGIN_INIT_FAILURE_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to initialize the error reporting plugin.`;const NOTIFY_FAILURE_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to notify the error.`;const PLUGIN_NAME_MISSING_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Plugin name is missing.`;const PLUGIN_ALREADY_EXISTS_ERROR=(context,pluginName)=>`${context}${LOG_CONTEXT_SEPARATOR}Plugin "${pluginName}" already exists.`;const PLUGIN_NOT_FOUND_ERROR=(context,pluginName)=>`${context}${LOG_CONTEXT_SEPARATOR}Plugin "${pluginName}" not found.`;const PLUGIN_ENGINE_BUG_ERROR=(context,pluginName)=>`${context}${LOG_CONTEXT_SEPARATOR}Plugin "${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.`;const PLUGIN_DEPS_ERROR=(context,pluginName,notExistDeps)=>`${context}${LOG_CONTEXT_SEPARATOR}Plugin "${pluginName}" could not be loaded because some of its dependencies "${notExistDeps}" do not exist.`;const PLUGIN_INVOCATION_ERROR=(context,extPoint,pluginName)=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to invoke the "${extPoint}" extension point of plugin "${pluginName}".`;const STORAGE_UNAVAILABILITY_ERROR_PREFIX=(context,storageType)=>`${context}${LOG_CONTEXT_SEPARATOR}The "${storageType}" storage type is `;const SOURCE_CONFIG_FETCH_ERROR=reason=>`Failed to fetch the source config. Reason: ${reason}`;const WRITE_KEY_VALIDATION_ERROR=(context,writeKey)=>`${context}${LOG_CONTEXT_SEPARATOR}The write key "${writeKey}" is invalid. It must be a non-empty string. Please check that the write key is correct and try again.`;const DATA_PLANE_URL_VALIDATION_ERROR=(context,dataPlaneUrl)=>`${context}${LOG_CONTEXT_SEPARATOR}The data plane URL "${dataPlaneUrl}" is invalid. It must be a valid URL string. Please check that the data plane URL is correct and try again.`;const READY_API_CALLBACK_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}The provided callback is not a function.`;const XHR_DELIVERY_ERROR=(prefix,status,statusText,url)=>`${prefix} with status: ${status}, ${statusText} for URL: ${url}.`;const XHR_REQUEST_ERROR=(prefix,e,url)=>`${prefix} due to timeout or no connection (${e?e.type:''}) for URL: ${url}.`;const XHR_SEND_ERROR=(prefix,url)=>`${prefix} for URL: ${url}`;const STORE_DATA_SAVE_ERROR=key=>`Failed to save the value for "${key}" to storage`;const STORE_DATA_FETCH_ERROR=key=>`Failed to retrieve or parse data for "${key}" from storage`;const DATA_SERVER_REQUEST_FAIL_ERROR=status=>`The server responded with status ${status} while setting the cookies. As a fallback, the cookies will be set client side.`;const FAILED_SETTING_COOKIE_FROM_SERVER_ERROR=key=>`The server failed to set the ${key} cookie. As a fallback, the cookies will be set client side.`;const FAILED_SETTING_COOKIE_FROM_SERVER_GLOBAL_ERROR=`Failed to set/remove cookies via server. As a fallback, the cookies will be managed client side.`;// WARNING
|
582
597
|
const STORAGE_TYPE_VALIDATION_WARNING=(context,storageType,defaultStorageType)=>`${context}${LOG_CONTEXT_SEPARATOR}The storage type "${storageType}" is not supported. Please choose one of the following supported types: "${SUPPORTED_STORAGE_TYPES}". The default type "${defaultStorageType}" will be used instead.`;const UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING=(context,selectedStorageEncryptionVersion,storageEncryptionVersionsToPluginNameMap,defaultVersion)=>`${context}${LOG_CONTEXT_SEPARATOR}The storage encryption version "${selectedStorageEncryptionVersion}" is not supported. Please choose one of the following supported versions: "${Object.keys(storageEncryptionVersionsToPluginNameMap)}". The default version "${defaultVersion}" will be used instead.`;const STORAGE_DATA_MIGRATION_OVERRIDE_WARNING=(context,storageEncryptionVersion,defaultVersion)=>`${context}${LOG_CONTEXT_SEPARATOR}The storage data migration has been disabled because the configured storage encryption version (${storageEncryptionVersion}) is not the latest (${defaultVersion}). To enable storage data migration, please update the storage encryption version to the latest version.`;const SERVER_SIDE_COOKIE_FEATURE_OVERRIDE_WARNING=(context,providedCookieDomain,currentCookieDomain)=>`${context}${LOG_CONTEXT_SEPARATOR}The provided cookie domain (${providedCookieDomain}) does not match the current webpage's domain (${currentCookieDomain}). Hence, the cookies will be set client-side.`;const RESERVED_KEYWORD_WARNING=(context,property,parentKeyPath,reservedElements)=>`${context}${LOG_CONTEXT_SEPARATOR}The "${property}" property defined under "${parentKeyPath}" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (${reservedElements}).`;const UNSUPPORTED_BEACON_API_WARNING=context=>`${context}${LOG_CONTEXT_SEPARATOR}The Beacon API is not supported by your browser. The events will be sent using XHR instead.`;const TIMEOUT_NOT_NUMBER_WARNING=(context,timeout,defaultValue)=>`${context}${LOG_CONTEXT_SEPARATOR}The session timeout value "${timeout}" is not a number. The default timeout of ${defaultValue} ms will be used instead.`;const TIMEOUT_ZERO_WARNING=context=>`${context}${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.`;const TIMEOUT_NOT_RECOMMENDED_WARNING=(context,timeout,minTimeout)=>`${context}${LOG_CONTEXT_SEPARATOR}The session timeout value ${timeout} ms is less than the recommended minimum of ${minTimeout} ms. Please consider increasing the timeout value to ensure optimal performance and reliability.`;const INVALID_SESSION_ID_WARNING=(context,sessionId,minSessionIdLength)=>`${context}${LOG_CONTEXT_SEPARATOR}The provided session ID (${sessionId}) is either invalid, not a positive integer, or not at least "${minSessionIdLength}" digits long. A new session ID will be auto-generated instead.`;const STORAGE_QUOTA_EXCEEDED_WARNING=context=>`${context}${LOG_CONTEXT_SEPARATOR}The storage is either full or unavailable, so the data will not be persisted. Switching to in-memory storage.`;const STORAGE_UNAVAILABLE_WARNING=(context,entry,selectedStorageType,finalStorageType)=>`${context}${LOG_CONTEXT_SEPARATOR}The storage type "${selectedStorageType}" is not available for entry "${entry}". The SDK will initialize the entry with "${finalStorageType}" storage type instead.`;const READY_CALLBACK_INVOKE_ERROR=`Failed to invoke the ready callback`;const API_CALLBACK_INVOKE_ERROR=`API Callback Invocation Failed`;const NATIVE_DEST_PLUGIN_INITIALIZE_ERROR=`NativeDestinationQueuePlugin initialization failed`;const DATAPLANE_PLUGIN_INITIALIZE_ERROR=`XhrQueuePlugin initialization failed`;const DMT_PLUGIN_INITIALIZE_ERROR=`DeviceModeTransformationPlugin initialization failed`;const NATIVE_DEST_PLUGIN_ENQUEUE_ERROR=`NativeDestinationQueuePlugin event enqueue failed`;const DATAPLANE_PLUGIN_ENQUEUE_ERROR=`XhrQueuePlugin event enqueue failed`;const INVALID_CONFIG_URL_WARNING=(context,configUrl)=>`${context}${LOG_CONTEXT_SEPARATOR}The provided source config URL "${configUrl}" is invalid. Using the default source config URL instead.`;const POLYFILL_SCRIPT_LOAD_ERROR=(scriptId,url)=>`Failed to load the polyfill script with ID "${scriptId}" from URL ${url}.`;const UNSUPPORTED_PRE_CONSENT_STORAGE_STRATEGY=(context,selectedStrategy,defaultStrategy)=>`${context}${LOG_CONTEXT_SEPARATOR}The pre-consent storage strategy "${selectedStrategy}" is not supported. Please choose one of the following supported strategies: "none, session, anonymousId". The default strategy "${defaultStrategy}" will be used instead.`;const UNSUPPORTED_PRE_CONSENT_EVENTS_DELIVERY_TYPE=(context,selectedDeliveryType,defaultDeliveryType)=>`${context}${LOG_CONTEXT_SEPARATOR}The pre-consent events delivery type "${selectedDeliveryType}" is not supported. Please choose one of the following supported types: "immediate, buffer". The default type "${defaultDeliveryType}" will be used instead.`;const generateMisconfiguredPluginsWarning=(context,configurationStatus,missingPlugins,shouldAddMissingPlugins)=>{const isSinglePlugin=missingPlugins.length===1;const pluginsString=isSinglePlugin?` '${missingPlugins[0]}' plugin was`:` ['${missingPlugins.join("', '")}'] plugins were`;const baseWarning=`${context}${LOG_CONTEXT_SEPARATOR}${configurationStatus}, but${pluginsString} not configured to load.`;if(shouldAddMissingPlugins){return `${baseWarning} So, ${isSinglePlugin?'the plugin':'those plugins'} will be loaded automatically.`;}return `${baseWarning} Ignore if this was intentional. Otherwise, consider adding ${isSinglePlugin?'it':'them'} to the 'plugins' load API option.`;};const INVALID_POLYFILL_URL_WARNING=(context,customPolyfillUrl)=>`${context}${LOG_CONTEXT_SEPARATOR}The provided polyfill URL "${customPolyfillUrl}" is invalid. The default polyfill URL will be used instead.`;const BAD_COOKIES_WARNING=key=>`The cookie data for ${key} seems to be encrypted using SDK versions < v3. The data is dropped. This can potentially stem from using SDK versions < v3 on other sites or web pages that can share cookies with this webpage. We recommend using the same SDK (v3) version everywhere or avoid disabling the storage data migration.`;const PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING=context=>`${context}${LOG_CONTEXT_SEPARATOR}Page Unloaded event can only be tracked when the Beacon transport is active. Please enable "useBeacon" load API option.`;
|
583
598
|
|
@@ -594,11 +609,11 @@ const CDN_INT_DIR='js-integrations';const CDN_PLUGINS_DIR='plugins';const URL_PA
|
|
594
609
|
'(\\#[-a-zA-Z\\d_]*)?$')// fragment locator
|
595
610
|
;
|
596
611
|
|
597
|
-
const BUILD_TYPE='modern';const SDK_CDN_BASE_URL='https://cdn.rudderlabs.com';const CDN_ARCH_VERSION_DIR='v3';const
|
612
|
+
const BUILD_TYPE='modern';const SDK_CDN_BASE_URL='https://cdn.rudderlabs.com';const CDN_ARCH_VERSION_DIR='v3';const DEFAULT_INTEGRATION_SDKS_URL=`${SDK_CDN_BASE_URL}/${CDN_ARCH_VERSION_DIR}/${BUILD_TYPE}/${CDN_INT_DIR}`;const DEFAULT_PLUGINS_URL=`${SDK_CDN_BASE_URL}/${CDN_ARCH_VERSION_DIR}/${BUILD_TYPE}/${CDN_PLUGINS_DIR}`;const DEFAULT_CONFIG_BE_URL='https://api.rudderstack.com';
|
598
613
|
|
599
614
|
const DEFAULT_STORAGE_ENCRYPTION_VERSION='v3';const DEFAULT_DATA_PLANE_EVENTS_TRANSPORT='xhr';const ConsentManagersToPluginNameMap={iubenda:'IubendaConsentManager',oneTrust:'OneTrustConsentManager',ketch:'KetchConsentManager',custom:'CustomConsentManager'};const StorageEncryptionVersionsToPluginNameMap={[DEFAULT_STORAGE_ENCRYPTION_VERSION]:'StorageEncryption',legacy:'StorageEncryptionLegacy'};const DataPlaneEventsTransportToPluginNameMap={[DEFAULT_DATA_PLANE_EVENTS_TRANSPORT]:'XhrQueue',beacon:'BeaconQueue'};const DEFAULT_DATA_SERVICE_ENDPOINT='rsaRequest';const METRICS_SERVICE_ENDPOINT='rsaMetrics';
|
600
615
|
|
601
|
-
const defaultLoadOptions={logLevel:'ERROR',configUrl:DEFAULT_CONFIG_BE_URL,loadIntegration:true,sessions:{autoTrack:true,timeout:DEFAULT_SESSION_TIMEOUT_MS},sameSiteCookie:'Lax',polyfillIfRequired:true,integrations:DEFAULT_INTEGRATIONS_CONFIG,useBeacon:false,beaconQueueOptions:{},destinationsQueueOptions:{},queueOptions:{},lockIntegrationsVersion:false,lockPluginsVersion:false,uaChTrackLevel:'none',plugins:[],useGlobalIntegrationsConfigInEvents:false,bufferDataPlaneEventsUntilReady:false,dataPlaneEventsBufferTimeout:DEFAULT_DATA_PLANE_EVENTS_BUFFER_TIMEOUT_MS,storage:{encryption:{version:DEFAULT_STORAGE_ENCRYPTION_VERSION},migrate:true,cookie:{}},sendAdblockPageOptions:{},useServerSideCookies:false};const loadOptionsState=d$1(clone(defaultLoadOptions));
|
616
|
+
const defaultLoadOptions={logLevel:'ERROR',configUrl:DEFAULT_CONFIG_BE_URL,loadIntegration:true,sessions:{autoTrack:true,timeout:DEFAULT_SESSION_TIMEOUT_MS},sameSiteCookie:'Lax',polyfillIfRequired:true,integrations:DEFAULT_INTEGRATIONS_CONFIG,useBeacon:false,beaconQueueOptions:{},destinationsQueueOptions:{},queueOptions:{},lockIntegrationsVersion:false,lockPluginsVersion:false,uaChTrackLevel:'none',plugins:[],useGlobalIntegrationsConfigInEvents:false,bufferDataPlaneEventsUntilReady:false,dataPlaneEventsBufferTimeout:DEFAULT_DATA_PLANE_EVENTS_BUFFER_TIMEOUT_MS,storage:{encryption:{version:DEFAULT_STORAGE_ENCRYPTION_VERSION},migrate:true,cookie:{}},sendAdblockPage:false,sameDomainCookiesOnly:false,secureCookie:false,sendAdblockPageOptions:{},useServerSideCookies:false};const loadOptionsState=d$1(clone(defaultLoadOptions));
|
602
617
|
|
603
618
|
const DEFAULT_USER_SESSION_VALUES={userId:'',userTraits:{},anonymousId:'',groupId:'',groupTraits:{},initialReferrer:'',initialReferringDomain:'',sessionInfo:{},authToken:null};const SERVER_SIDE_COOKIES_DEBOUNCE_TIME=10;// milliseconds
|
604
619
|
|
@@ -610,7 +625,7 @@ const reportingState={isErrorReportingEnabled:d$1(false),isMetricsReportingEnabl
|
|
610
625
|
|
611
626
|
const sourceConfigState=d$1(undefined);
|
612
627
|
|
613
|
-
const lifecycleState={activeDataplaneUrl:d$1(undefined),integrationsCDNPath:d$1(
|
628
|
+
const lifecycleState={activeDataplaneUrl:d$1(undefined),integrationsCDNPath:d$1(DEFAULT_INTEGRATION_SDKS_URL),pluginsCDNPath:d$1(DEFAULT_PLUGINS_URL),sourceConfigUrl:d$1(undefined),status:d$1(undefined),initialized:d$1(false),logLevel:d$1('ERROR'),loaded:d$1(false),readyCallbacks:d$1([]),writeKey:d$1(undefined),dataPlaneUrl:d$1(undefined)};
|
614
629
|
|
615
630
|
const consentsState={enabled:d$1(false),initialized:d$1(false),data:d$1({}),activeConsentManagerPluginName:d$1(undefined),preConsent:d$1({enabled:false}),postConsent:d$1({}),resolutionStrategy:d$1('and'),provider:d$1(undefined),metadata:d$1(undefined)};
|
616
631
|
|
@@ -943,7 +958,7 @@ if(!consentManagement){return true;}// Get the corresponding consents for the de
|
|
943
958
|
const cmpConfig=consentManagement.find(c=>c.provider===state.consents.provider.value);// If there are no consents configured for the destination for the current provider, events should be sent.
|
944
959
|
if(!cmpConfig?.consents){return true;}const configuredConsents=cmpConfig.consents.map(c=>c.consent.trim()).filter(n=>n);const resolutionStrategy=cmpConfig.resolutionStrategy??state.consents.resolutionStrategy.value;// match the configured consents with user provided consents as per
|
945
960
|
// the configured resolution strategy
|
946
|
-
const matchPredicate=consent=>allowedConsentIds.includes(consent);switch(resolutionStrategy){case'or':return configuredConsents.some(matchPredicate)||configuredConsents.length===0;case'and':default:return configuredConsents.every(matchPredicate);}}catch(err){errorHandler?.onError(err,CUSTOM_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR$3);return true;}}}});
|
961
|
+
const matchPredicate=consent=>allowedConsentIds.includes(consent);switch(resolutionStrategy){case 'or':return configuredConsents.some(matchPredicate)||configuredConsents.length===0;case 'and':default:return configuredConsents.every(matchPredicate);}}catch(err){errorHandler?.onError(err,CUSTOM_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR$3);return true;}}}});
|
947
962
|
|
948
963
|
const READY_CHECK_TIMEOUT_MS=11*1000;// 11 seconds
|
949
964
|
const SCRIPT_LOAD_TIMEOUT_MS=10*1000;// 10 seconds
|
@@ -959,170 +974,170 @@ const isDestIntgConfigTruthy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boole
|
|
959
974
|
* @returns Destinations array filtered based on the integration options
|
960
975
|
*/const filterDestinations=(intgOpts,destinations)=>{const allOptVal=intgOpts.All??true;return destinations.filter(dest=>{const destDisplayName=dest.displayName;let isDestEnabled;if(allOptVal){isDestEnabled=true;if(isDestIntgConfigFalsy(intgOpts[destDisplayName])){isDestEnabled=false;}}else {isDestEnabled=false;if(isDestIntgConfigTruthy(intgOpts[destDisplayName])){isDestEnabled=true;}}return isDestEnabled;});};
|
961
976
|
|
962
|
-
const
|
977
|
+
const ACTIVE_CAMPAIGN_DISPLAY_NAME='ActiveCampaign';const ADOBE_ANALYTICS_DISPLAY_NAME='Adobe Analytics';const ADROLL_DISPLAY_NAME='Adroll';const AM_DISPLAY_NAME='Amplitude';const APPCUES_DISPLAY_NAME='Appcues';const AXEPTIO_DISPLAY_NAME='Axeptio';const BINGADS_DISPLAY_NAME='Bing Ads';const BRAZE_DISPLAY_NAME='Braze';const BUGSNAG_DISPLAY_NAME='Bugsnag';const CHARTBEAT_DISPLAY_NAME='Chartbeat';const CLEVERTAP_DISPLAY_NAME='CleverTap';const COMMANDBAR_DISPLAY_NAME='CommandBar';const CONVERTFLOW_DISPLAY_NAME='Convertflow';const CRITEO_DISPLAY_NAME='Criteo';const CUSTOMERIO_DISPLAY_NAME='Customer IO';const DCM_FLOODLIGHT_DISPLAY_NAME='DCM Floodlight';const DRIP_DISPLAY_NAME='Drip';const ENGAGE_DISPLAY_NAME='Engage';const FACEBOOK_PIXEL_DISPLAY_NAME='Facebook Pixel';const FULLSTORY_DISPLAY_NAME='Fullstory';const GA_DISPLAY_NAME='Google Analytics';const GA360_DISPLAY_NAME='Google Analytics 360';const GA4_DISPLAY_NAME='Google Analytics 4 (GA4)';const GA4_V2_DISPLAY_NAME='Google Analytics 4 (GA4) V2';const GAINSIGHT_PX_DISPLAY_NAME='Gainsight PX';const GOOGLE_OPTIMIZE_DISPLAY_NAME='Google Optimize';const GOOGLEADS_DISPLAY_NAME='Google Ads';const GTM_DISPLAY_NAME='Google Tag Manager';const HEAP_DISPLAY_NAME='Heap.io';const HOTJAR_DISPLAY_NAME='Hotjar';const HS_DISPLAY_NAME='HubSpot';const INTERCOM_DISPLAY_NAME='Intercom';const ITERABLE_DISPLAY_NAME='Iterable';const JUNE_DISPLAY_NAME='JUNE';const KEEN_DISPLAY_NAME='Keen';const KISSMETRICS_DISPLAY_NAME='Kiss Metrics';const KLAVIYO_DISPLAY_NAME='Klaviyo';const LAUNCHDARKLY_DISPLAY_NAME='LaunchDarkly';const LEMNISK_DISPLAY_NAME='Lemnisk Marketing Automation';const LINKEDIN_INSIGHT_TAG_DISPLAY_NAME='Linkedin Insight Tag';const LIVECHAT_DISPLAY_NAME='livechat';const LOTAME_DISPLAY_NAME='Lotame';const LYTICS_DISPLAY_NAME='Lytics';const MATOMO_DISPLAY_NAME='Matomo';const MICROSOFT_CLARITY_DISPLAY_NAME='Microsoft Clarity';const MOENGAGE_DISPLAY_NAME='MoEngage';const MOUSEFLOW_DISPLAY_NAME='Mouseflow';const MP_DISPLAY_NAME='Mixpanel';const NINETAILED_DISPLAY_NAME='Ninetailed';const OLARK_DISPLAY_NAME='Olark';const OPTIMIZELY_DISPLAY_NAME='Optimizely Web';const PENDO_DISPLAY_NAME='Pendo';const PINTEREST_TAG_DISPLAY_NAME='Pinterest Tag';const PODSIGHTS_DISPLAY_NAME='Podsights';const POST_AFFILIATE_PRO_DISPLAY_NAME='Post Affiliate Pro';const POSTHOG_DISPLAY_NAME='PostHog';const PROFITWELL_DISPLAY_NAME='ProfitWell';const QUALAROO_DISPLAY_NAME='Qualaroo';const QUALTRICS_DISPLAY_NAME='Qualtrics';const QUANTUMMETRIC_DISPLAY_NAME='Quantum Metric';const QUORA_PIXEL_DISPLAY_NAME='Quora Pixel';const REDDIT_PIXEL_DISPLAY_NAME='Reddit Pixel';const REFINER_DISPLAY_NAME='Refiner';const ROCKERBOX_DISPLAY_NAME='Rockerbox';const ROLLBAR_DISPLAY_NAME='rollbar';const SATISMETER_DISPLAY_NAME='SatisMeter';const SENDINBLUE_DISPLAY_NAME='Sendinblue';const SENTRY_DISPLAY_NAME='Sentry';const SHYNET_DISPLAY_NAME='Shynet';const SNAP_PIXEL_DISPLAY_NAME='Snap Pixel';const SNAPENGAGE_DISPLAY_NAME='SnapEngage';const SPOTIFYPIXEL_DISPLAY_NAME='Spotify Pixel';const SPRIG_DISPLAY_NAME='Sprig';const TIKTOK_ADS_DISPLAY_NAME='TikTok Ads';const TVSQUARED_DISPLAY_NAME='TVSquared';const VERO_DISPLAY_NAME='Vero';const VWO_DISPLAY_NAME='VWO';const WOOPRA_DISPLAY_NAME='WOOPRA';const XPIXEL_DISPLAY_NAME='XPixel';const YANDEX_METRICA_DISPLAY_NAME='Yandex.Metrica';
|
963
978
|
|
964
|
-
const DIR_NAME$1f='
|
979
|
+
const DIR_NAME$1f='AdobeAnalytics';
|
965
980
|
|
966
|
-
const DIR_NAME$1e='
|
981
|
+
const DIR_NAME$1e='Amplitude';
|
967
982
|
|
968
|
-
const DIR_NAME$1d='
|
983
|
+
const DIR_NAME$1d='Appcues';
|
969
984
|
|
970
|
-
const DIR_NAME$1c='
|
985
|
+
const DIR_NAME$1c='BingAds';
|
971
986
|
|
972
|
-
const DIR_NAME$1b='
|
987
|
+
const DIR_NAME$1b='Braze';
|
973
988
|
|
974
|
-
const DIR_NAME$1a='
|
989
|
+
const DIR_NAME$1a='Bugsnag';
|
975
990
|
|
976
|
-
const DIR_NAME$19='
|
991
|
+
const DIR_NAME$19='Chartbeat';
|
977
992
|
|
978
|
-
const DIR_NAME$18='
|
993
|
+
const DIR_NAME$18='Clevertap';
|
979
994
|
|
980
|
-
const DIR_NAME$17='Criteo';
|
995
|
+
const DIR_NAME$17='Criteo';
|
981
996
|
|
982
|
-
const DIR_NAME$16='CustomerIO';
|
997
|
+
const DIR_NAME$16='CustomerIO';
|
983
998
|
|
984
|
-
const DIR_NAME$15='Drip';
|
999
|
+
const DIR_NAME$15='Drip';
|
985
1000
|
|
986
|
-
const DIR_NAME$14='FacebookPixel';
|
1001
|
+
const DIR_NAME$14='FacebookPixel';
|
987
1002
|
|
988
|
-
const DIR_NAME$13='Fullstory';
|
1003
|
+
const DIR_NAME$13='Fullstory';
|
989
1004
|
|
990
|
-
const DIR_NAME$12='GA';
|
1005
|
+
const DIR_NAME$12='GA';
|
991
1006
|
|
992
|
-
const DIR_NAME$11='GA4';
|
1007
|
+
const DIR_NAME$11='GA4';
|
993
1008
|
|
994
|
-
const DIR_NAME$10='GA4_V2';
|
1009
|
+
const DIR_NAME$10='GA4_V2';
|
995
1010
|
|
996
|
-
const DIR_NAME$$='GoogleAds';
|
1011
|
+
const DIR_NAME$$='GoogleAds';
|
997
1012
|
|
998
|
-
const DIR_NAME$_='GoogleOptimize';
|
1013
|
+
const DIR_NAME$_='GoogleOptimize';
|
999
1014
|
|
1000
|
-
const DIR_NAME$Z='GoogleTagManager';
|
1015
|
+
const DIR_NAME$Z='GoogleTagManager';
|
1001
1016
|
|
1002
|
-
const DIR_NAME$Y='Heap';
|
1017
|
+
const DIR_NAME$Y='Heap';
|
1003
1018
|
|
1004
|
-
const DIR_NAME$X='Hotjar';
|
1019
|
+
const DIR_NAME$X='Hotjar';
|
1005
1020
|
|
1006
|
-
const DIR_NAME$W='HubSpot';
|
1021
|
+
const DIR_NAME$W='HubSpot';
|
1007
1022
|
|
1008
|
-
const DIR_NAME$V='INTERCOM';
|
1023
|
+
const DIR_NAME$V='INTERCOM';
|
1009
1024
|
|
1010
|
-
const DIR_NAME$U='Keen';
|
1025
|
+
const DIR_NAME$U='Keen';
|
1011
1026
|
|
1012
|
-
const DIR_NAME$T='Kissmetrics';
|
1027
|
+
const DIR_NAME$T='Kissmetrics';
|
1013
1028
|
|
1014
|
-
const DIR_NAME$S='Klaviyo';
|
1029
|
+
const DIR_NAME$S='Klaviyo';
|
1015
1030
|
|
1016
|
-
const DIR_NAME$R='LaunchDarkly';
|
1031
|
+
const DIR_NAME$R='LaunchDarkly';
|
1017
1032
|
|
1018
|
-
const DIR_NAME$Q='LinkedInInsightTag';
|
1033
|
+
const DIR_NAME$Q='LinkedInInsightTag';
|
1019
1034
|
|
1020
|
-
const DIR_NAME$P='Lotame';
|
1035
|
+
const DIR_NAME$P='Lotame';
|
1021
1036
|
|
1022
|
-
const DIR_NAME$O='Lytics';
|
1037
|
+
const DIR_NAME$O='Lytics';
|
1023
1038
|
|
1024
|
-
const DIR_NAME$N='Mixpanel';
|
1039
|
+
const DIR_NAME$N='Mixpanel';
|
1025
1040
|
|
1026
|
-
const DIR_NAME$M='MoEngage';
|
1041
|
+
const DIR_NAME$M='MoEngage';
|
1027
1042
|
|
1028
|
-
const DIR_NAME$L='Optimizely';
|
1043
|
+
const DIR_NAME$L='Optimizely';
|
1029
1044
|
|
1030
|
-
const DIR_NAME$K='Pendo';
|
1045
|
+
const DIR_NAME$K='Pendo';
|
1031
1046
|
|
1032
|
-
const DIR_NAME$J='PinterestTag';
|
1047
|
+
const DIR_NAME$J='PinterestTag';
|
1033
1048
|
|
1034
|
-
const DIR_NAME$I='PostAffiliatePro';
|
1049
|
+
const DIR_NAME$I='PostAffiliatePro';
|
1035
1050
|
|
1036
|
-
const DIR_NAME$H='Posthog';
|
1051
|
+
const DIR_NAME$H='Posthog';
|
1037
1052
|
|
1038
|
-
const DIR_NAME$G='ProfitWell';
|
1053
|
+
const DIR_NAME$G='ProfitWell';
|
1039
1054
|
|
1040
|
-
const DIR_NAME$F='Qualtrics';
|
1055
|
+
const DIR_NAME$F='Qualtrics';
|
1041
1056
|
|
1042
|
-
const DIR_NAME$E='QuantumMetric';
|
1057
|
+
const DIR_NAME$E='QuantumMetric';
|
1043
1058
|
|
1044
|
-
const DIR_NAME$D='RedditPixel';
|
1059
|
+
const DIR_NAME$D='RedditPixel';
|
1045
1060
|
|
1046
|
-
const DIR_NAME$C='Sentry';
|
1061
|
+
const DIR_NAME$C='Sentry';
|
1047
1062
|
|
1048
|
-
const DIR_NAME$B='SnapPixel';
|
1063
|
+
const DIR_NAME$B='SnapPixel';
|
1049
1064
|
|
1050
|
-
const DIR_NAME$A='TVSquared';
|
1065
|
+
const DIR_NAME$A='TVSquared';
|
1051
1066
|
|
1052
|
-
const DIR_NAME$z='VWO';
|
1067
|
+
const DIR_NAME$z='VWO';
|
1053
1068
|
|
1054
|
-
const DIR_NAME$y='GA360';
|
1069
|
+
const DIR_NAME$y='GA360';
|
1055
1070
|
|
1056
|
-
const DIR_NAME$x='Adroll';
|
1071
|
+
const DIR_NAME$x='Adroll';
|
1057
1072
|
|
1058
|
-
const DIR_NAME$w='DCMFloodlight';
|
1073
|
+
const DIR_NAME$w='DCMFloodlight';
|
1059
1074
|
|
1060
|
-
const DIR_NAME$v='Matomo';
|
1075
|
+
const DIR_NAME$v='Matomo';
|
1061
1076
|
|
1062
|
-
const DIR_NAME$u='Vero';
|
1077
|
+
const DIR_NAME$u='Vero';
|
1063
1078
|
|
1064
|
-
const DIR_NAME$t='Mouseflow';
|
1079
|
+
const DIR_NAME$t='Mouseflow';
|
1065
1080
|
|
1066
|
-
const DIR_NAME$s='Rockerbox';
|
1081
|
+
const DIR_NAME$s='Rockerbox';
|
1067
1082
|
|
1068
|
-
const DIR_NAME$r='ConvertFlow';
|
1083
|
+
const DIR_NAME$r='ConvertFlow';
|
1069
1084
|
|
1070
|
-
const DIR_NAME$q='SnapEngage';
|
1085
|
+
const DIR_NAME$q='SnapEngage';
|
1071
1086
|
|
1072
|
-
const DIR_NAME$p='LiveChat';
|
1087
|
+
const DIR_NAME$p='LiveChat';
|
1073
1088
|
|
1074
|
-
const DIR_NAME$o='Shynet';
|
1089
|
+
const DIR_NAME$o='Shynet';
|
1075
1090
|
|
1076
|
-
const DIR_NAME$n='Woopra';
|
1091
|
+
const DIR_NAME$n='Woopra';
|
1077
1092
|
|
1078
|
-
const DIR_NAME$m='RollBar';
|
1093
|
+
const DIR_NAME$m='RollBar';
|
1079
1094
|
|
1080
|
-
const DIR_NAME$l='QuoraPixel';
|
1095
|
+
const DIR_NAME$l='QuoraPixel';
|
1081
1096
|
|
1082
|
-
const DIR_NAME$k='June';
|
1097
|
+
const DIR_NAME$k='June';
|
1083
1098
|
|
1084
|
-
const DIR_NAME$j='Engage';
|
1099
|
+
const DIR_NAME$j='Engage';
|
1085
1100
|
|
1086
|
-
const DIR_NAME$i='Iterable';
|
1101
|
+
const DIR_NAME$i='Iterable';
|
1087
1102
|
|
1088
|
-
const DIR_NAME$h='YandexMetrica';
|
1103
|
+
const DIR_NAME$h='YandexMetrica';
|
1089
1104
|
|
1090
|
-
const DIR_NAME$g='Refiner';
|
1105
|
+
const DIR_NAME$g='Refiner';
|
1091
1106
|
|
1092
|
-
const DIR_NAME$f='Qualaroo';
|
1107
|
+
const DIR_NAME$f='Qualaroo';
|
1093
1108
|
|
1094
|
-
const DIR_NAME$e='Podsights';
|
1109
|
+
const DIR_NAME$e='Podsights';
|
1095
1110
|
|
1096
|
-
const DIR_NAME$d='Axeptio';
|
1111
|
+
const DIR_NAME$d='Axeptio';
|
1097
1112
|
|
1098
|
-
const DIR_NAME$c='Satismeter';
|
1113
|
+
const DIR_NAME$c='Satismeter';
|
1099
1114
|
|
1100
|
-
const DIR_NAME$b='MicrosoftClarity';
|
1115
|
+
const DIR_NAME$b='MicrosoftClarity';
|
1101
1116
|
|
1102
|
-
const DIR_NAME$a='Sendinblue';
|
1117
|
+
const DIR_NAME$a='Sendinblue';
|
1103
1118
|
|
1104
|
-
const DIR_NAME$9='Olark';
|
1119
|
+
const DIR_NAME$9='Olark';
|
1105
1120
|
|
1106
|
-
const DIR_NAME$8='Lemnisk';
|
1121
|
+
const DIR_NAME$8='Lemnisk';
|
1107
1122
|
|
1108
|
-
const DIR_NAME$7='TiktokAds';
|
1123
|
+
const DIR_NAME$7='TiktokAds';
|
1109
1124
|
|
1110
|
-
const DIR_NAME$6='ActiveCampaign';
|
1125
|
+
const DIR_NAME$6='ActiveCampaign';
|
1111
1126
|
|
1112
|
-
const DIR_NAME$5='Sprig';
|
1127
|
+
const DIR_NAME$5='Sprig';
|
1113
1128
|
|
1114
|
-
const DIR_NAME$4='SpotifyPixel';
|
1129
|
+
const DIR_NAME$4='SpotifyPixel';
|
1115
1130
|
|
1116
|
-
const DIR_NAME$3='CommandBar';
|
1131
|
+
const DIR_NAME$3='CommandBar';
|
1117
1132
|
|
1118
|
-
const DIR_NAME$2='Ninetailed';
|
1133
|
+
const DIR_NAME$2='Ninetailed';
|
1119
1134
|
|
1120
|
-
const DIR_NAME$1='Gainsight_PX';
|
1135
|
+
const DIR_NAME$1='Gainsight_PX';
|
1121
1136
|
|
1122
|
-
const DIR_NAME='XPixel';
|
1137
|
+
const DIR_NAME='XPixel';
|
1123
1138
|
|
1124
1139
|
// map of the destination display names to the destination directory names
|
1125
|
-
const destDisplayNamesToFileNamesMap={[
|
1140
|
+
const destDisplayNamesToFileNamesMap={[HS_DISPLAY_NAME]:DIR_NAME$W,[GA_DISPLAY_NAME]:DIR_NAME$12,[HOTJAR_DISPLAY_NAME]:DIR_NAME$X,[GOOGLEADS_DISPLAY_NAME]:DIR_NAME$$,[VWO_DISPLAY_NAME]:DIR_NAME$z,[GTM_DISPLAY_NAME]:DIR_NAME$Z,[BRAZE_DISPLAY_NAME]:DIR_NAME$1b,[INTERCOM_DISPLAY_NAME]:DIR_NAME$V,[KEEN_DISPLAY_NAME]:DIR_NAME$U,[KISSMETRICS_DISPLAY_NAME]:DIR_NAME$T,[CUSTOMERIO_DISPLAY_NAME]:DIR_NAME$16,[CHARTBEAT_DISPLAY_NAME]:DIR_NAME$19,[FACEBOOK_PIXEL_DISPLAY_NAME]:DIR_NAME$14,[LOTAME_DISPLAY_NAME]:DIR_NAME$P,[OPTIMIZELY_DISPLAY_NAME]:DIR_NAME$L,[BUGSNAG_DISPLAY_NAME]:DIR_NAME$1a,[FULLSTORY_DISPLAY_NAME]:DIR_NAME$13,[TVSQUARED_DISPLAY_NAME]:DIR_NAME$A,[GA4_DISPLAY_NAME]:DIR_NAME$11,[GA4_V2_DISPLAY_NAME]:DIR_NAME$10,[MOENGAGE_DISPLAY_NAME]:DIR_NAME$M,[AM_DISPLAY_NAME]:DIR_NAME$1e,[PENDO_DISPLAY_NAME]:DIR_NAME$K,[LYTICS_DISPLAY_NAME]:DIR_NAME$O,[APPCUES_DISPLAY_NAME]:DIR_NAME$1d,[POSTHOG_DISPLAY_NAME]:DIR_NAME$H,[KLAVIYO_DISPLAY_NAME]:DIR_NAME$S,[CLEVERTAP_DISPLAY_NAME]:DIR_NAME$18,[BINGADS_DISPLAY_NAME]:DIR_NAME$1c,[PINTEREST_TAG_DISPLAY_NAME]:DIR_NAME$J,[ADOBE_ANALYTICS_DISPLAY_NAME]:DIR_NAME$1f,[LINKEDIN_INSIGHT_TAG_DISPLAY_NAME]:DIR_NAME$Q,[REDDIT_PIXEL_DISPLAY_NAME]:DIR_NAME$D,[DRIP_DISPLAY_NAME]:DIR_NAME$15,[HEAP_DISPLAY_NAME]:DIR_NAME$Y,[CRITEO_DISPLAY_NAME]:DIR_NAME$17,[MP_DISPLAY_NAME]:DIR_NAME$N,[QUALTRICS_DISPLAY_NAME]:DIR_NAME$F,[PROFITWELL_DISPLAY_NAME]:DIR_NAME$G,[SENTRY_DISPLAY_NAME]:DIR_NAME$C,[QUANTUMMETRIC_DISPLAY_NAME]:DIR_NAME$E,[SNAP_PIXEL_DISPLAY_NAME]:DIR_NAME$B,[POST_AFFILIATE_PRO_DISPLAY_NAME]:DIR_NAME$I,[GOOGLE_OPTIMIZE_DISPLAY_NAME]:DIR_NAME$_,[LAUNCHDARKLY_DISPLAY_NAME]:DIR_NAME$R,[GA360_DISPLAY_NAME]:DIR_NAME$y,[ADROLL_DISPLAY_NAME]:DIR_NAME$x,[DCM_FLOODLIGHT_DISPLAY_NAME]:DIR_NAME$w,[MATOMO_DISPLAY_NAME]:DIR_NAME$v,[VERO_DISPLAY_NAME]:DIR_NAME$u,[MOUSEFLOW_DISPLAY_NAME]:DIR_NAME$t,[ROCKERBOX_DISPLAY_NAME]:DIR_NAME$s,[CONVERTFLOW_DISPLAY_NAME]:DIR_NAME$r,[SNAPENGAGE_DISPLAY_NAME]:DIR_NAME$q,[LIVECHAT_DISPLAY_NAME]:DIR_NAME$p,[SHYNET_DISPLAY_NAME]:DIR_NAME$o,[WOOPRA_DISPLAY_NAME]:DIR_NAME$n,[ROLLBAR_DISPLAY_NAME]:DIR_NAME$m,[QUORA_PIXEL_DISPLAY_NAME]:DIR_NAME$l,[JUNE_DISPLAY_NAME]:DIR_NAME$k,[ENGAGE_DISPLAY_NAME]:DIR_NAME$j,[ITERABLE_DISPLAY_NAME]:DIR_NAME$i,[YANDEX_METRICA_DISPLAY_NAME]:DIR_NAME$h,[REFINER_DISPLAY_NAME]:DIR_NAME$g,[QUALAROO_DISPLAY_NAME]:DIR_NAME$f,[PODSIGHTS_DISPLAY_NAME]:DIR_NAME$e,[AXEPTIO_DISPLAY_NAME]:DIR_NAME$d,[SATISMETER_DISPLAY_NAME]:DIR_NAME$c,[MICROSOFT_CLARITY_DISPLAY_NAME]:DIR_NAME$b,[SENDINBLUE_DISPLAY_NAME]:DIR_NAME$a,[OLARK_DISPLAY_NAME]:DIR_NAME$9,[LEMNISK_DISPLAY_NAME]:DIR_NAME$8,[TIKTOK_ADS_DISPLAY_NAME]:DIR_NAME$7,[ACTIVE_CAMPAIGN_DISPLAY_NAME]:DIR_NAME$6,[SPRIG_DISPLAY_NAME]:DIR_NAME$5,[SPOTIFYPIXEL_DISPLAY_NAME]:DIR_NAME$4,[COMMANDBAR_DISPLAY_NAME]:DIR_NAME$3,[NINETAILED_DISPLAY_NAME]:DIR_NAME$2,[GAINSIGHT_PX_DISPLAY_NAME]:DIR_NAME$1,[XPIXEL_DISPLAY_NAME]:DIR_NAME};
|
1126
1141
|
|
1127
1142
|
/**
|
1128
1143
|
* Determines if the destination SDK code is evaluated
|
@@ -1130,7 +1145,7 @@ const destDisplayNamesToFileNamesMap={[DISPLAY_NAME$W]:DIR_NAME$W,[DISPLAY_NAME$
|
|
1130
1145
|
* @param sdkTypeName The name of the destination SDK type
|
1131
1146
|
* @param logger Logger instance
|
1132
1147
|
* @returns true if the destination SDK code is evaluated, false otherwise
|
1133
|
-
*/const isDestinationSDKMounted=(destSDKIdentifier,sdkTypeName,logger)=>Boolean(globalThis[destSDKIdentifier]
|
1148
|
+
*/const isDestinationSDKMounted=(destSDKIdentifier,sdkTypeName,logger)=>Boolean(globalThis[destSDKIdentifier]?.[sdkTypeName]?.prototype&&typeof globalThis[destSDKIdentifier][sdkTypeName].prototype.constructor!=='undefined');const wait=time=>new Promise(resolve=>{globalThis.setTimeout(resolve,time);});const createDestinationInstance=(destSDKIdentifier,sdkTypeName,dest,state)=>{const rAnalytics=globalThis.rudderanalytics;const analytics=rAnalytics.getAnalyticsInstance(state.lifecycle.writeKey.value);const analyticsInstance={loadIntegration:state.nativeDestinations.loadIntegration.value,logLevel:state.lifecycle.logLevel.value,loadOnlyIntegrations:state.consents.postConsent.value?.integrations??state.nativeDestinations.loadOnlyIntegrations.value,page:(category,name,properties,options,callback)=>analytics.page(pageArgumentsToCallOptions(getSanitizedValue(category),getSanitizedValue(name),getSanitizedValue(properties),getSanitizedValue(options),getSanitizedValue(callback))),track:(event,properties,options,callback)=>analytics.track(trackArgumentsToCallOptions(getSanitizedValue(event),getSanitizedValue(properties),getSanitizedValue(options),getSanitizedValue(callback))),identify:(userId,traits,options,callback)=>analytics.identify(identifyArgumentsToCallOptions(getSanitizedValue(userId),getSanitizedValue(traits),getSanitizedValue(options),getSanitizedValue(callback))),alias:(to,from,options,callback)=>analytics.alias(aliasArgumentsToCallOptions(getSanitizedValue(to),getSanitizedValue(from),getSanitizedValue(options),getSanitizedValue(callback))),group:(groupId,traits,options,callback)=>analytics.group(groupArgumentsToCallOptions(getSanitizedValue(groupId),getSanitizedValue(traits),getSanitizedValue(options),getSanitizedValue(callback))),getAnonymousId:options=>analytics.getAnonymousId(getSanitizedValue(options)),getUserId:()=>analytics.getUserId(),getUserTraits:()=>analytics.getUserTraits(),getGroupId:()=>analytics.getGroupId(),getGroupTraits:()=>analytics.getGroupTraits(),getSessionId:()=>analytics.getSessionId()};const deviceModeDestination=new globalThis[destSDKIdentifier][sdkTypeName](clone(dest.config),analyticsInstance,{shouldApplyDeviceModeTransformation:dest.shouldApplyDeviceModeTransformation,propagateEventsUntransformedOnError:dest.propagateEventsUntransformedOnError,destinationId:dest.id});return deviceModeDestination;};const isDestinationReady=(dest,time=0)=>new Promise((resolve,reject)=>{const instance=dest.instance;if(instance.isLoaded()&&(!instance.isReady||instance.isReady())){resolve(true);}else if(time>=READY_CHECK_TIMEOUT_MS){reject(new Error(DESTINATION_READY_TIMEOUT_ERROR(READY_CHECK_TIMEOUT_MS,dest.userFriendlyId)));}else {const curTime=Date.now();wait(READY_CHECK_INTERVAL_MS).then(()=>{const elapsedTime=Date.now()-curTime;isDestinationReady(dest,time+elapsedTime).then(resolve).catch(err=>reject(err));}).catch(err=>reject(err));}});/**
|
1134
1149
|
* Extracts the integration config, if any, from the given destination
|
1135
1150
|
* and merges it with the current integrations config
|
1136
1151
|
* @param dest Destination object
|
@@ -1218,7 +1233,7 @@ parseOpera11:function ErrorStackParser$$parseOpera11(error){var filtered=error.s
|
|
1218
1233
|
var errorStackParserExports = requireErrorStackParser();
|
1219
1234
|
const ErrorStackParser = /*@__PURE__*/getDefaultExportFromCjs(errorStackParserExports);
|
1220
1235
|
|
1221
|
-
const hasStack=err=>!!err&&(!!err.stack||!!err.stacktrace||!!err['opera#sourceloc'])&&typeof(err.stack||err.stacktrace||err['opera#sourceloc'])==='string'&&err.stack!==`${err.name}: ${err.message}`;const isError=value=>{switch(Object.prototype.toString.call(value)){case'[object Error]':case'[object Exception]':case'[object DOMException]':return true;default:return value instanceof Error;}};
|
1236
|
+
const hasStack=err=>!!err&&(!!err.stack||!!err.stacktrace||!!err['opera#sourceloc'])&&typeof(err.stack||err.stacktrace||err['opera#sourceloc'])==='string'&&err.stack!==`${err.name}: ${err.message}`;const isError=value=>{switch(Object.prototype.toString.call(value)){case '[object Error]':case '[object Exception]':case '[object DOMException]':return true;default:return value instanceof Error;}};
|
1222
1237
|
|
1223
1238
|
const normaliseFunctionName=name=>/^global code$/i.test(name)?'global code':name;// takes a stacktrace.js style stackframe (https://github.com/stacktracejs/stackframe)
|
1224
1239
|
// and returns a Bugsnag compatible stackframe (https://docs.bugsnag.com/api/error-reporting/#json-payload)
|
@@ -1250,7 +1265,7 @@ const getSegmentAnonymousId=getStorageEngine=>{let anonymousId;/**
|
|
1250
1265
|
const csEngine=getStorageEngine(COOKIE_STORAGE);if(!anonymousId&&csEngine?.isEnabled){anonymousId=csEngine.getItem(externallyLoadedSessionStorageKeys.segment);}return anonymousId;};
|
1251
1266
|
|
1252
1267
|
const pluginName$9='ExternalAnonymousId';const ExternalAnonymousId=()=>({name:pluginName$9,initialize:state=>{state.plugins.loadedPlugins.value=[...state.plugins.loadedPlugins.value,pluginName$9];},storage:{getAnonymousId(getStorageEngine,options){let anonymousId;if(options?.autoCapture?.enabled&&options.autoCapture.source){const source=options.autoCapture.source.toLowerCase();if(!Object.keys(externallyLoadedSessionStorageKeys).includes(source)){return anonymousId;}// eslint-disable-next-line sonarjs/no-small-switch
|
1253
|
-
switch(source){case'segment':anonymousId=getSegmentAnonymousId(getStorageEngine);break;}}return anonymousId;}}});
|
1268
|
+
switch(source){case 'segment':anonymousId=getSegmentAnonymousId(getStorageEngine);break;}}return anonymousId;}}});
|
1254
1269
|
|
1255
1270
|
const AMP_LINKER_ANONYMOUS_ID_KEY='rs_amp_id';
|
1256
1271
|
|
@@ -1375,7 +1390,7 @@ if(consentManagement){// Get the corresponding consents for the destination
|
|
1375
1390
|
const cmpConfig=consentManagement.find(c=>c.provider===state.consents.provider.value);// If there are no consents configured for the destination for the current provider, events should be sent.
|
1376
1391
|
if(!cmpConfig?.consents){return true;}const configuredConsents=cmpConfig.consents.map(c=>c.consent.trim()).filter(n=>n);const resolutionStrategy=cmpConfig.resolutionStrategy??state.consents.resolutionStrategy.value;// match the configured consents with user provided consents as per
|
1377
1392
|
// the configured resolution strategy
|
1378
|
-
switch(resolutionStrategy){case'or':return configuredConsents.some(matchPredicate)||configuredConsents.length===0;case'and':default:return configuredConsents.every(matchPredicate);}}return true;}catch(err){errorHandler?.onError(err,IUBENDA_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR$2);return true;}}}});
|
1393
|
+
switch(resolutionStrategy){case 'or':return configuredConsents.some(matchPredicate)||configuredConsents.length===0;case 'and':default:return configuredConsents.every(matchPredicate);}}return true;}catch(err){errorHandler?.onError(err,IUBENDA_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR$2);return true;}}}});
|
1379
1394
|
|
1380
1395
|
const KETCH_CONSENT_COOKIE_READ_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to read the consent cookie.`;const KETCH_CONSENT_COOKIE_PARSE_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to parse the consent cookie.`;const DESTINATION_CONSENT_STATUS_ERROR$1=`Failed to determine the consent status for the destination. Please check the destination configuration and try again.`;
|
1381
1396
|
|
@@ -1407,7 +1422,7 @@ if(consentManagement){// Get the corresponding consents for the destination
|
|
1407
1422
|
const cmpConsents=consentManagement.find(c=>c.provider===state.consents.provider.value)?.consents;// If there are no consents configured for the destination for the current provider, events should be sent.
|
1408
1423
|
if(!cmpConsents){return true;}const configuredConsents=cmpConsents.map(c=>c.consent.trim()).filter(n=>n);// match the configured consents with user provided consents as per
|
1409
1424
|
// the configured resolution strategy
|
1410
|
-
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
|
1425
|
+
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
|
1411
1426
|
// TODO: To be removed once the source config API is updated to support generic consent management
|
1412
1427
|
}else if(ketchConsentPurposes){const configuredConsents=ketchConsentPurposes.map(p=>p.purpose.trim()).filter(n=>n);// Check if any of the destination's mapped ketch purposes are consented by the user in the browser.
|
1413
1428
|
return configuredConsents.some(matchPredicate)||configuredConsents.length===0;}// If there are no consents configured for the destination for the current provider, events should be sent.
|
@@ -1418,8 +1433,8 @@ const DEFAULT_QUEUE_OPTIONS={maxItems:100};const QUEUE_NAME$1='rudder_destinatio
|
|
1418
1433
|
const DESTINATION_EVENT_FILTERING_WARNING=(context,eventName,destUserFriendlyId)=>`${context}${LOG_CONTEXT_SEPARATOR}The "${eventName}" track event has been filtered for the "${destUserFriendlyId}" destination.`;const DESTINATION_EVENT_FORWARDING_ERROR=destUserFriendlyId=>`Failed to forward event to destination "${destUserFriendlyId}".`;
|
1419
1434
|
|
1420
1435
|
const getNormalizedQueueOptions$1=queueOpts=>mergeDeepRight(DEFAULT_QUEUE_OPTIONS,queueOpts);const isValidEventName=eventName=>eventName&&typeof eventName==='string';const isEventDenyListed=(eventType,eventName,dest)=>{if(eventType!=='track'){return false;}const{blacklistedEvents,whitelistedEvents,eventFilteringOption}=dest.config;switch(eventFilteringOption){// Blacklist is chosen for filtering events
|
1421
|
-
case'blacklistedEvents':{if(!isValidEventName(eventName)){return false;}const trimmedEventName=eventName.trim();if(Array.isArray(blacklistedEvents)){return blacklistedEvents.some(eventObj=>eventObj.eventName.trim()===trimmedEventName);}return false;}// Whitelist is chosen for filtering events
|
1422
|
-
case'whitelistedEvents':{if(!isValidEventName(eventName)){return true;}const trimmedEventName=eventName.trim();if(Array.isArray(whitelistedEvents)){return !whitelistedEvents.some(eventObj=>eventObj.eventName.trim()===trimmedEventName);}return true;}case'disable':default:return false;}};const sendEventToDestination=(item,dest,errorHandler,logger)=>{const methodName=item.type.toString();try{// Destinations expect the event to be wrapped under the `message` key
|
1436
|
+
case 'blacklistedEvents':{if(!isValidEventName(eventName)){return false;}const trimmedEventName=eventName.trim();if(Array.isArray(blacklistedEvents)){return blacklistedEvents.some(eventObj=>eventObj.eventName.trim()===trimmedEventName);}return false;}// Whitelist is chosen for filtering events
|
1437
|
+
case 'whitelistedEvents':{if(!isValidEventName(eventName)){return true;}const trimmedEventName=eventName.trim();if(Array.isArray(whitelistedEvents)){return !whitelistedEvents.some(eventObj=>eventObj.eventName.trim()===trimmedEventName);}return true;}case 'disable':default:return false;}};const sendEventToDestination=(item,dest,errorHandler,logger)=>{const methodName=item.type.toString();try{// Destinations expect the event to be wrapped under the `message` key
|
1423
1438
|
// This will remain until we update the destinations to accept the event directly
|
1424
1439
|
dest.instance?.[methodName]?.({message:item});}catch(err){errorHandler?.onError(err,NATIVE_DESTINATION_QUEUE_PLUGIN,DESTINATION_EVENT_FORWARDING_ERROR(dest.userFriendlyId));}};
|
1425
1440
|
|
@@ -1473,7 +1488,7 @@ if(consentManagement){// Get the corresponding consents for the destination
|
|
1473
1488
|
const cmpConsents=consentManagement.find(c=>c.provider===state.consents.provider.value)?.consents;// If there are no consents configured for the destination for the current provider, events should be sent.
|
1474
1489
|
if(!cmpConsents){return true;}const configuredConsents=cmpConsents.map(c=>c.consent.trim()).filter(n=>n);// match the configured consents with user provided consents as per
|
1475
1490
|
// the configured resolution strategy
|
1476
|
-
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
|
1491
|
+
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
|
1477
1492
|
// TODO: To be removed once the source config API is updated to support generic consent management
|
1478
1493
|
}else if(oneTrustCookieCategories){// Change the structure of oneTrustConsentGroup as an array and filter values if empty string
|
1479
1494
|
// Eg:
|
@@ -1484,7 +1499,7 @@ return true;}catch(err){errorHandler?.onError(err,ONETRUST_CONSENT_MANAGER_PLUGI
|
|
1484
1499
|
|
1485
1500
|
const pluginName$3='StorageEncryption';const StorageEncryption=()=>({name:pluginName$3,initialize:state=>{state.plugins.loadedPlugins.value=[...state.plugins.loadedPlugins.value,pluginName$3];},storage:{encrypt(value){return encryptBrowser(value);},decrypt(value){return decryptBrowser(value);}}});
|
1486
1501
|
|
1487
|
-
/* eslint-disable no-use-before-define */const crypto$1=(typeof globalThis!='undefined'?globalThis:
|
1502
|
+
/* eslint-disable no-use-before-define */const crypto$1=(typeof globalThis!='undefined'?globalThis:undefined)?.crypto||(typeof global!='undefined'?global:undefined)?.crypto||(typeof window!='undefined'?window:undefined)?.crypto||(typeof self!='undefined'?self:undefined)?.crypto||(typeof frames!='undefined'?frames:undefined)?.[0]?.crypto;let randomWordArray;if(crypto$1){randomWordArray=nBytes=>{const words=[];for(let i=0,rcache;i<nBytes;i+=4){words.push(crypto$1.getRandomValues(new Uint32Array(1))[0]);}return new WordArray(words,nBytes);};}else {// Because there is no global crypto property in this context, cryptographically unsafe Math.random() is used.
|
1488
1503
|
randomWordArray=nBytes=>{const words=[];const r=m_w=>{let _m_w=m_w;let _m_z=0x3ade68b1;const mask=0xffffffff;return ()=>{_m_z=0x9069*(_m_z&0xFFFF)+(_m_z>>0x10)&mask;_m_w=0x4650*(_m_w&0xFFFF)+(_m_w>>0x10)&mask;let result=(_m_z<<0x10)+_m_w&mask;result/=0x100000000;result+=0.5;return result*(Math.random()>0.5?1:-1);};};for(let i=0,rcache;i<nBytes;i+=4){const _r=r((rcache||Math.random())*0x100000000);rcache=_r()*0x3ade67b7;words.push(_r()*0x100000000|0);}return new WordArray(words,nBytes);};}/**
|
1489
1504
|
* Base class for inheritance.
|
1490
1505
|
*/class Base{/**
|
@@ -2176,8 +2191,8 @@ this._minBufferSize=1;}this._mode=modeCreator.call(mode,this,iv&&iv.words);this.
|
|
2176
2191
|
const{padding}=this.cfg;// Finalize
|
2177
2192
|
if(this._xformMode===this.constructor._ENC_XFORM_MODE){// Pad data
|
2178
2193
|
padding.pad(this._data,this.blockSize);// Process final blocks
|
2179
|
-
finalProcessedBlocks=this._process(
|
2180
|
-
finalProcessedBlocks=this._process(
|
2194
|
+
finalProcessedBlocks=this._process(true);}else/* if (this._xformMode == this._DEC_XFORM_MODE) */{// Process final blocks
|
2195
|
+
finalProcessedBlocks=this._process(true);// Unpad data
|
2181
2196
|
padding.unpad(finalProcessedBlocks);}return finalProcessedBlocks;}}/**
|
2182
2197
|
* A collection of cipher parameters.
|
2183
2198
|
*
|
@@ -2736,13 +2751,13 @@ if(isString(decryptedValue)&&decryptedValue.startsWith('RudderEncrypt:')){this.l
|
|
2736
2751
|
* Handle errors
|
2737
2752
|
*/onError(error){if(this.hasErrorHandler){this.errorHandler?.onError(error,`Store ${this.id}`);}else {throw error;}}}
|
2738
2753
|
|
2739
|
-
const getStorageTypeFromPreConsentIfApplicable=(state,sessionKey)=>{let overriddenStorageType;if(state.consents.preConsent.value.enabled){switch(state.consents.preConsent.value.storage?.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;};
|
2754
|
+
const getStorageTypeFromPreConsentIfApplicable=(state,sessionKey)=>{let overriddenStorageType;if(state.consents.preConsent.value.enabled){switch(state.consents.preConsent.value.storage?.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;};
|
2740
2755
|
|
2741
2756
|
/**
|
2742
2757
|
* A service to manage stores & available storage client configurations
|
2743
2758
|
*/class StoreManager{stores={};isInitialized=false;hasErrorHandler=false;constructor(pluginsManager,errorHandler,logger){this.errorHandler=errorHandler;this.logger=logger;this.hasErrorHandler=Boolean(this.errorHandler);this.pluginsManager=pluginsManager;this.onError=this.onError.bind(this);}/**
|
2744
2759
|
* Configure available storage client instances
|
2745
|
-
*/init(){if(this.isInitialized){return;}const loadOptions=state.loadOptions.value;const 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.cookieStorageOptions
|
2760
|
+
*/init(){if(this.isInitialized){return;}const loadOptions=state.loadOptions.value;const 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.cookieStorageOptions,state.storage.cookie?.value??{})),removeUndefinedValues(config.localStorageOptions),removeUndefinedValues(config.inMemoryStorageOptions),removeUndefinedValues(config.sessionStorageOptions));this.initClientDataStores();this.isInitialized=true;}/**
|
2746
2761
|
* Create store to persist data used by the SDK like session, used details etc
|
2747
2762
|
*/initClientDataStores(){this.initializeStorageState();// TODO: fill in extra config values and bring them in from StoreManagerOptions if needed
|
2748
2763
|
// TODO: should we pass the keys for all in order to validate or leave free as v1.1?
|
@@ -2798,7 +2813,7 @@ if(utmParam==='campaign'){utmParam='name';}result[utmParam]=value;}});}catch(err
|
|
2798
2813
|
/**
|
2799
2814
|
* Determines if the SDK is running inside a chrome extension
|
2800
2815
|
* @returns boolean
|
2801
|
-
*/const isSDKRunningInChromeExtension=()=>!!
|
2816
|
+
*/const isSDKRunningInChromeExtension=()=>!!window.chrome?.runtime?.id;
|
2802
2817
|
|
2803
2818
|
const DEFAULT_PRE_CONSENT_STORAGE_STRATEGY='none';const DEFAULT_PRE_CONSENT_EVENTS_DELIVERY_TYPE='immediate';
|
2804
2819
|
|
@@ -2831,7 +2846,12 @@ enabled=enabled&&Boolean(consentManagerPluginName);return {provider,consentManag
|
|
2831
2846
|
/**
|
2832
2847
|
* Determines the SDK URL
|
2833
2848
|
* @returns sdkURL
|
2834
|
-
*/const getSDKUrl=()=>{
|
2849
|
+
*/const getSDKUrl=()=>{// First try the new method of getting the SDK URL
|
2850
|
+
// from the script tag
|
2851
|
+
const scriptTag=document.querySelector('script[data-rsa-write-key]');if(scriptTag&&scriptTag.dataset.rsaWriteKey===state.lifecycle.writeKey.value){return scriptTag.src;}// If the new method fails, try the old method
|
2852
|
+
// TODO: We need to remove this once all the customers upgrade to the
|
2853
|
+
// latest SDK loading snippet
|
2854
|
+
const scripts=document.getElementsByTagName('script');const sdkFileNameRegex=/(?:^|\/)rsa(\.min)?\.js$/;// eslint-disable-next-line no-restricted-syntax
|
2835
2855
|
for(const script of scripts){const src=script.getAttribute('src');if(src&&sdkFileNameRegex.test(src)){return src;}}return undefined;};/**
|
2836
2856
|
* Updates the reporting state variables from the source config data
|
2837
2857
|
* @param res Source config
|
@@ -2862,19 +2882,34 @@ enabled:state.loadOptions.value.preConsent?.enabled===true&&initialized===false&
|
|
2862
2882
|
*/const updateConsentsState=resp=>{let resolutionStrategy=state.consents.resolutionStrategy.value;let cmpMetadata;if(isObjectLiteralAndNotNull(resp.consentManagementMetadata)){if(state.consents.provider.value){resolutionStrategy=resp.consentManagementMetadata.providers.find(p=>p.provider===state.consents.provider.value)?.resolutionStrategy??state.consents.resolutionStrategy.value;}cmpMetadata=resp.consentManagementMetadata;}// If the provider is custom, then the resolution strategy is not applicable
|
2863
2883
|
if(state.consents.provider.value==='custom'){resolutionStrategy=undefined;}r(()=>{state.consents.metadata.value=clone(cmpMetadata);state.consents.resolutionStrategy.value=resolutionStrategy;});};const updateDataPlaneEventsStateFromLoadOptions=logger=>{if(state.dataPlaneEvents.deliveryEnabled.value){const defaultEventsQueuePluginName='XhrQueue';let eventsQueuePluginName=defaultEventsQueuePluginName;if(state.loadOptions.value.useBeacon){if(state.capabilities.isBeaconAvailable.value){eventsQueuePluginName='BeaconQueue';}else {eventsQueuePluginName=defaultEventsQueuePluginName;logger?.warn(UNSUPPORTED_BEACON_API_WARNING(CONFIG_MANAGER));}}r(()=>{state.dataPlaneEvents.eventsQueuePluginName.value=eventsQueuePluginName;});}};const getSourceConfigURL=(configUrl,writeKey,lockIntegrationsVersion,lockPluginsVersion,logger)=>{const defSearchParams=new URLSearchParams({p:MODULE_TYPE,v:APP_VERSION,build:BUILD_TYPE,writeKey,lockIntegrationsVersion:lockIntegrationsVersion.toString(),lockPluginsVersion:lockPluginsVersion.toString()});let origin=DEFAULT_CONFIG_BE_URL;let searchParams=defSearchParams;let pathname='/sourceConfig/';let hash='';if(isValidURL(configUrl)){const configUrlInstance=new URL(configUrl);if(!removeTrailingSlashes(configUrlInstance.pathname).endsWith('/sourceConfig')){configUrlInstance.pathname=`${removeTrailingSlashes(configUrlInstance.pathname)}/sourceConfig/`;}configUrlInstance.pathname=removeDuplicateSlashes(configUrlInstance.pathname);defSearchParams.forEach((value,key)=>{if(configUrlInstance.searchParams.get(key)===null){configUrlInstance.searchParams.set(key,value);}});origin=configUrlInstance.origin;pathname=configUrlInstance.pathname;searchParams=configUrlInstance.searchParams;hash=configUrlInstance.hash;}else {logger?.warn(INVALID_CONFIG_URL_WARNING(CONFIG_MANAGER,configUrl));}return `${origin}${pathname}?${searchParams}${hash}`;};
|
2864
2884
|
|
2865
|
-
|
2885
|
+
/**
|
2886
|
+
* A function that determines the base URL for the integrations or plugins SDK
|
2887
|
+
* @param componentType The type of the component (integrations or plugins)
|
2888
|
+
* @param pathSuffix The path suffix to be appended to the base URL (js-integrations or plugins)
|
2889
|
+
* @param defaultComponentUrl The default URL to be used if the user has not provided a custom URL
|
2890
|
+
* @param currentSdkVersion The current version of the SDK
|
2891
|
+
* @param lockVersion Flag to lock the version of the component
|
2892
|
+
* @param urlFromLoadOptions The URL provided by the user in the load options
|
2893
|
+
* @returns The base URL for the integrations or plugins SDK
|
2894
|
+
*/const getSDKComponentBaseURL=(componentType,pathSuffix,defaultComponentUrl,currentSdkVersion,lockVersion,urlFromLoadOptions)=>{let sdkComponentBaseURL;// If the user has provided a custom URL, then validate, clean up and use it
|
2895
|
+
if(urlFromLoadOptions){if(!isValidURL(urlFromLoadOptions)){throw new Error(COMPONENT_BASE_URL_ERROR(componentType,urlFromLoadOptions));}sdkComponentBaseURL=removeTrailingSlashes(urlFromLoadOptions);}else {sdkComponentBaseURL=defaultComponentUrl;// We can automatically determine the base URL only for CDN installations
|
2896
|
+
if(state.context.app.value.installType==='cdn'){const sdkURL=getSDKUrl();if(sdkURL){// Extract the base URL from the core SDK file URL
|
2897
|
+
// and append the path suffix to it
|
2898
|
+
sdkComponentBaseURL=sdkURL.split('/').slice(0,-1).concat(pathSuffix).join('/');}}}// If the version needs to be locked, then replace the major version in the URL
|
2899
|
+
// with the current version of the SDK
|
2900
|
+
if(lockVersion){sdkComponentBaseURL=sdkComponentBaseURL.replace(new RegExp(`/${CDN_ARCH_VERSION_DIR}/${BUILD_TYPE}/${pathSuffix}$`),`/${currentSdkVersion}/${BUILD_TYPE}/${pathSuffix}`);}return sdkComponentBaseURL;};/**
|
2866
2901
|
* A function that determines integration SDK loading path
|
2867
|
-
* @param
|
2868
|
-
* @param lockIntegrationsVersion
|
2869
|
-
* @param
|
2902
|
+
* @param currentSdkVersion Current SDK version
|
2903
|
+
* @param lockIntegrationsVersion Flag to lock the integrations version
|
2904
|
+
* @param integrationsUrlFromLoadOptions URL to load the integrations from as provided by the user
|
2870
2905
|
* @returns
|
2871
|
-
*/const getIntegrationsCDNPath=(
|
2906
|
+
*/const getIntegrationsCDNPath=(currentSdkVersion,lockIntegrationsVersion,integrationsUrlFromLoadOptions)=>getSDKComponentBaseURL('integrations',CDN_INT_DIR,DEFAULT_INTEGRATION_SDKS_URL,currentSdkVersion,lockIntegrationsVersion,integrationsUrlFromLoadOptions);/**
|
2872
2907
|
* A function that determines plugins SDK loading path
|
2873
|
-
* @param
|
2908
|
+
* @param currentSdkVersion Current SDK version
|
2874
2909
|
* @param lockPluginsVersion Flag to lock the plugins version
|
2875
|
-
* @param
|
2910
|
+
* @param pluginsUrlFromLoadOptions URL to load the plugins from as provided by the user
|
2876
2911
|
* @returns Final plugins CDN path
|
2877
|
-
*/const getPluginsCDNPath=(
|
2912
|
+
*/const getPluginsCDNPath=(currentSdkVersion,lockPluginsVersion,pluginsUrlFromLoadOptions)=>getSDKComponentBaseURL('plugins',CDN_PLUGINS_DIR,DEFAULT_PLUGINS_URL,currentSdkVersion,lockPluginsVersion,pluginsUrlFromLoadOptions);
|
2878
2913
|
|
2879
2914
|
class ConfigManager{hasErrorHandler=false;constructor(httpClient,errorHandler,logger){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);}attachEffects(){E(()=>{this.logger?.setMinLogLevel(state.lifecycle.logLevel.value);});}/**
|
2880
2915
|
* A function to validate, construct and store loadOption, lifecycle, source and destination
|
@@ -2909,7 +2944,9 @@ this.httpClient.getAsyncData({url:state.lifecycle.sourceConfigUrl.value,options:
|
|
2909
2944
|
* To get the timezone of the user
|
2910
2945
|
*
|
2911
2946
|
* @returns string
|
2912
|
-
*/const getTimezone=()=>{
|
2947
|
+
*/const getTimezone=()=>{// Not susceptible to super-linear backtracking
|
2948
|
+
// eslint-disable-next-line sonarjs/slow-regex
|
2949
|
+
const timezone=/([A-Z]+[+-]\d+)/.exec(new Date().toString());return timezone?.[1]?timezone[1]:'NA';};
|
2913
2950
|
|
2914
2951
|
/**
|
2915
2952
|
* Get the referrer URL
|
@@ -3095,7 +3132,7 @@ enrichedEvent.userId=to??enrichedEvent.userId;return enrichedEvent;}/**
|
|
3095
3132
|
* Generates a new RudderEvent object based on the user-input fields
|
3096
3133
|
* @param event API event parameters object
|
3097
3134
|
* @returns A RudderEvent object
|
3098
|
-
*/create(event){let eventObj;switch(event.type){case'page':eventObj=this.generatePageEvent(event.category,event.name,event.properties,event.options);break;case'track':eventObj=this.generateTrackEvent(event.name,event.properties,event.options);break;case'identify':eventObj=this.generateIdentifyEvent(event.userId,event.traits,event.options);break;case'alias':eventObj=this.generateAliasEvent(event.to,event.from,event.options);break;case'group':eventObj=this.generateGroupEvent(event.groupId,event.traits,event.options);break;}return eventObj;}}
|
3135
|
+
*/create(event){let eventObj;switch(event.type){case 'page':eventObj=this.generatePageEvent(event.category,event.name,event.properties,event.options);break;case 'track':eventObj=this.generateTrackEvent(event.name,event.properties,event.options);break;case 'identify':eventObj=this.generateIdentifyEvent(event.userId,event.traits,event.options);break;case 'alias':eventObj=this.generateAliasEvent(event.to,event.from,event.options);break;case 'group':eventObj=this.generateGroupEvent(event.groupId,event.traits,event.options);break;}return eventObj;}}
|
3099
3136
|
|
3100
3137
|
/**
|
3101
3138
|
* A service to generate valid event payloads and queue them for processing
|
@@ -3253,7 +3290,7 @@ this.setAnonymousId();}if(noNewSessionStart){return;}if(autoTrack){session.sessi
|
|
3253
3290
|
*/const defaultOptionalPluginsList=['BeaconQueue','Bugsnag','CustomConsentManager','DeviceModeDestinations','DeviceModeTransformation','ErrorReporting','ExternalAnonymousId','GoogleLinker','IubendaConsentManager','KetchConsentManager','NativeDestinationQueue','OneTrustConsentManager','StorageEncryption','StorageEncryptionLegacy','StorageMigrator','XhrQueue'];
|
3254
3291
|
|
3255
3292
|
const normalizeLoadOptions=(loadOptionsFromState,loadOptions)=>{// TODO: Maybe add warnings for invalid values
|
3256
|
-
const normalizedLoadOpts=clone(loadOptions);if(!isString(normalizedLoadOpts.setCookieDomain)){
|
3293
|
+
const normalizedLoadOpts=clone(loadOptions);if(!isString(normalizedLoadOpts.setCookieDomain)){normalizedLoadOpts.setCookieDomain=undefined;}const cookieSameSiteValues=['Strict','Lax','None'];if(!cookieSameSiteValues.includes(normalizedLoadOpts.sameSiteCookie)){normalizedLoadOpts.sameSiteCookie=undefined;}normalizedLoadOpts.secureCookie=getNormalizedBooleanValue(normalizedLoadOpts.secureCookie,loadOptionsFromState.secureCookie);normalizedLoadOpts.sameDomainCookiesOnly=getNormalizedBooleanValue(normalizedLoadOpts.sameDomainCookiesOnly,loadOptionsFromState.sameDomainCookiesOnly);const uaChTrackLevels=['none','default','full'];if(!uaChTrackLevels.includes(normalizedLoadOpts.uaChTrackLevel)){normalizedLoadOpts.uaChTrackLevel=undefined;}normalizedLoadOpts.integrations=getNormalizedObjectValue(normalizedLoadOpts.integrations);if(!Array.isArray(normalizedLoadOpts.plugins)){normalizedLoadOpts.plugins=defaultOptionalPluginsList;}normalizedLoadOpts.useGlobalIntegrationsConfigInEvents=getNormalizedBooleanValue(normalizedLoadOpts.useGlobalIntegrationsConfigInEvents,loadOptionsFromState.useGlobalIntegrationsConfigInEvents);normalizedLoadOpts.bufferDataPlaneEventsUntilReady=getNormalizedBooleanValue(normalizedLoadOpts.bufferDataPlaneEventsUntilReady,loadOptionsFromState.bufferDataPlaneEventsUntilReady);normalizedLoadOpts.sendAdblockPage=getNormalizedBooleanValue(normalizedLoadOpts.sendAdblockPage,loadOptionsFromState.sendAdblockPage);normalizedLoadOpts.useServerSideCookies=getNormalizedBooleanValue(normalizedLoadOpts.useServerSideCookies,loadOptionsFromState.useServerSideCookies);if(!isString(normalizedLoadOpts.dataServiceEndpoint)){normalizedLoadOpts.dataServiceEndpoint=undefined;}normalizedLoadOpts.sendAdblockPageOptions=getNormalizedObjectValue(normalizedLoadOpts.sendAdblockPageOptions);normalizedLoadOpts.loadIntegration=getNormalizedBooleanValue(normalizedLoadOpts.loadIntegration,loadOptionsFromState.loadIntegration);if(!isNonEmptyObject(normalizedLoadOpts.storage)){normalizedLoadOpts.storage=undefined;}else {normalizedLoadOpts.storage.migrate=getNormalizedBooleanValue(normalizedLoadOpts.storage.migrate,loadOptionsFromState.storage?.migrate);normalizedLoadOpts.storage.cookie=getNormalizedObjectValue(normalizedLoadOpts.storage.cookie);normalizedLoadOpts.storage.encryption=getNormalizedObjectValue(normalizedLoadOpts.storage.encryption);normalizedLoadOpts.storage=removeUndefinedAndNullValues(normalizedLoadOpts.storage);}normalizedLoadOpts.destinationsQueueOptions=getNormalizedObjectValue(normalizedLoadOpts.destinationsQueueOptions);normalizedLoadOpts.queueOptions=getNormalizedObjectValue(normalizedLoadOpts.queueOptions);normalizedLoadOpts.lockIntegrationsVersion=getNormalizedBooleanValue(normalizedLoadOpts.lockIntegrationsVersion,loadOptionsFromState.lockIntegrationsVersion);normalizedLoadOpts.lockPluginsVersion=getNormalizedBooleanValue(normalizedLoadOpts.lockPluginsVersion,loadOptionsFromState.lockPluginsVersion);if(!isNumber(normalizedLoadOpts.dataPlaneEventsBufferTimeout)){normalizedLoadOpts.dataPlaneEventsBufferTimeout=undefined;}normalizedLoadOpts.beaconQueueOptions=getNormalizedObjectValue(normalizedLoadOpts.beaconQueueOptions);normalizedLoadOpts.preConsent=getNormalizedObjectValue(normalizedLoadOpts.preConsent);const mergedLoadOptions=mergeDeepRight(loadOptionsFromState,removeUndefinedAndNullValues(normalizedLoadOpts));return mergedLoadOptions;};
|
3257
3294
|
|
3258
3295
|
const DATA_PLANE_QUEUE_EXT_POINT_PREFIX='dataplaneEventsQueue';const DESTINATIONS_QUEUE_EXT_POINT_PREFIX='destinationsEventsQueue';const DMT_EXT_POINT_PREFIX='transformEvent';
|
3259
3296
|
|
@@ -3317,7 +3354,7 @@ setExposedGlobal('state',state,writeKey);// Configure initial config of any serv
|
|
3317
3354
|
this.startLifecycle();}// Start lifecycle methods
|
3318
3355
|
/**
|
3319
3356
|
* Orchestrate the lifecycle of the application phases/status
|
3320
|
-
*/startLifecycle(){E(()=>{try{switch(state.lifecycle.status.value){case'mounted':this.onMounted();break;case'browserCapabilitiesReady':this.onBrowserCapabilitiesReady();break;case'configured':this.onConfigured();break;case'pluginsLoading':break;case'pluginsReady':this.onPluginsReady();break;case'initialized':this.onInitialized();break;case'loaded':this.onLoaded();break;case'destinationsLoading':break;case'destinationsReady':this.onDestinationsReady();break;case'ready':this.onReady();break;case'readyExecuted':default:break;}}catch(err){const issue='Failed to load the SDK';this.errorHandler.onError(getMutatedError(err,issue),ANALYTICS_CORE);}});}onBrowserCapabilitiesReady(){// initialize the preloaded events enqueuing
|
3357
|
+
*/startLifecycle(){E(()=>{try{switch(state.lifecycle.status.value){case 'mounted':this.onMounted();break;case 'browserCapabilitiesReady':this.onBrowserCapabilitiesReady();break;case 'configured':this.onConfigured();break;case 'pluginsLoading':break;case 'pluginsReady':this.onPluginsReady();break;case 'initialized':this.onInitialized();break;case 'loaded':this.onLoaded();break;case 'destinationsLoading':break;case 'destinationsReady':this.onDestinationsReady();break;case 'ready':this.onReady();break;case 'readyExecuted':default:break;}}catch(err){const issue='Failed to load the SDK';this.errorHandler.onError(getMutatedError(err,issue),ANALYTICS_CORE);}});}onBrowserCapabilitiesReady(){// initialize the preloaded events enqueuing
|
3321
3358
|
retrievePreloadBufferEvents(this);this.prepareInternalServices();this.loadConfig();}onLoaded(){this.processBufferedEvents();// Short-circuit the life cycle and move to the ready state if pre-consent behavior is enabled
|
3322
3359
|
if(state.consents.preConsent.value.enabled===true){state.lifecycle.status.value='ready';}else {this.loadDestinations();}}/**
|
3323
3360
|
* Load browser polyfill if required
|