@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,10 +1,10 @@
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 eventbuilder = require('./eventbuilder.js');
5
5
  const helpers = require('./helpers.js');
6
6
 
7
- class BrowserClient extends browser.Client {
7
+ class BrowserClient extends core.Client {
8
8
  /**
9
9
  * Creates a new Browser SDK instance.
10
10
  *
@@ -12,8 +12,8 @@ class BrowserClient extends browser.Client {
12
12
  */
13
13
  constructor(options) {
14
14
  const opts = applyDefaultOptions(options);
15
- const sdkSource = helpers.WINDOW.SENTRY_SDK_SOURCE || browser.getSDKSource();
16
- browser.applySdkMetadata(opts, "browser", ["browser"], sdkSource);
15
+ const sdkSource = helpers.WINDOW.SENTRY_SDK_SOURCE || core.getSDKSource();
16
+ core.applySdkMetadata(opts, "browser", ["browser"], sdkSource);
17
17
  super(opts);
18
18
  this._unhandledSessionStatus = "unhandled";
19
19
  const { userInfo } = this.getDataCollectionOptions();
@@ -39,7 +39,7 @@ class BrowserClient extends browser.Client {
39
39
  });
40
40
  }
41
41
  if (userInfo) {
42
- this.on("beforeSendSession", browser.addAutoIpAddressToSession);
42
+ this.on("beforeSendSession", core.addAutoIpAddressToSession);
43
43
  }
44
44
  }
