@newrelic/browser-agent 1.309.0 → 1.310.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 (133) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +0 -2
  3. package/dist/cjs/common/config/init-types.js +1 -4
  4. package/dist/cjs/common/config/init.js +1 -5
  5. package/dist/cjs/common/constants/env.cdn.js +1 -1
  6. package/dist/cjs/common/constants/env.npm.js +1 -1
  7. package/dist/cjs/common/util/browser-stack-matchers.js +15 -0
  8. package/dist/cjs/common/util/script-tracker.js +184 -0
  9. package/dist/cjs/common/wrap/wrap-fetch.js +2 -2
  10. package/dist/cjs/common/wrap/wrap-history.js +2 -2
  11. package/dist/cjs/common/wrap/wrap-logger.js +2 -2
  12. package/dist/cjs/common/wrap/wrap-xhr.js +2 -2
  13. package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +6 -10
  14. package/dist/cjs/features/page_view_event/aggregate/initialized-features.js +1 -2
  15. package/dist/cjs/index.js +3 -3
  16. package/dist/cjs/interfaces/registered-entity.js +2 -1
  17. package/dist/cjs/loaders/agent.js +1 -4
  18. package/dist/cjs/loaders/api/register-api-types.js +20 -8
  19. package/dist/cjs/loaders/api/register.js +36 -2
  20. package/dist/cjs/loaders/api-base.js +1 -1
  21. package/dist/cjs/loaders/features/features.js +6 -9
  22. package/dist/esm/common/config/init-types.js +1 -4
  23. package/dist/esm/common/config/init.js +1 -5
  24. package/dist/esm/common/constants/env.cdn.js +1 -1
  25. package/dist/esm/common/constants/env.npm.js +1 -1
  26. package/dist/esm/common/util/browser-stack-matchers.js +9 -0
  27. package/dist/esm/common/util/script-tracker.js +179 -0
  28. package/dist/esm/common/wrap/wrap-fetch.js +2 -2
  29. package/dist/esm/common/wrap/wrap-history.js +2 -2
  30. package/dist/esm/common/wrap/wrap-logger.js +2 -2
  31. package/dist/esm/common/wrap/wrap-xhr.js +2 -2
  32. package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +2 -6
  33. package/dist/esm/features/page_view_event/aggregate/initialized-features.js +1 -2
  34. package/dist/esm/index.js +2 -2
  35. package/dist/esm/interfaces/registered-entity.js +2 -1
  36. package/dist/esm/loaders/agent.js +1 -4
  37. package/dist/esm/loaders/api/register-api-types.js +22 -8
  38. package/dist/esm/loaders/api/register.js +36 -2
  39. package/dist/esm/loaders/api-base.js +1 -1
  40. package/dist/esm/loaders/features/features.js +6 -9
  41. package/dist/tsconfig.tsbuildinfo +1 -1
  42. package/dist/types/common/config/init-types.d.ts +0 -10
  43. package/dist/types/common/config/init.d.ts.map +1 -1
  44. package/dist/types/common/util/browser-stack-matchers.d.ts +10 -0
  45. package/dist/types/common/util/browser-stack-matchers.d.ts.map +1 -0
  46. package/dist/types/common/util/script-tracker.d.ts +7 -0
  47. package/dist/types/common/util/script-tracker.d.ts.map +1 -0
  48. package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -1
  49. package/dist/types/features/page_view_event/aggregate/initialized-features.d.ts.map +1 -1
  50. package/dist/types/index.d.ts +1 -1
  51. package/dist/types/interfaces/registered-entity.d.ts +4 -5
  52. package/dist/types/interfaces/registered-entity.d.ts.map +1 -1
  53. package/dist/types/loaders/agent.d.ts.map +1 -1
  54. package/dist/types/loaders/api/register-api-types.d.ts +58 -14
  55. package/dist/types/loaders/api/register-api-types.d.ts.map +1 -1
  56. package/dist/types/loaders/api/register.d.ts.map +1 -1
  57. package/dist/types/loaders/api-base.d.ts +4 -5
  58. package/dist/types/loaders/api-base.d.ts.map +1 -1
  59. package/dist/types/loaders/features/features.d.ts +2 -5
  60. package/dist/types/loaders/features/features.d.ts.map +1 -1
  61. package/package.json +1 -9
  62. package/src/common/config/init-types.js +1 -4
  63. package/src/common/config/init.js +1 -2
  64. package/src/common/util/browser-stack-matchers.js +9 -0
  65. package/src/common/util/script-tracker.js +171 -0
  66. package/src/common/wrap/wrap-fetch.js +2 -2
  67. package/src/common/wrap/wrap-history.js +2 -2
  68. package/src/common/wrap/wrap-logger.js +2 -2
  69. package/src/common/wrap/wrap-xhr.js +2 -2
  70. package/src/features/jserrors/aggregate/compute-stack-trace.js +2 -7
  71. package/src/features/page_view_event/aggregate/initialized-features.js +1 -2
  72. package/src/index.js +2 -2
  73. package/src/interfaces/registered-entity.js +2 -1
  74. package/src/loaders/agent.js +0 -4
  75. package/src/loaders/api/register-api-types.js +22 -8
  76. package/src/loaders/api/register.js +31 -2
  77. package/src/loaders/api-base.js +1 -1
  78. package/src/loaders/features/features.js +6 -9
  79. package/dist/cjs/common/wrap/wrap-jsonp.js +0 -137
  80. package/dist/cjs/common/wrap/wrap-mutation.js +0 -62
  81. package/dist/cjs/common/wrap/wrap-promise.js +0 -166
  82. package/dist/cjs/common/wrap/wrap-timer.js +0 -71
  83. package/dist/cjs/features/spa/aggregate/index.js +0 -672
  84. package/dist/cjs/features/spa/aggregate/interaction-node.js +0 -83
  85. package/dist/cjs/features/spa/aggregate/interaction.js +0 -95
  86. package/dist/cjs/features/spa/aggregate/serializer.js +0 -150
  87. package/dist/cjs/features/spa/constants.js +0 -35
  88. package/dist/cjs/features/spa/index.js +0 -12
  89. package/dist/cjs/features/spa/instrument/index.js +0 -136
  90. package/dist/esm/common/wrap/wrap-jsonp.js +0 -130
  91. package/dist/esm/common/wrap/wrap-mutation.js +0 -55
  92. package/dist/esm/common/wrap/wrap-promise.js +0 -159
  93. package/dist/esm/common/wrap/wrap-timer.js +0 -64
  94. package/dist/esm/features/spa/aggregate/index.js +0 -663
  95. package/dist/esm/features/spa/aggregate/interaction-node.js +0 -77
  96. package/dist/esm/features/spa/aggregate/interaction.js +0 -88
  97. package/dist/esm/features/spa/aggregate/serializer.js +0 -142
  98. package/dist/esm/features/spa/constants.js +0 -28
  99. package/dist/esm/features/spa/index.js +0 -5
  100. package/dist/esm/features/spa/instrument/index.js +0 -129
  101. package/dist/types/common/wrap/wrap-jsonp.d.ts +0 -16
  102. package/dist/types/common/wrap/wrap-jsonp.d.ts.map +0 -1
  103. package/dist/types/common/wrap/wrap-mutation.d.ts +0 -16
  104. package/dist/types/common/wrap/wrap-mutation.d.ts.map +0 -1
  105. package/dist/types/common/wrap/wrap-promise.d.ts +0 -17
  106. package/dist/types/common/wrap/wrap-promise.d.ts.map +0 -1
  107. package/dist/types/common/wrap/wrap-timer.d.ts +0 -17
  108. package/dist/types/common/wrap/wrap-timer.d.ts.map +0 -1
  109. package/dist/types/features/spa/aggregate/index.d.ts +0 -24
  110. package/dist/types/features/spa/aggregate/index.d.ts.map +0 -1
  111. package/dist/types/features/spa/aggregate/interaction-node.d.ts +0 -15
  112. package/dist/types/features/spa/aggregate/interaction-node.d.ts.map +0 -1
  113. package/dist/types/features/spa/aggregate/interaction.d.ts +0 -19
  114. package/dist/types/features/spa/aggregate/interaction.d.ts.map +0 -1
  115. package/dist/types/features/spa/aggregate/serializer.d.ts +0 -17
  116. package/dist/types/features/spa/aggregate/serializer.d.ts.map +0 -1
  117. package/dist/types/features/spa/constants.d.ts +0 -23
  118. package/dist/types/features/spa/constants.d.ts.map +0 -1
  119. package/dist/types/features/spa/index.d.ts +0 -2
  120. package/dist/types/features/spa/index.d.ts.map +0 -1
  121. package/dist/types/features/spa/instrument/index.d.ts +0 -12
  122. package/dist/types/features/spa/instrument/index.d.ts.map +0 -1
  123. package/src/common/wrap/wrap-jsonp.js +0 -142
  124. package/src/common/wrap/wrap-mutation.js +0 -58
  125. package/src/common/wrap/wrap-promise.js +0 -176
  126. package/src/common/wrap/wrap-timer.js +0 -70
  127. package/src/features/spa/aggregate/index.js +0 -734
  128. package/src/features/spa/aggregate/interaction-node.js +0 -85
  129. package/src/features/spa/aggregate/interaction.js +0 -108
  130. package/src/features/spa/aggregate/serializer.js +0 -200
  131. package/src/features/spa/constants.js +0 -39
  132. package/src/features/spa/index.js +0 -5
  133. package/src/features/spa/instrument/index.js +0 -134
