@newrelic/browser-agent 1.319.0 → 1.320.0

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 (84) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/common/config/init.js +17 -2
  3. package/dist/cjs/common/config/runtime.js +2 -1
  4. package/dist/cjs/common/constants/env.cdn.js +1 -1
  5. package/dist/cjs/common/constants/env.npm.js +1 -1
  6. package/dist/cjs/common/constants/iframe-constants.js +16 -0
  7. package/dist/cjs/common/url/add-url.js +23 -0
  8. package/dist/cjs/common/util/console.js +40 -33
  9. package/dist/cjs/common/v2/mfe-vitals.js +9 -2
  10. package/dist/cjs/common/v2/script-correlation.js +2 -0
  11. package/dist/cjs/common/v2/script-tracker-constants.js +13 -0
  12. package/dist/cjs/common/v2/script-tracker.js +54 -29
  13. package/dist/cjs/common/v2/timing-factory.js +18 -0
  14. package/dist/cjs/common/v2/utils.js +100 -6
  15. package/dist/cjs/features/ajax/instrument/index.js +4 -14
  16. package/dist/cjs/features/utils/instrument-base.js +13 -0
  17. package/dist/cjs/interfaces/registered-iframe-entity.js +527 -0
  18. package/dist/cjs/loaders/api/register.js +10 -6
  19. package/dist/cjs/loaders/configure/configure.js +14 -0
  20. package/dist/cjs/loaders/configure/iframe-message-handler.js +270 -0
  21. package/dist/esm/common/config/init.js +17 -2
  22. package/dist/esm/common/config/runtime.js +2 -1
  23. package/dist/esm/common/constants/env.cdn.js +1 -1
  24. package/dist/esm/common/constants/env.npm.js +1 -1
  25. package/dist/esm/common/constants/iframe-constants.js +10 -0
  26. package/dist/esm/common/url/add-url.js +16 -0
  27. package/dist/esm/common/util/console.js +40 -33
  28. package/dist/esm/common/v2/mfe-vitals.js +9 -2
  29. package/dist/esm/common/v2/script-correlation.js +2 -0
  30. package/dist/esm/common/v2/script-tracker-constants.js +7 -0
  31. package/dist/esm/common/v2/script-tracker.js +54 -29
  32. package/dist/esm/common/v2/timing-factory.js +12 -0
  33. package/dist/esm/common/v2/utils.js +97 -6
  34. package/dist/esm/features/ajax/instrument/index.js +1 -11
  35. package/dist/esm/features/utils/instrument-base.js +13 -0
  36. package/dist/esm/interfaces/registered-iframe-entity.js +518 -0
  37. package/dist/esm/loaders/api/register.js +10 -6
  38. package/dist/esm/loaders/configure/configure.js +15 -1
  39. package/dist/esm/loaders/configure/iframe-message-handler.js +263 -0
  40. package/dist/tsconfig.tsbuildinfo +1 -1
  41. package/dist/types/common/config/init.d.ts.map +1 -1
  42. package/dist/types/common/config/runtime.d.ts.map +1 -1
  43. package/dist/types/common/constants/iframe-constants.d.ts +11 -0
  44. package/dist/types/common/constants/iframe-constants.d.ts.map +1 -0
  45. package/dist/types/common/url/add-url.d.ts +2 -0
  46. package/dist/types/common/url/add-url.d.ts.map +1 -0
  47. package/dist/types/common/util/console.d.ts +40 -33
  48. package/dist/types/common/util/console.d.ts.map +1 -1
  49. package/dist/types/common/v2/mfe-vitals.d.ts.map +1 -1
  50. package/dist/types/common/v2/script-correlation.d.ts +2 -0
  51. package/dist/types/common/v2/script-correlation.d.ts.map +1 -1
  52. package/dist/types/common/v2/script-tracker-constants.d.ts +7 -0
  53. package/dist/types/common/v2/script-tracker-constants.d.ts.map +1 -0
  54. package/dist/types/common/v2/script-tracker.d.ts +4 -1
  55. package/dist/types/common/v2/script-tracker.d.ts.map +1 -1
  56. package/dist/types/common/v2/timing-factory.d.ts +9 -0
  57. package/dist/types/common/v2/timing-factory.d.ts.map +1 -0
  58. package/dist/types/common/v2/utils.d.ts +37 -0
  59. package/dist/types/common/v2/utils.d.ts.map +1 -1
  60. package/dist/types/features/ajax/instrument/index.d.ts.map +1 -1
  61. package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
  62. package/dist/types/interfaces/registered-iframe-entity.d.ts +116 -0
  63. package/dist/types/interfaces/registered-iframe-entity.d.ts.map +1 -0
  64. package/dist/types/loaders/configure/configure.d.ts.map +1 -1
  65. package/dist/types/loaders/configure/iframe-message-handler.d.ts +17 -0
  66. package/dist/types/loaders/configure/iframe-message-handler.d.ts.map +1 -0
  67. package/package.json +9 -1
  68. package/src/common/config/init.js +13 -2
  69. package/src/common/config/runtime.js +2 -1
  70. package/src/common/constants/iframe-constants.js +11 -0
  71. package/src/common/url/add-url.js +18 -0
  72. package/src/common/util/console.js +40 -33
  73. package/src/common/v2/mfe-vitals.js +7 -4
  74. package/src/common/v2/script-correlation.js +2 -0
  75. package/src/common/v2/script-tracker-constants.js +7 -0
  76. package/src/common/v2/script-tracker.js +65 -26
  77. package/src/common/v2/timing-factory.js +10 -0
  78. package/src/common/v2/utils.js +102 -6
  79. package/src/features/ajax/instrument/index.js +1 -13
  80. package/src/features/utils/instrument-base.js +12 -0
  81. package/src/interfaces/registered-iframe-entity.js +482 -0
  82. package/src/loaders/api/register.js +9 -5
  83. package/src/loaders/configure/configure.js +15 -1
  84. package/src/loaders/configure/iframe-message-handler.js +244 -0
