@rudderstack/analytics-js 3.11.14 → 3.11.16
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +20 -0
- package/dist/npm/index.d.cts +1 -1
- package/dist/npm/index.d.mts +1 -1
- package/dist/npm/legacy/bundled/cjs/index.cjs +10 -10
- package/dist/npm/legacy/bundled/esm/index.mjs +10 -10
- package/dist/npm/legacy/bundled/umd/index.js +10 -10
- package/dist/npm/legacy/cjs/index.cjs +10 -10
- package/dist/npm/legacy/content-script/cjs/index.cjs +7 -8
- package/dist/npm/legacy/content-script/esm/index.mjs +7 -8
- package/dist/npm/legacy/content-script/umd/index.js +7 -8
- package/dist/npm/legacy/esm/index.mjs +10 -10
- package/dist/npm/legacy/umd/index.js +10 -10
- package/dist/npm/modern/bundled/cjs/index.cjs +8 -8
- package/dist/npm/modern/bundled/esm/index.mjs +8 -8
- package/dist/npm/modern/bundled/umd/index.js +8 -8
- package/dist/npm/modern/cjs/index.cjs +2 -4
- package/dist/npm/modern/content-script/cjs/index.cjs +6 -7
- package/dist/npm/modern/content-script/esm/index.mjs +6 -7
- package/dist/npm/modern/content-script/umd/index.js +6 -7
- package/dist/npm/modern/esm/index.mjs +2 -4
- package/dist/npm/modern/umd/index.js +2 -4
- package/package.json +1 -1
@@ -981,7 +981,7 @@ var getFormattedTimestamp=function getFormattedTimestamp(date){return date.toISO
|
|
981
981
|
* @returns ISO formatted timestamp string
|
982
982
|
*/var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
|
983
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.";
|
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.";var COOKIE_DATA_ENCODING_ERROR="Failed to encode the cookie data.";
|
985
985
|
|
986
986
|
var JSON_STRINGIFY='JSONStringify';var BIG_INT_PLACEHOLDER='[BigInt]';var CIRCULAR_REFERENCE_PLACEHOLDER='[Circular Reference]';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
987
|
// eslint-disable-next-line func-names
|
@@ -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.16';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
|
|
@@ -1276,10 +1276,6 @@ new URL(url);}return URL_PATTERN.test(url);}catch(e){return false;}};
|
|
1276
1276
|
var isErrRetryable=function isErrRetryable(details){var isRetryableNWFailure=false;if(details!==null&&details!==void 0&&details.error&&details!==null&&details!==void 0&&details.xhr){var xhrStatus=details.xhr.status;// same as in v1.1
|
1277
1277
|
isRetryableNWFailure=xhrStatus===429||xhrStatus>=500&&xhrStatus<600;}return isRetryableNWFailure;};
|
1278
1278
|
|
1279
|
-
var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
1280
|
-
|
1281
|
-
var COOKIE_DATA_ENCODING_ERROR="Failed to encode the cookie data.";
|
1282
|
-
|
1283
1279
|
/**
|
1284
1280
|
* Encode.
|
1285
1281
|
*/var encode=function encode(value,logger){try{return encodeURIComponent(value);}catch(err){logger===null||logger===void 0||logger.error(COOKIE_DATA_ENCODING_ERROR,err);return undefined;}};/**
|
@@ -1299,6 +1295,8 @@ pairs.forEach(function(pairItem){pair=pairItem.split('=');var keyName=pair[0]?de
|
|
1299
1295
|
*/// eslint-disable-next-line func-names
|
1300
1296
|
var cookie=function cookie(name,value,options,logger){switch(arguments.length){case 4:case 3:case 2:return set(name,value,options,logger);case 1:if(name){return get(name);}return all();default:return all();}};
|
1301
1297
|
|
1298
|
+
var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
1299
|
+
|
1302
1300
|
var encryptBrowser=function encryptBrowser(value){return "".concat(ENCRYPTION_PREFIX_V3).concat(toBase64(value));};var decryptBrowser=function decryptBrowser(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};
|
1303
1301
|
|
1304
1302
|
var EVENT_PAYLOAD_SIZE_BYTES_LIMIT=32*1024;// 32 KB
|
@@ -1662,7 +1660,7 @@ var DIR_NAME$2='Ninetailed';var NAME$2='NINETAILED';var DISPLAY_NAME$2='Ninetail
|
|
1662
1660
|
|
1663
1661
|
var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
|
1664
1662
|
|
1665
|
-
var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(
|
1663
|
+
var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
|
1666
1664
|
|
1667
1665
|
var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
|
1668
1666
|
var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
|
@@ -1717,7 +1715,8 @@ var NOTIFIER_NAME='RudderStack JavaScript SDK Error Notifier';var SDK_GITHUB_URL
|
|
1717
1715
|
|
1718
1716
|
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
|
1719
1717
|
// on the dashboard
|
1720
|
-
if(message.includes('Error in loading a third-party script')){context='Script load failures';}return context;};var getBugsnagErrorEvent=function getBugsnagErrorEvent(payload,errorState,state){var _state$context$locale,_state$context$userAg,_getAppStateForMetada,_state$source$value$i,_state$source$value;return {notifier:{name:NOTIFIER_NAME,version:state.context.app.value.version,url:SDK_GITHUB_URL},events:[{payloadVersion:'5',exceptions:clone(payload.errors),severity:errorState.severity,unhandled:errorState.unhandled,severityReason:errorState.severityReason,app:{version:state.context.app.value.version,releaseStage:getReleaseStage()},device:{locale:(_state$context$locale=state.context.locale.value)!==null&&_state$context$locale!==void 0?_state$context$locale:undefined,userAgent:(_state$context$userAg=state.context.userAgent.value)!==null&&_state$context$userAg!==void 0?_state$context$userAg:undefined,time:new Date()},request:{url:getURLWithoutQueryString(),clientIp:'[NOT COLLECTED]'},breadcrumbs:clone(state.reporting.breadcrumbs.value),context:getErrorContext(payload.errors[0]),metaData:{sdk:{name:'JS',installType:state.context.app.value.installType},state:(_getAppStateForMetada=getAppStateForMetadata(state))!==null&&_getAppStateForMetada!==void 0?_getAppStateForMetada:{},source:{snippetVersion:globalThis.RudderSnippetVersion}},user:{
|
1718
|
+
if(message.includes('Error in loading a third-party script')){context='Script load failures';}return context;};var getBugsnagErrorEvent=function getBugsnagErrorEvent(payload,errorState,state){var _state$context$locale,_state$context$userAg,_getAppStateForMetada,_state$source$value$i,_state$source$value,_state$session$sessio,_state$session$sessio2,_state$autoTrack$page,_state$autoTrack;return {notifier:{name:NOTIFIER_NAME,version:state.context.app.value.version,url:SDK_GITHUB_URL},events:[{payloadVersion:'5',exceptions:clone(payload.errors),severity:errorState.severity,unhandled:errorState.unhandled,severityReason:errorState.severityReason,app:{version:state.context.app.value.version,releaseStage:getReleaseStage()},device:{locale:(_state$context$locale=state.context.locale.value)!==null&&_state$context$locale!==void 0?_state$context$locale:undefined,userAgent:(_state$context$userAg=state.context.userAgent.value)!==null&&_state$context$userAg!==void 0?_state$context$userAg:undefined,time:new Date()},request:{url:getURLWithoutQueryString(),clientIp:'[NOT COLLECTED]'},breadcrumbs:clone(state.reporting.breadcrumbs.value),context:getErrorContext(payload.errors[0]),metaData:{sdk:{name:'JS',installType:state.context.app.value.installType},state:(_getAppStateForMetada=getAppStateForMetadata(state))!==null&&_getAppStateForMetada!==void 0?_getAppStateForMetada:{},source:{snippetVersion:globalThis.RudderSnippetVersion}},user:{// Combination of source, session and visit ids
|
1719
|
+
id:"".concat((_state$source$value$i=(_state$source$value=state.source.value)===null||_state$source$value===void 0?void 0:_state$source$value.id)!==null&&_state$source$value$i!==void 0?_state$source$value$i:state.lifecycle.writeKey.value,"..").concat((_state$session$sessio=(_state$session$sessio2=state.session.sessionInfo.value)===null||_state$session$sessio2===void 0?void 0:_state$session$sessio2.id)!==null&&_state$session$sessio!==void 0?_state$session$sessio:'NA',"..").concat((_state$autoTrack$page=(_state$autoTrack=state.autoTrack)===null||_state$autoTrack===void 0||(_state$autoTrack=_state$autoTrack.pageLifecycle)===null||_state$autoTrack===void 0||(_state$autoTrack=_state$autoTrack.visitId)===null||_state$autoTrack===void 0?void 0:_state$autoTrack.value)!==null&&_state$autoTrack$page!==void 0?_state$autoTrack$page:'NA')}}]};};/**
|
1721
1720
|
* A function to determine whether the error should be promoted to notify or not
|
1722
1721
|
* @param {Error} error
|
1723
1722
|
* @returns
|
@@ -987,7 +987,7 @@
|
|
987
987
|
* @returns ISO formatted timestamp string
|
988
988
|
*/var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
|
989
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.";
|
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.";var COOKIE_DATA_ENCODING_ERROR="Failed to encode the cookie data.";
|
991
991
|
|
992
992
|
var JSON_STRINGIFY='JSONStringify';var BIG_INT_PLACEHOLDER='[BigInt]';var CIRCULAR_REFERENCE_PLACEHOLDER='[Circular Reference]';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
993
|
// eslint-disable-next-line func-names
|
@@ -1031,7 +1031,7 @@
|
|
1031
1031
|
* @returns Instance of Error with message prepended with issue
|
1032
1032
|
*/var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
|
1033
1033
|
|
1034
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.
|
1034
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.16';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';
|
1035
1035
|
|
1036
1036
|
var QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';var QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';var QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';var QUERY_PARAM_USER_ID_KEY='ajs_uid';var QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
1037
1037
|
|
@@ -1282,10 +1282,6 @@
|
|
1282
1282
|
var isErrRetryable=function isErrRetryable(details){var isRetryableNWFailure=false;if(details!==null&&details!==void 0&&details.error&&details!==null&&details!==void 0&&details.xhr){var xhrStatus=details.xhr.status;// same as in v1.1
|
1283
1283
|
isRetryableNWFailure=xhrStatus===429||xhrStatus>=500&&xhrStatus<600;}return isRetryableNWFailure;};
|
1284
1284
|
|
1285
|
-
var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
1286
|
-
|
1287
|
-
var COOKIE_DATA_ENCODING_ERROR="Failed to encode the cookie data.";
|
1288
|
-
|
1289
1285
|
/**
|
1290
1286
|
* Encode.
|
1291
1287
|
*/var encode=function encode(value,logger){try{return encodeURIComponent(value);}catch(err){logger===null||logger===void 0||logger.error(COOKIE_DATA_ENCODING_ERROR,err);return undefined;}};/**
|
@@ -1305,6 +1301,8 @@
|
|
1305
1301
|
*/// eslint-disable-next-line func-names
|
1306
1302
|
var cookie=function cookie(name,value,options,logger){switch(arguments.length){case 4:case 3:case 2:return set(name,value,options,logger);case 1:if(name){return get(name);}return all();default:return all();}};
|
1307
1303
|
|
1304
|
+
var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
1305
|
+
|
1308
1306
|
var encryptBrowser=function encryptBrowser(value){return "".concat(ENCRYPTION_PREFIX_V3).concat(toBase64(value));};var decryptBrowser=function decryptBrowser(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};
|
1309
1307
|
|
1310
1308
|
var EVENT_PAYLOAD_SIZE_BYTES_LIMIT=32*1024;// 32 KB
|
@@ -1668,7 +1666,7 @@
|
|
1668
1666
|
|
1669
1667
|
var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
|
1670
1668
|
|
1671
|
-
var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(
|
1669
|
+
var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
|
1672
1670
|
|
1673
1671
|
var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
|
1674
1672
|
var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
|
@@ -1723,7 +1721,8 @@
|
|
1723
1721
|
|
1724
1722
|
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
|
1725
1723
|
// on the dashboard
|
1726
|
-
if(message.includes('Error in loading a third-party script')){context='Script load failures';}return context;};var getBugsnagErrorEvent=function getBugsnagErrorEvent(payload,errorState,state){var _state$context$locale,_state$context$userAg,_getAppStateForMetada,_state$source$value$i,_state$source$value;return {notifier:{name:NOTIFIER_NAME,version:state.context.app.value.version,url:SDK_GITHUB_URL},events:[{payloadVersion:'5',exceptions:clone(payload.errors),severity:errorState.severity,unhandled:errorState.unhandled,severityReason:errorState.severityReason,app:{version:state.context.app.value.version,releaseStage:getReleaseStage()},device:{locale:(_state$context$locale=state.context.locale.value)!==null&&_state$context$locale!==void 0?_state$context$locale:undefined,userAgent:(_state$context$userAg=state.context.userAgent.value)!==null&&_state$context$userAg!==void 0?_state$context$userAg:undefined,time:new Date()},request:{url:getURLWithoutQueryString(),clientIp:'[NOT COLLECTED]'},breadcrumbs:clone(state.reporting.breadcrumbs.value),context:getErrorContext(payload.errors[0]),metaData:{sdk:{name:'JS',installType:state.context.app.value.installType},state:(_getAppStateForMetada=getAppStateForMetadata(state))!==null&&_getAppStateForMetada!==void 0?_getAppStateForMetada:{},source:{snippetVersion:globalThis.RudderSnippetVersion}},user:{
|
1724
|
+
if(message.includes('Error in loading a third-party script')){context='Script load failures';}return context;};var getBugsnagErrorEvent=function getBugsnagErrorEvent(payload,errorState,state){var _state$context$locale,_state$context$userAg,_getAppStateForMetada,_state$source$value$i,_state$source$value,_state$session$sessio,_state$session$sessio2,_state$autoTrack$page,_state$autoTrack;return {notifier:{name:NOTIFIER_NAME,version:state.context.app.value.version,url:SDK_GITHUB_URL},events:[{payloadVersion:'5',exceptions:clone(payload.errors),severity:errorState.severity,unhandled:errorState.unhandled,severityReason:errorState.severityReason,app:{version:state.context.app.value.version,releaseStage:getReleaseStage()},device:{locale:(_state$context$locale=state.context.locale.value)!==null&&_state$context$locale!==void 0?_state$context$locale:undefined,userAgent:(_state$context$userAg=state.context.userAgent.value)!==null&&_state$context$userAg!==void 0?_state$context$userAg:undefined,time:new Date()},request:{url:getURLWithoutQueryString(),clientIp:'[NOT COLLECTED]'},breadcrumbs:clone(state.reporting.breadcrumbs.value),context:getErrorContext(payload.errors[0]),metaData:{sdk:{name:'JS',installType:state.context.app.value.installType},state:(_getAppStateForMetada=getAppStateForMetadata(state))!==null&&_getAppStateForMetada!==void 0?_getAppStateForMetada:{},source:{snippetVersion:globalThis.RudderSnippetVersion}},user:{// Combination of source, session and visit ids
|
1725
|
+
id:"".concat((_state$source$value$i=(_state$source$value=state.source.value)===null||_state$source$value===void 0?void 0:_state$source$value.id)!==null&&_state$source$value$i!==void 0?_state$source$value$i:state.lifecycle.writeKey.value,"..").concat((_state$session$sessio=(_state$session$sessio2=state.session.sessionInfo.value)===null||_state$session$sessio2===void 0?void 0:_state$session$sessio2.id)!==null&&_state$session$sessio!==void 0?_state$session$sessio:'NA',"..").concat((_state$autoTrack$page=(_state$autoTrack=state.autoTrack)===null||_state$autoTrack===void 0||(_state$autoTrack=_state$autoTrack.pageLifecycle)===null||_state$autoTrack===void 0||(_state$autoTrack=_state$autoTrack.visitId)===null||_state$autoTrack===void 0?void 0:_state$autoTrack.value)!==null&&_state$autoTrack$page!==void 0?_state$autoTrack$page:'NA')}}]};};/**
|
1727
1726
|
* A function to determine whether the error should be promoted to notify or not
|
1728
1727
|
* @param {Error} error
|
1729
1728
|
* @returns
|
@@ -981,7 +981,7 @@ var getFormattedTimestamp=function getFormattedTimestamp(date){return date.toISO
|
|
981
981
|
* @returns ISO formatted timestamp string
|
982
982
|
*/var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
|
983
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.";
|
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.";var COOKIE_DATA_ENCODING_ERROR="Failed to encode the cookie data.";
|
985
985
|
|
986
986
|
var JSON_STRINGIFY='JSONStringify';var BIG_INT_PLACEHOLDER='[BigInt]';var CIRCULAR_REFERENCE_PLACEHOLDER='[Circular Reference]';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
987
|
// eslint-disable-next-line func-names
|
@@ -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.16';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
|
|
@@ -1276,10 +1276,6 @@ new URL(url);}return URL_PATTERN.test(url);}catch(e){return false;}};
|
|
1276
1276
|
var isErrRetryable=function isErrRetryable(details){var isRetryableNWFailure=false;if(details!==null&&details!==void 0&&details.error&&details!==null&&details!==void 0&&details.xhr){var xhrStatus=details.xhr.status;// same as in v1.1
|
1277
1277
|
isRetryableNWFailure=xhrStatus===429||xhrStatus>=500&&xhrStatus<600;}return isRetryableNWFailure;};
|
1278
1278
|
|
1279
|
-
var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
1280
|
-
|
1281
|
-
var COOKIE_DATA_ENCODING_ERROR="Failed to encode the cookie data.";
|
1282
|
-
|
1283
1279
|
/**
|
1284
1280
|
* Encode.
|
1285
1281
|
*/var encode=function encode(value,logger){try{return encodeURIComponent(value);}catch(err){logger===null||logger===void 0||logger.error(COOKIE_DATA_ENCODING_ERROR,err);return undefined;}};/**
|
@@ -1299,6 +1295,8 @@ pairs.forEach(function(pairItem){pair=pairItem.split('=');var keyName=pair[0]?de
|
|
1299
1295
|
*/// eslint-disable-next-line func-names
|
1300
1296
|
var cookie=function cookie(name,value,options,logger){switch(arguments.length){case 4:case 3:case 2:return set(name,value,options,logger);case 1:if(name){return get(name);}return all();default:return all();}};
|
1301
1297
|
|
1298
|
+
var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
1299
|
+
|
1302
1300
|
var encryptBrowser=function encryptBrowser(value){return "".concat(ENCRYPTION_PREFIX_V3).concat(toBase64(value));};var decryptBrowser=function decryptBrowser(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};
|
1303
1301
|
|
1304
1302
|
var EVENT_PAYLOAD_SIZE_BYTES_LIMIT=32*1024;// 32 KB
|
@@ -1489,10 +1487,11 @@ event.context='Script load failures';}// eslint-disable-next-line no-param-reass
|
|
1489
1487
|
event.severity='error';};var onError=function onError(state,logger){return function(event){try{// Discard the event if it's not originated at the SDK
|
1490
1488
|
if(!isRudderSDKError$1(event)){return false;}enhanceErrorEventMutator(state,event);return true;}catch(_unused){logger===null||logger===void 0||logger.error(FAILED_TO_FILTER_ERROR(BUGSNAG_PLUGIN));// Drop the error event if it couldn't be filtered as
|
1491
1489
|
// it is most likely a non-SDK error
|
1492
|
-
return false;}};};var getReleaseStage$1=function getReleaseStage(){var host=globalThis.location.hostname;return host&&DEV_HOSTS$1.includes(host)?'development':'production';};var getGlobalBugsnagLibInstance=function getGlobalBugsnagLibInstance(){return globalThis[BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME];};var getNewClient=function getNewClient(state,logger){var _state$source$value;var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();var clientConfig={apiKey:API_KEY,appVersion:state.context.app.value.version,metaData:{SDK:{name:'JS',installType:state.context.app.value.installType}},beforeSend:onError(state,logger),autoCaptureSessions:false,// auto capture sessions is disabled
|
1490
|
+
return false;}};};var getReleaseStage$1=function getReleaseStage(){var host=globalThis.location.hostname;return host&&DEV_HOSTS$1.includes(host)?'development':'production';};var getGlobalBugsnagLibInstance=function getGlobalBugsnagLibInstance(){return globalThis[BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME];};var getNewClient=function getNewClient(state,logger){var _state$source$value$i,_state$source$value,_state$session$sessio,_state$session$sessio2,_state$autoTrack$page,_state$autoTrack;var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();var clientConfig={apiKey:API_KEY,appVersion:state.context.app.value.version,metaData:{SDK:{name:'JS',installType:state.context.app.value.installType}},beforeSend:onError(state,logger),autoCaptureSessions:false,// auto capture sessions is disabled
|
1493
1491
|
collectUserIp:false,// collecting user's IP is disabled
|
1494
1492
|
// enabledBreadcrumbTypes: ['error', 'log', 'user'], // for v7 and above
|
1495
|
-
maxEvents:100,maxBreadcrumbs:40,releaseStage:getReleaseStage$1(),user:{
|
1493
|
+
maxEvents:100,maxBreadcrumbs:40,releaseStage:getReleaseStage$1(),user:{// Combination of source, session and visit ids
|
1494
|
+
id:"".concat((_state$source$value$i=(_state$source$value=state.source.value)===null||_state$source$value===void 0?void 0:_state$source$value.id)!==null&&_state$source$value$i!==void 0?_state$source$value$i:state.lifecycle.writeKey.value,"..").concat((_state$session$sessio=(_state$session$sessio2=state.session.sessionInfo.value)===null||_state$session$sessio2===void 0?void 0:_state$session$sessio2.id)!==null&&_state$session$sessio!==void 0?_state$session$sessio:'NA',"..").concat((_state$autoTrack$page=(_state$autoTrack=state.autoTrack)===null||_state$autoTrack===void 0||(_state$autoTrack=_state$autoTrack.pageLifecycle)===null||_state$autoTrack===void 0||(_state$autoTrack=_state$autoTrack.visitId)===null||_state$autoTrack===void 0?void 0:_state$autoTrack.value)!==null&&_state$autoTrack$page!==void 0?_state$autoTrack$page:'NA')},logger:logger,networkBreadcrumbsEnabled:false};var client=globalBugsnagLibInstance(clientConfig);return client;};var isApiKeyValid=function isApiKeyValid(apiKey){var isAPIKeyValid=!(apiKey.startsWith('{{')||apiKey.endsWith('}}')||apiKey.length===0);return isAPIKeyValid;};var loadBugsnagSDK=function loadBugsnagSDK(externalSrcLoader,logger){var isNotLoaded=GLOBAL_LIBRARY_OBJECT_NAMES.every(function(globalKeyName){return !globalThis[globalKeyName];});if(!isNotLoaded){return;}externalSrcLoader.loadJSFile({url:BUGSNAG_CDN_URL,id:ERROR_REPORT_PROVIDER_NAME_BUGSNAG,callback:function callback(id){if(!id){logger===null||logger===void 0||logger.error(BUGSNAG_SDK_LOAD_ERROR(BUGSNAG_PLUGIN));}}});};var _initBugsnagClient=function initBugsnagClient(state,promiseResolve,promiseReject,logger){var time=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();if(typeof globalBugsnagLibInstance==='function'){if(isValidVersion(globalBugsnagLibInstance)){var client=getNewClient(state,logger);promiseResolve(client);}}else if(time>=MAX_WAIT_FOR_SDK_LOAD_MS){promiseReject(new Error(BUGSNAG_SDK_LOAD_TIMEOUT_ERROR(MAX_WAIT_FOR_SDK_LOAD_MS)));}else {// Try to initialize the client after a delay
|
1496
1495
|
globalThis.setTimeout(_initBugsnagClient,SDK_LOAD_POLL_INTERVAL_MS,state,promiseResolve,promiseReject,logger,time+SDK_LOAD_POLL_INTERVAL_MS);}};
|
1497
1496
|
|
1498
1497
|
var pluginName$e='Bugsnag';var Bugsnag=function Bugsnag(){return {name:pluginName$e,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$e]);},errorReportingProvider:{init:function init(state,externalSrcLoader,logger){return new Promise(function(resolve,reject){// If API key token is not parsed or invalid, don't proceed to initialize the client
|
@@ -1686,7 +1685,7 @@ var DIR_NAME$2='Ninetailed';var NAME$2='NINETAILED';var DISPLAY_NAME$2='Ninetail
|
|
1686
1685
|
|
1687
1686
|
var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
|
1688
1687
|
|
1689
|
-
var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(
|
1688
|
+
var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
|
1690
1689
|
|
1691
1690
|
var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
|
1692
1691
|
var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
|
@@ -1741,7 +1740,8 @@ var NOTIFIER_NAME='RudderStack JavaScript SDK Error Notifier';var SDK_GITHUB_URL
|
|
1741
1740
|
|
1742
1741
|
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
|
1743
1742
|
// on the dashboard
|
1744
|
-
if(message.includes('Error in loading a third-party script')){context='Script load failures';}return context;};var getBugsnagErrorEvent=function getBugsnagErrorEvent(payload,errorState,state){var _state$context$locale,_state$context$userAg,_getAppStateForMetada,_state$source$value$i,_state$source$value;return {notifier:{name:NOTIFIER_NAME,version:state.context.app.value.version,url:SDK_GITHUB_URL},events:[{payloadVersion:'5',exceptions:clone(payload.errors),severity:errorState.severity,unhandled:errorState.unhandled,severityReason:errorState.severityReason,app:{version:state.context.app.value.version,releaseStage:getReleaseStage()},device:{locale:(_state$context$locale=state.context.locale.value)!==null&&_state$context$locale!==void 0?_state$context$locale:undefined,userAgent:(_state$context$userAg=state.context.userAgent.value)!==null&&_state$context$userAg!==void 0?_state$context$userAg:undefined,time:new Date()},request:{url:getURLWithoutQueryString(),clientIp:'[NOT COLLECTED]'},breadcrumbs:clone(state.reporting.breadcrumbs.value),context:getErrorContext(payload.errors[0]),metaData:{sdk:{name:'JS',installType:state.context.app.value.installType},state:(_getAppStateForMetada=getAppStateForMetadata(state))!==null&&_getAppStateForMetada!==void 0?_getAppStateForMetada:{},source:{snippetVersion:globalThis.RudderSnippetVersion}},user:{
|
1743
|
+
if(message.includes('Error in loading a third-party script')){context='Script load failures';}return context;};var getBugsnagErrorEvent=function getBugsnagErrorEvent(payload,errorState,state){var _state$context$locale,_state$context$userAg,_getAppStateForMetada,_state$source$value$i,_state$source$value,_state$session$sessio,_state$session$sessio2,_state$autoTrack$page,_state$autoTrack;return {notifier:{name:NOTIFIER_NAME,version:state.context.app.value.version,url:SDK_GITHUB_URL},events:[{payloadVersion:'5',exceptions:clone(payload.errors),severity:errorState.severity,unhandled:errorState.unhandled,severityReason:errorState.severityReason,app:{version:state.context.app.value.version,releaseStage:getReleaseStage()},device:{locale:(_state$context$locale=state.context.locale.value)!==null&&_state$context$locale!==void 0?_state$context$locale:undefined,userAgent:(_state$context$userAg=state.context.userAgent.value)!==null&&_state$context$userAg!==void 0?_state$context$userAg:undefined,time:new Date()},request:{url:getURLWithoutQueryString(),clientIp:'[NOT COLLECTED]'},breadcrumbs:clone(state.reporting.breadcrumbs.value),context:getErrorContext(payload.errors[0]),metaData:{sdk:{name:'JS',installType:state.context.app.value.installType},state:(_getAppStateForMetada=getAppStateForMetadata(state))!==null&&_getAppStateForMetada!==void 0?_getAppStateForMetada:{},source:{snippetVersion:globalThis.RudderSnippetVersion}},user:{// Combination of source, session and visit ids
|
1744
|
+
id:"".concat((_state$source$value$i=(_state$source$value=state.source.value)===null||_state$source$value===void 0?void 0:_state$source$value.id)!==null&&_state$source$value$i!==void 0?_state$source$value$i:state.lifecycle.writeKey.value,"..").concat((_state$session$sessio=(_state$session$sessio2=state.session.sessionInfo.value)===null||_state$session$sessio2===void 0?void 0:_state$session$sessio2.id)!==null&&_state$session$sessio!==void 0?_state$session$sessio:'NA',"..").concat((_state$autoTrack$page=(_state$autoTrack=state.autoTrack)===null||_state$autoTrack===void 0||(_state$autoTrack=_state$autoTrack.pageLifecycle)===null||_state$autoTrack===void 0||(_state$autoTrack=_state$autoTrack.visitId)===null||_state$autoTrack===void 0?void 0:_state$autoTrack.value)!==null&&_state$autoTrack$page!==void 0?_state$autoTrack$page:'NA')}}]};};/**
|
1745
1745
|
* A function to determine whether the error should be promoted to notify or not
|
1746
1746
|
* @param {Error} error
|
1747
1747
|
* @returns
|
@@ -987,7 +987,7 @@
|
|
987
987
|
* @returns ISO formatted timestamp string
|
988
988
|
*/var getCurrentTimeFormatted=function getCurrentTimeFormatted(){return getFormattedTimestamp(new Date());};
|
989
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.";
|
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.";var COOKIE_DATA_ENCODING_ERROR="Failed to encode the cookie data.";
|
991
991
|
|
992
992
|
var JSON_STRINGIFY='JSONStringify';var BIG_INT_PLACEHOLDER='[BigInt]';var CIRCULAR_REFERENCE_PLACEHOLDER='[Circular Reference]';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
993
|
// eslint-disable-next-line func-names
|
@@ -1031,7 +1031,7 @@
|
|
1031
1031
|
* @returns Instance of Error with message prepended with issue
|
1032
1032
|
*/var getMutatedError=function getMutatedError(err,issue){var finalError=err;if(!isTypeOfError(err)){finalError=new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}else {finalError.message="".concat(issue,": ").concat(err.message);}return finalError;};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var _error$stack;error.stack="".concat((_error$stack=error.stack)!==null&&_error$stack!==void 0?_error$stack:'',"\n").concat(MANUAL_ERROR_IDENTIFIER);}globalThis.dispatchEvent(new ErrorEvent('error',{error:error}));};
|
1033
1033
|
|
1034
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.
|
1034
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.11.16';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';
|
1035
1035
|
|
1036
1036
|
var QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';var QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';var QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';var QUERY_PARAM_USER_ID_KEY='ajs_uid';var QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
1037
1037
|
|
@@ -1282,10 +1282,6 @@
|
|
1282
1282
|
var isErrRetryable=function isErrRetryable(details){var isRetryableNWFailure=false;if(details!==null&&details!==void 0&&details.error&&details!==null&&details!==void 0&&details.xhr){var xhrStatus=details.xhr.status;// same as in v1.1
|
1283
1283
|
isRetryableNWFailure=xhrStatus===429||xhrStatus>=500&&xhrStatus<600;}return isRetryableNWFailure;};
|
1284
1284
|
|
1285
|
-
var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
1286
|
-
|
1287
|
-
var COOKIE_DATA_ENCODING_ERROR="Failed to encode the cookie data.";
|
1288
|
-
|
1289
1285
|
/**
|
1290
1286
|
* Encode.
|
1291
1287
|
*/var encode=function encode(value,logger){try{return encodeURIComponent(value);}catch(err){logger===null||logger===void 0||logger.error(COOKIE_DATA_ENCODING_ERROR,err);return undefined;}};/**
|
@@ -1305,6 +1301,8 @@
|
|
1305
1301
|
*/// eslint-disable-next-line func-names
|
1306
1302
|
var cookie=function cookie(name,value,options,logger){switch(arguments.length){case 4:case 3:case 2:return set(name,value,options,logger);case 1:if(name){return get(name);}return all();default:return all();}};
|
1307
1303
|
|
1304
|
+
var userIdKey='rl_user_id';var userTraitsKey='rl_trait';var anonymousUserIdKey='rl_anonymous_id';var groupIdKey='rl_group_id';var groupTraitsKey='rl_group_trait';var pageInitialReferrerKey='rl_page_init_referrer';var pageInitialReferringDomainKey='rl_page_init_referring_domain';var sessionInfoKey='rl_session';var authTokenKey='rl_auth_token';var COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
1305
|
+
|
1308
1306
|
var encryptBrowser=function encryptBrowser(value){return "".concat(ENCRYPTION_PREFIX_V3).concat(toBase64(value));};var decryptBrowser=function decryptBrowser(value){if(value!==null&&value!==void 0&&value.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};
|
1309
1307
|
|
1310
1308
|
var EVENT_PAYLOAD_SIZE_BYTES_LIMIT=32*1024;// 32 KB
|
@@ -1495,10 +1493,11 @@
|
|
1495
1493
|
event.severity='error';};var onError=function onError(state,logger){return function(event){try{// Discard the event if it's not originated at the SDK
|
1496
1494
|
if(!isRudderSDKError$1(event)){return false;}enhanceErrorEventMutator(state,event);return true;}catch(_unused){logger===null||logger===void 0||logger.error(FAILED_TO_FILTER_ERROR(BUGSNAG_PLUGIN));// Drop the error event if it couldn't be filtered as
|
1497
1495
|
// it is most likely a non-SDK error
|
1498
|
-
return false;}};};var getReleaseStage$1=function getReleaseStage(){var host=globalThis.location.hostname;return host&&DEV_HOSTS$1.includes(host)?'development':'production';};var getGlobalBugsnagLibInstance=function getGlobalBugsnagLibInstance(){return globalThis[BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME];};var getNewClient=function getNewClient(state,logger){var _state$source$value;var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();var clientConfig={apiKey:API_KEY,appVersion:state.context.app.value.version,metaData:{SDK:{name:'JS',installType:state.context.app.value.installType}},beforeSend:onError(state,logger),autoCaptureSessions:false,// auto capture sessions is disabled
|
1496
|
+
return false;}};};var getReleaseStage$1=function getReleaseStage(){var host=globalThis.location.hostname;return host&&DEV_HOSTS$1.includes(host)?'development':'production';};var getGlobalBugsnagLibInstance=function getGlobalBugsnagLibInstance(){return globalThis[BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME];};var getNewClient=function getNewClient(state,logger){var _state$source$value$i,_state$source$value,_state$session$sessio,_state$session$sessio2,_state$autoTrack$page,_state$autoTrack;var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();var clientConfig={apiKey:API_KEY,appVersion:state.context.app.value.version,metaData:{SDK:{name:'JS',installType:state.context.app.value.installType}},beforeSend:onError(state,logger),autoCaptureSessions:false,// auto capture sessions is disabled
|
1499
1497
|
collectUserIp:false,// collecting user's IP is disabled
|
1500
1498
|
// enabledBreadcrumbTypes: ['error', 'log', 'user'], // for v7 and above
|
1501
|
-
maxEvents:100,maxBreadcrumbs:40,releaseStage:getReleaseStage$1(),user:{
|
1499
|
+
maxEvents:100,maxBreadcrumbs:40,releaseStage:getReleaseStage$1(),user:{// Combination of source, session and visit ids
|
1500
|
+
id:"".concat((_state$source$value$i=(_state$source$value=state.source.value)===null||_state$source$value===void 0?void 0:_state$source$value.id)!==null&&_state$source$value$i!==void 0?_state$source$value$i:state.lifecycle.writeKey.value,"..").concat((_state$session$sessio=(_state$session$sessio2=state.session.sessionInfo.value)===null||_state$session$sessio2===void 0?void 0:_state$session$sessio2.id)!==null&&_state$session$sessio!==void 0?_state$session$sessio:'NA',"..").concat((_state$autoTrack$page=(_state$autoTrack=state.autoTrack)===null||_state$autoTrack===void 0||(_state$autoTrack=_state$autoTrack.pageLifecycle)===null||_state$autoTrack===void 0||(_state$autoTrack=_state$autoTrack.visitId)===null||_state$autoTrack===void 0?void 0:_state$autoTrack.value)!==null&&_state$autoTrack$page!==void 0?_state$autoTrack$page:'NA')},logger:logger,networkBreadcrumbsEnabled:false};var client=globalBugsnagLibInstance(clientConfig);return client;};var isApiKeyValid=function isApiKeyValid(apiKey){var isAPIKeyValid=!(apiKey.startsWith('{{')||apiKey.endsWith('}}')||apiKey.length===0);return isAPIKeyValid;};var loadBugsnagSDK=function loadBugsnagSDK(externalSrcLoader,logger){var isNotLoaded=GLOBAL_LIBRARY_OBJECT_NAMES.every(function(globalKeyName){return !globalThis[globalKeyName];});if(!isNotLoaded){return;}externalSrcLoader.loadJSFile({url:BUGSNAG_CDN_URL,id:ERROR_REPORT_PROVIDER_NAME_BUGSNAG,callback:function callback(id){if(!id){logger===null||logger===void 0||logger.error(BUGSNAG_SDK_LOAD_ERROR(BUGSNAG_PLUGIN));}}});};var _initBugsnagClient=function initBugsnagClient(state,promiseResolve,promiseReject,logger){var time=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();if(typeof globalBugsnagLibInstance==='function'){if(isValidVersion(globalBugsnagLibInstance)){var client=getNewClient(state,logger);promiseResolve(client);}}else if(time>=MAX_WAIT_FOR_SDK_LOAD_MS){promiseReject(new Error(BUGSNAG_SDK_LOAD_TIMEOUT_ERROR(MAX_WAIT_FOR_SDK_LOAD_MS)));}else {// Try to initialize the client after a delay
|
1502
1501
|
globalThis.setTimeout(_initBugsnagClient,SDK_LOAD_POLL_INTERVAL_MS,state,promiseResolve,promiseReject,logger,time+SDK_LOAD_POLL_INTERVAL_MS);}};
|
1503
1502
|
|
1504
1503
|
var pluginName$e='Bugsnag';var Bugsnag=function Bugsnag(){return {name:pluginName$e,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$e]);},errorReportingProvider:{init:function init(state,externalSrcLoader,logger){return new Promise(function(resolve,reject){// If API key token is not parsed or invalid, don't proceed to initialize the client
|
@@ -1692,7 +1691,7 @@
|
|
1692
1691
|
|
1693
1692
|
var DIR_NAME$1='Gainsight_PX';var NAME$1='GAINSIGHT_PX';var DISPLAY_NAME$1='Gainsight PX';_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);_defineProperty(_defineProperty({},NAME$1,NAME$1),"Gainsight_PX",NAME$1);
|
1694
1693
|
|
1695
|
-
var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(
|
1694
|
+
var DIR_NAME='XPixel';var NAME='XPIXEL';var DISPLAY_NAME='XPixel';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"XPixel",NAME),"Xpixel",NAME),"xpixel",NAME),"xPixel",NAME);
|
1696
1695
|
|
1697
1696
|
var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
|
1698
1697
|
var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$T,DIR_NAME$T),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$11,DIR_NAME$11),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1f,DIR_NAME$1f),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$1d,DIR_NAME$1d),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$1g,DIR_NAME$1g),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$G,DIR_NAME$G),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$R,DIR_NAME$R),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),DISPLAY_NAME$r,DIR_NAME$r),DISPLAY_NAME$q,DIR_NAME$q),DISPLAY_NAME$p,DIR_NAME$p),DISPLAY_NAME$o,DIR_NAME$o),DISPLAY_NAME$n,DIR_NAME$n),DISPLAY_NAME$m,DIR_NAME$m),DISPLAY_NAME$l,DIR_NAME$l),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),DISPLAY_NAME$h,DIR_NAME$h),DISPLAY_NAME$g,DIR_NAME$g),DISPLAY_NAME$f,DIR_NAME$f),DISPLAY_NAME$e,DIR_NAME$e),DISPLAY_NAME$d,DIR_NAME$d),DISPLAY_NAME$c,DIR_NAME$c),DISPLAY_NAME$b,DIR_NAME$b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),DISPLAY_NAME$7,DIR_NAME$7),DISPLAY_NAME$6,DIR_NAME$6),DISPLAY_NAME$5,DIR_NAME$5),DISPLAY_NAME$4,DIR_NAME$4),DISPLAY_NAME$3,DIR_NAME$3),DISPLAY_NAME$2,DIR_NAME$2),DISPLAY_NAME$1,DIR_NAME$1),_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME,DIR_NAME));
|
@@ -1747,7 +1746,8 @@
|
|
1747
1746
|
|
1748
1747
|
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
|
1749
1748
|
// on the dashboard
|
1750
|
-
if(message.includes('Error in loading a third-party script')){context='Script load failures';}return context;};var getBugsnagErrorEvent=function getBugsnagErrorEvent(payload,errorState,state){var _state$context$locale,_state$context$userAg,_getAppStateForMetada,_state$source$value$i,_state$source$value;return {notifier:{name:NOTIFIER_NAME,version:state.context.app.value.version,url:SDK_GITHUB_URL},events:[{payloadVersion:'5',exceptions:clone(payload.errors),severity:errorState.severity,unhandled:errorState.unhandled,severityReason:errorState.severityReason,app:{version:state.context.app.value.version,releaseStage:getReleaseStage()},device:{locale:(_state$context$locale=state.context.locale.value)!==null&&_state$context$locale!==void 0?_state$context$locale:undefined,userAgent:(_state$context$userAg=state.context.userAgent.value)!==null&&_state$context$userAg!==void 0?_state$context$userAg:undefined,time:new Date()},request:{url:getURLWithoutQueryString(),clientIp:'[NOT COLLECTED]'},breadcrumbs:clone(state.reporting.breadcrumbs.value),context:getErrorContext(payload.errors[0]),metaData:{sdk:{name:'JS',installType:state.context.app.value.installType},state:(_getAppStateForMetada=getAppStateForMetadata(state))!==null&&_getAppStateForMetada!==void 0?_getAppStateForMetada:{},source:{snippetVersion:globalThis.RudderSnippetVersion}},user:{
|
1749
|
+
if(message.includes('Error in loading a third-party script')){context='Script load failures';}return context;};var getBugsnagErrorEvent=function getBugsnagErrorEvent(payload,errorState,state){var _state$context$locale,_state$context$userAg,_getAppStateForMetada,_state$source$value$i,_state$source$value,_state$session$sessio,_state$session$sessio2,_state$autoTrack$page,_state$autoTrack;return {notifier:{name:NOTIFIER_NAME,version:state.context.app.value.version,url:SDK_GITHUB_URL},events:[{payloadVersion:'5',exceptions:clone(payload.errors),severity:errorState.severity,unhandled:errorState.unhandled,severityReason:errorState.severityReason,app:{version:state.context.app.value.version,releaseStage:getReleaseStage()},device:{locale:(_state$context$locale=state.context.locale.value)!==null&&_state$context$locale!==void 0?_state$context$locale:undefined,userAgent:(_state$context$userAg=state.context.userAgent.value)!==null&&_state$context$userAg!==void 0?_state$context$userAg:undefined,time:new Date()},request:{url:getURLWithoutQueryString(),clientIp:'[NOT COLLECTED]'},breadcrumbs:clone(state.reporting.breadcrumbs.value),context:getErrorContext(payload.errors[0]),metaData:{sdk:{name:'JS',installType:state.context.app.value.installType},state:(_getAppStateForMetada=getAppStateForMetadata(state))!==null&&_getAppStateForMetada!==void 0?_getAppStateForMetada:{},source:{snippetVersion:globalThis.RudderSnippetVersion}},user:{// Combination of source, session and visit ids
|
1750
|
+
id:"".concat((_state$source$value$i=(_state$source$value=state.source.value)===null||_state$source$value===void 0?void 0:_state$source$value.id)!==null&&_state$source$value$i!==void 0?_state$source$value$i:state.lifecycle.writeKey.value,"..").concat((_state$session$sessio=(_state$session$sessio2=state.session.sessionInfo.value)===null||_state$session$sessio2===void 0?void 0:_state$session$sessio2.id)!==null&&_state$session$sessio!==void 0?_state$session$sessio:'NA',"..").concat((_state$autoTrack$page=(_state$autoTrack=state.autoTrack)===null||_state$autoTrack===void 0||(_state$autoTrack=_state$autoTrack.pageLifecycle)===null||_state$autoTrack===void 0||(_state$autoTrack=_state$autoTrack.visitId)===null||_state$autoTrack===void 0?void 0:_state$autoTrack.value)!==null&&_state$autoTrack$page!==void 0?_state$autoTrack$page:'NA')}}]};};/**
|
1751
1751
|
* A function to determine whether the error should be promoted to notify or not
|
1752
1752
|
* @param {Error} error
|
1753
1753
|
* @returns
|
@@ -419,7 +419,7 @@ const getFormattedTimestamp=date=>date.toISOString();/**
|
|
419
419
|
* @returns ISO formatted timestamp string
|
420
420
|
*/const getCurrentTimeFormatted=()=>getFormattedTimestamp(new Date());
|
421
421
|
|
422
|
-
const LOG_CONTEXT_SEPARATOR=':: ';const SCRIPT_ALREADY_EXISTS_ERROR=id=>`A script with the id "${id}" is already loaded. Skipping the loading of this script to prevent conflicts.`;const SCRIPT_LOAD_ERROR=(id,url)=>`Failed to load the script with the id "${id}" from URL "${url}".`;const SCRIPT_LOAD_TIMEOUT_ERROR=(id,url,timeout)=>`A timeout of ${timeout} ms occurred while trying to load the script with id "${id}" from URL "${url}".`;const CIRCULAR_REFERENCE_WARNING=(context,key)=>`${context}${LOG_CONTEXT_SEPARATOR}A circular reference has been detected in the object and the property "${key}" has been dropped from the output.`;const JSON_STRINGIFY_WARNING=`Failed to convert the value to a JSON string.`;
|
422
|
+
const LOG_CONTEXT_SEPARATOR=':: ';const SCRIPT_ALREADY_EXISTS_ERROR=id=>`A script with the id "${id}" is already loaded. Skipping the loading of this script to prevent conflicts.`;const SCRIPT_LOAD_ERROR=(id,url)=>`Failed to load the script with the id "${id}" from URL "${url}".`;const SCRIPT_LOAD_TIMEOUT_ERROR=(id,url,timeout)=>`A timeout of ${timeout} ms occurred while trying to load the script with id "${id}" from URL "${url}".`;const CIRCULAR_REFERENCE_WARNING=(context,key)=>`${context}${LOG_CONTEXT_SEPARATOR}A circular reference has been detected in the object and the property "${key}" has been dropped from the output.`;const JSON_STRINGIFY_WARNING=`Failed to convert the value to a JSON string.`;const COOKIE_DATA_ENCODING_ERROR=`Failed to encode the cookie data.`;
|
423
423
|
|
424
424
|
const JSON_STRINGIFY='JSONStringify';const BIG_INT_PLACEHOLDER='[BigInt]';const CIRCULAR_REFERENCE_PLACEHOLDER='[Circular Reference]';const getCircularReplacer=(excludeNull,excludeKeys,logger)=>{const ancestors=[];// Here we do not want to use arrow function to use "this" in function context
|
425
425
|
// eslint-disable-next-line func-names
|
@@ -463,7 +463,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
|
463
463
|
* @returns Instance of Error with message prepended with issue
|
464
464
|
*/const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
|
465
465
|
|
466
|
-
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.
|
466
|
+
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.16';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
467
467
|
|
468
468
|
const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
469
469
|
|
@@ -714,10 +714,6 @@ new URL(url);}return URL_PATTERN.test(url);}catch(e){return false;}};
|
|
714
714
|
const isErrRetryable=details=>{let isRetryableNWFailure=false;if(details?.error&&details?.xhr){const xhrStatus=details.xhr.status;// same as in v1.1
|
715
715
|
isRetryableNWFailure=xhrStatus===429||xhrStatus>=500&&xhrStatus<600;}return isRetryableNWFailure;};
|
716
716
|
|
717
|
-
const userIdKey='rl_user_id';const userTraitsKey='rl_trait';const anonymousUserIdKey='rl_anonymous_id';const groupIdKey='rl_group_id';const groupTraitsKey='rl_group_trait';const pageInitialReferrerKey='rl_page_init_referrer';const pageInitialReferringDomainKey='rl_page_init_referring_domain';const sessionInfoKey='rl_session';const authTokenKey='rl_auth_token';const COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};const ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
718
|
-
|
719
|
-
const COOKIE_DATA_ENCODING_ERROR=`Failed to encode the cookie data.`;
|
720
|
-
|
721
717
|
/**
|
722
718
|
* Encode.
|
723
719
|
*/const encode=(value,logger)=>{try{return encodeURIComponent(value);}catch(err){logger?.error(COOKIE_DATA_ENCODING_ERROR,err);return undefined;}};/**
|
@@ -737,6 +733,8 @@ pairs.forEach(pairItem=>{pair=pairItem.split('=');const keyName=pair[0]?decode$1
|
|
737
733
|
*/// eslint-disable-next-line func-names
|
738
734
|
const cookie=function(name,value,options,logger){switch(arguments.length){case 4:case 3:case 2:return set(name,value,options,logger);case 1:if(name){return get(name);}return all();default:return all();}};
|
739
735
|
|
736
|
+
const userIdKey='rl_user_id';const userTraitsKey='rl_trait';const anonymousUserIdKey='rl_anonymous_id';const groupIdKey='rl_group_id';const groupTraitsKey='rl_group_trait';const pageInitialReferrerKey='rl_page_init_referrer';const pageInitialReferringDomainKey='rl_page_init_referring_domain';const sessionInfoKey='rl_session';const authTokenKey='rl_auth_token';const COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};const ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
737
|
+
|
740
738
|
const encryptBrowser=value=>`${ENCRYPTION_PREFIX_V3}${toBase64(value)}`;const decryptBrowser=value=>{if(value?.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};
|
741
739
|
|
742
740
|
const EVENT_PAYLOAD_SIZE_BYTES_LIMIT=32*1024;// 32 KB
|
@@ -930,7 +928,8 @@ if(!isRudderSDKError$1(event)){return false;}enhanceErrorEventMutator(state,even
|
|
930
928
|
return false;}};const getReleaseStage$1=()=>{const host=globalThis.location.hostname;return host&&DEV_HOSTS$1.includes(host)?'development':'production';};const getGlobalBugsnagLibInstance=()=>globalThis[BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME];const getNewClient=(state,logger)=>{const globalBugsnagLibInstance=getGlobalBugsnagLibInstance();const clientConfig={apiKey:API_KEY,appVersion:state.context.app.value.version,metaData:{SDK:{name:'JS',installType:state.context.app.value.installType}},beforeSend:onError(state,logger),autoCaptureSessions:false,// auto capture sessions is disabled
|
931
929
|
collectUserIp:false,// collecting user's IP is disabled
|
932
930
|
// enabledBreadcrumbTypes: ['error', 'log', 'user'], // for v7 and above
|
933
|
-
maxEvents:100,maxBreadcrumbs:40,releaseStage:getReleaseStage$1(),user:{
|
931
|
+
maxEvents:100,maxBreadcrumbs:40,releaseStage:getReleaseStage$1(),user:{// Combination of source, session and visit ids
|
932
|
+
id:`${state.source.value?.id??state.lifecycle.writeKey.value}..${state.session.sessionInfo.value?.id??'NA'}..${state.autoTrack?.pageLifecycle?.visitId?.value??'NA'}`},logger,networkBreadcrumbsEnabled:false};const client=globalBugsnagLibInstance(clientConfig);return client;};const isApiKeyValid=apiKey=>{const isAPIKeyValid=!(apiKey.startsWith('{{')||apiKey.endsWith('}}')||apiKey.length===0);return isAPIKeyValid;};const loadBugsnagSDK=(externalSrcLoader,logger)=>{const isNotLoaded=GLOBAL_LIBRARY_OBJECT_NAMES.every(globalKeyName=>!globalThis[globalKeyName]);if(!isNotLoaded){return;}externalSrcLoader.loadJSFile({url:BUGSNAG_CDN_URL,id:ERROR_REPORT_PROVIDER_NAME_BUGSNAG,callback:id=>{if(!id){logger?.error(BUGSNAG_SDK_LOAD_ERROR(BUGSNAG_PLUGIN));}}});};const initBugsnagClient=(state,promiseResolve,promiseReject,logger,time=0)=>{const globalBugsnagLibInstance=getGlobalBugsnagLibInstance();if(typeof globalBugsnagLibInstance==='function'){if(isValidVersion(globalBugsnagLibInstance)){const client=getNewClient(state,logger);promiseResolve(client);}}else if(time>=MAX_WAIT_FOR_SDK_LOAD_MS){promiseReject(new Error(BUGSNAG_SDK_LOAD_TIMEOUT_ERROR(MAX_WAIT_FOR_SDK_LOAD_MS)));}else {// Try to initialize the client after a delay
|
934
933
|
globalThis.setTimeout(initBugsnagClient,SDK_LOAD_POLL_INTERVAL_MS,state,promiseResolve,promiseReject,logger,time+SDK_LOAD_POLL_INTERVAL_MS);}};
|
935
934
|
|
936
935
|
const pluginName$e='Bugsnag';const Bugsnag=()=>({name:pluginName$e,deps:[],initialize:state=>{state.plugins.loadedPlugins.value=[...state.plugins.loadedPlugins.value,pluginName$e];},errorReportingProvider:{init:(state,externalSrcLoader,logger)=>new Promise((resolve,reject)=>{// If API key token is not parsed or invalid, don't proceed to initialize the client
|
@@ -1179,7 +1178,8 @@ const NOTIFIER_NAME='RudderStack JavaScript SDK Error Notifier';const SDK_GITHUB
|
|
1179
1178
|
|
1180
1179
|
const getConfigForPayloadCreation=(err,errorType)=>{switch(errorType){case ErrorType.UNHANDLEDEXCEPTION:{const{error}=err;return {component:'unhandledException handler',normalizedError:error||err};}case ErrorType.UNHANDLEDREJECTION:{const error=err;return {component:'unhandledrejection handler',normalizedError:error.reason};}case ErrorType.HANDLEDEXCEPTION:default:return {component:'notify()',normalizedError:err};}};const createNewBreadcrumb=(message,metaData)=>({type:'manual',name:message,timestamp:new Date(),metaData:metaData??{}});const getReleaseStage=()=>{const host=globalThis.location.hostname;return host&&DEV_HOSTS.includes(host)?'development':'production';};const getAppStateForMetadata=state=>{const stateStr=stringifyWithoutCircular(state,false,APP_STATE_EXCLUDE_KEYS);return stateStr!==null?JSON.parse(stateStr):{};};const getURLWithoutQueryString=()=>{const url=globalThis.location.href.split('?');return url[0];};const getErrorContext=event=>{const{message}=event;let context=message;// Hack for easily grouping the script load errors
|
1181
1180
|
// on the dashboard
|
1182
|
-
if(message.includes('Error in loading a third-party script')){context='Script load failures';}return context;};const getBugsnagErrorEvent=(payload,errorState,state)=>({notifier:{name:NOTIFIER_NAME,version:state.context.app.value.version,url:SDK_GITHUB_URL},events:[{payloadVersion:'5',exceptions:clone(payload.errors),severity:errorState.severity,unhandled:errorState.unhandled,severityReason:errorState.severityReason,app:{version:state.context.app.value.version,releaseStage:getReleaseStage()},device:{locale:state.context.locale.value??undefined,userAgent:state.context.userAgent.value??undefined,time:new Date()},request:{url:getURLWithoutQueryString(),clientIp:'[NOT COLLECTED]'},breadcrumbs:clone(state.reporting.breadcrumbs.value),context:getErrorContext(payload.errors[0]),metaData:{sdk:{name:'JS',installType:state.context.app.value.installType},state:getAppStateForMetadata(state)??{},source:{snippetVersion:globalThis.RudderSnippetVersion}},user:{
|
1181
|
+
if(message.includes('Error in loading a third-party script')){context='Script load failures';}return context;};const getBugsnagErrorEvent=(payload,errorState,state)=>({notifier:{name:NOTIFIER_NAME,version:state.context.app.value.version,url:SDK_GITHUB_URL},events:[{payloadVersion:'5',exceptions:clone(payload.errors),severity:errorState.severity,unhandled:errorState.unhandled,severityReason:errorState.severityReason,app:{version:state.context.app.value.version,releaseStage:getReleaseStage()},device:{locale:state.context.locale.value??undefined,userAgent:state.context.userAgent.value??undefined,time:new Date()},request:{url:getURLWithoutQueryString(),clientIp:'[NOT COLLECTED]'},breadcrumbs:clone(state.reporting.breadcrumbs.value),context:getErrorContext(payload.errors[0]),metaData:{sdk:{name:'JS',installType:state.context.app.value.installType},state:getAppStateForMetadata(state)??{},source:{snippetVersion:globalThis.RudderSnippetVersion}},user:{// Combination of source, session and visit ids
|
1182
|
+
id:`${state.source.value?.id??state.lifecycle.writeKey.value}..${state.session.sessionInfo.value?.id??'NA'}..${state.autoTrack?.pageLifecycle?.visitId?.value??'NA'}`}}]});/**
|
1183
1183
|
* A function to determine whether the error should be promoted to notify or not
|
1184
1184
|
* @param {Error} error
|
1185
1185
|
* @returns
|
@@ -415,7 +415,7 @@ const getFormattedTimestamp=date=>date.toISOString();/**
|
|
415
415
|
* @returns ISO formatted timestamp string
|
416
416
|
*/const getCurrentTimeFormatted=()=>getFormattedTimestamp(new Date());
|
417
417
|
|
418
|
-
const LOG_CONTEXT_SEPARATOR=':: ';const SCRIPT_ALREADY_EXISTS_ERROR=id=>`A script with the id "${id}" is already loaded. Skipping the loading of this script to prevent conflicts.`;const SCRIPT_LOAD_ERROR=(id,url)=>`Failed to load the script with the id "${id}" from URL "${url}".`;const SCRIPT_LOAD_TIMEOUT_ERROR=(id,url,timeout)=>`A timeout of ${timeout} ms occurred while trying to load the script with id "${id}" from URL "${url}".`;const CIRCULAR_REFERENCE_WARNING=(context,key)=>`${context}${LOG_CONTEXT_SEPARATOR}A circular reference has been detected in the object and the property "${key}" has been dropped from the output.`;const JSON_STRINGIFY_WARNING=`Failed to convert the value to a JSON string.`;
|
418
|
+
const LOG_CONTEXT_SEPARATOR=':: ';const SCRIPT_ALREADY_EXISTS_ERROR=id=>`A script with the id "${id}" is already loaded. Skipping the loading of this script to prevent conflicts.`;const SCRIPT_LOAD_ERROR=(id,url)=>`Failed to load the script with the id "${id}" from URL "${url}".`;const SCRIPT_LOAD_TIMEOUT_ERROR=(id,url,timeout)=>`A timeout of ${timeout} ms occurred while trying to load the script with id "${id}" from URL "${url}".`;const CIRCULAR_REFERENCE_WARNING=(context,key)=>`${context}${LOG_CONTEXT_SEPARATOR}A circular reference has been detected in the object and the property "${key}" has been dropped from the output.`;const JSON_STRINGIFY_WARNING=`Failed to convert the value to a JSON string.`;const COOKIE_DATA_ENCODING_ERROR=`Failed to encode the cookie data.`;
|
419
419
|
|
420
420
|
const JSON_STRINGIFY='JSONStringify';const BIG_INT_PLACEHOLDER='[BigInt]';const CIRCULAR_REFERENCE_PLACEHOLDER='[Circular Reference]';const getCircularReplacer=(excludeNull,excludeKeys,logger)=>{const ancestors=[];// Here we do not want to use arrow function to use "this" in function context
|
421
421
|
// eslint-disable-next-line func-names
|
@@ -459,7 +459,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
|
459
459
|
* @returns Instance of Error with message prepended with issue
|
460
460
|
*/const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
|
461
461
|
|
462
|
-
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.
|
462
|
+
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.16';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
463
463
|
|
464
464
|
const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
465
465
|
|
@@ -710,10 +710,6 @@ new URL(url);}return URL_PATTERN.test(url);}catch(e){return false;}};
|
|
710
710
|
const isErrRetryable=details=>{let isRetryableNWFailure=false;if(details?.error&&details?.xhr){const xhrStatus=details.xhr.status;// same as in v1.1
|
711
711
|
isRetryableNWFailure=xhrStatus===429||xhrStatus>=500&&xhrStatus<600;}return isRetryableNWFailure;};
|
712
712
|
|
713
|
-
const userIdKey='rl_user_id';const userTraitsKey='rl_trait';const anonymousUserIdKey='rl_anonymous_id';const groupIdKey='rl_group_id';const groupTraitsKey='rl_group_trait';const pageInitialReferrerKey='rl_page_init_referrer';const pageInitialReferringDomainKey='rl_page_init_referring_domain';const sessionInfoKey='rl_session';const authTokenKey='rl_auth_token';const COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};const ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
714
|
-
|
715
|
-
const COOKIE_DATA_ENCODING_ERROR=`Failed to encode the cookie data.`;
|
716
|
-
|
717
713
|
/**
|
718
714
|
* Encode.
|
719
715
|
*/const encode=(value,logger)=>{try{return encodeURIComponent(value);}catch(err){logger?.error(COOKIE_DATA_ENCODING_ERROR,err);return undefined;}};/**
|
@@ -733,6 +729,8 @@ pairs.forEach(pairItem=>{pair=pairItem.split('=');const keyName=pair[0]?decode$1
|
|
733
729
|
*/// eslint-disable-next-line func-names
|
734
730
|
const cookie=function(name,value,options,logger){switch(arguments.length){case 4:case 3:case 2:return set(name,value,options,logger);case 1:if(name){return get(name);}return all();default:return all();}};
|
735
731
|
|
732
|
+
const userIdKey='rl_user_id';const userTraitsKey='rl_trait';const anonymousUserIdKey='rl_anonymous_id';const groupIdKey='rl_group_id';const groupTraitsKey='rl_group_trait';const pageInitialReferrerKey='rl_page_init_referrer';const pageInitialReferringDomainKey='rl_page_init_referring_domain';const sessionInfoKey='rl_session';const authTokenKey='rl_auth_token';const COOKIE_KEYS={userId:userIdKey,userTraits:userTraitsKey,anonymousId:anonymousUserIdKey,groupId:groupIdKey,groupTraits:groupTraitsKey,initialReferrer:pageInitialReferrerKey,initialReferringDomain:pageInitialReferringDomainKey,sessionInfo:sessionInfoKey,authToken:authTokenKey};const ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
733
|
+
|
736
734
|
const encryptBrowser=value=>`${ENCRYPTION_PREFIX_V3}${toBase64(value)}`;const decryptBrowser=value=>{if(value?.startsWith(ENCRYPTION_PREFIX_V3)){return fromBase64(value.substring(ENCRYPTION_PREFIX_V3.length));}return value;};
|
737
735
|
|
738
736
|
const EVENT_PAYLOAD_SIZE_BYTES_LIMIT=32*1024;// 32 KB
|
@@ -926,7 +924,8 @@ if(!isRudderSDKError$1(event)){return false;}enhanceErrorEventMutator(state,even
|
|
926
924
|
return false;}};const getReleaseStage$1=()=>{const host=globalThis.location.hostname;return host&&DEV_HOSTS$1.includes(host)?'development':'production';};const getGlobalBugsnagLibInstance=()=>globalThis[BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME];const getNewClient=(state,logger)=>{const globalBugsnagLibInstance=getGlobalBugsnagLibInstance();const clientConfig={apiKey:API_KEY,appVersion:state.context.app.value.version,metaData:{SDK:{name:'JS',installType:state.context.app.value.installType}},beforeSend:onError(state,logger),autoCaptureSessions:false,// auto capture sessions is disabled
|
927
925
|
collectUserIp:false,// collecting user's IP is disabled
|
928
926
|
// enabledBreadcrumbTypes: ['error', 'log', 'user'], // for v7 and above
|
929
|
-
maxEvents:100,maxBreadcrumbs:40,releaseStage:getReleaseStage$1(),user:{
|
927
|
+
maxEvents:100,maxBreadcrumbs:40,releaseStage:getReleaseStage$1(),user:{// Combination of source, session and visit ids
|
928
|
+
id:`${state.source.value?.id??state.lifecycle.writeKey.value}..${state.session.sessionInfo.value?.id??'NA'}..${state.autoTrack?.pageLifecycle?.visitId?.value??'NA'}`},logger,networkBreadcrumbsEnabled:false};const client=globalBugsnagLibInstance(clientConfig);return client;};const isApiKeyValid=apiKey=>{const isAPIKeyValid=!(apiKey.startsWith('{{')||apiKey.endsWith('}}')||apiKey.length===0);return isAPIKeyValid;};const loadBugsnagSDK=(externalSrcLoader,logger)=>{const isNotLoaded=GLOBAL_LIBRARY_OBJECT_NAMES.every(globalKeyName=>!globalThis[globalKeyName]);if(!isNotLoaded){return;}externalSrcLoader.loadJSFile({url:BUGSNAG_CDN_URL,id:ERROR_REPORT_PROVIDER_NAME_BUGSNAG,callback:id=>{if(!id){logger?.error(BUGSNAG_SDK_LOAD_ERROR(BUGSNAG_PLUGIN));}}});};const initBugsnagClient=(state,promiseResolve,promiseReject,logger,time=0)=>{const globalBugsnagLibInstance=getGlobalBugsnagLibInstance();if(typeof globalBugsnagLibInstance==='function'){if(isValidVersion(globalBugsnagLibInstance)){const client=getNewClient(state,logger);promiseResolve(client);}}else if(time>=MAX_WAIT_FOR_SDK_LOAD_MS){promiseReject(new Error(BUGSNAG_SDK_LOAD_TIMEOUT_ERROR(MAX_WAIT_FOR_SDK_LOAD_MS)));}else {// Try to initialize the client after a delay
|
930
929
|
globalThis.setTimeout(initBugsnagClient,SDK_LOAD_POLL_INTERVAL_MS,state,promiseResolve,promiseReject,logger,time+SDK_LOAD_POLL_INTERVAL_MS);}};
|
931
930
|
|
932
931
|
const pluginName$e='Bugsnag';const Bugsnag=()=>({name:pluginName$e,deps:[],initialize:state=>{state.plugins.loadedPlugins.value=[...state.plugins.loadedPlugins.value,pluginName$e];},errorReportingProvider:{init:(state,externalSrcLoader,logger)=>new Promise((resolve,reject)=>{// If API key token is not parsed or invalid, don't proceed to initialize the client
|
@@ -1175,7 +1174,8 @@ const NOTIFIER_NAME='RudderStack JavaScript SDK Error Notifier';const SDK_GITHUB
|
|
1175
1174
|
|
1176
1175
|
const getConfigForPayloadCreation=(err,errorType)=>{switch(errorType){case ErrorType.UNHANDLEDEXCEPTION:{const{error}=err;return {component:'unhandledException handler',normalizedError:error||err};}case ErrorType.UNHANDLEDREJECTION:{const error=err;return {component:'unhandledrejection handler',normalizedError:error.reason};}case ErrorType.HANDLEDEXCEPTION:default:return {component:'notify()',normalizedError:err};}};const createNewBreadcrumb=(message,metaData)=>({type:'manual',name:message,timestamp:new Date(),metaData:metaData??{}});const getReleaseStage=()=>{const host=globalThis.location.hostname;return host&&DEV_HOSTS.includes(host)?'development':'production';};const getAppStateForMetadata=state=>{const stateStr=stringifyWithoutCircular(state,false,APP_STATE_EXCLUDE_KEYS);return stateStr!==null?JSON.parse(stateStr):{};};const getURLWithoutQueryString=()=>{const url=globalThis.location.href.split('?');return url[0];};const getErrorContext=event=>{const{message}=event;let context=message;// Hack for easily grouping the script load errors
|
1177
1176
|
// on the dashboard
|
1178
|
-
if(message.includes('Error in loading a third-party script')){context='Script load failures';}return context;};const getBugsnagErrorEvent=(payload,errorState,state)=>({notifier:{name:NOTIFIER_NAME,version:state.context.app.value.version,url:SDK_GITHUB_URL},events:[{payloadVersion:'5',exceptions:clone(payload.errors),severity:errorState.severity,unhandled:errorState.unhandled,severityReason:errorState.severityReason,app:{version:state.context.app.value.version,releaseStage:getReleaseStage()},device:{locale:state.context.locale.value??undefined,userAgent:state.context.userAgent.value??undefined,time:new Date()},request:{url:getURLWithoutQueryString(),clientIp:'[NOT COLLECTED]'},breadcrumbs:clone(state.reporting.breadcrumbs.value),context:getErrorContext(payload.errors[0]),metaData:{sdk:{name:'JS',installType:state.context.app.value.installType},state:getAppStateForMetadata(state)??{},source:{snippetVersion:globalThis.RudderSnippetVersion}},user:{
|
1177
|
+
if(message.includes('Error in loading a third-party script')){context='Script load failures';}return context;};const getBugsnagErrorEvent=(payload,errorState,state)=>({notifier:{name:NOTIFIER_NAME,version:state.context.app.value.version,url:SDK_GITHUB_URL},events:[{payloadVersion:'5',exceptions:clone(payload.errors),severity:errorState.severity,unhandled:errorState.unhandled,severityReason:errorState.severityReason,app:{version:state.context.app.value.version,releaseStage:getReleaseStage()},device:{locale:state.context.locale.value??undefined,userAgent:state.context.userAgent.value??undefined,time:new Date()},request:{url:getURLWithoutQueryString(),clientIp:'[NOT COLLECTED]'},breadcrumbs:clone(state.reporting.breadcrumbs.value),context:getErrorContext(payload.errors[0]),metaData:{sdk:{name:'JS',installType:state.context.app.value.installType},state:getAppStateForMetadata(state)??{},source:{snippetVersion:globalThis.RudderSnippetVersion}},user:{// Combination of source, session and visit ids
|
1178
|
+
id:`${state.source.value?.id??state.lifecycle.writeKey.value}..${state.session.sessionInfo.value?.id??'NA'}..${state.autoTrack?.pageLifecycle?.visitId?.value??'NA'}`}}]});/**
|
1179
1179
|
* A function to determine whether the error should be promoted to notify or not
|
1180
1180
|
* @param {Error} error
|
1181
1181
|
* @returns
|