@coralogix/browser 2.8.4 → 2.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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
  };
@@ -323,18 +738,8 @@ var MAIN_TRACER_KEY = '@';
323
738
  var ATTR_PROCESSOR_KEY = 'attrProcessor';
324
739
  var SpanStatusCode;
325
740
  (function (SpanStatusCode) {
326
- /**
327
- * The default status.
328
- */
329
741
  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
742
  SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK";
335
- /**
336
- * The operation contains an error.
337
- */
338
743
  SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR";
339
744
  })(SpanStatusCode || (SpanStatusCode = {}));
340
745
 
@@ -390,7 +795,7 @@ function buildStacktrace(span, err) {
390
795
  case 0:
391
796
  stack = err.stack, message = err.message, name = err.name;
392
797
  hasStack = !!(stack === null || stack === void 0 ? void 0 : stack.includes('at '));
393
- if (!(err && hasStack)) return [3 /*break*/, 3];
798
+ if (!(err && hasStack)) return [3, 3];
394
799
  supportMfe = getSdkConfig().supportMfe;
395
800
  stackFrames = ErrorStackParser.parse({
396
801
  stack: stack.substring(0, STACK_LIMIT),
@@ -405,15 +810,15 @@ function buildStacktrace(span, err) {
405
810
  functionName: functionName,
406
811
  });
407
812
  });
408
- if (!supportMfe) return [3 /*break*/, 2];
409
- return [4 /*yield*/, handleMFE(stackFrames, span)];
813
+ if (!supportMfe) return [3, 2];
814
+ return [4, handleMFE(stackFrames, span)];
410
815
  case 1:
411
816
  _a.sent();
412
817
  _a.label = 2;
413
818
  case 2:
414
819
  span[ErrorAttributes.STACK] = stackFrames;
415
820
  _a.label = 3;
416
- case 3: return [2 /*return*/];
821
+ case 3: return [2];
417
822
  }
418
823
  });
419
824
  });
@@ -427,26 +832,25 @@ function handleMFE(stackFrames, span) {
427
832
  i = 0;
428
833
  _b.label = 1;
429
834
  case 1:
430
- if (!(i < stackFrames.length)) return [3 /*break*/, 4];
431
- return [4 /*yield*/, extractMetadataFromMfeStacktrace(stackFrames[i].fileName)];
835
+ if (!(i < stackFrames.length)) return [3, 4];
836
+ return [4, extractMetadataFromMfeStacktrace(stackFrames[i].fileName)];
432
837
  case 2:
433
838
  metadata = _b.sent();
434
839
  stackFrames[i] = __assign(__assign({}, stackFrames[i]), (metadata || { isShell: true }));
435
840
  _b.label = 3;
436
841
  case 3:
437
842
  i++;
438
- return [3 /*break*/, 1];
843
+ return [3, 1];
439
844
  case 4:
440
- _a = __read$1(stackFrames, 1), lastFrame = _a[0];
845
+ _a = __read(stackFrames, 1), lastFrame = _a[0];
441
846
  addLabelForMFE(span, lastFrame);
442
- return [2 /*return*/];
847
+ return [2];
443
848
  }
444
849
  });
445
850
  });
446
851
  }
447
852
  function addLabelForMFE(span, lastFrame) {
448
853
  var app = lastFrame.app, version = lastFrame.version, isShell = lastFrame.isShell;
449
- // Do not add label if its shell
450
854
  if (!isShell) {
451
855
  setCustomLabelsForSpan(span, { mfeApp: app, mfeVersion: version });
452
856
  }
@@ -460,37 +864,36 @@ function extractMetadataFromMfeStacktrace() {
460
864
  case 0:
461
865
  cachedMetadata = CxGlobal[CACHED_METADATA_KEY];
462
866
  MFE_METADATA_KEY = 'cx-metadata.json';
463
- _a = __read$1(fileName.match(/https?:\/\/.*\//), 1), mfePath = _a[0];
464
- if (!mfePath) return [3 /*break*/, 7];
867
+ _a = __read(fileName.match(/https?:\/\/.*\//), 1), mfePath = _a[0];
868
+ if (!mfePath) return [3, 7];
465
869
  response = void 0;
466
- if (!!(cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.has(mfePath))) return [3 /*break*/, 6];
870
+ if (!!(cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.has(mfePath))) return [3, 6];
467
871
  _c.label = 1;
468
872
  case 1:
469
873
  _c.trys.push([1, 4, , 5]);
470
- return [4 /*yield*/, fetch("".concat(mfePath).concat(MFE_METADATA_KEY), {
471
- //this is a browser cache control
874
+ return [4, fetch("".concat(mfePath).concat(MFE_METADATA_KEY), {
472
875
  cache: 'no-cache',
473
876
  })];
474
877
  case 2:
475
878
  response = _c.sent();
476
879
  _b = [{}];
477
- return [4 /*yield*/, response.json()];
880
+ return [4, response.json()];
478
881
  case 3:
479
882
  metadata = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_c.sent())])), { mfePath: mfePath }]);
480
- return [3 /*break*/, 5];
883
+ return [3, 5];
481
884
  case 4:
482
885
  e_1 = _c.sent();
483
886
  if (getSdkConfig().debug) {
484
887
  console.warn('Coralogix Browser SDK - Error fetching metadata', e_1);
485
888
  }
486
- return [3 /*break*/, 5];
889
+ return [3, 5];
487
890
  case 5:
488
891
  CxGlobal[CACHED_METADATA_KEY] = cachedMetadata.set(mfePath, metadata);
489
- return [3 /*break*/, 7];
892
+ return [3, 7];
490
893
  case 6:
491
894
  metadata = cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.get(mfePath);
492
895
  _c.label = 7;
493
- case 7: return [2 /*return*/, metadata];
896
+ case 7: return [2, metadata];
494
897
  }
495
898
  });
496
899
  });
@@ -526,7 +929,7 @@ function addErrorDefaultAttributes(span) {
526
929
  span.setAttribute(CoralogixAttributes.EVENT_TYPE, CoralogixEventType.ERROR);
527
930
  span.setAttribute(CoralogixAttributes.SEVERITY, CoralogixLogSeverity.Error);
528
931
  }
529
- var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
932
+ var CoralogixErrorInstrumentation = (function (_super) {
530
933
  __extends(CoralogixErrorInstrumentation, _super);
531
934
  function CoralogixErrorInstrumentation(config) {
532
935
  var _this = _super.call(this, ERROR_INSTRUMENTATION_NAME, ERROR_INSTRUMENTATION_VERSION, config) || this;
@@ -575,7 +978,6 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
575
978
  this.reportString(source, arg);
576
979
  break;
577
980
  case arg instanceof Array: {
578
- // if any arguments are Errors then add the stack trace even though the message is handled differently
579
981
  var firstError = arg.find(function (x) { return x instanceof Error; });
580
982
  var message = arg
581
983
  .map(function (msg) {
@@ -608,11 +1010,11 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
608
1010
  if (labels) {
609
1011
  setCustomLabelsForSpan(span, labels);
610
1012
  }
611
- return [4 /*yield*/, buildStacktrace(span, err)];
1013
+ return [4, buildStacktrace(span, err)];
612
1014
  case 1:
613
1015
  _a.sent();
614
1016
  span.end();
615
- return [2 /*return*/];
1017
+ return [2];
616
1018
  }
617
1019
  });
618
1020
  });
@@ -627,14 +1029,14 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
627
1029
  addErrorDefaultAttributes(span);
628
1030
  span.setAttribute(CoralogixAttributes.SOURCE, source);
629
1031
  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)];
1032
+ if (!firstError) return [3, 2];
1033
+ return [4, buildStacktrace(span, firstError)];
632
1034
  case 1:
633
1035
  _a.sent();
634
1036
  _a.label = 2;
635
1037
  case 2:
636
1038
  span.end();
637
- return [2 /*return*/];
1039
+ return [2];
638
1040
  }
639
1041
  });
640
1042
  });
@@ -673,7 +1075,6 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
673
1075
  if (message && typeof message === 'string') {
674
1076
  return message;
675
1077
  }
676
- // GrpcStatusEvent
677
1078
  if (statusMessage && typeof statusMessage === 'string') {
678
1079
  return statusMessage;
679
1080
  }
@@ -691,7 +1092,7 @@ var propagateTraceHeaderCorsUrls = function (config) {
691
1092
  }
692
1093
  };
693
1094
 
694
- var NetworkDataManager = /** @class */ (function () {
1095
+ var NetworkDataManager = (function () {
695
1096
  function NetworkDataManager() {
696
1097
  var _this = this;
697
1098
  this.responseBodyParsers = new Map([
@@ -699,68 +1100,68 @@ var NetworkDataManager = /** @class */ (function () {
699
1100
  switch (_c.label) {
700
1101
  case 0:
701
1102
  _b = (_a = JSON).stringify;
702
- return [4 /*yield*/, body.json()];
703
- case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];
1103
+ return [4, body.json()];
1104
+ case 1: return [2, _b.apply(_a, [_c.sent()])];
704
1105
  }
705
1106
  }); }); }],
706
1107
  [MimeType.TextPlain, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
707
1108
  switch (_a.label) {
708
- case 0: return [4 /*yield*/, body.text()];
709
- case 1: return [2 /*return*/, _a.sent()];
1109
+ case 0: return [4, body.text()];
1110
+ case 1: return [2, _a.sent()];
710
1111
  }
711
1112
  }); }); }],
712
1113
  [MimeType.TextHtml, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
713
1114
  switch (_a.label) {
714
- case 0: return [4 /*yield*/, body.text()];
715
- case 1: return [2 /*return*/, _a.sent()];
1115
+ case 0: return [4, body.text()];
1116
+ case 1: return [2, _a.sent()];
716
1117
  }
717
1118
  }); }); }],
718
1119
  [MimeType.TextCss, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
719
1120
  switch (_a.label) {
720
- case 0: return [4 /*yield*/, body.text()];
721
- case 1: return [2 /*return*/, _a.sent()];
1121
+ case 0: return [4, body.text()];
1122
+ case 1: return [2, _a.sent()];
722
1123
  }
723
1124
  }); }); }],
724
1125
  [MimeType.TextJavascript, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
725
1126
  switch (_a.label) {
726
- case 0: return [4 /*yield*/, body.text()];
727
- case 1: return [2 /*return*/, _a.sent()];
1127
+ case 0: return [4, body.text()];
1128
+ case 1: return [2, _a.sent()];
728
1129
  }
729
1130
  }); }); }],
730
1131
  [MimeType.Xml, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
731
1132
  switch (_a.label) {
732
- case 0: return [4 /*yield*/, body.text()];
733
- case 1: return [2 /*return*/, _a.sent()];
1133
+ case 0: return [4, body.text()];
1134
+ case 1: return [2, _a.sent()];
734
1135
  }
735
1136
  }); }); }],
736
1137
  [MimeType.FormData, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
737
1138
  switch (_a.label) {
738
- case 0: return [4 /*yield*/, body.text()];
739
- case 1: return [2 /*return*/, _a.sent()];
1139
+ case 0: return [4, body.text()];
1140
+ case 1: return [2, _a.sent()];
740
1141
  }
741
1142
  }); }); }],
742
1143
  ]);
743
1144
  this.requestBodySerializers = new Map([
744
1145
  [BodyType.String, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
745
- return [2 /*return*/, body];
1146
+ return [2, body];
746
1147
  }); }); }],
747
1148
  [BodyType.Blob, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
748
- return [2 /*return*/, body.text()];
1149
+ return [2, body.text()];
749
1150
  }); }); }],
750
1151
  [
751
1152
  BodyType.FormData,
752
1153
  function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
753
- return [2 /*return*/, this.serializeFormData(body)];
1154
+ return [2, this.serializeFormData(body)];
754
1155
  }); }); },
755
1156
  ],
756
1157
  [
757
1158
  BodyType.URLSearchParams,
758
1159
  function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
759
- return [2 /*return*/, body.toString()];
1160
+ return [2, body.toString()];
760
1161
  }); }); },
761
1162
  ],
762
1163
  [BodyType.JsonObject, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
763
- return [2 /*return*/, JSON.stringify(body)];
1164
+ return [2, JSON.stringify(body)];
764
1165
  }); }); }],
765
1166
  ]);
