Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@splitsoftware/browser-rum-agent

Package Overview
Dependencies
Maintainers
8
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@splitsoftware/browser-rum-agent - npm Package Compare versions

Comparing version 0.3.2-rc.1 to 0.3.2

4

CHANGES.txt

@@ -1,4 +0,4 @@

0.4.0 (October 12, 2023)
- BREAKING CHANGE: Updated the shape of the options object for the `webVitals` event collector. It no longer allows overwriting the default report options per metric.
0.3.2 (October 19, 2023)
- 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.
- Updated `web-vitals` dependency to version 3.5.0 that includes multiple fixes and improvements.
- Bugfixing - Fixed an issue with parsing error events, which caused the agent to not track errors occurring in scripts from different origins.

@@ -5,0 +5,0 @@

@@ -25,2 +25,3 @@ "use strict";

var WebVitals = __importStar(require("web-vitals"));
var isObject_1 = require("../../utils/isObject");
function convertWebVitalsMetricToSplitEvent(_a) {

@@ -42,3 +43,4 @@ var name = _a.name, value = _a.value, rating = _a.rating, navigationType = _a.navigationType;

function webVitals(options) {
if (options === void 0) { options = {
if (options === void 0) { options = {}; }
var _a = options.reportOptions, reportOptions = _a === void 0 ? {
onCLS: true,

@@ -50,9 +52,9 @@ onFCP: true,

onTTFB: true,
}; }
} : _a;
return function onWebVitals(ctx) {
Object.keys(options).forEach(function (key) {
if (options[key] && WebVitals[key]) {
Object.keys(reportOptions).forEach(function (key) {
if (reportOptions[key] && WebVitals[key]) {
WebVitals[key](function (metric) {
ctx.track(convertWebVitalsMetricToSplitEvent(metric));
});
}, (0, isObject_1.isObject)(reportOptions[key]) ? reportOptions[key] : undefined);
}

@@ -59,0 +61,0 @@ });

@@ -38,2 +38,2 @@ "use strict";

exports.userAgent = getUserAgent();
exports.languageVersion = 'jsrum-' + '0.3.2-rc.1';
exports.languageVersion = 'jsrum-' + '0.3.2';
// webVitals plugin uses the web-vital standard build.
import * as WebVitals from 'web-vitals';
import { isObject } from '../../utils/isObject';
export function convertWebVitalsMetricToSplitEvent(_a) {

@@ -18,3 +19,4 @@ var name = _a.name, value = _a.value, rating = _a.rating, navigationType = _a.navigationType;

export function webVitals(options) {
if (options === void 0) { options = {
if (options === void 0) { options = {}; }
var _a = options.reportOptions, reportOptions = _a === void 0 ? {
onCLS: true,

@@ -26,9 +28,9 @@ onFCP: true,

onTTFB: true,
}; }
} : _a;
return function onWebVitals(ctx) {
Object.keys(options).forEach(function (key) {
if (options[key] && WebVitals[key]) {
Object.keys(reportOptions).forEach(function (key) {
if (reportOptions[key] && WebVitals[key]) {
WebVitals[key](function (metric) {
ctx.track(convertWebVitalsMetricToSplitEvent(metric));
});
}, isObject(reportOptions[key]) ? reportOptions[key] : undefined);
}

@@ -35,0 +37,0 @@ });

@@ -31,2 +31,2 @@ /* eslint-disable compat/compat */

export var userAgent = getUserAgent();
export var languageVersion = 'jsrum-' + '0.3.2-rc.1';
export var languageVersion = 'jsrum-' + '0.3.2';
{
"name": "@splitsoftware/browser-rum-agent",
"version": "0.3.2-rc.1",
"version": "0.3.2",
"description": "Split Software RUM Agent for Browsers.",

@@ -5,0 +5,0 @@ "main": "cjs/index.js",

@@ -330,8 +330,10 @@ import type { ReportOpts } from 'web-vitals'

export interface IWebVitalsOptions {
onCLS?: boolean,
onFCP?: boolean,
onFID?: boolean,
onINP?: boolean,
onLCP?: boolean,
onTTFB?: boolean,
reportOptions?: {
onCLS?: boolean | ReportOpts,
onFCP?: boolean | ReportOpts,
onFID?: boolean | ReportOpts,
onINP?: boolean | ReportOpts,
onLCP?: boolean | ReportOpts,
onTTFB?: boolean | ReportOpts,
}
}

@@ -342,3 +344,3 @@

*
* By default it collects all Web-Vitals metrics, but you can specify which ones to collect by passing the corresponding options.
* By default it collects all web-vitals metrics, but you can specify which ones to collect by passing a `reportOptions` object.
*

@@ -348,5 +350,9 @@ * For example:

* SplitRumAgent.register(webVitals({
* // collects only Cumulative Layout Shift
* onCLS: true
* // other web-vital metrics are not collected
* reportOptions: {
* // collects only the core web-vitals
* onCLS: true,
* onFID: true,
* onLCP: true,
* // other web-vital metrics are not collected
* }
* }));

@@ -370,5 +376,5 @@ * ```

* ```
* { onCLS: true, onFCP: true, onFID: true, onINP: true, onLCP: true, onTTFB: true }
* { reportOptions: { onCLS: true, onFCP: true, onFID: true, onINP: true, onLCP: true, onTTFB: true } }
* ```
*/
export declare function webVitals(options?: IWebVitalsOptions): EventCollector;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc