@coralogix/browser 3.23.3 → 3.23.5

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,17 @@
1
+ ## 3.23.5 (2026-09-02)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - 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`)
6
+ - Stop reporting the SDK's own `cx-metadata.json` lookups as network requests in your RUM data
7
+ - 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
8
+
9
+ ## 3.23.4 (2026-08-31)
10
+
11
+ ### 🩹 Fixes
12
+
13
+ - 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
14
+
1
15
  ## 3.23.3 (2026-08-30)
2
16
 
3
17
  ### 🩹 Fixes
package/index.esm2.js CHANGED
@@ -536,46 +536,52 @@ function addLabelForMFE(span, lastFrame) {
536
536
  setCustomLabelsForSpan(span, { mfeApp: app, mfeVersion: version });
537
537
  }
538
538
  }
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) {
539
+ function fetchMfeMetadata(mfePath) {
540
+ return __awaiter(this, void 0, void 0, function () {
541
+ var response, _a, e_1;
542
+ var _b;
543
+ return __generator(this, function (_c) {
544
+ switch (_c.label) {
545
545
  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), {
546
+ _c.trys.push([0, 3, , 4]);
547
+ return [4, fetch("".concat(mfePath).concat(MFE_METADATA_FILE), {
556
548
  cache: 'no-cache',
557
549
  })];
558
- case 2:
559
- response = _b.sent();
550
+ case 1:
551
+ response = _c.sent();
552
+ if (!response.ok) {
553
+ return [2, undefined];
554
+ }
560
555
  _a = [{}];
561
556
  return [4, response.json()];
557
+ case 2: return [2, __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_c.sent())])), { mfePath: mfePath }])];
562
558
  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) {
559
+ e_1 = _c.sent();
560
+ if ((_b = getSdkConfig()) === null || _b === void 0 ? void 0 : _b.debug) {
568
561
  console.warn('Coralogix Browser SDK - Error fetching metadata', e_1);
569
562
  }
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];
563
+ return [2, undefined];
564
+ case 4: return [2];
565
+ }
566
+ });
567
+ });
568
+ }
569
+ function extractMetadataFromMfeStacktrace() {
570
+ return __awaiter(this, arguments, void 0, function (fileName) {
571
+ var cachedMetadata, mfePath, pending;
572
+ if (fileName === void 0) { fileName = ''; }
573
+ return __generator(this, function (_a) {
574
+ cachedMetadata = CxGlobal[CACHED_METADATA_KEY];
575
+ mfePath = extractMfePath(fileName);
576
+ if (mfePath) {
577
+ pending = cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.get(mfePath);
578
+ if (!pending) {
579
+ pending = fetchMfeMetadata(mfePath);
580
+ cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.set(mfePath, pending);
581
+ }
582
+ return [2, pending];
578
583
  }
584
+ return [2, undefined];
579
585
  });
580
586
  });
581
587
  }
@@ -3151,6 +3157,8 @@ var CoralogixWorkerInstrumentation = (function (_super) {
3151
3157
 
3152
3158
  var CORALOGIX_LOGS_URL_SUFFIX = '/browser/v1beta/logs';
3153
3159
  var CORALOGIX_RECORDING_URL_SUFFIX = '/sessionrecording';
3160
+ var MFE_METADATA_FILE = 'cx-metadata.json';
3161
+ var MFE_METADATA_URL_PATTERN = /cx-metadata\.json$/;
3154
3162
  var MAX_INTERACTION_ELEMENT_SIZE = 1024;
3155
3163
  var MAX_CHARACTERS = 1024;
3156
3164
  var REQUIRED_CONFIG_KEYS = [
@@ -3207,6 +3215,7 @@ var OPTIONS_DEFAULTS = {
3207
3215
  ignoreUrls: [
3208
3216
  new RegExp(CORALOGIX_LOGS_URL_SUFFIX),
3209
3217
  new RegExp(CORALOGIX_RECORDING_URL_SUFFIX),
3218
+ MFE_METADATA_URL_PATTERN,
3210
3219
  ],
3211
3220
  user_context: {
3212
3221
  user_id: '',
@@ -5215,7 +5224,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
5215
5224
  return resolvedUrlBlueprinters;
5216
5225
  }
5217
5226
 
5218
- var SDK_VERSION = '3.23.3';
5227
+ var SDK_VERSION = '3.23.5';
5219
5228
 
5220
5229
  function shouldDropEvent(cxRumEvent, options) {
5221
5230
  if (isDocumentErrorWithoutMessage(cxRumEvent)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/browser",
3
- "version": "3.23.3",
3
+ "version": "3.23.5",
4
4
  "description": "Official Coralogix SDK for browsers",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Coralogix",
@@ -1,4 +1,4 @@
1
- import { __values, __spreadArray, __read, __assign, __awaiter, __generator, __rest } from 'tslib';
1
+ import { __values, __spreadArray, __read, __assign, __rest, __awaiter, __generator } from 'tslib';
2
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';
3
3
  import '@opentelemetry/sdk-trace-base';
4
4
  import '@opentelemetry/sdk-trace-web';
@@ -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
  }
@@ -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;
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.5";