@coralogix/browser 3.8.0 → 3.8.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 3.8.2 (2026-05-06)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - run web vitals listeners outside zone
6
+
7
+ ## 3.8.1 (2026-05-06)
8
+
9
+ ### 🩹 Fixes
10
+
11
+ Improve error stack trace handling.
12
+
1
13
  ## 3.8.0 (2026-04-27)
2
14
 
3
15
  ### 🚀 Features
package/index.esm2.js CHANGED
@@ -374,6 +374,23 @@ var STACK_FRAME_LIMIT = 50;
374
374
  var STACK_LINE_LIMIT = 1024;
375
375
  var MESSAGE_LIMIT = 1024;
376
376
  var MFE_PATH_PATTERN = /https?:\/\/.*\//;
377
+ var V8_HEADER_PATTERN = /^Error\b/;
378
+ function sanitizeConsoleErrorStack(stack) {
379
+ var _a;
380
+ if (!stack)
381
+ return stack;
382
+ var lines = stack.split('\n');
383
+ if (lines.length === 0)
384
+ return stack;
385
+ if (V8_HEADER_PATTERN.test(lines[0])) {
386
+ lines = lines.slice(1);
387
+ }
388
+ lines = lines.slice(1);
389
+ if ((_a = getSessionRecorder()) === null || _a === void 0 ? void 0 : _a.isConsoleRecordingActive()) {
390
+ lines = lines.slice(1);
391
+ }
392
+ return lines.join('\n');
393
+ }
377
394
  function extractMfePath(fileName) {
378
395
  var _a;
379
396
  var _b = __read$1((_a = fileName.match(MFE_PATH_PATTERN)) !== null && _a !== void 0 ? _a : [], 1), mfePath = _b[0];
@@ -526,6 +543,7 @@ var _consoleErrorHandler = function (errorInstrumentation) {
526
543
  args[_i] = arguments[_i];
527
544
  }
528
545
  var stackContextError = new Error();
546
+ stackContextError.stack = sanitizeConsoleErrorStack(stackContextError.stack);
529
547
  errorInstrumentation.report(ErrorSource.CONSOLE, args, stackContextError);
530
548
  return original.apply(console, args);
531
549
  };
@@ -1385,6 +1403,16 @@ function createCxMutationObserver(callback) {
1385
1403
  var OriginalMutationObserver = getZoneJsOriginalDom(browserWindow, 'MutationObserver');
1386
1404
  return new OriginalMutationObserver(callback);
1387
1405
  }
1406
+ function cxRunOutsideZone(fn) {
1407
+ if (!shouldRunOutsideZone()) {
1408
+ return fn();
1409
+ }
1410
+ var zone = getBrowserWindow().Zone;
1411
+ if (zone && zone.root && typeof zone.root.run === 'function') {
1412
+ return zone.root.run(fn);
1413
+ }
1414
+ return fn();
1415
+ }
1388
1416
 
