@coralogix/browser 3.23.3 → 3.23.6

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,25 @@
1
+ ## 3.23.6 (2026-09-09)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - Prevent the browser tab from freezing on Safari and on every browser on iOS/iPadOS when an error is reported while the page is navigating away — a redirect on first visit, a link, or a form submit. The tab could hang at 100% CPU and grow in memory until the browser killed it, and the page being navigated to never loaded. Applications that load zone.js, such as Angular, were affected
6
+ - Prevent a `pageUrlBlueprinters` callback that throws from freezing the tab in any browser. Such a callback is now contained and reported once instead of looping; it still surfaces to your own error handling as before
7
+ - Stop the SDK's own error reporting from surfacing in your application as unhandled promise rejections
8
+
9
+ ## 3.23.5 (2026-09-02)
10
+
11
+ ### 🩹 Fixes
12
+
13
+ - Make a single `cx-metadata.json` request per microfrontend when several errors are reported at once, instead of one request per error (microfrontend support, `supportMfe`)
14
+ - Stop reporting the SDK's own `cx-metadata.json` lookups as network requests in your RUM data
15
+ - Ignore a `cx-metadata.json` served with an error status instead of reading it as metadata, which could label an error with an empty microfrontend name and version
16
+
17
+ ## 3.23.4 (2026-08-31)
18
+
19
+ ### 🩹 Fixes
20
+
21
+ - Restore canvas capture in session recording: with `recordCanvas` enabled and a numeric `sampling.canvas`, snapshots stopped after the first frame and the recording worker reported an uncaught `__awaiter is not defined` error
22
+
1
23
  ## 3.23.3 (2026-08-30)
2
24
 
3
25
  ### 🩹 Fixes
