@rudderstack/analytics-js 3.7.5 → 3.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -936,7 +936,7 @@
936
936
 
937
937
  var CAPABILITIES_MANAGER='CapabilitiesManager';var CONFIG_MANAGER='ConfigManager';var EVENT_MANAGER='EventManager';var PLUGINS_MANAGER='PluginsManager';var USER_SESSION_MANAGER='UserSessionManager';var ERROR_HANDLER='ErrorHandler';var PLUGIN_ENGINE='PluginEngine';var STORE_MANAGER='StoreManager';var READY_API='readyApi';var EVENT_REPOSITORY='EventRepository';var EXTERNAL_SRC_LOADER='ExternalSrcLoader';var HTTP_CLIENT='HttpClient';var RS_APP='RudderStackApplication';var ANALYTICS_CORE='AnalyticsCore';
938
938
 
939
- var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.7.5';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';
939
+ var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.7.7';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';
940
940
 
941
941
  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';
942
942
 
@@ -1141,35 +1141,14 @@
1141
1141
  extensionPointName=extensionPointName.replace(/(^!|!$)/g,'');if(!extensionPointName){throw new Error(PLUGIN_EXT_POINT_INVALID_ERROR);}var extensionPointNameParts=extensionPointName.split('.');extensionPointNameParts.pop();var pluginMethodPath=extensionPointNameParts.join('.');var pluginsToInvoke=allowMultiple?this.getPlugins(extensionPointName):[this.getPlugins(extensionPointName)[0]];return pluginsToInvoke.map(function(plugin){var method=getValueByPath(plugin,extensionPointName);if(!isFunction(method)||noCall){return method;}try{return method.apply(getValueByPath(plugin,pluginMethodPath),args);}catch(err){// When a plugin failed, doesn't break the app
1142
1142
  if(throws){throw err;}else {var _this2$logger;(_this2$logger=_this2.logger)===null||_this2$logger===void 0||_this2$logger.error(PLUGIN_INVOCATION_ERROR(PLUGIN_ENGINE,extensionPointName,plugin.name),err);}}return null;});}},{key:"invokeSingle",value:function invokeSingle(extPoint){for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}return this.invoke.apply(this,[extPoint,false].concat(args))[0];}},{key:"invokeMultiple",value:function invokeMultiple(extPoint){for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3];}return this.invoke.apply(this,[extPoint,true].concat(args));}}]);}();var defaultPluginEngine=new PluginEngine({throws:true},defaultLogger);
1143
1143
 
1144
- var FAILED_REQUEST_ERR_MSG_PREFIX='The request failed';var UNHANDLEDEXCEPTION_FOR_NON_ERROR_OBJECT='unhandledException handler received a non-error';var ERROR_MESSAGES_TO_BE_FILTERED=[FAILED_REQUEST_ERR_MSG_PREFIX,UNHANDLEDEXCEPTION_FOR_NON_ERROR_OBJECT];
1144
+ var LOAD_ORIGIN='RS_JS_SDK';
1145
1145
 
1146
1146
  /**
1147
1147
  * Utility method to normalise errors
1148
1148
  */var processError=function processError(error){var errorMessage;try{if(isString(error)){errorMessage=error;}else if(error instanceof Error){errorMessage=error.message;}else if(error instanceof ErrorEvent){errorMessage=error.message;}else {errorMessage=error.message?error.message:stringifyWithoutCircular(error);}}catch(e){errorMessage="Unknown error: ".concat(e.message);}return errorMessage;};var getNormalizedErrorForUnhandledError=function getNormalizedErrorForUnhandledError(error){try{if(error instanceof Error||error instanceof ErrorEvent||error instanceof PromiseRejectionEvent&&error.reason){return error;}// TODO: remove this block once all device mode integrations start using the v3 script loader module (TS)
1149
- // if (error instanceof Event) {
1150
- // const eventTarget = error.target as ErrorTarget;
1151
- // // Discard all the non-script loading errors
1152
- // if (eventTarget && eventTarget.localName !== 'script') {
1153
- // return undefined;
1154
- // }
1155
- // // Discard script errors that are not originated at SDK or from native SDKs
1156
- // if (
1157
- // eventTarget?.dataset &&
1158
- // (eventTarget.dataset.loader !== LOAD_ORIGIN ||
1159
- // eventTarget.dataset.isnonnativesdk !== 'true')
1160
- // ) {
1161
- // return undefined;
1162
- // }
1163
- // const errorMessage = `Error in loading a third-party script from URL ${eventTarget?.src} with ID ${eventTarget?.id}.`;
1164
- // return Object.create(error, {
1165
- // message: { value: errorMessage },
1166
- // });
1167
- // }
1168
- return undefined;}catch(e){return e;}};/**
1169
- * A function to determine whether the error should be promoted to notify or not
1170
- * @param {Error} error
1171
- * @returns
1172
- */var isAllowedToBeNotified=function isAllowedToBeNotified(error){if((error instanceof Error||error instanceof ErrorEvent)&&error.message){return !ERROR_MESSAGES_TO_BE_FILTERED.some(function(e){return error.message.includes(e);});}if(error instanceof PromiseRejectionEvent&&typeof error.reason==='string'){return !ERROR_MESSAGES_TO_BE_FILTERED.some(function(e){return error.reason.includes(e);});}return true;};
1149
+ if(error instanceof Event){var eventTarget=error.target;// Discard all the non-script loading errors
1150
+ if(eventTarget&&eventTarget.localName!=='script'){return undefined;}// Discard script errors that are not originated at SDK or from native SDKs
1151
+ if(eventTarget!==null&&eventTarget!==void 0&&eventTarget.dataset&&(eventTarget.dataset.loader!==LOAD_ORIGIN||eventTarget.dataset.isnonnativesdk!=='true')){return undefined;}var errorMessage="Error in loading a third-party script from URL ".concat(eventTarget===null||eventTarget===void 0?void 0:eventTarget.src," with ID ").concat(eventTarget===null||eventTarget===void 0?void 0:eventTarget.id,".");return Object.create(error,{message:{value:errorMessage}});}return error;}catch(e){return e;}};
1173
1152
 