@@ -0,0 +1,263 @@
1
+ /**
2
+ * Copyright 2020-2026 New Relic, Inc. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { warn } from '../../common/util/console';
6
+ import { getRegisteredEntityByIframeInterfaceId } from '../../common/v2/utils';
7
+ import { IFRAME_TIMING_UPDATE, IFRAME_API, IFRAME_API_RESPONSE, IFRAME_VITALS_UPDATE, IFRAME_AJAX } from '../../common/constants/iframe-constants';
8
+ import { REGISTER } from '../api/constants';
9
+ import { handle } from '../../common/event-emitter/handle';
10
+ import { FEATURE_NAMES } from '../features/features';
11
+ import { stringify } from '../../common/util/stringify';
12
+ import { registerHandler } from '../../common/event-emitter/register-handler';
13
+ import { drain } from '../../common/drain/drain';
14
+ import { isBrowserScope } from '../../common/constants/runtime';
15
+
16
+ /**
17
+ * Retrieves the registered entity associated with the iframeInterfaceId from the event data, and validates that the origin of the message event matches the expected origin for that entity.
18
+ * @param {MessageEvent} event - The message event containing the method call or registration request
19
+ * @param {Object} agent - The browser agent instance
20
+ * @returns {Object|undefined} - The registered entity if it exists and the origin is valid, otherwise undefined
21
+ */
22
+ function getValidEntity(event, agent) {
23
+ try {
24
+ const {
25
+ iframeInterfaceId
26
+ } = event.data;
27
+ if (!iframeInterfaceId) return;
28
+ const entity = getRegisteredEntityByIframeInterfaceId(iframeInterfaceId, agent);
29
+ if (!isValidOrigin(event, entity)) return;
30
+ return entity;
31
+ } catch (e) {
32
+ // couldnt get entity or validate origin, just let the method return undefined
33
+ }
34
+ }
35
+ function isSafeProperty(obj, property) {
36
+ return property in obj && typeof property === 'string' && !['__proto__', 'constructor', 'prototype'].includes(property);
37
+ }
38
+
39
+ /**
40
+ * Handles timing property updates from iframes. Mutates the timings object on the entity's metadata with the new value for the specified property.
41
+ * @param {MessageEvent} event - The message event containing the timing update
42
+ * @param {Object} agent - The browser agent instance
43
+ * @returns
44
+ */
45
+ function handleTimingUpdate(event, agent) {
46
+ const entity = getValidEntity(event, agent);
47
+ if (!entity) return;
48
+ if (!entity.metadata.timings) return;
49
+ event.data.entries?.forEach(({
50
+ property,
51
+ value
52
+ }) => {
53
+ if (isSafeProperty(entity.metadata.timings, property)) {
54
+ entity.metadata.timings[property] = value;
55
+ }
56
+ });
57
+ }
58
+
59
+ /**
60
+ * Handles vitals property updates from iframes. Mutates the vitals object on the entity's metadata with the new value for the specified property.
61
+ * @param {MessageEvent} event - The message event containing the vitals update
62
+ * @param {Object} agent - The browser agent instance
63
+ * @returns
64
+ */
65
+ function handleVitalsUpdate(event, agent) {
66
+ const entity = getValidEntity(event, agent);
67
+ if (!entity) return;
68
+ if (!entity.metadata?.vitals) return;
69
+ event.data.entries?.forEach(({
70
+ property,
71
+ value
72
+ }) => {
73
+ if (isSafeProperty(entity.metadata.vitals, property) && (!!Number(value) || value === 0)) {
74
+ entity.metadata.vitals[property].value = value;
75
+ }
76
+ });
77
+ }
78
+
79
+ /**
80
+ * Handles ajax events from iframes and forwards them to the agent's event emitter
81
+ * @param {MessageEvent} event - The message event containing the method call or registration request
82
+ * @param {Object} agent - The browser agent instance
83
+ * @returns
84
+ */
85
+ function handleAjax(event, agent) {
86
+ const entity = getValidEntity(event, agent);
87
+ if (!entity) return;
88
+ const {
89
+ entries
90
+ } = event.data;
91
+ entries?.forEach(({
92
+ params,
93
+ metrics,
94
+ start,
95
+ end,
96
+ initiatorType
97
+ }) => {
98
+ handle('xhr', [params, metrics, start, end, initiatorType, entity.metadata.target], undefined, FEATURE_NAMES.ajax, agent.ee);
99
+ });
100
+ }
101
+
102
+ /**
103
+ * Validates that the origin of the message event matches the expected origin for the registered entity
104
+ * @param {MessageEvent} event - The message event containing the method call or registration request
105
+ * @param {Object} entity - The registered entity associated with the iframeInterfaceId from the event data
106
+ * @returns {boolean}
107
+ */
108
+ function isValidOrigin(event, entity) {
109
+ if (!entity) return false;
110
+ try {
111
+ // "null" is the literal serialization the spec uses for every opaque origin (sandboxed iframes
112
+ // without allow-same-origin, data:/javascript: URLs, etc.) -- it does not uniquely identify a
113
+ // single origin, so treating two "null" origins as a match would let an unrelated opaque-origin
114
+ // frame impersonate the one that actually registered.
115
+ if (event.origin === 'null' || entity.metadata.target.iframeOrigin === 'null') return false;
116
+ return event.origin === entity.metadata.target.iframeOrigin;
117
+ } catch (e) {
118
+ warn(77, e);
119
+ return false;
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Handles both entity registration and method calls on existing entities
125
+ * @async
126
+ * @param {MessageEvent} event - The message event containing the method call or registration request
127
+ * @param {Object} agent - The browser agent instance
128
+ * @returns {Promise<{entity: Object|null, result: any}>}
129
+ */
130
+ export async function handleMethodCall(event, agent) {
131
+ const {
132
+ target,
133
+ iframeInterfaceId,
134
+ timestamp
135
+ } = event.data;
136
+ // Method calls are always sent one-at-a-time (each has its own postMessage response), so only
137
+ // the first entry is ever populated -- but the payload shape stays consistent with every other
138
+ // iframe message type (timing/vitals/ajax), which all wrap their data in an `entries` array.
139
+ const [{
140
+ method,
141
+ args
142
+ } = {}] = event.data.entries || [];
143
+ const output = {
144
+ entity: null,
145
+ result: null
146
+ };
147
+ // Registration of a new entity needs to be handled differently than method calls on existing entities
148
+ if (method === REGISTER) {
149
+ // "null" is the opaque-origin serialization (sandboxed iframes, data:/javascript: URLs) -- it
150
+ // doesn't identify a single origin, so an entity registered from one can never be safely
151
+ // distinguished from another later on (see isValidOrigin). Reject up front rather than
152
+ // registering an entity that would silently fail every subsequent call.
153
+ if (event.origin === 'null') {
154
+ warn(74, event.origin);
155
+ return output;
156
+ }
157
+ const iframeDomains = agent.init.api.register.iframe_domains;
158
+ if (iframeDomains.length && !iframeDomains.includes(event.origin)) {
159
+ warn(74, event.origin);
160
+ return output;
161
+ }
162
+ const targetData = args?.[0] || target || {};
163
+ if (!agent[REGISTER]) {
164
+ warn(35, REGISTER);
165
+ return output;
166
+ }
167
+ const freshTarget = {
168
+ id: targetData.id,
169
+ name: targetData.name,
170
+ type: targetData.type,
171
+ version: targetData.version,
172
+ tags: targetData.tags
173
+ };
174
+ output.entity = agent[REGISTER](freshTarget);
175
+ output.entity.metadata.target.iframeInterfaceId = iframeInterfaceId;
176
+ output.entity.metadata.target.iframeOrigin = event.origin;
177
+ return output;
178
+ }
179
+ const entity = getRegisteredEntityByIframeInterfaceId(iframeInterfaceId, agent);
180
+ if (!isValidOrigin(event, entity)) {
181
+ warn(76);
182
+ return output;
183
+ }
184
+ output.entity = entity;
185
+ const methodFn = entity[method];
186
+ if (!isSafeProperty(entity, method) || typeof methodFn !== 'function') {
187
+ warn(35, method);
188
+ return output;
189
+ }
190
+
191
+ // Supply the timestamp captured inside the iframe at call time (from event.data.timestamp)
192
+ entity.metadata.events.latestTimestamp = timestamp;
193
+ output.result = await methodFn.apply(entity, args || []);
194
+ return output;
195
+ }
196
+
197
+ /**
198
+ * Serializes entity metadata for postMessage response.
199
+ * Strips out any non-serializable properties and returns a plain object.
200
+ * postMessage cant handle complex objects that cause DataCloneErrors to throw like functions, circular references, etc.
201
+ * @param {Object} entity - The registered entity whose metadata is to be serialized. Uses a pattern of stringify and parse to remove any non-serializable properties from the metadata object.
202
+ * @returns {Object} - The serialized metadata object
203
+ */
204
+ function serializeMetadata(entity) {
205
+ const meta = entity.metadata;
206
+ return JSON.parse(stringify(meta));
207
+ }
208
+
209
+ /**
210
+ * Sends a postMessage response to the iframe
211
+ * @param {MessageEvent} event - The message event containing the method call or registration request
212
+ * @param {Object} payload - The response payload to send back to the iframe
213
+ */
214
+ function sendResponse(event, payload) {
215
+ event.source.postMessage({
216
+ type: IFRAME_API_RESPONSE,
217
+ messageId: event.data.messageId,
218
+ iframeInterfaceId: event.data.iframeInterfaceId,
219
+ ...payload
220
+ }, event.origin);
221
+ }
222
+
223
+ /**
224
+ * Sets up a postMessage listener to handle API calls and timing updates from iframes
225
+ * @param {Object} agent The agent instance
226
+ */
227
+ export function setupIframeMFEMessageListener(agent) {
228
+ if (!isBrowserScope || !window.addEventListener || agent.runtime.listeningForIframeMessages) return;
229
+ registerHandler('iframe-message', async event => {
230
+ if (!event.data) return;
231
+ switch (event.data.type) {
232
+ case IFRAME_TIMING_UPDATE:
233
+ handleTimingUpdate(event, agent);
234
+ return;
235
+ case IFRAME_VITALS_UPDATE:
236
+ handleVitalsUpdate(event, agent);
237
+ return;
238
+ case IFRAME_AJAX:
239
+ handleAjax(event, agent);
240
+ return;
241
+ case IFRAME_API:
242
+ try {
243
+ if (!event.source || !event.data.messageId || !event.data.entries?.[0]?.method) return;
244
+ const {
245
+ entity,
246
+ result
247
+ } = await handleMethodCall(event, agent);
248
+ const metadata = entity ? serializeMetadata(entity) : undefined;
249
+ sendResponse(event, {
250
+ result,
251
+ metadata
252
+ });
253
+ } catch (error) {
254
+ const errorMessage = error?.message || String(error);
255
+ sendResponse(event, {
256
+ error: errorMessage
257
+ });
258
+ }
259
+ }
260
+ }, 'IFRAME', agent.ee);
261
+ drain(agent, 'IFRAME', true); // drain any buffered iframe messages that were received before the listener was set up
262
+ agent.runtime.listeningForIframeMessages = true;
263
+ }
@@ -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-types.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/events.js","../src/common/constants/runtime.js","../src/common/constants/shared-channel.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/send.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/payloads/payloads.js","../src/common/serialize/bel-serializer.js","../src/common/session/constants.js","../src/common/session/session-entity.js","../src/common/session/session-key.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/extract-url.js","../src/common/url/location.js","../src/common/url/parse-url.js","../src/common/url/protocol.js","../src/common/util/attribute-size.js","../src/common/util/browser-stack-matchers.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/monkey-patched.js","../src/common/util/obfuscate.js","../src/common/util/short-circuit.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/util/webdriver-detection.js","../src/common/v2/mfe-vitals.js","../src/common/v2/script-correlation.js","../src/common/v2/script-tracker.js","../src/common/v2/utils.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/load-time.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-logger.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/cause-string.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/harvest-metadata.js","../src/features/metrics/aggregate/index.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/aggregate/trace/utils.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/utils/agent-session.js","../src/features/utils/aggregate-base.js","../src/features/utils/event-buffer.js","../src/features/utils/feature-base.js","../src/features/utils/feature-gates.js","../src/features/utils/instrument-base.js","../src/interfaces/registered-entity.js","../src/loaders/agent-base.js","../src/loaders/agent.js","../src/loaders/api-base.js","../src/loaders/browser-agent.js","../src/loaders/micro-agent-base.js","../src/loaders/micro-agent.js","../src/loaders/api/addPageAction.js","../src/loaders/api/addRelease.js","../src/loaders/api/addToTrace.js","../src/loaders/api/consent.js","../src/loaders/api/constants.js","../src/loaders/api/finished.js","../src/loaders/api/interaction-types.js","../src/loaders/api/interaction.js","../src/loaders/api/log.js","../src/loaders/api/measure.js","../src/loaders/api/noticeError.js","../src/loaders/api/pauseReplay.js","../src/loaders/api/recordCustomEvent.js","../src/loaders/api/recordReplay.js","../src/loaders/api/register-api-types.js","../src/loaders/api/register.js","../src/loaders/api/setApplicationVersion.js","../src/loaders/api/setCustomAttribute.js","../src/loaders/api/setErrorHandler.js","../src/loaders/api/setPageViewName.js","../src/loaders/api/setUserId.js","../src/loaders/api/sharedHandlers.js","../src/loaders/api/start.js","../src/loaders/api/topLevelCallers.js","../src/loaders/api/wrapLogger.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.9.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-types.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/events.js","../src/common/constants/iframe-constants.js","../src/common/constants/runtime.js","../src/common/constants/shared-channel.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/send.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/payloads/payloads.js","../src/common/serialize/bel-serializer.js","../src/common/session/constants.js","../src/common/session/session-entity.js","../src/common/session/session-key.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/add-url.js","../src/common/url/canonicalize-url.js","../src/common/url/clean-url.js","../src/common/url/encode.js","../src/common/url/extract-url.js","../src/common/url/location.js","../src/common/url/parse-url.js","../src/common/url/protocol.js","../src/common/util/attribute-size.js","../src/common/util/browser-stack-matchers.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/monkey-patched.js","../src/common/util/obfuscate.js","../src/common/util/short-circuit.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/util/webdriver-detection.js","../src/common/v2/mfe-vitals.js","../src/common/v2/script-correlation.js","../src/common/v2/script-tracker-constants.js","../src/common/v2/script-tracker.js","../src/common/v2/timing-factory.js","../src/common/v2/utils.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/load-time.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-logger.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/cause-string.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/harvest-metadata.js","../src/features/metrics/aggregate/index.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/aggregate/trace/utils.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/utils/agent-session.js","../src/features/utils/aggregate-base.js","../src/features/utils/event-buffer.js","../src/features/utils/feature-base.js","../src/features/utils/feature-gates.js","../src/features/utils/instrument-base.js","../src/interfaces/registered-entity.js","../src/interfaces/registered-iframe-entity.js","../src/loaders/agent-base.js","../src/loaders/agent.js","../src/loaders/api-base.js","../src/loaders/browser-agent.js","../src/loaders/micro-agent-base.js","../src/loaders/micro-agent.js","../src/loaders/api/addPageAction.js","../src/loaders/api/addRelease.js","../src/loaders/api/addToTrace.js","../src/loaders/api/consent.js","../src/loaders/api/constants.js","../src/loaders/api/finished.js","../src/loaders/api/interaction-types.js","../src/loaders/api/interaction.js","../src/loaders/api/log.js","../src/loaders/api/measure.js","../src/loaders/api/noticeError.js","../src/loaders/api/pauseReplay.js","../src/loaders/api/recordCustomEvent.js","../src/loaders/api/recordReplay.js","../src/loaders/api/register-api-types.js","../src/loaders/api/register.js","../src/loaders/api/setApplicationVersion.js","../src/loaders/api/setCustomAttribute.js","../src/loaders/api/setErrorHandler.js","../src/loaders/api/setPageViewName.js","../src/loaders/api/setUserId.js","../src/loaders/api/sharedHandlers.js","../src/loaders/api/start.js","../src/loaders/api/topLevelCallers.js","../src/loaders/api/wrapLogger.js","../src/loaders/configure/configure.js","../src/loaders/configure/iframe-message-handler.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.9.3"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/common/config/init.js"],"names":[],"mappings":"AAiJO,0CAEN;mBAvIY,OAAO,cAAc,EAAE,IAAI"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/common/config/init.js"],"names":[],"mappings":"AA4JO,0CAEN;mBAlJY,OAAO,cAAc,EAAE,IAAI"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/config/runtime.js"],"names":[],"mappings":"AA4DO,gDAON"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/config/runtime.js"],"names":[],"mappings":"AA6DO,gDAON"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright 2020-2026 New Relic, Inc. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export const prefix: "newrelic-iframe-";
6
+ export const IFRAME_TIMING_UPDATE: string;
7
+ export const IFRAME_API: string;
8
+ export const IFRAME_API_RESPONSE: string;
9
+ export const IFRAME_VITALS_UPDATE: string;
10
+ export const IFRAME_AJAX: string;
11
+ //# sourceMappingURL=iframe-constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iframe-constants.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/iframe-constants.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAsB,kBAAkB,CAAA;AAExC,0CAA4D;AAC5D,gCAAwC;AACxC,yCAA0D;AAC1D,0CAA4D;AAC5D,iCAA0C"}
@@ -0,0 +1,2 @@
1
+ export function addUrl(ctx: any, url: any): void;
2
+ //# sourceMappingURL=add-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-url.d.ts","sourceRoot":"","sources":["../../../../src/common/url/add-url.js"],"names":[],"mappings":"AAMA,iDAWC"}
@@ -6,39 +6,39 @@
6
6
  *
