@honeycombio/opentelemetry-web
Advanced tools
| 'use strict'; | ||
| var api = require('@opentelemetry/api'); | ||
| var instrumentation = require('@opentelemetry/instrumentation'); | ||
| var sdkTraceWeb = require('@opentelemetry/sdk-trace-web'); | ||
| const VERSION = '1.0.3'; | ||
| const INSTRUMENTATION_NAME = '@honeycombio/user-instrumentation'; | ||
| const DEFAULT_EVENT_NAMES = ['click']; | ||
| class UserInteractionInstrumentation extends instrumentation.InstrumentationBase { | ||
| constructor(config = {}) { | ||
| var _a, _b; | ||
| super(INSTRUMENTATION_NAME, VERSION, config); | ||
| this._config = config; | ||
| this._isEnabled = (_a = this._config.enabled) !== null && _a !== void 0 ? _a : false; | ||
| // enable() gets called by our superclass constructor | ||
| // @ts-expect-error this may get set in enable() | ||
| this._listeners = (_b = this._listeners) !== null && _b !== void 0 ? _b : []; | ||
| } | ||
| init() {} | ||
| static handleEndSpan(ev) { | ||
| var _a; | ||
| (_a = UserInteractionInstrumentation._eventMap.get(ev)) === null || _a === void 0 ? void 0 : _a.end(); | ||
| } | ||
| static createGlobalEventListener(eventName, rootNodeId, isInstrumentationEnabled) { | ||
| return event => { | ||
| const element = event.target; | ||
| if (isInstrumentationEnabled() === false) return; | ||
| if (UserInteractionInstrumentation._eventMap.has(event)) return; | ||
| if (!shouldCreateSpan(event, element, eventName, rootNodeId)) return; | ||
| const xpath = sdkTraceWeb.getElementXPath(element); | ||
| const tracer = api.trace.getTracer(INSTRUMENTATION_NAME); | ||
| api.context.with(api.context.active(), () => { | ||
| tracer.startActiveSpan(eventName, { | ||
| attributes: { | ||
| event_type: eventName, | ||
| target_element: element.tagName, | ||
| target_xpath: xpath, | ||
| 'http.url': window.location.href | ||
| } | ||
| }, span => { | ||
| // if user space code calls stopPropagation, we'll never see it again | ||
| // so let's monkey patch those funcs to end the span if they do kill it | ||
| wrapEventPropagationCb(event, 'stopPropagation', span); | ||
| wrapEventPropagationCb(event, 'stopImmediatePropagation', span); | ||
| UserInteractionInstrumentation._eventMap.set(event, span); | ||
| }); | ||
| }); | ||
| }; | ||
| } | ||
| enable() { | ||
| var _a; | ||
| if (this._isEnabled) { | ||
| return; | ||
| } | ||
| const rootNode = this.getRootNode(); | ||
| // enable() gets called by our superclass constructor | ||
| // meaning our private fields aren't initialized yet!! | ||
| this._listeners = []; | ||
| // | ||
| const eventNames = (_a = this._config.eventNames) !== null && _a !== void 0 ? _a : DEFAULT_EVENT_NAMES; | ||
| eventNames.forEach(eventName => { | ||
| // we need a stable reference to this handler so that we can remove it later | ||
| const handler = UserInteractionInstrumentation.createGlobalEventListener(eventName, this._config.rootNodeId, () => this._isEnabled); | ||
| this._listeners.push({ | ||
| eventName, | ||
| handler | ||
| }); | ||
| // capture phase listener to kick in before any other listeners | ||
| rootNode.addEventListener(eventName, handler, { | ||
| capture: true | ||
| }); | ||
| // bubble phase listener gets called at the end, if user space doesn't call e.stopPropagation() | ||
| rootNode.addEventListener(eventName, UserInteractionInstrumentation.handleEndSpan); | ||
| }); | ||
| this._isEnabled = true; | ||
| } | ||
| getRootNode() { | ||
| if (this._config.rootNodeId) { | ||
| const rootNode = document.getElementById(this._config.rootNodeId); | ||
| if (rootNode === null) { | ||
| this._diag.warn(`Root Node id: ${this._config.rootNodeId} not found!`); | ||
| return document; | ||
| } | ||
| return rootNode; | ||
| } | ||
| return document; | ||
| } | ||
| disable() { | ||
| this._isEnabled = false; | ||
| this._listeners.forEach(({ | ||
| eventName, | ||
| handler | ||
| }) => { | ||
| document.removeEventListener(eventName, handler, { | ||
| capture: true | ||
| }); | ||
| document.removeEventListener(eventName, UserInteractionInstrumentation.handleEndSpan); | ||
| }); | ||
| this._listeners = []; | ||
| } | ||
| } | ||
| UserInteractionInstrumentation._eventMap = new WeakMap(); | ||
| const shouldCreateSpan = (event, element, eventName, rootNodeId) => { | ||
| if (!(element instanceof HTMLElement)) { | ||
| return false; | ||
| } | ||
| const handlerName = `on${eventName}`; | ||
| if (!elementHasEventHandler(element, handlerName, rootNodeId)) { | ||
| return false; | ||
| } | ||
| if (!element.getAttribute) { | ||
| return false; | ||
| } | ||
| if (element.hasAttribute('disabled')) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; | ||
| /** | ||
| * Detects if this event on this element is useful | ||
| * by checking if this element or any of its parents have handlers | ||
| * for this event. | ||
| * | ||
| * Accounts for the fact that frameworks like React will put dummy/noop | ||
| * handlers at their root, and ignores those. | ||
| */ | ||
| const elementHasEventHandler = (element, eventName, rootNodeId) => { | ||
| if (!element || !!rootNodeId && element.id === rootNodeId) { | ||
| return false; | ||
| } | ||
| if (element[eventName]) { | ||
| return true; | ||
| } | ||
| return elementHasEventHandler(element.parentElement, eventName, rootNodeId); | ||
| }; | ||
| const wrapEventPropagationCb = (event, key, span) => { | ||
| const oldCb = event[key].bind(event); | ||
| event[key] = () => { | ||
| span.end(); | ||
| oldCb(); | ||
| }; | ||
| }; | ||
| exports.UserInteractionInstrumentation = UserInteractionInstrumentation; | ||
| exports.VERSION = VERSION; |
| import { trace, context } from '@opentelemetry/api'; | ||
| import { InstrumentationBase } from '@opentelemetry/instrumentation'; | ||
| import { getElementXPath } from '@opentelemetry/sdk-trace-web'; | ||
| const VERSION = '1.0.3'; | ||
| const INSTRUMENTATION_NAME = '@honeycombio/user-instrumentation'; | ||
| const DEFAULT_EVENT_NAMES = ['click']; | ||
| class UserInteractionInstrumentation extends InstrumentationBase { | ||
| constructor(config = {}) { | ||
| var _a, _b; | ||
| super(INSTRUMENTATION_NAME, VERSION, config); | ||
| this._config = config; | ||
| this._isEnabled = (_a = this._config.enabled) !== null && _a !== void 0 ? _a : false; | ||
| // enable() gets called by our superclass constructor | ||
| // @ts-expect-error this may get set in enable() | ||
| this._listeners = (_b = this._listeners) !== null && _b !== void 0 ? _b : []; | ||
| } | ||
| init() {} | ||
| static handleEndSpan(ev) { | ||
| var _a; | ||
| (_a = UserInteractionInstrumentation._eventMap.get(ev)) === null || _a === void 0 ? void 0 : _a.end(); | ||
| } | ||
| static createGlobalEventListener(eventName, rootNodeId, isInstrumentationEnabled) { | ||
| return event => { | ||
| const element = event.target; | ||
| if (isInstrumentationEnabled() === false) return; | ||
| if (UserInteractionInstrumentation._eventMap.has(event)) return; | ||
| if (!shouldCreateSpan(event, element, eventName, rootNodeId)) return; | ||
| const xpath = getElementXPath(element); | ||
| const tracer = trace.getTracer(INSTRUMENTATION_NAME); | ||
| context.with(context.active(), () => { | ||
| tracer.startActiveSpan(eventName, { | ||
| attributes: { | ||
| event_type: eventName, | ||
| target_element: element.tagName, | ||
| target_xpath: xpath, | ||
| 'http.url': window.location.href | ||
| } | ||
| }, span => { | ||
| // if user space code calls stopPropagation, we'll never see it again | ||
| // so let's monkey patch those funcs to end the span if they do kill it | ||
| wrapEventPropagationCb(event, 'stopPropagation', span); | ||
| wrapEventPropagationCb(event, 'stopImmediatePropagation', span); | ||
| UserInteractionInstrumentation._eventMap.set(event, span); | ||
| }); | ||
| }); | ||
| }; | ||
| } | ||
| enable() { | ||
| var _a; | ||
| if (this._isEnabled) { | ||
| return; | ||
| } | ||
| const rootNode = this.getRootNode(); | ||
| // enable() gets called by our superclass constructor | ||
| // meaning our private fields aren't initialized yet!! | ||
| this._listeners = []; | ||
| // | ||
| const eventNames = (_a = this._config.eventNames) !== null && _a !== void 0 ? _a : DEFAULT_EVENT_NAMES; | ||
| eventNames.forEach(eventName => { | ||
| // we need a stable reference to this handler so that we can remove it later | ||
| const handler = UserInteractionInstrumentation.createGlobalEventListener(eventName, this._config.rootNodeId, () => this._isEnabled); | ||
| this._listeners.push({ | ||
| eventName, | ||
| handler | ||
| }); | ||
| // capture phase listener to kick in before any other listeners | ||
| rootNode.addEventListener(eventName, handler, { | ||
| capture: true | ||
| }); | ||
| // bubble phase listener gets called at the end, if user space doesn't call e.stopPropagation() | ||
| rootNode.addEventListener(eventName, UserInteractionInstrumentation.handleEndSpan); | ||
| }); | ||
| this._isEnabled = true; | ||
| } | ||
| getRootNode() { | ||
| if (this._config.rootNodeId) { | ||
| const rootNode = document.getElementById(this._config.rootNodeId); | ||
| if (rootNode === null) { | ||
| this._diag.warn(`Root Node id: ${this._config.rootNodeId} not found!`); | ||
| return document; | ||
| } | ||
| return rootNode; | ||
| } | ||
| return document; | ||
| } | ||
| disable() { | ||
| this._isEnabled = false; | ||
| this._listeners.forEach(({ | ||
| eventName, | ||
| handler | ||
| }) => { | ||
| document.removeEventListener(eventName, handler, { | ||
| capture: true | ||
| }); | ||
| document.removeEventListener(eventName, UserInteractionInstrumentation.handleEndSpan); | ||
| }); | ||
| this._listeners = []; | ||
| } | ||
| } | ||
| UserInteractionInstrumentation._eventMap = new WeakMap(); | ||
| const shouldCreateSpan = (event, element, eventName, rootNodeId) => { | ||
| if (!(element instanceof HTMLElement)) { | ||
| return false; | ||
| } | ||
| const handlerName = `on${eventName}`; | ||
| if (!elementHasEventHandler(element, handlerName, rootNodeId)) { | ||
| return false; | ||
| } | ||
| if (!element.getAttribute) { | ||
| return false; | ||
| } | ||
| if (element.hasAttribute('disabled')) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; | ||
| /** | ||
| * Detects if this event on this element is useful | ||
| * by checking if this element or any of its parents have handlers | ||
| * for this event. | ||
| * | ||
| * Accounts for the fact that frameworks like React will put dummy/noop | ||
| * handlers at their root, and ignores those. | ||
| */ | ||
| const elementHasEventHandler = (element, eventName, rootNodeId) => { | ||
| if (!element || !!rootNodeId && element.id === rootNodeId) { | ||
| return false; | ||
| } | ||
| if (element[eventName]) { | ||
| return true; | ||
| } | ||
| return elementHasEventHandler(element.parentElement, eventName, rootNodeId); | ||
| }; | ||
| const wrapEventPropagationCb = (event, key, span) => { | ||
| const oldCb = event[key].bind(event); | ||
| event[key] = () => { | ||
| span.end(); | ||
| oldCb(); | ||
| }; | ||
| }; | ||
| export { UserInteractionInstrumentation as U, VERSION as V }; |
| 'use strict'; | ||
| var userInteractionInstrumentation = require('../user-interaction-instrumentation-BG90kwZA.js'); | ||
| var userInteractionInstrumentation = require('../user-interaction-instrumentation-ep7Sptw2.js'); | ||
| require('@opentelemetry/api'); | ||
@@ -5,0 +5,0 @@ require('@opentelemetry/instrumentation'); |
@@ -1,4 +0,4 @@ | ||
| export { U as UserInteractionInstrumentation } from '../user-interaction-instrumentation-e2UGPk8b.js'; | ||
| export { U as UserInteractionInstrumentation } from '../user-interaction-instrumentation-CE6qKGDn.js'; | ||
| import '@opentelemetry/api'; | ||
| import '@opentelemetry/instrumentation'; | ||
| import '@opentelemetry/sdk-trace-web'; |
+1
-1
| { | ||
| "name": "@honeycombio/opentelemetry-web", | ||
| "version": "1.0.2", | ||
| "version": "1.0.3", | ||
| "description": "Honeycomb OpenTelemetry Wrapper for Browser Applications", | ||
@@ -5,0 +5,0 @@ "repository": { |
+1
-0
@@ -54,2 +54,3 @@ # Honeycomb OpenTelemetry Web | ||
| const sdk = new HoneycombWebSDK({ | ||
| // endpoint: "https://api.eu1.honeycomb.io/v1/traces", // Send to EU instance of Honeycomb. Defaults to sending to US instance. | ||
| apiKey: 'api-key-goes-here', | ||
@@ -56,0 +57,0 @@ serviceName: 'your-great-browser-application', |
| 'use strict'; | ||
| var api = require('@opentelemetry/api'); | ||
| var instrumentation = require('@opentelemetry/instrumentation'); | ||
| var sdkTraceWeb = require('@opentelemetry/sdk-trace-web'); | ||
| const VERSION = '1.0.2'; | ||
| const INSTRUMENTATION_NAME = '@honeycombio/user-instrumentation'; | ||
| const DEFAULT_EVENT_NAMES = ['click']; | ||
| class UserInteractionInstrumentation extends instrumentation.InstrumentationBase { | ||
| constructor(config = {}) { | ||
| var _a, _b; | ||
| super(INSTRUMENTATION_NAME, VERSION, config); | ||
| this._config = config; | ||
| this._isEnabled = (_a = this._config.enabled) !== null && _a !== void 0 ? _a : false; | ||
| // enable() gets called by our superclass constructor | ||
| // @ts-expect-error this may get set in enable() | ||
| this._listeners = (_b = this._listeners) !== null && _b !== void 0 ? _b : []; | ||
| } | ||
| init() {} | ||
| static handleEndSpan(ev) { | ||
| var _a; | ||
| (_a = UserInteractionInstrumentation._eventMap.get(ev)) === null || _a === void 0 ? void 0 : _a.end(); | ||
| } | ||
| static createGlobalEventListener(eventName, rootNodeId, isInstrumentationEnabled) { | ||
| return event => { | ||
| const element = event.target; | ||
| if (isInstrumentationEnabled() === false) return; | ||
| if (UserInteractionInstrumentation._eventMap.has(event)) return; | ||
| if (!shouldCreateSpan(event, element, eventName, rootNodeId)) return; | ||
| const xpath = sdkTraceWeb.getElementXPath(element); | ||
| const tracer = api.trace.getTracer(INSTRUMENTATION_NAME); | ||
| api.context.with(api.context.active(), () => { | ||
| tracer.startActiveSpan(eventName, { | ||
| attributes: { | ||
| event_type: eventName, | ||
| target_element: element.tagName, | ||
| target_xpath: xpath, | ||
| 'http.url': window.location.href | ||
| } | ||
| }, span => { | ||
| // if user space code calls stopPropagation, we'll never see it again | ||
| // so let's monkey patch those funcs to end the span if they do kill it | ||
| wrapEventPropagationCb(event, 'stopPropagation', span); | ||
| wrapEventPropagationCb(event, 'stopImmediatePropagation', span); | ||
| UserInteractionInstrumentation._eventMap.set(event, span); | ||
| }); | ||
| }); | ||
| }; | ||
| } | ||
| enable() { | ||
| var _a; | ||
| if (this._isEnabled) { | ||
| return; | ||
| } | ||
| const rootNode = this.getRootNode(); | ||
| // enable() gets called by our superclass constructor | ||
| // meaning our private fields aren't initialized yet!! | ||
| this._listeners = []; | ||
| // | ||
| const eventNames = (_a = this._config.eventNames) !== null && _a !== void 0 ? _a : DEFAULT_EVENT_NAMES; | ||
| eventNames.forEach(eventName => { | ||
| // we need a stable reference to this handler so that we can remove it later | ||
| const handler = UserInteractionInstrumentation.createGlobalEventListener(eventName, this._config.rootNodeId, () => this._isEnabled); | ||
| this._listeners.push({ | ||
| eventName, | ||
| handler | ||
| }); | ||
| // capture phase listener to kick in before any other listeners | ||
| rootNode.addEventListener(eventName, handler, { | ||
| capture: true | ||
| }); | ||
| // bubble phase listener gets called at the end, if user space doesn't call e.stopPropagation() | ||
| rootNode.addEventListener(eventName, UserInteractionInstrumentation.handleEndSpan); | ||
| }); | ||
| this._isEnabled = true; | ||
| } | ||
| getRootNode() { | ||
| if (this._config.rootNodeId) { | ||
| const rootNode = document.getElementById(this._config.rootNodeId); | ||
| if (rootNode === null) { | ||
| this._diag.warn(`Root Node id: ${this._config.rootNodeId} not found!`); | ||
| return document; | ||
| } | ||
| return rootNode; | ||
| } | ||
| return document; | ||
| } | ||
| disable() { | ||
| this._isEnabled = false; | ||
| this._listeners.forEach(({ | ||
| eventName, | ||
| handler | ||
| }) => { | ||
| document.removeEventListener(eventName, handler, { | ||
| capture: true | ||
| }); | ||
| document.removeEventListener(eventName, UserInteractionInstrumentation.handleEndSpan); | ||
| }); | ||
| this._listeners = []; | ||
| } | ||
| } | ||
| UserInteractionInstrumentation._eventMap = new WeakMap(); | ||
| const shouldCreateSpan = (event, element, eventName, rootNodeId) => { | ||
| if (!(element instanceof HTMLElement)) { | ||
| return false; | ||
| } | ||
| const handlerName = `on${eventName}`; | ||
| if (!elementHasEventHandler(element, handlerName, rootNodeId)) { | ||
| return false; | ||
| } | ||
| if (!element.getAttribute) { | ||
| return false; | ||
| } | ||
| if (element.hasAttribute('disabled')) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; | ||
| /** | ||
| * Detects if this event on this element is useful | ||
| * by checking if this element or any of its parents have handlers | ||
| * for this event. | ||
| * | ||
| * Accounts for the fact that frameworks like React will put dummy/noop | ||
| * handlers at their root, and ignores those. | ||
| */ | ||
| const elementHasEventHandler = (element, eventName, rootNodeId) => { | ||
| if (!element || !!rootNodeId && element.id === rootNodeId) { | ||
| return false; | ||
| } | ||
| if (element[eventName]) { | ||
| return true; | ||
| } | ||
| return elementHasEventHandler(element.parentElement, eventName, rootNodeId); | ||
| }; | ||
| const wrapEventPropagationCb = (event, key, span) => { | ||
| const oldCb = event[key].bind(event); | ||
| event[key] = () => { | ||
| span.end(); | ||
| oldCb(); | ||
| }; | ||
| }; | ||
| exports.UserInteractionInstrumentation = UserInteractionInstrumentation; | ||
| exports.VERSION = VERSION; |
| import { trace, context } from '@opentelemetry/api'; | ||
| import { InstrumentationBase } from '@opentelemetry/instrumentation'; | ||
| import { getElementXPath } from '@opentelemetry/sdk-trace-web'; | ||
| const VERSION = '1.0.2'; | ||
| const INSTRUMENTATION_NAME = '@honeycombio/user-instrumentation'; | ||
| const DEFAULT_EVENT_NAMES = ['click']; | ||
| class UserInteractionInstrumentation extends InstrumentationBase { | ||
| constructor(config = {}) { | ||
| var _a, _b; | ||
| super(INSTRUMENTATION_NAME, VERSION, config); | ||
| this._config = config; | ||
| this._isEnabled = (_a = this._config.enabled) !== null && _a !== void 0 ? _a : false; | ||
| // enable() gets called by our superclass constructor | ||
| // @ts-expect-error this may get set in enable() | ||
| this._listeners = (_b = this._listeners) !== null && _b !== void 0 ? _b : []; | ||
| } | ||
| init() {} | ||
| static handleEndSpan(ev) { | ||
| var _a; | ||
| (_a = UserInteractionInstrumentation._eventMap.get(ev)) === null || _a === void 0 ? void 0 : _a.end(); | ||
| } | ||
| static createGlobalEventListener(eventName, rootNodeId, isInstrumentationEnabled) { | ||
| return event => { | ||
| const element = event.target; | ||
| if (isInstrumentationEnabled() === false) return; | ||
| if (UserInteractionInstrumentation._eventMap.has(event)) return; | ||
| if (!shouldCreateSpan(event, element, eventName, rootNodeId)) return; | ||
| const xpath = getElementXPath(element); | ||
| const tracer = trace.getTracer(INSTRUMENTATION_NAME); | ||
| context.with(context.active(), () => { | ||
| tracer.startActiveSpan(eventName, { | ||
| attributes: { | ||
| event_type: eventName, | ||
| target_element: element.tagName, | ||
| target_xpath: xpath, | ||
| 'http.url': window.location.href | ||
| } | ||
| }, span => { | ||
| // if user space code calls stopPropagation, we'll never see it again | ||
| // so let's monkey patch those funcs to end the span if they do kill it | ||
| wrapEventPropagationCb(event, 'stopPropagation', span); | ||
| wrapEventPropagationCb(event, 'stopImmediatePropagation', span); | ||
| UserInteractionInstrumentation._eventMap.set(event, span); | ||
| }); | ||
| }); | ||
| }; | ||
| } | ||
| enable() { | ||
| var _a; | ||
| if (this._isEnabled) { | ||
| return; | ||
| } | ||
| const rootNode = this.getRootNode(); | ||
| // enable() gets called by our superclass constructor | ||
| // meaning our private fields aren't initialized yet!! | ||
| this._listeners = []; | ||
| // | ||
| const eventNames = (_a = this._config.eventNames) !== null && _a !== void 0 ? _a : DEFAULT_EVENT_NAMES; | ||
| eventNames.forEach(eventName => { | ||
| // we need a stable reference to this handler so that we can remove it later | ||
| const handler = UserInteractionInstrumentation.createGlobalEventListener(eventName, this._config.rootNodeId, () => this._isEnabled); | ||
| this._listeners.push({ | ||
| eventName, | ||
| handler | ||
| }); | ||
| // capture phase listener to kick in before any other listeners | ||
| rootNode.addEventListener(eventName, handler, { | ||
| capture: true | ||
| }); | ||
| // bubble phase listener gets called at the end, if user space doesn't call e.stopPropagation() | ||
| rootNode.addEventListener(eventName, UserInteractionInstrumentation.handleEndSpan); | ||
| }); | ||
| this._isEnabled = true; | ||
| } | ||
| getRootNode() { | ||
| if (this._config.rootNodeId) { | ||
| const rootNode = document.getElementById(this._config.rootNodeId); | ||
| if (rootNode === null) { | ||
| this._diag.warn(`Root Node id: ${this._config.rootNodeId} not found!`); | ||
| return document; | ||
| } | ||
| return rootNode; | ||
| } | ||
| return document; | ||
| } | ||
| disable() { | ||
| this._isEnabled = false; | ||
| this._listeners.forEach(({ | ||
| eventName, | ||
| handler | ||
| }) => { | ||
| document.removeEventListener(eventName, handler, { | ||
| capture: true | ||
| }); | ||
| document.removeEventListener(eventName, UserInteractionInstrumentation.handleEndSpan); | ||
| }); | ||
| this._listeners = []; | ||
| } | ||
| } | ||
| UserInteractionInstrumentation._eventMap = new WeakMap(); | ||
| const shouldCreateSpan = (event, element, eventName, rootNodeId) => { | ||
| if (!(element instanceof HTMLElement)) { | ||
| return false; | ||
| } | ||
| const handlerName = `on${eventName}`; | ||
| if (!elementHasEventHandler(element, handlerName, rootNodeId)) { | ||
| return false; | ||
| } | ||
| if (!element.getAttribute) { | ||
| return false; | ||
| } | ||
| if (element.hasAttribute('disabled')) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; | ||
| /** | ||
| * Detects if this event on this element is useful | ||
| * by checking if this element or any of its parents have handlers | ||
| * for this event. | ||
| * | ||
| * Accounts for the fact that frameworks like React will put dummy/noop | ||
| * handlers at their root, and ignores those. | ||
| */ | ||
| const elementHasEventHandler = (element, eventName, rootNodeId) => { | ||
| if (!element || !!rootNodeId && element.id === rootNodeId) { | ||
| return false; | ||
| } | ||
| if (element[eventName]) { | ||
| return true; | ||
| } | ||
| return elementHasEventHandler(element.parentElement, eventName, rootNodeId); | ||
| }; | ||
| const wrapEventPropagationCb = (event, key, span) => { | ||
| const oldCb = event[key].bind(event); | ||
| event[key] = () => { | ||
| span.end(); | ||
| oldCb(); | ||
| }; | ||
| }; | ||
| export { UserInteractionInstrumentation as U, VERSION as V }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1453425
0.02%36235
0.01%296
0.34%