1174
1153
  /**
1175
1154
  * A service to handle errors
@@ -1190,7 +1169,7 @@
1190
1169
  * Send handled errors to external error monitoring service via a plugin
1191
1170
  *
1192
1171
  * @param {Error} error Error instance from handled error
1193
- */},{key:"notifyError",value:function notifyError(error,errorState){if(this.pluginEngine&&this.httpClient&&isAllowedToBeNotified(error)){try{this.pluginEngine.invokeSingle('errorReporting.notify',this.pluginEngine,// deprecated parameter
1172
+ */},{key:"notifyError",value:function notifyError(error,errorState){if(this.pluginEngine&&this.httpClient){try{this.pluginEngine.invokeSingle('errorReporting.notify',this.pluginEngine,// deprecated parameter
1194
1173
  this.errReportingClient,// deprecated parameter
1195
1174
  error,state,this.logger,this.httpClient,errorState);}catch(err){var _this$logger3;// Not calling onError here as we don't want to go into infinite loop
1196
1175
  (_this$logger3=this.logger)===null||_this$logger3===void 0||_this$logger3.error(NOTIFY_FAILURE_ERROR(ERROR_HANDLER),err);}}}}]);}();var defaultErrorHandler=new ErrorHandler(defaultLogger,defaultPluginEngine);
@@ -1453,37 +1432,39 @@
1453
1432
  // the configured resolution strategy
1454
1433
  var matchPredicate=function matchPredicate(consent){return allowedConsentIds.includes(consent);};switch(resolutionStrategy){case'or':return configuredConsents.some(matchPredicate)||configuredConsents.length===0;case'and':default:return configuredConsents.every(matchPredicate);}}catch(err){errorHandler===null||errorHandler===void 0||errorHandler.onError(err,CUSTOM_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR$2);return true;}}}};};
1455
1434
 
1456
- var DIR_NAME$1d='AdobeAnalytics';var NAME$1d='ADOBE_ANALYTICS';var DISPLAY_NAME$1d='Adobe Analytics';_defineProperty({},DISPLAY_NAME$1d,DIR_NAME$1d);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({'Adobe Analytics':NAME$1d,ADOBEANALYTICS:NAME$1d,'ADOBE ANALYTICS':NAME$1d},NAME$1d,NAME$1d),"AdobeAnalytics",NAME$1d),"adobeanalytics",NAME$1d),'adobe analytics',NAME$1d),'Adobe analytics',NAME$1d),'adobe Analytics',NAME$1d);
1435
+ var DIR_NAME$1e='AdobeAnalytics';var NAME$1e='ADOBE_ANALYTICS';var DISPLAY_NAME$1e='Adobe Analytics';_defineProperty({},DISPLAY_NAME$1e,DIR_NAME$1e);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({'Adobe Analytics':NAME$1e,ADOBEANALYTICS:NAME$1e,'ADOBE ANALYTICS':NAME$1e},NAME$1e,NAME$1e),"AdobeAnalytics",NAME$1e),"adobeanalytics",NAME$1e),'adobe analytics',NAME$1e),'Adobe analytics',NAME$1e),'adobe Analytics',NAME$1e);
1436
+
1437
+ var DIR_NAME$1d='Amplitude';var NAME$1d='AM';var DISPLAY_NAME$1d='Amplitude';_defineProperty({},DISPLAY_NAME$1d,DIR_NAME$1d);_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$1d,NAME$1d),"AMPLITUDE",NAME$1d),"Amplitude",NAME$1d),"am",NAME$1d);
1457
1438
 
1458
- var DIR_NAME$1c='Amplitude';var NAME$1c='AM';var DISPLAY_NAME$1c='Amplitude';_defineProperty({},DISPLAY_NAME$1c,DIR_NAME$1c);_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$1c,NAME$1c),"AMPLITUDE",NAME$1c),"Amplitude",NAME$1c),"am",NAME$1c);
1439
+ var DIR_NAME$1c='Appcues';var NAME$1c='APPCUES';var DISPLAY_NAME$1c='Appcues';_defineProperty({},DISPLAY_NAME$1c,DIR_NAME$1c);_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$1c,NAME$1c),"Appcues",NAME$1c),'App Cues',NAME$1c),"appcues",NAME$1c);
1459
1440
 
1460
- var DIR_NAME$1b='Appcues';var NAME$1b='APPCUES';var DISPLAY_NAME$1b='Appcues';_defineProperty({},DISPLAY_NAME$1b,DIR_NAME$1b);_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$1b,NAME$1b),"Appcues",NAME$1b),'App Cues',NAME$1b),"appcues",NAME$1b);
1441
+ var DIR_NAME$1b='BingAds';var NAME$1b='BINGADS';var DISPLAY_NAME$1b='Bing Ads';_defineProperty({},DISPLAY_NAME$1b,DIR_NAME$1b);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$1b,NAME$1b),"BingAds",NAME$1b),"bingads",NAME$1b),'Bing Ads',NAME$1b),'Bing ads',NAME$1b),'bing Ads',NAME$1b),'bing ads',NAME$1b);
1461
1442
 
1462
- var DIR_NAME$1a='BingAds';var NAME$1a='BINGADS';var DISPLAY_NAME$1a='Bing Ads';_defineProperty({},DISPLAY_NAME$1a,DIR_NAME$1a);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$1a,NAME$1a),"BingAds",NAME$1a),"bingads",NAME$1a),'Bing Ads',NAME$1a),'Bing ads',NAME$1a),'bing Ads',NAME$1a),'bing ads',NAME$1a);
1443
+ var DIR_NAME$1a='Braze';var NAME$1a='BRAZE';var DISPLAY_NAME$1a='Braze';_defineProperty({},DISPLAY_NAME$1a,DIR_NAME$1a);_defineProperty(_defineProperty(_defineProperty({},NAME$1a,NAME$1a),"Braze",NAME$1a),"braze",NAME$1a);
1463
1444
 
1464
- var DIR_NAME$19='Braze';var NAME$19='BRAZE';var DISPLAY_NAME$19='Braze';_defineProperty({},DISPLAY_NAME$19,DIR_NAME$19);_defineProperty(_defineProperty(_defineProperty({},NAME$19,NAME$19),"Braze",NAME$19),"braze",NAME$19);
1445
+ var DIR_NAME$19='Bugsnag';var NAME$19='BUGSNAG';var DISPLAY_NAME$19='Bugsnag';_defineProperty({},DISPLAY_NAME$19,DIR_NAME$19);_defineProperty(_defineProperty(_defineProperty({},NAME$19,NAME$19),"bugsnag",NAME$19),"Bugsnag",NAME$19);
1465
1446
 