7
7
  * | Code | Message |
8
8
  * |------|---------|
9
- * | 1 | An error occurred while setting a property of a Configurable |
10
- * | 2 | An error occurred while setting a Configurable |
11
- * | 3 | Setting a Configurable requires an object as input |
12
- * | 4 | Setting a Configurable requires a model to set its initial properties |
9
+ * | 1 | An error occurred while setting a property of a Configurable. |
10
+ * | 2 | An error occurred while setting a Configurable. |
11
+ * | 3 | Setting a Configurable requires an object as input. |
12
+ * | 4 | Setting a Configurable requires a model to set its initial properties. |
13
13
  * | 5 | An invalid session_replay.mask_selector was provided. \* will be used. |
14
- * | 6 | An invalid session_replay.block_selector was provided and will not be used |
15
- * | 7 | An invalid session_replay.mask_input_option was provided and will not be used |
16
- * | 8 | Shared context requires an object as input |
17
- * | 9 | An error occurred while setting SharedContext |
18
- * | 10 | Failed to read from storage API |
19
- * | 11 | Failed to write to the storage API |
14
+ * | 6 | An invalid session_replay.block_selector was provided and will not be used. |
15
+ * | 7 | An invalid session_replay.mask_input_option was provided and will not be used. |
16
+ * | 8 | Shared context requires an object as input. |
17
+ * | 9 | An error occurred while setting SharedContext. |
18
+ * | 10 | Failed to read from storage API. |
19
+ * | 11 | Failed to write to the storage API. |
20
20
  * | 12 | An obfuscation replacement rule was detected missing a "regex" value. |
