@splitsoftware/browser-rum-agent
Advanced tools
Comparing version 0.4.2-rc.2 to 0.4.2-rc.3
@@ -1,2 +0,2 @@ | ||
0.4.2 (March 1, 2024) | ||
0.5.0 (March 4, 2024) | ||
- Adding a default prefix for events to simplify compatibility with Split's out-of-the-box metrics feature. This value can be changed or override with empty via the config `prefix` option. | ||
@@ -3,0 +3,0 @@ - Updated TypeScript declaration file to use TSDoc comments and improve type definitions. |
@@ -33,3 +33,3 @@ "use strict"; | ||
p: {}, | ||
prefix: 'split.rum', | ||
prefix: constants_1.DEFAULT_PREFIX, | ||
url: 'https://events.split.io/api', | ||
@@ -56,2 +56,6 @@ pushRate: 30, | ||
(0, assign_1.objectAssign)(_config, config); | ||
if (_config.prefix && (!(0, isString_1.isString)(_config.prefix) || !validateEvent_1.EVENT_TYPE_REGEX.test(_config.prefix))) { | ||
_config.log.error('Event type prefix must adhere to the regular expression /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/. Setting to default.'); | ||
_config.prefix = constants_1.DEFAULT_PREFIX; | ||
} | ||
} | ||
@@ -58,0 +62,0 @@ if ((0, isString_1.isString)(sdkKey)) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CONSENT_UNKNOWN = exports.CONSENT_DECLINED = exports.CONSENT_GRANTED = exports.UNAVAILABLE = void 0; | ||
exports.DEFAULT_PREFIX = exports.CONSENT_UNKNOWN = exports.CONSENT_DECLINED = exports.CONSENT_GRANTED = exports.UNAVAILABLE = void 0; | ||
exports.UNAVAILABLE = 'unavailable'; | ||
@@ -8,1 +8,2 @@ exports.CONSENT_GRANTED = 'GRANTED'; | ||
exports.CONSENT_UNKNOWN = 'UNKNOWN'; | ||
exports.DEFAULT_PREFIX = 'split.rum'; |
@@ -38,2 +38,2 @@ "use strict"; | ||
exports.userAgent = getUserAgent(); | ||
exports.languageVersion = 'jsrum-' + '0.4.2-rc.2'; | ||
exports.languageVersion = 'jsrum-' + '0.4.2-rc.3'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateEvent = exports.validateProperties = void 0; | ||
exports.validateEvent = exports.EVENT_TYPE_REGEX = exports.validateProperties = void 0; | ||
var isBoolean_1 = require("./isBoolean"); | ||
@@ -29,3 +29,3 @@ var isNumber_1 = require("./isNumber"); | ||
exports.validateProperties = validateProperties; | ||
var EVENT_TYPE_REGEX = /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/; | ||
exports.EVENT_TYPE_REGEX = /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/; | ||
/** | ||
@@ -36,4 +36,4 @@ * Validates and sanitizes an event. Returns the sanitized event or undefined if the event is invalid. | ||
var eventTypeId = event.eventTypeId, value = event.value, properties = event.properties; | ||
if (!(0, isString_1.isString)(eventTypeId) || !EVENT_TYPE_REGEX.test(eventTypeId)) { | ||
log.error('Event must have a valid eventTypeId.'); | ||
if (!(0, isString_1.isString)(eventTypeId) || !exports.EVENT_TYPE_REGEX.test(eventTypeId)) { | ||
log.error('Event type ID must be a string that adheres to the regular expression /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/.'); | ||
return; | ||
@@ -40,0 +40,0 @@ } |
@@ -10,7 +10,7 @@ import { setSchedule, flush, track, queue } from './queue'; | ||
import { validateIdentity, areEqual } from './validateIdentity'; | ||
import { CONSENT_DECLINED, CONSENT_GRANTED } from './constants'; | ||
import { CONSENT_DECLINED, CONSENT_GRANTED, DEFAULT_PREFIX } from './constants'; | ||
// Built-in event collectors | ||
import { handleCustomErrors, onError } from '../metrics/errors'; | ||
import { onNavigationTimingMetrics } from '../metrics/navigation'; | ||
import { validateProperties } from './validateEvent'; | ||
import { EVENT_TYPE_REGEX, validateProperties } from './validateEvent'; | ||
// Browser support: | ||
@@ -31,3 +31,3 @@ // - ES5 syntax | ||
p: {}, | ||
prefix: 'split.rum', | ||
prefix: DEFAULT_PREFIX, | ||
url: 'https://events.split.io/api', | ||
@@ -54,2 +54,6 @@ pushRate: 30, | ||
objectAssign(_config, config); | ||
if (_config.prefix && (!isString(_config.prefix) || !EVENT_TYPE_REGEX.test(_config.prefix))) { | ||
_config.log.error('Event type prefix must adhere to the regular expression /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/. Setting to default.'); | ||
_config.prefix = DEFAULT_PREFIX; | ||
} | ||
} | ||
@@ -56,0 +60,0 @@ if (isString(sdkKey)) { |
@@ -5,1 +5,2 @@ export var UNAVAILABLE = 'unavailable'; | ||
export var CONSENT_UNKNOWN = 'UNKNOWN'; | ||
export var DEFAULT_PREFIX = 'split.rum'; |
@@ -31,2 +31,2 @@ /* eslint-disable compat/compat */ | ||
export var userAgent = getUserAgent(); | ||
export var languageVersion = 'jsrum-' + '0.4.2-rc.2'; | ||
export var languageVersion = 'jsrum-' + '0.4.2-rc.3'; |
@@ -25,3 +25,3 @@ import { isBoolean } from './isBoolean'; | ||
} | ||
var EVENT_TYPE_REGEX = /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/; | ||
export var EVENT_TYPE_REGEX = /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/; | ||
/** | ||
@@ -33,3 +33,3 @@ * Validates and sanitizes an event. Returns the sanitized event or undefined if the event is invalid. | ||
if (!isString(eventTypeId) || !EVENT_TYPE_REGEX.test(eventTypeId)) { | ||
log.error('Event must have a valid eventTypeId.'); | ||
log.error('Event type ID must be a string that adheres to the regular expression /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/.'); | ||
return; | ||
@@ -36,0 +36,0 @@ } |
{ | ||
"name": "@splitsoftware/browser-rum-agent", | ||
"version": "0.4.2-rc.2", | ||
"version": "0.4.2-rc.3", | ||
"description": "Split Software RUM Agent for Browsers.", | ||
@@ -5,0 +5,0 @@ "main": "cjs/index.js", |
@@ -70,6 +70,6 @@ /* eslint-disable no-use-before-define */ | ||
/** | ||
* Optional prefix to append to the `eventTypeId` of the events sent to Split. | ||
* Prefix to append to the `eventTypeId` of the events sent to Split. | ||
* | ||
* For example, if you set the prefix to 'my-app', the event type 'error' will be sent as 'my-app.error'. | ||
* If you set the prefix to an empty string, the event type 'error' will be sent as 'error'. | ||
* If you set the prefix to a falsy value, like an empty string, `null` or `undefined`, the event type 'error' will be sent as 'error'. | ||
* | ||
@@ -76,0 +76,0 @@ * @defaultValue `'split.rum'` |
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
128445
2690