@splitsoftware/browser-rum-agent
Advanced tools
Comparing version 0.3.2 to 0.4.0-rc.0
@@ -0,1 +1,5 @@ | ||
0.4.0 (XXX XX, 2023) | ||
- BREAKING CHANGES: | ||
- Removed `webVitals` event collector. It is now registered by default. | ||
0.3.2 (October 19, 2023) | ||
@@ -2,0 +6,0 @@ - Added user consent feature to allow delaying or disabling the event tracking until user consent is explicitly granted or declined. Read more in our docs. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.webVitals = exports.routeChanges = exports.tti = exports.SplitRumAgent = void 0; | ||
exports.routeChanges = exports.tti = exports.SplitRumAgent = void 0; | ||
// Create SplitRumAgent namespace and export it for ESM/CJS imports | ||
@@ -13,3 +13,1 @@ // Must use a named import to create the SplitRumAgent namespace (side effects) | ||
Object.defineProperty(exports, "routeChanges", { enumerable: true, get: function () { return routeChanges_1.routeChanges; } }); | ||
var webVitals_1 = require("./metrics/webVitals"); | ||
Object.defineProperty(exports, "webVitals", { enumerable: true, get: function () { return webVitals_1.webVitals; } }); |
@@ -39,3 +39,23 @@ "use strict"; | ||
/** | ||
* web-vitals metrics | ||
* Collects Web-Vitals metrics (https://www.npmjs.com/package/web-vitals). | ||
* | ||
* By default it collects all web-vitals metrics, but you can specify which ones to collect by passing a `reportOptions` object. | ||
* | ||
* Collected event format: | ||
* ``` | ||
* { | ||
* eventTypeId: 'webvitals.cls' | 'webvitals.fcp' | 'webvitals.fid' | 'webvitals.inp' | 'webvitals.lcp' | 'webvitals.ttfb', | ||
* value: number, | ||
* properties: { | ||
* rating: 'good' | 'needsImprovement' | 'poor', | ||
* navigationType: 'navigate' | 'reload' | 'back_forward' | 'back-forward-cache' | 'prerender' | 'restore' | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* @param {IWebVitalsOptions} options | ||
* @default | ||
* ``` | ||
* { reportOptions: { onCLS: true, onFCP: true, onFID: true, onINP: true, onLCP: true, onTTFB: true } } | ||
* ``` | ||
*/ | ||
@@ -42,0 +62,0 @@ function webVitals(options) { |
@@ -5,4 +5,3 @@ "use strict"; | ||
index_1.SplitRumAgent.routeChanges = index_1.routeChanges; | ||
index_1.SplitRumAgent.webVitals = index_1.webVitals; | ||
// eslint-disable-next-line import/no-default-export | ||
exports.default = index_1.SplitRumAgent; |
@@ -14,6 +14,7 @@ "use strict"; | ||
var constants_1 = require("./constants"); | ||
var validateEvent_1 = require("./validateEvent"); | ||
// Built-in event collectors | ||
var errors_1 = require("../metrics/errors"); | ||
var navigation_1 = require("../metrics/navigation"); | ||
var validateEvent_1 = require("./validateEvent"); | ||
var webVitals_1 = require("../metrics/webVitals"); | ||
// Browser support: | ||
@@ -47,2 +48,3 @@ // - ES5 syntax | ||
(0, errors_1.onError)(context), | ||
(0, webVitals_1.webVitals)()(context) | ||
]; | ||
@@ -49,0 +51,0 @@ // Post events periodically |
@@ -38,2 +38,2 @@ "use strict"; | ||
exports.userAgent = getUserAgent(); | ||
exports.languageVersion = 'jsrum-' + '0.3.2'; | ||
exports.languageVersion = 'jsrum-' + '0.4.0-rc.0'; |
@@ -7,2 +7,1 @@ // Create SplitRumAgent namespace and export it for ESM/CJS imports | ||
export { routeChanges } from './metrics/routeChanges'; | ||
export { webVitals } from './metrics/webVitals'; |
@@ -16,3 +16,23 @@ // webVitals plugin uses the web-vital standard build. | ||
/** | ||
* web-vitals metrics | ||
* Collects Web-Vitals metrics (https://www.npmjs.com/package/web-vitals). | ||
* | ||
* By default it collects all web-vitals metrics, but you can specify which ones to collect by passing a `reportOptions` object. | ||
* | ||
* Collected event format: | ||
* ``` | ||
* { | ||
* eventTypeId: 'webvitals.cls' | 'webvitals.fcp' | 'webvitals.fid' | 'webvitals.inp' | 'webvitals.lcp' | 'webvitals.ttfb', | ||
* value: number, | ||
* properties: { | ||
* rating: 'good' | 'needsImprovement' | 'poor', | ||
* navigationType: 'navigate' | 'reload' | 'back_forward' | 'back-forward-cache' | 'prerender' | 'restore' | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* @param {IWebVitalsOptions} options | ||
* @default | ||
* ``` | ||
* { reportOptions: { onCLS: true, onFCP: true, onFID: true, onINP: true, onLCP: true, onTTFB: true } } | ||
* ``` | ||
*/ | ||
@@ -19,0 +39,0 @@ export function webVitals(options) { |
@@ -1,5 +0,4 @@ | ||
import { SplitRumAgent, routeChanges, webVitals } from './index'; | ||
import { SplitRumAgent, routeChanges } from './index'; | ||
SplitRumAgent.routeChanges = routeChanges; | ||
SplitRumAgent.webVitals = webVitals; | ||
// eslint-disable-next-line import/no-default-export | ||
export default SplitRumAgent; |
@@ -11,6 +11,7 @@ import { setSchedule, flush, track } from './queue'; | ||
import { CONSENT_DECLINED, CONSENT_GRANTED } from './constants'; | ||
import { validateProperties } from './validateEvent'; | ||
// Built-in event collectors | ||
import { handleCustomErrors, onError } from '../metrics/errors'; | ||
import { onNavigationTimingMetrics } from '../metrics/navigation'; | ||
import { validateProperties } from './validateEvent'; | ||
import { webVitals } from '../metrics/webVitals'; | ||
// Browser support: | ||
@@ -44,2 +45,3 @@ // - ES5 syntax | ||
onError(context), | ||
webVitals()(context) | ||
]; | ||
@@ -46,0 +48,0 @@ // Post events periodically |
@@ -31,2 +31,2 @@ /* eslint-disable compat/compat */ | ||
export var userAgent = getUserAgent(); | ||
export var languageVersion = 'jsrum-' + '0.3.2'; | ||
export var languageVersion = 'jsrum-' + '0.4.0-rc.0'; |
{ | ||
"name": "@splitsoftware/browser-rum-agent", | ||
"version": "0.3.2", | ||
"version": "0.4.0-rc.0", | ||
"description": "Split Software RUM Agent for Browsers.", | ||
@@ -24,3 +24,4 @@ "main": "cjs/index.js", | ||
"check:types": "tsc -p ./config/tsconfig.json --noEmit", | ||
"test": "npm run test:karma && npm run test:jest", | ||
"test": "npm run test:ts-decls && npm run test:karma && npm run test:jest", | ||
"test:ts-decls": "tsc ts-tests/index.ts --noEmit", | ||
"test:karma": "karma start config/karma.config.js", | ||
@@ -27,0 +28,0 @@ "test:jest": "jest", |
@@ -37,6 +37,2 @@ # Split Browser RUM Agent | ||
## License | ||
Licensed under the Apache License, Version 2.0. See: [Apache License](http://www.apache.org/licenses/). | ||
## About Split | ||
@@ -56,4 +52,4 @@ | ||
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK) | ||
* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK) | ||
* Javascript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK) | ||
* JavaScript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK) | ||
* JavaScript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK) | ||
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK) | ||
@@ -60,0 +56,0 @@ * PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK) |
@@ -1,3 +0,1 @@ | ||
import type { ReportOpts } from 'web-vitals' | ||
/** | ||
@@ -328,50 +326,1 @@ * Type of a property value | ||
export declare function routeChanges(options?: IRouteChangesOptions): EventCollector; | ||
export interface IWebVitalsOptions { | ||
reportOptions?: { | ||
onCLS?: boolean | ReportOpts, | ||
onFCP?: boolean | ReportOpts, | ||
onFID?: boolean | ReportOpts, | ||
onINP?: boolean | ReportOpts, | ||
onLCP?: boolean | ReportOpts, | ||
onTTFB?: boolean | ReportOpts, | ||
} | ||
} | ||
/** | ||
* Collects Web-Vitals metrics (https://www.npmjs.com/package/web-vitals). | ||
* | ||
* By default it collects all web-vitals metrics, but you can specify which ones to collect by passing a `reportOptions` object. | ||
* | ||
* For example: | ||
* ``` | ||
* SplitRumAgent.register(webVitals({ | ||
* reportOptions: { | ||
* // collects only the core web-vitals | ||
* onCLS: true, | ||
* onFID: true, | ||
* onLCP: true, | ||
* // other web-vital metrics are not collected | ||
* } | ||
* })); | ||
* ``` | ||
* | ||
* Collected event format: | ||
* ``` | ||
* { | ||
* eventTypeId: 'webvitals.cls' | 'webvitals.fcp' | 'webvitals.fid' | 'webvitals.inp' | 'webvitals.lcp' | 'webvitals.ttfb', | ||
* value: number, | ||
* properties: { | ||
* rating: 'good' | 'needsImprovement' | 'poor', | ||
* navigationType: 'navigate' | 'reload' | 'back_forward' | 'back-forward-cache' | 'prerender' | 'restore' | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* @param {IWebVitalsOptions} options | ||
* @default | ||
* ``` | ||
* { reportOptions: { onCLS: true, onFCP: true, onFID: true, onINP: true, onLCP: true, onTTFB: true } } | ||
* ``` | ||
*/ | ||
export declare function webVitals(options?: IWebVitalsOptions): EventCollector; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
124331
2663
66