766
1167
  }
@@ -779,11 +1180,11 @@ var NetworkDataManager = /** @class */ (function () {
779
1180
  switch (_a.label) {
780
1181
  case 0:
781
1182
  if (!(request === null || request === void 0 ? void 0 : request.body))
782
- return [2 /*return*/, ''];
783
- return [4 /*yield*/, this.serializeRequestBody(request.body)];
1183
+ return [2, ''];
1184
+ return [4, this.serializeRequestBody(request.body)];
784
1185
  case 1:
785
1186
  bodyContent = _a.sent();
786
- return [2 /*return*/, this.truncateIfExceedsLimit(bodyContent)];
1187
+ return [2, this.truncateIfExceedsLimit(bodyContent)];
787
1188
  }
788
1189
  });
789
1190
  });
@@ -798,11 +1199,11 @@ var NetworkDataManager = /** @class */ (function () {
798
1199
  mimeType = contentType.split(';')[0].trim();
799
1200
  parser = this.responseBodyParsers.get(mimeType);
800
1201
  if (!parser)
801
- return [2 /*return*/, ''];
802
- return [4 /*yield*/, parser(response)];
1202
+ return [2, ''];
1203
+ return [4, parser(response)];
803
1204
  case 1:
804
1205
  parsedContent = _a.sent();
805
- return [2 /*return*/, this.truncateIfExceedsLimit(parsedContent)];
1206
+ return [2, this.truncateIfExceedsLimit(parsedContent)];
806
1207
  }
807
1208
  });
808
1209
  });
@@ -817,15 +1218,15 @@ var NetworkDataManager = /** @class */ (function () {
817
1218
  switch (_b.label) {
818
1219
  case 0:
819
1220
  handler = this.requestBodySerializers.get(body.constructor.name);
820
- if (!handler) return [3 /*break*/, 2];
821
- return [4 /*yield*/, handler(body)];
1221
+ if (!handler) return [3, 2];
1222
+ return [4, handler(body)];
822
1223
  case 1:
823
1224
  _a = _b.sent();
824
- return [3 /*break*/, 3];
1225
+ return [3, 3];
825
1226
  case 2:
826
1227
  _a = '';
827
1228
  _b.label = 3;
828
- case 3: return [2 /*return*/, _a];
1229
+ case 3: return [2, _a];
829
1230
  }
830
1231
  });
831
1232
  });
@@ -859,7 +1260,7 @@ var BodyType;
859
1260
  BodyType["Unknown"] = "Unknown";
860
1261
  })(BodyType || (BodyType = {}));
861
1262
 
862
- var HeadersManager = /** @class */ (function () {
1263
+ var HeadersManager = (function () {
863
1264
  function HeadersManager() {
864
1265
  }
865
1266
  HeadersManager.prototype.filterHeaders = function (headersInit, allowedKeys) {
@@ -895,7 +1296,7 @@ var HeadersManager = /** @class */ (function () {
895
1296
  }
896
1297
  var lines = headersString.trim().split(/\r\n/);
897
1298
  lines.forEach(function (line) {
898
- var _a = __read$1(line.split(': ', 2), 2), key = _a[0], value = _a[1];
1299
+ var _a = __read(line.split(': ', 2), 2), key = _a[0], value = _a[1];
899
1300
  if (key && value) {
900
1301
  headerMap.set(key.trim().toLowerCase(), value.trim());
901
1302
  }
@@ -925,7 +1326,7 @@ var FetchSource;
925
1326
  (function (FetchSource) {
926
1327
  FetchSource["FETCH"] = "fetch";
927
1328
  })(FetchSource || (FetchSource = {}));
928
- var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
1329
+ var CoralogixFetchInstrumentation = (function (_super) {
929
1330
  __extends(CoralogixFetchInstrumentation, _super);
930
1331
  function CoralogixFetchInstrumentation(config) {
931
1332
  var _this = this;
@@ -952,11 +1353,11 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
952
1353
  url = span.attributes['http.url'] ||
953
1354
  '';
954
1355
  resolvedConfig = this.networkDataManager.resolveConfigForUrl(url, networkExtraConfig);
955
- if (!resolvedConfig) return [3 /*break*/, 3];
956
- return [4 /*yield*/, this.setRequestAttributes(span, request, resolvedConfig)];
1356
+ if (!resolvedConfig) return [3, 3];
1357
+ return [4, this.setRequestAttributes(span, request, resolvedConfig)];
957
1358
  case 1:
958
1359
  _b.sent();
959
- return [4 /*yield*/, this.setResponseAttributes(span, response, resolvedConfig)];
1360
+ return [4, this.setResponseAttributes(span, response, resolvedConfig)];
960
1361
  case 2:
961
1362
  _b.sent();
962
1363
  _b.label = 3;
@@ -968,7 +1369,7 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
968
1369
  _a[CoralogixAttributes.EVENT_TYPE] = CoralogixEventType.NETWORK_REQUEST,
969
1370
  _a[CoralogixAttributes.SOURCE] = FetchSource.FETCH,
970
1371
  _a));
971
- return [2 /*return*/];
1372
+ return [2];
972
1373
  }
973
1374
  });
974
1375
  });
@@ -983,11 +1384,11 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
983
1384
  _b.label = 1;
984
1385
  case 1:
985
1386
  _b.trys.push([1, 5, , 6]);
986
- if (!collectReqPayload) return [3 /*break*/, 3];
987
- return [4 /*yield*/, this.networkDataManager.stringifyRequestBody(request)];
1387
+ if (!collectReqPayload) return [3, 3];
1388
+ return [4, this.networkDataManager.stringifyRequestBody(request)];
988
1389
  case 2:
989
1390
  _a = _b.sent();
990
- return [3 /*break*/, 4];
1391
+ return [3, 4];
991
1392
  case 3:
992
1393
  _a = undefined;
993
1394
  _b.label = 4;
@@ -1002,14 +1403,14 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
1002
1403
  span[NetworkInstrumentationAttributes.REQUEST_HEADERS] =
1003
1404
  Object.fromEntries(sanitizedHeaders);
1004
1405
  }
1005
- return [3 /*break*/, 6];
1406
+ return [3, 6];
1006
1407
  case 5:
1007
1408
  error_1 = _b.sent();
1008
1409
  if (getSdkConfig().debug) {
1009
1410
  console.debug('Error setting request attributes on span:', error_1);
1010
1411
  }
1011
- return [3 /*break*/, 6];
1012
- case 6: return [2 /*return*/];
1412
+ return [3, 6];
1413
+ case 6: return [2];
1013
1414
  }
1014
1415
  });
1015
1416
  });
@@ -1021,15 +1422,15 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
1021
1422
  switch (_b.label) {
1022
1423
  case 0:
1023
1424
  resHeaders = networkExtraConfig.resHeaders, collectResPayload = networkExtraConfig.collectResPayload;
1024
- if (!(result instanceof Response)) return [3 /*break*/, 6];
1425
+ if (!(result instanceof Response)) return [3, 6];
1025
1426
  _b.label = 1;
1026
1427
  case 1:
1027
1428
  _b.trys.push([1, 5, , 6]);
1028
- if (!collectResPayload) return [3 /*break*/, 3];
1029
- return [4 /*yield*/, this.networkDataManager.stringifyResponseBody(result)];
1429
+ if (!collectResPayload) return [3, 3];
1430
+ return [4, this.networkDataManager.stringifyResponseBody(result)];
1030
1431
  case 2:
1031
1432
  _a = _b.sent();
1032
- return [3 /*break*/, 4];
1433
+ return [3, 4];
1033
1434
  case 3:
1034
1435
  _a = undefined;
1035
1436
  _b.label = 4;
@@ -1046,14 +1447,14 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
1046
1447
  span[NetworkInstrumentationAttributes.RESPONSE_HEADERS] =
1047
1448
  Object.fromEntries(sanitizedHeaders);
1048
1449
  }
1049
- return [3 /*break*/, 6];
1450
+ return [3, 6];
1050
1451
  case 5:
1051
1452
  error_2 = _b.sent();
1052
1453
  if (getSdkConfig().debug) {
1053
1454
  console.debug('Error setting request attributes on span:', error_2);
1054
1455
  }
1055
- return [3 /*break*/, 6];
1056
- case 6: return [2 /*return*/];
1456
+ return [3, 6];
1457
+ case 6: return [2];
1057
1458
  }
1058
1459
  });
1059
1460
  });
@@ -1065,7 +1466,7 @@ var XHRSource;
1065
1466
  (function (XHRSource) {
1066
1467
  XHRSource["XHR"] = "xhr";
1067
1468
  })(XHRSource || (XHRSource = {}));