1389
1417
  /** Original source: https://www.npmjs.com/package/tti-polyfill?activeTab=code
1390
1418
  * @license Apache-2.0
@@ -1684,11 +1712,13 @@ var CoralogixWebVitalsInstrumentation = (function (_super) {
1684
1712
  if (!isPerformanceObserverSupported()) {
1685
1713
  return _this;
1686
1714
  }
1687
- _this.registerToCoreWebVitalMetrics();
1688
- _this.registerToCalculatedWebVitalMetrics();
1689
- if (_this.isSoftNavsEnabled) {
1690
- _this.registerToSoftNavigations();
1691
- }
1715
+ cxRunOutsideZone(function () {
1716
+ _this.registerToCoreWebVitalMetrics();
1717
+ _this.registerToCalculatedWebVitalMetrics();
1718
+ if (_this.isSoftNavsEnabled) {
1719
+ _this.registerToSoftNavigations();
1720
+ }
1721
+ });
1692
1722
  return _this;
1693
1723
  }
1694
1724
  CoralogixWebVitalsInstrumentation.prototype.registerToCoreWebVitalMetrics = function () {
@@ -4270,7 +4300,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
4270
4300
  return resolvedUrlBlueprinters;
4271
4301
  }
4272
4302
 
4273
- var SDK_VERSION = '3.8.0';
4303
+ var SDK_VERSION = '3.8.2';
4274
4304
 
4275
4305
  function shouldDropEvent(cxRumEvent, options) {
4276
4306
  if (isDocumentErrorWithoutMessage(cxRumEvent)) {
@@ -5283,4 +5313,4 @@ var SessionRecordingEventType;
5283
5313
  SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
5284
5314
  })(SessionRecordingEventType || (SessionRecordingEventType = {}));
5285
5315
 
5286
- export { BATCH_TIME_DELAY as B, CxGlobal as C, MAX_BATCH_TIME_MS as M, OtelNetworkAttrs as O, PerformanceTypes as P, Request as R, SESSION_RECORDER_SEGMENTS_MAP as S, UrlBasedLabelProvider as U, cxClearTimeout as a, createCxMutationObserver as b, cxSetTimeout as c, cxRequestAnimationFrame as d, cxCancelAnimationFrame as e, cxClearInterval as f, getZoneJsOriginalDom as g, getSdkConfig as h, getNowTime as i, SESSION_RECORDING_NETWORK_ERR0R_MESSAGE as j, cxSetInterval as k, SESSION_RECORDING_DEFAULT_HEADERS as l, SESSION_RECORDING_POSTFIX_URL as m, SESSION_RECORDER_KEY as n, SESSION_RECORDING_DEFAULT_ERROR_MESSAGE as o, CoralogixRum as p, CoralogixLogSeverity as q, SessionRecordingEventType as r, CoralogixEventType as s, UrlType as t };
5316
+ export { BATCH_TIME_DELAY as B, CxGlobal as C, MAX_BATCH_TIME_MS as M, OtelNetworkAttrs as O, PerformanceTypes as P, Request as R, SESSION_RECORDER_SEGMENTS_MAP as S, UrlBasedLabelProvider as U, cxClearTimeout as a, createCxMutationObserver as b, cxSetTimeout as c, cxRequestAnimationFrame as d, cxCancelAnimationFrame as e, getSdkConfig as f, getZoneJsOriginalDom as g, cxClearInterval as h, getNowTime as i, SESSION_RECORDING_NETWORK_ERR0R_MESSAGE as j, cxSetInterval as k, SESSION_RECORDING_DEFAULT_HEADERS as l, SESSION_RECORDING_POSTFIX_URL as m, SESSION_RECORDER_KEY as n, SESSION_RECORDING_DEFAULT_ERROR_MESSAGE as o, CoralogixRum as p, CoralogixLogSeverity as q, SessionRecordingEventType as r, CoralogixEventType as s, UrlType as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/browser",
3
- "version": "3.8.0",
3
+ "version": "3.8.2",
4
4
  "description": "Official Coralogix SDK for browsers",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Coralogix",
@@ -1,5 +1,5 @@
1
1
  import { __values, __spreadArray, __read, __assign, __awaiter, __generator, __rest } from 'tslib';
2
- import { c as cxSetTimeout, a as cxClearTimeout, g as getZoneJsOriginalDom, b as createCxMutationObserver, d as cxRequestAnimationFrame, e as cxCancelAnimationFrame, C as CxGlobal, f as cxClearInterval, h as getSdkConfig, S as SESSION_RECORDER_SEGMENTS_MAP, i as getNowTime, j as SESSION_RECORDING_NETWORK_ERR0R_MESSAGE, k as cxSetInterval, R as Request, l as SESSION_RECORDING_DEFAULT_HEADERS, m as SESSION_RECORDING_POSTFIX_URL, B as BATCH_TIME_DELAY, n as SESSION_RECORDER_KEY, o as SESSION_RECORDING_DEFAULT_ERROR_MESSAGE, M as MAX_BATCH_TIME_MS } from './index.esm2.js';
2
+ import { c as cxSetTimeout, a as cxClearTimeout, g as getZoneJsOriginalDom, b as createCxMutationObserver, d as cxRequestAnimationFrame, e as cxCancelAnimationFrame, C as CxGlobal, f as getSdkConfig, h as cxClearInterval, S as SESSION_RECORDER_SEGMENTS_MAP, i as getNowTime, j as SESSION_RECORDING_NETWORK_ERR0R_MESSAGE, k as cxSetInterval, R as Request, l as SESSION_RECORDING_DEFAULT_HEADERS, m as SESSION_RECORDING_POSTFIX_URL, B as BATCH_TIME_DELAY, n as SESSION_RECORDER_KEY, o as SESSION_RECORDING_DEFAULT_ERROR_MESSAGE, M as MAX_BATCH_TIME_MS } from './index.esm2.js';
3
3
  import '@opentelemetry/sdk-trace-base';
4
4
  import '@opentelemetry/sdk-trace-web';
5
5
  import '@opentelemetry/instrumentation';
@@ -5818,6 +5818,10 @@ var SessionRecorder = (function () {
5818
5818
  SessionRecorder.prototype.getIsAutoStartRecording = function () {
5819
5819
  return this.isAutoStartRecording;
5820
5820
  };
5821
+ SessionRecorder.prototype.isConsoleRecordingActive = function () {
5822
+ var _a;
5823
+ return !!this.recordRef && ((_a = getSdkConfig().sessionRecordingConfig) === null || _a === void 0 ? void 0 : _a.recordConsoleEvents) === true;
5824
+ };
5821
5825
  Object.defineProperty(SessionRecorder.prototype, "recordingStopDueToTimeout", {
5822
5826
  get: function () {
5823
5827
  return this._recordingStopDueToTimeout;
@@ -2,6 +2,7 @@ import { InstrumentationBase, InstrumentationConfig } from '@opentelemetry/instr
2
2
  import { CoralogixRumLabels, CxStackFrame } from '../types';
3
3
  export declare const STACK_FRAME_LIMIT = 50;
4
4
  export declare const STACK_LINE_LIMIT = 1024;
5
+ export declare function sanitizeConsoleErrorStack(stack: string | undefined): string | undefined;
5
6
  export declare function extractMfePath(fileName: string): string | undefined;
6
7
  export declare const ERROR_INSTRUMENTATION_NAME = "errors";
7
8
  export declare const ErrorAttributes: {
@@ -28,6 +28,7 @@ export declare class SessionRecorder {
28
28
  getSessionHasRecording(): boolean;
29
29
  updateSegmentIndexCounter(segmentIndexCounter: Record<string, number>): void;
30
30
  getIsAutoStartRecording(): boolean;
31
+ isConsoleRecordingActive(): boolean;
31
32
  set recordingStopDueToTimeout(value: boolean);
32
33
  get recordingStopDueToTimeout(): boolean;
33
34
  startRecording(): Promise<void>;
@@ -23,3 +23,4 @@ export declare function cxClearInterval(id: ReturnType<typeof setInterval>): voi
23
23
  export declare function cxRequestAnimationFrame(callback: FrameRequestCallback): number;
24
24
  export declare function cxCancelAnimationFrame(id: number): void;
25
25
  export declare function createCxMutationObserver(callback: MutationCallback): MutationObserver;
26
+ export declare function cxRunOutsideZone<T>(fn: () => T): T;
package/src/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "3.8.0";
1
+ export declare const SDK_VERSION = "3.8.2";