@coralogix/browser 2.8.5 → 2.8.7

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/index.esm2.js CHANGED
@@ -1,15 +1,150 @@
1
- import { __assign, __extends, __awaiter, __generator, __read as __read$1, __spreadArray, __rest, __values as __values$1 } from 'tslib';
2
1
  import { SamplingDecision, AlwaysOnSampler, BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
3
2
  import { getElementXPath, WebTracerProvider } from '@opentelemetry/sdk-trace-web';
4
3
  import { InstrumentationBase, registerInstrumentations } from '@opentelemetry/instrumentation';
5
- import ErrorStackParser from 'error-stack-parser';
6
4
  import { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';
7
5
  import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
8
6
  import { onFID, onCLS, onLCP, onFCP, onINP, onTTFB } from 'web-vitals/attribution';
9
- import { createContextKey, baggageEntryMetadataFromString, propagation, diag, trace, isSpanContextValid, TraceFlags, context } from '@opentelemetry/api';
7
+ import { ExportResultCode, W3CBaggagePropagator, W3CTraceContextPropagator, CompositePropagator } from '@opentelemetry/core';
8
+ import { trace, context } from '@opentelemetry/api';
10
9
  import { B3Propagator, B3InjectEncoding } from '@opentelemetry/propagator-b3';
11
10
  import { AWSXRayPropagator } from '@opentelemetry/propagator-aws-xray';
12
11
 
12
+ /******************************************************************************
13
+ Copyright (c) Microsoft Corporation.
14
+
15
+ Permission to use, copy, modify, and/or distribute this software for any
16
+ purpose with or without fee is hereby granted.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
19
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
20
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
21
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
22
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
23
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24
+ PERFORMANCE OF THIS SOFTWARE.
25
+ ***************************************************************************** */
26
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
27
+
28
+ var extendStatics = function(d, b) {
29
+ extendStatics = Object.setPrototypeOf ||
30
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
31
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
32
+ return extendStatics(d, b);
33
+ };
34
+
35
+ function __extends(d, b) {
36
+ if (typeof b !== "function" && b !== null)
37
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
38
+ extendStatics(d, b);
39
+ function __() { this.constructor = d; }
40
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41
+ }
42
+
43
+ var __assign = function() {
44
+ __assign = Object.assign || function __assign(t) {
45
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
46
+ s = arguments[i];
47
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
48
+ }
49
+ return t;
50
+ };
51
+ return __assign.apply(this, arguments);
52
+ };
53
+
54
+ function __rest(s, e) {
55
+ var t = {};
56
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
57
+ t[p] = s[p];
58
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
59
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
60
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
61
+ t[p[i]] = s[p[i]];
62
+ }
63
+ return t;
64
+ }
65
+
66
+ function __awaiter(thisArg, _arguments, P, generator) {
67
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
68
+ return new (P || (P = Promise))(function (resolve, reject) {
69
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
70
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
71
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
72
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
73
+ });
74
+ }
75
+
76
+ function __generator(thisArg, body) {
77
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
78
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
79
+ function verb(n) { return function (v) { return step([n, v]); }; }
80
+ function step(op) {
81
+ if (f) throw new TypeError("Generator is already executing.");
82
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
83
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
84
+ if (y = 0, t) op = [op[0] & 2, t.value];
85
+ switch (op[0]) {
86
+ case 0: case 1: t = op; break;
87
+ case 4: _.label++; return { value: op[1], done: false };
88
+ case 5: _.label++; y = op[1]; op = [0]; continue;
89
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
90
+ default:
91
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
92
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
93
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
94
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
95
+ if (t[2]) _.ops.pop();
96
+ _.trys.pop(); continue;
97
+ }
98
+ op = body.call(thisArg, _);
99
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
100
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
101
+ }
102
+ }
103
+
104
+ function __values(o) {
105
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
106
+ if (m) return m.call(o);
107
+ if (o && typeof o.length === "number") return {
108
+ next: function () {
109
+ if (o && i >= o.length) o = void 0;
110
+ return { value: o && o[i++], done: !o };
111
+ }
112
+ };
113
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
114
+ }
115
+
116
+ function __read(o, n) {
117
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
118
+ if (!m) return o;
119
+ var i = m.call(o), r, ar = [], e;
120
+ try {
121
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
122
+ }
123
+ catch (error) { e = { error: error }; }
124
+ finally {
125
+ try {
126
+ if (r && !r.done && (m = i["return"])) m.call(i);
127
+ }
128
+ finally { if (e) throw e.error; }
129
+ }
130
+ return ar;
131
+ }
132
+
133
+ function __spreadArray(to, from, pack) {
134
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
135
+ if (ar || !(i in from)) {
136
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
137
+ ar[i] = from[i];
138
+ }
139
+ }
140
+ return to.concat(ar || Array.prototype.slice.call(from));
141
+ }
142
+
143
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
144
+ var e = new Error(message);
145
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
146
+ };
147
+
13
148
  function isString(value) {
14
149
  return typeof value === 'string';
15
150
  }
@@ -38,10 +173,6 @@ function stringMatchesSomePattern(testString, patterns, requireExactStringMatch)
38
173
  return isMatchingPattern(testString, pattern, requireExactStringMatch);
39
174
  });
40
175
  }
41
- /**
42
- * UUID v4
43
- * https://gist.github.com/jed/982883
44
- */
45
176
  function generateUUID(placeholder) {
46
177
  return placeholder
47
178
  ? (+placeholder ^ ((Math.random() * 16) >> (+placeholder / 4))).toString(16)
@@ -88,15 +219,16 @@ var UrlType;
88
219
  UrlType["NETWORK_REQUEST"] = "network_request";
89
220
  })(UrlType || (UrlType = {}));
90
221
 
222
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
223
+
224
+ function getDefaultExportFromCjs (x) {
225
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
226
+ }
227
+
91
228
  function isFunction(funktion) {
92
229
  return typeof funktion === 'function';
93
230
  }
94
-
95
- // Default to complaining loudly when things don't go according to plan.
96
231
  var logger = console.error.bind(console);
97
-
98
- // Sets a property on an object, preserving its enumerability.
99
- // This function assumes that the property is already writable.
100
232
  function defineProperty(obj, name, value) {
101
233
  var enumerable = !!obj[name] && obj.propertyIsEnumerable(name);
102
234
  Object.defineProperty(obj, name, {
@@ -106,8 +238,6 @@ function defineProperty(obj, name, value) {
106
238
  value: value
107
239
  });
108
240
  }
109
-
110
- // Keep initialization idempotent.
111
241
  function shimmer(options) {
112
242
  if (options && options.logger) {
113
243
  if (!isFunction(options.logger)) logger("new logger isn't a function, not replacing");else logger = options.logger;
@@ -190,6 +320,7 @@ shimmer.massWrap = massWrap;
190
320
  shimmer.unwrap = unwrap;
191
321
  shimmer.massUnwrap = massUnwrap;
192
322
  var shimmer_1 = shimmer;
323
+ getDefaultExportFromCjs(shimmer_1);
193
324
 
194
325
  var CoralogixLogSeverity;
195
326
  (function (CoralogixLogSeverity) {
@@ -201,6 +332,290 @@ var CoralogixLogSeverity;
201
332
  CoralogixLogSeverity[CoralogixLogSeverity["Critical"] = 6] = "Critical";
202
333
  })(CoralogixLogSeverity || (CoralogixLogSeverity = {}));
203
334
 
335
+ var errorStackParser = {exports: {}};
336
+
337
+ var stackframe = {exports: {}};
338
+
339
+ var hasRequiredStackframe;
340
+ function requireStackframe() {
341
+ if (hasRequiredStackframe) return stackframe.exports;
342
+ hasRequiredStackframe = 1;
343
+ (function (module, exports) {
344
+ (function (root, factory) {
345
+ {
346
+ module.exports = factory();
347
+ }
348
+ })(commonjsGlobal, function () {
349
+
350
+ function _isNumber(n) {
351
+ return !isNaN(parseFloat(n)) && isFinite(n);
352
+ }
353
+ function _capitalize(str) {
354
+ return str.charAt(0).toUpperCase() + str.substring(1);
355
+ }
356
+ function _getter(p) {
357
+ return function () {
358
+ return this[p];
359
+ };
360
+ }
361
+ var booleanProps = ['isConstructor', 'isEval', 'isNative', 'isToplevel'];
362
+ var numericProps = ['columnNumber', 'lineNumber'];
363
+ var stringProps = ['fileName', 'functionName', 'source'];
364
+ var arrayProps = ['args'];
365
+ var objectProps = ['evalOrigin'];
366
+ var props = booleanProps.concat(numericProps, stringProps, arrayProps, objectProps);
367
+ function StackFrame(obj) {
368
+ if (!obj) return;
369
+ for (var i = 0; i < props.length; i++) {
370
+ if (obj[props[i]] !== undefined) {
371
+ this['set' + _capitalize(props[i])](obj[props[i]]);
372
+ }
373
+ }
374
+ }
375
+ StackFrame.prototype = {
376
+ getArgs: function getArgs() {
377
+ return this.args;
378
+ },
379
+ setArgs: function setArgs(v) {
380
+ if (Object.prototype.toString.call(v) !== '[object Array]') {
381
+ throw new TypeError('Args must be an Array');
382
+ }
383
+ this.args = v;
384
+ },
385
+ getEvalOrigin: function getEvalOrigin() {
386
+ return this.evalOrigin;
387
+ },
388
+ setEvalOrigin: function setEvalOrigin(v) {
389
+ if (v instanceof StackFrame) {
390
+ this.evalOrigin = v;
391
+ } else if (v instanceof Object) {
392
+ this.evalOrigin = new StackFrame(v);
393
+ } else {
394
+ throw new TypeError('Eval Origin must be an Object or StackFrame');
395
+ }
396
+ },
397
+ toString: function toString() {
398
+ var fileName = this.getFileName() || '';
399
+ var lineNumber = this.getLineNumber() || '';
400
+ var columnNumber = this.getColumnNumber() || '';
401
+ var functionName = this.getFunctionName() || '';
402
+ if (this.getIsEval()) {
403
+ if (fileName) {
404
+ return '[eval] (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';
405
+ }
406
+ return '[eval]:' + lineNumber + ':' + columnNumber;
407
+ }
408
+ if (functionName) {
409
+ return functionName + ' (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';
410
+ }
411
+ return fileName + ':' + lineNumber + ':' + columnNumber;
412
+ }
413
+ };
414
+ StackFrame.fromString = function StackFrame$$fromString(str) {
415
+ var argsStartIndex = str.indexOf('(');
416
+ var argsEndIndex = str.lastIndexOf(')');
417
+ var functionName = str.substring(0, argsStartIndex);
418
+ var args = str.substring(argsStartIndex + 1, argsEndIndex).split(',');
419
+ var locationString = str.substring(argsEndIndex + 1);
420
+ if (locationString.indexOf('@') === 0) {
421
+ var parts = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(locationString, '');
422
+ var fileName = parts[1];
423
+ var lineNumber = parts[2];
424
+ var columnNumber = parts[3];
425
+ }
426
+ return new StackFrame({
427
+ functionName: functionName,
428
+ args: args || undefined,
429
+ fileName: fileName,
430
+ lineNumber: lineNumber || undefined,
431
+ columnNumber: columnNumber || undefined
432
+ });
433
+ };
434
+ for (var i = 0; i < booleanProps.length; i++) {
435
+ StackFrame.prototype['get' + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);
436
+ StackFrame.prototype['set' + _capitalize(booleanProps[i])] = function (p) {
437
+ return function (v) {
438
+ this[p] = Boolean(v);
439
+ };
440
+ }(booleanProps[i]);
441
+ }
442
+ for (var j = 0; j < numericProps.length; j++) {
443
+ StackFrame.prototype['get' + _capitalize(numericProps[j])] = _getter(numericProps[j]);
444
+ StackFrame.prototype['set' + _capitalize(numericProps[j])] = function (p) {
445
+ return function (v) {
446
+ if (!_isNumber(v)) {
447
+ throw new TypeError(p + ' must be a Number');
448
+ }
449
+ this[p] = Number(v);
450
+ };
451
+ }(numericProps[j]);
452
+ }
453
+ for (var k = 0; k < stringProps.length; k++) {
454
+ StackFrame.prototype['get' + _capitalize(stringProps[k])] = _getter(stringProps[k]);
455
+ StackFrame.prototype['set' + _capitalize(stringProps[k])] = function (p) {
456
+ return function (v) {
457
+ this[p] = String(v);
458
+ };
459
+ }(stringProps[k]);
460
+ }
461
+ return StackFrame;
462
+ });
463
+ })(stackframe);
464
+ return stackframe.exports;
465
+ }
466
+
467
+ (function (module, exports) {
468
+ (function (root, factory) {
469
+ {
470
+ module.exports = factory(requireStackframe());
471
+ }
472
+ })(commonjsGlobal, function ErrorStackParser(StackFrame) {
473
+
474
+ var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
475
+ var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
476
+ var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
477
+ return {
478
+ parse: function ErrorStackParser$$parse(error) {
479
+ if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {
480
+ return this.parseOpera(error);
481
+ } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
482
+ return this.parseV8OrIE(error);
483
+ } else if (error.stack) {
484
+ return this.parseFFOrSafari(error);
485
+ } else {
486
+ throw new Error('Cannot parse given Error object');
487
+ }
488
+ },
489
+ extractLocation: function ErrorStackParser$$extractLocation(urlLike) {
490
+ if (urlLike.indexOf(':') === -1) {
491
+ return [urlLike];
492
+ }
493
+ var regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
494
+ var parts = regExp.exec(urlLike.replace(/[()]/g, ''));
495
+ return [parts[1], parts[2] || undefined, parts[3] || undefined];
496
+ },
497
+ parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {
498
+ var filtered = error.stack.split('\n').filter(function (line) {
499
+ return !!line.match(CHROME_IE_STACK_REGEXP);
500
+ }, this);
501
+ return filtered.map(function (line) {
502
+ if (line.indexOf('(eval ') > -1) {
503
+ line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(,.*$)/g, '');
504
+ }
505
+ var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').replace(/^.*?\s+/, '');
506
+ var location = sanitizedLine.match(/ (\(.+\)$)/);
507
+ sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;
508
+ var locationParts = this.extractLocation(location ? location[1] : sanitizedLine);
509
+ var functionName = location && sanitizedLine || undefined;
510
+ var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];
511
+ return new StackFrame({
512
+ functionName: functionName,
513
+ fileName: fileName,
514
+ lineNumber: locationParts[1],
515
+ columnNumber: locationParts[2],
516
+ source: line
517
+ });
518
+ }, this);
519
+ },
520
+ parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {
521
+ var filtered = error.stack.split('\n').filter(function (line) {
522
+ return !line.match(SAFARI_NATIVE_CODE_REGEXP);
523
+ }, this);
524
+ return filtered.map(function (line) {
525
+ if (line.indexOf(' > eval') > -1) {
526
+ line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
527
+ }
528
+ if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {
529
+ return new StackFrame({
530
+ functionName: line
531
+ });
532
+ } else {
533
+ var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
534
+ var matches = line.match(functionNameRegex);
535
+ var functionName = matches && matches[1] ? matches[1] : undefined;
536
+ var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));
537
+ return new StackFrame({
538
+ functionName: functionName,
539
+ fileName: locationParts[0],
540
+ lineNumber: locationParts[1],
541
+ columnNumber: locationParts[2],
542
+ source: line
543
+ });
544
+ }
545
+ }, this);
546
+ },
547
+ parseOpera: function ErrorStackParser$$parseOpera(e) {
548
+ if (!e.stacktrace || e.message.indexOf('\n') > -1 && e.message.split('\n').length > e.stacktrace.split('\n').length) {
549
+ return this.parseOpera9(e);
550
+ } else if (!e.stack) {
551
+ return this.parseOpera10(e);
552
+ } else {
553
+ return this.parseOpera11(e);
554
+ }
555
+ },
556
+ parseOpera9: function ErrorStackParser$$parseOpera9(e) {
557
+ var lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
558
+ var lines = e.message.split('\n');
559
+ var result = [];
560
+ for (var i = 2, len = lines.length; i < len; i += 2) {
561
+ var match = lineRE.exec(lines[i]);
562
+ if (match) {
563
+ result.push(new StackFrame({
564
+ fileName: match[2],
565
+ lineNumber: match[1],
566
+ source: lines[i]
567
+ }));
568
+ }
569
+ }
570
+ return result;
571
+ },
572
+ parseOpera10: function ErrorStackParser$$parseOpera10(e) {
573
+ var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
574
+ var lines = e.stacktrace.split('\n');
575
+ var result = [];
576
+ for (var i = 0, len = lines.length; i < len; i += 2) {
577
+ var match = lineRE.exec(lines[i]);
578
+ if (match) {
579
+ result.push(new StackFrame({
580
+ functionName: match[3] || undefined,
581
+ fileName: match[2],
582
+ lineNumber: match[1],
583
+ source: lines[i]
584
+ }));
585
+ }
586
+ }
587
+ return result;
588
+ },
589
+ parseOpera11: function ErrorStackParser$$parseOpera11(error) {
590
+ var filtered = error.stack.split('\n').filter(function (line) {
591
+ return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
592
+ }, this);
593
+ return filtered.map(function (line) {
594
+ var tokens = line.split('@');
595
+ var locationParts = this.extractLocation(tokens.pop());
596
+ var functionCall = tokens.shift() || '';
597
+ var functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, '$2').replace(/\([^)]*\)/g, '') || undefined;
598
+ var argsRaw;
599
+ if (functionCall.match(/\(([^)]*)\)/)) {
600
+ argsRaw = functionCall.replace(/^[^(]+\(([^)]*)\)$/, '$1');
601
+ }
602
+ var args = argsRaw === undefined || argsRaw === '[arguments not available]' ? undefined : argsRaw.split(',');
603
+ return new StackFrame({
604
+ functionName: functionName,
605
+ args: args,
606
+ fileName: locationParts[0],
607
+ lineNumber: locationParts[1],
608
+ columnNumber: locationParts[2],
609
+ source: line
610
+ });
611
+ }, this);
612
+ }
613
+ };
614
+ });
615
+ })(errorStackParser);
616
+ var errorStackParserExports = errorStackParser.exports;
617
+ var ErrorStackParser = getDefaultExportFromCjs(errorStackParserExports);
618
+
204
619
  var millisecondsPerSecond = 1000;
