@newrelic/browser-agent 1.283.2 → 1.284.1

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +1 -1
  3. package/dist/cjs/common/constants/env.cdn.js +2 -2
  4. package/dist/cjs/common/constants/env.npm.js +2 -2
  5. package/dist/cjs/common/util/event-origin.js +36 -0
  6. package/dist/cjs/common/vitals/constants.js +1 -1
  7. package/dist/cjs/features/ajax/instrument/index.js +3 -2
  8. package/dist/cjs/features/jserrors/shared/cast-error.js +5 -5
  9. package/dist/cjs/features/metrics/aggregate/index.js +3 -0
  10. package/dist/cjs/features/metrics/instrument/index.js +7 -0
  11. package/dist/cjs/features/page_view_timing/aggregate/index.js +31 -4
  12. package/dist/cjs/features/session_replay/shared/stylesheet-evaluator.js +1 -1
  13. package/dist/cjs/features/session_trace/aggregate/trace/storage.js +4 -28
  14. package/dist/esm/common/constants/env.cdn.js +2 -2
  15. package/dist/esm/common/constants/env.npm.js +2 -2
  16. package/dist/esm/common/util/event-origin.js +30 -0
  17. package/dist/esm/common/vitals/constants.js +1 -1
  18. package/dist/esm/features/ajax/instrument/index.js +3 -2
  19. package/dist/esm/features/jserrors/shared/cast-error.js +5 -5
  20. package/dist/esm/features/metrics/aggregate/index.js +3 -0
  21. package/dist/esm/features/metrics/instrument/index.js +12 -2
  22. package/dist/esm/features/page_view_timing/aggregate/index.js +31 -4
  23. package/dist/esm/features/session_replay/shared/stylesheet-evaluator.js +1 -1
  24. package/dist/esm/features/session_trace/aggregate/trace/storage.js +4 -28
  25. package/dist/tsconfig.tsbuildinfo +1 -1
  26. package/dist/types/common/util/event-origin.d.ts +13 -0
  27. package/dist/types/common/util/event-origin.d.ts.map +1 -0
  28. package/dist/types/common/vitals/constants.d.ts +1 -1
  29. package/dist/types/features/ajax/instrument/index.d.ts.map +1 -1
  30. package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
  31. package/dist/types/features/metrics/instrument/index.d.ts.map +1 -1
  32. package/dist/types/features/page_view_timing/aggregate/index.d.ts +12 -1
  33. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  34. package/dist/types/features/session_trace/aggregate/trace/storage.d.ts +0 -1
  35. package/dist/types/features/session_trace/aggregate/trace/storage.d.ts.map +1 -1
  36. package/package.json +3 -3
  37. package/src/common/util/event-origin.js +36 -0
  38. package/src/common/vitals/constants.js +1 -1
  39. package/src/common/vitals/interaction-to-next-paint.js +1 -1
  40. package/src/features/ajax/instrument/index.js +3 -2
  41. package/src/features/jserrors/shared/cast-error.js +5 -5
  42. package/src/features/metrics/aggregate/index.js +3 -0
  43. package/src/features/metrics/instrument/index.js +14 -2
  44. package/src/features/page_view_timing/aggregate/index.js +33 -4
  45. package/src/features/session_replay/shared/stylesheet-evaluator.js +1 -1
  46. package/src/features/session_trace/aggregate/trace/storage.js +4 -33
  47. package/dist/cjs/common/vitals/first-input-delay.js +0 -36
  48. package/dist/esm/common/vitals/first-input-delay.js +0 -29
  49. package/dist/types/common/vitals/first-input-delay.d.ts +0 -3
  50. package/dist/types/common/vitals/first-input-delay.d.ts.map +0 -1
  51. package/src/common/vitals/first-input-delay.js +0 -28
@@ -6,6 +6,7 @@ import { globalScope } from '../../../../common/constants/runtime';
6
6
  import { MODE } from '../../../../common/session/constants';
7
7
  import { now } from '../../../../common/timing/now';
8
8
  import { parseUrl } from '../../../../common/url/parse-url';
9
+ import { eventOrigin } from '../../../../common/util/event-origin';
9
10
  import { MAX_NODES_PER_HARVEST } from '../../constants';
10
11
  import { TraceNode } from './node';
11
12
  const ERROR_MODE_SECONDS_WINDOW = 30 * 1000; // sliding window of nodes to track when simply monitoring (but not harvesting) in error mode
@@ -137,13 +138,6 @@ export class TraceStorage {
137
138
  this.storeTiming({
138
139
  [name]: value
139
140
  });
140
- if (hasFID(name, attrs)) this.storeEvent({
141
- type: 'fid',
142
- target: 'document'
143
- }, 'document', value, value + attrs.fid);
144
- function hasFID(name, attrs) {
145
- return name === 'fi' && !!attrs && typeof attrs.fid === 'number';
146
- }
147
141
  }
