@rudderstack/analytics-js 3.11.6 → 3.11.8

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.
@@ -835,6 +835,10 @@ var isFunction=function isFunction(value){return typeof value==='function'&&Bool
835
835
  * @param value input value
836
836
  * @returns boolean
837
837
  */var isNullOrUndefined=function isNullOrUndefined(value){return isNull(value)||isUndefined(value);};/**
838
+ * Checks if the input is a BigInt
839
+ * @param value input value
840
+ * @returns True if the input is a BigInt
841
+ */var isBigInt=function isBigInt(value){return typeof value==='bigint';};/**
838
842
  * A function to check given value is defined
839
843
  * @param value input value
840
844
  * @returns boolean
@@ -852,6 +856,8 @@ var isFunction=function isFunction(value){return typeof value==='function'&&Bool
852
856
  * @returns true if the input is an instance of Error and false otherwise
853
857
  */var isTypeOfError=function isTypeOfError(obj){return obj instanceof Error;};
854
858
 
859
+ var LOG_CONTEXT_SEPARATOR=':: ';var SCRIPT_ALREADY_EXISTS_ERROR=function SCRIPT_ALREADY_EXISTS_ERROR(id){return "A script with the id \"".concat(id,"\" is already loaded. Skipping the loading of this script to prevent conflicts.");};var SCRIPT_LOAD_ERROR=function SCRIPT_LOAD_ERROR(id,url){return "Failed to load the script with the id \"".concat(id,"\" from URL \"").concat(url,"\".");};var SCRIPT_LOAD_TIMEOUT_ERROR=function SCRIPT_LOAD_TIMEOUT_ERROR(id,url,timeout){return "A timeout of ".concat(timeout," ms occurred while trying to load the script with id \"").concat(id,"\" from URL \"").concat(url,"\".");};var CIRCULAR_REFERENCE_WARNING=function CIRCULAR_REFERENCE_WARNING(context,key){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"A circular reference has been detected in the object and the property \"").concat(key,"\" has been dropped from the output.");};var JSON_STRINGIFY_WARNING="Failed to convert the value to a JSON string.";
860
+
855
861
  var getValueByPath=function getValueByPath(obj,keyPath){var pathParts=keyPath.split('.');return path(pathParts,obj);};var hasValueByPath=function hasValueByPath(obj,path){return Boolean(getValueByPath(obj,path));};var isObject=function isObject(value){return _typeof(value)==='object';};/**
856
862
  * Checks if the input is an object literal or built-in object type and not null
857
863
  * @param value Input value
@@ -873,7 +879,28 @@ mergeDeepRight(mergedArray[index],value):value;});return mergedArray;};var merge
873
879
  * A utility to recursively remove undefined and null values from an object
874
880
  * @param obj input object
875
881
  * @returns a new object
876
- */var _removeUndefinedAndNullValues=function removeUndefinedAndNullValues(obj){var result=pickBy(isDefinedAndNotNull,obj);Object.keys(result).forEach(function(key){var value=result[key];if(isObjectLiteralAndNotNull(value)){result[key]=_removeUndefinedAndNullValues(value);}});return result;};
882
+ */var _removeUndefinedAndNullValues=function removeUndefinedAndNullValues(obj){var result=pickBy(isDefinedAndNotNull,obj);Object.keys(result).forEach(function(key){var value=result[key];if(isObjectLiteralAndNotNull(value)){result[key]=_removeUndefinedAndNullValues(value);}});return result;};var getReplacer=function getReplacer(logger){var ancestors=[];// Array to track ancestor objects
883
+ // Using a regular function to use `this` for the parent context
884
+ return function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
885
+ }// `this` is the object that value is contained in, i.e., its direct parent.
886
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
887
+ // @ts-ignore-next-line
888
+ while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();// Remove ancestors that are no longer part of the chain
889
+ }// Check for circular references (if the value is already in the ancestors)
890
+ if(ancestors.includes(value)){return '[Circular Reference]';}// Add current value to ancestors
891
+ ancestors.push(value);return value;};};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
892
+ var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
893
+ // eslint-disable-next-line no-restricted-syntax
894
+ for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
895
+ var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
896
+ if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
897
+ * Recursively traverses an object similar to JSON.stringify,
898
+ * sanitizing BigInts and circular references
899
+ * @param value Input object
900
+ * @param logger Logger instance
901
+ * @returns Sanitized value
902
+ */var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
903
+ var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
877
904
 
878
905
  var trim=function trim(value){return value.replace(/^\s+|\s+$/gm,'');};var removeDoubleSpaces=function removeDoubleSpaces(value){return value.replace(/ {2,}/g,' ');};var removeLeadingPeriod=function removeLeadingPeriod(value){return value.replace(/^\.+/,'');};/**
879
906
  * A function to convert values to string
@@ -899,28 +926,6 @@ var trim=function trim(value){return value.replace(/^\s+|\s+$/gm,'');};var remov
899
926
  * @returns decoded string
900
927
  */var fromBase64=function fromBase64(value){return new TextDecoder().decode(base64ToBytes(value));};
901
928
 