1466
- var DIR_NAME$18='Bugsnag';var NAME$18='BUGSNAG';var DISPLAY_NAME$18='Bugsnag';_defineProperty({},DISPLAY_NAME$18,DIR_NAME$18);_defineProperty(_defineProperty(_defineProperty({},NAME$18,NAME$18),"bugsnag",NAME$18),"Bugsnag",NAME$18);
1447
+ var DIR_NAME$18='Chartbeat';var NAME$18='CHARTBEAT';var DISPLAY_NAME$18='Chartbeat';_defineProperty({},DISPLAY_NAME$18,DIR_NAME$18);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$18,NAME$18),"Chartbeat",NAME$18),"chartbeat",NAME$18),'Chart Beat',NAME$18),'chart beat',NAME$18);
1467
1448
 
1468
- var DIR_NAME$17='Chartbeat';var NAME$17='CHARTBEAT';var DISPLAY_NAME$17='Chartbeat';_defineProperty({},DISPLAY_NAME$17,DIR_NAME$17);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$17,NAME$17),"Chartbeat",NAME$17),"chartbeat",NAME$17),'Chart Beat',NAME$17),'chart beat',NAME$17);
1449
+ var DIR_NAME$17='Clevertap';var NAME$17='CLEVERTAP';var DISPLAY_NAME$17='CleverTap';_defineProperty({},DISPLAY_NAME$17,DIR_NAME$17);_defineProperty(_defineProperty(_defineProperty({},NAME$17,NAME$17),"Clevertap",NAME$17),"clevertap",NAME$17);
1469
1450
 
1470
- var DIR_NAME$16='Clevertap';var NAME$16='CLEVERTAP';var DISPLAY_NAME$16='CleverTap';_defineProperty({},DISPLAY_NAME$16,DIR_NAME$16);_defineProperty(_defineProperty(_defineProperty({},NAME$16,NAME$16),"Clevertap",NAME$16),"clevertap",NAME$16);
1451
+ var DIR_NAME$16='Comscore';var NAME$16='COMSCORE';var DISPLAY_NAME$16='Comscore';_defineProperty({},DISPLAY_NAME$16,DIR_NAME$16);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$16,NAME$16),"Comscore",NAME$16),'Com Score',NAME$16),'com Score',NAME$16),'com score',NAME$16),'Com score',NAME$16);
1471
1452
 
1472
- var DIR_NAME$15='Comscore';var NAME$15='COMSCORE';var DISPLAY_NAME$15='Comscore';_defineProperty({},DISPLAY_NAME$15,DIR_NAME$15);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$15,NAME$15),"Comscore",NAME$15),'Com Score',NAME$15),'com Score',NAME$15),'com score',NAME$15),'Com score',NAME$15);
1453
+ var DIR_NAME$15='Criteo';var NAME$15='CRITEO';var DISPLAY_NAME$15='Criteo';_defineProperty({},DISPLAY_NAME$15,DIR_NAME$15);_defineProperty(_defineProperty(_defineProperty({},NAME$15,NAME$15),"Criteo",NAME$15),"criteo",NAME$15);
1473
1454
 
1474
- var DIR_NAME$14='Criteo';var NAME$14='CRITEO';var DISPLAY_NAME$14='Criteo';_defineProperty({},DISPLAY_NAME$14,DIR_NAME$14);_defineProperty(_defineProperty(_defineProperty({},NAME$14,NAME$14),"Criteo",NAME$14),"criteo",NAME$14);
1455
+ var DIR_NAME$14='CustomerIO';var NAME$14='CUSTOMERIO';var DISPLAY_NAME$14='Customer IO';_defineProperty({},DISPLAY_NAME$14,DIR_NAME$14);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$14,NAME$14),"Customerio",NAME$14),'Customer.io',NAME$14),'CUSTOMER.IO',NAME$14),'customer.io',NAME$14);
1475
1456
 
1476
- var DIR_NAME$13='CustomerIO';var NAME$13='CUSTOMERIO';var DISPLAY_NAME$13='Customer IO';_defineProperty({},DISPLAY_NAME$13,DIR_NAME$13);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$13,NAME$13),"Customerio",NAME$13),'Customer.io',NAME$13),'CUSTOMER.IO',NAME$13),'customer.io',NAME$13);
1457
+ var DIR_NAME$13='Drip';var NAME$13='DRIP';var DISPLAY_NAME$13='Drip';_defineProperty({},DISPLAY_NAME$13,DIR_NAME$13);_defineProperty(_defineProperty(_defineProperty({},NAME$13,NAME$13),"Drip",NAME$13),"drip",NAME$13);
1477
1458
 
1478
- var DIR_NAME$12='Drip';var NAME$12='DRIP';var DISPLAY_NAME$12='Drip';_defineProperty({},DISPLAY_NAME$12,DIR_NAME$12);_defineProperty(_defineProperty(_defineProperty({},NAME$12,NAME$12),"Drip",NAME$12),"drip",NAME$12);
1459
+ var DIR_NAME$12='FacebookPixel';var NAME$12='FACEBOOK_PIXEL';var DISPLAY_NAME$12='Facebook Pixel';_defineProperty({},DISPLAY_NAME$12,DIR_NAME$12);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$12,NAME$12),'FB Pixel',NAME$12),'Facebook Pixel',NAME$12),'facebook pixel',NAME$12),"fbpixel",NAME$12),"FBPIXEL",NAME$12),"FB_PIXEL",NAME$12);
1479
1460
 
1480
- var DIR_NAME$11='FacebookPixel';var NAME$11='FACEBOOK_PIXEL';var DISPLAY_NAME$11='Facebook Pixel';_defineProperty({},DISPLAY_NAME$11,DIR_NAME$11);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$11,NAME$11),'FB Pixel',NAME$11),'Facebook Pixel',NAME$11),'facebook pixel',NAME$11),"fbpixel",NAME$11),"FBPIXEL",NAME$11),"FB_PIXEL",NAME$11);
1461
+ var DIR_NAME$11='Fullstory';var NAME$11='FULLSTORY';var DISPLAY_NAME$11='Fullstory';_defineProperty({},DISPLAY_NAME$11,DIR_NAME$11);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$11,NAME$11),"Fullstory",NAME$11),"FullStory",NAME$11),'full Story',NAME$11),'Full Story',NAME$11),'Full story',NAME$11),'full story',NAME$11),"fullstory",NAME$11);
1481
1462
 
