@rudderstack/analytics-js 3.11.0 → 3.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/npm/legacy/bundled/cjs/index.cjs +50 -50
- package/dist/npm/legacy/bundled/esm/index.mjs +50 -50
- package/dist/npm/legacy/bundled/umd/index.js +50 -50
- package/dist/npm/legacy/cjs/index.cjs +50 -50
- package/dist/npm/legacy/content-script/cjs/index.cjs +49 -49
- package/dist/npm/legacy/content-script/esm/index.mjs +49 -49
- package/dist/npm/legacy/content-script/umd/index.js +49 -49
- package/dist/npm/legacy/esm/index.mjs +50 -50
- package/dist/npm/legacy/umd/index.js +50 -50
- package/dist/npm/modern/bundled/cjs/index.cjs +50 -50
- package/dist/npm/modern/bundled/esm/index.mjs +50 -50
- package/dist/npm/modern/bundled/umd/index.js +50 -50
- package/dist/npm/modern/cjs/index.cjs +48 -48
- package/dist/npm/modern/content-script/cjs/index.cjs +49 -49
- package/dist/npm/modern/content-script/esm/index.mjs +49 -49
- package/dist/npm/modern/content-script/umd/index.js +49 -49
- package/dist/npm/modern/esm/index.mjs +48 -48
- package/dist/npm/modern/umd/index.js +48 -48
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [3.11.2](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.11.1...@rudderstack/analytics-js@3.11.2) (2024-11-21)
|
6
|
+
|
7
|
+
### Dependency Updates
|
8
|
+
|
9
|
+
* `@rudderstack/analytics-js-plugins` updated to version `3.6.4`
|
10
|
+
## [3.11.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.11.0...@rudderstack/analytics-js@3.11.1) (2024-11-19)
|
11
|
+
|
12
|
+
### Dependency Updates
|
13
|
+
|
14
|
+
* `@rudderstack/analytics-js-cookies` updated to version `0.4.4`
|
15
|
+
* `@rudderstack/analytics-js-common` updated to version `3.14.1`
|
16
|
+
* `@rudderstack/analytics-js-plugins` updated to version `3.6.4`
|
5
17
|
## [3.11.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.10.2...@rudderstack/analytics-js@3.11.0) (2024-11-18)
|
6
18
|
|
7
19
|
### Dependency Updates
|
@@ -905,74 +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){var ancestors=[];// Array to track ancestor objects
|
923
|
-
// Using a regular function to use `this` for the parent context
|
924
|
-
return function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
|
925
|
-
}// `this` is the object that value is contained in, i.e., its direct parent.
|
926
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
927
|
-
// @ts-ignore-next-line
|
928
|
-
while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();// Remove ancestors that are no longer part of the chain
|
929
|
-
}// Check for circular references (if the value is already in the ancestors)
|
930
|
-
if(ancestors.includes(value)){return '[Circular Reference]';}// Add current value to ancestors
|
931
|
-
ancestors.push(value);return value;};};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
|
932
|
-
var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
|
933
|
-
// eslint-disable-next-line no-restricted-syntax
|
934
|
-
for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
|
935
|
-
var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
|
936
|
-
if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
|
937
|
-
* Recursively traverses an object similar to JSON.stringify,
|
938
|
-
* sanitizing BigInts and circular references
|
939
|
-
* @param value Input object
|
940
|
-
* @param logger Logger instance
|
941
|
-
* @returns Sanitized value
|
942
|
-
*/var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
|
943
|
-
var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
|
944
|
-
|
945
908
|
// if yes make them null instead of omitting in overloaded cases
|
946
909
|
/*
|
947
910
|
* Normalise the overloaded arguments of the page call facade
|
948
|
-
*/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,
|
949
912
|
// use it as name and set category to undefined
|
950
|
-
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
|
951
914
|
// and set some proper defaults
|
952
915
|
// Also, to clone the incoming object type arguments
|
953
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
|
954
917
|
payload.properties=mergeDeepRight(isObjectLiteralAndNotNull(payload.properties)?payload.properties:{},_objectSpread2(_objectSpread2({},nameForProperties&&{name:nameForProperties}),categoryForProperties&&{category:categoryForProperties}));return payload;};/*
|
955
918
|
* Normalise the overloaded arguments of the track call facade
|
956
|
-
*/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
|
957
920
|
// and set some proper defaults
|
958
921
|
// Also, to clone the incoming object type arguments
|
959
922
|
payload.properties=isDefinedAndNotNull(payload.properties)?clone(payload.properties):{};if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};/*
|
960
923
|
* Normalise the overloaded arguments of the identify call facade
|
961
|
-
*/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
|
962
925
|
// in the Analytics class
|
963
|
-
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
|
964
927
|
// and set some proper defaults
|
965
928
|
// Also, to clone the incoming object type arguments
|
966
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;};/*
|
967
930
|
* Normalise the overloaded arguments of the alias call facade
|
968
|
-
*/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
|
969
932
|
// and set some proper defaults
|
970
933
|
// Also, to clone the incoming object type arguments
|
971
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;};/*
|
972
935
|
* Normalise the overloaded arguments of the group call facade
|
973
|
-
*/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
|
974
937
|
// in the Analytics class
|
975
|
-
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
|
976
939
|
// and set some proper defaults
|
977
940
|
// Also, to clone the incoming object type arguments
|
978
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;};
|
@@ -1020,6 +983,43 @@ var getFormattedTimestamp=function getFormattedTimestamp(date){return date.toISO
|
|
1020
983
|
* @returns ISO formatted timestamp string
|
1021
984
|
*/var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
|
1022
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){var ancestors=[];// Array to track ancestor objects
|
1001
|
+
// Using a regular function to use `this` for the parent context
|
1002
|
+
return function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
|
1003
|
+
}// `this` is the object that value is contained in, i.e., its direct parent.
|
1004
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
1005
|
+
// @ts-ignore-next-line
|
1006
|
+
while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();// Remove ancestors that are no longer part of the chain
|
1007
|
+
}// Check for circular references (if the value is already in the ancestors)
|
1008
|
+
if(ancestors.includes(value)){return '[Circular Reference]';}// Add current value to ancestors
|
1009
|
+
ancestors.push(value);return value;};};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
|
1010
|
+
var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
|
1011
|
+
// eslint-disable-next-line no-restricted-syntax
|
1012
|
+
for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
|
1013
|
+
var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
|
1014
|
+
if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
|
1015
|
+
* Recursively traverses an object similar to JSON.stringify,
|
1016
|
+
* sanitizing BigInts and circular references
|
1017
|
+
* @param value Input object
|
1018
|
+
* @param logger Logger instance
|
1019
|
+
* @returns Sanitized value
|
1020
|
+
*/var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
|
1021
|
+
var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
|
1022
|
+
|
1023
1023
|
var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
1024
1024
|
* Get mutated error with issue prepended to error message
|
1025
1025
|
* @param err Original error
|
@@ -1027,7 +1027,7 @@ var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
|
1027
1027
|
* @returns Instance of Error with message prepended with issue
|
1028
1028
|
*/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}));};
|
1029
1029
|
|
1030
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.
|
1030
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.2';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';
|
1031
1031
|
|
1032
1032
|
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';
|
1033
1033
|
|
@@ -1472,7 +1472,7 @@ var SDK_FILE_NAME_PREFIXES$1=function SDK_FILE_NAME_PREFIXES(){return ['rsa'// P
|
|
1472
1472
|
// Potential PII or sensitive data
|
1473
1473
|
var APP_STATE_EXCLUDE_KEYS$1=['userId','userTraits','groupId','groupTraits','anonymousId','config','instance',// destination instance objects
|
1474
1474
|
'eventBuffer',// pre-load event buffer (may contain PII)
|
1475
|
-
'traits'];var BUGSNAG_PLUGIN='BugsnagPlugin';
|
1475
|
+
'traits','authToken'];var BUGSNAG_PLUGIN='BugsnagPlugin';
|
1476
1476
|
|
1477
1477
|
var isValidVersion=function isValidVersion(globalLibInstance){var _globalLibInstance$_c;// For version 7
|
1478
1478
|
// eslint-disable-next-line no-underscore-dangle
|
@@ -1738,7 +1738,7 @@ var SDK_FILE_NAME_PREFIXES=function SDK_FILE_NAME_PREFIXES(){return ['rsa'// Pre
|
|
1738
1738
|
// Potential PII or sensitive data
|
1739
1739
|
var APP_STATE_EXCLUDE_KEYS=['userId','userTraits','groupId','groupTraits','anonymousId','config','instance',// destination instance objects
|
1740
1740
|
'eventBuffer',// pre-load event buffer (may contain PII)
|
1741
|
-
'traits'];var REQUEST_TIMEOUT_MS$1=10*1000;// 10 seconds
|
1741
|
+
'traits','authToken'];var REQUEST_TIMEOUT_MS$1=10*1000;// 10 seconds
|
1742
1742
|
var NOTIFIER_NAME='RudderStack JavaScript SDK Error Notifier';var SDK_GITHUB_URL='https://github.com/rudderlabs/rudder-sdk-js';var SOURCE_NAME='js';var ERROR_REPORTING_PLUGIN='ErrorReportingPlugin';
|
1743
1743
|
|
1744
1744
|
var getConfigForPayloadCreation=function getConfigForPayloadCreation(err,errorType){switch(errorType){case ErrorType.UNHANDLEDEXCEPTION:{var _ref=err,error=_ref.error;return {component:'unhandledException handler',normalizedError:error||err};}case ErrorType.UNHANDLEDREJECTION:{var _error=err;return {component:'unhandledrejection handler',normalizedError:_error.reason};}case ErrorType.HANDLEDEXCEPTION:default:return {component:'notify()',normalizedError:err};}};var createNewBreadcrumb=function createNewBreadcrumb(message,metaData){return {type:'manual',name:message,timestamp:new Date(),metaData:metaData!==null&&metaData!==void 0?metaData:{}};};var getReleaseStage=function getReleaseStage(){var host=globalThis.location.hostname;return host&&DEV_HOSTS.includes(host)?'development':'production';};var getAppStateForMetadata=function getAppStateForMetadata(state){var stateStr=stringifyWithoutCircular(state,false,APP_STATE_EXCLUDE_KEYS);return stateStr!==null?JSON.parse(stateStr):{};};var getURLWithoutQueryString=function getURLWithoutQueryString(){var url=globalThis.location.href.split('?');return url[0];};var getErrorContext=function getErrorContext(event){var message=event.message;var context=message;// Hack for easily grouping the script load errors
|
@@ -3754,7 +3754,7 @@ USER_SESSION_KEYS.forEach(function(sessionKey){E(function(){_this6.syncValueToSt
|
|
3754
3754
|
* 2. rudderAmpLinkerParam: value generated from linker query parm (rudderstack)
|
3755
3755
|
* using parseLinker util.
|
3756
3756
|
* 3. generateUUID: A new unique id is generated and assigned.
|
3757
|
-
*/},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){var finalAnonymousId=anonymousId;if(this.isPersistenceEnabledForStorageEntry('anonymousId')){if(!finalAnonymousId&&rudderAmpLinkerParam){var _this$pluginsManager;var linkerPluginsResult=(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0?void 0:_this$pluginsManager.invokeSingle('userSession.anonymousIdGoogleLinker',rudderAmpLinkerParam);finalAnonymousId=linkerPluginsResult;}finalAnonymousId=finalAnonymousId||generateAnonymousId();}else {finalAnonymousId=DEFAULT_USER_SESSION_VALUES.anonymousId;}state.session.anonymousId.value=finalAnonymousId;}/**
|
3757
|
+
*/},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){var finalAnonymousId=anonymousId;if(!isString(anonymousId)||!finalAnonymousId){finalAnonymousId=undefined;}if(this.isPersistenceEnabledForStorageEntry('anonymousId')){if(!finalAnonymousId&&rudderAmpLinkerParam){var _this$pluginsManager;var linkerPluginsResult=(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0?void 0:_this$pluginsManager.invokeSingle('userSession.anonymousIdGoogleLinker',rudderAmpLinkerParam);finalAnonymousId=linkerPluginsResult;}finalAnonymousId=finalAnonymousId||generateAnonymousId();}else {finalAnonymousId=DEFAULT_USER_SESSION_VALUES.anonymousId;}state.session.anonymousId.value=finalAnonymousId;}/**
|
3758
3758
|
* Fetches anonymousId
|
3759
3759
|
* @param options option to fetch it from external source
|
3760
3760
|
* @returns anonymousId
|
@@ -3805,7 +3805,7 @@ this.syncValueToStorage('sessionInfo',sessionInfo);}}/**
|
|
3805
3805
|
* @param resetAnonymousId
|
3806
3806
|
* @param noNewSessionStart
|
3807
3807
|
* @returns
|
3808
|
-
*/},{key:"reset",value:function reset(resetAnonymousId,noNewSessionStart){var _this7=this;var session=state.session;var _session$sessionInfo$=session.sessionInfo.value,manualTrack=_session$sessionInfo$.manualTrack,autoTrack=_session$sessionInfo$.autoTrack;r(function(){session.userId.value=DEFAULT_USER_SESSION_VALUES.userId;session.userTraits.value=DEFAULT_USER_SESSION_VALUES.userTraits;session.groupId.value=DEFAULT_USER_SESSION_VALUES.groupId;session.groupTraits.value=DEFAULT_USER_SESSION_VALUES.groupTraits;session.authToken.value=DEFAULT_USER_SESSION_VALUES.authToken;if(resetAnonymousId){// This will generate a new anonymous ID
|
3808
|
+
*/},{key:"reset",value:function reset(resetAnonymousId,noNewSessionStart){var _this7=this;var session=state.session;var _session$sessionInfo$=session.sessionInfo.value,manualTrack=_session$sessionInfo$.manualTrack,autoTrack=_session$sessionInfo$.autoTrack;r(function(){session.userId.value=DEFAULT_USER_SESSION_VALUES.userId;session.userTraits.value=DEFAULT_USER_SESSION_VALUES.userTraits;session.groupId.value=DEFAULT_USER_SESSION_VALUES.groupId;session.groupTraits.value=DEFAULT_USER_SESSION_VALUES.groupTraits;session.authToken.value=DEFAULT_USER_SESSION_VALUES.authToken;if(resetAnonymousId===true){// This will generate a new anonymous ID
|
3809
3809
|
_this7.setAnonymousId();}if(noNewSessionStart){return;}if(autoTrack){session.sessionInfo.value=DEFAULT_USER_SESSION_VALUES.sessionInfo;_this7.startOrRenewAutoTracking(session.sessionInfo.value);}else if(manualTrack){_this7.startManualTrackingInternal();}});}/**
|
3810
3810
|
* Set user Id
|
3811
3811
|
* @param userId
|
@@ -903,74 +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){var ancestors=[];// Array to track ancestor objects
|
921
|
-
// Using a regular function to use `this` for the parent context
|
922
|
-
return function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
|
923
|
-
}// `this` is the object that value is contained in, i.e., its direct parent.
|
924
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
925
|
-
// @ts-ignore-next-line
|
926
|
-
while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();// Remove ancestors that are no longer part of the chain
|
927
|
-
}// Check for circular references (if the value is already in the ancestors)
|
928
|
-
if(ancestors.includes(value)){return '[Circular Reference]';}// Add current value to ancestors
|
929
|
-
ancestors.push(value);return value;};};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
|
930
|
-
var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
|
931
|
-
// eslint-disable-next-line no-restricted-syntax
|
932
|
-
for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
|
933
|
-
var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
|
934
|
-
if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
|
935
|
-
* Recursively traverses an object similar to JSON.stringify,
|
936
|
-
* sanitizing BigInts and circular references
|
937
|
-
* @param value Input object
|
938
|
-
* @param logger Logger instance
|
939
|
-
* @returns Sanitized value
|
940
|
-
*/var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
|
941
|
-
var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
|
942
|
-
|
943
906
|
// if yes make them null instead of omitting in overloaded cases
|
944
907
|
/*
|
945
908
|
* Normalise the overloaded arguments of the page call facade
|
946
|
-
*/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,
|
947
910
|
// use it as name and set category to undefined
|
948
|
-
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
|
949
912
|
// and set some proper defaults
|
950
913
|
// Also, to clone the incoming object type arguments
|
951
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
|
952
915
|
payload.properties=mergeDeepRight(isObjectLiteralAndNotNull(payload.properties)?payload.properties:{},_objectSpread2(_objectSpread2({},nameForProperties&&{name:nameForProperties}),categoryForProperties&&{category:categoryForProperties}));return payload;};/*
|
953
916
|
* Normalise the overloaded arguments of the track call facade
|
954
|
-
*/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
|
955
918
|
// and set some proper defaults
|
956
919
|
// Also, to clone the incoming object type arguments
|
957
920
|
payload.properties=isDefinedAndNotNull(payload.properties)?clone(payload.properties):{};if(isDefined(payload.options)){payload.options=clone(payload.options);}else {payload.options=undefined;}return payload;};/*
|
958
921
|
* Normalise the overloaded arguments of the identify call facade
|
959
|
-
*/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
|
960
923
|
// in the Analytics class
|
961
|
-
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
|
962
925
|
// and set some proper defaults
|
963
926
|
// Also, to clone the incoming object type arguments
|
964
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;};/*
|
965
928
|
* Normalise the overloaded arguments of the alias call facade
|
966
|
-
*/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
|
967
930
|
// and set some proper defaults
|
968
931
|
// Also, to clone the incoming object type arguments
|
969
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;};/*
|
970
933
|
* Normalise the overloaded arguments of the group call facade
|
971
|
-
*/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
|
972
935
|
// in the Analytics class
|
973
|
-
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
|
974
937
|
// and set some proper defaults
|
975
938
|
// Also, to clone the incoming object type arguments
|
976
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;};
|
@@ -1018,6 +981,43 @@ var getFormattedTimestamp=function getFormattedTimestamp(date){return date.toISO
|
|
1018
981
|
* @returns ISO formatted timestamp string
|
1019
982
|
*/var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
|
1020
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){var ancestors=[];// Array to track ancestor objects
|
999
|
+
// Using a regular function to use `this` for the parent context
|
1000
|
+
return function replacer(key,value){if(isBigInt(value)){return '[BigInt]';// Replace BigInt values
|
1001
|
+
}// `this` is the object that value is contained in, i.e., its direct parent.
|
1002
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
1003
|
+
// @ts-ignore-next-line
|
1004
|
+
while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();// Remove ancestors that are no longer part of the chain
|
1005
|
+
}// Check for circular references (if the value is already in the ancestors)
|
1006
|
+
if(ancestors.includes(value)){return '[Circular Reference]';}// Add current value to ancestors
|
1007
|
+
ancestors.push(value);return value;};};var _traverseWithThis=function traverseWithThis(obj,replacer){// Create a new result object or array
|
1008
|
+
var result=Array.isArray(obj)?[]:{};// Traverse object properties or array elements
|
1009
|
+
// eslint-disable-next-line no-restricted-syntax
|
1010
|
+
for(var key in obj){if(Object.hasOwnProperty.call(obj,key)){var value=obj[key];// Recursively apply the replacer and traversal
|
1011
|
+
var sanitizedValue=replacer.call(obj,key,value);// If the value is an object or array, continue traversal
|
1012
|
+
if(isObjectLiteralAndNotNull(sanitizedValue)||Array.isArray(sanitizedValue)){result[key]=_traverseWithThis(sanitizedValue,replacer);}else {result[key]=sanitizedValue;}}}return result;};/**
|
1013
|
+
* Recursively traverses an object similar to JSON.stringify,
|
1014
|
+
* sanitizing BigInts and circular references
|
1015
|
+
* @param value Input object
|
1016
|
+
* @param logger Logger instance
|
1017
|
+
* @returns Sanitized value
|
1018
|
+
*/var getSanitizedValue=function getSanitizedValue(value,logger){var replacer=getReplacer();// This is needed for registering the first ancestor
|
1019
|
+
var newValue=replacer.call(value,'',value);if(isObjectLiteralAndNotNull(value)||Array.isArray(value)){return _traverseWithThis(value,replacer);}return newValue;};
|
1020
|
+
|
1021
1021
|
var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
1022
1022
|
* Get mutated error with issue prepended to error message
|
1023
1023
|
* @param err Original error
|
@@ -1025,7 +1025,7 @@ var MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
|
1025
1025
|
* @returns Instance of Error with message prepended with issue
|
1026
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}));};
|
1027
1027
|
|
1028
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.
|
1028
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.2';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';
|
1029
1029
|
|
1030
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';
|
1031
1031
|
|
@@ -1470,7 +1470,7 @@ var SDK_FILE_NAME_PREFIXES$1=function SDK_FILE_NAME_PREFIXES(){return ['rsa'// P
|
|
1470
1470
|
// Potential PII or sensitive data
|
1471
1471
|
var APP_STATE_EXCLUDE_KEYS$1=['userId','userTraits','groupId','groupTraits','anonymousId','config','instance',// destination instance objects
|
1472
1472
|
'eventBuffer',// pre-load event buffer (may contain PII)
|
1473
|
-
'traits'];var BUGSNAG_PLUGIN='BugsnagPlugin';
|
1473
|
+
'traits','authToken'];var BUGSNAG_PLUGIN='BugsnagPlugin';
|
1474
1474
|
|
1475
1475
|
var isValidVersion=function isValidVersion(globalLibInstance){var _globalLibInstance$_c;// For version 7
|
1476
1476
|
// eslint-disable-next-line no-underscore-dangle
|
@@ -1736,7 +1736,7 @@ var SDK_FILE_NAME_PREFIXES=function SDK_FILE_NAME_PREFIXES(){return ['rsa'// Pre
|
|
1736
1736
|
// Potential PII or sensitive data
|
1737
1737
|
var APP_STATE_EXCLUDE_KEYS=['userId','userTraits','groupId','groupTraits','anonymousId','config','instance',// destination instance objects
|
1738
1738
|
'eventBuffer',// pre-load event buffer (may contain PII)
|
1739
|
-
'traits'];var REQUEST_TIMEOUT_MS$1=10*1000;// 10 seconds
|
1739
|
+
'traits','authToken'];var REQUEST_TIMEOUT_MS$1=10*1000;// 10 seconds
|
1740
1740
|
var NOTIFIER_NAME='RudderStack JavaScript SDK Error Notifier';var SDK_GITHUB_URL='https://github.com/rudderlabs/rudder-sdk-js';var SOURCE_NAME='js';var ERROR_REPORTING_PLUGIN='ErrorReportingPlugin';
|
1741
1741
|
|
1742
1742
|
var getConfigForPayloadCreation=function getConfigForPayloadCreation(err,errorType){switch(errorType){case ErrorType.UNHANDLEDEXCEPTION:{var _ref=err,error=_ref.error;return {component:'unhandledException handler',normalizedError:error||err};}case ErrorType.UNHANDLEDREJECTION:{var _error=err;return {component:'unhandledrejection handler',normalizedError:_error.reason};}case ErrorType.HANDLEDEXCEPTION:default:return {component:'notify()',normalizedError:err};}};var createNewBreadcrumb=function createNewBreadcrumb(message,metaData){return {type:'manual',name:message,timestamp:new Date(),metaData:metaData!==null&&metaData!==void 0?metaData:{}};};var getReleaseStage=function getReleaseStage(){var host=globalThis.location.hostname;return host&&DEV_HOSTS.includes(host)?'development':'production';};var getAppStateForMetadata=function getAppStateForMetadata(state){var stateStr=stringifyWithoutCircular(state,false,APP_STATE_EXCLUDE_KEYS);return stateStr!==null?JSON.parse(stateStr):{};};var getURLWithoutQueryString=function getURLWithoutQueryString(){var url=globalThis.location.href.split('?');return url[0];};var getErrorContext=function getErrorContext(event){var message=event.message;var context=message;// Hack for easily grouping the script load errors
|
@@ -3752,7 +3752,7 @@ USER_SESSION_KEYS.forEach(function(sessionKey){E(function(){_this6.syncValueToSt
|
|
3752
3752
|
* 2. rudderAmpLinkerParam: value generated from linker query parm (rudderstack)
|
3753
3753
|
* using parseLinker util.
|
3754
3754
|
* 3. generateUUID: A new unique id is generated and assigned.
|
3755
|
-
*/},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){var finalAnonymousId=anonymousId;if(this.isPersistenceEnabledForStorageEntry('anonymousId')){if(!finalAnonymousId&&rudderAmpLinkerParam){var _this$pluginsManager;var linkerPluginsResult=(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0?void 0:_this$pluginsManager.invokeSingle('userSession.anonymousIdGoogleLinker',rudderAmpLinkerParam);finalAnonymousId=linkerPluginsResult;}finalAnonymousId=finalAnonymousId||generateAnonymousId();}else {finalAnonymousId=DEFAULT_USER_SESSION_VALUES.anonymousId;}state.session.anonymousId.value=finalAnonymousId;}/**
|
3755
|
+
*/},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){var finalAnonymousId=anonymousId;if(!isString(anonymousId)||!finalAnonymousId){finalAnonymousId=undefined;}if(this.isPersistenceEnabledForStorageEntry('anonymousId')){if(!finalAnonymousId&&rudderAmpLinkerParam){var _this$pluginsManager;var linkerPluginsResult=(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0?void 0:_this$pluginsManager.invokeSingle('userSession.anonymousIdGoogleLinker',rudderAmpLinkerParam);finalAnonymousId=linkerPluginsResult;}finalAnonymousId=finalAnonymousId||generateAnonymousId();}else {finalAnonymousId=DEFAULT_USER_SESSION_VALUES.anonymousId;}state.session.anonymousId.value=finalAnonymousId;}/**
|
3756
3756
|
* Fetches anonymousId
|
3757
3757
|
* @param options option to fetch it from external source
|
3758
3758
|
* @returns anonymousId
|
@@ -3803,7 +3803,7 @@ this.syncValueToStorage('sessionInfo',sessionInfo);}}/**
|
|
3803
3803
|
* @param resetAnonymousId
|
3804
3804
|
* @param noNewSessionStart
|
3805
3805
|
* @returns
|
3806
|
-
*/},{key:"reset",value:function reset(resetAnonymousId,noNewSessionStart){var _this7=this;var session=state.session;var _session$sessionInfo$=session.sessionInfo.value,manualTrack=_session$sessionInfo$.manualTrack,autoTrack=_session$sessionInfo$.autoTrack;r(function(){session.userId.value=DEFAULT_USER_SESSION_VALUES.userId;session.userTraits.value=DEFAULT_USER_SESSION_VALUES.userTraits;session.groupId.value=DEFAULT_USER_SESSION_VALUES.groupId;session.groupTraits.value=DEFAULT_USER_SESSION_VALUES.groupTraits;session.authToken.value=DEFAULT_USER_SESSION_VALUES.authToken;if(resetAnonymousId){// This will generate a new anonymous ID
|
3806
|
+
*/},{key:"reset",value:function reset(resetAnonymousId,noNewSessionStart){var _this7=this;var session=state.session;var _session$sessionInfo$=session.sessionInfo.value,manualTrack=_session$sessionInfo$.manualTrack,autoTrack=_session$sessionInfo$.autoTrack;r(function(){session.userId.value=DEFAULT_USER_SESSION_VALUES.userId;session.userTraits.value=DEFAULT_USER_SESSION_VALUES.userTraits;session.groupId.value=DEFAULT_USER_SESSION_VALUES.groupId;session.groupTraits.value=DEFAULT_USER_SESSION_VALUES.groupTraits;session.authToken.value=DEFAULT_USER_SESSION_VALUES.authToken;if(resetAnonymousId===true){// This will generate a new anonymous ID
|
3807
3807
|
_this7.setAnonymousId();}if(noNewSessionStart){return;}if(autoTrack){session.sessionInfo.value=DEFAULT_USER_SESSION_VALUES.sessionInfo;_this7.startOrRenewAutoTracking(session.sessionInfo.value);}else if(manualTrack){_this7.startManualTrackingInternal();}});}/**
|
3808
3808
|
* Set user Id
|
3809
3809
|
* @param userId
|