@coralogix/browser 3.4.0 → 3.5.0

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +24 -21
  3. package/index.esm.js +1 -1
  4. package/index.esm2.js +128 -56
  5. package/package.json +1 -3
  6. package/sessionRecorder.esm.js +5535 -1314
  7. package/src/constants.d.ts +1 -2
  8. package/src/cx-rrweb/rrweb/index.d.ts +4 -0
  9. package/src/cx-rrweb/rrweb/record/cross-origin-iframe-mirror.d.ts +14 -0
  10. package/src/cx-rrweb/rrweb/record/error-handler.d.ts +6 -0
  11. package/src/cx-rrweb/rrweb/record/iframe-manager.d.ts +34 -0
  12. package/src/cx-rrweb/rrweb/record/index.d.ts +10 -0
  13. package/src/cx-rrweb/rrweb/record/mutation.d.ts +50 -0
  14. package/src/cx-rrweb/rrweb/record/observer.d.ts +9 -0
  15. package/src/cx-rrweb/rrweb/record/observers/canvas/2d.d.ts +2 -0
  16. package/src/cx-rrweb/rrweb/record/observers/canvas/canvas-manager.d.ts +37 -0
  17. package/src/cx-rrweb/rrweb/record/observers/canvas/canvas.d.ts +2 -0
  18. package/src/cx-rrweb/rrweb/record/observers/canvas/serialize-args.d.ts +6 -0
  19. package/src/cx-rrweb/rrweb/record/observers/canvas/webgl.d.ts +2 -0
  20. package/src/cx-rrweb/rrweb/record/processed-node-manager.d.ts +8 -0
  21. package/src/cx-rrweb/rrweb/record/shadow-dom-manager.d.ts +26 -0
  22. package/src/cx-rrweb/rrweb/record/stylesheet-manager.d.ts +17 -0
  23. package/src/cx-rrweb/rrweb/record/workers/image-bitmap-data-url-worker.d.ts +6 -0
  24. package/src/cx-rrweb/rrweb/types.d.ts +102 -0
  25. package/src/cx-rrweb/rrweb/utils/base64.d.ts +1 -0
  26. package/src/cx-rrweb/rrweb/utils.d.ts +66 -0
  27. package/src/cx-rrweb/rrweb-plugin-console-record/error-stack-parser.d.ts +37 -0
  28. package/src/cx-rrweb/rrweb-plugin-console-record/index.d.ts +42 -0
  29. package/src/cx-rrweb/rrweb-plugin-console-record/stringify.d.ts +2 -0
  30. package/src/cx-rrweb/rrweb-snapshot/index.d.ts +4 -0
  31. package/src/cx-rrweb/rrweb-snapshot/snapshot.d.ts +76 -0
  32. package/src/cx-rrweb/rrweb-snapshot/types.d.ts +50 -0
  33. package/src/cx-rrweb/rrweb-snapshot/utils.d.ts +51 -0
  34. package/src/cx-rrweb/rrweb-types/index.d.ts +558 -0
  35. package/src/cx-rrweb/rrweb-utils/index.d.ts +43 -0
  36. package/src/instrumentations/CoralogixErrorInstrumentation.d.ts +1 -0
  37. package/src/processors/CoralogixNavigationProcessor.d.ts +1 -0
  38. package/src/session/session-idle.d.ts +2 -0
  39. package/src/session/session.model.d.ts +3 -3
  40. package/src/session/sessionRecorder.d.ts +0 -3
  41. package/src/tools/cx-timers.d.ts +25 -0
  42. package/src/tools/global-keys.d.ts +2 -0
  43. package/src/types.d.ts +2 -1
  44. package/src/version.d.ts +1 -1
  45. package/src/tools/getZoneJsOriginalDom.d.ts +0 -1
  46. package/src/utils/zone-patch.d.ts +0 -10
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## 3.5.0 (2026-03-26)
2
+
3
+ ### 🚀 Features
4
+
5
+ - Run SDK Web APIs outside zone.js by default for Angular applications
6
+
7
+ ## 3.4.1 (2026-03-25)
8
+
9
+ ### 🩹 Fixes
10
+
11
+ - Improve MFE stacktrace metadata extraction stability
12
+ - Fix potential infinite loop in navigation tracking
13
+
1
14
  ## 3.4.0 (2026-02-26)
2
15
 
3
16
  ### 🚀 Features
package/README.md CHANGED
@@ -18,7 +18,6 @@
18
18
 