205
620
  var millisecondsPerMinute = millisecondsPerSecond * 60;
206
621
  var MILLISECONDS_PER_HOUR = millisecondsPerMinute * 60;
@@ -208,7 +623,7 @@ function getNowTime() {
208
623
  return new Date().getTime();
209
624
  }
210
625
 
211
- var MAX_BATCH_TIME_MS = 10000; //10s
626
+ var MAX_BATCH_TIME_MS = 10000;
212
627
  var SESSION_RECORDING_DEFAULT_HEADERS = {
213
628
  'Content-Encoding': 'gzip',
214
629
  };
@@ -284,9 +699,26 @@ function getUserAgentData() {
284
699
  }
285
700
 
286
701
  var GLOBAL_SPAN_KEY = '__globalSpan__';
702
+ var GLOBAL_SPAN_MAP_KEY = '__globalSpanMap__';
287
703
  var CUSTOM_TRACER_KEY = '__customTracer__';
288
704
  var CUSTOM_TRACER_IGNORED_INSTRUMENTS = '__customTracerIgnoredInstruments__';
289
705
 
706
+ function addGlobalSpanByTraceId(traceId, globalSpan) {
707
+ var _a;
708
+ CxGlobal[GLOBAL_SPAN_MAP_KEY] = __assign(__assign({}, (CxGlobal[GLOBAL_SPAN_MAP_KEY] || {})), (_a = {}, _a[traceId] = globalSpan, _a));
709
+ }
710
+ function getGlobalSpanByTraceId(traceId) {
711
+ var _a;
712
+ return (_a = CxGlobal[GLOBAL_SPAN_MAP_KEY]) === null || _a === void 0 ? void 0 : _a[traceId];
713
+ }
714
+ function clearGlobalSpanMap() {
715
+ var globalSpanMap = CxGlobal[GLOBAL_SPAN_MAP_KEY];
716
+ Object.keys(globalSpanMap || {}).forEach(function (traceId) {
717
+ var globalSpan = globalSpanMap[traceId];
718
+ globalSpan === null || globalSpan === void 0 ? void 0 : globalSpan.endSpan();
719
+ });
720
+ delete CxGlobal[GLOBAL_SPAN_MAP_KEY];
721
+ }
290
722
  function setGlobalSpan(globalSpan) {
291
723
  CxGlobal[GLOBAL_SPAN_KEY] = globalSpan;
292
724
  }
@@ -309,9 +741,11 @@ function getCustomTracerIgnoredInstruments() {
309
741
  return CxGlobal[CUSTOM_TRACER_IGNORED_INSTRUMENTS];
310
742
  }
311
743
  function shouldAttachSpanToGlobalSpan(instrumentationType) {
744
+ return getGlobalSpan() && !isInstrumentationIgnored(instrumentationType);
745
+ }
746
+ function isInstrumentationIgnored(instrumentationType) {
312
747
  var _a;
313
- return (getGlobalSpan() &&
314
- !((_a = getCustomTracerIgnoredInstruments()) === null || _a === void 0 ? void 0 : _a.includes(instrumentationType)));
748
+ return !!((_a = getCustomTracerIgnoredInstruments()) === null || _a === void 0 ? void 0 : _a.includes(instrumentationType));
315
749
  }
316
750
  function attachChildSpanToGlobalSpan(name) {
317
751
  var globalSpan = getGlobalSpan();
@@ -323,18 +757,8 @@ var MAIN_TRACER_KEY = '@';
323
757
  var ATTR_PROCESSOR_KEY = 'attrProcessor';
324
758
  var SpanStatusCode;
325
759
  (function (SpanStatusCode) {
326
- /**
327
- * The default status.
328
- */
329
760
  SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET";
330
- /**
331
- * The operation has been validated by an Application developer or
332
- * Operator to have completed successfully.
333
- */
334
761
  SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK";
335
- /**
336
- * The operation contains an error.
337
- */
338
762
  SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR";
339
763
  })(SpanStatusCode || (SpanStatusCode = {}));
340
764
 
@@ -390,7 +814,7 @@ function buildStacktrace(span, err) {
390
814
  case 0:
391
815
  stack = err.stack, message = err.message, name = err.name;
392
816
  hasStack = !!(stack === null || stack === void 0 ? void 0 : stack.includes('at '));
393
- if (!(err && hasStack)) return [3 /*break*/, 3];
817
+ if (!(err && hasStack)) return [3, 3];
394
818
  supportMfe = getSdkConfig().supportMfe;
395
819
  stackFrames = ErrorStackParser.parse({
396
820
  stack: stack.substring(0, STACK_LIMIT),
@@ -405,15 +829,15 @@ function buildStacktrace(span, err) {
405
829
  functionName: functionName,
406
830
  });
407
831
  });
408
- if (!supportMfe) return [3 /*break*/, 2];
409
- return [4 /*yield*/, handleMFE(stackFrames, span)];
832
+ if (!supportMfe) return [3, 2];
833
+ return [4, handleMFE(stackFrames, span)];
410
834
  case 1:
411
835
  _a.sent();
412
836
  _a.label = 2;
413
837
  case 2:
414
838
  span[ErrorAttributes.STACK] = stackFrames;
415
839
  _a.label = 3;
416
- case 3: return [2 /*return*/];
840
+ case 3: return [2];
417
841
  }
418
842
  });
419
843
  });
@@ -427,26 +851,25 @@ function handleMFE(stackFrames, span) {
427
851
  i = 0;
428
852
  _b.label = 1;
429
853
  case 1:
430
- if (!(i < stackFrames.length)) return [3 /*break*/, 4];
431
- return [4 /*yield*/, extractMetadataFromMfeStacktrace(stackFrames[i].fileName)];
854
+ if (!(i < stackFrames.length)) return [3, 4];
855
+ return [4, extractMetadataFromMfeStacktrace(stackFrames[i].fileName)];
432
856
  case 2:
433
857
  metadata = _b.sent();
434
858
  stackFrames[i] = __assign(__assign({}, stackFrames[i]), (metadata || { isShell: true }));
435
859
  _b.label = 3;
436
860
  case 3:
437
861
  i++;
438
- return [3 /*break*/, 1];
862
+ return [3, 1];
439
863
  case 4:
440
- _a = __read$1(stackFrames, 1), lastFrame = _a[0];
864
+ _a = __read(stackFrames, 1), lastFrame = _a[0];
441
865
  addLabelForMFE(span, lastFrame);
442
- return [2 /*return*/];
866
+ return [2];
443
867
  }
444
868
  });
445
869
  });
446
870
  }
447
871
  function addLabelForMFE(span, lastFrame) {
448
872
  var app = lastFrame.app, version = lastFrame.version, isShell = lastFrame.isShell;
449
- // Do not add label if its shell
450
873
  if (!isShell) {
451
874
  setCustomLabelsForSpan(span, { mfeApp: app, mfeVersion: version });
452
875
  }
@@ -460,37 +883,36 @@ function extractMetadataFromMfeStacktrace() {
460
883
  case 0:
461
884
  cachedMetadata = CxGlobal[CACHED_METADATA_KEY];
462
885
  MFE_METADATA_KEY = 'cx-metadata.json';
463
- _a = __read$1(fileName.match(/https?:\/\/.*\//), 1), mfePath = _a[0];
464
- if (!mfePath) return [3 /*break*/, 7];
886
+ _a = __read(fileName.match(/https?:\/\/.*\//), 1), mfePath = _a[0];
887
+ if (!mfePath) return [3, 7];
465
888
  response = void 0;
466
- if (!!(cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.has(mfePath))) return [3 /*break*/, 6];
889
+ if (!!(cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.has(mfePath))) return [3, 6];
467
890
  _c.label = 1;
468
891
  case 1:
469
892
  _c.trys.push([1, 4, , 5]);
470
- return [4 /*yield*/, fetch("".concat(mfePath).concat(MFE_METADATA_KEY), {
471
- //this is a browser cache control
893
+ return [4, fetch("".concat(mfePath).concat(MFE_METADATA_KEY), {
472
894
  cache: 'no-cache',
473
895
  })];
474
896
  case 2:
475
897
  response = _c.sent();
476
898
  _b = [{}];
477
- return [4 /*yield*/, response.json()];
899
+ return [4, response.json()];
478
900
  case 3:
479
901
  metadata = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_c.sent())])), { mfePath: mfePath }]);
480
- return [3 /*break*/, 5];
902
+ return [3, 5];
481
903
  case 4:
482
904
  e_1 = _c.sent();
483
905
  if (getSdkConfig().debug) {
484
906
  console.warn('Coralogix Browser SDK - Error fetching metadata', e_1);
485
907
  }
486
- return [3 /*break*/, 5];
908
+ return [3, 5];
487
909
  case 5:
488
910
  CxGlobal[CACHED_METADATA_KEY] = cachedMetadata.set(mfePath, metadata);
489
- return [3 /*break*/, 7];
911
+ return [3, 7];
490
912
  case 6:
491
913
  metadata = cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.get(mfePath);
492
914
  _c.label = 7;
493
- case 7: return [2 /*return*/, metadata];
915
+ case 7: return [2, metadata];
494
916
  }
495
917
  });
496
918
  });
@@ -526,7 +948,7 @@ function addErrorDefaultAttributes(span) {
526
948
  span.setAttribute(CoralogixAttributes.EVENT_TYPE, CoralogixEventType.ERROR);
527
949
  span.setAttribute(CoralogixAttributes.SEVERITY, CoralogixLogSeverity.Error);
528
950
  }
529
- var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
951
+ var CoralogixErrorInstrumentation = (function (_super) {
530
952
  __extends(CoralogixErrorInstrumentation, _super);
531
953
  function CoralogixErrorInstrumentation(config) {
532
954
  var _this = _super.call(this, ERROR_INSTRUMENTATION_NAME, ERROR_INSTRUMENTATION_VERSION, config) || this;
@@ -575,7 +997,6 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
575
997
  this.reportString(source, arg);
576
998
  break;
577
999
  case arg instanceof Array: {
578
- // if any arguments are Errors then add the stack trace even though the message is handled differently
579
1000
  var firstError = arg.find(function (x) { return x instanceof Error; });
580
1001
  var message = arg
581
1002
  .map(function (msg) {
@@ -608,11 +1029,11 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
608
1029
  if (labels) {
609
1030
  setCustomLabelsForSpan(span, labels);
610
1031
  }
611
- return [4 /*yield*/, buildStacktrace(span, err)];
1032
+ return [4, buildStacktrace(span, err)];
612
1033
  case 1:
613
1034
  _a.sent();
614
1035
  span.end();
615
- return [2 /*return*/];
1036
+ return [2];
616
1037
  }
617
1038
  });
618
1039
  });
@@ -627,14 +1048,14 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
627
1048
  addErrorDefaultAttributes(span);
628
1049
  span.setAttribute(CoralogixAttributes.SOURCE, source);
629
1050
  span.setAttribute(ErrorAttributes.MESSAGE, message === null || message === void 0 ? void 0 : message.substring(0, MESSAGE_LIMIT));
630
- if (!firstError) return [3 /*break*/, 2];
631
- return [4 /*yield*/, buildStacktrace(span, firstError)];
1051
+ if (!firstError) return [3, 2];
1052
+ return [4, buildStacktrace(span, firstError)];
632
1053
  case 1:
633
1054
  _a.sent();
634
1055
  _a.label = 2;
635
1056
  case 2:
636
1057
  span.end();
637
- return [2 /*return*/];
1058
+ return [2];
638
1059
  }
639
1060
  });
640
1061
  });
@@ -673,7 +1094,6 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
673
1094
  if (message && typeof message === 'string') {
674
1095
  return message;
675
1096
  }
676
- // GrpcStatusEvent
677
1097
  if (statusMessage && typeof statusMessage === 'string') {
678
1098
  return statusMessage;
679
1099
  }
@@ -691,7 +1111,7 @@ var propagateTraceHeaderCorsUrls = function (config) {
691
1111
  }
692
1112
  };
693
1113
 
694
- var NetworkDataManager = /** @class */ (function () {
1114
+ var NetworkDataManager = (function () {
695
1115
  function NetworkDataManager() {
696
1116
  var _this = this;
697
1117
  this.responseBodyParsers = new Map([
@@ -699,68 +1119,68 @@ var NetworkDataManager = /** @class */ (function () {
699
1119
  switch (_c.label) {
700
1120
  case 0:
701
1121
  _b = (_a = JSON).stringify;
702
- return [4 /*yield*/, body.json()];
703
- case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];
1122
+ return [4, body.json()];
1123
+ case 1: return [2, _b.apply(_a, [_c.sent()])];
704
1124
  }
705
1125
  }); }); }],
706
1126
  [MimeType.TextPlain, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
707
1127
  switch (_a.label) {
708
- case 0: return [4 /*yield*/, body.text()];
709
- case 1: return [2 /*return*/, _a.sent()];
1128
+ case 0: return [4, body.text()];
1129
+ case 1: return [2, _a.sent()];
710
1130
  }
711
1131
  }); }); }],