148
142
  storeTiming(timingEntry, isAbsoluteTimestamp = false) {
149
143
  if (!timingEntry) return;
@@ -176,14 +170,14 @@ export class TraceStorage {
176
170
  try {
177
171
  // webcomponents-lite.js can trigger an exception on currentEvent.target getter because
178
172
  // it does not check currentEvent.currentTarget before calling getRootNode() on it
179
- evt.o = this.evtOrigin(currentEvent.target, target);
173
+ evt.o = eventOrigin(currentEvent.target, target, this.parent.ee);
180
174
  } catch (e) {
181
- evt.o = this.evtOrigin(null, target);
175
+ evt.o = eventOrigin(null, target, this.parent.ee);
182
176
  }
183
177
  this.storeSTN(evt);
184
178
  }
185
179
  shouldIgnoreEvent(event, target) {
186
- const origin = this.evtOrigin(event.target, target);
180
+ const origin = eventOrigin(event.target, target, this.parent.ee);
187
181
  if (event.type in ignoredEvents.global) return true;
188
182
  if (!!ignoredEvents[origin] && ignoredEvents[origin].ignoreAll) return true;
189
183
  return !!(!!ignoredEvents[origin] && event.type in ignoredEvents[origin]);
@@ -213,24 +207,6 @@ export class TraceStorage {
213
207
  return type;
214
208
  }
215
209
  }
216
- evtOrigin(t, target) {
217
- let origin = 'unknown';
218
- if (t && t instanceof XMLHttpRequest) {
219
- const params = this.parent.ee.context(t).params;
220
- if (!params || !params.status || !params.method || !params.host || !params.pathname) return 'xhrOriginMissing';
221
- origin = params.status + ' ' + params.method + ': ' + params.host + params.pathname;
222
- } else if (t && typeof t.tagName === 'string') {
223
- origin = t.tagName.toLowerCase();
224
- if (t.id) origin += '#' + t.id;
225
- if (t.className) {
226
- for (let i = 0; i < t.classList.length; i++) origin += '.' + t.classList[i];
227
- }
228
- }
229
- if (origin === 'unknown') {
230
- if (typeof target === 'string') origin = target;else if (target === document) origin = 'document';else if (target === window) origin = 'window';else if (target instanceof FileReader) origin = 'FileReader';
231
- }
232
- return origin;
233
- }
234
210
 
235
211
  // Tracks when the window history API specified by wrap-history is used.
236
212
  storeHist(path, old, time) {
@@ -1 +1 @@
1
- {"root":["../src/index.js","../src/cdn/experimental.js","../src/cdn/lite.js","../src/cdn/pro.js","../src/cdn/spa.js","../src/common/aggregate/aggregator.js","../src/common/aggregate/event-aggregator.js","../src/common/config/configurable.js","../src/common/config/info.js","../src/common/config/init.js","../src/common/config/loader-config.js","../src/common/config/runtime.js","../src/common/constants/agent-constants.js","../src/common/constants/env.cdn.js","../src/common/constants/env.js","../src/common/constants/env.npm.js","../src/common/constants/runtime.js","../src/common/constants/shared-channel.js","../src/common/context/shared-context.js","../src/common/deny-list/deny-list.js","../src/common/dispatch/global-event.js","../src/common/dom/iframe.js","../src/common/dom/query-selector.js","../src/common/dom/selector-path.js","../src/common/drain/drain.js","../src/common/event-emitter/contextual-ee.js","../src/common/event-emitter/event-context.js","../src/common/event-emitter/handle.js","../src/common/event-emitter/register-handler.js","../src/common/event-listener/event-listener-opts.js","../src/common/harvest/harvester.js","../src/common/harvest/types.js","../src/common/ids/bundle-id.js","../src/common/ids/id.js","../src/common/ids/unique-id.js","../src/common/serialize/bel-serializer.js","../src/common/session/constants.js","../src/common/session/session-entity.js","../src/common/storage/local-storage.js","../src/common/timer/interaction-timer.js","../src/common/timer/timer.js","../src/common/timing/nav-timing.js","../src/common/timing/now.js","../src/common/timing/time-keeper.js","../src/common/unload/eol.js","../src/common/url/canonicalize-url.js","../src/common/url/clean-url.js","../src/common/url/encode.js","../src/common/url/location.js","../src/common/url/parse-url.js","../src/common/url/protocol.js","../src/common/util/console.js","../src/common/util/data-size.js","../src/common/util/feature-flags.js","../src/common/util/get-or-set.js","../src/common/util/invoke.js","../src/common/util/obfuscate.js","../src/common/util/stringify.js","../src/common/util/submit-data.js","../src/common/util/text.js","../src/common/util/traverse.js","../src/common/util/type-check.js","../src/common/vitals/constants.js","../src/common/vitals/cumulative-layout-shift.js","../src/common/vitals/first-contentful-paint.js","../src/common/vitals/first-input-delay.js","../src/common/vitals/first-paint.js","../src/common/vitals/interaction-to-next-paint.js","../src/common/vitals/largest-contentful-paint.js","../src/common/vitals/time-to-first-byte.js","../src/common/vitals/vital-metric.js","../src/common/window/load.js","../src/common/window/nreum.js","../src/common/window/page-visibility.js","../src/common/wrap/wrap-events.js","../src/common/wrap/wrap-fetch.js","../src/common/wrap/wrap-function.js","../src/common/wrap/wrap-history.js","../src/common/wrap/wrap-jsonp.js","../src/common/wrap/wrap-logger.js","../src/common/wrap/wrap-mutation.js","../src/common/wrap/wrap-promise.js","../src/common/wrap/wrap-timer.js","../src/common/wrap/wrap-websocket.js","../src/common/wrap/wrap-xhr.js","../src/features/ajax/constants.js","../src/features/ajax/index.js","../src/features/ajax/aggregate/gql.js","../src/features/ajax/aggregate/index.js","../src/features/ajax/instrument/distributed-tracing.js","../src/features/ajax/instrument/index.js","../src/features/ajax/instrument/response-size.js","../src/features/generic_events/constants.js","../src/features/generic_events/index.js","../src/features/generic_events/aggregate/index.js","../src/features/generic_events/aggregate/user-actions/aggregated-user-action.js","../src/features/generic_events/aggregate/user-actions/user-actions-aggregator.js","../src/features/generic_events/instrument/index.js","../src/features/jserrors/constants.js","../src/features/jserrors/index.js","../src/features/jserrors/aggregate/canonical-function-name.js","../src/features/jserrors/aggregate/compute-stack-trace.js","../src/features/jserrors/aggregate/format-stack-trace.js","../src/features/jserrors/aggregate/index.js","../src/features/jserrors/aggregate/internal-errors.js","../src/features/jserrors/aggregate/string-hash-code.js","../src/features/jserrors/instrument/index.js","../src/features/jserrors/shared/cast-error.js","../src/features/jserrors/shared/uncaught-error.js","../src/features/logging/constants.js","../src/features/logging/index.js","../src/features/logging/aggregate/index.js","../src/features/logging/instrument/index.js","../src/features/logging/shared/log.js","../src/features/logging/shared/utils.js","../src/features/metrics/constants.js","../src/features/metrics/index.js","../src/features/metrics/aggregate/framework-detection.js","../src/features/metrics/aggregate/index.js","../src/features/metrics/aggregate/websocket-detection.js","../src/features/metrics/instrument/index.js","../src/features/page_action/constants.js","../src/features/page_action/index.js","../src/features/page_action/instrument/index.js","../src/features/page_view_event/constants.js","../src/features/page_view_event/index.js","../src/features/page_view_event/aggregate/index.js","../src/features/page_view_event/aggregate/initialized-features.js","../src/features/page_view_event/instrument/index.js","../src/features/page_view_timing/constants.js","../src/features/page_view_timing/index.js","../src/features/page_view_timing/aggregate/index.js","../src/features/page_view_timing/instrument/index.js","../src/features/session_replay/constants.js","../src/features/session_replay/index.js","../src/features/session_replay/aggregate/index.js","../src/features/session_replay/instrument/index.js","../src/features/session_replay/shared/recorder-events.js","../src/features/session_replay/shared/recorder.js","../src/features/session_replay/shared/stylesheet-evaluator.js","../src/features/session_replay/shared/utils.js","../src/features/session_trace/constants.js","../src/features/session_trace/index.js","../src/features/session_trace/aggregate/index.js","../src/features/session_trace/aggregate/trace/node.js","../src/features/session_trace/aggregate/trace/storage.js","../src/features/session_trace/instrument/index.js","../src/features/soft_navigations/constants.js","../src/features/soft_navigations/index.js","../src/features/soft_navigations/aggregate/ajax-node.js","../src/features/soft_navigations/aggregate/bel-node.js","../src/features/soft_navigations/aggregate/index.js","../src/features/soft_navigations/aggregate/initial-page-load-interaction.js","../src/features/soft_navigations/aggregate/interaction.js","../src/features/soft_navigations/instrument/index.js","../src/features/spa/constants.js","../src/features/spa/index.js","../src/features/spa/aggregate/index.js","../src/features/spa/aggregate/interaction-node.js","../src/features/spa/aggregate/interaction.js","../src/features/spa/aggregate/serializer.js","../src/features/spa/instrument/index.js","../src/features/utils/agent-session.js","../src/features/utils/aggregate-base.js","../src/features/utils/event-buffer.js","../src/features/utils/event-store-manager.js","../src/features/utils/feature-base.js","../src/features/utils/feature-gates.js","../src/features/utils/instrument-base.js","../src/features/utils/lazy-feature-loader.js","../src/features/utils/nr1-debugger.js","../src/loaders/agent-base.js","../src/loaders/agent.js","../src/loaders/browser-agent.js","../src/loaders/micro-agent-base.js","../src/loaders/micro-agent.js","../src/loaders/api/api-methods.js","../src/loaders/api/api.js","../src/loaders/api/apiAsync.js","../src/loaders/api/interaction-types.js","../src/loaders/configure/configure.js","../src/loaders/configure/nonce.js","../src/loaders/configure/public-path.js","../src/loaders/features/enabled-features.js","../src/loaders/features/featureDependencies.js","../src/loaders/features/features.js"],"version":"5.7.3"}
1
+ {"root":["../src/index.js","../src/cdn/experimental.js","../src/cdn/lite.js","../src/cdn/pro.js","../src/cdn/spa.js","../src/common/aggregate/aggregator.js","../src/common/aggregate/event-aggregator.js","../src/common/config/configurable.js","../src/common/config/info.js","../src/common/config/init.js","../src/common/config/loader-config.js","../src/common/config/runtime.js","../src/common/constants/agent-constants.js","../src/common/constants/env.cdn.js","../src/common/constants/env.js","../src/common/constants/env.npm.js","../src/common/constants/runtime.js","../src/common/constants/shared-channel.js","../src/common/context/shared-context.js","../src/common/deny-list/deny-list.js","../src/common/dispatch/global-event.js","../src/common/dom/iframe.js","../src/common/dom/query-selector.js","../src/common/dom/selector-path.js","../src/common/drain/drain.js","../src/common/event-emitter/contextual-ee.js","../src/common/event-emitter/event-context.js","../src/common/event-emitter/handle.js","../src/common/event-emitter/register-handler.js","../src/common/event-listener/event-listener-opts.js","../src/common/harvest/harvester.js","../src/common/harvest/types.js","../src/common/ids/bundle-id.js","../src/common/ids/id.js","../src/common/ids/unique-id.js","../src/common/serialize/bel-serializer.js","../src/common/session/constants.js","../src/common/session/session-entity.js","../src/common/storage/local-storage.js","../src/common/timer/interaction-timer.js","../src/common/timer/timer.js","../src/common/timing/nav-timing.js","../src/common/timing/now.js","../src/common/timing/time-keeper.js","../src/common/unload/eol.js","../src/common/url/canonicalize-url.js","../src/common/url/clean-url.js","../src/common/url/encode.js","../src/common/url/location.js","../src/common/url/parse-url.js","../src/common/url/protocol.js","../src/common/util/console.js","../src/common/util/data-size.js","../src/common/util/event-origin.js","../src/common/util/feature-flags.js","../src/common/util/get-or-set.js","../src/common/util/invoke.js","../src/common/util/obfuscate.js","../src/common/util/stringify.js","../src/common/util/submit-data.js","../src/common/util/text.js","../src/common/util/traverse.js","../src/common/util/type-check.js","../src/common/vitals/constants.js","../src/common/vitals/cumulative-layout-shift.js","../src/common/vitals/first-contentful-paint.js","../src/common/vitals/first-paint.js","../src/common/vitals/interaction-to-next-paint.js","../src/common/vitals/largest-contentful-paint.js","../src/common/vitals/time-to-first-byte.js","../src/common/vitals/vital-metric.js","../src/common/window/load.js","../src/common/window/nreum.js","../src/common/window/page-visibility.js","../src/common/wrap/wrap-events.js","../src/common/wrap/wrap-fetch.js","../src/common/wrap/wrap-function.js","../src/common/wrap/wrap-history.js","../src/common/wrap/wrap-jsonp.js","../src/common/wrap/wrap-logger.js","../src/common/wrap/wrap-mutation.js","../src/common/wrap/wrap-promise.js","../src/common/wrap/wrap-timer.js","../src/common/wrap/wrap-websocket.js","../src/common/wrap/wrap-xhr.js","../src/features/ajax/constants.js","../src/features/ajax/index.js","../src/features/ajax/aggregate/gql.js","../src/features/ajax/aggregate/index.js","../src/features/ajax/instrument/distributed-tracing.js","../src/features/ajax/instrument/index.js","../src/features/ajax/instrument/response-size.js","../src/features/generic_events/constants.js","../src/features/generic_events/index.js","../src/features/generic_events/aggregate/index.js","../src/features/generic_events/aggregate/user-actions/aggregated-user-action.js","../src/features/generic_events/aggregate/user-actions/user-actions-aggregator.js","../src/features/generic_events/instrument/index.js","../src/features/jserrors/constants.js","../src/features/jserrors/index.js","../src/features/jserrors/aggregate/canonical-function-name.js","../src/features/jserrors/aggregate/compute-stack-trace.js","../src/features/jserrors/aggregate/format-stack-trace.js","../src/features/jserrors/aggregate/index.js","../src/features/jserrors/aggregate/internal-errors.js","../src/features/jserrors/aggregate/string-hash-code.js","../src/features/jserrors/instrument/index.js","../src/features/jserrors/shared/cast-error.js","../src/features/jserrors/shared/uncaught-error.js","../src/features/logging/constants.js","../src/features/logging/index.js","../src/features/logging/aggregate/index.js","../src/features/logging/instrument/index.js","../src/features/logging/shared/log.js","../src/features/logging/shared/utils.js","../src/features/metrics/constants.js","../src/features/metrics/index.js","../src/features/metrics/aggregate/framework-detection.js","../src/features/metrics/aggregate/index.js","../src/features/metrics/aggregate/websocket-detection.js","../src/features/metrics/instrument/index.js","../src/features/page_action/constants.js","../src/features/page_action/index.js","../src/features/page_action/instrument/index.js","../src/features/page_view_event/constants.js","../src/features/page_view_event/index.js","../src/features/page_view_event/aggregate/index.js","../src/features/page_view_event/aggregate/initialized-features.js","../src/features/page_view_event/instrument/index.js","../src/features/page_view_timing/constants.js","../src/features/page_view_timing/index.js","../src/features/page_view_timing/aggregate/index.js","../src/features/page_view_timing/instrument/index.js","../src/features/session_replay/constants.js","../src/features/session_replay/index.js","../src/features/session_replay/aggregate/index.js","../src/features/session_replay/instrument/index.js","../src/features/session_replay/shared/recorder-events.js","../src/features/session_replay/shared/recorder.js","../src/features/session_replay/shared/stylesheet-evaluator.js","../src/features/session_replay/shared/utils.js","../src/features/session_trace/constants.js","../src/features/session_trace/index.js","../src/features/session_trace/aggregate/index.js","../src/features/session_trace/aggregate/trace/node.js","../src/features/session_trace/aggregate/trace/storage.js","../src/features/session_trace/instrument/index.js","../src/features/soft_navigations/constants.js","../src/features/soft_navigations/index.js","../src/features/soft_navigations/aggregate/ajax-node.js","../src/features/soft_navigations/aggregate/bel-node.js","../src/features/soft_navigations/aggregate/index.js","../src/features/soft_navigations/aggregate/initial-page-load-interaction.js","../src/features/soft_navigations/aggregate/interaction.js","../src/features/soft_navigations/instrument/index.js","../src/features/spa/constants.js","../src/features/spa/index.js","../src/features/spa/aggregate/index.js","../src/features/spa/aggregate/interaction-node.js","../src/features/spa/aggregate/interaction.js","../src/features/spa/aggregate/serializer.js","../src/features/spa/instrument/index.js","../src/features/utils/agent-session.js","../src/features/utils/aggregate-base.js","../src/features/utils/event-buffer.js","../src/features/utils/event-store-manager.js","../src/features/utils/feature-base.js","../src/features/utils/feature-gates.js","../src/features/utils/instrument-base.js","../src/features/utils/lazy-feature-loader.js","../src/features/utils/nr1-debugger.js","../src/loaders/agent-base.js","../src/loaders/agent.js","../src/loaders/browser-agent.js","../src/loaders/micro-agent-base.js","../src/loaders/micro-agent.js","../src/loaders/api/api-methods.js","../src/loaders/api/api.js","../src/loaders/api/apiAsync.js","../src/loaders/api/interaction-types.js","../src/loaders/configure/configure.js","../src/loaders/configure/nonce.js","../src/loaders/configure/public-path.js","../src/loaders/features/enabled-features.js","../src/loaders/features/featureDependencies.js","../src/loaders/features/features.js"],"version":"5.7.3"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright 2020-2025 New Relic, Inc. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * Returns a string representing the origin of an event target. Used by SessionTrace and PageViewTiming features to assign a "better" target to events
7
+ * @param {*} t The target to derive the origin from.
8
+ * @param {*} [target] A known target to compare to. If supplied, and a derived origin could not be reached, this will be referenced.
9
+ * @param {*} [ee] An event emitter instance to use for context retrieval, which only applies to XMLHttpRequests.
10
+ * @returns {string} The derived origin of the event target.
11
+ */
12
+ export function eventOrigin(t: any, target?: any, ee?: any): string;
13
+ //# sourceMappingURL=event-origin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-origin.d.ts","sourceRoot":"","sources":["../../../../src/common/util/event-origin.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AACH,+BALW,GAAC,WACD,GAAC,OACD,GAAC,GACC,MAAM,CAyBlB"}
@@ -1,7 +1,7 @@
1
1
  export namespace VITAL_NAMES {
2
2
  let FIRST_PAINT: string;
3
3
  let FIRST_CONTENTFUL_PAINT: string;
4
- let FIRST_INPUT_DELAY: string;
4
+ let FIRST_INTERACTION: string;
5
5
  let LARGEST_CONTENTFUL_PAINT: string;
6
6
  let CUMULATIVE_LAYOUT_SHIFT: string;
7
7
  let INTERACTION_TO_NEXT_PAINT: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/ajax/instrument/index.js"],"names":[],"mappings":"AA4BA;IACE,2BAAiC;IACjC,2CAkCC;IA/BC,OAA0C;IAE1C,8DAAkF;CA8BrF;AAkWD,qCAA8B;+BApZC,6BAA6B;mBAFzC,uBAAuB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/ajax/instrument/index.js"],"names":[],"mappings":"AA6BA;IACE,2BAAiC;IACjC,2CAkCC;IA/BC,OAA0C;IAE1C,8DAAkF;CA8BrF;AAkWD,qCAA8B;+BArZC,6BAA6B;mBAFzC,uBAAuB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/index.js"],"names":[],"mappings":"AAgBA;IACE,2BAAiC;IACjC,2BAoBC;IAED,iCAAsE;IAEtE,wDAKC;IAED,iDAKC;IAED,qBAmEC;IAED,0BAOC;CACF;8BA1H6B,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/index.js"],"names":[],"mappings":"AAgBA;IACE,2BAAiC;IACjC,2BAoBC;IAED,iCAAsE;IAEtE,wDAKC;IAED,iDAKC;IAED,qBAsEC;IAED,0BAOC;CACF;8BA7H6B,4BAA4B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/instrument/index.js"],"names":[],"mappings":"AAUA;IACE,2BAAiC;IACjC,2CAWC;CACF;AAED,wCAAiC;+BAnBF,6BAA6B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/instrument/index.js"],"names":[],"mappings":"AAgBA;IACE,2BAAiC;IACjC,2CAiBC;CACF;AAED,wCAAiC;+BA/BF,6BAA6B"}
@@ -2,13 +2,24 @@ export class Aggregate extends AggregateBase {
2
2
  static featureName: string;
3
3
  constructor(agentRef: any);
4
4
  curSessEndRecorded: boolean;
5
+ firstIxnRecorded: boolean;
5
6
  /**
6
7
  * Add the time of _document visibilitychange to hidden_ to the next PVT harvest == NRDB pageHide attr.
7
8
  * @param {number} timestamp
8
9
  */
9
10
  endCurrentSession(timestamp: number): void;
10
- addTiming(name: any, value: any, attrs: any): void;
11
+ addTiming(name: any, value: any, attrs: any): {
12
+ name: any;
13
+ value: any;
14
+ attrs: any;
15
+ };
16
+ /**
17
+ * Checks the performance API to see if the agent can set a first interaction event value
18
+ * @returns {void}
19
+ */
20
+ checkForFirstInteraction(): void;
11
21
  appendGlobalCustomAttributes(timing: any): void;
22
+ preHarvestChecks(): boolean;
12
23
  serializer(eventBuffer: any): string;
13
24
  #private;
14
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_timing/aggregate/index.js"],"names":[],"mappings":"AAqBA;IACE,2BAAiC;IAMjC,2BA4BC;IA1BC,4BAA+B;IA4BjC;;;OAGG;IACH,6BAFW,MAAM,QAOhB;IAED,mDAuBC;IAED,gDAUC;IAGD,qCAuBC;;CACF;8BAzH6B,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_timing/aggregate/index.js"],"names":[],"mappings":"AAsBA;IACE,2BAAiC;IAMjC,2BA4BC;IA1BC,4BAA+B;IAC/B,0BAA6B;IA2B/B;;;OAGG;IACH,6BAFW,MAAM,QAOhB;IAED;;;;MA6BC;IAED;;;OAGG;IACH,4BAFa,IAAI,CAahB;IAED,gDAUC;IAED,4BAGC;IAGD,qCAuBC;;CACF;8BAtJ6B,4BAA4B"}
@@ -27,7 +27,6 @@ export class TraceStorage {
27
27
  storeEvent(currentEvent: any, target: any, start: any, end: any): void;
28
28
  shouldIgnoreEvent(event: any, target: any): boolean;
29
29
  evtName(type: any): any;
30
- evtOrigin(t: any, target: any): string;
31
30
  storeHist(path: any, old: any, time: any): void;
32
31
  storeResources(resources: any): void;
33
32
  storeErrorAgg(type: any, name: any, params: any, metrics: any): void;
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../../../src/features/session_trace/aggregate/trace/storage.js"],"names":[],"mappings":"AA6BA,+HAA+H;AAC/H;IAQE,yBAEC;IATD,kBAAa;IACb,UAAU;IACV,0BAA4B;IAC5B,wBAAmB;IACnB,2BAA4B;IAI1B,YAAoB;IAGtB,gGAAgG;IAChG,yBAcC;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAsBlB;IAED,oEAAoE;IACpE;;;;MAgBC;IAED,mEA6BC;IAED,oDAOC;IAED,mEAuBC;IAGD,uEAcC;IAED,oDAKC;IAED,wBAwBC;IAED,uCAuBC;IAGD,gDAEC;IAID,qCAaC;IAGD,qEAGC;IAGD,mEAGC;IAID,mBAEC;IAED,aAEC;IAED;;;;;;;QAEC;IAED,cAMC;IAED,mBAEC;IAED,kBAEC;;CACF"}
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../../../src/features/session_trace/aggregate/trace/storage.js"],"names":[],"mappings":"AA8BA,+HAA+H;AAC/H;IAQE,yBAEC;IATD,kBAAa;IACb,UAAU;IACV,0BAA4B;IAC5B,wBAAmB;IACnB,2BAA4B;IAI1B,YAAoB;IAGtB,gGAAgG;IAChG,yBAcC;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAsBlB;IAED,oEAAoE;IACpE;;;;MAgBC;IAED,mEA6BC;IAED,oDAEC;IAED,mEAuBC;IAGD,uEAcC;IAED,oDAKC;IAED,wBAwBC;IAGD,gDAEC;IAID,qCAaC;IAGD,qEAGC;IAGD,mEAGC;IAID,mBAEC;IAED,aAEC;IAED;;;;;;;QAEC;IAED,cAMC;IAED,mBAEC;IAED,kBAEC;;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.283.2",
3
+ "version": "1.284.1",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -207,8 +207,8 @@
207
207
  },
208
208
  "dependencies": {
209
209
  "fflate": "0.8.2",
210
- "rrweb": "^2.0.0-alpha.17",
211
- "web-vitals": "4.2.3"
210
+ "rrweb": "^2.0.0-alpha.18",
211
+ "web-vitals": "4.2.4"
212
212
  },
213
213
  "devDependencies": {
214
214
  "@babel/cli": "^7.23.4",
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Copyright 2020-2025 New Relic, Inc. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ /**
7
+ * Returns a string representing the origin of an event target. Used by SessionTrace and PageViewTiming features to assign a "better" target to events
8
+ * @param {*} t The target to derive the origin from.
9
+ * @param {*} [target] A known target to compare to. If supplied, and a derived origin could not be reached, this will be referenced.
10
+ * @param {*} [ee] An event emitter instance to use for context retrieval, which only applies to XMLHttpRequests.
11
+ * @returns {string} The derived origin of the event target.
12
+ */
13
+ export function eventOrigin (t, target, ee) {
14
+ let origin = 'unknown'
15
+
16
+ if (t && t instanceof XMLHttpRequest) {
17
+ const params = ee.context(t).params
18
+ if (!params || !params.status || !params.method || !params.host || !params.pathname) return 'xhrOriginMissing'
19
+ origin = params.status + ' ' + params.method + ': ' + params.host + params.pathname
20
+ } else if (t && typeof (t.tagName) === 'string') {
21
+ origin = t.tagName.toLowerCase()
22
+ if (t.id) origin += '#' + t.id
23
+ if (t.className) {
24
+ for (let i = 0; i < t.classList.length; i++) origin += '.' + t.classList[i]
25
+ }
26
+ }
27
+
28
+ if (origin === 'unknown') {
29
+ if (typeof target === 'string') origin = target
30
+ else if (target === document) origin = 'document'
31
+ else if (target === window) origin = 'window'
32
+ else if (target instanceof FileReader) origin = 'FileReader'
33
+ }
34
+
35
+ return origin
36
+ }
@@ -5,7 +5,7 @@
5
5
  export const VITAL_NAMES = {
6
6
  FIRST_PAINT: 'fp',
7
7
  FIRST_CONTENTFUL_PAINT: 'fcp',
8
- FIRST_INPUT_DELAY: 'fi',
8
+ FIRST_INTERACTION: 'fi',
9
9
  LARGEST_CONTENTFUL_PAINT: 'lcp',
10
10
  CUMULATIVE_LAYOUT_SHIFT: 'cls',
11
11
  INTERACTION_TO_NEXT_PAINT: 'inp',
@@ -10,7 +10,7 @@ import { isBrowserScope } from '../constants/runtime'
10
10
  export const interactionToNextPaint = new VitalMetric(VITAL_NAMES.INTERACTION_TO_NEXT_PAINT)
11
11
 
12
12
  if (isBrowserScope) {
13
- /* Interaction-to-Next-Paint */
13
+ /* Interaction-to-Next-Paint */
14
14
  onINP(({ value, attribution, id }) => {
15
15
  const attrs = {
16
16
  metricId: id,
@@ -25,6 +25,7 @@ var handlersLen = handlers.length
25
25
 
26
26
  var origRequest = gosNREUMOriginals().o.REQ
27
27
  var origXHR = gosNREUMOriginals().o.XHR
28
+ const NR_CAT_HEADER = 'X-NewRelic-App-Data'
28
29
 
29
30
  export class Instrument extends InstrumentBase {
30
31
  static featureName = FEATURE_NAME
@@ -392,8 +393,8 @@ function subscribeToEvents (agentRef, ee, handler, dt) {
392
393
  var size = responseSizeFromXhr(xhr, ctx.lastSize)
393
394
  if (size) ctx.metrics.rxSize = size
394
395
 
395
- if (ctx.sameOrigin) {
396
- var header = xhr.getResponseHeader('X-NewRelic-App-Data')
396
+ if (ctx.sameOrigin && xhr.getAllResponseHeaders().indexOf(NR_CAT_HEADER) >= 0) {
397
+ var header = xhr.getResponseHeader(NR_CAT_HEADER)
397
398
  if (header) {
398
399
  handle(SUPPORTABILITY_METRIC, ['Ajax/CrossApplicationTracing/Header/Seen'], undefined, FEATURE_NAMES.metrics, ee)
399
400
  ctx.params.cat = header.split(', ').pop()
@@ -35,7 +35,7 @@ export function castError (error) {
35
35
  * @returns {Error} An Error object with the message as the casted reason
36
36
  */
37
37
  export function castPromiseRejectionEvent (promiseRejectionEvent) {
38
- const prefix = 'Unhandled Promise Rejection'
38
+ const prefix = 'Unhandled Promise Rejection: '
39
39
 
40
40
  /**
41
41
  * If the casted return value is falsy like this, it will get dropped and not produce an error event for harvest.
@@ -46,15 +46,15 @@ export function castPromiseRejectionEvent (promiseRejectionEvent) {
46
46
 
47
47
  if (canTrustError(promiseRejectionEvent.reason)) {
48
48
  try {
49
- promiseRejectionEvent.reason.message = prefix + ': ' + promiseRejectionEvent.reason.message
50
- return castError(promiseRejectionEvent.reason)
49
+ if (!promiseRejectionEvent.reason.message.startsWith(prefix)) promiseRejectionEvent.reason.message = prefix + promiseRejectionEvent.reason.message
51
50
  } catch (e) {
52
- return castError(promiseRejectionEvent.reason)
51
+ // failed to modify the message, do nothing else
53
52
  }
53
+ return castError(promiseRejectionEvent.reason)
54
54
  }
55
55
 
56
56
  const error = castError(promiseRejectionEvent.reason)
57
- error.message = prefix + ': ' + error?.message
57
+ if (!((error.message || '').startsWith(prefix))) error.message = prefix + error.message
58
58
  return error
59
59
  }
60
60
 
@@ -116,6 +116,9 @@ export class Aggregate extends AggregateBase {
116
116
  mo.observe(window.document.body, { childList: true, subtree: true })
117
117
  }
118
118
 
119
+ // webdriver detection
120
+ if (navigator.webdriver) this.storeSupportabilityMetrics('Generic/WebDriver/Detected')
121
+
119
122
  // WATCHABLE_WEB_SOCKET_EVENTS.forEach(tag => {
120
123
  // registerHandler('buffered-' + WEBSOCKET_TAG + tag, (...args) => {
121
124
  // handleWebsocketEvents(this.storeSupportabilityMetrics.bind(this), tag, ...args)
@@ -3,10 +3,16 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
6
+ import { isBrowserScope } from '../../../common/constants/runtime'
7
+ import { handle } from '../../../common/event-emitter/handle'
8
+ import { InstrumentBase } from '../../utils/instrument-base'
9
+ import {
10
+ FEATURE_NAME,
11
+ // WATCHABLE_WEB_SOCKET_EVENTS,
12
+ SUPPORTABILITY_METRIC_CHANNEL
13
+ } from '../constants'
6
14
  // import { handle } from '../../../common/event-emitter/handle'
7
15
  // import { WEBSOCKET_TAG, wrapWebSocket } from '../../../common/wrap/wrap-websocket'
8
- import { InstrumentBase } from '../../utils/instrument-base'
9
- import { FEATURE_NAME } from '../constants'
10
16
 
11
17
  export class Instrument extends InstrumentBase {
12
18
  static featureName = FEATURE_NAME
@@ -20,6 +26,12 @@ export class Instrument extends InstrumentBase {
20
26
  // })
21
27
  // })
22
28
 
29
+ if (isBrowserScope) {
30
+ document.addEventListener('securitypolicyviolation', (e) => {
31
+ handle(SUPPORTABILITY_METRIC_CHANNEL, ['Generic/CSPViolation/Detected'], undefined, this.featureName, this.ee)
32
+ })
33
+ }
34
+
23
35
  this.importAggregator(agentRef)
24
36
  }
25
37
  }
@@ -11,13 +11,14 @@ import { FEATURE_NAMES } from '../../../loaders/features/features'
11
11
  import { AggregateBase } from '../../utils/aggregate-base'
12
12
  import { cumulativeLayoutShift } from '../../../common/vitals/cumulative-layout-shift'
13
13
  import { firstContentfulPaint } from '../../../common/vitals/first-contentful-paint'
14
- import { firstInputDelay } from '../../../common/vitals/first-input-delay'
15
14
  import { firstPaint } from '../../../common/vitals/first-paint'
16
15
  import { interactionToNextPaint } from '../../../common/vitals/interaction-to-next-paint'
17
16
  import { largestContentfulPaint } from '../../../common/vitals/largest-contentful-paint'
18
17
  import { timeToFirstByte } from '../../../common/vitals/time-to-first-byte'
19
18
  import { subscribeToVisibilityChange } from '../../../common/window/page-visibility'
20
19
  import { VITAL_NAMES } from '../../../common/vitals/constants'
20
+ import { initiallyHidden } from '../../../common/constants/runtime'
21
+ import { eventOrigin } from '../../../common/util/event-origin'
21
22
 
22
23
  export class Aggregate extends AggregateBase {
23
24
  static featureName = FEATURE_NAME
@@ -29,6 +30,7 @@ export class Aggregate extends AggregateBase {
29
30
  constructor (agentRef) {
30
31
  super(agentRef, FEATURE_NAME)
31
32
  this.curSessEndRecorded = false
33
+ this.firstIxnRecorded = false
32
34
 
33
35
  registerHandler('docHidden', msTimestamp => this.endCurrentSession(msTimestamp), this.featureName, this.ee)
34
36
  // Add the time of _window pagehide event_ firing to the next PVT harvest == NRDB windowUnload attr:
@@ -37,7 +39,6 @@ export class Aggregate extends AggregateBase {
37
39
  this.waitForFlags(([])).then(() => {
38
40
  firstPaint.subscribe(this.#handleVitalMetric)
39
41
  firstContentfulPaint.subscribe(this.#handleVitalMetric)
40
- firstInputDelay.subscribe(this.#handleVitalMetric)
41
42
  largestContentfulPaint.subscribe(this.#handleVitalMetric)
42
43
  interactionToNextPaint.subscribe(this.#handleVitalMetric)
43
44
  timeToFirstByte.subscribe(({ attrs }) => {
@@ -83,13 +84,36 @@ export class Aggregate extends AggregateBase {
83
84
  attrs.cls = cumulativeLayoutShift.current.value
84
85
  }
85
86
 
86
- this.events.add({
87
+ const timing = {
87
88
  name,
88
89
  value,
89
90
  attrs
90
- })
91
+ }
92
+ this.events.add(timing)
91
93
 
92
94
  handle('pvtAdded', [name, value, attrs], undefined, FEATURE_NAMES.sessionTrace, this.ee)
95
+
96
+ this.checkForFirstInteraction()
97
+
98
+ // makes testing easier
99
+ return timing
100
+ }
101
+
102
+ /**
103
+ * Checks the performance API to see if the agent can set a first interaction event value
104
+ * @returns {void}
105
+ */
106
+ checkForFirstInteraction () {
107
+ // preserve the original behavior where FID is not reported if the page is hidden before the first interaction
108
+ if (this.firstIxnRecorded || initiallyHidden || !performance) return
109
+ const firstInput = performance.getEntriesByType('first-input')[0]
110
+ if (!firstInput) return
111
+ this.firstIxnRecorded = true
112
+ this.addTiming('fi', firstInput.startTime, {
113
+ type: firstInput.name,
114
+ eventTarget: eventOrigin(firstInput.target),
115
+ loadState: document.readyState
116
+ })
93
117
  }
94
118
 
95
119
  appendGlobalCustomAttributes (timing) {
@@ -104,6 +128,11 @@ export class Aggregate extends AggregateBase {
104
128
  })
105
129
  }
106
130
 
131
+ preHarvestChecks () {
132
+ this.checkForFirstInteraction()
133
+ return super.preHarvestChecks()
134
+ }
135
+
107
136
  // serialize array of timing data
108
137
  serializer (eventBuffer) {
109
138
  var addString = getAddStringContext(this.agentIdentifier)
@@ -24,7 +24,7 @@ class StylesheetEvaluator {
24
24
  this.#brokenSheets = []
25
25
  if (isBrowserScope) {
26
26
  for (let i = 0; i < Object.keys(document.styleSheets).length; i++) {
27
- if (!this.#evaluated.has(document.styleSheets[i])) {
27
+ if (!this.#evaluated.has(document.styleSheets[i]) && document.styleSheets[i] instanceof CSSStyleSheet) {
28
28
  this.#evaluated.add(document.styleSheets[i])
29
29
  try {
30
30
  // eslint-disable-next-line
@@ -6,6 +6,7 @@ import { globalScope } from '../../../../common/constants/runtime'
6
6
  import { MODE } from '../../../../common/session/constants'
7
7
  import { now } from '../../../../common/timing/now'
8
8
  import { parseUrl } from '../../../../common/url/parse-url'
9
+ import { eventOrigin } from '../../../../common/util/event-origin'
9
10
  import { MAX_NODES_PER_HARVEST } from '../../constants'
10
11
  import { TraceNode } from './node'
11
12
 
@@ -136,11 +137,6 @@ export class TraceStorage {
136
137
 
137
138
  processPVT (name, value, attrs) {
138
139
  this.storeTiming({ [name]: value })
139
- if (hasFID(name, attrs)) this.storeEvent({ type: 'fid', target: 'document' }, 'document', value, value + attrs.fid)
140
-
141
- function hasFID (name, attrs) {
142
- return name === 'fi' && !!attrs && typeof attrs.fid === 'number'
143
- }
144
140
  }
145
141
 
146
142
  storeTiming (timingEntry, isAbsoluteTimestamp = false) {
@@ -178,15 +174,15 @@ export class TraceStorage {
178
174
  try {
179
175
  // webcomponents-lite.js can trigger an exception on currentEvent.target getter because
180
176
  // it does not check currentEvent.currentTarget before calling getRootNode() on it
181
- evt.o = this.evtOrigin(currentEvent.target, target)
177
+ evt.o = eventOrigin(currentEvent.target, target, this.parent.ee)
182
178
  } catch (e) {
183
- evt.o = this.evtOrigin(null, target)
179
+ evt.o = eventOrigin(null, target, this.parent.ee)
184
180
  }
185
181
  this.storeSTN(evt)
186
182
  }
187
183
 
188
184
  shouldIgnoreEvent (event, target) {
189
- const origin = this.evtOrigin(event.target, target)
185
+ const origin = eventOrigin(event.target, target, this.parent.ee)
190
186
  if (event.type in ignoredEvents.global) return true
191
187
  if (!!ignoredEvents[origin] && ignoredEvents[origin].ignoreAll) return true
192
188
  return !!(!!ignoredEvents[origin] && event.type in ignoredEvents[origin])
@@ -218,31 +214,6 @@ export class TraceStorage {
218
214
  }
219
215
  }
220
216
 
221
- evtOrigin (t, target) {
222
- let origin = 'unknown'
223
-
224
- if (t && t instanceof XMLHttpRequest) {
225
- const params = this.parent.ee.context(t).params
226
- if (!params || !params.status || !params.method || !params.host || !params.pathname) return 'xhrOriginMissing'
227
- origin = params.status + ' ' + params.method + ': ' + params.host + params.pathname
228
- } else if (t && typeof (t.tagName) === 'string') {
229
- origin = t.tagName.toLowerCase()
230
- if (t.id) origin += '#' + t.id
231
- if (t.className) {
232
- for (let i = 0; i < t.classList.length; i++) origin += '.' + t.classList[i]
233
- }
234
- }
235
-
236
- if (origin === 'unknown') {
237
- if (typeof target === 'string') origin = target
238
- else if (target === document) origin = 'document'
239
- else if (target === window) origin = 'window'
240
- else if (target instanceof FileReader) origin = 'FileReader'
241
- }
242
-
243
- return origin
244
- }
245
-
246
217
  // Tracks when the window history API specified by wrap-history is used.
247
218
  storeHist (path, old, time) {
248
219
  this.storeSTN(new TraceNode('history.pushState', time, time, path, old))
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.firstInputDelay = void 0;
7
- var _attribution = require("web-vitals/attribution");
8
- var _vitalMetric = require("./vital-metric");
9
- var _constants = require("./constants");
10
- var _runtime = require("../constants/runtime");
11
- /**
12
- * Copyright 2020-2025 New Relic, Inc. All rights reserved.
13
- * SPDX-License-Identifier: Apache-2.0
14
- */
15
-
16
- const firstInputDelay = exports.firstInputDelay = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_INPUT_DELAY);
17
- if (_runtime.isBrowserScope) {
18
- (0, _attribution.onFID)(({
19
- value,
20
- attribution
21
- }) => {
22
- if (_runtime.initiallyHidden || firstInputDelay.isValid) return;
23
- const attrs = {
24
- type: attribution.eventType,
25
- fid: Math.round(value),
26
- eventTarget: attribution.eventTarget,
27
- loadState: attribution.loadState
28
- };
29
-
30
- // CWV will only report one (THE) first-input entry to us; fid isn't reported if there are no user interactions occurs before the *first* page hiding.
31
- firstInputDelay.update({
32
- value: attribution.eventTime,
33
- attrs
34
- });
35
- });
36
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * Copyright 2020-2025 New Relic, Inc. All rights reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { onFID } from 'web-vitals/attribution';
6
- import { VitalMetric } from './vital-metric';
7
- import { VITAL_NAMES } from './constants';
8
- import { initiallyHidden, isBrowserScope } from '../constants/runtime';
9
- export const firstInputDelay = new VitalMetric(VITAL_NAMES.FIRST_INPUT_DELAY);
10
- if (isBrowserScope) {
11
- onFID(({
12
- value,
13
- attribution
14
- }) => {
15
- if (initiallyHidden || firstInputDelay.isValid) return;
16
- const attrs = {
17
- type: attribution.eventType,
18
- fid: Math.round(value),
19
- eventTarget: attribution.eventTarget,
20
- loadState: attribution.loadState
21
- };
22
-
23
- // CWV will only report one (THE) first-input entry to us; fid isn't reported if there are no user interactions occurs before the *first* page hiding.
24
- firstInputDelay.update({
25
- value: attribution.eventTime,
26
- attrs
27
- });
28
- });
29
- }
@@ -1,3 +0,0 @@
1
- export const firstInputDelay: VitalMetric;
2
- import { VitalMetric } from './vital-metric';
3
- //# sourceMappingURL=first-input-delay.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"first-input-delay.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/first-input-delay.js"],"names":[],"mappings":"AASA,0CAA6E;4BAJjD,gBAAgB"}