@sentry/browser 11.0.0-alpha.2 → 11.0.0-beta.1

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 (454) hide show
  1. package/build/npm/cjs/dev/client.js +5 -5
  2. package/build/npm/cjs/dev/client.js.map +1 -1
  3. package/build/npm/cjs/dev/diagnose-sdk.js +3 -3
  4. package/build/npm/cjs/dev/diagnose-sdk.js.map +1 -1
  5. package/build/npm/cjs/dev/eventbuilder.js +25 -28
  6. package/build/npm/cjs/dev/eventbuilder.js.map +1 -1
  7. package/build/npm/cjs/dev/helpers.js +11 -11
  8. package/build/npm/cjs/dev/helpers.js.map +1 -1
  9. package/build/npm/cjs/dev/index.js +85 -84
  10. package/build/npm/cjs/dev/index.js.map +1 -1
  11. package/build/npm/cjs/dev/integrations/{bfcache.js → bfcacheMetrics.js} +41 -39
  12. package/build/npm/cjs/dev/integrations/bfcacheMetrics.js.map +1 -0
  13. package/build/npm/cjs/dev/integrations/breadcrumbs.js +27 -27
  14. package/build/npm/cjs/dev/integrations/breadcrumbs.js.map +1 -1
  15. package/build/npm/cjs/dev/integrations/browserapierrors.js +16 -16
  16. package/build/npm/cjs/dev/integrations/browserapierrors.js.map +1 -1
  17. package/build/npm/cjs/dev/integrations/browsersession.js +9 -9
  18. package/build/npm/cjs/dev/integrations/browsersession.js.map +1 -1
  19. package/build/npm/cjs/dev/integrations/contextlines.js +5 -5
  20. package/build/npm/cjs/dev/integrations/contextlines.js.map +1 -1
  21. package/build/npm/cjs/dev/integrations/culturecontext.js +3 -3
  22. package/build/npm/cjs/dev/integrations/culturecontext.js.map +1 -1
  23. package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js +2 -2
  24. package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
  25. package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js +5 -5
  26. package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  27. package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js +7 -7
  28. package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
  29. package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js +5 -5
  30. package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
  31. package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js +7 -7
  32. package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
  33. package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js +16 -10
  34. package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js.map +1 -1
  35. package/build/npm/cjs/dev/integrations/globalhandlers.js +15 -15
  36. package/build/npm/cjs/dev/integrations/globalhandlers.js.map +1 -1
  37. package/build/npm/cjs/dev/integrations/graphqlClient.js +28 -15
  38. package/build/npm/cjs/dev/integrations/graphqlClient.js.map +1 -1
  39. package/build/npm/cjs/dev/integrations/httpclient.js +20 -23
  40. package/build/npm/cjs/dev/integrations/httpclient.js.map +1 -1
  41. package/build/npm/cjs/dev/integrations/httpcontext.js +6 -7
  42. package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -1
  43. package/build/npm/cjs/dev/integrations/linkederrors.js +3 -3
  44. package/build/npm/cjs/dev/integrations/linkederrors.js.map +1 -1
  45. package/build/npm/cjs/dev/integrations/reportingobserver.js +6 -6
  46. package/build/npm/cjs/dev/integrations/reportingobserver.js.map +1 -1
  47. package/build/npm/cjs/dev/integrations/spotlight.js +6 -6
  48. package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -1
  49. package/build/npm/cjs/dev/integrations/view-hierarchy.js +2 -2
  50. package/build/npm/cjs/dev/integrations/view-hierarchy.js.map +1 -1
  51. package/build/npm/cjs/dev/integrations/webVitals.js +3 -3
  52. package/build/npm/cjs/dev/integrations/webVitals.js.map +1 -1
  53. package/build/npm/cjs/dev/integrations/webWorker.js +18 -18
  54. package/build/npm/cjs/dev/integrations/webWorker.js.map +1 -1
  55. package/build/npm/cjs/dev/profiling/UIProfiler.js +33 -33
  56. package/build/npm/cjs/dev/profiling/UIProfiler.js.map +1 -1
  57. package/build/npm/cjs/dev/profiling/index.js +7 -7
  58. package/build/npm/cjs/dev/profiling/index.js.map +1 -1
  59. package/build/npm/cjs/dev/profiling/integration.js +8 -8
  60. package/build/npm/cjs/dev/profiling/integration.js.map +1 -1
  61. package/build/npm/cjs/dev/profiling/utils.js +16 -16
  62. package/build/npm/cjs/dev/profiling/utils.js.map +1 -1
  63. package/build/npm/cjs/dev/report-dialog.js +7 -7
  64. package/build/npm/cjs/dev/report-dialog.js.map +1 -1
  65. package/build/npm/cjs/dev/sdk.js +9 -9
  66. package/build/npm/cjs/dev/sdk.js.map +1 -1
  67. package/build/npm/cjs/dev/stack-parsers.js +10 -10
  68. package/build/npm/cjs/dev/stack-parsers.js.map +1 -1
  69. package/build/npm/cjs/dev/tracing/backgroundtab.js +7 -7
  70. package/build/npm/cjs/dev/tracing/backgroundtab.js.map +1 -1
  71. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js +48 -48
  72. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js.map +1 -1
  73. package/build/npm/cjs/dev/tracing/linkedTraces.js +10 -11
  74. package/build/npm/cjs/dev/tracing/linkedTraces.js.map +1 -1
  75. package/build/npm/cjs/dev/tracing/reportPageLoaded.js +2 -2
  76. package/build/npm/cjs/dev/tracing/reportPageLoaded.js.map +1 -1
  77. package/build/npm/cjs/dev/tracing/request.js +37 -29
  78. package/build/npm/cjs/dev/tracing/request.js.map +1 -1
  79. package/build/npm/cjs/dev/tracing/setActiveSpan.js +5 -5
  80. package/build/npm/cjs/dev/tracing/setActiveSpan.js.map +1 -1
  81. package/build/npm/cjs/dev/transports/fetch.js +3 -3
  82. package/build/npm/cjs/dev/transports/fetch.js.map +1 -1
  83. package/build/npm/cjs/dev/transports/offline.js +5 -5
  84. package/build/npm/cjs/dev/transports/offline.js.map +1 -1
  85. package/build/npm/cjs/dev/userfeedback.js +3 -3
  86. package/build/npm/cjs/dev/userfeedback.js.map +1 -1
  87. package/build/npm/cjs/dev/utils/detectBrowserExtension.js +2 -2
  88. package/build/npm/cjs/dev/utils/detectBrowserExtension.js.map +1 -1
  89. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js +3 -3
  90. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js.map +1 -1
  91. package/build/npm/cjs/prod/client.js +5 -5
  92. package/build/npm/cjs/prod/client.js.map +1 -1
  93. package/build/npm/cjs/prod/diagnose-sdk.js +3 -3
  94. package/build/npm/cjs/prod/diagnose-sdk.js.map +1 -1
  95. package/build/npm/cjs/prod/eventbuilder.js +25 -28
  96. package/build/npm/cjs/prod/eventbuilder.js.map +1 -1
  97. package/build/npm/cjs/prod/helpers.js +11 -11
  98. package/build/npm/cjs/prod/helpers.js.map +1 -1
  99. package/build/npm/cjs/prod/index.js +85 -84
  100. package/build/npm/cjs/prod/index.js.map +1 -1
  101. package/build/npm/cjs/prod/integrations/{bfcache.js → bfcacheMetrics.js} +41 -39
  102. package/build/npm/cjs/prod/integrations/bfcacheMetrics.js.map +1 -0
  103. package/build/npm/cjs/prod/integrations/breadcrumbs.js +27 -27
  104. package/build/npm/cjs/prod/integrations/breadcrumbs.js.map +1 -1
  105. package/build/npm/cjs/prod/integrations/browserapierrors.js +16 -16
  106. package/build/npm/cjs/prod/integrations/browserapierrors.js.map +1 -1
  107. package/build/npm/cjs/prod/integrations/browsersession.js +9 -9
  108. package/build/npm/cjs/prod/integrations/browsersession.js.map +1 -1
  109. package/build/npm/cjs/prod/integrations/contextlines.js +5 -5
  110. package/build/npm/cjs/prod/integrations/contextlines.js.map +1 -1
  111. package/build/npm/cjs/prod/integrations/culturecontext.js +3 -3
  112. package/build/npm/cjs/prod/integrations/culturecontext.js.map +1 -1
  113. package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js +2 -2
  114. package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
  115. package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js +5 -5
  116. package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  117. package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js +7 -7
  118. package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
  119. package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js +5 -5
  120. package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
  121. package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js +7 -7
  122. package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
  123. package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js +16 -10
  124. package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js.map +1 -1
  125. package/build/npm/cjs/prod/integrations/globalhandlers.js +15 -15
  126. package/build/npm/cjs/prod/integrations/globalhandlers.js.map +1 -1
  127. package/build/npm/cjs/prod/integrations/graphqlClient.js +28 -15
  128. package/build/npm/cjs/prod/integrations/graphqlClient.js.map +1 -1
  129. package/build/npm/cjs/prod/integrations/httpclient.js +20 -23
  130. package/build/npm/cjs/prod/integrations/httpclient.js.map +1 -1
  131. package/build/npm/cjs/prod/integrations/httpcontext.js +6 -7
  132. package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -1
  133. package/build/npm/cjs/prod/integrations/linkederrors.js +3 -3
  134. package/build/npm/cjs/prod/integrations/linkederrors.js.map +1 -1
  135. package/build/npm/cjs/prod/integrations/reportingobserver.js +6 -6
  136. package/build/npm/cjs/prod/integrations/reportingobserver.js.map +1 -1
  137. package/build/npm/cjs/prod/integrations/spotlight.js +6 -6
  138. package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -1
  139. package/build/npm/cjs/prod/integrations/view-hierarchy.js +2 -2
  140. package/build/npm/cjs/prod/integrations/view-hierarchy.js.map +1 -1
  141. package/build/npm/cjs/prod/integrations/webVitals.js +3 -3
  142. package/build/npm/cjs/prod/integrations/webVitals.js.map +1 -1
  143. package/build/npm/cjs/prod/integrations/webWorker.js +18 -18
  144. package/build/npm/cjs/prod/integrations/webWorker.js.map +1 -1
  145. package/build/npm/cjs/prod/profiling/UIProfiler.js +33 -33
  146. package/build/npm/cjs/prod/profiling/UIProfiler.js.map +1 -1
  147. package/build/npm/cjs/prod/profiling/index.js +7 -7
  148. package/build/npm/cjs/prod/profiling/index.js.map +1 -1
  149. package/build/npm/cjs/prod/profiling/integration.js +8 -8
  150. package/build/npm/cjs/prod/profiling/integration.js.map +1 -1
  151. package/build/npm/cjs/prod/profiling/utils.js +16 -16
  152. package/build/npm/cjs/prod/profiling/utils.js.map +1 -1
  153. package/build/npm/cjs/prod/report-dialog.js +7 -7
  154. package/build/npm/cjs/prod/report-dialog.js.map +1 -1
  155. package/build/npm/cjs/prod/sdk.js +9 -9
  156. package/build/npm/cjs/prod/sdk.js.map +1 -1
  157. package/build/npm/cjs/prod/stack-parsers.js +10 -10
  158. package/build/npm/cjs/prod/stack-parsers.js.map +1 -1
  159. package/build/npm/cjs/prod/tracing/backgroundtab.js +7 -7
  160. package/build/npm/cjs/prod/tracing/backgroundtab.js.map +1 -1
  161. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js +48 -48
  162. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js.map +1 -1
  163. package/build/npm/cjs/prod/tracing/linkedTraces.js +10 -11
  164. package/build/npm/cjs/prod/tracing/linkedTraces.js.map +1 -1
  165. package/build/npm/cjs/prod/tracing/reportPageLoaded.js +2 -2
  166. package/build/npm/cjs/prod/tracing/reportPageLoaded.js.map +1 -1
  167. package/build/npm/cjs/prod/tracing/request.js +37 -29
  168. package/build/npm/cjs/prod/tracing/request.js.map +1 -1
  169. package/build/npm/cjs/prod/tracing/setActiveSpan.js +5 -5
  170. package/build/npm/cjs/prod/tracing/setActiveSpan.js.map +1 -1
  171. package/build/npm/cjs/prod/transports/fetch.js +3 -3
  172. package/build/npm/cjs/prod/transports/fetch.js.map +1 -1
  173. package/build/npm/cjs/prod/transports/offline.js +5 -5
  174. package/build/npm/cjs/prod/transports/offline.js.map +1 -1
  175. package/build/npm/cjs/prod/userfeedback.js +3 -3
  176. package/build/npm/cjs/prod/userfeedback.js.map +1 -1
  177. package/build/npm/cjs/prod/utils/detectBrowserExtension.js +2 -2
  178. package/build/npm/cjs/prod/utils/detectBrowserExtension.js.map +1 -1
  179. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js +3 -3
  180. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js.map +1 -1
  181. package/build/npm/esm/dev/client.js +1 -1
  182. package/build/npm/esm/dev/client.js.map +1 -1
  183. package/build/npm/esm/dev/diagnose-sdk.js +1 -1
  184. package/build/npm/esm/dev/diagnose-sdk.js.map +1 -1
  185. package/build/npm/esm/dev/eventbuilder.js +1 -4
  186. package/build/npm/esm/dev/eventbuilder.js.map +1 -1
  187. package/build/npm/esm/dev/helpers.js +1 -1
  188. package/build/npm/esm/dev/helpers.js.map +1 -1
  189. package/build/npm/esm/dev/index.js +3 -2
  190. package/build/npm/esm/dev/index.js.map +1 -1
  191. package/build/npm/esm/dev/integrations/{bfcache.js → bfcacheMetrics.js} +37 -35
  192. package/build/npm/esm/dev/integrations/bfcacheMetrics.js.map +1 -0
  193. package/build/npm/esm/dev/integrations/breadcrumbs.js +1 -1
  194. package/build/npm/esm/dev/integrations/breadcrumbs.js.map +1 -1
  195. package/build/npm/esm/dev/integrations/browserapierrors.js +1 -1
  196. package/build/npm/esm/dev/integrations/browserapierrors.js.map +1 -1
  197. package/build/npm/esm/dev/integrations/browsersession.js +1 -1
  198. package/build/npm/esm/dev/integrations/browsersession.js.map +1 -1
  199. package/build/npm/esm/dev/integrations/contextlines.js +1 -1
  200. package/build/npm/esm/dev/integrations/contextlines.js.map +1 -1
  201. package/build/npm/esm/dev/integrations/culturecontext.js +1 -1
  202. package/build/npm/esm/dev/integrations/culturecontext.js.map +1 -1
  203. package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js +1 -1
  204. package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
  205. package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js +1 -1
  206. package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  207. package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js +1 -1
  208. package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
  209. package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js +1 -1
  210. package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
  211. package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js +1 -1
  212. package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
  213. package/build/npm/esm/dev/integrations/fetchStreamPerformance.js +11 -5
  214. package/build/npm/esm/dev/integrations/fetchStreamPerformance.js.map +1 -1
  215. package/build/npm/esm/dev/integrations/globalhandlers.js +1 -1
  216. package/build/npm/esm/dev/integrations/globalhandlers.js.map +1 -1
  217. package/build/npm/esm/dev/integrations/graphqlClient.js +21 -8
  218. package/build/npm/esm/dev/integrations/graphqlClient.js.map +1 -1
  219. package/build/npm/esm/dev/integrations/httpclient.js +1 -4
  220. package/build/npm/esm/dev/integrations/httpclient.js.map +1 -1
  221. package/build/npm/esm/dev/integrations/httpcontext.js +1 -2
  222. package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -1
  223. package/build/npm/esm/dev/integrations/linkederrors.js +1 -1
  224. package/build/npm/esm/dev/integrations/linkederrors.js.map +1 -1
  225. package/build/npm/esm/dev/integrations/reportingobserver.js +1 -1
  226. package/build/npm/esm/dev/integrations/reportingobserver.js.map +1 -1
  227. package/build/npm/esm/dev/integrations/spotlight.js +1 -1
  228. package/build/npm/esm/dev/integrations/spotlight.js.map +1 -1
  229. package/build/npm/esm/dev/integrations/view-hierarchy.js +1 -1
  230. package/build/npm/esm/dev/integrations/view-hierarchy.js.map +1 -1
  231. package/build/npm/esm/dev/integrations/webVitals.js +1 -1
  232. package/build/npm/esm/dev/integrations/webVitals.js.map +1 -1
  233. package/build/npm/esm/dev/integrations/webWorker.js +1 -1
  234. package/build/npm/esm/dev/integrations/webWorker.js.map +1 -1
  235. package/build/npm/esm/dev/package.json +1 -1
  236. package/build/npm/esm/dev/profiling/UIProfiler.js +1 -1
  237. package/build/npm/esm/dev/profiling/UIProfiler.js.map +1 -1
  238. package/build/npm/esm/dev/profiling/index.js +1 -1
  239. package/build/npm/esm/dev/profiling/index.js.map +1 -1
  240. package/build/npm/esm/dev/profiling/integration.js +1 -1
  241. package/build/npm/esm/dev/profiling/integration.js.map +1 -1
  242. package/build/npm/esm/dev/profiling/utils.js +1 -1
  243. package/build/npm/esm/dev/profiling/utils.js.map +1 -1
  244. package/build/npm/esm/dev/report-dialog.js +1 -1
  245. package/build/npm/esm/dev/report-dialog.js.map +1 -1
  246. package/build/npm/esm/dev/sdk.js +1 -1
  247. package/build/npm/esm/dev/sdk.js.map +1 -1
  248. package/build/npm/esm/dev/stack-parsers.js +1 -1
  249. package/build/npm/esm/dev/stack-parsers.js.map +1 -1
  250. package/build/npm/esm/dev/tracing/backgroundtab.js +1 -1
  251. package/build/npm/esm/dev/tracing/backgroundtab.js.map +1 -1
  252. package/build/npm/esm/dev/tracing/browserTracingIntegration.js +7 -7
  253. package/build/npm/esm/dev/tracing/browserTracingIntegration.js.map +1 -1
  254. package/build/npm/esm/dev/tracing/linkedTraces.js +1 -2
  255. package/build/npm/esm/dev/tracing/linkedTraces.js.map +1 -1
  256. package/build/npm/esm/dev/tracing/reportPageLoaded.js +1 -1
  257. package/build/npm/esm/dev/tracing/reportPageLoaded.js.map +1 -1
  258. package/build/npm/esm/dev/tracing/request.js +16 -8
  259. package/build/npm/esm/dev/tracing/request.js.map +1 -1
  260. package/build/npm/esm/dev/tracing/setActiveSpan.js +1 -1
  261. package/build/npm/esm/dev/tracing/setActiveSpan.js.map +1 -1
  262. package/build/npm/esm/dev/transports/fetch.js +1 -1
  263. package/build/npm/esm/dev/transports/fetch.js.map +1 -1
  264. package/build/npm/esm/dev/transports/offline.js +1 -1
  265. package/build/npm/esm/dev/transports/offline.js.map +1 -1
  266. package/build/npm/esm/dev/userfeedback.js +1 -1
  267. package/build/npm/esm/dev/userfeedback.js.map +1 -1
  268. package/build/npm/esm/dev/utils/detectBrowserExtension.js +1 -1
  269. package/build/npm/esm/dev/utils/detectBrowserExtension.js.map +1 -1
  270. package/build/npm/esm/dev/utils/lazyLoadIntegration.js +1 -1
  271. package/build/npm/esm/dev/utils/lazyLoadIntegration.js.map +1 -1
  272. package/build/npm/esm/prod/client.js +1 -1
  273. package/build/npm/esm/prod/client.js.map +1 -1
  274. package/build/npm/esm/prod/diagnose-sdk.js +1 -1
  275. package/build/npm/esm/prod/diagnose-sdk.js.map +1 -1
  276. package/build/npm/esm/prod/eventbuilder.js +1 -4
  277. package/build/npm/esm/prod/eventbuilder.js.map +1 -1
  278. package/build/npm/esm/prod/helpers.js +1 -1
  279. package/build/npm/esm/prod/helpers.js.map +1 -1
  280. package/build/npm/esm/prod/index.js +3 -2
  281. package/build/npm/esm/prod/index.js.map +1 -1
  282. package/build/npm/esm/prod/integrations/{bfcache.js → bfcacheMetrics.js} +37 -35
  283. package/build/npm/esm/prod/integrations/bfcacheMetrics.js.map +1 -0
  284. package/build/npm/esm/prod/integrations/breadcrumbs.js +1 -1
  285. package/build/npm/esm/prod/integrations/breadcrumbs.js.map +1 -1
  286. package/build/npm/esm/prod/integrations/browserapierrors.js +1 -1
  287. package/build/npm/esm/prod/integrations/browserapierrors.js.map +1 -1
  288. package/build/npm/esm/prod/integrations/browsersession.js +1 -1
  289. package/build/npm/esm/prod/integrations/browsersession.js.map +1 -1
  290. package/build/npm/esm/prod/integrations/contextlines.js +1 -1
  291. package/build/npm/esm/prod/integrations/contextlines.js.map +1 -1
  292. package/build/npm/esm/prod/integrations/culturecontext.js +1 -1
  293. package/build/npm/esm/prod/integrations/culturecontext.js.map +1 -1
  294. package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js +1 -1
  295. package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
  296. package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js +1 -1
  297. package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  298. package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js +1 -1
  299. package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
  300. package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js +1 -1
  301. package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
  302. package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js +1 -1
  303. package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
  304. package/build/npm/esm/prod/integrations/fetchStreamPerformance.js +11 -5
  305. package/build/npm/esm/prod/integrations/fetchStreamPerformance.js.map +1 -1
  306. package/build/npm/esm/prod/integrations/globalhandlers.js +1 -1
  307. package/build/npm/esm/prod/integrations/globalhandlers.js.map +1 -1
  308. package/build/npm/esm/prod/integrations/graphqlClient.js +21 -8
  309. package/build/npm/esm/prod/integrations/graphqlClient.js.map +1 -1
  310. package/build/npm/esm/prod/integrations/httpclient.js +1 -4
  311. package/build/npm/esm/prod/integrations/httpclient.js.map +1 -1
  312. package/build/npm/esm/prod/integrations/httpcontext.js +1 -2
  313. package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -1
  314. package/build/npm/esm/prod/integrations/linkederrors.js +1 -1
  315. package/build/npm/esm/prod/integrations/linkederrors.js.map +1 -1
  316. package/build/npm/esm/prod/integrations/reportingobserver.js +1 -1
  317. package/build/npm/esm/prod/integrations/reportingobserver.js.map +1 -1
  318. package/build/npm/esm/prod/integrations/spotlight.js +1 -1
  319. package/build/npm/esm/prod/integrations/spotlight.js.map +1 -1
  320. package/build/npm/esm/prod/integrations/view-hierarchy.js +1 -1
  321. package/build/npm/esm/prod/integrations/view-hierarchy.js.map +1 -1
  322. package/build/npm/esm/prod/integrations/webVitals.js +1 -1
  323. package/build/npm/esm/prod/integrations/webVitals.js.map +1 -1
  324. package/build/npm/esm/prod/integrations/webWorker.js +1 -1
  325. package/build/npm/esm/prod/integrations/webWorker.js.map +1 -1
  326. package/build/npm/esm/prod/package.json +1 -1
  327. package/build/npm/esm/prod/profiling/UIProfiler.js +1 -1
  328. package/build/npm/esm/prod/profiling/UIProfiler.js.map +1 -1
  329. package/build/npm/esm/prod/profiling/index.js +1 -1
  330. package/build/npm/esm/prod/profiling/index.js.map +1 -1
  331. package/build/npm/esm/prod/profiling/integration.js +1 -1
  332. package/build/npm/esm/prod/profiling/integration.js.map +1 -1
  333. package/build/npm/esm/prod/profiling/utils.js +1 -1
  334. package/build/npm/esm/prod/profiling/utils.js.map +1 -1
  335. package/build/npm/esm/prod/report-dialog.js +1 -1
  336. package/build/npm/esm/prod/report-dialog.js.map +1 -1
  337. package/build/npm/esm/prod/sdk.js +1 -1
  338. package/build/npm/esm/prod/sdk.js.map +1 -1
  339. package/build/npm/esm/prod/stack-parsers.js +1 -1
  340. package/build/npm/esm/prod/stack-parsers.js.map +1 -1
  341. package/build/npm/esm/prod/tracing/backgroundtab.js +1 -1
  342. package/build/npm/esm/prod/tracing/backgroundtab.js.map +1 -1
  343. package/build/npm/esm/prod/tracing/browserTracingIntegration.js +7 -7
  344. package/build/npm/esm/prod/tracing/browserTracingIntegration.js.map +1 -1
  345. package/build/npm/esm/prod/tracing/linkedTraces.js +1 -2
  346. package/build/npm/esm/prod/tracing/linkedTraces.js.map +1 -1
  347. package/build/npm/esm/prod/tracing/reportPageLoaded.js +1 -1
  348. package/build/npm/esm/prod/tracing/reportPageLoaded.js.map +1 -1
  349. package/build/npm/esm/prod/tracing/request.js +16 -8
  350. package/build/npm/esm/prod/tracing/request.js.map +1 -1
  351. package/build/npm/esm/prod/tracing/setActiveSpan.js +1 -1
  352. package/build/npm/esm/prod/tracing/setActiveSpan.js.map +1 -1
  353. package/build/npm/esm/prod/transports/fetch.js +1 -1
  354. package/build/npm/esm/prod/transports/fetch.js.map +1 -1
  355. package/build/npm/esm/prod/transports/offline.js +1 -1
  356. package/build/npm/esm/prod/transports/offline.js.map +1 -1
  357. package/build/npm/esm/prod/userfeedback.js +1 -1
  358. package/build/npm/esm/prod/userfeedback.js.map +1 -1
  359. package/build/npm/esm/prod/utils/detectBrowserExtension.js +1 -1
  360. package/build/npm/esm/prod/utils/detectBrowserExtension.js.map +1 -1
  361. package/build/npm/esm/prod/utils/lazyLoadIntegration.js +1 -1
  362. package/build/npm/esm/prod/utils/lazyLoadIntegration.js.map +1 -1
  363. package/build/npm/types/client.d.ts +3 -2
  364. package/build/npm/types/client.d.ts.map +1 -1
  365. package/build/npm/types/eventbuilder.d.ts +1 -1
  366. package/build/npm/types/eventbuilder.d.ts.map +1 -1
  367. package/build/npm/types/exports.d.ts +3 -3
  368. package/build/npm/types/exports.d.ts.map +1 -1
  369. package/build/npm/types/helpers.d.ts +2 -2
  370. package/build/npm/types/helpers.d.ts.map +1 -1
  371. package/build/npm/types/index.bundle.logs.metrics.d.ts +1 -1
  372. package/build/npm/types/index.bundle.logs.metrics.d.ts.map +1 -1
  373. package/build/npm/types/index.bundle.replay.logs.metrics.d.ts +1 -1
  374. package/build/npm/types/index.bundle.replay.logs.metrics.d.ts.map +1 -1
  375. package/build/npm/types/index.bundle.tracing.d.ts +2 -2
  376. package/build/npm/types/index.bundle.tracing.d.ts.map +1 -1
  377. package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts +3 -3
  378. package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts.map +1 -1
  379. package/build/npm/types/index.bundle.tracing.replay.d.ts +2 -2
  380. package/build/npm/types/index.bundle.tracing.replay.d.ts.map +1 -1
  381. package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts +2 -2
  382. package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts.map +1 -1
  383. package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +2 -2
  384. package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts.map +1 -1
  385. package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts +3 -3
  386. package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts.map +1 -1
  387. package/build/npm/types/index.d.ts +4 -4
  388. package/build/npm/types/index.d.ts.map +1 -1
  389. package/build/npm/types/integrations/{bfcache.d.ts → bfcacheMetrics.d.ts} +3 -3
  390. package/build/npm/types/integrations/bfcacheMetrics.d.ts.map +1 -0
  391. package/build/npm/types/integrations/breadcrumbs.d.ts.map +1 -1
  392. package/build/npm/types/integrations/contextlines.d.ts +1 -1
  393. package/build/npm/types/integrations/contextlines.d.ts.map +1 -1
  394. package/build/npm/types/integrations/fetchStreamPerformance.d.ts.map +1 -1
  395. package/build/npm/types/integrations/globalhandlers.d.ts +1 -1
  396. package/build/npm/types/integrations/globalhandlers.d.ts.map +1 -1
  397. package/build/npm/types/integrations/graphqlClient.d.ts.map +1 -1
  398. package/build/npm/types/integrations/httpclient.d.ts.map +1 -1
  399. package/build/npm/types/integrations/view-hierarchy.d.ts +1 -1
  400. package/build/npm/types/integrations/view-hierarchy.d.ts.map +1 -1
  401. package/build/npm/types/integrations/webWorker.d.ts +1 -1
  402. package/build/npm/types/integrations/webWorker.d.ts.map +1 -1
  403. package/build/npm/types/integrations-bundle/index.captureconsole.d.ts +1 -1
  404. package/build/npm/types/integrations-bundle/index.captureconsole.d.ts.map +1 -1
  405. package/build/npm/types/integrations-bundle/index.dedupe.d.ts +1 -1
  406. package/build/npm/types/integrations-bundle/index.dedupe.d.ts.map +1 -1
  407. package/build/npm/types/integrations-bundle/index.extraerrordata.d.ts +1 -1
  408. package/build/npm/types/integrations-bundle/index.extraerrordata.d.ts.map +1 -1
  409. package/build/npm/types/integrations-bundle/index.feedback.d.ts +1 -1
  410. package/build/npm/types/integrations-bundle/index.feedback.d.ts.map +1 -1
  411. package/build/npm/types/integrations-bundle/index.modulemetadata.d.ts +1 -1
  412. package/build/npm/types/integrations-bundle/index.modulemetadata.d.ts.map +1 -1
  413. package/build/npm/types/integrations-bundle/index.rewriteframes.d.ts +1 -1
  414. package/build/npm/types/integrations-bundle/index.rewriteframes.d.ts.map +1 -1
  415. package/build/npm/types/pluggable-exports-bundle/index.multiplexedtransport.d.ts +1 -1
  416. package/build/npm/types/pluggable-exports-bundle/index.multiplexedtransport.d.ts.map +1 -1
  417. package/build/npm/types/profiling/UIProfiler.d.ts +1 -1
  418. package/build/npm/types/profiling/UIProfiler.d.ts.map +1 -1
  419. package/build/npm/types/profiling/index.d.ts +1 -1
  420. package/build/npm/types/profiling/index.d.ts.map +1 -1
  421. package/build/npm/types/profiling/utils.d.ts +1 -1
  422. package/build/npm/types/profiling/utils.d.ts.map +1 -1
  423. package/build/npm/types/report-dialog.d.ts +1 -1
  424. package/build/npm/types/report-dialog.d.ts.map +1 -1
  425. package/build/npm/types/sdk.d.ts +1 -1
  426. package/build/npm/types/sdk.d.ts.map +1 -1
  427. package/build/npm/types/stack-parsers.d.ts +1 -1
  428. package/build/npm/types/stack-parsers.d.ts.map +1 -1
  429. package/build/npm/types/tracing/browserTracingIntegration.d.ts +1 -1
  430. package/build/npm/types/tracing/browserTracingIntegration.d.ts.map +1 -1
  431. package/build/npm/types/tracing/linkedTraces.d.ts +2 -2
  432. package/build/npm/types/tracing/linkedTraces.d.ts.map +1 -1
  433. package/build/npm/types/tracing/reportPageLoaded.d.ts +1 -1
  434. package/build/npm/types/tracing/reportPageLoaded.d.ts.map +1 -1
  435. package/build/npm/types/tracing/request.d.ts +1 -1
  436. package/build/npm/types/tracing/request.d.ts.map +1 -1
  437. package/build/npm/types/tracing/setActiveSpan.d.ts +1 -1
  438. package/build/npm/types/tracing/setActiveSpan.d.ts.map +1 -1
  439. package/build/npm/types/transports/fetch.d.ts +1 -1
  440. package/build/npm/types/transports/fetch.d.ts.map +1 -1
  441. package/build/npm/types/transports/offline.d.ts +1 -1
  442. package/build/npm/types/transports/offline.d.ts.map +1 -1
  443. package/build/npm/types/transports/types.d.ts +1 -1
  444. package/build/npm/types/transports/types.d.ts.map +1 -1
  445. package/build/npm/types/userfeedback.d.ts +1 -1
  446. package/build/npm/types/userfeedback.d.ts.map +1 -1
  447. package/build/npm/types/utils/lazyLoadIntegration.d.ts +1 -1
  448. package/build/npm/types/utils/lazyLoadIntegration.d.ts.map +1 -1
  449. package/package.json +7 -7
  450. package/build/npm/cjs/dev/integrations/bfcache.js.map +0 -1
  451. package/build/npm/cjs/prod/integrations/bfcache.js.map +0 -1
  452. package/build/npm/esm/dev/integrations/bfcache.js.map +0 -1
  453. package/build/npm/esm/prod/integrations/bfcache.js.map +0 -1
  454. package/build/npm/types/integrations/bfcache.d.ts.map +0 -1
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
3
+ const core = require('@sentry/core');
4
4
 