712
1132
  [MimeType.TextHtml, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
713
1133
  switch (_a.label) {
714
- case 0: return [4 /*yield*/, body.text()];
715
- case 1: return [2 /*return*/, _a.sent()];
1134
+ case 0: return [4, body.text()];
1135
+ case 1: return [2, _a.sent()];
716
1136
  }
717
1137
  }); }); }],
718
1138
  [MimeType.TextCss, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
719
1139
  switch (_a.label) {
720
- case 0: return [4 /*yield*/, body.text()];
721
- case 1: return [2 /*return*/, _a.sent()];
1140
+ case 0: return [4, body.text()];
1141
+ case 1: return [2, _a.sent()];
722
1142
  }
723
1143
  }); }); }],
724
1144
  [MimeType.TextJavascript, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
725
1145
  switch (_a.label) {
726
- case 0: return [4 /*yield*/, body.text()];
727
- case 1: return [2 /*return*/, _a.sent()];
1146
+ case 0: return [4, body.text()];
1147
+ case 1: return [2, _a.sent()];
728
1148
  }
729
1149
  }); }); }],
730
1150
  [MimeType.Xml, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
731
1151
  switch (_a.label) {
732
- case 0: return [4 /*yield*/, body.text()];
733
- case 1: return [2 /*return*/, _a.sent()];
1152
+ case 0: return [4, body.text()];
1153
+ case 1: return [2, _a.sent()];
734
1154
  }
735
1155
  }); }); }],
736
1156
  [MimeType.FormData, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
737
1157
  switch (_a.label) {
738
- case 0: return [4 /*yield*/, body.text()];
739
- case 1: return [2 /*return*/, _a.sent()];
1158
+ case 0: return [4, body.text()];
1159
+ case 1: return [2, _a.sent()];
740
1160
  }
741
1161
  }); }); }],
742
1162
  ]);
743
1163
  this.requestBodySerializers = new Map([
744
1164
  [BodyType.String, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
745
- return [2 /*return*/, body];
1165
+ return [2, body];
746
1166
  }); }); }],
747
1167
  [BodyType.Blob, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
748
- return [2 /*return*/, body.text()];
1168
+ return [2, body.text()];
749
1169
  }); }); }],
750
1170
  [
751
1171
  BodyType.FormData,
752
1172
  function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
753
- return [2 /*return*/, this.serializeFormData(body)];
1173
+ return [2, this.serializeFormData(body)];
754
1174
  }); }); },
755
1175
  ],
756
1176
  [
757
1177
  BodyType.URLSearchParams,
758
1178
  function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
759
- return [2 /*return*/, body.toString()];
1179
+ return [2, body.toString()];
760
1180
  }); }); },
761
1181
  ],
762
1182
  [BodyType.JsonObject, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
763
- return [2 /*return*/, JSON.stringify(body)];
1183
+ return [2, JSON.stringify(body)];
764
1184
  }); }); }],
765
1185
  ]);
766
1186
  }
@@ -779,11 +1199,11 @@ var NetworkDataManager = /** @class */ (function () {
779
1199
  switch (_a.label) {
780
1200
  case 0:
781
1201
  if (!(request === null || request === void 0 ? void 0 : request.body))
782
- return [2 /*return*/, ''];
783
- return [4 /*yield*/, this.serializeRequestBody(request.body)];
1202
+ return [2, ''];
1203
+ return [4, this.serializeRequestBody(request.body)];
784
1204
  case 1:
785
1205
  bodyContent = _a.sent();
786
- return [2 /*return*/, this.truncateIfExceedsLimit(bodyContent)];
1206
+ return [2, this.truncateIfExceedsLimit(bodyContent)];
787
1207
  }
788
1208
  });
789
1209
  });
@@ -798,11 +1218,11 @@ var NetworkDataManager = /** @class */ (function () {
798
1218
  mimeType = contentType.split(';')[0].trim();
799
1219
  parser = this.responseBodyParsers.get(mimeType);
800
1220
  if (!parser)
801
- return [2 /*return*/, ''];
802
- return [4 /*yield*/, parser(response)];
1221
+ return [2, ''];
1222
+ return [4, parser(response)];
803
1223
  case 1:
804
1224
  parsedContent = _a.sent();
805
- return [2 /*return*/, this.truncateIfExceedsLimit(parsedContent)];
1225
+ return [2, this.truncateIfExceedsLimit(parsedContent)];
806
1226
  }
807
1227
  });
808
1228
  });
@@ -817,15 +1237,15 @@ var NetworkDataManager = /** @class */ (function () {
817
1237
  switch (_b.label) {
818
1238
  case 0:
819
1239
  handler = this.requestBodySerializers.get(body.constructor.name);
820
- if (!handler) return [3 /*break*/, 2];
821
- return [4 /*yield*/, handler(body)];
1240
+ if (!handler) return [3, 2];
1241
+ return [4, handler(body)];
822
1242
  case 1:
823
1243
  _a = _b.sent();
824
- return [3 /*break*/, 3];
1244
+ return [3, 3];
825
1245
  case 2:
826
1246
  _a = '';
827
1247
  _b.label = 3;
828
- case 3: return [2 /*return*/, _a];
1248
+ case 3: return [2, _a];
829
1249
  }
830
1250
  });
831
1251
  });
@@ -859,7 +1279,7 @@ var BodyType;
859
1279
  BodyType["Unknown"] = "Unknown";
860
1280
  })(BodyType || (BodyType = {}));
861
1281
 
862
- var HeadersManager = /** @class */ (function () {
1282
+ var HeadersManager = (function () {
863
1283
  function HeadersManager() {
864
1284
  }
865
1285
  HeadersManager.prototype.filterHeaders = function (headersInit, allowedKeys) {
@@ -895,7 +1315,7 @@ var HeadersManager = /** @class */ (function () {
895
1315
  }
896
1316
  var lines = headersString.trim().split(/\r\n/);
897
1317
  lines.forEach(function (line) {
898
- var _a = __read$1(line.split(': ', 2), 2), key = _a[0], value = _a[1];
1318
+ var _a = __read(line.split(': ', 2), 2), key = _a[0], value = _a[1];
899
1319
  if (key && value) {
900
1320
  headerMap.set(key.trim().toLowerCase(), value.trim());
901
1321
  }
@@ -913,9 +1333,10 @@ var NetworkInstrumentationAttributes = {
913
1333
  };
914
1334
 
915
1335
  function checkAttachingNetworkSpanToGlobalSpan(span) {
916
- if (shouldAttachSpanToGlobalSpan(CoralogixEventType.NETWORK_REQUEST)) {
917
- var globalSpan = getGlobalSpan();
918
- var _a = globalSpan.span.spanContext(), traceId = _a.traceId, globalSpanId = _a.spanId;
1336
+ var activeGlobalSpan = getGlobalSpanByTraceId(span.spanContext().traceId);
1337
+ if (activeGlobalSpan &&
1338
+ !isInstrumentationIgnored(CoralogixEventType.NETWORK_REQUEST)) {
1339
+ var _a = activeGlobalSpan.span.spanContext(), traceId = _a.traceId, globalSpanId = _a.spanId;
919
1340
  span['_spanContext'].traceId = traceId;
920
1341
  span['parentSpanId'] = globalSpanId;
921
1342
  }
@@ -925,7 +1346,7 @@ var FetchSource;
925
1346
  (function (FetchSource) {
926
1347
  FetchSource["FETCH"] = "fetch";
927
1348
  })(FetchSource || (FetchSource = {}));
928
- var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
1349
+ var CoralogixFetchInstrumentation = (function (_super) {
929
1350
  __extends(CoralogixFetchInstrumentation, _super);
930
1351
  function CoralogixFetchInstrumentation(config) {
931
1352
  var _this = this;
@@ -952,11 +1373,11 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
952
1373
  url = span.attributes['http.url'] ||
953
1374
  '';
954
1375
  resolvedConfig = this.networkDataManager.resolveConfigForUrl(url, networkExtraConfig);
955
- if (!resolvedConfig) return [3 /*break*/, 3];
956
- return [4 /*yield*/, this.setRequestAttributes(span, request, resolvedConfig)];
1376
+ if (!resolvedConfig) return [3, 3];
1377
+ return [4, this.setRequestAttributes(span, request, resolvedConfig)];
957
1378
  case 1:
958
1379
  _b.sent();
959
- return [4 /*yield*/, this.setResponseAttributes(span, response, resolvedConfig)];
1380
+ return [4, this.setResponseAttributes(span, response, resolvedConfig)];
960
1381
  case 2:
961
1382
  _b.sent();
962
1383
  _b.label = 3;
@@ -968,7 +1389,7 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
968
1389
  _a[CoralogixAttributes.EVENT_TYPE] = CoralogixEventType.NETWORK_REQUEST,
969
1390
  _a[CoralogixAttributes.SOURCE] = FetchSource.FETCH,
970
1391
  _a));
971
- return [2 /*return*/];
1392
+ return [2];
972
1393
  }
973
1394
  });
974
1395
  });
@@ -983,11 +1404,11 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
983
1404
  _b.label = 1;
984
1405
  case 1:
985
1406
  _b.trys.push([1, 5, , 6]);
986
- if (!collectReqPayload) return [3 /*break*/, 3];
987
- return [4 /*yield*/, this.networkDataManager.stringifyRequestBody(request)];
1407
+ if (!collectReqPayload) return [3, 3];
1408
+ return [4, this.networkDataManager.stringifyRequestBody(request)];
988
1409
  case 2:
989
1410
  _a = _b.sent();
990
- return [3 /*break*/, 4];
1411
+ return [3, 4];
991
1412
  case 3:
992
1413
  _a = undefined;
993
1414
  _b.label = 4;
@@ -1002,14 +1423,14 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
1002
1423
  span[NetworkInstrumentationAttributes.REQUEST_HEADERS] =
1003
1424
  Object.fromEntries(sanitizedHeaders);
1004
1425
  }
1005
- return [3 /*break*/, 6];
1426
+ return [3, 6];
1006
1427
  case 5:
1007
1428
  error_1 = _b.sent();
1008
1429
  if (getSdkConfig().debug) {
1009
1430
  console.debug('Error setting request attributes on span:', error_1);
1010
1431
  }
1011
- return [3 /*break*/, 6];
1012
- case 6: return [2 /*return*/];
1432
+ return [3, 6];
1433
+ case 6: return [2];
1013
1434
  }
1014
1435
  });
1015
1436
  });
@@ -1021,15 +1442,15 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
1021
1442
  switch (_b.label) {
1022
1443
  case 0:
1023
1444
  resHeaders = networkExtraConfig.resHeaders, collectResPayload = networkExtraConfig.collectResPayload;
1024
- if (!(result instanceof Response)) return [3 /*break*/, 6];
1445
+ if (!(result instanceof Response)) return [3, 6];
1025
1446
  _b.label = 1;
1026
1447
  case 1:
1027
1448
  _b.trys.push([1, 5, , 6]);
1028
- if (!collectResPayload) return [3 /*break*/, 3];
1029
- return [4 /*yield*/, this.networkDataManager.stringifyResponseBody(result)];
1449
+ if (!collectResPayload) return [3, 3];
1450
+ return [4, this.networkDataManager.stringifyResponseBody(result)];
1030
1451
  case 2:
1031
1452
  _a = _b.sent();
1032
- return [3 /*break*/, 4];
1453
+ return [3, 4];
1033
1454
  case 3:
1034
1455
  _a = undefined;
1035
1456
  _b.label = 4;
@@ -1046,14 +1467,14 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
1046
1467
  span[NetworkInstrumentationAttributes.RESPONSE_HEADERS] =
1047
1468
  Object.fromEntries(sanitizedHeaders);
1048
1469
  }
1049
- return [3 /*break*/, 6];
1470
+ return [3, 6];
1050
1471
  case 5:
1051
1472
  error_2 = _b.sent();
1052
1473
  if (getSdkConfig().debug) {
1053
1474
  console.debug('Error setting request attributes on span:', error_2);
1054
1475
  }
1055
- return [3 /*break*/, 6];
1056
- case 6: return [2 /*return*/];
1476
+ return [3, 6];
1477
+ case 6: return [2];
1057
1478
  }
1058
1479
  });
1059
1480
  });
@@ -1065,7 +1486,7 @@ var XHRSource;
1065
1486
  (function (XHRSource) {
1066
1487
  XHRSource["XHR"] = "xhr";
1067
1488
  })(XHRSource || (XHRSource = {}));
