@newrelic/browser-agent 1.302.0-rc.6 → 1.302.0-rc.8
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.
- package/dist/cjs/common/config/init-types.js +2 -0
- package/dist/cjs/common/config/init.js +3 -0
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/harvest/harvester.js +13 -9
- package/dist/cjs/common/harvest/types.js +0 -1
- package/dist/cjs/common/session/session-entity.js +4 -2
- package/dist/cjs/features/page_view_event/aggregate/index.js +36 -22
- package/dist/cjs/features/page_view_event/instrument/index.js +0 -4
- package/dist/cjs/features/utils/agent-session.js +13 -0
- package/dist/cjs/features/utils/instrument-base.js +7 -8
- package/dist/cjs/loaders/agent.js +2 -0
- package/dist/cjs/loaders/api/consent.js +24 -0
- package/dist/cjs/loaders/api/constants.js +3 -2
- package/dist/cjs/loaders/api-base.js +10 -0
- package/dist/esm/common/config/init-types.js +2 -0
- package/dist/esm/common/config/init.js +3 -0
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/harvest/harvester.js +13 -9
- package/dist/esm/common/harvest/types.js +0 -1
- package/dist/esm/common/session/session-entity.js +4 -2
- package/dist/esm/features/page_view_event/aggregate/index.js +36 -22
- package/dist/esm/features/page_view_event/instrument/index.js +0 -4
- package/dist/esm/features/utils/agent-session.js +13 -0
- package/dist/esm/features/utils/instrument-base.js +7 -8
- package/dist/esm/loaders/agent.js +2 -0
- package/dist/esm/loaders/api/consent.js +17 -0
- package/dist/esm/loaders/api/constants.js +2 -1
- package/dist/esm/loaders/api-base.js +11 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/common/config/init-types.d.ts +6 -0
- package/dist/types/common/config/init.d.ts.map +1 -1
- package/dist/types/common/harvest/harvester.d.ts.map +1 -1
- package/dist/types/common/harvest/types.d.ts +0 -2
- package/dist/types/common/harvest/types.d.ts.map +1 -1
- package/dist/types/common/session/session-entity.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts +22 -3
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -1
- package/dist/types/features/utils/agent-session.d.ts.map +1 -1
- package/dist/types/features/utils/instrument-base.d.ts +1 -0
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/consent.d.ts +2 -0
- package/dist/types/loaders/api/consent.d.ts.map +1 -0
- package/dist/types/loaders/api/constants.d.ts +1 -0
- package/dist/types/loaders/api/constants.d.ts.map +1 -1
- package/dist/types/loaders/api-base.d.ts +7 -0
- package/dist/types/loaders/api-base.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/config/init-types.js +2 -0
- package/src/common/config/init.js +1 -0
- package/src/common/harvest/harvester.js +11 -8
- package/src/common/harvest/types.js +0 -1
- package/src/common/session/session-entity.js +6 -2
- package/src/features/page_view_event/aggregate/index.js +29 -15
- package/src/features/page_view_event/instrument/index.js +0 -4
- package/src/features/utils/agent-session.js +12 -0
- package/src/features/utils/instrument-base.js +7 -9
- package/src/loaders/agent.js +2 -0
- package/src/loaders/api/consent.js +18 -0
- package/src/loaders/api/constants.js +1 -0
- package/src/loaders/api-base.js +11 -1
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright 2020-2025 New Relic, Inc. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import { handle } from '../../../common/event-emitter/handle';
|
|
6
5
|
import { setupSetPageViewNameAPI } from '../../../loaders/api/setPageViewName';
|
|
7
6
|
import { InstrumentBase } from '../../utils/instrument-base';
|
|
8
7
|
import * as CONSTANTS from '../constants';
|
|
@@ -19,9 +18,6 @@ export class Instrument extends InstrumentBase {
|
|
|
19
18
|
|
|
20
19
|
/** feature specific APIs */
|
|
21
20
|
setupSetPageViewNameAPI(agentRef);
|
|
22
|
-
|
|
23
|
-
/** messages from the register API that can trigger a new RUM call */
|
|
24
|
-
this.ee.on('api-send-rum', (attrs, target) => handle('send-rum', [attrs, target], undefined, this.featureName, this.ee));
|
|
25
21
|
this.importAggregator(agentRef, () => import(/* webpackChunkName: "page_view_event-aggregate" */'../aggregate'));
|
|
26
22
|
}
|
|
27
23
|
setupInspectionEvents(agentIdentifier) {
|
|
@@ -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.
|
|
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
|
};
|
|
@@ -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';
|
|
@@ -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
|
|
@@ -224,4 +224,14 @@ export class ApiBase {
|
|
|
224
224
|
measure(name, options) {
|
|
225
225
|
return this.#callMethod(MEASURE, name, options);
|
|
226
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
|
+
}
|
|
227
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":"
|
|
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":"
|
|
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
|
|
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":"
|
|
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"}
|
|
@@ -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
|
|
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
|
-
|
|
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":"AAuBA;IACE,2BAA2C;
|
|
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":"
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/agent-session.js"],"names":[],"mappings":"AAaA,
|
|
1
|
+
{"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/agent-session.js"],"names":[],"mappings":"AAaA,sDA4DC"}
|
|
@@ -21,6 +21,7 @@ export class InstrumentBase extends FeatureBase {
|
|
|
21
21
|
* @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
|
|
22
22
|
* one another if there are inter-features dependencies.
|
|
23
23
|
*/
|
|
24
|
+
loadedSuccessfully: Promise<any>;
|
|
24
25
|
onAggregateImported: Promise<any>;
|
|
25
26
|
/**
|
|
26
27
|
* used in conjunction with newrelic.start() to defer harvesting in features
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/instrument-base.js"],"names":[],"mappings":"AAuBA;;;GAGG;AACH;IACE;;;;OAIG;IACH,wCAFW,MAAM,
|
|
1
|
+
{"version":3,"file":"instrument-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/instrument-base.js"],"names":[],"mappings":"AAuBA;;;GAGG;AACH;IACE;;;;OAIG;IACH,wCAFW,MAAM,EA4ChB;IAvCC,cAAwB;IAExB,8IAA8I;IAC9I,cADW,WAAW,SAAS,CACF;IAE7B;;;MAGE;IACF,eAHU,OAAO,kBAAkB,EAAE,aAAa,CAGpB;IAE9B;;;MAGE;IACF,iCAAmC;IACnC,kCAEE;IAEF;;;MAGE;IACF,uBAAiC;IAiBnC;;;;;;;OAOG;IACH,2BALW,MAAM,qDAEN,MAAM,QAqDhB;;CAmBF;4BA9I2B,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/agent.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/agent.js"],"names":[],"mappings":"AA2BA;;;;;;;;;GASG;AAEH;;;GAGG;AACH;IACE;;OAEG;IACH,qBAFW,YAAY,EAgCtB;IApBC,yBAAkB;IAGlB,yCAAsD;IAMtD,uCAA6G;IAa/G;;;;;MAOC;IAED,gBAEC;IAED,yBAqCC;CACF;;;;;UApGa,OAAO,uBAAuB,EAAE,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;0BApBxB,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/consent.js"],"names":[],"mappings":"AASA,kDAQC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/constants.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAsB,MAAM,CAAA;AAC5B,+BAAwC;AAExC,8BAA+B,eAAe,CAAA;AAC9C,2BAA4B,YAAY,CAAA;AACxC,0BAA2B,YAAY,CAAA;AACvC,uBAAwB,UAAU,CAAA;AAClC,0BAA2B,aAAa,CAAA;AACxC,kBAAmB,KAAK,CAAA;AACxB,2BAA4B,aAAa,CAAA;AACzC,2BAA4B,aAAa,CAAA;AACzC,kCAAmC,mBAAmB,CAAA;AACtD,4BAA6B,cAAc,CAAA;AAC3C,uBAAwB,UAAU,CAAA;AAClC,sCAAuC,uBAAuB,CAAA;AAC9D,qCAAsC,qBAAqB,CAAA;AAC3D,mCAAoC,oBAAoB,CAAA;AACxD,gCAAiC,iBAAiB,CAAA;AAClD,iCAAkC,iBAAiB,CAAA;AACnD,0BAA2B,WAAW,CAAA;AACtC,oBAAqB,OAAO,CAAA;AAC5B,0BAA2B,YAAY,CAAA;AACvC,sBAAuB,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/constants.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAsB,MAAM,CAAA;AAC5B,+BAAwC;AAExC,8BAA+B,eAAe,CAAA;AAC9C,2BAA4B,YAAY,CAAA;AACxC,0BAA2B,YAAY,CAAA;AACvC,uBAAwB,UAAU,CAAA;AAClC,0BAA2B,aAAa,CAAA;AACxC,kBAAmB,KAAK,CAAA;AACxB,2BAA4B,aAAa,CAAA;AACzC,2BAA4B,aAAa,CAAA;AACzC,kCAAmC,mBAAmB,CAAA;AACtD,4BAA6B,cAAc,CAAA;AAC3C,uBAAwB,UAAU,CAAA;AAClC,sCAAuC,uBAAuB,CAAA;AAC9D,qCAAsC,qBAAqB,CAAA;AAC3D,mCAAoC,oBAAoB,CAAA;AACxD,gCAAiC,iBAAiB,CAAA;AAClD,iCAAkC,iBAAiB,CAAA;AACnD,0BAA2B,WAAW,CAAA;AACtC,oBAAqB,OAAO,CAAA;AAC5B,0BAA2B,YAAY,CAAA;AACvC,sBAAuB,SAAS,CAAA;AAChC,sBAAuB,SAAS,CAAA"}
|
|
@@ -173,6 +173,13 @@ export class ApiBase {
|
|
|
173
173
|
duration: number;
|
|
174
174
|
customAttributes: object;
|
|
175
175
|
};
|
|
176
|
+
/**
|
|
177
|
+
* Accepts or rejects consent when the agent is configured to require consent before harvesting.
|
|
178
|
+
* The consent state is stored in session storage inside the NRBA_SESSION object.
|
|
179
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/consent/}
|
|
180
|
+
* @param {boolean?} accept Whether to accept or reject consent. Defaults to true (accept) if left undefined.
|
|
181
|
+
*/
|
|
182
|
+
consent(accept: boolean | null): any;
|
|
176
183
|
#private;
|
|
177
184
|
}
|
|
178
185
|
export type InteractionInstance = import("./api/interaction-types").InteractionInstance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-base.d.ts","sourceR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,6 +84,8 @@
|
|
|
84
84
|
* @property {boolean} [spa.enabled] - Turn on/off the single page application feature (on by default). NOTE: the SPA feature is deprecated and under removal procedure.
|
|
85
85
|
* @property {boolean} [spa.autoStart] - If true, the agent will automatically start the single page application feature. Otherwise, it will be in a deferred state until the `start` API method is called.
|
|
86
86
|
* @property {boolean} [ssl] - If explicitly false, the agent will use HTTP instead of HTTPS. This setting should NOT be used.
|
|
87
|
+
* @property {Object} [browser_consent_mode]
|
|
88
|
+
* @property {boolean} [browser_consent_mode.enabled] - If true, the agent will use consent mode for whether to allow or disallow data harvest.
|
|
87
89
|
* @property {Object} [user_actions]
|
|
88
90
|
* @property {boolean} [user_actions.enabled] - Must be true to allow UserAction events to be captured.
|
|
89
91
|
* @property {Array<string>} [user_actions.elementAttributes] - List of HTML Element properties to be captured with UserAction events' target elements. This may help to identify the source element being interacted with in the UI.
|
|
@@ -53,6 +53,7 @@ const InitModelFn = () => {
|
|
|
53
53
|
set allow_registered_children (val) { hiddenState.experimental.allow_registered_children = val },
|
|
54
54
|
duplicate_registered_data: false
|
|
55
55
|
},
|
|
56
|
+
browser_consent_mode: { enabled: false },
|
|
56
57
|
distributed_tracing: {
|
|
57
58
|
enabled: undefined,
|
|
58
59
|
exclude_newrelic_header: undefined,
|
|
@@ -18,8 +18,10 @@ import { getSubmitMethod, xhr as xhrMethod, xhrFetch as fetchMethod } from '../u
|
|
|
18
18
|
import { activatedFeatures } from '../util/feature-flags'
|
|
19
19
|
import { dispatchGlobalEvent } from '../dispatch/global-event'
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
const
|
|
21
|
+
const RETRY = 'Harvester/Retry/'
|
|
22
|
+
const RETRY_ATTEMPTED = RETRY + 'Attempted/'
|
|
23
|
+
const RETRY_FAILED = RETRY + 'Failed/'
|
|
24
|
+
const RETRY_SUCCEEDED = RETRY + 'Succeeded/'
|
|
23
25
|
|
|
24
26
|
export class Harvester {
|
|
25
27
|
#started = false
|
|
@@ -57,12 +59,13 @@ export class Harvester {
|
|
|
57
59
|
triggerHarvestFor (aggregateInst, localOpts = {}) {
|
|
58
60
|
const output = { ranSend: false, payload: undefined, endpointVersion: aggregateInst.harvestEndpointVersion || 1 }
|
|
59
61
|
if (aggregateInst.blocked) return output
|
|
62
|
+
if (this.agentRef.init?.browser_consent_mode?.enabled && !this.agentRef.runtime?.session?.state?.consent) return output
|
|
60
63
|
|
|
61
64
|
const submitMethod = getSubmitMethod(localOpts)
|
|
62
65
|
if (!submitMethod) return output
|
|
63
66
|
|
|
64
67
|
const shouldRetryOnFail = !localOpts.isFinalHarvest && submitMethod === xhrMethod // always retry all features harvests except for final
|
|
65
|
-
output.payload =
|
|
68
|
+
output.payload = aggregateInst.makeHarvestPayload(shouldRetryOnFail, localOpts)
|
|
66
69
|
|
|
67
70
|
if (!output.payload) return output
|
|
68
71
|
|
|
@@ -86,7 +89,9 @@ export class Harvester {
|
|
|
86
89
|
*/
|
|
87
90
|
function cbFinished (result) {
|
|
88
91
|
if (aggregateInst.harvestOpts.prevAttemptCode) { // this means we just retried a harvest that last failed
|
|
89
|
-
handle(SUPPORTABILITY_METRIC_CHANNEL, [
|
|
92
|
+
const reportSM = (message) => handle(SUPPORTABILITY_METRIC_CHANNEL, [message], undefined, FEATURE_NAMES.metrics, aggregateInst.ee)
|
|
93
|
+
reportSM(RETRY_ATTEMPTED + aggregateInst.featureName)
|
|
94
|
+
reportSM((result.retry ? RETRY_FAILED : RETRY_SUCCEEDED) + aggregateInst.harvestOpts.prevAttemptCode)
|
|
90
95
|
delete aggregateInst.harvestOpts.prevAttemptCode // always reset last observation so we don't falsely report again next harvest
|
|
91
96
|
// In case this re-attempt failed again, that'll be handled (re-marked again) next.
|
|
92
97
|
}
|
|
@@ -155,8 +160,7 @@ export function send (agentRef, { endpoint, payload, localOpts = {}, submitMetho
|
|
|
155
160
|
result.addEventListener('loadend', function () {
|
|
156
161
|
// `this` here in block refers to the XHR object in this scope, do not change the anon function to an arrow function
|
|
157
162
|
// status 0 refers to a local error, such as CORS or network failure, or a blocked request by the browser (e.g. adblocker)
|
|
158
|
-
const cbResult = { sent: this.status !== 0, status: this.status, retry: shouldRetry(this.status), fullUrl, xhr: this }
|
|
159
|
-
if (localOpts.needResponse) cbResult.responseText = this.responseText
|
|
163
|
+
const cbResult = { sent: this.status !== 0, status: this.status, retry: shouldRetry(this.status), fullUrl, xhr: this, responseText: this.responseText }
|
|
160
164
|
cbFinished(cbResult)
|
|
161
165
|
|
|
162
166
|
/** temporary audit of consistency of harvest metadata flags */
|
|
@@ -165,8 +169,7 @@ export function send (agentRef, { endpoint, payload, localOpts = {}, submitMetho
|
|
|
165
169
|
} else if (submitMethod === fetchMethod) {
|
|
166
170
|
result.then(async function (response) {
|
|
167
171
|
const status = response.status
|
|
168
|
-
const cbResult = { sent: true, status, retry: shouldRetry(status), fullUrl, fetchResponse: response }
|
|
169
|
-
if (localOpts.needResponse) cbResult.responseText = await response.text()
|
|
172
|
+
const cbResult = { sent: true, status, retry: shouldRetry(status), fullUrl, fetchResponse: response, responseText: await response.text() }
|
|
170
173
|
cbFinished(cbResult)
|
|
171
174
|
/** temporary audit of consistency of harvest metadata flags */
|
|
172
175
|
if (!shouldRetry(status)) trackHarvestMetadata()
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
* @property {HarvestEndpointIdentifier} endpoint The endpoint to use (jserrors, events, resources etc.)
|
|
25
25
|
* @property {HarvestPayload} payload Object representing payload.
|
|
26
26
|
* @property {object} localOpts Additional options for sending data
|
|
27
|
-
* @property {boolean} localOpts.needResponse Specify whether the caller expects a response data.
|
|
28
27
|
* @property {boolean} localOpts.isFinalHarvest Specify whether the call is a final harvest during page unload.
|
|
29
28
|
* @property {boolean} localOpts.sendEmptyBody Specify whether the call should be made even if the body is empty. Useful for rum calls.
|
|
30
29
|
* @property {boolean} localOpts.forceNoRetry Don't save the buffered data in the case of a need to retry the transmission.
|
|
@@ -32,7 +32,8 @@ const model = {
|
|
|
32
32
|
loggingMode: LOGGING_MODE.OFF,
|
|
33
33
|
serverTimeDiff: null, // set by TimeKeeper; "undefined" value will not be stringified and stored but "null" will
|
|
34
34
|
custom: {},
|
|
35
|
-
numOfResets: 0
|
|
35
|
+
numOfResets: 0,
|
|
36
|
+
consent: false // set by consent() API call
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
export class SessionEntity {
|
|
@@ -77,7 +78,10 @@ export class SessionEntity {
|
|
|
77
78
|
|
|
78
79
|
setup ({ value = generateRandomHexString(16), expiresMs = DEFAULT_EXPIRES_MS, inactiveMs = DEFAULT_INACTIVE_MS, numOfResets = 0 }) {
|
|
79
80
|
/** Ensure that certain properties are preserved across a reset if already set */
|
|
80
|
-
const persistentAttributes = {
|
|
81
|
+
const persistentAttributes = {
|
|
82
|
+
serverTimeDiff: this.state.serverTimeDiff || model.serverTimeDiff,
|
|
83
|
+
consent: this.state.consent || model.consent
|
|
84
|
+
}
|
|
81
85
|
this.state = {}
|
|
82
86
|
this.sync({ ...model, ...persistentAttributes })
|
|
83
87
|
|