902
- var LOG_CONTEXT_SEPARATOR=':: ';var SCRIPT_ALREADY_EXISTS_ERROR=function SCRIPT_ALREADY_EXISTS_ERROR(id){return "A script with the id \"".concat(id,"\" is already loaded. Skipping the loading of this script to prevent conflicts.");};var SCRIPT_LOAD_ERROR=function SCRIPT_LOAD_ERROR(id,url){return "Failed to load the script with the id \"".concat(id,"\" from URL \"").concat(url,"\".");};var SCRIPT_LOAD_TIMEOUT_ERROR=function SCRIPT_LOAD_TIMEOUT_ERROR(id,url,timeout){return "A timeout of ".concat(timeout," ms occurred while trying to load the script with id \"").concat(id,"\" from URL \"").concat(url,"\".");};var CIRCULAR_REFERENCE_WARNING=function CIRCULAR_REFERENCE_WARNING(context,key){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"A circular reference has been detected in the object and the property \"").concat(key,"\" has been dropped from the output.");};var JSON_STRINGIFY_WARNING="Failed to convert the value to a JSON string.";
903
-
904
- var JSON_STRINGIFY='JSONStringify';var getCircularReplacer=function getCircularReplacer(excludeNull,excludeKeys,logger){var ancestors=[];// Here we do not want to use arrow function to use "this" in function context
905
- // eslint-disable-next-line func-names
906
- return function(key,value){if(excludeKeys!==null&&excludeKeys!==void 0&&excludeKeys.includes(key)){return undefined;}if(excludeNull&&isNullOrUndefined(value)){return undefined;}if(_typeof(value)!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
907
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
908
- // @ts-ignore-next-line
909
- while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){logger===null||logger===void 0||logger.warn(CIRCULAR_REFERENCE_WARNING(JSON_STRINGIFY,key));return '[Circular Reference]';}ancestors.push(value);return value;};};/**
910
- * Utility method for JSON stringify object excluding null values & circular references
911
- *
912
- * @param {*} value input
913
- * @param {boolean} excludeNull if it should exclude nul or not
914
- * @param {function} logger optional logger methods for warning
915
- * @returns string
916
- */var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){logger===null||logger===void 0||logger.warn(JSON_STRINGIFY_WARNING,err);return null;}};/**
917
- * Recursively traverses an object similar to JSON.stringify,
918
- * sanitizing BigInts and circular references
919
- * @param value Input object
920
- * @param logger Logger instance
921
- * @returns Sanitized value
922
- */var getSanitizedValue=function getSanitizedValue(value,logger){return value;};
923
-
924
929
  // if yes make them null instead of omitting in overloaded cases
925
930
  /*
926
931
  * Normalise the overloaded arguments of the page call facade
@@ -999,6 +1004,20 @@ var getFormattedTimestamp=function getFormattedTimestamp(date){return date.toISO
999
1004
  * @returns ISO formatted timestamp string
1000
1005
  */var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
1001
1006
 
1007
+ var JSON_STRINGIFY='JSONStringify';var getCircularReplacer=function getCircularReplacer(excludeNull,excludeKeys,logger){var ancestors=[];// Here we do not want to use arrow function to use "this" in function context
1008
+ // eslint-disable-next-line func-names
1009
+ return function(key,value){if(excludeKeys!==null&&excludeKeys!==void 0&&excludeKeys.includes(key)){return undefined;}if(excludeNull&&isNullOrUndefined(value)){return undefined;}if(_typeof(value)!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
1010
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1011
+ // @ts-ignore-next-line
1012
+ while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){logger===null||logger===void 0||logger.warn(CIRCULAR_REFERENCE_WARNING(JSON_STRINGIFY,key));return '[Circular Reference]';}ancestors.push(value);return value;};};/**
1013
+ * Utility method for JSON stringify object excluding null values & circular references
1014
+ *
1015
+ * @param {*} value input
1016
+ * @param {boolean} excludeNull if it should exclude nul or not
1017
+ * @param {function} logger optional logger methods for warning
1018
+ * @returns string
1019
+ */var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){logger===null||logger===void 0||logger.warn(JSON_STRINGIFY_WARNING,err);return null;}};
1020
+
1002
1021
  var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
1003
1022
  * Get mutated error with issue prepended to error message
1004
1023
  * @param err Original error
@@ -1006,7 +1025,7 @@ var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
1006
1025
  * @returns Instance of Error with message prepended with issue
1007
1026
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1008
1027
 
1009
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.6';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';var CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
1028
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.8';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';
1010
1029
 
1011
1030
  var QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';var QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';var QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';var QUERY_PARAM_USER_ID_KEY='ajs_uid';var QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
1012
1031
 
@@ -841,6 +841,10 @@
841
841
  * @param value input value
842
842
  * @returns boolean
843
843
  */var isNullOrUndefined=function isNullOrUndefined(value){return isNull(value)||isUndefined(value);};/**
844
+ * Checks if the input is a BigInt
845
+ * @param value input value
846
+ * @returns True if the input is a BigInt
847
+ */var isBigInt=function isBigInt(value){return typeof value==='bigint';};/**
844
848
  * A function to check given value is defined
845
849
  * @param value input value
846
850
  * @returns boolean
@@ -858,6 +862,8 @@
858
862
  * @returns true if the input is an instance of Error and false otherwise
859
863
  */var isTypeOfError=function isTypeOfError(obj){return obj instanceof Error;};
860
864
 