1068
- var CoralogixXhrInstrumentation = /** @class */ (function (_super) {
1489
+ var CoralogixXhrInstrumentation = (function (_super) {
1069
1490
  __extends(CoralogixXhrInstrumentation, _super);
1070
1491
  function CoralogixXhrInstrumentation(config) {
1071
1492
  var _this = this;
@@ -1120,7 +1541,7 @@ var LogSource;
1120
1541
  (function (LogSource) {
1121
1542
  LogSource["CODE"] = "code";
1122
1543
  })(LogSource || (LogSource = {}));
1123
- var CoralogixCustomLogInstrumentation = /** @class */ (function (_super) {
1544
+ var CoralogixCustomLogInstrumentation = (function (_super) {
1124
1545
  __extends(CoralogixCustomLogInstrumentation, _super);
1125
1546
  function CoralogixCustomLogInstrumentation(config) {
1126
1547
  var _a;
@@ -1152,43 +1573,21 @@ var CoralogixCustomLogInstrumentation = /** @class */ (function (_super) {
1152
1573
  return CoralogixCustomLogInstrumentation;
1153
1574
  }(InstrumentationBase));
1154
1575
 
1155
- /**
1156
- * Checks if value is null or undefined.
1157
- *
1158
- * @param value The value to check.
1159
- * @returns Returns true if value is null or undefined, else false.
1160
- */
1161
1576
  function isNil(value) {
1162
1577
  return value == null;
1163
1578
  }
1164
1579
 
1165
- /**
1166
- * Ensures a given value is converted into an array of elements.
1167
- *
1168
- * @template T - The type of the input value and the elements in the resulting array.
1169
- *
1170
- * @param value - The input value, which can be a single instance of type `T`, an array of instances of type `T`, or a Set of instances of type `T`.
1171
- *
1172
- * @returns An array of elements of type `T`. If the input is `null` or `undefined`, returns an empty array.
1173
- */
1174
1580
  function coerceArray(value) {
1175
1581
  if (isNil(value))
1176
1582
  return [];
1177
1583
  if (value instanceof Set)
1178
- return __spreadArray([], __read$1(value), false);
1584
+ return __spreadArray([], __read(value), false);
1179
1585
  return Array.isArray(value) ? value : [value];
1180
1586
  }
1181
1587
 
1182
1588
  function isObject(value) {
1183
1589
  return typeof value === 'object';
1184
1590
  }
1185
- /**
1186
- * Creates an object composed of the properties of the input object, excluding the specified paths.
1187
- *
1188
- * @param object The source object from which to omit properties.
1189
- * @param paths An array or a single path (including nested paths) to omit from the source object.
1190
- * @returns Returns a new object with the specified paths omitted.
1191
- */
1192
1591
  function omit(object) {
1193
1592
  if (object === void 0) { object = {}; }
1194
1593
  var paths = [];
@@ -1199,7 +1598,7 @@ function omit(object) {
1199
1598
  return {};
1200
1599
  var omitter = function (source, pathArray) {
1201
1600
  var _a;
1202
- var _b = __read$1(pathArray), firstKey = _b[0], remainingKeys = _b.slice(1);
1601
+ var _b = __read(pathArray), firstKey = _b[0], remainingKeys = _b.slice(1);
1203
1602
  if (!source.hasOwnProperty(firstKey))
1204
1603
  return source;
1205
1604
  if (!remainingKeys.length) {
@@ -1208,15 +1607,8 @@ function omit(object) {
1208
1607
  }
1209
1608
  return __assign(__assign({}, source), (_a = {}, _a[firstKey] = omitter(source[firstKey], remainingKeys), _a));
1210
1609
  };
1211
- //@ts-ignore
1212
1610
  return coerceArray(paths).reduce(function (result, path) { return omitter(result, path.split('.')); }, object);
1213
1611
  }
1214
- /**
1215
- * Checks if a Set, Array, Map, or Object is empty.
1216
- *
1217
- * @param value - The value to check.
1218
- * @returns Returns true if the value is an empty Set, Map, Array, String or Object, else false.
1219
- */
1220
1612
  function isEmpty(value) {
1221
1613
  if (isNil(value))
1222
1614
  return true;
@@ -1231,12 +1623,6 @@ function isEmpty(value) {
1231
1623
  }
1232
1624
  return false;
1233
1625
  }
1234
- /**
1235
- * Checks if a Set, Array, Map, or Object is not empty.
1236
- *
1237
- * @param value - The value to check.
1238
- * @returns Returns false if the value is an empty Set, Map, Array, String or Object, else true.
1239
- */
1240
1626
  function isNotEmpty(value) {
1241
1627
  return !isEmpty(value);
1242
1628
  }
@@ -1577,23 +1963,19 @@ function isPerformanceObserverSupported() {
1577
1963
  return true;
1578
1964
  }
1579
1965
 
1580
- var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
1966
+ var CoralogixWebVitalsInstrumentation = (function (_super) {
1581
1967
  __extends(CoralogixWebVitalsInstrumentation, _super);
1582
1968
  function CoralogixWebVitalsInstrumentation(config) {
1583
1969
  var _this = _super.call(this, WEB_VITALS_INSTRUMENTATION_NAME, WEB_VITALS_INSTRUMENTATION_VERSION, config) || this;
1584
1970
  _this.observers = [];
1585
1971
  _this.isSoftNavsEnabled = getSdkConfig().trackSoftNavigations;
1586
- // function that creates a span for each web vital and reports the data
1587
- // as attributes
1588
1972
  _this.onReport = function (metric) {
1589
1973
  if (!metric) {
1590
1974
  return;
1591
1975
  }
1592
- // calculate TBT when FCP is reported because TBT is calculated between FCP and TTI
1593
1976
  if (metric.name === 'FCP') {
1594
1977
  _this.registerToTBTMetric();
1595
1978
  }
1596
- // start the span
1597
1979
  var webVitalsSpan = _this.tracer.startSpan(CoralogixEventType.WEB_VITALS);
1598
1980
  var metricData = metric.entries ? omit(metric, 'entries') : metric;
1599
1981
  metricData = omit(metricData, 'attribution.navigationEntry');
@@ -1601,9 +1983,7 @@ var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
1601
1983
  metricData = omit(metricData, 'attribution');
1602
1984
  }
1603
1985
  webVitalsSpan.setAttribute(CoralogixAttributes.EVENT_TYPE, CoralogixEventType.WEB_VITALS);
1604
- // add core web vital attributes
1605
1986
  webVitalsSpan.setAttribute(WEB_VITALS_INSTRUMENTATION_NAME, JSON.stringify(metricData, getCircularReplacer()));
1606
- // end the span
1607
1987
  webVitalsSpan.end();
1608
1988
  };
1609
1989
  _this.metrics = isEmpty(config.metrics)
@@ -1622,27 +2002,21 @@ var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
1622
2002
  CoralogixWebVitalsInstrumentation.prototype.registerToCoreWebVitalMetrics = function () {
1623
2003
  var shouldReportSoftNavs = this.isSoftNavsEnabled &&
1624
2004
  supportedPerformanceTypes.has(PerformanceTypes.SoftNavigation);
1625
- // Capture First Input Delay
1626
2005
  if (this.metrics.fid) {
1627
2006
  onFID(this.onReport);
1628
2007
  }
1629
- // Capture Cumulative Layout Shift
1630
2008
  if (this.metrics.cls) {
1631
2009
  onCLS(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
1632
2010
  }
1633
- // Capture Largest Contentful Paint
1634
2011
  if (this.metrics.lcp) {
1635
2012
  onLCP(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
1636
2013
  }
1637
- // Capture First Contentful Paint
1638
2014
  if (this.metrics.fcp) {
1639
2015
  onFCP(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
1640
2016
  }
1641
- // Capture Interaction to Next Paint
1642
2017
  if (this.metrics.inp) {
1643
2018
  onINP(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
1644
2019
  }
1645
- // Capture Time to First Byte
1646
2020
  if (this.metrics.ttfb) {
1647
2021
  onTTFB(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
1648
2022
  }
@@ -1745,7 +2119,7 @@ var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
1745
2119
  return CoralogixWebVitalsInstrumentation;
1746
2120
  }(InstrumentationBase));
1747
2121
 
1748
- var CoralogixLongTaskInstrumentation = /** @class */ (function (_super) {
2122
+ var CoralogixLongTaskInstrumentation = (function (_super) {
1749
2123
  __extends(CoralogixLongTaskInstrumentation, _super);
1750
2124
  function CoralogixLongTaskInstrumentation(config) {
1751
2125
  var _this = _super.call(this, LONG_TASKS_INSTRUMENTATION_NAME, LONG_TASK_INSTRUMENTATION_VERSION, config) || this;
@@ -1828,7 +2202,7 @@ function isPatternMatch(str, arr, warnKey) {
1828
2202
  });
1829
2203
  }
1830
2204
 
1831
- var CoralogixResourcesInstrumentation = /** @class */ (function (_super) {
2205
+ var CoralogixResourcesInstrumentation = (function (_super) {
1832
2206
  __extends(CoralogixResourcesInstrumentation, _super);
1833
2207
  function CoralogixResourcesInstrumentation(config) {
1834
2208
  var _a;
@@ -1926,9 +2300,6 @@ var CoralogixResourcesInstrumentation = /** @class */ (function (_super) {
1926
2300
  return CoralogixResourcesInstrumentation;
1927
2301
  }(InstrumentationBase));
1928
2302
 
1929
- /**
1930
- * Gets the original value for a DOM API that was potentially patched by Zone.js.
1931
- */
1932
2303
  function getZoneJsOriginalDom(target, name) {
1933
2304
  var browserWindow = getCxGlobal();
1934
2305
  var original;
@@ -1942,9 +2313,6 @@ function getZoneJsOriginalDom(target, name) {
1942
2313
  return original;
1943
2314
  }
1944
2315
 
1945
- /**
1946
- * Add event listeners to an event target object.
1947
- */
1948
2316
  function addEventListeners(eventTarget, eventNames, listener, _a) {
1949
2317
  var _b = _a === void 0 ? {} : _a, once = _b.once, capture = _b.capture, passive = _b.passive;
1950
2318
  var resolvedListener = once
@@ -2048,9 +2416,9 @@ var _a$3;
2048
2416
  var USER_INTERACTION_INSTRUMENTATION_NAME = 'interactions';
2049
2417
  var USER_INTERACTION_INSTRUMENTATION_VERSION = '1';
2050
2418
  var DEFAULT_INSTRUMENTED_EVENTS = (_a$3 = {},
2051
- _a$3["click" /* DOM_EVENT.CLICK */] = true,
2419
+ _a$3["click"] = true,
2052
2420
  _a$3);
2053
- var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
2421
+ var CoralogixUserInteractionInstrumentation = (function (_super) {
2054
2422
  __extends(CoralogixUserInteractionInstrumentation, _super);
2055
2423
  function CoralogixUserInteractionInstrumentation(config) {
2056
2424
  var _this = _super.call(this, USER_INTERACTION_INSTRUMENTATION_NAME, USER_INTERACTION_INSTRUMENTATION_VERSION, config) || this;
@@ -2086,7 +2454,7 @@ var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
2086
2454
  ],
2087
2455
  [CoralogixAttributes.TARGET_ELEMENT, nodeName],
2088
2456
  ].forEach(function (_a) {
2089
- var _b = __read$1(_a, 2), key = _b[0], value = _b[1];
2457
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
2090
2458
  span.setAttribute(key, value);
2091
2459
  });
2092
2460
  }
@@ -2095,11 +2463,11 @@ var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
2095
2463
  var eventsMap = __assign(__assign({}, DEFAULT_INSTRUMENTED_EVENTS), (_a = this._config) === null || _a === void 0 ? void 0 : _a['events']);
2096
2464
  var eventNames = Object.entries(eventsMap)
2097
2465
  .filter(function (_a) {
2098
- var _b = __read$1(_a, 2); _b[0]; var enabled = _b[1];
2466
+ var _b = __read(_a, 2); _b[0]; var enabled = _b[1];
2099
2467
  return enabled;
2100
2468
  })
2101
2469
  .map(function (_a) {
2102
- var _b = __read$1(_a, 1), eventName = _b[0];
2470
+ var _b = __read(_a, 1), eventName = _b[0];
2103
2471
  return eventName;
2104
2472
  });
2105
2473
  this.stop = addEventListeners(document, eventNames, this.handler, {
@@ -2116,7 +2484,7 @@ var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
2116
2484
 
2117
2485
  var MEMORY_USAGE_INSTRUMENTATION_NAME = 'memory_usage';
2118
2486
  var MEMORY_USAGE_INSTRUMENTATION_VERSION = '1.0.0';
2119
- var MEMORY_USAGE_DEFAULT_INTERVAL = 300000; // 5 minutes;
2487
+ var MEMORY_USAGE_DEFAULT_INTERVAL = 300000;
2120
2488
 
2121
2489
  function isMeasureUserAgentSpecificMemoryAllowed() {
2122
2490
  if (!CxGlobal.crossOriginIsolated) {
@@ -2139,7 +2507,7 @@ function mapMemoryUsageEntries(memoryUsage) {
2139
2507
  };
2140
2508
  var breakdownEntries = [];
2141
2509
  try {
2142
- for (var _b = __values$1(memoryUsage.breakdown), _c = _b.next(); !_c.done; _c = _b.next()) {
2510
+ for (var _b = __values(memoryUsage.breakdown), _c = _b.next(); !_c.done; _c = _b.next()) {
2143
2511
  var entry = _c.value;
2144
2512
  if (entry.bytes > 0) {
2145
2513
  breakdownEntries.push({
@@ -2158,10 +2526,10 @@ function mapMemoryUsageEntries(memoryUsage) {
2158
2526
  }
2159
2527
  finally { if (e_1) throw e_1.error; }
2160
2528
  }
2161
- return __spreadArray([parentEntry], __read$1(breakdownEntries), false);
2529
+ return __spreadArray([parentEntry], __read(breakdownEntries), false);
2162
2530
  }
2163
2531
 
2164
- var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
2532
+ var CoralogixMemoryUsageInstrumentation = (function (_super) {
2165
2533
  __extends(CoralogixMemoryUsageInstrumentation, _super);
2166
2534
  function CoralogixMemoryUsageInstrumentation(config) {
2167
2535
  var _this = _super.call(this, MEMORY_USAGE_INSTRUMENTATION_NAME, MEMORY_USAGE_INSTRUMENTATION_VERSION, config) || this;
@@ -2188,12 +2556,12 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
2188
2556
  switch (_b.label) {
2189
2557
  case 0:
2190
2558
  _b.trys.push([0, 2, , 3]);
2191
- return [4 /*yield*/, performance.measureUserAgentSpecificMemory()];
2559
+ return [4, performance.measureUserAgentSpecificMemory()];
2192
2560
  case 1:
2193
2561
  memoryUsage = _b.sent();
2194
2562
  memoryUsageEntries = mapMemoryUsageEntries(memoryUsage);
2195
2563
  try {
2196
- for (memoryUsageEntries_1 = __values$1(memoryUsageEntries), memoryUsageEntries_1_1 = memoryUsageEntries_1.next(); !memoryUsageEntries_1_1.done; memoryUsageEntries_1_1 = memoryUsageEntries_1.next()) {
2564
+ for (memoryUsageEntries_1 = __values(memoryUsageEntries), memoryUsageEntries_1_1 = memoryUsageEntries_1.next(); !memoryUsageEntries_1_1.done; memoryUsageEntries_1_1 = memoryUsageEntries_1.next()) {
2197
2565
  entry = memoryUsageEntries_1_1.value;
2198
2566
  memoryUsageSpan = this.tracer.startSpan(MEMORY_USAGE_INSTRUMENTATION_NAME);
2199
2567
  memoryUsageSpan[CoralogixAttributes.EVENT_TYPE] =
@@ -2209,13 +2577,13 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
2209
2577
  }
2210
2578
  finally { if (e_1) throw e_1.error; }
2211
2579
  }
2212
- return [3 /*break*/, 3];
2580
+ return [3, 3];
2213
2581
  case 2:
2214
2582
  error_1 = _b.sent();
2215
2583
  console.warn('Memory usage measurement failed', error_1);
2216
2584
  this.clearMeasurementsInterval();
2217
- return [3 /*break*/, 3];
2218
- case 3: return [2 /*return*/];
2585
+ return [3, 3];
2586
+ case 3: return [2];
2219
2587
  }
2220
2588
  });
2221
2589
  });
@@ -2228,11 +2596,11 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
2228
2596
  return __awaiter(this, void 0, void 0, function () {
2229
2597
  return __generator(this, function (_a) {
2230
2598
  switch (_a.label) {
2231
- case 0: return [4 /*yield*/, this.createMemorySample()];
2599
+ case 0: return [4, this.createMemorySample()];
2232
2600
  case 1:
2233
2601
  _a.sent();
2234
2602
  this.runMemoryMeasurements();
2235
- return [2 /*return*/];
2603
+ return [2];
2236
2604
  }
2237
2605
  });
2238
2606
  });
@@ -2248,7 +2616,7 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
2248
2616
  var SCREENSHOT_INSTRUMENTATION_NAME = 'screenshot';
2249
2617
  var SCREENSHOT_INSTRUMENTATION_VERSION = '1.0.0';
2250
2618
 
2251
- var CoralogixScreenshotInstrumentation = /** @class */ (function (_super) {
2619
+ var CoralogixScreenshotInstrumentation = (function (_super) {
2252
2620
  __extends(CoralogixScreenshotInstrumentation, _super);
2253
2621
  function CoralogixScreenshotInstrumentation(config) {
2254
2622
  return _super.call(this, SCREENSHOT_INSTRUMENTATION_NAME, SCREENSHOT_INSTRUMENTATION_VERSION, config) || this;
@@ -2272,7 +2640,7 @@ var CoralogixScreenshotInstrumentation = /** @class */ (function (_super) {
2272
2640
  return CoralogixScreenshotInstrumentation;
2273
2641
  }(InstrumentationBase));
2274
2642
 
2275
- var TimeMeasurementTracker = /** @class */ (function () {
2643
+ var TimeMeasurementTracker = (function () {
2276
2644
  function TimeMeasurementTracker() {
2277
2645
  this.measurements = new Map();
2278
2646
  }
@@ -2310,7 +2678,7 @@ var TimeMeasurementTracker = /** @class */ (function () {
2310
2678
  return TimeMeasurementTracker;
2311
2679
  }());
2312
2680
 
2313
- var CoralogixCustomMeasurementInstrumentation = /** @class */ (function (_super) {
2681
+ var CoralogixCustomMeasurementInstrumentation = (function (_super) {
2314
2682
  __extends(CoralogixCustomMeasurementInstrumentation, _super);
2315
2683
  function CoralogixCustomMeasurementInstrumentation(config) {
2316
2684
  return _super.call(this, CUSTOM_MEASUREMENT_INSTRUMENTATION_NAME, CUSTOM_MEASUREMENT_INSTRUMENTATION_VERSION, config) || this;
@@ -2335,7 +2703,7 @@ var CoralogixCustomMeasurementInstrumentation = /** @class */ (function (_super)
2335
2703
  }(InstrumentationBase));
2336
2704
 
2337
2705
  var INTERNAL_INSTRUMENTATION_VERSION = '1';
2338
- var CoralogixInternalInstrumentation = /** @class */ (function (_super) {
2706
+ var CoralogixInternalInstrumentation = (function (_super) {
2339
2707
  __extends(CoralogixInternalInstrumentation, _super);
2340
2708
  function CoralogixInternalInstrumentation(config) {
2341
2709
  return _super.call(this, CoralogixEventType.INTERNAL, INTERNAL_INSTRUMENTATION_VERSION, config) || this;
@@ -2382,8 +2750,7 @@ var CoralogixInternalInstrumentation = /** @class */ (function (_super) {
2382
2750
  return CoralogixInternalInstrumentation;
2383
2751
  }(InstrumentationBase));
2384
2752
 
2385
- // In future we can make this class more generic and add more DOM events
2386
- var CoralogixDOMInstrumentation = /** @class */ (function (_super) {
2753
+ var CoralogixDOMInstrumentation = (function (_super) {
2387
2754
  __extends(CoralogixDOMInstrumentation, _super);
2388
2755
  function CoralogixDOMInstrumentation(config) {
2389
2756
  var _this = _super.call(this, DOM_INSTRUMENTATION_NAME, DOM_INSTRUMENTATION_VERSION, config) || this;
@@ -2428,7 +2795,7 @@ var WORKER_EVENTS = {
2428
2795
  MESSAGE_ERROR: 'messageerror',
2429
2796
  };
2430
2797
 
2431
- var CoralogixWorkerInstrumentation = /** @class */ (function (_super) {
2798
+ var CoralogixWorkerInstrumentation = (function (_super) {
2432
2799
  __extends(CoralogixWorkerInstrumentation, _super);
2433
2800
  function CoralogixWorkerInstrumentation(config, errorInstrumentation, coralogixRum) {
2434
2801
  var _this = _super.call(this, WORKER_INSTRUMENTATION, WORKER_INSTRUMENTATION_VERSION, config) || this;
@@ -2446,7 +2813,7 @@ var CoralogixWorkerInstrumentation = /** @class */ (function (_super) {
2446
2813
  };
2447
2814
  CoralogixWorkerInstrumentation.prototype.createCxWorker = function (OriginalWorker) {
2448
2815
  var self = this;
2449
- var CxWorker = /** @class */ (function (_super) {
2816
+ var CxWorker = (function (_super) {
2450
2817
  __extends(CxWorker, _super);
2451
2818
  function CxWorker(scriptURL, options) {
2452
2819
  var _this = _super.call(this, scriptURL, options) || this;
@@ -2539,10 +2906,6 @@ var OPTIONS_DEFAULTS = {
2539
2906
  urlBlueprinters: defaultUrlBlueprinters,
2540
2907
  collectIPData: true,
2541
2908
  };
2542
- /**
2543
- * Note: For any instrumentation added to CoralogixOtelWebOptionsInstrumentations,
2544
- * The `confKey` must match one of its keys.
2545
- */
2546
2909
  var INSTRUMENTATIONS = [
2547
2910
  {
2548
2911
  Instrument: CoralogixErrorInstrumentation,
@@ -2640,13 +3003,13 @@ var CoralogixAttributes = {
2640
3003
  SCREENSHOT_CONTEXT: 'screenshot_context',
2641
3004
  };
2642
3005
  var CoralogixDomainsApiUrlMap = {
2643
- EU1: 'https://ingress.eu1.rum-ingress-coralogix.com', // eu-west-1 (Ireland)
2644
- EU2: 'https://ingress.eu2.rum-ingress-coralogix.com', // eu-north-1 (Stockholm)
2645
- US1: 'https://ingress.us1.rum-ingress-coralogix.com', // us-east-2 (Ohio)
2646
- US2: 'https://ingress.us2.rum-ingress-coralogix.com', // us-west-2 (Oregon)
2647
- AP1: 'https://ingress.ap1.rum-ingress-coralogix.com', // ap-south-1 (Mumbai)
2648
- AP2: 'https://ingress.ap2.rum-ingress-coralogix.com', // ap-southeast-1 (Singapore)
2649
- AP3: 'https://ingress.ap3.rum-ingress-coralogix.com', // ap-southeast-3 (Jakarta)
3006
+ EU1: 'https://ingress.eu1.rum-ingress-coralogix.com',
3007
+ EU2: 'https://ingress.eu2.rum-ingress-coralogix.com',
3008
+ US1: 'https://ingress.us1.rum-ingress-coralogix.com',
3009
+ US2: 'https://ingress.us2.rum-ingress-coralogix.com',
3010
+ AP1: 'https://ingress.ap1.rum-ingress-coralogix.com',
3011
+ AP2: 'https://ingress.ap2.rum-ingress-coralogix.com',
3012
+ AP3: 'https://ingress.ap3.rum-ingress-coralogix.com',
2650
3013
  STAGING: 'https://ingress.staging.rum-ingress-coralogix.com',
2651
3014
  };
2652
3015
  var PROXY_CX_FORWARD_PARAMETER = 'cxforward';
@@ -2687,7 +3050,7 @@ function getInstrumentationConfig(value, defaults, defaultDisable) {
2687
3050
  return Object.assign({}, defaults, value);
2688
3051
  }
2689
3052
  var hrTimeToMilliseconds = function (_a) {
2690
- var _b = __read$1(_a, 2), seconds = _b[0], nanoseconds = _b[1];
3053
+ var _b = __read(_a, 2), seconds = _b[0], nanoseconds = _b[1];
2691
3054
  return seconds * 1000 + Math.round(nanoseconds / 1e6);
2692
3055
  };
2693
3056
  var isNetworkError = function (status) {
@@ -2756,8 +3119,8 @@ function parseUserAgent(userAgent) {
2756
3119
  var osVersion = 'Unknown';
2757
3120
  var device = 'Desktop';
2758
3121
  try {
2759
- for (var _g = __values$1(Object.entries(browsers)), _h = _g.next(); !_h.done; _h = _g.next()) {
2760
- var _j = __read$1(_h.value, 2), name_1 = _j[0], regex = _j[1];
3122
+ for (var _g = __values(Object.entries(browsers)), _h = _g.next(); !_h.done; _h = _g.next()) {
3123
+ var _j = __read(_h.value, 2), name_1 = _j[0], regex = _j[1];
2761
3124
  var match = userAgent.match(regex);
2762
3125
  if (match) {
2763
3126
  browser = name_1;
@@ -2774,8 +3137,8 @@ function parseUserAgent(userAgent) {
2774
3137
  finally { if (e_1) throw e_1.error; }
2775
3138
  }
2776
3139
  try {
2777
- for (var _k = __values$1(Object.entries(operatingSystems)), _l = _k.next(); !_l.done; _l = _k.next()) {
2778
- var _m = __read$1(_l.value, 2), name_2 = _m[0], regex = _m[1];
3140
+ for (var _k = __values(Object.entries(operatingSystems)), _l = _k.next(); !_l.done; _l = _k.next()) {
3141
+ var _m = __read(_l.value, 2), name_2 = _m[0], regex = _m[1];
2779
3142
  var match = userAgent.match(regex);
2780
3143
  if (match) {
2781
3144
  os = name_2;
@@ -2792,8 +3155,8 @@ function parseUserAgent(userAgent) {
2792
3155
  finally { if (e_2) throw e_2.error; }
2793
3156
  }
2794
3157
  try {
2795
- for (var _o = __values$1(Object.entries(devices)), _p = _o.next(); !_p.done; _p = _o.next()) {
2796
- var _q = __read$1(_p.value, 2), name_3 = _q[0], regex = _q[1];
3158
+ for (var _o = __values(Object.entries(devices)), _p = _o.next(); !_p.done; _p = _o.next()) {
3159
+ var _q = __read(_p.value, 2), name_3 = _q[0], regex = _q[1];
2797
3160
  var match = userAgent.match(regex);
2798
3161
  if (match) {
2799
3162
  device = name_3;
@@ -2819,8 +3182,7 @@ function calculateTotalBlockingTime(list) {
2819
3182
  function generateWebVitalUniqueID() {
2820
3183
  return "v3-".concat(getNowTime(), "-").concat(Math.floor(Math.random() * (9e12 - 1)) + 1e12);
2821
3184
  }
2822
- function rateForTBTMetricValue(value // ms
2823
- ) {
3185
+ function rateForTBTMetricValue(value) {
2824
3186
  switch (true) {
2825
3187
  case value > 600:
2826
3188
  return 'poor';
@@ -2835,8 +3197,8 @@ function flattenAttributes(attributes) {
2835
3197
  var customLabels = JSON.parse(attributes[CoralogixAttributes.CUSTOM_LABELS]);
2836
3198
  var flatAttributes = omit(attributes, CoralogixAttributes.CUSTOM_LABELS);
2837
3199
  try {
2838
- for (var _b = __values$1(Object.entries(customLabels)), _c = _b.next(); !_c.done; _c = _b.next()) {
2839
- var _d = __read$1(_c.value, 2), key = _d[0], value = _d[1];
3200
+ for (var _b = __values(Object.entries(customLabels)), _c = _b.next(); !_c.done; _c = _b.next()) {
3201
+ var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
2840
3202
  flatAttributes[key] =
2841
3203
  typeof value !== 'string' ? JSON.stringify(value) : value;
2842
3204
  }
@@ -2867,7 +3229,7 @@ function replacePatternsInUrl(_a) {
2867
3229
  var patterns = _a.patterns, url = _a.url;
2868
3230
  var modifiedUrl = url;
2869
3231
  try {
2870
- for (var patterns_1 = __values$1(patterns), patterns_1_1 = patterns_1.next(); !patterns_1_1.done; patterns_1_1 = patterns_1.next()) {
3232
+ for (var patterns_1 = __values(patterns), patterns_1_1 = patterns_1.next(); !patterns_1_1.done; patterns_1_1 = patterns_1.next()) {
2871
3233
  var _c = patterns_1_1.value, pattern = _c.pattern, replacement = _c.replacement;
2872
3234
  modifiedUrl = modifiedUrl.replace(pattern, replacement);
2873
3235
  }
@@ -2909,7 +3271,7 @@ function partition(array, predicate) {
2909
3271
  var truthyValues = [];
2910
3272
  var falsyValues = [];
2911
3273
  try {
2912
- for (var array_1 = __values$1(array), array_1_1 = array_1.next(); !array_1_1.done; array_1_1 = array_1.next()) {
3274
+ for (var array_1 = __values(array), array_1_1 = array_1.next(); !array_1_1.done; array_1_1 = array_1.next()) {
2913
3275
  var element = array_1_1.value;
2914
3276
  if (predicate(element)) {
2915
3277
  truthyValues.push(element);
@@ -2929,7 +3291,7 @@ function partition(array, predicate) {
2929
3291
  return [truthyValues, falsyValues];
2930
3292
  }
2931
3293
 
2932
- var CoralogixSpanAttributesProcessor = /** @class */ (function () {
3294
+ var CoralogixSpanAttributesProcessor = (function () {
2933
3295
  function CoralogixSpanAttributesProcessor(labels) {
2934
3296
  var _a;
2935
3297
  this.labels = (_a = {},
@@ -2985,528 +3347,6 @@ var CoralogixSpanAttributesProcessor = /** @class */ (function () {
2985
3347
  return CoralogixSpanAttributesProcessor;
2986
3348
  }());
2987
3349
 
2988
- /*
2989
- * Copyright The OpenTelemetry Authors
2990
- *
2991
- * Licensed under the Apache License, Version 2.0 (the "License");
2992
- * you may not use this file except in compliance with the License.
2993
- * You may obtain a copy of the License at
2994
- *
2995
- * https://www.apache.org/licenses/LICENSE-2.0
2996
- *
2997
- * Unless required by applicable law or agreed to in writing, software
2998
- * distributed under the License is distributed on an "AS IS" BASIS,
2999
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3000
- * See the License for the specific language governing permissions and
3001
- * limitations under the License.
3002
- */
3003
- var SUPPRESS_TRACING_KEY = createContextKey('OpenTelemetry SDK Context Key SUPPRESS_TRACING');
3004
- function isTracingSuppressed(context) {
3005
- return context.getValue(SUPPRESS_TRACING_KEY) === true;
3006
- }
3007
-
3008
- /*
3009
- * Copyright The OpenTelemetry Authors
3010
- *
3011
- * Licensed under the Apache License, Version 2.0 (the "License");
3012
- * you may not use this file except in compliance with the License.
3013
- * You may obtain a copy of the License at
3014
- *
3015
- * https://www.apache.org/licenses/LICENSE-2.0
3016
- *
3017
- * Unless required by applicable law or agreed to in writing, software
3018
- * distributed under the License is distributed on an "AS IS" BASIS,
3019
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3020
- * See the License for the specific language governing permissions and
3021
- * limitations under the License.
3022
- */
3023
- var BAGGAGE_KEY_PAIR_SEPARATOR = '=';
3024
- var BAGGAGE_PROPERTIES_SEPARATOR = ';';
3025
- var BAGGAGE_ITEMS_SEPARATOR = ',';
3026
- // Name of the http header used to propagate the baggage
3027
- var BAGGAGE_HEADER = 'baggage';
3028
- // Maximum number of name-value pairs allowed by w3c spec
3029
- var BAGGAGE_MAX_NAME_VALUE_PAIRS = 180;
3030
- // Maximum number of bytes per a single name-value pair allowed by w3c spec
3031
- var BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096;
3032
- // Maximum total length of all name-value pairs allowed by w3c spec
3033
- var BAGGAGE_MAX_TOTAL_LENGTH = 8192;
3034
-
3035
- var __read = undefined && undefined.__read || function (o, n) {
3036
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3037
- if (!m) return o;
3038
- var i = m.call(o),
3039
- r,
3040
- ar = [],
3041
- e;
3042
- try {
3043
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
3044
- } catch (error) {
3045
- e = {
3046
- error: error
3047
- };
3048
- } finally {
3049
- try {
3050
- if (r && !r.done && (m = i["return"])) m.call(i);
3051
- } finally {
3052
- if (e) throw e.error;
3053
- }
3054
- }
3055
- return ar;
3056
- };
3057
- function serializeKeyPairs(keyPairs) {
3058
- return keyPairs.reduce(function (hValue, current) {
3059
- var value = "" + hValue + (hValue !== '' ? BAGGAGE_ITEMS_SEPARATOR : '') + current;
3060
- return value.length > BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value;
3061
- }, '');
3062
- }
3063
- function getKeyPairs(baggage) {
3064
- return baggage.getAllEntries().map(function (_a) {
3065
- var _b = __read(_a, 2),
3066
- key = _b[0],
3067
- value = _b[1];
3068
- var entry = encodeURIComponent(key) + "=" + encodeURIComponent(value.value);
3069
- // include opaque metadata if provided
3070
- // NOTE: we intentionally don't URI-encode the metadata - that responsibility falls on the metadata implementation
3071
- if (value.metadata !== undefined) {
3072
- entry += BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString();
3073
- }
3074
- return entry;
3075
- });
3076
- }
3077
- function parsePairKeyValue(entry) {
3078
- var valueProps = entry.split(BAGGAGE_PROPERTIES_SEPARATOR);
3079
- if (valueProps.length <= 0) return;
3080
- var keyPairPart = valueProps.shift();
3081
- if (!keyPairPart) return;
3082
- var separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);
3083
- if (separatorIndex <= 0) return;
3084
- var key = decodeURIComponent(keyPairPart.substring(0, separatorIndex).trim());
3085
- var value = decodeURIComponent(keyPairPart.substring(separatorIndex + 1).trim());
3086
- var metadata;
3087
- if (valueProps.length > 0) {
3088
- metadata = baggageEntryMetadataFromString(valueProps.join(BAGGAGE_PROPERTIES_SEPARATOR));
3089
- }
3090
- return {
3091
- key: key,
3092
- value: value,
3093
- metadata: metadata
3094
- };
3095
- }
3096
-
3097
- /*
3098
- * Copyright The OpenTelemetry Authors
3099
- *
3100
- * Licensed under the Apache License, Version 2.0 (the "License");
3101
- * you may not use this file except in compliance with the License.
3102
- * You may obtain a copy of the License at
3103
- *
3104
- * https://www.apache.org/licenses/LICENSE-2.0
3105
- *
3106
- * Unless required by applicable law or agreed to in writing, software
3107
- * distributed under the License is distributed on an "AS IS" BASIS,
3108
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3109
- * See the License for the specific language governing permissions and
3110
- * limitations under the License.
3111
- */
3112
- /**
3113
- * Propagates {@link Baggage} through Context format propagation.
3114
- *
3115
- * Based on the Baggage specification:
3116
- * https://w3c.github.io/baggage/
3117
- */
3118
- var W3CBaggagePropagator = /** @class */function () {
3119
- function W3CBaggagePropagator() {}
3120
- W3CBaggagePropagator.prototype.inject = function (context, carrier, setter) {
3121
- var baggage = propagation.getBaggage(context);
3122
- if (!baggage || isTracingSuppressed(context)) return;
3123
- var keyPairs = getKeyPairs(baggage).filter(function (pair) {
3124
- return pair.length <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS;
3125
- }).slice(0, BAGGAGE_MAX_NAME_VALUE_PAIRS);
3126
- var headerValue = serializeKeyPairs(keyPairs);
3127
- if (headerValue.length > 0) {
3128
- setter.set(carrier, BAGGAGE_HEADER, headerValue);
3129
- }
3130
- };
3131
- W3CBaggagePropagator.prototype.extract = function (context, carrier, getter) {
3132
- var headerValue = getter.get(carrier, BAGGAGE_HEADER);
3133
- var baggageString = Array.isArray(headerValue) ? headerValue.join(BAGGAGE_ITEMS_SEPARATOR) : headerValue;
3134
- if (!baggageString) return context;
3135
- var baggage = {};
3136
- if (baggageString.length === 0) {
3137
- return context;
3138
- }
3139
- var pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);
3140
- pairs.forEach(function (entry) {
3141
- var keyPair = parsePairKeyValue(entry);
3142
- if (keyPair) {
3143
- var baggageEntry = {
3144
- value: keyPair.value
3145
- };
3146
- if (keyPair.metadata) {
3147
- baggageEntry.metadata = keyPair.metadata;
3148
- }
3149
- baggage[keyPair.key] = baggageEntry;
3150
- }
3151
- });
3152
- if (Object.entries(baggage).length === 0) {
3153
- return context;
3154
- }
3155
- return propagation.setBaggage(context, propagation.createBaggage(baggage));
3156
- };
3157
- W3CBaggagePropagator.prototype.fields = function () {
3158
- return [BAGGAGE_HEADER];
3159
- };
3160
- return W3CBaggagePropagator;
3161
- }();
3162
-
3163
- /*
3164
- * Copyright The OpenTelemetry Authors
3165
- *
3166
- * Licensed under the Apache License, Version 2.0 (the "License");
3167
- * you may not use this file except in compliance with the License.
3168
- * You may obtain a copy of the License at
3169
- *
3170
- * https://www.apache.org/licenses/LICENSE-2.0
3171
- *
3172
- * Unless required by applicable law or agreed to in writing, software
3173
- * distributed under the License is distributed on an "AS IS" BASIS,
3174
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3175
- * See the License for the specific language governing permissions and
3176
- * limitations under the License.
3177
- */
3178
- var ExportResultCode;
3179
- (function (ExportResultCode) {
3180
- ExportResultCode[ExportResultCode["SUCCESS"] = 0] = "SUCCESS";
3181
- ExportResultCode[ExportResultCode["FAILED"] = 1] = "FAILED";
3182
- })(ExportResultCode || (ExportResultCode = {}));
3183
-
3184
- /*
3185
- * Copyright The OpenTelemetry Authors
3186
- *
3187
- * Licensed under the Apache License, Version 2.0 (the "License");
3188
- * you may not use this file except in compliance with the License.
3189
- * You may obtain a copy of the License at
3190
- *
3191
- * https://www.apache.org/licenses/LICENSE-2.0
3192
- *
3193
- * Unless required by applicable law or agreed to in writing, software
3194
- * distributed under the License is distributed on an "AS IS" BASIS,
3195
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3196
- * See the License for the specific language governing permissions and
3197
- * limitations under the License.
3198
- */
3199
- var __values = undefined && undefined.__values || function (o) {
3200
- var s = typeof Symbol === "function" && Symbol.iterator,
3201
- m = s && o[s],
3202
- i = 0;
3203
- if (m) return m.call(o);
3204
- if (o && typeof o.length === "number") return {
3205
- next: function next() {
3206
- if (o && i >= o.length) o = void 0;
3207
- return {
3208
- value: o && o[i++],
3209
- done: !o
3210
- };
3211
- }
3212
- };
3213
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
3214
- };
3215
- /** Combines multiple propagators into a single propagator. */
3216
- var CompositePropagator = /** @class */function () {
3217
- /**
3218
- * Construct a composite propagator from a list of propagators.
3219
- *
3220
- * @param [config] Configuration object for composite propagator
3221
- */
3222
- function CompositePropagator(config) {
3223
- if (config === void 0) {
3224
- config = {};
3225
- }
3226
- var _a;
3227
- this._propagators = (_a = config.propagators) !== null && _a !== void 0 ? _a : [];
3228
- this._fields = Array.from(new Set(this._propagators
3229
- // older propagators may not have fields function, null check to be sure
3230
- .map(function (p) {
3231
- return typeof p.fields === 'function' ? p.fields() : [];
3232
- }).reduce(function (x, y) {
3233
- return x.concat(y);
3234
- }, [])));
3235
- }
3236
- /**
3237
- * Run each of the configured propagators with the given context and carrier.
3238
- * Propagators are run in the order they are configured, so if multiple
3239
- * propagators write the same carrier key, the propagator later in the list
3240
- * will "win".
3241
- *
3242
- * @param context Context to inject
3243
- * @param carrier Carrier into which context will be injected
3244
- */
3245
- CompositePropagator.prototype.inject = function (context, carrier, setter) {
3246
- var e_1, _a;
3247
- try {
3248
- for (var _b = __values(this._propagators), _c = _b.next(); !_c.done; _c = _b.next()) {
3249
- var propagator = _c.value;
3250
- try {
3251
- propagator.inject(context, carrier, setter);
3252
- } catch (err) {
3253
- diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
3254
- }
3255
- }
3256
- } catch (e_1_1) {
3257
- e_1 = {
3258
- error: e_1_1
3259
- };
3260
- } finally {
3261
- try {
3262
- if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
3263
- } finally {
3264
- if (e_1) throw e_1.error;
3265
- }
3266
- }
3267
- };
3268
- /**
3269
- * Run each of the configured propagators with the given context and carrier.
3270
- * Propagators are run in the order they are configured, so if multiple
3271
- * propagators write the same context key, the propagator later in the list
3272
- * will "win".
3273
- *
3274
- * @param context Context to add values to
3275
- * @param carrier Carrier from which to extract context
3276
- */
3277
- CompositePropagator.prototype.extract = function (context, carrier, getter) {
3278
- return this._propagators.reduce(function (ctx, propagator) {
3279
- try {
3280
- return propagator.extract(ctx, carrier, getter);
3281
- } catch (err) {
3282
- diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
3283
- }
3284
- return ctx;
3285
- }, context);
3286
- };
3287
- CompositePropagator.prototype.fields = function () {
3288
- // return a new array so our fields cannot be modified
3289
- return this._fields.slice();
3290
- };
3291
- return CompositePropagator;
3292
- }();
3293
-
3294
- /*
3295
- * Copyright The OpenTelemetry Authors
3296
- *
3297
- * Licensed under the Apache License, Version 2.0 (the "License");
3298
- * you may not use this file except in compliance with the License.
3299
- * You may obtain a copy of the License at
3300
- *
3301
- * https://www.apache.org/licenses/LICENSE-2.0
3302
- *
3303
- * Unless required by applicable law or agreed to in writing, software
3304
- * distributed under the License is distributed on an "AS IS" BASIS,
3305
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3306
- * See the License for the specific language governing permissions and
3307
- * limitations under the License.
3308
- */
3309
- var VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';
3310
- var VALID_KEY = "[a-z]" + VALID_KEY_CHAR_RANGE + "{0,255}";
3311
- var VALID_VENDOR_KEY = "[a-z0-9]" + VALID_KEY_CHAR_RANGE + "{0,240}@[a-z]" + VALID_KEY_CHAR_RANGE + "{0,13}";
3312
- var VALID_KEY_REGEX = new RegExp("^(?:" + VALID_KEY + "|" + VALID_VENDOR_KEY + ")$");
3313
- var VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;
3314
- var INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;
3315
- /**
3316
- * Key is opaque string up to 256 characters printable. It MUST begin with a
3317
- * lowercase letter, and can only contain lowercase letters a-z, digits 0-9,
3318
- * underscores _, dashes -, asterisks *, and forward slashes /.
3319
- * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the
3320
- * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.
3321
- * see https://www.w3.org/TR/trace-context/#key
3322
- */
3323
- function validateKey(key) {
3324
- return VALID_KEY_REGEX.test(key);
3325
- }
3326
- /**
3327
- * Value is opaque string up to 256 characters printable ASCII RFC0020
3328
- * characters (i.e., the range 0x20 to 0x7E) except comma , and =.
3329
- */
3330
- function validateValue(value) {
3331
- return VALID_VALUE_BASE_REGEX.test(value) && !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value);
3332
- }
3333
-
3334
- /*
3335
- * Copyright The OpenTelemetry Authors
3336
- *
3337
- * Licensed under the Apache License, Version 2.0 (the "License");
3338
- * you may not use this file except in compliance with the License.
3339
- * You may obtain a copy of the License at
3340
- *
3341
- * https://www.apache.org/licenses/LICENSE-2.0
3342
- *
3343
- * Unless required by applicable law or agreed to in writing, software
3344
- * distributed under the License is distributed on an "AS IS" BASIS,
3345
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3346
- * See the License for the specific language governing permissions and
3347
- * limitations under the License.
3348
- */
3349
- var MAX_TRACE_STATE_ITEMS = 32;
3350
- var MAX_TRACE_STATE_LEN = 512;
3351
- var LIST_MEMBERS_SEPARATOR = ',';
3352
- var LIST_MEMBER_KEY_VALUE_SPLITTER = '=';
3353
- /**
3354
- * TraceState must be a class and not a simple object type because of the spec
3355
- * requirement (https://www.w3.org/TR/trace-context/#tracestate-field).
3356
- *
3357
- * Here is the list of allowed mutations:
3358
- * - New key-value pair should be added into the beginning of the list
3359
- * - The value of any key can be updated. Modified keys MUST be moved to the
3360
- * beginning of the list.
3361
- */
3362
- var TraceState = /** @class */function () {
3363
- function TraceState(rawTraceState) {
3364
- this._internalState = new Map();
3365
- if (rawTraceState) this._parse(rawTraceState);
3366
- }
3367
- TraceState.prototype.set = function (key, value) {
3368
- // TODO: Benchmark the different approaches(map vs list) and
3369
- // use the faster one.
3370
- var traceState = this._clone();
3371
- if (traceState._internalState.has(key)) {
3372
- traceState._internalState["delete"](key);
3373
- }
3374
- traceState._internalState.set(key, value);
3375
- return traceState;
3376
- };
3377
- TraceState.prototype.unset = function (key) {
3378
- var traceState = this._clone();
3379
- traceState._internalState["delete"](key);
3380
- return traceState;
3381
- };
3382
- TraceState.prototype.get = function (key) {
3383
- return this._internalState.get(key);
3384
- };
3385
- TraceState.prototype.serialize = function () {
3386
- var _this = this;
3387
- return this._keys().reduce(function (agg, key) {
3388
- agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + _this.get(key));
3389
- return agg;
3390
- }, []).join(LIST_MEMBERS_SEPARATOR);
3391
- };
3392
- TraceState.prototype._parse = function (rawTraceState) {
3393
- if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;
3394
- this._internalState = rawTraceState.split(LIST_MEMBERS_SEPARATOR).reverse() // Store in reverse so new keys (.set(...)) will be placed at the beginning
3395
- .reduce(function (agg, part) {
3396
- var listMember = part.trim(); // Optional Whitespace (OWS) handling
3397
- var i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);
3398
- if (i !== -1) {
3399
- var key = listMember.slice(0, i);
3400
- var value = listMember.slice(i + 1, part.length);
3401
- if (validateKey(key) && validateValue(value)) {
3402
- agg.set(key, value);
3403
- }
3404
- }
3405
- return agg;
3406
- }, new Map());
3407
- // Because of the reverse() requirement, trunc must be done after map is created
3408
- if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {
3409
- this._internalState = new Map(Array.from(this._internalState.entries()).reverse() // Use reverse same as original tracestate parse chain
3410
- .slice(0, MAX_TRACE_STATE_ITEMS));
3411
- }
3412
- };
3413
- TraceState.prototype._keys = function () {
3414
- return Array.from(this._internalState.keys()).reverse();
3415
- };
3416
- TraceState.prototype._clone = function () {
3417
- var traceState = new TraceState();
3418
- traceState._internalState = new Map(this._internalState);
3419
- return traceState;
3420
- };
3421
- return TraceState;
3422
- }();
3423
-
3424
- /*
3425
- * Copyright The OpenTelemetry Authors
3426
- *
3427
- * Licensed under the Apache License, Version 2.0 (the "License");
3428
- * you may not use this file except in compliance with the License.
3429
- * You may obtain a copy of the License at
3430
- *
3431
- * https://www.apache.org/licenses/LICENSE-2.0
3432
- *
3433
- * Unless required by applicable law or agreed to in writing, software
3434
- * distributed under the License is distributed on an "AS IS" BASIS,
3435
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3436
- * See the License for the specific language governing permissions and
3437
- * limitations under the License.
3438
- */
3439
- var TRACE_PARENT_HEADER = 'traceparent';
3440
- var TRACE_STATE_HEADER = 'tracestate';
3441
- var VERSION = '00';
3442
- var VERSION_PART = '(?!ff)[\\da-f]{2}';
3443
- var TRACE_ID_PART = '(?![0]{32})[\\da-f]{32}';
3444
- var PARENT_ID_PART = '(?![0]{16})[\\da-f]{16}';
3445
- var FLAGS_PART = '[\\da-f]{2}';
3446
- var TRACE_PARENT_REGEX = new RegExp("^\\s?(" + VERSION_PART + ")-(" + TRACE_ID_PART + ")-(" + PARENT_ID_PART + ")-(" + FLAGS_PART + ")(-.*)?\\s?$");
3447
- /**
3448
- * Parses information from the [traceparent] span tag and converts it into {@link SpanContext}
3449
- * @param traceParent - A meta property that comes from server.
3450
- * It should be dynamically generated server side to have the server's request trace Id,
3451
- * a parent span Id that was set on the server's request span,
3452
- * and the trace flags to indicate the server's sampling decision
3453
- * (01 = sampled, 00 = not sampled).
3454
- * for example: '{version}-{traceId}-{spanId}-{sampleDecision}'
3455
- * For more information see {@link https://www.w3.org/TR/trace-context/}
3456
- */
3457
- function parseTraceParent(traceParent) {
3458
- var match = TRACE_PARENT_REGEX.exec(traceParent);
3459
- if (!match) return null;
3460
- // According to the specification the implementation should be compatible
3461
- // with future versions. If there are more parts, we only reject it if it's using version 00
3462
- // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent
3463
- if (match[1] === '00' && match[5]) return null;
3464
- return {
3465
- traceId: match[2],
3466
- spanId: match[3],
3467
- traceFlags: parseInt(match[4], 16)
3468
- };
3469
- }
3470
- /**
3471
- * Propagates {@link SpanContext} through Trace Context format propagation.
3472
- *
3473
- * Based on the Trace Context specification:
3474
- * https://www.w3.org/TR/trace-context/
3475
- */
3476
- var W3CTraceContextPropagator = /** @class */function () {
3477
- function W3CTraceContextPropagator() {}
3478
- W3CTraceContextPropagator.prototype.inject = function (context, carrier, setter) {
3479
- var spanContext = trace.getSpanContext(context);
3480
- if (!spanContext || isTracingSuppressed(context) || !isSpanContextValid(spanContext)) return;
3481
- var traceParent = VERSION + "-" + spanContext.traceId + "-" + spanContext.spanId + "-0" + Number(spanContext.traceFlags || TraceFlags.NONE).toString(16);
3482
- setter.set(carrier, TRACE_PARENT_HEADER, traceParent);
3483
- if (spanContext.traceState) {
3484
- setter.set(carrier, TRACE_STATE_HEADER, spanContext.traceState.serialize());
3485
- }
3486
- };
3487
- W3CTraceContextPropagator.prototype.extract = function (context, carrier, getter) {
3488
- var traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);
3489
- if (!traceParentHeader) return context;
3490
- var traceParent = Array.isArray(traceParentHeader) ? traceParentHeader[0] : traceParentHeader;
3491
- if (typeof traceParent !== 'string') return context;
3492
- var spanContext = parseTraceParent(traceParent);
3493
- if (!spanContext) return context;
3494
- spanContext.isRemote = true;
3495
- var traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);
3496
- if (traceStateHeader) {
3497
- // If more than one `tracestate` header is found, we merge them into a
3498
- // single header.
3499
- var state = Array.isArray(traceStateHeader) ? traceStateHeader.join(',') : traceStateHeader;
3500
- spanContext.traceState = new TraceState(typeof state === 'string' ? state : undefined);
3501
- }
3502
- return trace.setSpanContext(context, spanContext);
3503
- };
3504
- W3CTraceContextPropagator.prototype.fields = function () {
3505
- return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];
3506
- };
3507
- return W3CTraceContextPropagator;
3508
- }();
3509
-
3510
3350
  var _a$1;
3511
3351
  var MAX_RUM_EVENTS_PER_REQUEST = 500;
3512
3352
  var MAX_RUM_EVENTS = 20000;
@@ -3519,7 +3359,7 @@ var DEFAULT_MS_RECORD_TIME = 10000;
3519
3359
  _a$1),
3520
3360
  });
3521
3361
 
3522
- var Request = /** @class */ (function () {
3362
+ var Request = (function () {
3523
3363
  function Request(requestConfig) {
3524
3364
  this.requestConfig = requestConfig;
3525
3365
  this.resolvedUrl = '';
@@ -3550,12 +3390,12 @@ var Request = /** @class */ (function () {
3550
3390
  return Request;
3551
3391
  }());
3552
3392
 
3553
- var CxCustomSampler = /** @class */ (function () {
3393
+ var CxCustomSampler = (function () {
3554
3394
  function CxCustomSampler() {
3555
3395
  }
3556
3396
  CxCustomSampler.prototype.shouldSample = function () {
3557
3397
  return {
3558
- decision: SamplingDecision.RECORD, // RECORDED BUT SAMPLED = 00
3398
+ decision: SamplingDecision.RECORD,
3559
3399
  };
3560
3400
  };
3561
3401
  return CxCustomSampler;
@@ -3609,9 +3449,7 @@ var isSessionWithError = function () {
3609
3449
  function getResolvedSampler(resolvedOptions) {
3610
3450
  var sampler = new AlwaysOnSampler();
3611
3451
  var sessionSampleRate = resolvedOptions.sessionSampleRate, sessionConfig = resolvedOptions.sessionConfig, debug = resolvedOptions.debug, sessionRecordingConfig = resolvedOptions.sessionRecordingConfig;
3612
- var shouldNotTrackSession =
3613
- //todo: remove when sessionSampleRate is removed
3614
- !isSamplingOn(sessionSampleRate) ||
3452
+ var shouldNotTrackSession = !isSamplingOn(sessionSampleRate) ||
3615
3453
  !isSamplingOn(sessionConfig.sessionSampleRate);
3616
3454
  if (shouldNotTrackSession) {
3617
3455
  var shouldAlwaysTrackSessionsWithErrors = sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.alwaysTrackSessionsWithErrors;
@@ -3622,7 +3460,6 @@ function getResolvedSampler(resolvedOptions) {
3622
3460
  if (debug) {
3623
3461
  console.debug('CoralogixRum: Session tracking is disabled due to sampling rate');
3624
3462
  }
3625
- // session dropped due to sample, only network trace headers should run
3626
3463
  sampler = new CxCustomSampler();
3627
3464
  if (sessionRecordingConfig) {
3628
3465
  sessionRecordingConfig.enable = false;
@@ -3638,7 +3475,7 @@ function isProcessorShouldStop(isActive) {
3638
3475
  return !isActive || !!((_a = getSessionManager()) === null || _a === void 0 ? void 0 : _a.isIdleActive);
3639
3476
  }
3640
3477
 
3641
- var CoralogixExporter = /** @class */ (function () {
3478
+ var CoralogixExporter = (function () {
3642
3479
  function CoralogixExporter() {
3643
3480
  var _this = this;
3644
3481
  this.isActive = true;
@@ -3697,15 +3534,13 @@ var CoralogixExporter = /** @class */ (function () {
3697
3534
  return cxSpans;
3698
3535
  }, []);
3699
3536
  this.invokeLogRequest(instrumentationLogs);
3700
- var cachedLogs = (CxGlobal.cachedLogs = __spreadArray(__spreadArray([], __read$1((CxGlobal.cachedLogs || [])), false), __read$1(currentSpans), false));
3537
+ var cachedLogs = (CxGlobal.cachedLogs = __spreadArray(__spreadArray([], __read((CxGlobal.cachedLogs || [])), false), __read(currentSpans), false));
3701
3538
  var logsCounter = cachedLogs.length;
3702
- //check if we reached the limit of max rum events for session with error
3703
3539
  if (logsCounter > maxRumEventsForSessionWithError && !sessionHasError) {
3704
3540
  this.clearCachedDataForSessionWithError();
3705
3541
  }
3706
3542
  else if (sessionHasError) {
3707
3543
  if (logsCounter > MAX_RUM_EVENTS_PER_REQUEST) {
3708
- //split request to chunks of 500 logs per each
3709
3544
  var chunks = [];
3710
3545
  for (var i = 0; i < logsCounter; i += MAX_RUM_EVENTS_PER_REQUEST) {
3711
3546
  chunks.push(cachedLogs.slice(i, i + MAX_RUM_EVENTS_PER_REQUEST));
@@ -3733,7 +3568,7 @@ var CoralogixExporter = /** @class */ (function () {
3733
3568
  return CoralogixExporter;
3734
3569
  }());
3735
3570
 
3736
- var CoralogixWebTracerProvider = /** @class */ (function (_super) {
3571
+ var CoralogixWebTracerProvider = (function (_super) {
3737
3572
  __extends(CoralogixWebTracerProvider, _super);
3738
3573
  function CoralogixWebTracerProvider() {
3739
3574
  return _super !== null && _super.apply(this, arguments) || this;
@@ -3741,7 +3576,7 @@ var CoralogixWebTracerProvider = /** @class */ (function (_super) {
3741
3576
  return CoralogixWebTracerProvider;
3742
3577
  }(WebTracerProvider));
3743
3578
 
3744
- var SessionIdle = /** @class */ (function () {
3579
+ var SessionIdle = (function () {
3745
3580
  function SessionIdle(idleConfig) {
3746
3581
  var _this = this;
3747
3582
  this.idleConfig = idleConfig;
@@ -3782,7 +3617,7 @@ var SessionIdle = /** @class */ (function () {
3782
3617
  var _a, _b;
3783
3618
  (_b = (_a = this.stopCallbacks).removeActivityListeners) === null || _b === void 0 ? void 0 : _b.call(_a);
3784
3619
  if (typeof CxGlobal.addEventListener === 'function') {
3785
- var stop_1 = addEventListeners(CxGlobal, ["touchstart" /* DOM_EVENT.TOUCH_START */, "keydown" /* DOM_EVENT.KEY_DOWN */, "mousemove" /* DOM_EVENT.MOUSE_MOVE */], this.idlenessEventsHandler, { capture: true, passive: true }).stop;
3620
+ var stop_1 = addEventListeners(CxGlobal, ["touchstart", "keydown", "mousemove"], this.idlenessEventsHandler, { capture: true, passive: true }).stop;
3786
3621
  this.stopCallbacks.removeActivityListeners = stop_1;
3787
3622
  }
3788
3623
  };
@@ -3817,7 +3652,7 @@ function isInstrumentationCompatible(confKey) {
3817
3652
  return true;
3818
3653
  }
3819
3654
 
3820
- var SessionManager = /** @class */ (function (_super) {
3655
+ var SessionManager = (function (_super) {
3821
3656
  __extends(SessionManager, _super);
3822
3657
  function SessionManager(recordConfig) {
3823
3658
  var _a;
@@ -3945,7 +3780,6 @@ var SessionManager = /** @class */ (function (_super) {
3945
3780
  configurable: true
3946
3781
  });
3947
3782
  SessionManager.prototype.updateCurrentPage = function (fragment) {
3948
- // Should not updateCurrentPage when idle, even if rum events are sent before idle(like network requests)
3949
3783
  if (this.isIdleActive) {
3950
3784
  this._currentPageFragment = undefined;
3951
3785
  return;
@@ -3975,21 +3809,21 @@ var SessionManager = /** @class */ (function (_super) {
3975
3809
  case 0:
3976
3810
  CxGlobal[SESSION_MANAGER_KEY] = this;
3977
3811
  this.sessionRecorderConfig = recordConfig;
3978
- if (!(recordConfig === null || recordConfig === void 0 ? void 0 : recordConfig.enable)) return [3 /*break*/, 3];
3812
+ if (!(recordConfig === null || recordConfig === void 0 ? void 0 : recordConfig.enable)) return [3, 3];
3979
3813
  recordingSamplingEnabled = isSamplingOn(recordConfig.sessionRecordingSampleRate);
3980
3814
  isSessionRecordingCompatible = isInstrumentationCompatible(SESSION_RECORDING_INSTRUMENTATION_NAME);
3981
- if (!(recordingSamplingEnabled && isSessionRecordingCompatible)) return [3 /*break*/, 2];
3982
- return [4 /*yield*/, import('./sessionRecorder.esm.js')];
3815
+ if (!(recordingSamplingEnabled && isSessionRecordingCompatible)) return [3, 2];
3816
+ return [4, import('./sessionRecorder.esm.js')];
3983
3817
  case 1:
3984
3818
  SessionRecorder_1 = (_a.sent()).SessionRecorder;
3985
3819
  this.sessionRecorder = new SessionRecorder_1(this, recordConfig);
3986
- return [3 /*break*/, 3];
3820
+ return [3, 3];
3987
3821
  case 2:
3988
3822
  if (getSdkConfig().debug) {
3989
3823
  console.debug('Coralogix Browser SDK - Session recording is disabled');
3990
3824
  }
3991
3825
  _a.label = 3;
3992
- case 3: return [2 /*return*/];
3826
+ case 3: return [2];
3993
3827
  }
3994
3828
  });
3995
3829
  });
@@ -4011,13 +3845,19 @@ var SessionManager = /** @class */ (function (_super) {
4011
3845
  console.debug('Coralogix Browser SDK - Session expired, clearing session');
4012
3846
  }
4013
3847
  (_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.setItem(PREV_SESSION_KEY, JSON.stringify(__assign(__assign({}, this.activeSession), { hasRecording: (_b = this.sessionRecorder) === null || _b === void 0 ? void 0 : _b.getSessionHasRecording(), hasScreenshot: (_c = this.sessionRecorder) === null || _c === void 0 ? void 0 : _c.getSessionHasScreenshot() })));
4014
- clearGlobalSpan();
3848
+ this.clearGlobalSpans();
4015
3849
  this.clearSessionWithErrorMode();
4016
3850
  (_d = getSnapshotManager()) === null || _d === void 0 ? void 0 : _d.resetSnapshot();
4017
3851
  this._currentPageFragment = undefined;
4018
3852
  (_e = this.sessionRecorder) === null || _e === void 0 ? void 0 : _e.stopRecording();
4019
3853
  (_f = CxGlobal.sessionStorage) === null || _f === void 0 ? void 0 : _f.removeItem(SESSION_KEY);
4020
3854
  };
3855
+ SessionManager.prototype.clearGlobalSpans = function () {
3856
+ var _a;
3857
+ (_a = getGlobalSpan()) === null || _a === void 0 ? void 0 : _a.endSpan();
3858
+ clearGlobalSpan();
3859
+ clearGlobalSpanMap();
3860
+ };
4021
3861
  SessionManager.prototype.clearSessionWithErrorMode = function () {
4022
3862
  this.sessionHasError = false;
4023
3863
  this.cachedLogsSent = false;
@@ -4061,7 +3901,7 @@ function handlePropagators(config, tracerProvider) {
4061
3901
  propagators = [];
4062
3902
  _a = ((_c = config.traceParentInHeader) === null || _c === void 0 ? void 0 : _c.options) || {}, propagateB3TraceHeader = _a.propagateB3TraceHeader, propagateAwsXrayTraceHeader = _a.propagateAwsXrayTraceHeader;
4063
3903
  if (!propagateAwsXrayTraceHeader && !propagateB3TraceHeader) {
4064
- propagators = __spreadArray(__spreadArray([], __read$1(propagators), false), [
3904
+ propagators = __spreadArray(__spreadArray([], __read(propagators), false), [
4065
3905
  new W3CBaggagePropagator(),
4066
3906
  new W3CTraceContextPropagator(),
4067
3907
  ], false);
@@ -4084,11 +3924,11 @@ function handlePropagators(config, tracerProvider) {
4084
3924
  })),
4085
3925
  });
4086
3926
  }
4087
- return [2 /*return*/];
3927
+ return [2];
4088
3928
  });
4089
3929
  });
4090
3930
  }
4091
- var CxPropagator = /** @class */ (function () {
3931
+ var CxPropagator = (function () {
4092
3932
  function CxPropagator(config, internalPropagator) {
4093
3933
  this.config = config;
4094
3934
  this.internalPropagator = internalPropagator;
@@ -4133,13 +3973,12 @@ function isInitialConfigValid(initConfig) {
4133
3973
  console.warn('CoralogixRum: Initialization configuration missing');
4134
3974
  return;
4135
3975
  }
4136
- // Ensure public key is provided when no proxy URL is set
4137
3976
  if (!initConfig.proxyUrl && !initConfig.public_key) {
4138
3977
  console.warn('CoralogixRum: Public key is missing');
4139
3978
  return;
4140
3979
  }
4141
3980
  try {
4142
- for (var REQUIRED_CONFIG_KEYS_1 = __values$1(REQUIRED_CONFIG_KEYS), REQUIRED_CONFIG_KEYS_1_1 = REQUIRED_CONFIG_KEYS_1.next(); !REQUIRED_CONFIG_KEYS_1_1.done; REQUIRED_CONFIG_KEYS_1_1 = REQUIRED_CONFIG_KEYS_1.next()) {
3981
+ for (var REQUIRED_CONFIG_KEYS_1 = __values(REQUIRED_CONFIG_KEYS), REQUIRED_CONFIG_KEYS_1_1 = REQUIRED_CONFIG_KEYS_1.next(); !REQUIRED_CONFIG_KEYS_1_1.done; REQUIRED_CONFIG_KEYS_1_1 = REQUIRED_CONFIG_KEYS_1.next()) {
4143
3982
  var requiredProp = REQUIRED_CONFIG_KEYS_1_1.value;
4144
3983
  if (isNil(initConfig[requiredProp])) {
4145
3984
  console.error("CoralogixRum: Initialization aborted. Please provide the required property \"".concat(requiredProp, "\"."));
@@ -4163,10 +4002,10 @@ function validateAndResolveInitConfig(config) {
4163
4002
  }
4164
4003
  var ignoreUrls = config.ignoreUrls, urlBlueprinters = config.urlBlueprinters, proxyUrl = config.proxyUrl;
4165
4004
  var resolvedIgnoreUrls = [];
4166
- ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read$1(ignoreUrls), false));
4005
+ ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read(ignoreUrls), false));
4167
4006
  if (proxyUrl)
4168
4007
  resolvedIgnoreUrls.push(new RegExp(proxyUrl));
4169
- OPTIONS_DEFAULTS.ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read$1(OPTIONS_DEFAULTS.ignoreUrls), false));
4008
+ OPTIONS_DEFAULTS.ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read(OPTIONS_DEFAULTS.ignoreUrls), false));
4170
4009
  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 });
4171
4010
  }
4172
4011
  function resolveMemoryUsageConfig(memoryUsageConfig) {
@@ -4188,10 +4027,10 @@ function resolveUrlBlueprinters(urlBlueprinters) {
4188
4027
  var _a, _b;
4189
4028
  var _c = urlBlueprinters || {}, pageUrlBlueprinters = _c.pageUrlBlueprinters, networkUrlBlueprinters = _c.networkUrlBlueprinters;
4190
4029
  if (pageUrlBlueprinters) {
4191
- (_a = resolvedUrlBlueprinters.pageUrlBlueprinters).push.apply(_a, __spreadArray([], __read$1(pageUrlBlueprinters), false));
4030
+ (_a = resolvedUrlBlueprinters.pageUrlBlueprinters).push.apply(_a, __spreadArray([], __read(pageUrlBlueprinters), false));
4192
4031
  }
4193
4032
  if (networkUrlBlueprinters) {
4194
- (_b = resolvedUrlBlueprinters.networkUrlBlueprinters).push.apply(_b, __spreadArray([], __read$1(networkUrlBlueprinters), false));
4033
+ (_b = resolvedUrlBlueprinters.networkUrlBlueprinters).push.apply(_b, __spreadArray([], __read(networkUrlBlueprinters), false));
4195
4034
  }
4196
4035
  };
4197
4036
  concatBlueprinters(urlBlueprinters);
@@ -4201,7 +4040,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
4201
4040
  return resolvedUrlBlueprinters;
4202
4041
  }
4203
4042
 
4204
- var SDK_VERSION = '2.8.5';
4043
+ var SDK_VERSION = '2.8.7';
4205
4044
 
4206
4045
  function shouldDropEvent(cxRumEvent, options) {
4207
4046
  if (isDocumentErrorWithoutMessage(cxRumEvent)) {
@@ -4267,7 +4106,7 @@ function editableToCxRumEvent(editable, cxRumEvent) {
4267
4106
  return __assign(__assign(__assign({}, cxRumEvent), editable), { session_context: __assign(__assign({}, cxRumEvent.session_context), editable.session_context) });
4268
4107
  }
4269
4108
 
4270
- var CoralogixSpanMapProcessor = /** @class */ (function () {
4109
+ var CoralogixSpanMapProcessor = (function () {
4271
4110
  function CoralogixSpanMapProcessor() {
4272
4111
  this.sdkConfig = getSdkConfig();
4273
4112
  this.isActive = true;
@@ -4362,7 +4201,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
4362
4201
  traceId: traceId,
4363
4202
  parentSpanId: parentSpanId,
4364
4203
  name: name,
4365
- attributes: __assign(__assign({}, flattenAttributes(attributes)), this.resolveLabels(cxSpan.text.cx_rum)),
4204
+ attributes: __assign(__assign(__assign({}, flattenAttributes(attributes)), this.resolveLabels(cxSpan.text.cx_rum)), { sessionId: sessionId }),
4366
4205
  startTime: startTime,
4367
4206
  endTime: endTime,
4368
4207
  status: severity === CoralogixLogSeverity.Error
@@ -4521,7 +4360,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
4521
4360
  var allLabels = {};
4522
4361
  var cxRumEventClone = deepClone(cxRumEvent);
4523
4362
  try {
4524
- for (var labelProviders_1 = __values$1(labelProviders), labelProviders_1_1 = labelProviders_1.next(); !labelProviders_1_1.done; labelProviders_1_1 = labelProviders_1.next()) {
4363
+ for (var labelProviders_1 = __values(labelProviders), labelProviders_1_1 = labelProviders_1.next(); !labelProviders_1_1.done; labelProviders_1_1 = labelProviders_1.next()) {
4525
4364
  var labelProvider = labelProviders_1_1.value;
4526
4365
  allLabels = __assign(__assign({}, allLabels), labelProvider.providerFunc(url, cxRumEventClone));
4527
4366
  }
@@ -4538,7 +4377,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
4538
4377
  return CoralogixSpanMapProcessor;
4539
4378
  }());
4540
4379
 
4541
- var CoralogixSnapshotSpanProcessor = /** @class */ (function () {
4380
+ var CoralogixSnapshotSpanProcessor = (function () {
4542
4381
  function CoralogixSnapshotSpanProcessor() {
4543
4382
  this.isActive = true;
4544
4383
  }
@@ -4615,7 +4454,7 @@ var CoralogixSnapshotSpanProcessor = /** @class */ (function () {
4615
4454
  return CoralogixSnapshotSpanProcessor;
4616
4455
  }());
4617
4456
 
4618
- var SnapshotManager = /** @class */ (function () {
4457
+ var SnapshotManager = (function () {
4619
4458
  function SnapshotManager() {
4620
4459
  var _this = this;
4621
4460
  this.updateSnapshot = function (overrides) {
@@ -4656,7 +4495,7 @@ var SnapshotManager = /** @class */ (function () {
4656
4495
  return SnapshotManager;
4657
4496
  }());
4658
4497
 
4659
- var CoralogixNavigationProcessor = /** @class */ (function () {
4498
+ var CoralogixNavigationProcessor = (function () {
4660
4499
  function CoralogixNavigationProcessor() {
4661
4500
  }
4662
4501
  CoralogixNavigationProcessor.prototype.forceFlush = function () {
@@ -4719,17 +4558,14 @@ var CoralogixRum = {
4719
4558
  var _a, _b;
4720
4559
  var _this = this;
4721
4560
  try {
4722
- // Check if CoralogixRum already inited.
4723
4561
  if (isInited && (options === null || options === void 0 ? void 0 : options.debug)) {
4724
4562
  console.debug('CoralogixRum already initialized, skipping init');
4725
4563
  return;
4726
4564
  }
4727
- // Abort if not in browser environment.
4728
4565
  if (!CxGlobal.sessionStorage) {
4729
4566
  console.warn('CoralogixRum: Non-browser environment detected, aborting');
4730
4567
  return;
4731
4568
  }
4732
- // Abort if running in a not supported browser.
4733
4569
  if (typeof Symbol !== 'function') {
4734
4570
  console.warn('CoralogixRum: browser not supported, disabling instrumentation.');
4735
4571
  return;
@@ -4741,7 +4577,6 @@ var CoralogixRum = {
4741
4577
  CxGlobal[USER_AGENT_KEY] = parseUserAgent(navigator.userAgent);
4742
4578
  CxGlobal[SDK_CONFIG_KEY] = resolvedOptions_1;
4743
4579
  var sampler = getResolvedSampler(resolvedOptions_1);
4744
- // Check if not in debug mode & no auth token.
4745
4580
  if (!resolvedOptions_1.debug && !resolvedOptions_1.public_key) {
4746
4581
  console.warn('rumAuth will be required in the future');
4747
4582
  }
@@ -4752,7 +4587,6 @@ var CoralogixRum = {
4752
4587
  sampler: sampler,
4753
4588
  });
4754
4589
  var pluginDefaults_1 = {};
4755
- // Resolve instrumentations.
4756
4590
  var instrumentations = INSTRUMENTATIONS.map(function (_a) {
4757
4591
  var _b, _c;
4758
4592
  var Instrument = _a.Instrument, confKey = _a.confKey, disable = _a.disable;
@@ -4822,7 +4656,6 @@ var CoralogixRum = {
4822
4656
  return Boolean(instrument);
4823
4657
  });
4824
4658
  var mergedUserContext = __assign(__assign({}, OPTIONS_DEFAULTS.user_context), user_context);
4825
- // Init Span Attributes Processor.
4826
4659
  attributesProcessor = new CoralogixSpanAttributesProcessor(__assign((_a = {}, _a[CoralogixAttributes.APPLICATION_CONTEXT] = JSON.stringify({
4827
4660
  application: application,
4828
4661
  version: version,
@@ -4832,30 +4665,24 @@ var CoralogixRum = {
4832
4665
  attributesProcessor.setCustomLabels(labels);
4833
4666
  }
4834
4667
  setAttrProcessor(attributesProcessor);
4835
- // The order of processors is important.
4836
4668
  tracerProvider.addSpanProcessor(attributesProcessor);
4837
- // Add Navigation Processor
4838
4669
  navigationProcessor = new CoralogixNavigationProcessor();
4839
4670
  tracerProvider.addSpanProcessor(navigationProcessor);
4840
- // Add Span Mapping Processor
4841
4671
  spanMapProcessor = new CoralogixSpanMapProcessor();
4842
4672
  tracerProvider.addSpanProcessor(spanMapProcessor);
4843
- // Add snapshot processor
4844
4673
  new SnapshotManager();
4845
4674
  snapshotProcessor = new CoralogixSnapshotSpanProcessor();
4846
4675
  tracerProvider.addSpanProcessor(snapshotProcessor);
4847
- // Add Batch Span Processor and Exporter
4848
4676
  tracerProvider.addSpanProcessor(new BatchSpanProcessor((exporter = new CoralogixExporter()), {
4849
4677
  maxExportBatchSize: MAX_EXPORT_BATCH_SIZE,
4850
4678
  scheduledDelayMillis: SCHEDULE_DELAY_MILLIS,
4851
4679
  }));
4852
4680
  handlePropagators(options, tracerProvider);
4853
- // Register Instrumentations
4854
4681
  _deregisterInstrumentations = registerInstrumentations({
4855
4682
  tracerProvider: tracerProvider,
4856
4683
  instrumentations: instrumentations,
4857
4684
  });
4858
- var _c = __read$1(partition(resolvedOptions_1.labelProviders || [], function (_a) {
4685
+ var _c = __read(partition(resolvedOptions_1.labelProviders || [], function (_a) {
4859
4686
  var urlType = _a.urlType;
4860
4687
  return urlType === UrlType.PAGE || !urlType;
4861
4688
  }), 2), pageUrlLabelProviders = _c[0], networkUrlLabelProviders = _c[1];
@@ -4930,6 +4757,7 @@ var CoralogixRum = {
4930
4757
  },
4931
4758
  };
4932
4759
  setGlobalSpan(globalSpanModel);
4760
+ addGlobalSpanByTraceId(globalSpan.spanContext().traceId, globalSpanModel);
4933
4761
  return globalSpanModel;
4934
4762
  },
4935
4763
  };
@@ -4999,9 +4827,6 @@ var CoralogixRum = {
4999
4827
  getSessionRecorder().startRecording();
5000
4828
  return;
5001
4829
  }
5002
- /*
5003
- * The session recorder is initialized asynchronously via dynamic import.
5004
- * */
5005
4830
  var intervalId = setInterval(function () {
5006
4831
  if (getSessionRecorder()) {
5007
4832
  clearInterval(intervalId);
@@ -5088,7 +4913,7 @@ var CoralogixRum = {
5088
4913
  };
5089
4914
  CxGlobal.CoralogixRum = CoralogixRum;
5090
4915
 
5091
- var UrlBasedLabelProvider = /** @class */ (function () {
4916
+ var UrlBasedLabelProvider = (function () {
5092
4917
  function UrlBasedLabelProvider(config) {
5093
4918
  var urlPatterns = config.urlPatterns, defaultLabels = config.defaultLabels, urlType = config.urlType;
5094
4919
  var compiledRegexps = urlPatterns.map(function (_a) {
@@ -5100,8 +4925,8 @@ var UrlBasedLabelProvider = /** @class */ (function () {
5100
4925
  var e_1, _a;
5101
4926
  var providerLabels = {};
5102
4927
  try {
5103
- outerLoop: for (var _b = __values$1(compiledRegexps.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
5104
- var _d = __read$1(_c.value, 2), index = _d[0], compiledRegex = _d[1];
4928
+ outerLoop: for (var _b = __values(compiledRegexps.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
4929
+ var _d = __read(_c.value, 2), index = _d[0], compiledRegex = _d[1];
5105
4930
  var labels = urlPatterns[index].labels;
5106
4931
  if (compiledRegex.some(function (regexp) { return regexp.test(url); })) {
5107
4932
  providerLabels = __assign(__assign({}, providerLabels), labels);
@@ -5137,4 +4962,4 @@ var SessionRecordingEventType;
5137
4962
  SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
5138
4963
  })(SessionRecordingEventType || (SessionRecordingEventType = {}));
5139
4964
 
5140
- 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, MAX_MUTATIONS_FOR_SESSION_RECORDING 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 };
4965
+ 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, __awaiter as _, __generator as a, __assign as b, getNowTime as c, SESSION_RECORDING_NETWORK_ERR0R_MESSAGE as d, SESSION_RECORDING_DEFAULT_HEADERS as e, SESSION_RECORDING_POSTFIX_URL as f, getSdkConfig as g, SESSION_RECORDER_KEY as h, MAX_MUTATIONS_FOR_SESSION_RECORDING as i, SESSION_RECORDING_DEFAULT_ERROR_MESSAGE as j, CoralogixRum as k, CoralogixLogSeverity as l, SessionRecordingEventType as m, CoralogixEventType as n, UrlType as o, reportInternalEvent as r };