o11y 242.3.3 → 242.8.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.
Files changed (101) hide show
  1. package/dist/modules/o11y/client/client.js +201 -159
  2. package/dist/modules/o11y/client/client.js.map +1 -1
  3. package/dist/modules/o11y/client/interfaces/InstrumentationContext.d.ts +1 -0
  4. package/dist/modules/o11y/client/library/AppInstrumentationImpl.d.ts +1 -1
  5. package/dist/modules/o11y/client/library/AutomaticClickTracker.d.ts +7 -7
  6. package/dist/modules/o11y/client/library/IdleDetectorImpl.d.ts +8 -8
  7. package/dist/modules/o11y/client/library/InstrumentationImpl.d.ts +1 -1
  8. package/dist/modules/o11y/client/library/LogValidator.d.ts +5 -5
  9. package/dist/modules/o11y/client/library/MockObj.d.ts +3 -0
  10. package/dist/modules/o11y/client/library/NextgenImpl.d.ts +3 -3
  11. package/dist/modules/o11y/client/library/Tracing.d.ts +2 -2
  12. package/dist/modules/o11y/client/shared/SchemaUtil.d.ts +1 -1
  13. package/dist/modules/o11y/client/shared/Utility.d.ts +1 -1
  14. package/dist/modules/o11y/client/test/MockMouseEvent.d.ts +47 -0
  15. package/dist/modules/o11y/client/test/TestEnvironment.d.ts +7 -0
  16. package/dist/modules/o11y/client/version.d.ts +1 -1
  17. package/dist/modules/o11y/collectors/collectors.js +4 -1
  18. package/dist/modules/o11y/collectors/collectors.js.map +1 -1
  19. package/dist/modules/o11y/collectors/interfaces/InstrumentationContext.d.ts +1 -0
  20. package/dist/modules/o11y/collectors/library/AppInstrumentationImpl.d.ts +1 -1
  21. package/dist/modules/o11y/collectors/library/AutomaticClickTracker.d.ts +7 -7
  22. package/dist/modules/o11y/collectors/library/IdleDetectorImpl.d.ts +8 -8
  23. package/dist/modules/o11y/collectors/library/InstrumentationImpl.d.ts +1 -1
  24. package/dist/modules/o11y/collectors/library/LogValidator.d.ts +5 -5
  25. package/dist/modules/o11y/collectors/library/MockObj.d.ts +3 -0
  26. package/dist/modules/o11y/collectors/library/NextgenImpl.d.ts +3 -3
  27. package/dist/modules/o11y/collectors/library/Tracing.d.ts +2 -2
  28. package/dist/modules/o11y/collectors/shared/SchemaUtil.d.ts +1 -1
  29. package/dist/modules/o11y/collectors/shared/Utility.d.ts +1 -1
  30. package/dist/modules/o11y/collectors/test/MockMouseEvent.d.ts +47 -0
  31. package/dist/modules/o11y/collectors/test/TestEnvironment.d.ts +7 -0
  32. package/dist/modules/o11y/collectors/version.d.ts +1 -1
  33. package/dist/modules/o11y/core_envelope/core_envelope.js +1 -1
  34. package/dist/modules/o11y/core_envelope/core_envelope.js.map +1 -1
  35. package/dist/modules/o11y/core_envelope/interfaces/InstrumentationContext.d.ts +1 -0
  36. package/dist/modules/o11y/core_envelope/library/AppInstrumentationImpl.d.ts +1 -1
  37. package/dist/modules/o11y/core_envelope/library/AutomaticClickTracker.d.ts +7 -7
  38. package/dist/modules/o11y/core_envelope/library/IdleDetectorImpl.d.ts +8 -8
  39. package/dist/modules/o11y/core_envelope/library/InstrumentationImpl.d.ts +1 -1
  40. package/dist/modules/o11y/core_envelope/library/LogValidator.d.ts +5 -5
  41. package/dist/modules/o11y/core_envelope/library/MockObj.d.ts +3 -0
  42. package/dist/modules/o11y/core_envelope/library/NextgenImpl.d.ts +3 -3
  43. package/dist/modules/o11y/core_envelope/library/Tracing.d.ts +2 -2
  44. package/dist/modules/o11y/core_envelope/shared/SchemaUtil.d.ts +1 -1
  45. package/dist/modules/o11y/core_envelope/shared/Utility.d.ts +1 -1
  46. package/dist/modules/o11y/core_envelope/test/MockMouseEvent.d.ts +47 -0
  47. package/dist/modules/o11y/core_envelope/test/TestEnvironment.d.ts +7 -0
  48. package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
  49. package/dist/modules/o11y/shared/interfaces/InstrumentationContext.d.ts +1 -0
  50. package/dist/modules/o11y/shared/library/AppInstrumentationImpl.d.ts +1 -1
  51. package/dist/modules/o11y/shared/library/AutomaticClickTracker.d.ts +7 -7
  52. package/dist/modules/o11y/shared/library/IdleDetectorImpl.d.ts +8 -8
  53. package/dist/modules/o11y/shared/library/InstrumentationImpl.d.ts +1 -1
  54. package/dist/modules/o11y/shared/library/LogValidator.d.ts +5 -5
  55. package/dist/modules/o11y/shared/library/MockObj.d.ts +3 -0
  56. package/dist/modules/o11y/shared/library/NextgenImpl.d.ts +3 -3
  57. package/dist/modules/o11y/shared/library/Tracing.d.ts +2 -2
  58. package/dist/modules/o11y/shared/shared/SchemaUtil.d.ts +1 -1
  59. package/dist/modules/o11y/shared/shared/Utility.d.ts +1 -1
  60. package/dist/modules/o11y/shared/shared.js +11 -15
  61. package/dist/modules/o11y/shared/shared.js.map +1 -1
  62. package/dist/modules/o11y/shared/test/MockMouseEvent.d.ts +47 -0
  63. package/dist/modules/o11y/shared/test/TestEnvironment.d.ts +7 -0
  64. package/dist/modules/o11y/shared/version.d.ts +1 -1
  65. package/dist/modules/o11y/simple_collector/interfaces/InstrumentationContext.d.ts +1 -0
  66. package/dist/modules/o11y/simple_collector/library/AppInstrumentationImpl.d.ts +1 -1
  67. package/dist/modules/o11y/simple_collector/library/AutomaticClickTracker.d.ts +7 -7
  68. package/dist/modules/o11y/simple_collector/library/IdleDetectorImpl.d.ts +8 -8
  69. package/dist/modules/o11y/simple_collector/library/InstrumentationImpl.d.ts +1 -1
  70. package/dist/modules/o11y/simple_collector/library/LogValidator.d.ts +5 -5
  71. package/dist/modules/o11y/simple_collector/library/MockObj.d.ts +3 -0
  72. package/dist/modules/o11y/simple_collector/library/NextgenImpl.d.ts +3 -3
  73. package/dist/modules/o11y/simple_collector/library/Tracing.d.ts +2 -2
  74. package/dist/modules/o11y/simple_collector/shared/SchemaUtil.d.ts +1 -1
  75. package/dist/modules/o11y/simple_collector/shared/Utility.d.ts +1 -1
  76. package/dist/modules/o11y/simple_collector/simple_collector.js +2 -1
  77. package/dist/modules/o11y/simple_collector/simple_collector.js.map +1 -1
  78. package/dist/modules/o11y/simple_collector/test/MockMouseEvent.d.ts +47 -0
  79. package/dist/modules/o11y/simple_collector/test/TestEnvironment.d.ts +7 -0
  80. package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
  81. package/dist/modules/o11y/web_vitals/interfaces/InstrumentationContext.d.ts +1 -0
  82. package/dist/modules/o11y/web_vitals/library/AppInstrumentationImpl.d.ts +1 -1
  83. package/dist/modules/o11y/web_vitals/library/AutomaticClickTracker.d.ts +7 -7
  84. package/dist/modules/o11y/web_vitals/library/IdleDetectorImpl.d.ts +8 -8
  85. package/dist/modules/o11y/web_vitals/library/InstrumentationImpl.d.ts +1 -1
  86. package/dist/modules/o11y/web_vitals/library/LogValidator.d.ts +5 -5
  87. package/dist/modules/o11y/web_vitals/library/MockObj.d.ts +3 -0
  88. package/dist/modules/o11y/web_vitals/library/NextgenImpl.d.ts +3 -3
  89. package/dist/modules/o11y/web_vitals/library/Tracing.d.ts +2 -2
  90. package/dist/modules/o11y/web_vitals/shared/SchemaUtil.d.ts +1 -1
  91. package/dist/modules/o11y/web_vitals/shared/Utility.d.ts +1 -1
  92. package/dist/modules/o11y/web_vitals/test/MockMouseEvent.d.ts +47 -0
  93. package/dist/modules/o11y/web_vitals/test/TestEnvironment.d.ts +7 -0
  94. package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
  95. package/package.json +2 -2
  96. package/dist/modules/o11y/client/library/MockEvent.d.ts +0 -7
  97. package/dist/modules/o11y/collectors/library/MockEvent.d.ts +0 -7
  98. package/dist/modules/o11y/core_envelope/library/MockEvent.d.ts +0 -7
  99. package/dist/modules/o11y/shared/library/MockEvent.d.ts +0 -7
  100. package/dist/modules/o11y/simple_collector/library/MockEvent.d.ts +0 -7
  101. package/dist/modules/o11y/web_vitals/library/MockEvent.d.ts +0 -7