5
- function reportPageLoaded(client = browser.getClient()) {
5
+ function reportPageLoaded(client = core.getClient()) {
6
6
  client?.emit("endPageloadSpan");
7
7
  }
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"reportPageLoaded.js","sources":["../../../../../src/tracing/reportPageLoaded.ts"],"sourcesContent":["import type { Client } from '@sentry/core/browser';\nimport { getClient } from '@sentry/core/browser';\n\n/**\n * Manually report the end of the page load, resulting in the SDK ending the pageload span.\n * This only works if {@link BrowserTracingOptions.enableReportPageLoaded} is set to `true`.\n * Otherwise, the pageload span will end itself based on the {@link BrowserTracingOptions.finalTimeout},\n * {@link BrowserTracingOptions.idleTimeout} and {@link BrowserTracingOptions.childSpanTimeout}.\n *\n * @param client - The client to use. If not provided, the global client will be used.\n */\nexport function reportPageLoaded(client: Client | undefined = getClient()): void {\n client?.emit('endPageloadSpan');\n}\n"],"names":["getClient"],"mappings":";;;;AAWO,SAAS,gBAAA,CAAiB,MAAA,GAA6BA,iBAAA,EAAU,EAAS;AAC/E,EAAA,MAAA,EAAQ,KAAK,iBAAiB,CAAA;AAChC;;;;"}
1
+ {"version":3,"file":"reportPageLoaded.js","sources":["../../../../../src/tracing/reportPageLoaded.ts"],"sourcesContent":["import type { Client } from '@sentry/core';\nimport { getClient } from '@sentry/core';\n\n/**\n * Manually report the end of the page load, resulting in the SDK ending the pageload span.\n * This only works if {@link BrowserTracingOptions.enableReportPageLoaded} is set to `true`.\n * Otherwise, the pageload span will end itself based on the {@link BrowserTracingOptions.finalTimeout},\n * {@link BrowserTracingOptions.idleTimeout} and {@link BrowserTracingOptions.childSpanTimeout}.\n *\n * @param client - The client to use. If not provided, the global client will be used.\n */\nexport function reportPageLoaded(client: Client | undefined = getClient()): void {\n client?.emit('endPageloadSpan');\n}\n"],"names":["getClient"],"mappings":";;;;AAWO,SAAS,gBAAA,CAAiB,MAAA,GAA6BA,cAAA,EAAU,EAAS;AAC/E,EAAA,MAAA,EAAQ,KAAK,iBAAiB,CAAA;AAChC;;;;"}
@@ -1,10 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
4
3
  const core = require('@sentry/core');