package/README.md CHANGED
@@ -960,7 +960,7 @@ CoralogixRum.init({
960
960
  > The `priority` hint only works in Chromium browsers (Chrome/Edge 101+) and is a no-op elsewhere. We type this option with our own `SdkFetchPriority` alias instead of the DOM `RequestPriority` type, so it still compiles on older TypeScript versions (the SDK supports `>= 4.4.2`).
961
961
 
962
962
  <!-- /split -->
963
- <!-- split title="Custom instrumentation" path="features/custom-instrumentation.md" -->
963
+ <!-- split title="Timing and measurements" path="features/timing-and-measurements.md" -->
964
964
  ### Custom Measurement
965
965
 
966
966
  Custom measurement allows you to send numeric data to Coralogix for precise monitoring and analysis.
@@ -1017,6 +1017,8 @@ A few behaviours worth knowing:
1017
1017
  - Ending a measurement releases its key, so the same key can be measured again afterwards.
1018
1018
  - Open measurements are dropped the next time you start or end one while the session is idle. The check runs on those calls rather than on a timer, and activity clears the idle flag, so a measurement spanning a short idle gap may still report.
1019
1019
 
1020
+ <!-- /split -->
1021
+ <!-- split title="Microfrontend support" path="configuration/microfrontend.md" -->
1020
1022
  ### Microfrontend support
1021
1023
 
1022
1024
  This feature allows you to track multiple applications on the same page.<br>
@@ -1035,6 +1037,8 @@ CoralogixRum.init({
1035
1037
  });
1036
1038
  ```
1037
1039
 
1040
+ <!-- /split -->
1041
+ <!-- split title="Custom spans" path="features/custom-spans.md" -->
1038
1042
  ### Custom Spans
1039
1043
 
1040
1044
  Create your own custom spans to track specific operations in your application.<br>
@@ -1095,6 +1099,8 @@ A few more things worth knowing:
1095
1099
  - Open global spans are ended for you when the session resets, which happens after an
1096
1100
  hour of session time or 15 minutes of inactivity.
1097
1101
 
1102
+ <!-- /split -->
1103
+ <!-- split title="Traces exporter" path="configuration/traces-exporter.md" -->
1098
1104
  ### Traces Exporter
1099
1105
 
1100
1106
  The `tracesExporter` callback gives you full control over how collected trace events are handled.
@@ -1135,6 +1141,8 @@ CoralogixRum.init({
1135
1141
  });
1136
1142
  ```
1137
1143
 
1144
+ <!-- /split -->
1145
+ <!-- split title="OpenTelemetry batching" path="configuration/opentelemetry-batching.md" -->
1138
1146
  ### OpenTelemetry Batch Configuration
1139
1147
 
1140
1148
  The SDK batches logs and traces through an OpenTelemetry `BatchSpanProcessor` before sending them to Coralogix. Use `otelConfig` to tune that batching — for example, to flush less frequently and reduce the number of network requests your app makes.
@@ -1152,6 +1160,8 @@ CoralogixRum.init({
1152
1160
  });
1153
1161
  ```
1154
1162
 
1163
+ <!-- /split -->
1164
+ <!-- split title="Soft navigations" path="configuration/soft-navigations.md" -->
1155
1165
  ### Soft Navigations — Experimental
1156
1166
 
1157
1167
  Soft navigations are navigations that do not trigger a full page reload, such as SPA navigations. Defaults to false.
@@ -1169,6 +1179,8 @@ CoralogixRum.init({
1169
1179
  });
1170
1180
  ```
1171
1181
 
1182
+ <!-- /split -->
1183
+ <!-- split title="Memory usage" path="features/memory-usage.md" -->
1172
1184
  ### Memory Usage - Experimental
1173
1185
 
1174
1186
  Memory usage is a feature that allows you to track the memory usage of your application. It uses the [measureUserAgentSpecificMemory](https://developer.mozilla.org/en-US/docs/Web/API/Performance/measureUserAgentSpecificMemory) API.<br>
package/index.esm.js CHANGED
@@ -1,4 +1,4 @@
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';
1
+ export { t as CoralogixEventType, q as CoralogixLogSeverity, p as CoralogixRum, O as OtelNetworkAttrs, P as PerformanceTypes, r as SessionRecordingEventType, U as UrlBasedLabelProvider, u 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
@@ -268,32 +268,46 @@ function getCxGlobal() {
268
268
  }
269
269
  var CxGlobal = getCxGlobal();
270
270
 
271
+ var SDK_STORE_KEY = '__cx_store__';
272
+ var CACHED_LOGS_KEY = 'cachedLogs';
273
+ var globalWithStore = CxGlobal;
274
+ var sdkStore = globalWithStore[SDK_STORE_KEY] || (globalWithStore[SDK_STORE_KEY] = {});
275
+ var globalMirror = CxGlobal;
276
+ function setSdkState(key, value) {
277
+ sdkStore[key] = value;
278
+ globalMirror[key] = value;
279
+ }
280
+ function deleteSdkState(key) {
281
+ delete sdkStore[key];
282
+ delete globalMirror[key];
283
+ }
284
+
271
285
  var CLICK_SCREENSHOT_MANAGER_KEY = 'rumClickScreenshotManager';
272
286
 
273
287
  function getSnapshotManager() {
274
- return CxGlobal[SNAPSHOT_MANAGER_KEY];
288
+ return sdkStore[SNAPSHOT_MANAGER_KEY];
275
289
  }
276
290
  function getSessionManager() {
277
- return CxGlobal[SESSION_MANAGER_KEY];
291
+ return sdkStore[SESSION_MANAGER_KEY];
278
292
  }
279
293
  function getSessionRecorder() {
280
- return CxGlobal[SESSION_RECORDER_KEY];
294
+ return sdkStore[SESSION_RECORDER_KEY];
281
295
  }
282
296
  function getClickScreenshotManager() {
283
- return CxGlobal[CLICK_SCREENSHOT_MANAGER_KEY];
297
+ return sdkStore[CLICK_SCREENSHOT_MANAGER_KEY];
284
298
  }
285
299
  function getSdkConfig() {
286
- return CxGlobal[SDK_CONFIG_KEY];
300
+ return sdkStore[SDK_CONFIG_KEY];
287
301
  }
288
302
  function getUserAgentData() {
289
- return CxGlobal[USER_AGENT_KEY];
303
+ return sdkStore[USER_AGENT_KEY];
290
304
  }
291
305
  var TRACER_PROVIDER_KEY = '__cx_tracer_provider__';
292
306
  function setTracerProvider(provider) {
293
- CxGlobal[TRACER_PROVIDER_KEY] = provider;
307
+ setSdkState(TRACER_PROVIDER_KEY, provider);
294
308
  }
295
309
  function getTracerProvider() {
296
- return CxGlobal[TRACER_PROVIDER_KEY];
310
+ return sdkStore[TRACER_PROVIDER_KEY];
297
311
  }
298
312
  function flush() {
299
313
  var tracerProvider = getTracerProvider();
@@ -309,40 +323,40 @@ var CUSTOM_TRACER_IGNORED_INSTRUMENTS = '__customTracerIgnoredInstruments__';
309
323
 
310
324
  function addGlobalSpanByTraceId(traceId, globalSpan) {
311
325
  var _a;
312
- CxGlobal[GLOBAL_SPAN_MAP_KEY] = __assign(__assign({}, (CxGlobal[GLOBAL_SPAN_MAP_KEY] || {})), (_a = {}, _a[traceId] = globalSpan, _a));
326
+ setSdkState(GLOBAL_SPAN_MAP_KEY, __assign(__assign({}, (sdkStore[GLOBAL_SPAN_MAP_KEY] || {})), (_a = {}, _a[traceId] = globalSpan, _a)));
313
327
  }
314
328
  function getGlobalSpanByTraceId(traceId) {
315
329
  var _a;
316
- return (_a = CxGlobal[GLOBAL_SPAN_MAP_KEY]) === null || _a === void 0 ? void 0 : _a[traceId];
330
+ return (_a = sdkStore[GLOBAL_SPAN_MAP_KEY]) === null || _a === void 0 ? void 0 : _a[traceId];
317
331
  }
318
332
  function clearGlobalSpanMap() {
319
- var globalSpanMap = CxGlobal[GLOBAL_SPAN_MAP_KEY];
333
+ var globalSpanMap = sdkStore[GLOBAL_SPAN_MAP_KEY];
320
334
  Object.keys(globalSpanMap || {}).forEach(function (traceId) {
321
335
  var globalSpan = globalSpanMap[traceId];
322
336
  globalSpan === null || globalSpan === void 0 ? void 0 : globalSpan.endSpan();
323
337
  });
324
- delete CxGlobal[GLOBAL_SPAN_MAP_KEY];
338
+ deleteSdkState(GLOBAL_SPAN_MAP_KEY);
325
339
  }
326
340
  function setGlobalSpan(globalSpan) {
327
- CxGlobal[GLOBAL_SPAN_KEY] = globalSpan;
341
+ setSdkState(GLOBAL_SPAN_KEY, globalSpan);
328
342
  }
329
343
  function getGlobalSpan() {
330
- return CxGlobal[GLOBAL_SPAN_KEY];
344
+ return sdkStore[GLOBAL_SPAN_KEY];
331
345
  }
332
346
  function clearGlobalSpan() {
333
- delete CxGlobal[GLOBAL_SPAN_KEY];
347
+ deleteSdkState(GLOBAL_SPAN_KEY);
334
348
  }
335
349
  function setCustomTracer(customTracer) {
336
- CxGlobal[CUSTOM_TRACER_KEY] = customTracer;
350
+ setSdkState(CUSTOM_TRACER_KEY, customTracer);
337
351
  }
338
352
  function getActiveCustomTracer() {
339
- return CxGlobal[CUSTOM_TRACER_KEY];
353
+ return sdkStore[CUSTOM_TRACER_KEY];
340
354
  }
341
355
  function setCustomTracerIgnoredInstruments(ignoredInstruments) {
342
- CxGlobal[CUSTOM_TRACER_IGNORED_INSTRUMENTS] = ignoredInstruments;
356
+ setSdkState(CUSTOM_TRACER_IGNORED_INSTRUMENTS, ignoredInstruments);
343
357
  }
344
358
  function getCustomTracerIgnoredInstruments() {
345
- return CxGlobal[CUSTOM_TRACER_IGNORED_INSTRUMENTS];
359
+ return sdkStore[CUSTOM_TRACER_IGNORED_INSTRUMENTS];
346
360
  }
347
361
  function shouldAttachSpanToGlobalSpan(instrumentationType) {
348
362
  return getGlobalSpan() && !isInstrumentationIgnored(instrumentationType);
@@ -373,15 +387,15 @@ function shouldAddOtelAttr(span) {
373
387
  return !!span[IS_OTEL_READY];
374
388
  }
375
389
  function setAttrProcessor(processor) {
376
- CxGlobal[ATTR_PROCESSOR_KEY] = processor;
390
+ setSdkState(ATTR_PROCESSOR_KEY, processor);
377
391
  }
378
392
  function getAttrProcessor() {
379
- return CxGlobal[ATTR_PROCESSOR_KEY];
393
+ return sdkStore[ATTR_PROCESSOR_KEY];
380
394
  }
381
395
 
382
396
  function setCustomLabelsForSpan(span, labels) {
383
397
  if (labels === void 0) { labels = {}; }
384
- span.setAttribute(CoralogixAttributes.CUSTOM_LABELS, JSON.stringify(getCustomMergedLabels(labels)));
398
+ span.setAttribute(CoralogixAttributes.CUSTOM_LABELS, JSON.stringify(getCustomMergedLabels(labels), getCircularReplacer()));
385
399
  }
386
400
  function getCustomMergedLabels(labels) {
387
401
  var _a;
@@ -427,6 +441,12 @@ var STACK_FRAME_LIMIT = 50;
427
441
  var STACK_LINE_LIMIT = 1024;
428
442
  var MESSAGE_LIMIT = 1024;
429
443
  var MFE_PATH_PATTERN = /https?:\/\/.*\//;
444
+ function reportFailed(e) {
445
+ var _a;
446
+ if ((_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.debug) {
447
+ console.warn('Coralogix Browser SDK - Error report failed', e);
448
+ }
449
+ }
430
450
  var V8_HEADER_PATTERN = /^Error\b/;
431
451
  function sanitizeConsoleErrorStack(stack) {
432
452
  var _a;
@@ -483,23 +503,29 @@ function parseStackFrames(err) {
483
503
  }
484
504
  function buildStacktrace(span, err) {
485
505
  return __awaiter(this, void 0, void 0, function () {
486
- var stackFrames, supportMfe;
487
- return __generator(this, function (_a) {
488
- switch (_a.label) {
506
+ var stackFrames, e_1;
507
+ var _a;
508
+ return __generator(this, function (_b) {
509
+ switch (_b.label) {
489
510
  case 0:
511
+ _b.trys.push([0, 3, , 4]);
490
512
  stackFrames = parseStackFrames(err);
491
513
  if (stackFrames.length === 0) {
492
514
  return [2];
493
515
  }
494
- supportMfe = getSdkConfig().supportMfe;
495
- if (!supportMfe) return [3, 2];
516
+ if (!((_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.supportMfe)) return [3, 2];
496
517
  return [4, handleMFE(stackFrames, span)];
497
518
  case 1:
498
- _a.sent();
499
- _a.label = 2;
519
+ _b.sent();
520
+ _b.label = 2;
500
521
  case 2:
501
522
  span[ErrorAttributes.STACK] = stackFrames;
502
- return [2];
523
+ return [3, 4];
524
+ case 3:
525
+ e_1 = _b.sent();
526
+ reportFailed(e_1);
527
+ return [3, 4];
528
+ case 4: return [2];
503
529
  }
504
530
  });
505
531
  });
@@ -536,46 +562,52 @@ function addLabelForMFE(span, lastFrame) {
536
562
  setCustomLabelsForSpan(span, { mfeApp: app, mfeVersion: version });
537
563
  }
538
564
  }
539
- function extractMetadataFromMfeStacktrace() {
540
- return __awaiter(this, arguments, void 0, function (fileName) {
541
- var metadata, cachedMetadata, MFE_METADATA_KEY, mfePath, response, _a, e_1;
542
- if (fileName === void 0) { fileName = ''; }
543
- return __generator(this, function (_b) {
544
- switch (_b.label) {
565
+ function fetchMfeMetadata(mfePath) {
566
+ return __awaiter(this, void 0, void 0, function () {
567
+ var response, _a, e_2;
568
+ var _b;
569
+ return __generator(this, function (_c) {
570
+ switch (_c.label) {
545
571
  case 0:
546
- cachedMetadata = CxGlobal[CACHED_METADATA_KEY];
547
- MFE_METADATA_KEY = 'cx-metadata.json';
548
- mfePath = extractMfePath(fileName);
549
- if (!mfePath) return [3, 7];
550
- response = void 0;
551
- if (!!(cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.has(mfePath))) return [3, 6];
552
- _b.label = 1;
553
- case 1:
554
- _b.trys.push([1, 4, , 5]);
555
- return [4, fetch("".concat(mfePath).concat(MFE_METADATA_KEY), {
572
+ _c.trys.push([0, 3, , 4]);
573
+ return [4, fetch("".concat(mfePath).concat(MFE_METADATA_FILE), {
556
574
  cache: 'no-cache',
557
575
  })];
558
- case 2:
559
- response = _b.sent();
576
+ case 1:
577
+ response = _c.sent();
578
+ if (!response.ok) {
579
+ return [2, undefined];
580
+ }
560
581
  _a = [{}];
561
582
  return [4, response.json()];
583
+ case 2: return [2, __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_c.sent())])), { mfePath: mfePath }])];
562
584
  case 3:
563
- metadata = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_b.sent())])), { mfePath: mfePath }]);
564
- return [3, 5];
565
- case 4:
566
- e_1 = _b.sent();
567
- if (getSdkConfig().debug) {
568
- console.warn('Coralogix Browser SDK - Error fetching metadata', e_1);
585
+ e_2 = _c.sent();
586
+ if ((_b = getSdkConfig()) === null || _b === void 0 ? void 0 : _b.debug) {
587
+ console.warn('Coralogix Browser SDK - Error fetching metadata', e_2);
569
588
  }
570
- return [3, 5];
571
- case 5:
572
- CxGlobal[CACHED_METADATA_KEY] = cachedMetadata.set(mfePath, metadata);
573
- return [3, 7];
574
- case 6:
575
- metadata = cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.get(mfePath);
576
- _b.label = 7;
577
- case 7: return [2, metadata];
589
+ return [2, undefined];
590
+ case 4: return [2];
591
+ }
592
+ });
593
+ });
594
+ }
595
+ function extractMetadataFromMfeStacktrace() {
596
+ return __awaiter(this, arguments, void 0, function (fileName) {
597
+ var cachedMetadata, mfePath, pending;
598
+ if (fileName === void 0) { fileName = ''; }
599
+ return __generator(this, function (_a) {
600
+ cachedMetadata = sdkStore[CACHED_METADATA_KEY];
601
+ mfePath = extractMfePath(fileName);
602
+ if (mfePath) {
603
+ pending = cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.get(mfePath);
604
+ if (!pending) {
605
+ pending = fetchMfeMetadata(mfePath);
606
+ cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.set(mfePath, pending);
607
+ }
608
+ return [2, pending];
578
609
  }
610
+ return [2, undefined];
579
611
  });
580
612
  });
581
613
  }
@@ -615,6 +647,7 @@ function addErrorDefaultAttributes(span) {
615
647
  var CoralogixErrorInstrumentation = (function (_super) {
616
648
  __extends(CoralogixErrorInstrumentation, _super);
617
649
  function CoralogixErrorInstrumentation(config) {
650
+ var _a;
618
651
  var _this = _super.call(this, ERROR_INSTRUMENTATION_NAME, ERROR_INSTRUMENTATION_VERSION, config) || this;
619
652
  _this.parseErrorObject = function (obj) {
620
653
  var _a;
@@ -625,14 +658,15 @@ var CoralogixErrorInstrumentation = (function (_super) {
625
658
  return obj === null || obj === void 0 ? void 0 : obj.toString();
626
659
  }
627
660
  };
628
- if (getSdkConfig().supportMfe) {
629
- CxGlobal[CACHED_METADATA_KEY] = new Map();
661
+ if ((_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.supportMfe) {
662
+ setSdkState(CACHED_METADATA_KEY, new Map());
630
663
  }
631
664
  return _this;
632
665
  }
633
666
  CoralogixErrorInstrumentation.prototype.init = function () { };
634
667
  CoralogixErrorInstrumentation.prototype.enable = function () {
635
- var stackTraceLimit = getSdkConfig().stackTraceLimit;
668
+ var _a;
669
+ var stackTraceLimit = ((_a = getSdkConfig()) !== null && _a !== void 0 ? _a : {}).stackTraceLimit;
636
670
  if (stackTraceLimit) {
637
671
  Error.stackTraceLimit = stackTraceLimit;
638
672
  }
@@ -656,94 +690,115 @@ var CoralogixErrorInstrumentation = (function (_super) {
656
690
  return;
657
691
  }
658
692
  }
659
- switch (true) {
660
- case arg instanceof Error:
661
- this.reportError(source, arg);
662
- break;
663
- case arg instanceof ErrorEvent:
664
- this.reportErrorEvent(source, arg);
665
- break;
666
- case arg instanceof Event:
667
- this.reportEvent(source, arg);
668
- break;
669
- case typeof arg === 'string':
670
- this.reportString(source, arg, stackContextError);
671
- break;
672
- case arg instanceof Array: {
673
- var firstError = arg.find(function (x) { return x instanceof Error; });
674
- var message = arg
675
- .map(function (msg) {
676
- return typeof msg === 'string' ? msg : _this.parseErrorObject(msg);
677
- })
678
- .join(' ');
679
- var stackSourceError = firstError !== null && firstError !== void 0 ? firstError : stackContextError;
680
- this.reportString(source, message, stackSourceError);
681
- break;
693
+ try {
694
+ switch (true) {
695
+ case arg instanceof Error:
696
+ this.reportError(source, arg);
697
+ break;
698
+ case arg instanceof ErrorEvent:
699
+ this.reportErrorEvent(source, arg);
700
+ break;
701
+ case arg instanceof Event:
702
+ this.reportEvent(source, arg);
703
+ break;
704
+ case typeof arg === 'string':
705
+ this.reportString(source, arg, stackContextError);
706
+ break;
707
+ case arg instanceof Array: {
708
+ var firstError = arg.find(function (x) { return x instanceof Error; });
709
+ var message = arg
710
+ .map(function (msg) {
711
+ return typeof msg === 'string' ? msg : _this.parseErrorObject(msg);
712
+ })
713
+ .join(' ');
714
+ var stackSourceError = firstError !== null && firstError !== void 0 ? firstError : stackContextError;
715
+ this.reportString(source, message, stackSourceError);
716
+ break;
717
+ }
718
+ default:
719
+ this.reportString(source, typeof arg === 'string' ? arg : this.getPossibleEventMessage(arg));
682
720
  }
683
- default:
684
- this.reportString(source, typeof arg === 'string' ? arg : this.getPossibleEventMessage(arg));
721
+ }
722
+ catch (e) {
723
+ reportFailed(e);
685
724
  }
686
725
  };
687
726
  CoralogixErrorInstrumentation.prototype.reportError = function (source, err, customData, labels) {
688
727
  return __awaiter(this, void 0, void 0, function () {
689
- var message, name, span, cleanMessage, supportMfe;
690
- return __generator(this, function (_b) {
691
- switch (_b.label) {
728
+ var message, name_1, cleanMessage, data, span, e_3;
729
+ var _b;
730
+ return __generator(this, function (_c) {
731
+ switch (_c.label) {
692
732
  case 0:
693
- message = err.message, name = err.name;
694
- span = this.createSpan('error');
733
+ _c.trys.push([0, 4, , 5]);
734
+ message = err.message, name_1 = err.name;
695
735
  cleanMessage = message.split('\n')[0];
736
+ data = customData
737
+ ? JSON.stringify(customData, getCircularReplacer())
738
+ : undefined;
739
+ span = this.createSpan('error');
696
740
  addErrorDefaultAttributes(span);
697
741
  span.setAttribute(CoralogixAttributes.SOURCE, source);
698
- span.setAttribute(ErrorAttributes.TYPE, name);
742
+ span.setAttribute(ErrorAttributes.TYPE, name_1);
699
743
  span.setAttribute(ErrorAttributes.MESSAGE, cleanMessage);
700
- if (customData) {
701
- span[ErrorAttributes.DATA] = JSON.stringify(customData, getCircularReplacer());
744
+ if (data) {
745
+ span[ErrorAttributes.DATA] = data;
702
746
  }
703
747
  if (labels) {
704
748
  setCustomLabelsForSpan(span, labels);
705
749
  }
706
- supportMfe = getSdkConfig().supportMfe;
707
- if (!supportMfe) return [3, 2];
750
+ if (!((_b = getSdkConfig()) === null || _b === void 0 ? void 0 : _b.supportMfe)) return [3, 2];
708
751
  return [4, buildStacktrace(span, err)];
709
752
  case 1:
710
- _b.sent();
753
+ _c.sent();
711
754
  return [3, 3];
712
755
  case 2:
713
756
  void buildStacktrace(span, err);
714
- _b.label = 3;
757
+ _c.label = 3;
715
758
  case 3:
716
759
  span.end();
717
- return [2];
760
+ return [3, 5];
761
+ case 4:
762
+ e_3 = _c.sent();
763
+ reportFailed(e_3);
764
+ return [3, 5];
765
+ case 5: return [2];
718
766
  }
719
767
  });
720
768
  });
721
769
  };
722
770
  CoralogixErrorInstrumentation.prototype.reportString = function (source, message, stackError) {
723
771
  return __awaiter(this, void 0, void 0, function () {
724
- var span, supportMfe;
725
- return __generator(this, function (_b) {
726
- switch (_b.label) {
772
+ var cleanMessage, span, e_4;
773
+ var _b;
774
+ return __generator(this, function (_c) {
775
+ switch (_c.label) {
727
776
  case 0:
777
+ _c.trys.push([0, 5, , 6]);
778
+ cleanMessage = message === null || message === void 0 ? void 0 : message.substring(0, MESSAGE_LIMIT);
728
779
  span = this.createSpan(source);
729
780
  addErrorDefaultAttributes(span);
730
781
  span.setAttribute(CoralogixAttributes.SOURCE, source);
731
- span.setAttribute(ErrorAttributes.MESSAGE, message === null || message === void 0 ? void 0 : message.substring(0, MESSAGE_LIMIT));
732
- supportMfe = getSdkConfig().supportMfe;
782
+ span.setAttribute(ErrorAttributes.MESSAGE, cleanMessage);
733
783
  if (!stackError) return [3, 4];
734
- if (!supportMfe) return [3, 2];
784
+ if (!((_b = getSdkConfig()) === null || _b === void 0 ? void 0 : _b.supportMfe)) return [3, 2];
735
785
  return [4, buildStacktrace(span, stackError)];
736
786
  case 1:
737
- _b.sent();
787
+ _c.sent();
738
788
  return [3, 3];
739
789
  case 2:
740
790
  void buildStacktrace(span, stackError);
741
- _b.label = 3;
791
+ _c.label = 3;
742
792
  case 3:
743
- _b.label = 4;
793
+ _c.label = 4;
744
794
  case 4:
745
795
  span.end();
746
- return [2];
796
+ return [3, 6];
797
+ case 5:
798
+ e_4 = _c.sent();
799
+ reportFailed(e_4);
800
+ return [3, 6];
801
+ case 6: return [2];
747
802
  }
748
803
  });
749
804
  });
@@ -3151,6 +3206,8 @@ var CoralogixWorkerInstrumentation = (function (_super) {
3151
3206
 
3152
3207
  var CORALOGIX_LOGS_URL_SUFFIX = '/browser/v1beta/logs';
3153
3208
  var CORALOGIX_RECORDING_URL_SUFFIX = '/sessionrecording';
3209
+ var MFE_METADATA_FILE = 'cx-metadata.json';
3210
+ var MFE_METADATA_URL_PATTERN = /cx-metadata\.json$/;
3154
3211
  var MAX_INTERACTION_ELEMENT_SIZE = 1024;
3155
3212
  var MAX_CHARACTERS = 1024;
3156
3213
  var REQUIRED_CONFIG_KEYS = [
@@ -3207,6 +3264,7 @@ var OPTIONS_DEFAULTS = {
3207
3264
  ignoreUrls: [
3208
3265
  new RegExp(CORALOGIX_LOGS_URL_SUFFIX),
3209
3266
  new RegExp(CORALOGIX_RECORDING_URL_SUFFIX),
3267
+ MFE_METADATA_URL_PATTERN,
3210
3268
  ],
3211
3269
  user_context: {
3212
3270
  user_id: '',
@@ -3354,14 +3412,14 @@ var PAGE_URL_PARTS_KEY = 'rum_page_url_parts';
3354
3412
  var REFERRER_URL_PARTS_KEY = 'rum_referrer_url_parts';
3355
3413
 
3356
3414
  function saveInternalRumData(key, value) {
3357
- if (!CxGlobal[RUM_INTERNAL_DATA_KEY]) {
3358
- CxGlobal[RUM_INTERNAL_DATA_KEY] = {};
3415
+ if (!sdkStore[RUM_INTERNAL_DATA_KEY]) {
3416
+ setSdkState(RUM_INTERNAL_DATA_KEY, {});
3359
3417
  }
3360
- CxGlobal[RUM_INTERNAL_DATA_KEY][key] = value;
3418
+ sdkStore[RUM_INTERNAL_DATA_KEY][key] = value;
3361
3419
  }
3362
3420
  function getInternalRumData(key) {
3363
3421
  var _a;
3364
- return (_a = CxGlobal[RUM_INTERNAL_DATA_KEY]) === null || _a === void 0 ? void 0 : _a[key];
3422
+ return (_a = sdkStore[RUM_INTERNAL_DATA_KEY]) === null || _a === void 0 ? void 0 : _a[key];
3365
3423
  }
3366
3424
 
3367
3425
  var _a$2;
@@ -3604,14 +3662,14 @@ function applyUrlBluePrinters(_a) {
3604
3662
  return blueprintedUrl;
3605
3663
  }
3606
3664
  function resolvePageContext(url) {
3607
- var _a;
3665
+ var _a, _b, _c, _d;
3608
3666
  var page_url_blueprint = applyUrlBluePrinters({
3609
3667
  url: url,
3610
- blueprinters: (_a = getSdkConfig().urlBlueprinters) === null || _a === void 0 ? void 0 : _a.pageUrlBlueprinters,
3668
+ blueprinters: (_b = (_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.urlBlueprinters) === null || _b === void 0 ? void 0 : _b.pageUrlBlueprinters,
3611
3669
  });
3612
3670
  var page_fragments = getUrlFragments(page_url_blueprint);
3613
3671
  var urlParts = getCachedUrlParts(PAGE_URL_PARTS_KEY, url);
3614
- var referrerParts = getCachedUrlParts(REFERRER_URL_PARTS_KEY, document === null || document === void 0 ? void 0 : document.referrer);
3672
+ var referrerParts = getCachedUrlParts(REFERRER_URL_PARTS_KEY, (_c = CxGlobal.document) === null || _c === void 0 ? void 0 : _c.referrer);
3615
3673
  return {
3616
3674
  page_url: url.slice(0, MAX_CHARACTERS),
3617
3675
  page_url_blueprint: page_url_blueprint,
@@ -3620,7 +3678,7 @@ function resolvePageContext(url) {
3620
3678
  subdomain: urlParts === null || urlParts === void 0 ? void 0 : urlParts.subdomain,
3621
3679
  domain: urlParts === null || urlParts === void 0 ? void 0 : urlParts.domain,
3622
3680
  host: urlParts === null || urlParts === void 0 ? void 0 : urlParts.host,
3623
- referrer: document.referrer,
3681
+ referrer: (_d = CxGlobal.document) === null || _d === void 0 ? void 0 : _d.referrer,
3624
3682
  referrer_path: referrerParts === null || referrerParts === void 0 ? void 0 : referrerParts.path,
3625
3683
  referrer_schema: referrerParts === null || referrerParts === void 0 ? void 0 : referrerParts.schema,
3626
3684
  referrer_subdomain: referrerParts === null || referrerParts === void 0 ? void 0 : referrerParts.subdomain,
@@ -4440,7 +4498,8 @@ var CoralogixExporter = (function () {
4440
4498
  return cxSpans;
4441
4499
  }, []);
4442
4500
  this.invokeLogRequest(instrumentationLogs);
4443
- var cachedLogs = (CxGlobal.cachedLogs = __spreadArray(__spreadArray([], __read$1((CxGlobal.cachedLogs || [])), false), __read$1(currentSpans), false));
4501
+ var cachedLogs = __spreadArray(__spreadArray([], __read$1((sdkStore[CACHED_LOGS_KEY] || [])), false), __read$1(currentSpans), false);
4502
+ setSdkState(CACHED_LOGS_KEY, cachedLogs);
4444
4503
  var logsCounter = cachedLogs.length;
4445
4504
  if (logsCounter > maxRumEventsForSessionWithError && !sessionHasError) {
4446
4505
  this.clearCachedDataForSessionWithError();
@@ -4472,7 +4531,7 @@ var CoralogixExporter = (function () {
4472
4531
  return strippedLogs;
4473
4532
  };
4474
4533
  CoralogixExporter.prototype.clearCachedDataForSessionWithError = function () {
4475
- CxGlobal.cachedLogs = [];
4534
+ setSdkState(CACHED_LOGS_KEY, []);
4476
4535
  this.batchTimeDelay = BATCH_TIME_DELAY;
4477
4536
  };
4478
4537
  CoralogixExporter.prototype.shutdown = function () {
@@ -4566,7 +4625,7 @@ var SnapshotManager = (function () {
4566
4625
  _this._isSnapshotSentDueToRecording = false;
4567
4626
  clearStoredSnapshotState();
4568
4627
  };
4569
- CxGlobal[SNAPSHOT_MANAGER_KEY] = this;
4628
+ setSdkState(SNAPSHOT_MANAGER_KEY, this);
4570
4629
  if (!this.restoreSnapshot()) {
4571
4630
  this.resetSnapshot();
4572
4631
  }
@@ -4896,7 +4955,7 @@ var SessionManager = (function (_super) {
4896
4955
  return __generator(this, function (_a) {
4897
4956
  switch (_a.label) {
4898
4957
  case 0:
4899
- CxGlobal[SESSION_MANAGER_KEY] = this;
4958
+ setSdkState(SESSION_MANAGER_KEY, this);
4900
4959
  this.sessionRecorderConfig = recordConfig;
4901
4960
  if (!(recordConfig === null || recordConfig === void 0 ? void 0 : recordConfig.enable)) return [3, 3];
4902
4961
  recordingSamplingEnabled = isSamplingOn(recordConfig.sessionRecordingSampleRate);
@@ -5215,7 +5274,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
5215
5274
  return resolvedUrlBlueprinters;
5216
5275
  }
5217
5276
 
5218
- var SDK_VERSION = '3.23.3';
5277
+ var SDK_VERSION = '3.23.6';
5219
5278
 
5220
5279
  function shouldDropEvent(cxRumEvent, options) {
5221
5280
  if (isDocumentErrorWithoutMessage(cxRumEvent)) {
@@ -5745,17 +5804,18 @@ var CoralogixNavigationProcessor = (function () {
5745
5804
  this.isResolving = true;
5746
5805
  try {
5747
5806
  var pageContext = resolvePageContext(location.href);
5748
- if (pageContext) {
5807
+ var sessionManager = getSessionManager();
5808
+ if (pageContext && sessionManager) {
5749
5809
  span[CoralogixAttributes.PAGE_CONTEXT] = pageContext;
5750
- var previousPageFragment = getSessionManager().currentPageFragment;
5810
+ var previousPageFragment = sessionManager.currentPageFragment;
5751
5811
  var page_fragments = pageContext.page_fragments;
5752
5812
  if (previousPageFragment !== page_fragments) {
5753
- getSessionManager().updateCurrentPage(page_fragments);
5813
+ sessionManager.updateCurrentPage(page_fragments);
5754
5814
  span[CoralogixAttributes.IS_NAVIGATION_EVENT] = true;
5755
5815
  this.handlePageNavigation(previousPageFragment);
5756
5816
  (_a = getClickScreenshotManager()) === null || _a === void 0 ? void 0 : _a.onNavigation();
5757
5817
  }
5758
- span[CoralogixAttributes.VIEW_NUMBER] = getSessionManager().viewNumber;
5818
+ span[CoralogixAttributes.VIEW_NUMBER] = sessionManager.viewNumber;
5759
5819
  }
5760
5820
  }
5761
5821
  finally {
@@ -5763,8 +5823,9 @@ var CoralogixNavigationProcessor = (function () {
5763
5823
  }
5764
5824
  };
5765
5825
  CoralogixNavigationProcessor.prototype.handlePageNavigation = function (previousPageFragment) {
5826
+ var _a;
5766
5827
  if (previousPageFragment) {
5767
- getSessionManager().incrementViewNumber();
5828
+ (_a = getSessionManager()) === null || _a === void 0 ? void 0 : _a.incrementViewNumber();
5768
5829
  }
5769
5830
  };
5770
5831
  CoralogixNavigationProcessor.prototype.shutdown = function () {
@@ -5808,10 +5869,10 @@ var ClickScreenshotManager = (function () {
5808
5869
  CoralogixRum.screenshot(CX_PREFIX);
5809
5870
  }
5810
5871
  };
5811
- CxGlobal[CLICK_SCREENSHOT_MANAGER_KEY] = this;
5872
+ setSdkState(CLICK_SCREENSHOT_MANAGER_KEY, this);
5812
5873
  }
5813
5874
  ClickScreenshotManager.unregister = function () {
5814
- CxGlobal[CLICK_SCREENSHOT_MANAGER_KEY] = undefined;
5875
+ deleteSdkState(CLICK_SCREENSHOT_MANAGER_KEY);
5815
5876
  };
5816
5877
  return ClickScreenshotManager;
5817
5878
  }());
@@ -5891,8 +5952,8 @@ var CoralogixRum = {
5891
5952
  if (!resolvedOptions_1) {
5892
5953
  return;
5893
5954
  }
5894
- CxGlobal[USER_AGENT_KEY] = parseUserAgent(navigator.userAgent);
5895
- CxGlobal[SDK_CONFIG_KEY] = resolvedOptions_1;
5955
+ setSdkState(USER_AGENT_KEY, parseUserAgent(navigator.userAgent));
5956
+ setSdkState(SDK_CONFIG_KEY, resolvedOptions_1);
5896
5957
  var sampler = getResolvedSampler();
5897
5958
  if (!resolvedOptions_1.debug && !resolvedOptions_1.public_key) {
5898
5959
  console.warn('rumAuth will be required in the future');
@@ -6317,4 +6378,4 @@ var SessionRecordingEventType;
6317
6378
  SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
6318
6379
  })(SessionRecordingEventType || (SessionRecordingEventType = {}));
6319
6380
 
6320
- 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 };
6381
+ 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, setSdkState as s, CoralogixEventType as t, UrlType as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/browser",
3
- "version": "3.23.3",
3
+ "version": "3.23.6",
4
4
  "description": "Official Coralogix SDK for browsers",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Coralogix",
@@ -1,5 +1,5 @@
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, S as SESSION_RECORDER_SEGMENTS_MAP, f as getSdkConfig, h as cxClearInterval, 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';
1
+ import { __values, __spreadArray, __read, __assign, __rest, __awaiter, __generator } 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, S as SESSION_RECORDER_SEGMENTS_MAP, f as getSdkConfig, h as cxClearInterval, 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, s as setSdkState, 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';
@@ -4230,78 +4230,69 @@ function getImageBitmapWorkerString() {
4230
4230
  var lastBlobMap = new Map();
4231
4231
  var transparentBlobMap = new Map();
4232
4232
  function getTransparentBlobFor(width, height, dataURLOptions) {
4233
- return __awaiter(this, void 0, void 0, function () {
4234
- var id, offscreen, blob, arrayBuffer, base64;
4235
- return __generator(this, function (_a) {
4236
- switch (_a.label) {
4237
- case 0:
4238
- id = width + '-' + height;
4239
- if (!('OffscreenCanvas' in globalThis)) return [3, 3];
4240
- if (transparentBlobMap.has(id))
4241
- return [2, transparentBlobMap.get(id)];
4242
- offscreen = new OffscreenCanvas(width, height);
4243
- offscreen.getContext('2d');
4244
- return [4, offscreen.convertToBlob(dataURLOptions)];
4245
- case 1:
4246
- blob = _a.sent();
4247
- return [4, blob.arrayBuffer()];
4248
- case 2:
4249
- arrayBuffer = _a.sent();
4250
- base64 = encode(arrayBuffer);
4251
- transparentBlobMap.set(id, base64);
4252
- return [2, base64];
4253
- case 3: return [2, ''];
4254
- }
4233
+ var id = width + '-' + height;
4234
+ if ('OffscreenCanvas' in globalThis) {
4235
+ var cached = transparentBlobMap.get(id);
4236
+ if (cached !== undefined)
4237
+ return Promise.resolve(cached);
4238
+ var offscreen = new OffscreenCanvas(width, height);
4239
+ offscreen.getContext('2d');
4240
+ return offscreen
4241
+ .convertToBlob(dataURLOptions)
4242
+ .then(function (blob) {
4243
+ return blob.arrayBuffer();
4244
+ })
4245
+ .then(function (arrayBuffer) {
4246
+ var base64 = encode(arrayBuffer);
4247
+ transparentBlobMap.set(id, base64);
4248
+ return base64;
4255
4249
  });
4250
+ }
4251
+ else {
4252
+ return Promise.resolve('');
4253
+ }
4254
+ }
4255
+ function sendSnapshot(id, type, base64, width, height) {
4256
+ if (lastBlobMap.get(id) === base64)
4257
+ return self.postMessage({ id: id });
4258
+ self.postMessage({
4259
+ id: id,
4260
+ type: type,
4261
+ base64: base64,
4262
+ width: width,
4263
+ height: height,
4256
4264
  });
4265
+ lastBlobMap.set(id, base64);
4257
4266
  }
4258
4267
  self.onmessage = function (e) {
4259
- return __awaiter(this, void 0, void 0, function () {
4260
- var _a, id, bitmap, width, height, dataURLOptions, transparentBase64, offscreen, ctx, blob, type, arrayBuffer, base64, _b;
4261
- return __generator(this, function (_c) {
4262
- switch (_c.label) {
4263
- case 0:
4264
- if (!('OffscreenCanvas' in globalThis)) return [3, 5];
4265
- _a = e.data, id = _a.id, bitmap = _a.bitmap, width = _a.width, height = _a.height, dataURLOptions = _a.dataURLOptions;
4266
- transparentBase64 = getTransparentBlobFor(width, height, dataURLOptions);
4267
- offscreen = new OffscreenCanvas(width, height);
4268
- ctx = offscreen.getContext('2d');
4269
- ctx.drawImage(bitmap, 0, 0);
4270
- bitmap.close();
4271
- return [4, offscreen.convertToBlob(dataURLOptions)];
4272
- case 1:
4273
- blob = _c.sent();
4274
- type = blob.type;
4275
- return [4, blob.arrayBuffer()];
4276
- case 2:
4277
- arrayBuffer = _c.sent();
4278
- base64 = encode(arrayBuffer);
4279
- _b = !lastBlobMap.has(id);
4280
- if (!_b) return [3, 4];
4281
- return [4, transparentBase64];
4282
- case 3:
4283
- _b = (_c.sent()) === base64;
4284
- _c.label = 4;
4285
- case 4:
4286
- if (_b) {
4287
- lastBlobMap.set(id, base64);
4288
- return [2, self.postMessage({ id: id })];
4289
- }
4290
- if (lastBlobMap.get(id) === base64)
4291
- return [2, self.postMessage({ id: id })];
4292
- self.postMessage({
4293
- id: id,
4294
- type: type,
4295
- base64: base64,
4296
- width: width,
4297
- height: height,
4298
- });
4268
+ if (!('OffscreenCanvas' in globalThis)) {
4269
+ return self.postMessage({ id: e.data.id });
4270
+ }
4271
+ var _a = e.data, id = _a.id, bitmap = _a.bitmap, width = _a.width, height = _a.height, dataURLOptions = _a.dataURLOptions;
4272
+ var transparentBase64 = getTransparentBlobFor(width, height, dataURLOptions);
4273
+ var offscreen = new OffscreenCanvas(width, height);
4274
+ var ctx = offscreen.getContext('2d');
4275
+ ctx.drawImage(bitmap, 0, 0);
4276
+ bitmap.close();
4277
+ var type = '';
4278
+ return offscreen
4279
+ .convertToBlob(dataURLOptions)
4280
+ .then(function (blob) {
4281
+ type = blob.type;
4282
+ return blob.arrayBuffer();
4283
+ })
4284
+ .then(function (arrayBuffer) {
4285
+ var base64 = encode(arrayBuffer);
4286
+ if (!lastBlobMap.has(id)) {
4287
+ return transparentBase64.then(function (transparent) {
4288
+ if (transparent === base64) {
4299
4289
  lastBlobMap.set(id, base64);
4300
- return [3, 6];
4301
- case 5: return [2, self.postMessage({ id: e.data.id })];
4302
- case 6: return [2];
4303
- }
4304
- });
4290
+ return self.postMessage({ id: id });
4291
+ }
4292
+ return sendSnapshot(id, type, base64, width, height);
4293
+ });
4294
+ }
4295
+ return sendSnapshot(id, type, base64, width, height);
4305
4296
  });
4306
4297
  };
4307
4298
  }
@@ -5802,7 +5793,7 @@ var SessionRecorder = (function () {
5802
5793
  _this.batchTimeDelay = BATCH_TIME_DELAY;
5803
5794
  }
5804
5795
  };
5805
- CxGlobal[SESSION_RECORDER_KEY] = this;
5796
+ setSdkState(SESSION_RECORDER_KEY, this);
5806
5797
  this.sessionManager = sessionManager;
5807
5798
  if ((_b = getSdkConfig().sessionConfig) === null || _b === void 0 ? void 0 : _b.keepSessionAfterReload) {
5808
5799
  this.restoreSegmentIndexCounter();
@@ -2,6 +2,8 @@ import { CoralogixBrowserSdkConfig, InputType } from './types';
2
2
  import { InternalInstrumentationConfig } from './instrumentations/instrumentation.model';
3
3
  export declare const CORALOGIX_LOGS_URL_SUFFIX = "/browser/v1beta/logs";
4
4
  export declare const CORALOGIX_RECORDING_URL_SUFFIX = "/sessionrecording";
5
+ export declare const MFE_METADATA_FILE = "cx-metadata.json";
6
+ export declare const MFE_METADATA_URL_PATTERN: RegExp;
5
7
  export declare const MAX_INTERACTION_ELEMENT_SIZE = 1024;
6
8
  export declare const MAX_CHARACTERS = 1024;
7
9
  export declare const REQUIRED_CONFIG_KEYS: Array<keyof CoralogixBrowserSdkConfig>;
@@ -1,6 +1,8 @@
1
1
  import { InstrumentationBase, InstrumentationConfig } from '@opentelemetry/instrumentation';
2
2
  import { CoralogixRumLabels, CxStackFrame } from '../types';
3
+ import { MFEMetadata } from '../mfe/mfe.types';
3
4
  import { ErrorSource } from './instrumentation.model';
5
+ export declare const CACHED_METADATA_KEY = "__cx_metadata__";
4
6
  export declare const STACK_FRAME_LIMIT = 50;
5
7
  export declare const STACK_LINE_LIMIT = 1024;
6
8
  export declare function sanitizeConsoleErrorStack(stack: string | undefined): string | undefined;
@@ -16,6 +18,7 @@ interface CoralogixErrorInstrumentationConfig extends InstrumentationConfig {
16
18
  ignoreErrors?: Array<string | RegExp>;
17
19
  }
18
20
  export declare function parseStackFrames(err: Error): CxStackFrame[];
21
+ export declare function extractMetadataFromMfeStacktrace(fileName?: string): Promise<MFEMetadata | undefined>;
19
22
  export declare class CoralogixErrorInstrumentation extends InstrumentationBase {
20
23
  constructor(config: CoralogixErrorInstrumentationConfig);
21
24
  protected init(): void;
@@ -0,0 +1,6 @@
1
+ export declare const SDK_STORE_KEY = "__cx_store__";
2
+ export declare const CACHED_LOGS_KEY = "cachedLogs";
3
+ export type SdkStore = Record<string, any>;
4
+ export declare const sdkStore: SdkStore;
5
+ export declare function setSdkState(key: string, value: unknown): void;
6
+ export declare function deleteSdkState(key: string): void;
package/src/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "3.23.3";
1
+ export declare const SDK_VERSION = "3.23.6";