@newrelic/browser-agent 1.304.0-rc.3 → 1.304.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
17
17
  /**
18
18
  * Exposes the version of the agent
19
19
  */
20
- const VERSION = exports.VERSION = "1.304.0-rc.3";
20
+ const VERSION = exports.VERSION = "1.304.0-rc.4";
21
21
 
22
22
  /**
23
23
  * Exposes the build type of the agent
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
17
17
  /**
18
18
  * Exposes the version of the agent
19
19
  */
20
- const VERSION = exports.VERSION = "1.304.0-rc.3";
20
+ const VERSION = exports.VERSION = "1.304.0-rc.4";
21
21
 
22
22
  /**
23
23
  * Exposes the build type of the agent
@@ -61,7 +61,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
61
61
  }
62
62
  let addUserAction = () => {/** no-op */};
63
63
  if (_runtime.isBrowserScope && agentRef.init.user_actions.enabled) {
64
- this.#userActionAggregator = new _userActionsAggregator.UserActionsAggregator(agentRef.init.feature_flags.includes('user_frustrations'));
64
+ this.#userActionAggregator = new _userActionsAggregator.UserActionsAggregator();
65
65
  this.harvestOpts.beforeUnload = () => addUserAction?.(this.#userActionAggregator.aggregationEvent);
66
66
  addUserAction = aggregatedUserAction => {
67
67
  try {
@@ -18,14 +18,12 @@ class UserActionsAggregator {
18
18
  /** @type {AggregatedUserAction=} */
19
19
  #aggregationEvent = undefined;
20
20
  #aggregationKey = '';
21
- #ufEnabled = false;
22
21
  #deadClickTimer = undefined;
23
22
  #domObserver = undefined;
24
23
  #errorClickTimer = undefined;
25
- constructor(userFrustrationsEnabled) {
26
- if (userFrustrationsEnabled && (0, _nreum.gosNREUMOriginals)().o.MO) {
24
+ constructor() {
25
+ if ((0, _nreum.gosNREUMOriginals)().o.MO) {
27
26
  this.#domObserver = new MutationObserver(this.isLiveClick.bind(this));
28
- this.#ufEnabled = true;
29
27
  }
30
28
  }
31
29
  get aggregationEvent() {
@@ -56,15 +54,13 @@ class UserActionsAggregator {
56
54
  } else {
57
55
  // return the prev existing one (if there is one)
58
56
  const finishedEvent = this.#aggregationEvent;
59
- if (this.#ufEnabled) {
60
- this.#deadClickCleanup();
61
- this.#errorClickCleanup();
62
- }
57
+ this.#deadClickCleanup();
58
+ this.#errorClickCleanup();
63
59
 
64
60
  // then start new event aggregation
65
61
  this.#aggregationKey = aggregationKey;
66
62
  this.#aggregationEvent = new _aggregatedUserAction.AggregatedUserAction(evt, selectorInfo);
67
- if (this.#ufEnabled && evt.type === 'click' && (selectorInfo.hasButton || selectorInfo.hasLink)) {
63
+ if (evt.type === 'click' && (selectorInfo.hasButton || selectorInfo.hasLink)) {
68
64
  this.#deadClickSetup(this.#aggregationEvent);
69
65
  this.#errorClickSetup();
70
66
  }
@@ -31,7 +31,6 @@ class Instrument extends _instrumentBase.InstrumentBase {
31
31
  constructor(agentRef) {
32
32
  super(agentRef, _constants.FEATURE_NAME);
33
33
  const websocketsEnabled = agentRef.init.feature_flags.includes('websockets');
34
- const ufEnabled = agentRef.init.feature_flags.includes('user_frustrations');
35
34
 
36
35
  /** config values that gate whether the generic events aggregator should be imported at all */
37
36
  const genericEventSourceConfigs = [agentRef.init.page_action.enabled, agentRef.init.performance.capture_marks, agentRef.init.performance.capture_measures, agentRef.init.performance.resources.enabled, agentRef.init.user_actions.enabled, websocketsEnabled];
@@ -43,13 +42,11 @@ class Instrument extends _instrumentBase.InstrumentBase {
43
42
  (0, _register.setupRegisterAPI)(agentRef);
44
43
  (0, _measure.setupMeasureAPI)(agentRef);
45
44
  let historyEE, websocketsEE;
46
- if (_runtime.isBrowserScope && ufEnabled) {
45
+ if (websocketsEnabled) websocketsEE = (0, _wrapWebsocket.wrapWebSocket)(this.ee);
46
+ if (_runtime.isBrowserScope) {
47
47
  (0, _wrapFetch.wrapFetch)(this.ee);
48
48
  (0, _wrapXhr.wrapXhr)(this.ee);
49
49
  historyEE = (0, _wrapHistory.wrapHistory)(this.ee);
50
- }
51
- if (websocketsEnabled) websocketsEE = (0, _wrapWebsocket.wrapWebSocket)(this.ee);
52
- if (_runtime.isBrowserScope) {
53
50
  if (agentRef.init.user_actions.enabled) {
54
51
  _constants.OBSERVED_EVENTS.forEach(eventType => (0, _eventListenerOpts.windowAddEventListener)(eventType, evt => (0, _handle.handle)('ua', [evt], undefined, this.featureName, this.ee), true));
55
52
  _constants.OBSERVED_WINDOW_EVENTS.forEach(eventType => {
@@ -62,36 +59,34 @@ class Instrument extends _instrumentBase.InstrumentBase {
62
59
  }
63
60
  // Capture is not used here so that we don't get element focus/blur events, only the window's as they do not bubble. They are also not cancellable, so no worries about being front of line.
64
61
  );
65
- if (ufEnabled) {
66
- _runtime.globalScope.addEventListener('error', () => {
67
- (0, _handle.handle)('uaErr', [], undefined, _features.FEATURE_NAMES.genericEvents, this.ee);
68
- }, (0, _eventListenerOpts.eventListenerOpts)(false, this.removeOnAbort?.signal));
69
- this.ee.on('open-xhr-start', (args, xhr) => {
70
- if (!isInternalTraffic(args[1])) {
71
- xhr.addEventListener('readystatechange', () => {
72
- if (xhr.readyState === 2) {
73
- // HEADERS_RECEIVED
74
- (0, _handle.handle)('uaXhr', [], undefined, _features.FEATURE_NAMES.genericEvents, this.ee);
75
- }
76
- });
77
- }
78
- });
79
- this.ee.on('fetch-start', fetchArguments => {
80
- if (fetchArguments.length >= 1 && !isInternalTraffic((0, _extractUrl.extractUrl)(fetchArguments[0]))) {
81
- (0, _handle.handle)('uaXhr', [], undefined, _features.FEATURE_NAMES.genericEvents, this.ee);
82
- }
83
- });
84
- function isInternalTraffic(url) {
85
- const parsedUrl = (0, _parseUrl.parseUrl)(url);
86
- return agentRef.beacons.includes(parsedUrl.hostname + ':' + parsedUrl.port);
62
+ _runtime.globalScope.addEventListener('error', () => {
63
+ (0, _handle.handle)('uaErr', [], undefined, _features.FEATURE_NAMES.genericEvents, this.ee);
64
+ }, (0, _eventListenerOpts.eventListenerOpts)(false, this.removeOnAbort?.signal));
65
+ this.ee.on('open-xhr-start', (args, xhr) => {
66
+ if (!isInternalTraffic(args[1])) {
67
+ xhr.addEventListener('readystatechange', () => {
68
+ if (xhr.readyState === 2) {
69
+ // HEADERS_RECEIVED
70
+ (0, _handle.handle)('uaXhr', [], undefined, _features.FEATURE_NAMES.genericEvents, this.ee);
71
+ }
72
+ });
87
73
  }
88
- historyEE.on('pushState-end', navigationChange);
89
- historyEE.on('replaceState-end', navigationChange);
90
- window.addEventListener('hashchange', navigationChange, (0, _eventListenerOpts.eventListenerOpts)(true, this.removeOnAbort?.signal));
91
- window.addEventListener('popstate', navigationChange, (0, _eventListenerOpts.eventListenerOpts)(true, this.removeOnAbort?.signal));
92
- function navigationChange() {
93
- historyEE.emit('navChange');
74
+ });
75
+ this.ee.on('fetch-start', fetchArguments => {
76
+ if (fetchArguments.length >= 1 && !isInternalTraffic((0, _extractUrl.extractUrl)(fetchArguments[0]))) {
77
+ (0, _handle.handle)('uaXhr', [], undefined, _features.FEATURE_NAMES.genericEvents, this.ee);
94
78
  }
79
+ });
80
+ function isInternalTraffic(url) {
81
+ const parsedUrl = (0, _parseUrl.parseUrl)(url);
82
+ return agentRef.beacons.includes(parsedUrl.hostname + ':' + parsedUrl.port);
83
+ }
84
+ historyEE.on('pushState-end', navigationChange);
85
+ historyEE.on('replaceState-end', navigationChange);
86
+ window.addEventListener('hashchange', navigationChange, (0, _eventListenerOpts.eventListenerOpts)(true, this.removeOnAbort?.signal));
87
+ window.addEventListener('popstate', navigationChange, (0, _eventListenerOpts.eventListenerOpts)(true, this.removeOnAbort?.signal));
88
+ function navigationChange() {
89
+ historyEE.emit('navChange');
95
90
  }
96
91
  }
97
92
  if (agentRef.init.performance.resources.enabled && _runtime.globalScope.PerformanceObserver?.supportedEntryTypes.includes('resource')) {
@@ -11,7 +11,7 @@
11
11
  /**
12
12
  * Exposes the version of the agent
13
13
  */
14
- export const VERSION = "1.304.0-rc.3";
14
+ export const VERSION = "1.304.0-rc.4";
15
15
 
16
16
  /**
17
17
  * Exposes the build type of the agent
@@ -11,7 +11,7 @@
11
11
  /**
12
12
  * Exposes the version of the agent
13
13
  */
14
- export const VERSION = "1.304.0-rc.3";
14
+ export const VERSION = "1.304.0-rc.4";
15
15
 
16
16
  /**
17
17
  * Exposes the build type of the agent
@@ -54,7 +54,7 @@ export class Aggregate extends AggregateBase {
54
54
  }
55
55
  let addUserAction = () => {/** no-op */};
56
56
  if (isBrowserScope && agentRef.init.user_actions.enabled) {
57
- this.#userActionAggregator = new UserActionsAggregator(agentRef.init.feature_flags.includes('user_frustrations'));
57
+ this.#userActionAggregator = new UserActionsAggregator();
58
58
  this.harvestOpts.beforeUnload = () => addUserAction?.(this.#userActionAggregator.aggregationEvent);
59
59
  addUserAction = aggregatedUserAction => {
60
60
  try {
@@ -11,14 +11,12 @@ export class UserActionsAggregator {
11
11
  /** @type {AggregatedUserAction=} */
12
12
  #aggregationEvent = undefined;
13
13
  #aggregationKey = '';
14
- #ufEnabled = false;
15
14
  #deadClickTimer = undefined;
16
15
  #domObserver = undefined;
17
16
  #errorClickTimer = undefined;
18
- constructor(userFrustrationsEnabled) {
19
- if (userFrustrationsEnabled && gosNREUMOriginals().o.MO) {
17
+ constructor() {
18
+ if (gosNREUMOriginals().o.MO) {
20
19
  this.#domObserver = new MutationObserver(this.isLiveClick.bind(this));
21
- this.#ufEnabled = true;
22
20
  }
23
21
  }
24
22
  get aggregationEvent() {
@@ -49,15 +47,13 @@ export class UserActionsAggregator {
49
47
  } else {
50
48
  // return the prev existing one (if there is one)
51
49
  const finishedEvent = this.#aggregationEvent;
52
- if (this.#ufEnabled) {
53
- this.#deadClickCleanup();
54
- this.#errorClickCleanup();
55
- }
50
+ this.#deadClickCleanup();
51
+ this.#errorClickCleanup();
56
52
 
57
53
  // then start new event aggregation
58
54
  this.#aggregationKey = aggregationKey;
59
55
  this.#aggregationEvent = new AggregatedUserAction(evt, selectorInfo);
60
- if (this.#ufEnabled && evt.type === 'click' && (selectorInfo.hasButton || selectorInfo.hasLink)) {
56
+ if (evt.type === 'click' && (selectorInfo.hasButton || selectorInfo.hasLink)) {
61
57
  this.#deadClickSetup(this.#aggregationEvent);
62
58
  this.#errorClickSetup();
63
59
  }
@@ -26,7 +26,6 @@ export class Instrument extends InstrumentBase {
26
26
  constructor(agentRef) {
27
27
  super(agentRef, FEATURE_NAME);
28
28
  const websocketsEnabled = agentRef.init.feature_flags.includes('websockets');
29
- const ufEnabled = agentRef.init.feature_flags.includes('user_frustrations');
30
29
 
31
30
  /** config values that gate whether the generic events aggregator should be imported at all */
32
31
  const genericEventSourceConfigs = [agentRef.init.page_action.enabled, agentRef.init.performance.capture_marks, agentRef.init.performance.capture_measures, agentRef.init.performance.resources.enabled, agentRef.init.user_actions.enabled, websocketsEnabled];
@@ -38,13 +37,11 @@ export class Instrument extends InstrumentBase {
38
37
  setupRegisterAPI(agentRef);
39
38
  setupMeasureAPI(agentRef);
40
39
  let historyEE, websocketsEE;
41
- if (isBrowserScope && ufEnabled) {
40
+ if (websocketsEnabled) websocketsEE = wrapWebSocket(this.ee);
41
+ if (isBrowserScope) {
42
42
  wrapFetch(this.ee);
43
43
  wrapXhr(this.ee);
44
44
  historyEE = wrapHistory(this.ee);
45
- }
46
- if (websocketsEnabled) websocketsEE = wrapWebSocket(this.ee);
47
- if (isBrowserScope) {
48
45
  if (agentRef.init.user_actions.enabled) {
49
46
  OBSERVED_EVENTS.forEach(eventType => windowAddEventListener(eventType, evt => handle('ua', [evt], undefined, this.featureName, this.ee), true));
50
47
  OBSERVED_WINDOW_EVENTS.forEach(eventType => {
@@ -57,36 +54,34 @@ export class Instrument extends InstrumentBase {
57
54
  }
58
55
  // Capture is not used here so that we don't get element focus/blur events, only the window's as they do not bubble. They are also not cancellable, so no worries about being front of line.
59
56
  );
60
- if (ufEnabled) {
61
- globalScope.addEventListener('error', () => {
62
- handle('uaErr', [], undefined, FEATURE_NAMES.genericEvents, this.ee);
63
- }, eventListenerOpts(false, this.removeOnAbort?.signal));
64
- this.ee.on('open-xhr-start', (args, xhr) => {
65
- if (!isInternalTraffic(args[1])) {
66
- xhr.addEventListener('readystatechange', () => {
67
- if (xhr.readyState === 2) {
68
- // HEADERS_RECEIVED
69
- handle('uaXhr', [], undefined, FEATURE_NAMES.genericEvents, this.ee);
70
- }
71
- });
72
- }
73
- });
74
- this.ee.on('fetch-start', fetchArguments => {
75
- if (fetchArguments.length >= 1 && !isInternalTraffic(extractUrl(fetchArguments[0]))) {
76
- handle('uaXhr', [], undefined, FEATURE_NAMES.genericEvents, this.ee);
77
- }
78
- });
79
- function isInternalTraffic(url) {
80
- const parsedUrl = parseUrl(url);
81
- return agentRef.beacons.includes(parsedUrl.hostname + ':' + parsedUrl.port);
57
+ globalScope.addEventListener('error', () => {
58
+ handle('uaErr', [], undefined, FEATURE_NAMES.genericEvents, this.ee);
59
+ }, eventListenerOpts(false, this.removeOnAbort?.signal));
60
+ this.ee.on('open-xhr-start', (args, xhr) => {
61
+ if (!isInternalTraffic(args[1])) {
62
+ xhr.addEventListener('readystatechange', () => {
63
+ if (xhr.readyState === 2) {
64
+ // HEADERS_RECEIVED
65
+ handle('uaXhr', [], undefined, FEATURE_NAMES.genericEvents, this.ee);
66
+ }
67
+ });
82
68
  }
83
- historyEE.on('pushState-end', navigationChange);
84
- historyEE.on('replaceState-end', navigationChange);
85
- window.addEventListener('hashchange', navigationChange, eventListenerOpts(true, this.removeOnAbort?.signal));
86
- window.addEventListener('popstate', navigationChange, eventListenerOpts(true, this.removeOnAbort?.signal));
87
- function navigationChange() {
88
- historyEE.emit('navChange');
69
+ });
70
+ this.ee.on('fetch-start', fetchArguments => {
71
+ if (fetchArguments.length >= 1 && !isInternalTraffic(extractUrl(fetchArguments[0]))) {
72
+ handle('uaXhr', [], undefined, FEATURE_NAMES.genericEvents, this.ee);
89
73
  }
74
+ });
75
+ function isInternalTraffic(url) {
76
+ const parsedUrl = parseUrl(url);
77
+ return agentRef.beacons.includes(parsedUrl.hostname + ':' + parsedUrl.port);
78
+ }
79
+ historyEE.on('pushState-end', navigationChange);
80
+ historyEE.on('replaceState-end', navigationChange);
81
+ window.addEventListener('hashchange', navigationChange, eventListenerOpts(true, this.removeOnAbort?.signal));
82
+ window.addEventListener('popstate', navigationChange, eventListenerOpts(true, this.removeOnAbort?.signal));
83
+ function navigationChange() {
84
+ historyEE.emit('navChange');
90
85
  }
91
86
  }
92
87
  if (agentRef.init.performance.resources.enabled && globalScope.PerformanceObserver?.supportedEntryTypes.includes('resource')) {
@@ -1,5 +1,4 @@
1
1
  export class UserActionsAggregator {
2
- constructor(userFrustrationsEnabled: any);
3
2
  get aggregationEvent(): AggregatedUserAction | undefined;
4
3
  /**
5
4
  * Process the event and determine if a new aggregation set should be made or if it should increment the current aggregation
@@ -1 +1 @@
1
- {"version":3,"file":"user-actions-aggregator.d.ts","sourceRoot":"","sources":["../../../../../../src/features/generic_events/aggregate/user-actions/user-actions-aggregator.js"],"names":[],"mappings":"AAUA;IASE,0CAKC;IAED,yDAQC;IAED;;;;OAIG;IACH,aAHW,KAAK,sBACH,oBAAoB,GAAC,SAAS,CA6B1C;IAED,yBAKC;IA0CD,oBAEC;;CACF;qCAlHoC,0BAA0B"}
1
+ {"version":3,"file":"user-actions-aggregator.d.ts","sourceRoot":"","sources":["../../../../../../src/features/generic_events/aggregate/user-actions/user-actions-aggregator.js"],"names":[],"mappings":"AAUA;IAcE,yDAQC;IAED;;;;OAIG;IACH,aAHW,KAAK,sBACH,oBAAoB,GAAC,SAAS,CA2B1C;IAED,yBAKC;IA0CD,oBAEC;;CACF;qCA9GoC,0BAA0B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/instrument/index.js"],"names":[],"mappings":"AAwBA;IACE,2BAAiC;IACjC,2BAyGC;IAXG,2CAA0C;IAG5C,yBAGC;CAMJ;AAED,8CAAuC;+BAxHR,6BAA6B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/instrument/index.js"],"names":[],"mappings":"AAwBA;IACE,2BAAiC;IACjC,2BAuGC;IAXG,2CAA0C;IAG5C,yBAGC;CAMJ;AAED,8CAAuC;+BAtHR,6BAA6B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.304.0-rc.3",
3
+ "version": "1.304.0-rc.4",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -61,7 +61,7 @@ export class Aggregate extends AggregateBase {
61
61
 
62
62
  let addUserAction = () => { /** no-op */ }
63
63
  if (isBrowserScope && agentRef.init.user_actions.enabled) {
64
- this.#userActionAggregator = new UserActionsAggregator(agentRef.init.feature_flags.includes('user_frustrations'))
64
+ this.#userActionAggregator = new UserActionsAggregator()
65
65
  this.harvestOpts.beforeUnload = () => addUserAction?.(this.#userActionAggregator.aggregationEvent)
66
66
 
67
67
  addUserAction = (aggregatedUserAction) => {
@@ -12,15 +12,13 @@ export class UserActionsAggregator {
12
12
  /** @type {AggregatedUserAction=} */
13
13
  #aggregationEvent = undefined
14
14
  #aggregationKey = ''
15
- #ufEnabled = false
16
15
  #deadClickTimer = undefined
17
16
  #domObserver = undefined
18
17
  #errorClickTimer = undefined
19
18
 
20
- constructor (userFrustrationsEnabled) {
21
- if (userFrustrationsEnabled && gosNREUMOriginals().o.MO) {
19
+ constructor () {
20
+ if (gosNREUMOriginals().o.MO) {
22
21
  this.#domObserver = new MutationObserver(this.isLiveClick.bind(this))
23
- this.#ufEnabled = true
24
22
  }
25
23
  }
26
24
 
@@ -52,15 +50,13 @@ export class UserActionsAggregator {
52
50
  } else {
53
51
  // return the prev existing one (if there is one)
54
52
  const finishedEvent = this.#aggregationEvent
55
- if (this.#ufEnabled) {
56
- this.#deadClickCleanup()
57
- this.#errorClickCleanup()
58
- }
53
+ this.#deadClickCleanup()
54
+ this.#errorClickCleanup()
59
55
 
60
56
  // then start new event aggregation
61
57
  this.#aggregationKey = aggregationKey
62
58
  this.#aggregationEvent = new AggregatedUserAction(evt, selectorInfo)
63
- if (this.#ufEnabled && evt.type === 'click' && (selectorInfo.hasButton || selectorInfo.hasLink)) {
59
+ if (evt.type === 'click' && (selectorInfo.hasButton || selectorInfo.hasLink)) {
64
60
  this.#deadClickSetup(this.#aggregationEvent)
65
61
  this.#errorClickSetup()
66
62
  }
@@ -27,7 +27,6 @@ export class Instrument extends InstrumentBase {
27
27
  constructor (agentRef) {
28
28
  super(agentRef, FEATURE_NAME)
29
29
  const websocketsEnabled = agentRef.init.feature_flags.includes('websockets')
30
- const ufEnabled = agentRef.init.feature_flags.includes('user_frustrations')
31
30
 
32
31
  /** config values that gate whether the generic events aggregator should be imported at all */
33
32
  const genericEventSourceConfigs = [
@@ -47,14 +46,12 @@ export class Instrument extends InstrumentBase {
47
46
  setupMeasureAPI(agentRef)
48
47
 
49
48
  let historyEE, websocketsEE
50
- if (isBrowserScope && ufEnabled) {
49
+ if (websocketsEnabled) websocketsEE = wrapWebSocket(this.ee)
50
+ if (isBrowserScope) {
51
51
  wrapFetch(this.ee)
52
52
  wrapXhr(this.ee)
53
53
  historyEE = wrapHistory(this.ee)
54
- }
55
- if (websocketsEnabled) websocketsEE = wrapWebSocket(this.ee)
56
54
 
57
- if (isBrowserScope) {
58
55
  if (agentRef.init.user_actions.enabled) {
59
56
  OBSERVED_EVENTS.forEach(eventType =>
60
57
  windowAddEventListener(eventType, (evt) => handle('ua', [evt], undefined, this.featureName, this.ee), true)
@@ -63,42 +60,40 @@ export class Instrument extends InstrumentBase {
63
60
  const debounceHandler = debounce((evt) => { handle('ua', [evt], undefined, this.featureName, this.ee) }, 500, { leading: true })
64
61
  windowAddEventListener(eventType, debounceHandler)
65
62
  }
66
- // Capture is not used here so that we don't get element focus/blur events, only the window's as they do not bubble. They are also not cancellable, so no worries about being front of line.
63
+ // Capture is not used here so that we don't get element focus/blur events, only the window's as they do not bubble. They are also not cancellable, so no worries about being front of line.
67
64
  )
68
65
 
69
- if (ufEnabled) {
70
- globalScope.addEventListener('error', () => {
71
- handle('uaErr', [], undefined, FEATURE_NAMES.genericEvents, this.ee)
72
- }, eventListenerOpts(false, this.removeOnAbort?.signal))
73
-
74
- this.ee.on('open-xhr-start', (args, xhr) => {
75
- if (!isInternalTraffic(args[1])) {
76
- xhr.addEventListener('readystatechange', () => {
77
- if (xhr.readyState === 2) { // HEADERS_RECEIVED
78
- handle('uaXhr', [], undefined, FEATURE_NAMES.genericEvents, this.ee)
79
- }
80
- })
81
- }
82
- })
83
- this.ee.on('fetch-start', (fetchArguments) => {
84
- if (fetchArguments.length >= 1 && !isInternalTraffic(extractUrl(fetchArguments[0]))) {
85
- handle('uaXhr', [], undefined, FEATURE_NAMES.genericEvents, this.ee)
86
- }
87
- })
88
-
89
- function isInternalTraffic (url) {
90
- const parsedUrl = parseUrl(url)
91
- return agentRef.beacons.includes(parsedUrl.hostname + ':' + parsedUrl.port)
66
+ globalScope.addEventListener('error', () => {
67
+ handle('uaErr', [], undefined, FEATURE_NAMES.genericEvents, this.ee)
68
+ }, eventListenerOpts(false, this.removeOnAbort?.signal))
69
+
70
+ this.ee.on('open-xhr-start', (args, xhr) => {
71
+ if (!isInternalTraffic(args[1])) {
72
+ xhr.addEventListener('readystatechange', () => {
73
+ if (xhr.readyState === 2) { // HEADERS_RECEIVED
74
+ handle('uaXhr', [], undefined, FEATURE_NAMES.genericEvents, this.ee)
75
+ }
76
+ })
92
77
  }
78
+ })
79
+ this.ee.on('fetch-start', (fetchArguments) => {
80
+ if (fetchArguments.length >= 1 && !isInternalTraffic(extractUrl(fetchArguments[0]))) {
81
+ handle('uaXhr', [], undefined, FEATURE_NAMES.genericEvents, this.ee)
82
+ }
83
+ })
93
84
 
94
- historyEE.on('pushState-end', navigationChange)
95
- historyEE.on('replaceState-end', navigationChange)
96
- window.addEventListener('hashchange', navigationChange, eventListenerOpts(true, this.removeOnAbort?.signal))
97
- window.addEventListener('popstate', navigationChange, eventListenerOpts(true, this.removeOnAbort?.signal))
85
+ function isInternalTraffic (url) {
86
+ const parsedUrl = parseUrl(url)
87
+ return agentRef.beacons.includes(parsedUrl.hostname + ':' + parsedUrl.port)
88
+ }
98
89
 
99
- function navigationChange () {
100
- historyEE.emit('navChange')
101
- }
90
+ historyEE.on('pushState-end', navigationChange)
91
+ historyEE.on('replaceState-end', navigationChange)
92
+ window.addEventListener('hashchange', navigationChange, eventListenerOpts(true, this.removeOnAbort?.signal))
93
+ window.addEventListener('popstate', navigationChange, eventListenerOpts(true, this.removeOnAbort?.signal))
94
+
95
+ function navigationChange () {
96
+ historyEE.emit('navChange')
102
97
  }
103
98
  }
104
99
 
@@ -108,7 +103,10 @@ export class Instrument extends InstrumentBase {
108
103
  handle('browserPerformance.resource', [entry], undefined, this.featureName, this.ee)
109
104
  })
110
105
  })
111
- observer.observe({ type: 'resource', buffered: true })
106
+ observer.observe({
107
+ type: 'resource',
108
+ buffered: true
109
+ })
112
110
  }
113
111
  }
114
112
  if (websocketsEnabled) { // this can apply outside browser scope such as in worker