865
+ var LOG_CONTEXT_SEPARATOR=':: ';var SCRIPT_ALREADY_EXISTS_ERROR=function SCRIPT_ALREADY_EXISTS_ERROR(id){return "A script with the id \"".concat(id,"\" is already loaded. Skipping the loading of this script to prevent conflicts.");};var SCRIPT_LOAD_ERROR=function SCRIPT_LOAD_ERROR(id,url){return "Failed to load the script with the id \"".concat(id,"\" from URL \"").concat(url,"\".");};var SCRIPT_LOAD_TIMEOUT_ERROR=function SCRIPT_LOAD_TIMEOUT_ERROR(id,url,timeout){return "A timeout of ".concat(timeout," ms occurred while trying to load the script with id \"").concat(id,"\" from URL \"").concat(url,"\".");};var CIRCULAR_REFERENCE_WARNING=function CIRCULAR_REFERENCE_WARNING(context,key){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"A circular reference has been detected in the object and the property \"").concat(key,"\" has been dropped from the output.");};var JSON_STRINGIFY_WARNING="Failed to convert the value to a JSON string.";
866
+
861
867
  var getValueByPath=function getValueByPath(obj,keyPath){var pathParts=keyPath.split('.');return path(pathParts,obj);};var hasValueByPath=function hasValueByPath(obj,path){return Boolean(getValueByPath(obj,path));};var isObject=function isObject(value){return _typeof(value)==='object';};/**
862
868
  * Checks if the input is an object literal or built-in object type and not null
863
869
  * @param value Input value
@@ -879,7 +885,28 @@
879
885
  * A utility to recursively remove undefined and null values from an object
880
886
  * @param obj input object
881
887
  * @returns a new object
882
- */var _removeUndefinedAndNullValues=function removeUndefinedAndNullValues(obj){var result=pickBy(isDefinedAndNotNull,obj);Object.keys(result).forEach(function(key){var value=result[key];if(isObjectLiteralAndNotNull(value)){result[key]=_removeUndefinedAndNullValues(value);}});return result;};
888
+ */var _removeUndefinedAndNullValues=function removeUndefinedAndNullValues(obj){var result=pickBy(isDefinedAndNotNull,obj);Object.keys(result).forEach(function(key){var value=result[key];if(isObjectLiteralAndNotNull(value)){result[key]=_removeUndefinedAndNullValues(value);}});return result;};var getReplacer=function getReplacer(logger){var ancestors=[];// Array to track ancestor objects
889
+ // Using a regular function to use `this` for the parent context
890
+ return function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
891
+ }// `this` is the object that value is contained in, i.e., its direct parent.
892
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
893
+ // @ts-ignore-next-line
894
+ while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();// Remove ancestors that are no longer part of the chain
895
+ }// Check for circular references (if the value is already in the ancestors)
896
+ if(ancestors.includes(value)){return '[Circular Reference]';}// Add current value to ancestors
897
+ ancestors.push(value);return value;};};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
898
+ var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
899
+ // eslint-disable-next-line no-restricted-syntax
900
+ for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
901
+ var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
902
+ if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
903
+ * Recursively traverses an object similar to JSON.stringify,
904
+ * sanitizing BigInts and circular references
905
+ * @param value Input object
906
+ * @param logger Logger instance
907
+ * @returns Sanitized value
908
+ */var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
909
+ var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
883
910
 
884
911
  var trim=function trim(value){return value.replace(/^\s+|\s+$/gm,'');};var removeDoubleSpaces=function removeDoubleSpaces(value){return value.replace(/ {2,}/g,' ');};var removeLeadingPeriod=function removeLeadingPeriod(value){return value.replace(/^\.+/,'');};/**
885
912
  * A function to convert values to string
@@ -905,28 +932,6 @@
905
932
  * @returns decoded string
906
933
  */var fromBase64=function fromBase64(value){return new TextDecoder().decode(base64ToBytes(value));};
907
934
 
908
- var LOG_CONTEXT_SEPARATOR=':: ';var SCRIPT_ALREADY_EXISTS_ERROR=function SCRIPT_ALREADY_EXISTS_ERROR(id){return "A script with the id \"".concat(id,"\" is already loaded. Skipping the loading of this script to prevent conflicts.");};var SCRIPT_LOAD_ERROR=function SCRIPT_LOAD_ERROR(id,url){return "Failed to load the script with the id \"".concat(id,"\" from URL \"").concat(url,"\".");};var SCRIPT_LOAD_TIMEOUT_ERROR=function SCRIPT_LOAD_TIMEOUT_ERROR(id,url,timeout){return "A timeout of ".concat(timeout," ms occurred while trying to load the script with id \"").concat(id,"\" from URL \"").concat(url,"\".");};var CIRCULAR_REFERENCE_WARNING=function CIRCULAR_REFERENCE_WARNING(context,key){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"A circular reference has been detected in the object and the property \"").concat(key,"\" has been dropped from the output.");};var JSON_STRINGIFY_WARNING="Failed to convert the value to a JSON string.";
909
-
910
- var JSON_STRINGIFY='JSONStringify';var getCircularReplacer=function getCircularReplacer(excludeNull,excludeKeys,logger){var ancestors=[];// Here we do not want to use arrow function to use "this" in function context
911
- // eslint-disable-next-line func-names
912
- return function(key,value){if(excludeKeys!==null&&excludeKeys!==void 0&&excludeKeys.includes(key)){return undefined;}if(excludeNull&&isNullOrUndefined(value)){return undefined;}if(_typeof(value)!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
913
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
914
- // @ts-ignore-next-line
915
- while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){logger===null||logger===void 0||logger.warn(CIRCULAR_REFERENCE_WARNING(JSON_STRINGIFY,key));return '[Circular Reference]';}ancestors.push(value);return value;};};/**
916
- * Utility method for JSON stringify object excluding null values & circular references
917
- *
918
- * @param {*} value input
919
- * @param {boolean} excludeNull if it should exclude nul or not
920
- * @param {function} logger optional logger methods for warning
921
- * @returns string
922
- */var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){logger===null||logger===void 0||logger.warn(JSON_STRINGIFY_WARNING,err);return null;}};/**
923
- * Recursively traverses an object similar to JSON.stringify,
924
- * sanitizing BigInts and circular references
925
- * @param value Input object
926
- * @param logger Logger instance
927
- * @returns Sanitized value
928
- */var getSanitizedValue=function getSanitizedValue(value,logger){return value;};
929
-
930
935
  // if yes make them null instead of omitting in overloaded cases
931
936
  /*
932
937
  * Normalise the overloaded arguments of the page call facade
@@ -1005,6 +1010,20 @@
1005
1010
  * @returns ISO formatted timestamp string
1006
1011
  */var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
1007
1012
 