@@ -1,71 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.scopedEE = scopedEE;
7
- exports.wrapTimer = wrapTimer;
8
- var _contextualEe = require("../event-emitter/contextual-ee");
9
- var _wrapFunction = require("./wrap-function");
10
- var _runtime = require("../constants/runtime");
11
- /**
12
- * Copyright 2020-2025 New Relic, Inc. All rights reserved.
13
- * SPDX-License-Identifier: Apache-2.0
14
- */
15
-
16
- /**
17
- * @file Wraps native timeout and interval methods for instrumentation.
18
- * This module is used by: jserrors, spa.
19
- */
20
-
21
- const wrapped = {};
22
- const SET_TIMEOUT = 'setTimeout';
23
- const SET_INTERVAL = 'setInterval';
24
- const CLEAR_TIMEOUT = 'clearTimeout';
25
- const START = '-start';
26
- const DASH = '-';
27
- const TIMER_FNS = [SET_TIMEOUT, 'setImmediate', SET_INTERVAL, CLEAR_TIMEOUT, 'clearImmediate'];
28
-
29
- /**
30
- * Wraps the global `setTimeout`, `setImmediate`, `setInterval`, `clearTimeout`, and `clearImmediate` functions to emit
31
- * events on start, end, and error, in the context of a new event emitter scoped only to timer functions. Also wraps
32
- * the callbacks of `setTimeout` and `setInterval`.
33
- * @param {Object} sharedEE - The shared event emitter on which a new scoped event emitter will be based.
34
- * @returns {Object} Scoped event emitter with a debug ID of `timer`.
35
- */
36
- // eslint-disable-next-line
37
- function wrapTimer(sharedEE) {
38
- const ee = scopedEE(sharedEE);
39
-
40
- // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
41
- // then we increment the count to track # of feats using this at runtime.
42
- if (wrapped[ee.debugId]++) return ee;
43
- wrapped[ee.debugId] = 1; // otherwise, first feature to wrap timer
44
-
45
- var wrapFn = (0, _wrapFunction.createWrapperWithEmitter)(ee);
46
- wrapFn.inPlace(_runtime.globalScope, TIMER_FNS.slice(0, 2), SET_TIMEOUT + DASH);
47
- wrapFn.inPlace(_runtime.globalScope, TIMER_FNS.slice(2, 3), SET_INTERVAL + DASH);
48
- wrapFn.inPlace(_runtime.globalScope, TIMER_FNS.slice(3), CLEAR_TIMEOUT + DASH);
49
- ee.on(SET_INTERVAL + START, interval);
50
- ee.on(SET_TIMEOUT + START, timer);
51
- function interval(args, obj, type) {
52
- args[0] = wrapFn(args[0], 'fn-', null, type);
53
- }
54
- function timer(args, obj, type) {
55
- this.method = type;
56
- this.timerDuration = isNaN(args[1]) ? 0 : +args[1];
57
- args[0] = wrapFn(args[0], 'fn-', this, type);
58
- }
59
- return ee;
60
- }
61
-
62
- /**
63
- * Returns an event emitter scoped specifically for the `timer` context. This scoping is a remnant from when all the
64
- * features shared the same group in the event, to isolate events between features. It will likely be revisited.
65
- * @param {Object} sharedEE - Optional event emitter on which to base the scoped emitter.
66
- * Uses `ee` on the global scope if undefined).
67
- * @returns {Object} Scoped event emitter with a debug ID of 'timer'.
68
- */
69
- function scopedEE(sharedEE) {
70
- return (sharedEE || _contextualEe.ee).get('timer');
71
- }