4
+ const browser = require('@sentry/core/browser');
5
5
  const browserUtils = require('@sentry/browser-utils');
6
+ const helpers = require('../helpers.js');
6
7
  const utils = require('./utils.js');
7
8
  const attributes = require('@sentry/conventions/attributes');
9
+ const op = require('@sentry/conventions/op');
8
10
 
9
11
  const defaultRequestInstrumentationOptions = {
10
12
  traceFetch: true,
@@ -29,15 +31,17 @@ function instrumentOutgoingRequests(client, _options) {
29
31
  const spans = {};
30
32
  const propagateTraceparent = client.getOptions().propagateTraceparent;
31
33
  if (traceFetch) {
32
- browser.addFetchInstrumentationHandler((handlerData) => {
33
- const createdSpan = browser.instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans, {
34
+ core.addFetchInstrumentationHandler((handlerData) => {
35
+ const createdSpan = core.instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans, {
34
36
  propagateTraceparent,
35
- onRequestSpanEnd
37
+ onRequestSpanEnd,
38
+ // The generic fetch instrumentation has no page origin to resolve relative URLs against.
39
+ urlBase: helpers.WINDOW.location?.origin
36
40
  });
37
41
  if (createdSpan) {
38
42
  const fullUrl = utils.getFullURL(handlerData.fetchData.url);
39
- const host = fullUrl ? browser.parseUrl(fullUrl).host : void 0;
40
- const sanitizedFullUrl = fullUrl ? browser.stripDataUrlContent(fullUrl) : void 0;
43
+ const host = fullUrl ? core.parseUrl(fullUrl).host?.replace(/^.*@/, "") : void 0;
44
+ const sanitizedFullUrl = fullUrl ? core.stripDataUrlContent(fullUrl) : void 0;
41
45
  createdSpan.setAttributes({
42
46
  [attributes.URL_FULL]: core.filterCollectedUrl(sanitizedFullUrl),
43
47
  [attributes.SERVER_ADDRESS]: host
@@ -72,15 +76,15 @@ function instrumentOutgoingRequests(client, _options) {
72
76
  }
73
77
  const HTTP_TIMING_WAIT_MS = 300;
74
78
  function addHTTPTimings(span, client) {
75
- const url = browser.spanToJSON(span).attributes[attributes.URL_FULL];
79
+ const url = core.spanToJSON(span).attributes[attributes.URL_FULL];
76
80
  if (!url || typeof url !== "string") {
77
81
  return;
78
82
  }
79
83
  let onEntryFound = () => void setTimeout(unsubscribePerformanceObsever);
80
- if (browser.hasSpanStreamingEnabled(client)) {
84
+ if (core.hasSpanStreamingEnabled(client)) {
81
85
  const originalEnd = span.end.bind(span);
82
86
  span.end = (endTimestamp) => {
83
- const capturedEndTimestamp = endTimestamp ?? browser.timestampInSeconds();
87
+ const capturedEndTimestamp = endTimestamp ?? core.timestampInSeconds();
84
88
  let isEnded = false;
85
89
  const endSpanAndCleanup = () => {
86
90
  if (isEnded) {
@@ -111,7 +115,7 @@ function shouldAttachHeaders(targetUrl, tracePropagationTargets) {
111
115
  if (!tracePropagationTargets) {
112
116
  return isRelativeSameOriginRequest;
113
117
  } else {
114
- return browser.matchesTracePropagationTargets(targetUrl, tracePropagationTargets);
118
+ return core.matchesTracePropagationTargets(targetUrl, tracePropagationTargets);
115
119
  }
116
120
  } else {
117
121
  let resolvedUrl;
@@ -126,7 +130,7 @@ function shouldAttachHeaders(targetUrl, tracePropagationTargets) {
126
130
  if (!tracePropagationTargets) {
127
131
  return isSameOriginRequest;
128
132
  } else {
129
- return browser.matchesTracePropagationTargets(resolvedUrl.toString(), tracePropagationTargets) || isSameOriginRequest && browser.matchesTracePropagationTargets(resolvedUrl.pathname, tracePropagationTargets);
133
+ return core.matchesTracePropagationTargets(resolvedUrl.toString(), tracePropagationTargets) || isSameOriginRequest && core.matchesTracePropagationTargets(resolvedUrl.pathname, tracePropagationTargets);
130
134
  }
131
135
  }
132
136
  }
@@ -137,14 +141,14 @@ function xhrCallback(handlerData, shouldCreateSpan, shouldAttachHeaders2, spans,
137
141
  return void 0;
138
142
  }
139
143
  const { url, method } = sentryXhrData;
140
- const shouldCreateSpanResult = browser.hasSpansEnabled() && shouldCreateSpan(url);
144
+ const shouldCreateSpanResult = core.hasSpansEnabled() && shouldCreateSpan(url);
141
145
  if (handlerData.endTimestamp) {
142
146
  const spanId = xhr.__sentry_xhr_span_id__;
143
147
  if (!spanId) return;
144
148
  const span2 = spans[spanId];
145
149
  if (span2) {
146
150
  if (shouldCreateSpanResult && sentryXhrData.status_code !== void 0) {
147
- browser.setHttpStatus(span2, sentryXhrData.status_code);
151
+ core.setHttpStatus(span2, sentryXhrData.status_code);
148
152
  span2.end();
149
153
  onRequestSpanEnd?.(span2, {
150
154
  headers: utils.createHeadersSafely(browserUtils.parseXhrResponseHeaders(xhr)),
@@ -156,27 +160,31 @@ function xhrCallback(handlerData, shouldCreateSpan, shouldAttachHeaders2, spans,
156
160
  return void 0;
157
161
  }
158
162
  const fullUrl = utils.getFullURL(url);
159
- const parsedUrl = fullUrl ? browser.parseUrl(fullUrl) : browser.parseUrl(url);
160
- const sanitizedFullUrl = fullUrl ? browser.stripDataUrlContent(fullUrl) : void 0;
161
- const urlForSpanName = browser.stripDataUrlContent(browser.stripUrlQueryAndFragment(url));
162
- const client = browser.getClient();
163
- const hasParent = !!browser.getActiveSpan();
164
- const shouldEmitSpan = hasParent || !!client && browser.hasSpanStreamingEnabled(client);
163
+ const parsedUrl = fullUrl ? core.parseUrl(fullUrl) : core.parseUrl(url);
164
+ const sanitizedFullUrl = fullUrl ? core.stripDataUrlContent(fullUrl) : void 0;
165
+ const urlForSpanName = core.stripDataUrlContent(core.stripUrlQueryAndFragment(url));
166
+ const client = core.getClient();
167
+ const hasParent = !!core.getActiveSpan();
168
+ const shouldEmitSpan = hasParent || !!client && core.hasSpanStreamingEnabled(client);
169
+ const host = parsedUrl?.host?.replace(/^.*@/, "");
170
+ const domain = core.getUrlDomain(fullUrl || url);
171
+ const streamedName = domain ? `${method} ${domain}` : method;
165
172
  const span = shouldCreateSpanResult && shouldEmitSpan ? browser.startInactiveSpan({
166
- name: `${method} ${urlForSpanName}`,
173
+ name: !!client && core.hasSpanStreamingEnabled(client) ? streamedName : `${method} ${urlForSpanName}`,
167
174
  attributes: {
168
175
  type: "xhr",
169
176
  // eslint-disable-next-line typescript/no-deprecated
170
177
  [attributes.HTTP_REQUEST_METHOD]: method,
171
178
  [attributes.URL_FULL]: core.filterCollectedUrl(sanitizedFullUrl),
172
- [attributes.SERVER_ADDRESS]: parsedUrl?.host,
173
- [browser.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser",
174
- [browser.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "http.client",
175
- [attributes.URL_QUERY]: core.filterCollectedUrlQuery(browser.getUrlQuery(parsedUrl?.search)),
176
- [attributes.URL_FRAGMENT]: browser.getUrlFragment(parsedUrl?.hash)
179
+ [attributes.SERVER_ADDRESS]: host,
180
+ [attributes.URL_DOMAIN]: domain,
181
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser",
182
+ [attributes.SENTRY_OP]: op.HTTP_CLIENT,
183
+ [attributes.URL_QUERY]: core.filterCollectedUrlQuery(core.getUrlQuery(parsedUrl?.search)),
184
+ [attributes.URL_FRAGMENT]: core.getUrlFragment(parsedUrl?.hash)
177
185
  }
178
- }) : new browser.SentryNonRecordingSpan();
179
- const spanForTraceHeaders = browser.spanIsIgnored(span) && hasParent ? void 0 : span;
186
+ }) : new core.SentryNonRecordingSpan();
187
+ const spanForTraceHeaders = core.spanIsIgnored(span) && hasParent ? void 0 : span;
180
188
  if (shouldCreateSpanResult && !shouldEmitSpan) {
181
189
  client?.recordDroppedEvent("no_parent_span", "span");
182
190
  }
@@ -188,7 +196,7 @@ function xhrCallback(handlerData, shouldCreateSpan, shouldAttachHeaders2, spans,
188
196
  // If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction),
189
197
  // we do not want to use the span as base for the trace headers,
190
198
  // which means that the headers will be generated from the scope and the sampling decision is deferred
191
- browser.hasSpansEnabled() && shouldEmitSpan ? spanForTraceHeaders : void 0,
199
+ core.hasSpansEnabled() && shouldEmitSpan ? spanForTraceHeaders : void 0,
192
200
  propagateTraceparent
193
201
  );
194
202
  }
@@ -198,7 +206,7 @@ function xhrCallback(handlerData, shouldCreateSpan, shouldAttachHeaders2, spans,
198
206
  return span;
199
207
  }
200
208
  function addTracingHeadersToXhrRequest(xhr, span, propagateTraceparent) {
201
- const { "sentry-trace": sentryTrace, baggage, traceparent } = browser.getTraceData({ span, propagateTraceparent });
209
+ const { "sentry-trace": sentryTrace, baggage, traceparent } = core.getTraceData({ span, propagateTraceparent });
202
210
  if (sentryTrace) {
203
211
  setHeaderOnXhr(xhr, sentryTrace, baggage, traceparent);
204
212
  }
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sources":["../../../../../src/tracing/request.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type { Client, RequestHookInfo, ResponseHookInfo, Span, SpanTimeInput } from '@sentry/core/browser';\nimport {\n addFetchInstrumentationHandler,\n getActiveSpan,\n getClient,\n getTraceData,\n getUrlFragment,\n getUrlQuery,\n hasSpansEnabled,\n hasSpanStreamingEnabled,\n instrumentFetchRequest,\n matchesTracePropagationTargets,\n parseUrl,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n setHttpStatus,\n spanIsIgnored,\n spanToJSON,\n startInactiveSpan,\n stripDataUrlContent,\n stripUrlQueryAndFragment,\n timestampInSeconds,\n} from '@sentry/core/browser';\nimport type { HandlerDataXhr, SentryWrappedXMLHttpRequest, XhrHint } from '@sentry/browser-utils';\nimport { filterCollectedUrl, filterCollectedUrlQuery } from '@sentry/core';\nimport {\n addPerformanceInstrumentationHandler,\n addXhrInstrumentationHandler,\n getLocationHref,\n parseXhrResponseHeaders,\n resourceTimingToSpanAttributes,\n SENTRY_XHR_DATA_KEY,\n} from '@sentry/browser-utils';\nimport type { BrowserClient } from '../client';\nimport { baggageHeaderHasSentryValues, createHeadersSafely, getFullURL, isPerformanceResourceTiming } from './utils';\nimport { HTTP_REQUEST_METHOD, SERVER_ADDRESS, URL_FRAGMENT, URL_FULL, URL_QUERY } from '@sentry/conventions/attributes';\n\n/** Options for Request Instrumentation */\nexport interface RequestInstrumentationOptions {\n /**\n * List of strings and/or Regular Expressions used to determine which outgoing requests will have `sentry-trace` and `baggage`\n * headers attached.\n *\n * **Default:** If this option is not provided, tracing headers will be attached to all outgoing requests.\n * If you are using a browser SDK, by default, tracing headers will only be attached to outgoing requests to the same origin.\n *\n * **Disclaimer:** Carelessly setting this option in browser environments may result into CORS errors!\n * Only attach tracing headers to requests to the same origin, or to requests to services you can control CORS headers of.\n * Cross-origin requests, meaning requests to a different domain, for example a request to `https://api.example.com/` while you're on `https://example.com/`, take special care.\n * If you are attaching headers to cross-origin requests, make sure the backend handling the request returns a `\"Access-Control-Allow-Headers: sentry-trace, baggage\"` header to ensure your requests aren't blocked.\n *\n * If you provide a `tracePropagationTargets` array, the entries you provide will be matched against the entire URL of the outgoing request.\n * If you are using a browser SDK, the entries will also be matched against the pathname of the outgoing requests.\n * This is so you can have matchers for relative requests, for example, `/^\\/api/` if you want to trace requests to your `/api` routes on the same domain.\n *\n * If any of the two match any of the provided values, tracing headers will be attached to the outgoing request.\n * Both, the string values, and the RegExes you provide in the array will match if they partially match the URL or pathname.\n * Matching is case-insensitive, so `'myApi.com'` and `/^myApi\\.com/` both match a request to `https://myapi.com`.\n *\n * Examples:\n * - `tracePropagationTargets: [/^\\/api/]` and request to `https://same-origin.com/api/posts`:\n * - Tracing headers will be attached because the request is sent to the same origin and the regex matches the pathname \"/api/posts\".\n * - `tracePropagationTargets: [/^\\/api/]` and request to `https://different-origin.com/api/posts`:\n * - Tracing headers will not be attached because the pathname will only be compared when the request target lives on the same origin.\n * - `tracePropagationTargets: [/^\\/api/, 'https://external-api.com']` and request to `https://external-api.com/v1/data`:\n * - Tracing headers will be attached because the request URL matches the string `'https://external-api.com'`.\n */\n tracePropagationTargets?: Array<string | RegExp>;\n\n /**\n * Flag to disable patching all together for fetch requests.\n *\n * Default: true\n */\n traceFetch: boolean;\n\n /**\n * Flag to disable patching all together for xhr requests.\n *\n * Default: true\n */\n traceXHR: boolean;\n\n /**\n * If true, Sentry will capture http timings and add them to the corresponding http spans.\n *\n * Default: true\n */\n enableHTTPTimings: boolean;\n\n /**\n * This function will be called before creating a span for a request with the given url.\n * Return false if you don't want a span for the given url.\n *\n * Default: (url: string) => true\n */\n shouldCreateSpanForRequest?(this: void, url: string): boolean;\n\n /**\n * Is called when spans are started for outgoing requests.\n */\n onRequestSpanStart?(span: Span, requestInformation: RequestHookInfo): void;\n\n /**\n * Is called when spans end for outgoing requests, providing access to response headers.\n */\n onRequestSpanEnd?(span: Span, responseInformation: ResponseHookInfo): void;\n}\n\nexport const defaultRequestInstrumentationOptions: RequestInstrumentationOptions = {\n traceFetch: true,\n traceXHR: true,\n enableHTTPTimings: true,\n};\n\n/** Registers span creators for xhr and fetch requests */\nexport function instrumentOutgoingRequests(client: Client, _options?: Partial<RequestInstrumentationOptions>): void {\n const {\n traceFetch,\n traceXHR,\n shouldCreateSpanForRequest,\n enableHTTPTimings,\n tracePropagationTargets,\n onRequestSpanStart,\n onRequestSpanEnd,\n } = {\n ...defaultRequestInstrumentationOptions,\n ..._options,\n };\n\n const shouldCreateSpan =\n typeof shouldCreateSpanForRequest === 'function' ? shouldCreateSpanForRequest : (_: string) => true;\n\n const shouldAttachHeadersWithTargets = (url: string): boolean => shouldAttachHeaders(url, tracePropagationTargets);\n\n const spans: Record<string, Span> = {};\n\n const propagateTraceparent = (client as BrowserClient).getOptions().propagateTraceparent;\n\n if (traceFetch) {\n addFetchInstrumentationHandler(handlerData => {\n const createdSpan = instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans, {\n propagateTraceparent,\n onRequestSpanEnd,\n });\n\n // We cannot use `window.location` in the generic fetch instrumentation,\n // but we need it for reliable `server.address` attribute.\n // so we extend this in here\n if (createdSpan) {\n const fullUrl = getFullURL(handlerData.fetchData.url);\n const host = fullUrl ? parseUrl(fullUrl).host : undefined;\n const sanitizedFullUrl = fullUrl ? stripDataUrlContent(fullUrl) : undefined;\n createdSpan.setAttributes({\n [URL_FULL]: filterCollectedUrl(sanitizedFullUrl),\n [SERVER_ADDRESS]: host,\n });\n\n if (enableHTTPTimings) {\n addHTTPTimings(createdSpan, client);\n }\n\n onRequestSpanStart?.(createdSpan, { headers: handlerData.headers });\n }\n });\n }\n\n if (traceXHR) {\n addXhrInstrumentationHandler(handlerData => {\n const createdSpan = xhrCallback(\n handlerData,\n shouldCreateSpan,\n shouldAttachHeadersWithTargets,\n spans,\n propagateTraceparent,\n onRequestSpanEnd,\n );\n\n if (createdSpan) {\n if (enableHTTPTimings) {\n addHTTPTimings(createdSpan, client);\n }\n\n onRequestSpanStart?.(createdSpan, {\n headers: createHeadersSafely(handlerData.xhr.__sentry_xhr_v3__?.request_headers),\n });\n }\n });\n }\n}\n\n/**\n * The maximum time (ms) to wait for PerformanceResourceTiming data before ending the span.\n * Same approach is used by OTel's browser fetch instrumentation:\n * See {@link https://github.com/open-telemetry/opentelemetry-js/blob/30f94fe99339287b1e4d3c8bb90172c2523f06f4/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts#L352-L372}\n */\nconst HTTP_TIMING_WAIT_MS = 300;\n\n/**\n * Creates a temporary observer to listen to the next fetch/xhr resourcing timings,\n * so that when timings hit their per-browser limit they don't need to be removed.\n *\n * @param span A span that has yet to be finished, must contain `url.full` on data.\n */\nfunction addHTTPTimings(span: Span, client: Client): void {\n const url = spanToJSON(span).attributes[URL_FULL];\n\n if (!url || typeof url !== 'string') {\n return;\n }\n\n // Clean up the performance observer and other resources\n // We have to wait here because otherwise this cleans itself up before it is fully done.\n // Default (non-streaming): just deregister the observer.\n let onEntryFound = (): void => void setTimeout(unsubscribePerformanceObsever);\n\n // For streamed spans, we have to artificially delay the ending of the span until we\n // either receive the timing data, or HTTP_TIMING_WAIT_MS elapses.\n if (hasSpanStreamingEnabled(client)) {\n const originalEnd = span.end.bind(span);\n\n span.end = (endTimestamp?: SpanTimeInput) => {\n const capturedEndTimestamp = endTimestamp ?? timestampInSeconds();\n let isEnded = false;\n\n const endSpanAndCleanup = (): void => {\n if (isEnded) {\n return;\n }\n isEnded = true;\n setTimeout(unsubscribePerformanceObsever);\n originalEnd(capturedEndTimestamp);\n clearTimeout(fallbackTimeout);\n };\n\n onEntryFound = endSpanAndCleanup;\n\n // Fallback: always end the span after HTTP_TIMING_WAIT_MS even if no\n // PerformanceResourceTiming entry arrives (e.g. cross-origin without\n // Timing-Allow-Origin, or the browser didn't fire the observer in time).\n const fallbackTimeout = setTimeout(endSpanAndCleanup, HTTP_TIMING_WAIT_MS);\n };\n }\n\n const unsubscribePerformanceObsever = addPerformanceInstrumentationHandler('resource', ({ entries }) => {\n entries.forEach(entry => {\n if (isPerformanceResourceTiming(entry) && entry.name.endsWith(url)) {\n span.setAttributes(resourceTimingToSpanAttributes(entry));\n onEntryFound();\n }\n });\n });\n}\n\n/**\n * A function that determines whether to attach tracing headers to a request.\n * We only export this function for testing purposes.\n */\nexport function shouldAttachHeaders(\n targetUrl: string,\n tracePropagationTargets: (string | RegExp)[] | undefined,\n): boolean {\n // window.location.href not being defined is an edge case in the browser but we need to handle it.\n // Potentially dangerous situations where it may not be defined: Browser Extensions, Web Workers, patching of the location obj\n const href = getLocationHref();\n\n if (!href) {\n // If there is no window.location.origin, we default to only attaching tracing headers to relative requests, i.e. ones that start with `/`\n // BIG DISCLAIMER: Users can call URLs with a double slash (fetch(\"//example.com/api\")), this is a shorthand for \"send to the same protocol\",\n // so we need a to exclude those requests, because they might be cross origin.\n const isRelativeSameOriginRequest = !!targetUrl.match(/^\\/(?!\\/)/);\n if (!tracePropagationTargets) {\n return isRelativeSameOriginRequest;\n } else {\n return matchesTracePropagationTargets(targetUrl, tracePropagationTargets);\n }\n } else {\n let resolvedUrl;\n let currentOrigin;\n\n // URL parsing may fail, we default to not attaching trace headers in that case.\n try {\n resolvedUrl = new URL(targetUrl, href);\n currentOrigin = new URL(href).origin;\n } catch {\n return false;\n }\n\n const isSameOriginRequest = resolvedUrl.origin === currentOrigin;\n if (!tracePropagationTargets) {\n return isSameOriginRequest;\n } else {\n return (\n matchesTracePropagationTargets(resolvedUrl.toString(), tracePropagationTargets) ||\n (isSameOriginRequest && matchesTracePropagationTargets(resolvedUrl.pathname, tracePropagationTargets))\n );\n }\n }\n}\n\n/**\n * Create and track xhr request spans\n *\n * @returns Span if a span was created, otherwise void.\n */\n// oxlint-disable-next-line complexity\nfunction xhrCallback(\n handlerData: HandlerDataXhr,\n shouldCreateSpan: (url: string) => boolean,\n shouldAttachHeaders: (url: string) => boolean,\n spans: Record<string, Span>,\n propagateTraceparent?: boolean,\n onRequestSpanEnd?: RequestInstrumentationOptions['onRequestSpanEnd'],\n): Span | undefined {\n const xhr = handlerData.xhr;\n const sentryXhrData = xhr?.[SENTRY_XHR_DATA_KEY];\n\n if (!xhr || xhr.__sentry_own_request__ || !sentryXhrData) {\n return undefined;\n }\n\n const { url, method } = sentryXhrData;\n\n const shouldCreateSpanResult = hasSpansEnabled() && shouldCreateSpan(url);\n\n // Handle XHR completion - clean up spans from the record\n if (handlerData.endTimestamp) {\n const spanId = xhr.__sentry_xhr_span_id__;\n if (!spanId) return;\n\n const span = spans[spanId];\n\n if (span) {\n if (shouldCreateSpanResult && sentryXhrData.status_code !== undefined) {\n setHttpStatus(span, sentryXhrData.status_code);\n span.end();\n\n onRequestSpanEnd?.(span, {\n headers: createHeadersSafely(parseXhrResponseHeaders(xhr as XMLHttpRequest & SentryWrappedXMLHttpRequest)),\n error: handlerData.error,\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete spans[spanId];\n }\n\n return undefined;\n }\n\n const fullUrl = getFullURL(url);\n const parsedUrl = fullUrl ? parseUrl(fullUrl) : parseUrl(url);\n const sanitizedFullUrl = fullUrl ? stripDataUrlContent(fullUrl) : undefined;\n\n const urlForSpanName = stripDataUrlContent(stripUrlQueryAndFragment(url));\n\n const client = getClient();\n const hasParent = !!getActiveSpan();\n // With span streaming, we always emit http.client spans, even without a parent span\n const shouldEmitSpan = hasParent || (!!client && hasSpanStreamingEnabled(client));\n\n const span =\n shouldCreateSpanResult && shouldEmitSpan\n ? startInactiveSpan({\n name: `${method} ${urlForSpanName}`,\n attributes: {\n type: 'xhr',\n // eslint-disable-next-line typescript/no-deprecated\n [HTTP_REQUEST_METHOD]: method,\n [URL_FULL]: filterCollectedUrl(sanitizedFullUrl),\n [SERVER_ADDRESS]: parsedUrl?.host,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client',\n [URL_QUERY]: filterCollectedUrlQuery(getUrlQuery(parsedUrl?.search)),\n [URL_FRAGMENT]: getUrlFragment(parsedUrl?.hash),\n },\n })\n : new SentryNonRecordingSpan();\n\n // If the span is ignored, we don't want to continue the trace from it (NonRecordingSpan) but rather\n // from the active span. Passing `undefined` here will make `getTraceData` use the active span instead.\n const spanForTraceHeaders = spanIsIgnored(span) && hasParent ? undefined : span;\n\n if (shouldCreateSpanResult && !shouldEmitSpan) {\n client?.recordDroppedEvent('no_parent_span', 'span');\n }\n\n xhr.__sentry_xhr_span_id__ = span.spanContext().spanId;\n spans[xhr.__sentry_xhr_span_id__] = span;\n\n if (shouldAttachHeaders(url)) {\n addTracingHeadersToXhrRequest(\n xhr,\n // If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction),\n // we do not want to use the span as base for the trace headers,\n // which means that the headers will be generated from the scope and the sampling decision is deferred\n hasSpansEnabled() && shouldEmitSpan ? spanForTraceHeaders : undefined,\n propagateTraceparent,\n );\n }\n\n if (client) {\n client.emit('beforeOutgoingRequestSpan', span, handlerData as XhrHint);\n }\n\n return span;\n}\n\nfunction addTracingHeadersToXhrRequest(\n xhr: SentryWrappedXMLHttpRequest,\n span?: Span,\n propagateTraceparent?: boolean,\n): void {\n const { 'sentry-trace': sentryTrace, baggage, traceparent } = getTraceData({ span, propagateTraceparent });\n\n if (sentryTrace) {\n setHeaderOnXhr(xhr, sentryTrace, baggage, traceparent);\n }\n}\n\nfunction setHeaderOnXhr(\n xhr: SentryWrappedXMLHttpRequest,\n sentryTraceHeader: string,\n sentryBaggageHeader: string | undefined,\n traceparentHeader: string | undefined,\n): void {\n const originalHeaders = xhr.__sentry_xhr_v3__?.request_headers;\n\n if (originalHeaders?.['sentry-trace'] || !xhr.setRequestHeader) {\n // bail if a sentry-trace header is already set\n return;\n }\n\n try {\n xhr.setRequestHeader('sentry-trace', sentryTraceHeader);\n\n if (traceparentHeader && !originalHeaders?.['traceparent']) {\n xhr.setRequestHeader('traceparent', traceparentHeader);\n }\n\n if (sentryBaggageHeader) {\n // only add our headers if\n // - no pre-existing baggage header exists\n // - or it is set and doesn't yet contain sentry values\n const originalBaggageHeader = originalHeaders?.['baggage'];\n if (!originalBaggageHeader || !baggageHeaderHasSentryValues(originalBaggageHeader)) {\n // From MDN: \"If this method is called several times with the same header, the values are merged into one single request header.\"\n // We can therefore simply set a baggage header without checking what was there before\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader\n xhr.setRequestHeader('baggage', sentryBaggageHeader);\n }\n }\n } catch {\n // Error: InvalidStateError: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.\n }\n}\n"],"names":["addFetchInstrumentationHandler","instrumentFetchRequest","getFullURL","parseUrl","stripDataUrlContent","URL_FULL","filterCollectedUrl","SERVER_ADDRESS","addXhrInstrumentationHandler","createHeadersSafely","spanToJSON","hasSpanStreamingEnabled","timestampInSeconds","addPerformanceInstrumentationHandler","isPerformanceResourceTiming","resourceTimingToSpanAttributes","getLocationHref","matchesTracePropagationTargets","shouldAttachHeaders","SENTRY_XHR_DATA_KEY","hasSpansEnabled","span","setHttpStatus","parseXhrResponseHeaders","stripUrlQueryAndFragment","getClient","getActiveSpan","startInactiveSpan","HTTP_REQUEST_METHOD","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","URL_QUERY","filterCollectedUrlQuery","getUrlQuery","URL_FRAGMENT","getUrlFragment","SentryNonRecordingSpan","spanIsIgnored","getTraceData","baggageHeaderHasSentryValues"],"mappings":";;;;;;;;AA+GO,MAAM,oCAAA,GAAsE;AAAA,EACjF,UAAA,EAAY,IAAA;AAAA,EACZ,QAAA,EAAU,IAAA;AAAA,EACV,iBAAA,EAAmB;AACrB;AAGO,SAAS,0BAAA,CAA2B,QAAgB,QAAA,EAAyD;AAClH,EAAA,MAAM;AAAA,IACJ,UAAA;AAAA,IACA,QAAA;AAAA,IACA,0BAAA;AAAA,IACA,iBAAA;AAAA,IACA,uBAAA;AAAA,IACA,kBAAA;AAAA,IACA;AAAA,GACF,GAAI;AAAA,IACF,GAAG,oCAAA;A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gBAAA,EAAkB;AAE9D,IAAA;AAAA,EACF;AAEA,EAAA,IAAI;AACF,IAAA,GAAA,CAAI,gBAAA,CAAiB,gBAAgB,iBAAiB,CAAA;AAEtD,IAAA,IAAI,iBAAA,IAAqB,CAAC,eAAA,GAAkB,aAAa,CAAA,EAAG;AAC1D,MAAA,GAAA,CAAI,gBAAA,CAAiB,eAAe,iBAAiB,CAAA;AAAA,IACvD;AAEA,IAAA,IAAI,mBAAA,EAAqB;AAIvB,MAAA,MAAM,qBAAA,GAAwB,kBAAkB,SAAS,CAAA;AACzD,MAAA,IAAI,CAAC,qBAAA,IAAyB,CAACC,kCAAA,CAA6B,qBAAqB,CAAA,EAAG;AAIlF,QAAA,GAAA,CAAI,gBAAA,CAAiB,WAAW,mBAAmB,CAAA;AAAA,MACrD;AAAA,IACF;AAAA,EACF,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;;;;;;"}
1
+ {"version":3,"file":"request.js","sources":["../../../../../src/tracing/request.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type { Client, RequestHookInfo, ResponseHookInfo, Span, SpanTimeInput } from '@sentry/core';\nimport {\n addFetchInstrumentationHandler,\n getActiveSpan,\n getClient,\n getTraceData,\n getUrlDomain,\n getUrlFragment,\n getUrlQuery,\n hasSpansEnabled,\n hasSpanStreamingEnabled,\n instrumentFetchRequest,\n matchesTracePropagationTargets,\n parseUrl,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n setHttpStatus,\n spanIsIgnored,\n spanToJSON,\n stripDataUrlContent,\n stripUrlQueryAndFragment,\n timestampInSeconds,\n} from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/core/browser';\nimport type { HandlerDataXhr, SentryWrappedXMLHttpRequest, XhrHint } from '@sentry/browser-utils';\nimport { filterCollectedUrl, filterCollectedUrlQuery } from '@sentry/core';\nimport {\n addPerformanceInstrumentationHandler,\n addXhrInstrumentationHandler,\n getLocationHref,\n parseXhrResponseHeaders,\n resourceTimingToSpanAttributes,\n SENTRY_XHR_DATA_KEY,\n} from '@sentry/browser-utils';\nimport type { BrowserClient } from '../client';\nimport { WINDOW } from '../helpers';\nimport { baggageHeaderHasSentryValues, createHeadersSafely, getFullURL, isPerformanceResourceTiming } from './utils';\nimport {\n HTTP_REQUEST_METHOD,\n SENTRY_OP,\n SERVER_ADDRESS,\n URL_DOMAIN,\n URL_FRAGMENT,\n URL_FULL,\n URL_QUERY,\n} from '@sentry/conventions/attributes';\nimport { HTTP_CLIENT } from '@sentry/conventions/op';\n\n/** Options for Request Instrumentation */\nexport interface RequestInstrumentationOptions {\n /**\n * List of strings and/or Regular Expressions used to determine which outgoing requests will have `sentry-trace` and `baggage`\n * headers attached.\n *\n * **Default:** If this option is not provided, tracing headers will be attached to all outgoing requests.\n * If you are using a browser SDK, by default, tracing headers will only be attached to outgoing requests to the same origin.\n *\n * **Disclaimer:** Carelessly setting this option in browser environments may result into CORS errors!\n * Only attach tracing headers to requests to the same origin, or to requests to services you can control CORS headers of.\n * Cross-origin requests, meaning requests to a different domain, for example a request to `https://api.example.com/` while you're on `https://example.com/`, take special care.\n * If you are attaching headers to cross-origin requests, make sure the backend handling the request returns a `\"Access-Control-Allow-Headers: sentry-trace, baggage\"` header to ensure your requests aren't blocked.\n *\n * If you provide a `tracePropagationTargets` array, the entries you provide will be matched against the entire URL of the outgoing request.\n * If you are using a browser SDK, the entries will also be matched against the pathname of the outgoing requests.\n * This is so you can have matchers for relative requests, for example, `/^\\/api/` if you want to trace requests to your `/api` routes on the same domain.\n *\n * If any of the two match any of the provided values, tracing headers will be attached to the outgoing request.\n * Both, the string values, and the RegExes you provide in the array will match if they partially match the URL or pathname.\n * Matching is case-insensitive, so `'myApi.com'` and `/^myApi\\.com/` both match a request to `https://myapi.com`.\n *\n * Examples:\n * - `tracePropagationTargets: [/^\\/api/]` and request to `https://same-origin.com/api/posts`:\n * - Tracing headers will be attached because the request is sent to the same origin and the regex matches the pathname \"/api/posts\".\n * - `tracePropagationTargets: [/^\\/api/]` and request to `https://different-origin.com/api/posts`:\n * - Tracing headers will not be attached because the pathname will only be compared when the request target lives on the same origin.\n * - `tracePropagationTargets: [/^\\/api/, 'https://external-api.com']` and request to `https://external-api.com/v1/data`:\n * - Tracing headers will be attached because the request URL matches the string `'https://external-api.com'`.\n */\n tracePropagationTargets?: Array<string | RegExp>;\n\n /**\n * Flag to disable patching all together for fetch requests.\n *\n * Default: true\n */\n traceFetch: boolean;\n\n /**\n * Flag to disable patching all together for xhr requests.\n *\n * Default: true\n */\n traceXHR: boolean;\n\n /**\n * If true, Sentry will capture http timings and add them to the corresponding http spans.\n *\n * Default: true\n */\n enableHTTPTimings: boolean;\n\n /**\n * This function will be called before creating a span for a request with the given url.\n * Return false if you don't want a span for the given url.\n *\n * Default: (url: string) => true\n */\n shouldCreateSpanForRequest?(this: void, url: string): boolean;\n\n /**\n * Is called when spans are started for outgoing requests.\n */\n onRequestSpanStart?(span: Span, requestInformation: RequestHookInfo): void;\n\n /**\n * Is called when spans end for outgoing requests, providing access to response headers.\n */\n onRequestSpanEnd?(span: Span, responseInformation: ResponseHookInfo): void;\n}\n\nexport const defaultRequestInstrumentationOptions: RequestInstrumentationOptions = {\n traceFetch: true,\n traceXHR: true,\n enableHTTPTimings: true,\n};\n\n/** Registers span creators for xhr and fetch requests */\nexport function instrumentOutgoingRequests(client: Client, _options?: Partial<RequestInstrumentationOptions>): void {\n const {\n traceFetch,\n traceXHR,\n shouldCreateSpanForRequest,\n enableHTTPTimings,\n tracePropagationTargets,\n onRequestSpanStart,\n onRequestSpanEnd,\n } = {\n ...defaultRequestInstrumentationOptions,\n ..._options,\n };\n\n const shouldCreateSpan =\n typeof shouldCreateSpanForRequest === 'function' ? shouldCreateSpanForRequest : (_: string) => true;\n\n const shouldAttachHeadersWithTargets = (url: string): boolean => shouldAttachHeaders(url, tracePropagationTargets);\n\n const spans: Record<string, Span> = {};\n\n const propagateTraceparent = (client as BrowserClient).getOptions().propagateTraceparent;\n\n if (traceFetch) {\n addFetchInstrumentationHandler(handlerData => {\n const createdSpan = instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans, {\n propagateTraceparent,\n onRequestSpanEnd,\n // The generic fetch instrumentation has no page origin to resolve relative URLs against.\n urlBase: WINDOW.location?.origin,\n });\n\n // We cannot use `window.location` in the generic fetch instrumentation,\n // but we need it for reliable `server.address` attribute.\n // so we extend this in here\n if (createdSpan) {\n const fullUrl = getFullURL(handlerData.fetchData.url);\n // `parseUrl` returns the raw authority — userinfo credentials must never reach an attribute.\n const host = fullUrl ? parseUrl(fullUrl).host?.replace(/^.*@/, '') : undefined;\n const sanitizedFullUrl = fullUrl ? stripDataUrlContent(fullUrl) : undefined;\n createdSpan.setAttributes({\n [URL_FULL]: filterCollectedUrl(sanitizedFullUrl),\n [SERVER_ADDRESS]: host,\n });\n\n if (enableHTTPTimings) {\n addHTTPTimings(createdSpan, client);\n }\n\n onRequestSpanStart?.(createdSpan, { headers: handlerData.headers });\n }\n });\n }\n\n if (traceXHR) {\n addXhrInstrumentationHandler(handlerData => {\n const createdSpan = xhrCallback(\n handlerData,\n shouldCreateSpan,\n shouldAttachHeadersWithTargets,\n spans,\n propagateTraceparent,\n onRequestSpanEnd,\n );\n\n if (createdSpan) {\n if (enableHTTPTimings) {\n addHTTPTimings(createdSpan, client);\n }\n\n onRequestSpanStart?.(createdSpan, {\n headers: createHeadersSafely(handlerData.xhr.__sentry_xhr_v3__?.request_headers),\n });\n }\n });\n }\n}\n\n/**\n * The maximum time (ms) to wait for PerformanceResourceTiming data before ending the span.\n * Same approach is used by OTel's browser fetch instrumentation:\n * See {@link https://github.com/open-telemetry/opentelemetry-js/blob/30f94fe99339287b1e4d3c8bb90172c2523f06f4/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts#L352-L372}\n */\nconst HTTP_TIMING_WAIT_MS = 300;\n\n/**\n * Creates a temporary observer to listen to the next fetch/xhr resourcing timings,\n * so that when timings hit their per-browser limit they don't need to be removed.\n *\n * @param span A span that has yet to be finished, must contain `url.full` on data.\n */\nfunction addHTTPTimings(span: Span, client: Client): void {\n const url = spanToJSON(span).attributes[URL_FULL];\n\n if (!url || typeof url !== 'string') {\n return;\n }\n\n // Clean up the performance observer and other resources\n // We have to wait here because otherwise this cleans itself up before it is fully done.\n // Default (non-streaming): just deregister the observer.\n let onEntryFound = (): void => void setTimeout(unsubscribePerformanceObsever);\n\n // For streamed spans, we have to artificially delay the ending of the span until we\n // either receive the timing data, or HTTP_TIMING_WAIT_MS elapses.\n if (hasSpanStreamingEnabled(client)) {\n const originalEnd = span.end.bind(span);\n\n span.end = (endTimestamp?: SpanTimeInput) => {\n const capturedEndTimestamp = endTimestamp ?? timestampInSeconds();\n let isEnded = false;\n\n const endSpanAndCleanup = (): void => {\n if (isEnded) {\n return;\n }\n isEnded = true;\n setTimeout(unsubscribePerformanceObsever);\n originalEnd(capturedEndTimestamp);\n clearTimeout(fallbackTimeout);\n };\n\n onEntryFound = endSpanAndCleanup;\n\n // Fallback: always end the span after HTTP_TIMING_WAIT_MS even if no\n // PerformanceResourceTiming entry arrives (e.g. cross-origin without\n // Timing-Allow-Origin, or the browser didn't fire the observer in time).\n const fallbackTimeout = setTimeout(endSpanAndCleanup, HTTP_TIMING_WAIT_MS);\n };\n }\n\n const unsubscribePerformanceObsever = addPerformanceInstrumentationHandler('resource', ({ entries }) => {\n entries.forEach(entry => {\n if (isPerformanceResourceTiming(entry) && entry.name.endsWith(url)) {\n span.setAttributes(resourceTimingToSpanAttributes(entry));\n onEntryFound();\n }\n });\n });\n}\n\n/**\n * A function that determines whether to attach tracing headers to a request.\n * We only export this function for testing purposes.\n */\nexport function shouldAttachHeaders(\n targetUrl: string,\n tracePropagationTargets: (string | RegExp)[] | undefined,\n): boolean {\n // window.location.href not being defined is an edge case in the browser but we need to handle it.\n // Potentially dangerous situations where it may not be defined: Browser Extensions, Web Workers, patching of the location obj\n const href = getLocationHref();\n\n if (!href) {\n // If there is no window.location.origin, we default to only attaching tracing headers to relative requests, i.e. ones that start with `/`\n // BIG DISCLAIMER: Users can call URLs with a double slash (fetch(\"//example.com/api\")), this is a shorthand for \"send to the same protocol\",\n // so we need a to exclude those requests, because they might be cross origin.\n const isRelativeSameOriginRequest = !!targetUrl.match(/^\\/(?!\\/)/);\n if (!tracePropagationTargets) {\n return isRelativeSameOriginRequest;\n } else {\n return matchesTracePropagationTargets(targetUrl, tracePropagationTargets);\n }\n } else {\n let resolvedUrl;\n let currentOrigin;\n\n // URL parsing may fail, we default to not attaching trace headers in that case.\n try {\n resolvedUrl = new URL(targetUrl, href);\n currentOrigin = new URL(href).origin;\n } catch {\n return false;\n }\n\n const isSameOriginRequest = resolvedUrl.origin === currentOrigin;\n if (!tracePropagationTargets) {\n return isSameOriginRequest;\n } else {\n return (\n matchesTracePropagationTargets(resolvedUrl.toString(), tracePropagationTargets) ||\n (isSameOriginRequest && matchesTracePropagationTargets(resolvedUrl.pathname, tracePropagationTargets))\n );\n }\n }\n}\n\n/**\n * Create and track xhr request spans\n *\n * @returns Span if a span was created, otherwise void.\n */\n// oxlint-disable-next-line complexity\nfunction xhrCallback(\n handlerData: HandlerDataXhr,\n shouldCreateSpan: (url: string) => boolean,\n shouldAttachHeaders: (url: string) => boolean,\n spans: Record<string, Span>,\n propagateTraceparent?: boolean,\n onRequestSpanEnd?: RequestInstrumentationOptions['onRequestSpanEnd'],\n): Span | undefined {\n const xhr = handlerData.xhr;\n const sentryXhrData = xhr?.[SENTRY_XHR_DATA_KEY];\n\n if (!xhr || xhr.__sentry_own_request__ || !sentryXhrData) {\n return undefined;\n }\n\n const { url, method } = sentryXhrData;\n\n const shouldCreateSpanResult = hasSpansEnabled() && shouldCreateSpan(url);\n\n // Handle XHR completion - clean up spans from the record\n if (handlerData.endTimestamp) {\n const spanId = xhr.__sentry_xhr_span_id__;\n if (!spanId) return;\n\n const span = spans[spanId];\n\n if (span) {\n if (shouldCreateSpanResult && sentryXhrData.status_code !== undefined) {\n setHttpStatus(span, sentryXhrData.status_code);\n span.end();\n\n onRequestSpanEnd?.(span, {\n headers: createHeadersSafely(parseXhrResponseHeaders(xhr as XMLHttpRequest & SentryWrappedXMLHttpRequest)),\n error: handlerData.error,\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete spans[spanId];\n }\n\n return undefined;\n }\n\n const fullUrl = getFullURL(url);\n const parsedUrl = fullUrl ? parseUrl(fullUrl) : parseUrl(url);\n const sanitizedFullUrl = fullUrl ? stripDataUrlContent(fullUrl) : undefined;\n\n const urlForSpanName = stripDataUrlContent(stripUrlQueryAndFragment(url));\n\n const client = getClient();\n const hasParent = !!getActiveSpan();\n // With span streaming, we always emit http.client spans, even without a parent span\n const shouldEmitSpan = hasParent || (!!client && hasSpanStreamingEnabled(client));\n\n // `parseUrl` returns the raw authority — userinfo credentials must never reach an attribute.\n const host = parsedUrl?.host?.replace(/^.*@/, '');\n // `getFullURL` already resolved relative URLs against the page origin; only data URLs have no domain.\n const domain = getUrlDomain(fullUrl || url);\n\n // With span streaming, span names have to be low cardinality, so only the domain is kept.\n const streamedName = domain ? `${method} ${domain}` : method;\n\n const span =\n shouldCreateSpanResult && shouldEmitSpan\n ? startInactiveSpan({\n name: !!client && hasSpanStreamingEnabled(client) ? streamedName : `${method} ${urlForSpanName}`,\n attributes: {\n type: 'xhr',\n // eslint-disable-next-line typescript/no-deprecated\n [HTTP_REQUEST_METHOD]: method,\n [URL_FULL]: filterCollectedUrl(sanitizedFullUrl),\n [SERVER_ADDRESS]: host,\n [URL_DOMAIN]: domain,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser',\n [SENTRY_OP]: HTTP_CLIENT,\n [URL_QUERY]: filterCollectedUrlQuery(getUrlQuery(parsedUrl?.search)),\n [URL_FRAGMENT]: getUrlFragment(parsedUrl?.hash),\n },\n })\n : new SentryNonRecordingSpan();\n\n // If the span is ignored, we don't want to continue the trace from it (NonRecordingSpan) but rather\n // from the active span. Passing `undefined` here will make `getTraceData` use the active span instead.\n const spanForTraceHeaders = spanIsIgnored(span) && hasParent ? undefined : span;\n\n if (shouldCreateSpanResult && !shouldEmitSpan) {\n client?.recordDroppedEvent('no_parent_span', 'span');\n }\n\n xhr.__sentry_xhr_span_id__ = span.spanContext().spanId;\n spans[xhr.__sentry_xhr_span_id__] = span;\n\n if (shouldAttachHeaders(url)) {\n addTracingHeadersToXhrRequest(\n xhr,\n // If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction),\n // we do not want to use the span as base for the trace headers,\n // which means that the headers will be generated from the scope and the sampling decision is deferred\n hasSpansEnabled() && shouldEmitSpan ? spanForTraceHeaders : undefined,\n propagateTraceparent,\n );\n }\n\n if (client) {\n client.emit('beforeOutgoingRequestSpan', span, handlerData as XhrHint);\n }\n\n return span;\n}\n\nfunction addTracingHeadersToXhrRequest(\n xhr: SentryWrappedXMLHttpRequest,\n span?: Span,\n propagateTraceparent?: boolean,\n): void {\n const { 'sentry-trace': sentryTrace, baggage, traceparent } = getTraceData({ span, propagateTraceparent });\n\n if (sentryTrace) {\n setHeaderOnXhr(xhr, sentryTrace, baggage, traceparent);\n }\n}\n\nfunction setHeaderOnXhr(\n xhr: SentryWrappedXMLHttpRequest,\n sentryTraceHeader: string,\n sentryBaggageHeader: string | undefined,\n traceparentHeader: string | undefined,\n): void {\n const originalHeaders = xhr.__sentry_xhr_v3__?.request_headers;\n\n if (originalHeaders?.['sentry-trace'] || !xhr.setRequestHeader) {\n // bail if a sentry-trace header is already set\n return;\n }\n\n try {\n xhr.setRequestHeader('sentry-trace', sentryTraceHeader);\n\n if (traceparentHeader && !originalHeaders?.['traceparent']) {\n xhr.setRequestHeader('traceparent', traceparentHeader);\n }\n\n if (sentryBaggageHeader) {\n // only add our headers if\n // - no pre-existing baggage header exists\n // - or it is set and doesn't yet contain sentry values\n const originalBaggageHeader = originalHeaders?.['baggage'];\n if (!originalBaggageHeader || !baggageHeaderHasSentryValues(originalBaggageHeader)) {\n // From MDN: \"If this method is called several times with the same header, the values are merged into one single request header.\"\n // We can therefore simply set a baggage header without checking what was there before\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader\n xhr.setRequestHeader('baggage', sentryBaggageHeader);\n }\n }\n } catch {\n // Error: InvalidStateError: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.\n }\n}\n"],"names":["addFetchInstrumentationHandler","instrumentFetchRequest","WINDOW","getFullURL","parseUrl","stripDataUrlContent","URL_FULL","filterCollectedUrl","SERVER_ADDRESS","addXhrInstrumentationHandler","createHeadersSafely","spanToJSON","hasSpanStreamingEnabled","timestampInSeconds","addPerformanceInstrumentationHandler","isPerformanceResourceTiming","resourceTimingToSpanAttributes","getLocationHref","matchesTracePropagationTargets","shouldAttachHeaders","SENTRY_XHR_DATA_KEY","hasSpansEnabled","span","setHttpStatus","parseXhrResponseHeaders","stripUrlQueryAndFragment","getClient","getActiveSpan","getUrlDomain","startInactiveSpan","HTTP_REQUEST_METHOD","URL_DOMAIN","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SENTRY_OP","HTTP_CLIENT","URL_QUERY","filterCollectedUrlQuery","getUrlQuery","URL_FRAGMENT","getUrlFragment","SentryNonRecordingSpan","spanIsIgnored","getTraceData","baggageHeaderHasSentryValues"],"mappings":";;;;;;;;;;AAyHO,MAAM,oCAAA,GAAsE;AAAA,EACjF,UAAA,EAAY,IAAA;AAAA,EACZ,QAAA,EAAU,IAAA;AAAA,EACV,iBAAA,EAAmB;AACrB;AAGO,SAAS,0BAAA,CAA2B,QAAgB,QAAA,EAAyD;AAClH,EAAA,MAAM;AAAA,IACJ,UAAA;AAAA,IACA,QAAA;AAAA,IACA,0BAAA;AAAA,IACA,iBAAA;AAAA,IACA,uBAAA;AAAA,IACA,kBAAA;AAAA,IACA;AAAA,GACF,GAAI;AAAA,IACF,GAAG,oCAAA;AAAA,IACH,GAAG;AAAA,GACL;AAEA,EAAA,MAAM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gB,WAAA,EAAa,OAAA,EAAS,WAAA,KAAgBqB,iBAAA,CAAa,EAAE,IAAA,EAAM,oBAAA,EAAsB,CAAA;AAEzG,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,cAAA,CAAe,GAAA,EAAK,WAAA,EAAa,OAAA,EAAS,WAAW,CAAA;AAAA,EACvD;AACF;AAEA,SAAS,cAAA,CACP,GAAA,EACA,iBAAA,EACA,mBAAA,EACA,iBAAA,EACM;AACN,EAAA,MAAM,eAAA,GAAkB,IAAI,iBAAA,EAAmB,eAAA;AAE/C,EAAA,IAAI,eAAA,GAAkB,cAAc,CAAA,IAAK,CAAC,IAAI,gBAAA,EAAkB;AAE9D,IAAA;AAAA,EACF;AAEA,EAAA,IAAI;AACF,IAAA,GAAA,CAAI,gBAAA,CAAiB,gBAAgB,iBAAiB,CAAA;AAEtD,IAAA,IAAI,iBAAA,IAAqB,CAAC,eAAA,GAAkB,aAAa,CAAA,EAAG;AAC1D,MAAA,GAAA,CAAI,gBAAA,CAAiB,eAAe,iBAAiB,CAAA;AAAA,IACvD;AAEA,IAAA,IAAI,mBAAA,EAAqB;AAIvB,MAAA,MAAM,qBAAA,GAAwB,kBAAkB,SAAS,CAAA;AACzD,MAAA,IAAI,CAAC,qBAAA,IAAyB,CAACC,kCAAA,CAA6B,qBAAqB,CAAA,EAAG;AAIlF,QAAA,GAAA,CAAI,gBAAA,CAAiB,WAAW,mBAAmB,CAAA;AAAA,MACrD;AAAA,IACF;AAAA,EACF,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;;;;;;"}
@@ -1,20 +1,20 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
3
+ const core = require('@sentry/core');
4
4
 
5
5
  function setActiveSpanInBrowser(span) {
6
- const maybePreviousActiveSpan = browser.getActiveSpan();
6
+ const maybePreviousActiveSpan = core.getActiveSpan();
7
7
  if (maybePreviousActiveSpan === span) {
8
8
  return;
9
9
  }
10
- const scope = browser.getCurrentScope();
10
+ const scope = core.getCurrentScope();
11
11
  span.end = new Proxy(span.end, {
12
12
  apply(target, thisArg, args) {
13
- browser._INTERNAL_setSpanForScope(scope, maybePreviousActiveSpan);
13
+ core._INTERNAL_setSpanForScope(scope, maybePreviousActiveSpan);
14
14
  return Reflect.apply(target, thisArg, args);
15
15
  }
16
16
  });
17
- browser._INTERNAL_setSpanForScope(scope, span);
17
+ core._INTERNAL_setSpanForScope(scope, span);
18
18
  }
19
19
 
20
20
  exports.setActiveSpanInBrowser = setActiveSpanInBrowser;
@@ -1 +1 @@
1
- {"version":3,"file":"setActiveSpan.js","sources":["../../../../../src/tracing/setActiveSpan.ts"],"sourcesContent":["import type { Span } from '@sentry/core/browser';\nimport { _INTERNAL_setSpanForScope, getActiveSpan, getCurrentScope } from '@sentry/core/browser';\n\n/**\n * Sets an inactive span active on the current scope.\n *\n * This is useful in browser applications, if you want to create a span that cannot be finished\n * within its callback. Any spans started while the given span is active, will be children of the span.\n *\n * If there already was an active span on the scope prior to calling this function, it is replaced\n * with the given span and restored after the span ended. Otherwise, the span will simply be\n * removed, resulting in no active span on the scope.\n *\n * IMPORTANT: This function can ONLY be used in the browser! Calling this function in a server\n * environment (for example in a server-side rendered component) will result in undefined behaviour\n * and is not supported.\n * You MUST call `span.end()` manually, otherwise the span will never be finished.\n *\n * @example\n * ```js\n * let checkoutSpan;\n *\n * on('checkoutStarted', () => {\n * checkoutSpan = Sentry.startInactiveSpan({ name: 'checkout-flow' });\n * Sentry.setActiveSpanInBrowser(checkoutSpan);\n * })\n *\n * // during this time, any spans started will be children of `checkoutSpan`:\n * Sentry.startSpan({ name: 'checkout-step-1' }, () => {\n * // ... `\n * })\n *\n * on('checkoutCompleted', () => {\n * checkoutSpan?.end();\n * })\n * ```\n *\n * @param span - the span to set active\n */\nexport function setActiveSpanInBrowser(span: Span): void {\n const maybePreviousActiveSpan = getActiveSpan();\n\n // If the span is already active, there's no need to double-patch or set it again.\n // This also guards against users (for whatever reason) calling setActiveSpanInBrowser on SDK-started\n // idle spans like pageload or navigation spans. These will already be handled correctly by the SDK.\n // For nested situations, we have to double-patch to ensure we restore the correct previous span (see tests)\n if (maybePreviousActiveSpan === span) {\n return;\n }\n\n const scope = getCurrentScope();\n\n // Putting a small patch onto the span.end method to ensure we\n // remove the span from the scope when it ends.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n span.end = new Proxy(span.end, {\n apply(target, thisArg, args: Parameters<Span['end']>) {\n _INTERNAL_setSpanForScope(scope, maybePreviousActiveSpan);\n return Reflect.apply(target, thisArg, args);\n },\n });\n\n _INTERNAL_setSpanForScope(scope, span);\n}\n"],"names":["getActiveSpan","getCurrentScope","_INTERNAL_setSpanForScope"],"mappings":";;;;AAuCO,SAAS,uBAAuB,IAAA,EAAkB;AACvD,EAAA,MAAM,0BAA0BA,qBAAA,EAAc;AAM9C,EAAA,IAAI,4BAA4B,IAAA,EAAM;AACpC,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,QAAQC,uBAAA,EAAgB;AAK9B,EAAA,IAAA,CAAK,GAAA,GAAM,IAAI,KAAA,CAAM,IAAA,CAAK,GAAA,EAAK;AAAA,IAC7B,KAAA,CAAM,MAAA,EAAQ,OAAA,EAAS,IAAA,EAA+B;AACpD,MAAAC,iCAAA,CAA0B,OAAO,uBAAuB,CAAA;AACxD,MAAA,OAAO,OAAA,CAAQ,KAAA,CAAM,MAAA,EAAQ,OAAA,EAAS,IAAI,CAAA;AAAA,IAC5C;AAAA,GACD,CAAA;AAED,EAAAA,iCAAA,CAA0B,OAAO,IAAI,CAAA;AACvC;;;;"}
1
+ {"version":3,"file":"setActiveSpan.js","sources":["../../../../../src/tracing/setActiveSpan.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport { _INTERNAL_setSpanForScope, getActiveSpan, getCurrentScope } from '@sentry/core';\n\n/**\n * Sets an inactive span active on the current scope.\n *\n * This is useful in browser applications, if you want to create a span that cannot be finished\n * within its callback. Any spans started while the given span is active, will be children of the span.\n *\n * If there already was an active span on the scope prior to calling this function, it is replaced\n * with the given span and restored after the span ended. Otherwise, the span will simply be\n * removed, resulting in no active span on the scope.\n *\n * IMPORTANT: This function can ONLY be used in the browser! Calling this function in a server\n * environment (for example in a server-side rendered component) will result in undefined behaviour\n * and is not supported.\n * You MUST call `span.end()` manually, otherwise the span will never be finished.\n *\n * @example\n * ```js\n * let checkoutSpan;\n *\n * on('checkoutStarted', () => {\n * checkoutSpan = Sentry.startInactiveSpan({ name: 'checkout-flow' });\n * Sentry.setActiveSpanInBrowser(checkoutSpan);\n * })\n *\n * // during this time, any spans started will be children of `checkoutSpan`:\n * Sentry.startSpan({ name: 'checkout-step-1' }, () => {\n * // ... `\n * })\n *\n * on('checkoutCompleted', () => {\n * checkoutSpan?.end();\n * })\n * ```\n *\n * @param span - the span to set active\n */\nexport function setActiveSpanInBrowser(span: Span): void {\n const maybePreviousActiveSpan = getActiveSpan();\n\n // If the span is already active, there's no need to double-patch or set it again.\n // This also guards against users (for whatever reason) calling setActiveSpanInBrowser on SDK-started\n // idle spans like pageload or navigation spans. These will already be handled correctly by the SDK.\n // For nested situations, we have to double-patch to ensure we restore the correct previous span (see tests)\n if (maybePreviousActiveSpan === span) {\n return;\n }\n\n const scope = getCurrentScope();\n\n // Putting a small patch onto the span.end method to ensure we\n // remove the span from the scope when it ends.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n span.end = new Proxy(span.end, {\n apply(target, thisArg, args: Parameters<Span['end']>) {\n _INTERNAL_setSpanForScope(scope, maybePreviousActiveSpan);\n return Reflect.apply(target, thisArg, args);\n },\n });\n\n _INTERNAL_setSpanForScope(scope, span);\n}\n"],"names":["getActiveSpan","getCurrentScope","_INTERNAL_setSpanForScope"],"mappings":";;;;AAuCO,SAAS,uBAAuB,IAAA,EAAkB;AACvD,EAAA,MAAM,0BAA0BA,kBAAA,EAAc;AAM9C,EAAA,IAAI,4BAA4B,IAAA,EAAM;AACpC,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,QAAQC,oBAAA,EAAgB;AAK9B,EAAA,IAAA,CAAK,GAAA,GAAM,IAAI,KAAA,CAAM,IAAA,CAAK,GAAA,EAAK;AAAA,IAC7B,KAAA,CAAM,MAAA,EAAQ,OAAA,EAAS,IAAA,EAA+B;AACpD,MAAAC,8BAAA,CAA0B,OAAO,uBAAuB,CAAA;AACxD,MAAA,OAAO,OAAA,CAAQ,KAAA,CAAM,MAAA,EAAQ,OAAA,EAAS,IAAI,CAAA;AAAA,IAC5C;AAAA,GACD,CAAA;AAED,EAAAA,8BAAA,CAA0B,OAAO,IAAI,CAAA;AACvC;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
3
+ const core = require('@sentry/core');
4
4
  const browserUtils = require('@sentry/browser-utils');
5
5
 
6
6
  const DEFAULT_BROWSER_TRANSPORT_BUFFER_SIZE = 40;
@@ -47,10 +47,10 @@ function makeFetchTransport(options, nativeFetch = browserUtils.getNativeImpleme
47
47
  pendingCount--;
48
48
  }
49
49
  }
50
- return browser.createTransport(
50
+ return core.createTransport(
51
51
  options,
52
52
  makeRequest,
53
- browser.makePromiseBuffer(options.bufferSize || DEFAULT_BROWSER_TRANSPORT_BUFFER_SIZE)
53
+ core.makePromiseBuffer(options.bufferSize || DEFAULT_BROWSER_TRANSPORT_BUFFER_SIZE)
54
54
  );
55
55
  }
56
56
 
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sources":["../../../../../src/transports/fetch.ts"],"sourcesContent":["import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core/browser';\nimport { createTransport, makePromiseBuffer } from '@sentry/core/browser';\nimport { clearCachedImplementation, getNativeImplementation } from '@sentry/browser-utils';\nimport type { WINDOW } from '../helpers';\nimport type { BrowserTransportOptions } from './types';\n\nconst DEFAULT_BROWSER_TRANSPORT_BUFFER_SIZE = 40;\n\n/**\n * Creates a Transport that uses the Fetch API to send events to Sentry.\n */\nexport function makeFetchTransport(\n options: BrowserTransportOptions,\n nativeFetch: typeof WINDOW.fetch = getNativeImplementation('fetch'),\n): Transport {\n let pendingBodySize = 0;\n let pendingCount = 0;\n\n async function makeRequest(request: TransportRequest): Promise<TransportMakeRequestResponse> {\n const requestSize = request.body.length;\n pendingBodySize += requestSize;\n pendingCount++;\n\n const requestOptions: RequestInit = {\n body: request.body as BodyInit,\n method: 'POST',\n referrerPolicy: 'strict-origin',\n headers: options.headers,\n // Outgoing requests are usually cancelled when navigating to a different page, causing a \"TypeError: Failed to\n // fetch\" error and sending a \"network_error\" client-outcome - in Chrome, the request status shows \"(cancelled)\".\n // The `keepalive` flag keeps outgoing requests alive, even when switching pages. We want this since we're\n // frequently sending events right before the user is switching pages (eg. when finishing navigation transactions).\n // Gotchas:\n // - `keepalive` isn't supported by Firefox\n // - As per spec (https://fetch.spec.whatwg.org/#http-network-or-cache-fetch):\n // If the sum of contentLength and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error.\n // We will therefore only activate the flag when we're below that limit.\n // There is also a limit of requests that can be open at the same time, so we also limit this to 15\n // See https://github.com/getsentry/sentry-javascript/pull/7553 for details\n keepalive: pendingBodySize <= 60_000 && pendingCount < 15,\n ...options.fetchOptions,\n };\n\n try {\n // Note: We do not need to suppress tracing here, because we are using the native fetch, instead of our wrapped one.\n const response = await nativeFetch(options.url, requestOptions);\n\n return {\n statusCode: response.status,\n headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n };\n } catch (e) {\n clearCachedImplementation('fetch');\n throw e;\n } finally {\n pendingBodySize -= requestSize;\n pendingCount--;\n }\n }\n\n return createTransport(\n options,\n makeRequest,\n makePromiseBuffer(options.bufferSize || DEFAULT_BROWSER_TRANSPORT_BUFFER_SIZE),\n );\n}\n"],"names":["getNativeImplementation","clearCachedImplementation","createTransport","makePromiseBuffer"],"mappings":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,uBAAA;AAAA,IACL,OAAA;AAAA,IACA,WAAA;AAAA,IACAC,yBAAA,CAAkB,OAAA,CAAQ,UAAA,IAAc,qCAAqC;AAAA,GAC/E;AACF;;;;"}
1
+ {"version":3,"file":"fetch.js","sources":["../../../../../src/transports/fetch.ts"],"sourcesContent":["import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core';\nimport { createTransport, makePromiseBuffer } from '@sentry/core';\nimport { clearCachedImplementation, getNativeImplementation } from '@sentry/browser-utils';\nimport type { WINDOW } from '../helpers';\nimport type { BrowserTransportOptions } from './types';\n\nconst DEFAULT_BROWSER_TRANSPORT_BUFFER_SIZE = 40;\n\n/**\n * Creates a Transport that uses the Fetch API to send events to Sentry.\n */\nexport function makeFetchTransport(\n options: BrowserTransportOptions,\n nativeFetch: typeof WINDOW.fetch = getNativeImplementation('fetch'),\n): Transport {\n let pendingBodySize = 0;\n let pendingCount = 0;\n\n async function makeRequest(request: TransportRequest): Promise<TransportMakeRequestResponse> {\n const requestSize = request.body.length;\n pendingBodySize += requestSize;\n pendingCount++;\n\n const requestOptions: RequestInit = {\n body: request.body as BodyInit,\n method: 'POST',\n referrerPolicy: 'strict-origin',\n headers: options.headers,\n // Outgoing requests are usually cancelled when navigating to a different page, causing a \"TypeError: Failed to\n // fetch\" error and sending a \"network_error\" client-outcome - in Chrome, the request status shows \"(cancelled)\".\n // The `keepalive` flag keeps outgoing requests alive, even when switching pages. We want this since we're\n // frequently sending events right before the user is switching pages (eg. when finishing navigation transactions).\n // Gotchas:\n // - `keepalive` isn't supported by Firefox\n // - As per spec (https://fetch.spec.whatwg.org/#http-network-or-cache-fetch):\n // If the sum of contentLength and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error.\n // We will therefore only activate the flag when we're below that limit.\n // There is also a limit of requests that can be open at the same time, so we also limit this to 15\n // See https://github.com/getsentry/sentry-javascript/pull/7553 for details\n keepalive: pendingBodySize <= 60_000 && pendingCount < 15,\n ...options.fetchOptions,\n };\n\n try {\n // Note: We do not need to suppress tracing here, because we are using the native fetch, instead of our wrapped one.\n const response = await nativeFetch(options.url, requestOptions);\n\n return {\n statusCode: response.status,\n headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n };\n } catch (e) {\n clearCachedImplementation('fetch');\n throw e;\n } finally {\n pendingBodySize -= requestSize;\n pendingCount--;\n }\n }\n\n return createTransport(\n options,\n makeRequest,\n makePromiseBuffer(options.bufferSize || DEFAULT_BROWSER_TRANSPORT_BUFFER_SIZE),\n );\n}\n"],"names":["getNativeImplementation","clearCachedImplementation","createTransport","makePromiseBuffer"],"mappings":";;;;;AAMA,MAAM,qCAAA,GAAwC,EAAA;AAKvC,SAAS,kBAAA,CACd,OAAA,EACA,WAAA,GAAmCA,oCAAA,CAAwB,OAAO,CAAA,EACvD;AACX,EAAA,IAAI,eAAA,GAAkB,CAAA;AACtB,EAAA,IAAI,YAAA,GAAe,CAAA;AAEnB,EAAA,eAAe,YAAY,OAAA,EAAkE;AAC3F,IAAA,MAAM,WAAA,GAAc,QAAQ,IAAA,CAAK,MAAA;AACjC,IAAA,eAAA,IAAmB,WAAA;AACnB,IAAA,YAAA,EAAA;AAEA,IAAA,MAAM,cAAA,GAA8B;AAAA,MAClC,MAAM,OAAA,CAAQ,IAAA;AAAA,MACd,MAAA,EAAQ,MAAA;AAAA,MACR,cAAA,EAAgB,eAAA;AAAA,MAChB,SAAS,OAAA,CAAQ,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAYjB,SAAA,EAAW,eAAA,IAAmB,GAAA,IAAU,YAAA,GAAe,EAAA;AAAA,MACvD,GAAG,OAAA,CAAQ;AAAA,KACb;AAEA,IAAA,IAAI;AAEF,MAAA,MAAM,QAAA,GAAW,MAAM,WAAA,CAAY,OAAA,CAAQ,KAAK,cAAc,CAAA;AAE9D,MAAA,OAAO;AAAA,QACL,YAAY,QAAA,CAAS,MAAA;AAAA,QACrB,OAAA,EAAS;AAAA,UACP,sBAAA,EAAwB,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,sBAAsB,CAAA;AAAA,UACnE,aAAA,EAAe,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,aAAa;AAAA;AACnD,OACF;AAAA,IACF,SAAS,CAAA,EAAG;AACV,MAAAC,sCAAA,CAA0B,OAAO,CAAA;AACjC,MAAA,MAAM,CAAA;AAAA,IACR,CAAA,SAAE;AACA,MAAA,eAAA,IAAmB,WAAA;AACnB,MAAA,YAAA,EAAA;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAOC,oBAAA;AAAA,IACL,OAAA;AAAA,IACA,WAAA;AAAA,IACAC,sBAAA,CAAkB,OAAA,CAAQ,UAAA,IAAc,qCAAqC;AAAA,GAC/E;AACF;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
3
+ const core = require('@sentry/core');
4
4
  const helpers = require('../helpers.js');
5
5
  const fetch = require('./fetch.js');
6
6
 
@@ -66,14 +66,14 @@ function createIndexedDbStore(options) {
66
66
  return {
67
67
  push: async (env) => {
68
68
  try {
69
- const serialized = browser.serializeEnvelope(env);
69
+ const serialized = core.serializeEnvelope(env);
70
70
  await push(getStore(), serialized, options.maxQueueSize || 30);
71
71
  } catch {
72
72
  }
73
73
  },
74
74
  unshift: async (env) => {
75
75
  try {
76
- const serialized = browser.serializeEnvelope(env);
76
+ const serialized = core.serializeEnvelope(env);
77
77
  await unshift(getStore(), serialized, options.maxQueueSize || 30);
78
78
  } catch {
79
79
  }
@@ -82,7 +82,7 @@ function createIndexedDbStore(options) {
82
82
  try {
83
83
  const deserialized = await shift(getStore());
84
84
  if (deserialized) {
85
- return browser.parseEnvelope(deserialized);
85
+ return core.parseEnvelope(deserialized);
86
86
  }
87
87
  } catch {
88
88
  }
@@ -100,7 +100,7 @@ function makeIndexedDbOfflineTransport(createTransport) {
100
100
  };
101
101
  }
102
102
  function makeBrowserOfflineTransport(createTransport = fetch.makeFetchTransport) {
103
- return makeIndexedDbOfflineTransport(browser.makeOfflineTransport(createTransport));
103
+ return makeIndexedDbOfflineTransport(core.makeOfflineTransport(createTransport));
104
104
  }
105
105
 
106
106
  exports.createStore = createStore;
@@ -1 +1 @@
1
- {"version":3,"file":"offline.js","sources":["../../../../../src/transports/offline.ts"],"sourcesContent":["import type {\n BaseTransportOptions,\n Envelope,\n OfflineStore,\n OfflineTransportOptions,\n Transport,\n} from '@sentry/core/browser';\nimport { makeOfflineTransport, parseEnvelope, serializeEnvelope } from '@sentry/core/browser';\nimport { WINDOW } from '../helpers';\nimport { makeFetchTransport } from './fetch';\n\n// 'Store', 'promisifyRequest' and 'createStore' were originally copied from the 'idb-keyval' package before being\n// modified and simplified: https://github.com/jakearchibald/idb-keyval\n//\n// At commit: 0420a704fd6cbb4225429c536b1f61112d012fca\n// Original license:\n\n// Copyright 2016, Jake Archibald\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntype Store = <T>(callback: (store: IDBObjectStore) => T | PromiseLike<T>) => Promise<T>;\n\nfunction promisifyRequest<T = undefined>(request: IDBRequest<T> | IDBTransaction): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n // @ts-expect-error - file size hacks\n request.oncomplete = request.onsuccess = () => resolve(request.result);\n // @ts-expect-error - file size hacks\n request.onabort = request.onerror = () => reject(request.error);\n });\n}\n\n/** Create or open an IndexedDb store */\nexport function createStore(dbName: string, storeName: string): Store {\n const request = indexedDB.open(dbName);\n request.onupgradeneeded = () => request.result.createObjectStore(storeName);\n const dbp = promisifyRequest(request);\n\n return callback => dbp.then(db => callback(db.transaction(storeName, 'readwrite').objectStore(storeName)));\n}\n\nfunction keys(store: IDBObjectStore): Promise<number[]> {\n return promisifyRequest(store.getAllKeys() as IDBRequest<number[]>);\n}\n\n/** Insert into the end of the store */\nexport function push(store: Store, value: Uint8Array | string, maxQueueSize: number): Promise<void> {\n return store(store => {\n return keys(store).then(keys => {\n if (keys.length >= maxQueueSize) {\n return;\n }\n\n // We insert with an incremented key so that the entries are popped in order\n store.put(value, Math.max(...keys, 0) + 1);\n return promisifyRequest(store.transaction);\n });\n });\n}\n\n/** Insert into the front of the store */\nexport function unshift(store: Store, value: Uint8Array | string, maxQueueSize: number): Promise<void> {\n return store(store => {\n return keys(store).then(keys => {\n if (keys.length >= maxQueueSize) {\n return;\n }\n\n // We insert with an decremented key so that the entries are popped in order\n store.put(value, Math.min(...keys, 0) - 1);\n return promisifyRequest(store.transaction);\n });\n });\n}\n\n/** Pop the oldest value from the store */\nexport function shift(store: Store): Promise<Uint8Array | string | undefined> {\n return store(store => {\n return keys(store).then(keys => {\n const firstKey = keys[0];\n if (firstKey == null) {\n return undefined;\n }\n\n return promisifyRequest(store.get(firstKey)).then(value => {\n store.delete(firstKey);\n return promisifyRequest(store.transaction).then(() => value);\n });\n });\n });\n}\n\nexport interface BrowserOfflineTransportOptions extends Omit<OfflineTransportOptions, 'createStore'> {\n /**\n * Name of indexedDb database to store envelopes in\n * Default: 'sentry-offline'\n */\n dbName?: string;\n /**\n * Name of indexedDb object store to store envelopes in\n * Default: 'queue'\n */\n storeName?: string;\n /**\n * Maximum number of envelopes to store\n * Default: 30\n */\n maxQueueSize?: number;\n}\n\nfunction createIndexedDbStore(options: BrowserOfflineTransportOptions): OfflineStore {\n let store: Store | undefined;\n\n // Lazily create the store only when it's needed\n function getStore(): Store {\n if (store == undefined) {\n store = createStore(options.dbName || 'sentry-offline', options.storeName || 'queue');\n }\n\n return store;\n }\n\n return {\n push: async (env: Envelope) => {\n try {\n const serialized = serializeEnvelope(env);\n await push(getStore(), serialized, options.maxQueueSize || 30);\n } catch {\n //\n }\n },\n unshift: async (env: Envelope) => {\n try {\n const serialized = serializeEnvelope(env);\n await unshift(getStore(), serialized, options.maxQueueSize || 30);\n } catch {\n //\n }\n },\n shift: async () => {\n try {\n const deserialized = await shift(getStore());\n if (deserialized) {\n return parseEnvelope(deserialized);\n }\n } catch {\n //\n }\n\n return undefined;\n },\n };\n}\n\nfunction makeIndexedDbOfflineTransport<T>(\n createTransport: (options: T) => Transport,\n): (options: T & BrowserOfflineTransportOptions) => Transport {\n return options => {\n const transport = createTransport({ ...options, createStore: createIndexedDbStore });\n\n WINDOW.addEventListener('online', async _ => {\n await transport.flush();\n });\n\n return transport;\n };\n}\n\n/**\n * Creates a transport that uses IndexedDb to store events when offline.\n */\nexport function makeBrowserOfflineTransport<T extends BaseTransportOptions>(\n createTransport: (options: T) => Transport = makeFetchTransport,\n): (options: T & BrowserOfflineTransportOptions) => Transport {\n return makeIndexedDbOfflineTransport<T>(makeOfflineTransport(createTransport));\n}\n"],"names":["store","keys","serializeEnvelope","parseEnvelope","WINDOW","makeFetchTransport","makeOfflineTransport"],"mappings":";;;;;;AAiCA,SAAS,iBAAgC,OAAA,EAAqD;AAC5F,EAAA,OAAO,IAAI,OAAA,CAAW,CAAC,OAAA,EAAS,MAAA,KAAW;AAEzC,IAAA,OAAA,CAAQ,aAAa,OAAA,CAAQ,SAAA,GAAY,MAAM,OAAA,CAAQ,QAAQ,MAAM,CAAA;AAErE,IAAA,OAAA,CAAQ,UAAU,OAAA,CAAQ,OAAA,GAAU,MAAM,MAAA,CAAO,QAAQ,KAAK,CAAA;AAAA,EAChE,CAAC,CAAA;AACH;AAGO,SAAS,WAAA,CAAY,QAAgB,SAAA,EAA0B;AACpE,EAAA,MAAM,OAAA,GAAU,SAAA,CAAU,IAAA,CAAK,MAAM,CAAA;AACrC,EAAA,OAAA,CAA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,gBAAgB,EAAE,CAAA;AAAA,MAC/D,CAAA,CAAA,MAAQ;AAAA,MAER;AAAA,IACF,CAAA;AAAA,IACA,OAAA,EAAS,OAAO,GAAA,KAAkB;AAChC,MAAA,IAAI;AACF,QAAA,MAAM,UAAA,GAAaA,0BAAkB,GAAG,CAAA;AACxC,QAAA,MAAM,QAAQ,QAAA,EAAS,EAAG,UAAA,EAAY,OAAA,CAAQ,gBAAgB,EAAE,CAAA;AAAA,MAClE,CAAA,CAAA,MAAQ;AAAA,MAER;AAAA,IACF,CAAA;AAAA,IACA,OAAO,YAAY;AACjB,MAAA,IAAI;AACF,QAAA,MAAM,YAAA,GAAe,MAAM,KAAA,CAAM,QAAA,EAAU,CAAA;AAC3C,QAAA,IAAI,YAAA,EAAc;AAChB,UAAA,OAAOC,sBAAc,YAAY,CAAA;AAAA,QACnC;AAAA,MACF,CAAA,CAAA,MAAQ;AAAA,MAER;AAEA,MAAA,OAAO,MAAA;AAAA,IACT;AAAA,GACF;AACF;AAEA,SAAS,8BACP,eAAA,EAC4D;AAC5D,EAAA,OAAO,CAAA,OAAA,KAAW;AAChB,IAAA,MAAM,YAAY,eAAA,CAAgB,EAAE,GAAG,OAAA,EAAS,WAAA,EAAa,sBAAsB,CAAA;AAEnF,IAAAC,cAAA,CAAO,gBAAA,CAAiB,QAAA,EAAU,OAAM,CAAA,KAAK;AAC3C,MAAA,MAAM,UAAU,KAAA,EAAM;AAAA,IACxB,CAAC,CAAA;AAED,IAAA,OAAO,SAAA;AAAA,EACT,CAAA;AACF;AAKO,SAAS,2BAAA,CACd,kBAA6CC,wBAAA,EACe;AAC5D,EAAA,OAAO,6BAAA,CAAiCC,4BAAA,CAAqB,eAAe,CAAC,CAAA;AAC/E;;;;;;;;"}
1
+ {"version":3,"file":"offline.js","sources":["../../../../../src/transports/offline.ts"],"sourcesContent":["import type { BaseTransportOptions, Envelope, OfflineStore, OfflineTransportOptions, Transport } from '@sentry/core';\nimport { makeOfflineTransport, parseEnvelope, serializeEnvelope } from '@sentry/core';\nimport { WINDOW } from '../helpers';\nimport { makeFetchTransport } from './fetch';\n\n// 'Store', 'promisifyRequest' and 'createStore' were originally copied from the 'idb-keyval' package before being\n// modified and simplified: https://github.com/jakearchibald/idb-keyval\n//\n// At commit: 0420a704fd6cbb4225429c536b1f61112d012fca\n// Original license:\n\n// Copyright 2016, Jake Archibald\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntype Store = <T>(callback: (store: IDBObjectStore) => T | PromiseLike<T>) => Promise<T>;\n\nfunction promisifyRequest<T = undefined>(request: IDBRequest<T> | IDBTransaction): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n // @ts-expect-error - file size hacks\n request.oncomplete = request.onsuccess = () => resolve(request.result);\n // @ts-expect-error - file size hacks\n request.onabort = request.onerror = () => reject(request.error);\n });\n}\n\n/** Create or open an IndexedDb store */\nexport function createStore(dbName: string, storeName: string): Store {\n const request = indexedDB.open(dbName);\n request.onupgradeneeded = () => request.result.createObjectStore(storeName);\n const dbp = promisifyRequest(request);\n\n return callback => dbp.then(db => callback(db.transaction(storeName, 'readwrite').objectStore(storeName)));\n}\n\nfunction keys(store: IDBObjectStore): Promise<number[]> {\n return promisifyRequest(store.getAllKeys() as IDBRequest<number[]>);\n}\n\n/** Insert into the end of the store */\nexport function push(store: Store, value: Uint8Array | string, maxQueueSize: number): Promise<void> {\n return store(store => {\n return keys(store).then(keys => {\n if (keys.length >= maxQueueSize) {\n return;\n }\n\n // We insert with an incremented key so that the entries are popped in order\n store.put(value, Math.max(...keys, 0) + 1);\n return promisifyRequest(store.transaction);\n });\n });\n}\n\n/** Insert into the front of the store */\nexport function unshift(store: Store, value: Uint8Array | string, maxQueueSize: number): Promise<void> {\n return store(store => {\n return keys(store).then(keys => {\n if (keys.length >= maxQueueSize) {\n return;\n }\n\n // We insert with an decremented key so that the entries are popped in order\n store.put(value, Math.min(...keys, 0) - 1);\n return promisifyRequest(store.transaction);\n });\n });\n}\n\n/** Pop the oldest value from the store */\nexport function shift(store: Store): Promise<Uint8Array | string | undefined> {\n return store(store => {\n return keys(store).then(keys => {\n const firstKey = keys[0];\n if (firstKey == null) {\n return undefined;\n }\n\n return promisifyRequest(store.get(firstKey)).then(value => {\n store.delete(firstKey);\n return promisifyRequest(store.transaction).then(() => value);\n });\n });\n });\n}\n\nexport interface BrowserOfflineTransportOptions extends Omit<OfflineTransportOptions, 'createStore'> {\n /**\n * Name of indexedDb database to store envelopes in\n * Default: 'sentry-offline'\n */\n dbName?: string;\n /**\n * Name of indexedDb object store to store envelopes in\n * Default: 'queue'\n */\n storeName?: string;\n /**\n * Maximum number of envelopes to store\n * Default: 30\n */\n maxQueueSize?: number;\n}\n\nfunction createIndexedDbStore(options: BrowserOfflineTransportOptions): OfflineStore {\n let store: Store | undefined;\n\n // Lazily create the store only when it's needed\n function getStore(): Store {\n if (store == undefined) {\n store = createStore(options.dbName || 'sentry-offline', options.storeName || 'queue');\n }\n\n return store;\n }\n\n return {\n push: async (env: Envelope) => {\n try {\n const serialized = serializeEnvelope(env);\n await push(getStore(), serialized, options.maxQueueSize || 30);\n } catch {\n //\n }\n },\n unshift: async (env: Envelope) => {\n try {\n const serialized = serializeEnvelope(env);\n await unshift(getStore(), serialized, options.maxQueueSize || 30);\n } catch {\n //\n }\n },\n shift: async () => {\n try {\n const deserialized = await shift(getStore());\n if (deserialized) {\n return parseEnvelope(deserialized);\n }\n } catch {\n //\n }\n\n return undefined;\n },\n };\n}\n\nfunction makeIndexedDbOfflineTransport<T>(\n createTransport: (options: T) => Transport,\n): (options: T & BrowserOfflineTransportOptions) => Transport {\n return options => {\n const transport = createTransport({ ...options, createStore: createIndexedDbStore });\n\n WINDOW.addEventListener('online', async _ => {\n await transport.flush();\n });\n\n return transport;\n };\n}\n\n/**\n * Creates a transport that uses IndexedDb to store events when offline.\n */\nexport function makeBrowserOfflineTransport<T extends BaseTransportOptions>(\n createTransport: (options: T) => Transport = makeFetchTransport,\n): (options: T & BrowserOfflineTransportOptions) => Transport {\n return makeIndexedDbOfflineTransport<T>(makeOfflineTransport(createTransport));\n}\n"],"names":["store","keys","serializeEnvelope","parseEnvelope","WINDOW","makeFetchTransport","makeOfflineTransport"],"mappings":";;;;;;AA2BA,SAAS,iBAAgC,OAAA,EAAqD;AAC5F,EAAA,OAAO,IAAI,OAAA,CAAW,CAAC,OAAA,EAAS,MAAA,KAAW;AAEzC,IAAA,OAAA,CAAQ,aAAa,OAAA,CAAQ,SAAA,GAAY,MAAM,OAAA,CAAQ,QAAQ,MAAM,CAAA;AAErE,IAAA,OAAA,CAAQ,UAAU,OAAA,CAAQ,OAAA,GAAU,MAAM,MAAA,CAAO,QAAQ,KAAK,CAAA;AAAA,EAChE,CAAC,CAAA;AACH;AAGO,SAAS,WAAA,CAAY,QAAgB,SAAA,EAA0B;AACpE,EAAA,MAAM,OAAA,GAAU,SAAA,CAAU,IAAA,CAAK,MAAM,CAAA;AACrC,EAAA,OAAA,CAAQ,eAAA,GAAkB,MAAM,OAAA,CAAQ,MAAA,CAAO,kBAAkB,SAAS,CAAA;AAC1E,EAAA,MAAM,GAAA,GAAM,iBAAiB,OAAO,CAAA;AAEpC,EAAA,OAAO,CAAA,QAAA,KAAY,GAAA,CAAI,IAAA,CAAK,CAAA,EAAA,KAAM,QAAA,CAAS,EAAA,CAAG,WAAA,CAAY,SAAA,EAAW,WAAW,CAAA,CAAE,WAAA,CAAY,SAAS,CAAC,CAAC,CAAA;AAC3G;AAEA,SAAS,KAAK,KAAA,EAA0C;AACtD,EAAA,OAAO,gBAAA,CAAiB,KAAA,CAAM,UAAA,EAAoC,CAAA;AACpE;AAGO,SAAS,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CAAM,QAAA,EAAU,CAAA;AAC3C,QAAA,IAAI,YAAA,EAAc;AAChB,UAAA,OAAOC,mBAAc,YAAY,CAAA;AAAA,QACnC;AAAA,MACF,CAAA,CAAA,MAAQ;AAAA,MAER;AAEA,MAAA,OAAO,MAAA;AAAA,IACT;AAAA,GACF;AACF;AAEA,SAAS,8BACP,eAAA,EAC4D;AAC5D,EAAA,OAAO,CAAA,OAAA,KAAW;AAChB,IAAA,MAAM,YAAY,eAAA,CAAgB,EAAE,GAAG,OAAA,EAAS,WAAA,EAAa,sBAAsB,CAAA;AAEnF,IAAAC,cAAA,CAAO,gBAAA,CAAiB,QAAA,EAAU,OAAM,CAAA,KAAK;AAC3C,MAAA,MAAM,UAAU,KAAA,EAAM;AAAA,IACxB,CAAC,CAAA;AAED,IAAA,OAAO,SAAA;AAAA,EACT,CAAA;AACF;AAKO,SAAS,2BAAA,CACd,kBAA6CC,wBAAA,EACe;AAC5D,EAAA,OAAO,6BAAA,CAAiCC,yBAAA,CAAqB,eAAe,CAAC,CAAA;AAC/E;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
3
+ const core = require('@sentry/core');
4
4
 
5
5
  function createUserFeedbackEnvelope(feedback, {
6
6
  metadata,
@@ -16,10 +16,10 @@ function createUserFeedbackEnvelope(feedback, {
16
16
  version: metadata.sdk.version
17
17
  }
18
18
  },
19
- ...!!tunnel && !!dsn && { dsn: browser.dsnToString(dsn) }
19
+ ...!!tunnel && !!dsn && { dsn: core.dsnToString(dsn) }
20
20
  };
21
21
  const item = createUserFeedbackEnvelopeItem(feedback);
22
- return browser.createEnvelope(headers, [item]);
22
+ return core.createEnvelope(headers, [item]);
23
23
  }
24
24
  function createUserFeedbackEnvelopeItem(feedback) {
25
25
  const feedbackHeaders = {
@@ -1 +1 @@
1
- {"version":3,"file":"userfeedback.js","sources":["../../../../src/userfeedback.ts"],"sourcesContent":["import type { DsnComponents, EventEnvelope, SdkMetadata, UserFeedback, UserFeedbackItem } from '@sentry/core/browser';\nimport { createEnvelope, dsnToString } from '@sentry/core/browser';\n\n/**\n * Creates an envelope from a user feedback.\n */\nexport function createUserFeedbackEnvelope(\n feedback: UserFeedback,\n {\n metadata,\n tunnel,\n dsn,\n }: {\n metadata: SdkMetadata | undefined;\n tunnel: string | undefined;\n dsn: DsnComponents | undefined;\n },\n): EventEnvelope {\n const headers: EventEnvelope[0] = {\n event_id: feedback.event_id,\n sent_at: new Date().toISOString(),\n ...(metadata?.sdk && {\n sdk: {\n name: metadata.sdk.name,\n version: metadata.sdk.version,\n },\n }),\n ...(!!tunnel && !!dsn && { dsn: dsnToString(dsn) }),\n };\n const item = createUserFeedbackEnvelopeItem(feedback);\n\n return createEnvelope(headers, [item]);\n}\n\nfunction createUserFeedbackEnvelopeItem(feedback: UserFeedback): UserFeedbackItem {\n const feedbackHeaders: UserFeedbackItem[0] = {\n type: 'user_report',\n };\n return [feedbackHeaders, feedback];\n}\n"],"names":["dsnToString","createEnvelope"],"mappings":";;;;AAMO,SAAS,2BACd,QAAA,EACA;AAAA,EACE,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAKe;AACf,EAAA,MAAM,OAAA,GAA4B;AAAA,IAChC,UAAU,QAAA,CAAS,QAAA;AAAA,IACnB,OAAA,EAAA,iBAAS,IAAI,IAAA,EAAK,EAAE,WAAA,EAAY;AAAA,IAChC,GAAI,UAAU,GAAA,IAAO;AAAA,MACnB,GAAA,EAAK;AAAA,QACH,IAAA,EAAM,SAAS,GAAA,CAAI,IAAA;AAAA,QACnB,OAAA,EAAS,SAAS,GAAA,CAAI;AAAA;AACxB,KACF;AAAA,IACA,GAAI,CAAC,CAAC,MAAA,IAAU,CAAC,CAAC,GAAA,IAAO,EAAE,GAAA,EAAKA,mBAAA,CAAY,GAAG,CAAA;AAAE,GACnD;AACA,EAAA,MAAM,IAAA,GAAO,+BAA+B,QAAQ,CAAA;AAEpD,EAAA,OAAOC,sBAAA,CAAe,OAAA,EAAS,CAAC,IAAI,CAAC,CAAA;AACvC;AAEA,SAAS,+BAA+B,QAAA,EAA0C;AAChF,EAAA,MAAM,eAAA,GAAuC;AAAA,IAC3C,IAAA,EAAM;AAAA,GACR;AACA,EAAA,OAAO,CAAC,iBAAiB,QAAQ,CAAA;AACnC;;;;"}
1
+ {"version":3,"file":"userfeedback.js","sources":["../../../../src/userfeedback.ts"],"sourcesContent":["import type { DsnComponents, EventEnvelope, SdkMetadata, UserFeedback, UserFeedbackItem } from '@sentry/core';\nimport { createEnvelope, dsnToString } from '@sentry/core';\n\n/**\n * Creates an envelope from a user feedback.\n */\nexport function createUserFeedbackEnvelope(\n feedback: UserFeedback,\n {\n metadata,\n tunnel,\n dsn,\n }: {\n metadata: SdkMetadata | undefined;\n tunnel: string | undefined;\n dsn: DsnComponents | undefined;\n },\n): EventEnvelope {\n const headers: EventEnvelope[0] = {\n event_id: feedback.event_id,\n sent_at: new Date().toISOString(),\n ...(metadata?.sdk && {\n sdk: {\n name: metadata.sdk.name,\n version: metadata.sdk.version,\n },\n }),\n ...(!!tunnel && !!dsn && { dsn: dsnToString(dsn) }),\n };\n const item = createUserFeedbackEnvelopeItem(feedback);\n\n return createEnvelope(headers, [item]);\n}\n\nfunction createUserFeedbackEnvelopeItem(feedback: UserFeedback): UserFeedbackItem {\n const feedbackHeaders: UserFeedbackItem[0] = {\n type: 'user_report',\n };\n return [feedbackHeaders, feedback];\n}\n"],"names":["dsnToString","createEnvelope"],"mappings":";;;;AAMO,SAAS,2BACd,QAAA,EACA;AAAA,EACE,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAKe;AACf,EAAA,MAAM,OAAA,GAA4B;AAAA,IAChC,UAAU,QAAA,CAAS,QAAA;AAAA,IACnB,OAAA,EAAA,iBAAS,IAAI,IAAA,EAAK,EAAE,WAAA,EAAY;AAAA,IAChC,GAAI,UAAU,GAAA,IAAO;AAAA,MACnB,GAAA,EAAK;AAAA,QACH,IAAA,EAAM,SAAS,GAAA,CAAI,IAAA;AAAA,QACnB,OAAA,EAAS,SAAS,GAAA,CAAI;AAAA;AACxB,KACF;AAAA,IACA,GAAI,CAAC,CAAC,MAAA,IAAU,CAAC,CAAC,GAAA,IAAO,EAAE,GAAA,EAAKA,gBAAA,CAAY,GAAG,CAAA;AAAE,GACnD;AACA,EAAA,MAAM,IAAA,GAAO,+BAA+B,QAAQ,CAAA;AAEpD,EAAA,OAAOC,mBAAA,CAAe,OAAA,EAAS,CAAC,IAAI,CAAC,CAAA;AACvC;AAEA,SAAS,+BAA+B,QAAA,EAA0C;AAChF,EAAA,MAAM,eAAA,GAAuC;AAAA,IAC3C,IAAA,EAAM;AAAA,GACR;AACA,EAAA,OAAO,CAAC,iBAAiB,QAAQ,CAAA;AACnC;;;;"}
@@ -1,14 +1,14 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const browserUtils = require('@sentry/browser-utils');
4
- const browser = require('@sentry/core/browser');
4
+ const core = require('@sentry/core');
5
5
  const debugBuild = require('../debug-build.js');
6
6
  const helpers = require('../helpers.js');
7
7
 
8
8
  function checkAndWarnIfIsEmbeddedBrowserExtension() {
9
9
  if (_isEmbeddedBrowserExtension()) {
10
10
  if (debugBuild.DEBUG_BUILD) {
11
- browser.consoleSandbox(() => {
11
+ core.consoleSandbox(() => {
12
12
  console.error(
13
13
  "[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/"
14
14
  );
@@ -1 +1 @@
1
- {"version":3,"file":"detectBrowserExtension.js","sources":["../../../../../src/utils/detectBrowserExtension.ts"],"sourcesContent":["import { getLocationHref } from '@sentry/browser-utils';\nimport { consoleSandbox } from '@sentry/core/browser';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\n\ntype ExtensionRuntime = {\n runtime?: {\n id?: string;\n };\n};\ntype ExtensionProperties = {\n chrome?: ExtensionRuntime;\n browser?: ExtensionRuntime;\n nw?: unknown;\n};\n\n/**\n * Returns true if the SDK is running in an embedded browser extension.\n * Stand-alone browser extensions (which do not share the same data as the main browser page) are fine.\n */\nexport function checkAndWarnIfIsEmbeddedBrowserExtension(): boolean {\n if (_isEmbeddedBrowserExtension()) {\n if (DEBUG_BUILD) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(\n '[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',\n );\n });\n }\n\n return true;\n }\n\n return false;\n}\n\nfunction _isEmbeddedBrowserExtension(): boolean {\n if (typeof WINDOW.window === 'undefined') {\n // No need to show the error if we're not in a browser window environment (e.g. service workers)\n return false;\n }\n\n const _window = WINDOW as typeof WINDOW & ExtensionProperties;\n\n // Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine\n // see: https://github.com/getsentry/sentry-javascript/issues/12668\n if (_window.nw) {\n return false;\n }\n\n const extensionObject = _window['chrome'] || _window['browser'];\n\n if (!extensionObject?.runtime?.id) {\n return false;\n }\n\n const href = getLocationHref();\n\n // Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage\n const isDedicatedExtensionPage =\n WINDOW === WINDOW.top &&\n /^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\\/\\//.test(href);\n\n return !isDedicatedExtensionPage;\n}\n"],"names":["DEBUG_BUILD","consoleSandbox","WINDOW","getLocationHref"],"mappings":";;;;;;;AAoBO,SAAS,wCAAA,GAAoD;AAClE,EAAA,IAAI,6BAA4B,EAAG;AACjC,IAAA,IAAIA,sBAAA,EAAa;AACf,MAAAC,sBAAA,CAAe,MAAM;AAEnB,QAAA,OAAA,CAAQ,KAAA;AAAA,UACN;AAAA,SACF;AAAA,MACF,CAAC,CAAA;AAAA,IACH;AAEA,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA;AACT;AAEA,SAAS,2BAAA,GAAuC;AAC9C,EAAA,IAAI,OAAOC,cAAA,CAAO,MAAA,KAAW,WAAA,EAAa;AAExC,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,OAAA,GAAUA,cAAA;AAIhB,EAAA,IAAI,QAAQ,EAAA,EAAI;AACd,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,eAAA,GAAkB,OAAA,CAAQ,QAAQ,CAAA,IAAK,QAAQ,SAAS,CAAA;AAE9D,EAAA,IAAI,CAAC,eAAA,EAAiB,OAAA,EAAS,EAAA,EAAI;AACjC,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,OAAOC,4BAAA,EAAgB;AAG7B,EAAA,MAAM,2BACJD,cAAA,KAAWA,cAAA,CAAO,GAAA,IAClB,oFAAA,CAAqF,KAAK,IAAI,CAAA;AAEhG,EAAA,OAAO,CAAC,wBAAA;AACV;;;;"}
1
+ {"version":3,"file":"detectBrowserExtension.js","sources":["../../../../../src/utils/detectBrowserExtension.ts"],"sourcesContent":["import { getLocationHref } from '@sentry/browser-utils';\nimport { consoleSandbox } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\n\ntype ExtensionRuntime = {\n runtime?: {\n id?: string;\n };\n};\ntype ExtensionProperties = {\n chrome?: ExtensionRuntime;\n browser?: ExtensionRuntime;\n nw?: unknown;\n};\n\n/**\n * Returns true if the SDK is running in an embedded browser extension.\n * Stand-alone browser extensions (which do not share the same data as the main browser page) are fine.\n */\nexport function checkAndWarnIfIsEmbeddedBrowserExtension(): boolean {\n if (_isEmbeddedBrowserExtension()) {\n if (DEBUG_BUILD) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(\n '[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',\n );\n });\n }\n\n return true;\n }\n\n return false;\n}\n\nfunction _isEmbeddedBrowserExtension(): boolean {\n if (typeof WINDOW.window === 'undefined') {\n // No need to show the error if we're not in a browser window environment (e.g. service workers)\n return false;\n }\n\n const _window = WINDOW as typeof WINDOW & ExtensionProperties;\n\n // Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine\n // see: https://github.com/getsentry/sentry-javascript/issues/12668\n if (_window.nw) {\n return false;\n }\n\n const extensionObject = _window['chrome'] || _window['browser'];\n\n if (!extensionObject?.runtime?.id) {\n return false;\n }\n\n const href = getLocationHref();\n\n // Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage\n const isDedicatedExtensionPage =\n WINDOW === WINDOW.top &&\n /^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\\/\\//.test(href);\n\n return !isDedicatedExtensionPage;\n}\n"],"names":["DEBUG_BUILD","consoleSandbox","WINDOW","getLocationHref"],"mappings":";;;;;;;AAoBO,SAAS,wCAAA,GAAoD;AAClE,EAAA,IAAI,6BAA4B,EAAG;AACjC,IAAA,IAAIA,sBAAA,EAAa;AACf,MAAAC,mBAAA,CAAe,MAAM;AAEnB,QAAA,OAAA,CAAQ,KAAA;AAAA,UACN;AAAA,SACF;AAAA,MACF,CAAC,CAAA;AAAA,IACH;AAEA,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA;AACT;AAEA,SAAS,2BAAA,GAAuC;AAC9C,EAAA,IAAI,OAAOC,cAAA,CAAO,MAAA,KAAW,WAAA,EAAa;AAExC,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,OAAA,GAAUA,cAAA;AAIhB,EAAA,IAAI,QAAQ,EAAA,EAAI;AACd,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,eAAA,GAAkB,OAAA,CAAQ,QAAQ,CAAA,IAAK,QAAQ,SAAS,CAAA;AAE9D,EAAA,IAAI,CAAC,eAAA,EAAiB,OAAA,EAAS,EAAA,EAAI;AACjC,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,OAAOC,4BAAA,EAAgB;AAG7B,EAAA,MAAM,2BACJD,cAAA,KAAWA,cAAA,CAAO,GAAA,IAClB,oFAAA,CAAqF,KAAK,IAAI,CAAA;AAEhG,EAAA,OAAO,CAAC,wBAAA;AACV;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
3
+ const core = require('@sentry/core');
4
4
  const helpers = require('../helpers.js');
5
5
 
6
6
  const LAZY_LOADABLE_NAMES = [
@@ -73,9 +73,9 @@ async function lazyLoadIntegration(name, scriptNonce) {
73
73
  return integrationFn;
74
74
  }
75
75
  function getScriptURL(bundle) {
76
- const client = browser.getClient();
76
+ const client = core.getClient();
77
77
  const baseURL = client?.getOptions()?.cdnBaseUrl || "https://browser.sentry-cdn.com";
78
- return new URL(`/${browser.SDK_VERSION}/${bundle}.min.js`, baseURL).toString();
78
+ return new URL(`/${core.SDK_VERSION}/${bundle}.min.js`, baseURL).toString();
79
79
  }
80
80
 
81
81
  exports.lazyLoadIntegration = lazyLoadIntegration;