1013
+ var JSON_STRINGIFY='JSONStringify';var getCircularReplacer=function getCircularReplacer(excludeNull,excludeKeys,logger){var ancestors=[];// Here we do not want to use arrow function to use "this" in function context
1014
+ // eslint-disable-next-line func-names
1015
+ return function(key,value){if(excludeKeys!==null&&excludeKeys!==void 0&&excludeKeys.includes(key)){return undefined;}if(excludeNull&&isNullOrUndefined(value)){return undefined;}if(_typeof(value)!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
1016
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1017
+ // @ts-ignore-next-line
1018
+ while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){logger===null||logger===void 0||logger.warn(CIRCULAR_REFERENCE_WARNING(JSON_STRINGIFY,key));return '[Circular Reference]';}ancestors.push(value);return value;};};/**
1019
+ * Utility method for JSON stringify object excluding null values & circular references
1020
+ *
1021
+ * @param {*} value input
1022
+ * @param {boolean} excludeNull if it should exclude nul or not
1023
+ * @param {function} logger optional logger methods for warning
1024
+ * @returns string
1025
+ */var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){logger===null||logger===void 0||logger.warn(JSON_STRINGIFY_WARNING,err);return null;}};
1026
+
1008
1027
  var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
1009
1028
  * Get mutated error with issue prepended to error message
1010
1029
  * @param err Original error
@@ -1012,7 +1031,7 @@
1012
1031
  * @returns Instance of Error with message prepended with issue
1013
1032
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1014
1033
 
1015
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.6';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';var CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
1034
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.8';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';
1016
1035
 
1017
1036
  var QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';var QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';var QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';var QUERY_PARAM_USER_ID_KEY='ajs_uid';var QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
1018
1037
 
@@ -835,6 +835,10 @@ var isFunction=function isFunction(value){return typeof value==='function'&&Bool
835
835
  * @param value input value
836
836
  * @returns boolean
837
837
  */var isNullOrUndefined=function isNullOrUndefined(value){return isNull(value)||isUndefined(value);};/**
838
+ * Checks if the input is a BigInt
839
+ * @param value input value
840
+ * @returns True if the input is a BigInt
841
+ */var isBigInt=function isBigInt(value){return typeof value==='bigint';};/**
838
842
  * A function to check given value is defined
839
843
  * @param value input value
840
844
  * @returns boolean
@@ -852,6 +856,8 @@ var isFunction=function isFunction(value){return typeof value==='function'&&Bool
852
856
  * @returns true if the input is an instance of Error and false otherwise
853
857
  */var isTypeOfError=function isTypeOfError(obj){return obj instanceof Error;};
854
858
 
859
+ var LOG_CONTEXT_SEPARATOR=':: ';var SCRIPT_ALREADY_EXISTS_ERROR=function SCRIPT_ALREADY_EXISTS_ERROR(id){return "A script with the id \"".concat(id,"\" is already loaded. Skipping the loading of this script to prevent conflicts.");};var SCRIPT_LOAD_ERROR=function SCRIPT_LOAD_ERROR(id,url){return "Failed to load the script with the id \"".concat(id,"\" from URL \"").concat(url,"\".");};var SCRIPT_LOAD_TIMEOUT_ERROR=function SCRIPT_LOAD_TIMEOUT_ERROR(id,url,timeout){return "A timeout of ".concat(timeout," ms occurred while trying to load the script with id \"").concat(id,"\" from URL \"").concat(url,"\".");};var CIRCULAR_REFERENCE_WARNING=function CIRCULAR_REFERENCE_WARNING(context,key){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"A circular reference has been detected in the object and the property \"").concat(key,"\" has been dropped from the output.");};var JSON_STRINGIFY_WARNING="Failed to convert the value to a JSON string.";
860
+
855
861
  var getValueByPath=function getValueByPath(obj,keyPath){var pathParts=keyPath.split('.');return path(pathParts,obj);};var hasValueByPath=function hasValueByPath(obj,path){return Boolean(getValueByPath(obj,path));};var isObject=function isObject(value){return _typeof(value)==='object';};/**
856
862
  * Checks if the input is an object literal or built-in object type and not null
857
863
  * @param value Input value
@@ -873,7 +879,28 @@ mergeDeepRight(mergedArray[index],value):value;});return mergedArray;};var merge
873
879
  * A utility to recursively remove undefined and null values from an object
874
880
  * @param obj input object
875
881
  * @returns a new object
876
- */var _removeUndefinedAndNullValues=function removeUndefinedAndNullValues(obj){var result=pickBy(isDefinedAndNotNull,obj);Object.keys(result).forEach(function(key){var value=result[key];if(isObjectLiteralAndNotNull(value)){result[key]=_removeUndefinedAndNullValues(value);}});return result;};
882
+ */var _removeUndefinedAndNullValues=function removeUndefinedAndNullValues(obj){var result=pickBy(isDefinedAndNotNull,obj);Object.keys(result).forEach(function(key){var value=result[key];if(isObjectLiteralAndNotNull(value)){result[key]=_removeUndefinedAndNullValues(value);}});return result;};var getReplacer=function getReplacer(logger){var ancestors=[];// Array to track ancestor objects
883
+ // Using a regular function to use `this` for the parent context
884
+ return function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
885
+ }// `this` is the object that value is contained in, i.e., its direct parent.
886
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
887
+ // @ts-ignore-next-line
888
+ while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();// Remove ancestors that are no longer part of the chain
889
+ }// Check for circular references (if the value is already in the ancestors)
890
+ if(ancestors.includes(value)){return '[Circular Reference]';}// Add current value to ancestors
891
+ ancestors.push(value);return value;};};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
892
+ var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
893
+ // eslint-disable-next-line no-restricted-syntax
894
+ for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
895
+ var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
896
+ if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
897
+ * Recursively traverses an object similar to JSON.stringify,
898
+ * sanitizing BigInts and circular references
899
+ * @param value Input object
900
+ * @param logger Logger instance
901
+ * @returns Sanitized value
902
+ */var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
903
+ var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
877
904
 
