@rudderstack/analytics-js 3.11.3 → 3.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/npm/legacy/bundled/cjs/index.cjs +39 -39
- package/dist/npm/legacy/bundled/esm/index.mjs +39 -39
- package/dist/npm/legacy/bundled/umd/index.js +39 -39
- package/dist/npm/legacy/cjs/index.cjs +39 -39
- package/dist/npm/legacy/content-script/cjs/index.cjs +39 -39
- package/dist/npm/legacy/content-script/esm/index.mjs +39 -39
- package/dist/npm/legacy/content-script/umd/index.js +39 -39
- package/dist/npm/legacy/esm/index.mjs +39 -39
- package/dist/npm/legacy/umd/index.js +39 -39
- package/dist/npm/modern/bundled/cjs/index.cjs +39 -39
- package/dist/npm/modern/bundled/esm/index.mjs +39 -39
- package/dist/npm/modern/bundled/umd/index.js +39 -39
- package/dist/npm/modern/cjs/index.cjs +39 -39
- package/dist/npm/modern/content-script/cjs/index.cjs +39 -39
- package/dist/npm/modern/content-script/esm/index.mjs +39 -39
- package/dist/npm/modern/content-script/umd/index.js +39 -39
- package/dist/npm/modern/esm/index.mjs +39 -39
- package/dist/npm/modern/umd/index.js +39 -39
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [3.11.4](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.11.3...@rudderstack/analytics-js@3.11.4) (2024-11-21)
|
6
|
+
|
7
|
+
### Dependency Updates
|
8
|
+
|
9
|
+
* `@rudderstack/analytics-js-cookies` updated to version `0.4.6`
|
10
|
+
* `@rudderstack/analytics-js-common` updated to version `3.14.3`
|
11
|
+
* `@rudderstack/analytics-js-plugins` updated to version `3.6.7`
|
5
12
|
## [3.11.3](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.11.2...@rudderstack/analytics-js@3.11.3) (2024-11-21)
|
6
13
|
|
7
14
|
### Dependency Updates
|
@@ -905,67 +905,37 @@ var trim=function trim(value){return value.replace(/^\s+|\s+$/gm,'');};var remov
|
|
905
905
|
* @returns decoded string
|
906
906
|
*/var fromBase64=function fromBase64(value){return new TextDecoder().decode(base64ToBytes(value));};
|
907
907
|
|
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;}};var getReplacer=function getReplacer(logger){return(// Using a regular function to use `this` for the parent context
|
923
|
-
function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
|
924
|
-
}return value;});};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
|
925
|
-
var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
|
926
|
-
// eslint-disable-next-line no-restricted-syntax
|
927
|
-
for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
|
928
|
-
var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
|
929
|
-
if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
|
930
|
-
* Recursively traverses an object similar to JSON.stringify,
|
931
|
-
* sanitizing BigInts and circular references
|
932
|
-
* @param value Input object
|
933
|
-
* @param logger Logger instance
|
934
|
-
* @returns Sanitized value
|
935
|
-
*/var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
|
936
|
-
var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
|
937
|
-
|
938
908
|
// if yes make them null instead of omitting in overloaded cases
|
939
909
|
/*
|
940
910
|
* Normalise the overloaded arguments of the page call facade
|
941
|
-
*/var pageArgumentsToCallOptions=function pageArgumentsToCallOptions(category,name,properties,options,callback){var
|
911
|
+
*/var pageArgumentsToCallOptions=function pageArgumentsToCallOptions(category,name,properties,options,callback){var payload={category:category,name:name,properties:properties,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.category=category;payload.name=name;payload.properties=properties;payload.options=undefined;payload.callback=options;}if(isFunction(properties)){payload.category=category;payload.name=name;payload.properties=undefined;payload.options=undefined;payload.callback=properties;}if(isFunction(name)){payload.category=category;payload.name=undefined;payload.properties=undefined;payload.options=undefined;payload.callback=name;}if(isFunction(category)){payload.category=undefined;payload.name=undefined;payload.properties=undefined;payload.options=undefined;payload.callback=category;}if(isObjectLiteralAndNotNull(category)){payload.name=undefined;payload.category=undefined;payload.properties=category;if(!isFunction(name)){payload.options=name;}else {payload.options=undefined;}}else if(isObjectLiteralAndNotNull(name)){payload.name=undefined;payload.properties=name;if(!isFunction(properties)){payload.options=properties;}else {payload.options=undefined;}}// if the category argument alone is provided b/w category and name,
|
942
912
|
// use it as name and set category to undefined
|
943
|
-
if(isString(
|
913
|
+
if(isString(category)&&!isString(name)){payload.category=undefined;payload.name=category;}// Rest of the code is just to clean up undefined values
|
944
914
|
// and set some proper defaults
|
945
915
|
// Also, to clone the incoming object type arguments
|
946
916
|
if(!isDefined(payload.category)){payload.category=undefined;}if(!isDefined(payload.name)){payload.name=undefined;}payload.properties=payload.properties?clone(payload.properties):{};if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}var nameForProperties=isString(payload.name)?payload.name:payload.properties.name;var categoryForProperties=isString(payload.category)?payload.category:payload.properties.category;// add name and category to properties
|
947
917
|
payload.properties=mergeDeepRight(isObjectLiteralAndNotNull(payload.properties)?payload.properties:{},_objectSpread2(_objectSpread2({},nameForProperties&&{name:nameForProperties}),categoryForProperties&&{category:categoryForProperties}));return payload;};/*
|
948
918
|
* Normalise the overloaded arguments of the track call facade
|
949
|
-
*/var trackArgumentsToCallOptions=function trackArgumentsToCallOptions(event,properties,options,callback){var
|
919
|
+
*/var trackArgumentsToCallOptions=function trackArgumentsToCallOptions(event,properties,options,callback){var payload={name:event,properties:properties,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.properties=properties;payload.options=undefined;payload.callback=options;}if(isFunction(properties)){payload.properties=undefined;payload.options=undefined;payload.callback=properties;}// Rest of the code is just to clean up undefined values
|
950
920
|
// and set some proper defaults
|
951
921
|
// Also, to clone the incoming object type arguments
|
952
922
|
payload.properties=isDefinedAndNotNull(payload.properties)?clone(payload.properties):{};if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};/*
|
953
923
|
* Normalise the overloaded arguments of the identify call facade
|
954
|
-
*/var identifyArgumentsToCallOptions=function identifyArgumentsToCallOptions(userId,traits,options,callback){var
|
924
|
+
*/var identifyArgumentsToCallOptions=function identifyArgumentsToCallOptions(userId,traits,options,callback){var payload={userId:userId,traits:traits,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.userId=userId;payload.traits=traits;payload.options=undefined;payload.callback=options;}if(isFunction(traits)){payload.userId=userId;payload.traits=undefined;payload.options=undefined;payload.callback=traits;}if(isObjectLiteralAndNotNull(userId)||isNull(userId)){// Explicitly set null to prevent resetting the existing value
|
955
925
|
// in the Analytics class
|
956
|
-
payload.userId=null;payload.traits=
|
926
|
+
payload.userId=null;payload.traits=userId;if(!isFunction(traits)){payload.options=traits;}else {payload.options=undefined;}}// Rest of the code is just to clean up undefined values
|
957
927
|
// and set some proper defaults
|
958
928
|
// Also, to clone the incoming object type arguments
|
959
929
|
payload.userId=tryStringify(payload.userId);if(isObjectLiteralAndNotNull(payload.traits)){payload.traits=clone(payload.traits);}else {payload.traits=undefined;}if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};/*
|
960
930
|
* Normalise the overloaded arguments of the alias call facade
|
961
|
-
*/var aliasArgumentsToCallOptions=function aliasArgumentsToCallOptions(to,from,options,callback){var
|
931
|
+
*/var aliasArgumentsToCallOptions=function aliasArgumentsToCallOptions(to,from,options,callback){var payload={to:to,from:from,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.to=to;payload.from=from;payload.options=undefined;payload.callback=options;}if(isFunction(from)){payload.to=to;payload.from=undefined;payload.options=undefined;payload.callback=from;}else if(isObjectLiteralAndNotNull(from)||isNull(from)){payload.to=to;payload.from=undefined;payload.options=from;}// Rest of the code is just to clean up undefined values
|
962
932
|
// and set some proper defaults
|
963
933
|
// Also, to clone the incoming object type arguments
|
964
934
|
if(isDefined(payload.to)){payload.to=tryStringify(payload.to);}if(isDefined(payload.from)){payload.from=tryStringify(payload.from);}else {payload.from=undefined;}if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};/*
|
965
935
|
* Normalise the overloaded arguments of the group call facade
|
966
|
-
*/var groupArgumentsToCallOptions=function groupArgumentsToCallOptions(groupId,traits,options,callback){var
|
936
|
+
*/var groupArgumentsToCallOptions=function groupArgumentsToCallOptions(groupId,traits,options,callback){var payload={groupId:groupId,traits:traits,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.groupId=groupId;payload.traits=traits;payload.options=undefined;payload.callback=options;}if(isFunction(traits)){payload.groupId=groupId;payload.traits=undefined;payload.options=undefined;payload.callback=traits;}if(isObjectLiteralAndNotNull(groupId)||isNull(groupId)){// Explicitly set null to prevent resetting the existing value
|
967
937
|
// in the Analytics class
|
968
|
-
payload.groupId=null;payload.traits=
|
938
|
+
payload.groupId=null;payload.traits=groupId;if(!isFunction(traits)){payload.options=traits;}else {payload.options=undefined;}}// Rest of the code is just to clean up undefined values
|
969
939
|
// and set some proper defaults
|
970
940
|
// Also, to clone the incoming object type arguments
|
971
941
|
payload.groupId=tryStringify(payload.groupId);if(isObjectLiteralAndNotNull(payload.traits)){payload.traits=clone(payload.traits);}else {payload.traits=undefined;}if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};
|
@@ -1013,6 +983,36 @@ var getFormattedTimestamp=function getFormattedTimestamp(date){return date.toISO
|
|
1013
983
|
* @returns ISO formatted timestamp string
|
1014
984
|
*/var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
|
1015
985
|
|
986
|
+
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.";
|
987
|
+
|
988
|
+
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
|
989
|
+
// eslint-disable-next-line func-names
|
990
|
+
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.
|
991
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
992
|
+
// @ts-ignore-next-line
|
993
|
+
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;};};/**
|
994
|
+
* Utility method for JSON stringify object excluding null values & circular references
|
995
|
+
*
|
996
|
+
* @param {*} value input
|
997
|
+
* @param {boolean} excludeNull if it should exclude nul or not
|
998
|
+
* @param {function} logger optional logger methods for warning
|
999
|
+
* @returns string
|
1000
|
+
*/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;}};var getReplacer=function getReplacer(logger){return(// Using a regular function to use `this` for the parent context
|
1001
|
+
function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
|
1002
|
+
}return value;});};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
|
1003
|
+
var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
|
1004
|
+
// eslint-disable-next-line no-restricted-syntax
|
1005
|
+
for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
|
1006
|
+
var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
|
1007
|
+
if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
|
1008
|
+
* Recursively traverses an object similar to JSON.stringify,
|
1009
|
+
* sanitizing BigInts and circular references
|
1010
|
+
* @param value Input object
|
1011
|
+
* @param logger Logger instance
|
1012
|
+
* @returns Sanitized value
|
1013
|
+
*/var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
|
1014
|
+
var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
|
1015
|
+
|
1016
1016
|
var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
1017
1017
|
* Get mutated error with issue prepended to error message
|
1018
1018
|
* @param err Original error
|
@@ -1020,7 +1020,7 @@ var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
|
1020
1020
|
* @returns Instance of Error with message prepended with issue
|
1021
1021
|
*/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}));};
|
1022
1022
|
|
1023
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.
|
1023
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.4';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';
|
1024
1024
|
|
1025
1025
|
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';
|
1026
1026
|
|
@@ -903,67 +903,37 @@ var trim=function trim(value){return value.replace(/^\s+|\s+$/gm,'');};var remov
|
|
903
903
|
* @returns decoded string
|
904
904
|
*/var fromBase64=function fromBase64(value){return new TextDecoder().decode(base64ToBytes(value));};
|
905
905
|
|
906
|
-
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.";
|
907
|
-
|
908
|
-
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
|
909
|
-
// eslint-disable-next-line func-names
|
910
|
-
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.
|
911
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
912
|
-
// @ts-ignore-next-line
|
913
|
-
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;};};/**
|
914
|
-
* Utility method for JSON stringify object excluding null values & circular references
|
915
|
-
*
|
916
|
-
* @param {*} value input
|
917
|
-
* @param {boolean} excludeNull if it should exclude nul or not
|
918
|
-
* @param {function} logger optional logger methods for warning
|
919
|
-
* @returns string
|
920
|
-
*/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;}};var getReplacer=function getReplacer(logger){return(// Using a regular function to use `this` for the parent context
|
921
|
-
function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
|
922
|
-
}return value;});};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
|
923
|
-
var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
|
924
|
-
// eslint-disable-next-line no-restricted-syntax
|
925
|
-
for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
|
926
|
-
var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
|
927
|
-
if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
|
928
|
-
* Recursively traverses an object similar to JSON.stringify,
|
929
|
-
* sanitizing BigInts and circular references
|
930
|
-
* @param value Input object
|
931
|
-
* @param logger Logger instance
|
932
|
-
* @returns Sanitized value
|
933
|
-
*/var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
|
934
|
-
var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
|
935
|
-
|
936
906
|
// if yes make them null instead of omitting in overloaded cases
|
937
907
|
/*
|
938
908
|
* Normalise the overloaded arguments of the page call facade
|
939
|
-
*/var pageArgumentsToCallOptions=function pageArgumentsToCallOptions(category,name,properties,options,callback){var
|
909
|
+
*/var pageArgumentsToCallOptions=function pageArgumentsToCallOptions(category,name,properties,options,callback){var payload={category:category,name:name,properties:properties,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.category=category;payload.name=name;payload.properties=properties;payload.options=undefined;payload.callback=options;}if(isFunction(properties)){payload.category=category;payload.name=name;payload.properties=undefined;payload.options=undefined;payload.callback=properties;}if(isFunction(name)){payload.category=category;payload.name=undefined;payload.properties=undefined;payload.options=undefined;payload.callback=name;}if(isFunction(category)){payload.category=undefined;payload.name=undefined;payload.properties=undefined;payload.options=undefined;payload.callback=category;}if(isObjectLiteralAndNotNull(category)){payload.name=undefined;payload.category=undefined;payload.properties=category;if(!isFunction(name)){payload.options=name;}else {payload.options=undefined;}}else if(isObjectLiteralAndNotNull(name)){payload.name=undefined;payload.properties=name;if(!isFunction(properties)){payload.options=properties;}else {payload.options=undefined;}}// if the category argument alone is provided b/w category and name,
|
940
910
|
// use it as name and set category to undefined
|
941
|
-
if(isString(
|
911
|
+
if(isString(category)&&!isString(name)){payload.category=undefined;payload.name=category;}// Rest of the code is just to clean up undefined values
|
942
912
|
// and set some proper defaults
|
943
913
|
// Also, to clone the incoming object type arguments
|
944
914
|
if(!isDefined(payload.category)){payload.category=undefined;}if(!isDefined(payload.name)){payload.name=undefined;}payload.properties=payload.properties?clone(payload.properties):{};if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}var nameForProperties=isString(payload.name)?payload.name:payload.properties.name;var categoryForProperties=isString(payload.category)?payload.category:payload.properties.category;// add name and category to properties
|
945
915
|
payload.properties=mergeDeepRight(isObjectLiteralAndNotNull(payload.properties)?payload.properties:{},_objectSpread2(_objectSpread2({},nameForProperties&&{name:nameForProperties}),categoryForProperties&&{category:categoryForProperties}));return payload;};/*
|
946
916
|
* Normalise the overloaded arguments of the track call facade
|
947
|
-
*/var trackArgumentsToCallOptions=function trackArgumentsToCallOptions(event,properties,options,callback){var
|
917
|
+
*/var trackArgumentsToCallOptions=function trackArgumentsToCallOptions(event,properties,options,callback){var payload={name:event,properties:properties,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.properties=properties;payload.options=undefined;payload.callback=options;}if(isFunction(properties)){payload.properties=undefined;payload.options=undefined;payload.callback=properties;}// Rest of the code is just to clean up undefined values
|
948
918
|
// and set some proper defaults
|
949
919
|
// Also, to clone the incoming object type arguments
|
950
920
|
payload.properties=isDefinedAndNotNull(payload.properties)?clone(payload.properties):{};if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};/*
|
951
921
|
* Normalise the overloaded arguments of the identify call facade
|
952
|
-
*/var identifyArgumentsToCallOptions=function identifyArgumentsToCallOptions(userId,traits,options,callback){var
|
922
|
+
*/var identifyArgumentsToCallOptions=function identifyArgumentsToCallOptions(userId,traits,options,callback){var payload={userId:userId,traits:traits,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.userId=userId;payload.traits=traits;payload.options=undefined;payload.callback=options;}if(isFunction(traits)){payload.userId=userId;payload.traits=undefined;payload.options=undefined;payload.callback=traits;}if(isObjectLiteralAndNotNull(userId)||isNull(userId)){// Explicitly set null to prevent resetting the existing value
|
953
923
|
// in the Analytics class
|
954
|
-
payload.userId=null;payload.traits=
|
924
|
+
payload.userId=null;payload.traits=userId;if(!isFunction(traits)){payload.options=traits;}else {payload.options=undefined;}}// Rest of the code is just to clean up undefined values
|
955
925
|
// and set some proper defaults
|
956
926
|
// Also, to clone the incoming object type arguments
|
957
927
|
payload.userId=tryStringify(payload.userId);if(isObjectLiteralAndNotNull(payload.traits)){payload.traits=clone(payload.traits);}else {payload.traits=undefined;}if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};/*
|
958
928
|
* Normalise the overloaded arguments of the alias call facade
|
959
|
-
*/var aliasArgumentsToCallOptions=function aliasArgumentsToCallOptions(to,from,options,callback){var
|
929
|
+
*/var aliasArgumentsToCallOptions=function aliasArgumentsToCallOptions(to,from,options,callback){var payload={to:to,from:from,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.to=to;payload.from=from;payload.options=undefined;payload.callback=options;}if(isFunction(from)){payload.to=to;payload.from=undefined;payload.options=undefined;payload.callback=from;}else if(isObjectLiteralAndNotNull(from)||isNull(from)){payload.to=to;payload.from=undefined;payload.options=from;}// Rest of the code is just to clean up undefined values
|
960
930
|
// and set some proper defaults
|
961
931
|
// Also, to clone the incoming object type arguments
|
962
932
|
if(isDefined(payload.to)){payload.to=tryStringify(payload.to);}if(isDefined(payload.from)){payload.from=tryStringify(payload.from);}else {payload.from=undefined;}if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};/*
|
963
933
|
* Normalise the overloaded arguments of the group call facade
|
964
|
-
*/var groupArgumentsToCallOptions=function groupArgumentsToCallOptions(groupId,traits,options,callback){var
|
934
|
+
*/var groupArgumentsToCallOptions=function groupArgumentsToCallOptions(groupId,traits,options,callback){var payload={groupId:groupId,traits:traits,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.groupId=groupId;payload.traits=traits;payload.options=undefined;payload.callback=options;}if(isFunction(traits)){payload.groupId=groupId;payload.traits=undefined;payload.options=undefined;payload.callback=traits;}if(isObjectLiteralAndNotNull(groupId)||isNull(groupId)){// Explicitly set null to prevent resetting the existing value
|
965
935
|
// in the Analytics class
|
966
|
-
payload.groupId=null;payload.traits=
|
936
|
+
payload.groupId=null;payload.traits=groupId;if(!isFunction(traits)){payload.options=traits;}else {payload.options=undefined;}}// Rest of the code is just to clean up undefined values
|
967
937
|
// and set some proper defaults
|
968
938
|
// Also, to clone the incoming object type arguments
|
969
939
|
payload.groupId=tryStringify(payload.groupId);if(isObjectLiteralAndNotNull(payload.traits)){payload.traits=clone(payload.traits);}else {payload.traits=undefined;}if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};
|
@@ -1011,6 +981,36 @@ var getFormattedTimestamp=function getFormattedTimestamp(date){return date.toISO
|
|
1011
981
|
* @returns ISO formatted timestamp string
|
1012
982
|
*/var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
|
1013
983
|
|
984
|
+
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.";
|
985
|
+
|
986
|
+
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
|
987
|
+
// eslint-disable-next-line func-names
|
988
|
+
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.
|
989
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
990
|
+
// @ts-ignore-next-line
|
991
|
+
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;};};/**
|
992
|
+
* Utility method for JSON stringify object excluding null values & circular references
|
993
|
+
*
|
994
|
+
* @param {*} value input
|
995
|
+
* @param {boolean} excludeNull if it should exclude nul or not
|
996
|
+
* @param {function} logger optional logger methods for warning
|
997
|
+
* @returns string
|
998
|
+
*/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;}};var getReplacer=function getReplacer(logger){return(// Using a regular function to use `this` for the parent context
|
999
|
+
function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
|
1000
|
+
}return value;});};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
|
1001
|
+
var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
|
1002
|
+
// eslint-disable-next-line no-restricted-syntax
|
1003
|
+
for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
|
1004
|
+
var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
|
1005
|
+
if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
|
1006
|
+
* Recursively traverses an object similar to JSON.stringify,
|
1007
|
+
* sanitizing BigInts and circular references
|
1008
|
+
* @param value Input object
|
1009
|
+
* @param logger Logger instance
|
1010
|
+
* @returns Sanitized value
|
1011
|
+
*/var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
|
1012
|
+
var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
|
1013
|
+
|
1014
1014
|
var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
1015
1015
|
* Get mutated error with issue prepended to error message
|
1016
1016
|
* @param err Original error
|
@@ -1018,7 +1018,7 @@ var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
|
1018
1018
|
* @returns Instance of Error with message prepended with issue
|
1019
1019
|
*/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}));};
|
1020
1020
|
|
1021
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.
|
1021
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.4';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';
|
1022
1022
|
|
1023
1023
|
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';
|
1024
1024
|
|
@@ -909,67 +909,37 @@
|
|
909
909
|
* @returns decoded string
|
910
910
|
*/var fromBase64=function fromBase64(value){return new TextDecoder().decode(base64ToBytes(value));};
|
911
911
|
|
912
|
-
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.";
|
913
|
-
|
914
|
-
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
|
915
|
-
// eslint-disable-next-line func-names
|
916
|
-
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.
|
917
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
918
|
-
// @ts-ignore-next-line
|
919
|
-
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;};};/**
|
920
|
-
* Utility method for JSON stringify object excluding null values & circular references
|
921
|
-
*
|
922
|
-
* @param {*} value input
|
923
|
-
* @param {boolean} excludeNull if it should exclude nul or not
|
924
|
-
* @param {function} logger optional logger methods for warning
|
925
|
-
* @returns string
|
926
|
-
*/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;}};var getReplacer=function getReplacer(logger){return(// Using a regular function to use `this` for the parent context
|
927
|
-
function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
|
928
|
-
}return value;});};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
|
929
|
-
var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
|
930
|
-
// eslint-disable-next-line no-restricted-syntax
|
931
|
-
for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
|
932
|
-
var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
|
933
|
-
if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
|
934
|
-
* Recursively traverses an object similar to JSON.stringify,
|
935
|
-
* sanitizing BigInts and circular references
|
936
|
-
* @param value Input object
|
937
|
-
* @param logger Logger instance
|
938
|
-
* @returns Sanitized value
|
939
|
-
*/var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
|
940
|
-
var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
|
941
|
-
|
942
912
|
// if yes make them null instead of omitting in overloaded cases
|
943
913
|
/*
|
944
914
|
* Normalise the overloaded arguments of the page call facade
|
945
|
-
*/var pageArgumentsToCallOptions=function pageArgumentsToCallOptions(category,name,properties,options,callback){var
|
915
|
+
*/var pageArgumentsToCallOptions=function pageArgumentsToCallOptions(category,name,properties,options,callback){var payload={category:category,name:name,properties:properties,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.category=category;payload.name=name;payload.properties=properties;payload.options=undefined;payload.callback=options;}if(isFunction(properties)){payload.category=category;payload.name=name;payload.properties=undefined;payload.options=undefined;payload.callback=properties;}if(isFunction(name)){payload.category=category;payload.name=undefined;payload.properties=undefined;payload.options=undefined;payload.callback=name;}if(isFunction(category)){payload.category=undefined;payload.name=undefined;payload.properties=undefined;payload.options=undefined;payload.callback=category;}if(isObjectLiteralAndNotNull(category)){payload.name=undefined;payload.category=undefined;payload.properties=category;if(!isFunction(name)){payload.options=name;}else {payload.options=undefined;}}else if(isObjectLiteralAndNotNull(name)){payload.name=undefined;payload.properties=name;if(!isFunction(properties)){payload.options=properties;}else {payload.options=undefined;}}// if the category argument alone is provided b/w category and name,
|
946
916
|
// use it as name and set category to undefined
|
947
|
-
if(isString(
|
917
|
+
if(isString(category)&&!isString(name)){payload.category=undefined;payload.name=category;}// Rest of the code is just to clean up undefined values
|
948
918
|
// and set some proper defaults
|
949
919
|
// Also, to clone the incoming object type arguments
|
950
920
|
if(!isDefined(payload.category)){payload.category=undefined;}if(!isDefined(payload.name)){payload.name=undefined;}payload.properties=payload.properties?clone(payload.properties):{};if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}var nameForProperties=isString(payload.name)?payload.name:payload.properties.name;var categoryForProperties=isString(payload.category)?payload.category:payload.properties.category;// add name and category to properties
|
951
921
|
payload.properties=mergeDeepRight(isObjectLiteralAndNotNull(payload.properties)?payload.properties:{},_objectSpread2(_objectSpread2({},nameForProperties&&{name:nameForProperties}),categoryForProperties&&{category:categoryForProperties}));return payload;};/*
|
952
922
|
* Normalise the overloaded arguments of the track call facade
|
953
|
-
*/var trackArgumentsToCallOptions=function trackArgumentsToCallOptions(event,properties,options,callback){var
|
923
|
+
*/var trackArgumentsToCallOptions=function trackArgumentsToCallOptions(event,properties,options,callback){var payload={name:event,properties:properties,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.properties=properties;payload.options=undefined;payload.callback=options;}if(isFunction(properties)){payload.properties=undefined;payload.options=undefined;payload.callback=properties;}// Rest of the code is just to clean up undefined values
|
954
924
|
// and set some proper defaults
|
955
925
|
// Also, to clone the incoming object type arguments
|
956
926
|
payload.properties=isDefinedAndNotNull(payload.properties)?clone(payload.properties):{};if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};/*
|
957
927
|
* Normalise the overloaded arguments of the identify call facade
|
958
|
-
*/var identifyArgumentsToCallOptions=function identifyArgumentsToCallOptions(userId,traits,options,callback){var
|
928
|
+
*/var identifyArgumentsToCallOptions=function identifyArgumentsToCallOptions(userId,traits,options,callback){var payload={userId:userId,traits:traits,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.userId=userId;payload.traits=traits;payload.options=undefined;payload.callback=options;}if(isFunction(traits)){payload.userId=userId;payload.traits=undefined;payload.options=undefined;payload.callback=traits;}if(isObjectLiteralAndNotNull(userId)||isNull(userId)){// Explicitly set null to prevent resetting the existing value
|
959
929
|
// in the Analytics class
|
960
|
-
payload.userId=null;payload.traits=
|
930
|
+
payload.userId=null;payload.traits=userId;if(!isFunction(traits)){payload.options=traits;}else {payload.options=undefined;}}// Rest of the code is just to clean up undefined values
|
961
931
|
// and set some proper defaults
|
962
932
|
// Also, to clone the incoming object type arguments
|
963
933
|
payload.userId=tryStringify(payload.userId);if(isObjectLiteralAndNotNull(payload.traits)){payload.traits=clone(payload.traits);}else {payload.traits=undefined;}if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};/*
|
964
934
|
* Normalise the overloaded arguments of the alias call facade
|
965
|
-
*/var aliasArgumentsToCallOptions=function aliasArgumentsToCallOptions(to,from,options,callback){var
|
935
|
+
*/var aliasArgumentsToCallOptions=function aliasArgumentsToCallOptions(to,from,options,callback){var payload={to:to,from:from,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.to=to;payload.from=from;payload.options=undefined;payload.callback=options;}if(isFunction(from)){payload.to=to;payload.from=undefined;payload.options=undefined;payload.callback=from;}else if(isObjectLiteralAndNotNull(from)||isNull(from)){payload.to=to;payload.from=undefined;payload.options=from;}// Rest of the code is just to clean up undefined values
|
966
936
|
// and set some proper defaults
|
967
937
|
// Also, to clone the incoming object type arguments
|
968
938
|
if(isDefined(payload.to)){payload.to=tryStringify(payload.to);}if(isDefined(payload.from)){payload.from=tryStringify(payload.from);}else {payload.from=undefined;}if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};/*
|
969
939
|
* Normalise the overloaded arguments of the group call facade
|
970
|
-
*/var groupArgumentsToCallOptions=function groupArgumentsToCallOptions(groupId,traits,options,callback){var
|
940
|
+
*/var groupArgumentsToCallOptions=function groupArgumentsToCallOptions(groupId,traits,options,callback){var payload={groupId:groupId,traits:traits,options:options,callback:undefined};if(isFunction(callback)){payload.callback=callback;}if(isFunction(options)){payload.groupId=groupId;payload.traits=traits;payload.options=undefined;payload.callback=options;}if(isFunction(traits)){payload.groupId=groupId;payload.traits=undefined;payload.options=undefined;payload.callback=traits;}if(isObjectLiteralAndNotNull(groupId)||isNull(groupId)){// Explicitly set null to prevent resetting the existing value
|
971
941
|
// in the Analytics class
|
972
|
-
payload.groupId=null;payload.traits=
|
942
|
+
payload.groupId=null;payload.traits=groupId;if(!isFunction(traits)){payload.options=traits;}else {payload.options=undefined;}}// Rest of the code is just to clean up undefined values
|
973
943
|
// and set some proper defaults
|
974
944
|
// Also, to clone the incoming object type arguments
|
975
945
|
payload.groupId=tryStringify(payload.groupId);if(isObjectLiteralAndNotNull(payload.traits)){payload.traits=clone(payload.traits);}else {payload.traits=undefined;}if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};
|
@@ -1017,6 +987,36 @@
|
|
1017
987
|
* @returns ISO formatted timestamp string
|
1018
988
|
*/var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
|
1019
989
|
|
990
|
+
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.";
|
991
|
+
|
992
|
+
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
|
993
|
+
// eslint-disable-next-line func-names
|
994
|
+
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.
|
995
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
996
|
+
// @ts-ignore-next-line
|
997
|
+
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;};};/**
|
998
|
+
* Utility method for JSON stringify object excluding null values & circular references
|
999
|
+
*
|
1000
|
+
* @param {*} value input
|
1001
|
+
* @param {boolean} excludeNull if it should exclude nul or not
|
1002
|
+
* @param {function} logger optional logger methods for warning
|
1003
|
+
* @returns string
|
1004
|
+
*/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;}};var getReplacer=function getReplacer(logger){return(// Using a regular function to use `this` for the parent context
|
1005
|
+
function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
|
1006
|
+
}return value;});};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
|
1007
|
+
var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
|
1008
|
+
// eslint-disable-next-line no-restricted-syntax
|
1009
|
+
for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
|
1010
|
+
var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
|
1011
|
+
if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
|
1012
|
+
* Recursively traverses an object similar to JSON.stringify,
|
1013
|
+
* sanitizing BigInts and circular references
|
1014
|
+
* @param value Input object
|
1015
|
+
* @param logger Logger instance
|
1016
|
+
* @returns Sanitized value
|
1017
|
+
*/var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
|
1018
|
+
var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
|
1019
|
+
|
1020
1020
|
var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
1021
1021
|
* Get mutated error with issue prepended to error message
|
1022
1022
|
* @param err Original error
|
@@ -1024,7 +1024,7 @@
|
|
1024
1024
|
* @returns Instance of Error with message prepended with issue
|
1025
1025
|
*/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}));};
|
1026
1026
|
|
1027
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.
|
1027
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.4';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
1028
|
|
1029
1029
|
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';
|
1030
1030
|
|