@@ -12,9 +12,9 @@ const headerParentSpanId = 'X-B3-ParentSpanId';
12
12
  const defaultActivityNameForFetch = 'fetch';
13
13
  const defaultActivityNameForXhrSend = 'xhr_send';
14
14
  class Tracing {
15
- constructor(instr) {
16
- this.instr = instr;
17
- utility.requireArgument(instr, 'instr', 'object');
15
+ constructor(_instr) {
16
+ this._instr = _instr;
17
+ utility.requireArgument(_instr, '_instr', 'object');
18
18
  }
19
19
  static _getB3CompactFormat(traceId, spanId, isSampled, parentSpanId) {
20
20
  let b3 = `${traceId}-${spanId}`;
@@ -49,8 +49,8 @@ class Tracing {
49
49
  static getHeaders(traceId, spanId, isSampled, options) {
50
50
  utility.requireArgument(traceId, 'traceId', 'string');
51
51
  utility.requireArgument(spanId, 'spanId', 'string');
52
- const useB3Headers = options && options.useB3Headers;
53
- traceId = this._conformTextAsId(traceId, options && options.traceIdEffectiveLength !== undefined
52
+ const useB3Headers = options === null || options === void 0 ? void 0 : options.useB3Headers;
53
+ traceId = this._conformTextAsId(traceId, (options === null || options === void 0 ? void 0 : options.traceIdEffectiveLength) !== undefined
54
54
  ? options.traceIdEffectiveLength
55
55
  : useB3Headers
56
56
  ? defaultTraceIdLengthB3
@@ -62,7 +62,7 @@ class Tracing {
62
62
  undefined;
63
63
  const headers = {};
64
64
  if (useB3Headers) {
65
- const isCompact = options && options.useCompactHeader;
65
+ const isCompact = options === null || options === void 0 ? void 0 : options.useCompactHeader;
66
66
  if (isCompact) {
67
67
  headers[headerB3] = this._getB3CompactFormat(traceId, spanId, isSampled, parentSpanId);
68
68
  }
@@ -210,7 +210,7 @@ class Tracing {
210
210
  if (options) {
211
211
  this._disableNetworkInstrumentation();
212
212
  const tracingOptions = typeof options === 'object' ? options : {};
213
- this._enableNetworkInstrumentation(utility.definedValueOrDefault(tracingOptions.instrumentation, this.instr), utility.definedValueOrDefault(tracingOptions.logErrors, true), tracingOptions.activityName, utility.definedValueOrDefault(tracingOptions.useTracing, true), tracingOptions.tracingHeadersOptions);
213
+ this._enableNetworkInstrumentation(utility.definedValueOrDefault(tracingOptions.instrumentation, this._instr), utility.definedValueOrDefault(tracingOptions.logErrors, true), tracingOptions.activityName, utility.definedValueOrDefault(tracingOptions.useTracing, true), tracingOptions.tracingHeadersOptions);
214
214
  }
215
215
  else {
216
216
  this._disableNetworkInstrumentation();
@@ -466,9 +466,10 @@ const activityNoOp = Object.freeze(new ActivityNoOp());
466
466
 
467
467
  class DomEventHelpers {
468
468
  getInstrumentedEventData(eventData, handledBy, userPayload) {
469
+ var _a;
469
470
  const instrumentedEvent = {
470
471
  ownerComponent: handledBy.tagName,
471
- parentComponent: (handledBy.parentElement && handledBy.parentElement.tagName) || undefined,
472
+ parentComponent: ((_a = handledBy.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) || undefined,
472
473
  event: eventData,
473
474
  simplePath: utility.getXpath(handledBy)
474
475
  };
@@ -554,6 +555,12 @@ class ValidationEntry {
554
555
  case 7:
555
556
  msg = 'Exceeded app limit for item count';
556
557
  break;
558
+ case 12:
559
+ msg = 'Value must be an integer';
560
+ break;
561
+ case 13:
562
+ msg = 'Values like null or undefined are not allowed for items in repeated fields';
563
+ break;
557
564
  default:
558
565
  msg = `Unknown error code: ${this.errorCode}`;
559
566
  break;
@@ -568,113 +575,146 @@ class LogValidator {
568
575
  const schemaId = schemaUtil.getSchemaId(schema);
569
576
  const errorInfos = new Array();
570
577
  const nestedSchema = schemaUtil.getTypes(schema);
571
- this.validateFields(errorInfos, [], data, nestedSchema[schemaTokens.message], nestedSchema, schemaId);
578
+ this._validateFields(errorInfos, [], data, nestedSchema[schemaTokens.message], nestedSchema, schemaId);
572
579
  if (errorInfos.length && !noThrow) {
573
580
  throw new Error(errorInfos[0].asMessage(schemaId));
574
581
  }
575
582
  return errorInfos;
576
583
  }
577
- validateFields(errorInfos, fieldNames, data, message, descriptor, schemaId) {
584
+ _validateFields(errorInfos, fieldNames, data, message, descriptor, schemaId) {
578
585
  const oneofs = message.oneofs || {};
579
586
  const fields = message.fields || {};
580
587
  for (const key in data) {
581
588
  const value = data[key];
582
- if (!this.isNullOrUndefinedOrEmpty(value)) {
583
- const mft = (fieldType, rule) => this.matchFieldTypes(errorInfos, [...fieldNames, key], value, fieldType, descriptor, schemaId, key, rule);
589
+ if (value !== undefined && value !== null) {
590
+ const mft = (fieldType, isRepeated, isItem) => this._matchFieldTypes(errorInfos, [...fieldNames, key], value, fieldType, descriptor, schemaId, key, isRepeated, isItem);
584
591
  if (oneofs[key]) {
585
592
  mft(fields[oneofs[key].oneof[0]].type);
586
593
  }
587
594
  else if (fields[key]) {
588
- mft(fields[key].type, fields[key].rule);
595
+ mft(fields[key].type, fields[key].rule === 'repeated');
589
596
  }
590
597
  }
591
598
  }
592
599
  }
593
- isNullOrUndefinedOrEmpty(val) {
594
- return val === undefined || val === null || val === '';
595
- }
596
- matchFieldTypes(errorInfos, fieldNames, fieldDataValue, protobufType, descriptor, schemaId, key, rule) {
600
+ _matchFieldTypes(errorInfos, fieldNames, fieldDataValue, protobufType, descriptor, schemaId, key, isRepeated, isItem) {
597
601
  let errorCode;
598
- if (rule === 'repeated') {
602
+ if (isRepeated) {
599
603
  if (Array.isArray(fieldDataValue)) {
600
604
  if (fieldDataValue.length > maxItemCountAppLimit) {
601
605
  errorCode = 7;
602
606
  }
603
607
  fieldDataValue.forEach((value, index) => {
604
- this.matchFieldTypes(errorInfos, [...fieldNames, index.toString()], value, protobufType, descriptor, schemaId, key);
608
+ this._matchFieldTypes(errorInfos, [...fieldNames, index.toString()], value, protobufType, descriptor, schemaId, key, undefined, true);
605
609
  });
606
610
  }
607
611
  else {
608
612
  errorCode = 1;
609
613
  }
610
- if (errorCode) {
611
- errorInfos.push(new ValidationEntry(errorCode, fieldNames));
614
+ }
615
+ else if (fieldDataValue == null || fieldDataValue === undefined) {
616
+ if (isItem) {
617
+ errorCode = 13;
612
618
  }
613
- return;
614
619
  }
615
- let javaScriptType;
616
- switch (protobufType) {
617
- case 'string':
618
- javaScriptType = 'string';
619
- if (fieldDataValue.length > maxStringLengthAppLimit) {
620
- errorCode = 6;
621
- }
622
- break;
623
- case 'bytes':
624
- javaScriptType = 'object';
625
- if (!(fieldDataValue instanceof Uint8Array)) {
626
- errorCode = 5;
627
- }
628
- break;
629
- case 'bool':
630
- javaScriptType = 'boolean';
631
- break;
632
- case 'uint32':
633
- javaScriptType = 'number';
634
- errorCode = this.checkNumberRange(fieldDataValue, minUnsigned, maxFourBytesUnsigned);
635
- break;
636
- case 'int32':
637
- case 'sint32':
638
- case 'fixed32':
639
- case 'sfixed32':
640
- javaScriptType = 'number';
641
- errorCode = this.checkNumberRange(fieldDataValue, minFourBytes, maxFourBytes);
642
- break;
643
- case 'uint64':
644
- javaScriptType = 'number';
645
- errorCode = this.checkNumberRange(fieldDataValue, minUnsigned, maxEightBytesUnsigned);
646
- break;
647
- case 'fixed64':
648
- case 'sfixed64':
649
- case 'int64':
650
- case 'sint64':
651
- javaScriptType = 'number';
652
- errorCode = this.checkNumberRange(fieldDataValue, minEightBytes, maxEightBytes);
653
- break;
654
- case 'double':
655
- case 'float':
656
- javaScriptType = 'number';
657
- if (!Number.isFinite(fieldDataValue)) {
620
+ else {
621
+ let numOpts;
622
+ let javaScriptType;
623
+ switch (protobufType) {
624
+ case 'string':
625
+ javaScriptType = 'string';
626
+ if (fieldDataValue.length > maxStringLengthAppLimit) {
627
+ errorCode = 6;
628
+ }
629
+ break;
630
+ case 'bytes':
631
+ javaScriptType = 'object';
632
+ if (!(fieldDataValue instanceof Uint8Array)) {
633
+ errorCode = 5;
634
+ }
635
+ break;
636
+ case 'bool':
637
+ javaScriptType = 'boolean';
638
+ break;
639
+ case 'uint32':
640
+ javaScriptType = 'number';
641
+ numOpts = {
642
+ min: minUnsigned,
643
+ max: maxFourBytesUnsigned,
644
+ isInt: true,
645
+ isItem
646
+ };
647
+ break;
648
+ case 'int32':
649
+ case 'sint32':
650
+ case 'fixed32':
651
+ case 'sfixed32':
652
+ javaScriptType = 'number';
653
+ numOpts = {
654
+ min: minFourBytes,
655
+ max: maxFourBytes,
656
+ isInt: true,
657
+ isItem
658
+ };
659
+ break;
660
+ case 'uint64':
661
+ javaScriptType = 'number';
662
+ numOpts = {
663
+ min: minUnsigned,
664
+ max: maxEightBytesUnsigned,
665
+ isInt: true,
666
+ isItem
667
+ };
668
+ break;
669
+ case 'fixed64':
670
+ case 'sfixed64':
671
+ case 'int64':
672
+ case 'sint64':
673
+ javaScriptType = 'number';
674
+ numOpts = {
675
+ min: minEightBytes,
676
+ max: maxEightBytes,
677
+ isInt: true,
678
+ isItem
679
+ };
680
+ break;
681
+ case 'double':
682
+ case 'float':
683
+ javaScriptType = 'number';
684
+ numOpts = {
685
+ min: Number.NEGATIVE_INFINITY,
686
+ max: Number.POSITIVE_INFINITY,
687
+ isInt: false,
688
+ isItem
689
+ };
690
+ break;
691
+ default:
692
+ if (new Set(Object.keys(descriptor)).has(protobufType)) {
693
+ this._validateFields(errorInfos, fieldNames, fieldDataValue, descriptor[protobufType], descriptor, schemaId);
694
+ javaScriptType = 'object';
695
+ }
696
+ break;
697
+ }
698
+ if (typeof fieldDataValue !== javaScriptType) {
699
+ errorInfos.push(new ValidationEntry(2, fieldNames, protobufType, typeof fieldDataValue));
700
+ }
701
+ else if (numOpts) {
702
+ if (numOpts.isInt && !Number.isFinite(fieldDataValue)) {
658
703
  errorCode = 3;
659
704
  }
660
- break;
661
- default:
662
- if (new Set(Object.keys(descriptor)).has(protobufType)) {
663
- this.validateFields(errorInfos, fieldNames, fieldDataValue, descriptor[protobufType], descriptor, schemaId);
664
- javaScriptType = 'object';
705
+ else if (numOpts.isInt && !Number.isInteger(fieldDataValue)) {
706
+ errorCode = 12;
665
707
  }
666
- break;
667
- }
668
- if (typeof fieldDataValue !== javaScriptType) {
669
- errorInfos.push(new ValidationEntry(2, fieldNames, protobufType, typeof fieldDataValue));
708
+ else if (!(!numOpts.isInt && Number.isNaN(fieldDataValue)) &&
709
+ !(fieldDataValue >= numOpts.min && fieldDataValue <= numOpts.max)) {
710
+ errorCode = 4;
711
+ }
712
+ }
670
713
  }
671
714
  if (errorCode) {
672
715
  errorInfos.push(new ValidationEntry(errorCode, fieldNames));
673
716
  }
674
717
  }
675
- checkNumberRange(value, min, max) {
676
- return value > max || value < min ? 4 : undefined;
677
- }
678
718
  }
679
719
  const logValidator = new LogValidator();
680
720
 
@@ -945,14 +985,9 @@ class MetricsImpl {
945
985
  }
946
986
  }
947
987
 
948
- class MockEvent {
949
- constructor(type, composed, _composedPaths) {
950
- this.type = type;
951
- this.composed = composed;
952
- this._composedPaths = _composedPaths;
953
- }
954
- composedPath() {
955
- return this._composedPaths;
988
+ class MockBase {
989
+ constructor() {
990
+ this.isMock = true;
956
991
  }
957
992
  }
958
993
 
@@ -1009,7 +1044,7 @@ class InstrumentationImpl {
1009
1044
  }
1010
1045
  return schemaUtil.makePayload(userSchema, userData, onlyIfBoth);
1011
1046
  }
1012
- getEffectiveRootId(options) {
1047
+ _getEffectiveRootId(options) {
1013
1048
  var _a, _b;
1014
1049
  return ((_b = (_a = options === null || options === void 0 ? void 0 : options.instrumentationContext) === null || _a === void 0 ? void 0 : _a.rootId) !== null && _b !== void 0 ? _b : this._nextGen.getDefaultInstrumentationContext().rootId);
1015
1050
  }
@@ -1021,7 +1056,7 @@ class InstrumentationImpl {
1021
1056
  utility.requireArgumentIfDefined(options, 'options', 'object');
1022
1057
  const userPayload = this._wrapUserPayload(userSchemaOrText, userData);
1023
1058
  if (userPayload === null || userPayload === void 0 ? void 0 : userPayload.payload) {
1024
- this._logInternal(this.name, userPayload.schema, userPayload.payload, timestamp, this.getEffectiveRootId(options));
1059
+ this._logInternal(this.name, userPayload.schema, userPayload.payload, timestamp, this._getEffectiveRootId(options));
1025
1060
  }
1026
1061
  });
1027
1062
  }
@@ -1039,7 +1074,7 @@ class InstrumentationImpl {
1039
1074
  ]);
1040
1075
  utility.requireArgumentIfDefined(userData, 'userData', 'object');
1041
1076
  utility.requireArgumentIfDefined(options, 'options', 'object');
1042
- const rootId = this.getEffectiveRootId(options);
1077
+ const rootId = this._getEffectiveRootId(options);
1043
1078
  this._errorInternal(error, userSchemaOrText, userData, undefined, rootId);
1044
1079
  });
1045
1080
  }
@@ -1124,8 +1159,9 @@ class InstrumentationImpl {
1124
1159
  }
1125
1160
  domEvent(event, handledBy, userSchemaOrText, userData, options) {
1126
1161
  this._safety.tryCatch(() => {
1162
+ var _a;
1127
1163
  const tsNow = utility.time().tsNow;
1128
- utility.requireArgument(event, 'event', [Event, MockEvent]);
1164
+ utility.requireArgument(event, 'event', [Event, MockBase]);
1129
1165
  utility.requireArgument(handledBy, 'handledBy', [HTMLElement, 'object']);
1130
1166
  let htmlElement;
1131
1167
  if (handledBy instanceof HTMLElement) {
@@ -1133,7 +1169,7 @@ class InstrumentationImpl {
1133
1169
  }
1134
1170
  else {
1135
1171
  handledBy = handledBy;
1136
- if (handledBy.template && handledBy.template.host instanceof HTMLElement) {
1172
+ if (((_a = handledBy.template) === null || _a === void 0 ? void 0 : _a.host) instanceof HTMLElement) {
1137
1173
  htmlElement = handledBy.template.host;
1138
1174
  }
1139
1175
  else {
@@ -1141,7 +1177,7 @@ class InstrumentationImpl {
1141
1177
  }
1142
1178
  }
1143
1179
  const userPayload = this._wrapUserPayload(userSchemaOrText, userData, true);
1144
- const rootId = this.getEffectiveRootId(options);
1180
+ const rootId = this._getEffectiveRootId(options);
1145
1181
  switch (event.type) {
1146
1182
  case 'click': {
1147
1183
  const mouseEvent = event;
@@ -1151,7 +1187,7 @@ class InstrumentationImpl {
1151
1187
  }
1152
1188
  const mouseEventData = domEventHelpers.getMouseEventData(mouseEvent);
1153
1189
  const instrumentedEvent = domEventHelpers.getInstrumentedEventData(mouseEventData, htmlElement, userPayload);
1154
- instrumentedEvent.auto = options && options._auto;
1190
+ instrumentedEvent.auto = options === null || options === void 0 ? void 0 : options._auto;
1155
1191
  this._logInternal(this.name, instrumented_event, instrumentedEvent, tsNow, rootId);
1156
1192
  break;
1157
1193
  }
@@ -1357,7 +1393,7 @@ class AppInstrumentationImpl extends InstrumentationImpl {
1357
1393
  constructor(_nextGen, _name, _allowMulti) {
1358
1394
  super(_nextGen, _name);
1359
1395
  this._allowMulti = _allowMulti;
1360
- this._onRootActivityStoppedCallback = this.handleRootActivityStop.bind(this);
1396
+ this._onRootActivityStoppedCallback = this._handleRootActivityStop.bind(this);
1361
1397
  }
1362
1398
  startRootActivity(name, rootId, isSampled) {
1363
1399
  return this._safety.tryCatchReturn(() => {
@@ -1374,7 +1410,7 @@ class AppInstrumentationImpl extends InstrumentationImpl {
1374
1410
  return newRootActivity;
1375
1411
  }, rootActivityNoOp);
1376
1412
  }
1377
- handleRootActivityStop(detail) {
1413
+ _handleRootActivityStop(detail) {
1378
1414
  if (detail.stopReason === discarded) {
1379
1415
  return;
1380
1416
  }
@@ -1403,56 +1439,58 @@ class AppInstrumentationImpl extends InstrumentationImpl {
1403
1439
 
1404
1440
  const pathLimit = 5;
1405
1441
  class AutomaticClickTracker {
1406
- constructor(instrumentation, document) {
1407
- this.isActive = false;
1408
- this._boundClickListener = this.clickListener.bind(this);
1409
- utility.requireArgument(instrumentation, 'instrumentation');
1410
- utility.requireArgument(document, 'document');
1411
- this.instr = instrumentation;
1412
- this.document = document;
1442
+ constructor(_instr, _doc) {
1443
+ this._instr = _instr;
1444
+ this._doc = _doc;
1445
+ this._isActive = false;
1446
+ this._boundClickListener = this._clickListener.bind(this);
1447
+ utility.requireArgument(_instr, '_instr');
1448
+ utility.requireArgument(_doc, '_doc');
1413
1449
  }
1414
1450
  activate() {
1415
- if (!this.isActive) {
1416
- this.document.addEventListener('click', this._boundClickListener, true);
1417
- this.isActive = true;
1451
+ if (!this._isActive) {
1452
+ this._doc.addEventListener('click', this._boundClickListener, true);
1453
+ this._isActive = true;
1418
1454
  }
1419
1455
  }
1420
1456
  deactivate() {
1421
- if (this.isActive) {
1422
- this.document.removeEventListener('click', this._boundClickListener, true);
1423
- this.isActive = false;
1457
+ if (this._isActive) {
1458
+ this._doc.removeEventListener('click', this._boundClickListener, true);
1459
+ this._isActive = false;
1424
1460
  }
1425
1461
  }
1426
1462
  markEventHandled(event) {
1427
- this.ignoredEvent = event;
1463
+ this._ignoredEvent = event;
1428
1464
  }
1429
- clickListener(event) {
1430
- let eventTargets = event.composedPath && event.composedPath();
1465
+ _clickListener(event) {
1466
+ var _a;
1467
+ let eventTargets = (_a = event.composedPath) === null || _a === void 0 ? void 0 : _a.call(event);
1431
1468
  if (!eventTargets || !eventTargets.length) {
1432
1469
  eventTargets = event.path;
1433
1470
  }
1434
- const handledBy = this.getClickableElement(eventTargets);
1471
+ const handledBy = this._getClickableElement(eventTargets);
1435
1472
  if (handledBy) {
1436
1473
  setTimeout(() => {
1437
- if (event !== this.ignoredEvent) {
1438
- this.instr.domEvent(event, handledBy, undefined, undefined, {
1474
+ if (event !== this._ignoredEvent) {
1475
+ this._instr.domEvent(event, handledBy, undefined, undefined, {
1439
1476
  _auto: true
1440
1477
  });
1441
1478
  }
1442
1479
  });
1443
1480
  }
1444
1481
  }
1445
- getClickableElement(path) {
1482
+ _getClickableElement(path) {
1483
+ var _a, _b;
1446
1484
  const limit = path ? Math.min(path.length, pathLimit) : 0;
1447
1485
  for (let x = 0; x < limit; x += 1) {
1448
1486
  const currentElement = path[x];
1449
- const tagName = currentElement.tagName && currentElement.tagName.toLowerCase();
1487
+ const tagName = (_a = currentElement.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
1450
1488
  if (tagName === 'a' || tagName === 'button') {
1451
1489
  return currentElement;
1452
1490
  }
1453
1491
  if (tagName === 'input') {
1454
1492
  const inputElement = currentElement;
1455
- if (inputElement.type && inputElement.type.toLowerCase() === 'button') {
1493
+ if (((_b = inputElement.type) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'button') {
1456
1494
  return inputElement;
1457
1495
  }
1458
1496
  }
@@ -1497,9 +1535,9 @@ class NextgenImpl {
1497
1535
  if (instr) {
1498
1536
  throw new Error(`The instrumentation name ${name} is already taken`);
1499
1537
  }
1500
- this._appInstr = new AppInstrumentationImpl(this, name, options && options.allowMultipleRootActivities);
1538
+ this._appInstr = new AppInstrumentationImpl(this, name, options === null || options === void 0 ? void 0 : options.allowMultipleRootActivities);
1501
1539
  this._instruments.set(name, this._appInstr);
1502
- this._isBufferingEnabled = options && options.enableBuffering;
1540
+ this._isBufferingEnabled = options === null || options === void 0 ? void 0 : options.enableBuffering;
1503
1541
  const tracing = new Tracing(this._appInstr);
1504
1542
  return {
1505
1543
  log: this._appInstr.log.bind(this._appInstr),
@@ -1538,7 +1576,8 @@ class NextgenImpl {
1538
1576
  return instr;
1539
1577
  }
1540
1578
  get appName() {
1541
- return this._appInstr && this._appInstr.name;
1579
+ var _a;
1580
+ return (_a = this._appInstr) === null || _a === void 0 ? void 0 : _a.name;
1542
1581
  }
1543
1582
  addLog(loggerName, schema, data, timestamp, rootId, pagePayload, appPayload) {
1544
1583
  this._sequence += 1;
@@ -1560,8 +1599,11 @@ class NextgenImpl {
1560
1599
  if (this._isBufferingEnabled) {
1561
1600
  this._buffer.push({ schema, data: utility.clone(data), logMeta });
1562
1601
  }
1563
- const eligibleCollectors = Array.from(this._logCollectors).filter((collector) => !this._forceDisabledLogCollectors.has(collector) &&
1564
- !(collector.getIsCollectDisabled && collector.getIsCollectDisabled()));
1602
+ const eligibleCollectors = Array.from(this._logCollectors).filter((collector) => {
1603
+ var _a;
1604
+ return !this._forceDisabledLogCollectors.has(collector) &&
1605
+ !((_a = collector.getIsCollectDisabled) === null || _a === void 0 ? void 0 : _a.call(collector));
1606
+ });
1565
1607
  if (eligibleCollectors.length > 0) {
1566
1608
  for (const collector of eligibleCollectors) {
1567
1609
  const dataClone = utility.clone(data);
@@ -1606,10 +1648,12 @@ class NextgenImpl {
1606
1648
  };
1607
1649
  }
1608
1650
  activateClickTracker() {
1609
- if (!this._autoClickTracker) {
1610
- this._autoClickTracker = new AutomaticClickTracker(this._appInstr, window.document);
1651
+ if (typeof document !== 'undefined') {
1652
+ if (!this._autoClickTracker) {
1653
+ this._autoClickTracker = new AutomaticClickTracker(this._appInstr, document);
1654
+ }
1655
+ this._autoClickTracker.activate();
1611
1656
  }
1612
- this._autoClickTracker.activate();
1613
1657
  }
1614
1658
  deactivateClickTracker() {
1615
1659
  if (this._autoClickTracker) {
@@ -1639,20 +1683,20 @@ class NextgenImpl {
1639
1683
  }
1640
1684
  this._metricsCollector = collector;
1641
1685
  this._metricsCollector.receiveMetricsExtractors({
1642
- getAllUpCounters: this.getAllUpCounters.bind(this),
1643
- getAllValueRecorders: this.getAllValueRecorders.bind(this),
1644
- getAllBucketHistograms: this.getAllBucketHistograms.bind(this)
1686
+ getAllUpCounters: this._getAllUpCounters.bind(this),
1687
+ getAllValueRecorders: this._getAllValueRecorders.bind(this),
1688
+ getAllBucketHistograms: this._getAllBucketHistograms.bind(this)
1645
1689
  });
1646
1690
  }
1647
- getAllUpCounters() {
1691
+ _getAllUpCounters() {
1648
1692
  const arrOfArrs = Array.from(this._instruments.values()).map((instr) => instr.getUpCounters());
1649
1693
  return arrOfArrs.reduce((pv, cv) => pv.concat(cv), []);
1650
1694
  }
1651
- getAllValueRecorders() {
1695
+ _getAllValueRecorders() {
1652
1696
  const arrOfArrs = Array.from(this._instruments.values()).map((instr) => instr.getValueRecorders());
1653
1697
  return arrOfArrs.reduce((pv, cv) => pv.concat(cv), []);
1654
1698
  }
1655
- getAllBucketHistograms() {
1699
+ _getAllBucketHistograms() {
1656
1700
  const arrOfArrs = Array.from(this._instruments.values()).map((instr) => instr.getBucketHistograms());
1657
1701
  return arrOfArrs.reduce((pv, cv) => pv.concat(cv), []);
1658
1702
  }
@@ -1744,7 +1788,6 @@ class IdleDetectorImpl {
1744
1788
  this._logThreshold = defaultLogThreshold;
1745
1789
  this._endedTasks = new Array();
1746
1790
  this._pollableReport = new Array();
1747
- this._timerCheckQueued = 0;
1748
1791
  if (utility.requireArgumentIfDefined(options === null || options === void 0 ? void 0 : options.logThreshold, 'options.logThreshold', 'number')) {
1749
1792
  this._logThreshold = options.logThreshold;
1750
1793
  }
@@ -1755,9 +1798,9 @@ class IdleDetectorImpl {
1755
1798
  this._firstCallbackTime = utility.time().perfNow;
1756
1799
  }
1757
1800
  this._listeners.add(callback);
1758
- this.checkIfLoaded();
1801
+ this._checkIfLoaded();
1759
1802
  }
1760
- reportTaskEnded(tasker) {
1803
+ _reportTaskEnded(tasker) {
1761
1804
  if (this._listeners.size) {
1762
1805
  const snapshot = Object.assign({}, this._taskers.get(tasker));
1763
1806
  this._endedTasks.push(snapshot);
@@ -1765,7 +1808,7 @@ class IdleDetectorImpl {
1765
1808
  }
1766
1809
  declareNotifierTaskSingle(name) {
1767
1810
  utility.requireArgument(name, 'name', 'string');
1768
- const tasker = this.addTasker(name, 1);
1811
+ const tasker = this._addTasker(name, 1);
1769
1812
  const retVal = {
1770
1813
  get isBusy() {
1771
1814
  return tasker.isBusy;
@@ -1781,12 +1824,11 @@ class IdleDetectorImpl {
1781
1824
  utility.requireArgument(name, 'name', 'string');
1782
1825
  if (existingBusyCount !== undefined) {
1783
1826
  utility.requireArgument(existingBusyCount, 'existingBusyCount', 'number');
1784
- if (existingBusyCount < 0 ||
1785
- parseInt(existingBusyCount.toString(), 10) !== existingBusyCount) {
1827
+ if (!Number.isInteger(existingBusyCount) || existingBusyCount < 0) {
1786
1828
  throw new Error('existingBusyCount accepts only non-negative integers');
1787
1829
  }
1788
1830
  }
1789
- const tasker = this.addTasker(name, existingBusyCount);
1831
+ const tasker = this._addTasker(name, existingBusyCount);
1790
1832
  const retVal = {
1791
1833
  get isBusy() {
1792
1834
  return tasker.isBusy;
@@ -1808,11 +1850,11 @@ class IdleDetectorImpl {
1808
1850
  utility.requireArgument(isBusyChecker, 'isBusyChecker', 'function');
1809
1851
  this._busyCheckers.set(isBusyChecker, name);
1810
1852
  }
1811
- addTasker(name, existingBusyCount) {
1853
+ _addTasker(name, existingBusyCount) {
1812
1854
  const tasker = new TaskerImpl(name, existingBusyCount, () => {
1813
1855
  this._taskers.get(tasker).end = utility.time().perfNow;
1814
- this.reportTaskEnded(tasker);
1815
- this.checkIfLoaded();
1856
+ this._reportTaskEnded(tasker);
1857
+ this._checkIfLoaded();
1816
1858
  }, () => {
1817
1859
  this._instr.error(`Overdone: ${tasker.name}`);
1818
1860
  utility.noProdThrow(`Tasker '${tasker.name}' is done too many times.`);
@@ -1824,10 +1866,10 @@ class IdleDetectorImpl {
1824
1866
  });
1825
1867
  return tasker;
1826
1868
  }
1827
- areAllNotifiersIdle() {
1869
+ _areAllNotifiersIdle() {
1828
1870
  return !Array.from(this._taskers.keys()).some((t) => t.isBusy);
1829
1871
  }
1830
- getFirstBusyPollable() {
1872
+ _getFirstBusyPollable() {
1831
1873
  const entry = Array.from(this._busyCheckers).find((entry) => {
1832
1874
  const isBusyChecker = entry[0];
1833
1875
  const name = entry[1];
@@ -1842,29 +1884,29 @@ class IdleDetectorImpl {
1842
1884
  });
1843
1885
  return entry ? entry[1] : undefined;
1844
1886
  }
1845
- checkIfLoaded() {
1887
+ _checkIfLoaded() {
1846
1888
  if (!this._listeners.size) {
1847
1889
  return;
1848
1890
  }
1849
1891
  if (this._timerCheckQueued) {
1850
- window.clearTimeout(this._timerCheckQueued);
1892
+ clearTimeout(this._timerCheckQueued);
1851
1893
  }
1852
- if (this.areAllNotifiersIdle()) {
1853
- this._timerCheckQueued = window.setTimeout(() => {
1854
- this._timerCheckQueued = window.setTimeout(() => {
1855
- this.doubleCheck();
1894
+ if (this._areAllNotifiersIdle()) {
1895
+ this._timerCheckQueued = setTimeout(() => {
1896
+ this._timerCheckQueued = setTimeout(() => {
1897
+ this._doubleCheck();
1856
1898
  }, 40);
1857
1899
  }, 0);
1858
1900
  }
1859
1901
  }
1860
- doubleCheck() {
1861
- this._timerCheckQueued = 0;
1862
- if (this.areAllNotifiersIdle()) {
1863
- const pollableName = this.getFirstBusyPollable();
1902
+ _doubleCheck() {
1903
+ this._timerCheckQueued = undefined;
1904
+ if (this._areAllNotifiersIdle()) {
1905
+ const pollableName = this._getFirstBusyPollable();
1864
1906
  if (pollableName !== undefined) {
1865
- this.addToPollableReport(pollableName);
1866
- this._timerCheckQueued = window.setTimeout(() => {
1867
- this.doubleCheck();
1907
+ this._addToPollableReport(pollableName);
1908
+ this._timerCheckQueued = setTimeout(() => {
1909
+ this._doubleCheck();
1868
1910
  }, 15);
1869
1911
  }
1870
1912
  else {
@@ -1874,11 +1916,11 @@ class IdleDetectorImpl {
1874
1916
  this._firstCallbackTime = undefined;
1875
1917
  const endedTasks = this._endedTasks.splice(0);
1876
1918
  const pollableReport = this._pollableReport.splice(0);
1877
- this.notify(listeners, maxDuration, endedTasks, pollableReport);
1919
+ this._notify(listeners, maxDuration, endedTasks, pollableReport);
1878
1920
  }
1879
1921
  }
1880
1922
  }
1881
- addToPollableReport(name) {
1923
+ _addToPollableReport(name) {
1882
1924
  const lastEntry = this._pollableReport.length
1883
1925
  ? this._pollableReport[this._pollableReport.length - 1]
1884
1926
  : undefined;
@@ -1892,7 +1934,7 @@ class IdleDetectorImpl {
1892
1934
  });
1893
1935
  }
1894
1936
  }
1895
- notify(listeners, maxDuration, taskReport, pollableReport) {
1937
+ _notify(listeners, maxDuration, taskReport, pollableReport) {
1896
1938
  if (maxDuration >= this._logThreshold) {
1897
1939
  const logData = this._getReport(maxDuration, listeners.length, taskReport, pollableReport);
1898
1940
  this._instr.log(idle_detector_report, logData);
@@ -1978,7 +2020,7 @@ class ConsoleCollector {
1978
2020
  }
1979
2021
  }
1980
2022
 
1981
- const version = '242.3.3';
2023
+ const version = '242.8.0';
1982
2024
 
1983
2025
  const idleDetector = new IdleDetectorImpl({
1984
2026
  logThreshold: 300