@grafana/faro-web-sdk 2.0.0-beta → 2.0.2
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/bundle/faro-web-sdk.iife.js +1 -1
- package/dist/bundle/types/index.d.ts +3 -3
- package/dist/bundle/types/instrumentations/_internal/activityWindowTracker.d.ts +36 -0
- package/dist/bundle/types/instrumentations/_internal/monitors/const.d.ts +4 -0
- package/dist/bundle/types/instrumentations/_internal/monitors/domMutationMonitor.d.ts +4 -0
- package/dist/bundle/types/instrumentations/{userActions → _internal/monitors}/httpRequestMonitor.d.ts +1 -3
- package/dist/bundle/types/instrumentations/_internal/monitors/index.d.ts +5 -0
- package/dist/bundle/types/instrumentations/_internal/monitors/interactionMonitor.d.ts +8 -0
- package/dist/{types/instrumentations/userActions → bundle/types/instrumentations/_internal/monitors}/performanceEntriesMonitor.d.ts +1 -0
- package/dist/bundle/types/instrumentations/_internal/monitors/urlChangeMonitor.d.ts +10 -0
- package/dist/bundle/types/instrumentations/console/instrumentation.d.ts +1 -1
- package/dist/bundle/types/instrumentations/csp/instrumentation.d.ts +1 -1
- package/dist/bundle/types/instrumentations/errors/instrumentation.d.ts +1 -1
- package/dist/bundle/types/instrumentations/index.d.ts +1 -0
- package/dist/bundle/types/instrumentations/navigation/index.d.ts +1 -0
- package/dist/bundle/types/instrumentations/navigation/instrumentation.d.ts +6 -0
- package/dist/bundle/types/instrumentations/performance/instrumentation.d.ts +1 -1
- package/dist/bundle/types/instrumentations/session/instrumentation.d.ts +1 -1
- package/dist/bundle/types/instrumentations/userActions/const.d.ts +1 -4
- package/dist/bundle/types/instrumentations/userActions/index.d.ts +3 -2
- package/dist/bundle/types/instrumentations/userActions/instrumentation.d.ts +1 -1
- package/dist/bundle/types/instrumentations/userActions/processUserActionEventHandler.d.ts +1 -4
- package/dist/bundle/types/instrumentations/userActions/userActionController.d.ts +22 -0
- package/dist/bundle/types/instrumentations/userActions/util.d.ts +4 -0
- package/dist/bundle/types/instrumentations/view/instrumentation.d.ts +1 -1
- package/dist/bundle/types/instrumentations/webVitals/instrumentation.d.ts +1 -2
- package/dist/bundle/types/transports/console/transport.d.ts +1 -1
- package/dist/bundle/types/transports/fetch/transport.d.ts +1 -1
- package/dist/cjs/config/getWebInstrumentations.js +1 -0
- package/dist/cjs/config/getWebInstrumentations.js.map +1 -1
- package/dist/cjs/config/makeCoreConfig.js +20 -9
- package/dist/cjs/config/makeCoreConfig.js.map +1 -1
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/instrumentations/_internal/activityWindowTracker.js +140 -0
- package/dist/cjs/instrumentations/_internal/activityWindowTracker.js.map +1 -0
- package/dist/cjs/instrumentations/_internal/monitors/const.js +8 -0
- package/dist/cjs/instrumentations/_internal/monitors/const.js.map +1 -0
- package/dist/cjs/instrumentations/_internal/monitors/domMutationMonitor.js +34 -0
- package/dist/cjs/instrumentations/_internal/monitors/domMutationMonitor.js.map +1 -0
- package/dist/cjs/instrumentations/{userActions → _internal/monitors}/httpRequestMonitor.js +45 -17
- package/dist/cjs/instrumentations/_internal/monitors/httpRequestMonitor.js.map +1 -0
- package/dist/cjs/instrumentations/_internal/monitors/index.js +14 -0
- package/dist/cjs/instrumentations/_internal/monitors/index.js.map +1 -0
- package/dist/cjs/instrumentations/_internal/monitors/interactionMonitor.js +36 -0
- package/dist/cjs/instrumentations/_internal/monitors/interactionMonitor.js.map +1 -0
- package/dist/cjs/instrumentations/_internal/monitors/performanceEntriesMonitor.js +35 -0
- package/dist/cjs/instrumentations/_internal/monitors/performanceEntriesMonitor.js.map +1 -0
- package/dist/cjs/instrumentations/_internal/monitors/types.js.map +1 -0
- package/dist/cjs/instrumentations/_internal/monitors/urlChangeMonitor.js +138 -0
- package/dist/cjs/instrumentations/_internal/monitors/urlChangeMonitor.js.map +1 -0
- package/dist/cjs/instrumentations/index.js +3 -1
- package/dist/cjs/instrumentations/index.js.map +1 -1
- package/dist/cjs/instrumentations/navigation/index.js +6 -0
- package/dist/cjs/instrumentations/navigation/index.js.map +1 -0
- package/dist/cjs/instrumentations/navigation/instrumentation.js +68 -0
- package/dist/cjs/instrumentations/navigation/instrumentation.js.map +1 -0
- package/dist/cjs/instrumentations/performance/resource.js +4 -6
- package/dist/cjs/instrumentations/performance/resource.js.map +1 -1
- package/dist/cjs/instrumentations/userActions/const.js +5 -5
- package/dist/cjs/instrumentations/userActions/const.js.map +1 -1
- package/dist/cjs/instrumentations/userActions/index.js +3 -2
- package/dist/cjs/instrumentations/userActions/index.js.map +1 -1
- package/dist/cjs/instrumentations/userActions/instrumentation.js +2 -2
- package/dist/cjs/instrumentations/userActions/instrumentation.js.map +1 -1
- package/dist/cjs/instrumentations/userActions/processUserActionEventHandler.js +8 -56
- package/dist/cjs/instrumentations/userActions/processUserActionEventHandler.js.map +1 -1
- package/dist/cjs/instrumentations/userActions/userActionController.js +125 -0
- package/dist/cjs/instrumentations/userActions/userActionController.js.map +1 -0
- package/dist/cjs/instrumentations/userActions/util.js +20 -0
- package/dist/cjs/instrumentations/userActions/util.js.map +1 -1
- package/dist/cjs/instrumentations/webVitals/instrumentation.js +1 -10
- package/dist/cjs/instrumentations/webVitals/instrumentation.js.map +1 -1
- package/dist/cjs/utils/webStorage.js +1 -1
- package/dist/cjs/utils/webStorage.js.map +1 -1
- package/dist/esm/config/getWebInstrumentations.js +2 -1
- package/dist/esm/config/getWebInstrumentations.js.map +1 -1
- package/dist/esm/config/makeCoreConfig.js +19 -9
- package/dist/esm/config/makeCoreConfig.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/instrumentations/_internal/activityWindowTracker.js +113 -0
- package/dist/esm/instrumentations/_internal/activityWindowTracker.js.map +1 -0
- package/dist/esm/instrumentations/_internal/monitors/const.js +5 -0
- package/dist/esm/instrumentations/_internal/monitors/const.js.map +1 -0
- package/dist/esm/instrumentations/_internal/monitors/domMutationMonitor.js +30 -0
- package/dist/esm/instrumentations/_internal/monitors/domMutationMonitor.js.map +1 -0
- package/dist/esm/instrumentations/{userActions → _internal/monitors}/httpRequestMonitor.js +44 -17
- package/dist/esm/instrumentations/_internal/monitors/httpRequestMonitor.js.map +1 -0
- package/dist/esm/instrumentations/_internal/monitors/index.js +6 -0
- package/dist/esm/instrumentations/_internal/monitors/index.js.map +1 -0
- package/dist/esm/instrumentations/_internal/monitors/interactionMonitor.js +31 -0
- package/dist/esm/instrumentations/_internal/monitors/interactionMonitor.js.map +1 -0
- package/dist/esm/instrumentations/_internal/monitors/performanceEntriesMonitor.js +31 -0
- package/dist/esm/instrumentations/_internal/monitors/performanceEntriesMonitor.js.map +1 -0
- package/dist/esm/instrumentations/_internal/monitors/types.js.map +1 -0
- package/dist/esm/instrumentations/_internal/monitors/urlChangeMonitor.js +125 -0
- package/dist/esm/instrumentations/_internal/monitors/urlChangeMonitor.js.map +1 -0
- package/dist/esm/instrumentations/index.js +1 -0
- package/dist/esm/instrumentations/index.js.map +1 -1
- package/dist/esm/instrumentations/navigation/index.js +2 -0
- package/dist/esm/instrumentations/navigation/index.js.map +1 -0
- package/dist/esm/instrumentations/navigation/instrumentation.js +46 -0
- package/dist/esm/instrumentations/navigation/instrumentation.js.map +1 -0
- package/dist/esm/instrumentations/performance/resource.js +4 -6
- package/dist/esm/instrumentations/performance/resource.js.map +1 -1
- package/dist/esm/instrumentations/userActions/const.js +1 -4
- package/dist/esm/instrumentations/userActions/const.js.map +1 -1
- package/dist/esm/instrumentations/userActions/index.js +2 -1
- package/dist/esm/instrumentations/userActions/index.js.map +1 -1
- package/dist/esm/instrumentations/userActions/instrumentation.js +2 -2
- package/dist/esm/instrumentations/userActions/instrumentation.js.map +1 -1
- package/dist/esm/instrumentations/userActions/processUserActionEventHandler.js +9 -55
- package/dist/esm/instrumentations/userActions/processUserActionEventHandler.js.map +1 -1
- package/dist/esm/instrumentations/userActions/userActionController.js +117 -0
- package/dist/esm/instrumentations/userActions/userActionController.js.map +1 -0
- package/dist/esm/instrumentations/userActions/util.js +17 -0
- package/dist/esm/instrumentations/userActions/util.js.map +1 -1
- package/dist/esm/instrumentations/webVitals/instrumentation.js +1 -10
- package/dist/esm/instrumentations/webVitals/instrumentation.js.map +1 -1
- package/dist/esm/utils/webStorage.js +1 -1
- package/dist/esm/utils/webStorage.js.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/instrumentations/_internal/activityWindowTracker.d.ts +36 -0
- package/dist/types/instrumentations/_internal/monitors/const.d.ts +4 -0
- package/dist/types/instrumentations/_internal/monitors/domMutationMonitor.d.ts +4 -0
- package/dist/types/instrumentations/{userActions → _internal/monitors}/httpRequestMonitor.d.ts +1 -3
- package/dist/types/instrumentations/_internal/monitors/index.d.ts +5 -0
- package/dist/types/instrumentations/_internal/monitors/interactionMonitor.d.ts +8 -0
- package/dist/{bundle/types/instrumentations/userActions → types/instrumentations/_internal/monitors}/performanceEntriesMonitor.d.ts +1 -0
- package/dist/types/instrumentations/_internal/monitors/urlChangeMonitor.d.ts +10 -0
- package/dist/types/instrumentations/console/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/csp/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/errors/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/index.d.ts +1 -0
- package/dist/types/instrumentations/navigation/index.d.ts +1 -0
- package/dist/types/instrumentations/navigation/instrumentation.d.ts +6 -0
- package/dist/types/instrumentations/performance/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/session/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/userActions/const.d.ts +1 -4
- package/dist/types/instrumentations/userActions/index.d.ts +3 -2
- package/dist/types/instrumentations/userActions/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/userActions/processUserActionEventHandler.d.ts +1 -4
- package/dist/types/instrumentations/userActions/userActionController.d.ts +22 -0
- package/dist/types/instrumentations/userActions/util.d.ts +4 -0
- package/dist/types/instrumentations/view/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/webVitals/instrumentation.d.ts +1 -2
- package/dist/types/transports/console/transport.d.ts +1 -1
- package/dist/types/transports/fetch/transport.d.ts +1 -1
- package/package.json +10 -9
- package/dist/bundle/types/instrumentations/userActions/domMutationMonitor.d.ts +0 -2
- package/dist/bundle/types/instrumentations/webVitals/webVitalsBasic.d.ts +0 -14
- package/dist/cjs/instrumentations/userActions/domMutationMonitor.js +0 -19
- package/dist/cjs/instrumentations/userActions/domMutationMonitor.js.map +0 -1
- package/dist/cjs/instrumentations/userActions/httpRequestMonitor.js.map +0 -1
- package/dist/cjs/instrumentations/userActions/performanceEntriesMonitor.js +0 -17
- package/dist/cjs/instrumentations/userActions/performanceEntriesMonitor.js.map +0 -1
- package/dist/cjs/instrumentations/userActions/types.js.map +0 -1
- package/dist/cjs/instrumentations/webVitals/webVitalsBasic.js +0 -36
- package/dist/cjs/instrumentations/webVitals/webVitalsBasic.js.map +0 -1
- package/dist/esm/instrumentations/userActions/domMutationMonitor.js +0 -16
- package/dist/esm/instrumentations/userActions/domMutationMonitor.js.map +0 -1
- package/dist/esm/instrumentations/userActions/httpRequestMonitor.js.map +0 -1
- package/dist/esm/instrumentations/userActions/performanceEntriesMonitor.js +0 -14
- package/dist/esm/instrumentations/userActions/performanceEntriesMonitor.js.map +0 -1
- package/dist/esm/instrumentations/userActions/types.js.map +0 -1
- package/dist/esm/instrumentations/webVitals/webVitalsBasic.js +0 -28
- package/dist/esm/instrumentations/webVitals/webVitalsBasic.js.map +0 -1
- package/dist/types/instrumentations/userActions/domMutationMonitor.d.ts +0 -2
- package/dist/types/instrumentations/webVitals/webVitalsBasic.d.ts +0 -14
- /package/dist/bundle/types/instrumentations/{userActions → _internal/monitors}/types.d.ts +0 -0
- /package/dist/cjs/instrumentations/{userActions → _internal/monitors}/types.js +0 -0
- /package/dist/esm/instrumentations/{userActions → _internal/monitors}/types.js +0 -0
- /package/dist/types/instrumentations/{userActions → _internal/monitors}/types.d.ts +0 -0
package/dist/types/instrumentations/{userActions → _internal/monitors}/httpRequestMonitor.d.ts
RENAMED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Observable } from '@grafana/faro-core';
|
|
2
2
|
import type { HttpRequestEndMessage, HttpRequestStartMessage } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Monitors if any http requests are in progress.
|
|
5
|
-
*/
|
|
6
3
|
export declare function monitorHttpRequests(): Observable<HttpRequestStartMessage | HttpRequestEndMessage>;
|
|
4
|
+
export declare function __resetHttpRequestMonitorForTests(): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { monitorDomMutations } from './domMutationMonitor';
|
|
2
|
+
export { monitorHttpRequests } from './httpRequestMonitor';
|
|
3
|
+
export { monitorPerformanceEntries } from './performanceEntriesMonitor';
|
|
4
|
+
export { monitorUrlChanges } from './urlChangeMonitor';
|
|
5
|
+
export { monitorInteractions } from './interactionMonitor';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Observable } from '@grafana/faro-core';
|
|
2
|
+
export declare const MESSAGE_TYPE_INTERACTION = "interaction";
|
|
3
|
+
export type InteractionMessage = {
|
|
4
|
+
type: typeof MESSAGE_TYPE_INTERACTION;
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function monitorInteractions(eventNames: string[]): Observable<InteractionMessage>;
|
|
8
|
+
export declare function __resetInteractionMonitorForTests(): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Observable } from '@grafana/faro-core';
|
|
2
|
+
export declare const MESSAGE_TYPE_URL_CHANGE = "url-change";
|
|
3
|
+
export type UrlChangeMessage = {
|
|
4
|
+
type: typeof MESSAGE_TYPE_URL_CHANGE;
|
|
5
|
+
from: string;
|
|
6
|
+
to: string;
|
|
7
|
+
trigger: 'pushState' | 'replaceState' | 'popstate' | 'hashchange' | 'navigate' | 'navigate-intercept';
|
|
8
|
+
};
|
|
9
|
+
export declare function monitorUrlChanges(): Observable<UrlChangeMessage>;
|
|
10
|
+
export declare function __resetUrlChangeMonitorForTests(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseInstrumentation, LogLevel } from '@grafana/faro-core';
|
|
2
2
|
export declare class ConsoleInstrumentation extends BaseInstrumentation {
|
|
3
3
|
readonly name = "@grafana/faro-web-sdk:instrumentation-console";
|
|
4
|
-
readonly version = "2.0.
|
|
4
|
+
readonly version = "2.0.2";
|
|
5
5
|
static defaultDisabledLevels: LogLevel[];
|
|
6
6
|
static consoleErrorPrefix: string;
|
|
7
7
|
private errorSerializer;
|
|
@@ -2,7 +2,7 @@ import { BaseInstrumentation } from '@grafana/faro-core';
|
|
|
2
2
|
import type { Instrumentation } from '@grafana/faro-core';
|
|
3
3
|
export declare class CSPInstrumentation extends BaseInstrumentation implements Instrumentation {
|
|
4
4
|
readonly name = "@grafana/faro-web-sdk:instrumentation-csp";
|
|
5
|
-
readonly version = "2.0.
|
|
5
|
+
readonly version = "2.0.2";
|
|
6
6
|
constructor();
|
|
7
7
|
initialize(): void;
|
|
8
8
|
destroy(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseInstrumentation } from '@grafana/faro-core';
|
|
2
2
|
export declare class ErrorsInstrumentation extends BaseInstrumentation {
|
|
3
3
|
readonly name = "@grafana/faro-web-sdk:instrumentation-errors";
|
|
4
|
-
readonly version = "2.0.
|
|
4
|
+
readonly version = "2.0.2";
|
|
5
5
|
initialize(): void;
|
|
6
6
|
}
|
|
@@ -8,3 +8,4 @@ export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSIST
|
|
|
8
8
|
export { PerformanceInstrumentation } from './performance';
|
|
9
9
|
export { UserActionInstrumentation, userActionDataAttribute } from './userActions';
|
|
10
10
|
export { CSPInstrumentation } from './csp';
|
|
11
|
+
export { NavigationInstrumentation } from './navigation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NavigationInstrumentation } from './instrumentation';
|
|
@@ -3,6 +3,6 @@ import type { ResourceEntryMessage } from './types';
|
|
|
3
3
|
export declare const performanceEntriesSubscription: Observable<ResourceEntryMessage>;
|
|
4
4
|
export declare class PerformanceInstrumentation extends BaseInstrumentation {
|
|
5
5
|
readonly name = "@grafana/faro-web-sdk:instrumentation-performance";
|
|
6
|
-
readonly version = "2.0.
|
|
6
|
+
readonly version = "2.0.2";
|
|
7
7
|
initialize(): void;
|
|
8
8
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseInstrumentation } from '@grafana/faro-core';
|
|
2
2
|
export declare class SessionInstrumentation extends BaseInstrumentation {
|
|
3
3
|
readonly name = "@grafana/faro-web-sdk:instrumentation-session";
|
|
4
|
-
readonly version = "2.0.
|
|
4
|
+
readonly version = "2.0.2";
|
|
5
5
|
private notifiedSession;
|
|
6
6
|
private sendSessionStartEvent;
|
|
7
7
|
private createInitialSession;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export declare const MESSAGE_TYPE_RESOURCE_ENTRY = "resource-entry";
|
|
2
|
-
export declare const MESSAGE_TYPE_HTTP_REQUEST_START = "http-request-start";
|
|
3
|
-
export declare const MESSAGE_TYPE_HTTP_REQUEST_END = "http-request-end";
|
|
4
|
-
export declare const MESSAGE_TYPE_DOM_MUTATION = "dom-mutation";
|
|
5
1
|
export declare const userActionDataAttributeParsed = "faroUserActionName";
|
|
6
2
|
export declare const userActionDataAttribute = "data-faro-user-action-name";
|
|
3
|
+
export { MESSAGE_TYPE_DOM_MUTATION, MESSAGE_TYPE_HTTP_REQUEST_START, MESSAGE_TYPE_HTTP_REQUEST_END, } from '../_internal/monitors/const';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { UserActionInstrumentation } from './instrumentation';
|
|
2
|
-
export type { DomMutationMessage, HttpRequestEndMessage, HttpRequestStartMessage, HttpRequestMessagePayload, } from '
|
|
3
|
-
export { MESSAGE_TYPE_DOM_MUTATION, MESSAGE_TYPE_HTTP_REQUEST_END, MESSAGE_TYPE_HTTP_REQUEST_START,
|
|
2
|
+
export type { DomMutationMessage, HttpRequestEndMessage, HttpRequestStartMessage, HttpRequestMessagePayload, } from '../_internal/monitors/types';
|
|
3
|
+
export { MESSAGE_TYPE_DOM_MUTATION, MESSAGE_TYPE_HTTP_REQUEST_END, MESSAGE_TYPE_HTTP_REQUEST_START, } from '../_internal/monitors/const';
|
|
4
|
+
export { userActionDataAttribute } from './const';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseInstrumentation } from '@grafana/faro-core';
|
|
2
2
|
export declare class UserActionInstrumentation extends BaseInstrumentation {
|
|
3
3
|
readonly name = "@grafana/faro-web-sdk:instrumentation-user-action";
|
|
4
|
-
readonly version = "2.0.
|
|
4
|
+
readonly version = "2.0.2";
|
|
5
5
|
private _userActionSub?;
|
|
6
6
|
initialize(): void;
|
|
7
7
|
destroy(): void;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { Faro, Subscription, UserActionInterface } from '@grafana/faro-core';
|
|
2
|
-
import type { HttpRequestEndMessage, HttpRequestStartMessage } from './types';
|
|
3
2
|
export declare function getUserEventHandler(faro: Faro): {
|
|
4
3
|
processUserEvent: (event: PointerEvent | KeyboardEvent) => void;
|
|
5
|
-
|
|
4
|
+
processUserActionStarted: (userAction: UserActionInterface) => void;
|
|
6
5
|
};
|
|
7
6
|
export declare function getUserActionNameFromElement(element: HTMLElement, dataAttributeName: string): string | undefined;
|
|
8
7
|
export declare function unsubscribeAllMonitors(allMonitorsSub: Subscription | undefined): void;
|
|
9
|
-
export declare function isRequestStartMessage(msg: any): msg is HttpRequestStartMessage;
|
|
10
|
-
export declare function isRequestEndMessage(msg: any): msg is HttpRequestEndMessage;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { UserActionInternalInterface } from '@grafana/faro-core';
|
|
2
|
+
export declare class UserActionController {
|
|
3
|
+
private userAction;
|
|
4
|
+
private readonly http;
|
|
5
|
+
private readonly dom;
|
|
6
|
+
private readonly perf;
|
|
7
|
+
private allMonitorsSub?;
|
|
8
|
+
private stateSub?;
|
|
9
|
+
private followUpTid?;
|
|
10
|
+
private haltTid?;
|
|
11
|
+
private isValid;
|
|
12
|
+
private runningRequests;
|
|
13
|
+
constructor(userAction: UserActionInternalInterface);
|
|
14
|
+
attach(): void;
|
|
15
|
+
private scheduleFollowUp;
|
|
16
|
+
private haltAction;
|
|
17
|
+
private startHaltTimeout;
|
|
18
|
+
private endAction;
|
|
19
|
+
private cancelAction;
|
|
20
|
+
private cleanup;
|
|
21
|
+
private clearTimer;
|
|
22
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HttpRequestEndMessage, HttpRequestStartMessage } from '../_internal/monitors/types';
|
|
1
2
|
/**
|
|
2
3
|
* Parses the action attribute name by removing the 'data-' prefix and converting
|
|
3
4
|
* the remaining string to camelCase.
|
|
@@ -6,3 +7,6 @@
|
|
|
6
7
|
* data attributes and make then camelCase.
|
|
7
8
|
*/
|
|
8
9
|
export declare function convertDataAttributeName(userActionDataAttribute: string): string | undefined;
|
|
10
|
+
export declare function startTimeout(timeoutId: number | undefined, cb: () => void, delay: number): number | undefined;
|
|
11
|
+
export declare function isRequestStartMessage(msg: any): msg is HttpRequestStartMessage;
|
|
12
|
+
export declare function isRequestEndMessage(msg: any): msg is HttpRequestEndMessage;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseInstrumentation } from '@grafana/faro-core';
|
|
2
2
|
export declare class ViewInstrumentation extends BaseInstrumentation {
|
|
3
3
|
readonly name = "@grafana/faro-web-sdk:instrumentation-view";
|
|
4
|
-
readonly version = "2.0.
|
|
4
|
+
readonly version = "2.0.2";
|
|
5
5
|
private notifiedView;
|
|
6
6
|
private sendViewChangedEvent;
|
|
7
7
|
initialize(): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BaseInstrumentation } from '@grafana/faro-core';
|
|
2
2
|
export declare class WebVitalsInstrumentation extends BaseInstrumentation {
|
|
3
3
|
readonly name = "@grafana/faro-web-sdk:instrumentation-web-vitals";
|
|
4
|
-
readonly version = "2.0.
|
|
4
|
+
readonly version = "2.0.2";
|
|
5
5
|
initialize(): void;
|
|
6
|
-
private intializeWebVitalsInstrumentation;
|
|
7
6
|
}
|
|
@@ -4,7 +4,7 @@ import type { ConsoleTransportOptions } from './types';
|
|
|
4
4
|
export declare class ConsoleTransport extends BaseTransport {
|
|
5
5
|
private options;
|
|
6
6
|
readonly name = "@grafana/faro-web-sdk:transport-console";
|
|
7
|
-
readonly version = "2.0.
|
|
7
|
+
readonly version = "2.0.2";
|
|
8
8
|
constructor(options?: ConsoleTransportOptions);
|
|
9
9
|
send(item: TransportItem): void;
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ import type { FetchTransportOptions } from './types';
|
|
|
4
4
|
export declare class FetchTransport extends BaseTransport {
|
|
5
5
|
private options;
|
|
6
6
|
readonly name = "@grafana/faro-web-sdk:transport-fetch";
|
|
7
|
-
readonly version = "2.0.
|
|
7
|
+
readonly version = "2.0.2";
|
|
8
8
|
promiseBuffer: PromiseBuffer<Response | void>;
|
|
9
9
|
private readonly rateLimitBackoffMs;
|
|
10
10
|
private readonly getNow;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/faro-web-sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Faro instrumentations, metas, transports for web.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"observability",
|
|
@@ -39,30 +39,31 @@
|
|
|
39
39
|
"build:compile:bundle": "run-s 'build:compile:bundle:*'",
|
|
40
40
|
"build:compile:bundle:create": "rollup -c ./rollup.config.js",
|
|
41
41
|
"build:compile:bundle:remove-extras": "rimraf dist/bundle/dist",
|
|
42
|
-
"watch": "run-
|
|
43
|
-
"watch:compile": "yarn build:compile:cjs -w",
|
|
42
|
+
"watch": "run-p 'watch:compile:*'",
|
|
43
|
+
"watch:compile:cjs": "yarn build:compile:cjs -w",
|
|
44
|
+
"watch:compile:esm": "yarn build:compile:esm -w",
|
|
44
45
|
"clean": "rimraf dist/ yarn-error.log",
|
|
45
46
|
"quality": "run-s 'quality:*'",
|
|
46
47
|
"quality:test": "jest",
|
|
47
48
|
"quality:format": "prettier --cache --cache-location=../../.cache/prettier/webSdk --ignore-path ../../.prettierignore -w \"./**/*.{js,jsx,ts,tsx,css,scss,md,yaml,yml,json}\"",
|
|
48
49
|
"quality:lint": "run-s 'quality:lint:*'",
|
|
49
|
-
"quality:lint:eslint": "eslint --cache --cache-location ../../.cache/eslint/webSdk
|
|
50
|
+
"quality:lint:eslint": "eslint --cache --cache-location ../../.cache/eslint/webSdk \"./**/*.{js,jsx,ts,tsx}\"",
|
|
50
51
|
"quality:lint:prettier": "prettier --cache --cache-location=../../.cache/prettier/webSdk --ignore-path ../../.prettierignore -c \"./**/*.{js,jsx,ts,tsx,css,scss,md,yaml,yml,json}\"",
|
|
51
52
|
"quality:lint:md": "markdownlint README.md",
|
|
52
53
|
"quality:circular-deps": "madge --circular ."
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
|
-
"@grafana/faro-core": "^2.0.
|
|
56
|
+
"@grafana/faro-core": "^2.0.2",
|
|
56
57
|
"ua-parser-js": "^1.0.32",
|
|
57
58
|
"web-vitals": "^5.0.3"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@types/node": "
|
|
61
|
-
"@types/ua-parser-js": "
|
|
62
|
-
"user-agent-data-types": "
|
|
61
|
+
"@types/node": "24.10.0",
|
|
62
|
+
"@types/ua-parser-js": "0.7.39",
|
|
63
|
+
"user-agent-data-types": "0.4.2"
|
|
63
64
|
},
|
|
64
65
|
"publishConfig": {
|
|
65
66
|
"access": "public"
|
|
66
67
|
},
|
|
67
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "c47ff6089dfa52b34630131ea2776910eae984ab"
|
|
68
69
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Config, MeasurementsAPI } from '@grafana/faro-core';
|
|
2
|
-
export declare class WebVitalsBasic {
|
|
3
|
-
private pushMeasurement;
|
|
4
|
-
private webVitalConfig?;
|
|
5
|
-
static mapping: {
|
|
6
|
-
cls: (onReport: (metric: import("web-vitals").CLSMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
|
|
7
|
-
fcp: (onReport: (metric: import("web-vitals").FCPMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
|
|
8
|
-
inp: (onReport: (metric: import("web-vitals").INPMetric) => void, opts?: import("web-vitals").INPReportOpts) => void;
|
|
9
|
-
lcp: (onReport: (metric: import("web-vitals").LCPMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
|
|
10
|
-
ttfb: (onReport: (metric: import("web-vitals").TTFBMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
|
|
11
|
-
};
|
|
12
|
-
constructor(pushMeasurement: MeasurementsAPI['pushMeasurement'], webVitalConfig?: Config['webVitalsInstrumentation']);
|
|
13
|
-
initialize(): void;
|
|
14
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.monitorDomMutations = monitorDomMutations;
|
|
4
|
-
var faro_core_1 = require("@grafana/faro-core");
|
|
5
|
-
var const_1 = require("./const");
|
|
6
|
-
function monitorDomMutations() {
|
|
7
|
-
var observable = new faro_core_1.Observable();
|
|
8
|
-
var observer = new MutationObserver(function (_mutationsList, _observer) {
|
|
9
|
-
observable.notify({ type: const_1.MESSAGE_TYPE_DOM_MUTATION });
|
|
10
|
-
});
|
|
11
|
-
observer.observe(document, {
|
|
12
|
-
attributes: true,
|
|
13
|
-
childList: true,
|
|
14
|
-
subtree: true,
|
|
15
|
-
characterData: true,
|
|
16
|
-
});
|
|
17
|
-
return observable;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=domMutationMonitor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"domMutationMonitor.js","sourceRoot":"","sources":["../../../../src/instrumentations/userActions/domMutationMonitor.ts"],"names":[],"mappings":";;AAKA,kDAeC;AApBD,gDAAgD;AAEhD,iCAAoD;AAGpD,SAAgB,mBAAmB;IACjC,IAAM,UAAU,GAAG,IAAI,sBAAU,EAAsB,CAAC;IAExD,IAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,UAAC,cAAc,EAAE,SAAS;QAC9D,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,iCAAyB,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE;QACzB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;QACb,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { Observable } from '@grafana/faro-core';\n\nimport { MESSAGE_TYPE_DOM_MUTATION } from './const';\nimport type { DomMutationMessage } from './types';\n\nexport function monitorDomMutations(): Observable {\n const observable = new Observable<DomMutationMessage>();\n\n const observer = new MutationObserver((_mutationsList, _observer) => {\n observable.notify({ type: MESSAGE_TYPE_DOM_MUTATION });\n });\n\n observer.observe(document, {\n attributes: true,\n childList: true,\n subtree: true,\n characterData: true,\n });\n\n return observable;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"httpRequestMonitor.js","sourceRoot":"","sources":["../../../../src/instrumentations/userActions/httpRequestMonitor.ts"],"names":[],"mappings":";;AAeA,kDA4BC;AA3CD,gDAA4D;AAE5D,uCAAmE;AAEnE,iCAAyF;AAKzF,IAAM,YAAY,GAAG,OAAO,CAAC;AAC7B,IAAM,UAAU,GAAG,KAAK,CAAC;AAEzB;;GAEG;AACH,SAAgB,mBAAmB;IACjC,IAAM,UAAU,GAAG,IAAI,sBAA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E,GAAG,KAAA,EAAE,MAAM,QAAA,EAAE,SAAS,WAAA,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,aAAa;aACjB,KAAK,CAAC,IAAI,EAAE,SAAgB,CAAC;aAC7B,IAAI,CAAC,UAAC,QAAQ;YACb,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,YAAY,CAAC,EAAE,GAAG,KAAA,EAAE,MAAM,QAAA,EAAE,SAAS,WAAA,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;YAClE,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC;aACD,KAAK,CAAC,UAAC,KAAK;YACX,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,YAAY,CAAC,EAAE,GAAG,KAAA,EAAE,MAAM,QAAA,EAAE,SAAS,WAAA,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;YAClE,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { genShortID, Observable } from '@grafana/faro-core';\n\nimport { getUrlFromResource, isUrlIgnored } from '../../utils/url';\n\nimport { MESSAGE_TYPE_HTTP_REQUEST_END, MESSAGE_TYPE_HTTP_REQUEST_START } from './const';\nimport type { HttpRequestEndMessage, HttpRequestMessagePayload, HttpRequestStartMessage } from './types';\n\ntype RequestProps = HttpRequestMessagePayload;\n\nconst apiTypeFetch = 'fetch';\nconst apiTypeXhr = 'xhr';\n\n/**\n * Monitors if any http requests are in progress.\n */\nexport function monitorHttpRequests(): Observable<HttpRequestStartMessage | HttpRequestEndMessage> {\n const observable = new Observable<HttpRequestStartMessage | HttpRequestEndMessage>();\n\n function emitStartMessage(requestProps: RequestProps) {\n observable.notify({\n type: MESSAGE_TYPE_HTTP_REQUEST_START,\n request: requestProps,\n });\n }\n\n function emitEndMessage(requestProps: RequestProps) {\n observable.notify({\n type: MESSAGE_TYPE_HTTP_REQUEST_END,\n request: requestProps,\n });\n }\n\n monitorFetch({\n onRequestStart: emitStartMessage,\n onRequestEnd: emitEndMessage,\n });\n\n monitorXhr({\n onRequestStart: emitStartMessage,\n onRequestEnd: emitEndMessage,\n });\n\n return observable;\n}\n\nfunction monitorXhr({\n onRequestStart,\n onRequestEnd,\n}: {\n onRequestStart: (props: RequestProps) => void;\n onRequestEnd: (props: RequestProps) => void;\n}) {\n const originalOpen = XMLHttpRequest.prototype.open;\n\n XMLHttpRequest.prototype.open = function () {\n const url = arguments[1];\n const isIgnoredUrl = isUrlIgnored(url);\n const method = arguments[0];\n\n const requestId = genShortID();\n\n // request has started to load data.\n this.addEventListener('loadstart', function () {\n if (!isIgnoredUrl) {\n onRequestStart({ url, method, requestId, apiType: apiTypeXhr });\n }\n });\n\n // transaction completes successfully.\n this.addEventListener('load', function () {\n if (!isIgnoredUrl) {\n onRequestEnd({ url, method, requestId, apiType: apiTypeXhr });\n }\n });\n\n this.addEventListener('error', function () {\n if (!isIgnoredUrl) {\n onRequestEnd({ url, method, requestId, apiType: apiTypeXhr });\n }\n });\n\n this.addEventListener('abort', function () {\n if (!isIgnoredUrl) {\n onRequestEnd({ url, method, requestId, apiType: apiTypeXhr });\n }\n });\n\n originalOpen.apply(this, arguments as any);\n };\n}\n\nfunction monitorFetch({\n onRequestEnd,\n onRequestStart,\n}: {\n onRequestStart: (props: RequestProps) => void;\n onRequestEnd: (props: RequestProps) => void;\n}) {\n const originalFetch = window.fetch;\n\n window.fetch = function () {\n const url = getUrlFromResource(arguments[0]) ?? '';\n const isIgnoredUrl = isUrlIgnored(url);\n const method = (arguments[1] ?? {}).method;\n\n const requestId = genShortID();\n\n if (!isIgnoredUrl) {\n onRequestStart({ url, method, requestId, apiType: apiTypeFetch });\n }\n\n return originalFetch\n .apply(this, arguments as any)\n .then((response) => {\n if (!isIgnoredUrl) {\n onRequestEnd({ url, method, requestId, apiType: apiTypeFetch });\n }\n return response;\n })\n .catch((error) => {\n if (!isIgnoredUrl) {\n onRequestEnd({ url, method, requestId, apiType: apiTypeFetch });\n }\n throw error;\n });\n };\n}\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.monitorPerformanceEntries = monitorPerformanceEntries;
|
|
4
|
-
var faro_core_1 = require("@grafana/faro-core");
|
|
5
|
-
var instrumentation_1 = require("../performance/instrumentation");
|
|
6
|
-
var performanceConstants_1 = require("../performance/performanceConstants");
|
|
7
|
-
var const_1 = require("./const");
|
|
8
|
-
function monitorPerformanceEntries() {
|
|
9
|
-
var observable = new faro_core_1.Observable();
|
|
10
|
-
instrumentation_1.performanceEntriesSubscription.subscribe(function (data) {
|
|
11
|
-
if (data.type === performanceConstants_1.RESOURCE_ENTRY) {
|
|
12
|
-
observable.notify({ type: const_1.MESSAGE_TYPE_RESOURCE_ENTRY });
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return observable;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=performanceEntriesMonitor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"performanceEntriesMonitor.js","sourceRoot":"","sources":["../../../../src/instrumentations/userActions/performanceEntriesMonitor.ts"],"names":[],"mappings":";;AAOA,8DAUC;AAjBD,gDAAgD;AAEhD,kEAAgF;AAChF,4EAAqE;AAErE,iCAAsD;AAEtD,SAAgB,yBAAyB;IACvC,IAAM,UAAU,GAAG,IAAI,sBAAU,EAAE,CAAC;IAEpC,gDAA8B,CAAC,SAAS,CAAC,UAAC,IAAI;QAC5C,IAAI,IAAI,CAAC,IAAI,KAAK,qCAAc,EAAE,CAAC;YACjC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,mCAA2B,EAAE,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { Observable } from '@grafana/faro-core';\n\nimport { performanceEntriesSubscription } from '../performance/instrumentation';\nimport { RESOURCE_ENTRY } from '../performance/performanceConstants';\n\nimport { MESSAGE_TYPE_RESOURCE_ENTRY } from './const';\n\nexport function monitorPerformanceEntries(): Observable {\n const observable = new Observable();\n\n performanceEntriesSubscription.subscribe((data) => {\n if (data.type === RESOURCE_ENTRY) {\n observable.notify({ type: MESSAGE_TYPE_RESOURCE_ENTRY });\n }\n });\n\n return observable;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instrumentations/userActions/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n MESSAGE_TYPE_DOM_MUTATION,\n MESSAGE_TYPE_HTTP_REQUEST_END,\n MESSAGE_TYPE_HTTP_REQUEST_START,\n} from './const';\n\nexport type DomMutationMessage = {\n type: typeof MESSAGE_TYPE_DOM_MUTATION;\n};\n\ntype RequestApiType = 'xhr' | 'fetch';\n\nexport type HttpRequestMessagePayload = {\n requestId: string;\n url: string;\n method: string;\n apiType: RequestApiType;\n};\n\nexport type HttpRequestStartMessage = {\n type: typeof MESSAGE_TYPE_HTTP_REQUEST_START;\n request: HttpRequestMessagePayload;\n};\n\nexport type HttpRequestEndMessage = {\n type: typeof MESSAGE_TYPE_HTTP_REQUEST_END;\n request: HttpRequestMessagePayload;\n};\n"]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebVitalsBasic = void 0;
|
|
4
|
-
var web_vitals_1 = require("web-vitals");
|
|
5
|
-
var WebVitalsBasic = /** @class */ (function () {
|
|
6
|
-
function WebVitalsBasic(pushMeasurement, webVitalConfig) {
|
|
7
|
-
this.pushMeasurement = pushMeasurement;
|
|
8
|
-
this.webVitalConfig = webVitalConfig;
|
|
9
|
-
}
|
|
10
|
-
WebVitalsBasic.prototype.initialize = function () {
|
|
11
|
-
var _this = this;
|
|
12
|
-
Object.entries(WebVitalsBasic.mapping).forEach(function (_a) {
|
|
13
|
-
var _b;
|
|
14
|
-
var indicator = _a[0], executor = _a[1];
|
|
15
|
-
executor(function (metric) {
|
|
16
|
-
var _a;
|
|
17
|
-
_this.pushMeasurement({
|
|
18
|
-
type: 'web-vitals',
|
|
19
|
-
values: (_a = {},
|
|
20
|
-
_a[indicator] = metric.value,
|
|
21
|
-
_a),
|
|
22
|
-
});
|
|
23
|
-
}, { reportAllChanges: (_b = _this.webVitalConfig) === null || _b === void 0 ? void 0 : _b.reportAllChanges });
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
WebVitalsBasic.mapping = {
|
|
27
|
-
cls: web_vitals_1.onCLS,
|
|
28
|
-
fcp: web_vitals_1.onFCP,
|
|
29
|
-
inp: web_vitals_1.onINP,
|
|
30
|
-
lcp: web_vitals_1.onLCP,
|
|
31
|
-
ttfb: web_vitals_1.onTTFB,
|
|
32
|
-
};
|
|
33
|
-
return WebVitalsBasic;
|
|
34
|
-
}());
|
|
35
|
-
exports.WebVitalsBasic = WebVitalsBasic;
|
|
36
|
-
//# sourceMappingURL=webVitalsBasic.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webVitalsBasic.js","sourceRoot":"","sources":["../../../../src/instrumentations/webVitals/webVitalsBasic.ts"],"names":[],"mappings":";;;AAAA,yCAAgE;AAIhE;IASE,wBACU,eAAmD,EACnD,cAAmD;QADnD,oBAAe,GAAf,eAAe,CAAoC;QACnD,mBAAc,GAAd,cAAc,CAAqC;IAC1D,CAAC;IAEJ,mCAAU,GAAV;QAAA,iBAeC;QAdC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAC,EAAqB;;gBAApB,SAAS,QAAA,EAAE,QAAQ,QAAA;YAClE,QAAQ,CACN,UAAC,MAAM;;gBACL,KAAI,CAAC,eAAe,CAAC;oBACnB,IAAI,EAAE,YAAY;oBAElB,MAAM;wBACJ,GAAC,SAAS,IAAG,MAAM,CAAC,KAAK;2BAC1B;iBACF,CAAC,CAAC;YACL,CAAC,EACD,EAAE,gBAAgB,EAAE,MAAA,KAAI,CAAC,cAAc,0CAAE,gBAAgB,EAAE,CAC5D,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IA5BM,sBAAO,GAAG;QACf,GAAG,EAAE,kBAAK;QACV,GAAG,EAAE,kBAAK;QACV,GAAG,EAAE,kBAAK;QACV,GAAG,EAAE,kBAAK;QACV,IAAI,EAAE,mBAAM;KACb,CAAC;IAuBJ,qBAAC;CAAA,AA9BD,IA8BC;AA9BY,wCAAc","sourcesContent":["import { onCLS, onFCP, onINP, onLCP, onTTFB } from 'web-vitals';\n\nimport type { Config, MeasurementsAPI } from '@grafana/faro-core';\n\nexport class WebVitalsBasic {\n static mapping = {\n cls: onCLS,\n fcp: onFCP,\n inp: onINP,\n lcp: onLCP,\n ttfb: onTTFB,\n };\n\n constructor(\n private pushMeasurement: MeasurementsAPI['pushMeasurement'],\n private webVitalConfig?: Config['webVitalsInstrumentation']\n ) {}\n\n initialize(): void {\n Object.entries(WebVitalsBasic.mapping).forEach(([indicator, executor]) => {\n executor(\n (metric) => {\n this.pushMeasurement({\n type: 'web-vitals',\n\n values: {\n [indicator]: metric.value,\n },\n });\n },\n { reportAllChanges: this.webVitalConfig?.reportAllChanges }\n );\n });\n }\n}\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Observable } from '@grafana/faro-core';
|
|
2
|
-
import { MESSAGE_TYPE_DOM_MUTATION } from './const';
|
|
3
|
-
export function monitorDomMutations() {
|
|
4
|
-
const observable = new Observable();
|
|
5
|
-
const observer = new MutationObserver((_mutationsList, _observer) => {
|
|
6
|
-
observable.notify({ type: MESSAGE_TYPE_DOM_MUTATION });
|
|
7
|
-
});
|
|
8
|
-
observer.observe(document, {
|
|
9
|
-
attributes: true,
|
|
10
|
-
childList: true,
|
|
11
|
-
subtree: true,
|
|
12
|
-
characterData: true,
|
|
13
|
-
});
|
|
14
|
-
return observable;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=domMutationMonitor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"domMutationMonitor.js","sourceRoot":"","sources":["../../../../src/instrumentations/userActions/domMutationMonitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAGpD,MAAM,UAAU,mBAAmB;IACjC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAsB,CAAC;IAExD,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,CAAC,cAAc,EAAE,SAAS,EAAE,EAAE;QAClE,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,yBAAyB,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE;QACzB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;QACb,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { Observable } from '@grafana/faro-core';\n\nimport { MESSAGE_TYPE_DOM_MUTATION } from './const';\nimport type { DomMutationMessage } from './types';\n\nexport function monitorDomMutations(): Observable {\n const observable = new Observable<DomMutationMessage>();\n\n const observer = new MutationObserver((_mutationsList, _observer) => {\n observable.notify({ type: MESSAGE_TYPE_DOM_MUTATION });\n });\n\n observer.observe(document, {\n attributes: true,\n childList: true,\n subtree: true,\n characterData: true,\n });\n\n return observable;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"httpRequestMonitor.js","sourceRoot":"","sources":["../../../../src/instrumentations/userActions/httpRequestMonitor.ts"],"names":[],"mappings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CAAC;QACvC,MAAM,MAAM,GAAG,CAAC,MAAA,SAAS,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QAE3C,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;QAE/B,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,cAAc,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,aAAa;aACjB,KAAK,CAAC,IAAI,EAAE,SAAgB,CAAC;aAC7B,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjB,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,YAAY,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;YAClE,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,YAAY,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;YAClE,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { genShortID, Observable } from '@grafana/faro-core';\n\nimport { getUrlFromResource, isUrlIgnored } from '../../utils/url';\n\nimport { MESSAGE_TYPE_HTTP_REQUEST_END, MESSAGE_TYPE_HTTP_REQUEST_START } from './const';\nimport type { HttpRequestEndMessage, HttpRequestMessagePayload, HttpRequestStartMessage } from './types';\n\ntype RequestProps = HttpRequestMessagePayload;\n\nconst apiTypeFetch = 'fetch';\nconst apiTypeXhr = 'xhr';\n\n/**\n * Monitors if any http requests are in progress.\n */\nexport function monitorHttpRequests(): Observable<HttpRequestStartMessage | HttpRequestEndMessage> {\n const observable = new Observable<HttpRequestStartMessage | HttpRequestEndMessage>();\n\n function emitStartMessage(requestProps: RequestProps) {\n observable.notify({\n type: MESSAGE_TYPE_HTTP_REQUEST_START,\n request: requestProps,\n });\n }\n\n function emitEndMessage(requestProps: RequestProps) {\n observable.notify({\n type: MESSAGE_TYPE_HTTP_REQUEST_END,\n request: requestProps,\n });\n }\n\n monitorFetch({\n onRequestStart: emitStartMessage,\n onRequestEnd: emitEndMessage,\n });\n\n monitorXhr({\n onRequestStart: emitStartMessage,\n onRequestEnd: emitEndMessage,\n });\n\n return observable;\n}\n\nfunction monitorXhr({\n onRequestStart,\n onRequestEnd,\n}: {\n onRequestStart: (props: RequestProps) => void;\n onRequestEnd: (props: RequestProps) => void;\n}) {\n const originalOpen = XMLHttpRequest.prototype.open;\n\n XMLHttpRequest.prototype.open = function () {\n const url = arguments[1];\n const isIgnoredUrl = isUrlIgnored(url);\n const method = arguments[0];\n\n const requestId = genShortID();\n\n // request has started to load data.\n this.addEventListener('loadstart', function () {\n if (!isIgnoredUrl) {\n onRequestStart({ url, method, requestId, apiType: apiTypeXhr });\n }\n });\n\n // transaction completes successfully.\n this.addEventListener('load', function () {\n if (!isIgnoredUrl) {\n onRequestEnd({ url, method, requestId, apiType: apiTypeXhr });\n }\n });\n\n this.addEventListener('error', function () {\n if (!isIgnoredUrl) {\n onRequestEnd({ url, method, requestId, apiType: apiTypeXhr });\n }\n });\n\n this.addEventListener('abort', function () {\n if (!isIgnoredUrl) {\n onRequestEnd({ url, method, requestId, apiType: apiTypeXhr });\n }\n });\n\n originalOpen.apply(this, arguments as any);\n };\n}\n\nfunction monitorFetch({\n onRequestEnd,\n onRequestStart,\n}: {\n onRequestStart: (props: RequestProps) => void;\n onRequestEnd: (props: RequestProps) => void;\n}) {\n const originalFetch = window.fetch;\n\n window.fetch = function () {\n const url = getUrlFromResource(arguments[0]) ?? '';\n const isIgnoredUrl = isUrlIgnored(url);\n const method = (arguments[1] ?? {}).method;\n\n const requestId = genShortID();\n\n if (!isIgnoredUrl) {\n onRequestStart({ url, method, requestId, apiType: apiTypeFetch });\n }\n\n return originalFetch\n .apply(this, arguments as any)\n .then((response) => {\n if (!isIgnoredUrl) {\n onRequestEnd({ url, method, requestId, apiType: apiTypeFetch });\n }\n return response;\n })\n .catch((error) => {\n if (!isIgnoredUrl) {\n onRequestEnd({ url, method, requestId, apiType: apiTypeFetch });\n }\n throw error;\n });\n };\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Observable } from '@grafana/faro-core';
|
|
2
|
-
import { performanceEntriesSubscription } from '../performance/instrumentation';
|
|
3
|
-
import { RESOURCE_ENTRY } from '../performance/performanceConstants';
|
|
4
|
-
import { MESSAGE_TYPE_RESOURCE_ENTRY } from './const';
|
|
5
|
-
export function monitorPerformanceEntries() {
|
|
6
|
-
const observable = new Observable();
|
|
7
|
-
performanceEntriesSubscription.subscribe((data) => {
|
|
8
|
-
if (data.type === RESOURCE_ENTRY) {
|
|
9
|
-
observable.notify({ type: MESSAGE_TYPE_RESOURCE_ENTRY });
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
return observable;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=performanceEntriesMonitor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"performanceEntriesMonitor.js","sourceRoot":"","sources":["../../../../src/instrumentations/userActions/performanceEntriesMonitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,UAAU,yBAAyB;IACvC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAEpC,8BAA8B,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;QAChD,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YACjC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,2BAA2B,EAAE,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { Observable } from '@grafana/faro-core';\n\nimport { performanceEntriesSubscription } from '../performance/instrumentation';\nimport { RESOURCE_ENTRY } from '../performance/performanceConstants';\n\nimport { MESSAGE_TYPE_RESOURCE_ENTRY } from './const';\n\nexport function monitorPerformanceEntries(): Observable {\n const observable = new Observable();\n\n performanceEntriesSubscription.subscribe((data) => {\n if (data.type === RESOURCE_ENTRY) {\n observable.notify({ type: MESSAGE_TYPE_RESOURCE_ENTRY });\n }\n });\n\n return observable;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instrumentations/userActions/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n MESSAGE_TYPE_DOM_MUTATION,\n MESSAGE_TYPE_HTTP_REQUEST_END,\n MESSAGE_TYPE_HTTP_REQUEST_START,\n} from './const';\n\nexport type DomMutationMessage = {\n type: typeof MESSAGE_TYPE_DOM_MUTATION;\n};\n\ntype RequestApiType = 'xhr' | 'fetch';\n\nexport type HttpRequestMessagePayload = {\n requestId: string;\n url: string;\n method: string;\n apiType: RequestApiType;\n};\n\nexport type HttpRequestStartMessage = {\n type: typeof MESSAGE_TYPE_HTTP_REQUEST_START;\n request: HttpRequestMessagePayload;\n};\n\nexport type HttpRequestEndMessage = {\n type: typeof MESSAGE_TYPE_HTTP_REQUEST_END;\n request: HttpRequestMessagePayload;\n};\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { onCLS, onFCP, onINP, onLCP, onTTFB } from 'web-vitals';
|
|
2
|
-
export class WebVitalsBasic {
|
|
3
|
-
constructor(pushMeasurement, webVitalConfig) {
|
|
4
|
-
this.pushMeasurement = pushMeasurement;
|
|
5
|
-
this.webVitalConfig = webVitalConfig;
|
|
6
|
-
}
|
|
7
|
-
initialize() {
|
|
8
|
-
Object.entries(WebVitalsBasic.mapping).forEach(([indicator, executor]) => {
|
|
9
|
-
var _a;
|
|
10
|
-
executor((metric) => {
|
|
11
|
-
this.pushMeasurement({
|
|
12
|
-
type: 'web-vitals',
|
|
13
|
-
values: {
|
|
14
|
-
[indicator]: metric.value,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
}, { reportAllChanges: (_a = this.webVitalConfig) === null || _a === void 0 ? void 0 : _a.reportAllChanges });
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
WebVitalsBasic.mapping = {
|
|
22
|
-
cls: onCLS,
|
|
23
|
-
fcp: onFCP,
|
|
24
|
-
inp: onINP,
|
|
25
|
-
lcp: onLCP,
|
|
26
|
-
ttfb: onTTFB,
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=webVitalsBasic.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webVitalsBasic.js","sourceRoot":"","sources":["../../../../src/instrumentations/webVitals/webVitalsBasic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAIhE,MAAM,OAAO,cAAc;IASzB,YACU,eAAmD,EACnD,cAAmD;QADnD,oBAAe,GAAf,eAAe,CAAoC;QACnD,mBAAc,GAAd,cAAc,CAAqC;IAC1D,CAAC;IAEJ,UAAU;QACR,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,EAAE;;YACvE,QAAQ,CACN,CAAC,MAAM,EAAE,EAAE;gBACT,IAAI,CAAC,eAAe,CAAC;oBACnB,IAAI,EAAE,YAAY;oBAElB,MAAM,EAAE;wBACN,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,KAAK;qBAC1B;iBACF,CAAC,CAAC;YACL,CAAC,EACD,EAAE,gBAAgB,EAAE,MAAA,IAAI,CAAC,cAAc,0CAAE,gBAAgB,EAAE,CAC5D,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;;AA5BM,sBAAO,GAAG;IACf,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACb,CAAC","sourcesContent":["import { onCLS, onFCP, onINP, onLCP, onTTFB } from 'web-vitals';\n\nimport type { Config, MeasurementsAPI } from '@grafana/faro-core';\n\nexport class WebVitalsBasic {\n static mapping = {\n cls: onCLS,\n fcp: onFCP,\n inp: onINP,\n lcp: onLCP,\n ttfb: onTTFB,\n };\n\n constructor(\n private pushMeasurement: MeasurementsAPI['pushMeasurement'],\n private webVitalConfig?: Config['webVitalsInstrumentation']\n ) {}\n\n initialize(): void {\n Object.entries(WebVitalsBasic.mapping).forEach(([indicator, executor]) => {\n executor(\n (metric) => {\n this.pushMeasurement({\n type: 'web-vitals',\n\n values: {\n [indicator]: metric.value,\n },\n });\n },\n { reportAllChanges: this.webVitalConfig?.reportAllChanges }\n );\n });\n }\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Config, MeasurementsAPI } from '@grafana/faro-core';
|
|
2
|
-
export declare class WebVitalsBasic {
|
|
3
|
-
private pushMeasurement;
|
|
4
|
-
private webVitalConfig?;
|
|
5
|
-
static mapping: {
|
|
6
|
-
cls: (onReport: (metric: import("web-vitals").CLSMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
|
|
7
|
-
fcp: (onReport: (metric: import("web-vitals").FCPMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
|
|
8
|
-
inp: (onReport: (metric: import("web-vitals").INPMetric) => void, opts?: import("web-vitals").INPReportOpts) => void;
|
|
9
|
-
lcp: (onReport: (metric: import("web-vitals").LCPMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
|
|
10
|
-
ttfb: (onReport: (metric: import("web-vitals").TTFBMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
|
|
11
|
-
};
|
|
12
|
-
constructor(pushMeasurement: MeasurementsAPI['pushMeasurement'], webVitalConfig?: Config['webVitalsInstrumentation']);
|
|
13
|
-
initialize(): void;
|
|
14
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|