@newrelic/browser-agent 0.0.9 → 0.1.229
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/README.md +84 -207
- package/dist/cjs/cdn/lite.js +14 -0
- package/dist/cjs/cdn/polyfills/lite.js +4 -0
- package/dist/cjs/cdn/polyfills/pro.js +4 -0
- package/dist/cjs/cdn/polyfills/spa.js +4 -0
- package/dist/cjs/cdn/polyfills.js +14 -0
- package/dist/cjs/cdn/pro.js +19 -0
- package/dist/cjs/cdn/spa.js +19 -0
- package/dist/cjs/cdn/worker.js +16 -0
- package/dist/cjs/common/aggregate/aggregator.js +168 -0
- package/dist/cjs/common/browser-version/firefox-version.js +17 -0
- package/dist/cjs/common/browser-version/ios-version.js +18 -0
- package/dist/cjs/common/config/config.js +76 -0
- package/dist/cjs/common/config/state/configurable.js +32 -0
- package/dist/cjs/common/config/state/info.js +50 -0
- package/dist/cjs/common/config/state/init.js +86 -0
- package/dist/cjs/common/config/state/loader-config.js +28 -0
- package/dist/cjs/common/config/state/originals.js +9 -0
- package/dist/cjs/common/config/state/runtime.js +50 -0
- package/dist/cjs/common/constants/environment-variables.js +20 -0
- package/dist/cjs/common/context/shared-context.js +25 -0
- package/dist/cjs/common/deny-list/deny-list.js +108 -0
- package/dist/cjs/common/drain/drain.js +126 -0
- package/dist/cjs/common/event-emitter/contextual-ee.js +149 -0
- package/dist/cjs/common/event-emitter/handle.js +24 -0
- package/dist/cjs/common/event-emitter/register-handler.js +24 -0
- package/dist/cjs/common/event-listener/event-listener-opts.js +46 -0
- package/dist/cjs/common/harvest/harvest-scheduler.js +111 -0
- package/dist/cjs/common/harvest/harvest.js +236 -0
- package/dist/cjs/common/ids/id.js +30 -0
- package/dist/cjs/common/ids/unique-id.js +84 -0
- package/dist/cjs/common/metrics/framework-detection.js +72 -0
- package/dist/cjs/common/metrics/paint-metrics.js +13 -0
- package/dist/cjs/common/serialize/bel-serializer.js +89 -0
- package/dist/cjs/common/timing/nav-timing.js +77 -0
- package/dist/cjs/common/timing/now.js +15 -0
- package/dist/cjs/common/unload/eol.js +69 -0
- package/dist/cjs/common/url/clean-url.js +16 -0
- package/dist/cjs/common/url/encode.js +79 -0
- package/dist/cjs/common/url/location.js +14 -0
- package/dist/cjs/common/url/parse-url.js +66 -0
- package/dist/cjs/common/url/protocol.js +25 -0
- package/dist/cjs/common/util/console.js +17 -0
- package/dist/cjs/common/util/data-size.js +25 -0
- package/dist/cjs/common/util/feature-flags.js +42 -0
- package/dist/cjs/common/util/get-or-set.js +39 -0
- package/dist/cjs/common/util/global-scope.js +56 -0
- package/dist/cjs/common/util/map-own.js +24 -0
- package/dist/cjs/common/util/obfuscate.js +76 -0
- package/dist/cjs/common/util/reduce.js +22 -0
- package/dist/cjs/common/util/s-hash.js +19 -0
- package/dist/cjs/common/util/single.js +23 -0
- package/dist/cjs/common/util/stringify.js +47 -0
- package/dist/cjs/common/util/submit-data.js +99 -0
- package/dist/cjs/common/util/traverse.js +41 -0
- package/dist/cjs/common/util/user-agent.js +57 -0
- package/dist/cjs/common/window/load.js +19 -0
- package/dist/cjs/common/window/nreum.js +107 -0
- package/dist/cjs/common/window/page-visibility.js +28 -0
- package/dist/cjs/common/window/session-storage.js +42 -0
- package/dist/cjs/common/window/supports-performance-observer.js +15 -0
- package/dist/cjs/common/window/top-level-callers.js +23 -0
- package/dist/cjs/common/wrap/index.js +68 -0
- package/dist/cjs/common/wrap/wrap-events.js +105 -0
- package/dist/cjs/common/wrap/wrap-fetch.js +114 -0
- package/dist/cjs/common/wrap/wrap-function.js +269 -0
- package/dist/cjs/common/wrap/wrap-history.js +56 -0
- package/dist/cjs/common/wrap/wrap-jsonp.js +129 -0
- package/dist/cjs/common/wrap/wrap-mutation.js +61 -0
- package/dist/cjs/common/wrap/wrap-promise.js +160 -0
- package/dist/cjs/common/wrap/wrap-raf.js +55 -0
- package/dist/cjs/common/wrap/wrap-timer.js +70 -0
- package/dist/cjs/common/wrap/wrap-xhr.js +206 -0
- package/dist/cjs/features/ajax/aggregate/index.js +226 -0
- package/dist/cjs/features/ajax/constants.js +9 -0
- package/dist/cjs/features/ajax/index.js +12 -0
- package/dist/cjs/features/ajax/instrument/distributed-tracing.js +145 -0
- package/dist/cjs/features/ajax/instrument/index.js +338 -0
- package/dist/cjs/features/ajax/instrument/response-size.js +26 -0
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.js +18 -0
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.test.js +30 -0
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +216 -0
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +257 -0
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.js +36 -0
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.test.js +39 -0
- package/dist/cjs/features/jserrors/aggregate/index.js +267 -0
- package/dist/cjs/features/jserrors/aggregate/string-hash-code.js +23 -0
- package/dist/cjs/features/jserrors/aggregate/string-hash-code.test.js +26 -0
- package/dist/cjs/features/jserrors/constants.js +11 -0
- package/dist/cjs/features/jserrors/index.js +12 -0
- package/dist/cjs/features/jserrors/instrument/debug.js +40 -0
- package/dist/cjs/features/jserrors/instrument/index.js +158 -0
- package/dist/cjs/features/metrics/aggregate/index.js +136 -0
- package/dist/cjs/features/metrics/constants.js +17 -0
- package/dist/cjs/features/metrics/index.js +12 -0
- package/dist/cjs/features/metrics/instrument/index.js +20 -0
- package/dist/cjs/features/metrics/instrument/workers-helper.js +121 -0
- package/dist/cjs/features/page_action/aggregate/index.js +112 -0
- package/dist/cjs/features/page_action/constants.js +9 -0
- package/dist/cjs/features/page_action/index.js +12 -0
- package/dist/cjs/features/page_action/instrument/index.js +21 -0
- package/dist/cjs/features/page_view_event/aggregate/index.js +133 -0
- package/dist/cjs/features/page_view_event/aggregate/initialized-features.js +39 -0
- package/dist/cjs/features/page_view_event/constants.js +15 -0
- package/dist/cjs/features/page_view_event/index.js +12 -0
- package/dist/cjs/features/page_view_event/instrument/index.js +38 -0
- package/dist/cjs/features/page_view_timing/aggregate/index.js +265 -0
- package/dist/cjs/features/page_view_timing/constants.js +9 -0
- package/dist/cjs/features/page_view_timing/first-paint.js +50 -0
- package/dist/cjs/features/page_view_timing/index.js +12 -0
- package/dist/cjs/features/page_view_timing/instrument/index.js +36 -0
- package/dist/cjs/features/page_view_timing/long-tasks.js +75 -0
- package/dist/cjs/features/session_trace/aggregate/index.js +375 -0
- package/dist/cjs/features/session_trace/constants.js +32 -0
- package/dist/cjs/features/session_trace/index.js +12 -0
- package/dist/cjs/features/session_trace/instrument/index.js +133 -0
- package/dist/cjs/features/spa/aggregate/index.js +684 -0
- package/dist/cjs/features/spa/aggregate/interaction-node.js +84 -0
- package/dist/cjs/features/spa/aggregate/interaction-node.test.js +16 -0
- package/dist/cjs/features/spa/aggregate/interaction.js +98 -0
- package/dist/cjs/features/spa/aggregate/serializer.js +147 -0
- package/dist/cjs/features/spa/constants.js +53 -0
- package/dist/cjs/features/spa/index.js +12 -0
- package/dist/cjs/features/spa/instrument/index.js +114 -0
- package/dist/cjs/features/utils/aggregate-base.js +13 -0
- package/dist/cjs/features/utils/feature-base.js +58 -0
- package/dist/cjs/features/utils/handler-cache.js +64 -0
- package/dist/cjs/features/utils/instrument-base.js +71 -0
- package/dist/cjs/features/utils/lazy-loader.js +44 -0
- package/dist/cjs/index.js +81 -58
- package/dist/cjs/loaders/agent.js +86 -0
- package/dist/cjs/loaders/api/api.js +109 -0
- package/dist/cjs/loaders/api/apiAsync.js +94 -0
- package/dist/cjs/loaders/browser-agent.js +29 -0
- package/dist/cjs/loaders/configure/configure.js +47 -0
- package/dist/cjs/loaders/features/enabled-features.js +19 -0
- package/dist/cjs/loaders/features/featureDependencies.js +32 -0
- package/dist/cjs/loaders/features/features.js +33 -0
- package/dist/cjs/loaders/micro-agent.js +93 -0
- package/dist/cjs/loaders/worker-agent.js +24 -0
- package/dist/esm/cdn/lite.js +12 -0
- package/dist/esm/cdn/polyfills/lite.js +7 -0
- package/dist/esm/cdn/polyfills/pro.js +7 -0
- package/dist/esm/cdn/polyfills/spa.js +7 -0
- package/dist/esm/cdn/polyfills.js +17 -0
- package/dist/esm/cdn/pro.js +17 -0
- package/dist/esm/cdn/spa.js +17 -0
- package/dist/esm/cdn/worker.js +14 -0
- package/dist/esm/common/aggregate/aggregator.js +161 -0
- package/dist/esm/common/browser-version/firefox-version.js +10 -0
- package/dist/esm/common/browser-version/ios-version.js +10 -0
- package/dist/esm/common/config/config.js +11 -0
- package/dist/esm/common/config/state/configurable.js +25 -0
- package/dist/esm/common/config/state/info.js +42 -0
- package/dist/esm/common/config/state/init.js +78 -0
- package/dist/esm/common/config/state/loader-config.js +21 -0
- package/dist/esm/common/config/state/originals.js +2 -0
- package/dist/esm/common/config/state/runtime.js +41 -0
- package/dist/esm/common/constants/environment-variables.js +11 -0
- package/dist/esm/common/context/shared-context.js +18 -0
- package/dist/esm/common/deny-list/deny-list.js +101 -0
- package/dist/esm/common/drain/drain.js +119 -0
- package/dist/esm/common/event-emitter/contextual-ee.js +142 -0
- package/dist/esm/common/event-emitter/handle.js +16 -0
- package/dist/esm/common/event-emitter/register-handler.js +19 -0
- package/dist/esm/common/event-listener/event-listener-opts.js +39 -0
- package/dist/esm/common/harvest/harvest-scheduler.js +105 -0
- package/dist/esm/common/harvest/harvest.js +228 -0
- package/dist/esm/common/ids/id.js +23 -0
- package/dist/esm/common/ids/unique-id.js +75 -0
- package/dist/esm/common/metrics/framework-detection.js +66 -0
- package/dist/esm/common/metrics/paint-metrics.js +6 -0
- package/dist/esm/common/serialize/bel-serializer.js +80 -0
- package/dist/esm/common/timing/nav-timing.js +67 -0
- package/dist/esm/common/timing/now.js +9 -0
- package/dist/esm/common/unload/eol.js +62 -0
- package/dist/esm/common/url/clean-url.js +10 -0
- package/dist/esm/common/url/encode.js +71 -0
- package/dist/esm/common/url/location.js +8 -0
- package/dist/esm/common/url/parse-url.js +60 -0
- package/dist/esm/common/url/protocol.js +17 -0
- package/dist/esm/common/util/console.js +11 -0
- package/dist/esm/common/util/data-size.js +19 -0
- package/dist/esm/common/util/feature-flags.js +33 -0
- package/dist/esm/common/util/get-or-set.js +33 -0
- package/dist/esm/common/util/global-scope.js +44 -0
- package/dist/esm/common/util/map-own.js +18 -0
- package/dist/esm/common/util/obfuscate.js +67 -0
- package/dist/esm/common/util/reduce.js +16 -0
- package/dist/esm/common/util/s-hash.js +13 -0
- package/dist/esm/common/util/single.js +16 -0
- package/dist/esm/common/util/stringify.js +42 -0
- package/dist/esm/common/util/submit-data.js +91 -0
- package/dist/esm/common/util/traverse.js +35 -0
- package/dist/esm/common/util/user-agent.js +48 -0
- package/dist/esm/common/window/load.js +12 -0
- package/dist/esm/common/window/nreum.js +91 -0
- package/dist/esm/common/window/page-visibility.js +23 -0
- package/dist/esm/common/window/session-storage.js +36 -0
- package/dist/esm/common/window/supports-performance-observer.js +9 -0
- package/dist/esm/common/window/top-level-callers.js +17 -0
- package/dist/esm/common/wrap/index.js +14 -0
- package/dist/esm/common/wrap/wrap-events.js +97 -0
- package/dist/esm/common/wrap/wrap-fetch.js +105 -0
- package/dist/esm/common/wrap/wrap-function.js +257 -0
- package/dist/esm/common/wrap/wrap-history.js +48 -0
- package/dist/esm/common/wrap/wrap-jsonp.js +122 -0
- package/dist/esm/common/wrap/wrap-mutation.js +54 -0
- package/dist/esm/common/wrap/wrap-promise.js +153 -0
- package/dist/esm/common/wrap/wrap-raf.js +48 -0
- package/dist/esm/common/wrap/wrap-timer.js +63 -0
- package/dist/esm/common/wrap/wrap-xhr.js +199 -0
- package/dist/esm/features/ajax/aggregate/index.js +218 -0
- package/dist/esm/features/ajax/constants.js +2 -0
- package/dist/esm/features/ajax/index.js +1 -0
- package/dist/esm/features/ajax/instrument/distributed-tracing.js +137 -0
- package/dist/esm/features/ajax/instrument/index.js +330 -0
- package/dist/esm/features/ajax/instrument/response-size.js +19 -0
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.js +12 -0
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.test.js +28 -0
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +209 -0
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +255 -0
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.js +29 -0
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.test.js +37 -0
- package/dist/esm/features/jserrors/aggregate/index.js +260 -0
- package/dist/esm/features/jserrors/aggregate/string-hash-code.js +17 -0
- package/dist/esm/features/jserrors/aggregate/string-hash-code.test.js +24 -0
- package/dist/esm/features/jserrors/constants.js +3 -0
- package/dist/esm/features/jserrors/index.js +1 -0
- package/dist/esm/features/jserrors/instrument/debug.js +38 -0
- package/dist/esm/features/jserrors/instrument/index.js +150 -0
- package/dist/esm/features/metrics/aggregate/index.js +129 -0
- package/dist/esm/features/metrics/constants.js +6 -0
- package/dist/esm/features/metrics/index.js +1 -0
- package/dist/esm/features/metrics/instrument/index.js +13 -0
- package/dist/esm/features/metrics/instrument/workers-helper.js +116 -0
- package/dist/esm/features/page_action/aggregate/index.js +105 -0
- package/dist/esm/features/page_action/constants.js +2 -0
- package/dist/esm/features/page_action/index.js +1 -0
- package/dist/esm/features/page_action/instrument/index.js +14 -0
- package/dist/esm/features/page_view_event/aggregate/index.js +124 -0
- package/dist/esm/features/page_view_event/aggregate/initialized-features.js +34 -0
- package/dist/esm/features/page_view_event/constants.js +5 -0
- package/dist/esm/features/page_view_event/index.js +1 -0
- package/dist/esm/features/page_view_event/instrument/index.js +29 -0
- package/dist/esm/features/page_view_timing/aggregate/index.js +258 -0
- package/dist/esm/features/page_view_timing/constants.js +2 -0
- package/dist/esm/features/page_view_timing/first-paint.js +43 -0
- package/dist/esm/features/page_view_timing/index.js +1 -0
- package/dist/esm/features/page_view_timing/instrument/index.js +28 -0
- package/dist/esm/features/page_view_timing/long-tasks.js +69 -0
- package/dist/esm/features/session_trace/aggregate/index.js +366 -0
- package/dist/esm/features/session_trace/constants.js +14 -0
- package/dist/esm/features/session_trace/index.js +1 -0
- package/dist/esm/features/session_trace/instrument/index.js +123 -0
- package/dist/esm/features/spa/aggregate/index.js +674 -0
- package/dist/esm/features/spa/aggregate/interaction-node.js +78 -0
- package/dist/esm/features/spa/aggregate/interaction-node.test.js +14 -0
- package/dist/esm/features/spa/aggregate/interaction.js +92 -0
- package/dist/esm/features/spa/aggregate/serializer.js +139 -0
- package/dist/esm/features/spa/constants.js +25 -0
- package/dist/esm/features/spa/index.js +1 -0
- package/dist/esm/features/spa/instrument/index.js +104 -0
- package/dist/esm/features/utils/aggregate-base.js +6 -0
- package/dist/esm/features/utils/feature-base.js +51 -0
- package/dist/esm/features/utils/handler-cache.js +57 -0
- package/dist/esm/features/utils/instrument-base.js +69 -0
- package/dist/esm/features/utils/lazy-loader.js +37 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/loaders/agent.js +77 -0
- package/dist/esm/loaders/api/api.js +104 -0
- package/dist/esm/loaders/api/apiAsync.js +88 -0
- package/dist/esm/loaders/browser-agent.js +23 -0
- package/dist/esm/loaders/configure/configure.js +41 -0
- package/dist/esm/loaders/features/enabled-features.js +13 -0
- package/dist/esm/loaders/features/featureDependencies.js +25 -0
- package/dist/esm/loaders/features/features.js +25 -0
- package/dist/esm/loaders/micro-agent.js +86 -0
- package/dist/esm/loaders/worker-agent.js +18 -0
- package/package.json +204 -71
- package/types.ts +221 -0
- package/dist/bundled/es5/index.js +0 -2
- package/dist/bundled/es5/index.js.map +0 -1
- package/dist/bundled/es6/index.js +0 -2
- package/dist/bundled/es6/index.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -19
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/types.d.ts +0 -94
- package/dist/cjs/types.js +0 -28
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/utils/api/api.d.ts +0 -10
- package/dist/cjs/utils/api/api.js +0 -40
- package/dist/cjs/utils/api/api.js.map +0 -1
- package/dist/cjs/utils/config/build-configs.d.ts +0 -6
- package/dist/cjs/utils/config/build-configs.js +0 -68
- package/dist/cjs/utils/config/build-configs.js.map +0 -1
- package/dist/cjs/utils/features/features.d.ts +0 -5
- package/dist/cjs/utils/features/features.js +0 -14
- package/dist/cjs/utils/features/features.js.map +0 -1
- package/dist/cjs/utils/features/initialize.d.ts +0 -5
- package/dist/cjs/utils/features/initialize.js +0 -51
- package/dist/cjs/utils/features/initialize.js.map +0 -1
- package/dist/es/index.d.ts +0 -19
- package/dist/es/index.js +0 -55
- package/dist/es/index.js.map +0 -1
- package/dist/es/types.d.ts +0 -94
- package/dist/es/types.js +0 -24
- package/dist/es/types.js.map +0 -1
- package/dist/es/utils/api/api.d.ts +0 -10
- package/dist/es/utils/api/api.js +0 -36
- package/dist/es/utils/api/api.js.map +0 -1
- package/dist/es/utils/config/build-configs.d.ts +0 -6
- package/dist/es/utils/config/build-configs.js +0 -64
- package/dist/es/utils/config/build-configs.js.map +0 -1
- package/dist/es/utils/features/features.d.ts +0 -5
- package/dist/es/utils/features/features.js +0 -10
- package/dist/es/utils/features/features.js.map +0 -1
- package/dist/es/utils/features/initialize.d.ts +0 -5
- package/dist/es/utils/features/initialize.js +0 -24
- package/dist/es/utils/features/initialize.js.map +0 -1
- package/dist/umd/index.d.ts +0 -19
- package/dist/umd/index.js +0 -69
- package/dist/umd/index.js.map +0 -1
- package/dist/umd/types.d.ts +0 -94
- package/dist/umd/types.js +0 -38
- package/dist/umd/types.js.map +0 -1
- package/dist/umd/utils/api/api.d.ts +0 -10
- package/dist/umd/utils/api/api.js +0 -50
- package/dist/umd/utils/api/api.js.map +0 -1
- package/dist/umd/utils/config/build-configs.d.ts +0 -6
- package/dist/umd/utils/config/build-configs.js +0 -78
- package/dist/umd/utils/config/build-configs.js.map +0 -1
- package/dist/umd/utils/features/features.d.ts +0 -5
- package/dist/umd/utils/features/features.js +0 -24
- package/dist/umd/utils/features/features.js.map +0 -1
- package/dist/umd/utils/features/initialize.d.ts +0 -5
- package/dist/umd/utils/features/initialize.js +0 -63
- package/dist/umd/utils/features/initialize.js.map +0 -1
- package/dist/webpack-analysis.html +0 -38
package/package.json
CHANGED
|
@@ -1,85 +1,218 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newrelic/browser-agent",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.1.229",
|
|
4
|
+
"private": false,
|
|
5
|
+
"author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
|
|
6
|
+
"description": "Tests for the New Relic JavaScript agent",
|
|
5
7
|
"license": "Apache-2.0",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"email": "jporter@newrelic.com",
|
|
10
|
-
"web": "http://newrelic.com"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"name": "Aubrey Masten",
|
|
14
|
-
"email": "amasten@newrelic.com",
|
|
15
|
-
"web": "http://newrelic.com"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"homepage": "https://github.com/newrelic/newrelic-browser-agent",
|
|
19
|
-
"repository": "github:newrelic/newrelic-browser-agent",
|
|
20
|
-
"main": "dist/umd/index.js",
|
|
21
|
-
"module": "dist/es/index.js",
|
|
22
|
-
"types": "dist/es/index.d.ts",
|
|
8
|
+
"homepage": "https://docs.newrelic.com/docs/browser/browser-monitoring",
|
|
9
|
+
"main": "./dist/cjs/index.js",
|
|
10
|
+
"types": "./types.ts",
|
|
23
11
|
"exports": {
|
|
24
|
-
"./bundled": "./dist/bundled/es6/index.js",
|
|
25
|
-
"./cjs": "./dist/cjs/index.js",
|
|
26
|
-
"./es": "./dist/es/index.js",
|
|
27
|
-
"./umd": "./dist/umd/index.js",
|
|
28
12
|
".": {
|
|
29
|
-
"import": "./dist/
|
|
30
|
-
"require": "./dist/cjs/index.js"
|
|
31
|
-
|
|
13
|
+
"import": "./dist/esm/index.js",
|
|
14
|
+
"require": "./dist/cjs/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./loaders/agent": {
|
|
17
|
+
"import": "./dist/esm/loaders/agent.js",
|
|
18
|
+
"require": "./dist/cjs/loaders/agent.js"
|
|
19
|
+
},
|
|
20
|
+
"./loaders/browser-agent": {
|
|
21
|
+
"import": "./dist/esm/loaders/browser-agent.js",
|
|
22
|
+
"require": "./dist/cjs/loaders/browser-agent.js"
|
|
23
|
+
},
|
|
24
|
+
"./loaders/worker-agent": {
|
|
25
|
+
"import": "./dist/esm/loaders/worker-agent.js",
|
|
26
|
+
"require": "./dist/cjs/loaders/worker-agent.js"
|
|
27
|
+
},
|
|
28
|
+
"./features/ajax": {
|
|
29
|
+
"import": "./dist/esm/features/ajax/index.js",
|
|
30
|
+
"require": "./dist/cjs/features/ajax/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./features/jserrors": {
|
|
33
|
+
"import": "./dist/esm/features/jserrors/index.js",
|
|
34
|
+
"require": "./dist/cjs/features/jserrors/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./features/metrics": {
|
|
37
|
+
"import": "./dist/esm/features/metrics/index.js",
|
|
38
|
+
"require": "./dist/cjs/features/metrics/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./features/page_action": {
|
|
41
|
+
"import": "./dist/esm/features/page_action/index.js",
|
|
42
|
+
"require": "./dist/cjs/features/page_action/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./features/page_view_event": {
|
|
45
|
+
"import": "./dist/esm/features/page_view_event/index.js",
|
|
46
|
+
"require": "./dist/cjs/features/page_view_event/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./features/page_view_timing": {
|
|
49
|
+
"import": "./dist/esm/features/page_view_timing/index.js",
|
|
50
|
+
"require": "./dist/cjs/features/page_view_timing/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./features/session_trace": {
|
|
53
|
+
"import": "./dist/esm/features/session_trace/index.js",
|
|
54
|
+
"require": "./dist/cjs/features/session_trace/index.js"
|
|
55
|
+
},
|
|
56
|
+
"./features/spa": {
|
|
57
|
+
"import": "./dist/esm/features/spa/index.js",
|
|
58
|
+
"require": "./dist/cjs/features/spa/index.js"
|
|
32
59
|
}
|
|
33
60
|
},
|
|
34
|
-
"
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=12.17.0 < 13.0.0 || >=13.7.0"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"wdio": "node tools/wdio/bin/cli.js",
|
|
66
|
+
"start": "npm-run-all --parallel cdn:watch test-server",
|
|
67
|
+
"unit": "jest",
|
|
68
|
+
"format": "prettier -w .",
|
|
69
|
+
"format:check": "prettier --check .",
|
|
70
|
+
"test": "node tools/jil/bin/cli.js",
|
|
71
|
+
"build:all": "npm run cdn:build:local && npm run build:npm && npm run tools:test-builds",
|
|
72
|
+
"build:npm": "npm run npm:build:esm && npm run npm:build:cjs && npm run npm:pack",
|
|
73
|
+
"lint": "eslint -c .eslintrc.js --ext .js,.cjs,.mjs . --fix",
|
|
74
|
+
"lint:fix": "eslint --ext .js -c .eslintrc . --fix",
|
|
75
|
+
"test-all": "tools/jil/bin/cli.js -b *@*",
|
|
76
|
+
"ci-build": "npm ci --cache ./.npm",
|
|
77
|
+
"build-tar": "npm run ci-build && tar czf ./build/browser-agent.tar.gz --exclude=.git --exclude=.npm --exclude=build/browser-agent.tar.gz .",
|
|
78
|
+
"watch": "jung -D '\\.npm|.git|node_modules|build|tools|tests' --run -- npm run build:all",
|
|
79
|
+
"cdn:build": "npm run cdn:build:prod",
|
|
80
|
+
"cdn:build:extension": "PUBLISH=EXTENSION rm -rf ./build && npm run cdn:webpack && npm run cdn:cleanup",
|
|
81
|
+
"cdn:build:local": "npm run cdn:webpack && npm run cdn:cleanup",
|
|
82
|
+
"cdn:build:prod": "npm run cdn:fresh-build && PUBLISH=PROD npm run cdn:webpack && npm run cdn:cleanup",
|
|
83
|
+
"cdn:build:dev": "npm run cdn:fresh-build && PUBLISH=DEV npm run cdn:webpack && npm run cdn:cleanup",
|
|
84
|
+
"cdn:build:current": "npm run cdn:fresh-build && PUBLISH=CURRENT npm run cdn:webpack && npm run cdn:cleanup",
|
|
85
|
+
"cdn:build:nr": "npm run cdn:fresh-build && PUBLISH=PROD SOURCEMAPS=false npm run cdn:webpack && npm run cdn:cleanup",
|
|
86
|
+
"cdn:build:pr": "npm run cdn:fresh-build && PUBLISH=PR npm run cdn:webpack && npm run cdn:cleanup",
|
|
87
|
+
"cdn:cleanup": "node ./tools/scripts/post-build-cleanup",
|
|
88
|
+
"cdn:fresh-build": "rm -rf ./build",
|
|
89
|
+
"cdn:watch": "jung -r ./src -F '.*\\.test\\.js' --run -- npm run cdn:build:local",
|
|
90
|
+
"cdn:watch:extension": "jung -r ./src -F '.*\\.test\\.js' --run -- npm run cdn:build:extension",
|
|
91
|
+
"cdn:webpack": "npx webpack --progress --config ./webpack.config.js",
|
|
92
|
+
"packages:bundle": "webpack -c tools/jil/webpack.modular.js",
|
|
93
|
+
"test-server": "node ./tools/jil/bin/server",
|
|
94
|
+
"sauce:connect": "node ./tools/wdio/bin/sauce",
|
|
95
|
+
"sauce:get-browsers": "node ./tools/jil/util/sauce-browsers && node ./tools/wdio/util/sauce-browsers",
|
|
96
|
+
"tools:test-builds": "npm --prefix ./tools/test-builds run build-all",
|
|
97
|
+
"third-party-updates": "oss third-party manifest --includeOptDeps && oss third-party notices --includeOptDeps",
|
|
98
|
+
"prepare": "husky install",
|
|
99
|
+
"npm:build:esm": "npx babel --config-file ./babel.npm.esm.js --out-dir dist/esm --out-file-extension .js ./src",
|
|
100
|
+
"npm:build:cjs": "npx babel --config-file ./babel.npm.cjs.js --out-dir dist/cjs --out-file-extension .js ./src",
|
|
101
|
+
"npm:pack": "mkdir -p temp && export PKG_NAME=$(npm pack --pack-destination temp) && echo ./temp/$PKG_NAME",
|
|
102
|
+
"sync:version": "node tools/scripts/sync-version.js"
|
|
103
|
+
},
|
|
104
|
+
"config": {
|
|
105
|
+
"unsafe-perm": true
|
|
106
|
+
},
|
|
107
|
+
"repository": {
|
|
108
|
+
"type": "git",
|
|
109
|
+
"url": "https://github.com/newrelic/newrelic-browser-agent.git"
|
|
110
|
+
},
|
|
35
111
|
"dependencies": {
|
|
36
|
-
"
|
|
112
|
+
"core-js": "^3.26.0",
|
|
113
|
+
"lodash._slice": "^2.4.1",
|
|
114
|
+
"web-vitals": "^3.1.0"
|
|
37
115
|
},
|
|
38
116
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@babel/
|
|
41
|
-
"@
|
|
42
|
-
"babel-
|
|
117
|
+
"@actions/core": "^1.10.0",
|
|
118
|
+
"@babel/cli": "^7.20.7",
|
|
119
|
+
"@babel/core": "^7.20.12",
|
|
120
|
+
"@babel/eslint-parser": "^7.19.1",
|
|
121
|
+
"@babel/plugin-proposal-optional-chaining": "^7.20.7",
|
|
122
|
+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
123
|
+
"@babel/plugin-syntax-import-assertions": "^7.20.0",
|
|
124
|
+
"@babel/plugin-transform-modules-commonjs": "^7.18.2",
|
|
125
|
+
"@babel/plugin-transform-strict-mode": "^7.18.6",
|
|
126
|
+
"@babel/preset-env": "^7.20.2",
|
|
127
|
+
"@faker-js/faker": "^7.6.0",
|
|
128
|
+
"@fastify/cors": "^8.2.0",
|
|
129
|
+
"@fastify/multipart": "^7.3.0",
|
|
130
|
+
"@fastify/static": "^6.6.0",
|
|
131
|
+
"@newrelic/newrelic-oss-cli": "^0.1.2",
|
|
132
|
+
"@newrelic/nr-querypack": "https://git@github.com/newrelic/nr-querypack",
|
|
133
|
+
"@octokit/rest": "^19.0.7",
|
|
134
|
+
"@wdio/cli": "^8.1.2",
|
|
135
|
+
"@wdio/local-runner": "^8.1.2",
|
|
136
|
+
"@wdio/mocha-framework": "^8.1.2",
|
|
137
|
+
"@wdio/sauce-service": "^8.1.2",
|
|
138
|
+
"@wdio/selenium-standalone-service": "^8.1.2",
|
|
139
|
+
"@wdio/spec-reporter": "^8.1.2",
|
|
140
|
+
"aws-sdk": "^2.894.0",
|
|
141
|
+
"babel-jest": "^29.4.1",
|
|
43
142
|
"babel-loader": "^8.2.5",
|
|
44
|
-
"babel-plugin-
|
|
45
|
-
"babel-
|
|
46
|
-
"babel-
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"webpack": "^
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
143
|
+
"babel-plugin-module-resolver": "^4.1.0",
|
|
144
|
+
"babel-plugin-search-and-replace": "^1.1.1",
|
|
145
|
+
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
|
|
146
|
+
"babelify": "^10.0.0",
|
|
147
|
+
"browserify": "^13.3.0",
|
|
148
|
+
"bundle-collapser": "^1.2.1",
|
|
149
|
+
"chalk": "^5.1.2",
|
|
150
|
+
"charm": "^1.0.1",
|
|
151
|
+
"concat-stream": "^1.5.1",
|
|
152
|
+
"cors": "^2.7.1",
|
|
153
|
+
"create-polyfill-service-url": "^2.2.6",
|
|
154
|
+
"deepmerge-ts": "^4.2.2",
|
|
155
|
+
"defined": "^1.0.0",
|
|
156
|
+
"dotenv-webpack": "^8.0.1",
|
|
157
|
+
"eslint": "^8.34.0",
|
|
158
|
+
"eslint-config-standard": "^17.0.0",
|
|
159
|
+
"eslint-import-resolver-alias": "^1.1.2",
|
|
160
|
+
"eslint-import-resolver-webpack": "^0.13.2",
|
|
161
|
+
"eslint-plugin-import": "^2.27.5",
|
|
162
|
+
"eslint-plugin-n": "^15.6.1",
|
|
163
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
164
|
+
"fastify": "^4.13.0",
|
|
165
|
+
"fastify-plugin": "^4.4.0",
|
|
166
|
+
"filesize": "^10.0.6",
|
|
167
|
+
"fs-extra": "^11.1.0",
|
|
168
|
+
"function-bind": "^1.1.1",
|
|
169
|
+
"glob": "^7.0.5",
|
|
170
|
+
"husky": "^8.0.0",
|
|
171
|
+
"html-webpack-plugin": "^5.5.0",
|
|
172
|
+
"jest": "^28.1.1",
|
|
173
|
+
"jest-environment-jsdom": "28.1.1",
|
|
174
|
+
"jquery": "1.11.3",
|
|
175
|
+
"jsonc-eslint-parser": "^2.1.0",
|
|
176
|
+
"jung": "^2.1.0",
|
|
177
|
+
"just-debounce": "^1.0.0",
|
|
178
|
+
"ls-stream": "^1.0.0",
|
|
179
|
+
"mime-types": "^2.1.11",
|
|
180
|
+
"minimatch": "^3.0.3",
|
|
181
|
+
"multiparty": "^4.1.2",
|
|
182
|
+
"newrelic": "^9.7.5",
|
|
183
|
+
"node-fetch": "^3.3.0",
|
|
184
|
+
"npm-run-all": "^4.1.5",
|
|
185
|
+
"object-inspect": "^1.5.0",
|
|
186
|
+
"octokit": "^2.0.14",
|
|
187
|
+
"preprocessify": "0.0.6",
|
|
188
|
+
"request": "2.74.0",
|
|
189
|
+
"sauce-connect-launcher": "^1.2.4",
|
|
190
|
+
"saucelabs": "^7.2.0",
|
|
191
|
+
"semver": "^5.3.0",
|
|
192
|
+
"serialize-anything": "^1.2.3",
|
|
193
|
+
"server-destroy": "^1.0.1",
|
|
194
|
+
"sinon": "^1.17.5",
|
|
195
|
+
"tap-parser": "^1.2.2",
|
|
196
|
+
"tape": "^4.8.0",
|
|
197
|
+
"through": "^2.3.8",
|
|
198
|
+
"through2": "^2.0.1",
|
|
199
|
+
"transpile-webpack-plugin": "^1.1.1",
|
|
200
|
+
"uglify-js": "^3.15.4",
|
|
201
|
+
"uuid": "^9.0.0",
|
|
202
|
+
"vinyl-buffer": "^1.0.1",
|
|
203
|
+
"vinyl-source-stream": "^2.0.0",
|
|
204
|
+
"wait-on": "^7.0.1",
|
|
205
|
+
"watchify": "^3.7.0",
|
|
206
|
+
"wd": "^1.11.2",
|
|
207
|
+
"webpack": "^5.74.0",
|
|
208
|
+
"webpack-bundle-analyzer": "^4.7.0",
|
|
209
|
+
"webpack-cli": "^4.10.0",
|
|
210
|
+
"yargs": "^17.6.2"
|
|
69
211
|
},
|
|
70
212
|
"files": [
|
|
71
|
-
"dist
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
"keywords": [
|
|
77
|
-
"new relic",
|
|
78
|
-
"browser",
|
|
79
|
-
"instrumentation",
|
|
80
|
-
"errors",
|
|
81
|
-
"micro front ends",
|
|
82
|
-
"browser agent"
|
|
83
|
-
],
|
|
84
|
-
"gitHead": "641472040562b78d2a334a8f41da97ccaf7c99ed"
|
|
213
|
+
"dist",
|
|
214
|
+
"LICENSE",
|
|
215
|
+
"README.md",
|
|
216
|
+
"types.ts"
|
|
217
|
+
]
|
|
85
218
|
}
|
package/types.ts
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
export interface BrowserAgent {
|
|
2
|
+
config: NrOptions;
|
|
3
|
+
start: (options: NrOptions) => Promise<boolean>;
|
|
4
|
+
sharedAggregator: any;
|
|
5
|
+
features: any[]
|
|
6
|
+
agentIdentifier: String;
|
|
7
|
+
setErrorHandler: (filterCallback: ErrorHandler) => void;
|
|
8
|
+
finished: (timestamp?: number) => void;
|
|
9
|
+
inlineHit: () => void;
|
|
10
|
+
addRelease: (releaseName: string, releaseId: string) => void;
|
|
11
|
+
addPageAction: (name: string, attributes?: Record<string, SimpleType>) => void;
|
|
12
|
+
addToTrace: (eventObject: EventObject) => void;
|
|
13
|
+
setCurrentRouteName: (name: string | null) => void;
|
|
14
|
+
setPageViewName: (name: string, host?: string) => void;
|
|
15
|
+
setCustomAttribute: (name: string, value: SimpleType) => void;
|
|
16
|
+
interaction: () => BrowserInteraction;
|
|
17
|
+
noticeError: (error: Error | string, customAttributes?: Record<string, SimpleType>) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface NrOptions {
|
|
21
|
+
info: NrInfo,
|
|
22
|
+
init: NrInit,
|
|
23
|
+
loader_config: NrLoaderConfig,
|
|
24
|
+
runtime: NrRuntime,
|
|
25
|
+
exposed: boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface NrShared {
|
|
29
|
+
applicationID?: string;
|
|
30
|
+
licenseKey?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface NrRuntime {
|
|
34
|
+
customTransaction?: any,
|
|
35
|
+
disabled?: boolean,
|
|
36
|
+
features?: {},
|
|
37
|
+
maxBytes?: boolean,
|
|
38
|
+
offset?: number,
|
|
39
|
+
onerror?: () => boolean,
|
|
40
|
+
origin?: string,
|
|
41
|
+
ptid?: string,
|
|
42
|
+
releaseIds?: {},
|
|
43
|
+
sessionId?: string,
|
|
44
|
+
xhrWrappable?: boolean,
|
|
45
|
+
userAgent?: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface NrInfo extends NrShared {
|
|
49
|
+
applicationID: string;
|
|
50
|
+
licenseKey: string;
|
|
51
|
+
beacon: string // sets beacon and errorBeacon
|
|
52
|
+
errorBeacon?: string
|
|
53
|
+
sa?: number
|
|
54
|
+
queueTime?: number;
|
|
55
|
+
applicationTime?: number;
|
|
56
|
+
ttGuid?: string;
|
|
57
|
+
user?: string;
|
|
58
|
+
account?: string;
|
|
59
|
+
product?: string;
|
|
60
|
+
extra?: string;
|
|
61
|
+
userAttributes?: string;
|
|
62
|
+
atts?: string;
|
|
63
|
+
transactionName?: string;
|
|
64
|
+
tNamePlain?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface NrInit {
|
|
68
|
+
privacy?: { cookies_enabled?: boolean }, // *cli - per discussion, default should be boolean
|
|
69
|
+
ajax?: { deny_list?: string, enabled?: boolean, auto?: boolean, harvestTimeSeconds?: number },
|
|
70
|
+
distributed_tracing?: {
|
|
71
|
+
enabled?: boolean
|
|
72
|
+
exclude_newrelic_header?: boolean
|
|
73
|
+
cors_use_newrelic_header?: boolean
|
|
74
|
+
cors_use_tracecontext_headers?: boolean
|
|
75
|
+
allowed_origins?: string[]
|
|
76
|
+
}
|
|
77
|
+
ssl?: boolean,
|
|
78
|
+
obfuscate?: { regex?: string | RegExp, replacement?: string }[],
|
|
79
|
+
jserrors?: { enabled?: boolean, auto?: boolean, harvestTimeSeconds?: number },
|
|
80
|
+
metrics?: { enabled?: boolean, auto?: boolean },
|
|
81
|
+
page_action?: { enabled?: boolean, auto?: false, harvestTimeSeconds?: number },
|
|
82
|
+
page_view_event?: { enabled?: boolean, auto?: boolean },
|
|
83
|
+
page_view_timing?: { enabled?: boolean, auto?: boolean, harvestTimeSeconds?: number },
|
|
84
|
+
session_trace?: { enabled?: boolean, auto?: boolean, harvestTimeSeconds?: number },
|
|
85
|
+
spa?: { enabled?: boolean, auto?: boolean, harvestTimeSeconds?: number }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface NrLoaderConfig extends NrShared {
|
|
89
|
+
accountID?: string
|
|
90
|
+
trustKey?: string
|
|
91
|
+
agentID?: string
|
|
92
|
+
xpid?: string
|
|
93
|
+
licenseKey: string,
|
|
94
|
+
applicationID: string,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type NrNoticeError = (err: Error | String, customAttributes: Object) => void;
|
|
98
|
+
|
|
99
|
+
interface EventObject {
|
|
100
|
+
/** Event name */
|
|
101
|
+
name: string;
|
|
102
|
+
/** Start time in ms since epoch */
|
|
103
|
+
start: number;
|
|
104
|
+
/** End time in ms since epoch. Defaults to same as start resulting in trace object with a duration of zero. */
|
|
105
|
+
end?: number | undefined;
|
|
106
|
+
/** Origin of event */
|
|
107
|
+
origin?: string | undefined;
|
|
108
|
+
/** Event type */
|
|
109
|
+
type?: string | undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface BrowserInteraction {
|
|
113
|
+
/**
|
|
114
|
+
* Sets the text value of the HTML element that was clicked to start a browser interaction.
|
|
115
|
+
*
|
|
116
|
+
* @param value The text value of the HTML element that represents the action that started the interaction.
|
|
117
|
+
* @returns This method returns the same API object created by interaction().
|
|
118
|
+
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/actiontext-browser-spa-api
|
|
119
|
+
*/
|
|
120
|
+
actionText(value: string): this;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Times sub-components of a SPA interaction separately, including wait time and JS execution time.
|
|
124
|
+
*
|
|
125
|
+
* @param name This will be used as the name of the tracer. If you do not include a name,
|
|
126
|
+
* New Relic Browser does not add a node to the interaction tree. The callback time will be
|
|
127
|
+
* attributed to the parent node.
|
|
128
|
+
* @param callback A callback that contains the synchronous work to run at the end of the async work.
|
|
129
|
+
* To execute this callback, call the wrapper function returned using createTracer()
|
|
130
|
+
* @returns This method ends the async time. It calls (and times) the callback that was passed into createTracer().
|
|
131
|
+
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-create-tracer
|
|
132
|
+
*/
|
|
133
|
+
createTracer(name: string, callback?: Callback): Wrapper;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Ends the New Relic SPA interaction at the current time.
|
|
137
|
+
*
|
|
138
|
+
* @returns This method returns the same API object created by interaction().
|
|
139
|
+
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-end
|
|
140
|
+
*/
|
|
141
|
+
end(): this;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Stores values across the current SPA interaction asynchronously in New Relic Browser.
|
|
145
|
+
*
|
|
146
|
+
* @param callback A function that accepts the interaction context object
|
|
147
|
+
* as its only argument.
|
|
148
|
+
* @returns This method returns the same API object created by interaction().
|
|
149
|
+
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-get-context
|
|
150
|
+
*/
|
|
151
|
+
// tslint:disable-next-line:no-unnecessary-generics
|
|
152
|
+
getContext<T extends Record<string, any>>(callback: GetContextCallback<T>): this;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Overrides other SPA save() calls; ignores an interaction so it is not saved or sent to New Relic.
|
|
156
|
+
*
|
|
157
|
+
* @returns This method returns the same API object created by interaction().
|
|
158
|
+
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-ignore-browser
|
|
159
|
+
*/
|
|
160
|
+
ignore(): this;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Adds custom attributes for SPA interactions to the end of an event. It is called when the interaction
|
|
164
|
+
* has finished. You can invoke methods to modify the interaction, but methods that have asynchronous
|
|
165
|
+
* side effects will not have an effect.
|
|
166
|
+
*
|
|
167
|
+
* @returns This method returns the same API object created by interaction().
|
|
168
|
+
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-on-end
|
|
169
|
+
*/
|
|
170
|
+
// tslint:disable-next-line:no-unnecessary-generics
|
|
171
|
+
onEnd<T extends Record<string, any>>(callback: GetContextCallback<T>): this;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Ensures a SPA browser interaction will be saved when it ends.
|
|
175
|
+
*
|
|
176
|
+
* @returns This method returns the same API object created by interaction().
|
|
177
|
+
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-save
|
|
178
|
+
*/
|
|
179
|
+
save(): this;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Adds a custom SPA attribute only to the current interaction in New Relic Browser.
|
|
183
|
+
*
|
|
184
|
+
* @param key Used as the attribute name on the BrowserInteraction event.
|
|
185
|
+
* @param value Used as the attribute value on the BrowserInteraction event. This can be a
|
|
186
|
+
* string, number, boolean, or object. If it is an object, New Relic serializes it to a JSON string.
|
|
187
|
+
* @returns This method returns the same API object created by interaction().
|
|
188
|
+
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-set-attribute
|
|
189
|
+
*/
|
|
190
|
+
setAttribute(key: string, value: ComplexType): this;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Sets the name and trigger of a SPA's browser interaction that is not a route change or URL change.
|
|
194
|
+
*
|
|
195
|
+
* @param name If null, the name will be set using the targetGroupedUrl attribute.
|
|
196
|
+
* If not null, this will set the browserInteractionName attribute in the BrowserInteraction event.
|
|
197
|
+
* @param trigger If not null, this will set the TRIGGER attribute on the BrowserInteraction event.
|
|
198
|
+
* @returns This method returns the same API object created by interaction().
|
|
199
|
+
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-set-name
|
|
200
|
+
*/
|
|
201
|
+
setName(name: string, trigger?: string): this;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
interface Callback {
|
|
205
|
+
(): void;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
interface ErrorHandler {
|
|
209
|
+
(err: any): boolean;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
interface GetContextCallback<T extends Record<string, any>> {
|
|
213
|
+
(contextObject: T): void;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
interface Wrapper {
|
|
217
|
+
(): void;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
type SimpleType = string | number;
|
|
221
|
+
type ComplexType = string | number | boolean | unknown;
|