@newrelic/browser-agent 1.302.0-rc.0 → 1.302.0-rc.10

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 (116) hide show
  1. package/dist/cjs/common/config/init-types.js +2 -0
  2. package/dist/cjs/common/config/init.js +3 -0
  3. package/dist/cjs/common/constants/env.cdn.js +1 -1
  4. package/dist/cjs/common/constants/env.npm.js +1 -1
  5. package/dist/cjs/common/harvest/harvester.js +13 -9
  6. package/dist/cjs/common/harvest/types.js +0 -1
  7. package/dist/cjs/common/session/session-entity.js +4 -2
  8. package/dist/cjs/common/util/mfe.js +4 -0
  9. package/dist/cjs/common/wrap/wrap-promise.js +10 -5
  10. package/dist/cjs/features/generic_events/aggregate/index.js +4 -4
  11. package/dist/cjs/features/logging/aggregate/index.js +1 -2
  12. package/dist/cjs/features/page_view_event/aggregate/index.js +84 -22
  13. package/dist/cjs/features/page_view_event/instrument/index.js +0 -4
  14. package/dist/cjs/features/session_replay/aggregate/index.js +3 -2
  15. package/dist/cjs/features/session_replay/constants.js +2 -6
  16. package/dist/cjs/features/session_replay/instrument/index.js +3 -2
  17. package/dist/cjs/features/utils/agent-session.js +13 -0
  18. package/dist/cjs/features/utils/instrument-base.js +7 -8
  19. package/dist/cjs/interfaces/registered-entity.js +21 -0
  20. package/dist/cjs/loaders/agent.js +2 -0
  21. package/dist/cjs/loaders/api/consent.js +24 -0
  22. package/dist/cjs/loaders/api/constants.js +3 -2
  23. package/dist/cjs/loaders/api/measure.js +36 -35
  24. package/dist/cjs/loaders/api/recordCustomEvent.js +5 -3
  25. package/dist/cjs/loaders/api/register-api-types.js +10 -9
  26. package/dist/cjs/loaders/api/register.js +16 -0
  27. package/dist/cjs/loaders/api-base.js +14 -7
  28. package/dist/esm/common/config/init-types.js +2 -0
  29. package/dist/esm/common/config/init.js +3 -0
  30. package/dist/esm/common/constants/env.cdn.js +1 -1
  31. package/dist/esm/common/constants/env.npm.js +1 -1
  32. package/dist/esm/common/harvest/harvester.js +13 -9
  33. package/dist/esm/common/harvest/types.js +0 -1
  34. package/dist/esm/common/session/session-entity.js +4 -2
  35. package/dist/esm/common/util/mfe.js +3 -0
  36. package/dist/esm/common/wrap/wrap-promise.js +10 -5
  37. package/dist/esm/features/generic_events/aggregate/index.js +4 -4
  38. package/dist/esm/features/logging/aggregate/index.js +1 -2
  39. package/dist/esm/features/page_view_event/aggregate/index.js +84 -22
  40. package/dist/esm/features/page_view_event/instrument/index.js +0 -4
  41. package/dist/esm/features/session_replay/aggregate/index.js +4 -3
  42. package/dist/esm/features/session_replay/constants.js +1 -5
  43. package/dist/esm/features/session_replay/instrument/index.js +4 -3
  44. package/dist/esm/features/utils/agent-session.js +13 -0
  45. package/dist/esm/features/utils/instrument-base.js +7 -8
  46. package/dist/esm/interfaces/registered-entity.js +21 -0
  47. package/dist/esm/loaders/agent.js +2 -0
  48. package/dist/esm/loaders/api/consent.js +17 -0
  49. package/dist/esm/loaders/api/constants.js +2 -1
  50. package/dist/esm/loaders/api/measure.js +35 -35
  51. package/dist/esm/loaders/api/recordCustomEvent.js +4 -3
  52. package/dist/esm/loaders/api/register-api-types.js +10 -9
  53. package/dist/esm/loaders/api/register.js +17 -1
  54. package/dist/esm/loaders/api-base.js +15 -8
  55. package/dist/tsconfig.tsbuildinfo +1 -1
  56. package/dist/types/common/config/init-types.d.ts +6 -0
  57. package/dist/types/common/config/init.d.ts.map +1 -1
  58. package/dist/types/common/harvest/harvester.d.ts.map +1 -1
  59. package/dist/types/common/harvest/types.d.ts +0 -2
  60. package/dist/types/common/harvest/types.d.ts.map +1 -1
  61. package/dist/types/common/session/session-entity.d.ts.map +1 -1
  62. package/dist/types/common/util/mfe.d.ts +1 -0
  63. package/dist/types/common/util/mfe.d.ts.map +1 -1
  64. package/dist/types/common/wrap/wrap-promise.d.ts.map +1 -1
  65. package/dist/types/features/page_view_event/aggregate/index.d.ts +22 -3
  66. package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
  67. package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -1
  68. package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
  69. package/dist/types/features/session_replay/constants.d.ts +1 -5
  70. package/dist/types/features/session_replay/constants.d.ts.map +1 -1
  71. package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -1
  72. package/dist/types/features/utils/agent-session.d.ts.map +1 -1
  73. package/dist/types/features/utils/instrument-base.d.ts +1 -0
  74. package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
  75. package/dist/types/interfaces/registered-entity.d.ts +25 -0
  76. package/dist/types/interfaces/registered-entity.d.ts.map +1 -1
  77. package/dist/types/loaders/agent.d.ts.map +1 -1
  78. package/dist/types/loaders/api/consent.d.ts +2 -0
  79. package/dist/types/loaders/api/consent.d.ts.map +1 -0
  80. package/dist/types/loaders/api/constants.d.ts +1 -0
  81. package/dist/types/loaders/api/constants.d.ts.map +1 -1
  82. package/dist/types/loaders/api/measure.d.ts +3 -0
  83. package/dist/types/loaders/api/measure.d.ts.map +1 -1
  84. package/dist/types/loaders/api/recordCustomEvent.d.ts +1 -0
  85. package/dist/types/loaders/api/recordCustomEvent.d.ts.map +1 -1
  86. package/dist/types/loaders/api/register-api-types.d.ts +28 -11
  87. package/dist/types/loaders/api/register-api-types.d.ts.map +1 -1
  88. package/dist/types/loaders/api/register.d.ts.map +1 -1
  89. package/dist/types/loaders/api-base.d.ts +20 -15
  90. package/dist/types/loaders/api-base.d.ts.map +1 -1
  91. package/package.json +2 -2
  92. package/src/common/config/init-types.js +2 -0
  93. package/src/common/config/init.js +1 -0
  94. package/src/common/harvest/harvester.js +11 -8
  95. package/src/common/harvest/types.js +0 -1
  96. package/src/common/session/session-entity.js +6 -2
  97. package/src/common/util/mfe.js +4 -0
  98. package/src/common/wrap/wrap-promise.js +16 -6
  99. package/src/features/generic_events/aggregate/index.js +4 -4
  100. package/src/features/logging/aggregate/index.js +1 -1
  101. package/src/features/page_view_event/aggregate/index.js +79 -15
  102. package/src/features/page_view_event/instrument/index.js +0 -4
  103. package/src/features/session_replay/aggregate/index.js +4 -3
  104. package/src/features/session_replay/constants.js +1 -5
  105. package/src/features/session_replay/instrument/index.js +4 -3
  106. package/src/features/utils/agent-session.js +12 -0
  107. package/src/features/utils/instrument-base.js +7 -9
  108. package/src/interfaces/registered-entity.js +21 -0
  109. package/src/loaders/agent.js +2 -0
  110. package/src/loaders/api/consent.js +18 -0
  111. package/src/loaders/api/constants.js +1 -0
  112. package/src/loaders/api/measure.js +34 -33
  113. package/src/loaders/api/recordCustomEvent.js +5 -3
  114. package/src/loaders/api/register-api-types.js +10 -9
  115. package/src/loaders/api/register.js +8 -1
  116. package/src/loaders/api-base.js +15 -8