21
- * | 13 | An obfuscation replacement rule contains a "regex" value with an invalid type (must be a string or RegExp) |
22
- * | 14 | An obfuscation replacement rule contains a "replacement" value with an invalid type (must be a string) |
23
- * | 15 | An error occurred while intercepting XHR |
24
- * | 16 | Could not cast log message to string |
21
+ * | 13 | An obfuscation replacement rule contains a "regex" value with an invalid type (must be a string or RegExp). |
22
+ * | 14 | An obfuscation replacement rule contains a "replacement" value with an invalid type (must be a string). |
23
+ * | 15 | An error occurred while intercepting XHR. |
24
+ * | 16 | Could not cast log message to string. |
25
25
  * | 17 | Could not calculate New Relic server time. Agent shutting down. |
26
26
  * | 18 | RUM call failed. Agent shutting down. |
27
27
  * | 19 | SPA scheduler is not initialized. Saved interaction is not sent! |
28
28
  * | 20 | A problem occurred when starting up session manager. This page will not start or extend any session. |
29
29
  * | 21 | Failed to initialize the agent. Could not determine the runtime environment. |
30
30
  * | 22 | Failed to initialize all enabled instrument classes (agent aborted) - |
31
- * | 23 | An unexpected issue occurred |
31
+ * | 23 | An unexpected issue occurred. |
32
32
  * | 24 | Something prevented the agent from instrumenting. |