1482
- var DIR_NAME$10='Fullstory';var NAME$10='FULLSTORY';var DISPLAY_NAME$10='Fullstory';_defineProperty({},DISPLAY_NAME$10,DIR_NAME$10);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$10,NAME$10),"Fullstory",NAME$10),"FullStory",NAME$10),'full Story',NAME$10),'Full Story',NAME$10),'Full story',NAME$10),'full story',NAME$10),"fullstory",NAME$10);
1463
+ var DIR_NAME$10='GA';var NAME$10='GA';var DISPLAY_NAME$10='Google Analytics';_defineProperty({},DISPLAY_NAME$10,DIR_NAME$10);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$10,NAME$10),'Google Analytics',NAME$10),"GoogleAnalytics",NAME$10),'GOOGLE ANALYTICS',NAME$10),'google analytics',NAME$10);
1483
1464
 
1484
- var DIR_NAME$$='GA';var NAME$$='GA';var DISPLAY_NAME$$='Google Analytics';_defineProperty({},DISPLAY_NAME$$,DIR_NAME$$);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$$,NAME$$),'Google Analytics',NAME$$),"GoogleAnalytics",NAME$$),'GOOGLE ANALYTICS',NAME$$),'google analytics',NAME$$);
1465
+ var DIR_NAME$$='GA4';var NAME$$='GA4';var DISPLAY_NAME$$='Google Analytics 4 (GA4)';_defineProperty({},DISPLAY_NAME$$,DIR_NAME$$);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$$,NAME$$),'Google Analytics 4',NAME$$),'Google analytics 4',NAME$$),'google analytics 4',NAME$$),'Google Analytics4',NAME$$),'Google analytics4',NAME$$),'google analytics4',NAME$$),'Google Analytics 4 (GA4)',NAME$$),'google analytics 4 (ga4)',NAME$$),"GoogleAnalytics4",NAME$$);
1485
1466
 
1486
- var DIR_NAME$_='GA4';var NAME$_='GA4';var DISPLAY_NAME$_='Google Analytics 4 (GA4)';_defineProperty({},DISPLAY_NAME$_,DIR_NAME$_);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$_,NAME$_),'Google Analytics 4',NAME$_),'Google analytics 4',NAME$_),'google analytics 4',NAME$_),'Google Analytics4',NAME$_),'Google analytics4',NAME$_),'google analytics4',NAME$_),'Google Analytics 4 (GA4)',NAME$_),'google analytics 4 (ga4)',NAME$_),"GoogleAnalytics4",NAME$_);
1467
+ var DIR_NAME$_='GA4_V2';var NAME$_='GA4_V2';var DISPLAY_NAME$_='Google Analytics 4 (GA4) V2';_defineProperty({},DISPLAY_NAME$_,DIR_NAME$_);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$_,NAME$_),'Google Analytics 4 V2',NAME$_),'Google analytics 4 V2',NAME$_),'google analytics 4 V2',NAME$_),'Google Analytics4 V2',NAME$_),'Google analytics4 V2',NAME$_),'google analytics4 V2',NAME$_),'Google Analytics 4 (GA4) V2',NAME$_),'google analytics 4 (ga4) V2',NAME$_),"GoogleAnalytics4V2",NAME$_);
1487
1468
 
1488
1469
  var DIR_NAME$Z='GoogleAds';var NAME$Z='GOOGLEADS';var DISPLAY_NAME$Z='Google Ads';_defineProperty({},DISPLAY_NAME$Z,DIR_NAME$Z);_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME$Z,NAME$Z),'Google Ads',NAME$Z),"GoogleAds",NAME$Z),'GOOGLE ADS',NAME$Z),'google ads',NAME$Z),"googleads",NAME$Z);
1489
1470
 
@@ -1610,7 +1591,7 @@
1610
1591
  var DIR_NAME='Ninetailed';var NAME='NINETAILED';var DISPLAY_NAME='Ninetailed';_defineProperty({},DISPLAY_NAME,DIR_NAME);_defineProperty(_defineProperty(_defineProperty(_defineProperty({},NAME,NAME),"Ninetailed",NAME),"ninetailed",NAME),"NineTailed",NAME);
1611
1592
 
1612
1593
  var _destDisplayNamesToFi;// map of the destination display names to the destination directory names
