@newrelic/browser-agent 1.312.1-rc.8 → 1.312.1-rc.9

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.312.1-rc.8";
20
+ const VERSION = exports.VERSION = "1.312.1-rc.9";
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.312.1-rc.8";
20
+ const VERSION = exports.VERSION = "1.312.1-rc.9";
21
21
 
22
22
  /**
23
23
  * Exposes the build type of the agent
@@ -45,6 +45,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
45
45
  this.entitled ??= stEntitled;
46
46
  if (!this.entitled) this.blocked = true;
47
47
  if (this.blocked) return this.deregisterDrain();
48
+ this.timeKeeper ??= this.agentRef.runtime.timeKeeper;
48
49
  if (!this.initialized) {
49
50
  this.initialized = true;
50
51
  /** Store session identifiers at initialization time to be cross-checked later at harvest time for session changes that are subject to race conditions */
@@ -64,9 +65,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
64
65
  // if another page's session entity has expired, or another page has transitioned to off and this one hasn't... we can just abort straight away here
65
66
  if (this.sessionId !== sessionState.value || eventType === 'cross-tab' && sessionState.sessionTraceMode === _constants2.MODE.OFF) this.abort(2);
66
67
  });
67
- const navEntry = (0, _runtime.getNavigationEntry)();
68
- if (navEntry) {
69
- this.traceStorage.storeTiming(navEntry);
68
+ if (typeof PerformanceNavigationTiming !== 'undefined' && _runtime.globalScope.performance?.getEntriesByType('navigation')?.length > 0) {
69
+ this.traceStorage.storeTiming(_runtime.globalScope.performance.getEntriesByType('navigation')[0]);
70
70
  } else {
71
71
  this.traceStorage.storeTiming(_runtime.globalScope.performance?.timing, true);
72
72
  }
@@ -79,7 +79,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
79
79
  /** If the mode is off, we do not want to hold up draining for other features, so we deregister the feature for now.
80
80
  * If it drains later (due to a mode change), data and handlers will instantly drain instead of waiting for the registry. */
81
81
  if (this.mode === _constants2.MODE.OFF) return this.deregisterDrain();
82
- this.timeKeeper ??= this.agentRef.runtime.timeKeeper;
83
82
 
84
83
  /** The handlers set up by the Inst file */
85
84
  (0, _registerHandler.registerHandler)('bst', (...args) => this.traceStorage.storeEvent(...args), this.featureName, this.ee);
@@ -12,7 +12,7 @@ var _constants2 = require("../../constants");
12
12
  var _node = require("./node");
13
13
  var _utils = require("./utils");
14
14
  /**
15
- * Copyright 2020-2025 New Relic, Inc. All rights reserved.
15
+ * Copyright 2020-2026 New Relic, Inc. All rights reserved.
16
16
  * SPDX-License-Identifier: Apache-2.0
17
17
  */
18
18
 
@@ -185,7 +185,7 @@ class TraceStorage {
185
185
  // that are in the future (Microsoft Edge seems to sometimes produce these)
186
186
  if (!(typeof val === 'number' && val >= 0)) continue;
187
187
  val = Math.round(val);
188
- if (this.parent.timeKeeper && this.parent.timeKeeper.ready && isAbsoluteTimestamp) {
188
+ if (isAbsoluteTimestamp && this.parent.timeKeeper?.ready) {
189
189
  val = this.parent.timeKeeper.convertAbsoluteTimestamp(Math.floor(this.parent.timeKeeper.correctAbsoluteTimestamp(val)));
190
190
  }
191
191
  if (!this.#storeSTN(new _node.TraceNode(key, val, val, 'document', 'timing'))) allStored = false;
@@ -11,7 +11,7 @@
11
11
  /**
12
12
  * Exposes the version of the agent
13
13
  */
14
- export const VERSION = "1.312.1-rc.8";
14
+ export const VERSION = "1.312.1-rc.9";
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.312.1-rc.8";
14
+ export const VERSION = "1.312.1-rc.9";
15
15
 
16
16
  /**
17
17
  * Exposes the build type of the agent
@@ -7,7 +7,7 @@ import { FEATURE_NAME } from '../constants';
7
7
  import { AggregateBase } from '../../utils/aggregate-base';
8
8
  import { TraceStorage } from './trace/storage';
9
9
  import { obj as encodeObj } from '../../../common/url/encode';
10
- import { globalScope, getNavigationEntry } from '../../../common/constants/runtime';
10
+ import { globalScope } from '../../../common/constants/runtime';
11
11
  import { MODE, SESSION_EVENTS } from '../../../common/session/constants';
12
12
  import { applyFnToProps } from '../../../common/util/traverse';
13
13
  import { cleanURL } from '../../../common/url/clean-url';
@@ -39,6 +39,7 @@ export class Aggregate extends AggregateBase {
39
39
  this.entitled ??= stEntitled;
40
40
  if (!this.entitled) this.blocked = true;
41
41
  if (this.blocked) return this.deregisterDrain();
42
+ this.timeKeeper ??= this.agentRef.runtime.timeKeeper;
42
43
  if (!this.initialized) {
43
44
  this.initialized = true;
44
45
  /** Store session identifiers at initialization time to be cross-checked later at harvest time for session changes that are subject to race conditions */
@@ -58,9 +59,8 @@ export class Aggregate extends AggregateBase {
58
59
  // if another page's session entity has expired, or another page has transitioned to off and this one hasn't... we can just abort straight away here
59
60
  if (this.sessionId !== sessionState.value || eventType === 'cross-tab' && sessionState.sessionTraceMode === MODE.OFF) this.abort(2);
60
61
  });
61
- const navEntry = getNavigationEntry();
62
- if (navEntry) {
63
- this.traceStorage.storeTiming(navEntry);
62
+ if (typeof PerformanceNavigationTiming !== 'undefined' && globalScope.performance?.getEntriesByType('navigation')?.length > 0) {
63
+ this.traceStorage.storeTiming(globalScope.performance.getEntriesByType('navigation')[0]);
64
64
  } else {
65
65
  this.traceStorage.storeTiming(globalScope.performance?.timing, true);
66
66
  }
@@ -73,7 +73,6 @@ export class Aggregate extends AggregateBase {
73
73
  /** If the mode is off, we do not want to hold up draining for other features, so we deregister the feature for now.
74
74
  * If it drains later (due to a mode change), data and handlers will instantly drain instead of waiting for the registry. */
75
75
  if (this.mode === MODE.OFF) return this.deregisterDrain();
76
- this.timeKeeper ??= this.agentRef.runtime.timeKeeper;
77
76
 
78
77
  /** The handlers set up by the Inst file */
79
78
  registerHandler('bst', (...args) => this.traceStorage.storeEvent(...args), this.featureName, this.ee);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2020-2025 New Relic, Inc. All rights reserved.
2
+ * Copyright 2020-2026 New Relic, Inc. All rights reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { MODE } from '../../../../common/session/constants';
@@ -178,7 +178,7 @@ export class TraceStorage {
178
178
  // that are in the future (Microsoft Edge seems to sometimes produce these)
179
179
  if (!(typeof val === 'number' && val >= 0)) continue;
180
180
  val = Math.round(val);
181
- if (this.parent.timeKeeper && this.parent.timeKeeper.ready && isAbsoluteTimestamp) {
181
+ if (isAbsoluteTimestamp && this.parent.timeKeeper?.ready) {
182
182
  val = this.parent.timeKeeper.convertAbsoluteTimestamp(Math.floor(this.parent.timeKeeper.correctAbsoluteTimestamp(val)));
183
183
  }
184
184
  if (!this.#storeSTN(new TraceNode(key, val, val, 'document', 'timing'))) allStored = false;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IAEjC,2BAgBC;IAZC,0GAA0G;IAC1G,cAAyB;IACzB,mIAAmI;IACnI,uBAA0B;IAC1B,0CAA0C;IAC1C,oBAAuB;IACvB,0GAA0G;IAC1G,2BAA0C;IAO5C,gLAAgL;IAChL,mEA6DC;IAvDG,iCAAuB;IACvB,yJAAyJ;IACzJ,UAAsC;IACtC,eAA2D;IA0BD,UAAgE;IA4B9H,qCAWC;IAED,0CAIC;IAED;;;;;;;MAgDC;IAED,8DAA8D;IAC9D,qBAUC;IAED,2DAA2D;IAC3D,uBAMC;IAED,sCAGC;CACF;8BA/L6B,4BAA4B;6BAC7B,iBAAiB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IAEjC,2BAgBC;IAZC,0GAA0G;IAC1G,cAAyB;IACzB,mIAAmI;IACnI,uBAA0B;IAC1B,0CAA0C;IAC1C,oBAAuB;IACvB,0GAA0G;IAC1G,2BAA0C;IAO5C,gLAAgL;IAChL,mEA2DC;IApDG,iCAAuB;IACvB,yJAAyJ;IACzJ,UAAsC;IACtC,eAA2D;IAyBD,UAAgE;IA0B9H,qCAWC;IAED,0CAIC;IAED;;;;;;;MAgDC;IAED,8DAA8D;IAC9D,qBAUC;IAED,2DAA2D;IAC3D,uBAMC;IAED,sCAGC;CACF;8BA7L6B,4BAA4B;6BAC7B,iBAAiB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.312.1-rc.8",
3
+ "version": "1.312.1-rc.9",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -7,7 +7,7 @@ import { FEATURE_NAME } from '../constants'
7
7
  import { AggregateBase } from '../../utils/aggregate-base'
8
8
  import { TraceStorage } from './trace/storage'
9
9
  import { obj as encodeObj } from '../../../common/url/encode'
10
- import { globalScope, getNavigationEntry } from '../../../common/constants/runtime'
10
+ import { globalScope } from '../../../common/constants/runtime'
11
11
  import { MODE, SESSION_EVENTS } from '../../../common/session/constants'
12
12
  import { applyFnToProps } from '../../../common/util/traverse'
13
13
  import { cleanURL } from '../../../common/url/clean-url'
@@ -41,6 +41,7 @@ export class Aggregate extends AggregateBase {
41
41
  this.entitled ??= stEntitled
42
42
  if (!this.entitled) this.blocked = true
43
43
  if (this.blocked) return this.deregisterDrain()
44
+ this.timeKeeper ??= this.agentRef.runtime.timeKeeper
44
45
 
45
46
  if (!this.initialized) {
46
47
  this.initialized = true
@@ -62,9 +63,8 @@ export class Aggregate extends AggregateBase {
62
63
  if (this.sessionId !== sessionState.value || (eventType === 'cross-tab' && sessionState.sessionTraceMode === MODE.OFF)) this.abort(2)
63
64
  })
64
65
 
65
- const navEntry = getNavigationEntry()
66
- if (navEntry) {
67
- this.traceStorage.storeTiming(navEntry)
66
+ if (typeof PerformanceNavigationTiming !== 'undefined' && globalScope.performance?.getEntriesByType('navigation')?.length > 0) {
67
+ this.traceStorage.storeTiming(globalScope.performance.getEntriesByType('navigation')[0])
68
68
  } else {
69
69
  this.traceStorage.storeTiming(globalScope.performance?.timing, true)
70
70
  }
@@ -79,8 +79,6 @@ export class Aggregate extends AggregateBase {
79
79
  * If it drains later (due to a mode change), data and handlers will instantly drain instead of waiting for the registry. */
80
80
  if (this.mode === MODE.OFF) return this.deregisterDrain()
81
81
 
82
- this.timeKeeper ??= this.agentRef.runtime.timeKeeper
83
-
84
82
  /** The handlers set up by the Inst file */
85
83
  registerHandler('bst', (...args) => this.traceStorage.storeEvent(...args), this.featureName, this.ee)
86
84
  registerHandler('bstResource', (...args) => this.traceStorage.storeResources(...args), this.featureName, this.ee)
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2020-2025 New Relic, Inc. All rights reserved.
2
+ * Copyright 2020-2026 New Relic, Inc. All rights reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { MODE } from '../../../../common/session/constants'
@@ -168,7 +168,7 @@ export class TraceStorage {
168
168
  if (!(typeof val === 'number' && val >= 0)) continue
169
169
 
170
170
  val = Math.round(val)
171
- if (this.parent.timeKeeper && this.parent.timeKeeper.ready && isAbsoluteTimestamp) {
171
+ if (isAbsoluteTimestamp && this.parent.timeKeeper?.ready) {
172
172
  val = this.parent.timeKeeper.convertAbsoluteTimestamp(
173
173
  Math.floor(this.parent.timeKeeper.correctAbsoluteTimestamp(val))
174
174
  )