33
33
  * | 25 | Something prevented the agent from being downloaded. |
34
34
  * | 26 | Failed to initialize instrument classes. |
35
35
  * | 27 | Downloading runtime APIs failed... |
36
36
  * | 28 | The Browser Agent is attempting to send a very large payload. This is usually tied to large amounts of custom attributes. Please check your configurations. |
37
- * | 29 | Failed to wrap logger: invalid argument(s) |
38
- * | 30 | Invalid log level |
39
- * | 31 | Ignored log: Log is larger than maximum payload size |
40
- * | 32 | Ignored log: Invalid message |
41
- * | 33 | Session Replay Aborted |
37
+ * | 29 | Failed to wrap logger: invalid argument(s). |
38
+ * | 30 | Invalid log level. |
39
+ * | 31 | Ignored log: Log is larger than maximum payload size. |
40
+ * | 32 | Ignored log: Invalid message. |
41
+ * | 33 | Session Replay Aborted. |
42
42
  * | 34 | Downloading and initializing a feature failed... |
43
43
  * | 35 | Call to agent api failed. The API is not currently initialized. |
44
44
  * | 36 | A feature is enabled but one or more dependent features have not been initialized. This may cause unintended consequences or missing data... |
@@ -47,7 +47,7 @@
47
47
  * | 39 | Failed to execute setCustomAttribute. Name must be a string type. |