1613
- var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$$,DIR_NAME$$),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$T,DIR_NAME$T),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$R,DIR_NAME$R),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$11,DIR_NAME$11),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$_,DIR_NAME$_),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1b,DIR_NAME$1b),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$H,DIR_NAME$H),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$1d,DIR_NAME$1d),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$E,DIR_NAME$E),DISPLAY_NAME$A,DIR_NAME$A),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$G,DIR_NAME$G),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$w,DIR_NAME$w),DISPLAY_NAME$v,DIR_NAME$v),DISPLAY_NAME$u,DIR_NAME$u),DISPLAY_NAME$t,DIR_NAME$t),DISPLAY_NAME$s,DIR_NAME$s),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,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),DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),DISPLAY_NAME$i,DIR_NAME$i),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,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),DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),DISPLAY_NAME$8,DIR_NAME$8),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,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),DISPLAY_NAME,DIR_NAME));
1594
+ var destDisplayNamesToFileNamesMap=(_destDisplayNamesToFi={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$U,DIR_NAME$U),DISPLAY_NAME$10,DIR_NAME$10),DISPLAY_NAME$V,DIR_NAME$V),DISPLAY_NAME$Z,DIR_NAME$Z),DISPLAY_NAME$x,DIR_NAME$x),DISPLAY_NAME$X,DIR_NAME$X),DISPLAY_NAME$1a,DIR_NAME$1a),DISPLAY_NAME$T,DIR_NAME$T),DISPLAY_NAME$S,DIR_NAME$S),DISPLAY_NAME$R,DIR_NAME$R),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$14,DIR_NAME$14),DISPLAY_NAME$18,DIR_NAME$18),DISPLAY_NAME$16,DIR_NAME$16),DISPLAY_NAME$12,DIR_NAME$12),DISPLAY_NAME$N,DIR_NAME$N),DISPLAY_NAME$J,DIR_NAME$J),DISPLAY_NAME$19,DIR_NAME$19),DISPLAY_NAME$11,DIR_NAME$11),DISPLAY_NAME$y,DIR_NAME$y),DISPLAY_NAME$$,DIR_NAME$$),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$_,DIR_NAME$_),DISPLAY_NAME$K,DIR_NAME$K),DISPLAY_NAME$1d,DIR_NAME$1d),DISPLAY_NAME$I,DIR_NAME$I),DISPLAY_NAME$M,DIR_NAME$M),DISPLAY_NAME$1c,DIR_NAME$1c),DISPLAY_NAME$F,DIR_NAME$F),DISPLAY_NAME$Q,DIR_NAME$Q),DISPLAY_NAME$17,DIR_NAME$17),DISPLAY_NAME$1b,DIR_NAME$1b),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$H,DIR_NAME$H),DISPLAY_NAME$1e,DIR_NAME$1e),DISPLAY_NAME$O,DIR_NAME$O),DISPLAY_NAME$B,DIR_NAME$B),DISPLAY_NAME$13,DIR_NAME$13),DISPLAY_NAME$W,DIR_NAME$W),DISPLAY_NAME$15,DIR_NAME$15),DISPLAY_NAME$L,DIR_NAME$L),DISPLAY_NAME$D,DIR_NAME$D),DISPLAY_NAME$E,DIR_NAME$E),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,DISPLAY_NAME$A,DIR_NAME$A),DISPLAY_NAME$C,DIR_NAME$C),DISPLAY_NAME$z,DIR_NAME$z),DISPLAY_NAME$G,DIR_NAME$G),DISPLAY_NAME$Y,DIR_NAME$Y),DISPLAY_NAME$P,DIR_NAME$P),DISPLAY_NAME$w,DIR_NAME$w),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$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),DISPLAY_NAME$k,DIR_NAME$k),DISPLAY_NAME$j,DIR_NAME$j),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,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),DISPLAY_NAME$a,DIR_NAME$a),DISPLAY_NAME$9,DIR_NAME$9),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_destDisplayNamesToFi,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),DISPLAY_NAME,DIR_NAME));
1614
1595
 
1615
1596
  var DEFAULT_INTEGRATIONS_CONFIG={All:true};
1616
1597
 
@@ -1669,6 +1650,8 @@
1669
1650
 
1670
1651
  var METRICS_PAYLOAD_VERSION='1';
1671
1652
 
1653
+ var FAILED_REQUEST_ERR_MSG_PREFIX='The request failed';var ERROR_MESSAGES_TO_BE_FILTERED=[FAILED_REQUEST_ERR_MSG_PREFIX];
1654
+
1672
1655
  // Errors from the below scripts are NOT allowed to reach Bugsnag
1673
1656
  var SDK_FILE_NAME_PREFIXES=function SDK_FILE_NAME_PREFIXES(){return ['rsa'// Prefix for all the SDK scripts including plugins and module federated chunks
1674
1657
  ];};var DEV_HOSTS=['www.test-host.com','localhost','127.0.0.1','[::1]'];// List of keys to exclude from the metadata
@@ -1676,11 +1659,19 @@
1676
1659
  var APP_STATE_EXCLUDE_KEYS=['userId','userTraits','groupId','groupTraits','anonymousId','config','instance',// destination instance objects
1677
1660
  'eventBuffer',// pre-load event buffer (may contain PII)
1678
1661
  'traits'];var REQUEST_TIMEOUT_MS$1=10*1000;// 10 seconds
1679
- var NOTIFIER_NAME='RudderStack JavaScript SDK Error Notifier';var SDK_GITHUB_URL='https://github.com/rudderlabs/rudder-sdk-js';var SOURCE_NAME='js';
1662
+ var NOTIFIER_NAME='RudderStack JavaScript SDK Error Notifier';var SDK_GITHUB_URL='https://github.com/rudderlabs/rudder-sdk-js';var SOURCE_NAME='js';var ERROR_REPORTING_PLUGIN='ErrorReportingPlugin';
1680
1663
 
1681
1664
  var getConfigForPayloadCreation=function getConfigForPayloadCreation(err,errorType){switch(errorType){case ErrorType.UNHANDLEDEXCEPTION:{var _ref=err,error=_ref.error;return {component:'unhandledException handler',tolerateNonErrors:true,errorFramesToSkip:1,normalizedError:error||err};}case ErrorType.UNHANDLEDREJECTION:{var _error=err;return {component:'unhandledrejection handler',tolerateNonErrors:false,errorFramesToSkip:1,normalizedError:_error.reason};}case ErrorType.HANDLEDEXCEPTION:default:return {component:'notify()',tolerateNonErrors:true,errorFramesToSkip:2,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
1682
1665
  // on the dashboard
1683
- 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:{id:(_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}}]};};var isRudderSDKError=function isRudderSDKError(event){var _event$stacktrace;var errorOrigin=(_event$stacktrace=event.stacktrace)===null||_event$stacktrace===void 0||(_event$stacktrace=_event$stacktrace[0])===null||_event$stacktrace===void 0?void 0:_event$stacktrace.file;if(!errorOrigin||typeof errorOrigin!=='string'){return false;}var srcFileName=errorOrigin.substring(errorOrigin.lastIndexOf('/')+1);var paths=errorOrigin.split('/');// extract the parent folder name from the error origin file path
1666
+ 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:{id:(_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}}]};};/**
1667
+ * A function to determine whether the error should be promoted to notify or not
1668
+ * @param {Error} error
1669
+ * @returns
1670
+ */var isAllowedToBeNotified=function isAllowedToBeNotified(event){var errorMessage=event.message;if(errorMessage&&typeof errorMessage==='string'){return !ERROR_MESSAGES_TO_BE_FILTERED.some(function(e){return errorMessage.includes(e);});}return true;};/**
1671
+ * A function to determine if the error is from Rudder SDK
1672
+ * @param {Error} event
1673
+ * @returns
1674
+ */var isRudderSDKError=function isRudderSDKError(event){var _event$stacktrace;var errorOrigin=(_event$stacktrace=event.stacktrace)===null||_event$stacktrace===void 0||(_event$stacktrace=_event$stacktrace[0])===null||_event$stacktrace===void 0?void 0:_event$stacktrace.file;if(!errorOrigin||typeof errorOrigin!=='string'){return false;}var srcFileName=errorOrigin.substring(errorOrigin.lastIndexOf('/')+1);var paths=errorOrigin.split('/');// extract the parent folder name from the error origin file path
1684
1675
  // Ex: parentFolderName will be 'sample' for url: https://example.com/sample/file.min.js
1685
1676
  var parentFolderName=paths[paths.length-2];return parentFolderName===CDN_INT_DIR||SDK_FILE_NAME_PREFIXES().some(function(prefix){return srcFileName.startsWith(prefix)&&srcFileName.endsWith('.js');});};var getErrorDeliveryPayload=function getErrorDeliveryPayload(payload,state){var data={version:METRICS_PAYLOAD_VERSION,message_id:generateUUID(),source:{name:SOURCE_NAME,sdk_version:state.context.app.value.version,write_key:state.lifecycle.writeKey.value,install_type:state.context.app.value.installType},errors:payload};return stringifyWithoutCircular(data);};