19
19
  - [Recording Manually](#recording-manually)
20
20
  - [Privacy & Security](#privacy--security)
21
- - [Performance](#performance)
22
21
  - [Worker URL](#worker-url)
23
22
  - [Screenshots](#screenshots)
24
23
 
@@ -51,7 +50,8 @@
51
50
 
52
51
  26. [Soft Navigations (Experimental)](#soft-navigations--experimental)
53
52
  27. [Memory Usage (Experimental)](#memory-usage---experimental)
54
- 28. [CDN](#cdn)
53
+ 28. [Angular Zone.js Configuration](#angular-zonejs-configuration)
54
+ 29. [CDN](#cdn)
55
55
 
56
56
  - [Specific Version](#specific-version-recommended)
57
57
  - [Add the CDN Script to Your Application](#add-the-cdn-script-to-your-application)
@@ -59,7 +59,7 @@
59
59
  - [Via JS File](#via-js-file)
60
60
  - [Via TS File](#via-ts-file)
61
61
 
62
- 29. [Flutter Web](#flutter-web)
62
+ 30. [Flutter Web](#flutter-web)
63
63
 
64
64
  ---
65
65
 
@@ -352,22 +352,6 @@ CoralogixRum.init({
352
352
  });
353
353
  ```
354
354
 
355
- #### Performance
356
-
357
- Session Recording works by recording incremental DOM changes that occur in your web application.
358
- To avoid performance issues, Session Recording will stop recording if it detects a large number of mutations (Default: 5,000).
359
-
360
- ```javascript
361
- CoralogixRum.init({
362
- // ...
363
- sessionRecordingConfig: {
364
- // ...
365
- // According to MutationObserver API, A large number of DOM mutations can negatively impact performance
366
- maxMutations: 5000,
367
- },
368
- });
369
- ```
370
-
371
355
  #### Worker Url
372
356
 
373
357
  By default, Session recording uses an inline web worker script to compress data before transmission. For added flexibility, you can host a custom worker script on your own domain. Simply host the following file on your server: [worker.min.js](https://cdn.rum-ingress-coralogix.com/coralogix/browser/latest/worker.min.js)
@@ -872,8 +856,7 @@ This feature allows you to track multiple applications on the same page.<br>
872
856
 
873
857
  #### Pre Requisites
874
858
 
875
- To support microfrontend, you need to install one of these plugins: [webpack](https://www.npmjs.com/package/@coralogix/webpack-plugin), [esbuild](https://www.npmjs.com/package/@coralogix/esbuild-plugin) and include them in your build process.<br>
876
- Plugins for other bundlers are coming soon.
859
+ To support microfrontend, you need to install one of these plugins: [webpack](https://www.npmjs.com/package/@coralogix/webpack-plugin), [esbuild](https://www.npmjs.com/package/@coralogix/esbuild-plugin), [vite](https://www.npmjs.com/package/@coralogix/vite-plugin) and include them in your build process.
877
860
 
878
861
  When an error occurs, the SDK will find the correlated microfrontend and will add a label with the microfrontend app/version to the error event.
879
862
 
@@ -1028,6 +1011,26 @@ self.onmessage = (message) => {
1028
1011
 
1029
1012
  ---
1030
1013
 
1014
+ ## Angular Zone.js Configuration
1015
+
1016
+ By default, the SDK runs its internal timers outside Angular's Zone.js to prevent unnecessary change detection cycles. This improves performance by avoiding redundant UI updates triggered by the SDK's background operations.
1017
+
1018
+ ```javascript
1019
+ CoralogixRum.init({
1020
+ // ...
1021
+ runOutsideAngularZone: true, // Defaults to true
1022
+ });
1023
+ ```
1024
+
1025
+ | Value | Behavior |
1026
+ | ------- | ------------------------------------------------------------------------ |
1027
+ | `true` | SDK timers run outside Zone.js, preventing change detection triggers. |
1028
+ | `false` | SDK timers run inside Zone.js, which may trigger change detection. |
1029
+
1030
+ > **Note:** In most cases, you should keep the default value (`true`) for optimal performance. Only set to `false` if you have a specific reason to include SDK operations in Angular's change detection.
1031
+
1032
+ ---
1033
+
1031
1034
  ## CDN
1032
1035
 
1033
1036
  Coralogix Browser SDK is also provided via CDN.<br>
package/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- export { l as CoralogixEventType, j as CoralogixLogSeverity, i as CoralogixRum, O as OtelNetworkAttrs, P as PerformanceTypes, k as SessionRecordingEventType, U as UrlBasedLabelProvider, m as UrlType } from './index.esm2.js';
1
+ export { s as CoralogixEventType, q as CoralogixLogSeverity, p as CoralogixRum, O as OtelNetworkAttrs, P as PerformanceTypes, r as SessionRecordingEventType, U as UrlBasedLabelProvider, t as UrlType } from './index.esm2.js';
2
2
  import 'tslib';
3
3
  import '@opentelemetry/sdk-trace-base';
4
4
  import '@opentelemetry/sdk-trace-web';
package/index.esm2.js CHANGED
@@ -195,6 +195,9 @@ var CoralogixLogSeverity;
195
195
  CoralogixLogSeverity[CoralogixLogSeverity["Critical"] = 6] = "Critical";
196
196
  })(CoralogixLogSeverity || (CoralogixLogSeverity = {}));
197
197
 
198
+ var SDK_CONFIG_KEY = 'sdkConfig';
199
+ var USER_AGENT_KEY = 'userAgent';
200
+
198
201
  var millisecondsPerSecond = 1000;
199
202
  var millisecondsPerMinute = millisecondsPerSecond * 60;
200
203
  var MILLISECONDS_PER_HOUR = millisecondsPerMinute * 60;
@@ -212,7 +215,6 @@ var BATCH_TIME_DELAY = 1000;
212
215
  var SESSION_RECORDING_POSTFIX_URL = '/browser/alpha/sessionrecording';
213
216
  var SESSION_KEY = 'rum_session';
214
217
  var PREV_SESSION_KEY = 'rum_prev_session';
215
- var MUTATION_LIMIT = 10000;
216
218
  var DEFAULT_SESSION_CONFIG = {
217
219
  sessionSampleRate: 100,
218
220
  onlyWithErrorConfig: {
@@ -369,6 +371,12 @@ var CACHED_METADATA_KEY = '__cx_metadata__';
369
371
  var ERROR_INSTRUMENTATION_VERSION = '1';
370
372
  var STACK_LIMIT = 4096;
371
373
  var MESSAGE_LIMIT = 1024;
374
+ var MFE_PATH_PATTERN = /https?:\/\/.*\//;
375
+ function extractMfePath(fileName) {
376
+ var _a;
377
+ var _b = __read$1((_a = fileName.match(MFE_PATH_PATTERN)) !== null && _a !== void 0 ? _a : [], 1), mfePath = _b[0];
378
+ return mfePath;
379
+ }
372
380
  var ERROR_INSTRUMENTATION_NAME = 'errors';
373
381
  var ErrorAttributes = {
374
382
  TYPE: 'error_type',
@@ -455,32 +463,32 @@ function addLabelForMFE(span, lastFrame) {
455
463
  }
456
464
  function extractMetadataFromMfeStacktrace() {
457
465
  return __awaiter(this, arguments, void 0, function (fileName) {
458
- var metadata, cachedMetadata, MFE_METADATA_KEY, _a, mfePath, response, _b, e_1;
466
+ var metadata, cachedMetadata, MFE_METADATA_KEY, mfePath, response, _a, e_1;
459
467
  if (fileName === void 0) { fileName = ''; }
460
- return __generator(this, function (_c) {
461
- switch (_c.label) {
468
+ return __generator(this, function (_b) {
469
+ switch (_b.label) {
462
470
  case 0:
463
471
  cachedMetadata = CxGlobal[CACHED_METADATA_KEY];
464
472
  MFE_METADATA_KEY = 'cx-metadata.json';
465
- _a = __read$1(fileName.match(/https?:\/\/.*\//), 1), mfePath = _a[0];
473
+ mfePath = extractMfePath(fileName);
466
474
  if (!mfePath) return [3, 7];
467
475
  response = void 0;
468
476
  if (!!(cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.has(mfePath))) return [3, 6];
469
- _c.label = 1;
477
+ _b.label = 1;
470
478
  case 1:
471
- _c.trys.push([1, 4, , 5]);
479
+ _b.trys.push([1, 4, , 5]);
472
480
  return [4, fetch("".concat(mfePath).concat(MFE_METADATA_KEY), {
473
481
  cache: 'no-cache',
474
482
  })];
475
483
  case 2:
476
- response = _c.sent();
477
- _b = [{}];
484
+ response = _b.sent();
485
+ _a = [{}];
478
486
  return [4, response.json()];
479
487
  case 3:
480
- metadata = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_c.sent())])), { mfePath: mfePath }]);
488
+ metadata = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_b.sent())])), { mfePath: mfePath }]);
481
489
  return [3, 5];
482
490
  case 4:
483
- e_1 = _c.sent();
491
+ e_1 = _b.sent();
484
492
  if (getSdkConfig().debug) {
485
493
  console.warn('Coralogix Browser SDK - Error fetching metadata', e_1);
486
494
  }
@@ -490,7 +498,7 @@ function extractMetadataFromMfeStacktrace() {
490
498
  return [3, 7];
491
499
  case 6:
492
500
  metadata = cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.get(mfePath);
493
- _c.label = 7;
501
+ _b.label = 7;
494
502
  case 7: return [2, metadata];
495
503
  }
496
504
  });
@@ -1297,6 +1305,64 @@ var IMG_EXTENSIONS = [
1297
1305
  '.webp',
1298
1306
  ];
1299
1307
 
1308
+ function getBrowserWindow() {
1309
+ return CxGlobal;
1310
+ }
1311
+ function shouldRunOutsideZone() {
1312
+ var _a;
1313
+ return ((_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.runOutsideAngularZone) !== false;
1314
+ }
1315
+ function getZoneJsOriginalDom(target, name) {
1316
+ if (!shouldRunOutsideZone()) {
1317
+ return target[name];
1318
+ }
1319
+ var browserWindow = getBrowserWindow();
1320
+ var original;
1321
+ if (browserWindow.Zone &&
1322
+ typeof browserWindow.Zone.__symbol__ === 'function') {
1323
+ original = target[browserWindow.Zone.__symbol__(name)];
1324
+ }
1325
+ if (!original) {
1326
+ original = target[name];
1327
+ }
1328
+ return original;
1329
+ }
1330
+ function cxSetTimeout(callback, delay) {
1331
+ var browserWindow = getBrowserWindow();
1332
+ var originalSetTimeout = getZoneJsOriginalDom(browserWindow, 'setTimeout');
1333
+ return originalSetTimeout.call(browserWindow, callback, delay);
1334
+ }
1335
+ function cxSetInterval(callback, delay) {
1336
+ var browserWindow = getBrowserWindow();
1337
+ var originalSetInterval = getZoneJsOriginalDom(browserWindow, 'setInterval');
1338
+ return originalSetInterval.call(browserWindow, callback, delay);
1339
+ }
1340
+ function cxClearTimeout(id) {
1341
+ var browserWindow = getBrowserWindow();
1342
+ var originalClearTimeout = getZoneJsOriginalDom(browserWindow, 'clearTimeout');
1343
+ originalClearTimeout.call(browserWindow, id);
1344
+ }
1345
+ function cxClearInterval(id) {
1346
+ var browserWindow = getBrowserWindow();
1347
+ var originalClearInterval = getZoneJsOriginalDom(browserWindow, 'clearInterval');
1348
+ originalClearInterval.call(browserWindow, id);
1349
+ }
1350
+ function cxRequestAnimationFrame(callback) {
1351
+ var browserWindow = getBrowserWindow();
1352
+ var originalRaf = getZoneJsOriginalDom(browserWindow, 'requestAnimationFrame');
1353
+ return originalRaf.call(browserWindow, callback);
1354
+ }
1355
+ function cxCancelAnimationFrame(id) {
1356
+ var browserWindow = getBrowserWindow();
1357
+ var originalCaf = getZoneJsOriginalDom(browserWindow, 'cancelAnimationFrame');
1358
+ originalCaf.call(browserWindow, id);
1359
+ }
1360
+ function createCxMutationObserver(callback) {
1361
+ var browserWindow = getBrowserWindow();
1362
+ var OriginalMutationObserver = getZoneJsOriginalDom(browserWindow, 'MutationObserver');
1363
+ return new OriginalMutationObserver(callback);
1364
+ }
1365
+
1300
1366
  /** Original source: https://www.npmjs.com/package/tti-polyfill?activeTab=code
1301
1367
  * @license Apache-2.0
1302
1368
  * @version 0.2.2
@@ -1403,7 +1469,7 @@ function z(a, b) {
1403
1469
  return false;
1404
1470
  }
1405
1471
  function A(a) {
1406
- var b = new MutationObserver(function (c) {
1472
+ var b = createCxMutationObserver(function (c) {
1407
1473
  c = t(c);
1408
1474
  for (var b = c.next(); !b.done; b = c.next()) b = b.value, 'childList' == b.type && z(b.addedNodes, y) ? a(b) : 'attributes' == b.type && y.includes(b.target.tagName.toLowerCase()) && a(b);
1409
1475
  });
@@ -1488,7 +1554,7 @@ function F(a) {
1488
1554
  G(a, Math.max(c + 5e3, b));
1489
1555
  }
1490
1556
  function G(a, b) {
1491
- !a.i || a.v > b || (clearTimeout(a.j), a.j = setTimeout(function () {
1557
+ !a.i || a.v > b || (cxClearTimeout(a.j), a.j = cxSetTimeout(function () {
1492
1558
  var b = performance.timing.navigationStart,
1493
1559
  d = B(a.g, a.b),
1494
1560
  b = (CxGlobal.a && CxGlobal.a.A ? 1e3 * CxGlobal.a.A().C - b : 0) || performance.timing.domContentLoadedEventEnd - b;
@@ -1497,7 +1563,7 @@ function G(a, b) {
1497
1563
  null === f && G(a, Math.max(d + 5e3, e + 1e3));
1498
1564
  var g = a.a;
1499
1565
  5e3 > e - d ? d = null : (d = g.length ? g[g.length - 1].end : b, d = 5e3 > e - d ? null : Math.max(d, f));
1500
- d && (a.s(d), clearTimeout(a.j), a.i = false, a.c && a.c.disconnect(), a.h && a.h.disconnect());
1566
+ d && (a.s(d), cxClearTimeout(a.j), a.i = false, a.c && a.c.disconnect(), a.h && a.h.disconnect());
1501
1567
  G(a, performance.now() + 1e3);
1502
1568
  }, b - performance.now()), a.v = b);
1503
1569
  }
@@ -1903,19 +1969,6 @@ var CoralogixResourcesInstrumentation = (function (_super) {
1903
1969
  return CoralogixResourcesInstrumentation;
1904
1970
  }(InstrumentationBase));
1905
1971
 
1906
- function getZoneJsOriginalDom(target, name) {
1907
- var browserWindow = getCxGlobal();
1908
- var original;
1909
- if (browserWindow.Zone &&
1910
- typeof browserWindow.Zone.__symbol__ === 'function') {
1911
- original = target[browserWindow.Zone.__symbol__(name)];
1912
- }
1913
- if (!original) {
1914
- original = target[name];
1915
- }
1916
- return original;
1917
- }
1918
-
1919
1972
  function addEventListeners(eventTarget, eventNames, listener, _a) {
1920
1973
  var _b = _a === void 0 ? {} : _a, once = _b.once, capture = _b.capture, passive = _b.passive;
1921
1974
  var resolvedListener = once
@@ -2193,7 +2246,7 @@ var CoralogixMemoryUsageInstrumentation = (function (_super) {
2193
2246
  };
2194
2247
  CoralogixMemoryUsageInstrumentation.prototype.runMemoryMeasurements = function () {
2195
2248
  var _this = this;
2196
- this.timeoutId = setTimeout(function () { return _this.measureMemoryUsage(); }, this.memoryUsageInterval);
2249
+ this.timeoutId = cxSetTimeout(function () { return _this.measureMemoryUsage(); }, this.memoryUsageInterval);
2197
2250
  };
2198
2251
  CoralogixMemoryUsageInstrumentation.prototype.measureMemoryUsage = function () {
2199
2252
  return __awaiter(this, void 0, void 0, function () {
@@ -2210,7 +2263,7 @@ var CoralogixMemoryUsageInstrumentation = (function (_super) {
2210
2263
  };
2211
2264
  CoralogixMemoryUsageInstrumentation.prototype.clearMeasurementsInterval = function () {
2212
2265
  if (this.timeoutId) {
2213
- clearTimeout(this.timeoutId);
2266
+ cxClearTimeout(this.timeoutId);
2214
2267
  }
2215
2268
  };
2216
2269
  return CoralogixMemoryUsageInstrumentation;
@@ -2367,10 +2420,12 @@ var CoralogixDOMInstrumentation = (function (_super) {
2367
2420
  return _this;
2368
2421
  }
2369
2422
  CoralogixDOMInstrumentation.prototype.registerToDOMEvents = function () {
2370
- document.addEventListener('visibilitychange', this.visibilityChangeHandler);
2423
+ var originalAddEventListener = getZoneJsOriginalDom(document, 'addEventListener');
2424
+ originalAddEventListener.call(document, 'visibilitychange', this.visibilityChangeHandler);
2371
2425
  };
2372
2426
  CoralogixDOMInstrumentation.prototype.unregisterFromDOMEvents = function () {
2373
- document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
2427
+ var originalRemoveEventListener = getZoneJsOriginalDom(document, 'removeEventListener');
2428
+ originalRemoveEventListener.call(document, 'visibilitychange', this.visibilityChangeHandler);
2374
2429
  };
2375
2430
  CoralogixDOMInstrumentation.prototype.init = function () { };
2376
2431
  CoralogixDOMInstrumentation.prototype.disable = function () {
@@ -2378,7 +2433,7 @@ var CoralogixDOMInstrumentation = (function (_super) {
2378
2433
  };
2379
2434
  CoralogixDOMInstrumentation.prototype.enable = function () {
2380
2435
  var _this = this;
2381
- setTimeout(function () {
2436
+ cxSetTimeout(function () {
2382
2437
  _this.registerToDOMEvents();
2383
2438
  });
2384
2439
  };
@@ -2464,8 +2519,6 @@ var REQUIRED_CONFIG_KEYS = [
2464
2519
  'version',
2465
2520
  'coralogixDomain',
2466
2521
  ];
2467
- var SDK_CONFIG_KEY = 'sdkConfig';
2468
- var USER_AGENT_KEY = 'userAgent';
2469
2522
  var ID_MASK_KEY = '{id}';
2470
2523
  var UUID_REGEX = /[0-9a-fA-F-]{36}/g;
2471
2524
  var NANOID_REGEX = /^[a-zA-Z0-9-_]{21}$/;
@@ -3624,7 +3677,7 @@ var CoralogixExporter = (function () {
3624
3677
  chunks.push(cachedLogs.slice(i, i + MAX_RUM_EVENTS_PER_REQUEST));
3625
3678
  }
3626
3679
  chunks.forEach(function (chunk) {
3627
- setTimeout(function () { return _this.invokeLogRequest(chunk, true); }, _this.batchTimeDelay);
3680
+ cxSetTimeout(function () { return _this.invokeLogRequest(chunk, true); }, _this.batchTimeDelay);
3628
3681
  _this.batchTimeDelay += BATCH_TIME_DELAY;
3629
3682
  });
3630
3683
  this.clearCachedDataForSessionWithError();
@@ -3667,22 +3720,28 @@ var SessionIdle = (function () {
3667
3720
  var _this = this;
3668
3721
  this.idleConfig = idleConfig;
3669
3722
  this._isIdleActive = false;
3723
+ this.lastResetTime = 0;
3724
+ this.THROTTLE_MS = 1000;
3670
3725
  this.stopCallbacks = {};
3671
3726
  this.resetTimeout = function () {
3672
3727
  var _a, _b;
3673
3728
  (_b = (_a = _this.stopCallbacks).clearTimeout) === null || _b === void 0 ? void 0 : _b.call(_a);
3674
- var id = setTimeout(function () {
3729
+ var id = cxSetTimeout(function () {
3675
3730
  _this._isIdleActive = true;
3676
3731
  _this.idleConfig.onIdle();
3677
3732
  }, _this.idleConfig.timeoutDelay);
3678
- _this.stopCallbacks.clearTimeout = function () { return clearTimeout(id); };
3733
+ _this.stopCallbacks.clearTimeout = function () { return cxClearTimeout(id); };
3679
3734
  };
3680
3735
  this.idlenessEventsHandler = function () {
3681
3736
  if (_this._isIdleActive) {
3682
3737
  _this._isIdleActive = false;
3683
3738
  _this.idleConfig.onActive();
3684
3739
  }
3685
- _this.resetTimeout();
3740
+ var now = Date.now();
3741
+ if (now - _this.lastResetTime >= _this.THROTTLE_MS) {
3742
+ _this.lastResetTime = now;
3743
+ _this.resetTimeout();
3744
+ }
3686
3745
  };
3687
3746
  }
3688
3747
  Object.defineProperty(SessionIdle.prototype, "isIdleActive", {
@@ -4104,7 +4163,7 @@ function isInitialConfigValid(initConfig) {
4104
4163
  return true;
4105
4164
  }
4106
4165
  function validateAndResolveInitConfig(config) {
4107
- var _a, _b, _c;
4166
+ var _a, _b, _c, _d;
4108
4167
  if (!isInitialConfigValid(config)) {
4109
4168
  return;
4110
4169
  }
@@ -4114,7 +4173,7 @@ function validateAndResolveInitConfig(config) {
4114
4173
  if (proxyUrl)
4115
4174
  resolvedIgnoreUrls.push(new RegExp(proxyUrl));
4116
4175
  OPTIONS_DEFAULTS.ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read$1(OPTIONS_DEFAULTS.ignoreUrls), false));
4117
- return __assign(__assign(__assign({}, OPTIONS_DEFAULTS), config), { maskInputTypes: (_a = config.maskInputTypes) !== null && _a !== void 0 ? _a : MASK_INPUT_TYPES_DEFAULT, maskClass: (_b = config.maskClass) !== null && _b !== void 0 ? _b : MASK_CLASS_DEFAULT, ignoreUrls: resolvedIgnoreUrls, urlBlueprinters: resolveUrlBlueprinters(urlBlueprinters), sessionSampleRate: (_c = config.sessionSampleRate) !== null && _c !== void 0 ? _c : 100, sessionConfig: resolveSessionConfig(config.sessionConfig), sessionRecordingConfig: resolveSessionRecordingConfig(config.sessionRecordingConfig), memoryUsageConfig: resolveMemoryUsageConfig(config.memoryUsageConfig), trackSoftNavigations: !!config.trackSoftNavigations, supportMfe: !!config.supportMfe });
4176
+ return __assign(__assign(__assign({}, OPTIONS_DEFAULTS), config), { maskInputTypes: (_a = config.maskInputTypes) !== null && _a !== void 0 ? _a : MASK_INPUT_TYPES_DEFAULT, maskClass: (_b = config.maskClass) !== null && _b !== void 0 ? _b : MASK_CLASS_DEFAULT, ignoreUrls: resolvedIgnoreUrls, urlBlueprinters: resolveUrlBlueprinters(urlBlueprinters), sessionSampleRate: (_c = config.sessionSampleRate) !== null && _c !== void 0 ? _c : 100, sessionConfig: resolveSessionConfig(config.sessionConfig), sessionRecordingConfig: resolveSessionRecordingConfig(config.sessionRecordingConfig), memoryUsageConfig: resolveMemoryUsageConfig(config.memoryUsageConfig), trackSoftNavigations: !!config.trackSoftNavigations, supportMfe: !!config.supportMfe, runOutsideAngularZone: (_d = config.runOutsideAngularZone) !== null && _d !== void 0 ? _d : true });
4118
4177
  }
4119
4178
  function resolveMemoryUsageConfig(memoryUsageConfig) {
4120
4179
  var _a;
@@ -4148,7 +4207,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
4148
4207
  return resolvedUrlBlueprinters;
4149
4208
  }
4150
4209
 
4151
- var SDK_VERSION = '3.4.0';
4210
+ var SDK_VERSION = '3.5.0';
4152
4211
 
4153
4212
  function shouldDropEvent(cxRumEvent, options) {
4154
4213
  if (isDocumentErrorWithoutMessage(cxRumEvent)) {
@@ -4499,14 +4558,17 @@ var CoralogixSpanMapProcessor = (function () {
4499
4558
  return {};
4500
4559
  };
4501
4560
  CoralogixSpanMapProcessor.prototype.resolveLabels = function (cxRumEvent) {
4502
- var _a, _b;
4561
+ var _a, _b, _c;
4503
4562
  var allLabels = cxRumEvent.labels;
4504
4563
  var labelProviders = (_a = this.sdkConfig) === null || _a === void 0 ? void 0 : _a.labelProviders;
4505
4564
  if (labelProviders === null || labelProviders === void 0 ? void 0 : labelProviders.length) {
4506
4565
  var pageUrlLabelProviders = getInternalRumData(PAGE_URL_LABEL_PROVIDERS_KEY);
4507
4566
  var networkUrlLabelProviders = getInternalRumData(NETWORK_URL_LABEL_PROVIDERS_KEY);
4508
4567
  var networkRequestFragment = (_b = cxRumEvent.network_request_context) === null || _b === void 0 ? void 0 : _b.fragments;
4509
- var labelsFromProviders = __assign(__assign({}, this.getLabelsByLabelProviders(pageUrlLabelProviders, cxRumEvent, cxRumEvent.page_context.page_fragments)), (networkRequestFragment
4568
+ var pageFragment = (_c = cxRumEvent.page_context) === null || _c === void 0 ? void 0 : _c.page_fragments;
4569
+ var labelsFromProviders = __assign(__assign({}, (pageFragment
4570
+ ? this.getLabelsByLabelProviders(pageUrlLabelProviders, cxRumEvent, pageFragment)
4571
+ : {})), (networkRequestFragment
4510
4572
  ? this.getLabelsByLabelProviders(networkUrlLabelProviders, cxRumEvent, networkRequestFragment)
4511
4573
  : {}));
4512
4574
  allLabels = __assign(__assign({}, allLabels), labelsFromProviders);
@@ -4670,22 +4732,32 @@ var SnapshotManager = (function () {
4670
4732
 
4671
4733
  var CoralogixNavigationProcessor = (function () {
4672
4734
  function CoralogixNavigationProcessor() {
4735
+ this.isResolving = false;
4673
4736
  }
4674
4737
  CoralogixNavigationProcessor.prototype.forceFlush = function () {
4675
4738
  return Promise.resolve();
4676
4739
  };
4677
4740
  CoralogixNavigationProcessor.prototype.onEnd = function (span) { };
4678
4741
  CoralogixNavigationProcessor.prototype.onStart = function (span) {
4679
- var pageContext = resolvePageContext(location.href);
4680
- if (pageContext) {
4681
- span[CoralogixAttributes.PAGE_CONTEXT] = pageContext;
4682
- var currentPageFragment = getSessionManager().currentPageFragment;
4683
- var page_fragments = pageContext.page_fragments;
4684
- if (currentPageFragment !== page_fragments) {
4685
- getSessionManager().updateCurrentPage(page_fragments);
4686
- span[CoralogixAttributes.IS_NAVIGATION_EVENT] = true;
4742
+ if (this.isResolving) {
4743
+ return;
4744
+ }
4745
+ this.isResolving = true;
4746
+ try {
4747
+ var pageContext = resolvePageContext(location.href);
4748
+ if (pageContext) {
4749
+ span[CoralogixAttributes.PAGE_CONTEXT] = pageContext;
4750
+ var currentPageFragment = getSessionManager().currentPageFragment;
4751
+ var page_fragments = pageContext.page_fragments;
4752
+ if (currentPageFragment !== page_fragments) {
4753
+ getSessionManager().updateCurrentPage(page_fragments);
4754
+ span[CoralogixAttributes.IS_NAVIGATION_EVENT] = true;
4755
+ }
4687
4756
  }
4688
4757
  }
4758
+ finally {
4759
+ this.isResolving = false;
4760
+ }
4689
4761
  };
4690
4762
  CoralogixNavigationProcessor.prototype.shutdown = function () {
4691
4763
  return Promise.resolve();
@@ -5012,13 +5084,13 @@ var CoralogixRum = {
5012
5084
  getSessionRecorder().startRecording();
5013
5085
  return;
5014
5086
  }
5015
- var intervalId = setInterval(function () {
5087
+ var intervalId = cxSetInterval(function () {
5016
5088
  if (getSessionRecorder()) {
5017
- clearInterval(intervalId);
5089
+ cxClearInterval(intervalId);
5018
5090
  getSessionRecorder().startRecording();
5019
5091
  }
5020
5092
  }, 300);
5021
- setTimeout(function () { return clearInterval(intervalId); }, 3000);
5093
+ cxSetTimeout(function () { return cxClearInterval(intervalId); }, 3000);
5022
5094
  },
5023
5095
  screenshot: function (description) {
5024
5096
  var _a;
@@ -5148,4 +5220,4 @@ var SessionRecordingEventType;
5148
5220
  SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
5149
5221
  })(SessionRecordingEventType || (SessionRecordingEventType = {}));
5150
5222
 
5151
- 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, getNowTime as a, SESSION_RECORDING_NETWORK_ERR0R_MESSAGE as b, SESSION_RECORDING_DEFAULT_HEADERS as c, SESSION_RECORDING_POSTFIX_URL as d, SESSION_RECORDER_KEY as e, MUTATION_LIMIT as f, getSdkConfig as g, SESSION_RECORDING_DEFAULT_ERROR_MESSAGE as h, CoralogixRum as i, CoralogixLogSeverity as j, SessionRecordingEventType as k, CoralogixEventType as l, UrlType as m, reportInternalEvent as r };
5223
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/browser",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "Official Coralogix SDK for browsers",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Coralogix",
@@ -27,9 +27,7 @@
27
27
  "@opentelemetry/propagator-b3": "1.25.1",
28
28
  "@opentelemetry/sdk-trace-base": "1.25.1",
29
29
  "@opentelemetry/sdk-trace-web": "1.25.1",
30
- "@rrweb/rrweb-plugin-console-record": "2.0.0-alpha.15",
31
30
  "error-stack-parser": "2.1.4",
32
- "rrweb": "2.0.0-alpha.15",
33
31
  "tslib": "2.6.3",
34
32
  "web-vitals": "4.2.3-soft-navs"
35
33
  },