@splitsoftware/browser-suite
Advanced tools
Comparing version 1.4.0 to 1.4.1-rc.0
@@ -0,1 +1,5 @@ | ||
1.5.0 (May 15, 2024) | ||
- Added a new configuration option called `rumAgent.register` to disable or configure the registration of event collectors in the RUM Agent. | ||
- Updated @splitsoftware/browser-rum-agent package to version 0.7.0. | ||
1.4.0 (May 10, 2024) | ||
@@ -2,0 +6,0 @@ - Updated @splitsoftware/splitio-browserjs package to version 0.14.0 that includes minor updates: |
@@ -7,7 +7,8 @@ "use strict"; | ||
var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants"); | ||
var browser_rum_agent_1 = require("@splitsoftware/browser-rum-agent"); | ||
var slim_1 = require("@splitsoftware/browser-rum-agent/slim"); | ||
var full_1 = require("@splitsoftware/splitio-browserjs/full"); | ||
var validation_1 = require("./utils/validation"); | ||
var DEFAULT_TRAFFIC_TYPE = 'user'; | ||
// @TODO remove eventually when RUM Agent registers web vitals by default | ||
var registerWebVitals = true; | ||
// @TODO remove eventually when RUM Agent handles `register` config option and webVitals registration by default | ||
var registerEventCollectors = true; | ||
/** | ||
@@ -29,3 +30,3 @@ * Split Suite for Browsers. | ||
sdk.UserConsent.setStatus = function (newStatus) { | ||
browser_rum_agent_1.SplitRumAgent.setUserConsent(newStatus); | ||
slim_1.SplitRumAgent.setUserConsent(newStatus); | ||
return originalSetStatus.apply(this, arguments); | ||
@@ -44,8 +45,8 @@ }; | ||
}; | ||
browser_rum_agent_1.SplitRumAgent.addIdentity(identity_1); | ||
slim_1.SplitRumAgent.addIdentity(identity_1); | ||
// override client.destroy to remove identity from RUM Agent | ||
var originalDestroy_1 = client.destroy; | ||
client.destroy = function () { | ||
browser_rum_agent_1.SplitRumAgent.flush(); | ||
browser_rum_agent_1.SplitRumAgent.removeIdentity(identity_1); | ||
slim_1.SplitRumAgent.flush(); | ||
slim_1.SplitRumAgent.removeIdentity(identity_1); | ||
return originalDestroy_1.apply(client, arguments); | ||
@@ -57,3 +58,3 @@ }; | ||
rumAgent: function () { | ||
return browser_rum_agent_1.SplitRumAgent; | ||
return slim_1.SplitRumAgent; | ||
}, | ||
@@ -66,14 +67,20 @@ destroy: function () { | ||
if (settings.mode === constants_1.STANDALONE_MODE) { | ||
if (registerWebVitals) { | ||
browser_rum_agent_1.SplitRumAgent.register((0, browser_rum_agent_1.webVitals)()); | ||
registerWebVitals = false; | ||
if (registerEventCollectors) { | ||
var register = (0, validation_1.validateRumAgentRegisterOption)(settings.rumAgent); | ||
if (register.errors) | ||
slim_1.SplitRumAgent.register((0, slim_1.errors)()); | ||
if (register.navigationTiming) | ||
slim_1.SplitRumAgent.register((0, slim_1.navigationTiming)()); | ||
if (register.webVitals) | ||
slim_1.SplitRumAgent.register((0, slim_1.webVitals)(register.webVitals === true ? undefined : register.webVitals)); | ||
registerEventCollectors = false; | ||
} | ||
var agentConfig = browser_rum_agent_1.SplitRumAgent.__getConfig(); | ||
var agentConfig = slim_1.SplitRumAgent.__getConfig(); | ||
if (agentConfig.a && agentConfig.a !== settings.core.authorizationKey) { | ||
settings.log.warn('RUM Agent already setup. The new Suite instance will reset the RUM Agent configuration.'); | ||
browser_rum_agent_1.SplitRumAgent.flush(); // flush events for previous SDK key | ||
browser_rum_agent_1.SplitRumAgent.removeIdentities(); // reset identities for new SDK key | ||
slim_1.SplitRumAgent.flush(); // flush events for previous SDK key | ||
slim_1.SplitRumAgent.removeIdentities(); // reset identities for new SDK key | ||
} | ||
agentConfig.log = settings.log; | ||
browser_rum_agent_1.SplitRumAgent.setup(settings.core.authorizationKey, (0, objectAssign_1.objectAssign)({ | ||
slim_1.SplitRumAgent.setup(settings.core.authorizationKey, (0, objectAssign_1.objectAssign)({ | ||
url: settings.urls.events, | ||
@@ -80,0 +87,0 @@ userConsent: settings.userConsent |
@@ -16,5 +16,5 @@ "use strict"; | ||
Object.defineProperty(exports, "DebugLogger", { enumerable: true, get: function () { return splitio_browserjs_5.DebugLogger; } }); | ||
var browser_rum_agent_1 = require("@splitsoftware/browser-rum-agent"); | ||
Object.defineProperty(exports, "SplitRumAgent", { enumerable: true, get: function () { return browser_rum_agent_1.SplitRumAgent; } }); | ||
Object.defineProperty(exports, "routeChanges", { enumerable: true, get: function () { return browser_rum_agent_1.routeChanges; } }); | ||
Object.defineProperty(exports, "tti", { enumerable: true, get: function () { return browser_rum_agent_1.tti; } }); | ||
var slim_1 = require("@splitsoftware/browser-rum-agent/slim"); | ||
Object.defineProperty(exports, "SplitRumAgent", { enumerable: true, get: function () { return slim_1.SplitRumAgent; } }); | ||
Object.defineProperty(exports, "routeChanges", { enumerable: true, get: function () { return slim_1.routeChanges; } }); | ||
Object.defineProperty(exports, "tti", { enumerable: true, get: function () { return slim_1.tti; } }); |
import { objectAssign } from '@splitsoftware/splitio-commons/esm/utils/lang/objectAssign'; | ||
import { _Set, setToArray } from '@splitsoftware/splitio-commons/esm/utils/lang/sets'; | ||
import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants'; | ||
import { SplitRumAgent, webVitals } from '@splitsoftware/browser-rum-agent'; | ||
import { SplitRumAgent, errors, navigationTiming, webVitals } from '@splitsoftware/browser-rum-agent/slim'; | ||
import { SplitFactory } from '@splitsoftware/splitio-browserjs/full'; | ||
import { validateRumAgentRegisterOption } from './utils/validation'; | ||
var DEFAULT_TRAFFIC_TYPE = 'user'; | ||
// @TODO remove eventually when RUM Agent registers web vitals by default | ||
var registerWebVitals = true; | ||
// @TODO remove eventually when RUM Agent handles `register` config option and webVitals registration by default | ||
var registerEventCollectors = true; | ||
/** | ||
@@ -59,5 +60,11 @@ * Split Suite for Browsers. | ||
if (settings.mode === STANDALONE_MODE) { | ||
if (registerWebVitals) { | ||
SplitRumAgent.register(webVitals()); | ||
registerWebVitals = false; | ||
if (registerEventCollectors) { | ||
var register = validateRumAgentRegisterOption(settings.rumAgent); | ||
if (register.errors) | ||
SplitRumAgent.register(errors()); | ||
if (register.navigationTiming) | ||
SplitRumAgent.register(navigationTiming()); | ||
if (register.webVitals) | ||
SplitRumAgent.register(webVitals(register.webVitals === true ? undefined : register.webVitals)); | ||
registerEventCollectors = false; | ||
} | ||
@@ -64,0 +71,0 @@ var agentConfig = SplitRumAgent.__getConfig(); |
@@ -7,2 +7,2 @@ export { SplitSuite } from './browserSuite'; | ||
export { DebugLogger } from '@splitsoftware/splitio-browserjs'; | ||
export { SplitRumAgent, routeChanges, tti } from '@splitsoftware/browser-rum-agent'; | ||
export { SplitRumAgent, routeChanges, tti } from '@splitsoftware/browser-rum-agent/slim'; |
{ | ||
"name": "@splitsoftware/browser-suite", | ||
"version": "1.4.0", | ||
"version": "1.4.1-rc.0", | ||
"description": "Split Suite for JavaScript on Browser", | ||
@@ -24,4 +24,5 @@ "main": "cjs/index.js", | ||
"build:umd": "rimraf umd && rollup --config rollup.ci.config.js --branch=$BUILD_BRANCH", | ||
"test": "npm run test:ts-decls && npm run test:e2e", | ||
"test": "npm run test:ts-decls && npm run test:unit && npm run test:e2e", | ||
"test:e2e": "karma start karma/e2e.karma.conf.js", | ||
"test:unit": "jest", | ||
"test:ts-decls": "tsc ts-tests/index.ts --noEmit", | ||
@@ -51,3 +52,3 @@ "all": "npm run check && npm run build && npm run test", | ||
"dependencies": { | ||
"@splitsoftware/browser-rum-agent": "^0.6.1", | ||
"@splitsoftware/browser-rum-agent": "^0.6.2-rc.0", | ||
"@splitsoftware/splitio-browserjs": "^0.14.0", | ||
@@ -61,2 +62,3 @@ "tslib": "^2.3.1" | ||
"@rollup/plugin-terser": "^0.4.0", | ||
"@types/jest": "^29.5.12", | ||
"@types/node-fetch": "^2.5.7", | ||
@@ -70,2 +72,3 @@ "@typescript-eslint/eslint-plugin": "^6.6.0", | ||
"husky": "^8.0.3", | ||
"jest": "^29.7.0", | ||
"karma": "^6.4.1", | ||
@@ -85,2 +88,3 @@ "karma-chrome-launcher": "^3.1.1", | ||
"tape-catch": "1.0.6", | ||
"ts-jest": "^29.1.2", | ||
"typescript": "4.4.4" | ||
@@ -87,0 +91,0 @@ }, |
@@ -5,10 +5,11 @@ import { objectAssign } from '@splitsoftware/splitio-commons/src/utils/lang/objectAssign'; | ||
import { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; | ||
import { SplitRumAgent, webVitals } from '@splitsoftware/browser-rum-agent'; | ||
import { SplitRumAgent, errors, navigationTiming, webVitals } from '@splitsoftware/browser-rum-agent/slim'; | ||
import { SplitFactory } from '@splitsoftware/splitio-browserjs/full'; | ||
import { IBrowserSuiteSettings } from '../types'; | ||
import { validateRumAgentRegisterOption } from './utils/validation'; | ||
const DEFAULT_TRAFFIC_TYPE = 'user'; | ||
// @TODO remove eventually when RUM Agent registers web vitals by default | ||
let registerWebVitals = true; | ||
// @TODO remove eventually when RUM Agent handles `register` config option and webVitals registration by default | ||
let registerEventCollectors = true; | ||
@@ -77,5 +78,10 @@ /** | ||
if (settings.mode === STANDALONE_MODE) { | ||
if (registerWebVitals) { | ||
SplitRumAgent.register(webVitals()); | ||
registerWebVitals = false; | ||
if (registerEventCollectors) { | ||
const register = validateRumAgentRegisterOption(settings.rumAgent); | ||
if (register.errors) SplitRumAgent.register(errors()); | ||
if (register.navigationTiming) SplitRumAgent.register(navigationTiming()); | ||
if (register.webVitals) SplitRumAgent.register(webVitals(register.webVitals === true ? undefined : register.webVitals)); | ||
registerEventCollectors = false; | ||
} | ||
@@ -82,0 +88,0 @@ const agentConfig = SplitRumAgent.__getConfig(); |
@@ -16,2 +16,3 @@ export { SplitSuite } from './browserSuite'; | ||
Identity, | ||
IWebVitalsOptions, | ||
Properties, | ||
@@ -23,2 +24,2 @@ SplitRumAgent, | ||
tti | ||
} from '@splitsoftware/browser-rum-agent'; | ||
} from '@splitsoftware/browser-rum-agent/slim'; |
@@ -5,3 +5,3 @@ // Declaration file for JavaScript Browser Split Software SDK | ||
import '@splitsoftware/splitio-browserjs'; | ||
import type { SplitRumAgentConfig, SplitRumAgent } from '@splitsoftware/browser-rum-agent'; | ||
import type { SplitRumAgentConfig, SplitRumAgent, IWebVitalsOptions } from '@splitsoftware/browser-rum-agent'; | ||
export { | ||
@@ -15,2 +15,3 @@ ConsentStatus, | ||
Identity, | ||
IWebVitalsOptions, | ||
Properties, | ||
@@ -45,3 +46,25 @@ SplitRumAgent, | ||
*/ | ||
rumAgent?: SplitRumAgentConfig | ||
rumAgent?: SplitRumAgentConfig & { | ||
/** | ||
* Optional object to configure the registration of event collectors in the RUM agent. | ||
*/ | ||
register?: { | ||
/** | ||
* Whether to register `error` events or not. | ||
* @default true | ||
*/ | ||
errors?: boolean, | ||
/** | ||
* Whether to register navigation timing events, i.e., `page.load.time` and `time.to.dom.interactive` events. | ||
* @default true | ||
*/ | ||
navigationTiming?: boolean, | ||
/** | ||
* Whether to register Web-Vitals events or not. If an object is provided, it will be used as the configuration for the Web-Vitals event collector. | ||
* @default true | ||
* @see {@link https://help.split.io/hc/en-us/articles/360030898431-Browser-RUM-Agent#web-vitals} | ||
*/ | ||
webVitals?: boolean | IWebVitalsOptions | ||
} | ||
} | ||
} | ||
@@ -48,0 +71,0 @@ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
36760
20
528
30
2
+ Added@splitsoftware/browser-rum-agent@0.6.2-rc.0(transitive)
- Removed@splitsoftware/browser-rum-agent@0.6.1(transitive)