48
48
  * | 40 | Failed to execute setCustomAttribute. Non-null value must be a string, number or boolean type. |
49
49
  * | 41 | Failed to execute setUserId. Non-null value must be a string type. |
50
- * | 42 | Failed to execute setApplicationVersion. Expected <String \| null> |
50
+ * | 42 | Failed to execute setApplicationVersion. Expected <String \| null>. |
51
51
  * | 43 | Agent not configured properly. |
52
52
  * | 44 | Invalid object passed to generic event aggregate. Missing "eventType". |
53
53
  * | 45 | An internal agent process failed to execute. |
@@ -56,27 +56,34 @@
56
56
  * | 48 | Supplied an invalid API target. Must be an <Object> that contains valid (string) id and name properties. |
57
57
  * | 49 | Supplied API target is missing an entityGuid. Some APIs may not behave correctly without a valid entityGuid (ex. logs). |
58
58
  * | 50 | Failed to connect. Cannot allow registered API. |
59
- * | 51 | Container agent is not available to register with. Can not connect |
59
+ * | 51 | Container agent is not available to register with. Can not connect. |
60
60
  * | 52 | Unexpected problem encountered. There should be at least one app for harvest! |
61
- * | 53 | Did not receive a valid entityGuid from connection response |
62
- * | 54 | An experimental feature is being used. Support can not be offered for issues |
63
- * | 55 | Register API has been disabled on the container agent |
64
- * | 56 | Could not find a matching entity to store data |
61
+ * | 53 | Did not receive a valid entityGuid from connection response. |
62
+ * | 54 | An experimental feature is being used. Support can not be offered for issues. |
63
+ * | 55 | Register API has been disabled on the container agent. |
64
+ * | 56 | Could not find a matching entity to store data. |
65
65
  * | 57 | Failed to execute measure. Arguments must have valid types. |
66
66
  * | 58 | Failed to execute measure. Resulting duration must be non-negative. |
67
- * | 59 | Session replay harvested before a session trace payload could be sent. This could be problematic for replays that rely on a trace |
68
- * | 60 | Session trace aborted |
67
+ * | 59 | Session replay harvested before a session trace payload could be sent. This could be problematic for replays that rely on a trace. |
68
+ * | 60 | Session trace aborted. |
69
69
  * | 61 | Timestamps must be non-negative and end time cannot be before start time. |
70
- * | 62 | Timestamp must be a unix timestamp greater than the page origin time |
71
- * | 63 | A single event was larger than the maximum allowed payload size |
70
+ * | 62 | Timestamp must be a unix timestamp greater than the page origin time. |
71
+ * | 63 | A single event was larger than the maximum allowed payload size. |
72
72
  * | 64 | Required globals have been mutated before being accessed by the browser agent. This can cause issues and should be avoided. |
73
- * | 65 | Consent API argument must be boolean or undefined |
74
- * | 66 | A new agent session has started |
73
+ * | 65 | Consent API argument must be boolean or undefined. |
74
+ * | 66 | A new agent session has started. |
75
75
  * | 67 | The "spa" feature has been deprecated and disabled. Please use/import "soft_navigations" instead for tracking of BrowserInteraction data. |
76
76
  * | 68 | API has been deregistered and can no longer be used. Call "register" API again with credentials to start over. |
77
- * | 69 | More than one Browser agent is running on the page |
77
+ * | 69 | More than one Browser agent is running on the page. |
78
78
  * | 70 | A session replay payload failed to send and is being retried. Recording is paused during the retry period, and will resume when a successful harvest is made. Some replay activity may be missed during retry phases. |
79
79
  * | 71 | An invalid feature mode was detected and set to "off". |
80
+ * | 72 | RegisteredIframeEntity failed to transmit API data from an iframe to window context. |
81
+ * | 73 | RegisteredIframeEntity failed to register with window context. |
82
+ * | 74 | RegisteredIframeEntity rejected message from unauthorized origin. |
83
+ * | 75 | RegisteredIframeEntity rejected message with mismatched iframeInterfaceId. |
84
+ * | 76 | Agent rejected post message, could not match with existing entity. |
85
+ * | 77 | Agent rejected post message, could not validate origin. |
86
+ * | 78 | RegisteredIframeEntity could not determine parent origin and will not register, to avoid trusting messages from any origin. |
80
87
  *
81
88
  * @param {number} code The warning code to emit, which will be used to link to the warning code documentation
82
89
  * @param {*} [secondary] Secondary data to include, usually an extra message, error or object