878
905
  var trim=function trim(value){return value.replace(/^\s+|\s+$/gm,'');};var removeDoubleSpaces=function removeDoubleSpaces(value){return value.replace(/ {2,}/g,' ');};var removeLeadingPeriod=function removeLeadingPeriod(value){return value.replace(/^\.+/,'');};/**
879
906
  * A function to convert values to string
@@ -899,28 +926,6 @@ var trim=function trim(value){return value.replace(/^\s+|\s+$/gm,'');};var remov
899
926
  * @returns decoded string
900
927
  */var fromBase64=function fromBase64(value){return new TextDecoder().decode(base64ToBytes(value));};
901
928
 
902
- var LOG_CONTEXT_SEPARATOR=':: ';var SCRIPT_ALREADY_EXISTS_ERROR=function SCRIPT_ALREADY_EXISTS_ERROR(id){return "A script with the id \"".concat(id,"\" is already loaded. Skipping the loading of this script to prevent conflicts.");};var SCRIPT_LOAD_ERROR=function SCRIPT_LOAD_ERROR(id,url){return "Failed to load the script with the id \"".concat(id,"\" from URL \"").concat(url,"\".");};var SCRIPT_LOAD_TIMEOUT_ERROR=function SCRIPT_LOAD_TIMEOUT_ERROR(id,url,timeout){return "A timeout of ".concat(timeout," ms occurred while trying to load the script with id \"").concat(id,"\" from URL \"").concat(url,"\".");};var CIRCULAR_REFERENCE_WARNING=function CIRCULAR_REFERENCE_WARNING(context,key){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"A circular reference has been detected in the object and the property \"").concat(key,"\" has been dropped from the output.");};var JSON_STRINGIFY_WARNING="Failed to convert the value to a JSON string.";
903
-
904
- var JSON_STRINGIFY='JSONStringify';var getCircularReplacer=function getCircularReplacer(excludeNull,excludeKeys,logger){var ancestors=[];// Here we do not want to use arrow function to use "this" in function context
905
- // eslint-disable-next-line func-names
906
- return function(key,value){if(excludeKeys!==null&&excludeKeys!==void 0&&excludeKeys.includes(key)){return undefined;}if(excludeNull&&isNullOrUndefined(value)){return undefined;}if(_typeof(value)!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
907
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
908
- // @ts-ignore-next-line
909
- while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){logger===null||logger===void 0||logger.warn(CIRCULAR_REFERENCE_WARNING(JSON_STRINGIFY,key));return '[Circular Reference]';}ancestors.push(value);return value;};};/**
910
- * Utility method for JSON stringify object excluding null values & circular references
911
- *
912
- * @param {*} value input
913
- * @param {boolean} excludeNull if it should exclude nul or not
914
- * @param {function} logger optional logger methods for warning
915
- * @returns string
916
- */var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){logger===null||logger===void 0||logger.warn(JSON_STRINGIFY_WARNING,err);return null;}};/**
917
- * Recursively traverses an object similar to JSON.stringify,
918
- * sanitizing BigInts and circular references
919
- * @param value Input object
920
- * @param logger Logger instance
921
- * @returns Sanitized value
922
- */var getSanitizedValue=function getSanitizedValue(value,logger){return value;};
923
-
924
929
  // if yes make them null instead of omitting in overloaded cases
925
930
  /*
926
931
  * Normalise the overloaded arguments of the page call facade
@@ -999,6 +1004,20 @@ var getFormattedTimestamp=function getFormattedTimestamp(date){return date.toISO
999
1004
  * @returns ISO formatted timestamp string
1000
1005
  */var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
1001
1006
 
1007
+ var JSON_STRINGIFY='JSONStringify';var getCircularReplacer=function getCircularReplacer(excludeNull,excludeKeys,logger){var ancestors=[];// Here we do not want to use arrow function to use "this" in function context
1008
+ // eslint-disable-next-line func-names
1009
+ return function(key,value){if(excludeKeys!==null&&excludeKeys!==void 0&&excludeKeys.includes(key)){return undefined;}if(excludeNull&&isNullOrUndefined(value)){return undefined;}if(_typeof(value)!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
1010
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1011
+ // @ts-ignore-next-line
1012
+ while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){logger===null||logger===void 0||logger.warn(CIRCULAR_REFERENCE_WARNING(JSON_STRINGIFY,key));return '[Circular Reference]';}ancestors.push(value);return value;};};/**
1013
+ * Utility method for JSON stringify object excluding null values & circular references
1014
+ *
1015
+ * @param {*} value input
1016
+ * @param {boolean} excludeNull if it should exclude nul or not
1017
+ * @param {function} logger optional logger methods for warning
1018
+ * @returns string
1019
+ */var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){logger===null||logger===void 0||logger.warn(JSON_STRINGIFY_WARNING,err);return null;}};
1020
+
1002
1021
  var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
1003
1022
  * Get mutated error with issue prepended to error message
1004
1023
  * @param err Original error
@@ -1006,7 +1025,7 @@ var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
1006
1025
  * @returns Instance of Error with message prepended with issue
1007
1026
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1008
1027
 
1009
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.6';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';var CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
1028
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.8';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';
1010
1029
 
1011
1030
  var QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';var QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';var QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';var QUERY_PARAM_USER_ID_KEY='ajs_uid';var QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
1012
1031
 
@@ -841,6 +841,10 @@
841
841
  * @param value input value
842
842
  * @returns boolean