@@ -5,11 +5,7 @@
5
5
  import { MODE } from '../../common/session/constants';
6
6
  import { FEATURE_NAMES } from '../../loaders/features/features';
7
7
  export const FEATURE_NAME = FEATURE_NAMES.sessionReplay;
8
- export const SR_EVENT_EMITTER_TYPES = {
9
- RECORD: 'recordReplay',
10
- PAUSE: 'pauseReplay',
11
- ERROR_DURING_REPLAY: 'errorDuringReplay'
12
- };
8
+ export const ERROR_DURING_REPLAY = 'errorDuringReplay';
13
9
  export const AVG_COMPRESSION = 0.12;
14
10
  export const RRWEB_EVENT_TYPES = {
15
11
  DomContentLoaded: 0,
@@ -10,9 +10,10 @@ import { handle } from '../../../common/event-emitter/handle';
10
10
  import { DEFAULT_KEY, MODE, PREFIX } from '../../../common/session/constants';
11
11
  import { InstrumentBase } from '../../utils/instrument-base';
12
12
  import { hasReplayPrerequisite, isPreloadAllowed } from '../shared/utils';
13
- import { FEATURE_NAME, SR_EVENT_EMITTER_TYPES, TRIGGERS } from '../constants';
13
+ import { ERROR_DURING_REPLAY, FEATURE_NAME, TRIGGERS } from '../constants';
14
14
  import { setupRecordReplayAPI } from '../../../loaders/api/recordReplay';
15
15
  import { setupPauseReplayAPI } from '../../../loaders/api/pauseReplay';
16
+ import { RECORD_REPLAY } from '../../../loaders/api/constants';
16
17
  export class Instrument extends InstrumentBase {
17
18
  static featureName = FEATURE_NAME;
18
19
  /** @type {Promise|undefined} A promise that resolves when the recorder module is imported and added to the class. Undefined if the recorder has never been staged to import with `importRecorder`. */
@@ -30,7 +31,7 @@ export class Instrument extends InstrumentBase {
30
31
  session = JSON.parse(localStorage.getItem("".concat(PREFIX, "_").concat(DEFAULT_KEY)));
31
32
  } catch (err) {}
32
33
  if (hasReplayPrerequisite(agentRef.init)) {
33
- this.ee.on(SR_EVENT_EMITTER_TYPES.RECORD, () => this.#apiStartOrRestartReplay());
34
+ this.ee.on(RECORD_REPLAY, () => this.#apiStartOrRestartReplay());
34
35
  }
35
36
  if (this.#canPreloadRecorder(session)) {
36
37
  this.importRecorder().then(recorder => {
@@ -44,7 +45,7 @@ export class Instrument extends InstrumentBase {
44
45
  if (this.blocked) return;
45
46
  if (this.agentRef.runtime.isRecording) {
46
47
  this.errorNoticed = true;
47
- handle(SR_EVENT_EMITTER_TYPES.ERROR_DURING_REPLAY, [e], undefined, this.featureName, this.ee);
48
+ handle(ERROR_DURING_REPLAY, [e], undefined, this.featureName, this.ee);
48
49
  }
49
50
  });
50
51
  }
@@ -52,6 +52,19 @@ export function setupAgentSession(agentRef) {
52
52
  registerHandler('api-setUserId', (time, key, value) => {
53
53
  agentRef.runtime.session.syncCustomAttribute(key, value);
54
54
  }, 'session', sharedEE);
55
+ registerHandler('api-consent', accept => {
56
+ agentRef.runtime.session.write({
57
+ consent: accept === undefined ? true : accept
58
+ });
59
+
60
+ // call sendRum if it wasn't called yet
61
+ agentRef.features.page_view_event.onAggregateImported.then(loaded => {
62
+ const pveAgg = agentRef.features.page_view_event.featAggregate;
63
+ if (loaded && !pveAgg.sentRum) {
64
+ pveAgg.sendRum();
65
+ }
66
+ });
67
+ }, 'session', sharedEE);
55
68
  drain(agentRef.agentIdentifier, 'session');
56
69
  return agentRef.runtime.session;
57
70
  }
@@ -48,7 +48,10 @@ export class InstrumentBase extends FeatureBase {
48
48
  * @type {Promise} Assigned immediately after @see importAggregator runs. Serves as a signal for when the inner async fn finishes execution. Useful for features to await
49
49
  * one another if there are inter-features dependencies.
50
50
  */
51
- this.onAggregateImported = undefined;
51
+ this.loadedSuccessfully = undefined;
52
+ this.onAggregateImported = new Promise(resolve => {
53
+ this.loadedSuccessfully = resolve;
54
+ });
52
55
 
53
56
  /**
54
57
  * used in conjunction with newrelic.start() to defer harvesting in features
@@ -80,10 +83,6 @@ export class InstrumentBase extends FeatureBase {
80
83
  */
81
84
  importAggregator(agentRef, fetchAggregator, argsObjFromInstrument = {}) {
82
85
  if (this.featAggregate) return;
83
- let loadedSuccessfully;
84
- this.onAggregateImported = new Promise(resolve => {
85
- loadedSuccessfully = resolve;
86
- });
87
86
  const importLater = async () => {
88
87
  // wait for the deferred promise to resolve before proceeding
89
88
  // this will resolve immediately if the feature is auto-started,
@@ -111,7 +110,7 @@ export class InstrumentBase extends FeatureBase {
111
110
  try {
112
111
  if (!this.#shouldImportAgg(this.featureName, session, agentRef.init)) {
113
112
  drain(this.agentIdentifier, this.featureName);
114
- loadedSuccessfully(false); // aggregate module isn't loaded at all
113
+ this.loadedSuccessfully(false); // aggregate module isn't loaded at all
115
114
  return;
116
115
  }
117
116
  const {
@@ -119,13 +118,13 @@ export class InstrumentBase extends FeatureBase {
119
118
  } = await fetchAggregator();
120
119
  this.featAggregate = new Aggregate(agentRef, argsObjFromInstrument);
121
120
  agentRef.runtime.harvester.initializedAggregates.push(this.featAggregate); // "subscribe" the feature to future harvest intervals (PVE will start the timer)
122
- loadedSuccessfully(true);
121
+ this.loadedSuccessfully(true);
123
122
  } catch (e) {
124
123
  warn(34, e);
125
124
  this.abortHandler?.(); // undo any important alterations made to the page
126
125
  // not supported yet but nice to do: "abort" this agent's EE for this feature specifically
127
126
  drain(this.agentIdentifier, this.featureName, true);
128
- loadedSuccessfully(false);
127
+ this.loadedSuccessfully(false);
129
128
  if (this.ee) this.ee.abort();
130
129
  }
131
130
  };
@@ -48,6 +48,27 @@ export class RegisteredEntity {
48
48
  warn(35, 'addPageAction');
49
49
  }
50
50
 
51
+ /**
52
+ * Records a custom event with a specified eventType and attributes.
53
+ * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/recordCustomEvent/}
54
+ * @param {string} eventType The eventType to store the event as.
55
+ * @param {Object} [attributes] JSON object with one or more key/value pairs. For example: {key:"value"}.
56
+ */
57
+ recordCustomEvent(eventType, attributes) {
58
+ warn(35, 'recordCustomEvent');
59
+ }
60
+
61
+ /**
62
+ * Measures a task that is recorded as a BrowserPerformance event.
63
+ * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/measure/}
64
+ * @param {string} name The name of the task
65
+ * @param {{start: number, end: number, duration: number, customAttributes: object}} [options] An object used to control the way the measure API operates
66
+ * @returns {{start: number, end: number, duration: number, customAttributes: object}} Measurement details
67
+ */
68
+ measure(name, options) {
69
+ warn(35, 'measure');
70
+ }
71
+
51
72
  /**
52
73
  * Adds a user-defined attribute name and value to subsequent events on the page for the registered target. Note -- the persist flag does not work with the register API.
53
74
  * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setcustomattribute/}
@@ -23,6 +23,7 @@ import { setupSetCustomAttributeAPI } from './api/setCustomAttribute';
23
23
  import { setupSetUserIdAPI } from './api/setUserId';
24
24
  import { setupSetApplicationVersionAPI } from './api/setApplicationVersion';
25
25
  import { setupStartAPI } from './api/start';
26
+ import { setupConsentAPI } from './api/consent';
26
27
 
27
28
  /**
28
29
  * @typedef {Object} AgentOptions
@@ -67,6 +68,7 @@ export class Agent extends AgentBase {
67
68
  setupSetUserIdAPI(this);
68
69
  setupSetApplicationVersionAPI(this);
69
70
  setupStartAPI(this);
71
+ setupConsentAPI(this);
70
72
  this.run();
71
73
  }
72
74
  get config() {
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2020-2025 New Relic, Inc. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { prefix, CONSENT } from './constants';
6
+ import { setupAPI } from './sharedHandlers';
7
+ import { handle } from '../../common/event-emitter/handle';
8
+ import { warn } from '../../common/util/console';
9
+ export function setupConsentAPI(agent) {
10
+ setupAPI(CONSENT, function (accept) {
11
+ if (accept !== undefined && typeof accept !== 'boolean') {
12
+ warn(65, typeof accept);
13
+ return;
14
+ }
15
+ handle(prefix + CONSENT, [accept], undefined, 'session', agent.ee);
16
+ }, agent);
17
+ }
@@ -23,4 +23,5 @@ export const SET_PAGE_VIEW_NAME = 'setPageViewName';
23
23
  export const SET_USER_ID = 'setUserId';
24
24
  export const START = 'start';
25
25
  export const WRAP_LOGGER = 'wrapLogger';
26
- export const MEASURE = 'measure';
26
+ export const MEASURE = 'measure';
27
+ export const CONSENT = 'consent';
@@ -9,45 +9,45 @@ import { FEATURE_NAMES } from '../features/features';
9
9
  import { prefix, MEASURE } from './constants';
10
10
  import { setupAPI } from './sharedHandlers';
11
11
  export function setupMeasureAPI(agent) {
12
- setupAPI(MEASURE, function (name, options) {
13
- const n = now();
14
- const {
15
- start,
16
- end,
17
- customAttributes
18
- } = options || {};
19
- const returnObj = {
20
- customAttributes: customAttributes || {}
21
- };
22
- if (typeof returnObj.customAttributes !== 'object' || typeof name !== 'string' || name.length === 0) {
23
- warn(57);
24
- return;
25
- }
12
+ setupAPI(MEASURE, (name, options) => measure(name, options, agent), agent);
13
+ }
14
+ export function measure(name, options, agentRef, target, timestamp = now()) {
15
+ const {
16
+ start,
17
+ end,
18
+ customAttributes
19
+ } = options || {};
20
+ const returnObj = {
21
+ customAttributes: customAttributes || {}
22
+ };
23
+ if (typeof returnObj.customAttributes !== 'object' || typeof name !== 'string' || name.length === 0) {
24
+ warn(57);
25
+ return;
26
+ }
26
27
 
27
- /**
28
+ /**
28
29
  * getValueFromTiming - Helper function to extract a numeric value from a supplied option.
29
30
  * @param {Number|PerformanceMark} [timing] The timing value
30
31
  * @param {Number} [d] The default value to return if timing is invalid
31
32
  * @returns {Number} The timing value or the default value
32
33
  */
33
- const getValueFromTiming = (timing, d) => {
34
- if (timing == null) return d;
35
- if (typeof timing === 'number') return timing;
36
- if (timing instanceof PerformanceMark) return timing.startTime;
37
- return Number.NaN;
38
- };
39
- returnObj.start = getValueFromTiming(start, 0);
40
- returnObj.end = getValueFromTiming(end, n);
41
- if (Number.isNaN(returnObj.start) || Number.isNaN(returnObj.end)) {
42
- warn(57);
43
- return;
44
- }
45
- returnObj.duration = returnObj.end - returnObj.start;
46
- if (returnObj.duration < 0) {
47
- warn(58);
48
- return;
49
- }
50
- handle(prefix + MEASURE, [returnObj, name], undefined, FEATURE_NAMES.genericEvents, agent.ee);
51
- return returnObj;
52
- }, agent);
34
+ const getValueFromTiming = (timing, d) => {
35
+ if (timing == null) return d;
36
+ if (typeof timing === 'number') return timing;
37
+ if (timing instanceof PerformanceMark) return timing.startTime;
38
+ return Number.NaN;
39
+ };
40
+ returnObj.start = getValueFromTiming(start, 0);
41
+ returnObj.end = getValueFromTiming(end, timestamp);
42
+ if (Number.isNaN(returnObj.start) || Number.isNaN(returnObj.end)) {
43
+ warn(57);
44
+ return;
45
+ }
46
+ returnObj.duration = returnObj.end - returnObj.start;
47
+ if (returnObj.duration < 0) {
48
+ warn(58);
49
+ return;
50
+ }
51
+ handle(prefix + MEASURE, [returnObj, name, target], undefined, FEATURE_NAMES.genericEvents, agentRef.ee);
52
+ return returnObj;
53
53
  }
@@ -8,7 +8,8 @@ import { FEATURE_NAMES } from '../features/features';
8
8
  import { prefix, RECORD_CUSTOM_EVENT } from './constants';
9
9
  import { setupAPI } from './sharedHandlers';
10
10
  export function setupRecordCustomEventAPI(agent) {
11
- setupAPI(RECORD_CUSTOM_EVENT, function () {
12
- handle(prefix + RECORD_CUSTOM_EVENT, [now(), ...arguments], undefined, FEATURE_NAMES.genericEvents, agent.ee);
13
- }, agent);
11
+ setupAPI(RECORD_CUSTOM_EVENT, (eventType, attributes) => recordCustomEvent(eventType, attributes, agent), agent);
12
+ }
13
+ export function recordCustomEvent(eventType, attributes = {}, agentRef, target, timestamp = now()) {
14
+ handle(prefix + RECORD_CUSTOM_EVENT, [timestamp, eventType, attributes, target], undefined, FEATURE_NAMES.genericEvents, agentRef.ee);
14
15
  }
@@ -5,20 +5,21 @@
5
5
 
6
6
  /**
7
7
  * @typedef {Object} RegisterAPI
8
- * @property {Function} addPageAction - Add a page action for the registered entity.
9
- * @property {Function} log - Capture a log for the registered entity.
10
- * @property {Function} noticeError - Notice an error for the registered entity.
11
- * @property {Function} setApplicationVersion - Add an application.version attribute to all outgoing data for the registered entity.
12
- * @property {Function} setCustomAttribute - Add a custom attribute to outgoing data for the registered entity.
13
- * @property {Function} setUserId - Add an enduser.id attribute to all outgoing API data for the registered entity.
8
+ * @property {(name: string, attributes?: object) => void} addPageAction - Add a page action for the registered entity.
9
+ * @property {(message: string, options?: { customAttributes?: object, level?: 'ERROR' | 'TRACE' | 'DEBUG' | 'INFO' | 'WARN'}) => void} log - Capture a log for the registered entity.
10
+ * @property {(error: Error | string, customAttributes?: object) => void} noticeError - Notice an error for the registered entity.
11
+ * @property {(eventType: string, attributes?: Object) => void} recordCustomEvent - Record a custom event for the registered entity.
12
+ * @property {(eventType: string, options?: {start: number, end: number, duration: number, customAttributes: object}) => {{start: number, end: number, duration: number, customAttributes: object}}} measure - Measures a task that is recorded as a BrowserPerformance event.
13
+ * @property {(value: string | null) => void} setApplicationVersion - Add an application.version attribute to all outgoing data for the registered entity.
14
+ * @property {(name: string, value: string | number | boolean | null, persist?: boolean) => void} setCustomAttribute - Add a custom attribute to outgoing data for the registered entity.
15
+ * @property {(value: string | null) => void} setUserId - Add an enduser.id attribute to all outgoing API data for the registered entity.
14
16
  * @property {RegisterAPIMetadata} metadata - The metadata object containing the custom attributes and target information for the registered entity.
15
17
  */
16
18
 
17
19
  /**
18
20
  * @typedef {Object} RegisterAPIConstructor
19
- * @property {Object} opts - The options for the registered entity.
20
- * @property {string} opts.id - The unique id for the registered entity. This will be assigned to any synthesized entities.
21
- * @property {string} opts.name - The readable name for the registered entity. This will be assigned to any synthesized entities.
21
+ * @property {string|number} id - The unique id for the registered entity. This will be assigned to any synthesized entities.
22
+ * @property {string} name - The readable name for the registered entity. This will be assigned to any synthesized entities.
22
23
  */
23
24
 
24
25
  /**
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { handle } from '../../common/event-emitter/handle';
6
6
  import { warn } from '../../common/util/console';
7
- import { isValidMFETarget } from '../../common/util/mfe';
7
+ import { hasValidValue, isValidMFETarget } from '../../common/util/mfe';
8
8
  import { FEATURE_NAMES } from '../features/features';
9
9
  import { now } from '../../common/timing/now';
10
10
  import { SUPPORTABILITY_METRIC_CHANNEL } from '../../features/metrics/constants';
@@ -14,6 +14,8 @@ import { log } from './log';
14
14
  import { addPageAction } from './addPageAction';
15
15
  import { noticeError } from './noticeError';
16
16
  import { single } from '../../common/util/invoke';
17
+ import { measure } from './measure';
18
+ import { recordCustomEvent } from './recordCustomEvent';
17
19
 
18
20
  /**
19
21
  * @typedef {import('./register-api-types').RegisterAPI} RegisterAPI
@@ -79,6 +81,9 @@ export function buildRegisterApi(agentRef, target) {
79
81
  /** primary cases that can block the register API from working at init time */
80
82
  if (!agentRef.init.api.allow_registered_children) block(single(() => warn(55)));
81
83
  if (!isValidMFETarget(target)) block(single(() => warn(48, target)));
84
+ if (!hasValidValue(target.id) || !hasValidValue(target.name)) {
85
+ block(single(() => warn(48, target)));
86
+ }
82
87
 
83
88
  /** @type {RegisterAPI} */
84
89
  const api = {
@@ -93,10 +98,21 @@ export function buildRegisterApi(agentRef, target) {
93
98
  ...(options.customAttributes || {})
94
99
  }
95
100
  }, agentRef], target),
101
+ measure: (name, options = {}) => report(measure, [name, {
102
+ ...options,
103
+ customAttributes: {
104
+ ...attrs,
105
+ ...(options.customAttributes || {})
106
+ }
107
+ }, agentRef], target),
96
108
  noticeError: (error, attributes = {}) => report(noticeError, [error, {
97
109
  ...attrs,
98
110
  ...attributes
99
111
  }, agentRef], target),
112
+ recordCustomEvent: (eventType, attributes = {}) => report(recordCustomEvent, [eventType, {
113
+ ...attrs,
114
+ ...attributes
115
+ }, agentRef], target),
100
116
  setApplicationVersion: value => setLocalValue('application.version', value),
101
117
  setCustomAttribute: (key, value) => setLocalValue(key, value),
102
118
  setUserId: value => setLocalValue('enduser.id', value),
@@ -3,7 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { warn } from '../common/util/console';
6
- import { ADD_PAGE_ACTION, ADD_RELEASE, ADD_TO_TRACE, FINISHED, INTERACTION, LOG, NOTICE_ERROR, PAUSE_REPLAY, RECORD_CUSTOM_EVENT, RECORD_REPLAY, REGISTER, SET_APPLICATION_VERSION, SET_CURRENT_ROUTE_NAME, SET_CUSTOM_ATTRIBUTE, SET_ERROR_HANDLER, SET_PAGE_VIEW_NAME, SET_USER_ID, START, WRAP_LOGGER, MEASURE } from './api/constants';
6
+ import { ADD_PAGE_ACTION, ADD_RELEASE, ADD_TO_TRACE, CONSENT, FINISHED, INTERACTION, LOG, NOTICE_ERROR, PAUSE_REPLAY, RECORD_CUSTOM_EVENT, RECORD_REPLAY, REGISTER, SET_APPLICATION_VERSION, SET_CURRENT_ROUTE_NAME, SET_CUSTOM_ATTRIBUTE, SET_ERROR_HANDLER, SET_PAGE_VIEW_NAME, SET_USER_ID, START, WRAP_LOGGER, MEASURE } from './api/constants';
7
7
 
8
8
  /**
9
9
  * @typedef {import('./api/interaction-types').InteractionInstance} InteractionInstance
@@ -31,11 +31,8 @@ export class ApiBase {
31
31
  * It is not recommended for use in production environments and will not receive support for issues.
32
32
  *
33
33
  * Registers an external caller to report through the base agent to a different target than the base agent.
34
- * @param {object} target the target object to report data to
35
- * @param {string} target.licenseKey The licenseKey to report data to
36
- * @param {string} target.applicationID The applicationID to report data to
37
- * @param {string=} target.entityGuid The entityGuid to report data to
38
- * @returns {object} Returns an object that contains the available API methods and configurations to use with the external caller. See loaders/api/api.js for more information.
34
+ * @param {import('./api/register-api-types').RegisterAPIConstructor} target the target object to report data to
35
+ @returns {import('./api/register-api-types').RegisterAPI} Returns an object that contains the available API methods and configurations to use with the external caller. See loaders/api/api.js for more information.
39
36
  */
40
37
  register(target) {
41
38
  return this.#callMethod(REGISTER, target);
@@ -45,7 +42,7 @@ export class ApiBase {
45
42
  * Records a custom event with a specified eventType and attributes.
46
43
  * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/recordCustomEvent/}
47
44
  * @param {string} eventType The eventType to store the event as.
48
- * @param {object} [attributes] JSON object with one or more key/value pairs. For example: {key:"value"}.
45
+ * @param {Object} [attributes] JSON object with one or more key/value pairs. For example: {key:"value"}.
49
46
  */
50
47
  recordCustomEvent(eventType, attributes) {
51
48
  return this.#callMethod(RECORD_CUSTOM_EVENT, eventType, attributes);
@@ -221,10 +218,20 @@ export class ApiBase {
221
218
  * Measures a task that is recorded as a BrowserPerformance event.
222
219
  * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/measure/}
223
220
  * @param {string} name The name of the task
224
- * @param {object?} options An object used to control the way the measure API operates
221
+ * @param {{start: number, end: number, duration: number, customAttributes: object}} [options] An object used to control the way the measure API operates
225
222
  * @returns {{start: number, end: number, duration: number, customAttributes: object}} Measurement details
226
223
  */
227
224
  measure(name, options) {
228
225
  return this.#callMethod(MEASURE, name, options);
229
226
  }
227
+
228
+ /**
229
+ * Accepts or rejects consent when the agent is configured to require consent before harvesting.
230
+ * The consent state is stored in session storage inside the NRBA_SESSION object.
231
+ * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/consent/}
232
+ * @param {boolean?} accept Whether to accept or reject consent. Defaults to true (accept) if left undefined.
233
+ */
234
+ consent(accept) {
235
+ return this.#callMethod(CONSENT, accept);
236
+ }
230
237
  }
@@ -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/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/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/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/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/mfe.js","../src/common/util/monkey-patched.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/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/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/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/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/feature-base.js","../src/features/utils/feature-gates.js","../src/features/utils/instrument-base.js","../src/features/utils/nr1-debugger.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/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/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/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/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/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/mfe.js","../src/common/util/monkey-patched.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/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/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/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/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/feature-base.js","../src/features/utils/feature-gates.js","../src/features/utils/instrument-base.js","../src/features/utils/nr1-debugger.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"}
@@ -264,6 +264,12 @@ export type Init = {
264
264
  * - If explicitly false, the agent will use HTTP instead of HTTPS. This setting should NOT be used.
265
265
  */
266
266
  ssl?: boolean | undefined;
267
+ browser_consent_mode?: {
268
+ /**
269
+ * - If true, the agent will use consent mode for whether to allow or disallow data harvest.
270
+ */
271
+ enabled?: boolean | undefined;
272
+ } | undefined;
267
273
  user_actions?: {
268
274
  /**
269
275
  * - Must be true to allow UserAction events to be captured.
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/common/config/init.js"],"names":[],"mappings":"AA8IO,0CAEN;mBArIY,OAAO,cAAc,EAAE,IAAI"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/common/config/init.js"],"names":[],"mappings":"AA+IO,0CAEN;mBAtIY,OAAO,cAAc,EAAE,IAAI"}
@@ -1 +1 @@
1
- {"version":3,"file":"harvester.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvester.js"],"names":[],"mappings":"AAyGA;;;;IAII;AACJ;;;;;;;;;IAFc,OAAO,CAyHpB;AA9MD;IAIE,2BAUC;IAZD,6BAA0B;IAGxB,cAAwB;IAW1B,wCASC;IAED;;;;;OAKG;IACH,iCAJW,MAAM,cACN,MAAM,GACJ,OAAO,CA2CnB;;CACF;8BAGY,OAAO,YAAY,EAAE,eAAe"}
1
+ {"version":3,"file":"harvester.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvester.js"],"names":[],"mappings":"AA8GA;;;;IAII;AACJ;;;;;;;;;IAFc,OAAO,CAuHpB;AA/MD;IAIE,2BAUC;IAZD,6BAA0B;IAGxB,cAAwB;IAW1B,wCASC;IAED;;;;;OAKG;IACH,iCAJW,MAAM,cACN,MAAM,GACJ,OAAO,CA8CnB;;CACF;8BAGY,OAAO,YAAY,EAAE,eAAe"}
@@ -20,7 +20,6 @@
20
20
  * @property {HarvestEndpointIdentifier} endpoint The endpoint to use (jserrors, events, resources etc.)
21
21
  * @property {HarvestPayload} payload Object representing payload.
22
22
  * @property {object} localOpts Additional options for sending data
23
- * @property {boolean} localOpts.needResponse Specify whether the caller expects a response data.
24
23
  * @property {boolean} localOpts.isFinalHarvest Specify whether the call is a final harvest during page unload.
25
24
  * @property {boolean} localOpts.sendEmptyBody Specify whether the call should be made even if the body is empty. Useful for rum calls.
26
25
  * @property {boolean} localOpts.forceNoRetry Don't save the buffered data in the case of a need to retry the transmission.
@@ -51,7 +50,6 @@ export type NetworkSendSpec = {
51
50
  * Additional options for sending data
52
51
  */
53
52
  localOpts: {
54
- needResponse: boolean;
55
53
  isFinalHarvest: boolean;
56
54
  sendEmptyBody: boolean;
57
55
  forceNoRetry: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/types.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH;;GAEG;AAEH;;;;GAIG;AAEH;;;;;;;;;;GAUG;AAEH,wBAAwB;wCArBX,KAAK,GAAC,UAAU,GAAC,QAAQ,GAAC,KAAK,GAAC,WAAW,GAAC,MAAM;;;;;QAKjD,MAAM;;;;UACN,MAAM;;;;;;cAKN,yBAAyB;;;;aACzB,cAAc;;;;eAEzB;QAA8B,YAAY,EAA/B,OAAO;QACY,cAAc,EAAjC,OAAO;QACY,aAAa,EAAhC,OAAO;QACY,YAAY,EAA/B,OAAO;KAClB;;;;kBAAW,OAAO,wBAAwB,EAAE,cAAc"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/types.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH;;GAEG;AAEH;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH,wBAAwB;wCApBX,KAAK,GAAC,UAAU,GAAC,QAAQ,GAAC,KAAK,GAAC,WAAW,GAAC,MAAM;;;;;QAKjD,MAAM;;;;UACN,MAAM;;;;;;cAKN,yBAAyB;;;;aACzB,cAAc;;;;eAEzB;QAA8B,cAAc,EAAjC,OAAO;QACY,aAAa,EAAhC,OAAO;QACY,YAAY,EAA/B,OAAO;KAClB;;;;kBAAW,OAAO,wBAAwB,EAAE,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":"AAqCA;IACE;;;;;OAKG;IACH,uBA+BC;IAzBC,qBAAsC;IACtC,aAAsB;IACtB,UAAe;IAGf,SAAc;IAEd,QAAiC;IAoBnC;;;;;aA6EC;IApEC,8BAA0B;IAC1B,+BAA4B;IAe1B,gCAOqC;IAUrC,4CAkBsC;IAexC,iCAAuB;IAKzB,wBAEC;IAED,sBAEC;IAED;;;OAGG;IACH,QAFa,MAAM,CA6BlB;IAED;;;;;;OAMG;IACH,YAHW,MAAM,GACJ,MAAM,CAkBlB;IAED,gBA2BC;IAED;;OAEG;IACH,gBAIC;IAED;;;OAGG;IACH,qBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,gBAHW,MAAM,GACJ,OAAO,CAKnB;IAED,yDAUC;IAED,6DAIC;IAED;;;OAGG;IACH,6BAHW,MAAM,GACJ,MAAM,CAIlB;IAED,gDAaC;IAHG,YAAuD;CAI5D;sBAtTqB,gBAAgB;iCAGL,4BAA4B"}
1
+ {"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":"AAsCA;IACE;;;;;OAKG;IACH,uBA+BC;IAzBC,qBAAsC;IACtC,aAAsB;IACtB,UAAe;IAGf,SAAc;IAEd,QAAiC;IAoBnC;;;;;aAgFC;IApEC,8BAA0B;IAC1B,+BAA4B;IAe1B,gCAOqC;IAUrC,4CAkBsC;IAexC,iCAAuB;IAKzB,wBAEC;IAED,sBAEC;IAED;;;OAGG;IACH,QAFa,MAAM,CA6BlB;IAED;;;;;;OAMG;IACH,YAHW,MAAM,GACJ,MAAM,CAkBlB;IAED,gBA2BC;IAED;;OAEG;IACH,gBAIC;IAED;;;OAGG;IACH,qBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,gBAHW,MAAM,GACJ,OAAO,CAKnB;IAED,yDAUC;IAED,6DAIC;IAED;;;OAGG;IACH,6BAHW,MAAM,GACJ,MAAM,CAIlB;IAED,gDAaC;IAHG,YAAuD;CAI5D;sBA1TqB,gBAAgB;iCAGL,4BAA4B"}
@@ -7,6 +7,7 @@
7
7
  * @returns {boolean}
8
8
  */
9
9
  export function isValidMFETarget(target?: Object): boolean;
10
+ export function hasValidValue(val: any): boolean;
10
11
  /**
11
12
  * When given a valid target, returns an object with the MFE payload attributes. Returns an empty object otherwise.
12
13
  * @param {Object} [target] the registered target
@@ -1 +1 @@
1
- {"version":3,"file":"mfe.d.ts","sourceRoot":"","sources":["../../../../src/common/util/mfe.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,0CAHW,MAAM,GACJ,OAAO,CAInB;AAED;;;;;GAKG;AACH,+CAJW,MAAM,sBACN,iBAAiB,GACf;IAAC,QAAQ,EAAE,GAAC,CAAC;IAAC,UAAU,SAAQ;CAAC,GAAC,EAAE,CAiBhD"}
1
+ {"version":3,"file":"mfe.d.ts","sourceRoot":"","sources":["../../../../src/common/util/mfe.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,0CAHW,MAAM,GACJ,OAAO,CAInB;AAED,iDAEC;AAED;;;;;GAKG;AACH,+CAJW,MAAM,sBACN,iBAAiB,GACf;IAAC,QAAQ,EAAE,GAAC,CAAC;IAAC,UAAU,SAAQ;CAAC,GAAC,EAAE,CAiBhD"}
@@ -1 +1 @@
1
- {"version":3,"file":"wrap-promise.d.ts","sourceRoot":"","sources":["../../../../src/common/wrap/wrap-promise.js"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,sCAHW,MAAM,GACJ,MAAM,CAqIlB;AAED;;;;;;GAMG;AACH,mCAJW,MAAM,GAEJ,MAAM,CAIlB"}
1
+ {"version":3,"file":"wrap-promise.d.ts","sourceRoot":"","sources":["../../../../src/common/wrap/wrap-promise.js"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,sCAHW,MAAM,GACJ,MAAM,CA+IlB;AAED;;;;;;GAMG;AACH,mCAJW,MAAM,GAEJ,MAAM,CAIlB"}
@@ -1,21 +1,40 @@
1
1
  export class Aggregate extends AggregateBase {
2
2
  static featureName: string;
3
3
  constructor(agentRef: any);
4
+ sentRum: boolean;
4
5
  timeToFirstByte: number;
5
6
  firstByteToWindowLoad: number;
6
7
  firstByteToDomContent: number;
8
+ retries: number;
7
9
  /**
8
10
  *
9
11
  * @param {Function} cb A function to run once the RUM call has finished - Defaults to activateFeatures
10
12
  * @param {*} customAttributes custom attributes to attach to the RUM call - Defaults to info.js
11
- * @param {*} target The target to harvest to
12
13
  */
13
- sendRum(customAttributes?: any, target?: any): void;
14
+ sendRum(customAttributes?: any): void;
15
+ queryStringsBuilder: (() => {
16
+ xx: any;
17
+ ua: any;
18
+ at: any;
19
+ qt: any;
20
+ ap: any;
21
+ be: number;
22
+ fe: number;
23
+ dc: number;
24
+ tt: any;
25
+ us: any;
26
+ ac: any;
27
+ pr: any;
28
+ af: string;
29
+ }) | undefined;
14
30
  rumStartTime: number | undefined;
15
- postHarvestCleanup({ status, responseText, xhr }: {
31
+ serializer(eventBuffer: any): any;
32
+ postHarvestCleanup({ sent, status, responseText, xhr, retry }: {
33
+ sent: any;
16
34
  status: any;
17
35
  responseText: any;
18
36
  xhr: any;
37
+ retry: any;
19
38
  }): void;
20
39
  }
21
40
  import { AggregateBase } from '../../utils/aggregate-base';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/aggregate/index.js"],"names":[],"mappings":"AAoBA;IACE,2BAA2C;IAC3C,2BA0BC;IAvBC,wBAAwB;IACxB,8BAA8B;IAC9B,8BAA8B;IAuBhC;;;;;OAKG;IACH,2BAHW,GAAC,WACD,GAAC,QAsEX;IAVC,iCAAyB;IAY3B;;;;aAyCC;CACF;8BA5J6B,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/aggregate/index.js"],"names":[],"mappings":"AAuBA;IACE,2BAA2C;IAE3C,2BA6BC;IA1BC,iBAAoB;IAEpB,wBAAwB;IACxB,8BAA8B;IAC9B,8BAA8B;IAC9B,gBAAgB;IAuBlB;;;;OAIG;IACH,2BAFW,GAAC,QAoEX;IAbC;;;;;;;;;;;;;;mBAOC;IANC,iCAAyB;IAc7B,kCAEC;IAED;;;;;;aAiGC;CACF;8BA5N6B,4BAA4B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/instrument/index.js"],"names":[],"mappings":"AAYA;IACE,2BAA2C;IAC3C,2BAaC;IAED,kDAiCC;CACF;AAED,8CAAuC;+BA3DR,6BAA6B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/instrument/index.js"],"names":[],"mappings":"AAWA;IACE,2BAA2C;IAC3C,2BAUC;IAED,kDAiCC;CACF;AAED,8CAAuC;+BAxDR,6BAA6B"}