@@ -1 +1 @@
1
- {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../src/common/util/console.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AAEH,2BALW,MAAM,cACN,GAAC,QAiBX"}
1
+ {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../src/common/util/console.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AAEH,2BALW,MAAM,cACN,GAAC,QAiBX"}
@@ -1 +1 @@
1
- {"version":3,"file":"mfe-vitals.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/mfe-vitals.js"],"names":[],"mappings":"AAoHA;;;;;GAKG;AACH,uCAJW,iBAAiB,WACjB,kBAAkB,GAChB,iBAAiB,CAqM7B;iCApTY,OAAO,sCAAsC,EAAE,kBAAkB;gCACjE,OAAO,sCAAsC,EAAE,iBAAiB;gCAChE,OAAO,sCAAsC,EAAE,iBAAiB"}
1
+ {"version":3,"file":"mfe-vitals.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/mfe-vitals.js"],"names":[],"mappings":"AAqHA;;;;;GAKG;AACH,uCAJW,iBAAiB,WACjB,kBAAkB,GAChB,iBAAiB,CAuM7B;iCAtTY,OAAO,sCAAsC,EAAE,kBAAkB;gCACjE,OAAO,sCAAsC,EAAE,iBAAiB;gCAChE,OAAO,sCAAsC,EAAE,iBAAiB"}
@@ -17,6 +17,8 @@ export class ScriptCorrelation {
17
17
  performance: CorrelationTiming;
18
18
  /** @type {string} The cleaned URL of the script */
19
19
  url: string;
20
+ /** @type {Set<string>} MFE target ids that have already claimed this correlation via a completed `findScriptTimings()` call. Keyed per target rather than a single flag so one script that registers multiple distinct MFEs (each with its own id) doesn't have the second MFE's registration mistaken for a stale reuse of the first's. */
21
+ claimedBy: Set<string>;
20
22
  /**
21
23
  * Gets the script timing, using DOM timings if available, otherwise falling back to performance timings or registeredAt as appropriate. This is used to provide the most accurate script timing possible for registered entities.
22
24
  * @returns {{start: number, end: number}
@@ -1 +1 @@
1
- {"version":3,"file":"script-correlation.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/script-correlation.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AACH;IAME;;;OAGG;IACH,iBAFW,MAAM,EAKhB;IAZD,gEAAgE;IAChE,KADW,iBAAiB,CACC;IAC7B,gFAAgF;IAChF,aADW,iBAAiB,CACS;IAOnC,mDAAmD;IACnD,KADW,MAAM,CACH;IAGhB;;;OAGG;IACH,cAFa;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAC,CASxC;CACF;AAED;IACE,wEAAwE;IACxE,OADW,MAAM,CACR;IACT,wEAAwE;IACxE,KADW,MAAM,CACV;IACP,0CAA0C;IAC1C,OADW,GAAC,CACK;CAClB"}
1
+ {"version":3,"file":"script-correlation.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/script-correlation.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AACH;IAME;;;OAGG;IACH,iBAFW,MAAM,EAOhB;IAdD,gEAAgE;IAChE,KADW,iBAAiB,CACC;IAC7B,gFAAgF;IAChF,aADW,iBAAiB,CACS;IAOnC,mDAAmD;IACnD,KADW,MAAM,CACH;IACd,4UAA4U;IAC5U,WADW,GAAG,CAAC,MAAM,CAAC,CACI;IAG5B;;;OAGG;IACH,cAFa;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAC,CASxC;CACF;AAED;IACE,wEAAwE;IACxE,OADW,MAAM,CACR;IACT,wEAAwE;IACxE,KADW,MAAM,CACV;IACP,0CAA0C;IAC1C,OADW,GAAC,CACK;CAClB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright 2020-2026 New Relic, Inc. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /** @type {number} - Correlations are keyed only by script URL and never cleared per-registration, so a script registered more than once in a session (SPA remount, shared bundle, etc.) can reuse a correlation from a much earlier load. If the correlation's recorded start predates `registeredAt` by more than this, treat it as stale and fall back to `registeredAt`. */
6
+ export const CORRELATION_STALE_THRESHOLD_MS: number;
7
+ //# sourceMappingURL=script-tracker-constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script-tracker-constants.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/script-tracker-constants.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+WAA+W;AAC/W,6CADW,MAAM,CACkC"}
@@ -11,16 +11,19 @@ export function extractUrlsFromStack(stack: string): string[];
11
11
  export function getDeepStackTrace(): Error.stack | undefined;
12
12
  /**
13
13
  * Uses the stack of the initiator function, returns script timing information if a script can be found with the resource timing API matching the URL found in the stack.
14
+ * @param {RegisterAPITarget} [target] - The MFE target being registered. Its id is used to scope stale-correlation detection per-MFE rather than per-script-URL, so one script registering multiple distinct MFEs doesn't misclassify a later MFE's registration as a stale reuse of an earlier one's.
14
15
  * @returns {RegisterAPITimings} Object containing script fetch start and end times, and the asset URL if found
15
16
  */
16
- export function findScriptTimings(): RegisterAPITimings;
17
+ export function findScriptTimings(target?: RegisterAPITarget): RegisterAPITimings;
17
18
  /**
18
19
  * @typedef {import('./register-api-types').RegisterAPITimings} RegisterAPITimings
20
+ * @typedef {import('../../loaders/api/register-api-types').RegisterAPITarget} RegisterAPITarget
19
21
  */
20
22
  /** export for testing purposes */
21
23
  export let thisFile: any;
22
24
  /** @type {Map<string, ScriptCorrelation>} - Central registry for script correlations containing both DOM and Performance data */
23
25
  export const scriptCorrelations: Map<string, ScriptCorrelation>;
24
26
  export type RegisterAPITimings = any;
27
+ export type RegisterAPITarget = import("../../loaders/api/register-api-types").RegisterAPITarget;
25
28
  import { ScriptCorrelation } from './script-correlation';
26
29
  //# sourceMappingURL=script-tracker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"script-tracker.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/script-tracker.js"],"names":[],"mappings":"AA+GA;;;;GAIG;AACH,4CAHW,MAAM,GACJ,MAAM,EAAE,CAsBpB;AAED;;;GAGG;AACH,qCAFa,KAAK,CAAC,KAAK,GAAG,SAAS,CAanC;AA6CD;;;GAGG;AACH,qCAFa,kBAAkB,CA2D9B;AAxPD;;GAEG;AAEH,kCAAkC;AAClC,yBAAmB;AAUnB,iIAAiI;AACjI,iCADW,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CACE;;kCAlBT,sBAAsB"}
1
+ {"version":3,"file":"script-tracker.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/script-tracker.js"],"names":[],"mappings":"AAkHA;;;;GAIG;AACH,4CAHW,MAAM,GACJ,MAAM,EAAE,CAsBpB;AAED;;;GAGG;AACH,qCAFa,KAAK,CAAC,KAAK,GAAG,SAAS,CAanC;AAiED;;;;GAIG;AACH,2CAHW,iBAAiB,GACf,kBAAkB,CA0E9B;AA7RD;;;GAGG;AAEH,kCAAkC;AAClC,yBAAmB;AAUnB,iIAAiI;AACjI,iCADW,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CACE;;gCAf9B,OAAO,sCAAsC,EAAE,iBAAiB;kCAN3C,sBAAsB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright 2020-2026 New Relic, Inc. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export function timingFactory(getLazyValue: () => void, override: any): {
6
+ get: () => any;
7
+ set: (newValue: any) => void;
8
+ };
9
+ //# sourceMappingURL=timing-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing-factory.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/timing-factory.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;EAKC"}
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Returns a single registered entity associated with a given iframe interface ID. Returns undefined if no entity is found.
3
+ * @param {string} iframeInterfaceId
4
+ * @param {*} agentRef the agent reference
5
+ * @returns {import("../../loaders/api/register-api-types").RegisterAPI|undefined}
6
+ */
7
+ export function getRegisteredEntityByIframeInterfaceId(iframeInterfaceId: string, agentRef: any): import("../../loaders/api/register-api-types").RegisterAPI | undefined;
1
8
  /**
2
9
  * Returns the registered target associated with a given ID. Returns an empty array if no target is found.
3
10
  * @param {string|number} id
@@ -7,11 +14,32 @@
7
14
  export function getRegisteredTargetsFromId(id: string | number, agentRef: any): import("../../interfaces/registered-entity").RegisterAPIMetadataTarget[];
8
15
  /**
9
16
  * Returns the registered target(s) associated with a given filename if found in the resource timing API during registration. Returns an empty array if no target is found.
17
+ * Multiple registrations that resolve to the same underlying script asset AND represent the same logical MFE (i.e.
18
+ * share the same customer-supplied `target.id`) are collapsed to a single target via
19
+ * {@link dedupeRegisteredEntitiesByAsset}, since auto-instrumented events (AJAX, JS errors, logs, WebSockets) should
20
+ * only be reported once per real occurrence when the same MFE was registered many times over -- not once per
21
+ * duplicate registration. Distinct MFEs (different `target.id`) that happen to share a script (e.g. two different
22
+ * MFEs both registered from the same inline `<script>` block) are intentionally NOT collapsed, since each is a
23
+ * genuinely different entity that should still receive its own copy of the matched event.
10
24
  * @param {string} filename
11
25
  * @param {*} agentRef
12
26
  * @returns {import("../../interfaces/registered-entity").RegisterAPIMetadataTarget[]}
13
27
  */