843
843
  */var isNullOrUndefined=function isNullOrUndefined(value){return isNull(value)||isUndefined(value);};/**
844
+ * Checks if the input is a BigInt
845
+ * @param value input value
846
+ * @returns True if the input is a BigInt
847
+ */var isBigInt=function isBigInt(value){return typeof value==='bigint';};/**
844
848
  * A function to check given value is defined
845
849
  * @param value input value
846
850
  * @returns boolean
@@ -858,6 +862,8 @@
858
862
  * @returns true if the input is an instance of Error and false otherwise
859
863
  */var isTypeOfError=function isTypeOfError(obj){return obj instanceof Error;};
860
864
 
865
+ var LOG_CONTEXT_SEPARATOR=':: ';var SCRIPT_ALREADY_EXISTS_ERROR=function SCRIPT_ALREADY_EXISTS_ERROR(id){return "A script with the id \"".concat(id,"\" is already loaded. Skipping the loading of this script to prevent conflicts.");};var SCRIPT_LOAD_ERROR=function SCRIPT_LOAD_ERROR(id,url){return "Failed to load the script with the id \"".concat(id,"\" from URL \"").concat(url,"\".");};var SCRIPT_LOAD_TIMEOUT_ERROR=function SCRIPT_LOAD_TIMEOUT_ERROR(id,url,timeout){return "A timeout of ".concat(timeout," ms occurred while trying to load the script with id \"").concat(id,"\" from URL \"").concat(url,"\".");};var CIRCULAR_REFERENCE_WARNING=function CIRCULAR_REFERENCE_WARNING(context,key){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"A circular reference has been detected in the object and the property \"").concat(key,"\" has been dropped from the output.");};var JSON_STRINGIFY_WARNING="Failed to convert the value to a JSON string.";
866
+
861
867
  var getValueByPath=function getValueByPath(obj,keyPath){var pathParts=keyPath.split('.');return path(pathParts,obj);};var hasValueByPath=function hasValueByPath(obj,path){return Boolean(getValueByPath(obj,path));};var isObject=function isObject(value){return _typeof(value)==='object';};/**
862
868
  * Checks if the input is an object literal or built-in object type and not null
863
869
  * @param value Input value
@@ -879,7 +885,28 @@
879
885
  * A utility to recursively remove undefined and null values from an object
880
886
  * @param obj input object
881
887
  * @returns a new object
882
- */var _removeUndefinedAndNullValues=function removeUndefinedAndNullValues(obj){var result=pickBy(isDefinedAndNotNull,obj);Object.keys(result).forEach(function(key){var value=result[key];if(isObjectLiteralAndNotNull(value)){result[key]=_removeUndefinedAndNullValues(value);}});return result;};
888
+ */var _removeUndefinedAndNullValues=function removeUndefinedAndNullValues(obj){var result=pickBy(isDefinedAndNotNull,obj);Object.keys(result).forEach(function(key){var value=result[key];if(isObjectLiteralAndNotNull(value)){result[key]=_removeUndefinedAndNullValues(value);}});return result;};var getReplacer=function getReplacer(logger){var ancestors=[];// Array to track ancestor objects
889
+ // Using a regular function to use `this` for the parent context
890
+ return function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
891
+ }// `this` is the object that value is contained in, i.e., its direct parent.
892
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
893
+ // @ts-ignore-next-line
894
+ while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();// Remove ancestors that are no longer part of the chain
895
+ }// Check for circular references (if the value is already in the ancestors)
896
+ if(ancestors.includes(value)){return '[Circular Reference]';}// Add current value to ancestors
897
+ ancestors.push(value);return value;};};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
898
+ var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
899
+ // eslint-disable-next-line no-restricted-syntax
900
+ for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
901
+ var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
902
+ if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
903
+ * Recursively traverses an object similar to JSON.stringify,
904
+ * sanitizing BigInts and circular references
905
+ * @param value Input object
906
+ * @param logger Logger instance
907
+ * @returns Sanitized value
908
+ */var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
909
+ var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
883
910
 
884
911
  var trim=function trim(value){return value.replace(/^\s+|\s+$/gm,'');};var removeDoubleSpaces=function removeDoubleSpaces(value){return value.replace(/ {2,}/g,' ');};var removeLeadingPeriod=function removeLeadingPeriod(value){return value.replace(/^\.+/,'');};/**
885
912
  * A function to convert values to string
@@ -905,28 +932,6 @@
905
932
  * @returns decoded string
906
933
  */var fromBase64=function fromBase64(value){return new TextDecoder().decode(base64ToBytes(value));};
907
934
 
908
- var LOG_CONTEXT_SEPARATOR=':: ';var SCRIPT_ALREADY_EXISTS_ERROR=function SCRIPT_ALREADY_EXISTS_ERROR(id){return "A script with the id \"".concat(id,"\" is already loaded. Skipping the loading of this script to prevent conflicts.");};var SCRIPT_LOAD_ERROR=function SCRIPT_LOAD_ERROR(id,url){return "Failed to load the script with the id \"".concat(id,"\" from URL \"").concat(url,"\".");};var SCRIPT_LOAD_TIMEOUT_ERROR=function SCRIPT_LOAD_TIMEOUT_ERROR(id,url,timeout){return "A timeout of ".concat(timeout," ms occurred while trying to load the script with id \"").concat(id,"\" from URL \"").concat(url,"\".");};var CIRCULAR_REFERENCE_WARNING=function CIRCULAR_REFERENCE_WARNING(context,key){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"A circular reference has been detected in the object and the property \"").concat(key,"\" has been dropped from the output.");};var JSON_STRINGIFY_WARNING="Failed to convert the value to a JSON string.";
909
-
910
- var JSON_STRINGIFY='JSONStringify';var getCircularReplacer=function getCircularReplacer(excludeNull,excludeKeys,logger){var ancestors=[];// Here we do not want to use arrow function to use "this" in function context
911
- // eslint-disable-next-line func-names
912
- return function(key,value){if(excludeKeys!==null&&excludeKeys!==void 0&&excludeKeys.includes(key)){return undefined;}if(excludeNull&&isNullOrUndefined(value)){return undefined;}if(_typeof(value)!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
913
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
914
- // @ts-ignore-next-line
915
- while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){logger===null||logger===void 0||logger.warn(CIRCULAR_REFERENCE_WARNING(JSON_STRINGIFY,key));return '[Circular Reference]';}ancestors.push(value);return value;};};/**
916
- * Utility method for JSON stringify object excluding null values & circular references
917
- *
918
- * @param {*} value input
919
- * @param {boolean} excludeNull if it should exclude nul or not
920
- * @param {function} logger optional logger methods for warning
921
- * @returns string
922
- */var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){logger===null||logger===void 0||logger.warn(JSON_STRINGIFY_WARNING,err);return null;}};/**
923
- * Recursively traverses an object similar to JSON.stringify,
924
- * sanitizing BigInts and circular references
925
- * @param value Input object
926
- * @param logger Logger instance
927
- * @returns Sanitized value
928
- */var getSanitizedValue=function getSanitizedValue(value,logger){return value;};
929
-
930
935
  // if yes make them null instead of omitting in overloaded cases
