@newrelic/browser-agent 1.237.1 → 1.239.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/common/config/state/init.js +21 -13
- package/dist/cjs/common/config/state/runtime.js +0 -4
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/constants/runtime.js +3 -3
- package/dist/cjs/common/constants/shared-channel.js +3 -1
- package/dist/cjs/common/deny-list/deny-list.js +3 -9
- package/dist/cjs/common/drain/drain.js +1 -1
- package/dist/cjs/common/event-emitter/contextual-ee.js +24 -32
- package/dist/cjs/common/event-emitter/event-context.js +12 -0
- package/dist/cjs/common/harvest/harvest-scheduler.js +2 -4
- package/dist/cjs/common/harvest/harvest.js +4 -7
- package/dist/cjs/common/ids/bundle-id.js +19 -0
- package/dist/cjs/common/serialize/bel-serializer.js +1 -1
- package/dist/cjs/common/session/session-entity.js +16 -12
- package/dist/cjs/common/storage/first-party-cookies.js +5 -4
- package/dist/cjs/common/storage/local-storage.js +3 -2
- package/dist/cjs/common/timer/interaction-timer.js +14 -6
- package/dist/cjs/common/timing/nav-timing.js +1 -1
- package/dist/cjs/common/unload/eol.js +4 -30
- package/dist/cjs/common/util/feature-flags.js +14 -15
- package/dist/cjs/common/util/invoke.js +3 -1
- package/dist/cjs/common/util/obfuscate.js +3 -5
- package/dist/cjs/common/util/traverse.js +1 -0
- package/dist/cjs/common/window/page-visibility.js +1 -2
- package/dist/cjs/common/wrap/wrap-events.js +3 -2
- package/dist/cjs/common/wrap/wrap-fetch.js +1 -3
- package/dist/cjs/common/wrap/wrap-function.js +15 -46
- package/dist/cjs/common/wrap/wrap-jsonp.js +1 -1
- package/dist/cjs/common/wrap/wrap-mutation.js +1 -2
- package/dist/cjs/common/wrap/wrap-promise.js +2 -3
- package/dist/cjs/common/wrap/wrap-xhr.js +23 -27
- package/dist/cjs/features/ajax/aggregate/index.js +5 -7
- package/dist/cjs/features/ajax/instrument/distributed-tracing.js +8 -12
- package/dist/cjs/features/ajax/instrument/index.js +66 -24
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.js +0 -1
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +4 -4
- package/dist/cjs/features/jserrors/aggregate/index.js +4 -5
- package/dist/cjs/features/metrics/aggregate/framework-detection.js +103 -7
- package/dist/cjs/features/metrics/aggregate/index.js +20 -37
- package/dist/cjs/features/metrics/instrument/index.js +0 -2
- package/dist/cjs/features/page_action/aggregate/index.js +17 -19
- package/dist/cjs/features/page_view_event/aggregate/index.js +1 -2
- package/dist/cjs/features/page_view_event/instrument/index.js +4 -2
- package/dist/cjs/features/page_view_timing/aggregate/index.js +6 -7
- package/dist/cjs/features/session_replay/aggregate/index.js +5 -3
- package/dist/cjs/features/session_trace/aggregate/index.js +22 -16
- package/dist/cjs/features/spa/aggregate/index.js +14 -20
- package/dist/cjs/features/spa/aggregate/interaction.js +0 -2
- package/dist/cjs/features/spa/aggregate/serializer.js +1 -1
- package/dist/cjs/features/utils/aggregate-base.js +4 -0
- package/dist/cjs/features/utils/handler-cache.js +3 -1
- package/dist/cjs/features/utils/instrument-base.js +24 -6
- package/dist/cjs/loaders/agent-base.js +23 -0
- package/dist/cjs/loaders/agent.js +7 -7
- package/dist/cjs/loaders/api/api.js +34 -4
- package/dist/cjs/loaders/api/apiAsync.js +19 -20
- package/dist/cjs/loaders/api/interaction-types.js +11 -4
- package/dist/cjs/loaders/configure/configure.js +3 -0
- package/dist/cjs/loaders/micro-agent.js +20 -3
- package/dist/esm/common/config/state/init.js +21 -13
- package/dist/esm/common/config/state/runtime.js +0 -4
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/constants/runtime.js +1 -1
- package/dist/esm/common/constants/shared-channel.js +3 -1
- package/dist/esm/common/deny-list/deny-list.js +3 -9
- package/dist/esm/common/drain/drain.js +1 -1
- package/dist/esm/common/event-emitter/contextual-ee.js +22 -29
- package/dist/esm/common/event-emitter/event-context.js +5 -0
- package/dist/esm/common/harvest/harvest-scheduler.js +2 -4
- package/dist/esm/common/harvest/harvest.js +4 -7
- package/dist/esm/common/ids/bundle-id.js +13 -0
- package/dist/esm/common/serialize/bel-serializer.js +1 -1
- package/dist/esm/common/session/session-entity.js +16 -12
- package/dist/esm/common/storage/first-party-cookies.js +5 -4
- package/dist/esm/common/storage/local-storage.js +3 -2
- package/dist/esm/common/timer/interaction-timer.js +14 -6
- package/dist/esm/common/timing/nav-timing.js +1 -1
- package/dist/esm/common/unload/eol.js +5 -31
- package/dist/esm/common/util/feature-flags.js +14 -15
- package/dist/esm/common/util/invoke.js +3 -1
- package/dist/esm/common/util/obfuscate.js +3 -5
- package/dist/esm/common/util/traverse.js +1 -0
- package/dist/esm/common/window/page-visibility.js +1 -2
- package/dist/esm/common/wrap/wrap-events.js +4 -3
- package/dist/esm/common/wrap/wrap-fetch.js +2 -4
- package/dist/esm/common/wrap/wrap-function.js +15 -44
- package/dist/esm/common/wrap/wrap-jsonp.js +1 -1
- package/dist/esm/common/wrap/wrap-mutation.js +2 -3
- package/dist/esm/common/wrap/wrap-promise.js +3 -4
- package/dist/esm/common/wrap/wrap-xhr.js +23 -27
- package/dist/esm/features/ajax/aggregate/index.js +5 -7
- package/dist/esm/features/ajax/instrument/distributed-tracing.js +8 -12
- package/dist/esm/features/ajax/instrument/index.js +67 -25
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.js +0 -1
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +4 -4
- package/dist/esm/features/jserrors/aggregate/index.js +4 -5
- package/dist/esm/features/metrics/aggregate/framework-detection.js +103 -7
- package/dist/esm/features/metrics/aggregate/index.js +22 -39
- package/dist/esm/features/metrics/instrument/index.js +1 -3
- package/dist/esm/features/page_action/aggregate/index.js +17 -19
- package/dist/esm/features/page_view_event/aggregate/index.js +1 -2
- package/dist/esm/features/page_view_event/instrument/index.js +4 -2
- package/dist/esm/features/page_view_timing/aggregate/index.js +7 -8
- package/dist/esm/features/session_replay/aggregate/index.js +4 -2
- package/dist/esm/features/session_trace/aggregate/index.js +22 -16
- package/dist/esm/features/spa/aggregate/index.js +14 -20
- package/dist/esm/features/spa/aggregate/interaction.js +0 -2
- package/dist/esm/features/spa/aggregate/serializer.js +1 -1
- package/dist/esm/features/utils/aggregate-base.js +4 -0
- package/dist/esm/features/utils/handler-cache.js +3 -1
- package/dist/esm/features/utils/instrument-base.js +24 -6
- package/dist/esm/loaders/agent-base.js +23 -0
- package/dist/esm/loaders/agent.js +7 -7
- package/dist/esm/loaders/api/api.js +34 -4
- package/dist/esm/loaders/api/apiAsync.js +19 -20
- package/dist/esm/loaders/api/interaction-types.js +11 -4
- package/dist/esm/loaders/configure/configure.js +3 -0
- package/dist/esm/loaders/features/enabled-features.js +1 -1
- package/dist/esm/loaders/micro-agent.js +21 -4
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/config/state/runtime.d.ts.map +1 -1
- package/dist/types/common/constants/runtime.d.ts +1 -1
- package/dist/types/common/constants/runtime.d.ts.map +1 -1
- package/dist/types/common/event-emitter/contextual-ee.d.ts +22 -2
- package/dist/types/common/event-emitter/contextual-ee.d.ts.map +1 -1
- package/dist/types/common/event-emitter/event-context.d.ts +5 -0
- package/dist/types/common/event-emitter/event-context.d.ts.map +1 -0
- package/dist/types/common/event-emitter/register-handler.d.ts +1 -1
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/ids/bundle-id.d.ts +5 -0
- package/dist/types/common/ids/bundle-id.d.ts.map +1 -0
- package/dist/types/common/session/session-entity.d.ts +12 -15
- package/dist/types/common/session/session-entity.d.ts.map +1 -1
- package/dist/types/common/storage/first-party-cookies.d.ts +1 -1
- package/dist/types/common/storage/first-party-cookies.d.ts.map +1 -1
- package/dist/types/common/storage/local-storage.d.ts.map +1 -1
- package/dist/types/common/timer/interaction-timer.d.ts +3 -0
- package/dist/types/common/timer/interaction-timer.d.ts.map +1 -1
- package/dist/types/common/unload/eol.d.ts +1 -2
- package/dist/types/common/unload/eol.d.ts.map +1 -1
- package/dist/types/common/util/feature-flags.d.ts.map +1 -1
- package/dist/types/common/util/obfuscate.d.ts.map +1 -1
- package/dist/types/common/util/traverse.d.ts.map +1 -1
- package/dist/types/common/window/nreum.d.ts +2 -2
- package/dist/types/common/window/page-visibility.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-events.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-fetch.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-function.d.ts +1 -19
- package/dist/types/common/wrap/wrap-function.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-mutation.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-promise.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-xhr.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts +1 -1
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts.map +1 -1
- package/dist/types/features/ajax/instrument/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/framework-detection.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_action/aggregate/index.d.ts +2 -2
- package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts +5 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts +1 -0
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/dist/types/features/utils/handler-cache.d.ts.map +1 -1
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/loaders/agent-base.d.ts +15 -0
- package/dist/types/loaders/agent-base.d.ts.map +1 -1
- package/dist/types/loaders/agent.d.ts +1 -1
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts +7 -0
- package/dist/types/loaders/api/api.d.ts.map +1 -1
- package/dist/types/loaders/api/apiAsync.d.ts.map +1 -1
- package/dist/types/loaders/api/interaction-types.d.ts +18 -7
- package/dist/types/loaders/api/interaction-types.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts +2 -0
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/features/features.d.ts +9 -9
- package/dist/types/loaders/micro-agent.d.ts +7 -1
- package/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +62 -38
- package/src/common/aggregate/aggregator.test.js +107 -0
- package/src/common/config/state/configurable.test.js +73 -0
- package/src/common/config/state/info.test.js +31 -0
- package/src/common/config/state/init.js +13 -12
- package/src/common/config/state/init.test.js +28 -0
- package/src/common/config/state/loader-config.test.js +21 -0
- package/src/common/config/state/runtime.js +0 -2
- package/src/common/config/state/runtime.test.js +21 -0
- package/src/common/constants/__mocks__/runtime.js +1 -1
- package/src/common/constants/runtime.js +1 -1
- package/src/common/constants/runtime.test.js +2 -2
- package/src/common/constants/shared-channel.js +1 -1
- package/src/common/deny-list/deny-list.js +3 -11
- package/src/common/deny-list/deny-list.test.js +103 -30
- package/src/common/drain/drain.js +1 -1
- package/src/common/drain/drain.test.js +74 -0
- package/src/common/event-emitter/{contextual-ee.test.js → contextual-ee.component-test.js} +15 -32
- package/src/common/event-emitter/contextual-ee.js +26 -37
- package/src/common/event-emitter/event-context.js +5 -0
- package/src/common/harvest/harvest-scheduler.js +2 -5
- package/src/common/harvest/harvest-scheduler.test.js +2 -6
- package/src/common/harvest/harvest.js +4 -7
- package/src/common/harvest/harvest.test.js +1 -3
- package/src/common/ids/__mocks__/bundle-id.js +2 -0
- package/src/common/ids/__mocks__/unique-id.js +17 -0
- package/src/common/ids/bundle-id.js +13 -0
- package/src/common/ids/id.test.js +6 -6
- package/src/common/serialize/bel-serializer.js +1 -1
- package/src/common/session/session-entity.component-test.js +3 -2
- package/src/common/session/session-entity.js +11 -9
- package/src/common/storage/first-party-cookies.js +5 -4
- package/src/common/storage/local-storage.js +3 -2
- package/src/common/timer/interaction-timer.component-test.js +52 -7
- package/src/common/timer/interaction-timer.js +15 -6
- package/src/common/timer/timer.test.js +0 -1
- package/src/common/timing/nav-timing.js +1 -1
- package/src/common/unload/eol.js +5 -31
- package/src/common/url/__mocks__/parse-url.js +15 -0
- package/src/common/url/{encode.component-test.js → encode.test.js} +1 -0
- package/src/common/util/__mocks__/get-or-set.js +5 -0
- package/src/common/util/__mocks__/invoke.js +1 -0
- package/src/common/util/data-size.test.js +0 -1
- package/src/common/util/feature-flags.js +15 -17
- package/src/common/util/feature-flags.test.js +4 -8
- package/src/common/util/invoke.js +1 -1
- package/src/common/util/obfuscate.js +3 -5
- package/src/common/util/submit-data.test.js +1 -1
- package/src/common/util/traverse.js +1 -0
- package/src/common/window/__mocks__/nreum.js +12 -0
- package/src/common/window/page-visibility.js +1 -2
- package/src/common/wrap/wrap-events.js +4 -3
- package/src/common/wrap/wrap-fetch.js +2 -4
- package/src/common/wrap/wrap-function.js +16 -44
- package/src/common/wrap/wrap-jsonp.js +1 -1
- package/src/common/wrap/wrap-mutation.js +2 -3
- package/src/common/wrap/{wrap-promise.test.js → wrap-promise.component-test.js} +2 -32
- package/src/common/wrap/wrap-promise.js +3 -4
- package/src/common/wrap/wrap-xhr.js +24 -28
- package/src/features/ajax/aggregate/index.js +5 -7
- package/src/features/ajax/instrument/distributed-tracing.js +8 -12
- package/src/features/ajax/instrument/distributed-tracing.test.js +375 -0
- package/src/features/ajax/instrument/index.js +62 -27
- package/src/features/jserrors/aggregate/canonical-function-name.js +0 -2
- package/src/features/jserrors/aggregate/compute-stack-trace.js +4 -4
- package/src/features/jserrors/aggregate/compute-stack-trace.test.js +1 -1
- package/src/features/jserrors/aggregate/index.js +4 -5
- package/src/features/metrics/aggregate/framework-detection.js +129 -8
- package/src/features/metrics/aggregate/framework-detection.test.js +213 -82
- package/src/features/metrics/aggregate/index.js +22 -45
- package/src/features/metrics/instrument/index.js +1 -3
- package/src/features/page_action/aggregate/index.js +12 -13
- package/src/features/page_view_event/aggregate/index.js +1 -2
- package/src/features/page_view_event/instrument/index.js +2 -2
- package/src/features/page_view_timing/aggregate/index.js +7 -8
- package/src/features/session_replay/aggregate/index.component-test.js +3 -15
- package/src/features/session_replay/aggregate/index.js +4 -2
- package/src/features/session_trace/aggregate/index.js +22 -16
- package/src/features/spa/aggregate/index.js +14 -20
- package/src/features/spa/aggregate/interaction.js +0 -2
- package/src/features/spa/aggregate/serializer.js +1 -1
- package/src/features/utils/aggregate-base.js +5 -0
- package/src/features/utils/aggregate-base.test.js +2 -1
- package/src/features/utils/handler-cache.js +3 -2
- package/src/features/utils/instrument-base.js +25 -6
- package/src/features/utils/instrument-base.test.js +2 -2
- package/src/loaders/agent-base.js +23 -0
- package/src/loaders/agent.js +7 -7
- package/src/loaders/api/api.component-test.js +45 -0
- package/src/loaders/api/api.js +34 -4
- package/src/loaders/api/api.test.js +85 -0
- package/src/loaders/api/apiAsync.js +19 -20
- package/src/loaders/api/apiAsync.test.js +17 -0
- package/src/loaders/api/interaction-types.js +11 -4
- package/src/loaders/configure/configure.js +3 -0
- package/src/loaders/features/enabled-features.js +1 -1
- package/src/loaders/micro-agent.js +22 -4
- package/dist/cjs/features/metrics/aggregate/endpoint-map.js +0 -14
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.js +0 -14
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.js +0 -53
- package/dist/esm/features/metrics/aggregate/endpoint-map.js +0 -7
- package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.js +0 -8
- package/dist/esm/features/metrics/aggregate/polyfill-detection.js +0 -47
- package/dist/types/features/metrics/aggregate/endpoint-map.d.ts +0 -8
- package/dist/types/features/metrics/aggregate/endpoint-map.d.ts.map +0 -1
- package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts +0 -6
- package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts.map +0 -1
- package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts +0 -7
- package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts.map +0 -1
- package/src/features/metrics/aggregate/endpoint-map.js +0 -7
- package/src/features/metrics/aggregate/polyfill-detection.es5.js +0 -8
- package/src/features/metrics/aggregate/polyfill-detection.es5.test.js +0 -16
- package/src/features/metrics/aggregate/polyfill-detection.js +0 -48
- package/src/features/metrics/aggregate/polyfill-detection.test.js +0 -163
- /package/src/common/url/{protocol.component-test.js → protocol.test.js} +0 -0
|
@@ -7,7 +7,6 @@ import { getInfo, getRuntime, originals } from '../../../common/config/config';
|
|
|
7
7
|
import { mapOwn } from '../../../common/util/map-own';
|
|
8
8
|
import { ee } from '../../../common/event-emitter/contextual-ee';
|
|
9
9
|
import { InteractionNode } from './interaction-node';
|
|
10
|
-
import { now } from '../../../common/timing/now';
|
|
11
10
|
var originalSetTimeout = originals.ST;
|
|
12
11
|
var originalClearTimeout = originals.CT;
|
|
13
12
|
var lastId = {};
|
|
@@ -78,7 +77,6 @@ InteractionPrototype.finish = function finishInteraction() {
|
|
|
78
77
|
var root = interaction.root;
|
|
79
78
|
if (root.end !== null) return;
|
|
80
79
|
var endTimestamp = Math.max(interaction.lastCb, interaction.lastFinish);
|
|
81
|
-
var delta = now() - endTimestamp;
|
|
82
80
|
var attrs = root.attrs;
|
|
83
81
|
var customAttrs = attrs.custom;
|
|
84
82
|
if (this.onFinished) {
|
|
@@ -119,7 +119,7 @@ export class Serializer extends SharedContext {
|
|
|
119
119
|
// (since its the same as interaction.start)
|
|
120
120
|
// and limit to just the first 20 values we know about
|
|
121
121
|
mapOwn(navTiming.slice(1, 21), function (i, v) {
|
|
122
|
-
if (v !==
|
|
122
|
+
if (v !== undefined) {
|
|
123
123
|
navTimingNode += seperator + numeric(v - prev);
|
|
124
124
|
seperator = ',';
|
|
125
125
|
prev = v;
|
|
@@ -3,6 +3,7 @@ import { FeatureBase } from './feature-base';
|
|
|
3
3
|
import { getInfo, isConfigured, getRuntime } from '../../common/config/config';
|
|
4
4
|
import { configure } from '../../loaders/configure/configure';
|
|
5
5
|
import { gosCDN } from '../../common/window/nreum';
|
|
6
|
+
import { drain } from '../../common/drain/drain';
|
|
6
7
|
export class AggregateBase extends FeatureBase {
|
|
7
8
|
constructor() {
|
|
8
9
|
super(...arguments);
|
|
@@ -20,6 +21,9 @@ export class AggregateBase extends FeatureBase {
|
|
|
20
21
|
registerHandler("rumresp-".concat(fName), isOn => resolve(isOn), this.featureName, this.ee);
|
|
21
22
|
})));
|
|
22
23
|
}
|
|
24
|
+
drain() {
|
|
25
|
+
drain(this.agentIdentifier, this.featureName);
|
|
26
|
+
}
|
|
23
27
|
|
|
24
28
|
/**
|
|
25
29
|
* Checks for additional `jsAttributes` items to support backward compatibility with implementations of the agent where
|
|
@@ -36,7 +36,9 @@ export class HandlerCache {
|
|
|
36
36
|
* @returns {void}
|
|
37
37
|
*/
|
|
38
38
|
settle(handler) {
|
|
39
|
-
if (this.#decision === false)
|
|
39
|
+
if (this.#decision === false) {
|
|
40
|
+
// Do nothing
|
|
41
|
+
} else if (this.#decision === undefined) this.#cache.push(handler);else handler();
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
@@ -32,18 +32,24 @@ export class InstrumentBase extends FeatureBase {
|
|
|
32
32
|
this.auto = auto;
|
|
33
33
|
|
|
34
34
|
/** @type {Function | undefined} This should be set by any derived Instrument class if it has things to do when feature fails or is killed. */
|
|
35
|
-
this.abortHandler;
|
|
35
|
+
this.abortHandler = undefined;
|
|
36
|
+
|
|
36
37
|
/**
|
|
37
38
|
* @type {Class} Holds the reference to the feature's aggregate module counterpart, if and after it has been initialized. This may not be assigned until after page loads!
|
|
38
39
|
* The only purpose of this for now is to expose it to the NREUM interface, as the feature's instrument instance is already exposed.
|
|
39
40
|
*/
|
|
40
|
-
this.featAggregate;
|
|
41
|
+
this.featAggregate = undefined;
|
|
42
|
+
|
|
41
43
|
/**
|
|
42
44
|
* @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
|
|
43
45
|
* one another if there are inter-features dependencies.
|
|
44
46
|
*/
|
|
45
|
-
this.onAggregateImported;
|
|
46
|
-
|
|
47
|
+
this.onAggregateImported = undefined;
|
|
48
|
+
|
|
49
|
+
/** used in conjunction with newrelic.start() to defer harvesting in features */
|
|
50
|
+
if (getConfigurationValue(this.agentIdentifier, "".concat(this.featureName, ".autoStart")) === false) this.auto = false;
|
|
51
|
+
/** if the feature requires opt-in (!auto-start), it will get registered once the api has been called */
|
|
52
|
+
if (this.auto) registerDrain(agentIdentifier, featureName);
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
/**
|
|
@@ -54,7 +60,19 @@ export class InstrumentBase extends FeatureBase {
|
|
|
54
60
|
*/
|
|
55
61
|
importAggregator() {
|
|
56
62
|
let argsObjFromInstrument = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
|
-
if (this.featAggregate
|
|
63
|
+
if (this.featAggregate) return;
|
|
64
|
+
if (!this.auto) {
|
|
65
|
+
// this feature requires an opt in...
|
|
66
|
+
// wait for API to be called
|
|
67
|
+
this.ee.on("".concat(this.featureName, "-opt-in"), () => {
|
|
68
|
+
// register the feature to drain only once the API has been called, it will drain when importAggregator finishes for all the features
|
|
69
|
+
// called by the api in that cycle
|
|
70
|
+
registerDrain(this.agentIdentifier, this.featureName);
|
|
71
|
+
this.auto = true;
|
|
72
|
+
this.importAggregator();
|
|
73
|
+
});
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
58
76
|
const enableSessionTracking = isBrowserScope && getConfigurationValue(this.agentIdentifier, 'privacy.cookies_enabled') === true;
|
|
59
77
|
let loadedSuccessfully;
|
|
60
78
|
this.onAggregateImported = new Promise(resolve => {
|
|
@@ -75,7 +93,7 @@ export class InstrumentBase extends FeatureBase {
|
|
|
75
93
|
}
|
|
76
94
|
|
|
77
95
|
/**
|
|
78
|
-
* Note this try-catch differs from the one in Agent.
|
|
96
|
+
* Note this try-catch differs from the one in Agent.run() in that it's placed later in a page's lifecycle and
|
|
79
97
|
* it's only responsible for aborting its one specific feature, rather than all.
|
|
80
98
|
*/
|
|
81
99
|
try {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable n/handle-callback-err */
|
|
2
|
+
|
|
1
3
|
import { warn } from '../common/util/console';
|
|
2
4
|
export class AgentBase {
|
|
3
5
|
/**
|
|
@@ -50,6 +52,18 @@ export class AgentBase {
|
|
|
50
52
|
warn('Call to agent api setUserId failed. The js errors feature is not currently initialized.');
|
|
51
53
|
}
|
|
52
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Adds a user-defined application version string to subsequent events on the page.
|
|
57
|
+
* This decorates all payloads with an attribute of `application.version` which is queryable in NR1.
|
|
58
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setapplicationversion/}
|
|
59
|
+
* @param {string|null} value A string identifier for the application version, useful for
|
|
60
|
+
* tying all browser events to a specific release tag. The value parameter does not
|
|
61
|
+
* have to be unique. Passing a null value unsets any existing value.
|
|
62
|
+
*/
|
|
63
|
+
setApplicationVersion(value) {
|
|
64
|
+
warn('Call to agent api setApplicationVersion failed. The agent is not currently initialized.');
|
|
65
|
+
}
|
|
66
|
+
|
|
53
67
|
/**
|
|
54
68
|
* Allows selective ignoring and grouping of known errors that the browser agent captures.
|
|
55
69
|
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/seterrorhandler/}
|
|
@@ -77,4 +91,13 @@ export class AgentBase {
|
|
|
77
91
|
addRelease(name, id) {
|
|
78
92
|
warn('Call to agent api addRelease failed. The agent is not currently initialized.');
|
|
79
93
|
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Starts a set of agent features if not running in "autoStart" mode
|
|
97
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/start/}
|
|
98
|
+
* @param {string|string[]|undefined} name The feature name(s) to start. If no name(s) are passed, all features will be started
|
|
99
|
+
*/
|
|
100
|
+
start(featureNames) {
|
|
101
|
+
warn('Call to agent api addRelease failed. The agent is not currently initialized.');
|
|
102
|
+
}
|
|
80
103
|
}
|
|
@@ -44,7 +44,7 @@ export class Agent extends AgentBase {
|
|
|
44
44
|
// Future work is being planned to evaluate removing this behavior from the backend, but for now we must ensure this call is made
|
|
45
45
|
this.desiredFeatures.add(PageViewEvent);
|
|
46
46
|
Object.assign(this, configure(this.agentIdentifier, options, options.loaderType || 'agent'));
|
|
47
|
-
this.
|
|
47
|
+
this.run();
|
|
48
48
|
}
|
|
49
49
|
get config() {
|
|
50
50
|
return {
|
|
@@ -54,20 +54,20 @@ export class Agent extends AgentBase {
|
|
|
54
54
|
runtime: getRuntime(this.agentIdentifier)
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
run() {
|
|
58
58
|
const NR_FEATURES_REF_NAME = 'features';
|
|
59
59
|
// Attempt to initialize all the requested features (sequentially in prio order & synchronously), with any failure aborting the whole process.
|
|
60
60
|
try {
|
|
61
61
|
const enabledFeatures = getEnabledFeatures(this.agentIdentifier);
|
|
62
62
|
const featuresToStart = [...this.desiredFeatures];
|
|
63
63
|
featuresToStart.sort((a, b) => featurePriority[a.featureName] - featurePriority[b.featureName]);
|
|
64
|
-
featuresToStart.forEach(
|
|
64
|
+
featuresToStart.forEach(InstrumentCtor => {
|
|
65
65
|
// pageViewEvent must be enabled because RUM calls are not optional. See comment in constructor and PR 428.
|
|
66
|
-
if (enabledFeatures[
|
|
67
|
-
const dependencies = getFeatureDependencyNames(
|
|
66
|
+
if (enabledFeatures[InstrumentCtor.featureName] || InstrumentCtor.featureName === FEATURE_NAMES.pageViewEvent) {
|
|
67
|
+
const dependencies = getFeatureDependencyNames(InstrumentCtor.featureName);
|
|
68
68
|
const hasAllDeps = dependencies.every(x => enabledFeatures[x]);
|
|
69
|
-
if (!hasAllDeps) warn("".concat(
|
|
70
|
-
this.features[
|
|
69
|
+
if (!hasAllDeps) warn("".concat(InstrumentCtor.featureName, " is enabled but one or more dependent features has been disabled (").concat(stringify(dependencies), "). This may cause unintended consequences or missing data..."));
|
|
70
|
+
this.features[InstrumentCtor.featureName] = new InstrumentCtor(this.agentIdentifier, this.sharedAggregator);
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
gosNREUMInitializedAgents(this.agentIdentifier, this.features, NR_FEATURES_REF_NAME);
|
|
@@ -17,7 +17,7 @@ export const CUSTOM_ATTR_GROUP = 'CUSTOM/'; // the subgroup items should be stor
|
|
|
17
17
|
|
|
18
18
|
export function setTopLevelCallers() {
|
|
19
19
|
const nr = gosCDN();
|
|
20
|
-
const funcs = ['setErrorHandler', 'finished', 'addToTrace', 'inlineHit', 'addRelease', 'addPageAction', 'setCurrentRouteName', 'setPageViewName', 'setCustomAttribute', 'interaction', 'noticeError', 'setUserId'];
|
|
20
|
+
const funcs = ['setErrorHandler', 'finished', 'addToTrace', 'inlineHit', 'addRelease', 'addPageAction', 'setCurrentRouteName', 'setPageViewName', 'setCustomAttribute', 'interaction', 'noticeError', 'setUserId', 'setApplicationVersion', 'start'];
|
|
21
21
|
funcs.forEach(f => {
|
|
22
22
|
nr[f] = function () {
|
|
23
23
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -49,7 +49,9 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
49
49
|
var spaPrefix = prefix + 'ixn-';
|
|
50
50
|
|
|
51
51
|
// Setup stub functions that queue calls for later processing.
|
|
52
|
-
asyncApiFns.forEach(fnName =>
|
|
52
|
+
asyncApiFns.forEach(fnName => {
|
|
53
|
+
apiInterface[fnName] = apiCall(prefix, fnName, true, 'api');
|
|
54
|
+
});
|
|
53
55
|
apiInterface.addPageAction = apiCall(prefix, 'addPageAction', true, FEATURE_NAMES.pageAction);
|
|
54
56
|
apiInterface.setCurrentRouteName = apiCall(prefix, 'routeName', true, FEATURE_NAMES.spa);
|
|
55
57
|
apiInterface.setPageViewName = function (name, host) {
|
|
@@ -106,6 +108,34 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
106
108
|
}
|
|
107
109
|
return appendJsAttribute('enduser.id', value, 'setUserId', true);
|
|
108
110
|
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Attach the 'applcation.version' attribute onto agent payloads. This may be used in NR queries to group all browser events by a specific customer-defined release.
|
|
114
|
+
* @param {string|null} value - Application version -- if null, will "unset" the value
|
|
115
|
+
* @returns @see apiCall
|
|
116
|
+
*/
|
|
117
|
+
apiInterface.setApplicationVersion = function (value) {
|
|
118
|
+
if (!(typeof value === 'string' || value === null)) {
|
|
119
|
+
warn("Failed to execute setApplicationVersion. Expected <String | null>, but got <".concat(typeof value, ">."));
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
return appendJsAttribute('application.version', value, 'setApplicationVersion', false);
|
|
123
|
+
};
|
|
124
|
+
apiInterface.start = features => {
|
|
125
|
+
try {
|
|
126
|
+
const featNames = Object.values(FEATURE_NAMES);
|
|
127
|
+
if (features === undefined) features = featNames;else {
|
|
128
|
+
features = Array.isArray(features) && features.length ? features : [features];
|
|
129
|
+
if (features.some(f => !featNames.includes(f))) return warn("Invalid feature name supplied. Acceptable feature names are: ".concat(featNames));
|
|
130
|
+
if (!features.includes(FEATURE_NAMES.pageViewEvent)) features.push(FEATURE_NAMES.pageViewEvent);
|
|
131
|
+
}
|
|
132
|
+
features.forEach(feature => {
|
|
133
|
+
instanceEE.emit("".concat(feature, "-opt-in"));
|
|
134
|
+
});
|
|
135
|
+
} catch (err) {
|
|
136
|
+
warn('An unexpected issue occurred', err);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
109
139
|
apiInterface.interaction = function () {
|
|
110
140
|
return new InteractionHandle().get();
|
|
111
141
|
};
|
|
@@ -132,14 +162,14 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
132
162
|
};
|
|
133
163
|
}
|
|
134
164
|
};
|
|
135
|
-
|
|
165
|
+
['actionText', 'setName', 'setAttribute', 'save', 'ignore', 'onEnd', 'getContext', 'end', 'get'].forEach(name => {
|
|
136
166
|
InteractionApiProto[name] = apiCall(spaPrefix, name, undefined, FEATURE_NAMES.spa);
|
|
137
167
|
});
|
|
138
168
|
function apiCall(prefix, name, notSpa, bufferGroup) {
|
|
139
169
|
return function () {
|
|
140
170
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/' + name + '/called'], undefined, FEATURE_NAMES.metrics, instanceEE);
|
|
141
171
|
if (bufferGroup) handle(prefix + name, [now(), ...arguments], notSpa ? null : this, bufferGroup, instanceEE); // no bufferGroup means only the SM is emitted
|
|
142
|
-
return notSpa ?
|
|
172
|
+
return notSpa ? undefined : this;
|
|
143
173
|
};
|
|
144
174
|
}
|
|
145
175
|
apiInterface.noticeError = function (err, customAttributes) {
|
|
@@ -13,10 +13,10 @@ export function setAPI(agentIdentifier) {
|
|
|
13
13
|
var scheme = getConfigurationValue(agentIdentifier, 'ssl') === false ? 'http' : 'https';
|
|
14
14
|
var api = {
|
|
15
15
|
finished: single(finished),
|
|
16
|
-
setErrorHandler
|
|
17
|
-
addToTrace
|
|
18
|
-
inlineHit
|
|
19
|
-
addRelease
|
|
16
|
+
setErrorHandler,
|
|
17
|
+
addToTrace,
|
|
18
|
+
inlineHit,
|
|
19
|
+
addRelease
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// Hook all of the api functions up to the queues/stubs created in loader/api.js
|
|
@@ -52,29 +52,28 @@ export function setAPI(agentIdentifier) {
|
|
|
52
52
|
handle('bstApi', [report], undefined, FEATURE_NAMES.sessionTrace, instanceEE);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
// NREUM.inlineHit(
|
|
55
|
+
// NREUM.inlineHit(requestName, queueTime, appTime, totalBackEndTime, domTime, frontEndTime)
|
|
56
56
|
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
function inlineHit(t,
|
|
57
|
+
// requestName - the 'web page' name or service name
|
|
58
|
+
// queueTime - the amount of time spent in the app tier queue
|
|
59
|
+
// appTime - the amount of time spent in the application code
|
|
60
|
+
// totalBackEndTime - the total roundtrip time of the remote service call
|
|
61
|
+
// domTime - the time spent processing the result of the service call (or user defined)
|
|
62
|
+
// frontEndTime - the time spent rendering the result of the service call (or user defined)
|
|
63
|
+
function inlineHit(t, requestName, queueTime, appTime, totalBackEndTime, domTime, frontEndTime) {
|
|
64
64
|
if (!isBrowserScope) return;
|
|
65
|
-
|
|
65
|
+
requestName = window.encodeURIComponent(requestName);
|
|
66
66
|
cycle += 1;
|
|
67
67
|
const agentInfo = getInfo(agentIdentifier);
|
|
68
|
-
const agentRuntime = getRuntime(agentIdentifier);
|
|
69
68
|
if (!agentInfo.beacon) return;
|
|
70
69
|
var url = scheme + '://' + agentInfo.beacon + '/1/' + agentInfo.licenseKey;
|
|
71
70
|
url += '?a=' + agentInfo.applicationID + '&';
|
|
72
|
-
url += 't=' +
|
|
73
|
-
url += 'qt=' + ~~
|
|
74
|
-
url += 'ap=' + ~~
|
|
75
|
-
url += 'be=' + ~~
|
|
76
|
-
url += 'dc=' + ~~
|
|
77
|
-
url += 'fe=' + ~~
|
|
71
|
+
url += 't=' + requestName + '&';
|
|
72
|
+
url += 'qt=' + ~~queueTime + '&';
|
|
73
|
+
url += 'ap=' + ~~appTime + '&';
|
|
74
|
+
url += 'be=' + ~~totalBackEndTime + '&';
|
|
75
|
+
url += 'dc=' + ~~domTime + '&';
|
|
76
|
+
url += 'fe=' + ~~frontEndTime + '&';
|
|
78
77
|
url += 'c=' + cycle;
|
|
79
78
|
submitData.xhr({
|
|
80
79
|
url
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @property {getContext} getContext
|
|
7
7
|
* @property {ignore} ignore
|
|
8
8
|
* @property {onEnd} onEnd
|
|
9
|
-
* @property {
|
|
9
|
+
* @property {save} save
|
|
10
10
|
* @property {setAttribute} setAttribute
|
|
11
11
|
* @property {setName} setName
|
|
12
12
|
*/
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/createtracer/}
|
|
25
25
|
* @callback createTracer
|
|
26
26
|
* @param {string} name This will be used as the name of the tracer.
|
|
27
|
-
* @param {
|
|
28
|
-
* @returns {
|
|
27
|
+
* @param {(...args: any[]) => any} [callback] A callback that contains the synchronous work to run at the end of the async work. To execute this callback, call the wrapper function returned using createTracer().
|
|
28
|
+
* @returns {(...args: any[]) => any} Returns a method that wraps the original callback. When this method is invoked, it calls the original callback and ends the async timing.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -43,6 +43,13 @@
|
|
|
43
43
|
* @returns {InteractionInstance} Returns the same interaction object allowing method chaining.
|
|
44
44
|
*/
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Overrides other SPA save() calls; ignores an interaction so it is not saved or sent to New Relic.
|
|
48
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/ignore/}
|
|
49
|
+
* @callback ignore
|
|
50
|
+
* @returns {InteractionInstance} Returns the same interaction object allowing method chaining.
|
|
51
|
+
*/
|
|
52
|
+
|
|
46
53
|
/**
|
|
47
54
|
* Change the values associated with a SPA interaction before the interaction is saved.
|
|
48
55
|
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/onend/}
|
|
@@ -63,7 +70,7 @@
|
|
|
63
70
|
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setattribute/}
|
|
64
71
|
* @callback setAttribute
|
|
65
72
|
* @param {string} key Used as the attribute name on the BrowserInteraction event.
|
|
66
|
-
* @param {any}
|
|
73
|
+
* @param {any} value Used as the attribute value on the BrowserInteraction event. This can be a string, number, boolean, or object. If it is an object, New Relic serializes it to a JSON string.
|
|
67
74
|
* @returns {InteractionInstance} Returns the same interaction object allowing method chaining.
|
|
68
75
|
*/
|
|
69
76
|
|
|
@@ -7,6 +7,7 @@ export function configure(agentIdentifier) {
|
|
|
7
7
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8
8
|
let loaderType = arguments.length > 2 ? arguments[2] : undefined;
|
|
9
9
|
let forceDrain = arguments.length > 3 ? arguments[3] : undefined;
|
|
10
|
+
// eslint-disable-next-line camelcase
|
|
10
11
|
let {
|
|
11
12
|
init,
|
|
12
13
|
info,
|
|
@@ -20,9 +21,11 @@ export function configure(agentIdentifier) {
|
|
|
20
21
|
if (!info) {
|
|
21
22
|
init = nr.init;
|
|
22
23
|
info = nr.info;
|
|
24
|
+
// eslint-disable-next-line camelcase
|
|
23
25
|
loader_config = nr.loader_config;
|
|
24
26
|
}
|
|
25
27
|
setConfiguration(agentIdentifier, init || {});
|
|
28
|
+
// eslint-disable-next-line camelcase
|
|
26
29
|
setLoaderConfig(agentIdentifier, loader_config || {});
|
|
27
30
|
info.jsAttributes ??= {};
|
|
28
31
|
if (isWorkerScope) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FEATURE_NAMES } from './features';
|
|
2
|
-
import { getConfigurationValue
|
|
2
|
+
import { getConfigurationValue } from '../../common/config/config';
|
|
3
3
|
const featureNames = Object.values(FEATURE_NAMES);
|
|
4
4
|
function isEnabled(name, agentIdentifier) {
|
|
5
5
|
return getConfigurationValue(agentIdentifier, "".concat(name, ".enabled")) !== false;
|
|
@@ -6,7 +6,7 @@ import { configure } from './configure/configure';
|
|
|
6
6
|
import { Aggregator } from '../common/aggregate/aggregator';
|
|
7
7
|
import { gosNREUMInitializedAgents } from '../common/window/nreum';
|
|
8
8
|
import { generateRandomHexString } from '../common/ids/unique-id';
|
|
9
|
-
import { getConfiguration, getInfo, getLoaderConfig, getRuntime } from '../common/config/config';
|
|
9
|
+
import { getConfiguration, getConfigurationValue, getInfo, getLoaderConfig, getRuntime } from '../common/config/config';
|
|
10
10
|
import { FEATURE_NAMES } from './features/features';
|
|
11
11
|
import { warn } from '../common/util/console';
|
|
12
12
|
import { onWindowLoad } from '../common/window/load';
|
|
@@ -37,7 +37,14 @@ export class MicroAgent extends AgentBase {
|
|
|
37
37
|
isolatedBacklog: true
|
|
38
38
|
}
|
|
39
39
|
}, options.loaderType || 'micro-agent'));
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Starts a set of agent features if not running in "autoStart" mode
|
|
43
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/start/}
|
|
44
|
+
* @param {string|string[]|undefined} name The feature name(s) to start. If no name(s) are passed, all features will be started
|
|
45
|
+
*/
|
|
46
|
+
this.start = features => this.run(features);
|
|
47
|
+
this.run(nonAutoFeatures.filter(featureName => getConfigurationValue(agentIdentifier, "".concat(featureName, ".autoStart"))));
|
|
41
48
|
}
|
|
42
49
|
get config() {
|
|
43
50
|
return {
|
|
@@ -47,7 +54,17 @@ export class MicroAgent extends AgentBase {
|
|
|
47
54
|
runtime: getRuntime(this.agentIdentifier)
|
|
48
55
|
};
|
|
49
56
|
}
|
|
50
|
-
|
|
57
|
+
run(features) {
|
|
58
|
+
try {
|
|
59
|
+
const featNames = nonAutoFeatures;
|
|
60
|
+
if (features === undefined) features = featNames;else {
|
|
61
|
+
features = Array.isArray(features) && features.length ? features : [features];
|
|
62
|
+
if (features.some(f => !featNames.includes(f))) return warn("Invalid feature name supplied. Acceptable feature names are: ".concat(featNames));
|
|
63
|
+
if (!features.includes(FEATURE_NAMES.pageViewEvent)) features.push(FEATURE_NAMES.pageViewEvent);
|
|
64
|
+
}
|
|
65
|
+
} catch (err) {
|
|
66
|
+
warn('An unexpected issue occurred', err);
|
|
67
|
+
}
|
|
51
68
|
try {
|
|
52
69
|
const enabledFeatures = getEnabledFeatures(this.agentIdentifier);
|
|
53
70
|
try {
|
|
@@ -59,7 +76,7 @@ export class MicroAgent extends AgentBase {
|
|
|
59
76
|
onWindowLoad(() => {
|
|
60
77
|
// these features do not import an "instrument" file, meaning they are only hooked up to the API.
|
|
61
78
|
nonAutoFeatures.forEach(f => {
|
|
62
|
-
if (enabledFeatures[f]) {
|
|
79
|
+
if (enabledFeatures[f] && features.includes(f)) {
|
|
63
80
|
import( /* webpackChunkName: "lazy-feature-loader" */'../features/utils/lazy-feature-loader').then(_ref => {
|
|
64
81
|
let {
|
|
65
82
|
lazyFeatureLoader
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"AAsEA,+CAIC;AAED,0DAIC;AAED,+DAYC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/runtime.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/runtime.js"],"names":[],"mappings":"AA4BA,yCAIC;AAED,oDAIC"}
|
|
@@ -22,7 +22,7 @@ export const isiOS: boolean;
|
|
|
22
22
|
* did not work. This affects our onFCP metric in particular since web-vitals uses that flag to retrieve paint timing entries.
|
|
23
23
|
* This was fixed in v16+.
|
|
24
24
|
*/
|
|
25
|
-
export const
|
|
25
|
+
export const iOSBelow16: boolean;
|
|
26
26
|
export const ffVersion: number;
|
|
27
27
|
export const isIE: boolean;
|
|
28
28
|
export const supportsSendBeacon: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/runtime.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,qCAEqB;AAErB;;GAEG;AACH,oCAeK;AAEL,oDAUI;AAEJ,qCAAyD;AAEzD,4BAAiE;AAEjE;;;;;;GAMG;AACH,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/runtime.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,qCAEqB;AAErB;;GAEG;AACH,oCAeK;AAEL,oDAUI;AAEJ,qCAAyD;AAEzD,4BAAiE;AAEjE;;;;;;GAMG;AACH,iCAAwE;AAExE,+BAOI;AAEJ,2BAA2E;AAE3E,sCAAwD"}
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
declare namespace globalInstance {
|
|
2
|
+
export { addEventListener as on };
|
|
3
|
+
export { addEventListener };
|
|
4
|
+
export { removeEventListener };
|
|
5
|
+
export { emit };
|
|
6
|
+
export { getOrCreate as get };
|
|
7
|
+
export { listeners };
|
|
8
|
+
export { context };
|
|
9
|
+
export { bufferEventsByGroup as buffer };
|
|
10
|
+
export { abort };
|
|
11
|
+
export const aborted: boolean;
|
|
12
|
+
export { isBuffering };
|
|
13
|
+
export { debugId };
|
|
14
|
+
export const backlog: any;
|
|
15
|
+
}
|
|
16
|
+
export const contextId: string;
|
|
17
|
+
declare function emit(type: any, args: any, contextOrStore: any, force: any, bubble: any): any;
|
|
18
|
+
declare function getOrCreate(name: any): any;
|
|
19
|
+
declare function listeners(type: any): any;
|
|
20
|
+
declare function bufferEventsByGroup(types: any, group: any): void;
|
|
21
|
+
declare function abort(): void;
|
|
22
|
+
declare function isBuffering(type: any): boolean;
|
|
2
23
|
export { globalInstance as ee };
|
|
3
|
-
declare var globalInstance: any;
|
|
4
24
|
//# sourceMappingURL=contextual-ee.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextual-ee.d.ts","sourceRoot":"","sources":["../../../../src/common/event-emitter/contextual-ee.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contextual-ee.d.ts","sourceRoot":"","sources":["../../../../src/common/event-emitter/contextual-ee.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAYA,+BAA0C;AA0DxC,+FAsBC;AAqBD,6CAEC;AAND,2CAEC;AAMD,mEAaC;AAcH,+BAGC;AAfC,iDAGC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-context.d.ts","sourceRoot":"","sources":["../../../../src/common/event-emitter/event-context.js"],"names":[],"mappings":"AAAA;IACE,4BAEC;IADC,eAA0B;CAE7B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function defaultRegister(type: any, handler: any, group: any, ee: any): void;
|
|
2
2
|
export namespace defaultRegister {
|
|
3
3
|
export { registerWithSpecificEmitter as on };
|
|
4
|
-
export
|
|
4
|
+
export const handlers: {};
|
|
5
5
|
}
|
|
6
6
|
export { defaultRegister as registerHandler };
|
|
7
7
|
declare function registerWithSpecificEmitter(ee: any, handlers: any, type: any, handler: any, group: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE;;;;;;;;;;SAUK;IACL,sBATa,MAAM;QAES,UAAU;QACV,UAAU;QACZ,UAAU,EAAvB,MAAM;QACQ,GAAG,EAAjB,OAAO;QACM,SAAS,EAAtB,MAAM;oBAoBlB;IAfC,iBAAwB;IACxB;;;oBARW,MAAM;aACN,OAAO;mBACP,MAAM;MAMK;IACtB,iBAAoB;IACpB,mBAAyB;IACzB,iBAAoB;IAEpB,iBAA8C;IAWhD;;;OAGG;IACH,eAKC;IAED,mDAIC;IAHC,cAAwB;IAK1B,uCAMC;IAED,6CAUC;IAED,yCA8DC;IAED,gDAiBC;CACF;8BA9J6B,2BAA2B;wBACjC,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;OAKG;IACH,aAFW,eAAe,
|
|
1
|
+
{"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;OAKG;IACH,aAFW,eAAe,WAWzB;IAED;;;OAGG;IACH,YAFW,eAAe,WAMzB;IAED;;;OAGG;IACH,wBAFW,eAAe,WAMzB;IAED;;;;;;OAMG;IACH,gGAJW,eAAe,GACb,OAAO,CA+EnB;IAGD,0BAmBC;IAED;;;;;;;OAOG;IACH,wBALW,yBAAyB,WACzB,6BAA6B,GAE3B,cAAc,CA2B1B;IAED;;;;;;;OAOG;IACH,uBAHW,cAAc,GACZ,cAAc,CAuB1B;IAED;;;;;OAKG;IACH,aAHW,yBAAyB,YACzB,sBAAsB,QAQhC;CACF;8BAhPY,OAAO,YAAY,EAAE,eAAe;wCACpC,OAAO,YAAY,EAAE,yBAAyB;6BAC9C,OAAO,YAAY,EAAE,cAAc;qCACnC,OAAO,YAAY,EAAE,sBAAsB;4CAC3C,OAAO,YAAY,EAAE,6BAA6B;8BAZjC,2BAA2B;2BAF9B,mBAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-id.d.ts","sourceRoot":"","sources":["../../../../src/common/ids/bundle-id.js"],"names":[],"mappings":"AASA;;GAEG;AACH,8BAAsC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export namespace MODE {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const OFF: number;
|
|
3
|
+
const FULL: number;
|
|
4
|
+
const ERROR: number;
|
|
5
5
|
}
|
|
6
6
|
export namespace SESSION_EVENTS {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const PAUSE: string;
|
|
8
|
+
const RESET: string;
|
|
9
|
+
const RESUME: string;
|
|
10
10
|
}
|
|
11
11
|
export class SessionEntity {
|
|
12
12
|
/**
|
|
@@ -16,21 +16,18 @@ export class SessionEntity {
|
|
|
16
16
|
* expiresMs and inactiveMs are used to "expire" the session, but can be overridden in the constructor. Pass 0 to disable expiration timers.
|
|
17
17
|
*/
|
|
18
18
|
constructor(opts: any);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
agentIdentifier: any;
|
|
20
|
+
storage: any;
|
|
21
|
+
state: {};
|
|
22
|
+
key: any;
|
|
23
|
+
ee: any;
|
|
24
|
+
setup({ value, expiresMs, inactiveMs }: {
|
|
23
25
|
value?: string | undefined;
|
|
24
26
|
expiresMs?: number | undefined;
|
|
25
27
|
inactiveMs?: number | undefined;
|
|
26
28
|
}): void;
|
|
27
|
-
agentIdentifier: any;
|
|
28
|
-
storage: any;
|
|
29
|
-
state: {} | undefined;
|
|
30
|
-
key: any;
|
|
31
29
|
expiresMs: number | undefined;
|
|
32
30
|
inactiveMs: number | undefined;
|
|
33
|
-
ee: any;
|
|
34
31
|
expiresTimer: Timer | undefined;
|
|
35
32
|
inactiveTimer: InteractionTimer | undefined;
|
|
36
33
|
isNew: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":";;;;;;;;;;AAoCA;IACE;;;;;OAKG;IACH,
|
|
1
|
+
{"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":";;;;;;;;;;AAoCA;IACE;;;;;OAKG;IACH,uBAgBC;IAVC,qBAAsC;IACtC,aAAsB;IACtB,UAAe;IAGf,SAAc;IAEd,QAAiC;IAKnC;;;;aAsEC;IA/DC,8BAA0B;IAC1B,+BAA4B;IAc1B,gCAOqC;IAUrC,4CAiBsC;IAOV,2BAA6C;IAM3E,iCAAuB;IAIzB,wBAEC;IAED,sBAEC;IAED;;;OAGG;IACH,QAFa,MAAM,CA6BlB;IAED;;;;;;OAMG;IACH,YAHW,MAAM,GACJ,MAAM,CAiBlB;IAED,gBAuBC;IAED;;OAEG;IACH,gBAIC;IAED;;;OAGG;IACH,qBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,gBAHW,MAAM,GACJ,OAAO,CAKnB;IAED,yDAYC;IAED;;;OAGG;IACH,6BAHW,MAAM,GACJ,MAAM,CAIlB;IAED,gDAaC;IAHG,YAAuD;CAI5D;sBA1RqB,gBAAgB;iCAGL,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-party-cookies.d.ts","sourceRoot":"","sources":["../../../../src/common/storage/first-party-cookies.js"],"names":[],"mappings":"AAAA;IACE,yBAEC;IADC,YAAoB;IAGtB,
|
|
1
|
+
{"version":3,"file":"first-party-cookies.d.ts","sourceRoot":"","sources":["../../../../src/common/storage/first-party-cookies.js"],"names":[],"mappings":"AAAA;IACE,yBAEC;IADC,YAAoB;IAGtB,mCAQC;IAED,gCAOC;IAED,uBAMC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../../../../src/common/storage/local-storage.js"],"names":[],"mappings":"AAAA;IACE,
|
|
1
|
+
{"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../../../../src/common/storage/local-storage.js"],"names":[],"mappings":"AAAA;IACE,kCASC;IAED,gCAOC;IAED,uBAMC;CACF"}
|