1068
- var CoralogixXhrInstrumentation = /** @class */ (function (_super) {
1469
+ var CoralogixXhrInstrumentation = (function (_super) {
1069
1470
  __extends(CoralogixXhrInstrumentation, _super);
1070
1471
  function CoralogixXhrInstrumentation(config) {
1071
1472
  var _this = this;
@@ -1120,7 +1521,7 @@ var LogSource;
1120
1521
  (function (LogSource) {
1121
1522
  LogSource["CODE"] = "code";
1122
1523
  })(LogSource || (LogSource = {}));
1123
- var CoralogixCustomLogInstrumentation = /** @class */ (function (_super) {
1524
+ var CoralogixCustomLogInstrumentation = (function (_super) {
1124
1525
  __extends(CoralogixCustomLogInstrumentation, _super);
1125
1526
  function CoralogixCustomLogInstrumentation(config) {
1126
1527
  var _a;
@@ -1152,43 +1553,21 @@ var CoralogixCustomLogInstrumentation = /** @class */ (function (_super) {
1152
1553
  return CoralogixCustomLogInstrumentation;
1153
1554
  }(InstrumentationBase));
1154
1555
 
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
1556
  function isNil(value) {
1162
1557
  return value == null;
1163
1558
  }
1164
1559
 
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
1560
  function coerceArray(value) {
1175
1561
  if (isNil(value))
1176
1562
  return [];
1177
1563
  if (value instanceof Set)
1178
- return __spreadArray([], __read$1(value), false);
1564
+ return __spreadArray([], __read(value), false);
1179
1565
  return Array.isArray(value) ? value : [value];
1180
1566
  }
1181
1567
 
1182
1568
  function isObject(value) {
1183
1569
  return typeof value === 'object';
1184
1570
  }
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
1571
  function omit(object) {
1193
1572
  if (object === void 0) { object = {}; }
1194
1573
  var paths = [];
@@ -1199,7 +1578,7 @@ function omit(object) {
1199
1578
  return {};
1200
1579
  var omitter = function (source, pathArray) {
1201
1580
  var _a;
1202
- var _b = __read$1(pathArray), firstKey = _b[0], remainingKeys = _b.slice(1);
1581
+ var _b = __read(pathArray), firstKey = _b[0], remainingKeys = _b.slice(1);
1203
1582
  if (!source.hasOwnProperty(firstKey))
1204
1583
  return source;
1205
1584
  if (!remainingKeys.length) {
@@ -1208,15 +1587,8 @@ function omit(object) {
1208
1587
  }
1209
1588
  return __assign(__assign({}, source), (_a = {}, _a[firstKey] = omitter(source[firstKey], remainingKeys), _a));
1210
1589
  };
1211
- //@ts-ignore
1212
1590
  return coerceArray(paths).reduce(function (result, path) { return omitter(result, path.split('.')); }, object);
1213
1591
  }
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
1592
  function isEmpty(value) {
1221
1593
  if (isNil(value))
1222
1594
  return true;
@@ -1231,12 +1603,6 @@ function isEmpty(value) {
1231
1603
  }
1232
1604
  return false;
1233
1605
  }
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
1606
  function isNotEmpty(value) {
1241
1607
  return !isEmpty(value);
1242
1608
  }
@@ -1577,23 +1943,19 @@ function isPerformanceObserverSupported() {
1577
1943
  return true;
1578
1944
  }
1579
1945
 
1580
- var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
1946
+ var CoralogixWebVitalsInstrumentation = (function (_super) {
1581
1947
  __extends(CoralogixWebVitalsInstrumentation, _super);
1582
1948
  function CoralogixWebVitalsInstrumentation(config) {
1583
1949
  var _this = _super.call(this, WEB_VITALS_INSTRUMENTATION_NAME, WEB_VITALS_INSTRUMENTATION_VERSION, config) || this;
1584
1950
  _this.observers = [];
1585
1951
  _this.isSoftNavsEnabled = getSdkConfig().trackSoftNavigations;
1586
- // function that creates a span for each web vital and reports the data
1587
- // as attributes
1588
1952
  _this.onReport = function (metric) {
1589
1953
  if (!metric) {
1590
1954
  return;
1591
1955
  }
1592
- // calculate TBT when FCP is reported because TBT is calculated between FCP and TTI
1593
1956
  if (metric.name === 'FCP') {
1594
1957
  _this.registerToTBTMetric();
1595
1958
  }
1596
- // start the span
1597
1959
  var webVitalsSpan = _this.tracer.startSpan(CoralogixEventType.WEB_VITALS);
1598
1960
  var metricData = metric.entries ? omit(metric, 'entries') : metric;
1599
1961
  metricData = omit(metricData, 'attribution.navigationEntry');
@@ -1601,9 +1963,7 @@ var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
1601
1963
  metricData = omit(metricData, 'attribution');
1602
1964
  }
1603
1965
  webVitalsSpan.setAttribute(CoralogixAttributes.EVENT_TYPE, CoralogixEventType.WEB_VITALS);
1604
- // add core web vital attributes
1605
1966
  webVitalsSpan.setAttribute(WEB_VITALS_INSTRUMENTATION_NAME, JSON.stringify(metricData, getCircularReplacer()));
1606
- // end the span
1607
1967
  webVitalsSpan.end();
1608
1968
  };
1609
1969
  _this.metrics = isEmpty(config.metrics)
@@ -1622,27 +1982,21 @@ var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
1622
1982
  CoralogixWebVitalsInstrumentation.prototype.registerToCoreWebVitalMetrics = function () {
1623
1983
  var shouldReportSoftNavs = this.isSoftNavsEnabled &&
1624
1984
  supportedPerformanceTypes.has(PerformanceTypes.SoftNavigation);
1625
- // Capture First Input Delay
1626
1985
  if (this.metrics.fid) {
1627
1986
  onFID(this.onReport);
1628
1987
  }
1629
- // Capture Cumulative Layout Shift
1630
1988
  if (this.metrics.cls) {
1631
1989
  onCLS(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
1632
1990
  }
1633
- // Capture Largest Contentful Paint
1634
1991
  if (this.metrics.lcp) {
1635
1992
  onLCP(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
1636
1993
  }
1637
- // Capture First Contentful Paint
1638
1994
  if (this.metrics.fcp) {
1639
1995
  onFCP(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
1640
1996
  }
1641
- // Capture Interaction to Next Paint
1642
1997
  if (this.metrics.inp) {
1643
1998
  onINP(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
1644
1999
  }
1645
- // Capture Time to First Byte
1646
2000
  if (this.metrics.ttfb) {
1647
2001
  onTTFB(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
1648
2002
  }
@@ -1698,24 +2052,8 @@ var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
1698
2052
  var loadingPageObserver = new PerformanceObserver(function (list) {
1699
2053
  var loadTimeMetric;
1700
2054
  list.getEntries().forEach(function (entry) {
1701
- var _a = entry, duration = _a.duration, name = _a.name, type = _a.type, activationStart = _a.activationStart, domComplete = _a.domComplete, domContentLoadedEventEnd = _a.domContentLoadedEventEnd, domContentLoadedEventStart = _a.domContentLoadedEventStart, domInteractive = _a.domInteractive, loadEventEnd = _a.loadEventEnd, loadEventStart = _a.loadEventStart, redirectCount = _a.redirectCount, unloadEventStart = _a.unloadEventStart, unloadEventEnd = _a.unloadEventEnd;
1702
- loadTimeMetric = {
1703
- name: 'LT',
1704
- id: generateWebVitalUniqueID(),
1705
- value: duration,
1706
- url: name,
1707
- navigationType: type,
1708
- activationStart: activationStart,
1709
- domComplete: domComplete,
1710
- domContentLoadedEventEnd: domContentLoadedEventEnd,
1711
- domContentLoadedEventStart: domContentLoadedEventStart,
1712
- domInteractive: domInteractive,
1713
- loadEventEnd: loadEventEnd,
1714
- loadEventStart: loadEventStart,
1715
- redirectCount: redirectCount,
1716
- unloadEventStart: unloadEventStart,
1717
- unloadEventEnd: unloadEventEnd,
1718
- };
2055
+ var _a = entry, duration = _a.duration, name = _a.name, type = _a.type;
2056
+ loadTimeMetric = __assign(__assign({}, deepClone(entry)), { name: 'LT', id: generateWebVitalUniqueID(), value: duration, url: name, navigationType: type });
1719
2057
  if (duration) {
1720
2058
  _this.onReport(loadTimeMetric);
1721
2059
  }
@@ -1761,7 +2099,7 @@ var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
1761
2099
  return CoralogixWebVitalsInstrumentation;
1762
2100
  }(InstrumentationBase));
1763
2101
 
1764
- var CoralogixLongTaskInstrumentation = /** @class */ (function (_super) {
2102
+ var CoralogixLongTaskInstrumentation = (function (_super) {
1765
2103
  __extends(CoralogixLongTaskInstrumentation, _super);
1766
2104
  function CoralogixLongTaskInstrumentation(config) {
1767
2105
  var _this = _super.call(this, LONG_TASKS_INSTRUMENTATION_NAME, LONG_TASK_INSTRUMENTATION_VERSION, config) || this;
@@ -1844,7 +2182,7 @@ function isPatternMatch(str, arr, warnKey) {
1844
2182
  });
1845
2183
  }
1846
2184
 
1847
- var CoralogixResourcesInstrumentation = /** @class */ (function (_super) {
2185
+ var CoralogixResourcesInstrumentation = (function (_super) {
1848
2186
  __extends(CoralogixResourcesInstrumentation, _super);
1849
2187
  function CoralogixResourcesInstrumentation(config) {
1850
2188
  var _a;
@@ -1942,9 +2280,6 @@ var CoralogixResourcesInstrumentation = /** @class */ (function (_super) {
1942
2280
  return CoralogixResourcesInstrumentation;
1943
2281
  }(InstrumentationBase));
1944
2282
 
1945
- /**
1946
- * Gets the original value for a DOM API that was potentially patched by Zone.js.
1947
- */
1948
2283
  function getZoneJsOriginalDom(target, name) {
1949
2284
  var browserWindow = getCxGlobal();
1950
2285
  var original;
@@ -1958,9 +2293,6 @@ function getZoneJsOriginalDom(target, name) {
1958
2293
  return original;
1959
2294
  }
1960
2295
 
1961
- /**
1962
- * Add event listeners to an event target object.
1963
- */
1964
2296
  function addEventListeners(eventTarget, eventNames, listener, _a) {
1965
2297
  var _b = _a === void 0 ? {} : _a, once = _b.once, capture = _b.capture, passive = _b.passive;
1966
2298
  var resolvedListener = once
@@ -2064,9 +2396,9 @@ var _a$3;
2064
2396
  var USER_INTERACTION_INSTRUMENTATION_NAME = 'interactions';
2065
2397
  var USER_INTERACTION_INSTRUMENTATION_VERSION = '1';
2066
2398
  var DEFAULT_INSTRUMENTED_EVENTS = (_a$3 = {},
2067
- _a$3["click" /* DOM_EVENT.CLICK */] = true,
2399
+ _a$3["click"] = true,
2068
2400
  _a$3);
2069
- var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
2401
+ var CoralogixUserInteractionInstrumentation = (function (_super) {
2070
2402
  __extends(CoralogixUserInteractionInstrumentation, _super);
2071
2403
  function CoralogixUserInteractionInstrumentation(config) {
2072
2404
  var _this = _super.call(this, USER_INTERACTION_INSTRUMENTATION_NAME, USER_INTERACTION_INSTRUMENTATION_VERSION, config) || this;
@@ -2102,7 +2434,7 @@ var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
2102
2434
  ],
2103
2435
  [CoralogixAttributes.TARGET_ELEMENT, nodeName],
2104
2436
  ].forEach(function (_a) {
2105
- var _b = __read$1(_a, 2), key = _b[0], value = _b[1];
2437
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
2106
2438
  span.setAttribute(key, value);
2107
2439
  });
2108
2440
  }
@@ -2111,11 +2443,11 @@ var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
2111
2443
  var eventsMap = __assign(__assign({}, DEFAULT_INSTRUMENTED_EVENTS), (_a = this._config) === null || _a === void 0 ? void 0 : _a['events']);
2112
2444
  var eventNames = Object.entries(eventsMap)
2113
2445
  .filter(function (_a) {
2114
- var _b = __read$1(_a, 2); _b[0]; var enabled = _b[1];
2446
+ var _b = __read(_a, 2); _b[0]; var enabled = _b[1];
2115
2447
  return enabled;
2116
2448
  })
2117
2449
  .map(function (_a) {
2118
- var _b = __read$1(_a, 1), eventName = _b[0];
2450
+ var _b = __read(_a, 1), eventName = _b[0];
2119
2451
  return eventName;
2120
2452
  });
2121
2453
  this.stop = addEventListeners(document, eventNames, this.handler, {
@@ -2132,7 +2464,7 @@ var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
2132
2464
 
2133
2465
  var MEMORY_USAGE_INSTRUMENTATION_NAME = 'memory_usage';
2134
2466
  var MEMORY_USAGE_INSTRUMENTATION_VERSION = '1.0.0';
2135
- var MEMORY_USAGE_DEFAULT_INTERVAL = 300000; // 5 minutes;
2467
+ var MEMORY_USAGE_DEFAULT_INTERVAL = 300000;
2136
2468
 
2137
2469
  function isMeasureUserAgentSpecificMemoryAllowed() {
2138
2470
  if (!CxGlobal.crossOriginIsolated) {
@@ -2155,7 +2487,7 @@ function mapMemoryUsageEntries(memoryUsage) {
2155
2487
  };
2156
2488
  var breakdownEntries = [];
2157
2489
  try {
2158
- for (var _b = __values$1(memoryUsage.breakdown), _c = _b.next(); !_c.done; _c = _b.next()) {
2490
+ for (var _b = __values(memoryUsage.breakdown), _c = _b.next(); !_c.done; _c = _b.next()) {
2159
2491
  var entry = _c.value;
2160
2492
  if (entry.bytes > 0) {
2161
2493
  breakdownEntries.push({
@@ -2174,10 +2506,10 @@ function mapMemoryUsageEntries(memoryUsage) {
2174
2506
  }
2175
2507
  finally { if (e_1) throw e_1.error; }
2176
2508
  }
2177
- return __spreadArray([parentEntry], __read$1(breakdownEntries), false);
2509
+ return __spreadArray([parentEntry], __read(breakdownEntries), false);
2178
2510
  }
2179
2511
 
2180
- var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
2512
+ var CoralogixMemoryUsageInstrumentation = (function (_super) {
2181
2513
  __extends(CoralogixMemoryUsageInstrumentation, _super);
2182
2514
  function CoralogixMemoryUsageInstrumentation(config) {
2183
2515
  var _this = _super.call(this, MEMORY_USAGE_INSTRUMENTATION_NAME, MEMORY_USAGE_INSTRUMENTATION_VERSION, config) || this;
@@ -2204,12 +2536,12 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
2204
2536
  switch (_b.label) {
2205
2537
  case 0:
2206
2538
  _b.trys.push([0, 2, , 3]);
2207
- return [4 /*yield*/, performance.measureUserAgentSpecificMemory()];
2539
+ return [4, performance.measureUserAgentSpecificMemory()];
2208
2540
  case 1:
2209
2541
  memoryUsage = _b.sent();
2210
2542
  memoryUsageEntries = mapMemoryUsageEntries(memoryUsage);
2211
2543
  try {
2212
- for (memoryUsageEntries_1 = __values$1(memoryUsageEntries), memoryUsageEntries_1_1 = memoryUsageEntries_1.next(); !memoryUsageEntries_1_1.done; memoryUsageEntries_1_1 = memoryUsageEntries_1.next()) {
2544
+ for (memoryUsageEntries_1 = __values(memoryUsageEntries), memoryUsageEntries_1_1 = memoryUsageEntries_1.next(); !memoryUsageEntries_1_1.done; memoryUsageEntries_1_1 = memoryUsageEntries_1.next()) {
2213
2545
  entry = memoryUsageEntries_1_1.value;
2214
2546
  memoryUsageSpan = this.tracer.startSpan(MEMORY_USAGE_INSTRUMENTATION_NAME);
2215
2547
  memoryUsageSpan[CoralogixAttributes.EVENT_TYPE] =
@@ -2225,13 +2557,13 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
2225
2557
  }
2226
2558
  finally { if (e_1) throw e_1.error; }
2227
2559
  }
2228
- return [3 /*break*/, 3];
2560
+ return [3, 3];
2229
2561
  case 2:
2230
2562
  error_1 = _b.sent();
2231
2563
  console.warn('Memory usage measurement failed', error_1);
2232
2564
  this.clearMeasurementsInterval();
2233
- return [3 /*break*/, 3];
2234
- case 3: return [2 /*return*/];
2565
+ return [3, 3];
2566
+ case 3: return [2];
2235
2567
  }
2236
2568
  });
2237
2569
  });
@@ -2244,11 +2576,11 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
2244
2576
  return __awaiter(this, void 0, void 0, function () {
2245
2577
  return __generator(this, function (_a) {
2246
2578
  switch (_a.label) {
2247
- case 0: return [4 /*yield*/, this.createMemorySample()];
2579
+ case 0: return [4, this.createMemorySample()];
2248
2580
  case 1:
2249
2581
  _a.sent();
2250
2582
  this.runMemoryMeasurements();
2251
- return [2 /*return*/];
2583
+ return [2];
2252
2584
  }
2253
2585
  });
2254
2586
  });
@@ -2264,7 +2596,7 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
2264
2596
  var SCREENSHOT_INSTRUMENTATION_NAME = 'screenshot';
2265
2597
  var SCREENSHOT_INSTRUMENTATION_VERSION = '1.0.0';
2266
2598
 
2267
- var CoralogixScreenshotInstrumentation = /** @class */ (function (_super) {
2599
+ var CoralogixScreenshotInstrumentation = (function (_super) {
2268
2600
  __extends(CoralogixScreenshotInstrumentation, _super);
2269
2601
  function CoralogixScreenshotInstrumentation(config) {
2270
2602
  return _super.call(this, SCREENSHOT_INSTRUMENTATION_NAME, SCREENSHOT_INSTRUMENTATION_VERSION, config) || this;
@@ -2288,7 +2620,7 @@ var CoralogixScreenshotInstrumentation = /** @class */ (function (_super) {
2288
2620
  return CoralogixScreenshotInstrumentation;
2289
2621
  }(InstrumentationBase));
2290
2622
 
2291
- var TimeMeasurementTracker = /** @class */ (function () {
2623
+ var TimeMeasurementTracker = (function () {
2292
2624
  function TimeMeasurementTracker() {
2293
2625
  this.measurements = new Map();
2294
2626
  }
@@ -2326,7 +2658,7 @@ var TimeMeasurementTracker = /** @class */ (function () {
2326
2658
  return TimeMeasurementTracker;
2327
2659
  }());
2328
2660
 
2329
- var CoralogixCustomMeasurementInstrumentation = /** @class */ (function (_super) {
2661
+ var CoralogixCustomMeasurementInstrumentation = (function (_super) {
2330
2662
  __extends(CoralogixCustomMeasurementInstrumentation, _super);
2331
2663
  function CoralogixCustomMeasurementInstrumentation(config) {
2332
2664
  return _super.call(this, CUSTOM_MEASUREMENT_INSTRUMENTATION_NAME, CUSTOM_MEASUREMENT_INSTRUMENTATION_VERSION, config) || this;
@@ -2351,7 +2683,7 @@ var CoralogixCustomMeasurementInstrumentation = /** @class */ (function (_super)
2351
2683
  }(InstrumentationBase));
2352
2684
 
2353
2685
  var INTERNAL_INSTRUMENTATION_VERSION = '1';
2354
- var CoralogixInternalInstrumentation = /** @class */ (function (_super) {
2686
+ var CoralogixInternalInstrumentation = (function (_super) {
2355
2687
  __extends(CoralogixInternalInstrumentation, _super);
2356
2688
  function CoralogixInternalInstrumentation(config) {
2357
2689
  return _super.call(this, CoralogixEventType.INTERNAL, INTERNAL_INSTRUMENTATION_VERSION, config) || this;
@@ -2398,8 +2730,7 @@ var CoralogixInternalInstrumentation = /** @class */ (function (_super) {
2398
2730
  return CoralogixInternalInstrumentation;
2399
2731
  }(InstrumentationBase));
2400
2732
 
2401
- // In future we can make this class more generic and add more DOM events
2402
- var CoralogixDOMInstrumentation = /** @class */ (function (_super) {
2733
+ var CoralogixDOMInstrumentation = (function (_super) {
2403
2734
  __extends(CoralogixDOMInstrumentation, _super);
2404
2735
  function CoralogixDOMInstrumentation(config) {
2405
2736
  var _this = _super.call(this, DOM_INSTRUMENTATION_NAME, DOM_INSTRUMENTATION_VERSION, config) || this;
@@ -2444,7 +2775,7 @@ var WORKER_EVENTS = {
2444
2775
  MESSAGE_ERROR: 'messageerror',
2445
2776
  };
2446
2777
 
2447
- var CoralogixWorkerInstrumentation = /** @class */ (function (_super) {
2778
+ var CoralogixWorkerInstrumentation = (function (_super) {
2448
2779
  __extends(CoralogixWorkerInstrumentation, _super);
2449
2780
  function CoralogixWorkerInstrumentation(config, errorInstrumentation, coralogixRum) {
2450
2781
  var _this = _super.call(this, WORKER_INSTRUMENTATION, WORKER_INSTRUMENTATION_VERSION, config) || this;
@@ -2462,7 +2793,7 @@ var CoralogixWorkerInstrumentation = /** @class */ (function (_super) {
2462
2793
  };
2463
2794
  CoralogixWorkerInstrumentation.prototype.createCxWorker = function (OriginalWorker) {
2464
2795
  var self = this;
2465
- var CxWorker = /** @class */ (function (_super) {
2796
+ var CxWorker = (function (_super) {
2466
2797
  __extends(CxWorker, _super);
2467
2798
  function CxWorker(scriptURL, options) {
2468
2799
  var _this = _super.call(this, scriptURL, options) || this;
@@ -2555,10 +2886,6 @@ var OPTIONS_DEFAULTS = {
2555
2886
  urlBlueprinters: defaultUrlBlueprinters,
2556
2887
  collectIPData: true,
2557
2888
  };
2558
- /**
2559
- * Note: For any instrumentation added to CoralogixOtelWebOptionsInstrumentations,
2560
- * The `confKey` must match one of its keys.
2561
- */
2562
2889
  var INSTRUMENTATIONS = [
2563
2890
  {
2564
2891
  Instrument: CoralogixErrorInstrumentation,
@@ -2656,13 +2983,13 @@ var CoralogixAttributes = {
2656
2983
  SCREENSHOT_CONTEXT: 'screenshot_context',
2657
2984
  };
2658
2985
  var CoralogixDomainsApiUrlMap = {
2659
- EU1: 'https://ingress.eu1.rum-ingress-coralogix.com', // eu-west-1 (Ireland)
2660
- EU2: 'https://ingress.eu2.rum-ingress-coralogix.com', // eu-north-1 (Stockholm)
2661
- US1: 'https://ingress.us1.rum-ingress-coralogix.com', // us-east-2 (Ohio)
2662
- US2: 'https://ingress.us2.rum-ingress-coralogix.com', // us-west-2 (Oregon)
2663
- AP1: 'https://ingress.ap1.rum-ingress-coralogix.com', // ap-south-1 (Mumbai)
2664
- AP2: 'https://ingress.ap2.rum-ingress-coralogix.com', // ap-southeast-1 (Singapore)
2665
- AP3: 'https://ingress.ap3.rum-ingress-coralogix.com', // ap-southeast-3 (Jakarta)
2986
+ EU1: 'https://ingress.eu1.rum-ingress-coralogix.com',
2987
+ EU2: 'https://ingress.eu2.rum-ingress-coralogix.com',
2988
+ US1: 'https://ingress.us1.rum-ingress-coralogix.com',
2989
+ US2: 'https://ingress.us2.rum-ingress-coralogix.com',
2990
+ AP1: 'https://ingress.ap1.rum-ingress-coralogix.com',
2991
+ AP2: 'https://ingress.ap2.rum-ingress-coralogix.com',
2992
+ AP3: 'https://ingress.ap3.rum-ingress-coralogix.com',
2666
2993
  STAGING: 'https://ingress.staging.rum-ingress-coralogix.com',
2667
2994
  };
2668
2995
  var PROXY_CX_FORWARD_PARAMETER = 'cxforward';
@@ -2703,7 +3030,7 @@ function getInstrumentationConfig(value, defaults, defaultDisable) {
2703
3030
  return Object.assign({}, defaults, value);
2704
3031
  }
2705
3032
  var hrTimeToMilliseconds = function (_a) {
2706
- var _b = __read$1(_a, 2), seconds = _b[0], nanoseconds = _b[1];
3033
+ var _b = __read(_a, 2), seconds = _b[0], nanoseconds = _b[1];
2707
3034
  return seconds * 1000 + Math.round(nanoseconds / 1e6);
2708
3035
  };
2709
3036
  var isNetworkError = function (status) {
@@ -2772,8 +3099,8 @@ function parseUserAgent(userAgent) {
2772
3099
  var osVersion = 'Unknown';
2773
3100
  var device = 'Desktop';
2774
3101
  try {
2775
- for (var _g = __values$1(Object.entries(browsers)), _h = _g.next(); !_h.done; _h = _g.next()) {
2776
- var _j = __read$1(_h.value, 2), name_1 = _j[0], regex = _j[1];
3102
+ for (var _g = __values(Object.entries(browsers)), _h = _g.next(); !_h.done; _h = _g.next()) {
3103
+ var _j = __read(_h.value, 2), name_1 = _j[0], regex = _j[1];
2777
3104
  var match = userAgent.match(regex);
2778
3105
  if (match) {
2779
3106
  browser = name_1;
@@ -2790,8 +3117,8 @@ function parseUserAgent(userAgent) {
2790
3117
  finally { if (e_1) throw e_1.error; }
2791
3118
  }
2792
3119
  try {
2793
- for (var _k = __values$1(Object.entries(operatingSystems)), _l = _k.next(); !_l.done; _l = _k.next()) {
2794
- var _m = __read$1(_l.value, 2), name_2 = _m[0], regex = _m[1];
3120
+ for (var _k = __values(Object.entries(operatingSystems)), _l = _k.next(); !_l.done; _l = _k.next()) {
3121
+ var _m = __read(_l.value, 2), name_2 = _m[0], regex = _m[1];
2795
3122
  var match = userAgent.match(regex);
2796
3123
  if (match) {
2797
3124
  os = name_2;
@@ -2808,8 +3135,8 @@ function parseUserAgent(userAgent) {
2808
3135
  finally { if (e_2) throw e_2.error; }
2809
3136
  }
2810
3137
  try {
2811
- for (var _o = __values$1(Object.entries(devices)), _p = _o.next(); !_p.done; _p = _o.next()) {
2812
- var _q = __read$1(_p.value, 2), name_3 = _q[0], regex = _q[1];
3138
+ for (var _o = __values(Object.entries(devices)), _p = _o.next(); !_p.done; _p = _o.next()) {
3139
+ var _q = __read(_p.value, 2), name_3 = _q[0], regex = _q[1];
2813
3140
  var match = userAgent.match(regex);
2814
3141
  if (match) {
2815
3142
  device = name_3;
@@ -2835,8 +3162,7 @@ function calculateTotalBlockingTime(list) {
2835
3162
  function generateWebVitalUniqueID() {
2836
3163
  return "v3-".concat(getNowTime(), "-").concat(Math.floor(Math.random() * (9e12 - 1)) + 1e12);
2837
3164
  }
2838
- function rateForTBTMetricValue(value // ms
2839
- ) {
3165
+ function rateForTBTMetricValue(value) {
2840
3166
  switch (true) {
2841
3167
  case value > 600:
2842
3168
  return 'poor';
@@ -2851,8 +3177,8 @@ function flattenAttributes(attributes) {
2851
3177
  var customLabels = JSON.parse(attributes[CoralogixAttributes.CUSTOM_LABELS]);
2852
3178
  var flatAttributes = omit(attributes, CoralogixAttributes.CUSTOM_LABELS);
2853
3179
  try {
2854
- for (var _b = __values$1(Object.entries(customLabels)), _c = _b.next(); !_c.done; _c = _b.next()) {
2855
- var _d = __read$1(_c.value, 2), key = _d[0], value = _d[1];
3180
+ for (var _b = __values(Object.entries(customLabels)), _c = _b.next(); !_c.done; _c = _b.next()) {
3181
+ var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
2856
3182
  flatAttributes[key] =
2857
3183
  typeof value !== 'string' ? JSON.stringify(value) : value;
2858
3184
  }
@@ -2883,7 +3209,7 @@ function replacePatternsInUrl(_a) {
2883
3209
  var patterns = _a.patterns, url = _a.url;
2884
3210
  var modifiedUrl = url;
2885
3211
  try {
2886
- for (var patterns_1 = __values$1(patterns), patterns_1_1 = patterns_1.next(); !patterns_1_1.done; patterns_1_1 = patterns_1.next()) {
3212
+ for (var patterns_1 = __values(patterns), patterns_1_1 = patterns_1.next(); !patterns_1_1.done; patterns_1_1 = patterns_1.next()) {
2887
3213
  var _c = patterns_1_1.value, pattern = _c.pattern, replacement = _c.replacement;
2888
3214
  modifiedUrl = modifiedUrl.replace(pattern, replacement);
2889
3215
  }
@@ -2925,7 +3251,7 @@ function partition(array, predicate) {
2925
3251
  var truthyValues = [];
2926
3252
  var falsyValues = [];
2927
3253
  try {
2928
- for (var array_1 = __values$1(array), array_1_1 = array_1.next(); !array_1_1.done; array_1_1 = array_1.next()) {
3254
+ for (var array_1 = __values(array), array_1_1 = array_1.next(); !array_1_1.done; array_1_1 = array_1.next()) {
2929
3255
  var element = array_1_1.value;
2930
3256
  if (predicate(element)) {
2931
3257
  truthyValues.push(element);
@@ -2945,7 +3271,7 @@ function partition(array, predicate) {
2945
3271
  return [truthyValues, falsyValues];
2946
3272
  }
2947
3273
 
2948
- var CoralogixSpanAttributesProcessor = /** @class */ (function () {
3274
+ var CoralogixSpanAttributesProcessor = (function () {
2949
3275
  function CoralogixSpanAttributesProcessor(labels) {
2950
3276
  var _a;
2951
3277
  this.labels = (_a = {},
@@ -3001,528 +3327,6 @@ var CoralogixSpanAttributesProcessor = /** @class */ (function () {
3001
3327
  return CoralogixSpanAttributesProcessor;
3002
3328
  }());
3003
3329
 
3004
- /*
3005
- * Copyright The OpenTelemetry Authors
3006
- *
3007
- * Licensed under the Apache License, Version 2.0 (the "License");
3008
- * you may not use this file except in compliance with the License.
3009
- * You may obtain a copy of the License at
3010
- *
3011
- * https://www.apache.org/licenses/LICENSE-2.0
3012
- *
3013
- * Unless required by applicable law or agreed to in writing, software
3014
- * distributed under the License is distributed on an "AS IS" BASIS,
3015
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3016
- * See the License for the specific language governing permissions and
3017
- * limitations under the License.
3018
- */
3019
- var SUPPRESS_TRACING_KEY = createContextKey('OpenTelemetry SDK Context Key SUPPRESS_TRACING');
3020
- function isTracingSuppressed(context) {
3021
- return context.getValue(SUPPRESS_TRACING_KEY) === true;
3022
- }
3023
-
3024
- /*
3025
- * Copyright The OpenTelemetry Authors
3026
- *
3027
- * Licensed under the Apache License, Version 2.0 (the "License");
3028
- * you may not use this file except in compliance with the License.
3029
- * You may obtain a copy of the License at
3030
- *
3031
- * https://www.apache.org/licenses/LICENSE-2.0
3032
- *
3033
- * Unless required by applicable law or agreed to in writing, software
3034
- * distributed under the License is distributed on an "AS IS" BASIS,
3035
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3036
- * See the License for the specific language governing permissions and
3037
- * limitations under the License.
3038
- */
3039
- var BAGGAGE_KEY_PAIR_SEPARATOR = '=';
3040
- var BAGGAGE_PROPERTIES_SEPARATOR = ';';
3041
- var BAGGAGE_ITEMS_SEPARATOR = ',';
3042
- // Name of the http header used to propagate the baggage
3043
- var BAGGAGE_HEADER = 'baggage';
3044
- // Maximum number of name-value pairs allowed by w3c spec
3045
- var BAGGAGE_MAX_NAME_VALUE_PAIRS = 180;
3046
- // Maximum number of bytes per a single name-value pair allowed by w3c spec
3047
- var BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096;
3048
- // Maximum total length of all name-value pairs allowed by w3c spec
3049
- var BAGGAGE_MAX_TOTAL_LENGTH = 8192;
3050
-
3051
- var __read = undefined && undefined.__read || function (o, n) {
3052
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3053
- if (!m) return o;
3054
- var i = m.call(o),
3055
- r,
3056
- ar = [],
3057
- e;
3058
- try {
3059
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
3060
- } catch (error) {
3061
- e = {
3062
- error: error
3063
- };
3064
- } finally {
3065
- try {
3066
- if (r && !r.done && (m = i["return"])) m.call(i);
3067
- } finally {
3068
- if (e) throw e.error;
3069
- }
3070
- }
3071
- return ar;
3072
- };
3073
- function serializeKeyPairs(keyPairs) {
3074
- return keyPairs.reduce(function (hValue, current) {
3075
- var value = "" + hValue + (hValue !== '' ? BAGGAGE_ITEMS_SEPARATOR : '') + current;
3076
- return value.length > BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value;
3077
- }, '');
3078
- }
3079
- function getKeyPairs(baggage) {
3080
- return baggage.getAllEntries().map(function (_a) {
3081
- var _b = __read(_a, 2),
3082
- key = _b[0],
3083
- value = _b[1];
3084
- var entry = encodeURIComponent(key) + "=" + encodeURIComponent(value.value);
3085
- // include opaque metadata if provided
3086
- // NOTE: we intentionally don't URI-encode the metadata - that responsibility falls on the metadata implementation
3087
- if (value.metadata !== undefined) {
3088
- entry += BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString();
3089
- }
3090
- return entry;
3091
- });
3092
- }
3093
- function parsePairKeyValue(entry) {
3094
- var valueProps = entry.split(BAGGAGE_PROPERTIES_SEPARATOR);
3095
- if (valueProps.length <= 0) return;
3096
- var keyPairPart = valueProps.shift();
3097
- if (!keyPairPart) return;
3098
- var separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);
3099
- if (separatorIndex <= 0) return;
3100
- var key = decodeURIComponent(keyPairPart.substring(0, separatorIndex).trim());
3101
- var value = decodeURIComponent(keyPairPart.substring(separatorIndex + 1).trim());
3102
- var metadata;
3103
- if (valueProps.length > 0) {
3104
- metadata = baggageEntryMetadataFromString(valueProps.join(BAGGAGE_PROPERTIES_SEPARATOR));
3105
- }
3106
- return {
3107
- key: key,
3108
- value: value,
3109
- metadata: metadata
3110
- };
3111
- }
3112
-
3113
- /*
3114
- * Copyright The OpenTelemetry Authors
3115
- *
3116
- * Licensed under the Apache License, Version 2.0 (the "License");
3117
- * you may not use this file except in compliance with the License.
3118
- * You may obtain a copy of the License at
3119
- *
3120
- * https://www.apache.org/licenses/LICENSE-2.0
3121
- *
3122
- * Unless required by applicable law or agreed to in writing, software
3123
- * distributed under the License is distributed on an "AS IS" BASIS,
3124
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3125
- * See the License for the specific language governing permissions and
3126
- * limitations under the License.
3127
- */
3128
- /**
3129
- * Propagates {@link Baggage} through Context format propagation.
3130
- *
3131
- * Based on the Baggage specification:
3132
- * https://w3c.github.io/baggage/
3133
- */
3134
- var W3CBaggagePropagator = /** @class */function () {
3135
- function W3CBaggagePropagator() {}
3136
- W3CBaggagePropagator.prototype.inject = function (context, carrier, setter) {
3137
- var baggage = propagation.getBaggage(context);
3138
- if (!baggage || isTracingSuppressed(context)) return;
3139
- var keyPairs = getKeyPairs(baggage).filter(function (pair) {
3140
- return pair.length <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS;
3141
- }).slice(0, BAGGAGE_MAX_NAME_VALUE_PAIRS);
3142
- var headerValue = serializeKeyPairs(keyPairs);
3143
- if (headerValue.length > 0) {
3144
- setter.set(carrier, BAGGAGE_HEADER, headerValue);
3145
- }
3146
- };
3147
- W3CBaggagePropagator.prototype.extract = function (context, carrier, getter) {
3148
- var headerValue = getter.get(carrier, BAGGAGE_HEADER);
3149
- var baggageString = Array.isArray(headerValue) ? headerValue.join(BAGGAGE_ITEMS_SEPARATOR) : headerValue;
3150
- if (!baggageString) return context;
3151
- var baggage = {};
3152
- if (baggageString.length === 0) {
3153
- return context;
3154
- }
3155
- var pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);
3156
- pairs.forEach(function (entry) {
3157
- var keyPair = parsePairKeyValue(entry);
3158
- if (keyPair) {
3159
- var baggageEntry = {
3160
- value: keyPair.value
3161
- };
3162
- if (keyPair.metadata) {
3163
- baggageEntry.metadata = keyPair.metadata;
3164
- }
3165
- baggage[keyPair.key] = baggageEntry;
3166
- }
3167
- });
3168
- if (Object.entries(baggage).length === 0) {
3169
- return context;
3170
- }
3171
- return propagation.setBaggage(context, propagation.createBaggage(baggage));
3172
- };
3173
- W3CBaggagePropagator.prototype.fields = function () {
3174
- return [BAGGAGE_HEADER];
3175
- };
3176
- return W3CBaggagePropagator;
3177
- }();
3178
-
3179
- /*
3180
- * Copyright The OpenTelemetry Authors
3181
- *
3182
- * Licensed under the Apache License, Version 2.0 (the "License");
3183
- * you may not use this file except in compliance with the License.
3184
- * You may obtain a copy of the License at
3185
- *
3186
- * https://www.apache.org/licenses/LICENSE-2.0
3187
- *
3188
- * Unless required by applicable law or agreed to in writing, software
3189
- * distributed under the License is distributed on an "AS IS" BASIS,
3190
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3191
- * See the License for the specific language governing permissions and
3192
- * limitations under the License.
3193
- */
3194
- var ExportResultCode;
3195
- (function (ExportResultCode) {
3196
- ExportResultCode[ExportResultCode["SUCCESS"] = 0] = "SUCCESS";
3197
- ExportResultCode[ExportResultCode["FAILED"] = 1] = "FAILED";
3198
- })(ExportResultCode || (ExportResultCode = {}));
3199
-
3200
- /*
3201
- * Copyright The OpenTelemetry Authors
3202
- *
3203
- * Licensed under the Apache License, Version 2.0 (the "License");
3204
- * you may not use this file except in compliance with the License.
3205
- * You may obtain a copy of the License at
3206
- *
3207
- * https://www.apache.org/licenses/LICENSE-2.0
3208
- *
3209
- * Unless required by applicable law or agreed to in writing, software
3210
- * distributed under the License is distributed on an "AS IS" BASIS,
3211
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3212
- * See the License for the specific language governing permissions and
3213
- * limitations under the License.
3214
- */
3215
- var __values = undefined && undefined.__values || function (o) {
3216
- var s = typeof Symbol === "function" && Symbol.iterator,
3217
- m = s && o[s],
3218
- i = 0;
3219
- if (m) return m.call(o);
3220
- if (o && typeof o.length === "number") return {
3221
- next: function next() {
3222
- if (o && i >= o.length) o = void 0;
3223
- return {
3224
- value: o && o[i++],
3225
- done: !o
3226
- };
3227
- }
3228
- };
3229
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
3230
- };
3231
- /** Combines multiple propagators into a single propagator. */
3232
- var CompositePropagator = /** @class */function () {
3233
- /**
3234
- * Construct a composite propagator from a list of propagators.
3235
- *
3236
- * @param [config] Configuration object for composite propagator
3237
- */
3238
- function CompositePropagator(config) {
3239
- if (config === void 0) {
3240
- config = {};
3241
- }
3242
- var _a;
3243
- this._propagators = (_a = config.propagators) !== null && _a !== void 0 ? _a : [];
3244
- this._fields = Array.from(new Set(this._propagators
3245
- // older propagators may not have fields function, null check to be sure
3246
- .map(function (p) {
3247
- return typeof p.fields === 'function' ? p.fields() : [];
3248
- }).reduce(function (x, y) {
3249
- return x.concat(y);
3250
- }, [])));
3251
- }
3252
- /**
3253
- * Run each of the configured propagators with the given context and carrier.
3254
- * Propagators are run in the order they are configured, so if multiple
3255
- * propagators write the same carrier key, the propagator later in the list
3256
- * will "win".
3257
- *
3258
- * @param context Context to inject
3259
- * @param carrier Carrier into which context will be injected
3260
- */
3261
- CompositePropagator.prototype.inject = function (context, carrier, setter) {
3262
- var e_1, _a;
3263
- try {
3264
- for (var _b = __values(this._propagators), _c = _b.next(); !_c.done; _c = _b.next()) {
3265
- var propagator = _c.value;
3266
- try {
3267
- propagator.inject(context, carrier, setter);
3268
- } catch (err) {
3269
- diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
3270
- }
3271
- }
3272
- } catch (e_1_1) {
3273
- e_1 = {
3274
- error: e_1_1
3275
- };
3276
- } finally {
3277
- try {
3278
- if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
3279
- } finally {
3280
- if (e_1) throw e_1.error;
3281
- }
3282
- }
3283
- };
3284
- /**
3285
- * Run each of the configured propagators with the given context and carrier.
3286
- * Propagators are run in the order they are configured, so if multiple
3287
- * propagators write the same context key, the propagator later in the list
3288
- * will "win".
3289
- *
3290
- * @param context Context to add values to
3291
- * @param carrier Carrier from which to extract context
3292
- */
3293
- CompositePropagator.prototype.extract = function (context, carrier, getter) {
3294
- return this._propagators.reduce(function (ctx, propagator) {
3295
- try {
3296
- return propagator.extract(ctx, carrier, getter);
3297
- } catch (err) {
3298
- diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
3299
- }
3300
- return ctx;
3301
- }, context);
3302
- };
3303
- CompositePropagator.prototype.fields = function () {
3304
- // return a new array so our fields cannot be modified
3305
- return this._fields.slice();
3306
- };
3307
- return CompositePropagator;
3308
- }();
3309
-
3310
- /*
3311
- * Copyright The OpenTelemetry Authors
3312
- *
3313
- * Licensed under the Apache License, Version 2.0 (the "License");
3314
- * you may not use this file except in compliance with the License.
3315
- * You may obtain a copy of the License at
3316
- *
3317
- * https://www.apache.org/licenses/LICENSE-2.0
3318
- *
3319
- * Unless required by applicable law or agreed to in writing, software
3320
- * distributed under the License is distributed on an "AS IS" BASIS,
3321
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3322
- * See the License for the specific language governing permissions and
3323
- * limitations under the License.
3324
- */
3325
- var VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';
3326
- var VALID_KEY = "[a-z]" + VALID_KEY_CHAR_RANGE + "{0,255}";
3327
- var VALID_VENDOR_KEY = "[a-z0-9]" + VALID_KEY_CHAR_RANGE + "{0,240}@[a-z]" + VALID_KEY_CHAR_RANGE + "{0,13}";
3328
- var VALID_KEY_REGEX = new RegExp("^(?:" + VALID_KEY + "|" + VALID_VENDOR_KEY + ")$");
3329
- var VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;
3330
- var INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;
3331
- /**
3332
- * Key is opaque string up to 256 characters printable. It MUST begin with a
3333
- * lowercase letter, and can only contain lowercase letters a-z, digits 0-9,
3334
- * underscores _, dashes -, asterisks *, and forward slashes /.
3335
- * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the
3336
- * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.
3337
- * see https://www.w3.org/TR/trace-context/#key
3338
- */
3339
- function validateKey(key) {
3340
- return VALID_KEY_REGEX.test(key);
3341
- }
3342
- /**
3343
- * Value is opaque string up to 256 characters printable ASCII RFC0020
3344
- * characters (i.e., the range 0x20 to 0x7E) except comma , and =.
3345
- */
3346
- function validateValue(value) {
3347
- return VALID_VALUE_BASE_REGEX.test(value) && !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value);
3348
- }
3349
-
3350
- /*
3351
- * Copyright The OpenTelemetry Authors
3352
- *
3353
- * Licensed under the Apache License, Version 2.0 (the "License");
3354
- * you may not use this file except in compliance with the License.
3355
- * You may obtain a copy of the License at
3356
- *
3357
- * https://www.apache.org/licenses/LICENSE-2.0
3358
- *
3359
- * Unless required by applicable law or agreed to in writing, software
3360
- * distributed under the License is distributed on an "AS IS" BASIS,
3361
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3362
- * See the License for the specific language governing permissions and
3363
- * limitations under the License.
3364
- */
3365
- var MAX_TRACE_STATE_ITEMS = 32;
3366
- var MAX_TRACE_STATE_LEN = 512;
3367
- var LIST_MEMBERS_SEPARATOR = ',';
3368
- var LIST_MEMBER_KEY_VALUE_SPLITTER = '=';
3369
- /**
3370
- * TraceState must be a class and not a simple object type because of the spec
3371
- * requirement (https://www.w3.org/TR/trace-context/#tracestate-field).
3372
- *
3373
- * Here is the list of allowed mutations:
3374
- * - New key-value pair should be added into the beginning of the list
3375
- * - The value of any key can be updated. Modified keys MUST be moved to the
3376
- * beginning of the list.
3377
- */
3378
- var TraceState = /** @class */function () {
3379
- function TraceState(rawTraceState) {
3380
- this._internalState = new Map();
3381
- if (rawTraceState) this._parse(rawTraceState);
3382
- }
3383
- TraceState.prototype.set = function (key, value) {
3384
- // TODO: Benchmark the different approaches(map vs list) and
3385
- // use the faster one.
3386
- var traceState = this._clone();
3387
- if (traceState._internalState.has(key)) {
3388
- traceState._internalState["delete"](key);
3389
- }
3390
- traceState._internalState.set(key, value);
3391
- return traceState;
3392
- };
3393
- TraceState.prototype.unset = function (key) {
3394
- var traceState = this._clone();
3395
- traceState._internalState["delete"](key);
3396
- return traceState;
3397
- };
3398
- TraceState.prototype.get = function (key) {
3399
- return this._internalState.get(key);
3400
- };
3401
- TraceState.prototype.serialize = function () {
3402
- var _this = this;
3403
- return this._keys().reduce(function (agg, key) {
3404
- agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + _this.get(key));
3405
- return agg;
3406
- }, []).join(LIST_MEMBERS_SEPARATOR);
3407
- };
3408
- TraceState.prototype._parse = function (rawTraceState) {
3409
- if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;
3410
- this._internalState = rawTraceState.split(LIST_MEMBERS_SEPARATOR).reverse() // Store in reverse so new keys (.set(...)) will be placed at the beginning
3411
- .reduce(function (agg, part) {
3412
- var listMember = part.trim(); // Optional Whitespace (OWS) handling
3413
- var i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);
3414
- if (i !== -1) {
3415
- var key = listMember.slice(0, i);
3416
- var value = listMember.slice(i + 1, part.length);
3417
- if (validateKey(key) && validateValue(value)) {
3418
- agg.set(key, value);
3419
- }
3420
- }
3421
- return agg;
3422
- }, new Map());
3423
- // Because of the reverse() requirement, trunc must be done after map is created
3424
- if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {
3425
- this._internalState = new Map(Array.from(this._internalState.entries()).reverse() // Use reverse same as original tracestate parse chain
3426
- .slice(0, MAX_TRACE_STATE_ITEMS));
3427
- }
3428
- };
3429
- TraceState.prototype._keys = function () {
3430
- return Array.from(this._internalState.keys()).reverse();
3431
- };
3432
- TraceState.prototype._clone = function () {
3433
- var traceState = new TraceState();
3434
- traceState._internalState = new Map(this._internalState);
3435
- return traceState;
3436
- };
3437
- return TraceState;
3438
- }();
3439
-
3440
- /*
3441
- * Copyright The OpenTelemetry Authors
3442
- *
3443
- * Licensed under the Apache License, Version 2.0 (the "License");
3444
- * you may not use this file except in compliance with the License.
3445
- * You may obtain a copy of the License at
3446
- *
3447
- * https://www.apache.org/licenses/LICENSE-2.0
3448
- *
3449
- * Unless required by applicable law or agreed to in writing, software
3450
- * distributed under the License is distributed on an "AS IS" BASIS,
3451
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3452
- * See the License for the specific language governing permissions and
3453
- * limitations under the License.
3454
- */
3455
- var TRACE_PARENT_HEADER = 'traceparent';
3456
- var TRACE_STATE_HEADER = 'tracestate';
3457
- var VERSION = '00';
3458
- var VERSION_PART = '(?!ff)[\\da-f]{2}';
3459
- var TRACE_ID_PART = '(?![0]{32})[\\da-f]{32}';
3460
- var PARENT_ID_PART = '(?![0]{16})[\\da-f]{16}';
3461
- var FLAGS_PART = '[\\da-f]{2}';
3462
- var TRACE_PARENT_REGEX = new RegExp("^\\s?(" + VERSION_PART + ")-(" + TRACE_ID_PART + ")-(" + PARENT_ID_PART + ")-(" + FLAGS_PART + ")(-.*)?\\s?$");
3463
- /**
3464
- * Parses information from the [traceparent] span tag and converts it into {@link SpanContext}
3465
- * @param traceParent - A meta property that comes from server.
3466
- * It should be dynamically generated server side to have the server's request trace Id,
3467
- * a parent span Id that was set on the server's request span,
3468
- * and the trace flags to indicate the server's sampling decision
3469
- * (01 = sampled, 00 = not sampled).
3470
- * for example: '{version}-{traceId}-{spanId}-{sampleDecision}'
3471
- * For more information see {@link https://www.w3.org/TR/trace-context/}
3472
- */
3473
- function parseTraceParent(traceParent) {
3474
- var match = TRACE_PARENT_REGEX.exec(traceParent);
3475
- if (!match) return null;
3476
- // According to the specification the implementation should be compatible
3477
- // with future versions. If there are more parts, we only reject it if it's using version 00
3478
- // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent
3479
- if (match[1] === '00' && match[5]) return null;
3480
- return {
3481
- traceId: match[2],
3482
- spanId: match[3],
3483
- traceFlags: parseInt(match[4], 16)
3484
- };
3485
- }
3486
- /**
3487
- * Propagates {@link SpanContext} through Trace Context format propagation.
3488
- *
3489
- * Based on the Trace Context specification:
3490
- * https://www.w3.org/TR/trace-context/
3491
- */
3492
- var W3CTraceContextPropagator = /** @class */function () {
3493
- function W3CTraceContextPropagator() {}
3494
- W3CTraceContextPropagator.prototype.inject = function (context, carrier, setter) {
3495
- var spanContext = trace.getSpanContext(context);
3496
- if (!spanContext || isTracingSuppressed(context) || !isSpanContextValid(spanContext)) return;
3497
- var traceParent = VERSION + "-" + spanContext.traceId + "-" + spanContext.spanId + "-0" + Number(spanContext.traceFlags || TraceFlags.NONE).toString(16);
3498
- setter.set(carrier, TRACE_PARENT_HEADER, traceParent);
3499
- if (spanContext.traceState) {
3500
- setter.set(carrier, TRACE_STATE_HEADER, spanContext.traceState.serialize());
3501
- }
3502
- };
3503
- W3CTraceContextPropagator.prototype.extract = function (context, carrier, getter) {
3504
- var traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);
3505
- if (!traceParentHeader) return context;
3506
- var traceParent = Array.isArray(traceParentHeader) ? traceParentHeader[0] : traceParentHeader;
3507
- if (typeof traceParent !== 'string') return context;
3508
- var spanContext = parseTraceParent(traceParent);
3509
- if (!spanContext) return context;
3510
- spanContext.isRemote = true;
3511
- var traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);
3512
- if (traceStateHeader) {
3513
- // If more than one `tracestate` header is found, we merge them into a
3514
- // single header.
3515
- var state = Array.isArray(traceStateHeader) ? traceStateHeader.join(',') : traceStateHeader;
3516
- spanContext.traceState = new TraceState(typeof state === 'string' ? state : undefined);
3517
- }
3518
- return trace.setSpanContext(context, spanContext);
3519
- };
3520
- W3CTraceContextPropagator.prototype.fields = function () {
3521
- return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];
3522
- };
3523
- return W3CTraceContextPropagator;
3524
- }();
3525
-
3526
3330
  var _a$1;
3527
3331
  var MAX_RUM_EVENTS_PER_REQUEST = 500;
3528
3332
  var MAX_RUM_EVENTS = 20000;
@@ -3535,7 +3339,7 @@ var DEFAULT_MS_RECORD_TIME = 10000;
3535
3339
  _a$1),
3536
3340
  });
3537
3341
 
3538
- var Request = /** @class */ (function () {
3342
+ var Request = (function () {
3539
3343
  function Request(requestConfig) {
3540
3344
  this.requestConfig = requestConfig;
3541
3345
  this.resolvedUrl = '';
@@ -3566,12 +3370,12 @@ var Request = /** @class */ (function () {
3566
3370
  return Request;
3567
3371
  }());
3568
3372
 
3569
- var CxCustomSampler = /** @class */ (function () {
3373
+ var CxCustomSampler = (function () {
3570
3374
  function CxCustomSampler() {
3571
3375
  }
3572
3376
  CxCustomSampler.prototype.shouldSample = function () {
3573
3377
  return {
3574
- decision: SamplingDecision.RECORD, // RECORDED BUT SAMPLED = 00
3378
+ decision: SamplingDecision.RECORD,
3575
3379
  };
3576
3380
  };
3577
3381
  return CxCustomSampler;
@@ -3625,9 +3429,7 @@ var isSessionWithError = function () {
3625
3429
  function getResolvedSampler(resolvedOptions) {
3626
3430
  var sampler = new AlwaysOnSampler();
3627
3431
  var sessionSampleRate = resolvedOptions.sessionSampleRate, sessionConfig = resolvedOptions.sessionConfig, debug = resolvedOptions.debug, sessionRecordingConfig = resolvedOptions.sessionRecordingConfig;
3628
- var shouldNotTrackSession =
3629
- //todo: remove when sessionSampleRate is removed
3630
- !isSamplingOn(sessionSampleRate) ||
3432
+ var shouldNotTrackSession = !isSamplingOn(sessionSampleRate) ||
3631
3433
  !isSamplingOn(sessionConfig.sessionSampleRate);
3632
3434
  if (shouldNotTrackSession) {
3633
3435
  var shouldAlwaysTrackSessionsWithErrors = sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.alwaysTrackSessionsWithErrors;
@@ -3638,7 +3440,6 @@ function getResolvedSampler(resolvedOptions) {
3638
3440
  if (debug) {
3639
3441
  console.debug('CoralogixRum: Session tracking is disabled due to sampling rate');
3640
3442
  }
3641
- // session dropped due to sample, only network trace headers should run
3642
3443
  sampler = new CxCustomSampler();
3643
3444
  if (sessionRecordingConfig) {
3644
3445
  sessionRecordingConfig.enable = false;
@@ -3654,7 +3455,7 @@ function isProcessorShouldStop(isActive) {
3654
3455
  return !isActive || !!((_a = getSessionManager()) === null || _a === void 0 ? void 0 : _a.isIdleActive);
3655
3456
  }
3656
3457
 
3657
- var CoralogixExporter = /** @class */ (function () {
3458
+ var CoralogixExporter = (function () {
3658
3459
  function CoralogixExporter() {
3659
3460
  var _this = this;
3660
3461
  this.isActive = true;
@@ -3713,15 +3514,13 @@ var CoralogixExporter = /** @class */ (function () {
3713
3514
  return cxSpans;
3714
3515
  }, []);
3715
3516
  this.invokeLogRequest(instrumentationLogs);
3716
- var cachedLogs = (CxGlobal.cachedLogs = __spreadArray(__spreadArray([], __read$1((CxGlobal.cachedLogs || [])), false), __read$1(currentSpans), false));
3517
+ var cachedLogs = (CxGlobal.cachedLogs = __spreadArray(__spreadArray([], __read((CxGlobal.cachedLogs || [])), false), __read(currentSpans), false));
3717
3518
  var logsCounter = cachedLogs.length;
3718
- //check if we reached the limit of max rum events for session with error
3719
3519
  if (logsCounter > maxRumEventsForSessionWithError && !sessionHasError) {
3720
3520
  this.clearCachedDataForSessionWithError();
3721
3521
  }
3722
3522
  else if (sessionHasError) {
3723
3523
  if (logsCounter > MAX_RUM_EVENTS_PER_REQUEST) {
3724
- //split request to chunks of 500 logs per each
3725
3524
  var chunks = [];
3726
3525
  for (var i = 0; i < logsCounter; i += MAX_RUM_EVENTS_PER_REQUEST) {
3727
3526
  chunks.push(cachedLogs.slice(i, i + MAX_RUM_EVENTS_PER_REQUEST));
@@ -3749,7 +3548,7 @@ var CoralogixExporter = /** @class */ (function () {
3749
3548
  return CoralogixExporter;
3750
3549
  }());
3751
3550
 
3752
- var CoralogixWebTracerProvider = /** @class */ (function (_super) {
3551
+ var CoralogixWebTracerProvider = (function (_super) {
3753
3552
  __extends(CoralogixWebTracerProvider, _super);
3754
3553
  function CoralogixWebTracerProvider() {
3755
3554
  return _super !== null && _super.apply(this, arguments) || this;
@@ -3757,7 +3556,7 @@ var CoralogixWebTracerProvider = /** @class */ (function (_super) {
3757
3556
  return CoralogixWebTracerProvider;
3758
3557
  }(WebTracerProvider));
3759
3558
 
3760
- var SessionIdle = /** @class */ (function () {
3559
+ var SessionIdle = (function () {
3761
3560
  function SessionIdle(idleConfig) {
3762
3561
  var _this = this;
3763
3562
  this.idleConfig = idleConfig;
@@ -3798,7 +3597,7 @@ var SessionIdle = /** @class */ (function () {
3798
3597
  var _a, _b;
3799
3598
  (_b = (_a = this.stopCallbacks).removeActivityListeners) === null || _b === void 0 ? void 0 : _b.call(_a);
3800
3599
  if (typeof CxGlobal.addEventListener === 'function') {
3801
- 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;
3600
+ var stop_1 = addEventListeners(CxGlobal, ["touchstart", "keydown", "mousemove"], this.idlenessEventsHandler, { capture: true, passive: true }).stop;
3802
3601
  this.stopCallbacks.removeActivityListeners = stop_1;
3803
3602
  }
3804
3603
  };
@@ -3833,7 +3632,7 @@ function isInstrumentationCompatible(confKey) {
3833
3632
  return true;
3834
3633
  }
3835
3634
 
3836
- var SessionManager = /** @class */ (function (_super) {
3635
+ var SessionManager = (function (_super) {
3837
3636
  __extends(SessionManager, _super);
3838
3637
  function SessionManager(recordConfig) {
3839
3638
  var _a;
@@ -3961,7 +3760,6 @@ var SessionManager = /** @class */ (function (_super) {
3961
3760
  configurable: true
3962
3761
  });
3963
3762
  SessionManager.prototype.updateCurrentPage = function (fragment) {
3964
- // Should not updateCurrentPage when idle, even if rum events are sent before idle(like network requests)
3965
3763
  if (this.isIdleActive) {
3966
3764
  this._currentPageFragment = undefined;
3967
3765
  return;
@@ -3991,21 +3789,21 @@ var SessionManager = /** @class */ (function (_super) {
3991
3789
  case 0:
3992
3790
  CxGlobal[SESSION_MANAGER_KEY] = this;
3993
3791
  this.sessionRecorderConfig = recordConfig;
3994
- if (!(recordConfig === null || recordConfig === void 0 ? void 0 : recordConfig.enable)) return [3 /*break*/, 3];
3792
+ if (!(recordConfig === null || recordConfig === void 0 ? void 0 : recordConfig.enable)) return [3, 3];
3995
3793
  recordingSamplingEnabled = isSamplingOn(recordConfig.sessionRecordingSampleRate);
3996
3794
  isSessionRecordingCompatible = isInstrumentationCompatible(SESSION_RECORDING_INSTRUMENTATION_NAME);
3997
- if (!(recordingSamplingEnabled && isSessionRecordingCompatible)) return [3 /*break*/, 2];
3998
- return [4 /*yield*/, import('./sessionRecorder.esm.js')];
3795
+ if (!(recordingSamplingEnabled && isSessionRecordingCompatible)) return [3, 2];
3796
+ return [4, import('./sessionRecorder.esm.js')];
3999
3797
  case 1:
4000
3798
  SessionRecorder_1 = (_a.sent()).SessionRecorder;
4001
3799
  this.sessionRecorder = new SessionRecorder_1(this, recordConfig);
4002
- return [3 /*break*/, 3];
3800
+ return [3, 3];
4003
3801
  case 2:
4004
3802
  if (getSdkConfig().debug) {
4005
3803
  console.debug('Coralogix Browser SDK - Session recording is disabled');
4006
3804
  }
4007
3805
  _a.label = 3;
4008
- case 3: return [2 /*return*/];
3806
+ case 3: return [2];
4009
3807
  }
4010
3808
  });
4011
3809
  });
@@ -4077,7 +3875,7 @@ function handlePropagators(config, tracerProvider) {
4077
3875
  propagators = [];
4078
3876
  _a = ((_c = config.traceParentInHeader) === null || _c === void 0 ? void 0 : _c.options) || {}, propagateB3TraceHeader = _a.propagateB3TraceHeader, propagateAwsXrayTraceHeader = _a.propagateAwsXrayTraceHeader;
4079
3877
  if (!propagateAwsXrayTraceHeader && !propagateB3TraceHeader) {
4080
- propagators = __spreadArray(__spreadArray([], __read$1(propagators), false), [
3878
+ propagators = __spreadArray(__spreadArray([], __read(propagators), false), [
4081
3879
  new W3CBaggagePropagator(),
4082
3880
  new W3CTraceContextPropagator(),
4083
3881
  ], false);
@@ -4100,11 +3898,11 @@ function handlePropagators(config, tracerProvider) {
4100
3898
  })),
4101
3899
  });
4102
3900
  }
4103
- return [2 /*return*/];
3901
+ return [2];
4104
3902
  });
4105
3903
  });
4106
3904
  }
4107
- var CxPropagator = /** @class */ (function () {
3905
+ var CxPropagator = (function () {
4108
3906
  function CxPropagator(config, internalPropagator) {
4109
3907
  this.config = config;
4110
3908
  this.internalPropagator = internalPropagator;
@@ -4149,13 +3947,12 @@ function isInitialConfigValid(initConfig) {
4149
3947
  console.warn('CoralogixRum: Initialization configuration missing');
4150
3948
  return;
4151
3949
  }
4152
- // Ensure public key is provided when no proxy URL is set
4153
3950
  if (!initConfig.proxyUrl && !initConfig.public_key) {
4154
3951
  console.warn('CoralogixRum: Public key is missing');
4155
3952
  return;
4156
3953
  }
4157
3954
  try {
4158
- 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()) {
3955
+ 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()) {
4159
3956
  var requiredProp = REQUIRED_CONFIG_KEYS_1_1.value;
4160
3957
  if (isNil(initConfig[requiredProp])) {
4161
3958
  console.error("CoralogixRum: Initialization aborted. Please provide the required property \"".concat(requiredProp, "\"."));
@@ -4179,10 +3976,10 @@ function validateAndResolveInitConfig(config) {
4179
3976
  }
4180
3977
  var ignoreUrls = config.ignoreUrls, urlBlueprinters = config.urlBlueprinters, proxyUrl = config.proxyUrl;
4181
3978
  var resolvedIgnoreUrls = [];
4182
- ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read$1(ignoreUrls), false));
3979
+ ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read(ignoreUrls), false));
4183
3980
  if (proxyUrl)
4184
3981
  resolvedIgnoreUrls.push(new RegExp(proxyUrl));
4185
- OPTIONS_DEFAULTS.ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read$1(OPTIONS_DEFAULTS.ignoreUrls), false));
3982
+ OPTIONS_DEFAULTS.ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read(OPTIONS_DEFAULTS.ignoreUrls), false));
4186
3983
  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 });
4187
3984
  }
4188
3985
  function resolveMemoryUsageConfig(memoryUsageConfig) {
@@ -4204,10 +4001,10 @@ function resolveUrlBlueprinters(urlBlueprinters) {
4204
4001
  var _a, _b;
4205
4002
  var _c = urlBlueprinters || {}, pageUrlBlueprinters = _c.pageUrlBlueprinters, networkUrlBlueprinters = _c.networkUrlBlueprinters;
4206
4003
  if (pageUrlBlueprinters) {
4207
- (_a = resolvedUrlBlueprinters.pageUrlBlueprinters).push.apply(_a, __spreadArray([], __read$1(pageUrlBlueprinters), false));
4004
+ (_a = resolvedUrlBlueprinters.pageUrlBlueprinters).push.apply(_a, __spreadArray([], __read(pageUrlBlueprinters), false));
4208
4005
  }
4209
4006
  if (networkUrlBlueprinters) {
4210
- (_b = resolvedUrlBlueprinters.networkUrlBlueprinters).push.apply(_b, __spreadArray([], __read$1(networkUrlBlueprinters), false));
4007
+ (_b = resolvedUrlBlueprinters.networkUrlBlueprinters).push.apply(_b, __spreadArray([], __read(networkUrlBlueprinters), false));
4211
4008
  }
4212
4009
  };
4213
4010
  concatBlueprinters(urlBlueprinters);
@@ -4217,7 +4014,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
4217
4014
  return resolvedUrlBlueprinters;
4218
4015
  }
4219
4016
 
4220
- var SDK_VERSION = '2.8.4';
4017
+ var SDK_VERSION = '2.8.6';
4221
4018
 
4222
4019
  function shouldDropEvent(cxRumEvent, options) {
4223
4020
  if (isDocumentErrorWithoutMessage(cxRumEvent)) {
@@ -4283,7 +4080,7 @@ function editableToCxRumEvent(editable, cxRumEvent) {
4283
4080
  return __assign(__assign(__assign({}, cxRumEvent), editable), { session_context: __assign(__assign({}, cxRumEvent.session_context), editable.session_context) });
4284
4081
  }
4285
4082
 
4286
- var CoralogixSpanMapProcessor = /** @class */ (function () {
4083
+ var CoralogixSpanMapProcessor = (function () {
4287
4084
  function CoralogixSpanMapProcessor() {
4288
4085
  this.sdkConfig = getSdkConfig();
4289
4086
  this.isActive = true;
@@ -4537,7 +4334,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
4537
4334
  var allLabels = {};
4538
4335
  var cxRumEventClone = deepClone(cxRumEvent);
4539
4336
  try {
4540
- for (var labelProviders_1 = __values$1(labelProviders), labelProviders_1_1 = labelProviders_1.next(); !labelProviders_1_1.done; labelProviders_1_1 = labelProviders_1.next()) {
4337
+ for (var labelProviders_1 = __values(labelProviders), labelProviders_1_1 = labelProviders_1.next(); !labelProviders_1_1.done; labelProviders_1_1 = labelProviders_1.next()) {
4541
4338
  var labelProvider = labelProviders_1_1.value;
4542
4339
  allLabels = __assign(__assign({}, allLabels), labelProvider.providerFunc(url, cxRumEventClone));
4543
4340
  }
@@ -4554,7 +4351,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
4554
4351
  return CoralogixSpanMapProcessor;
4555
4352
  }());
4556
4353
 
4557
- var CoralogixSnapshotSpanProcessor = /** @class */ (function () {
4354
+ var CoralogixSnapshotSpanProcessor = (function () {
4558
4355
  function CoralogixSnapshotSpanProcessor() {
4559
4356
  this.isActive = true;
4560
4357
  }
@@ -4631,7 +4428,7 @@ var CoralogixSnapshotSpanProcessor = /** @class */ (function () {
4631
4428
  return CoralogixSnapshotSpanProcessor;
4632
4429
  }());
4633
4430
 
4634
- var SnapshotManager = /** @class */ (function () {
4431
+ var SnapshotManager = (function () {
4635
4432
  function SnapshotManager() {
4636
4433
  var _this = this;
4637
4434
  this.updateSnapshot = function (overrides) {
@@ -4672,7 +4469,7 @@ var SnapshotManager = /** @class */ (function () {
4672
4469
  return SnapshotManager;
4673
4470
  }());
4674
4471
 
4675
- var CoralogixNavigationProcessor = /** @class */ (function () {
4472
+ var CoralogixNavigationProcessor = (function () {
4676
4473
  function CoralogixNavigationProcessor() {
4677
4474
  }
4678
4475
  CoralogixNavigationProcessor.prototype.forceFlush = function () {
@@ -4735,17 +4532,14 @@ var CoralogixRum = {
4735
4532
  var _a, _b;
4736
4533
  var _this = this;
4737
4534
  try {
4738
- // Check if CoralogixRum already inited.
4739
4535
  if (isInited && (options === null || options === void 0 ? void 0 : options.debug)) {
4740
4536
  console.debug('CoralogixRum already initialized, skipping init');
4741
4537
  return;
4742
4538
  }
4743
- // Abort if not in browser environment.
4744
4539
  if (!CxGlobal.sessionStorage) {
4745
4540
  console.warn('CoralogixRum: Non-browser environment detected, aborting');
4746
4541
  return;
4747
4542
  }
4748
- // Abort if running in a not supported browser.
4749
4543
  if (typeof Symbol !== 'function') {
4750
4544
  console.warn('CoralogixRum: browser not supported, disabling instrumentation.');
4751
4545
  return;
@@ -4757,7 +4551,6 @@ var CoralogixRum = {
4757
4551
  CxGlobal[USER_AGENT_KEY] = parseUserAgent(navigator.userAgent);
4758
4552
  CxGlobal[SDK_CONFIG_KEY] = resolvedOptions_1;
4759
4553
  var sampler = getResolvedSampler(resolvedOptions_1);
4760
- // Check if not in debug mode & no auth token.
4761
4554
  if (!resolvedOptions_1.debug && !resolvedOptions_1.public_key) {
4762
4555
  console.warn('rumAuth will be required in the future');
4763
4556
  }
@@ -4768,7 +4561,6 @@ var CoralogixRum = {
4768
4561
  sampler: sampler,
4769
4562
  });
4770
4563
  var pluginDefaults_1 = {};
4771
- // Resolve instrumentations.
4772
4564
  var instrumentations = INSTRUMENTATIONS.map(function (_a) {
4773
4565
  var _b, _c;
4774
4566
  var Instrument = _a.Instrument, confKey = _a.confKey, disable = _a.disable;
@@ -4838,7 +4630,6 @@ var CoralogixRum = {
4838
4630
  return Boolean(instrument);
4839
4631
  });
4840
4632
  var mergedUserContext = __assign(__assign({}, OPTIONS_DEFAULTS.user_context), user_context);
4841
- // Init Span Attributes Processor.
4842
4633
  attributesProcessor = new CoralogixSpanAttributesProcessor(__assign((_a = {}, _a[CoralogixAttributes.APPLICATION_CONTEXT] = JSON.stringify({
4843
4634
  application: application,
4844
4635
  version: version,
@@ -4848,30 +4639,24 @@ var CoralogixRum = {
4848
4639
  attributesProcessor.setCustomLabels(labels);
4849
4640
  }
4850
4641
  setAttrProcessor(attributesProcessor);
4851
- // The order of processors is important.
4852
4642
  tracerProvider.addSpanProcessor(attributesProcessor);
4853
- // Add Navigation Processor
4854
4643
  navigationProcessor = new CoralogixNavigationProcessor();
4855
4644
  tracerProvider.addSpanProcessor(navigationProcessor);
4856
- // Add Span Mapping Processor
4857
4645
  spanMapProcessor = new CoralogixSpanMapProcessor();
4858
4646
  tracerProvider.addSpanProcessor(spanMapProcessor);
4859
- // Add snapshot processor
4860
4647
  new SnapshotManager();
4861
4648
  snapshotProcessor = new CoralogixSnapshotSpanProcessor();
4862
4649
  tracerProvider.addSpanProcessor(snapshotProcessor);
4863
- // Add Batch Span Processor and Exporter
4864
4650
  tracerProvider.addSpanProcessor(new BatchSpanProcessor((exporter = new CoralogixExporter()), {
4865
4651
  maxExportBatchSize: MAX_EXPORT_BATCH_SIZE,
4866
4652
  scheduledDelayMillis: SCHEDULE_DELAY_MILLIS,
4867
4653
  }));
4868
4654
  handlePropagators(options, tracerProvider);
4869
- // Register Instrumentations
4870
4655
  _deregisterInstrumentations = registerInstrumentations({
4871
4656
  tracerProvider: tracerProvider,
4872
4657
  instrumentations: instrumentations,
4873
4658
  });
4874
- var _c = __read$1(partition(resolvedOptions_1.labelProviders || [], function (_a) {
4659
+ var _c = __read(partition(resolvedOptions_1.labelProviders || [], function (_a) {
4875
4660
  var urlType = _a.urlType;
4876
4661
  return urlType === UrlType.PAGE || !urlType;
4877
4662
  }), 2), pageUrlLabelProviders = _c[0], networkUrlLabelProviders = _c[1];
@@ -5015,9 +4800,6 @@ var CoralogixRum = {
5015
4800
  getSessionRecorder().startRecording();
5016
4801
  return;
5017
4802
  }
5018
- /*
5019
- * The session recorder is initialized asynchronously via dynamic import.
5020
- * */
5021
4803
  var intervalId = setInterval(function () {
5022
4804
  if (getSessionRecorder()) {
5023
4805
  clearInterval(intervalId);
@@ -5104,7 +4886,7 @@ var CoralogixRum = {
5104
4886
  };
5105
4887
  CxGlobal.CoralogixRum = CoralogixRum;
5106
4888
 
5107
- var UrlBasedLabelProvider = /** @class */ (function () {
4889
+ var UrlBasedLabelProvider = (function () {
5108
4890
  function UrlBasedLabelProvider(config) {
5109
4891
  var urlPatterns = config.urlPatterns, defaultLabels = config.defaultLabels, urlType = config.urlType;
5110
4892
  var compiledRegexps = urlPatterns.map(function (_a) {
@@ -5116,8 +4898,8 @@ var UrlBasedLabelProvider = /** @class */ (function () {
5116
4898
  var e_1, _a;
5117
4899
  var providerLabels = {};
5118
4900
  try {
5119
- outerLoop: for (var _b = __values$1(compiledRegexps.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
5120
- var _d = __read$1(_c.value, 2), index = _d[0], compiledRegex = _d[1];
4901
+ outerLoop: for (var _b = __values(compiledRegexps.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
4902
+ var _d = __read(_c.value, 2), index = _d[0], compiledRegex = _d[1];
5121
4903
  var labels = urlPatterns[index].labels;
5122
4904
  if (compiledRegex.some(function (regexp) { return regexp.test(url); })) {
5123
4905
  providerLabels = __assign(__assign({}, providerLabels), labels);
@@ -5153,4 +4935,4 @@ var SessionRecordingEventType;
5153
4935
  SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
5154
4936
  })(SessionRecordingEventType || (SessionRecordingEventType = {}));
5155
4937
 
5156
- 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 };
4938
+ 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 };