931
936
  /*
932
937
  * Normalise the overloaded arguments of the page call facade
@@ -1005,6 +1010,20 @@
1005
1010
  * @returns ISO formatted timestamp string
1006
1011
  */var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
1007
1012
 
1013
+ var JSON_STRINGIFY='JSONStringify';var getCircularReplacer=function getCircularReplacer(excludeNull,excludeKeys,logger){var ancestors=[];// Here we do not want to use arrow function to use "this" in function context
1014
+ // eslint-disable-next-line func-names
1015
+ return function(key,value){if(excludeKeys!==null&&excludeKeys!==void 0&&excludeKeys.includes(key)){return undefined;}if(excludeNull&&isNullOrUndefined(value)){return undefined;}if(_typeof(value)!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
1016
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1017
+ // @ts-ignore-next-line
1018
+ while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){logger===null||logger===void 0||logger.warn(CIRCULAR_REFERENCE_WARNING(JSON_STRINGIFY,key));return '[Circular Reference]';}ancestors.push(value);return value;};};/**
1019
+ * Utility method for JSON stringify object excluding null values & circular references
1020
+ *
1021
+ * @param {*} value input
1022
+ * @param {boolean} excludeNull if it should exclude nul or not
1023
+ * @param {function} logger optional logger methods for warning
1024
+ * @returns string
1025
+ */var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){logger===null||logger===void 0||logger.warn(JSON_STRINGIFY_WARNING,err);return null;}};
1026
+
1008
1027
  var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
1009
1028
  * Get mutated error with issue prepended to error message
1010
1029
  * @param err Original error
@@ -1012,7 +1031,7 @@
1012
1031
  * @returns Instance of Error with message prepended with issue
1013
1032
  */var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
1014
1033
 
1015
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.6';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';var CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
1034
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.8';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';
1016
1035
 
1017
1036
  var QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';var QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';var QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';var QUERY_PARAM_USER_ID_KEY='ajs_uid';var QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
1018
1037
 
