@coralogix/browser 2.4.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm2.js CHANGED
@@ -48,8 +48,8 @@ function generateUUID(placeholder) {
48
48
  : "".concat(1e7, "-").concat(1e3, "-").concat(4e3, "-").concat(8e3, "-").concat(1e11).replace(/[018]/g, generateUUID);
49
49
  }
50
50
 
51
- function isFunction (funktion) {
52
- return typeof funktion === 'function'
51
+ function isFunction(funktion) {
52
+ return typeof funktion === 'function';
53
53
  }
54
54
 
55
55
  // Default to complaining loudly when things don't go according to plan.
@@ -57,7 +57,7 @@ var logger = console.error.bind(console);
57
57
 
58
58
  // Sets a property on an object, preserving its enumerability.
59
59
  // This function assumes that the property is already writable.
60
- function defineProperty (obj, name, value) {
60
+ function defineProperty(obj, name, value) {
61
61
  var enumerable = !!obj[name] && obj.propertyIsEnumerable(name);
62
62
  Object.defineProperty(obj, name, {
63
63
  configurable: true,
@@ -68,104 +68,87 @@ function defineProperty (obj, name, value) {
68
68
  }
69
69
 
70
70
  // Keep initialization idempotent.
71
- function shimmer (options) {
71
+ function shimmer(options) {
72
72
  if (options && options.logger) {
73
- if (!isFunction(options.logger)) logger("new logger isn't a function, not replacing");
74
- else logger = options.logger;
73
+ if (!isFunction(options.logger)) logger("new logger isn't a function, not replacing");else logger = options.logger;
75
74
  }
76
75
  }
77
-
78
- function wrap (nodule, name, wrapper) {
76
+ function wrap(nodule, name, wrapper) {
79
77
  if (!nodule || !nodule[name]) {
80
78
  logger('no original function ' + name + ' to wrap');
81
- return
79
+ return;
82
80
  }
83
-
84
81
  if (!wrapper) {
85
82
  logger('no wrapper function');
86
- logger((new Error()).stack);
87
- return
83
+ logger(new Error().stack);
84
+ return;
88
85
  }
89
-
90
86
  if (!isFunction(nodule[name]) || !isFunction(wrapper)) {
91
87
  logger('original object and wrapper must be functions');
92
- return
88
+ return;
93
89
  }
94
-
95
90
  var original = nodule[name];
96
91
  var wrapped = wrapper(original, name);
97
-
98
92
  defineProperty(wrapped, '__original', original);
99
93
  defineProperty(wrapped, '__unwrap', function () {
100
94
  if (nodule[name] === wrapped) defineProperty(nodule, name, original);
101
95
  });
102
96
  defineProperty(wrapped, '__wrapped', true);
103
-
104
97
  defineProperty(nodule, name, wrapped);
105
- return wrapped
98
+ return wrapped;
106
99
  }
107
-
108
- function massWrap (nodules, names, wrapper) {
100
+ function massWrap(nodules, names, wrapper) {
109
101
  if (!nodules) {
110
102
  logger('must provide one or more modules to patch');
111
- logger((new Error()).stack);
112
- return
103
+ logger(new Error().stack);
104
+ return;
113
105
  } else if (!Array.isArray(nodules)) {
114
106
  nodules = [nodules];
115
107
  }
116
-
117
108
  if (!(names && Array.isArray(names))) {
118
109
  logger('must provide one or more functions to wrap on modules');
119
- return
110
+ return;
120
111
  }
121
-
122
112
  nodules.forEach(function (nodule) {
123
113
  names.forEach(function (name) {
124
114
  wrap(nodule, name, wrapper);
125
115
  });
126
116
  });
127
117
  }
128
-
129
- function unwrap (nodule, name) {
118
+ function unwrap(nodule, name) {
130
119
  if (!nodule || !nodule[name]) {
131
120
  logger('no function to unwrap.');
132
- logger((new Error()).stack);
133
- return
121
+ logger(new Error().stack);
122
+ return;
134
123
  }
135
-
136
124
  if (!nodule[name].__unwrap) {
137
125
  logger('no original to unwrap to -- has ' + name + ' already been unwrapped?');
138
126
  } else {
139
- return nodule[name].__unwrap()
127
+ return nodule[name].__unwrap();
140
128
  }
141
129
  }
142
-
143
- function massUnwrap (nodules, names) {
130
+ function massUnwrap(nodules, names) {
144
131
  if (!nodules) {
145
132
  logger('must provide one or more modules to patch');
146
- logger((new Error()).stack);
147
- return
133
+ logger(new Error().stack);
134
+ return;
148
135
  } else if (!Array.isArray(nodules)) {
149
136
  nodules = [nodules];
150
137
  }
151
-
152
138
  if (!(names && Array.isArray(names))) {
153
139
  logger('must provide one or more functions to unwrap on modules');
154
- return
140
+ return;
155
141
  }
156
-
157
142
  nodules.forEach(function (nodule) {
158
143
  names.forEach(function (name) {
159
144
  unwrap(nodule, name);
160
145
  });
161
146
  });
162
147
  }
163
-
164
148
  shimmer.wrap = wrap;
165
149
  shimmer.massWrap = massWrap;
166
150
  shimmer.unwrap = unwrap;
167
151
  shimmer.massUnwrap = massUnwrap;
168
-
169
152
  var shimmer_1 = shimmer;
170
153
 
171
154
  var CoralogixEventType;
@@ -512,15 +495,15 @@ function extractMetadataFromMfeStacktrace() {
512
495
  });
513
496
  });
514
497
  }
515
- var _consoleErrorHandler = function (that) {
498
+ var _consoleErrorHandler = function (errorInstrumentation) {
516
499
  return function (original) {
517
500
  return function () {
518
501
  var args = [];
519
502
  for (var _i = 0; _i < arguments.length; _i++) {
520
503
  args[_i] = arguments[_i];
521
504
  }
522
- that.report(ErrorSource.CONSOLE, args);
523
- return original.apply(that, args);
505
+ errorInstrumentation.report(ErrorSource.CONSOLE, args);
506
+ return original.apply(console, args);
524
507
  };
525
508
  };
526
509
  };
@@ -1268,6 +1251,10 @@ var DOM_INSTRUMENTATION_NAME = 'dom';
1268
1251
  var DOM_INSTRUMENTATION_VERSION = '1.0.0';
1269
1252
  var CUSTOM_MEASUREMENT_INSTRUMENTATION_NAME = 'custom_measurement';
1270
1253
  var CUSTOM_MEASUREMENT_INSTRUMENTATION_VERSION = '1.0.0';
1254
+ var XHR_INSTRUMENTATION_NAME = 'xhr';
1255
+ var FETCH_INSTRUMENTATION_NAME = 'fetch';
1256
+ var CUSTOM_INSTRUMENTATION_NAME = 'custom';
1257
+ var SESSION_RECORDING_INSTRUMENTATION_NAME = 'session_recording';
1271
1258
  var ALL_WEB_VITALS_METRICS = {
1272
1259
  lcp: true,
1273
1260
  fid: true,
@@ -1329,14 +1316,11 @@ var IMG_EXTENSIONS = [
1329
1316
  */
1330
1317
 
1331
1318
  var h = 'undefined' != typeof CxGlobal ? CxGlobal : {},
1332
- k =
1333
- 'function' == typeof Object.defineProperties
1334
- ? Object.defineProperty
1335
- : function (a, b, c) {
1336
- a != Array.prototype && a != Object.prototype && (a[b] = c.value);
1337
- };
1319
+ k = 'function' == typeof Object.defineProperties ? Object.defineProperty : function (a, b, c) {
1320
+ a != Array.prototype && a != Object.prototype && (a[b] = c.value);
1321
+ };
1338
1322
  function l() {
1339
- l = function () {};
1323
+ l = function l() {};
1340
1324
  h.Symbol || (h.Symbol = m);
1341
1325
  }
1342
1326
  var n = 0;
@@ -1347,25 +1331,31 @@ function p() {
1347
1331
  l();
1348
1332
  var a = h.Symbol.iterator;
1349
1333
  a || (a = h.Symbol.iterator = h.Symbol('iterator'));
1350
- 'function' != typeof Array.prototype[a] &&
1351
- k(Array.prototype, a, {
1352
- configurable: true,
1353
- writable: true,
1354
- value: function () {
1355
- return q(this);
1356
- },
1357
- });
1358
- p = function () {};
1334
+ 'function' != typeof Array.prototype[a] && k(Array.prototype, a, {
1335
+ configurable: true,
1336
+ writable: true,
1337
+ value: function value() {
1338
+ return q(this);
1339
+ }
1340
+ });
1341
+ p = function p() {};
1359
1342
  }
1360
1343
  function q(a) {
1361
1344
  var b = 0;
1362
1345
  return r(function () {
1363
- return b < a.length ? { done: false, value: a[b++] } : { done: true };
1346
+ return b < a.length ? {
1347
+ done: false,
1348
+ value: a[b++]
1349
+ } : {
1350
+ done: true
1351
+ };
1364
1352
  });
1365
1353
  }
1366
1354
  function r(a) {
1367
1355
  p();
1368
- a = { next: a };
1356
+ a = {
1357
+ next: a
1358
+ };
1369
1359
  a[h.Symbol.iterator] = function () {
1370
1360
  return this;
1371
1361
  };
@@ -1379,7 +1369,7 @@ function t(a) {
1379
1369
  function u(a) {
1380
1370
  if (!(a instanceof Array)) {
1381
1371
  a = t(a);
1382
- for (var b, c = []; !(b = a.next()).done; ) c.push(b.value);
1372
+ for (var b, c = []; !(b = a.next()).done;) c.push(b.value);
1383
1373
  a = c;
1384
1374
  }
1385
1375
  return a;
@@ -1400,50 +1390,37 @@ function w(a, b) {
1400
1390
  }
1401
1391
  function x(a, b) {
1402
1392
  var c = fetch;
1403
- fetch = function (d) {
1393
+ fetch = function fetch(d) {
1404
1394
  for (var f = [], e = 0; e < arguments.length; ++e) f[e - 0] = arguments[e];
1405
1395
  return new Promise(function (d, e) {
1406
1396
  var g = v++;
1407
1397
  a(g);
1408
- c.apply(null, [].concat(u(f))).then(
1409
- function (a) {
1410
- b(g);
1411
- d(a);
1412
- },
1413
- function (a) {
1414
- b(a);
1415
- e(a);
1416
- }
1417
- );
1398
+ c.apply(null, [].concat(u(f))).then(function (a) {
1399
+ b(g);
1400
+ d(a);
1401
+ }, function (a) {
1402
+ b(a);
1403
+ e(a);
1404
+ });
1418
1405
  });
1419
1406
  };
1420
1407
  }
1421
1408
  var y = 'img script iframe link audio video source'.split(' ');
1422
1409
  function z(a, b) {
1423
1410
  a = t(a);
1424
- for (var c = a.next(); !c.done; c = a.next())
1425
- if (
1426
- ((c = c.value), b.includes(c.nodeName.toLowerCase()) || z(c.children, b))
1427
- )
1428
- return true;
1411
+ for (var c = a.next(); !c.done; c = a.next()) if (c = c.value, b.includes(c.nodeName.toLowerCase()) || z(c.children, b)) return true;
1429
1412
  return false;
1430
1413
  }
1431
1414
  function A(a) {
1432
1415
  var b = new MutationObserver(function (c) {
1433
1416
  c = t(c);
1434
- for (var b = c.next(); !b.done; b = c.next())
1435
- (b = b.value),
1436
- 'childList' == b.type && z(b.addedNodes, y)
1437
- ? a(b)
1438
- : 'attributes' == b.type &&
1439
- y.includes(b.target.tagName.toLowerCase()) &&
1440
- a(b);
1417
+ for (var b = c.next(); !b.done; b = c.next()) b = b.value, 'childList' == b.type && z(b.addedNodes, y) ? a(b) : 'attributes' == b.type && y.includes(b.target.tagName.toLowerCase()) && a(b);
1441
1418
  });
1442
1419
  b.observe(document, {
1443
1420
  attributes: true,
1444
1421
  childList: true,
1445
1422
  subtree: true,
1446
- attributeFilter: ['href', 'src'],
1423
+ attributeFilter: ['href', 'src']
1447
1424
  });
1448
1425
  return b;
1449
1426
  }
@@ -1451,29 +1428,33 @@ function B(a, b) {
1451
1428
  if (2 < a.length) return performance.now();
1452
1429
  var c = [];
1453
1430
  b = t(b);
1454
- for (var d = b.next(); !d.done; d = b.next())
1455
- (d = d.value),
1456
- c.push({ timestamp: d.start, type: 'requestStart' }),
1457
- c.push({ timestamp: d.end, type: 'requestEnd' });
1431
+ for (var d = b.next(); !d.done; d = b.next()) d = d.value, c.push({
1432
+ timestamp: d.start,
1433
+ type: 'requestStart'
1434
+ }), c.push({
1435
+ timestamp: d.end,
1436
+ type: 'requestEnd'
1437
+ });
1458
1438
  b = t(a);
1459
- for (d = b.next(); !d.done; d = b.next())
1460
- c.push({ timestamp: d.value, type: 'requestStart' });
1439
+ for (d = b.next(); !d.done; d = b.next()) c.push({
1440
+ timestamp: d.value,
1441
+ type: 'requestStart'
1442
+ });
1461
1443
  c.sort(function (a, b) {
1462
1444
  return a.timestamp - b.timestamp;
1463
1445
  });
1464
1446
  a = a.length;
1465
- for (b = c.length - 1; 0 <= b; b--)
1466
- switch (((d = c[b]), d.type)) {
1467
- case 'requestStart':
1468
- a--;
1469
- break;
1470
- case 'requestEnd':
1471
- a++;
1472
- if (2 < a) return d.timestamp;
1473
- break;
1474
- default:
1475
- throw Error('Internal Error: This should never happen');
1476
- }
1447
+ for (b = c.length - 1; 0 <= b; b--) switch (d = c[b], d.type) {
1448
+ case 'requestStart':
1449
+ a--;
1450
+ break;
1451
+ case 'requestEnd':
1452
+ a++;
1453
+ if (2 < a) return d.timestamp;
1454
+ break;
1455
+ default:
1456
+ throw Error('Internal Error: This should never happen');
1457
+ }
1477
1458
  return 0;
1478
1459
  }
1479
1460
  function C(a) {
@@ -1482,11 +1463,12 @@ function C(a) {
1482
1463
  this.u = a.minValue || null;
1483
1464
  a = CxGlobal.__tti && CxGlobal.__tti.e;
1484
1465
  var b = CxGlobal.__tti && CxGlobal.__tti.o;
1485
- this.a = a
1486
- ? a.map(function (a) {
1487
- return { start: a.startTime, end: a.startTime + a.duration };
1488
- })
1489
- : [];
1466
+ this.a = a ? a.map(function (a) {
1467
+ return {
1468
+ start: a.startTime,
1469
+ end: a.startTime + a.duration
1470
+ };
1471
+ }) : [];
1490
1472
  b && b.disconnect();
1491
1473
  this.b = [];
1492
1474
  this.f = new Map();
@@ -1503,11 +1485,9 @@ C.prototype.getFirstConsistentlyInteractive = function () {
1503
1485
  var a = this;
1504
1486
  return new Promise(function (b) {
1505
1487
  a.s = b;
1506
- 'complete' == document.readyState
1507
- ? F(a)
1508
- : CxGlobal.addEventListener('load', function () {
1509
- F(a);
1510
- });
1488
+ 'complete' == document.readyState ? F(a) : CxGlobal.addEventListener('load', function () {
1489
+ F(a);
1490
+ });
1511
1491
  });
1512
1492
  };
1513
1493
  function F(a) {
@@ -1517,55 +1497,37 @@ function F(a) {
1517
1497
  G(a, Math.max(c + 5e3, b));
1518
1498
  }
1519
1499
  function G(a, b) {
1520
- !a.i ||
1521
- a.v > b ||
1522
- (clearTimeout(a.j),
1523
- (a.j = setTimeout(function () {
1524
- var b = performance.timing.navigationStart,
1525
- d = B(a.g, a.b),
1526
- b =
1527
- (CxGlobal.a && CxGlobal.a.A ? 1e3 * CxGlobal.a.A().C - b : 0) ||
1528
- performance.timing.domContentLoadedEventEnd - b;
1529
- if (a.u) var f = a.u;
1530
- else
1531
- performance.timing.domContentLoadedEventEnd
1532
- ? ((f = performance.timing),
1533
- (f = f.domContentLoadedEventEnd - f.navigationStart))
1534
- : (f = null);
1535
- var e = performance.now();
1536
- null === f && G(a, Math.max(d + 5e3, e + 1e3));
1537
- var g = a.a;
1538
- 5e3 > e - d
1539
- ? (d = null)
1540
- : ((d = g.length ? g[g.length - 1].end : b),
1541
- (d = 5e3 > e - d ? null : Math.max(d, f)));
1542
- d &&
1543
- (a.s(d),
1544
- clearTimeout(a.j),
1545
- (a.i = false),
1546
- a.c && a.c.disconnect(),
1547
- a.h && a.h.disconnect());
1548
- G(a, performance.now() + 1e3);
1549
- }, b - performance.now())),
1550
- (a.v = b));
1500
+ !a.i || a.v > b || (clearTimeout(a.j), a.j = setTimeout(function () {
1501
+ var b = performance.timing.navigationStart,
1502
+ d = B(a.g, a.b),
1503
+ b = (CxGlobal.a && CxGlobal.a.A ? 1e3 * CxGlobal.a.A().C - b : 0) || performance.timing.domContentLoadedEventEnd - b;
1504
+ if (a.u) var f = a.u;else performance.timing.domContentLoadedEventEnd ? (f = performance.timing, f = f.domContentLoadedEventEnd - f.navigationStart) : f = null;
1505
+ var e = performance.now();
1506
+ null === f && G(a, Math.max(d + 5e3, e + 1e3));
1507
+ var g = a.a;
1508
+ 5e3 > e - d ? d = null : (d = g.length ? g[g.length - 1].end : b, d = 5e3 > e - d ? null : Math.max(d, f));
1509
+ d && (a.s(d), clearTimeout(a.j), a.i = false, a.c && a.c.disconnect(), a.h && a.h.disconnect());
1510
+ G(a, performance.now() + 1e3);
1511
+ }, b - performance.now()), a.v = b);
1551
1512
  }
1552
1513
  function D(a) {
1553
1514
  a.c = new PerformanceObserver(function (b) {
1554
1515
  b = t(b.getEntries());
1555
- for (var c = b.next(); !c.done; c = b.next())
1556
- if (
1557
- ((c = c.value),
1558
- 'resource' === c.entryType &&
1559
- (a.b.push({ start: c.fetchStart, end: c.responseEnd }),
1560
- G(a, B(a.g, a.b) + 5e3)),
1561
- 'longtask' === c.entryType)
1562
- ) {
1563
- var d = c.startTime + c.duration;
1564
- a.a.push({ start: c.startTime, end: d });
1565
- G(a, d + 5e3);
1566
- }
1516
+ for (var c = b.next(); !c.done; c = b.next()) if (c = c.value, 'resource' === c.entryType && (a.b.push({
1517
+ start: c.fetchStart,
1518
+ end: c.responseEnd
1519
+ }), G(a, B(a.g, a.b) + 5e3)), 'longtask' === c.entryType) {
1520
+ var d = c.startTime + c.duration;
1521
+ a.a.push({
1522
+ start: c.startTime,
1523
+ end: d
1524
+ });
1525
+ G(a, d + 5e3);
1526
+ }
1527
+ });
1528
+ a.c.observe({
1529
+ entryTypes: ['longtask', 'resource']
1567
1530
  });
1568
- a.c.observe({ entryTypes: ['longtask', 'resource'] });
1569
1531
  }
1570
1532
  C.prototype.m = function (a) {
1571
1533
  this.f.set(a, performance.now());
@@ -1580,18 +1542,17 @@ h.Object.defineProperties(C.prototype, {
1580
1542
  g: {
1581
1543
  configurable: true,
1582
1544
  enumerable: true,
1583
- get: function () {
1545
+ get: function get() {
1584
1546
  return [].concat(u(this.f.values()));
1585
- },
1586
- },
1547
+ }
1548
+ }
1587
1549
  });
1588
1550
  var H = {
1589
- getFirstConsistentlyInteractive: function (a = undefined) {
1551
+ getFirstConsistentlyInteractive: function getFirstConsistentlyInteractive() {
1552
+ var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
1590
1553
  a = a ? a : {};
1591
- return 'PerformanceLongTaskTiming' in CxGlobal
1592
- ? new C(a).getFirstConsistentlyInteractive()
1593
- : Promise.resolve(null);
1594
- },
1554
+ return 'PerformanceLongTaskTiming' in CxGlobal ? new C(a).getFirstConsistentlyInteractive() : Promise.resolve(null);
1555
+ }
1595
1556
  };
1596
1557
 
1597
1558
  function observeIfSupported(observer, entryType) {
@@ -2097,12 +2058,12 @@ function getTextualContent(element) {
2097
2058
  return 'innerText' in element ? element.innerText : '';
2098
2059
  }
2099
2060
 
2100
- var _a$2;
2061
+ var _a$3;
2101
2062
  var USER_INTERACTION_INSTRUMENTATION_NAME = 'user-interaction';
2102
2063
  var USER_INTERACTION_INSTRUMENTATION_VERSION = '1';
2103
- var DEFAULT_INSTRUMENTED_EVENTS = (_a$2 = {},
2104
- _a$2["click" /* DOM_EVENT.CLICK */] = true,
2105
- _a$2);
2064
+ var DEFAULT_INSTRUMENTED_EVENTS = (_a$3 = {},
2065
+ _a$3["click" /* DOM_EVENT.CLICK */] = true,
2066
+ _a$3);
2106
2067
  var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
2107
2068
  __extends(CoralogixUserInteractionInstrumentation, _super);
2108
2069
  function CoralogixUserInteractionInstrumentation(config) {
@@ -2529,22 +2490,22 @@ var INSTRUMENTATIONS = [
2529
2490
  },
2530
2491
  {
2531
2492
  Instrument: CoralogixFetchInstrumentation,
2532
- confKey: 'fetch',
2493
+ confKey: FETCH_INSTRUMENTATION_NAME,
2533
2494
  disable: false,
2534
2495
  },
2535
2496
  {
2536
2497
  Instrument: CoralogixXhrInstrumentation,
2537
- confKey: 'xhr',
2498
+ confKey: XHR_INSTRUMENTATION_NAME,
2538
2499
  disable: false,
2539
2500
  },
2540
2501
  {
2541
2502
  Instrument: CoralogixCustomLogInstrumentation,
2542
- confKey: 'custom',
2503
+ confKey: CUSTOM_INSTRUMENTATION_NAME,
2543
2504
  disable: false,
2544
2505
  },
2545
2506
  {
2546
2507
  Instrument: CoralogixUserInteractionInstrumentation,
2547
- confKey: 'interactions',
2508
+ confKey: USER_INTERACTION_INSTRUMENTATION_NAME,
2548
2509
  disable: false,
2549
2510
  },
2550
2511
  {
@@ -2645,8 +2606,8 @@ function getInternalRumData(key) {
2645
2606
  return (_a = CxGlobal[RUM_INTERNAL_DATA_KEY]) === null || _a === void 0 ? void 0 : _a[key];
2646
2607
  }
2647
2608
 
2648
- var _a$1;
2649
- var supportedPerformanceTypes = !((_a$1 = CxGlobal === null || CxGlobal === void 0 ? void 0 : CxGlobal.PerformanceObserver) === null || _a$1 === void 0 ? void 0 : _a$1.supportedEntryTypes)
2609
+ var _a$2;
2610
+ var supportedPerformanceTypes = !((_a$2 = CxGlobal === null || CxGlobal === void 0 ? void 0 : CxGlobal.PerformanceObserver) === null || _a$2 === void 0 ? void 0 : _a$2.supportedEntryTypes)
2650
2611
  ? new Set()
2651
2612
  : new Set(CxGlobal.PerformanceObserver.supportedEntryTypes);
2652
2613
  function valueEndWithOrInclude(value, extensions) {
@@ -2705,25 +2666,28 @@ var getUrlFragments = function (url) {
2705
2666
  };
2706
2667
  function parseUserAgent(userAgent) {
2707
2668
  var e_1, _a, e_2, _b, e_3, _c;
2708
- var _d, _e;
2669
+ var _d, _e, _f;
2709
2670
  var browsers = {
2671
+ Edge: /Edge\/([\d.]+)|Edg\/([\d.]+)/,
2710
2672
  Chrome: /Chrome\/([\d.]+)/,
2711
2673
  Firefox: /Firefox\/([\d.]+)/,
2712
- Safari: /Version\/([\d.]+).*Safari/,
2713
- Edge: /Edge\/([\d.]+)/,
2674
+ Safari: /Version\/([\d.]+).*Safari|Safari\/([\d.]+)/,
2714
2675
  Opera: /Opera\/([\d.]+)/,
2715
2676
  IE: /Trident.*rv:([\d.]+)/,
2716
2677
  };
2717
2678
  var operatingSystems = {
2718
2679
  Windows: /Windows NT ([\d.]+)/,
2719
2680
  MacOS: /Mac OS X ([\d._]+)/,
2681
+ webOS: /Web0S/,
2720
2682
  Linux: /Linux(?: ([\d.]+))?/,
2721
2683
  iOS: /CPU(?: iPhone)? OS (\d+([._]\d+)*)/,
2722
2684
  Android: /Android (\d+([._]\d+)*)/,
2685
+ Tizen: /Tizen ([\d.]+)/,
2723
2686
  };
2724
2687
  var devices = {
2725
2688
  Mobile: /Mobile|Android|iPhone|iPod|BlackBerry|IEMobile|Windows Phone|webOS|Opera Mini/,
2726
2689
  Tablet: /Tablet|iPad/,
2690
+ 'Smart-TV': /SMART-TV|SmartTV/,
2727
2691
  };
2728
2692
  var browser = 'Unknown';
2729
2693
  var browserVersion = 'Unknown';
@@ -2731,12 +2695,12 @@ function parseUserAgent(userAgent) {
2731
2695
  var osVersion = 'Unknown';
2732
2696
  var device = 'Desktop';
2733
2697
  try {
2734
- for (var _f = __values$1(Object.entries(browsers)), _g = _f.next(); !_g.done; _g = _f.next()) {
2735
- var _h = __read$1(_g.value, 2), name_1 = _h[0], regex = _h[1];
2698
+ for (var _g = __values$1(Object.entries(browsers)), _h = _g.next(); !_h.done; _h = _g.next()) {
2699
+ var _j = __read$1(_h.value, 2), name_1 = _j[0], regex = _j[1];
2736
2700
  var match = userAgent.match(regex);
2737
2701
  if (match) {
2738
2702
  browser = name_1;
2739
- browserVersion = match[1] || 'Unknown';
2703
+ browserVersion = ((_d = match.slice(1)) === null || _d === void 0 ? void 0 : _d.find(function (v) { return !!v; })) || 'Unknown';
2740
2704
  break;
2741
2705
  }
2742
2706
  }
@@ -2744,17 +2708,17 @@ function parseUserAgent(userAgent) {
2744
2708
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
2745
2709
  finally {
2746
2710
  try {
2747
- if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
2711
+ if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
2748
2712
  }
2749
2713
  finally { if (e_1) throw e_1.error; }
2750
2714
  }
2751
2715
  try {
2752
- for (var _j = __values$1(Object.entries(operatingSystems)), _k = _j.next(); !_k.done; _k = _j.next()) {
2753
- var _l = __read$1(_k.value, 2), name_2 = _l[0], regex = _l[1];
2716
+ for (var _k = __values$1(Object.entries(operatingSystems)), _l = _k.next(); !_l.done; _l = _k.next()) {
2717
+ var _m = __read$1(_l.value, 2), name_2 = _m[0], regex = _m[1];
2754
2718
  var match = userAgent.match(regex);
2755
2719
  if (match) {
2756
2720
  os = name_2;
2757
- osVersion = ((_e = (_d = match[1]) === null || _d === void 0 ? void 0 : _d.split('_')) === null || _e === void 0 ? void 0 : _e.join('.')) || 'Unknown';
2721
+ osVersion = ((_f = (_e = match[1]) === null || _e === void 0 ? void 0 : _e.split('_')) === null || _f === void 0 ? void 0 : _f.join('.')) || 'Unknown';
2758
2722
  break;
2759
2723
  }
2760
2724
  }
@@ -2762,13 +2726,13 @@ function parseUserAgent(userAgent) {
2762
2726
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
2763
2727
  finally {
2764
2728
  try {
2765
- if (_k && !_k.done && (_b = _j.return)) _b.call(_j);
2729
+ if (_l && !_l.done && (_b = _k.return)) _b.call(_k);
2766
2730
  }
2767
2731
  finally { if (e_2) throw e_2.error; }
2768
2732
  }
2769
2733
  try {
2770
- for (var _m = __values$1(Object.entries(devices)), _o = _m.next(); !_o.done; _o = _m.next()) {
2771
- var _p = __read$1(_o.value, 2), name_3 = _p[0], regex = _p[1];
2734
+ for (var _o = __values$1(Object.entries(devices)), _p = _o.next(); !_p.done; _p = _o.next()) {
2735
+ var _q = __read$1(_p.value, 2), name_3 = _q[0], regex = _q[1];
2772
2736
  var match = userAgent.match(regex);
2773
2737
  if (match) {
2774
2738
  device = name_3;
@@ -2779,7 +2743,7 @@ function parseUserAgent(userAgent) {
2779
2743
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
2780
2744
  finally {
2781
2745
  try {
2782
- if (_o && !_o.done && (_c = _m.return)) _c.call(_m);
2746
+ if (_p && !_p.done && (_c = _o.return)) _c.call(_o);
2783
2747
  }
2784
2748
  finally { if (e_3) throw e_3.error; }
2785
2749
  }
@@ -2978,7 +2942,7 @@ var CoralogixSpanAttributesProcessor = /** @class */ (function () {
2978
2942
  */
2979
2943
  var SUPPRESS_TRACING_KEY = createContextKey('OpenTelemetry SDK Context Key SUPPRESS_TRACING');
2980
2944
  function isTracingSuppressed(context) {
2981
- return context.getValue(SUPPRESS_TRACING_KEY) === true;
2945
+ return context.getValue(SUPPRESS_TRACING_KEY) === true;
2982
2946
  }
2983
2947
 
2984
2948
  /*
@@ -3008,57 +2972,66 @@ var BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096;
3008
2972
  // Maximum total length of all name-value pairs allowed by w3c spec
3009
2973
  var BAGGAGE_MAX_TOTAL_LENGTH = 8192;
3010
2974
 
3011
- var __read = (undefined && undefined.__read) || function (o, n) {
3012
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3013
- if (!m) return o;
3014
- var i = m.call(o), r, ar = [], e;
2975
+ var __read = undefined && undefined.__read || function (o, n) {
2976
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
2977
+ if (!m) return o;
2978
+ var i = m.call(o),
2979
+ r,
2980
+ ar = [],
2981
+ e;
2982
+ try {
2983
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
2984
+ } catch (error) {
2985
+ e = {
2986
+ error: error
2987
+ };
2988
+ } finally {
3015
2989
  try {
3016
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
3017
- }
3018
- catch (error) { e = { error: error }; }
3019
- finally {
3020
- try {
3021
- if (r && !r.done && (m = i["return"])) m.call(i);
3022
- }
3023
- finally { if (e) throw e.error; }
2990
+ if (r && !r.done && (m = i["return"])) m.call(i);
2991
+ } finally {
2992
+ if (e) throw e.error;
3024
2993
  }
3025
- return ar;
2994
+ }
2995
+ return ar;
3026
2996
  };
3027
2997
  function serializeKeyPairs(keyPairs) {
3028
- return keyPairs.reduce(function (hValue, current) {
3029
- var value = "" + hValue + (hValue !== '' ? BAGGAGE_ITEMS_SEPARATOR : '') + current;
3030
- return value.length > BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value;
3031
- }, '');
2998
+ return keyPairs.reduce(function (hValue, current) {
2999
+ var value = "" + hValue + (hValue !== '' ? BAGGAGE_ITEMS_SEPARATOR : '') + current;
3000
+ return value.length > BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value;
3001
+ }, '');
3032
3002
  }
3033
3003
  function getKeyPairs(baggage) {
3034
- return baggage.getAllEntries().map(function (_a) {
3035
- var _b = __read(_a, 2), key = _b[0], value = _b[1];
3036
- var entry = encodeURIComponent(key) + "=" + encodeURIComponent(value.value);
3037
- // include opaque metadata if provided
3038
- // NOTE: we intentionally don't URI-encode the metadata - that responsibility falls on the metadata implementation
3039
- if (value.metadata !== undefined) {
3040
- entry += BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString();
3041
- }
3042
- return entry;
3043
- });
3004
+ return baggage.getAllEntries().map(function (_a) {
3005
+ var _b = __read(_a, 2),
3006
+ key = _b[0],
3007
+ value = _b[1];
3008
+ var entry = encodeURIComponent(key) + "=" + encodeURIComponent(value.value);
3009
+ // include opaque metadata if provided
3010
+ // NOTE: we intentionally don't URI-encode the metadata - that responsibility falls on the metadata implementation
3011
+ if (value.metadata !== undefined) {
3012
+ entry += BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString();
3013
+ }
3014
+ return entry;
3015
+ });
3044
3016
  }
3045
3017
  function parsePairKeyValue(entry) {
3046
- var valueProps = entry.split(BAGGAGE_PROPERTIES_SEPARATOR);
3047
- if (valueProps.length <= 0)
3048
- return;
3049
- var keyPairPart = valueProps.shift();
3050
- if (!keyPairPart)
3051
- return;
3052
- var separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);
3053
- if (separatorIndex <= 0)
3054
- return;
3055
- var key = decodeURIComponent(keyPairPart.substring(0, separatorIndex).trim());
3056
- var value = decodeURIComponent(keyPairPart.substring(separatorIndex + 1).trim());
3057
- var metadata;
3058
- if (valueProps.length > 0) {
3059
- metadata = baggageEntryMetadataFromString(valueProps.join(BAGGAGE_PROPERTIES_SEPARATOR));
3060
- }
3061
- return { key: key, value: value, metadata: metadata };
3018
+ var valueProps = entry.split(BAGGAGE_PROPERTIES_SEPARATOR);
3019
+ if (valueProps.length <= 0) return;
3020
+ var keyPairPart = valueProps.shift();
3021
+ if (!keyPairPart) return;
3022
+ var separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);
3023
+ if (separatorIndex <= 0) return;
3024
+ var key = decodeURIComponent(keyPairPart.substring(0, separatorIndex).trim());
3025
+ var value = decodeURIComponent(keyPairPart.substring(separatorIndex + 1).trim());
3026
+ var metadata;
3027
+ if (valueProps.length > 0) {
3028
+ metadata = baggageEntryMetadataFromString(valueProps.join(BAGGAGE_PROPERTIES_SEPARATOR));
3029
+ }
3030
+ return {
3031
+ key: key,
3032
+ value: value,
3033
+ metadata: metadata
3034
+ };
3062
3035
  }
3063
3036
 
3064
3037
  /*
@@ -3082,55 +3055,50 @@ function parsePairKeyValue(entry) {
3082
3055
  * Based on the Baggage specification:
3083
3056
  * https://w3c.github.io/baggage/
3084
3057
  */
3085
- var W3CBaggagePropagator = /** @class */ (function () {
3086
- function W3CBaggagePropagator() {
3058
+ var W3CBaggagePropagator = /** @class */function () {
3059
+ function W3CBaggagePropagator() {}
3060
+ W3CBaggagePropagator.prototype.inject = function (context, carrier, setter) {
3061
+ var baggage = propagation.getBaggage(context);
3062
+ if (!baggage || isTracingSuppressed(context)) return;
3063
+ var keyPairs = getKeyPairs(baggage).filter(function (pair) {
3064
+ return pair.length <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS;
3065
+ }).slice(0, BAGGAGE_MAX_NAME_VALUE_PAIRS);
3066
+ var headerValue = serializeKeyPairs(keyPairs);
3067
+ if (headerValue.length > 0) {
3068
+ setter.set(carrier, BAGGAGE_HEADER, headerValue);
3087
3069
  }
3088
- W3CBaggagePropagator.prototype.inject = function (context, carrier, setter) {
3089
- var baggage = propagation.getBaggage(context);
3090
- if (!baggage || isTracingSuppressed(context))
3091
- return;
3092
- var keyPairs = getKeyPairs(baggage)
3093
- .filter(function (pair) {
3094
- return pair.length <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS;
3095
- })
3096
- .slice(0, BAGGAGE_MAX_NAME_VALUE_PAIRS);
3097
- var headerValue = serializeKeyPairs(keyPairs);
3098
- if (headerValue.length > 0) {
3099
- setter.set(carrier, BAGGAGE_HEADER, headerValue);
3100
- }
3101
- };
3102
- W3CBaggagePropagator.prototype.extract = function (context, carrier, getter) {
3103
- var headerValue = getter.get(carrier, BAGGAGE_HEADER);
3104
- var baggageString = Array.isArray(headerValue)
3105
- ? headerValue.join(BAGGAGE_ITEMS_SEPARATOR)
3106
- : headerValue;
3107
- if (!baggageString)
3108
- return context;
3109
- var baggage = {};
3110
- if (baggageString.length === 0) {
3111
- return context;
3112
- }
3113
- var pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);
3114
- pairs.forEach(function (entry) {
3115
- var keyPair = parsePairKeyValue(entry);
3116
- if (keyPair) {
3117
- var baggageEntry = { value: keyPair.value };
3118
- if (keyPair.metadata) {
3119
- baggageEntry.metadata = keyPair.metadata;
3120
- }
3121
- baggage[keyPair.key] = baggageEntry;
3122
- }
3123
- });
3124
- if (Object.entries(baggage).length === 0) {
3125
- return context;
3070
+ };
3071
+ W3CBaggagePropagator.prototype.extract = function (context, carrier, getter) {
3072
+ var headerValue = getter.get(carrier, BAGGAGE_HEADER);
3073
+ var baggageString = Array.isArray(headerValue) ? headerValue.join(BAGGAGE_ITEMS_SEPARATOR) : headerValue;
3074
+ if (!baggageString) return context;
3075
+ var baggage = {};
3076
+ if (baggageString.length === 0) {
3077
+ return context;
3078
+ }
3079
+ var pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);
3080
+ pairs.forEach(function (entry) {
3081
+ var keyPair = parsePairKeyValue(entry);
3082
+ if (keyPair) {
3083
+ var baggageEntry = {
3084
+ value: keyPair.value
3085
+ };
3086
+ if (keyPair.metadata) {
3087
+ baggageEntry.metadata = keyPair.metadata;
3126
3088
  }
3127
- return propagation.setBaggage(context, propagation.createBaggage(baggage));
3128
- };
3129
- W3CBaggagePropagator.prototype.fields = function () {
3130
- return [BAGGAGE_HEADER];
3131
- };
3132
- return W3CBaggagePropagator;
3133
- }());
3089
+ baggage[keyPair.key] = baggageEntry;
3090
+ }
3091
+ });
3092
+ if (Object.entries(baggage).length === 0) {
3093
+ return context;
3094
+ }
3095
+ return propagation.setBaggage(context, propagation.createBaggage(baggage));
3096
+ };
3097
+ W3CBaggagePropagator.prototype.fields = function () {
3098
+ return [BAGGAGE_HEADER];
3099
+ };
3100
+ return W3CBaggagePropagator;
3101
+ }();
3134
3102
 
3135
3103
  /*
3136
3104
  * Copyright The OpenTelemetry Authors
@@ -3149,8 +3117,8 @@ var W3CBaggagePropagator = /** @class */ (function () {
3149
3117
  */
3150
3118
  var ExportResultCode;
3151
3119
  (function (ExportResultCode) {
3152
- ExportResultCode[ExportResultCode["SUCCESS"] = 0] = "SUCCESS";
3153
- ExportResultCode[ExportResultCode["FAILED"] = 1] = "FAILED";
3120
+ ExportResultCode[ExportResultCode["SUCCESS"] = 0] = "SUCCESS";
3121
+ ExportResultCode[ExportResultCode["FAILED"] = 1] = "FAILED";
3154
3122
  })(ExportResultCode || (ExportResultCode = {}));
3155
3123
 
3156
3124
  /*
@@ -3168,89 +3136,100 @@ var ExportResultCode;
3168
3136
  * See the License for the specific language governing permissions and
3169
3137
  * limitations under the License.
3170
3138
  */
3171
- var __values = (undefined && undefined.__values) || function(o) {
3172
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3173
- if (m) return m.call(o);
3174
- if (o && typeof o.length === "number") return {
3175
- next: function () {
3176
- if (o && i >= o.length) o = void 0;
3177
- return { value: o && o[i++], done: !o };
3178
- }
3179
- };
3180
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
3139
+ var __values = undefined && undefined.__values || function (o) {
3140
+ var s = typeof Symbol === "function" && Symbol.iterator,
3141
+ m = s && o[s],
3142
+ i = 0;
3143
+ if (m) return m.call(o);
3144
+ if (o && typeof o.length === "number") return {
3145
+ next: function next() {
3146
+ if (o && i >= o.length) o = void 0;
3147
+ return {
3148
+ value: o && o[i++],
3149
+ done: !o
3150
+ };
3151
+ }
3152
+ };
3153
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
3181
3154
  };
3182
3155
  /** Combines multiple propagators into a single propagator. */
3183
- var CompositePropagator = /** @class */ (function () {
3184
- /**
3185
- * Construct a composite propagator from a list of propagators.
3186
- *
3187
- * @param [config] Configuration object for composite propagator
3188
- */
3189
- function CompositePropagator(config) {
3190
- if (config === void 0) { config = {}; }
3191
- var _a;
3192
- this._propagators = (_a = config.propagators) !== null && _a !== void 0 ? _a : [];
3193
- this._fields = Array.from(new Set(this._propagators
3194
- // older propagators may not have fields function, null check to be sure
3195
- .map(function (p) { return (typeof p.fields === 'function' ? p.fields() : []); })
3196
- .reduce(function (x, y) { return x.concat(y); }, [])));
3156
+ var CompositePropagator = /** @class */function () {
3157
+ /**
3158
+ * Construct a composite propagator from a list of propagators.
3159
+ *
3160
+ * @param [config] Configuration object for composite propagator
3161
+ */
3162
+ function CompositePropagator(config) {
3163
+ if (config === void 0) {
3164
+ config = {};
3197
3165
  }
3198
- /**
3199
- * Run each of the configured propagators with the given context and carrier.
3200
- * Propagators are run in the order they are configured, so if multiple
3201
- * propagators write the same carrier key, the propagator later in the list
3202
- * will "win".
3203
- *
3204
- * @param context Context to inject
3205
- * @param carrier Carrier into which context will be injected
3206
- */
3207
- CompositePropagator.prototype.inject = function (context, carrier, setter) {
3208
- var e_1, _a;
3166
+ var _a;
3167
+ this._propagators = (_a = config.propagators) !== null && _a !== void 0 ? _a : [];
3168
+ this._fields = Array.from(new Set(this._propagators
3169
+ // older propagators may not have fields function, null check to be sure
3170
+ .map(function (p) {
3171
+ return typeof p.fields === 'function' ? p.fields() : [];
3172
+ }).reduce(function (x, y) {
3173
+ return x.concat(y);
3174
+ }, [])));
3175
+ }
3176
+ /**
3177
+ * Run each of the configured propagators with the given context and carrier.
3178
+ * Propagators are run in the order they are configured, so if multiple
3179
+ * propagators write the same carrier key, the propagator later in the list
3180
+ * will "win".
3181
+ *
3182
+ * @param context Context to inject
3183
+ * @param carrier Carrier into which context will be injected
3184
+ */
3185
+ CompositePropagator.prototype.inject = function (context, carrier, setter) {
3186
+ var e_1, _a;
3187
+ try {
3188
+ for (var _b = __values(this._propagators), _c = _b.next(); !_c.done; _c = _b.next()) {
3189
+ var propagator = _c.value;
3209
3190
  try {
3210
- for (var _b = __values(this._propagators), _c = _b.next(); !_c.done; _c = _b.next()) {
3211
- var propagator = _c.value;
3212
- try {
3213
- propagator.inject(context, carrier, setter);
3214
- }
3215
- catch (err) {
3216
- diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
3217
- }
3218
- }
3191
+ propagator.inject(context, carrier, setter);
3192
+ } catch (err) {
3193
+ diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
3219
3194
  }
3220
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
3221
- finally {
3222
- try {
3223
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3224
- }
3225
- finally { if (e_1) throw e_1.error; }
3226
- }
3227
- };
3228
- /**
3229
- * Run each of the configured propagators with the given context and carrier.
3230
- * Propagators are run in the order they are configured, so if multiple
3231
- * propagators write the same context key, the propagator later in the list
3232
- * will "win".
3233
- *
3234
- * @param context Context to add values to
3235
- * @param carrier Carrier from which to extract context
3236
- */
3237
- CompositePropagator.prototype.extract = function (context, carrier, getter) {
3238
- return this._propagators.reduce(function (ctx, propagator) {
3239
- try {
3240
- return propagator.extract(ctx, carrier, getter);
3241
- }
3242
- catch (err) {
3243
- diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
3244
- }
3245
- return ctx;
3246
- }, context);
3247
- };
3248
- CompositePropagator.prototype.fields = function () {
3249
- // return a new array so our fields cannot be modified
3250
- return this._fields.slice();
3251
- };
3252
- return CompositePropagator;
3253
- }());
3195
+ }
3196
+ } catch (e_1_1) {
3197
+ e_1 = {
3198
+ error: e_1_1
3199
+ };
3200
+ } finally {
3201
+ try {
3202
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3203
+ } finally {
3204
+ if (e_1) throw e_1.error;
3205
+ }
3206
+ }
3207
+ };
3208
+ /**
3209
+ * Run each of the configured propagators with the given context and carrier.
3210
+ * Propagators are run in the order they are configured, so if multiple
3211
+ * propagators write the same context key, the propagator later in the list
3212
+ * will "win".
3213
+ *
3214
+ * @param context Context to add values to
3215
+ * @param carrier Carrier from which to extract context
3216
+ */
3217
+ CompositePropagator.prototype.extract = function (context, carrier, getter) {
3218
+ return this._propagators.reduce(function (ctx, propagator) {
3219
+ try {
3220
+ return propagator.extract(ctx, carrier, getter);
3221
+ } catch (err) {
3222
+ diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
3223
+ }
3224
+ return ctx;
3225
+ }, context);
3226
+ };
3227
+ CompositePropagator.prototype.fields = function () {
3228
+ // return a new array so our fields cannot be modified
3229
+ return this._fields.slice();
3230
+ };
3231
+ return CompositePropagator;
3232
+ }();
3254
3233
 
3255
3234
  /*
3256
3235
  * Copyright The OpenTelemetry Authors
@@ -3282,15 +3261,14 @@ var INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;
3282
3261
  * see https://www.w3.org/TR/trace-context/#key
3283
3262
  */
3284
3263
  function validateKey(key) {
3285
- return VALID_KEY_REGEX.test(key);
3264
+ return VALID_KEY_REGEX.test(key);
3286
3265
  }
3287
3266
  /**
3288
3267
  * Value is opaque string up to 256 characters printable ASCII RFC0020
3289
3268
  * characters (i.e., the range 0x20 to 0x7E) except comma , and =.
3290
3269
  */
3291
3270
  function validateValue(value) {
3292
- return (VALID_VALUE_BASE_REGEX.test(value) &&
3293
- !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value));
3271
+ return VALID_VALUE_BASE_REGEX.test(value) && !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value);
3294
3272
  }
3295
3273
 
3296
3274
  /*
@@ -3321,74 +3299,67 @@ var LIST_MEMBER_KEY_VALUE_SPLITTER = '=';
3321
3299
  * - The value of any key can be updated. Modified keys MUST be moved to the
3322
3300
  * beginning of the list.
3323
3301
  */
3324
- var TraceState = /** @class */ (function () {
3325
- function TraceState(rawTraceState) {
3326
- this._internalState = new Map();
3327
- if (rawTraceState)
3328
- this._parse(rawTraceState);
3302
+ var TraceState = /** @class */function () {
3303
+ function TraceState(rawTraceState) {
3304
+ this._internalState = new Map();
3305
+ if (rawTraceState) this._parse(rawTraceState);
3306
+ }
3307
+ TraceState.prototype.set = function (key, value) {
3308
+ // TODO: Benchmark the different approaches(map vs list) and
3309
+ // use the faster one.
3310
+ var traceState = this._clone();
3311
+ if (traceState._internalState.has(key)) {
3312
+ traceState._internalState.delete(key);
3329
3313
  }
3330
- TraceState.prototype.set = function (key, value) {
3331
- // TODO: Benchmark the different approaches(map vs list) and
3332
- // use the faster one.
3333
- var traceState = this._clone();
3334
- if (traceState._internalState.has(key)) {
3335
- traceState._internalState.delete(key);
3336
- }
3337
- traceState._internalState.set(key, value);
3338
- return traceState;
3339
- };
3340
- TraceState.prototype.unset = function (key) {
3341
- var traceState = this._clone();
3342
- traceState._internalState.delete(key);
3343
- return traceState;
3344
- };
3345
- TraceState.prototype.get = function (key) {
3346
- return this._internalState.get(key);
3347
- };
3348
- TraceState.prototype.serialize = function () {
3349
- var _this = this;
3350
- return this._keys()
3351
- .reduce(function (agg, key) {
3352
- agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + _this.get(key));
3353
- return agg;
3354
- }, [])
3355
- .join(LIST_MEMBERS_SEPARATOR);
3356
- };
3357
- TraceState.prototype._parse = function (rawTraceState) {
3358
- if (rawTraceState.length > MAX_TRACE_STATE_LEN)
3359
- return;
3360
- this._internalState = rawTraceState
3361
- .split(LIST_MEMBERS_SEPARATOR)
3362
- .reverse() // Store in reverse so new keys (.set(...)) will be placed at the beginning
3363
- .reduce(function (agg, part) {
3364
- var listMember = part.trim(); // Optional Whitespace (OWS) handling
3365
- var i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);
3366
- if (i !== -1) {
3367
- var key = listMember.slice(0, i);
3368
- var value = listMember.slice(i + 1, part.length);
3369
- if (validateKey(key) && validateValue(value)) {
3370
- agg.set(key, value);
3371
- }
3372
- }
3373
- return agg;
3374
- }, new Map());
3375
- // Because of the reverse() requirement, trunc must be done after map is created
3376
- if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {
3377
- this._internalState = new Map(Array.from(this._internalState.entries())
3378
- .reverse() // Use reverse same as original tracestate parse chain
3379
- .slice(0, MAX_TRACE_STATE_ITEMS));
3314
+ traceState._internalState.set(key, value);
3315
+ return traceState;
3316
+ };
3317
+ TraceState.prototype.unset = function (key) {
3318
+ var traceState = this._clone();
3319
+ traceState._internalState.delete(key);
3320
+ return traceState;
3321
+ };
3322
+ TraceState.prototype.get = function (key) {
3323
+ return this._internalState.get(key);
3324
+ };
3325
+ TraceState.prototype.serialize = function () {
3326
+ var _this = this;
3327
+ return this._keys().reduce(function (agg, key) {
3328
+ agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + _this.get(key));
3329
+ return agg;
3330
+ }, []).join(LIST_MEMBERS_SEPARATOR);
3331
+ };
3332
+ TraceState.prototype._parse = function (rawTraceState) {
3333
+ if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;
3334
+ this._internalState = rawTraceState.split(LIST_MEMBERS_SEPARATOR).reverse() // Store in reverse so new keys (.set(...)) will be placed at the beginning
3335
+ .reduce(function (agg, part) {
3336
+ var listMember = part.trim(); // Optional Whitespace (OWS) handling
3337
+ var i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);
3338
+ if (i !== -1) {
3339
+ var key = listMember.slice(0, i);
3340
+ var value = listMember.slice(i + 1, part.length);
3341
+ if (validateKey(key) && validateValue(value)) {
3342
+ agg.set(key, value);
3380
3343
  }
3381
- };
3382
- TraceState.prototype._keys = function () {
3383
- return Array.from(this._internalState.keys()).reverse();
3384
- };
3385
- TraceState.prototype._clone = function () {
3386
- var traceState = new TraceState();
3387
- traceState._internalState = new Map(this._internalState);
3388
- return traceState;
3389
- };
3390
- return TraceState;
3391
- }());
3344
+ }
3345
+ return agg;
3346
+ }, new Map());
3347
+ // Because of the reverse() requirement, trunc must be done after map is created
3348
+ if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {
3349
+ this._internalState = new Map(Array.from(this._internalState.entries()).reverse() // Use reverse same as original tracestate parse chain
3350
+ .slice(0, MAX_TRACE_STATE_ITEMS));
3351
+ }
3352
+ };
3353
+ TraceState.prototype._keys = function () {
3354
+ return Array.from(this._internalState.keys()).reverse();
3355
+ };
3356
+ TraceState.prototype._clone = function () {
3357
+ var traceState = new TraceState();
3358
+ traceState._internalState = new Map(this._internalState);
3359
+ return traceState;
3360
+ };
3361
+ return TraceState;
3362
+ }();
3392
3363
 
3393
3364
  /*
3394
3365
  * Copyright The OpenTelemetry Authors
@@ -3424,19 +3395,17 @@ var TRACE_PARENT_REGEX = new RegExp("^\\s?(" + VERSION_PART + ")-(" + TRACE_ID_P
3424
3395
  * For more information see {@link https://www.w3.org/TR/trace-context/}
3425
3396
  */
3426
3397
  function parseTraceParent(traceParent) {
3427
- var match = TRACE_PARENT_REGEX.exec(traceParent);
3428
- if (!match)
3429
- return null;
3430
- // According to the specification the implementation should be compatible
3431
- // with future versions. If there are more parts, we only reject it if it's using version 00
3432
- // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent
3433
- if (match[1] === '00' && match[5])
3434
- return null;
3435
- return {
3436
- traceId: match[2],
3437
- spanId: match[3],
3438
- traceFlags: parseInt(match[4], 16),
3439
- };
3398
+ var match = TRACE_PARENT_REGEX.exec(traceParent);
3399
+ if (!match) return null;
3400
+ // According to the specification the implementation should be compatible
3401
+ // with future versions. If there are more parts, we only reject it if it's using version 00
3402
+ // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent
3403
+ if (match[1] === '00' && match[5]) return null;
3404
+ return {
3405
+ traceId: match[2],
3406
+ spanId: match[3],
3407
+ traceFlags: parseInt(match[4], 16)
3408
+ };
3440
3409
  }
3441
3410
  /**
3442
3411
  * Propagates {@link SpanContext} through Trace Context format propagation.
@@ -3444,61 +3413,50 @@ function parseTraceParent(traceParent) {
3444
3413
  * Based on the Trace Context specification:
3445
3414
  * https://www.w3.org/TR/trace-context/
3446
3415
  */
3447
- var W3CTraceContextPropagator = /** @class */ (function () {
3448
- function W3CTraceContextPropagator() {
3416
+ var W3CTraceContextPropagator = /** @class */function () {
3417
+ function W3CTraceContextPropagator() {}
3418
+ W3CTraceContextPropagator.prototype.inject = function (context, carrier, setter) {
3419
+ var spanContext = trace.getSpanContext(context);
3420
+ if (!spanContext || isTracingSuppressed(context) || !isSpanContextValid(spanContext)) return;
3421
+ var traceParent = VERSION + "-" + spanContext.traceId + "-" + spanContext.spanId + "-0" + Number(spanContext.traceFlags || TraceFlags.NONE).toString(16);
3422
+ setter.set(carrier, TRACE_PARENT_HEADER, traceParent);
3423
+ if (spanContext.traceState) {
3424
+ setter.set(carrier, TRACE_STATE_HEADER, spanContext.traceState.serialize());
3449
3425
  }
3450
- W3CTraceContextPropagator.prototype.inject = function (context, carrier, setter) {
3451
- var spanContext = trace.getSpanContext(context);
3452
- if (!spanContext ||
3453
- isTracingSuppressed(context) ||
3454
- !isSpanContextValid(spanContext))
3455
- return;
3456
- var traceParent = VERSION + "-" + spanContext.traceId + "-" + spanContext.spanId + "-0" + Number(spanContext.traceFlags || TraceFlags.NONE).toString(16);
3457
- setter.set(carrier, TRACE_PARENT_HEADER, traceParent);
3458
- if (spanContext.traceState) {
3459
- setter.set(carrier, TRACE_STATE_HEADER, spanContext.traceState.serialize());
3460
- }
3461
- };
3462
- W3CTraceContextPropagator.prototype.extract = function (context, carrier, getter) {
3463
- var traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);
3464
- if (!traceParentHeader)
3465
- return context;
3466
- var traceParent = Array.isArray(traceParentHeader)
3467
- ? traceParentHeader[0]
3468
- : traceParentHeader;
3469
- if (typeof traceParent !== 'string')
3470
- return context;
3471
- var spanContext = parseTraceParent(traceParent);
3472
- if (!spanContext)
3473
- return context;
3474
- spanContext.isRemote = true;
3475
- var traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);
3476
- if (traceStateHeader) {
3477
- // If more than one `tracestate` header is found, we merge them into a
3478
- // single header.
3479
- var state = Array.isArray(traceStateHeader)
3480
- ? traceStateHeader.join(',')
3481
- : traceStateHeader;
3482
- spanContext.traceState = new TraceState(typeof state === 'string' ? state : undefined);
3483
- }
3484
- return trace.setSpanContext(context, spanContext);
3485
- };
3486
- W3CTraceContextPropagator.prototype.fields = function () {
3487
- return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];
3488
- };
3489
- return W3CTraceContextPropagator;
3490
- }());
3426
+ };
3427
+ W3CTraceContextPropagator.prototype.extract = function (context, carrier, getter) {
3428
+ var traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);
3429
+ if (!traceParentHeader) return context;
3430
+ var traceParent = Array.isArray(traceParentHeader) ? traceParentHeader[0] : traceParentHeader;
3431
+ if (typeof traceParent !== 'string') return context;
3432
+ var spanContext = parseTraceParent(traceParent);
3433
+ if (!spanContext) return context;
3434
+ spanContext.isRemote = true;
3435
+ var traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);
3436
+ if (traceStateHeader) {
3437
+ // If more than one `tracestate` header is found, we merge them into a
3438
+ // single header.
3439
+ var state = Array.isArray(traceStateHeader) ? traceStateHeader.join(',') : traceStateHeader;
3440
+ spanContext.traceState = new TraceState(typeof state === 'string' ? state : undefined);
3441
+ }
3442
+ return trace.setSpanContext(context, spanContext);
3443
+ };
3444
+ W3CTraceContextPropagator.prototype.fields = function () {
3445
+ return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];
3446
+ };
3447
+ return W3CTraceContextPropagator;
3448
+ }();
3491
3449
 
3492
- var _a;
3450
+ var _a$1;
3493
3451
  var MAX_RUM_EVENTS_PER_REQUEST = 500;
3494
3452
  var MAX_RUM_EVENTS = 20000;
3495
3453
  var MAX_MS_RECORD_TIME = 60000;
3496
3454
  var DEFAULT_RUM_EVENTS = 5000;
3497
3455
  var DEFAULT_MS_RECORD_TIME = 10000;
3498
3456
  ({
3499
- instrumentationsToSend: (_a = {},
3500
- _a[CoralogixEventType.WEB_VITALS] = true,
3501
- _a),
3457
+ instrumentationsToSend: (_a$1 = {},
3458
+ _a$1[CoralogixEventType.WEB_VITALS] = true,
3459
+ _a$1),
3502
3460
  });
3503
3461
 
3504
3462
  var Request = /** @class */ (function () {
@@ -3771,6 +3729,38 @@ var SessionIdle = /** @class */ (function () {
3771
3729
  return SessionIdle;
3772
3730
  }());
3773
3731
 
3732
+ var _a;
3733
+ var instrumentationsCompatibility = (_a = {},
3734
+ _a[XHR_INSTRUMENTATION_NAME] = {
3735
+ browsers: [
3736
+ { name: 'Chrome', minVersion: 43 }
3737
+ ],
3738
+ warningText: 'XHR',
3739
+ },
3740
+ _a[SESSION_RECORDING_INSTRUMENTATION_NAME] = {
3741
+ browsers: [
3742
+ { name: 'Chrome', minVersion: 45 },
3743
+ ],
3744
+ warningText: 'Session Recording',
3745
+ },
3746
+ _a);
3747
+ function isInstrumentationCompatible(confKey) {
3748
+ var _a = parseUserAgent(navigator.userAgent), browserVersion = _a.browserVersion, browser = _a.browser;
3749
+ var majorVersion = parseInt(browserVersion.split('.')[0]);
3750
+ var compatibility = instrumentationsCompatibility[confKey];
3751
+ if (!compatibility)
3752
+ return true;
3753
+ var matchedBrowser = compatibility.browsers.find(function (compatibleBrowser) { return compatibleBrowser.name === browser; });
3754
+ if (!matchedBrowser) {
3755
+ return true;
3756
+ }
3757
+ if (!isNaN(majorVersion) && majorVersion < matchedBrowser.minVersion) {
3758
+ console.debug("Coralogix Browser SDK - ".concat(compatibility.warningText, " is not supported on this browser"));
3759
+ return false;
3760
+ }
3761
+ return true;
3762
+ }
3763
+
3774
3764
  var SessionManager = /** @class */ (function (_super) {
3775
3765
  __extends(SessionManager, _super);
3776
3766
  function SessionManager(recordConfig) {
@@ -3923,7 +3913,7 @@ var SessionManager = /** @class */ (function (_super) {
3923
3913
  };
3924
3914
  SessionManager.prototype.initializeSession = function (recordConfig) {
3925
3915
  return __awaiter(this, void 0, void 0, function () {
3926
- var recordingSamplingEnabled, SessionRecorder_1;
3916
+ var recordingSamplingEnabled, isSessionRecordingCompatible, SessionRecorder_1;
3927
3917
  return __generator(this, function (_a) {
3928
3918
  switch (_a.label) {
3929
3919
  case 0:
@@ -3931,7 +3921,8 @@ var SessionManager = /** @class */ (function (_super) {
3931
3921
  this.sessionRecorderConfig = recordConfig;
3932
3922
  if (!(recordConfig === null || recordConfig === void 0 ? void 0 : recordConfig.enable)) return [3 /*break*/, 3];
3933
3923
  recordingSamplingEnabled = isSamplingOn(recordConfig.sessionRecordingSampleRate);
3934
- if (!recordingSamplingEnabled) return [3 /*break*/, 2];
3924
+ isSessionRecordingCompatible = isInstrumentationCompatible(SESSION_RECORDING_INSTRUMENTATION_NAME);
3925
+ if (!(recordingSamplingEnabled && isSessionRecordingCompatible)) return [3 /*break*/, 2];
3935
3926
  return [4 /*yield*/, import('./sessionRecorder.esm.js')];
3936
3927
  case 1:
3937
3928
  SessionRecorder_1 = (_a.sent()).SessionRecorder;
@@ -4143,7 +4134,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
4143
4134
  return resolvedUrlBlueprinters;
4144
4135
  }
4145
4136
 
4146
- var SDK_VERSION = '2.4.1';
4137
+ var SDK_VERSION = '2.6.0';
4147
4138
 
4148
4139
  function shouldDropEvent(cxRumEvent, options) {
4149
4140
  if (isDocumentErrorWithoutMessage(cxRumEvent)) {
@@ -4659,139 +4650,151 @@ var CoralogixRum = {
4659
4650
  },
4660
4651
  init: function (options) {
4661
4652
  var _a, _b;
4662
- // Check if CoralogixRum already inited.
4663
- if (isInited) {
4664
- console.warn('CoralogixRum already inited.');
4665
- return;
4666
- }
4667
- // Abort if not in browser environment.
4668
- if (!CxGlobal.sessionStorage) {
4669
- console.warn('CoralogixRum: Non-browser environment detected, aborting');
4670
- return;
4671
- }
4672
- // Abort if running in a not supported browser.
4673
- if (typeof Symbol !== 'function') {
4674
- console.warn('CoralogixRum: browser not supported, disabling instrumentation.');
4675
- return;
4676
- }
4677
- var resolvedOptions = validateAndResolveInitConfig(options);
4678
- if (!resolvedOptions) {
4679
- return;
4680
- }
4681
- CxGlobal[SDK_CONFIG_KEY] = resolvedOptions;
4682
- var sampler = getResolvedSampler(resolvedOptions);
4683
- // Check if not in debug mode & no auth token.
4684
- if (!resolvedOptions.debug && !resolvedOptions.public_key) {
4685
- console.warn('rumAuth will be required in the future');
4686
- }
4687
- timeMeasurementTracker = new TimeMeasurementTracker();
4688
- new SessionManager(resolvedOptions.sessionRecordingConfig).start();
4689
- var ignoreUrls = resolvedOptions.ignoreUrls, labels = resolvedOptions.labels, user_context = resolvedOptions.user_context, application = resolvedOptions.application, version = resolvedOptions.version, traceParentInHeader = resolvedOptions.traceParentInHeader, environment = resolvedOptions.environment;
4690
- tracerProvider = new CoralogixWebTracerProvider({
4691
- sampler: sampler,
4692
- });
4693
- var pluginDefaults = {};
4694
- // Resolve instrumentations.
4695
- var instrumentations = INSTRUMENTATIONS.map(function (_a) {
4696
- var _b, _c;
4697
- var Instrument = _a.Instrument, confKey = _a.confKey, disable = _a.disable;
4698
- var pluginConf = getInstrumentationConfig((_b = resolvedOptions === null || resolvedOptions === void 0 ? void 0 : resolvedOptions.instrumentations) === null || _b === void 0 ? void 0 : _b[confKey], pluginDefaults, disable);
4699
- if (pluginConf) {
4700
- var instrumentation = void 0;
4701
- switch (confKey) {
4702
- case 'errors': {
4703
- instrumentation = new Instrument(pluginConf);
4704
- errorsInstrumentation =
4705
- instrumentation;
4706
- break;
4707
- }
4708
- case 'fetch':
4709
- case 'xhr': {
4710
- instrumentation = new Instrument(__assign(__assign({}, pluginConf), { ignoreUrls: ignoreUrls, traceParentInHeader: traceParentInHeader }));
4711
- break;
4712
- }
4713
- case INTERNAL_INSTRUMENTATION_NAME: {
4714
- instrumentation = new Instrument(pluginConf);
4715
- saveInternalRumData(INTERNAL_INSTRUMENTATION_NAME, instrumentation);
4716
- break;
4717
- }
4718
- case SCREENSHOT_INSTRUMENTATION_NAME: {
4719
- if ((_c = resolvedOptions.sessionRecordingConfig) === null || _c === void 0 ? void 0 : _c.enable) {
4653
+ try {
4654
+ // Check if CoralogixRum already inited.
4655
+ if (isInited) {
4656
+ console.warn('CoralogixRum already inited.');
4657
+ return;
4658
+ }
4659
+ // Abort if not in browser environment.
4660
+ if (!CxGlobal.sessionStorage) {
4661
+ console.warn('CoralogixRum: Non-browser environment detected, aborting');
4662
+ return;
4663
+ }
4664
+ // Abort if running in a not supported browser.
4665
+ if (typeof Symbol !== 'function') {
4666
+ console.warn('CoralogixRum: browser not supported, disabling instrumentation.');
4667
+ return;
4668
+ }
4669
+ var resolvedOptions_1 = validateAndResolveInitConfig(options);
4670
+ if (!resolvedOptions_1) {
4671
+ return;
4672
+ }
4673
+ CxGlobal[SDK_CONFIG_KEY] = resolvedOptions_1;
4674
+ var sampler = getResolvedSampler(resolvedOptions_1);
4675
+ // Check if not in debug mode & no auth token.
4676
+ if (!resolvedOptions_1.debug && !resolvedOptions_1.public_key) {
4677
+ console.warn('rumAuth will be required in the future');
4678
+ }
4679
+ timeMeasurementTracker = new TimeMeasurementTracker();
4680
+ new SessionManager(resolvedOptions_1.sessionRecordingConfig).start();
4681
+ var ignoreUrls_1 = resolvedOptions_1.ignoreUrls, labels = resolvedOptions_1.labels, user_context = resolvedOptions_1.user_context, application = resolvedOptions_1.application, version = resolvedOptions_1.version, traceParentInHeader_1 = resolvedOptions_1.traceParentInHeader, environment = resolvedOptions_1.environment;
4682
+ tracerProvider = new CoralogixWebTracerProvider({
4683
+ sampler: sampler,
4684
+ });
4685
+ var pluginDefaults_1 = {};
4686
+ // Resolve instrumentations.
4687
+ var instrumentations = INSTRUMENTATIONS.map(function (_a) {
4688
+ var _b, _c;
4689
+ var Instrument = _a.Instrument, confKey = _a.confKey, disable = _a.disable;
4690
+ var pluginConf = getInstrumentationConfig((_b = resolvedOptions_1 === null || resolvedOptions_1 === void 0 ? void 0 : resolvedOptions_1.instrumentations) === null || _b === void 0 ? void 0 : _b[confKey], pluginDefaults_1, disable);
4691
+ if (pluginConf) {
4692
+ var instrumentation = void 0;
4693
+ switch (confKey) {
4694
+ case ERROR_INSTRUMENTATION_NAME: {
4720
4695
  instrumentation = new Instrument(pluginConf);
4721
- screenshotInstrumentation =
4696
+ errorsInstrumentation =
4722
4697
  instrumentation;
4698
+ break;
4723
4699
  }
4724
- break;
4725
- }
4726
- case MEMORY_USAGE_INSTRUMENTATION_NAME: {
4727
- if (resolvedOptions.memoryUsageConfig.enabled &&
4728
- isMeasureUserAgentSpecificMemoryAllowed()) {
4700
+ case FETCH_INSTRUMENTATION_NAME:
4701
+ case XHR_INSTRUMENTATION_NAME: {
4702
+ if (confKey === XHR_INSTRUMENTATION_NAME) {
4703
+ var isXhrCompatible = isInstrumentationCompatible(XHR_INSTRUMENTATION_NAME);
4704
+ if (!isXhrCompatible) {
4705
+ return;
4706
+ }
4707
+ }
4708
+ instrumentation = new Instrument(__assign(__assign({}, pluginConf), { ignoreUrls: ignoreUrls_1, traceParentInHeader: traceParentInHeader_1 }));
4709
+ break;
4710
+ }
4711
+ case INTERNAL_INSTRUMENTATION_NAME: {
4729
4712
  instrumentation = new Instrument(pluginConf);
4730
- memoryUsageInstrumentation =
4731
- instrumentation;
4713
+ saveInternalRumData(INTERNAL_INSTRUMENTATION_NAME, instrumentation);
4714
+ break;
4732
4715
  }
4733
- break;
4716
+ case SCREENSHOT_INSTRUMENTATION_NAME: {
4717
+ if ((_c = resolvedOptions_1.sessionRecordingConfig) === null || _c === void 0 ? void 0 : _c.enable) {
4718
+ instrumentation = new Instrument(pluginConf);
4719
+ screenshotInstrumentation =
4720
+ instrumentation;
4721
+ }
4722
+ break;
4723
+ }
4724
+ case MEMORY_USAGE_INSTRUMENTATION_NAME: {
4725
+ if (resolvedOptions_1.memoryUsageConfig.enabled &&
4726
+ isMeasureUserAgentSpecificMemoryAllowed()) {
4727
+ instrumentation = new Instrument(pluginConf);
4728
+ memoryUsageInstrumentation =
4729
+ instrumentation;
4730
+ }
4731
+ break;
4732
+ }
4733
+ default:
4734
+ instrumentation = new Instrument(pluginConf);
4734
4735
  }
4735
- default:
4736
- instrumentation = new Instrument(pluginConf);
4737
- }
4738
- if (instrumentation instanceof CoralogixCustomLogInstrumentation) {
4739
- _customInstrumentation = instrumentation;
4740
- }
4741
- if (instrumentation instanceof CoralogixCustomMeasurementInstrumentation) {
4742
- customMeasurementInstrumentation = instrumentation;
4736
+ if (instrumentation instanceof CoralogixCustomLogInstrumentation) {
4737
+ _customInstrumentation = instrumentation;
4738
+ }
4739
+ if (instrumentation instanceof
4740
+ CoralogixCustomMeasurementInstrumentation) {
4741
+ customMeasurementInstrumentation = instrumentation;
4742
+ }
4743
+ return instrumentation;
4743
4744
  }
4744
- return instrumentation;
4745
+ return null;
4746
+ }).filter(function (instrument) {
4747
+ return Boolean(instrument);
4748
+ });
4749
+ var mergedUserContext = __assign(__assign({}, OPTIONS_DEFAULTS.user_context), user_context);
4750
+ // Init Span Attributes Processor.
4751
+ attributesProcessor = new CoralogixSpanAttributesProcessor(__assign((_a = {}, _a[CoralogixAttributes.APPLICATION_CONTEXT] = JSON.stringify({
4752
+ application: application,
4753
+ version: version,
4754
+ }), _a[CoralogixAttributes.USER_CONTEXT] = JSON.stringify(mergedUserContext), _a), (environment
4755
+ ? (_b = {}, _b[CoralogixAttributes.ENVIRONMENT] = environment, _b) : {})));
4756
+ if (labels) {
4757
+ attributesProcessor.setCustomLabels(labels);
4745
4758
  }
4746
- return null;
4747
- }).filter(function (instrument) {
4748
- return Boolean(instrument);
4749
- });
4750
- var mergedUserContext = __assign(__assign({}, OPTIONS_DEFAULTS.user_context), user_context);
4751
- // Init Span Attributes Processor.
4752
- attributesProcessor = new CoralogixSpanAttributesProcessor(__assign((_a = {}, _a[CoralogixAttributes.APPLICATION_CONTEXT] = JSON.stringify({
4753
- application: application,
4754
- version: version,
4755
- }), _a[CoralogixAttributes.USER_CONTEXT] = JSON.stringify(mergedUserContext), _a), (environment
4756
- ? (_b = {}, _b[CoralogixAttributes.ENVIRONMENT] = environment, _b) : {})));
4757
- if (labels) {
4758
- attributesProcessor.setCustomLabels(labels);
4759
- }
4760
- setAttrProcessor(attributesProcessor);
4761
- // The order of processors is important.
4762
- tracerProvider.addSpanProcessor(attributesProcessor);
4763
- // Add Navigation Processor
4764
- navigationProcessor = new CoralogixNavigationProcessor();
4765
- tracerProvider.addSpanProcessor(navigationProcessor);
4766
- // Add Span Mapping Processor
4767
- spanMapProcessor = new CoralogixSpanMapProcessor();
4768
- tracerProvider.addSpanProcessor(spanMapProcessor);
4769
- // Add snapshot processor
4770
- new SnapshotManager();
4771
- snapshotProcessor = new CoralogixSnapshotSpanProcessor();
4772
- tracerProvider.addSpanProcessor(snapshotProcessor);
4773
- // Add Batch Span Processor and Exporter
4774
- tracerProvider.addSpanProcessor(new BatchSpanProcessor((exporter = new CoralogixExporter()), {
4775
- maxExportBatchSize: MAX_EXPORT_BATCH_SIZE,
4776
- scheduledDelayMillis: SCHEDULE_DELAY_MILLIS,
4777
- }));
4778
- handlePropagators(options, tracerProvider);
4779
- // Register Instrumentations
4780
- _deregisterInstrumentations = registerInstrumentations({
4781
- tracerProvider: tracerProvider,
4782
- instrumentations: instrumentations,
4783
- });
4784
- var _c = __read$1(partition(resolvedOptions.labelProviders || [], function (_a) {
4785
- var urlType = _a.urlType;
4786
- return urlType === UrlType.PAGE || !urlType;
4787
- }), 2), pageUrlLabelProviders = _c[0], networkUrlLabelProviders = _c[1];
4788
- saveInternalRumData(PAGE_URL_LABEL_PROVIDERS_KEY, pageUrlLabelProviders);
4789
- saveInternalRumData(NETWORK_URL_LABEL_PROVIDERS_KEY, networkUrlLabelProviders);
4790
- isInited = true;
4791
- if (options === null || options === void 0 ? void 0 : options.debug) {
4792
- console.info('CoralogixRum.init() complete');
4793
- }
4794
- reportInternalEvent('init');
4759
+ setAttrProcessor(attributesProcessor);
4760
+ // The order of processors is important.
4761
+ tracerProvider.addSpanProcessor(attributesProcessor);
4762
+ // Add Navigation Processor
4763
+ navigationProcessor = new CoralogixNavigationProcessor();
4764
+ tracerProvider.addSpanProcessor(navigationProcessor);
4765
+ // Add Span Mapping Processor
4766
+ spanMapProcessor = new CoralogixSpanMapProcessor();
4767
+ tracerProvider.addSpanProcessor(spanMapProcessor);
4768
+ // Add snapshot processor
4769
+ new SnapshotManager();
4770
+ snapshotProcessor = new CoralogixSnapshotSpanProcessor();
4771
+ tracerProvider.addSpanProcessor(snapshotProcessor);
4772
+ // Add Batch Span Processor and Exporter
4773
+ tracerProvider.addSpanProcessor(new BatchSpanProcessor((exporter = new CoralogixExporter()), {
4774
+ maxExportBatchSize: MAX_EXPORT_BATCH_SIZE,
4775
+ scheduledDelayMillis: SCHEDULE_DELAY_MILLIS,
4776
+ }));
4777
+ handlePropagators(options, tracerProvider);
4778
+ // Register Instrumentations
4779
+ _deregisterInstrumentations = registerInstrumentations({
4780
+ tracerProvider: tracerProvider,
4781
+ instrumentations: instrumentations,
4782
+ });
4783
+ var _c = __read$1(partition(resolvedOptions_1.labelProviders || [], function (_a) {
4784
+ var urlType = _a.urlType;
4785
+ return urlType === UrlType.PAGE || !urlType;
4786
+ }), 2), pageUrlLabelProviders = _c[0], networkUrlLabelProviders = _c[1];
4787
+ saveInternalRumData(PAGE_URL_LABEL_PROVIDERS_KEY, pageUrlLabelProviders);
4788
+ saveInternalRumData(NETWORK_URL_LABEL_PROVIDERS_KEY, networkUrlLabelProviders);
4789
+ isInited = true;
4790
+ if (options === null || options === void 0 ? void 0 : options.debug) {
4791
+ console.info('Coralogix Browser SDK - initialization has completed');
4792
+ }
4793
+ reportInternalEvent('init');
4794
+ }
4795
+ catch (err) {
4796
+ console.warn('Coralogix Browser SDK - initialization failed: ', err);
4797
+ }
4795
4798
  },
4796
4799
  getCustomTracer: function (ignoredList) {
4797
4800
  var _a, _b;