@sentry/browser-utils 10.69.0 → 11.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/htmlTreeAsString.js.map +1 -1
- package/build/cjs/index.js +2 -1
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/metrics/browserMetrics.js +25 -91
- package/build/cjs/metrics/browserMetrics.js.map +1 -1
- package/build/cjs/metrics/inp.js +0 -57
- package/build/cjs/metrics/inp.js.map +1 -1
- package/build/cjs/metrics/lcp.js +0 -67
- package/build/cjs/metrics/lcp.js.map +1 -1
- package/build/cjs/metrics/userTiming.js +118 -0
- package/build/cjs/metrics/userTiming.js.map +1 -0
- package/build/cjs/metrics/utils.js +0 -43
- package/build/cjs/metrics/utils.js.map +1 -1
- package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js +2 -6
- package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js.map +1 -1
- package/build/cjs/metrics/web-vitals/lib/initUnique.js +1 -1
- package/build/cjs/metrics/web-vitals/lib/initUnique.js.map +1 -1
- package/build/cjs/metrics/web-vitals/lib/onHidden.js +3 -4
- package/build/cjs/metrics/web-vitals/lib/onHidden.js.map +1 -1
- package/build/cjs/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +1 -1
- package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js +0 -2
- package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js.map +1 -1
- package/build/cjs/metrics/webVitalSpans.js +25 -9
- package/build/cjs/metrics/webVitalSpans.js.map +1 -1
- package/build/esm/htmlTreeAsString.js.map +1 -1
- package/build/esm/index.js +2 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/metrics/browserMetrics.js +29 -94
- package/build/esm/metrics/browserMetrics.js.map +1 -1
- package/build/esm/metrics/inp.js +3 -57
- package/build/esm/metrics/inp.js.map +1 -1
- package/build/esm/metrics/lcp.js +1 -66
- package/build/esm/metrics/lcp.js.map +1 -1
- package/build/esm/metrics/userTiming.js +115 -0
- package/build/esm/metrics/userTiming.js.map +1 -0
- package/build/esm/metrics/utils.js +2 -44
- package/build/esm/metrics/utils.js.map +1 -1
- package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js +2 -6
- package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js.map +1 -1
- package/build/esm/metrics/web-vitals/lib/initUnique.js +1 -1
- package/build/esm/metrics/web-vitals/lib/initUnique.js.map +1 -1
- package/build/esm/metrics/web-vitals/lib/onHidden.js +3 -4
- package/build/esm/metrics/web-vitals/lib/onHidden.js.map +1 -1
- package/build/esm/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +1 -1
- package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js +0 -2
- package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js.map +1 -1
- package/build/esm/metrics/webVitalSpans.js +26 -10
- package/build/esm/metrics/webVitalSpans.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/metrics/browserMetrics.d.ts +5 -29
- package/build/types/metrics/browserMetrics.d.ts.map +1 -1
- package/build/types/metrics/inp.d.ts +0 -13
- package/build/types/metrics/inp.d.ts.map +1 -1
- package/build/types/metrics/lcp.d.ts +0 -16
- package/build/types/metrics/lcp.d.ts.map +1 -1
- package/build/types/metrics/userTiming.d.ts +37 -0
- package/build/types/metrics/userTiming.d.ts.map +1 -0
- package/build/types/metrics/utils.d.ts +1 -25
- package/build/types/metrics/utils.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/getCLS.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/getINP.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/getLCP.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/InteractionManager.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/LCPEntryManager.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/LayoutShiftManager.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/bindReporter.d.ts +1 -1
- package/build/types/metrics/web-vitals/lib/bindReporter.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/getNavigationEntry.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/getVisibilityWatcher.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/initMetric.d.ts +3 -3
- package/build/types/metrics/web-vitals/lib/initMetric.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/observe.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/onHidden.d.ts +4 -16
- package/build/types/metrics/web-vitals/lib/onHidden.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts +1 -1
- package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/runOnce.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/whenActivated.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/whenIdleOrHidden.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/onFCP.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/onTTFB.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/types.d.ts +1 -1
- package/build/types/metrics/web-vitals/types.d.ts.map +1 -1
- package/build/types/metrics/webVitalSpans.d.ts +15 -9
- package/build/types/metrics/webVitalSpans.d.ts.map +1 -1
- package/build/types/types.d.ts +1 -1
- package/package.json +6 -15
- package/build/cjs/metrics/cls.js +0 -64
- package/build/cjs/metrics/cls.js.map +0 -1
- package/build/esm/metrics/cls.js +0 -61
- package/build/esm/metrics/cls.js.map +0 -1
- package/build/types/metrics/cls.d.ts +0 -17
- package/build/types/metrics/cls.d.ts.map +0 -1
- package/build/types-ts3.8/debug-build.d.ts +0 -7
- package/build/types-ts3.8/getNativeImplementation.d.ts +0 -69
- package/build/types-ts3.8/htmlTreeAsString.d.ts +0 -11
- package/build/types-ts3.8/index.d.ts +0 -17
- package/build/types-ts3.8/instrument/dom.d.ts +0 -11
- package/build/types-ts3.8/instrument/history.d.ts +0 -15
- package/build/types-ts3.8/instrument/location.d.ts +0 -13
- package/build/types-ts3.8/instrument/xhr.d.ts +0 -14
- package/build/types-ts3.8/is.d.ts +0 -7
- package/build/types-ts3.8/metrics/browserMetrics.d.ts +0 -119
- package/build/types-ts3.8/metrics/cls.d.ts +0 -17
- package/build/types-ts3.8/metrics/elementTiming.d.ts +0 -21
- package/build/types-ts3.8/metrics/inp.d.ts +0 -35
- package/build/types-ts3.8/metrics/instrument.d.ts +0 -121
- package/build/types-ts3.8/metrics/lcp.d.ts +0 -22
- package/build/types-ts3.8/metrics/resourceTiming.d.ts +0 -13
- package/build/types-ts3.8/metrics/utils.d.ts +0 -73
- package/build/types-ts3.8/metrics/web-vitals/getCLS.d.ts +0 -26
- package/build/types-ts3.8/metrics/web-vitals/getINP.d.ts +0 -34
- package/build/types-ts3.8/metrics/web-vitals/getLCP.d.ts +0 -16
- package/build/types-ts3.8/metrics/web-vitals/lib/InteractionManager.d.ts +0 -37
- package/build/types-ts3.8/metrics/web-vitals/lib/LCPEntryManager.d.ts +0 -5
- package/build/types-ts3.8/metrics/web-vitals/lib/LayoutShiftManager.d.ts +0 -7
- package/build/types-ts3.8/metrics/web-vitals/lib/bindReporter.d.ts +0 -7
- package/build/types-ts3.8/metrics/web-vitals/lib/generateUniqueID.d.ts +0 -7
- package/build/types-ts3.8/metrics/web-vitals/lib/getActivationStart.d.ts +0 -2
- package/build/types-ts3.8/metrics/web-vitals/lib/getNavigationEntry.d.ts +0 -2
- package/build/types-ts3.8/metrics/web-vitals/lib/getVisibilityWatcher.d.ts +0 -5
- package/build/types-ts3.8/metrics/web-vitals/lib/globalListeners.d.ts +0 -11
- package/build/types-ts3.8/metrics/web-vitals/lib/initMetric.d.ts +0 -21
- package/build/types-ts3.8/metrics/web-vitals/lib/initUnique.d.ts +0 -7
- package/build/types-ts3.8/metrics/web-vitals/lib/observe.d.ts +0 -23
- package/build/types-ts3.8/metrics/web-vitals/lib/onHidden.d.ts +0 -27
- package/build/types-ts3.8/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts +0 -15
- package/build/types-ts3.8/metrics/web-vitals/lib/runOnce.d.ts +0 -2
- package/build/types-ts3.8/metrics/web-vitals/lib/whenActivated.d.ts +0 -2
- package/build/types-ts3.8/metrics/web-vitals/lib/whenIdleOrHidden.d.ts +0 -6
- package/build/types-ts3.8/metrics/web-vitals/onFCP.d.ts +0 -11
- package/build/types-ts3.8/metrics/web-vitals/onTTFB.d.ts +0 -20
- package/build/types-ts3.8/metrics/web-vitals/types/base.d.ts +0 -106
- package/build/types-ts3.8/metrics/web-vitals/types/cls.d.ts +0 -58
- package/build/types-ts3.8/metrics/web-vitals/types/fcp.d.ts +0 -47
- package/build/types-ts3.8/metrics/web-vitals/types/inp.d.ts +0 -150
- package/build/types-ts3.8/metrics/web-vitals/types/lcp.d.ts +0 -74
- package/build/types-ts3.8/metrics/web-vitals/types/ttfb.d.ts +0 -60
- package/build/types-ts3.8/metrics/web-vitals/types.d.ts +0 -78
- package/build/types-ts3.8/metrics/webVitalSpans.d.ts +0 -65
- package/build/types-ts3.8/networkUtils.d.ts +0 -28
- package/build/types-ts3.8/types.d.ts +0 -15
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
import type { Client } from '@sentry/core';
|
|
2
|
-
import type { WebVitalReportEvent } from './utils';
|
|
3
1
|
/**
|
|
4
2
|
* 60 seconds is the maximum for a plausible LCP value.
|
|
5
3
|
*/
|
|
6
4
|
export declare const MAX_PLAUSIBLE_LCP_DURATION = 60000;
|
|
7
5
|
export declare function isValidLcpMetric(lcpValue: number | undefined): lcpValue is number;
|
|
8
|
-
/**
|
|
9
|
-
* Starts tracking the Largest Contentful Paint on the current page and collects the value once
|
|
10
|
-
*
|
|
11
|
-
* - the page visibility is hidden
|
|
12
|
-
* - a navigation span is started (to stop LCP measurement for SPA soft navigations)
|
|
13
|
-
*
|
|
14
|
-
* Once either of these events triggers, the LCP value is sent as a standalone span and we stop
|
|
15
|
-
* measuring LCP for subsequent routes.
|
|
16
|
-
*/
|
|
17
|
-
export declare function trackLcpAsStandaloneSpan(client: Client): void;
|
|
18
|
-
/**
|
|
19
|
-
* Exported only for testing!
|
|
20
|
-
*/
|
|
21
|
-
export declare function _sendStandaloneLcpSpan(lcpValue: number, entry: LargestContentfulPaint | undefined, pageloadSpanId: string, reportEvent: WebVitalReportEvent): void;
|
|
22
6
|
//# sourceMappingURL=lcp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lcp.d.ts","sourceRoot":"","sources":["../../../src/metrics/lcp.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lcp.d.ts","sourceRoot":"","sources":["../../../src/metrics/lcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,IAAI,MAAM,CAEjF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Span } from '@sentry/core';
|
|
2
|
+
interface UserTimingOptions {
|
|
3
|
+
/**
|
|
4
|
+
* User Timing entries with names matching any of these strings or regular expressions will not be emitted.
|
|
5
|
+
*
|
|
6
|
+
* Default: []
|
|
7
|
+
*/
|
|
8
|
+
ignore?: Array<string | RegExp>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Captures spans created with the browser's User Timing APIs, `performance.mark` and `performance.measure`.
|
|
12
|
+
*
|
|
13
|
+
* The integration must be explicitly added to `Sentry.init`. Entries are attached to the active pageload or
|
|
14
|
+
* navigation span when it ends.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* Sentry.init({
|
|
19
|
+
* integrations: [
|
|
20
|
+
* Sentry.browserTracingIntegration(),
|
|
21
|
+
* Sentry.userTimingIntegration({
|
|
22
|
+
* ignore: ['third-party-mark', /framework-measure/],
|
|
23
|
+
* }),
|
|
24
|
+
* ],
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const userTimingIntegration: (options?: UserTimingOptions | undefined) => import("@sentry/core").Integration & {
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Creates a span for a browser User Timing entry.
|
|
33
|
+
* Exported only for tests.
|
|
34
|
+
*/
|
|
35
|
+
export declare function _addUserTimingSpan(parentSpan: Span, entry: PerformanceEntry, startTime: number, duration: number, timeOrigin: number, requestTime: number, ignore: Array<string | RegExp>): void;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=userTiming.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userTiming.d.ts","sourceRoot":"","sources":["../../../src/metrics/userTiming.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,IAAI,EAAsC,MAAM,cAAc,CAAC;AAW5F,UAAU,iBAAiB;IACzB;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACjC;AAsDD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qBAAqB;;CAA4C,CAAC;AAE/E;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,IAAI,EAChB,KAAK,EAAE,gBAAgB,EACvB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GAC7B,IAAI,CA6BN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Client, Span,
|
|
1
|
+
import type { Client, Span, SpanTimeInput, StartSpanOptions } from '@sentry/core';
|
|
2
2
|
export type WebVitalReportEvent = 'pagehide' | 'navigation';
|
|
3
3
|
/**
|
|
4
4
|
* Checks if a given value is a valid measurement value.
|
|
@@ -10,29 +10,6 @@ export declare function isMeasurementValue(value: unknown): value is number;
|
|
|
10
10
|
* start timestamp.
|
|
11
11
|
*/
|
|
12
12
|
export declare function startAndEndSpan(parentSpan: Span, startTimeInSeconds: number, endTime: SpanTimeInput, { ...ctx }: StartSpanOptions): Span | undefined;
|
|
13
|
-
interface StandaloneWebVitalSpanOptions {
|
|
14
|
-
name: string;
|
|
15
|
-
transaction?: string;
|
|
16
|
-
attributes: SpanAttributes;
|
|
17
|
-
startTime: number;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Starts an inactive, standalone span used to send web vital values to Sentry.
|
|
21
|
-
* DO NOT use this for arbitrary spans, as these spans require special handling
|
|
22
|
-
* during ingestion to extract metrics.
|
|
23
|
-
*
|
|
24
|
-
* This function adds a bunch of attributes and data to the span that's shared
|
|
25
|
-
* by all web vital standalone spans. However, you need to take care of adding
|
|
26
|
-
* the actual web vital value as an event to the span. Also, you need to assign
|
|
27
|
-
* a transaction name and some other values that are specific to the web vital.
|
|
28
|
-
*
|
|
29
|
-
* Ultimately, you also need to take care of ending the span to send it off.
|
|
30
|
-
*
|
|
31
|
-
* @param options
|
|
32
|
-
*
|
|
33
|
-
* @returns an inactive, standalone and NOT YET ended span
|
|
34
|
-
*/
|
|
35
|
-
export declare function startStandaloneWebVitalSpan(options: StandaloneWebVitalSpanOptions): Span | undefined;
|
|
36
13
|
/** Get the browser performance API. */
|
|
37
14
|
export declare function getBrowserPerformanceAPI(): Performance | undefined;
|
|
38
15
|
/**
|
|
@@ -69,5 +46,4 @@ export declare function supportsWebVital(entryType: 'layout-shift' | 'largest-co
|
|
|
69
46
|
* - pageloadSpan: the pageload span instance. This is used for full access to the pageload span for span streaming.
|
|
70
47
|
*/
|
|
71
48
|
export declare function listenForWebVitalReportEvents(client: Client, collectorCallback: (event: WebVitalReportEvent, pageloadSpanId: string, pageloadSpan?: Span) => void): void;
|
|
72
|
-
export {};
|
|
73
49
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/metrics/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/metrics/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAc,IAAI,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAK9F,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,YAAY,CAAC;AAE5D;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAElE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,IAAI,EAChB,kBAAkB,EAAE,MAAM,EAC1B,OAAO,EAAE,aAAa,EACtB,EAAE,GAAG,GAAG,EAAE,EAAE,gBAAgB,GAC3B,IAAI,GAAG,SAAS,CAsBlB;AAED,uCAAuC;AACvC,wBAAgB,wBAAwB,IAAI,WAAW,GAAG,SAAS,CAGlE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAuBjG;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,cAAc,GAAG,0BAA0B,GAAG,OAAO,CAMhG;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,CAAC,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,IAAI,KAAK,IAAI,QA8BrG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCLS.d.ts","sourceRoot":"","sources":["../../../../src/metrics/web-vitals/getCLS.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE7E,oFAAoF;AACpF,eAAO,MAAM,aAAa,EAAE,sBAAoC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"getCLS.d.ts","sourceRoot":"","sources":["../../../../src/metrics/web-vitals/getCLS.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE7E,oFAAoF;AACpF,eAAO,MAAM,aAAa,EAAE,sBAAoC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,KAAK,aAAc,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,SAAQ,UAAU,SAyC5E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getINP.d.ts","sourceRoot":"","sources":["../../../../src/metrics/web-vitals/getINP.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEhF,oFAAoF;AACpF,eAAO,MAAM,aAAa,EAAE,sBAAmC,CAAC;AAMhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"getINP.d.ts","sourceRoot":"","sources":["../../../../src/metrics/web-vitals/getINP.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEhF,oFAAoF;AACpF,eAAO,MAAM,aAAa,EAAE,sBAAmC,CAAC;AAMhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,KAAK,aAAc,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,SAAQ,aAAa,SA+D/E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLCP.d.ts","sourceRoot":"","sources":["../../../../src/metrics/web-vitals/getLCP.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE7E,oFAAoF;AACpF,eAAO,MAAM,aAAa,EAAE,sBAAqC,CAAC;AAElE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"getLCP.d.ts","sourceRoot":"","sources":["../../../../src/metrics/web-vitals/getLCP.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE7E,oFAAoF;AACpF,eAAO,MAAM,aAAa,EAAE,sBAAqC,CAAC;AAElE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,aAAc,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,SAAQ,UAAU,SAwE5E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractionManager.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/InteractionManager.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IAKjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,sBAAsB,EAAE,CAAC;CACnC;AAkBD;;GAEG;AACH,qBAAa,kBAAkB;IAC7B;;;;OAIG;IAEH,uBAAuB,EAAE,WAAW,EAAE,CAAM;IAE5C;;;OAGG;IAEH,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAa;IAG7D,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAGnE,8BAA8B,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,CAAC;IAGpE,kBAAkB;
|
|
1
|
+
{"version":3,"file":"InteractionManager.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/InteractionManager.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IAKjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,sBAAsB,EAAE,CAAC;CACnC;AAkBD;;GAEG;AACH,qBAAa,kBAAkB;IAC7B;;;;OAIG;IAEH,uBAAuB,EAAE,WAAW,EAAE,CAAM;IAE5C;;;OAGG;IAEH,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAa;IAG7D,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAGnE,8BAA8B,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,CAAC;IAGpE,kBAAkB,SAIjB;IAED;;;OAGG;IAEH,8BAA8B,4BAO7B;IAED;;;;;OAKG;IAEH,aAAa,CAAC,KAAK,EAAE,sBAAsB,QAoD1C;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LCPEntryManager.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/LCPEntryManager.ts"],"names":[],"mappings":"AAiBA,qBAAa,eAAe;IAE1B,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAGnE,aAAa,CAAC,KAAK,EAAE,sBAAsB;
|
|
1
|
+
{"version":3,"file":"LCPEntryManager.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/LCPEntryManager.ts"],"names":[],"mappings":"AAiBA,qBAAa,eAAe;IAE1B,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAGnE,aAAa,CAAC,KAAK,EAAE,sBAAsB,QAE1C;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutShiftManager.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/LayoutShiftManager.ts"],"names":[],"mappings":"AAiBA,qBAAa,kBAAkB;IAE7B,iCAAiC,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAGjE,aAAa,SAAK;IAElB,eAAe,EAAE,WAAW,EAAE,CAAM;IAGpC,aAAa,CAAC,KAAK,EAAE,WAAW;
|
|
1
|
+
{"version":3,"file":"LayoutShiftManager.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/LayoutShiftManager.ts"],"names":[],"mappings":"AAiBA,qBAAa,kBAAkB;IAE7B,iCAAiC,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAGjE,aAAa,SAAK;IAElB,eAAe,EAAE,WAAW,EAAE,CAAM;IAGpC,aAAa,CAAC,KAAK,EAAE,WAAW,QA2B/B;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MetricRatingThresholds, MetricType } from '../types';
|
|
2
|
-
export declare const bindReporter: <MetricName extends MetricType[
|
|
2
|
+
export declare const bindReporter: <MetricName extends MetricType['name']>(callback: (metric: Extract<MetricType, {
|
|
3
3
|
name: MetricName;
|
|
4
4
|
}>) => void, metric: Extract<MetricType, {
|
|
5
5
|
name: MetricName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindReporter.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/bindReporter.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAYnE,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,UAAU,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"bindReporter.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/bindReporter.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAYnE,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,UAAU,CAAC,MAAM,CAAC,YACtD,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,KAAK,IAAI,UAC7D,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,cACrC,sBAAsB,qBACf,OAAO,oBAIJ,OAAO,SAkB9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNavigationEntry.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/getNavigationEntry.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"getNavigationEntry.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/getNavigationEntry.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,kBAAkB,oCAAgC,2BAA2B,GAAG,IAiB5F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVisibilityWatcher.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/getVisibilityWatcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getVisibilityWatcher.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/getVisibilityWatcher.ts"],"names":[],"mappings":"AA8DA,eAAO,MAAM,oBAAoB;aA4BzB,eAAe;IAGnB,QAAQ,KAAK,MAAM,IAAI;CAI1B,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { MetricType } from '../types';
|
|
2
|
-
export declare const initMetric: <MetricName extends MetricType[
|
|
2
|
+
export declare const initMetric: <MetricName extends MetricType['name']>(name: MetricName, value?: number) => {
|
|
3
3
|
name: MetricName;
|
|
4
4
|
value: number;
|
|
5
|
-
rating:
|
|
5
|
+
rating: 'good';
|
|
6
6
|
delta: number;
|
|
7
7
|
entries: (Extract<import("../types").CLSMetric, {
|
|
8
8
|
name: MetricName;
|
|
@@ -16,6 +16,6 @@ export declare const initMetric: <MetricName extends MetricType["name"]>(name: M
|
|
|
16
16
|
name: MetricName;
|
|
17
17
|
}>)["entries"];
|
|
18
18
|
id: string;
|
|
19
|
-
navigationType: "
|
|
19
|
+
navigationType: "back-forward" | "back-forward-cache" | "navigate" | "prerender" | "reload" | "restore";
|
|
20
20
|
};
|
|
21
21
|
//# sourceMappingURL=initMetric.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initMetric.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/initMetric.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3C,eAAO,MAAM,UAAU,GAAI,UAAU,SAAS,UAAU,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"initMetric.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/initMetric.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3C,eAAO,MAAM,UAAU,GAAI,UAAU,SAAS,UAAU,CAAC,MAAM,CAAC,QAAQ,UAAU,UAAS,MAAM;;;YAoBrF,MAAM;;;cAL2B,UAAU;;;;;;;;;;;;CAWtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/observe.ts"],"names":[],"mappings":"AAgBA,UAAU,mBAAmB;IAC3B,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,aAAa,EAAE,sBAAsB,EAAE,CAAC;IACxC,cAAc,EAAE,WAAW,EAAE,CAAC;IAC9B,0BAA0B,EAAE,sBAAsB,EAAE,CAAC;IACrD,sBAAsB,EAAE,mCAAmC,EAAE,CAAC;IAC9D,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,UAAU,EAAE,2BAA2B,EAAE,CAAC;IAC1C,QAAQ,EAAE,yBAAyB,EAAE,CAAC;IAKtC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAG7B,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/observe.ts"],"names":[],"mappings":"AAgBA,UAAU,mBAAmB;IAC3B,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,aAAa,EAAE,sBAAsB,EAAE,CAAC;IACxC,cAAc,EAAE,WAAW,EAAE,CAAC;IAC9B,0BAA0B,EAAE,sBAAsB,EAAE,CAAC;IACrD,sBAAsB,EAAE,mCAAmC,EAAE,CAAC;IAC9D,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,UAAU,EAAE,2BAA2B,EAAE,CAAC;IAC1C,QAAQ,EAAE,yBAAyB,EAAE,CAAC;IAKtC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAG7B,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,mBAAmB,QACnD,CAAC,YACG,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,SAC7C,uBAAuB,KAC5B,mBAAmB,GAAG,SAmBxB,CAAC"}
|
|
@@ -2,24 +2,12 @@ export interface OnHiddenCallback {
|
|
|
2
2
|
(event: Event): void;
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Calls the passed callback when the page transitions to hidden.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Uses the `visibilitychange` event exclusively, which is well-supported
|
|
8
|
+
* across all modern browsers.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* https://github.com/GoogleChrome/web-vitals/pull/442/files#r1530492402
|
|
12
|
-
*
|
|
13
|
-
* The PR removed listening to the `pagehide` event, in favour of only listening to
|
|
14
|
-
* the `visibilitychange` event. This is "more correct" but some browsers we still
|
|
15
|
-
* support (Safari <14.4) don't fully support `visibilitychange` or have known bugs
|
|
16
|
-
* with respect to the `visibilitychange` event.
|
|
17
|
-
*
|
|
18
|
-
* TODO (v11): If we decide to drop support for Safari 14.4, we can use the logic
|
|
19
|
-
* from web-vitals 4.2.4. In this case, we also need to update the integration tests
|
|
20
|
-
* that currently trigger the `pagehide` event to simulate the page being hidden.
|
|
21
|
-
*
|
|
22
|
-
* @param {OnHiddenCallback} cb - Callback to be executed when the page is hidden or unloaded.
|
|
10
|
+
* @param {OnHiddenCallback} cb - Callback to be executed when the page is hidden.
|
|
23
11
|
*
|
|
24
12
|
* @deprecated use `whenIdleOrHidden` or `addPageListener('visibilitychange')` instead
|
|
25
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onHidden.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/onHidden.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,gBAAgB;IAC/B,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACtB;AAED
|
|
1
|
+
{"version":3,"file":"onHidden.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/onHidden.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,gBAAgB;IAC/B,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACtB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,OAAQ,gBAAgB,SAQ5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionCountPolyfill.d.ts","sourceRoot":"","sources":["../../../../../../src/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.ts"],"names":[],"mappings":"AAkBA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,WAAW;QACnB,gBAAgB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"interactionCountPolyfill.d.ts","sourceRoot":"","sources":["../../../../../../src/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.ts"],"names":[],"mappings":"AAkBA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,WAAW;QACnB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;KACnC;CACF;AAmBD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAO,MAEtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,QAAO,IAQ/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runOnce.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/runOnce.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"runOnce.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/runOnce.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,OAAO,OAAQ,MAAM,IAAI,eAQrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whenActivated.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/whenActivated.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"whenActivated.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/whenActivated.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,aAAa,aAAc,MAAM,IAAI,SAMjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whenIdleOrHidden.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/whenIdleOrHidden.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"whenIdleOrHidden.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/web-vitals/lib/whenIdleOrHidden.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,OAAQ,MAAM,IAAI,SAkB9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onFCP.d.ts","sourceRoot":"","sources":["../../../../src/metrics/web-vitals/onFCP.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE7E,oFAAoF;AACpF,eAAO,MAAM,aAAa,EAAE,sBAAqC,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"onFCP.d.ts","sourceRoot":"","sources":["../../../../src/metrics/web-vitals/onFCP.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE7E,oFAAoF;AACpF,eAAO,MAAM,aAAa,EAAE,sBAAqC,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,KAAK,aAAc,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,SAAQ,UAAU,SA+B5E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onTTFB.d.ts","sourceRoot":"","sources":["../../../../src/metrics/web-vitals/onTTFB.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE9E,uFAAuF;AACvF,eAAO,MAAM,cAAc,EAAE,sBAAoC,CAAC;AAiBlE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"onTTFB.d.ts","sourceRoot":"","sources":["../../../../src/metrics/web-vitals/onTTFB.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE9E,uFAAuF;AACvF,eAAO,MAAM,cAAc,EAAE,sBAAoC,CAAC;AAiBlE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,MAAM,aAAc,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,SAAQ,UAAU,SAkB9E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/metrics/web-vitals/types.ts"],"names":[],"mappings":"AAgBA,cAAc,cAAc,CAAC;AAE7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAM7B,UAAU,mBAAmB;IAC3B,UAAU,EAAE,2BAA2B,CAAC;IACxC,QAAQ,EAAE,yBAAyB,CAAC;IACpC,KAAK,EAAE,sBAAsB,CAAC;CAC/B;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,QAAQ;QAEhB,YAAY,CAAC,EAAE,OAAO,CAAC;QAEvB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB;IAED,UAAU,WAAW;QACnB,gBAAgB,CAAC,CAAC,SAAS,MAAM,mBAAmB,EAAE,IAAI,EAAE,C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QACpC,QAAQ,CAAC,aAAa,EAAE,mBAAmB,CAAC;QAC5C,QAAQ,CAAC,4BAA4B,EAAE,mBAAmB,CAAC;QAC3D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;KACrD;IAGD,UAAU,mCAAoC,SAAQ,gBAAgB;QACpE,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;QACxC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;QACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;QAC1C,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;QAClD,QAAQ,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;QAC/C,QAAQ,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;QACpD,QAAQ,CAAC,OAAO,EAAE,uBAAuB,EAAE,CAAC;KAC7C;CACF"}
|
|
@@ -27,9 +27,18 @@ interface WebVitalSpanOptions {
|
|
|
27
27
|
reportEvent?: WebVitalReportEvent;
|
|
28
28
|
startTime: number;
|
|
29
29
|
endTime?: number;
|
|
30
|
+
/**
|
|
31
|
+
* When `true`, the span is sent on its own as a v2 streamed span instead of being folded into a
|
|
32
|
+
* transaction. Used for INP when span streaming is disabled (it reports late, so it can't ride
|
|
33
|
+
* the pageload transaction).
|
|
34
|
+
*
|
|
35
|
+
* TODO(standalone): remove once the static (transaction) trace lifecycle is dropped and INP always streams.
|
|
36
|
+
*/
|
|
37
|
+
standalone?: boolean;
|
|
30
38
|
}
|
|
31
39
|
/**
|
|
32
|
-
* Emits a web vital span
|
|
40
|
+
* Emits a web vital span. When `standalone` is set it is sent on its own as a v2 streamed span;
|
|
41
|
+
* otherwise it flows through the span streaming pipeline as a child of `parentSpan`.
|
|
33
42
|
*/
|
|
34
43
|
export declare function _emitWebVitalSpan(options: WebVitalSpanOptions): void;
|
|
35
44
|
/**
|
|
@@ -49,17 +58,14 @@ export declare function trackClsAsSpan(client: Client): void;
|
|
|
49
58
|
*/
|
|
50
59
|
export declare function _sendClsSpan(clsValue: number, entry: LayoutShift | undefined, pageloadSpan?: Span, reportEvent?: WebVitalReportEvent): void;
|
|
51
60
|
/**
|
|
52
|
-
* Tracks INP as a
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* spans through the streaming pipeline instead of as standalone spans.
|
|
56
|
-
* Requires `registerInpInteractionListener()` to be called separately for
|
|
57
|
-
* cached element names and root spans per interaction.
|
|
61
|
+
* Tracks INP and emits it as a web vital span, as a child of the interaction's root span.
|
|
62
|
+
* Requires `registerInpInteractionListener()` to be called separately for cached element names and
|
|
63
|
+
* root spans per interaction.
|
|
58
64
|
*/
|
|
59
|
-
export declare function trackInpAsSpan(): void;
|
|
65
|
+
export declare function trackInpAsSpan(client: Client): void;
|
|
60
66
|
/**
|
|
61
67
|
* Exported only for testing.
|
|
62
68
|
*/
|
|
63
|
-
export declare function _sendInpSpan(inpValue: number, entry: PerformanceEventTiming): void;
|
|
69
|
+
export declare function _sendInpSpan(inpValue: number, entry: PerformanceEventTiming, standalone?: boolean): void;
|
|
64
70
|
export {};
|
|
65
71
|
//# sourceMappingURL=webVitalSpans.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webVitalSpans.d.ts","sourceRoot":"","sources":["../../../src/metrics/webVitalSpans.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"webVitalSpans.d.ts","sourceRoot":"","sources":["../../../src/metrics/webVitalSpans.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,IAAI,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAuB9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,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AE,sBAAsB,GAAG,SAAS,EACzC,YAAY,CAAC,EAAE,IAAI,EACnB,WAAW,CAAC,EAAE,mBAAmB,GAChC,IAAI,CAiCN;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAqBnD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,WAAW,GAAG,SAAS,EAC9B,YAAY,CAAC,EAAE,IAAI,EACnB,WAAW,CAAC,EAAE,mBAAmB,GAChC,IAAI,CAyBN;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAkCnD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,EAAE,UAAU,UAAQ,GAAG,IAAI,CAkCtG"}
|
package/build/types/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FetchBreadcrumbHint, HandlerDataFetch, SentryWrappedXMLHttpRequest, XhrBreadcrumbHint } from '@sentry/core';
|
|
2
2
|
import { GLOBAL_OBJ } from '@sentry/core';
|
|
3
|
-
export declare const WINDOW: typeof GLOBAL_OBJ & Omit<Window,
|
|
3
|
+
export declare const WINDOW: typeof GLOBAL_OBJ & Omit<Window, 'document'> & Partial<Pick<Window, 'document'>>;
|
|
4
4
|
export type NetworkMetaWarning = 'MAYBE_JSON_TRUNCATED' | 'TEXT_TRUNCATED' | 'URL_SKIPPED' | 'BODY_PARSE_ERROR' | 'BODY_PARSE_TIMEOUT' | 'UNPARSEABLE_BODY_TYPE';
|
|
5
5
|
type RequestBody = null | Blob | BufferSource | FormData | URLSearchParams | string;
|
|
6
6
|
export type XhrHint = XhrBreadcrumbHint & {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/browser-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-alpha.0",
|
|
4
4
|
"description": "Browser Utilities for all Sentry JavaScript SDKs",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser-utils",
|
|
7
7
|
"author": "Sentry",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"/build"
|
|
@@ -29,34 +29,25 @@
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
"typesVersions": {
|
|
33
|
-
"<5.0": {
|
|
34
|
-
"build/types/index.d.ts": [
|
|
35
|
-
"build/types-ts3.8/index.d.ts"
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
32
|
"publishConfig": {
|
|
40
33
|
"access": "public"
|
|
41
34
|
},
|
|
42
35
|
"dependencies": {
|
|
43
|
-
"@sentry/core": "
|
|
36
|
+
"@sentry/core": "11.0.0-alpha.0",
|
|
44
37
|
"@sentry/conventions": "^0.16.0"
|
|
45
38
|
},
|
|
46
39
|
"scripts": {
|
|
47
40
|
"build": "run-p build:transpile build:types",
|
|
48
41
|
"build:dev": "yarn build",
|
|
49
42
|
"build:transpile": "rollup -c rollup.npm.config.mjs",
|
|
50
|
-
"build:types": "
|
|
51
|
-
"build:types:core": "tsc -p tsconfig.types.json",
|
|
52
|
-
"build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8",
|
|
43
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
53
44
|
"build:watch": "run-p build:transpile:watch",
|
|
54
45
|
"build:dev:watch": "run-p build:transpile:watch",
|
|
55
46
|
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
|
|
56
47
|
"build:tarball": "npm pack",
|
|
57
48
|
"clean": "rimraf build coverage sentry-browser-utils-*.tgz",
|
|
58
|
-
"lint:fix": "
|
|
59
|
-
"lint": "
|
|
49
|
+
"lint:fix": "oxlint . --fix --type-aware",
|
|
50
|
+
"lint": "oxlint . --type-aware",
|
|
60
51
|
"lint:es-compatibility": "es-check es2020 ./build/cjs/*.js && es-check es2020 ./build/esm/*.js --module",
|
|
61
52
|
"test:unit": "vitest run",
|
|
62
53
|
"test": "vitest run",
|
package/build/cjs/metrics/cls.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
|
|
3
|
-
const core = require('@sentry/core');
|
|
4
|
-
const debugBuild = require('../debug-build.js');
|
|
5
|
-
const htmlTreeAsString = require('../htmlTreeAsString.js');
|
|
6
|
-
const instrument = require('./instrument.js');
|
|
7
|
-
const utils = require('./utils.js');
|
|
8
|
-
|
|
9
|
-
function trackClsAsStandaloneSpan(client) {
|
|
10
|
-
let standaloneCLsValue = 0;
|
|
11
|
-
let standaloneClsEntry;
|
|
12
|
-
if (!utils.supportsWebVital("layout-shift")) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const cleanupClsHandler = instrument.addClsInstrumentationHandler(({ metric }) => {
|
|
16
|
-
const entry = metric.entries[metric.entries.length - 1];
|
|
17
|
-
if (!entry) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
standaloneCLsValue = metric.value;
|
|
21
|
-
standaloneClsEntry = entry;
|
|
22
|
-
}, true);
|
|
23
|
-
utils.listenForWebVitalReportEvents(client, (reportEvent, pageloadSpanId) => {
|
|
24
|
-
_sendStandaloneClsSpan(standaloneCLsValue, standaloneClsEntry, pageloadSpanId, reportEvent);
|
|
25
|
-
cleanupClsHandler();
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function _sendStandaloneClsSpan(clsValue, entry, pageloadSpanId, reportEvent) {
|
|
29
|
-
debugBuild.DEBUG_BUILD && core.debug.log(`Sending CLS span (${clsValue})`);
|
|
30
|
-
const startTime = entry ? utils.msToSec((core.browserPerformanceTimeOrigin() || 0) + entry.startTime) : core.timestampInSeconds();
|
|
31
|
-
const routeName = core.getCurrentScope().getScopeData().transactionName;
|
|
32
|
-
const name = entry ? htmlTreeAsString.htmlTreeAsString(entry.sources[0]?.node) : "Layout shift";
|
|
33
|
-
const attributes = {
|
|
34
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser.cls",
|
|
35
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "ui.webvital.cls",
|
|
36
|
-
[core.SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: 0,
|
|
37
|
-
// attach the pageload span id to the CLS span so that we can link them in the UI
|
|
38
|
-
"sentry.pageload.span_id": pageloadSpanId,
|
|
39
|
-
// describes what triggered the web vital to be reported
|
|
40
|
-
"sentry.report_event": reportEvent
|
|
41
|
-
};
|
|
42
|
-
if (entry?.sources) {
|
|
43
|
-
entry.sources.forEach((source, index) => {
|
|
44
|
-
attributes[`cls.source.${index + 1}`] = htmlTreeAsString.htmlTreeAsString(source.node);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
const span = utils.startStandaloneWebVitalSpan({
|
|
48
|
-
name,
|
|
49
|
-
transaction: routeName,
|
|
50
|
-
attributes,
|
|
51
|
-
startTime
|
|
52
|
-
});
|
|
53
|
-
if (span) {
|
|
54
|
-
span.addEvent("cls", {
|
|
55
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: "",
|
|
56
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: clsValue
|
|
57
|
-
});
|
|
58
|
-
span.end(startTime);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
exports._sendStandaloneClsSpan = _sendStandaloneClsSpan;
|
|
63
|
-
exports.trackClsAsStandaloneSpan = trackClsAsStandaloneSpan;
|
|
64
|
-
//# sourceMappingURL=cls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cls.js","sources":["../../../src/metrics/cls.ts"],"sourcesContent":["import type { Client, SpanAttributes } from '@sentry/core';\nimport {\n browserPerformanceTimeOrigin,\n debug,\n getCurrentScope,\n SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME,\n SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT,\n SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n timestampInSeconds,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { htmlTreeAsString } from '../htmlTreeAsString';\nimport { addClsInstrumentationHandler } from './instrument';\nimport type { WebVitalReportEvent } from './utils';\nimport { listenForWebVitalReportEvents, msToSec, startStandaloneWebVitalSpan, supportsWebVital } from './utils';\n\n/**\n * Starts tracking the Cumulative Layout Shift on the current page and collects the value once\n *\n * - the page visibility is hidden\n * - a navigation span is started (to stop CLS measurement for SPA soft navigations)\n *\n * Once either of these events triggers, the CLS value is sent as a standalone span and we stop\n * measuring CLS.\n */\nexport function trackClsAsStandaloneSpan(client: Client): void {\n let standaloneCLsValue = 0;\n let standaloneClsEntry: LayoutShift | undefined;\n\n if (!supportsWebVital('layout-shift')) {\n return;\n }\n\n const cleanupClsHandler = addClsInstrumentationHandler(({ metric }) => {\n const entry = metric.entries[metric.entries.length - 1] as LayoutShift | undefined;\n if (!entry) {\n return;\n }\n standaloneCLsValue = metric.value;\n standaloneClsEntry = entry;\n }, true);\n\n listenForWebVitalReportEvents(client, (reportEvent, pageloadSpanId) => {\n _sendStandaloneClsSpan(standaloneCLsValue, standaloneClsEntry, pageloadSpanId, reportEvent);\n cleanupClsHandler();\n });\n}\n\n/**\n * Exported only for testing!\n */\nexport function _sendStandaloneClsSpan(\n clsValue: number,\n entry: LayoutShift | undefined,\n pageloadSpanId: string,\n reportEvent: WebVitalReportEvent,\n) {\n DEBUG_BUILD && debug.log(`Sending CLS span (${clsValue})`);\n\n const startTime = entry ? msToSec((browserPerformanceTimeOrigin() || 0) + entry.startTime) : timestampInSeconds();\n const routeName = getCurrentScope().getScopeData().transactionName;\n\n const name = entry ? htmlTreeAsString(entry.sources[0]?.node) : 'Layout shift';\n\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser.cls',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.webvital.cls',\n [SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: 0,\n // attach the pageload span id to the CLS span so that we can link them in the UI\n 'sentry.pageload.span_id': pageloadSpanId,\n // describes what triggered the web vital to be reported\n 'sentry.report_event': reportEvent,\n };\n\n // Add CLS sources as span attributes to help with debugging layout shifts\n // See: https://developer.mozilla.org/en-US/docs/Web/API/LayoutShift/sources\n if (entry?.sources) {\n entry.sources.forEach((source, index) => {\n attributes[`cls.source.${index + 1}`] = htmlTreeAsString(source.node);\n });\n }\n\n const span = startStandaloneWebVitalSpan({\n name,\n transaction: routeName,\n attributes,\n startTime,\n });\n\n if (span) {\n span.addEvent('cls', {\n [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: '',\n [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: clsValue,\n });\n\n // LayoutShift performance entries always have a duration of 0, so we don't need to add `entry.duration` here\n // see: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/duration\n span.end(startTime);\n }\n}\n"],"names":["supportsWebVital","addClsInstrumentationHandler","listenForWebVitalReportEvents","DEBUG_BUILD","debug","msToSec","browserPerformanceTimeOrigin","timestampInSeconds","getCurrentScope","htmlTreeAsString","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SEN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ME, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
2
|
-
import { DEBUG_BUILD } from '../debug-build.js';
|
|
3
|
-
import { htmlTreeAsString } from '../htmlTreeAsString.js';
|
|
4
|
-
import { addClsInstrumentationHandler } from './instrument.js';
|
|
5
|
-
import { supportsWebVital, listenForWebVitalReportEvents, msToSec, startStandaloneWebVitalSpan } from './utils.js';
|
|
6
|
-
|
|
7
|
-
function trackClsAsStandaloneSpan(client) {
|
|
8
|
-
let standaloneCLsValue = 0;
|
|
9
|
-
let standaloneClsEntry;
|
|
10
|
-
if (!supportsWebVital("layout-shift")) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const cleanupClsHandler = addClsInstrumentationHandler(({ metric }) => {
|
|
14
|
-
const entry = metric.entries[metric.entries.length - 1];
|
|
15
|
-
if (!entry) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
standaloneCLsValue = metric.value;
|
|
19
|
-
standaloneClsEntry = entry;
|
|
20
|
-
}, true);
|
|
21
|
-
listenForWebVitalReportEvents(client, (reportEvent, pageloadSpanId) => {
|
|
22
|
-
_sendStandaloneClsSpan(standaloneCLsValue, standaloneClsEntry, pageloadSpanId, reportEvent);
|
|
23
|
-
cleanupClsHandler();
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function _sendStandaloneClsSpan(clsValue, entry, pageloadSpanId, reportEvent) {
|
|
27
|
-
DEBUG_BUILD && debug.log(`Sending CLS span (${clsValue})`);
|
|
28
|
-
const startTime = entry ? msToSec((browserPerformanceTimeOrigin() || 0) + entry.startTime) : timestampInSeconds();
|
|
29
|
-
const routeName = getCurrentScope().getScopeData().transactionName;
|
|
30
|
-
const name = entry ? htmlTreeAsString(entry.sources[0]?.node) : "Layout shift";
|
|
31
|
-
const attributes = {
|
|
32
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser.cls",
|
|
33
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: "ui.webvital.cls",
|
|
34
|
-
[SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: 0,
|
|
35
|
-
// attach the pageload span id to the CLS span so that we can link them in the UI
|
|
36
|
-
"sentry.pageload.span_id": pageloadSpanId,
|
|
37
|
-
// describes what triggered the web vital to be reported
|
|
38
|
-
"sentry.report_event": reportEvent
|
|
39
|
-
};
|
|
40
|
-
if (entry?.sources) {
|
|
41
|
-
entry.sources.forEach((source, index) => {
|
|
42
|
-
attributes[`cls.source.${index + 1}`] = htmlTreeAsString(source.node);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
const span = startStandaloneWebVitalSpan({
|
|
46
|
-
name,
|
|
47
|
-
transaction: routeName,
|
|
48
|
-
attributes,
|
|
49
|
-
startTime
|
|
50
|
-
});
|
|
51
|
-
if (span) {
|
|
52
|
-
span.addEvent("cls", {
|
|
53
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: "",
|
|
54
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: clsValue
|
|
55
|
-
});
|
|
56
|
-
span.end(startTime);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export { _sendStandaloneClsSpan, trackClsAsStandaloneSpan };
|
|
61
|
-
//# sourceMappingURL=cls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cls.js","sources":["../../../src/metrics/cls.ts"],"sourcesContent":["import type { Client, SpanAttributes } from '@sentry/core';\nimport {\n browserPerformanceTimeOrigin,\n debug,\n getCurrentScope,\n SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME,\n SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT,\n SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n timestampInSeconds,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { htmlTreeAsString } from '../htmlTreeAsString';\nimport { addClsInstrumentationHandler } from './instrument';\nimport type { WebVitalReportEvent } from './utils';\nimport { listenForWebVitalReportEvents, msToSec, startStandaloneWebVitalSpan, supportsWebVital } from './utils';\n\n/**\n * Starts tracking the Cumulative Layout Shift on the current page and collects the value once\n *\n * - the page visibility is hidden\n * - a navigation span is started (to stop CLS measurement for SPA soft navigations)\n *\n * Once either of these events triggers, the CLS value is sent as a standalone span and we stop\n * measuring CLS.\n */\nexport function trackClsAsStandaloneSpan(client: Client): void {\n let standaloneCLsValue = 0;\n let standaloneClsEntry: LayoutShift | undefined;\n\n if (!supportsWebVital('layout-shift')) {\n return;\n }\n\n const cleanupClsHandler = addClsInstrumentationHandler(({ metric }) => {\n const entry = metric.entries[metric.entries.length - 1] as LayoutShift | undefined;\n if (!entry) {\n return;\n }\n standaloneCLsValue = metric.value;\n standaloneClsEntry = entry;\n }, true);\n\n listenForWebVitalReportEvents(client, (reportEvent, pageloadSpanId) => {\n _sendStandaloneClsSpan(standaloneCLsValue, standaloneClsEntry, pageloadSpanId, reportEvent);\n cleanupClsHandler();\n });\n}\n\n/**\n * Exported only for testing!\n */\nexport function _sendStandaloneClsSpan(\n clsValue: number,\n entry: LayoutShift | undefined,\n pageloadSpanId: string,\n reportEvent: WebVitalReportEvent,\n) {\n DEBUG_BUILD && debug.log(`Sending CLS span (${clsValue})`);\n\n const startTime = entry ? msToSec((browserPerformanceTimeOrigin() || 0) + entry.startTime) : timestampInSeconds();\n const routeName = getCurrentScope().getScopeData().transactionName;\n\n const name = entry ? htmlTreeAsString(entry.sources[0]?.node) : 'Layout shift';\n\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser.cls',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.webvital.cls',\n [SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: 0,\n // attach the pageload span id to the CLS span so that we can link them in the UI\n 'sentry.pageload.span_id': pageloadSpanId,\n // describes what triggered the web vital to be reported\n 'sentry.report_event': reportEvent,\n };\n\n // Add CLS sources as span attributes to help with debugging layout shifts\n // See: https://developer.mozilla.org/en-US/docs/Web/API/LayoutShift/sources\n if (entry?.sources) {\n entry.sources.forEach((source, index) => {\n attributes[`cls.source.${index + 1}`] = htmlTreeAsString(source.node);\n });\n }\n\n const span = startStandaloneWebVitalSpan({\n name,\n transaction: routeName,\n attributes,\n startTime,\n });\n\n if (span) {\n span.addEvent('cls', {\n [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: '',\n [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: clsValue,\n });\n\n // LayoutShift performance entries always have a duration of 0, so we don't need to add `entry.duration` here\n // see: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/duration\n span.end(startTime);\n }\n}\n"],"names":[],"mappings":";;;;;;AA2BO,SAAS,yBAAyB,MAAA,EAAsB;AAC7D,EAAA,IAAI,kBAAA,GAAqB,CAAA;AACzB,EAAA,IAAI,kBAAA;AAEJ,EAAA,IAAI,CAAC,gBAAA,CAAiB,cAAc,CAAA,EAAG;AACrC,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,iBAAA,GAAoB,4BAAA,CAA6B,CAAC,EAAE,QAAO,KAAM;AACrE,IAAA,MAAM,QAAQ,MAAA,CAAO,OAAA,CAAQ,MAAA,CAAO,OAAA,CAAQ,SAAS,CAAC,CAAA;AACtD,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA;AAAA,IACF;AACA,IAAA,kBAAA,GAAqB,MAAA,CAAO,KAAA;AAC5B,IAAA,kBAAA,GAAqB,KAAA;AAAA,EACvB,GAAG,IAAI,CAAA;AAEP,EAAA,6BAAA,CAA8B,MAAA,EAAQ,CAAC,WAAA,EAAa,cAAA,KAAmB;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