@@ -273,6 +273,10 @@ const isFunction=value=>typeof value==='function'&&Boolean(value.constructor&&va
273
273
  * @param value input value
274
274
  * @returns boolean
275
275
  */const isNullOrUndefined=value=>isNull(value)||isUndefined(value);/**
276
+ * Checks if the input is a BigInt
277
+ * @param value input value
278
+ * @returns True if the input is a BigInt
279
+ */const isBigInt=value=>typeof value==='bigint';/**
276
280
  * A function to check given value is defined
277
281
  * @param value input value
278
282
  * @returns boolean
@@ -290,6 +294,8 @@ const isFunction=value=>typeof value==='function'&&Boolean(value.constructor&&va
290
294
  * @returns true if the input is an instance of Error and false otherwise
291
295
  */const isTypeOfError=obj=>obj instanceof Error;
292
296
 
297
+ const LOG_CONTEXT_SEPARATOR=':: ';const SCRIPT_ALREADY_EXISTS_ERROR=id=>`A script with the id "${id}" is already loaded. Skipping the loading of this script to prevent conflicts.`;const SCRIPT_LOAD_ERROR=(id,url)=>`Failed to load the script with the id "${id}" from URL "${url}".`;const SCRIPT_LOAD_TIMEOUT_ERROR=(id,url,timeout)=>`A timeout of ${timeout} ms occurred while trying to load the script with id "${id}" from URL "${url}".`;const CIRCULAR_REFERENCE_WARNING=(context,key)=>`${context}${LOG_CONTEXT_SEPARATOR}A circular reference has been detected in the object and the property "${key}" has been dropped from the output.`;const JSON_STRINGIFY_WARNING=`Failed to convert the value to a JSON string.`;
298
+
293
299
  const getValueByPath=(obj,keyPath)=>{const pathParts=keyPath.split('.');return path(pathParts,obj);};const hasValueByPath=(obj,path)=>Boolean(getValueByPath(obj,path));const isObject=value=>typeof value==='object';/**
294
300
  * Checks if the input is an object literal or built-in object type and not null
295
301
  * @param value Input value
@@ -311,7 +317,28 @@ mergeDeepRight(mergedArray[index],value):value;});return mergedArray;};const mer
311
317
  * A utility to recursively remove undefined and null values from an object
312
318
  * @param obj input object
313
319
  * @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;};
320
+ */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;};const getReplacer=logger=>{const ancestors=[];// Array to track ancestor objects
321
+ // Using a regular function to use `this` for the parent context
322
+ return function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
323
+ }// `this` is the object that value is contained in, i.e., its direct parent.
324
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
325
+ // @ts-ignore-next-line
326
+ while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();// Remove ancestors that are no longer part of the chain
327
+ }// Check for circular references (if the value is already in the ancestors)
328
+ if(ancestors.includes(value)){return '[Circular Reference]';}// Add current value to ancestors
329
+ ancestors.push(value);return value;};};const traverseWithThis=(obj,replacer)=>{// Create a new result object or array
330
+ const result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
331
+ // eslint-disable-next-line no-restricted-syntax
332
+ for(const key in obj){if(Object.hasOwnProperty.call(obj,key)){const value=obj[key];// Recursively apply the replacer and traversal
333
+ const sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
334
+ if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
335
+ * Recursively traverses an object similar to JSON.stringify,
336
+ * sanitizing BigInts and circular references
337
+ * @param value Input object
338
+ * @param logger Logger instance
339
+ * @returns Sanitized value
340
+ */const getSanitizedValue=(value,logger)=>{const replacer=getReplacer();// This is needed for registering the first ancestor
341
+ const newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return traverseWithThis(value,replacer);}return newValue;};
315
342
 
316
343
  const trim=value=>value.replace(/^\s+|\s+$/gm,'');const removeDoubleSpaces=value=>value.replace(/ {2,}/g,' ');const removeLeadingPeriod=value=>value.replace(/^\.+/,'');/**
317
344
  * A function to convert values to string
@@ -337,28 +364,6 @@ const trim=value=>value.replace(/^\s+|\s+$/gm,'');const removeDoubleSpaces=value
337
364
  * @returns decoded string
338
365
  */const fromBase64=value=>new TextDecoder().decode(base64ToBytes(value));
339
366
 
340
- const LOG_CONTEXT_SEPARATOR=':: ';const SCRIPT_ALREADY_EXISTS_ERROR=id=>`A script with the id "${id}" is already loaded. Skipping the loading of this script to prevent conflicts.`;const SCRIPT_LOAD_ERROR=(id,url)=>`Failed to load the script with the id "${id}" from URL "${url}".`;const SCRIPT_LOAD_TIMEOUT_ERROR=(id,url,timeout)=>`A timeout of ${timeout} ms occurred while trying to load the script with id "${id}" from URL "${url}".`;const CIRCULAR_REFERENCE_WARNING=(context,key)=>`${context}${LOG_CONTEXT_SEPARATOR}A circular reference has been detected in the object and the property "${key}" has been dropped from the output.`;const JSON_STRINGIFY_WARNING=`Failed to convert the value to a JSON string.`;
341
-
342
- const JSON_STRINGIFY='JSONStringify';const getCircularReplacer=(excludeNull,excludeKeys,logger)=>{const ancestors=[];// Here we do not want to use arrow function to use "this" in function context
343
- // eslint-disable-next-line func-names
344
- return function(key,value){if(excludeKeys?.includes(key)){return undefined;}if(excludeNull&&isNullOrUndefined(value)){return undefined;}if(typeof value!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
345
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
346
- // @ts-ignore-next-line
347
- while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){logger?.warn(CIRCULAR_REFERENCE_WARNING(JSON_STRINGIFY,key));return '[Circular Reference]';}ancestors.push(value);return value;};};/**
348
- * Utility method for JSON stringify object excluding null values & circular references
349
- *
350
- * @param {*} value input
351
- * @param {boolean} excludeNull if it should exclude nul or not
352
- * @param {function} logger optional logger methods for warning
353
- * @returns string
354
- */const stringifyWithoutCircular=(value,excludeNull,excludeKeys,logger)=>{try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){logger?.warn(JSON_STRINGIFY_WARNING,err);return null;}};/**
355
- * Recursively traverses an object similar to JSON.stringify,
356
- * sanitizing BigInts and circular references
357
- * @param value Input object
358
- * @param logger Logger instance
359
- * @returns Sanitized value
360
- */const getSanitizedValue=(value,logger)=>value;
361
-
362
367
  // if yes make them null instead of omitting in overloaded cases
363
368
  /*
364
369
  * Normalise the overloaded arguments of the page call facade
@@ -437,6 +442,20 @@ const getFormattedTimestamp=date=>date.toISOString();/**
437
442
  * @returns ISO formatted timestamp string
438
443
  */const getCurrentTimeFormatted=()=>getFormattedTimestamp(new Date());
439
444
 
445
+ const JSON_STRINGIFY='JSONStringify';const getCircularReplacer=(excludeNull,excludeKeys,logger)=>{const ancestors=[];// Here we do not want to use arrow function to use "this" in function context
446
+ // eslint-disable-next-line func-names
447
+ return function(key,value){if(excludeKeys?.includes(key)){return undefined;}if(excludeNull&&isNullOrUndefined(value)){return undefined;}if(typeof value!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
448
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
449
+ // @ts-ignore-next-line
450
+ while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){logger?.warn(CIRCULAR_REFERENCE_WARNING(JSON_STRINGIFY,key));return '[Circular Reference]';}ancestors.push(value);return value;};};/**
451
+ * Utility method for JSON stringify object excluding null values & circular references
452
+ *
453
+ * @param {*} value input
454
+ * @param {boolean} excludeNull if it should exclude nul or not
455
+ * @param {function} logger optional logger methods for warning
456
+ * @returns string
457
+ */const stringifyWithoutCircular=(value,excludeNull,excludeKeys,logger)=>{try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){logger?.warn(JSON_STRINGIFY_WARNING,err);return null;}};
458
+
440
459
  const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
441
460
  * Get mutated error with issue prepended to error message
442
461
  * @param err Original error
@@ -444,7 +463,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
444
463
  * @returns Instance of Error with message prepended with issue
445
464
  */const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
446
465
 
447
- const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.6';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
466
+ const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.8';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';
448
467
 
449
468
  const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
450
469