14
28
  export function getRegisteredTargetsFromFilename(filename: string, agentRef: any): import("../../interfaces/registered-entity").RegisterAPIMetadataTarget[];
29
+ /**
30
+ * Collapses a list of registered entities down to one canonical entity per unique, defined `metadata.timings.asset` +
31
+ * `target.id` combination. Entities whose asset could not be resolved (undefined -- e.g. inline scripts or scripts
32
+ * not found in the resource timing buffer) are never deduped against each other or against resolved entities, since
33
+ * there is no signal that they represent the same underlying script. Entities that share an asset but have different
34
+ * `target.id`s are never deduped against each other either, since a differing id means the customer registered
35
+ * genuinely distinct MFEs (not duplicate registrations of the same one).
36
+ *
37
+ * Canonical selection per asset+id: prefer an entity whose target has not been deregistered (`target.blocked ===
38
+ * false`) over one that has; otherwise the first-encountered entity wins, for determinism.
39
+ * @param {Array} entities registered entities (each with `metadata.timings.asset` and `metadata.target`)
40
+ * @returns {Array} deduped list of entities, preserving relative order of first occurrence
41
+ */
42
+ export function dedupeRegisteredEntitiesByAsset(entities: any[]): any[];
15
43
  /**
16
44
  * When given a valid target, returns an object with the V2 payload attributes. Returns an empty object otherwise.
17
45
  * @note Field names may change as the schema is finalized
@@ -44,6 +72,15 @@ export function shouldDuplicate(target: import("../../interfaces/registered-enti
44
72
  * @returns {Array} An array of targets found from the stack trace. If no targets are found or allowed, returns an array with undefined.
45
73
  */
46
74
  export function findTargetsFromStackTrace(agentRef: any): any[];
75
+ /**
76
+ * Removes duplicate targets from an array, keyed by `target.instance`. This guards against the same canonical
77
+ * target re-entering the array via multiple matched stack-frame URLs (e.g. a recursive call whose stack contains the
78
+ * same file at multiple depths). Entries with no `instance` (i.e. `undefined`, meaning "the container agent")
79
+ * naturally collapse to a single entry too, which is the desired behavior.
80
+ * @param {Array} targets
81
+ * @returns {Array} deduped list of targets, preserving relative order of first occurrence
82
+ */
83
+ export function dedupeTargetsByInstance(targets: any[]): any[];
47
84
  /**
48
85
  * *
49
86
  */