45
45
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sources":["../../../../src/client.ts"],"sourcesContent":["import type {\n BrowserClientReplayOptions,\n ClientOptions,\n Event,\n EventHint,\n Options as CoreOptions,\n ParameterizedString,\n Scope,\n SeverityLevel,\n} from '@sentry/core/browser';\nimport { addAutoIpAddressToSession, applySdkMetadata, Client, getSDKSource } from '@sentry/core/browser';\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { WINDOW } from './helpers';\nimport type { BrowserTransportOptions } from './transports/types';\n\n/**\n * A magic string that build tooling can leverage in order to inject a release value into the SDK.\n */\ndeclare const __SENTRY_RELEASE__: string | undefined;\n\nexport type BrowserClientProfilingOptions = {\n /**\n * Sets profiling session sample rate for the entire profiling session.\n *\n * A profiling session corresponds to a user session, meaning it is set once at integration initialization and\n * persisted until the next page reload. This rate determines what percentage of user sessions will have profiling enabled.\n * @default 0\n */\n profileSessionSampleRate?: number;\n\n /**\n * Set the lifecycle mode of the profiler.\n * - **manual**: The profiler will be manually started and stopped via `startProfiler`/`stopProfiler`.\n * If a session is sampled, is dependent on the `profileSessionSampleRate`.\n * - **trace**: The profiler will be automatically started when a root span exists and stopped when there are no\n * more sampled root spans. Whether a session is sampled, is dependent on the `profileSessionSampleRate` and the\n * existing sampling configuration for tracing (`tracesSampleRate`/`tracesSampler`).\n *\n * @default 'manual'\n */\n profileLifecycle?: 'manual' | 'trace';\n};\n\ntype BrowserSpecificOptions = BrowserClientReplayOptions &\n BrowserClientProfilingOptions & {\n /** If configured, this URL will be used as base URL for lazy loading integration. */\n cdnBaseUrl?: string;\n\n /**\n * Important: Only set this option if you know what you are doing!\n *\n * By default, the SDK will check if `Sentry.init` is called in a browser extension.\n * In case it is, it will stop initialization and log a warning\n * because browser extensions require a different Sentry initialization process:\n * https://docs.sentry.io/platforms/javascript/best-practices/shared-environments/\n *\n * Setting up the SDK in a browser extension with global error monitoring is not recommended\n * and will likely flood you with errors from other web sites or extensions. This can heavily\n * impact your quota and cause interference with your and other Sentry SDKs in shared environments.\n *\n * If this check wrongfully flags your setup as a browser extension, you can set this\n * option to `true` to skip the check.\n *\n * @default false\n */\n skipBrowserExtensionCheck?: boolean;\n\n /**\n * If you use Spotlight by Sentry during development, use\n * this option to forward captured Sentry events to Spotlight.\n *\n * Either set it to true, or provide a specific Spotlight Sidecar URL.\n *\n * More details: https://spotlightjs.com/\n *\n * IMPORTANT: Only set this option to `true` while developing, not in production!\n */\n spotlight?: boolean | string;\n };\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see @sentry/core Options for more information.\n */\nexport type BrowserOptions = CoreOptions<BrowserTransportOptions> & BrowserSpecificOptions;\n\n/**\n * Configuration options for the Sentry Browser SDK Client class\n * @see BrowserClient for more information.\n */\nexport type BrowserClientOptions = ClientOptions<BrowserTransportOptions> & BrowserSpecificOptions;\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends Client<BrowserClientOptions> {\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: BrowserClientOptions) {\n const opts = applyDefaultOptions(options);\n const sdkSource = WINDOW.SENTRY_SDK_SOURCE || getSDKSource();\n applySdkMetadata(opts, 'browser', ['browser'], sdkSource);\n\n super(opts);\n\n // Unhandled errors don't actually crash the browser, so we report `unhandled` rather than `crashed`.\n this._unhandledSessionStatus = 'unhandled';\n\n const { userInfo } = this.getDataCollectionOptions();\n\n if (opts._metadata?.sdk) {\n opts._metadata.sdk.settings = {\n // Only allow IP inferral by Relay if the user opted in via dataCollection\n infer_ip: userInfo ? 'auto' : 'never',\n // purposefully allowing already passed settings to override the default\n ...opts._metadata.sdk.settings,\n };\n }\n\n const { sendClientReports } = this._options;\n\n // Flush buffered data when the page becomes hidden (e.g. tab switch, navigation, or the page\n // being discarded). `flush()` emits the `flush` hook, which drains the span (streaming), log and\n // metric buffers and hands the resulting envelopes to the transport (which uses `keepalive`).\n // Client report outcomes don't listen to the `flush` hook, so we flush them separately.\n if (WINDOW.document) {\n WINDOW.document.addEventListener('visibilitychange', () => {\n if (WINDOW.document.visibilityState === 'hidden') {\n if (sendClientReports) {\n this._flushOutcomes();\n }\n // Defer the flush to a microtask so that visibilitychange listeners registered after this\n // one have already run. In particular, browser tracing's background-tab detection ends the\n // active pageload/navigation (segment) span when the page is hidden. Deferring ensures that\n // segment span has been added to the streaming buffer before we flush, so it is sent\n // together with its child spans instead of being orphaned.\n queueMicrotask(() => {\n void this.flush();\n });\n }\n });\n }\n\n if (userInfo) {\n this.on('beforeSendSession', addAutoIpAddressToSession);\n }\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event> {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(\n message: ParameterizedString,\n level: SeverityLevel = 'info',\n hint?: EventHint,\n ): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(\n event: Event,\n hint: EventHint,\n currentScope: Scope,\n isolationScope: Scope,\n ): PromiseLike<Event | null> {\n event.platform = event.platform || 'javascript';\n\n return super._prepareEvent(event, hint, currentScope, isolationScope);\n }\n}\n\n/** Exported only for tests. */\nexport function applyDefaultOptions<T extends Partial<BrowserClientOptions>>(optionsArg: T): T {\n return {\n release:\n typeof __SENTRY_RELEASE__ === 'string' // This allows build tooling to find-and-replace __SENTRY_RELEASE__ to inject a release value\n ? __SENTRY_RELEASE__\n : WINDOW.SENTRY_RELEASE?.id, // This supports the variable that sentry-webpack-plugin injects\n sendClientReports: true,\n // We default this to true, as it is the safer scenario\n parentSpanIsAlwaysRootSpan: true,\n ...optionsArg,\n };\n}\n"],"names":["Client","WINDOW","getSDKSource","applySdkMetadata","addAutoIpAddressToSession","eventFromException","eventFromMessage"],"mappings":";;;;;;AAiGO,MAAM,sBAAsBA,cAAA,CAA6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvD,YAAY,OAAA,EAA+B;AAChD,IAAA,MAAM,IAAA,GAAO,oBAAoB,OAAO,CAAA;AACxC,IAAA,MAAM,SAAA,GAAYC,cAAA,CAAO,iBAAA,IAAqBC,oBAAA,EAAa;AAC3D,IAAAC,wBAAA,CAAiB,IAAA,EAAM,SAAA,EAAW,CAAC,SAAS,GAAG,SAAS,CAAA;AAExD,IAAA,KAAA,CAAM,IAAI,CAAA;AAGV,IAAA,IAAA,CAAK,uBAAA,GAA0B,WAAA;AAE/B,IAAA,MAAM,EAAE,QAAA,EAAS,GAAI,IAAA,CAAK,wBAAA,EAAyB;AAEnD,IAAA,IAAI,IAAA,CAAK,WAAW,GAAA,EAAK;AACvB,MAAA,IAAA,CAAK,SAAA,CAAU,IAAI,QAAA,GAAW;AAAA;AAAA,QAE5B,QAAA,EAAU,WAAW,MAAA,GAAS,OAAA;AAAA;AAAA,QAE9B,GAAG,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI;AAAA,OACxB;AAAA,IACF;AAEA,IAAA,MAAM,EAAE,iBAAA,EAAkB,GAAI,IAAA,CAAK,QAAA;AAMnC,IAAA,IAAIF,eAAO,QAAA,EAAU;AACnB,MAAAA,cAAA,CAAO,QAAA,CAAS,gBAAA,CAAiB,kBAAA,EAAoB,MAAM;AACzD,QAAA,IAAIA,cAAA,CAAO,QAAA,CAAS,eAAA,KAAoB,QAAA,EAAU;AAChD,UAAA,IAAI,iBAAA,EAAmB;AACrB,YAAA,IAAA,CAAK,cAAA,EAAe;AAAA,UACtB;AAMA,UAAA,cAAA,CAAe,MAAM;AACnB,YAAA,KAAK,KAAK,KAAA,EAAM;AAAA,UAClB,CAAC,CAAA;AAAA,QACH;AAAA,MACF,CAAC,CAAA;AAAA,IACH;AAEA,IAAA,IAAI,QAAA,EAAU;AACZ,MAAA,IAAA,CAAK,EAAA,CAAG,qBAAqBG,iCAAyB,CAAA;AAAA,IACxD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKO,kBAAA,CAAmB,WAAoB,IAAA,EAAsC;AAClF,IAAA,OAAOC,+BAAA,CAAmB,KAAK,QAAA,CAAS,WAAA,EAAa,WAAW,IAAA,EAAM,IAAA,CAAK,SAAS,gBAAgB,CAAA;AAAA,EACtG;AAAA;AAAA;AAAA;AAAA,EAKO,gBAAA,CACL,OAAA,EACA,KAAA,GAAuB,MAAA,EACvB,IAAA,EACoB;AACpB,IAAA,OAAOC,6BAAA,CAAiB,KAAK,QAAA,CAAS,WAAA,EAAa,SAAS,KAAA,EAAO,IAAA,EAAM,IAAA,CAAK,QAAA,CAAS,gBAAgB,CAAA;AAAA,EACzG;AAAA;AAAA;AAAA;AAAA,EAKU,aAAA,CACR,KAAA,EACA,IAAA,EACA,YAAA,EACA,cAAA,EAC2B;AAC3B,IAAA,KAAA,CAAM,QAAA,GAAW,MAAM,QAAA,IAAY,YAAA;AAEnC,IAAA,OAAO,KAAA,CAAM,aAAA,CAAc,KAAA,EAAO,IAAA,EAAM,cAAc,cAAc,CAAA;AAAA,EACtE;AACF;AAGO,SAAS,oBAA6D,UAAA,EAAkB;AAC7F,EAAA,OAAO;AAAA,IACL,SACE,OAAO,kBAAA,KAAuB,QAAA,GAC1B,kBAAA,GACAL,eAAO,cAAA,EAAgB,EAAA;AAAA;AAAA,IAC7B,iBAAA,EAAmB,IAAA;AAAA;AAAA,IAEnB,0BAAA,EAA4B,IAAA;AAAA,IAC5B,GAAG;AAAA,GACL;AACF;;;;;"}
1
+ {"version":3,"file":"client.js","sources":["../../../../src/client.ts"],"sourcesContent":["import type {\n ClientOptions,\n Event,\n EventHint,\n Options as CoreOptions,\n ParameterizedString,\n Scope,\n SeverityLevel,\n} from '@sentry/core';\nimport type { BrowserClientReplayOptions } from '@sentry/core/browser';\nimport { addAutoIpAddressToSession, applySdkMetadata, Client, getSDKSource } from '@sentry/core';\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { WINDOW } from './helpers';\nimport type { BrowserTransportOptions } from './transports/types';\n\n/**\n * A magic string that build tooling can leverage in order to inject a release value into the SDK.\n */\ndeclare const __SENTRY_RELEASE__: string | undefined;\n\nexport type BrowserClientProfilingOptions = {\n /**\n * Sets profiling session sample rate for the entire profiling session.\n *\n * A profiling session corresponds to a user session, meaning it is set once at integration initialization and\n * persisted until the next page reload. This rate determines what percentage of user sessions will have profiling enabled.\n * @default 0\n */\n profileSessionSampleRate?: number;\n\n /**\n * Set the lifecycle mode of the profiler.\n * - **manual**: The profiler will be manually started and stopped via `startProfiler`/`stopProfiler`.\n * If a session is sampled, is dependent on the `profileSessionSampleRate`.\n * - **trace**: The profiler will be automatically started when a root span exists and stopped when there are no\n * more sampled root spans. Whether a session is sampled, is dependent on the `profileSessionSampleRate` and the\n * existing sampling configuration for tracing (`tracesSampleRate`/`tracesSampler`).\n *\n * @default 'manual'\n */\n profileLifecycle?: 'manual' | 'trace';\n};\n\ntype BrowserSpecificOptions = BrowserClientReplayOptions &\n BrowserClientProfilingOptions & {\n /** If configured, this URL will be used as base URL for lazy loading integration. */\n cdnBaseUrl?: string;\n\n /**\n * Important: Only set this option if you know what you are doing!\n *\n * By default, the SDK will check if `Sentry.init` is called in a browser extension.\n * In case it is, it will stop initialization and log a warning\n * because browser extensions require a different Sentry initialization process:\n * https://docs.sentry.io/platforms/javascript/best-practices/shared-environments/\n *\n * Setting up the SDK in a browser extension with global error monitoring is not recommended\n * and will likely flood you with errors from other web sites or extensions. This can heavily\n * impact your quota and cause interference with your and other Sentry SDKs in shared environments.\n *\n * If this check wrongfully flags your setup as a browser extension, you can set this\n * option to `true` to skip the check.\n *\n * @default false\n */\n skipBrowserExtensionCheck?: boolean;\n\n /**\n * If you use Spotlight by Sentry during development, use\n * this option to forward captured Sentry events to Spotlight.\n *\n * Either set it to true, or provide a specific Spotlight Sidecar URL.\n *\n * More details: https://spotlightjs.com/\n *\n * IMPORTANT: Only set this option to `true` while developing, not in production!\n */\n spotlight?: boolean | string;\n };\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see @sentry/core Options for more information.\n */\nexport type BrowserOptions = CoreOptions<BrowserTransportOptions> & BrowserSpecificOptions;\n\n/**\n * Configuration options for the Sentry Browser SDK Client class\n * @see BrowserClient for more information.\n */\nexport type BrowserClientOptions = ClientOptions<BrowserTransportOptions> & BrowserSpecificOptions;\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends Client<BrowserClientOptions> {\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: BrowserClientOptions) {\n const opts = applyDefaultOptions(options);\n const sdkSource = WINDOW.SENTRY_SDK_SOURCE || getSDKSource();\n applySdkMetadata(opts, 'browser', ['browser'], sdkSource);\n\n super(opts);\n\n // Unhandled errors don't actually crash the browser, so we report `unhandled` rather than `crashed`.\n this._unhandledSessionStatus = 'unhandled';\n\n const { userInfo } = this.getDataCollectionOptions();\n\n if (opts._metadata?.sdk) {\n opts._metadata.sdk.settings = {\n // Only allow IP inferral by Relay if the user opted in via dataCollection\n infer_ip: userInfo ? 'auto' : 'never',\n // purposefully allowing already passed settings to override the default\n ...opts._metadata.sdk.settings,\n };\n }\n\n const { sendClientReports } = this._options;\n\n // Flush buffered data when the page becomes hidden (e.g. tab switch, navigation, or the page\n // being discarded). `flush()` emits the `flush` hook, which drains the span (streaming), log and\n // metric buffers and hands the resulting envelopes to the transport (which uses `keepalive`).\n // Client report outcomes don't listen to the `flush` hook, so we flush them separately.\n if (WINDOW.document) {\n WINDOW.document.addEventListener('visibilitychange', () => {\n if (WINDOW.document.visibilityState === 'hidden') {\n if (sendClientReports) {\n this._flushOutcomes();\n }\n // Defer the flush to a microtask so that visibilitychange listeners registered after this\n // one have already run. In particular, browser tracing's background-tab detection ends the\n // active pageload/navigation (segment) span when the page is hidden. Deferring ensures that\n // segment span has been added to the streaming buffer before we flush, so it is sent\n // together with its child spans instead of being orphaned.\n queueMicrotask(() => {\n void this.flush();\n });\n }\n });\n }\n\n if (userInfo) {\n this.on('beforeSendSession', addAutoIpAddressToSession);\n }\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event> {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(\n message: ParameterizedString,\n level: SeverityLevel = 'info',\n hint?: EventHint,\n ): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(\n event: Event,\n hint: EventHint,\n currentScope: Scope,\n isolationScope: Scope,\n ): PromiseLike<Event | null> {\n event.platform = event.platform || 'javascript';\n\n return super._prepareEvent(event, hint, currentScope, isolationScope);\n }\n}\n\n/** Exported only for tests. */\nexport function applyDefaultOptions<T extends Partial<BrowserClientOptions>>(optionsArg: T): T {\n return {\n release:\n typeof __SENTRY_RELEASE__ === 'string' // This allows build tooling to find-and-replace __SENTRY_RELEASE__ to inject a release value\n ? __SENTRY_RELEASE__\n : WINDOW.SENTRY_RELEASE?.id, // This supports the variable that sentry-webpack-plugin injects\n sendClientReports: true,\n // We default this to true, as it is the safer scenario\n parentSpanIsAlwaysRootSpan: true,\n ...optionsArg,\n };\n}\n"],"names":["Client","WINDOW","getSDKSource","applySdkMetadata","addAutoIpAddressToSession","eventFromException","eventFromMessage"],"mappings":";;;;;;AAiGO,MAAM,sBAAsBA,WAAA,CAA6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvD,YAAY,OAAA,EAA+B;AAChD,IAAA,MAAM,IAAA,GAAO,oBAAoB,OAAO,CAAA;AACxC,IAAA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AAa,WAAW,IAAA,EAAM,IAAA,CAAK,SAAS,gBAAgB,CAAA;AAAA,EACtG;AAAA;AAAA;AAAA;AAAA,EAKO,gBAAA,CACL,OAAA,EACA,KAAA,GAAuB,MAAA,EACvB,IAAA,EACoB;AACpB,IAAA,OAAOC,6BAAA,CAAiB,KAAK,QAAA,CAAS,WAAA,EAAa,SAAS,KAAA,EAAO,IAAA,EAAM,IAAA,CAAK,QAAA,CAAS,gBAAgB,CAAA;AAAA,EACzG;AAAA;AAAA;AAAA;AAAA,EAKU,aAAA,CACR,KAAA,EACA,IAAA,EACA,YAAA,EACA,cAAA,EAC2B;AAC3B,IAAA,KAAA,CAAM,QAAA,GAAW,MAAM,QAAA,IAAY,YAAA;AAEnC,IAAA,OAAO,KAAA,CAAM,aAAA,CAAc,KAAA,EAAO,IAAA,EAAM,cAAc,cAAc,CAAA;AAAA,EACtE;AACF;AAGO,SAAS,oBAA6D,UAAA,EAAkB;AAC7F,EAAA,OAAO;AAAA,IACL,SACE,OAAO,kBAAA,KAAuB,QAAA,GAC1B,kBAAA,GACAL,eAAO,cAAA,EAAgB,EAAA;AAAA;AAAA,IAC7B,iBAAA,EAAmB,IAAA;AAAA;AAAA,IAEnB,0BAAA,EAA4B,IAAA;AAAA,IAC5B,GAAG;AAAA,GACL;AACF;;;;;"}
@@ -1,9 +1,9 @@
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
  async function diagnoseSdkConnectivity() {
6
- const client = browser.getClient();
6
+ const client = core.getClient();
7
7
  if (!client) {
8
8
  return "no-client-active";
9
9
  }
@@ -14,7 +14,7 @@ async function diagnoseSdkConnectivity() {
14
14
  const defaultUrl = "https://o447951.ingest.sentry.io/api/4509632503087104/envelope/?sentry_version=7&sentry_key=c1dfb07d783ad5325c245c1fd3725390&sentry_client=sentry.javascript.browser%2F1.33.7";
15
15
  const url = tunnel || defaultUrl;
16
16
  try {
17
- await browser.suppressTracing(
17
+ await core.suppressTracing(
18
18
  () => (
19
19
  // If fetch throws, there is likely an ad blocker active or there are other connective issues.
20
20
  fetch(url, {
@@ -1 +1 @@
1
- {"version":3,"file":"diagnose-sdk.js","sources":["../../../../src/diagnose-sdk.ts"],"sourcesContent":["import { getClient, suppressTracing } from '@sentry/core/browser';\n\n/**\n * A function to diagnose why the SDK might not be successfully sending data.\n *\n * Possible return values wrapped in a Promise:\n * - `\"no-client-active\"` - There was no active client when the function was called. This possibly means that the SDK was not initialized yet.\n * - `\"sentry-unreachable\"` - The Sentry SaaS servers were not reachable. This likely means that there is an ad blocker active on the page or that there are other connection issues.\n *\n * If the function doesn't detect an issue it resolves to `undefined`.\n */\nexport async function diagnoseSdkConnectivity(): Promise<\n 'no-client-active' | 'sentry-unreachable' | 'no-dsn-configured' | void\n> {\n const client = getClient();\n\n if (!client) {\n return 'no-client-active';\n }\n\n if (!client.getDsn()) {\n return 'no-dsn-configured';\n }\n\n // Check if a tunnel is configured and use it if available\n const tunnel = client.getOptions().tunnel;\n\n // We are using the\n // - \"sentry-sdks\" org with id 447951 not to pollute any actual organizations.\n // - \"diagnose-sdk-connectivity\" project with id 4509632503087104\n // - the public key of said org/project, which is disabled in the project settings\n // => this DSN: https://c1dfb07d783ad5325c245c1fd3725390@o447951.ingest.us.sentry.io/4509632503087104 (i.e. disabled)\n const defaultUrl =\n 'https://o447951.ingest.sentry.io/api/4509632503087104/envelope/?sentry_version=7&sentry_key=c1dfb07d783ad5325c245c1fd3725390&sentry_client=sentry.javascript.browser%2F1.33.7';\n\n const url = tunnel || defaultUrl;\n\n try {\n await suppressTracing(() =>\n // If fetch throws, there is likely an ad blocker active or there are other connective issues.\n fetch(url, {\n body: '{}',\n method: 'POST',\n mode: 'cors',\n credentials: 'omit',\n }),\n );\n } catch {\n return 'sentry-unreachable';\n }\n}\n"],"names":["getClient","suppressTracing"],"mappings":";;;;AAWA,eAAsB,uBAAA,GAEpB;AACA,EAAA,MAAM,SAASA,iBAAA,EAAU;AAEzB,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,kBAAA;AAAA,EACT;AAEA,EAAA,IAAI,CAAC,MAAA,CAAO,MAAA,EAAO,EAAG;AACpB,IAAA,OAAO,mBAAA;AAAA,EACT;AAGA,EAAA,MAAM,MAAA,GAAS,MAAA,CAAO,UAAA,EAAW,CAAE,MAAA;AAOnC,EAAA,MAAM,UAAA,GACJ,+KAAA;AAEF,EAAA,MAAM,MAAM,MAAA,IAAU,UAAA;AAEtB,EAAA,IAAI;AACF,IAAA,MAAMC,uBAAA;AAAA,MAAgB;AAAA;AAAA,QAEpB,MAAM,GAAA,EAAK;AAAA,UACT,IAAA,EAAM,IAAA;AAAA,UACN,MAAA,EAAQ,MAAA;AAAA,UACR,IAAA,EAAM,MAAA;AAAA,UACN,WAAA,EAAa;AAAA,SACd;AAAA;AAAA,KACH;AAAA,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,oBAAA;AAAA,EACT;AACF;;;;"}
1
+ {"version":3,"file":"diagnose-sdk.js","sources":["../../../../src/diagnose-sdk.ts"],"sourcesContent":["import { getClient, suppressTracing } from '@sentry/core';\n\n/**\n * A function to diagnose why the SDK might not be successfully sending data.\n *\n * Possible return values wrapped in a Promise:\n * - `\"no-client-active\"` - There was no active client when the function was called. This possibly means that the SDK was not initialized yet.\n * - `\"sentry-unreachable\"` - The Sentry SaaS servers were not reachable. This likely means that there is an ad blocker active on the page or that there are other connection issues.\n *\n * If the function doesn't detect an issue it resolves to `undefined`.\n */\nexport async function diagnoseSdkConnectivity(): Promise<\n 'no-client-active' | 'sentry-unreachable' | 'no-dsn-configured' | void\n> {\n const client = getClient();\n\n if (!client) {\n return 'no-client-active';\n }\n\n if (!client.getDsn()) {\n return 'no-dsn-configured';\n }\n\n // Check if a tunnel is configured and use it if available\n const tunnel = client.getOptions().tunnel;\n\n // We are using the\n // - \"sentry-sdks\" org with id 447951 not to pollute any actual organizations.\n // - \"diagnose-sdk-connectivity\" project with id 4509632503087104\n // - the public key of said org/project, which is disabled in the project settings\n // => this DSN: https://c1dfb07d783ad5325c245c1fd3725390@o447951.ingest.us.sentry.io/4509632503087104 (i.e. disabled)\n const defaultUrl =\n 'https://o447951.ingest.sentry.io/api/4509632503087104/envelope/?sentry_version=7&sentry_key=c1dfb07d783ad5325c245c1fd3725390&sentry_client=sentry.javascript.browser%2F1.33.7';\n\n const url = tunnel || defaultUrl;\n\n try {\n await suppressTracing(() =>\n // If fetch throws, there is likely an ad blocker active or there are other connective issues.\n fetch(url, {\n body: '{}',\n method: 'POST',\n mode: 'cors',\n credentials: 'omit',\n }),\n );\n } catch {\n return 'sentry-unreachable';\n }\n}\n"],"names":["getClient","suppressTracing"],"mappings":";;;;AAWA,eAAsB,uBAAA,GAEpB;AACA,EAAA,MAAM,SAASA,cAAA,EAAU;AAEzB,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,kBAAA;AAAA,EACT;AAEA,EAAA,IAAI,CAAC,MAAA,CAAO,MAAA,EAAO,EAAG;AACpB,IAAA,OAAO,mBAAA;AAAA,EACT;AAGA,EAAA,MAAM,MAAA,GAAS,MAAA,CAAO,UAAA,EAAW,CAAE,MAAA;AAOnC,EAAA,MAAM,UAAA,GACJ,+KAAA;AAEF,EAAA,MAAM,MAAM,MAAA,IAAU,UAAA;AAEtB,EAAA,IAAI;AACF,IAAA,MAAMC,oBAAA;AAAA,MAAgB;AAAA;AAAA,QAEpB,MAAM,GAAA,EAAK;AAAA,UACT,IAAA,EAAM,IAAA;AAAA,UACN,MAAA,EAAQ,MAAA;AAAA,UACR,IAAA,EAAM,MAAA;AAAA,UACN,WAAA,EAAa;AAAA,SACd;AAAA;AAAA,KACH;AAAA,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,oBAAA;AAAA,EACT;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
 
5
5
  function exceptionFromError(stackParser, ex) {
6
6
  const frames = parseStackFrames(stackParser, ex);
@@ -17,11 +17,11 @@ function exceptionFromError(stackParser, ex) {
17
17
  return exception;
18
18
  }
19
19
  function eventFromPlainObject(stackParser, exception, syntheticException, isUnhandledRejection) {
20
- const client = browser.getClient();
20
+ const client = core.getClient();
21
21
  const normalizeDepth = client?.getOptions().normalizeDepth;
22
22
  const errorFromProp = getErrorPropertyFromObject(exception);
23
23
  const extra = {
24
- __serialized__: browser.normalizeToSize(exception, normalizeDepth)
24
+ __serialized__: core.normalizeToSize(exception, normalizeDepth)
25
25
  };
26
26
  if (errorFromProp) {
27
27
  return {
@@ -32,7 +32,7 @@ function eventFromPlainObject(stackParser, exception, syntheticException, isUnha
32
32
  };
33
33
  }
34
34
  const exceptionValue = {
35
- type: browser.isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? "UnhandledRejection" : "Error",
35
+ type: core.isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? "UnhandledRejection" : "Error",
36
36
  value: getNonErrorObjectExceptionValue(exception, { isUnhandledRejection })
37
37
  };
38
38
  const event = {
@@ -106,19 +106,19 @@ function extractMessage(ex) {
106
106
  return "No error message";
107
107
  }
108
108
  if (message.error && typeof message.error.message === "string") {
109
- return browser._INTERNAL_enhanceErrorWithSentryInfo(message.error);
109
+ return core._INTERNAL_enhanceErrorWithSentryInfo(message.error);
110
110
  }
111
- return browser._INTERNAL_enhanceErrorWithSentryInfo(ex);
111
+ return core._INTERNAL_enhanceErrorWithSentryInfo(ex);
112
112
  }
113
113
  function eventFromException(stackParser, exception, hint, attachStacktrace) {
114
114
  const syntheticException = hint?.syntheticException || void 0;
115
115
  const event = eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace);
116
- browser.addExceptionMechanism(event);
116
+ core.addExceptionMechanism(event);
117
117
  event.level = "error";
118
118
  if (hint?.event_id) {
119
119
  event.event_id = hint.event_id;
120
120
  }
121
- return browser.resolvedSyncPromise(event);
121
+ return core.resolvedSyncPromise(event);
122
122
  }
123
123
  function eventFromMessage(stackParser, message, level = "info", hint, attachStacktrace) {
124
124
  const syntheticException = hint?.syntheticException || void 0;
@@ -127,15 +127,15 @@ function eventFromMessage(stackParser, message, level = "info", hint, attachStac
127
127
  if (hint?.event_id) {
128
128
  event.event_id = hint.event_id;
129
129
  }
130
- return browser.resolvedSyncPromise(event);
130
+ return core.resolvedSyncPromise(event);
131
131
  }
132
132
  function eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace, isUnhandledRejection) {
133
133
  let event;
134
- if (browser.isErrorEvent(exception) && exception.error) {
134
+ if (core.isErrorEvent(exception) && exception.error) {
135
135
  const errorEvent = exception;
136
136
  return eventFromError(stackParser, errorEvent.error);
137
137
  }
138
- if (browser.isDOMError(exception) || browser.isDOMException(exception)) {
138
+ if (core.isDOMError(exception) || core.isDOMException(exception)) {
139
139
  const domException = exception;
140
140
  if ("stack" in exception) {
141
141
  event = eventFromError(stackParser, exception);
@@ -144,35 +144,32 @@ function eventFromUnknownInput(stackParser, exception, syntheticException, attac
144
144
  const frames = parseStackFrames(stackParser, syntheticException);
145
145
  if (frames.length) {
146
146
  firstException.stacktrace = { frames };
147
- browser.addExceptionMechanism(event, { synthetic: true });
147
+ core.addExceptionMechanism(event, { synthetic: true });
148
148
  }
149
149
  }
150
150
  } else {
151
- const name = domException.name || (browser.isDOMError(domException) ? "DOMError" : "DOMException");
151
+ const name = domException.name || (core.isDOMError(domException) ? "DOMError" : "DOMException");
152
152
  const message = domException.message ? `${name}: ${domException.message}` : name;
153
153
  event = eventFromString(stackParser, message, syntheticException, attachStacktrace);
154
- browser.addExceptionTypeValue(event, message);
155
- }
156
- if ("code" in domException) {
157
- event.tags = { ...event.tags, "DOMException.code": `${domException.code}` };
154
+ core.addExceptionTypeValue(event, message);
158
155
  }
159
156
  return event;
160
157
  }
161
- if (browser.isError(exception)) {
158
+ if (core.isError(exception)) {
162
159
  return eventFromError(stackParser, exception);
163
160
  }
164
- if (browser.isPlainObject(exception) || browser.isEvent(exception)) {
161
+ if (core.isPlainObject(exception) || core.isEvent(exception)) {
165
162
  const objectException = exception;
166
163
  event = eventFromPlainObject(stackParser, objectException, syntheticException, isUnhandledRejection);
167
- browser.addExceptionMechanism(event, {
164
+ core.addExceptionMechanism(event, {
168
165
  synthetic: true
169
166
  });
170
167
  return event;
171
168
  }
172
169
  const stringifiedException = String(exception);
173
170
  event = eventFromString(stackParser, stringifiedException, syntheticException, attachStacktrace);
174
- browser.addExceptionTypeValue(event, stringifiedException, void 0);
175
- browser.addExceptionMechanism(event, {
171
+ core.addExceptionTypeValue(event, stringifiedException, void 0);
172
+ core.addExceptionMechanism(event, {
176
173
  synthetic: true
177
174
  });
178
175
  return event;
@@ -186,9 +183,9 @@ function eventFromString(stackParser, message, syntheticException, attachStacktr
186
183
  values: [{ value: message, stacktrace: { frames } }]
187
184
  };
188
185
  }
189
- browser.addExceptionMechanism(event, { synthetic: true });
186
+ core.addExceptionMechanism(event, { synthetic: true });
190
187
  }
191
- if (browser.isParameterizedString(message)) {
188
+ if (core.isParameterizedString(message)) {
192
189
  const { __sentry_template_string__, __sentry_template_values__ } = message;
193
190
  event.logentry = {
194
191
  message: __sentry_template_string__,
@@ -200,12 +197,12 @@ function eventFromString(stackParser, message, syntheticException, attachStacktr
200
197
  return event;
201
198
  }
202
199
  function getNonErrorObjectExceptionValue(exception, { isUnhandledRejection }) {
203
- const keys = browser.extractExceptionKeysForMessage(exception);
200
+ const keys = core.extractExceptionKeysForMessage(exception);
204
201
  const captureType = isUnhandledRejection ? "promise rejection" : "exception";
205
- if (browser.isErrorEvent(exception)) {
202
+ if (core.isErrorEvent(exception)) {
206
203
  return `Event \`ErrorEvent\` captured as ${captureType} with message \`${exception.message}\``;
207
204
  }
208
- if (browser.isEvent(exception)) {
205
+ if (core.isEvent(exception)) {
209
206
  const className = getObjectClassName(exception);
210
207
  return `Event \`${className}\` (type=${exception.type}) captured as ${captureType}`;
211
208
  }
@@ -219,7 +216,7 @@ function getObjectClassName(obj) {
219
216
  }
220
217
  }
221
218
  function getErrorPropertyFromObject(obj) {
222
- return Object.values(obj).find(browser.isError);
219
+ return Object.values(obj).find(core.isError);
223
220
  }
224
221
 
225
222
  exports.eventFromException = eventFromException;
@@ -1 +1 @@
1
- {"version":3,"file":"eventbuilder.js","sources":["../../../../src/eventbuilder.ts"],"sourcesContent":["import type {\n Event,\n EventHint,\n Exception,\n ParameterizedString,\n SeverityLevel,\n StackFrame,\n StackParser,\n} from '@sentry/core/browser';\nimport {\n _INTERNAL_enhanceErrorWithSentryInfo,\n addExceptionMechanism,\n addExceptionTypeValue,\n extractExceptionKeysForMessage,\n getClient,\n isDOMError,\n isDOMException,\n isError,\n isErrorEvent,\n isEvent,\n isParameterizedString,\n isPlainObject,\n normalizeToSize,\n resolvedSyncPromise,\n} from '@sentry/core/browser';\n\ntype Prototype = { constructor: (...args: unknown[]) => unknown };\n\n/**\n * This function creates an exception from a JavaScript Error\n */\nexport function exceptionFromError(stackParser: StackParser, ex: Error): Exception {\n // Get the frames first since Opera can lose the stack if we touch anything else first\n const frames = parseStackFrames(stackParser, ex);\n\n const exception: Exception = {\n type: extractType(ex),\n value: extractMessage(ex),\n };\n\n if (frames.length) {\n exception.stacktrace = { frames };\n }\n\n if (exception.type === undefined && exception.value === '') {\n exception.value = 'Unrecoverable error caught';\n }\n\n return exception;\n}\n\nfunction eventFromPlainObject(\n stackParser: StackParser,\n exception: Record<string, unknown>,\n syntheticException?: Error,\n isUnhandledRejection?: boolean,\n): Event {\n const client = getClient();\n const normalizeDepth = client?.getOptions().normalizeDepth;\n\n // If we can, we extract an exception from the object properties\n const errorFromProp = getErrorPropertyFromObject(exception);\n\n const extra = {\n __serialized__: normalizeToSize(exception, normalizeDepth),\n };\n\n if (errorFromProp) {\n return {\n exception: {\n values: [exceptionFromError(stackParser, errorFromProp)],\n },\n extra,\n };\n }\n\n const exceptionValue: Exception = {\n type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',\n value: getNonErrorObjectExceptionValue(exception, { isUnhandledRejection }),\n };\n\n const event = {\n exception: {\n values: [exceptionValue],\n },\n extra,\n } satisfies Event;\n\n if (syntheticException) {\n const frames = parseStackFrames(stackParser, syntheticException);\n if (frames.length) {\n // event.exception.values[0] has been set above\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n event.exception.values[0]!.stacktrace = { frames };\n }\n }\n\n return event;\n}\n\nfunction eventFromError(stackParser: StackParser, ex: Error): Event {\n return {\n exception: {\n values: [exceptionFromError(stackParser, ex)],\n },\n };\n}\n\n/** Parses stack frames from an error */\nfunction parseStackFrames(\n stackParser: StackParser,\n ex: Error & { framesToPop?: number; stacktrace?: string },\n): StackFrame[] {\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n const stacktrace = ex.stacktrace || ex.stack || '';\n\n const skipLines = getSkipFirstStackStringLines(ex);\n const framesToPop = getPopFirstTopFrames(ex);\n\n try {\n return stackParser(stacktrace, skipLines, framesToPop);\n } catch {\n // no-empty\n }\n\n return [];\n}\n\n// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108\nconst reactMinifiedRegexp = /Minified React error #\\d+;/i;\n\n/**\n * Certain known React errors contain links that would be falsely\n * parsed as frames. This function check for these errors and\n * returns number of the stack string lines to skip.\n */\nfunction getSkipFirstStackStringLines(ex: Error): number {\n if (ex && reactMinifiedRegexp.test(ex.message)) {\n return 1;\n }\n\n return 0;\n}\n\n/**\n * If error has `framesToPop` property, it means that the\n * creator tells us the first x frames will be useless\n * and should be discarded. Typically error from wrapper function\n * which don't point to the actual location in the developer's code.\n *\n * Example: https://github.com/zertosh/invariant/blob/master/invariant.js#L46\n */\nfunction getPopFirstTopFrames(ex: Error & { framesToPop?: unknown }): number {\n if (typeof ex.framesToPop === 'number') {\n return ex.framesToPop;\n }\n\n return 0;\n}\n\n// https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Exception\nfunction isWebAssemblyException(exception: unknown): exception is WebAssembly.Exception {\n // Check for support\n // oxlint-disable-next-line typescript/prefer-optional-chain\n if (typeof WebAssembly !== 'undefined' && typeof WebAssembly.Exception !== 'undefined') {\n return exception instanceof WebAssembly.Exception;\n } else {\n return false;\n }\n}\n\n/**\n * Extracts from errors what we use as the exception `type` in error events.\n *\n * Usually, this is the `name` property on Error objects but WASM errors need to be treated differently.\n */\nexport function extractType(ex: Error & { message: { error?: Error } }): string | undefined {\n const name = ex?.name;\n\n // The name for WebAssembly.Exception Errors needs to be extracted differently.\n // Context: https://github.com/getsentry/sentry-javascript/issues/13787\n if (!name && isWebAssemblyException(ex)) {\n // Emscripten sets array[type, message] to the \"message\" property on the WebAssembly.Exception object\n const hasTypeInMessage = ex.message && Array.isArray(ex.message) && ex.message.length == 2;\n return hasTypeInMessage ? ex.message[0] : 'WebAssembly.Exception';\n }\n\n return name;\n}\n\n/**\n * There are cases where stacktrace.message is an Event object\n * https://github.com/getsentry/sentry-javascript/issues/1949\n * In this specific case we try to extract stacktrace.message.error.message\n */\nexport function extractMessage(ex: Error & { message: { error?: Error } }): string {\n const message = ex?.message;\n\n if (isWebAssemblyException(ex)) {\n // For Node 18, Emscripten sets array[type, message] to the \"message\" property on the WebAssembly.Exception object\n if (Array.isArray(ex.message) && ex.message.length == 2) {\n return ex.message[1];\n }\n return 'wasm exception';\n }\n\n if (!message) {\n return 'No error message';\n }\n\n if (message.error && typeof message.error.message === 'string') {\n return _INTERNAL_enhanceErrorWithSentryInfo(message.error);\n }\n\n return _INTERNAL_enhanceErrorWithSentryInfo(ex);\n}\n\n/**\n * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.\n * @hidden\n */\nexport function eventFromException(\n stackParser: StackParser,\n exception: unknown,\n hint?: EventHint,\n attachStacktrace?: boolean,\n): PromiseLike<Event> {\n const syntheticException = hint?.syntheticException || undefined;\n const event = eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace);\n addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }\n event.level = 'error';\n if (hint?.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * Builds and Event from a Message\n * @hidden\n */\nexport function eventFromMessage(\n stackParser: StackParser,\n message: ParameterizedString,\n level: SeverityLevel = 'info',\n hint?: EventHint,\n attachStacktrace?: boolean,\n): PromiseLike<Event> {\n const syntheticException = hint?.syntheticException || undefined;\n const event = eventFromString(stackParser, message, syntheticException, attachStacktrace);\n event.level = level;\n if (hint?.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * @hidden\n */\nexport function eventFromUnknownInput(\n stackParser: StackParser,\n exception: unknown,\n syntheticException?: Error,\n attachStacktrace?: boolean,\n isUnhandledRejection?: boolean,\n): Event {\n let event: Event;\n\n if (isErrorEvent(exception) && (exception as ErrorEvent).error) {\n // If it is an ErrorEvent with `error` property, extract it to get actual Error\n const errorEvent = exception as ErrorEvent;\n return eventFromError(stackParser, errorEvent.error as Error);\n }\n\n // If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name\n // and message, as it doesn't provide anything else. According to the spec, all `DOMExceptions` should also be\n // `Error`s, but that's not the case in IE11, so in that case we treat it the same as we do a `DOMError`.\n //\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n // https://webidl.spec.whatwg.org/#es-DOMException-specialness\n if (isDOMError(exception) || isDOMException(exception)) {\n const domException = exception as DOMException;\n\n if ('stack' in (exception as Error)) {\n event = eventFromError(stackParser, exception as Error);\n\n const firstException = event.exception?.values?.[0];\n if (attachStacktrace && syntheticException && firstException && !firstException.stacktrace) {\n const frames = parseStackFrames(stackParser, syntheticException);\n if (frames.length) {\n firstException.stacktrace = { frames };\n addExceptionMechanism(event, { synthetic: true });\n }\n }\n } else {\n const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');\n const message = domException.message ? `${name}: ${domException.message}` : name;\n event = eventFromString(stackParser, message, syntheticException, attachStacktrace);\n addExceptionTypeValue(event, message);\n }\n if ('code' in domException) {\n // eslint-disable-next-line typescript/no-deprecated\n event.tags = { ...event.tags, 'DOMException.code': `${domException.code}` };\n }\n\n return event;\n }\n if (isError(exception)) {\n // we have a real Error object, do nothing\n return eventFromError(stackParser, exception);\n }\n if (isPlainObject(exception) || isEvent(exception)) {\n // If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize\n // it manually. This will allow us to group events based on top-level keys which is much better than creating a new\n // group on any key/value change.\n const objectException = exception;\n event = eventFromPlainObject(stackParser, objectException, syntheticException, isUnhandledRejection);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n return event;\n }\n\n // If none of previous checks were valid, then it means that it's not:\n // - an instance of DOMError\n // - an instance of DOMException\n // - an instance of Event\n // - an instance of Error\n // - a valid ErrorEvent (one with an error property)\n // - a plain Object\n //\n // So bail out and capture it as a simple message:\n const stringifiedException = String(exception);\n event = eventFromString(stackParser, stringifiedException, syntheticException, attachStacktrace);\n addExceptionTypeValue(event, stringifiedException, undefined);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n\n return event;\n}\n\nfunction eventFromString(\n stackParser: StackParser,\n message: ParameterizedString,\n syntheticException?: Error,\n attachStacktrace?: boolean,\n): Event {\n const event: Event = {};\n\n if (attachStacktrace && syntheticException) {\n const frames = parseStackFrames(stackParser, syntheticException);\n if (frames.length) {\n event.exception = {\n values: [{ value: message, stacktrace: { frames } }],\n };\n }\n addExceptionMechanism(event, { synthetic: true });\n }\n\n if (isParameterizedString(message)) {\n const { __sentry_template_string__, __sentry_template_values__ } = message;\n\n event.logentry = {\n message: __sentry_template_string__,\n params: __sentry_template_values__,\n };\n return event;\n }\n\n event.message = message;\n return event;\n}\n\nfunction getNonErrorObjectExceptionValue(\n exception: Record<string, unknown>,\n { isUnhandledRejection }: { isUnhandledRejection?: boolean },\n): string {\n const keys = extractExceptionKeysForMessage(exception);\n const captureType = isUnhandledRejection ? 'promise rejection' : 'exception';\n\n // Some ErrorEvent instances do not have an `error` property, which is why they are not handled before\n // We still want to try to get a decent message for these cases\n if (isErrorEvent(exception)) {\n return `Event \\`ErrorEvent\\` captured as ${captureType} with message \\`${exception.message}\\``;\n }\n\n if (isEvent(exception)) {\n const className = getObjectClassName(exception);\n return `Event \\`${className}\\` (type=${exception.type}) captured as ${captureType}`;\n }\n\n return `Object captured as ${captureType} with keys: ${keys}`;\n}\n\nfunction getObjectClassName(obj: unknown): string | undefined | void {\n try {\n const prototype: Prototype | null = Object.getPrototypeOf(obj);\n return prototype ? prototype.constructor.name : undefined;\n } catch {\n // ignore errors here\n }\n}\n\n/** If a plain object has a property that is an `Error`, return this error. */\nfunction getErrorPropertyFromObject(obj: Record<string, unknown>): Error | undefined {\n return Object.values(obj).find(isError);\n}\n"],"names":["getClient","normalizeToSize","isEvent","_INTERNAL_enhanceErrorWithSentryInfo","addExceptionMechanism","resolvedSyncPromise","isErrorEvent","isDOMError","isDOMException","addExceptionTypeValue","isError","isPlainObject","isParameterizedString","extractExceptionKeysForMessage"],"mappings":";;;;AA+BO,SAAS,kBAAA,CAAmB,aAA0B,EAAA,EAAsB;AAEjF,EAAA,MAAM,MAAA,GAAS,gBAAA,CAAiB,WAAA,EAAa,EAAE,CAAA;AAE/C,EAAA,MAAM,SAAA,GAAuB;AAAA,IAC3B,IAAA,EAAM,YAAY,EAAE,CAAA;AAAA,IACpB,KAAA,EAAO,eAAe,EAAE;AAAA,GAC1B;AAEA,EAAA,IAAI,OAAO,MAAA,EAAQ;AACjB,IAAA,SAAA,CAAU,UAAA,GAAa,EAAE,MAAA,EAAO;AAAA,EAClC;AAEA,EAAA,IAAI,SAAA,CAAU,IAAA,KAAS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AA,KAAA,CAAM,OAAA,GAAU,OAAA;AAChB,EAAA,OAAO,KAAA;AACT;AAEA,SAAS,+BAAA,CACP,SAAA,EACA,EAAE,oBAAA,EAAqB,EACf;AACR,EAAA,MAAM,IAAA,GAAOC,uCAA+B,SAAS,CAAA;AACrD,EAAA,MAAM,WAAA,GAAc,uBAAuB,mBAAA,GAAsB,WAAA;AAIjE,EAAA,IAAIP,oBAAA,CAAa,SAAS,CAAA,EAAG;AAC3B,IAAA,OAAO,CAAA,iCAAA,EAAoC,WAAW,CAAA,gBAAA,EAAmB,SAAA,CAAU,OAAO,CAAA,EAAA,CAAA;AAAA,EAC5F;AAEA,EAAA,IAAIJ,eAAA,CAAQ,SAAS,CAAA,EAAG;AACtB,IAAA,MAAM,SAAA,GAAY,mBAAmB,SAAS,CAAA;AAC9C,IAAA,OAAO,WAAW,SAAS,CAAA,SAAA,EAAY,SAAA,CAAU,IAAI,iBAAiB,WAAW,CAAA,CAAA;AAAA,EACnF;AAEA,EAAA,OAAO,CAAA,mBAAA,EAAsB,WAAW,CAAA,YAAA,EAAe,IAAI,CAAA,CAAA;AAC7D;AAEA,SAAS,mBAAmB,GAAA,EAAyC;AACnE,EAAA,IAAI;AACF,IAAA,MAAM,SAAA,GAA8B,MAAA,CAAO,cAAA,CAAe,GAAG,CAAA;AAC7D,IAAA,OAAO,SAAA,GAAY,SAAA,CAAU,WAAA,CAAY,IAAA,GAAO,KAAA,CAAA;AAAA,EAClD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;AAGA,SAAS,2BAA2B,GAAA,EAAiD;AACnF,EAAA,OAAO,MAAA,CAAO,MAAA,CAAO,GAAG,CAAA,CAAE,KAAKQ,eAAO,CAAA;AACxC;;;;;;;;;"}
1
+ {"version":3,"file":"eventbuilder.js","sources":["../../../../src/eventbuilder.ts"],"sourcesContent":["import type {\n Event,\n EventHint,\n Exception,\n ParameterizedString,\n SeverityLevel,\n StackFrame,\n StackParser,\n} from '@sentry/core';\nimport {\n _INTERNAL_enhanceErrorWithSentryInfo,\n addExceptionMechanism,\n addExceptionTypeValue,\n extractExceptionKeysForMessage,\n getClient,\n isDOMError,\n isDOMException,\n isError,\n isErrorEvent,\n isEvent,\n isParameterizedString,\n isPlainObject,\n normalizeToSize,\n resolvedSyncPromise,\n} from '@sentry/core';\n\ntype Prototype = { constructor: (...args: unknown[]) => unknown };\n\n/**\n * This function creates an exception from a JavaScript Error\n */\nexport function exceptionFromError(stackParser: StackParser, ex: Error): Exception {\n // Get the frames first since Opera can lose the stack if we touch anything else first\n const frames = parseStackFrames(stackParser, ex);\n\n const exception: Exception = {\n type: extractType(ex),\n value: extractMessage(ex),\n };\n\n if (frames.length) {\n exception.stacktrace = { frames };\n }\n\n if (exception.type === undefined && exception.value === '') {\n exception.value = 'Unrecoverable error caught';\n }\n\n return exception;\n}\n\nfunction eventFromPlainObject(\n stackParser: StackParser,\n exception: Record<string, unknown>,\n syntheticException?: Error,\n isUnhandledRejection?: boolean,\n): Event {\n const client = getClient();\n const normalizeDepth = client?.getOptions().normalizeDepth;\n\n // If we can, we extract an exception from the object properties\n const errorFromProp = getErrorPropertyFromObject(exception);\n\n const extra = {\n __serialized__: normalizeToSize(exception, normalizeDepth),\n };\n\n if (errorFromProp) {\n return {\n exception: {\n values: [exceptionFromError(stackParser, errorFromProp)],\n },\n extra,\n };\n }\n\n const exceptionValue: Exception = {\n type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',\n value: getNonErrorObjectExceptionValue(exception, { isUnhandledRejection }),\n };\n\n const event = {\n exception: {\n values: [exceptionValue],\n },\n extra,\n } satisfies Event;\n\n if (syntheticException) {\n const frames = parseStackFrames(stackParser, syntheticException);\n if (frames.length) {\n // event.exception.values[0] has been set above\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n event.exception.values[0]!.stacktrace = { frames };\n }\n }\n\n return event;\n}\n\nfunction eventFromError(stackParser: StackParser, ex: Error): Event {\n return {\n exception: {\n values: [exceptionFromError(stackParser, ex)],\n },\n };\n}\n\n/** Parses stack frames from an error */\nfunction parseStackFrames(\n stackParser: StackParser,\n ex: Error & { framesToPop?: number; stacktrace?: string },\n): StackFrame[] {\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n const stacktrace = ex.stacktrace || ex.stack || '';\n\n const skipLines = getSkipFirstStackStringLines(ex);\n const framesToPop = getPopFirstTopFrames(ex);\n\n try {\n return stackParser(stacktrace, skipLines, framesToPop);\n } catch {\n // no-empty\n }\n\n return [];\n}\n\n// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108\nconst reactMinifiedRegexp = /Minified React error #\\d+;/i;\n\n/**\n * Certain known React errors contain links that would be falsely\n * parsed as frames. This function check for these errors and\n * returns number of the stack string lines to skip.\n */\nfunction getSkipFirstStackStringLines(ex: Error): number {\n if (ex && reactMinifiedRegexp.test(ex.message)) {\n return 1;\n }\n\n return 0;\n}\n\n/**\n * If error has `framesToPop` property, it means that the\n * creator tells us the first x frames will be useless\n * and should be discarded. Typically error from wrapper function\n * which don't point to the actual location in the developer's code.\n *\n * Example: https://github.com/zertosh/invariant/blob/master/invariant.js#L46\n */\nfunction getPopFirstTopFrames(ex: Error & { framesToPop?: unknown }): number {\n if (typeof ex.framesToPop === 'number') {\n return ex.framesToPop;\n }\n\n return 0;\n}\n\n// https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Exception\nfunction isWebAssemblyException(exception: unknown): exception is WebAssembly.Exception {\n // Check for support\n // oxlint-disable-next-line typescript/prefer-optional-chain\n if (typeof WebAssembly !== 'undefined' && typeof WebAssembly.Exception !== 'undefined') {\n return exception instanceof WebAssembly.Exception;\n } else {\n return false;\n }\n}\n\n/**\n * Extracts from errors what we use as the exception `type` in error events.\n *\n * Usually, this is the `name` property on Error objects but WASM errors need to be treated differently.\n */\nexport function extractType(ex: Error & { message: { error?: Error } }): string | undefined {\n const name = ex?.name;\n\n // The name for WebAssembly.Exception Errors needs to be extracted differently.\n // Context: https://github.com/getsentry/sentry-javascript/issues/13787\n if (!name && isWebAssemblyException(ex)) {\n // Emscripten sets array[type, message] to the \"message\" property on the WebAssembly.Exception object\n const hasTypeInMessage = ex.message && Array.isArray(ex.message) && ex.message.length == 2;\n return hasTypeInMessage ? ex.message[0] : 'WebAssembly.Exception';\n }\n\n return name;\n}\n\n/**\n * There are cases where stacktrace.message is an Event object\n * https://github.com/getsentry/sentry-javascript/issues/1949\n * In this specific case we try to extract stacktrace.message.error.message\n */\nexport function extractMessage(ex: Error & { message: { error?: Error } }): string {\n const message = ex?.message;\n\n if (isWebAssemblyException(ex)) {\n // For Node 18, Emscripten sets array[type, message] to the \"message\" property on the WebAssembly.Exception object\n if (Array.isArray(ex.message) && ex.message.length == 2) {\n return ex.message[1];\n }\n return 'wasm exception';\n }\n\n if (!message) {\n return 'No error message';\n }\n\n if (message.error && typeof message.error.message === 'string') {\n return _INTERNAL_enhanceErrorWithSentryInfo(message.error);\n }\n\n return _INTERNAL_enhanceErrorWithSentryInfo(ex);\n}\n\n/**\n * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.\n * @hidden\n */\nexport function eventFromException(\n stackParser: StackParser,\n exception: unknown,\n hint?: EventHint,\n attachStacktrace?: boolean,\n): PromiseLike<Event> {\n const syntheticException = hint?.syntheticException || undefined;\n const event = eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace);\n addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }\n event.level = 'error';\n if (hint?.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * Builds and Event from a Message\n * @hidden\n */\nexport function eventFromMessage(\n stackParser: StackParser,\n message: ParameterizedString,\n level: SeverityLevel = 'info',\n hint?: EventHint,\n attachStacktrace?: boolean,\n): PromiseLike<Event> {\n const syntheticException = hint?.syntheticException || undefined;\n const event = eventFromString(stackParser, message, syntheticException, attachStacktrace);\n event.level = level;\n if (hint?.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * @hidden\n */\nexport function eventFromUnknownInput(\n stackParser: StackParser,\n exception: unknown,\n syntheticException?: Error,\n attachStacktrace?: boolean,\n isUnhandledRejection?: boolean,\n): Event {\n let event: Event;\n\n if (isErrorEvent(exception) && (exception as ErrorEvent).error) {\n // If it is an ErrorEvent with `error` property, extract it to get actual Error\n const errorEvent = exception as ErrorEvent;\n return eventFromError(stackParser, errorEvent.error as Error);\n }\n\n // If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name\n // and message, as it doesn't provide anything else. According to the spec, all `DOMExceptions` should also be\n // `Error`s, but that's not the case in IE11, so in that case we treat it the same as we do a `DOMError`.\n //\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n // https://webidl.spec.whatwg.org/#es-DOMException-specialness\n if (isDOMError(exception) || isDOMException(exception)) {\n const domException = exception as DOMException;\n\n if ('stack' in (exception as Error)) {\n event = eventFromError(stackParser, exception as Error);\n\n const firstException = event.exception?.values?.[0];\n if (attachStacktrace && syntheticException && firstException && !firstException.stacktrace) {\n const frames = parseStackFrames(stackParser, syntheticException);\n if (frames.length) {\n firstException.stacktrace = { frames };\n addExceptionMechanism(event, { synthetic: true });\n }\n }\n } else {\n const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');\n const message = domException.message ? `${name}: ${domException.message}` : name;\n event = eventFromString(stackParser, message, syntheticException, attachStacktrace);\n addExceptionTypeValue(event, message);\n }\n\n return event;\n }\n if (isError(exception)) {\n // we have a real Error object, do nothing\n return eventFromError(stackParser, exception);\n }\n if (isPlainObject(exception) || isEvent(exception)) {\n // If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize\n // it manually. This will allow us to group events based on top-level keys which is much better than creating a new\n // group on any key/value change.\n const objectException = exception;\n event = eventFromPlainObject(stackParser, objectException, syntheticException, isUnhandledRejection);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n return event;\n }\n\n // If none of previous checks were valid, then it means that it's not:\n // - an instance of DOMError\n // - an instance of DOMException\n // - an instance of Event\n // - an instance of Error\n // - a valid ErrorEvent (one with an error property)\n // - a plain Object\n //\n // So bail out and capture it as a simple message:\n const stringifiedException = String(exception);\n event = eventFromString(stackParser, stringifiedException, syntheticException, attachStacktrace);\n addExceptionTypeValue(event, stringifiedException, undefined);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n\n return event;\n}\n\nfunction eventFromString(\n stackParser: StackParser,\n message: ParameterizedString,\n syntheticException?: Error,\n attachStacktrace?: boolean,\n): Event {\n const event: Event = {};\n\n if (attachStacktrace && syntheticException) {\n const frames = parseStackFrames(stackParser, syntheticException);\n if (frames.length) {\n event.exception = {\n values: [{ value: message, stacktrace: { frames } }],\n };\n }\n addExceptionMechanism(event, { synthetic: true });\n }\n\n if (isParameterizedString(message)) {\n const { __sentry_template_string__, __sentry_template_values__ } = message;\n\n event.logentry = {\n message: __sentry_template_string__,\n params: __sentry_template_values__,\n };\n return event;\n }\n\n event.message = message;\n return event;\n}\n\nfunction getNonErrorObjectExceptionValue(\n exception: Record<string, unknown>,\n { isUnhandledRejection }: { isUnhandledRejection?: boolean },\n): string {\n const keys = extractExceptionKeysForMessage(exception);\n const captureType = isUnhandledRejection ? 'promise rejection' : 'exception';\n\n // Some ErrorEvent instances do not have an `error` property, which is why they are not handled before\n // We still want to try to get a decent message for these cases\n if (isErrorEvent(exception)) {\n return `Event \\`ErrorEvent\\` captured as ${captureType} with message \\`${exception.message}\\``;\n }\n\n if (isEvent(exception)) {\n const className = getObjectClassName(exception);\n return `Event \\`${className}\\` (type=${exception.type}) captured as ${captureType}`;\n }\n\n return `Object captured as ${captureType} with keys: ${keys}`;\n}\n\nfunction getObjectClassName(obj: unknown): string | undefined | void {\n try {\n const prototype: Prototype | null = Object.getPrototypeOf(obj);\n return prototype ? prototype.constructor.name : undefined;\n } catch {\n // ignore errors here\n }\n}\n\n/** If a plain object has a property that is an `Error`, return this error. */\nfunction getErrorPropertyFromObject(obj: Record<string, unknown>): Error | undefined {\n return Object.values(obj).find(isError);\n}\n"],"names":["getClient","normalizeToSize","isEvent","_INTERNAL_enhanceErrorWithSentryInfo","addExceptionMechanism","resolvedSyncPromise","isErrorEvent","isDOMError","isDOMException","addExceptionTypeValue","isError","isPlainObject","isParameterizedString","extractExceptionKeysForMessage"],"mappings":";;;;AA+BO,SAAS,kBAAA,CAAmB,aAA0B,EAAA,EAAsB;AAEjF,EAAA,MAAM,MAAA,GAAS,gBAAA,CAAiB,WAAA,EAAa,EAAE,CAAA;AAE/C,EAAA,MAAM,SAAA,GAAuB;AAAA,IAC3B,IAAA,EAAM,YAAY,EAAE,CAAA;AAAA,IACpB,KAAA,EAAO,eAAe,EAAE;AAAA,GAC1B;AAEA,EAAA,IAAI,OAAO,MAAA,EAAQ;AACjB,IAAA,SAAA,CAAU,UAAA,GAAa,EAAE,MAAA,EAAO;AAAA,EAClC;AAEA,EAAA,IAAI,SAAA,CAAU,IAAA,KAAS,MAAA,IAAa,SAAA,CAAU,UAAU,EAAA,EAAI;AAC1D,IAAA,SAAA,CAAU,KAAA,GAAQ,4BAAA;AAAA,EACpB;AAEA,EAAA,OAAO,SAAA;AACT;AAEA,SAAS,oBAAA,CACP,WAAA,EACA,SAAA,EACA,kBAAA,EACA,oBAAA,EACO;AACP,EAAA,MAAM,SAASA,cAAA,EAAU;AACzB,EAAA,MAAM,cAAA,GAAiB,MAAA,EAAQ,UAAA,EAAW,CAAE,cAAA;AAG5C,EAAA,MAAM,aAAA,GAAgB,2BAA2B,SAAS,CAAA;AAE1D,EAAA,MAAM,KAAA,GAAQ;AAAA,IACZ,cAAA,EAAgBC,oBAAA,CAAgB,SAAA,EAAW,cAAc;AAAA,GAC3D;AAEA,EAAA,IAAI,aAAA,EAAe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AI,CAAA,CAAA;AAC7D;AAEA,SAAS,mBAAmB,GAAA,EAAyC;AACnE,EAAA,IAAI;AACF,IAAA,MAAM,SAAA,GAA8B,MAAA,CAAO,cAAA,CAAe,GAAG,CAAA;AAC7D,IAAA,OAAO,SAAA,GAAY,SAAA,CAAU,WAAA,CAAY,IAAA,GAAO,KAAA,CAAA;AAAA,EAClD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;AAGA,SAAS,2BAA2B,GAAA,EAAiD;AACnF,EAAA,OAAO,MAAA,CAAO,MAAA,CAAO,GAAG,CAAA,CAAE,KAAKQ,YAAO,CAAA;AACxC;;;;;;;;;"}
@@ -1,9 +1,9 @@
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
- const WINDOW = browser.GLOBAL_OBJ;
6
+ const WINDOW = core.GLOBAL_OBJ;
7
7
  let ignoreOnError = 0;
8
8
  function shouldIgnoreOnError() {
9
9
  return ignoreOnError > 0;
@@ -31,24 +31,24 @@ function wrap(fn, options = {}) {
31
31
  return fn;
32
32
  }
33
33
  }
34
- if (browser.getOriginalFunction(fn)) {
34
+ if (core.getOriginalFunction(fn)) {
35
35
  return fn;
36
36
  }
37
37
  } catch {
38
38
  return fn;
39
39
  }
40
40
  const sentryWrapped = function(...args) {
41
- browser.GLOBAL_OBJ._sentryWrappedDepth = (browser.GLOBAL_OBJ._sentryWrappedDepth || 0) + 1;
41
+ core.GLOBAL_OBJ._sentryWrappedDepth = (core.GLOBAL_OBJ._sentryWrappedDepth || 0) + 1;
42
42
  try {
43
43
  const wrappedArguments = args.map((arg) => wrap(arg, options));
44
44
  return fn.apply(this, wrappedArguments);
45
45
  } catch (ex) {
46
46
  ignoreNextOnError();
47
- browser.withScope((scope) => {
47
+ core.withScope((scope) => {
48
48
  scope.addEventProcessor((event) => {
49
49
  if (options.mechanism) {
50
- browser.addExceptionTypeValue(event, void 0, void 0);
51
- browser.addExceptionMechanism(event, options.mechanism);
50
+ core.addExceptionTypeValue(event, void 0, void 0);
51
+ core.addExceptionMechanism(event, options.mechanism);
52
52
  }
53
53
  event.extra = {
54
54
  ...event.extra,
@@ -56,11 +56,11 @@ function wrap(fn, options = {}) {
56
56
  };
57
57
  return event;
58
58
  });
59
- browser.captureException(ex);
59
+ core.captureException(ex);
60
60
  });
61
61
  throw ex;
62
62
  } finally {
63
- browser.GLOBAL_OBJ._sentryWrappedDepth = (browser.GLOBAL_OBJ._sentryWrappedDepth || 0) - 1;
63
+ core.GLOBAL_OBJ._sentryWrappedDepth = (core.GLOBAL_OBJ._sentryWrappedDepth || 0) - 1;
64
64
  }
65
65
  };
66
66
  try {
@@ -71,8 +71,8 @@ function wrap(fn, options = {}) {
71
71
  }
72
72
  } catch {
73
73
  }
74
- browser.markFunctionWrapped(sentryWrapped, fn);
75
- browser.addNonEnumerableProperty(fn, "__sentry_wrapped__", sentryWrapped);
74
+ core.markFunctionWrapped(sentryWrapped, fn);
75
+ core.addNonEnumerableProperty(fn, "__sentry_wrapped__", sentryWrapped);
76
76
  try {
77
77
  const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, "name");
78
78
  if (descriptor.configurable) {
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sources":["../../../../src/helpers.ts"],"sourcesContent":["import type { Mechanism, WrappedFunction } from '@sentry/core/browser';\nimport {\n addExceptionMechanism,\n addExceptionTypeValue,\n addNonEnumerableProperty,\n captureException,\n getOriginalFunction,\n GLOBAL_OBJ,\n markFunctionWrapped,\n withScope,\n} from '@sentry/core/browser';\nimport { getLocationHref } from '@sentry/browser-utils';\n\nexport const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;\n\nlet ignoreOnError: number = 0;\n\n/**\n * @hidden\n */\nexport function shouldIgnoreOnError(): boolean {\n return ignoreOnError > 0;\n}\n\n/**\n * @hidden\n */\nexport function ignoreNextOnError(): void {\n // onerror should trigger before setTimeout\n ignoreOnError++;\n setTimeout(() => {\n ignoreOnError--;\n });\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype WrappableFunction = Function;\n\nexport function wrap<T extends WrappableFunction>(\n fn: T,\n options?: {\n mechanism?: Mechanism;\n },\n): WrappedFunction<T>;\nexport function wrap<NonFunction>(\n fn: NonFunction,\n options?: {\n mechanism?: Mechanism;\n },\n): NonFunction;\n/**\n * Instruments the given function and sends an event to Sentry every time the\n * function throws an exception.\n *\n * @param fn A function to wrap. It is generally safe to pass an unbound function, because the returned wrapper always\n * has a correct `this` context.\n * @returns The wrapped function.\n * @hidden\n */\nexport function wrap<T extends WrappableFunction, NonFunction>(\n fn: T | NonFunction,\n options: {\n mechanism?: Mechanism;\n } = {},\n): NonFunction | WrappedFunction<T> {\n // for future readers what this does is wrap a function and then create\n // a bi-directional wrapping between them.\n //\n // example: wrapped = wrap(original);\n // original.__sentry_wrapped__ -> wrapped\n // wrapped.__sentry_original__ -> original\n\n function isFunction(fn: T | NonFunction): fn is T {\n return typeof fn === 'function';\n }\n\n if (!isFunction(fn)) {\n return fn;\n }\n\n try {\n // If we're dealing with a function that was previously wrapped, return the original wrapper.\n // Check via hasOwnProperty so a `__sentry_wrapped__` inherited from a wrapped `Function.prototype`\n // is not mistaken for a real wrapper.\n const hasOwnWrapper = Object.prototype.hasOwnProperty.call(fn, '__sentry_wrapped__');\n if (hasOwnWrapper) {\n const wrapper = (fn as WrappedFunction<T>).__sentry_wrapped__;\n if (typeof wrapper === 'function') {\n return wrapper;\n } else {\n // If we find that the `__sentry_wrapped__` function is not a function at the time of accessing it, it means\n // that something messed with it. In that case we want to return the originally passed function.\n return fn;\n }\n }\n\n // We don't wanna wrap it twice\n if (getOriginalFunction(fn)) {\n return fn;\n }\n } catch {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return fn;\n }\n\n // Wrap the function itself\n // It is important that `sentryWrapped` is not an arrow function to preserve the context of `this`\n const sentryWrapped = function (this: unknown, ...args: unknown[]): unknown {\n // Track depth on GLOBAL_OBJ so the thirdPartyErrorFilterIntegration (in @sentry/core) can detect\n // that processEvent is running inside a sentryWrapped call, even with minified/bundled code.\n GLOBAL_OBJ._sentryWrappedDepth = (GLOBAL_OBJ._sentryWrappedDepth || 0) + 1;\n try {\n // Also wrap arguments that are themselves functions\n const wrappedArguments = args.map(arg => wrap(arg, options));\n\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.apply(this, wrappedArguments);\n } catch (ex) {\n ignoreNextOnError();\n\n withScope(scope => {\n scope.addEventProcessor(event => {\n if (options.mechanism) {\n addExceptionTypeValue(event, undefined, undefined);\n addExceptionMechanism(event, options.mechanism);\n }\n\n event.extra = {\n ...event.extra,\n arguments: args,\n };\n\n return event;\n });\n\n // no need to add a mechanism here, we already add it via an event processor above\n captureException(ex);\n });\n\n throw ex;\n } finally {\n GLOBAL_OBJ._sentryWrappedDepth = (GLOBAL_OBJ._sentryWrappedDepth || 0) - 1;\n }\n } as unknown as WrappedFunction<T>;\n\n // Wrap the wrapped function in a proxy, to ensure any other properties of the original function remain available\n try {\n for (const property in fn) {\n if (Object.prototype.hasOwnProperty.call(fn, property)) {\n sentryWrapped[property as keyof T] = fn[property as keyof T];\n }\n }\n } catch {\n // Accessing some objects may throw\n // ref: https://github.com/getsentry/sentry-javascript/issues/1168\n }\n\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n markFunctionWrapped(sentryWrapped, fn);\n\n addNonEnumerableProperty(fn, '__sentry_wrapped__', sentryWrapped);\n\n // Restore original function name (not all browsers allow that)\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name')!;\n if (descriptor.configurable) {\n Object.defineProperty(sentryWrapped, 'name', {\n get(): string {\n return fn.name;\n },\n });\n }\n } catch {\n // This may throw if e.g. the descriptor does not exist, or a browser does not allow redefining `name`.\n // to save some bytes we simply try-catch this\n }\n\n return sentryWrapped;\n}\n\n/**\n * Get HTTP request data from the current page.\n */\nexport function getHttpRequestData(): { url: string; headers: Record<string, string> } {\n // grab as much info as exists and add it to the event\n const url = getLocationHref();\n const { referrer } = WINDOW.document || {};\n const { userAgent } = WINDOW.navigator || {};\n\n const headers = {\n ...(referrer && { Referer: referrer }),\n ...(userAgent && { 'User-Agent': userAgent }),\n };\n const request = {\n url,\n headers,\n };\n\n return request;\n}\n"],"names":["GLOBAL_OBJ","fn","getOriginalFunction","withScope","addExceptionTypeValue","addExceptionMechanism","captureException","markFunctionWrapped","addNonEnumerableProperty","getLocationHref"],"mappings":";;;;;AAaO,MAAM,MAAA,GAASA;AAEtB,IAAI,aAAA,GAAwB,CAAA;AAKrB,SAAS,mBAAA,GAA+B;AAC7C,EAAA,OAAO,aAAA,GAAgB,CAAA;AACzB;AAKO,SAAS,iBAAA,GAA0B;AAExC,EAAA,aAAA,EAAA;AACA,EAAA,UAAA,CAAW,MAAM;AACf,IAAA,aAAA,EAAA;AAAA,EACF,CAAC,CAAA;AACH;AA0BO,SAAS,IAAA,CACd,EAAA,EACA,OAAA,GAEI,EAAC,EAC6B;AAQlC,EAAA,SAAS,WAAWC,GAAAA,EAA8B;AAChD,IAAA,OAAO,OAAOA,GAAAA,KAAO,UAAA;AAAA,EACvB;AAEA,EAAA,IAAI,CAAC,UAAA,CAAW,EAAE,CAAA,EAAG;AACnB,IAAA,OAAO,EAAA;AAAA,EACT;AAEA,EAAA,IAAI;AAIF,IAAA,MAAM,gBAAgB,MAAA,CAAO,SAAA,CAAU,cAAA,CAAe,IAAA,CAAK,IAAI,oBAAoB,CAAA;AACnF,IAAA,IAAI,aAAA,EAAe;AACjB,MAAA,MAAM,UAAW,EAA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A,MAAM,OAAA,GAAU;AAAA,IACd,GAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,OAAO,OAAA;AACT;;;;;;;;"}
1
+ {"version":3,"file":"helpers.js","sources":["../../../../src/helpers.ts"],"sourcesContent":["import type { Mechanism, WrappedFunction } from '@sentry/core';\nimport {\n addExceptionMechanism,\n addExceptionTypeValue,\n addNonEnumerableProperty,\n captureException,\n getOriginalFunction,\n GLOBAL_OBJ,\n markFunctionWrapped,\n withScope,\n} from '@sentry/core';\nimport { getLocationHref } from '@sentry/browser-utils';\n\nexport const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;\n\nlet ignoreOnError: number = 0;\n\n/**\n * @hidden\n */\nexport function shouldIgnoreOnError(): boolean {\n return ignoreOnError > 0;\n}\n\n/**\n * @hidden\n */\nexport function ignoreNextOnError(): void {\n // onerror should trigger before setTimeout\n ignoreOnError++;\n setTimeout(() => {\n ignoreOnError--;\n });\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype WrappableFunction = Function;\n\nexport function wrap<T extends WrappableFunction>(\n fn: T,\n options?: {\n mechanism?: Mechanism;\n },\n): WrappedFunction<T>;\nexport function wrap<NonFunction>(\n fn: NonFunction,\n options?: {\n mechanism?: Mechanism;\n },\n): NonFunction;\n/**\n * Instruments the given function and sends an event to Sentry every time the\n * function throws an exception.\n *\n * @param fn A function to wrap. It is generally safe to pass an unbound function, because the returned wrapper always\n * has a correct `this` context.\n * @returns The wrapped function.\n * @hidden\n */\nexport function wrap<T extends WrappableFunction, NonFunction>(\n fn: T | NonFunction,\n options: {\n mechanism?: Mechanism;\n } = {},\n): NonFunction | WrappedFunction<T> {\n // for future readers what this does is wrap a function and then create\n // a bi-directional wrapping between them.\n //\n // example: wrapped = wrap(original);\n // original.__sentry_wrapped__ -> wrapped\n // wrapped.__sentry_original__ -> original\n\n function isFunction(fn: T | NonFunction): fn is T {\n return typeof fn === 'function';\n }\n\n if (!isFunction(fn)) {\n return fn;\n }\n\n try {\n // If we're dealing with a function that was previously wrapped, return the original wrapper.\n // Check via hasOwnProperty so a `__sentry_wrapped__` inherited from a wrapped `Function.prototype`\n // is not mistaken for a real wrapper.\n const hasOwnWrapper = Object.prototype.hasOwnProperty.call(fn, '__sentry_wrapped__');\n if (hasOwnWrapper) {\n const wrapper = (fn as WrappedFunction<T>).__sentry_wrapped__;\n if (typeof wrapper === 'function') {\n return wrapper;\n } else {\n // If we find that the `__sentry_wrapped__` function is not a function at the time of accessing it, it means\n // that something messed with it. In that case we want to return the originally passed function.\n return fn;\n }\n }\n\n // We don't wanna wrap it twice\n if (getOriginalFunction(fn)) {\n return fn;\n }\n } catch {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return fn;\n }\n\n // Wrap the function itself\n // It is important that `sentryWrapped` is not an arrow function to preserve the context of `this`\n const sentryWrapped = function (this: unknown, ...args: unknown[]): unknown {\n // Track depth on GLOBAL_OBJ so the thirdPartyErrorFilterIntegration (in @sentry/core) can detect\n // that processEvent is running inside a sentryWrapped call, even with minified/bundled code.\n GLOBAL_OBJ._sentryWrappedDepth = (GLOBAL_OBJ._sentryWrappedDepth || 0) + 1;\n try {\n // Also wrap arguments that are themselves functions\n const wrappedArguments = args.map(arg => wrap(arg, options));\n\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.apply(this, wrappedArguments);\n } catch (ex) {\n ignoreNextOnError();\n\n withScope(scope => {\n scope.addEventProcessor(event => {\n if (options.mechanism) {\n addExceptionTypeValue(event, undefined, undefined);\n addExceptionMechanism(event, options.mechanism);\n }\n\n event.extra = {\n ...event.extra,\n arguments: args,\n };\n\n return event;\n });\n\n // no need to add a mechanism here, we already add it via an event processor above\n captureException(ex);\n });\n\n throw ex;\n } finally {\n GLOBAL_OBJ._sentryWrappedDepth = (GLOBAL_OBJ._sentryWrappedDepth || 0) - 1;\n }\n } as unknown as WrappedFunction<T>;\n\n // Wrap the wrapped function in a proxy, to ensure any other properties of the original function remain available\n try {\n for (const property in fn) {\n if (Object.prototype.hasOwnProperty.call(fn, property)) {\n sentryWrapped[property as keyof T] = fn[property as keyof T];\n }\n }\n } catch {\n // Accessing some objects may throw\n // ref: https://github.com/getsentry/sentry-javascript/issues/1168\n }\n\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n markFunctionWrapped(sentryWrapped, fn);\n\n addNonEnumerableProperty(fn, '__sentry_wrapped__', sentryWrapped);\n\n // Restore original function name (not all browsers allow that)\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name')!;\n if (descriptor.configurable) {\n Object.defineProperty(sentryWrapped, 'name', {\n get(): string {\n return fn.name;\n },\n });\n }\n } catch {\n // This may throw if e.g. the descriptor does not exist, or a browser does not allow redefining `name`.\n // to save some bytes we simply try-catch this\n }\n\n return sentryWrapped;\n}\n\n/**\n * Get HTTP request data from the current page.\n */\nexport function getHttpRequestData(): { url: string; headers: Record<string, string> } {\n // grab as much info as exists and add it to the event\n const url = getLocationHref();\n const { referrer } = WINDOW.document || {};\n const { userAgent } = WINDOW.navigator || {};\n\n const headers = {\n ...(referrer && { Referer: referrer }),\n ...(userAgent && { 'User-Agent': userAgent }),\n };\n const request = {\n url,\n headers,\n };\n\n return request;\n}\n"],"names":["GLOBAL_OBJ","fn","getOriginalFunction","withScope","addExceptionTypeValue","addExceptionMechanism","captureException","markFunctionWrapped","addNonEnumerableProperty","getLocationHref"],"mappings":";;;;;AAaO,MAAM,MAAA,GAASA;AAEtB,IAAI,aAAA,GAAwB,CAAA;AAKrB,SAAS,mBAAA,GAA+B;AAC7C,EAAA,OAAO,aAAA,GAAgB,CAAA;AACzB;AAKO,SAAS,iBAAA,GAA0B;AAExC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