1686
1677
 
@@ -1724,19 +1715,10 @@
1724
1715
  // This adds one.
1725
1716
  if(f.lineNumber>-1&&!f.file&&!f.method){f.file='global code';}return f;};var ensureString=function ensureString(str){return typeof str==='string'?str:'';};function createBugsnagError(errorClass,errorMessage,stacktrace){return {errorClass:ensureString(errorClass),message:ensureString(errorMessage),type:'browserjs',stacktrace:stacktrace.reduce(function(accum,frame){var f=formatStackframe(frame);// don't include a stackframe if none of its properties are defined
1726
1717
  try{if(JSON.stringify(f)==='{}')return accum;return accum.concat(f);}catch(e){return accum;}},[])};}// Helpers
1727
- var getStacktrace=function getStacktrace(error,errorFramesToSkip){if(hasStack(error))return ErrorStackParser.parse(error).slice(errorFramesToSkip);return [];};var hasNecessaryFields=function hasNecessaryFields(error){return (typeof error.name==='string'||typeof error.errorClass==='string')&&(typeof error.message==='string'||typeof error.errorMessage==='string');};var normaliseError=function normaliseError(maybeError,tolerateNonErrors,component,logger){var error;var internalFrames=0;var createAndLogInputError=function createAndLogInputError(reason){var verb=component==='error cause'?'was':'received';if(logger)logger.warn("".concat(component," ").concat(verb," a non-error: \"").concat(reason,"\""));var err=new Error("".concat(component," ").concat(verb," a non-error. See \"").concat(component,"\" tab for more detail."));err.name='InvalidError';return err;};// In some cases:
1728
- //
1729
- // - the promise rejection handler (both in the browser and node)
1730
- // - the node uncaughtException handler
1731
- //
1732
- // We are really limited in what we can do to get a stacktrace. So we use the
1733
- // tolerateNonErrors option to ensure that the resulting error communicates as
1734
- // such.
1735
- if(!tolerateNonErrors){if(isError(maybeError)){error=maybeError;}else {error=createAndLogInputError(_typeof(maybeError));internalFrames+=2;}}else {switch(_typeof(maybeError)){case'string':case'number':case'boolean':error=new Error(String(maybeError));internalFrames+=1;break;case'function':error=createAndLogInputError('function');internalFrames+=2;break;case'object':if(maybeError!==null&&isError(maybeError)){error=maybeError;}else if(maybeError!==null&&hasNecessaryFields(maybeError)){error=new Error(maybeError.message||maybeError.errorMessage);error.name=maybeError.name||maybeError.errorClass;internalFrames+=1;}else {error=createAndLogInputError(maybeError===null?'null':'unsupported object');internalFrames+=2;}break;default:error=createAndLogInputError('nothing');internalFrames+=2;}}if(!hasStack(error)){// in IE10/11 a new Error() doesn't have a stacktrace until you throw it, so try that here
1718
+ var getStacktrace=function getStacktrace(error,errorFramesToSkip){if(hasStack(error))return ErrorStackParser.parse(error).slice(errorFramesToSkip);return [];};var hasNecessaryFields=function hasNecessaryFields(error){return (typeof error.name==='string'||typeof error.errorClass==='string')&&(typeof error.message==='string'||typeof error.errorMessage==='string');};var normaliseError=function normaliseError(maybeError,component,logger){var error;var internalFrames=0;if(isError(maybeError)){error=maybeError;}else if(_typeof(maybeError)==='object'&&hasNecessaryFields(maybeError)){error=new Error(maybeError.message||maybeError.errorMessage);error.name=maybeError.name||maybeError.errorClass;internalFrames+=1;}else {logger===null||logger===void 0||logger.warn("".concat(ERROR_REPORTING_PLUGIN,":: ").concat(component," received a non-error: ").concat(stringifyWithoutCircular(error)));error=undefined;}if(error&&!hasStack(error)){// in IE10/11 a new Error() doesn't have a stacktrace until you throw it, so try that here
1736
1719
  try{throw error;}catch(e){if(hasStack(e)){error=e;// if the error only got a stacktrace after we threw it here, we know it
1737
- // will only have one extra internal frame from this function, regardless
1738
- // of whether it went through createAndLogInputError() or not
1739
- internalFrames=1;}}}return [error,internalFrames];};var ErrorFormat=/*#__PURE__*/function(){function ErrorFormat(errorClass,errorMessage,stacktrace){_classCallCheck(this,ErrorFormat);this.errors=[createBugsnagError(errorClass,errorMessage,stacktrace)];}return _createClass(ErrorFormat,null,[{key:"create",value:function create(maybeError,tolerateNonErrors,handledState,component){var errorFramesToSkip=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var logger=arguments.length>5?arguments[5]:undefined;var _normaliseError=normaliseError(maybeError,tolerateNonErrors,component,logger),_normaliseError2=_slicedToArray(_normaliseError,2),error=_normaliseError2[0],internalFrames=_normaliseError2[1];var event;try{var stacktrace=getStacktrace(error,// if an error was created/throw in the normaliseError() function, we need to
1720
+ // will only have one extra internal frame from this function
1721
+ internalFrames=1;}}}return [error,internalFrames];};var ErrorFormat=/*#__PURE__*/function(){function ErrorFormat(errorClass,errorMessage,stacktrace){_classCallCheck(this,ErrorFormat);this.errors=[createBugsnagError(errorClass,errorMessage,stacktrace)];}return _createClass(ErrorFormat,null,[{key:"create",value:function create(maybeError,tolerateNonErrors,handledState,component){var errorFramesToSkip=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var logger=arguments.length>5?arguments[5]:undefined;var _normaliseError=normaliseError(maybeError,component,logger),_normaliseError2=_slicedToArray(_normaliseError,2),error=_normaliseError2[0],internalFrames=_normaliseError2[1];if(!error){return undefined;}var event;try{var stacktrace=getStacktrace(error,// if an error was created/throw in the normaliseError() function, we need to
1740
1722
  // tell the getStacktrace() function to skip the number of frames we know will
1741
1723
  // be from our own functions. This is added to the number of frames deep we
1742
1724
  // were told about
@@ -1747,7 +1729,7 @@
1747
1729
  var pluginName$9='ErrorReporting';var ErrorReporting=function ErrorReporting(){return {name:pluginName$9,deps:[],initialize:function initialize(state){var _state$reporting$brea;state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$9]);state.reporting.isErrorReportingPluginLoaded.value=true;if((_state$reporting$brea=state.reporting.breadcrumbs)!==null&&_state$reporting$brea!==void 0&&_state$reporting$brea.value){state.reporting.breadcrumbs.value=[createNewBreadcrumb('Error Reporting Plugin Loaded')];}},errorReporting:{// This extension point is deprecated
1748
1730
  // TODO: Remove this in the next major release
1749
1731
  init:function init(state,pluginEngine,externalSrcLoader,logger,isInvokedFromLatestCore){var _state$source$value,_state$source$value2;if(isInvokedFromLatestCore){return undefined;}if(!((_state$source$value=state.source.value)!==null&&_state$source$value!==void 0&&_state$source$value.config)||!((_state$source$value2=state.source.value)!==null&&_state$source$value2!==void 0&&_state$source$value2.id)){return Promise.reject(new Error(INVALID_SOURCE_CONFIG_ERROR));}return pluginEngine.invokeSingle('errorReportingProvider.init',state,externalSrcLoader,logger);},notify:function notify(pluginEngine,client,error,state,logger,httpClient,errorState){if(httpClient){var _getConfigForPayloadC=getConfigForPayloadCreation(error,errorState===null||errorState===void 0?void 0:errorState.severityReason.type),component=_getConfigForPayloadC.component,tolerateNonErrors=_getConfigForPayloadC.tolerateNonErrors,errorFramesToSkip=_getConfigForPayloadC.errorFramesToSkip,normalizedError=_getConfigForPayloadC.normalizedError;// Generate the error payload
1750
- var errorPayload=ErrorFormat.create(normalizedError,tolerateNonErrors,errorState,component,errorFramesToSkip,logger);// filter errors
1732
+ var errorPayload=ErrorFormat.create(normalizedError,tolerateNonErrors,errorState,component,errorFramesToSkip,logger);if(!errorPayload||!isAllowedToBeNotified(errorPayload.errors[0])){return;}// filter errors
1751
1733
  if(!isRudderSDKError(errorPayload.errors[0])){return;}// enrich error payload
1752
1734
  var bugsnagPayload=getBugsnagErrorEvent(errorPayload,errorState,state);// send it to metrics service
1753
1735
  httpClient===null||httpClient===void 0||httpClient.getAsyncData({url:state.metrics.metricsServiceUrl.value,options:{method:'POST',data:getErrorDeliveryPayload(bugsnagPayload,state),sendRawData:true},isRawResponse:true,timeout:REQUEST_TIMEOUT_MS$1,callback:function callback(result,details){// do nothing
@@ -3292,9 +3274,14 @@
3292
3274
  */var getUrlWithoutHash=function getUrlWithoutHash(url){var urlWithoutHash=url;try{var urlObj=new URL(url);urlWithoutHash=urlObj.origin+urlObj.pathname+urlObj.search;}catch(error){// Do nothing
3293
3275
  }return urlWithoutHash;};
3294
3276
 
3277
+ /**
3278
+ * Determines if the SDK is running inside a chrome extension
3279
+ * @returns boolean
3280
+ */var isSDKRunningInChromeExtension=function isSDKRunningInChromeExtension(){return !!(window.chrome&&window.chrome.runtime&&window.chrome.runtime.id);};
3281
+
3295
3282
  var DEFAULT_PRE_CONSENT_STORAGE_STRATEGY='none';var DEFAULT_PRE_CONSENT_EVENTS_DELIVERY_TYPE='immediate';
3296
3283
 
3297
- var isMetricsReportingEnabled=function isMetricsReportingEnabled(sourceConfig){var _sourceConfig$statsCo2;return (sourceConfig===null||sourceConfig===void 0||(_sourceConfig$statsCo2=sourceConfig.statsCollection)===null||_sourceConfig$statsCo2===void 0||(_sourceConfig$statsCo2=_sourceConfig$statsCo2.metrics)===null||_sourceConfig$statsCo2===void 0?void 0:_sourceConfig$statsCo2.enabled)===true;};
3284
+ var isErrorReportingEnabled=function isErrorReportingEnabled(sourceConfig){var _sourceConfig$statsCo;return (sourceConfig===null||sourceConfig===void 0||(_sourceConfig$statsCo=sourceConfig.statsCollection)===null||_sourceConfig$statsCo===void 0||(_sourceConfig$statsCo=_sourceConfig$statsCo.errors)===null||_sourceConfig$statsCo===void 0?void 0:_sourceConfig$statsCo.enabled)===true;};var isMetricsReportingEnabled=function isMetricsReportingEnabled(sourceConfig){var _sourceConfig$statsCo2;return (sourceConfig===null||sourceConfig===void 0||(_sourceConfig$statsCo2=sourceConfig.statsCollection)===null||_sourceConfig$statsCo2===void 0||(_sourceConfig$statsCo2=_sourceConfig$statsCo2.metrics)===null||_sourceConfig$statsCo2===void 0?void 0:_sourceConfig$statsCo2.enabled)===true;};
3298
3285
 
3299
3286
  /**
3300
3287
  * Validates and normalizes the consent options provided by the user
@@ -3328,10 +3315,7 @@
3328
3315
  * Updates the reporting state variables from the source config data
3329
3316
  * @param res Source config
3330
3317
  * @param logger Logger instance
3331
- */var updateReportingState=function updateReportingState(res){state.reporting.isErrorReportingEnabled.value=false;// TODO: Enable this once the error reporting is tested properly
3332
- // state.reporting.isErrorReportingEnabled.value =
3333
- // isErrorReportingEnabled(res.source.config) && !isSDKRunningInChromeExtension();
3334
- state.reporting.isMetricsReportingEnabled.value=isMetricsReportingEnabled(res.source.config);};var updateStorageStateFromLoadOptions=function updateStorageStateFromLoadOptions(logger){var _storageOptsFromLoad$;var _state$loadOptions$va=state.loadOptions.value,useServerSideCookies=_state$loadOptions$va.useServerSideCookies,dataServiceEndpoint=_state$loadOptions$va.dataServiceEndpoint,storageOptsFromLoad=_state$loadOptions$va.storage,setCookieDomain=_state$loadOptions$va.setCookieDomain,sameDomainCookiesOnly=_state$loadOptions$va.sameDomainCookiesOnly;var storageType=storageOptsFromLoad===null||storageOptsFromLoad===void 0?void 0:storageOptsFromLoad.type;if(isDefined(storageType)&&!isValidStorageType(storageType)){logger===null||logger===void 0||logger.warn(STORAGE_TYPE_VALIDATION_WARNING(CONFIG_MANAGER,storageType,DEFAULT_STORAGE_TYPE));storageType=DEFAULT_STORAGE_TYPE;}var storageEncryptionVersion=storageOptsFromLoad===null||storageOptsFromLoad===void 0||(_storageOptsFromLoad$=storageOptsFromLoad.encryption)===null||_storageOptsFromLoad$===void 0?void 0:_storageOptsFromLoad$.version;var encryptionPluginName=storageEncryptionVersion&&StorageEncryptionVersionsToPluginNameMap[storageEncryptionVersion];if(!isUndefined(storageEncryptionVersion)&&isUndefined(encryptionPluginName)){// set the default encryption plugin
3318
+ */var updateReportingState=function updateReportingState(res){state.reporting.isErrorReportingEnabled.value=isErrorReportingEnabled(res.source.config)&&!isSDKRunningInChromeExtension();state.reporting.isMetricsReportingEnabled.value=isMetricsReportingEnabled(res.source.config);};var updateStorageStateFromLoadOptions=function updateStorageStateFromLoadOptions(logger){var _storageOptsFromLoad$;var _state$loadOptions$va=state.loadOptions.value,useServerSideCookies=_state$loadOptions$va.useServerSideCookies,dataServiceEndpoint=_state$loadOptions$va.dataServiceEndpoint,storageOptsFromLoad=_state$loadOptions$va.storage,setCookieDomain=_state$loadOptions$va.setCookieDomain,sameDomainCookiesOnly=_state$loadOptions$va.sameDomainCookiesOnly;var storageType=storageOptsFromLoad===null||storageOptsFromLoad===void 0?void 0:storageOptsFromLoad.type;if(isDefined(storageType)&&!isValidStorageType(storageType)){logger===null||logger===void 0||logger.warn(STORAGE_TYPE_VALIDATION_WARNING(CONFIG_MANAGER,storageType,DEFAULT_STORAGE_TYPE));storageType=DEFAULT_STORAGE_TYPE;}var storageEncryptionVersion=storageOptsFromLoad===null||storageOptsFromLoad===void 0||(_storageOptsFromLoad$=storageOptsFromLoad.encryption)===null||_storageOptsFromLoad$===void 0?void 0:_storageOptsFromLoad$.version;var encryptionPluginName=storageEncryptionVersion&&StorageEncryptionVersionsToPluginNameMap[storageEncryptionVersion];if(!isUndefined(storageEncryptionVersion)&&isUndefined(encryptionPluginName)){// set the default encryption plugin
3335
3319
  logger===null||logger===void 0||logger.warn(UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING(CONFIG_MANAGER,storageEncryptionVersion,StorageEncryptionVersionsToPluginNameMap,DEFAULT_STORAGE_ENCRYPTION_VERSION));storageEncryptionVersion=DEFAULT_STORAGE_ENCRYPTION_VERSION;}else if(isUndefined(storageEncryptionVersion)){storageEncryptionVersion=DEFAULT_STORAGE_ENCRYPTION_VERSION;}// Allow migration only if the configured encryption version is the default encryption version
3336
3320
  var configuredMigrationValue=storageOptsFromLoad===null||storageOptsFromLoad===void 0?void 0:storageOptsFromLoad.migrate;var finalMigrationVal=configuredMigrationValue&&storageEncryptionVersion===DEFAULT_STORAGE_ENCRYPTION_VERSION;if(configuredMigrationValue===true&&finalMigrationVal!==configuredMigrationValue){logger===null||logger===void 0||logger.warn(STORAGE_DATA_MIGRATION_OVERRIDE_WARNING(CONFIG_MANAGER,storageEncryptionVersion,DEFAULT_STORAGE_ENCRYPTION_VERSION));}r(function(){var _storageOptsFromLoad$2;state.storage.type.value=storageType;var cookieOptions=(_storageOptsFromLoad$2=storageOptsFromLoad===null||storageOptsFromLoad===void 0?void 0:storageOptsFromLoad.cookie)!==null&&_storageOptsFromLoad$2!==void 0?_storageOptsFromLoad$2:{};if(useServerSideCookies){var _cookieOptions$domain;state.serverCookies.isEnabledServerSideCookies.value=useServerSideCookies;var providedCookieDomain=(_cookieOptions$domain=cookieOptions.domain)!==null&&_cookieOptions$domain!==void 0?_cookieOptions$domain:setCookieDomain;/**
3337
3321
  * Based on the following conditions, we decide whether to use the exact domain or not to determine the data service URL: