@unidy.io/sdk 1.1.1-alpha2 → 1.1.2

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 (661) hide show
  1. package/dist/{esm/auth-DLKPv5Zm.js → sdk/auth-Che07PeV.js} +9 -9
  2. package/dist/{esm/auth-DLKPv5Zm.js.map → sdk/auth-Che07PeV.js.map} +1 -1
  3. package/dist/{components/auth-store.js → sdk/auth-store-CapiC8gJ.js} +4 -4
  4. package/dist/{esm/auth-store-BMqUdTpC.js.map → sdk/auth-store-CapiC8gJ.js.map} +1 -1
  5. package/dist/{components/flash-store.js → sdk/flash-store-DNcSEn2p.js} +4 -3
  6. package/dist/{esm/flash-store-CEvWSG0c.js.map → sdk/flash-store-DNcSEn2p.js.map} +1 -1
  7. package/dist/{components/i18n.js → sdk/i18n-BCI_ARJL.js} +25 -5
  8. package/dist/sdk/i18n-BCI_ARJL.js.map +1 -0
  9. package/dist/{esm/index-Bjp1XO-f.js → sdk/index-BnBstyfp.js} +3 -3
  10. package/dist/{esm/index-Bjp1XO-f.js.map → sdk/index-BnBstyfp.js.map} +1 -1
  11. package/dist/sdk/index-BqL27K_R.js +49640 -0
  12. package/dist/sdk/index-BqL27K_R.js.map +1 -0
  13. package/dist/{collection/auth/error-definitions.js → sdk/index-Cz3idqu9.js} +19 -2
  14. package/dist/sdk/index-Cz3idqu9.js.map +1 -0
  15. package/dist/sdk/index-gEcJztft.js +15349 -0
  16. package/dist/sdk/index-gEcJztft.js.map +1 -0
  17. package/dist/sdk/index.esm.js +22 -2
  18. package/dist/sdk/index.esm.js.map +1 -1
  19. package/dist/sdk/loader.esm.js.map +1 -1
  20. package/dist/sdk/locales/de.json +1 -0
  21. package/dist/sdk/locales/en.json +1 -0
  22. package/dist/sdk/locales/fr.json +1 -0
  23. package/dist/sdk/locales/it.json +1 -0
  24. package/dist/sdk/locales/nl_be.json +1 -0
  25. package/dist/sdk/locales/ro.json +1 -0
  26. package/dist/{esm/newsletter-helpers-Dh9k-4Ph.js → sdk/newsletter-helpers-DEXEBD0F.js} +16 -9
  27. package/dist/sdk/newsletter-helpers-DEXEBD0F.js.map +1 -0
  28. package/dist/sdk/newsletter-store-CvULKmsu.js +39 -0
  29. package/dist/sdk/newsletter-store-CvULKmsu.js.map +1 -0
  30. package/dist/{components/profile-helpers.js → sdk/profile-helpers-Bs3aj0CO.js} +4 -4
  31. package/dist/{esm/profile-helpers-7onubaoR.js.map → sdk/profile-helpers-Bs3aj0CO.js.map} +1 -1
  32. package/dist/{components/profile-store.js → sdk/profile-store-DD6sq42i.js} +3 -3
  33. package/dist/{esm/profile-store-RmZB2PTc.js.map → sdk/profile-store-DD6sq42i.js.map} +1 -1
  34. package/dist/sdk/sdk.esm.js +48 -2
  35. package/dist/sdk/sdk.esm.js.map +1 -1
  36. package/dist/sdk/u-conditional-render.entry.esm.js.map +1 -1
  37. package/dist/{esm → sdk}/u-conditional-render.entry.js +13 -12
  38. package/dist/sdk/u-config.entry.esm.js.map +1 -1
  39. package/dist/{esm → sdk}/u-config.entry.js +13 -12
  40. package/dist/sdk/u-email-field.entry.esm.js.map +1 -1
  41. package/dist/sdk/u-email-field.entry.js +75 -0
  42. package/dist/{esm → sdk}/u-error-message.entry.js +7 -7
  43. package/dist/sdk/u-field.entry.esm.js.map +1 -0
  44. package/dist/sdk/u-field.entry.js +101 -0
  45. package/dist/sdk/u-flash-message.entry.esm.js.map +1 -1
  46. package/dist/sdk/u-flash-message.entry.js +35 -0
  47. package/dist/sdk/u-full-profile.entry.esm.js.map +1 -1
  48. package/dist/sdk/u-full-profile.entry.js +35 -0
  49. package/dist/{esm → sdk}/u-logout-button.entry.js +11 -11
  50. package/dist/sdk/u-magic-code-field.entry.esm.js.map +1 -1
  51. package/dist/{esm → sdk}/u-magic-code-field.entry.js +10 -10
  52. package/dist/{esm → sdk}/u-missing-field.entry.js +5 -5
  53. package/dist/{esm → sdk}/u-missing-fields-submit-button.entry.js +9 -9
  54. package/dist/sdk/u-newsletter-checkbox.entry.esm.js.map +1 -1
  55. package/dist/{esm → sdk}/u-newsletter-checkbox.entry.js +25 -37
  56. package/dist/{esm → sdk}/u-newsletter-logout-button.entry.js +12 -12
  57. package/dist/sdk/u-newsletter-preference-checkbox.entry.esm.js.map +1 -1
  58. package/dist/{esm → sdk}/u-newsletter-preference-checkbox.entry.js +22 -33
  59. package/dist/sdk/u-newsletter-resend-doi-button.entry.esm.js.map +1 -1
  60. package/dist/sdk/u-newsletter-resend-doi-button.entry.js +47 -0
  61. package/dist/sdk/u-newsletter-root.entry.esm.js.map +1 -1
  62. package/dist/{esm → sdk}/u-newsletter-root.entry.js +19 -33
  63. package/dist/sdk/u-newsletter-toggle-subscription-button.entry.esm.js.map +1 -1
  64. package/dist/sdk/u-newsletter-toggle-subscription-button.entry.js +71 -0
  65. package/dist/{esm → sdk}/u-pagination-button.entry.js +2 -2
  66. package/dist/{esm → sdk}/u-pagination-page.entry.js +2 -2
  67. package/dist/{esm → sdk}/u-passkey.entry.js +10 -10
  68. package/dist/{esm → sdk}/u-password-field.entry.js +6 -6
  69. package/dist/sdk/u-profile.entry.esm.js.map +1 -0
  70. package/dist/{components/profile.js → sdk/u-profile.entry.js} +18 -38
  71. package/dist/sdk/u-raw-field.entry.esm.js.map +1 -0
  72. package/dist/{components/raw-field.js → sdk/u-raw-field.entry.js} +10 -51
  73. package/dist/{esm → sdk}/u-registration-button.entry.js +6 -6
  74. package/dist/{esm → sdk}/u-reset-password-button.entry.js +10 -10
  75. package/dist/{esm → sdk}/u-send-magic-code-button.entry.js +10 -10
  76. package/dist/{esm → sdk}/u-signed-in.entry.js +5 -5
  77. package/dist/{esm → sdk}/u-signin-root.entry.js +7 -7
  78. package/dist/sdk/u-signin-step.entry.esm.js.map +1 -1
  79. package/dist/{esm → sdk}/u-signin-step.entry.js +11 -10
  80. package/dist/{esm → sdk}/u-signin-strategy.entry.js +5 -5
  81. package/dist/{esm → sdk}/u-social-login-button.entry.js +6 -6
  82. package/dist/sdk/u-spinner.entry.esm.js.map +1 -1
  83. package/dist/{esm → sdk}/u-spinner.entry.js +3 -3
  84. package/dist/sdk/u-submit-button.entry.esm.js.map +1 -0
  85. package/dist/sdk/u-submit-button.entry.js +204 -0
  86. package/dist/sdk/u-ticketable-list.entry.esm.js.map +1 -1
  87. package/dist/{esm → sdk}/u-ticketable-list.entry.js +141 -73
  88. package/dist/{components/unidy-store.js → sdk/unidy-store-BwZym11Y.js} +4 -3
  89. package/dist/{esm/unidy-store-BldTAtO0.js.map → sdk/unidy-store-BwZym11Y.js.map} +1 -1
  90. package/dist/types/components.d.ts +0 -36
  91. package/dist/types/newsletter/components/newsletter-checkbox/newsletter-checkbox.d.ts +0 -5
  92. package/dist/types/newsletter/components/newsletter-root/newsletter-root.d.ts +0 -9
  93. package/dist/types/newsletter/components/preference-checkbox/preference-checkbox.d.ts +0 -5
  94. package/dist/types/newsletter/newsletter-helpers.d.ts +1 -1
  95. package/dist/types/newsletter/store/newsletter-store.d.ts +3 -0
  96. package/dist/types/shared/components/email-field/email-field.d.ts +0 -2
  97. package/package.json +1 -1
  98. package/dist/cjs/app-globals-DSKjcXX_.js +0 -10
  99. package/dist/cjs/app-globals-DSKjcXX_.js.map +0 -1
  100. package/dist/cjs/auth-BVKZHhXz.js +0 -573
  101. package/dist/cjs/auth-BVKZHhXz.js.map +0 -1
  102. package/dist/cjs/auth-store-DC9EVec8.js +0 -184
  103. package/dist/cjs/auth-store-DC9EVec8.js.map +0 -1
  104. package/dist/cjs/component-utils-BpMyeVQo.js +0 -35
  105. package/dist/cjs/component-utils-BpMyeVQo.js.map +0 -1
  106. package/dist/cjs/flash-store-BuIBuQDx.js +0 -50
  107. package/dist/cjs/flash-store-BuIBuQDx.js.map +0 -1
  108. package/dist/cjs/helpers-BcPlKlBG.js +0 -11
  109. package/dist/cjs/helpers-BcPlKlBG.js.map +0 -1
  110. package/dist/cjs/helpers-DJyRa0Qo.js +0 -11
  111. package/dist/cjs/helpers-DJyRa0Qo.js.map +0 -1
  112. package/dist/cjs/i18n-Xy1So-ba.js +0 -3224
  113. package/dist/cjs/i18n-Xy1So-ba.js.map +0 -1
  114. package/dist/cjs/index-B_N5xKgH.js +0 -12025
  115. package/dist/cjs/index-B_N5xKgH.js.map +0 -1
  116. package/dist/cjs/index-DLz3FT7T.js +0 -214
  117. package/dist/cjs/index-DLz3FT7T.js.map +0 -1
  118. package/dist/cjs/index-DiUlebpf.js +0 -5256
  119. package/dist/cjs/index-DiUlebpf.js.map +0 -1
  120. package/dist/cjs/index.cjs.js +0 -64
  121. package/dist/cjs/index.cjs.js.map +0 -1
  122. package/dist/cjs/loader.cjs.js +0 -14
  123. package/dist/cjs/loader.cjs.js.map +0 -1
  124. package/dist/cjs/newsletter-helpers-D34j8zxr.js +0 -280
  125. package/dist/cjs/newsletter-helpers-D34j8zxr.js.map +0 -1
  126. package/dist/cjs/newsletter-store-dhtu8ywO.js +0 -27
  127. package/dist/cjs/newsletter-store-dhtu8ywO.js.map +0 -1
  128. package/dist/cjs/pagination-store-BEiW3MQd.js +0 -16
  129. package/dist/cjs/pagination-store-BEiW3MQd.js.map +0 -1
  130. package/dist/cjs/profile-helpers-DrcTgN5n.js +0 -39
  131. package/dist/cjs/profile-helpers-DrcTgN5n.js.map +0 -1
  132. package/dist/cjs/profile-store-P_BcYkef.js +0 -22
  133. package/dist/cjs/profile-store-P_BcYkef.js.map +0 -1
  134. package/dist/cjs/sdk.cjs.js +0 -26
  135. package/dist/cjs/sdk.cjs.js.map +0 -1
  136. package/dist/cjs/u-conditional-render.cjs.entry.js +0 -102
  137. package/dist/cjs/u-conditional-render.entry.cjs.js.map +0 -1
  138. package/dist/cjs/u-config.cjs.entry.js +0 -87
  139. package/dist/cjs/u-config.entry.cjs.js.map +0 -1
  140. package/dist/cjs/u-email-field.cjs.entry.js +0 -75
  141. package/dist/cjs/u-email-field.entry.cjs.js.map +0 -1
  142. package/dist/cjs/u-error-message.cjs.entry.js +0 -82
  143. package/dist/cjs/u-error-message.entry.cjs.js.map +0 -1
  144. package/dist/cjs/u-field.u-raw-field.entry.cjs.js.map +0 -1
  145. package/dist/cjs/u-field_2.cjs.entry.js +0 -375
  146. package/dist/cjs/u-flash-message.cjs.entry.js +0 -34
  147. package/dist/cjs/u-flash-message.entry.cjs.js.map +0 -1
  148. package/dist/cjs/u-full-profile.cjs.entry.js +0 -36
  149. package/dist/cjs/u-full-profile.entry.cjs.js.map +0 -1
  150. package/dist/cjs/u-logout-button.cjs.entry.js +0 -38
  151. package/dist/cjs/u-logout-button.entry.cjs.js.map +0 -1
  152. package/dist/cjs/u-magic-code-field.cjs.entry.js +0 -91
  153. package/dist/cjs/u-magic-code-field.entry.cjs.js.map +0 -1
  154. package/dist/cjs/u-missing-field.cjs.entry.js +0 -22
  155. package/dist/cjs/u-missing-field.entry.cjs.js.map +0 -1
  156. package/dist/cjs/u-missing-fields-submit-button.cjs.entry.js +0 -46
  157. package/dist/cjs/u-missing-fields-submit-button.entry.cjs.js.map +0 -1
  158. package/dist/cjs/u-newsletter-checkbox.cjs.entry.js +0 -75
  159. package/dist/cjs/u-newsletter-checkbox.entry.cjs.js.map +0 -1
  160. package/dist/cjs/u-newsletter-logout-button.cjs.entry.js +0 -36
  161. package/dist/cjs/u-newsletter-logout-button.entry.cjs.js.map +0 -1
  162. package/dist/cjs/u-newsletter-preference-checkbox.cjs.entry.js +0 -117
  163. package/dist/cjs/u-newsletter-preference-checkbox.entry.cjs.js.map +0 -1
  164. package/dist/cjs/u-newsletter-resend-doi-button.cjs.entry.js +0 -46
  165. package/dist/cjs/u-newsletter-resend-doi-button.entry.cjs.js.map +0 -1
  166. package/dist/cjs/u-newsletter-root.cjs.entry.js +0 -86
  167. package/dist/cjs/u-newsletter-root.entry.cjs.js.map +0 -1
  168. package/dist/cjs/u-newsletter-toggle-subscription-button.cjs.entry.js +0 -70
  169. package/dist/cjs/u-newsletter-toggle-subscription-button.entry.cjs.js.map +0 -1
  170. package/dist/cjs/u-pagination-button.cjs.entry.js +0 -63
  171. package/dist/cjs/u-pagination-button.entry.cjs.js.map +0 -1
  172. package/dist/cjs/u-pagination-page.cjs.entry.js +0 -44
  173. package/dist/cjs/u-pagination-page.entry.cjs.js.map +0 -1
  174. package/dist/cjs/u-passkey.cjs.entry.js +0 -47
  175. package/dist/cjs/u-passkey.entry.cjs.js.map +0 -1
  176. package/dist/cjs/u-password-field.cjs.entry.js +0 -104
  177. package/dist/cjs/u-password-field.entry.cjs.js.map +0 -1
  178. package/dist/cjs/u-profile.u-submit-button.entry.cjs.js.map +0 -1
  179. package/dist/cjs/u-profile_2.cjs.entry.js +0 -311
  180. package/dist/cjs/u-registration-button.cjs.entry.js +0 -48
  181. package/dist/cjs/u-registration-button.entry.cjs.js.map +0 -1
  182. package/dist/cjs/u-reset-password-button.cjs.entry.js +0 -47
  183. package/dist/cjs/u-reset-password-button.entry.cjs.js.map +0 -1
  184. package/dist/cjs/u-send-magic-code-button.cjs.entry.js +0 -68
  185. package/dist/cjs/u-send-magic-code-button.entry.cjs.js.map +0 -1
  186. package/dist/cjs/u-signed-in.cjs.entry.js +0 -25
  187. package/dist/cjs/u-signed-in.entry.cjs.js.map +0 -1
  188. package/dist/cjs/u-signin-root.cjs.entry.js +0 -43
  189. package/dist/cjs/u-signin-root.entry.cjs.js.map +0 -1
  190. package/dist/cjs/u-signin-step.cjs.entry.js +0 -66
  191. package/dist/cjs/u-signin-step.entry.cjs.js.map +0 -1
  192. package/dist/cjs/u-signin-strategy.cjs.entry.js +0 -30
  193. package/dist/cjs/u-signin-strategy.entry.cjs.js.map +0 -1
  194. package/dist/cjs/u-social-login-button.cjs.entry.js +0 -100
  195. package/dist/cjs/u-social-login-button.entry.cjs.js.map +0 -1
  196. package/dist/cjs/u-spinner.cjs.entry.js +0 -18
  197. package/dist/cjs/u-spinner.entry.cjs.js.map +0 -1
  198. package/dist/cjs/u-ticketable-list.cjs.entry.js +0 -6078
  199. package/dist/cjs/u-ticketable-list.entry.cjs.js.map +0 -1
  200. package/dist/cjs/unidy-store-7AbWnZ6g.js +0 -41
  201. package/dist/cjs/unidy-store-7AbWnZ6g.js.map +0 -1
  202. package/dist/collection/api/client.js +0 -144
  203. package/dist/collection/api/client.js.map +0 -1
  204. package/dist/collection/api/index.js +0 -42
  205. package/dist/collection/api/index.js.map +0 -1
  206. package/dist/collection/api/shared.js +0 -18
  207. package/dist/collection/api/shared.js.map +0 -1
  208. package/dist/collection/auth/api/auth.js +0 -264
  209. package/dist/collection/auth/api/auth.js.map +0 -1
  210. package/dist/collection/auth/auth-helpers.js +0 -291
  211. package/dist/collection/auth/auth-helpers.js.map +0 -1
  212. package/dist/collection/auth/auth.js +0 -121
  213. package/dist/collection/auth/auth.js.map +0 -1
  214. package/dist/collection/auth/components/helpers.js +0 -5
  215. package/dist/collection/auth/components/helpers.js.map +0 -1
  216. package/dist/collection/auth/components/logout-button/logout-button.js +0 -85
  217. package/dist/collection/auth/components/logout-button/logout-button.js.map +0 -1
  218. package/dist/collection/auth/components/magic-code-field/magic-code-field.css +0 -1
  219. package/dist/collection/auth/components/magic-code-field/magic-code-field.js +0 -113
  220. package/dist/collection/auth/components/magic-code-field/magic-code-field.js.map +0 -1
  221. package/dist/collection/auth/components/missing-field/missing-field.js +0 -14
  222. package/dist/collection/auth/components/missing-field/missing-field.js.map +0 -1
  223. package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js +0 -39
  224. package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js.map +0 -1
  225. package/dist/collection/auth/components/passkey/passkey.js +0 -103
  226. package/dist/collection/auth/components/passkey/passkey.js.map +0 -1
  227. package/dist/collection/auth/components/password-field/password-field.js +0 -166
  228. package/dist/collection/auth/components/password-field/password-field.js.map +0 -1
  229. package/dist/collection/auth/components/registration/registration-button.js +0 -104
  230. package/dist/collection/auth/components/registration/registration-button.js.map +0 -1
  231. package/dist/collection/auth/components/reset-pass-button/reset-pass-button.js +0 -59
  232. package/dist/collection/auth/components/reset-pass-button/reset-pass-button.js.map +0 -1
  233. package/dist/collection/auth/components/send-magic-code-button/send-magic-code-button.js +0 -104
  234. package/dist/collection/auth/components/send-magic-code-button/send-magic-code-button.js.map +0 -1
  235. package/dist/collection/auth/components/signed-in/signed-in.js +0 -59
  236. package/dist/collection/auth/components/signed-in/signed-in.js.map +0 -1
  237. package/dist/collection/auth/components/signin-root/signin-root.js +0 -97
  238. package/dist/collection/auth/components/signin-root/signin-root.js.map +0 -1
  239. package/dist/collection/auth/components/signin-step/signin-step.js +0 -135
  240. package/dist/collection/auth/components/signin-step/signin-step.js.map +0 -1
  241. package/dist/collection/auth/components/signin-strategy/signin-strategy.js +0 -64
  242. package/dist/collection/auth/components/signin-strategy/signin-strategy.js.map +0 -1
  243. package/dist/collection/auth/components/social-logins/logos/apple.js +0 -3
  244. package/dist/collection/auth/components/social-logins/logos/apple.js.map +0 -1
  245. package/dist/collection/auth/components/social-logins/logos/discord.js +0 -3
  246. package/dist/collection/auth/components/social-logins/logos/discord.js.map +0 -1
  247. package/dist/collection/auth/components/social-logins/logos/facebook.js +0 -3
  248. package/dist/collection/auth/components/social-logins/logos/facebook.js.map +0 -1
  249. package/dist/collection/auth/components/social-logins/logos/google.js +0 -3
  250. package/dist/collection/auth/components/social-logins/logos/google.js.map +0 -1
  251. package/dist/collection/auth/components/social-logins/logos/linkedin.js +0 -3
  252. package/dist/collection/auth/components/social-logins/logos/linkedin.js.map +0 -1
  253. package/dist/collection/auth/components/social-logins/social-login-button.css +0 -1
  254. package/dist/collection/auth/components/social-logins/social-login-button.js +0 -188
  255. package/dist/collection/auth/components/social-logins/social-login-button.js.map +0 -1
  256. package/dist/collection/auth/components/submit-button/auth-submit-button.js +0 -62
  257. package/dist/collection/auth/components/submit-button/auth-submit-button.js.map +0 -1
  258. package/dist/collection/auth/error-definitions.js.map +0 -1
  259. package/dist/collection/auth/index.js +0 -14
  260. package/dist/collection/auth/index.js.map +0 -1
  261. package/dist/collection/auth/passkey-auth.js +0 -106
  262. package/dist/collection/auth/passkey-auth.js.map +0 -1
  263. package/dist/collection/auth/store/auth-store.js +0 -175
  264. package/dist/collection/auth/store/auth-store.js.map +0 -1
  265. package/dist/collection/collection-manifest.json +0 -46
  266. package/dist/collection/globalScript.js +0 -18
  267. package/dist/collection/globalScript.js.map +0 -1
  268. package/dist/collection/i18n.js +0 -31
  269. package/dist/collection/i18n.js.map +0 -1
  270. package/dist/collection/index.js +0 -16
  271. package/dist/collection/index.js.map +0 -1
  272. package/dist/collection/locales/de.json +0 -131
  273. package/dist/collection/locales/en.json +0 -131
  274. package/dist/collection/locales/fr.json +0 -131
  275. package/dist/collection/locales/it.json +0 -131
  276. package/dist/collection/locales/nl_be.json +0 -131
  277. package/dist/collection/locales/ro.json +0 -131
  278. package/dist/collection/logger.js +0 -106
  279. package/dist/collection/logger.js.map +0 -1
  280. package/dist/collection/newsletter/api/newsletters.js +0 -189
  281. package/dist/collection/newsletter/api/newsletters.js.map +0 -1
  282. package/dist/collection/newsletter/components/helpers.js +0 -5
  283. package/dist/collection/newsletter/components/helpers.js.map +0 -1
  284. package/dist/collection/newsletter/components/logout-button/logout-button.js +0 -48
  285. package/dist/collection/newsletter/components/logout-button/logout-button.js.map +0 -1
  286. package/dist/collection/newsletter/components/newsletter-checkbox/newsletter-checkbox.js +0 -163
  287. package/dist/collection/newsletter/components/newsletter-checkbox/newsletter-checkbox.js.map +0 -1
  288. package/dist/collection/newsletter/components/newsletter-root/newsletter-root.js +0 -164
  289. package/dist/collection/newsletter/components/newsletter-root/newsletter-root.js.map +0 -1
  290. package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js +0 -231
  291. package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js.map +0 -1
  292. package/dist/collection/newsletter/components/resend-doi-button/resend-doi-button.js +0 -79
  293. package/dist/collection/newsletter/components/resend-doi-button/resend-doi-button.js.map +0 -1
  294. package/dist/collection/newsletter/components/submit-button/newsletter-submit-button.js +0 -19
  295. package/dist/collection/newsletter/components/submit-button/newsletter-submit-button.js.map +0 -1
  296. package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.js +0 -144
  297. package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.js.map +0 -1
  298. package/dist/collection/newsletter/index.js +0 -11
  299. package/dist/collection/newsletter/index.js.map +0 -1
  300. package/dist/collection/newsletter/newsletter-helpers.js +0 -268
  301. package/dist/collection/newsletter/newsletter-helpers.js.map +0 -1
  302. package/dist/collection/newsletter/store/newsletter-store.js +0 -24
  303. package/dist/collection/newsletter/store/newsletter-store.js.map +0 -1
  304. package/dist/collection/profile/api/profile.js +0 -156
  305. package/dist/collection/profile/api/profile.js.map +0 -1
  306. package/dist/collection/profile/components/field/field.css +0 -1
  307. package/dist/collection/profile/components/field/field.js +0 -359
  308. package/dist/collection/profile/components/field/field.js.map +0 -1
  309. package/dist/collection/profile/components/full-profile/full-profile.css +0 -1
  310. package/dist/collection/profile/components/full-profile/full-profile.js +0 -77
  311. package/dist/collection/profile/components/full-profile/full-profile.js.map +0 -1
  312. package/dist/collection/profile/components/profile/profile.js +0 -189
  313. package/dist/collection/profile/components/profile/profile.js.map +0 -1
  314. package/dist/collection/profile/components/raw-field/raw-field.js +0 -697
  315. package/dist/collection/profile/components/raw-field/raw-field.js.map +0 -1
  316. package/dist/collection/profile/components/raw-input-fields/Input.js +0 -3
  317. package/dist/collection/profile/components/raw-input-fields/Input.js.map +0 -1
  318. package/dist/collection/profile/components/raw-input-fields/MultiSelect.js +0 -8
  319. package/dist/collection/profile/components/raw-input-fields/MultiSelect.js.map +0 -1
  320. package/dist/collection/profile/components/raw-input-fields/RadioGroup.js +0 -8
  321. package/dist/collection/profile/components/raw-input-fields/RadioGroup.js.map +0 -1
  322. package/dist/collection/profile/components/raw-input-fields/Select.js +0 -11
  323. package/dist/collection/profile/components/raw-input-fields/Select.js.map +0 -1
  324. package/dist/collection/profile/components/raw-input-fields/Textarea.js +0 -3
  325. package/dist/collection/profile/components/raw-input-fields/Textarea.js.map +0 -1
  326. package/dist/collection/profile/components/submit-button/profile-submit-button.js +0 -17
  327. package/dist/collection/profile/components/submit-button/profile-submit-button.js.map +0 -1
  328. package/dist/collection/profile/index.js +0 -13
  329. package/dist/collection/profile/index.js.map +0 -1
  330. package/dist/collection/profile/profile-helpers.js +0 -31
  331. package/dist/collection/profile/profile-helpers.js.map +0 -1
  332. package/dist/collection/profile/store/profile-store.js +0 -15
  333. package/dist/collection/profile/store/profile-store.js.map +0 -1
  334. package/dist/collection/sdk.css +0 -39
  335. package/dist/collection/shared/component-utils.js +0 -28
  336. package/dist/collection/shared/component-utils.js.map +0 -1
  337. package/dist/collection/shared/components/conditional-render/conditional-render.js +0 -177
  338. package/dist/collection/shared/components/conditional-render/conditional-render.js.map +0 -1
  339. package/dist/collection/shared/components/config/config.js +0 -260
  340. package/dist/collection/shared/components/config/config.js.map +0 -1
  341. package/dist/collection/shared/components/email-field/email-field.js +0 -161
  342. package/dist/collection/shared/components/email-field/email-field.js.map +0 -1
  343. package/dist/collection/shared/components/error-message/error-message.js +0 -141
  344. package/dist/collection/shared/components/error-message/error-message.js.map +0 -1
  345. package/dist/collection/shared/components/flash-message/close-icon.js +0 -3
  346. package/dist/collection/shared/components/flash-message/close-icon.js.map +0 -1
  347. package/dist/collection/shared/components/flash-message/flash-message.js +0 -69
  348. package/dist/collection/shared/components/flash-message/flash-message.js.map +0 -1
  349. package/dist/collection/shared/components/spinner/spinner.css +0 -1
  350. package/dist/collection/shared/components/spinner/spinner.js +0 -19
  351. package/dist/collection/shared/components/spinner/spinner.js.map +0 -1
  352. package/dist/collection/shared/components/submit-button/context.js +0 -10
  353. package/dist/collection/shared/components/submit-button/context.js.map +0 -1
  354. package/dist/collection/shared/components/submit-button/submit-button.js +0 -186
  355. package/dist/collection/shared/components/submit-button/submit-button.js.map +0 -1
  356. package/dist/collection/shared/store/flash-store.js +0 -43
  357. package/dist/collection/shared/store/flash-store.js.map +0 -1
  358. package/dist/collection/shared/store/unidy-store.js +0 -33
  359. package/dist/collection/shared/store/unidy-store.js.map +0 -1
  360. package/dist/collection/ticketable/api/get-with-schema.js +0 -35
  361. package/dist/collection/ticketable/api/get-with-schema.js.map +0 -1
  362. package/dist/collection/ticketable/api/schemas.js +0 -12
  363. package/dist/collection/ticketable/api/schemas.js.map +0 -1
  364. package/dist/collection/ticketable/api/subscriptions.js +0 -47
  365. package/dist/collection/ticketable/api/subscriptions.js.map +0 -1
  366. package/dist/collection/ticketable/api/tickets.js +0 -48
  367. package/dist/collection/ticketable/api/tickets.js.map +0 -1
  368. package/dist/collection/ticketable/components/pagination/pagination-button.js +0 -108
  369. package/dist/collection/ticketable/components/pagination/pagination-button.js.map +0 -1
  370. package/dist/collection/ticketable/components/pagination/pagination-page.js +0 -69
  371. package/dist/collection/ticketable/components/pagination/pagination-page.js.map +0 -1
  372. package/dist/collection/ticketable/components/ticketable-list/skeleton-helpers.js +0 -54
  373. package/dist/collection/ticketable/components/ticketable-list/skeleton-helpers.js.map +0 -1
  374. package/dist/collection/ticketable/components/ticketable-list/ticketable-list.js +0 -442
  375. package/dist/collection/ticketable/components/ticketable-list/ticketable-list.js.map +0 -1
  376. package/dist/collection/ticketable/index.js +0 -13
  377. package/dist/collection/ticketable/index.js.map +0 -1
  378. package/dist/collection/ticketable/store/pagination-store.js +0 -9
  379. package/dist/collection/ticketable/store/pagination-store.js.map +0 -1
  380. package/dist/components/auth-store.js.map +0 -1
  381. package/dist/components/auth.js +0 -572
  382. package/dist/components/auth.js.map +0 -1
  383. package/dist/components/component-utils.js +0 -32
  384. package/dist/components/component-utils.js.map +0 -1
  385. package/dist/components/exports.js +0 -4106
  386. package/dist/components/exports.js.map +0 -1
  387. package/dist/components/field.js +0 -144
  388. package/dist/components/field.js.map +0 -1
  389. package/dist/components/flash-store.js.map +0 -1
  390. package/dist/components/helpers.js +0 -9
  391. package/dist/components/helpers.js.map +0 -1
  392. package/dist/components/helpers2.js +0 -9
  393. package/dist/components/helpers2.js.map +0 -1
  394. package/dist/components/i18n.js.map +0 -1
  395. package/dist/components/index.js +0 -5902
  396. package/dist/components/index.js.map +0 -1
  397. package/dist/components/index2.js +0 -5245
  398. package/dist/components/index2.js.map +0 -1
  399. package/dist/components/index3.js +0 -212
  400. package/dist/components/index3.js.map +0 -1
  401. package/dist/components/logger.js +0 -111
  402. package/dist/components/logger.js.map +0 -1
  403. package/dist/components/newsletter-helpers.js +0 -269
  404. package/dist/components/newsletter-helpers.js.map +0 -1
  405. package/dist/components/newsletter-store.js +0 -24
  406. package/dist/components/newsletter-store.js.map +0 -1
  407. package/dist/components/pagination-store.js +0 -14
  408. package/dist/components/pagination-store.js.map +0 -1
  409. package/dist/components/profile-helpers.js.map +0 -1
  410. package/dist/components/profile-store.js.map +0 -1
  411. package/dist/components/profile.js.map +0 -1
  412. package/dist/components/raw-field.js.map +0 -1
  413. package/dist/components/spinner.js +0 -35
  414. package/dist/components/spinner.js.map +0 -1
  415. package/dist/components/submit-button.js +0 -229
  416. package/dist/components/submit-button.js.map +0 -1
  417. package/dist/components/u-conditional-render.js +0 -120
  418. package/dist/components/u-conditional-render.js.map +0 -1
  419. package/dist/components/u-config.js +0 -113
  420. package/dist/components/u-config.js.map +0 -1
  421. package/dist/components/u-email-field.js +0 -98
  422. package/dist/components/u-email-field.js.map +0 -1
  423. package/dist/components/u-error-message.js +0 -105
  424. package/dist/components/u-error-message.js.map +0 -1
  425. package/dist/components/u-field.js +0 -9
  426. package/dist/components/u-field.js.map +0 -1
  427. package/dist/components/u-flash-message.js +0 -55
  428. package/dist/components/u-flash-message.js.map +0 -1
  429. package/dist/components/u-full-profile.js +0 -86
  430. package/dist/components/u-full-profile.js.map +0 -1
  431. package/dist/components/u-logout-button.js +0 -53
  432. package/dist/components/u-logout-button.js.map +0 -1
  433. package/dist/components/u-magic-code-field.js +0 -106
  434. package/dist/components/u-magic-code-field.js.map +0 -1
  435. package/dist/components/u-missing-field.js +0 -57
  436. package/dist/components/u-missing-field.js.map +0 -1
  437. package/dist/components/u-missing-fields-submit-button.js +0 -70
  438. package/dist/components/u-missing-fields-submit-button.js.map +0 -1
  439. package/dist/components/u-newsletter-checkbox.js +0 -91
  440. package/dist/components/u-newsletter-checkbox.js.map +0 -1
  441. package/dist/components/u-newsletter-logout-button.js +0 -51
  442. package/dist/components/u-newsletter-logout-button.js.map +0 -1
  443. package/dist/components/u-newsletter-preference-checkbox.js +0 -137
  444. package/dist/components/u-newsletter-preference-checkbox.js.map +0 -1
  445. package/dist/components/u-newsletter-resend-doi-button.js +0 -67
  446. package/dist/components/u-newsletter-resend-doi-button.js.map +0 -1
  447. package/dist/components/u-newsletter-root.js +0 -104
  448. package/dist/components/u-newsletter-root.js.map +0 -1
  449. package/dist/components/u-newsletter-toggle-subscription-button.js +0 -94
  450. package/dist/components/u-newsletter-toggle-subscription-button.js.map +0 -1
  451. package/dist/components/u-pagination-button.js +0 -86
  452. package/dist/components/u-pagination-button.js.map +0 -1
  453. package/dist/components/u-pagination-page.js +0 -66
  454. package/dist/components/u-pagination-page.js.map +0 -1
  455. package/dist/components/u-passkey.js +0 -65
  456. package/dist/components/u-passkey.js.map +0 -1
  457. package/dist/components/u-password-field.js +0 -125
  458. package/dist/components/u-password-field.js.map +0 -1
  459. package/dist/components/u-profile.js +0 -9
  460. package/dist/components/u-profile.js.map +0 -1
  461. package/dist/components/u-raw-field.js +0 -9
  462. package/dist/components/u-raw-field.js.map +0 -1
  463. package/dist/components/u-registration-button.js +0 -70
  464. package/dist/components/u-registration-button.js.map +0 -1
  465. package/dist/components/u-reset-password-button.js +0 -63
  466. package/dist/components/u-reset-password-button.js.map +0 -1
  467. package/dist/components/u-send-magic-code-button.js +0 -85
  468. package/dist/components/u-send-magic-code-button.js.map +0 -1
  469. package/dist/components/u-signed-in.js +0 -44
  470. package/dist/components/u-signed-in.js.map +0 -1
  471. package/dist/components/u-signin-root.js +0 -63
  472. package/dist/components/u-signin-root.js.map +0 -1
  473. package/dist/components/u-signin-step.js +0 -84
  474. package/dist/components/u-signin-step.js.map +0 -1
  475. package/dist/components/u-signin-strategy.js +0 -50
  476. package/dist/components/u-signin-strategy.js.map +0 -1
  477. package/dist/components/u-social-login-button.js +0 -125
  478. package/dist/components/u-social-login-button.js.map +0 -1
  479. package/dist/components/u-spinner.js +0 -9
  480. package/dist/components/u-spinner.js.map +0 -1
  481. package/dist/components/u-submit-button.js +0 -9
  482. package/dist/components/u-submit-button.js.map +0 -1
  483. package/dist/components/u-ticketable-list.js +0 -6113
  484. package/dist/components/u-ticketable-list.js.map +0 -1
  485. package/dist/components/unidy-store.js.map +0 -1
  486. package/dist/esm/app-globals-CPU9ZcqZ.js +0 -8
  487. package/dist/esm/app-globals-CPU9ZcqZ.js.map +0 -1
  488. package/dist/esm/auth-store-BMqUdTpC.js +0 -179
  489. package/dist/esm/flash-store-CEvWSG0c.js +0 -47
  490. package/dist/esm/i18n-BR-AGAnn.js +0 -3221
  491. package/dist/esm/i18n-BR-AGAnn.js.map +0 -1
  492. package/dist/esm/index-Ci3aTmzp.js +0 -12007
  493. package/dist/esm/index-Ci3aTmzp.js.map +0 -1
  494. package/dist/esm/index-DKaIwo59.js +0 -5243
  495. package/dist/esm/index-DKaIwo59.js.map +0 -1
  496. package/dist/esm/index.js +0 -40
  497. package/dist/esm/index.js.map +0 -1
  498. package/dist/esm/loader.js +0 -12
  499. package/dist/esm/loader.js.map +0 -1
  500. package/dist/esm/newsletter-helpers-Dh9k-4Ph.js.map +0 -1
  501. package/dist/esm/newsletter-store-BYmuLQg8.js +0 -24
  502. package/dist/esm/newsletter-store-BYmuLQg8.js.map +0 -1
  503. package/dist/esm/pagination-store-DzdJOp-n.js +0 -14
  504. package/dist/esm/pagination-store-DzdJOp-n.js.map +0 -1
  505. package/dist/esm/profile-helpers-7onubaoR.js +0 -36
  506. package/dist/esm/profile-store-RmZB2PTc.js +0 -18
  507. package/dist/esm/sdk.js +0 -22
  508. package/dist/esm/sdk.js.map +0 -1
  509. package/dist/esm/u-conditional-render.entry.js.map +0 -1
  510. package/dist/esm/u-config.entry.js.map +0 -1
  511. package/dist/esm/u-email-field.entry.js +0 -73
  512. package/dist/esm/u-email-field.entry.js.map +0 -1
  513. package/dist/esm/u-error-message.entry.js.map +0 -1
  514. package/dist/esm/u-field.u-raw-field.entry.js.map +0 -1
  515. package/dist/esm/u-field_2.entry.js +0 -372
  516. package/dist/esm/u-flash-message.entry.js +0 -32
  517. package/dist/esm/u-flash-message.entry.js.map +0 -1
  518. package/dist/esm/u-full-profile.entry.js +0 -34
  519. package/dist/esm/u-full-profile.entry.js.map +0 -1
  520. package/dist/esm/u-logout-button.entry.js.map +0 -1
  521. package/dist/esm/u-magic-code-field.entry.js.map +0 -1
  522. package/dist/esm/u-missing-field.entry.js.map +0 -1
  523. package/dist/esm/u-missing-fields-submit-button.entry.js.map +0 -1
  524. package/dist/esm/u-newsletter-checkbox.entry.js.map +0 -1
  525. package/dist/esm/u-newsletter-logout-button.entry.js.map +0 -1
  526. package/dist/esm/u-newsletter-preference-checkbox.entry.js.map +0 -1
  527. package/dist/esm/u-newsletter-resend-doi-button.entry.js +0 -44
  528. package/dist/esm/u-newsletter-resend-doi-button.entry.js.map +0 -1
  529. package/dist/esm/u-newsletter-root.entry.js.map +0 -1
  530. package/dist/esm/u-newsletter-toggle-subscription-button.entry.js +0 -68
  531. package/dist/esm/u-newsletter-toggle-subscription-button.entry.js.map +0 -1
  532. package/dist/esm/u-pagination-button.entry.js.map +0 -1
  533. package/dist/esm/u-pagination-page.entry.js.map +0 -1
  534. package/dist/esm/u-passkey.entry.js.map +0 -1
  535. package/dist/esm/u-password-field.entry.js.map +0 -1
  536. package/dist/esm/u-profile.u-submit-button.entry.js.map +0 -1
  537. package/dist/esm/u-profile_2.entry.js +0 -308
  538. package/dist/esm/u-registration-button.entry.js.map +0 -1
  539. package/dist/esm/u-reset-password-button.entry.js.map +0 -1
  540. package/dist/esm/u-send-magic-code-button.entry.js.map +0 -1
  541. package/dist/esm/u-signed-in.entry.js.map +0 -1
  542. package/dist/esm/u-signin-root.entry.js.map +0 -1
  543. package/dist/esm/u-signin-step.entry.js.map +0 -1
  544. package/dist/esm/u-signin-strategy.entry.js.map +0 -1
  545. package/dist/esm/u-social-login-button.entry.js.map +0 -1
  546. package/dist/esm/u-spinner.entry.js.map +0 -1
  547. package/dist/esm/u-ticketable-list.entry.js.map +0 -1
  548. package/dist/esm/unidy-store-BldTAtO0.js +0 -37
  549. package/dist/index.cjs.js +0 -1
  550. package/dist/index.js +0 -1
  551. package/dist/sdk/p-10e06612.entry.js +0 -2
  552. package/dist/sdk/p-10e06612.entry.js.map +0 -1
  553. package/dist/sdk/p-16f86a4d.entry.js +0 -2
  554. package/dist/sdk/p-16f86a4d.entry.js.map +0 -1
  555. package/dist/sdk/p-20240b02.entry.js +0 -2
  556. package/dist/sdk/p-20240b02.entry.js.map +0 -1
  557. package/dist/sdk/p-26f3d8db.entry.js +0 -2
  558. package/dist/sdk/p-26f3d8db.entry.js.map +0 -1
  559. package/dist/sdk/p-2da4497a.entry.js +0 -2
  560. package/dist/sdk/p-2da4497a.entry.js.map +0 -1
  561. package/dist/sdk/p-3f4c947d.entry.js +0 -2
  562. package/dist/sdk/p-3f4c947d.entry.js.map +0 -1
  563. package/dist/sdk/p-431ec460.entry.js +0 -2
  564. package/dist/sdk/p-431ec460.entry.js.map +0 -1
  565. package/dist/sdk/p-4f54194a.entry.js +0 -2
  566. package/dist/sdk/p-4f54194a.entry.js.map +0 -1
  567. package/dist/sdk/p-552056e7.entry.js +0 -2
  568. package/dist/sdk/p-552056e7.entry.js.map +0 -1
  569. package/dist/sdk/p-5da49d00.entry.js +0 -2
  570. package/dist/sdk/p-5da49d00.entry.js.map +0 -1
  571. package/dist/sdk/p-67096601.entry.js +0 -2
  572. package/dist/sdk/p-67096601.entry.js.map +0 -1
  573. package/dist/sdk/p-6893d167.entry.js +0 -2
  574. package/dist/sdk/p-6893d167.entry.js.map +0 -1
  575. package/dist/sdk/p-6e3c210c.entry.js +0 -2
  576. package/dist/sdk/p-6e3c210c.entry.js.map +0 -1
  577. package/dist/sdk/p-6febeead.entry.js +0 -2
  578. package/dist/sdk/p-6febeead.entry.js.map +0 -1
  579. package/dist/sdk/p-73c2ec89.entry.js +0 -2
  580. package/dist/sdk/p-73c2ec89.entry.js.map +0 -1
  581. package/dist/sdk/p-745742f1.entry.js +0 -2
  582. package/dist/sdk/p-745742f1.entry.js.map +0 -1
  583. package/dist/sdk/p-7a7c0db2.entry.js +0 -2
  584. package/dist/sdk/p-7a7c0db2.entry.js.map +0 -1
  585. package/dist/sdk/p-8d787494.entry.js +0 -2
  586. package/dist/sdk/p-8d787494.entry.js.map +0 -1
  587. package/dist/sdk/p-94dde7e5.entry.js +0 -2
  588. package/dist/sdk/p-94dde7e5.entry.js.map +0 -1
  589. package/dist/sdk/p-97d8ae02.entry.js +0 -2
  590. package/dist/sdk/p-97d8ae02.entry.js.map +0 -1
  591. package/dist/sdk/p-9da4dd6d.entry.js +0 -2
  592. package/dist/sdk/p-9da4dd6d.entry.js.map +0 -1
  593. package/dist/sdk/p-BZ1kW_eK.js +0 -2
  594. package/dist/sdk/p-BZ1kW_eK.js.map +0 -1
  595. package/dist/sdk/p-BlOjABPD.js +0 -2
  596. package/dist/sdk/p-BlOjABPD.js.map +0 -1
  597. package/dist/sdk/p-BqFCd65h.js +0 -2
  598. package/dist/sdk/p-BqFCd65h.js.map +0 -1
  599. package/dist/sdk/p-C0feI0p8.js +0 -2
  600. package/dist/sdk/p-C0feI0p8.js.map +0 -1
  601. package/dist/sdk/p-CDtLILSR.js +0 -2
  602. package/dist/sdk/p-CDtLILSR.js.map +0 -1
  603. package/dist/sdk/p-CFiZLMAA.js +0 -2
  604. package/dist/sdk/p-CFiZLMAA.js.map +0 -1
  605. package/dist/sdk/p-CR1oWC4S.js +0 -2
  606. package/dist/sdk/p-CR1oWC4S.js.map +0 -1
  607. package/dist/sdk/p-Ce8zGAi1.js +0 -2
  608. package/dist/sdk/p-Ce8zGAi1.js.map +0 -1
  609. package/dist/sdk/p-Ci3aTmzp.js +0 -3
  610. package/dist/sdk/p-Ci3aTmzp.js.map +0 -1
  611. package/dist/sdk/p-D1lzXl_Z.js +0 -2
  612. package/dist/sdk/p-D1lzXl_Z.js.map +0 -1
  613. package/dist/sdk/p-D4B6Zkq_.js +0 -2
  614. package/dist/sdk/p-D4B6Zkq_.js.map +0 -1
  615. package/dist/sdk/p-D8RGdjD3.js +0 -2
  616. package/dist/sdk/p-D8RGdjD3.js.map +0 -1
  617. package/dist/sdk/p-DGqadgLO.js +0 -2
  618. package/dist/sdk/p-DGqadgLO.js.map +0 -1
  619. package/dist/sdk/p-DSwwVdp1.js +0 -2
  620. package/dist/sdk/p-DSwwVdp1.js.map +0 -1
  621. package/dist/sdk/p-DUHc_Cx7.js +0 -2
  622. package/dist/sdk/p-DUHc_Cx7.js.map +0 -1
  623. package/dist/sdk/p-DYtgart8.js +0 -2
  624. package/dist/sdk/p-DYtgart8.js.map +0 -1
  625. package/dist/sdk/p-DsSffQBc.js +0 -2
  626. package/dist/sdk/p-DsSffQBc.js.map +0 -1
  627. package/dist/sdk/p-b79abe80.entry.js +0 -2
  628. package/dist/sdk/p-b79abe80.entry.js.map +0 -1
  629. package/dist/sdk/p-bb5ae222.entry.js +0 -2
  630. package/dist/sdk/p-bb5ae222.entry.js.map +0 -1
  631. package/dist/sdk/p-bbbec3d4.entry.js +0 -2
  632. package/dist/sdk/p-bbbec3d4.entry.js.map +0 -1
  633. package/dist/sdk/p-c2b6c674.entry.js +0 -2
  634. package/dist/sdk/p-c2b6c674.entry.js.map +0 -1
  635. package/dist/sdk/p-c2fba7c8.entry.js +0 -2
  636. package/dist/sdk/p-c2fba7c8.entry.js.map +0 -1
  637. package/dist/sdk/p-cba5d81e.entry.js +0 -2
  638. package/dist/sdk/p-cba5d81e.entry.js.map +0 -1
  639. package/dist/sdk/p-d2c6179a.entry.js +0 -2
  640. package/dist/sdk/p-d2c6179a.entry.js.map +0 -1
  641. package/dist/sdk/p-dcd4e8f0.entry.js +0 -2
  642. package/dist/sdk/p-dcd4e8f0.entry.js.map +0 -1
  643. package/dist/sdk/p-eaedb08e.entry.js +0 -2
  644. package/dist/sdk/p-eaedb08e.entry.js.map +0 -1
  645. package/dist/sdk/p-f0aecd55.entry.js +0 -2
  646. package/dist/sdk/p-f0aecd55.entry.js.map +0 -1
  647. package/dist/sdk/p-fc51c88d.entry.js +0 -2
  648. package/dist/sdk/p-fc51c88d.entry.js.map +0 -1
  649. package/dist/sdk/u-field.u-raw-field.entry.esm.js.map +0 -1
  650. package/dist/sdk/u-profile.u-submit-button.entry.esm.js.map +0 -1
  651. package/loader/cdn.js +0 -1
  652. package/loader/index.cjs.js +0 -1
  653. package/loader/index.d.ts +0 -24
  654. package/loader/index.es2017.js +0 -1
  655. package/loader/index.js +0 -2
  656. /package/dist/{esm → sdk}/component-utils-D1lzXl_Z.js +0 -0
  657. /package/dist/{esm → sdk}/component-utils-D1lzXl_Z.js.map +0 -0
  658. /package/dist/{esm → sdk}/helpers-BqFCd65h.js +0 -0
  659. /package/dist/{esm → sdk}/helpers-BqFCd65h.js.map +0 -0
  660. /package/dist/{esm → sdk}/helpers-DUHc_Cx7.js +0 -0
  661. /package/dist/{esm → sdk}/helpers-DUHc_Cx7.js.map +0 -0
@@ -1,4106 +0,0 @@
1
- /**
2
- * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
3
- *
4
- * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
5
- */
6
- const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
7
-
8
- /** Internal global with common properties and Sentry extensions */
9
-
10
- /** Get's the global object for the current JavaScript runtime */
11
- const GLOBAL_OBJ = globalThis ;
12
-
13
- // This is a magic string replaced by rollup
14
-
15
- const SDK_VERSION = "10.26.0" ;
16
-
17
- /**
18
- * An object that contains globally accessible properties and maintains a scope stack.
19
- * @hidden
20
- */
21
-
22
- /**
23
- * Returns the global shim registry.
24
- *
25
- * FIXME: This function is problematic, because despite always returning a valid Carrier,
26
- * it has an optional `__SENTRY__` property, which then in turn requires us to always perform an unnecessary check
27
- * at the call-site. We always access the carrier through this function, so we can guarantee that `__SENTRY__` is there.
28
- **/
29
- function getMainCarrier() {
30
- // This ensures a Sentry carrier exists
31
- getSentryCarrier(GLOBAL_OBJ);
32
- return GLOBAL_OBJ;
33
- }
34
-
35
- /** Will either get the existing sentry carrier, or create a new one. */
36
- function getSentryCarrier(carrier) {
37
- const __SENTRY__ = (carrier.__SENTRY__ = carrier.__SENTRY__ || {});
38
-
39
- // For now: First SDK that sets the .version property wins
40
- __SENTRY__.version = __SENTRY__.version || SDK_VERSION;
41
-
42
- // Intentionally populating and returning the version of "this" SDK instance
43
- // rather than what's set in .version so that "this" SDK always gets its carrier
44
- return (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});
45
- }
46
-
47
- /**
48
- * Returns a global singleton contained in the global `__SENTRY__[]` object.
49
- *
50
- * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory
51
- * function and added to the `__SENTRY__` object.
52
- *
53
- * @param name name of the global singleton on __SENTRY__
54
- * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`
55
- * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `GLOBAL_OBJ`'s return value
56
- * @returns the singleton
57
- */
58
- function getGlobalSingleton(
59
- name,
60
- creator,
61
- obj = GLOBAL_OBJ,
62
- ) {
63
- const __SENTRY__ = (obj.__SENTRY__ = obj.__SENTRY__ || {});
64
- const carrier = (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});
65
- // Note: We do not want to set `carrier.version` here, as this may be called before any `init` is called, e.g. for the default scopes
66
- return carrier[name] || (carrier[name] = creator());
67
- }
68
-
69
- const CONSOLE_LEVELS = [
70
- 'debug',
71
- 'info',
72
- 'warn',
73
- 'error',
74
- 'log',
75
- 'assert',
76
- 'trace',
77
- ] ;
78
-
79
- /** Prefix for logging strings */
80
- const PREFIX = 'Sentry Logger ';
81
-
82
- /** This may be mutated by the console instrumentation. */
83
- const originalConsoleMethods
84
-
85
- = {};
86
-
87
- /**
88
- * Temporarily disable sentry console instrumentations.
89
- *
90
- * @param callback The function to run against the original `console` messages
91
- * @returns The results of the callback
92
- */
93
- function consoleSandbox(callback) {
94
- if (!('console' in GLOBAL_OBJ)) {
95
- return callback();
96
- }
97
-
98
- const console = GLOBAL_OBJ.console;
99
- const wrappedFuncs = {};
100
-
101
- const wrappedLevels = Object.keys(originalConsoleMethods) ;
102
-
103
- // Restore all wrapped console methods
104
- wrappedLevels.forEach(level => {
105
- const originalConsoleMethod = originalConsoleMethods[level];
106
- wrappedFuncs[level] = console[level] ;
107
- console[level] = originalConsoleMethod ;
108
- });
109
-
110
- try {
111
- return callback();
112
- } finally {
113
- // Revert restoration to wrapped state
114
- wrappedLevels.forEach(level => {
115
- console[level] = wrappedFuncs[level] ;
116
- });
117
- }
118
- }
119
-
120
- function enable() {
121
- _getLoggerSettings().enabled = true;
122
- }
123
-
124
- function disable() {
125
- _getLoggerSettings().enabled = false;
126
- }
127
-
128
- function isEnabled() {
129
- return _getLoggerSettings().enabled;
130
- }
131
-
132
- function log(...args) {
133
- _maybeLog('log', ...args);
134
- }
135
-
136
- function warn(...args) {
137
- _maybeLog('warn', ...args);
138
- }
139
-
140
- function error(...args) {
141
- _maybeLog('error', ...args);
142
- }
143
-
144
- function _maybeLog(level, ...args) {
145
- if (!DEBUG_BUILD) {
146
- return;
147
- }
148
-
149
- if (isEnabled()) {
150
- consoleSandbox(() => {
151
- GLOBAL_OBJ.console[level](`${PREFIX}[${level}]:`, ...args);
152
- });
153
- }
154
- }
155
-
156
- function _getLoggerSettings() {
157
- if (!DEBUG_BUILD) {
158
- return { enabled: false };
159
- }
160
-
161
- return getGlobalSingleton('loggerSettings', () => ({ enabled: false }));
162
- }
163
-
164
- /**
165
- * This is a logger singleton which either logs things or no-ops if logging is not enabled.
166
- */
167
- const debug = {
168
- /** Enable logging. */
169
- enable,
170
- /** Disable logging. */
171
- disable,
172
- /** Check if logging is enabled. */
173
- isEnabled,
174
- /** Log a message. */
175
- log,
176
- /** Log a warning. */
177
- warn,
178
- /** Log an error. */
179
- error,
180
- } ;
181
-
182
- const STACKTRACE_FRAME_LIMIT = 50;
183
- const UNKNOWN_FUNCTION = '?';
184
- // Used to sanitize webpack (error: *) wrapped stack errors
185
- const WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
186
- const STRIP_FRAME_REGEXP = /captureMessage|captureException/;
187
-
188
- /**
189
- * Creates a stack parser with the supplied line parsers
190
- *
191
- * StackFrames are returned in the correct order for Sentry Exception
192
- * frames and with Sentry SDK internal frames removed from the top and bottom
193
- *
194
- */
195
- function createStackParser(...parsers) {
196
- const sortedParsers = parsers.sort((a, b) => a[0] - b[0]).map(p => p[1]);
197
-
198
- return (stack, skipFirstLines = 0, framesToPop = 0) => {
199
- const frames = [];
200
- const lines = stack.split('\n');
201
-
202
- for (let i = skipFirstLines; i < lines.length; i++) {
203
- let line = lines[i] ;
204
- // Truncate lines over 1kb because many of the regular expressions use
205
- // backtracking which results in run time that increases exponentially
206
- // with input size. Huge strings can result in hangs/Denial of Service:
207
- // https://github.com/getsentry/sentry-javascript/issues/2286
208
- if (line.length > 1024) {
209
- line = line.slice(0, 1024);
210
- }
211
-
212
- // https://github.com/getsentry/sentry-javascript/issues/5459
213
- // Remove webpack (error: *) wrappers
214
- const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, '$1') : line;
215
-
216
- // https://github.com/getsentry/sentry-javascript/issues/7813
217
- // Skip Error: lines
218
- if (cleanedLine.match(/\S*Error: /)) {
219
- continue;
220
- }
221
-
222
- for (const parser of sortedParsers) {
223
- const frame = parser(cleanedLine);
224
-
225
- if (frame) {
226
- frames.push(frame);
227
- break;
228
- }
229
- }
230
-
231
- if (frames.length >= STACKTRACE_FRAME_LIMIT + framesToPop) {
232
- break;
233
- }
234
- }
235
-
236
- return stripSentryFramesAndReverse(frames.slice(framesToPop));
237
- };
238
- }
239
-
240
- /**
241
- * Gets a stack parser implementation from Options.stackParser
242
- * @see Options
243
- *
244
- * If options contains an array of line parsers, it is converted into a parser
245
- */
246
- function stackParserFromStackParserOptions(stackParser) {
247
- if (Array.isArray(stackParser)) {
248
- return createStackParser(...stackParser);
249
- }
250
- return stackParser;
251
- }
252
-
253
- /**
254
- * Removes Sentry frames from the top and bottom of the stack if present and enforces a limit of max number of frames.
255
- * Assumes stack input is ordered from top to bottom and returns the reverse representation so call site of the
256
- * function that caused the crash is the last frame in the array.
257
- * @hidden
258
- */
259
- function stripSentryFramesAndReverse(stack) {
260
- if (!stack.length) {
261
- return [];
262
- }
263
-
264
- const localStack = Array.from(stack);
265
-
266
- // If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)
267
- if (/sentryWrapped/.test(getLastStackFrame(localStack).function || '')) {
268
- localStack.pop();
269
- }
270
-
271
- // Reversing in the middle of the procedure allows us to just pop the values off the stack
272
- localStack.reverse();
273
-
274
- // If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)
275
- if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || '')) {
276
- localStack.pop();
277
-
278
- // When using synthetic events, we will have a 2 levels deep stack, as `new Error('Sentry syntheticException')`
279
- // is produced within the scope itself, making it:
280
- //
281
- // Sentry.captureException()
282
- // scope.captureException()
283
- //
284
- // instead of just the top `Sentry` call itself.
285
- // This forces us to possibly strip an additional frame in the exact same was as above.
286
- if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || '')) {
287
- localStack.pop();
288
- }
289
- }
290
-
291
- return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map(frame => ({
292
- ...frame,
293
- filename: frame.filename || getLastStackFrame(localStack).filename,
294
- function: frame.function || UNKNOWN_FUNCTION,
295
- }));
296
- }
297
-
298
- function getLastStackFrame(arr) {
299
- return arr[arr.length - 1] || {};
300
- }
301
-
302
- const defaultFunctionName = '<anonymous>';
303
-
304
- /**
305
- * Safely extract function name from itself
306
- */
307
- function getFunctionName(fn) {
308
- try {
309
- if (!fn || typeof fn !== 'function') {
310
- return defaultFunctionName;
311
- }
312
- return fn.name || defaultFunctionName;
313
- } catch {
314
- // Just accessing custom props in some Selenium environments
315
- // can cause a "Permission denied" exception (see raven-js#495).
316
- return defaultFunctionName;
317
- }
318
- }
319
-
320
- /**
321
- * Get's stack frames from an event without needing to check for undefined properties.
322
- */
323
- function getFramesFromEvent(event) {
324
- const exception = event.exception;
325
-
326
- if (exception) {
327
- const frames = [];
328
- try {
329
- // @ts-expect-error Object could be undefined
330
- exception.values.forEach(value => {
331
- // @ts-expect-error Value could be undefined
332
- if (value.stacktrace.frames) {
333
- // @ts-expect-error Value could be undefined
334
- frames.push(...value.stacktrace.frames);
335
- }
336
- });
337
- return frames;
338
- } catch {
339
- return undefined;
340
- }
341
- }
342
- return undefined;
343
- }
344
-
345
- /**
346
- * Get the internal name of an internal Vue value, to represent it in a stacktrace.
347
- *
348
- * @param value The value to get the internal name of.
349
- */
350
- function getVueInternalName(value) {
351
- // Check if it's a VNode (has __v_isVNode) or a component instance (has _isVue/__isVue)
352
- const isVNode = '__v_isVNode' in value && value.__v_isVNode;
353
-
354
- return isVNode ? '[VueVNode]' : '[VueViewModel]';
355
- }
356
-
357
- // eslint-disable-next-line @typescript-eslint/unbound-method
358
- const objectToString = Object.prototype.toString;
359
-
360
- /**
361
- * Checks whether given value's type is one of a few Error or Error-like
362
- * {@link isError}.
363
- *
364
- * @param wat A value to be checked.
365
- * @returns A boolean representing the result.
366
- */
367
- function isError(wat) {
368
- switch (objectToString.call(wat)) {
369
- case '[object Error]':
370
- case '[object Exception]':
371
- case '[object DOMException]':
372
- case '[object WebAssembly.Exception]':
373
- return true;
374
- default:
375
- return isInstanceOf(wat, Error);
376
- }
377
- }
378
- /**
379
- * Checks whether given value is an instance of the given built-in class.
380
- *
381
- * @param wat The value to be checked
382
- * @param className
383
- * @returns A boolean representing the result.
384
- */
385
- function isBuiltin(wat, className) {
386
- return objectToString.call(wat) === `[object ${className}]`;
387
- }
388
-
389
- /**
390
- * Checks whether given value's type is ErrorEvent
391
- * {@link isErrorEvent}.
392
- *
393
- * @param wat A value to be checked.
394
- * @returns A boolean representing the result.
395
- */
396
- function isErrorEvent(wat) {
397
- return isBuiltin(wat, 'ErrorEvent');
398
- }
399
-
400
- /**
401
- * Checks whether given value's type is DOMError
402
- * {@link isDOMError}.
403
- *
404
- * @param wat A value to be checked.
405
- * @returns A boolean representing the result.
406
- */
407
- function isDOMError(wat) {
408
- return isBuiltin(wat, 'DOMError');
409
- }
410
-
411
- /**
412
- * Checks whether given value's type is DOMException
413
- * {@link isDOMException}.
414
- *
415
- * @param wat A value to be checked.
416
- * @returns A boolean representing the result.
417
- */
418
- function isDOMException(wat) {
419
- return isBuiltin(wat, 'DOMException');
420
- }
421
-
422
- /**
423
- * Checks whether given value's type is a string
424
- * {@link isString}.
425
- *
426
- * @param wat A value to be checked.
427
- * @returns A boolean representing the result.
428
- */
429
- function isString(wat) {
430
- return isBuiltin(wat, 'String');
431
- }
432
-
433
- /**
434
- * Checks whether given string is parameterized
435
- * {@link isParameterizedString}.
436
- *
437
- * @param wat A value to be checked.
438
- * @returns A boolean representing the result.
439
- */
440
- function isParameterizedString(wat) {
441
- return (
442
- typeof wat === 'object' &&
443
- wat !== null &&
444
- '__sentry_template_string__' in wat &&
445
- '__sentry_template_values__' in wat
446
- );
447
- }
448
-
449
- /**
450
- * Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)
451
- * {@link isPrimitive}.
452
- *
453
- * @param wat A value to be checked.
454
- * @returns A boolean representing the result.
455
- */
456
- function isPrimitive(wat) {
457
- return wat === null || isParameterizedString(wat) || (typeof wat !== 'object' && typeof wat !== 'function');
458
- }
459
-
460
- /**
461
- * Checks whether given value's type is an object literal, or a class instance.
462
- * {@link isPlainObject}.
463
- *
464
- * @param wat A value to be checked.
465
- * @returns A boolean representing the result.
466
- */
467
- function isPlainObject(wat) {
468
- return isBuiltin(wat, 'Object');
469
- }
470
-
471
- /**
472
- * Checks whether given value's type is an Event instance
473
- * {@link isEvent}.
474
- *
475
- * @param wat A value to be checked.
476
- * @returns A boolean representing the result.
477
- */
478
- function isEvent(wat) {
479
- return typeof Event !== 'undefined' && isInstanceOf(wat, Event);
480
- }
481
-
482
- /**
483
- * Checks whether given value's type is an Element instance
484
- * {@link isElement}.
485
- *
486
- * @param wat A value to be checked.
487
- * @returns A boolean representing the result.
488
- */
489
- function isElement(wat) {
490
- return typeof Element !== 'undefined' && isInstanceOf(wat, Element);
491
- }
492
-
493
- /**
494
- * Checks whether given value's type is an regexp
495
- * {@link isRegExp}.
496
- *
497
- * @param wat A value to be checked.
498
- * @returns A boolean representing the result.
499
- */
500
- function isRegExp(wat) {
501
- return isBuiltin(wat, 'RegExp');
502
- }
503
-
504
- /**
505
- * Checks whether given value has a then function.
506
- * @param wat A value to be checked.
507
- */
508
- function isThenable(wat) {
509
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
510
- return Boolean(wat?.then && typeof wat.then === 'function');
511
- }
512
-
513
- /**
514
- * Checks whether given value's type is a SyntheticEvent
515
- * {@link isSyntheticEvent}.
516
- *
517
- * @param wat A value to be checked.
518
- * @returns A boolean representing the result.
519
- */
520
- function isSyntheticEvent(wat) {
521
- return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat;
522
- }
523
-
524
- /**
525
- * Checks whether given value's type is an instance of provided constructor.
526
- * {@link isInstanceOf}.
527
- *
528
- * @param wat A value to be checked.
529
- * @param base A constructor to be used in a check.
530
- * @returns A boolean representing the result.
531
- */
532
- function isInstanceOf(wat, base) {
533
- try {
534
- return wat instanceof base;
535
- } catch {
536
- return false;
537
- }
538
- }
539
-
540
- /**
541
- * Checks whether given value's type is a Vue ViewModel or a VNode.
542
- *
543
- * @param wat A value to be checked.
544
- * @returns A boolean representing the result.
545
- */
546
- function isVueViewModel(wat) {
547
- // Not using Object.prototype.toString because in Vue 3 it would read the instance's Symbol(Symbol.toStringTag) property.
548
- // We also need to check for __v_isVNode because Vue 3 component render instances have an internal __v_isVNode property.
549
- return !!(
550
- typeof wat === 'object' &&
551
- wat !== null &&
552
- ((wat ).__isVue || (wat )._isVue || (wat ).__v_isVNode)
553
- );
554
- }
555
-
556
- /**
557
- * Checks whether the given parameter is a Standard Web API Request instance.
558
- *
559
- * Returns false if Request is not available in the current runtime.
560
- */
561
- function isRequest(request) {
562
- return typeof Request !== 'undefined' && isInstanceOf(request, Request);
563
- }
564
-
565
- const WINDOW = GLOBAL_OBJ ;
566
-
567
- const DEFAULT_MAX_STRING_LENGTH = 80;
568
-
569
- /**
570
- * Given a child DOM element, returns a query-selector statement describing that
571
- * and its ancestors
572
- * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]
573
- * @returns generated DOM path
574
- */
575
- function htmlTreeAsString(
576
- elem,
577
- options = {},
578
- ) {
579
- if (!elem) {
580
- return '<unknown>';
581
- }
582
-
583
- // try/catch both:
584
- // - accessing event.target (see getsentry/raven-js#838, #768)
585
- // - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly
586
- // - can throw an exception in some circumstances.
587
- try {
588
- let currentElem = elem ;
589
- const MAX_TRAVERSE_HEIGHT = 5;
590
- const out = [];
591
- let height = 0;
592
- let len = 0;
593
- const separator = ' > ';
594
- const sepLength = separator.length;
595
- let nextStr;
596
- const keyAttrs = Array.isArray(options) ? options : options.keyAttrs;
597
- const maxStringLength = (!Array.isArray(options) && options.maxStringLength) || DEFAULT_MAX_STRING_LENGTH;
598
-
599
- while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) {
600
- nextStr = _htmlElementAsString(currentElem, keyAttrs);
601
- // bail out if
602
- // - nextStr is the 'html' element
603
- // - the length of the string that would be created exceeds maxStringLength
604
- // (ignore this limit if we are on the first iteration)
605
- if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= maxStringLength)) {
606
- break;
607
- }
608
-
609
- out.push(nextStr);
610
-
611
- len += nextStr.length;
612
- currentElem = currentElem.parentNode;
613
- }
614
-
615
- return out.reverse().join(separator);
616
- } catch {
617
- return '<unknown>';
618
- }
619
- }
620
-
621
- /**
622
- * Returns a simple, query-selector representation of a DOM element
623
- * e.g. [HTMLElement] => input#foo.btn[name=baz]
624
- * @returns generated DOM path
625
- */
626
- function _htmlElementAsString(el, keyAttrs) {
627
- const elem = el
628
-
629
- ;
630
-
631
- const out = [];
632
-
633
- if (!elem?.tagName) {
634
- return '';
635
- }
636
-
637
- // @ts-expect-error WINDOW has HTMLElement
638
- if (WINDOW.HTMLElement) {
639
- // If using the component name annotation plugin, this value may be available on the DOM node
640
- if (elem instanceof HTMLElement && elem.dataset) {
641
- if (elem.dataset['sentryComponent']) {
642
- return elem.dataset['sentryComponent'];
643
- }
644
- if (elem.dataset['sentryElement']) {
645
- return elem.dataset['sentryElement'];
646
- }
647
- }
648
- }
649
-
650
- out.push(elem.tagName.toLowerCase());
651
-
652
- // Pairs of attribute keys defined in `serializeAttribute` and their values on element.
653
- const keyAttrPairs = keyAttrs?.length
654
- ? keyAttrs.filter(keyAttr => elem.getAttribute(keyAttr)).map(keyAttr => [keyAttr, elem.getAttribute(keyAttr)])
655
- : null;
656
-
657
- if (keyAttrPairs?.length) {
658
- keyAttrPairs.forEach(keyAttrPair => {
659
- out.push(`[${keyAttrPair[0]}="${keyAttrPair[1]}"]`);
660
- });
661
- } else {
662
- if (elem.id) {
663
- out.push(`#${elem.id}`);
664
- }
665
-
666
- const className = elem.className;
667
- if (className && isString(className)) {
668
- const classes = className.split(/\s+/);
669
- for (const c of classes) {
670
- out.push(`.${c}`);
671
- }
672
- }
673
- }
674
- const allowedAttrs = ['aria-label', 'type', 'name', 'title', 'alt'];
675
- for (const k of allowedAttrs) {
676
- const attr = elem.getAttribute(k);
677
- if (attr) {
678
- out.push(`[${k}="${attr}"]`);
679
- }
680
- }
681
-
682
- return out.join('');
683
- }
684
-
685
- /**
686
- * A safe form of location.href
687
- */
688
- function getLocationHref() {
689
- try {
690
- return WINDOW.document.location.href;
691
- } catch {
692
- return '';
693
- }
694
- }
695
-
696
- /**
697
- * Given a DOM element, traverses up the tree until it finds the first ancestor node
698
- * that has the `data-sentry-component` or `data-sentry-element` attribute with `data-sentry-component` taking
699
- * precedence. This attribute is added at build-time by projects that have the component name annotation plugin installed.
700
- *
701
- * @returns a string representation of the component for the provided DOM element, or `null` if not found
702
- */
703
- function getComponentName(elem) {
704
- // @ts-expect-error WINDOW has HTMLElement
705
- if (!WINDOW.HTMLElement) {
706
- return null;
707
- }
708
-
709
- let currentElem = elem ;
710
- const MAX_TRAVERSE_HEIGHT = 5;
711
- for (let i = 0; i < MAX_TRAVERSE_HEIGHT; i++) {
712
- if (!currentElem) {
713
- return null;
714
- }
715
-
716
- if (currentElem instanceof HTMLElement) {
717
- if (currentElem.dataset['sentryComponent']) {
718
- return currentElem.dataset['sentryComponent'];
719
- }
720
- if (currentElem.dataset['sentryElement']) {
721
- return currentElem.dataset['sentryElement'];
722
- }
723
- }
724
-
725
- currentElem = currentElem.parentNode;
726
- }
727
-
728
- return null;
729
- }
730
-
731
- /* eslint-disable @typescript-eslint/no-explicit-any */
732
-
733
- /**
734
- * Replace a method in an object with a wrapped version of itself.
735
- *
736
- * If the method on the passed object is not a function, the wrapper will not be applied.
737
- *
738
- * @param source An object that contains a method to be wrapped.
739
- * @param name The name of the method to be wrapped.
740
- * @param replacementFactory A higher-order function that takes the original version of the given method and returns a
741
- * wrapped version. Note: The function returned by `replacementFactory` needs to be a non-arrow function, in order to
742
- * preserve the correct value of `this`, and the original method must be called using `origMethod.call(this, <other
743
- * args>)` or `origMethod.apply(this, [<other args>])` (rather than being called directly), again to preserve `this`.
744
- * @returns void
745
- */
746
- function fill(source, name, replacementFactory) {
747
- if (!(name in source)) {
748
- return;
749
- }
750
-
751
- // explicitly casting to unknown because we don't know the type of the method initially at all
752
- const original = source[name] ;
753
-
754
- if (typeof original !== 'function') {
755
- return;
756
- }
757
-
758
- const wrapped = replacementFactory(original) ;
759
-
760
- // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work
761
- // otherwise it'll throw "TypeError: Object.defineProperties called on non-object"
762
- if (typeof wrapped === 'function') {
763
- markFunctionWrapped(wrapped, original);
764
- }
765
-
766
- try {
767
- source[name] = wrapped;
768
- } catch {
769
- DEBUG_BUILD && debug.log(`Failed to replace method "${name}" in object`, source);
770
- }
771
- }
772
-
773
- /**
774
- * Defines a non-enumerable property on the given object.
775
- *
776
- * @param obj The object on which to set the property
777
- * @param name The name of the property to be set
778
- * @param value The value to which to set the property
779
- */
780
- function addNonEnumerableProperty(obj, name, value) {
781
- try {
782
- Object.defineProperty(obj, name, {
783
- // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it
784
- value: value,
785
- writable: true,
786
- configurable: true,
787
- });
788
- } catch {
789
- DEBUG_BUILD && debug.log(`Failed to add non-enumerable property "${name}" to object`, obj);
790
- }
791
- }
792
-
793
- /**
794
- * Remembers the original function on the wrapped function and
795
- * patches up the prototype.
796
- *
797
- * @param wrapped the wrapper function
798
- * @param original the original function that gets wrapped
799
- */
800
- function markFunctionWrapped(wrapped, original) {
801
- try {
802
- const proto = original.prototype || {};
803
- wrapped.prototype = original.prototype = proto;
804
- addNonEnumerableProperty(wrapped, '__sentry_original__', original);
805
- } catch {} // eslint-disable-line no-empty
806
- }
807
-
808
- /**
809
- * This extracts the original function if available. See
810
- * `markFunctionWrapped` for more information.
811
- *
812
- * @param func the function to unwrap
813
- * @returns the unwrapped version of the function if available.
814
- */
815
- // eslint-disable-next-line @typescript-eslint/ban-types
816
- function getOriginalFunction(func) {
817
- return func.__sentry_original__;
818
- }
819
-
820
- /**
821
- * Transforms any `Error` or `Event` into a plain object with all of their enumerable properties, and some of their
822
- * non-enumerable properties attached.
823
- *
824
- * @param value Initial source that we have to transform in order for it to be usable by the serializer
825
- * @returns An Event or Error turned into an object - or the value argument itself, when value is neither an Event nor
826
- * an Error.
827
- */
828
- function convertToPlainObject(value)
829
-
830
- {
831
- if (isError(value)) {
832
- return {
833
- message: value.message,
834
- name: value.name,
835
- stack: value.stack,
836
- ...getOwnProperties(value),
837
- };
838
- } else if (isEvent(value)) {
839
- const newObj
840
-
841
- = {
842
- type: value.type,
843
- target: serializeEventTarget(value.target),
844
- currentTarget: serializeEventTarget(value.currentTarget),
845
- ...getOwnProperties(value),
846
- };
847
-
848
- if (typeof CustomEvent !== 'undefined' && isInstanceOf(value, CustomEvent)) {
849
- newObj.detail = value.detail;
850
- }
851
-
852
- return newObj;
853
- } else {
854
- return value;
855
- }
856
- }
857
-
858
- /** Creates a string representation of the target of an `Event` object */
859
- function serializeEventTarget(target) {
860
- try {
861
- return isElement(target) ? htmlTreeAsString(target) : Object.prototype.toString.call(target);
862
- } catch {
863
- return '<unknown>';
864
- }
865
- }
866
-
867
- /** Filters out all but an object's own properties */
868
- function getOwnProperties(obj) {
869
- if (typeof obj === 'object' && obj !== null) {
870
- const extractedProps = {};
871
- for (const property in obj) {
872
- if (Object.prototype.hasOwnProperty.call(obj, property)) {
873
- extractedProps[property] = (obj )[property];
874
- }
875
- }
876
- return extractedProps;
877
- } else {
878
- return {};
879
- }
880
- }
881
-
882
- /**
883
- * Given any captured exception, extract its keys and create a sorted
884
- * and truncated list that will be used inside the event message.
885
- * eg. `Non-error exception captured with keys: foo, bar, baz`
886
- */
887
- function extractExceptionKeysForMessage(exception) {
888
- const keys = Object.keys(convertToPlainObject(exception));
889
- keys.sort();
890
-
891
- return !keys[0] ? '[object has no keys]' : keys.join(', ');
892
- }
893
-
894
- /**
895
- * Truncates given string to the maximum characters count
896
- *
897
- * @param str An object that contains serializable values
898
- * @param max Maximum number of characters in truncated string (0 = unlimited)
899
- * @returns string Encoded
900
- */
901
- function truncate(str, max = 0) {
902
- if (typeof str !== 'string' || max === 0) {
903
- return str;
904
- }
905
- return str.length <= max ? str : `${str.slice(0, max)}...`;
906
- }
907
-
908
- /**
909
- * Join values in array
910
- * @param input array of values to be joined together
911
- * @param delimiter string to be placed in-between values
912
- * @returns Joined values
913
- */
914
- function safeJoin(input, delimiter) {
915
- if (!Array.isArray(input)) {
916
- return '';
917
- }
918
-
919
- const output = [];
920
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
921
- for (let i = 0; i < input.length; i++) {
922
- const value = input[i];
923
- try {
924
- // This is a hack to fix a Vue3-specific bug that causes an infinite loop of
925
- // console warnings. This happens when a Vue template is rendered with
926
- // an undeclared variable, which we try to stringify, ultimately causing
927
- // Vue to issue another warning which repeats indefinitely.
928
- // see: https://github.com/getsentry/sentry-javascript/pull/8981
929
- if (isVueViewModel(value)) {
930
- output.push(getVueInternalName(value));
931
- } else {
932
- output.push(String(value));
933
- }
934
- } catch {
935
- output.push('[value cannot be serialized]');
936
- }
937
- }
938
-
939
- return output.join(delimiter);
940
- }
941
-
942
- /**
943
- * Checks if the given value matches a regex or string
944
- *
945
- * @param value The string to test
946
- * @param pattern Either a regex or a string against which `value` will be matched
947
- * @param requireExactStringMatch If true, `value` must match `pattern` exactly. If false, `value` will match
948
- * `pattern` if it contains `pattern`. Only applies to string-type patterns.
949
- */
950
- function isMatchingPattern(
951
- value,
952
- pattern,
953
- requireExactStringMatch = false,
954
- ) {
955
- if (!isString(value)) {
956
- return false;
957
- }
958
-
959
- if (isRegExp(pattern)) {
960
- return pattern.test(value);
961
- }
962
- if (isString(pattern)) {
963
- return requireExactStringMatch ? value === pattern : value.includes(pattern);
964
- }
965
-
966
- return false;
967
- }
968
-
969
- /**
970
- * Test the given string against an array of strings and regexes. By default, string matching is done on a
971
- * substring-inclusion basis rather than a strict equality basis
972
- *
973
- * @param testString The string to test
974
- * @param patterns The patterns against which to test the string
975
- * @param requireExactStringMatch If true, `testString` must match one of the given string patterns exactly in order to
976
- * count. If false, `testString` will match a string pattern if it contains that pattern.
977
- * @returns
978
- */
979
- function stringMatchesSomePattern(
980
- testString,
981
- patterns = [],
982
- requireExactStringMatch = false,
983
- ) {
984
- return patterns.some(pattern => isMatchingPattern(testString, pattern, requireExactStringMatch));
985
- }
986
-
987
- function getCrypto() {
988
- const gbl = GLOBAL_OBJ ;
989
- return gbl.crypto || gbl.msCrypto;
990
- }
991
-
992
- let emptyUuid;
993
-
994
- function getRandomByte() {
995
- return Math.random() * 16;
996
- }
997
-
998
- /**
999
- * UUID4 generator
1000
- * @param crypto Object that provides the crypto API.
1001
- * @returns string Generated UUID4.
1002
- */
1003
- function uuid4(crypto = getCrypto()) {
1004
- try {
1005
- if (crypto?.randomUUID) {
1006
- return crypto.randomUUID().replace(/-/g, '');
1007
- }
1008
- } catch {
1009
- // some runtimes can crash invoking crypto
1010
- // https://github.com/getsentry/sentry-javascript/issues/8935
1011
- }
1012
-
1013
- if (!emptyUuid) {
1014
- // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
1015
- // Concatenating the following numbers as strings results in '10000000100040008000100000000000'
1016
- emptyUuid = ([1e7] ) + 1e3 + 4e3 + 8e3 + 1e11;
1017
- }
1018
-
1019
- return emptyUuid.replace(/[018]/g, c =>
1020
- // eslint-disable-next-line no-bitwise
1021
- ((c ) ^ ((getRandomByte() & 15) >> ((c ) / 4))).toString(16),
1022
- );
1023
- }
1024
-
1025
- function getFirstException(event) {
1026
- return event.exception?.values?.[0];
1027
- }
1028
-
1029
- /**
1030
- * Extracts either message or type+value from an event that can be used for user-facing logs
1031
- * @returns event's description
1032
- */
1033
- function getEventDescription(event) {
1034
- const { message, event_id: eventId } = event;
1035
- if (message) {
1036
- return message;
1037
- }
1038
-
1039
- const firstException = getFirstException(event);
1040
- if (firstException) {
1041
- if (firstException.type && firstException.value) {
1042
- return `${firstException.type}: ${firstException.value}`;
1043
- }
1044
- return firstException.type || firstException.value || eventId || '<unknown>';
1045
- }
1046
- return eventId || '<unknown>';
1047
- }
1048
-
1049
- /**
1050
- * Adds exception values, type and value to an synthetic Exception.
1051
- * @param event The event to modify.
1052
- * @param value Value of the exception.
1053
- * @param type Type of the exception.
1054
- * @hidden
1055
- */
1056
- function addExceptionTypeValue(event, value, type) {
1057
- const exception = (event.exception = event.exception || {});
1058
- const values = (exception.values = exception.values || []);
1059
- const firstException = (values[0] = values[0] || {});
1060
- if (!firstException.value) {
1061
- firstException.value = value || '';
1062
- }
1063
- if (!firstException.type) {
1064
- firstException.type = 'Error';
1065
- }
1066
- }
1067
-
1068
- /**
1069
- * Adds exception mechanism data to a given event. Uses defaults if the second parameter is not passed.
1070
- *
1071
- * @param event The event to modify.
1072
- * @param newMechanism Mechanism data to add to the event.
1073
- * @hidden
1074
- */
1075
- function addExceptionMechanism(event, newMechanism) {
1076
- const firstException = getFirstException(event);
1077
- if (!firstException) {
1078
- return;
1079
- }
1080
-
1081
- const defaultMechanism = { type: 'generic', handled: true };
1082
- const currentMechanism = firstException.mechanism;
1083
- firstException.mechanism = { ...defaultMechanism, ...currentMechanism, ...newMechanism };
1084
-
1085
- if (newMechanism && 'data' in newMechanism) {
1086
- const mergedData = { ...currentMechanism?.data, ...newMechanism.data };
1087
- firstException.mechanism.data = mergedData;
1088
- }
1089
- }
1090
-
1091
- /**
1092
- * Checks whether or not we've already captured the given exception (note: not an identical exception - the very object
1093
- * in question), and marks it captured if not.
1094
- *
1095
- * This is useful because it's possible for an error to get captured by more than one mechanism. After we intercept and
1096
- * record an error, we rethrow it (assuming we've intercepted it before it's reached the top-level global handlers), so
1097
- * that we don't interfere with whatever effects the error might have had were the SDK not there. At that point, because
1098
- * the error has been rethrown, it's possible for it to bubble up to some other code we've instrumented. If it's not
1099
- * caught after that, it will bubble all the way up to the global handlers (which of course we also instrument). This
1100
- * function helps us ensure that even if we encounter the same error more than once, we only record it the first time we
1101
- * see it.
1102
- *
1103
- * Note: It will ignore primitives (always return `false` and not mark them as seen), as properties can't be set on
1104
- * them. {@link: Object.objectify} can be used on exceptions to convert any that are primitives into their equivalent
1105
- * object wrapper forms so that this check will always work. However, because we need to flag the exact object which
1106
- * will get rethrown, and because that rethrowing happens outside of the event processing pipeline, the objectification
1107
- * must be done before the exception captured.
1108
- *
1109
- * @param A thrown exception to check or flag as having been seen
1110
- * @returns `true` if the exception has already been captured, `false` if not (with the side effect of marking it seen)
1111
- */
1112
- function checkOrSetAlreadyCaught(exception) {
1113
- if (isAlreadyCaptured(exception)) {
1114
- return true;
1115
- }
1116
-
1117
- try {
1118
- // set it this way rather than by assignment so that it's not ennumerable and therefore isn't recorded by the
1119
- // `ExtraErrorData` integration
1120
- addNonEnumerableProperty(exception , '__sentry_captured__', true);
1121
- } catch {
1122
- // `exception` is a primitive, so we can't mark it seen
1123
- }
1124
-
1125
- return false;
1126
- }
1127
-
1128
- function isAlreadyCaptured(exception) {
1129
- try {
1130
- return (exception ).__sentry_captured__;
1131
- } catch {} // eslint-disable-line no-empty
1132
- }
1133
-
1134
- const ONE_SECOND_IN_MS = 1000;
1135
-
1136
- /**
1137
- * A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}
1138
- * for accessing a high-resolution monotonic clock.
1139
- */
1140
-
1141
- /**
1142
- * Returns a timestamp in seconds since the UNIX epoch using the Date API.
1143
- */
1144
- function dateTimestampInSeconds() {
1145
- return Date.now() / ONE_SECOND_IN_MS;
1146
- }
1147
-
1148
- /**
1149
- * Returns a wrapper around the native Performance API browser implementation, or undefined for browsers that do not
1150
- * support the API.
1151
- *
1152
- * Wrapping the native API works around differences in behavior from different browsers.
1153
- */
1154
- function createUnixTimestampInSecondsFunc() {
1155
- const { performance } = GLOBAL_OBJ ;
1156
- // Some browser and environments don't have a performance or timeOrigin, so we fallback to
1157
- // using Date.now() to compute the starting time.
1158
- if (!performance?.now || !performance.timeOrigin) {
1159
- return dateTimestampInSeconds;
1160
- }
1161
-
1162
- const timeOrigin = performance.timeOrigin;
1163
-
1164
- // performance.now() is a monotonic clock, which means it starts at 0 when the process begins. To get the current
1165
- // wall clock time (actual UNIX timestamp), we need to add the starting time origin and the current time elapsed.
1166
- //
1167
- // TODO: This does not account for the case where the monotonic clock that powers performance.now() drifts from the
1168
- // wall clock time, which causes the returned timestamp to be inaccurate. We should investigate how to detect and
1169
- // correct for this.
1170
- // See: https://github.com/getsentry/sentry-javascript/issues/2590
1171
- // See: https://github.com/mdn/content/issues/4713
1172
- // See: https://dev.to/noamr/when-a-millisecond-is-not-a-millisecond-3h6
1173
- return () => {
1174
- return (timeOrigin + performance.now()) / ONE_SECOND_IN_MS;
1175
- };
1176
- }
1177
-
1178
- let _cachedTimestampInSeconds;
1179
-
1180
- /**
1181
- * Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the
1182
- * availability of the Performance API.
1183
- *
1184
- * BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is
1185
- * asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The
1186
- * skew can grow to arbitrary amounts like days, weeks or months.
1187
- * See https://github.com/getsentry/sentry-javascript/issues/2590.
1188
- */
1189
- function timestampInSeconds() {
1190
- // We store this in a closure so that we don't have to create a new function every time this is called.
1191
- const func = _cachedTimestampInSeconds ?? (_cachedTimestampInSeconds = createUnixTimestampInSecondsFunc());
1192
- return func();
1193
- }
1194
-
1195
- /**
1196
- * Creates a new `Session` object by setting certain default parameters. If optional @param context
1197
- * is passed, the passed properties are applied to the session object.
1198
- *
1199
- * @param context (optional) additional properties to be applied to the returned session object
1200
- *
1201
- * @returns a new `Session` object
1202
- */
1203
- function makeSession(context) {
1204
- // Both timestamp and started are in seconds since the UNIX epoch.
1205
- const startingTime = timestampInSeconds();
1206
-
1207
- const session = {
1208
- sid: uuid4(),
1209
- init: true,
1210
- timestamp: startingTime,
1211
- started: startingTime,
1212
- duration: 0,
1213
- status: 'ok',
1214
- errors: 0,
1215
- ignoreDuration: false,
1216
- toJSON: () => sessionToJSON(session),
1217
- };
1218
-
1219
- if (context) {
1220
- updateSession(session, context);
1221
- }
1222
-
1223
- return session;
1224
- }
1225
-
1226
- /**
1227
- * Updates a session object with the properties passed in the context.
1228
- *
1229
- * Note that this function mutates the passed object and returns void.
1230
- * (Had to do this instead of returning a new and updated session because closing and sending a session
1231
- * makes an update to the session after it was passed to the sending logic.
1232
- * @see Client.captureSession )
1233
- *
1234
- * @param session the `Session` to update
1235
- * @param context the `SessionContext` holding the properties that should be updated in @param session
1236
- */
1237
- // eslint-disable-next-line complexity
1238
- function updateSession(session, context = {}) {
1239
- if (context.user) {
1240
- if (!session.ipAddress && context.user.ip_address) {
1241
- session.ipAddress = context.user.ip_address;
1242
- }
1243
-
1244
- if (!session.did && !context.did) {
1245
- session.did = context.user.id || context.user.email || context.user.username;
1246
- }
1247
- }
1248
-
1249
- session.timestamp = context.timestamp || timestampInSeconds();
1250
-
1251
- if (context.abnormal_mechanism) {
1252
- session.abnormal_mechanism = context.abnormal_mechanism;
1253
- }
1254
-
1255
- if (context.ignoreDuration) {
1256
- session.ignoreDuration = context.ignoreDuration;
1257
- }
1258
- if (context.sid) {
1259
- // Good enough uuid validation. — Kamil
1260
- session.sid = context.sid.length === 32 ? context.sid : uuid4();
1261
- }
1262
- if (context.init !== undefined) {
1263
- session.init = context.init;
1264
- }
1265
- if (!session.did && context.did) {
1266
- session.did = `${context.did}`;
1267
- }
1268
- if (typeof context.started === 'number') {
1269
- session.started = context.started;
1270
- }
1271
- if (session.ignoreDuration) {
1272
- session.duration = undefined;
1273
- } else if (typeof context.duration === 'number') {
1274
- session.duration = context.duration;
1275
- } else {
1276
- const duration = session.timestamp - session.started;
1277
- session.duration = duration >= 0 ? duration : 0;
1278
- }
1279
- if (context.release) {
1280
- session.release = context.release;
1281
- }
1282
- if (context.environment) {
1283
- session.environment = context.environment;
1284
- }
1285
- if (!session.ipAddress && context.ipAddress) {
1286
- session.ipAddress = context.ipAddress;
1287
- }
1288
- if (!session.userAgent && context.userAgent) {
1289
- session.userAgent = context.userAgent;
1290
- }
1291
- if (typeof context.errors === 'number') {
1292
- session.errors = context.errors;
1293
- }
1294
- if (context.status) {
1295
- session.status = context.status;
1296
- }
1297
- }
1298
-
1299
- /**
1300
- * Closes a session by setting its status and updating the session object with it.
1301
- * Internally calls `updateSession` to update the passed session object.
1302
- *
1303
- * Note that this function mutates the passed session (@see updateSession for explanation).
1304
- *
1305
- * @param session the `Session` object to be closed
1306
- * @param status the `SessionStatus` with which the session was closed. If you don't pass a status,
1307
- * this function will keep the previously set status, unless it was `'ok'` in which case
1308
- * it is changed to `'exited'`.
1309
- */
1310
- function closeSession(session, status) {
1311
- let context = {};
1312
- if (session.status === 'ok') {
1313
- context = { status: 'exited' };
1314
- }
1315
-
1316
- updateSession(session, context);
1317
- }
1318
-
1319
- /**
1320
- * Serializes a passed session object to a JSON object with a slightly different structure.
1321
- * This is necessary because the Sentry backend requires a slightly different schema of a session
1322
- * than the one the JS SDKs use internally.
1323
- *
1324
- * @param session the session to be converted
1325
- *
1326
- * @returns a JSON object of the passed session
1327
- */
1328
- function sessionToJSON(session) {
1329
- return {
1330
- sid: `${session.sid}`,
1331
- init: session.init,
1332
- // Make sure that sec is converted to ms for date constructor
1333
- started: new Date(session.started * 1000).toISOString(),
1334
- timestamp: new Date(session.timestamp * 1000).toISOString(),
1335
- status: session.status,
1336
- errors: session.errors,
1337
- did: typeof session.did === 'number' || typeof session.did === 'string' ? `${session.did}` : undefined,
1338
- duration: session.duration,
1339
- abnormal_mechanism: session.abnormal_mechanism,
1340
- attrs: {
1341
- release: session.release,
1342
- environment: session.environment,
1343
- ip_address: session.ipAddress,
1344
- user_agent: session.userAgent,
1345
- },
1346
- };
1347
- }
1348
-
1349
- /**
1350
- * Shallow merge two objects.
1351
- * Does not mutate the passed in objects.
1352
- * Undefined/empty values in the merge object will overwrite existing values.
1353
- *
1354
- * By default, this merges 2 levels deep.
1355
- */
1356
- function merge(initialObj, mergeObj, levels = 2) {
1357
- // If the merge value is not an object, or we have no merge levels left,
1358
- // we just set the value to the merge value
1359
- if (!mergeObj || typeof mergeObj !== 'object' || levels <= 0) {
1360
- return mergeObj;
1361
- }
1362
-
1363
- // If the merge object is an empty object, and the initial object is not undefined, we return the initial object
1364
- if (initialObj && Object.keys(mergeObj).length === 0) {
1365
- return initialObj;
1366
- }
1367
-
1368
- // Clone object
1369
- const output = { ...initialObj };
1370
-
1371
- // Merge values into output, resursively
1372
- for (const key in mergeObj) {
1373
- if (Object.prototype.hasOwnProperty.call(mergeObj, key)) {
1374
- output[key] = merge(output[key], mergeObj[key], levels - 1);
1375
- }
1376
- }
1377
-
1378
- return output;
1379
- }
1380
-
1381
- /**
1382
- * Generate a random, valid trace ID.
1383
- */
1384
- function generateTraceId() {
1385
- return uuid4();
1386
- }
1387
-
1388
- /**
1389
- * Generate a random, valid span ID.
1390
- */
1391
- function generateSpanId() {
1392
- return uuid4().substring(16);
1393
- }
1394
-
1395
- const SCOPE_SPAN_FIELD = '_sentrySpan';
1396
-
1397
- /**
1398
- * Set the active span for a given scope.
1399
- * NOTE: This should NOT be used directly, but is only used internally by the trace methods.
1400
- */
1401
- function _setSpanForScope(scope, span) {
1402
- if (span) {
1403
- addNonEnumerableProperty(scope , SCOPE_SPAN_FIELD, span);
1404
- } else {
1405
- // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
1406
- delete (scope )[SCOPE_SPAN_FIELD];
1407
- }
1408
- }
1409
-
1410
- /**
1411
- * Get the active span for a given scope.
1412
- * NOTE: This should NOT be used directly, but is only used internally by the trace methods.
1413
- */
1414
- function _getSpanForScope(scope) {
1415
- return scope[SCOPE_SPAN_FIELD];
1416
- }
1417
-
1418
- /**
1419
- * Default value for maximum number of breadcrumbs added to an event.
1420
- */
1421
- const DEFAULT_MAX_BREADCRUMBS = 100;
1422
-
1423
- /**
1424
- * A context to be used for capturing an event.
1425
- * This can either be a Scope, or a partial ScopeContext,
1426
- * or a callback that receives the current scope and returns a new scope to use.
1427
- */
1428
-
1429
- /**
1430
- * Holds additional event information.
1431
- */
1432
- class Scope {
1433
- /** Flag if notifying is happening. */
1434
-
1435
- /** Callback for client to receive scope changes. */
1436
-
1437
- /** Callback list that will be called during event processing. */
1438
-
1439
- /** Array of breadcrumbs. */
1440
-
1441
- /** User */
1442
-
1443
- /** Tags */
1444
-
1445
- /** Extra */
1446
-
1447
- /** Contexts */
1448
-
1449
- /** Attachments */
1450
-
1451
- /** Propagation Context for distributed tracing */
1452
-
1453
- /**
1454
- * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
1455
- * sent to Sentry
1456
- */
1457
-
1458
- /** Fingerprint */
1459
-
1460
- /** Severity */
1461
-
1462
- /**
1463
- * Transaction Name
1464
- *
1465
- * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects.
1466
- * It's purpose is to assign a transaction to the scope that's added to non-transaction events.
1467
- */
1468
-
1469
- /** Session */
1470
-
1471
- /** The client on this scope */
1472
-
1473
- /** Contains the last event id of a captured event. */
1474
-
1475
- // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.
1476
-
1477
- constructor() {
1478
- this._notifyingListeners = false;
1479
- this._scopeListeners = [];
1480
- this._eventProcessors = [];
1481
- this._breadcrumbs = [];
1482
- this._attachments = [];
1483
- this._user = {};
1484
- this._tags = {};
1485
- this._extra = {};
1486
- this._contexts = {};
1487
- this._sdkProcessingMetadata = {};
1488
- this._propagationContext = {
1489
- traceId: generateTraceId(),
1490
- sampleRand: Math.random(),
1491
- };
1492
- }
1493
-
1494
- /**
1495
- * Clone all data from this scope into a new scope.
1496
- */
1497
- clone() {
1498
- const newScope = new Scope();
1499
- newScope._breadcrumbs = [...this._breadcrumbs];
1500
- newScope._tags = { ...this._tags };
1501
- newScope._extra = { ...this._extra };
1502
- newScope._contexts = { ...this._contexts };
1503
- if (this._contexts.flags) {
1504
- // We need to copy the `values` array so insertions on a cloned scope
1505
- // won't affect the original array.
1506
- newScope._contexts.flags = {
1507
- values: [...this._contexts.flags.values],
1508
- };
1509
- }
1510
-
1511
- newScope._user = this._user;
1512
- newScope._level = this._level;
1513
- newScope._session = this._session;
1514
- newScope._transactionName = this._transactionName;
1515
- newScope._fingerprint = this._fingerprint;
1516
- newScope._eventProcessors = [...this._eventProcessors];
1517
- newScope._attachments = [...this._attachments];
1518
- newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata };
1519
- newScope._propagationContext = { ...this._propagationContext };
1520
- newScope._client = this._client;
1521
- newScope._lastEventId = this._lastEventId;
1522
-
1523
- _setSpanForScope(newScope, _getSpanForScope(this));
1524
-
1525
- return newScope;
1526
- }
1527
-
1528
- /**
1529
- * Update the client assigned to this scope.
1530
- * Note that not every scope will have a client assigned - isolation scopes & the global scope will generally not have a client,
1531
- * as well as manually created scopes.
1532
- */
1533
- setClient(client) {
1534
- this._client = client;
1535
- }
1536
-
1537
- /**
1538
- * Set the ID of the last captured error event.
1539
- * This is generally only captured on the isolation scope.
1540
- */
1541
- setLastEventId(lastEventId) {
1542
- this._lastEventId = lastEventId;
1543
- }
1544
-
1545
- /**
1546
- * Get the client assigned to this scope.
1547
- */
1548
- getClient() {
1549
- return this._client ;
1550
- }
1551
-
1552
- /**
1553
- * Get the ID of the last captured error event.
1554
- * This is generally only available on the isolation scope.
1555
- */
1556
- lastEventId() {
1557
- return this._lastEventId;
1558
- }
1559
-
1560
- /**
1561
- * @inheritDoc
1562
- */
1563
- addScopeListener(callback) {
1564
- this._scopeListeners.push(callback);
1565
- }
1566
-
1567
- /**
1568
- * Add an event processor that will be called before an event is sent.
1569
- */
1570
- addEventProcessor(callback) {
1571
- this._eventProcessors.push(callback);
1572
- return this;
1573
- }
1574
-
1575
- /**
1576
- * Set the user for this scope.
1577
- * Set to `null` to unset the user.
1578
- */
1579
- setUser(user) {
1580
- // If null is passed we want to unset everything, but still define keys,
1581
- // so that later down in the pipeline any existing values are cleared.
1582
- this._user = user || {
1583
- email: undefined,
1584
- id: undefined,
1585
- ip_address: undefined,
1586
- username: undefined,
1587
- };
1588
-
1589
- if (this._session) {
1590
- updateSession(this._session, { user });
1591
- }
1592
-
1593
- this._notifyScopeListeners();
1594
- return this;
1595
- }
1596
-
1597
- /**
1598
- * Get the user from this scope.
1599
- */
1600
- getUser() {
1601
- return this._user;
1602
- }
1603
-
1604
- /**
1605
- * Set an object that will be merged into existing tags on the scope,
1606
- * and will be sent as tags data with the event.
1607
- */
1608
- setTags(tags) {
1609
- this._tags = {
1610
- ...this._tags,
1611
- ...tags,
1612
- };
1613
- this._notifyScopeListeners();
1614
- return this;
1615
- }
1616
-
1617
- /**
1618
- * Set a single tag that will be sent as tags data with the event.
1619
- */
1620
- setTag(key, value) {
1621
- return this.setTags({ [key]: value });
1622
- }
1623
-
1624
- /**
1625
- * Set an object that will be merged into existing extra on the scope,
1626
- * and will be sent as extra data with the event.
1627
- */
1628
- setExtras(extras) {
1629
- this._extra = {
1630
- ...this._extra,
1631
- ...extras,
1632
- };
1633
- this._notifyScopeListeners();
1634
- return this;
1635
- }
1636
-
1637
- /**
1638
- * Set a single key:value extra entry that will be sent as extra data with the event.
1639
- */
1640
- setExtra(key, extra) {
1641
- this._extra = { ...this._extra, [key]: extra };
1642
- this._notifyScopeListeners();
1643
- return this;
1644
- }
1645
-
1646
- /**
1647
- * Sets the fingerprint on the scope to send with the events.
1648
- * @param {string[]} fingerprint Fingerprint to group events in Sentry.
1649
- */
1650
- setFingerprint(fingerprint) {
1651
- this._fingerprint = fingerprint;
1652
- this._notifyScopeListeners();
1653
- return this;
1654
- }
1655
-
1656
- /**
1657
- * Sets the level on the scope for future events.
1658
- */
1659
- setLevel(level) {
1660
- this._level = level;
1661
- this._notifyScopeListeners();
1662
- return this;
1663
- }
1664
-
1665
- /**
1666
- * Sets the transaction name on the scope so that the name of e.g. taken server route or
1667
- * the page location is attached to future events.
1668
- *
1669
- * IMPORTANT: Calling this function does NOT change the name of the currently active
1670
- * root span. If you want to change the name of the active root span, use
1671
- * `Sentry.updateSpanName(rootSpan, 'new name')` instead.
1672
- *
1673
- * By default, the SDK updates the scope's transaction name automatically on sensible
1674
- * occasions, such as a page navigation or when handling a new request on the server.
1675
- */
1676
- setTransactionName(name) {
1677
- this._transactionName = name;
1678
- this._notifyScopeListeners();
1679
- return this;
1680
- }
1681
-
1682
- /**
1683
- * Sets context data with the given name.
1684
- * Data passed as context will be normalized. You can also pass `null` to unset the context.
1685
- * Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key.
1686
- */
1687
- setContext(key, context) {
1688
- if (context === null) {
1689
- // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
1690
- delete this._contexts[key];
1691
- } else {
1692
- this._contexts[key] = context;
1693
- }
1694
-
1695
- this._notifyScopeListeners();
1696
- return this;
1697
- }
1698
-
1699
- /**
1700
- * Set the session for the scope.
1701
- */
1702
- setSession(session) {
1703
- if (!session) {
1704
- delete this._session;
1705
- } else {
1706
- this._session = session;
1707
- }
1708
- this._notifyScopeListeners();
1709
- return this;
1710
- }
1711
-
1712
- /**
1713
- * Get the session from the scope.
1714
- */
1715
- getSession() {
1716
- return this._session;
1717
- }
1718
-
1719
- /**
1720
- * Updates the scope with provided data. Can work in three variations:
1721
- * - plain object containing updatable attributes
1722
- * - Scope instance that'll extract the attributes from
1723
- * - callback function that'll receive the current scope as an argument and allow for modifications
1724
- */
1725
- update(captureContext) {
1726
- if (!captureContext) {
1727
- return this;
1728
- }
1729
-
1730
- const scopeToMerge = typeof captureContext === 'function' ? captureContext(this) : captureContext;
1731
-
1732
- const scopeInstance =
1733
- scopeToMerge instanceof Scope
1734
- ? scopeToMerge.getScopeData()
1735
- : isPlainObject(scopeToMerge)
1736
- ? (captureContext )
1737
- : undefined;
1738
-
1739
- const { tags, extra, user, contexts, level, fingerprint = [], propagationContext } = scopeInstance || {};
1740
-
1741
- this._tags = { ...this._tags, ...tags };
1742
- this._extra = { ...this._extra, ...extra };
1743
- this._contexts = { ...this._contexts, ...contexts };
1744
-
1745
- if (user && Object.keys(user).length) {
1746
- this._user = user;
1747
- }
1748
-
1749
- if (level) {
1750
- this._level = level;
1751
- }
1752
-
1753
- if (fingerprint.length) {
1754
- this._fingerprint = fingerprint;
1755
- }
1756
-
1757
- if (propagationContext) {
1758
- this._propagationContext = propagationContext;
1759
- }
1760
-
1761
- return this;
1762
- }
1763
-
1764
- /**
1765
- * Clears the current scope and resets its properties.
1766
- * Note: The client will not be cleared.
1767
- */
1768
- clear() {
1769
- // client is not cleared here on purpose!
1770
- this._breadcrumbs = [];
1771
- this._tags = {};
1772
- this._extra = {};
1773
- this._user = {};
1774
- this._contexts = {};
1775
- this._level = undefined;
1776
- this._transactionName = undefined;
1777
- this._fingerprint = undefined;
1778
- this._session = undefined;
1779
- _setSpanForScope(this, undefined);
1780
- this._attachments = [];
1781
- this.setPropagationContext({ traceId: generateTraceId(), sampleRand: Math.random() });
1782
-
1783
- this._notifyScopeListeners();
1784
- return this;
1785
- }
1786
-
1787
- /**
1788
- * Adds a breadcrumb to the scope.
1789
- * By default, the last 100 breadcrumbs are kept.
1790
- */
1791
- addBreadcrumb(breadcrumb, maxBreadcrumbs) {
1792
- const maxCrumbs = typeof maxBreadcrumbs === 'number' ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS;
1793
-
1794
- // No data has been changed, so don't notify scope listeners
1795
- if (maxCrumbs <= 0) {
1796
- return this;
1797
- }
1798
-
1799
- const mergedBreadcrumb = {
1800
- timestamp: dateTimestampInSeconds(),
1801
- ...breadcrumb,
1802
- // Breadcrumb messages can theoretically be infinitely large and they're held in memory so we truncate them not to leak (too much) memory
1803
- message: breadcrumb.message ? truncate(breadcrumb.message, 2048) : breadcrumb.message,
1804
- };
1805
-
1806
- this._breadcrumbs.push(mergedBreadcrumb);
1807
- if (this._breadcrumbs.length > maxCrumbs) {
1808
- this._breadcrumbs = this._breadcrumbs.slice(-maxCrumbs);
1809
- this._client?.recordDroppedEvent('buffer_overflow', 'log_item');
1810
- }
1811
-
1812
- this._notifyScopeListeners();
1813
-
1814
- return this;
1815
- }
1816
-
1817
- /**
1818
- * Get the last breadcrumb of the scope.
1819
- */
1820
- getLastBreadcrumb() {
1821
- return this._breadcrumbs[this._breadcrumbs.length - 1];
1822
- }
1823
-
1824
- /**
1825
- * Clear all breadcrumbs from the scope.
1826
- */
1827
- clearBreadcrumbs() {
1828
- this._breadcrumbs = [];
1829
- this._notifyScopeListeners();
1830
- return this;
1831
- }
1832
-
1833
- /**
1834
- * Add an attachment to the scope.
1835
- */
1836
- addAttachment(attachment) {
1837
- this._attachments.push(attachment);
1838
- return this;
1839
- }
1840
-
1841
- /**
1842
- * Clear all attachments from the scope.
1843
- */
1844
- clearAttachments() {
1845
- this._attachments = [];
1846
- return this;
1847
- }
1848
-
1849
- /**
1850
- * Get the data of this scope, which should be applied to an event during processing.
1851
- */
1852
- getScopeData() {
1853
- return {
1854
- breadcrumbs: this._breadcrumbs,
1855
- attachments: this._attachments,
1856
- contexts: this._contexts,
1857
- tags: this._tags,
1858
- extra: this._extra,
1859
- user: this._user,
1860
- level: this._level,
1861
- fingerprint: this._fingerprint || [],
1862
- eventProcessors: this._eventProcessors,
1863
- propagationContext: this._propagationContext,
1864
- sdkProcessingMetadata: this._sdkProcessingMetadata,
1865
- transactionName: this._transactionName,
1866
- span: _getSpanForScope(this),
1867
- };
1868
- }
1869
-
1870
- /**
1871
- * Add data which will be accessible during event processing but won't get sent to Sentry.
1872
- */
1873
- setSDKProcessingMetadata(newData) {
1874
- this._sdkProcessingMetadata = merge(this._sdkProcessingMetadata, newData, 2);
1875
- return this;
1876
- }
1877
-
1878
- /**
1879
- * Add propagation context to the scope, used for distributed tracing
1880
- */
1881
- setPropagationContext(context) {
1882
- this._propagationContext = context;
1883
- return this;
1884
- }
1885
-
1886
- /**
1887
- * Get propagation context from the scope, used for distributed tracing
1888
- */
1889
- getPropagationContext() {
1890
- return this._propagationContext;
1891
- }
1892
-
1893
- /**
1894
- * Capture an exception for this scope.
1895
- *
1896
- * @returns {string} The id of the captured Sentry event.
1897
- */
1898
- captureException(exception, hint) {
1899
- const eventId = hint?.event_id || uuid4();
1900
-
1901
- if (!this._client) {
1902
- DEBUG_BUILD && debug.warn('No client configured on scope - will not capture exception!');
1903
- return eventId;
1904
- }
1905
-
1906
- const syntheticException = new Error('Sentry syntheticException');
1907
-
1908
- this._client.captureException(
1909
- exception,
1910
- {
1911
- originalException: exception,
1912
- syntheticException,
1913
- ...hint,
1914
- event_id: eventId,
1915
- },
1916
- this,
1917
- );
1918
-
1919
- return eventId;
1920
- }
1921
-
1922
- /**
1923
- * Capture a message for this scope.
1924
- *
1925
- * @returns {string} The id of the captured message.
1926
- */
1927
- captureMessage(message, level, hint) {
1928
- const eventId = hint?.event_id || uuid4();
1929
-
1930
- if (!this._client) {
1931
- DEBUG_BUILD && debug.warn('No client configured on scope - will not capture message!');
1932
- return eventId;
1933
- }
1934
-
1935
- const syntheticException = hint?.syntheticException ?? new Error(message);
1936
-
1937
- this._client.captureMessage(
1938
- message,
1939
- level,
1940
- {
1941
- originalException: message,
1942
- syntheticException,
1943
- ...hint,
1944
- event_id: eventId,
1945
- },
1946
- this,
1947
- );
1948
-
1949
- return eventId;
1950
- }
1951
-
1952
- /**
1953
- * Capture a Sentry event for this scope.
1954
- *
1955
- * @returns {string} The id of the captured event.
1956
- */
1957
- captureEvent(event, hint) {
1958
- const eventId = hint?.event_id || uuid4();
1959
-
1960
- if (!this._client) {
1961
- DEBUG_BUILD && debug.warn('No client configured on scope - will not capture event!');
1962
- return eventId;
1963
- }
1964
-
1965
- this._client.captureEvent(event, { ...hint, event_id: eventId }, this);
1966
-
1967
- return eventId;
1968
- }
1969
-
1970
- /**
1971
- * This will be called on every set call.
1972
- */
1973
- _notifyScopeListeners() {
1974
- // We need this check for this._notifyingListeners to be able to work on scope during updates
1975
- // If this check is not here we'll produce endless recursion when something is done with the scope
1976
- // during the callback.
1977
- if (!this._notifyingListeners) {
1978
- this._notifyingListeners = true;
1979
- this._scopeListeners.forEach(callback => {
1980
- callback(this);
1981
- });
1982
- this._notifyingListeners = false;
1983
- }
1984
- }
1985
- }
1986
-
1987
- /** Get the default current scope. */
1988
- function getDefaultCurrentScope() {
1989
- return getGlobalSingleton('defaultCurrentScope', () => new Scope());
1990
- }
1991
-
1992
- /** Get the default isolation scope. */
1993
- function getDefaultIsolationScope() {
1994
- return getGlobalSingleton('defaultIsolationScope', () => new Scope());
1995
- }
1996
-
1997
- /**
1998
- * This is an object that holds a stack of scopes.
1999
- */
2000
- class AsyncContextStack {
2001
-
2002
- constructor(scope, isolationScope) {
2003
- let assignedScope;
2004
- if (!scope) {
2005
- assignedScope = new Scope();
2006
- } else {
2007
- assignedScope = scope;
2008
- }
2009
-
2010
- let assignedIsolationScope;
2011
- if (!isolationScope) {
2012
- assignedIsolationScope = new Scope();
2013
- } else {
2014
- assignedIsolationScope = isolationScope;
2015
- }
2016
-
2017
- // scope stack for domains or the process
2018
- this._stack = [{ scope: assignedScope }];
2019
- this._isolationScope = assignedIsolationScope;
2020
- }
2021
-
2022
- /**
2023
- * Fork a scope for the stack.
2024
- */
2025
- withScope(callback) {
2026
- const scope = this._pushScope();
2027
-
2028
- let maybePromiseResult;
2029
- try {
2030
- maybePromiseResult = callback(scope);
2031
- } catch (e) {
2032
- this._popScope();
2033
- throw e;
2034
- }
2035
-
2036
- if (isThenable(maybePromiseResult)) {
2037
- // @ts-expect-error - isThenable returns the wrong type
2038
- return maybePromiseResult.then(
2039
- res => {
2040
- this._popScope();
2041
- return res;
2042
- },
2043
- e => {
2044
- this._popScope();
2045
- throw e;
2046
- },
2047
- );
2048
- }
2049
-
2050
- this._popScope();
2051
- return maybePromiseResult;
2052
- }
2053
-
2054
- /**
2055
- * Get the client of the stack.
2056
- */
2057
- getClient() {
2058
- return this.getStackTop().client ;
2059
- }
2060
-
2061
- /**
2062
- * Returns the scope of the top stack.
2063
- */
2064
- getScope() {
2065
- return this.getStackTop().scope;
2066
- }
2067
-
2068
- /**
2069
- * Get the isolation scope for the stack.
2070
- */
2071
- getIsolationScope() {
2072
- return this._isolationScope;
2073
- }
2074
-
2075
- /**
2076
- * Returns the topmost scope layer in the order domain > local > process.
2077
- */
2078
- getStackTop() {
2079
- return this._stack[this._stack.length - 1] ;
2080
- }
2081
-
2082
- /**
2083
- * Push a scope to the stack.
2084
- */
2085
- _pushScope() {
2086
- // We want to clone the content of prev scope
2087
- const scope = this.getScope().clone();
2088
- this._stack.push({
2089
- client: this.getClient(),
2090
- scope,
2091
- });
2092
- return scope;
2093
- }
2094
-
2095
- /**
2096
- * Pop a scope from the stack.
2097
- */
2098
- _popScope() {
2099
- if (this._stack.length <= 1) return false;
2100
- return !!this._stack.pop();
2101
- }
2102
- }
2103
-
2104
- /**
2105
- * Get the global async context stack.
2106
- * This will be removed during the v8 cycle and is only here to make migration easier.
2107
- */
2108
- function getAsyncContextStack() {
2109
- const registry = getMainCarrier();
2110
- const sentry = getSentryCarrier(registry);
2111
-
2112
- return (sentry.stack = sentry.stack || new AsyncContextStack(getDefaultCurrentScope(), getDefaultIsolationScope()));
2113
- }
2114
-
2115
- function withScope$1(callback) {
2116
- return getAsyncContextStack().withScope(callback);
2117
- }
2118
-
2119
- function withSetScope(scope, callback) {
2120
- const stack = getAsyncContextStack();
2121
- return stack.withScope(() => {
2122
- stack.getStackTop().scope = scope;
2123
- return callback(scope);
2124
- });
2125
- }
2126
-
2127
- function withIsolationScope(callback) {
2128
- return getAsyncContextStack().withScope(() => {
2129
- return callback(getAsyncContextStack().getIsolationScope());
2130
- });
2131
- }
2132
-
2133
- /**
2134
- * Get the stack-based async context strategy.
2135
- */
2136
- function getStackAsyncContextStrategy() {
2137
- return {
2138
- withIsolationScope,
2139
- withScope: withScope$1,
2140
- withSetScope,
2141
- withSetIsolationScope: (_isolationScope, callback) => {
2142
- return withIsolationScope(callback);
2143
- },
2144
- getCurrentScope: () => getAsyncContextStack().getScope(),
2145
- getIsolationScope: () => getAsyncContextStack().getIsolationScope(),
2146
- };
2147
- }
2148
-
2149
- /**
2150
- * Get the current async context strategy.
2151
- * If none has been setup, the default will be used.
2152
- */
2153
- function getAsyncContextStrategy(carrier) {
2154
- const sentry = getSentryCarrier(carrier);
2155
-
2156
- if (sentry.acs) {
2157
- return sentry.acs;
2158
- }
2159
-
2160
- // Otherwise, use the default one (stack)
2161
- return getStackAsyncContextStrategy();
2162
- }
2163
-
2164
- /**
2165
- * Get the currently active scope.
2166
- */
2167
- function getCurrentScope() {
2168
- const carrier = getMainCarrier();
2169
- const acs = getAsyncContextStrategy(carrier);
2170
- return acs.getCurrentScope();
2171
- }
2172
-
2173
- /**
2174
- * Get the currently active isolation scope.
2175
- * The isolation scope is active for the current execution context.
2176
- */
2177
- function getIsolationScope() {
2178
- const carrier = getMainCarrier();
2179
- const acs = getAsyncContextStrategy(carrier);
2180
- return acs.getIsolationScope();
2181
- }
2182
-
2183
- /**
2184
- * Get the global scope.
2185
- * This scope is applied to _all_ events.
2186
- */
2187
- function getGlobalScope() {
2188
- return getGlobalSingleton('globalScope', () => new Scope());
2189
- }
2190
-
2191
- /**
2192
- * Creates a new scope with and executes the given operation within.
2193
- * The scope is automatically removed once the operation
2194
- * finishes or throws.
2195
- */
2196
-
2197
- /**
2198
- * Either creates a new active scope, or sets the given scope as active scope in the given callback.
2199
- */
2200
- function withScope(
2201
- ...rest
2202
- ) {
2203
- const carrier = getMainCarrier();
2204
- const acs = getAsyncContextStrategy(carrier);
2205
-
2206
- // If a scope is defined, we want to make this the active scope instead of the default one
2207
- if (rest.length === 2) {
2208
- const [scope, callback] = rest;
2209
-
2210
- if (!scope) {
2211
- return acs.withScope(callback);
2212
- }
2213
-
2214
- return acs.withSetScope(scope, callback);
2215
- }
2216
-
2217
- return acs.withScope(rest[0]);
2218
- }
2219
-
2220
- /**
2221
- * Get the currently active client.
2222
- */
2223
- function getClient() {
2224
- return getCurrentScope().getClient();
2225
- }
2226
-
2227
- /**
2228
- * Get a trace context for the given scope.
2229
- */
2230
- function getTraceContextFromScope(scope) {
2231
- const propagationContext = scope.getPropagationContext();
2232
-
2233
- const { traceId, parentSpanId, propagationSpanId } = propagationContext;
2234
-
2235
- const traceContext = {
2236
- trace_id: traceId,
2237
- span_id: propagationSpanId || generateSpanId(),
2238
- };
2239
-
2240
- if (parentSpanId) {
2241
- traceContext.parent_span_id = parentSpanId;
2242
- }
2243
-
2244
- return traceContext;
2245
- }
2246
-
2247
- /**
2248
- * Use this attribute to represent the source of a span.
2249
- * Should be one of: custom, url, route, view, component, task, unknown
2250
- *
2251
- */
2252
- const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = 'sentry.source';
2253
-
2254
- /**
2255
- * Attributes that holds the sample rate that was locally applied to a span.
2256
- * If this attribute is not defined, it means that the span inherited a sampling decision.
2257
- *
2258
- * NOTE: Is only defined on root spans.
2259
- */
2260
- const SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = 'sentry.sample_rate';
2261
-
2262
- /**
2263
- * Attribute holding the sample rate of the previous trace.
2264
- * This is used to sample consistently across subsequent traces in the browser SDK.
2265
- *
2266
- * Note: Only defined on root spans, if opted into consistent sampling
2267
- */
2268
- const SEMANTIC_ATTRIBUTE_SENTRY_PREVIOUS_TRACE_SAMPLE_RATE = 'sentry.previous_trace_sample_rate';
2269
-
2270
- /**
2271
- * Use this attribute to represent the operation of a span.
2272
- */
2273
- const SEMANTIC_ATTRIBUTE_SENTRY_OP = 'sentry.op';
2274
-
2275
- /**
2276
- * Use this attribute to represent the origin of a span.
2277
- */
2278
- const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = 'sentry.origin';
2279
-
2280
- /**
2281
- * The id of the profile that this span occurred in.
2282
- */
2283
- const SEMANTIC_ATTRIBUTE_PROFILE_ID = 'sentry.profile_id';
2284
-
2285
- const SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME = 'sentry.exclusive_time';
2286
-
2287
- const SPAN_STATUS_UNSET = 0;
2288
- const SPAN_STATUS_OK = 1;
2289
-
2290
- const SCOPE_ON_START_SPAN_FIELD = '_sentryScope';
2291
- const ISOLATION_SCOPE_ON_START_SPAN_FIELD = '_sentryIsolationScope';
2292
-
2293
- /** Try to unwrap a scope from a potential WeakRef wrapper. */
2294
- function unwrapScopeFromWeakRef(scopeRef) {
2295
- if (!scopeRef) {
2296
- return undefined;
2297
- }
2298
-
2299
- if (typeof scopeRef === 'object' && 'deref' in scopeRef && typeof scopeRef.deref === 'function') {
2300
- try {
2301
- return scopeRef.deref();
2302
- } catch {
2303
- return undefined;
2304
- }
2305
- }
2306
-
2307
- // Fallback to a direct scope
2308
- return scopeRef ;
2309
- }
2310
-
2311
- /**
2312
- * Grabs the scope and isolation scope off a span that were active when the span was started.
2313
- * If WeakRef was used and scopes have been garbage collected, returns undefined for those scopes.
2314
- */
2315
- function getCapturedScopesOnSpan(span) {
2316
- const spanWithScopes = span ;
2317
-
2318
- return {
2319
- scope: spanWithScopes[SCOPE_ON_START_SPAN_FIELD],
2320
- isolationScope: unwrapScopeFromWeakRef(spanWithScopes[ISOLATION_SCOPE_ON_START_SPAN_FIELD]),
2321
- };
2322
- }
2323
-
2324
- const SENTRY_BAGGAGE_KEY_PREFIX = 'sentry-';
2325
-
2326
- const SENTRY_BAGGAGE_KEY_PREFIX_REGEX = /^sentry-/;
2327
-
2328
- /**
2329
- * Takes a baggage header and turns it into Dynamic Sampling Context, by extracting all the "sentry-" prefixed values
2330
- * from it.
2331
- *
2332
- * @param baggageHeader A very bread definition of a baggage header as it might appear in various frameworks.
2333
- * @returns The Dynamic Sampling Context that was found on `baggageHeader`, if there was any, `undefined` otherwise.
2334
- */
2335
- function baggageHeaderToDynamicSamplingContext(
2336
- // Very liberal definition of what any incoming header might look like
2337
- baggageHeader,
2338
- ) {
2339
- const baggageObject = parseBaggageHeader(baggageHeader);
2340
-
2341
- if (!baggageObject) {
2342
- return undefined;
2343
- }
2344
-
2345
- // Read all "sentry-" prefixed values out of the baggage object and put it onto a dynamic sampling context object.
2346
- const dynamicSamplingContext = Object.entries(baggageObject).reduce((acc, [key, value]) => {
2347
- if (key.match(SENTRY_BAGGAGE_KEY_PREFIX_REGEX)) {
2348
- const nonPrefixedKey = key.slice(SENTRY_BAGGAGE_KEY_PREFIX.length);
2349
- acc[nonPrefixedKey] = value;
2350
- }
2351
- return acc;
2352
- }, {});
2353
-
2354
- // Only return a dynamic sampling context object if there are keys in it.
2355
- // A keyless object means there were no sentry values on the header, which means that there is no DSC.
2356
- if (Object.keys(dynamicSamplingContext).length > 0) {
2357
- return dynamicSamplingContext ;
2358
- } else {
2359
- return undefined;
2360
- }
2361
- }
2362
-
2363
- /**
2364
- * Take a baggage header and parse it into an object.
2365
- */
2366
- function parseBaggageHeader(
2367
- baggageHeader,
2368
- ) {
2369
- if (!baggageHeader || (!isString(baggageHeader) && !Array.isArray(baggageHeader))) {
2370
- return undefined;
2371
- }
2372
-
2373
- if (Array.isArray(baggageHeader)) {
2374
- // Combine all baggage headers into one object containing the baggage values so we can later read the Sentry-DSC-values from it
2375
- return baggageHeader.reduce((acc, curr) => {
2376
- const currBaggageObject = baggageHeaderToObject(curr);
2377
- Object.entries(currBaggageObject).forEach(([key, value]) => {
2378
- acc[key] = value;
2379
- });
2380
- return acc;
2381
- }, {});
2382
- }
2383
-
2384
- return baggageHeaderToObject(baggageHeader);
2385
- }
2386
-
2387
- /**
2388
- * Will parse a baggage header, which is a simple key-value map, into a flat object.
2389
- *
2390
- * @param baggageHeader The baggage header to parse.
2391
- * @returns a flat object containing all the key-value pairs from `baggageHeader`.
2392
- */
2393
- function baggageHeaderToObject(baggageHeader) {
2394
- return baggageHeader
2395
- .split(',')
2396
- .map(baggageEntry => {
2397
- const eqIdx = baggageEntry.indexOf('=');
2398
- if (eqIdx === -1) {
2399
- // Likely an invalid entry
2400
- return [];
2401
- }
2402
- const key = baggageEntry.slice(0, eqIdx);
2403
- const value = baggageEntry.slice(eqIdx + 1);
2404
- return [key, value].map(keyOrValue => {
2405
- try {
2406
- return decodeURIComponent(keyOrValue.trim());
2407
- } catch {
2408
- // We ignore errors here, e.g. if the value cannot be URL decoded.
2409
- // This will then be skipped in the next step
2410
- return;
2411
- }
2412
- });
2413
- })
2414
- .reduce((acc, [key, value]) => {
2415
- if (key && value) {
2416
- acc[key] = value;
2417
- }
2418
- return acc;
2419
- }, {});
2420
- }
2421
-
2422
- /** Regular expression used to extract org ID from a DSN host. */
2423
- const ORG_ID_REGEX = /^o(\d+)\./;
2424
-
2425
- /** Regular expression used to parse a Dsn. */
2426
- const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;
2427
-
2428
- function isValidProtocol(protocol) {
2429
- return protocol === 'http' || protocol === 'https';
2430
- }
2431
-
2432
- /**
2433
- * Renders the string representation of this Dsn.
2434
- *
2435
- * By default, this will render the public representation without the password
2436
- * component. To get the deprecated private representation, set `withPassword`
2437
- * to true.
2438
- *
2439
- * @param withPassword When set to true, the password will be included.
2440
- */
2441
- function dsnToString(dsn, withPassword = false) {
2442
- const { host, path, pass, port, projectId, protocol, publicKey } = dsn;
2443
- return (
2444
- `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ''}` +
2445
- `@${host}${port ? `:${port}` : ''}/${path ? `${path}/` : path}${projectId}`
2446
- );
2447
- }
2448
-
2449
- /**
2450
- * Parses a Dsn from a given string.
2451
- *
2452
- * @param str A Dsn as string
2453
- * @returns Dsn as DsnComponents or undefined if @param str is not a valid DSN string
2454
- */
2455
- function dsnFromString(str) {
2456
- const match = DSN_REGEX.exec(str);
2457
-
2458
- if (!match) {
2459
- // This should be logged to the console
2460
- consoleSandbox(() => {
2461
- // eslint-disable-next-line no-console
2462
- console.error(`Invalid Sentry Dsn: ${str}`);
2463
- });
2464
- return undefined;
2465
- }
2466
-
2467
- const [protocol, publicKey, pass = '', host = '', port = '', lastPath = ''] = match.slice(1);
2468
- let path = '';
2469
- let projectId = lastPath;
2470
-
2471
- const split = projectId.split('/');
2472
- if (split.length > 1) {
2473
- path = split.slice(0, -1).join('/');
2474
- projectId = split.pop() ;
2475
- }
2476
-
2477
- if (projectId) {
2478
- const projectMatch = projectId.match(/^\d+/);
2479
- if (projectMatch) {
2480
- projectId = projectMatch[0];
2481
- }
2482
- }
2483
-
2484
- return dsnFromComponents({ host, pass, path, projectId, port, protocol: protocol , publicKey });
2485
- }
2486
-
2487
- function dsnFromComponents(components) {
2488
- return {
2489
- protocol: components.protocol,
2490
- publicKey: components.publicKey || '',
2491
- pass: components.pass || '',
2492
- host: components.host,
2493
- port: components.port || '',
2494
- path: components.path || '',
2495
- projectId: components.projectId,
2496
- };
2497
- }
2498
-
2499
- function validateDsn(dsn) {
2500
- if (!DEBUG_BUILD) {
2501
- return true;
2502
- }
2503
-
2504
- const { port, projectId, protocol } = dsn;
2505
-
2506
- const requiredComponents = ['protocol', 'publicKey', 'host', 'projectId'];
2507
- const hasMissingRequiredComponent = requiredComponents.find(component => {
2508
- if (!dsn[component]) {
2509
- debug.error(`Invalid Sentry Dsn: ${component} missing`);
2510
- return true;
2511
- }
2512
- return false;
2513
- });
2514
-
2515
- if (hasMissingRequiredComponent) {
2516
- return false;
2517
- }
2518
-
2519
- if (!projectId.match(/^\d+$/)) {
2520
- debug.error(`Invalid Sentry Dsn: Invalid projectId ${projectId}`);
2521
- return false;
2522
- }
2523
-
2524
- if (!isValidProtocol(protocol)) {
2525
- debug.error(`Invalid Sentry Dsn: Invalid protocol ${protocol}`);
2526
- return false;
2527
- }
2528
-
2529
- if (port && isNaN(parseInt(port, 10))) {
2530
- debug.error(`Invalid Sentry Dsn: Invalid port ${port}`);
2531
- return false;
2532
- }
2533
-
2534
- return true;
2535
- }
2536
-
2537
- /**
2538
- * Extract the org ID from a DSN host.
2539
- *
2540
- * @param host The host from a DSN
2541
- * @returns The org ID if found, undefined otherwise
2542
- */
2543
- function extractOrgIdFromDsnHost(host) {
2544
- const match = host.match(ORG_ID_REGEX);
2545
-
2546
- return match?.[1];
2547
- }
2548
-
2549
- /**
2550
- * Returns the organization ID of the client.
2551
- *
2552
- * The organization ID is extracted from the DSN. If the client options include a `orgId`, this will always take precedence.
2553
- */
2554
- function extractOrgIdFromClient(client) {
2555
- const options = client.getOptions();
2556
-
2557
- const { host } = client.getDsn() || {};
2558
-
2559
- let org_id;
2560
-
2561
- if (options.orgId) {
2562
- org_id = String(options.orgId);
2563
- } else if (host) {
2564
- org_id = extractOrgIdFromDsnHost(host);
2565
- }
2566
-
2567
- return org_id;
2568
- }
2569
-
2570
- /**
2571
- * Creates a valid Sentry Dsn object, identifying a Sentry instance and project.
2572
- * @returns a valid DsnComponents object or `undefined` if @param from is an invalid DSN source
2573
- */
2574
- function makeDsn(from) {
2575
- const components = typeof from === 'string' ? dsnFromString(from) : dsnFromComponents(from);
2576
- if (!components || !validateDsn(components)) {
2577
- return undefined;
2578
- }
2579
- return components;
2580
- }
2581
-
2582
- const TRACE_FLAG_SAMPLED = 0x1;
2583
-
2584
- let hasShownSpanDropWarning = false;
2585
-
2586
- /**
2587
- * Convert a span to a trace context, which can be sent as the `trace` context in a non-transaction event.
2588
- */
2589
- function spanToTraceContext(span) {
2590
- const { spanId, traceId: trace_id, isRemote } = span.spanContext();
2591
-
2592
- // If the span is remote, we use a random/virtual span as span_id to the trace context,
2593
- // and the remote span as parent_span_id
2594
- const parent_span_id = isRemote ? spanId : spanToJSON(span).parent_span_id;
2595
- const scope = getCapturedScopesOnSpan(span).scope;
2596
-
2597
- const span_id = isRemote ? scope?.getPropagationContext().propagationSpanId || generateSpanId() : spanId;
2598
-
2599
- return {
2600
- parent_span_id,
2601
- span_id,
2602
- trace_id,
2603
- };
2604
- }
2605
-
2606
- /**
2607
- * Converts the span links array to a flattened version to be sent within an envelope.
2608
- *
2609
- * If the links array is empty, it returns `undefined` so the empty value can be dropped before it's sent.
2610
- */
2611
- function convertSpanLinksForEnvelope(links) {
2612
- if (links && links.length > 0) {
2613
- return links.map(({ context: { spanId, traceId, traceFlags, ...restContext }, attributes }) => ({
2614
- span_id: spanId,
2615
- trace_id: traceId,
2616
- sampled: traceFlags === TRACE_FLAG_SAMPLED,
2617
- attributes,
2618
- ...restContext,
2619
- }));
2620
- } else {
2621
- return undefined;
2622
- }
2623
- }
2624
-
2625
- /**
2626
- * Convert a span time input into a timestamp in seconds.
2627
- */
2628
- function spanTimeInputToSeconds(input) {
2629
- if (typeof input === 'number') {
2630
- return ensureTimestampInSeconds(input);
2631
- }
2632
-
2633
- if (Array.isArray(input)) {
2634
- // See {@link HrTime} for the array-based time format
2635
- return input[0] + input[1] / 1e9;
2636
- }
2637
-
2638
- if (input instanceof Date) {
2639
- return ensureTimestampInSeconds(input.getTime());
2640
- }
2641
-
2642
- return timestampInSeconds();
2643
- }
2644
-
2645
- /**
2646
- * Converts a timestamp to second, if it was in milliseconds, or keeps it as second.
2647
- */
2648
- function ensureTimestampInSeconds(timestamp) {
2649
- const isMs = timestamp > 9999999999;
2650
- return isMs ? timestamp / 1000 : timestamp;
2651
- }
2652
-
2653
- /**
2654
- * Convert a span to a JSON representation.
2655
- */
2656
- // Note: Because of this, we currently have a circular type dependency (which we opted out of in package.json).
2657
- // This is not avoidable as we need `spanToJSON` in `spanUtils.ts`, which in turn is needed by `span.ts` for backwards compatibility.
2658
- // And `spanToJSON` needs the Span class from `span.ts` to check here.
2659
- function spanToJSON(span) {
2660
- if (spanIsSentrySpan(span)) {
2661
- return span.getSpanJSON();
2662
- }
2663
-
2664
- const { spanId: span_id, traceId: trace_id } = span.spanContext();
2665
-
2666
- // Handle a span from @opentelemetry/sdk-base-trace's `Span` class
2667
- if (spanIsOpenTelemetrySdkTraceBaseSpan(span)) {
2668
- const { attributes, startTime, name, endTime, status, links } = span;
2669
-
2670
- // In preparation for the next major of OpenTelemetry, we want to support
2671
- // looking up the parent span id according to the new API
2672
- // In OTel v1, the parent span id is accessed as `parentSpanId`
2673
- // In OTel v2, the parent span id is accessed as `spanId` on the `parentSpanContext`
2674
- const parentSpanId =
2675
- 'parentSpanId' in span
2676
- ? span.parentSpanId
2677
- : 'parentSpanContext' in span
2678
- ? (span.parentSpanContext )?.spanId
2679
- : undefined;
2680
-
2681
- return {
2682
- span_id,
2683
- trace_id,
2684
- data: attributes,
2685
- description: name,
2686
- parent_span_id: parentSpanId,
2687
- start_timestamp: spanTimeInputToSeconds(startTime),
2688
- // This is [0,0] by default in OTEL, in which case we want to interpret this as no end time
2689
- timestamp: spanTimeInputToSeconds(endTime) || undefined,
2690
- status: getStatusMessage(status),
2691
- op: attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP],
2692
- origin: attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] ,
2693
- links: convertSpanLinksForEnvelope(links),
2694
- };
2695
- }
2696
-
2697
- // Finally, at least we have `spanContext()`....
2698
- // This should not actually happen in reality, but we need to handle it for type safety.
2699
- return {
2700
- span_id,
2701
- trace_id,
2702
- start_timestamp: 0,
2703
- data: {},
2704
- };
2705
- }
2706
-
2707
- function spanIsOpenTelemetrySdkTraceBaseSpan(span) {
2708
- const castSpan = span ;
2709
- return !!castSpan.attributes && !!castSpan.startTime && !!castSpan.name && !!castSpan.endTime && !!castSpan.status;
2710
- }
2711
-
2712
- /** Exported only for tests. */
2713
-
2714
- /**
2715
- * Sadly, due to circular dependency checks we cannot actually import the Span class here and check for instanceof.
2716
- * :( So instead we approximate this by checking if it has the `getSpanJSON` method.
2717
- */
2718
- function spanIsSentrySpan(span) {
2719
- return typeof (span ).getSpanJSON === 'function';
2720
- }
2721
-
2722
- /**
2723
- * Returns true if a span is sampled.
2724
- * In most cases, you should just use `span.isRecording()` instead.
2725
- * However, this has a slightly different semantic, as it also returns false if the span is finished.
2726
- * So in the case where this distinction is important, use this method.
2727
- */
2728
- function spanIsSampled(span) {
2729
- // We align our trace flags with the ones OpenTelemetry use
2730
- // So we also check for sampled the same way they do.
2731
- const { traceFlags } = span.spanContext();
2732
- return traceFlags === TRACE_FLAG_SAMPLED;
2733
- }
2734
-
2735
- /** Get the status message to use for a JSON representation of a span. */
2736
- function getStatusMessage(status) {
2737
- if (!status || status.code === SPAN_STATUS_UNSET) {
2738
- return undefined;
2739
- }
2740
-
2741
- if (status.code === SPAN_STATUS_OK) {
2742
- return 'ok';
2743
- }
2744
-
2745
- return status.message || 'internal_error';
2746
- }
2747
- const ROOT_SPAN_FIELD = '_sentryRootSpan';
2748
-
2749
- /**
2750
- * Returns the root span of a given span.
2751
- */
2752
- function getRootSpan(span) {
2753
- return span[ROOT_SPAN_FIELD] || span;
2754
- }
2755
-
2756
- /**
2757
- * Logs a warning once if `beforeSendSpan` is used to drop spans.
2758
- */
2759
- function showSpanDropWarning() {
2760
- if (!hasShownSpanDropWarning) {
2761
- consoleSandbox(() => {
2762
- // eslint-disable-next-line no-console
2763
- console.warn(
2764
- '[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.',
2765
- );
2766
- });
2767
- hasShownSpanDropWarning = true;
2768
- }
2769
- }
2770
-
2771
- // Treeshakable guard to remove all code related to tracing
2772
-
2773
- /**
2774
- * Determines if span recording is currently enabled.
2775
- *
2776
- * Spans are recorded when at least one of `tracesSampleRate` and `tracesSampler`
2777
- * is defined in the SDK config. This function does not make any assumption about
2778
- * sampling decisions, it only checks if the SDK is configured to record spans.
2779
- *
2780
- * Important: This function only determines if span recording is enabled. Trace
2781
- * continuation and propagation is separately controlled and not covered by this function.
2782
- * If this function returns `false`, traces can still be propagated (which is what
2783
- * we refer to by "Tracing without Performance")
2784
- * @see https://develop.sentry.dev/sdk/telemetry/traces/tracing-without-performance/
2785
- *
2786
- * @param maybeOptions An SDK options object to be passed to this function.
2787
- * If this option is not provided, the function will use the current client's options.
2788
- */
2789
- function hasSpansEnabled(
2790
- maybeOptions,
2791
- ) {
2792
- if (typeof __SENTRY_TRACING__ === 'boolean' && !__SENTRY_TRACING__) {
2793
- return false;
2794
- }
2795
-
2796
- const options = getClient()?.getOptions();
2797
- return (
2798
- !!options &&
2799
- // Note: This check is `!= null`, meaning "nullish". `0` is not "nullish", `undefined` and `null` are. (This comment was brought to you by 15 minutes of questioning life)
2800
- (options.tracesSampleRate != null || !!options.tracesSampler)
2801
- );
2802
- }
2803
-
2804
- const DEFAULT_ENVIRONMENT = 'production';
2805
-
2806
- /**
2807
- * If you change this value, also update the terser plugin config to
2808
- * avoid minification of the object property!
2809
- */
2810
- const FROZEN_DSC_FIELD = '_frozenDsc';
2811
-
2812
- /**
2813
- * Creates a dynamic sampling context from a client.
2814
- *
2815
- * Dispatches the `createDsc` lifecycle hook as a side effect.
2816
- */
2817
- function getDynamicSamplingContextFromClient(trace_id, client) {
2818
- const options = client.getOptions();
2819
-
2820
- const { publicKey: public_key } = client.getDsn() || {};
2821
-
2822
- // Instead of conditionally adding non-undefined values, we add them and then remove them if needed
2823
- // otherwise, the order of baggage entries changes, which "breaks" a bunch of tests etc.
2824
- const dsc = {
2825
- environment: options.environment || DEFAULT_ENVIRONMENT,
2826
- release: options.release,
2827
- public_key,
2828
- trace_id,
2829
- org_id: extractOrgIdFromClient(client),
2830
- };
2831
-
2832
- client.emit('createDsc', dsc);
2833
-
2834
- return dsc;
2835
- }
2836
-
2837
- /**
2838
- * Get the dynamic sampling context for the currently active scopes.
2839
- */
2840
- function getDynamicSamplingContextFromScope(client, scope) {
2841
- const propagationContext = scope.getPropagationContext();
2842
- return propagationContext.dsc || getDynamicSamplingContextFromClient(propagationContext.traceId, client);
2843
- }
2844
-
2845
- /**
2846
- * Creates a dynamic sampling context from a span (and client and scope)
2847
- *
2848
- * @param span the span from which a few values like the root span name and sample rate are extracted.
2849
- *
2850
- * @returns a dynamic sampling context
2851
- */
2852
- function getDynamicSamplingContextFromSpan(span) {
2853
- const client = getClient();
2854
- if (!client) {
2855
- return {};
2856
- }
2857
-
2858
- const rootSpan = getRootSpan(span);
2859
- const rootSpanJson = spanToJSON(rootSpan);
2860
- const rootSpanAttributes = rootSpanJson.data;
2861
- const traceState = rootSpan.spanContext().traceState;
2862
-
2863
- // The span sample rate that was locally applied to the root span should also always be applied to the DSC, even if the DSC is frozen.
2864
- // This is so that the downstream traces/services can use parentSampleRate in their `tracesSampler` to make consistent sampling decisions across the entire trace.
2865
- const rootSpanSampleRate =
2866
- traceState?.get('sentry.sample_rate') ??
2867
- rootSpanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE] ??
2868
- rootSpanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_PREVIOUS_TRACE_SAMPLE_RATE];
2869
-
2870
- function applyLocalSampleRateToDsc(dsc) {
2871
- if (typeof rootSpanSampleRate === 'number' || typeof rootSpanSampleRate === 'string') {
2872
- dsc.sample_rate = `${rootSpanSampleRate}`;
2873
- }
2874
- return dsc;
2875
- }
2876
-
2877
- // For core implementation, we freeze the DSC onto the span as a non-enumerable property
2878
- const frozenDsc = (rootSpan )[FROZEN_DSC_FIELD];
2879
- if (frozenDsc) {
2880
- return applyLocalSampleRateToDsc(frozenDsc);
2881
- }
2882
-
2883
- // For OpenTelemetry, we freeze the DSC on the trace state
2884
- const traceStateDsc = traceState?.get('sentry.dsc');
2885
-
2886
- // If the span has a DSC, we want it to take precedence
2887
- const dscOnTraceState = traceStateDsc && baggageHeaderToDynamicSamplingContext(traceStateDsc);
2888
-
2889
- if (dscOnTraceState) {
2890
- return applyLocalSampleRateToDsc(dscOnTraceState);
2891
- }
2892
-
2893
- // Else, we generate it from the span
2894
- const dsc = getDynamicSamplingContextFromClient(span.spanContext().traceId, client);
2895
-
2896
- // We don't want to have a transaction name in the DSC if the source is "url" because URLs might contain PII
2897
- const source = rootSpanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
2898
-
2899
- // after JSON conversion, txn.name becomes jsonSpan.description
2900
- const name = rootSpanJson.description;
2901
- if (source !== 'url' && name) {
2902
- dsc.transaction = name;
2903
- }
2904
-
2905
- // How can we even land here with hasSpansEnabled() returning false?
2906
- // Otel creates a Non-recording span in Tracing Without Performance mode when handling incoming requests
2907
- // So we end up with an active span that is not sampled (neither positively nor negatively)
2908
- if (hasSpansEnabled()) {
2909
- dsc.sampled = String(spanIsSampled(rootSpan));
2910
- dsc.sample_rand =
2911
- // In OTEL we store the sample rand on the trace state because we cannot access scopes for NonRecordingSpans
2912
- // The Sentry OTEL SpanSampler takes care of writing the sample rand on the root span
2913
- traceState?.get('sentry.sample_rand') ??
2914
- // On all other platforms we can actually get the scopes from a root span (we use this as a fallback)
2915
- getCapturedScopesOnSpan(rootSpan).scope?.getPropagationContext().sampleRand.toString();
2916
- }
2917
-
2918
- applyLocalSampleRateToDsc(dsc);
2919
-
2920
- client.emit('createDsc', dsc, rootSpan);
2921
-
2922
- return dsc;
2923
- }
2924
-
2925
- /**
2926
- * Recursively normalizes the given object.
2927
- *
2928
- * - Creates a copy to prevent original input mutation
2929
- * - Skips non-enumerable properties
2930
- * - When stringifying, calls `toJSON` if implemented
2931
- * - Removes circular references
2932
- * - Translates non-serializable values (`undefined`/`NaN`/functions) to serializable format
2933
- * - Translates known global objects/classes to a string representations
2934
- * - Takes care of `Error` object serialization
2935
- * - Optionally limits depth of final output
2936
- * - Optionally limits number of properties/elements included in any single object/array
2937
- *
2938
- * @param input The object to be normalized.
2939
- * @param depth The max depth to which to normalize the object. (Anything deeper stringified whole.)
2940
- * @param maxProperties The max number of elements or properties to be included in any single array or
2941
- * object in the normalized output.
2942
- * @returns A normalized version of the object, or `"**non-serializable**"` if any errors are thrown during normalization.
2943
- */
2944
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2945
- function normalize(input, depth = 100, maxProperties = +Infinity) {
2946
- try {
2947
- // since we're at the outermost level, we don't provide a key
2948
- return visit('', input, depth, maxProperties);
2949
- } catch (err) {
2950
- return { ERROR: `**non-serializable** (${err})` };
2951
- }
2952
- }
2953
-
2954
- /** JSDoc */
2955
- function normalizeToSize(
2956
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2957
- object,
2958
- // Default Node.js REPL depth
2959
- depth = 3,
2960
- // 100kB, as 200kB is max payload size, so half sounds reasonable
2961
- maxSize = 100 * 1024,
2962
- ) {
2963
- const normalized = normalize(object, depth);
2964
-
2965
- if (jsonSize(normalized) > maxSize) {
2966
- return normalizeToSize(object, depth - 1, maxSize);
2967
- }
2968
-
2969
- return normalized ;
2970
- }
2971
-
2972
- /**
2973
- * Visits a node to perform normalization on it
2974
- *
2975
- * @param key The key corresponding to the given node
2976
- * @param value The node to be visited
2977
- * @param depth Optional number indicating the maximum recursion depth
2978
- * @param maxProperties Optional maximum number of properties/elements included in any single object/array
2979
- * @param memo Optional Memo class handling decycling
2980
- */
2981
- function visit(
2982
- key,
2983
- value,
2984
- depth = +Infinity,
2985
- maxProperties = +Infinity,
2986
- memo = memoBuilder(),
2987
- ) {
2988
- const [memoize, unmemoize] = memo;
2989
-
2990
- // Get the simple cases out of the way first
2991
- if (
2992
- value == null || // this matches null and undefined -> eqeq not eqeqeq
2993
- ['boolean', 'string'].includes(typeof value) ||
2994
- (typeof value === 'number' && Number.isFinite(value))
2995
- ) {
2996
- return value ;
2997
- }
2998
-
2999
- const stringified = stringifyValue(key, value);
3000
-
3001
- // Anything we could potentially dig into more (objects or arrays) will have come back as `"[object XXXX]"`.
3002
- // Everything else will have already been serialized, so if we don't see that pattern, we're done.
3003
- if (!stringified.startsWith('[object ')) {
3004
- return stringified;
3005
- }
3006
-
3007
- // From here on, we can assert that `value` is either an object or an array.
3008
-
3009
- // Do not normalize objects that we know have already been normalized. As a general rule, the
3010
- // "__sentry_skip_normalization__" property should only be used sparingly and only should only be set on objects that
3011
- // have already been normalized.
3012
- if ((value )['__sentry_skip_normalization__']) {
3013
- return value ;
3014
- }
3015
-
3016
- // We can set `__sentry_override_normalization_depth__` on an object to ensure that from there
3017
- // We keep a certain amount of depth.
3018
- // This should be used sparingly, e.g. we use it for the redux integration to ensure we get a certain amount of state.
3019
- const remainingDepth =
3020
- typeof (value )['__sentry_override_normalization_depth__'] === 'number'
3021
- ? ((value )['__sentry_override_normalization_depth__'] )
3022
- : depth;
3023
-
3024
- // We're also done if we've reached the max depth
3025
- if (remainingDepth === 0) {
3026
- // At this point we know `serialized` is a string of the form `"[object XXXX]"`. Clean it up so it's just `"[XXXX]"`.
3027
- return stringified.replace('object ', '');
3028
- }
3029
-
3030
- // If we've already visited this branch, bail out, as it's circular reference. If not, note that we're seeing it now.
3031
- if (memoize(value)) {
3032
- return '[Circular ~]';
3033
- }
3034
-
3035
- // If the value has a `toJSON` method, we call it to extract more information
3036
- const valueWithToJSON = value ;
3037
- if (valueWithToJSON && typeof valueWithToJSON.toJSON === 'function') {
3038
- try {
3039
- const jsonValue = valueWithToJSON.toJSON();
3040
- // We need to normalize the return value of `.toJSON()` in case it has circular references
3041
- return visit('', jsonValue, remainingDepth - 1, maxProperties, memo);
3042
- } catch {
3043
- // pass (The built-in `toJSON` failed, but we can still try to do it ourselves)
3044
- }
3045
- }
3046
-
3047
- // At this point we know we either have an object or an array, we haven't seen it before, and we're going to recurse
3048
- // because we haven't yet reached the max depth. Create an accumulator to hold the results of visiting each
3049
- // property/entry, and keep track of the number of items we add to it.
3050
- const normalized = (Array.isArray(value) ? [] : {}) ;
3051
- let numAdded = 0;
3052
-
3053
- // Before we begin, convert`Error` and`Event` instances into plain objects, since some of each of their relevant
3054
- // properties are non-enumerable and otherwise would get missed.
3055
- const visitable = convertToPlainObject(value );
3056
-
3057
- for (const visitKey in visitable) {
3058
- // Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.
3059
- if (!Object.prototype.hasOwnProperty.call(visitable, visitKey)) {
3060
- continue;
3061
- }
3062
-
3063
- if (numAdded >= maxProperties) {
3064
- normalized[visitKey] = '[MaxProperties ~]';
3065
- break;
3066
- }
3067
-
3068
- // Recursively visit all the child nodes
3069
- const visitValue = visitable[visitKey];
3070
- normalized[visitKey] = visit(visitKey, visitValue, remainingDepth - 1, maxProperties, memo);
3071
-
3072
- numAdded++;
3073
- }
3074
-
3075
- // Once we've visited all the branches, remove the parent from memo storage
3076
- unmemoize(value);
3077
-
3078
- // Return accumulated values
3079
- return normalized;
3080
- }
3081
-
3082
- /* eslint-disable complexity */
3083
- /**
3084
- * Stringify the given value. Handles various known special values and types.
3085
- *
3086
- * Not meant to be used on simple primitives which already have a string representation, as it will, for example, turn
3087
- * the number 1231 into "[Object Number]", nor on `null`, as it will throw.
3088
- *
3089
- * @param value The value to stringify
3090
- * @returns A stringified representation of the given value
3091
- */
3092
- function stringifyValue(
3093
- key,
3094
- // this type is a tiny bit of a cheat, since this function does handle NaN (which is technically a number), but for
3095
- // our internal use, it'll do
3096
- value,
3097
- ) {
3098
- try {
3099
- if (key === 'domain' && value && typeof value === 'object' && (value )._events) {
3100
- return '[Domain]';
3101
- }
3102
-
3103
- if (key === 'domainEmitter') {
3104
- return '[DomainEmitter]';
3105
- }
3106
-
3107
- // It's safe to use `global`, `window`, and `document` here in this manner, as we are asserting using `typeof` first
3108
- // which won't throw if they are not present.
3109
-
3110
- if (typeof global !== 'undefined' && value === global) {
3111
- return '[Global]';
3112
- }
3113
-
3114
- // eslint-disable-next-line no-restricted-globals
3115
- if (typeof window !== 'undefined' && value === window) {
3116
- return '[Window]';
3117
- }
3118
-
3119
- // eslint-disable-next-line no-restricted-globals
3120
- if (typeof document !== 'undefined' && value === document) {
3121
- return '[Document]';
3122
- }
3123
-
3124
- if (isVueViewModel(value)) {
3125
- return getVueInternalName(value);
3126
- }
3127
-
3128
- // React's SyntheticEvent thingy
3129
- if (isSyntheticEvent(value)) {
3130
- return '[SyntheticEvent]';
3131
- }
3132
-
3133
- if (typeof value === 'number' && !Number.isFinite(value)) {
3134
- return `[${value}]`;
3135
- }
3136
-
3137
- if (typeof value === 'function') {
3138
- return `[Function: ${getFunctionName(value)}]`;
3139
- }
3140
-
3141
- if (typeof value === 'symbol') {
3142
- return `[${String(value)}]`;
3143
- }
3144
-
3145
- // stringified BigInts are indistinguishable from regular numbers, so we need to label them to avoid confusion
3146
- if (typeof value === 'bigint') {
3147
- return `[BigInt: ${String(value)}]`;
3148
- }
3149
-
3150
- // Now that we've knocked out all the special cases and the primitives, all we have left are objects. Simply casting
3151
- // them to strings means that instances of classes which haven't defined their `toStringTag` will just come out as
3152
- // `"[object Object]"`. If we instead look at the constructor's name (which is the same as the name of the class),
3153
- // we can make sure that only plain objects come out that way.
3154
- const objName = getConstructorName(value);
3155
-
3156
- // Handle HTML Elements
3157
- if (/^HTML(\w*)Element$/.test(objName)) {
3158
- return `[HTMLElement: ${objName}]`;
3159
- }
3160
-
3161
- return `[object ${objName}]`;
3162
- } catch (err) {
3163
- return `**non-serializable** (${err})`;
3164
- }
3165
- }
3166
- /* eslint-enable complexity */
3167
-
3168
- function getConstructorName(value) {
3169
- const prototype = Object.getPrototypeOf(value);
3170
-
3171
- return prototype?.constructor ? prototype.constructor.name : 'null prototype';
3172
- }
3173
-
3174
- /** Calculates bytes size of input string */
3175
- function utf8Length(value) {
3176
- // eslint-disable-next-line no-bitwise
3177
- return ~-encodeURI(value).split(/%..|./).length;
3178
- }
3179
-
3180
- /** Calculates bytes size of input object */
3181
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3182
- function jsonSize(value) {
3183
- return utf8Length(JSON.stringify(value));
3184
- }
3185
-
3186
- /**
3187
- * Helper to decycle json objects
3188
- */
3189
- function memoBuilder() {
3190
- const inner = new WeakSet();
3191
- function memoize(obj) {
3192
- if (inner.has(obj)) {
3193
- return true;
3194
- }
3195
- inner.add(obj);
3196
- return false;
3197
- }
3198
-
3199
- function unmemoize(obj) {
3200
- inner.delete(obj);
3201
- }
3202
- return [memoize, unmemoize];
3203
- }
3204
-
3205
- /* eslint-disable @typescript-eslint/no-explicit-any */
3206
-
3207
- /** SyncPromise internal states */
3208
- const STATE_PENDING = 0;
3209
- const STATE_RESOLVED = 1;
3210
- const STATE_REJECTED = 2;
3211
-
3212
- /**
3213
- * Creates a resolved sync promise.
3214
- *
3215
- * @param value the value to resolve the promise with
3216
- * @returns the resolved sync promise
3217
- */
3218
- function resolvedSyncPromise(value) {
3219
- return new SyncPromise(resolve => {
3220
- resolve(value);
3221
- });
3222
- }
3223
-
3224
- /**
3225
- * Creates a rejected sync promise.
3226
- *
3227
- * @param value the value to reject the promise with
3228
- * @returns the rejected sync promise
3229
- */
3230
- function rejectedSyncPromise(reason) {
3231
- return new SyncPromise((_, reject) => {
3232
- reject(reason);
3233
- });
3234
- }
3235
-
3236
- /**
3237
- * Thenable class that behaves like a Promise and follows it's interface
3238
- * but is not async internally
3239
- */
3240
- class SyncPromise {
3241
-
3242
- constructor(executor) {
3243
- this._state = STATE_PENDING;
3244
- this._handlers = [];
3245
-
3246
- this._runExecutor(executor);
3247
- }
3248
-
3249
- /** @inheritdoc */
3250
- then(
3251
- onfulfilled,
3252
- onrejected,
3253
- ) {
3254
- return new SyncPromise((resolve, reject) => {
3255
- this._handlers.push([
3256
- false,
3257
- result => {
3258
- if (!onfulfilled) {
3259
- // TODO: ¯\_(ツ)_/¯
3260
- // TODO: FIXME
3261
- resolve(result );
3262
- } else {
3263
- try {
3264
- resolve(onfulfilled(result));
3265
- } catch (e) {
3266
- reject(e);
3267
- }
3268
- }
3269
- },
3270
- reason => {
3271
- if (!onrejected) {
3272
- reject(reason);
3273
- } else {
3274
- try {
3275
- resolve(onrejected(reason));
3276
- } catch (e) {
3277
- reject(e);
3278
- }
3279
- }
3280
- },
3281
- ]);
3282
- this._executeHandlers();
3283
- });
3284
- }
3285
-
3286
- /** @inheritdoc */
3287
- catch(
3288
- onrejected,
3289
- ) {
3290
- return this.then(val => val, onrejected);
3291
- }
3292
-
3293
- /** @inheritdoc */
3294
- finally(onfinally) {
3295
- return new SyncPromise((resolve, reject) => {
3296
- let val;
3297
- let isRejected;
3298
-
3299
- return this.then(
3300
- value => {
3301
- isRejected = false;
3302
- val = value;
3303
- if (onfinally) {
3304
- onfinally();
3305
- }
3306
- },
3307
- reason => {
3308
- isRejected = true;
3309
- val = reason;
3310
- if (onfinally) {
3311
- onfinally();
3312
- }
3313
- },
3314
- ).then(() => {
3315
- if (isRejected) {
3316
- reject(val);
3317
- return;
3318
- }
3319
-
3320
- resolve(val );
3321
- });
3322
- });
3323
- }
3324
-
3325
- /** Excute the resolve/reject handlers. */
3326
- _executeHandlers() {
3327
- if (this._state === STATE_PENDING) {
3328
- return;
3329
- }
3330
-
3331
- const cachedHandlers = this._handlers.slice();
3332
- this._handlers = [];
3333
-
3334
- cachedHandlers.forEach(handler => {
3335
- if (handler[0]) {
3336
- return;
3337
- }
3338
-
3339
- if (this._state === STATE_RESOLVED) {
3340
- handler[1](this._value );
3341
- }
3342
-
3343
- if (this._state === STATE_REJECTED) {
3344
- handler[2](this._value);
3345
- }
3346
-
3347
- handler[0] = true;
3348
- });
3349
- }
3350
-
3351
- /** Run the executor for the SyncPromise. */
3352
- _runExecutor(executor) {
3353
- const setResult = (state, value) => {
3354
- if (this._state !== STATE_PENDING) {
3355
- return;
3356
- }
3357
-
3358
- if (isThenable(value)) {
3359
- void (value ).then(resolve, reject);
3360
- return;
3361
- }
3362
-
3363
- this._state = state;
3364
- this._value = value;
3365
-
3366
- this._executeHandlers();
3367
- };
3368
-
3369
- const resolve = (value) => {
3370
- setResult(STATE_RESOLVED, value);
3371
- };
3372
-
3373
- const reject = (reason) => {
3374
- setResult(STATE_REJECTED, reason);
3375
- };
3376
-
3377
- try {
3378
- executor(resolve, reject);
3379
- } catch (e) {
3380
- reject(e);
3381
- }
3382
- }
3383
- }
3384
-
3385
- /**
3386
- * Process an array of event processors, returning the processed event (or `null` if the event was dropped).
3387
- */
3388
- function notifyEventProcessors(
3389
- processors,
3390
- event,
3391
- hint,
3392
- index = 0,
3393
- ) {
3394
- try {
3395
- const result = _notifyEventProcessors(event, hint, processors, index);
3396
- return isThenable(result) ? result : resolvedSyncPromise(result);
3397
- } catch (error) {
3398
- return rejectedSyncPromise(error);
3399
- }
3400
- }
3401
-
3402
- function _notifyEventProcessors(
3403
- event,
3404
- hint,
3405
- processors,
3406
- index,
3407
- ) {
3408
- const processor = processors[index];
3409
-
3410
- if (!event || !processor) {
3411
- return event;
3412
- }
3413
-
3414
- const result = processor({ ...event }, hint);
3415
-
3416
- DEBUG_BUILD && result === null && debug.log(`Event processor "${processor.id || '?'}" dropped event`);
3417
-
3418
- if (isThenable(result)) {
3419
- return result.then(final => _notifyEventProcessors(final, hint, processors, index + 1));
3420
- }
3421
-
3422
- return _notifyEventProcessors(result, hint, processors, index + 1);
3423
- }
3424
-
3425
- /**
3426
- * Applies data from the scope to the event and runs all event processors on it.
3427
- */
3428
- function applyScopeDataToEvent(event, data) {
3429
- const { fingerprint, span, breadcrumbs, sdkProcessingMetadata } = data;
3430
-
3431
- // Apply general data
3432
- applyDataToEvent(event, data);
3433
-
3434
- // We want to set the trace context for normal events only if there isn't already
3435
- // a trace context on the event. There is a product feature in place where we link
3436
- // errors with transaction and it relies on that.
3437
- if (span) {
3438
- applySpanToEvent(event, span);
3439
- }
3440
-
3441
- applyFingerprintToEvent(event, fingerprint);
3442
- applyBreadcrumbsToEvent(event, breadcrumbs);
3443
- applySdkMetadataToEvent(event, sdkProcessingMetadata);
3444
- }
3445
-
3446
- /** Merge data of two scopes together. */
3447
- function mergeScopeData(data, mergeData) {
3448
- const {
3449
- extra,
3450
- tags,
3451
- user,
3452
- contexts,
3453
- level,
3454
- sdkProcessingMetadata,
3455
- breadcrumbs,
3456
- fingerprint,
3457
- eventProcessors,
3458
- attachments,
3459
- propagationContext,
3460
- transactionName,
3461
- span,
3462
- } = mergeData;
3463
-
3464
- mergeAndOverwriteScopeData(data, 'extra', extra);
3465
- mergeAndOverwriteScopeData(data, 'tags', tags);
3466
- mergeAndOverwriteScopeData(data, 'user', user);
3467
- mergeAndOverwriteScopeData(data, 'contexts', contexts);
3468
-
3469
- data.sdkProcessingMetadata = merge(data.sdkProcessingMetadata, sdkProcessingMetadata, 2);
3470
-
3471
- if (level) {
3472
- data.level = level;
3473
- }
3474
-
3475
- if (transactionName) {
3476
- data.transactionName = transactionName;
3477
- }
3478
-
3479
- if (span) {
3480
- data.span = span;
3481
- }
3482
-
3483
- if (breadcrumbs.length) {
3484
- data.breadcrumbs = [...data.breadcrumbs, ...breadcrumbs];
3485
- }
3486
-
3487
- if (fingerprint.length) {
3488
- data.fingerprint = [...data.fingerprint, ...fingerprint];
3489
- }
3490
-
3491
- if (eventProcessors.length) {
3492
- data.eventProcessors = [...data.eventProcessors, ...eventProcessors];
3493
- }
3494
-
3495
- if (attachments.length) {
3496
- data.attachments = [...data.attachments, ...attachments];
3497
- }
3498
-
3499
- data.propagationContext = { ...data.propagationContext, ...propagationContext };
3500
- }
3501
-
3502
- /**
3503
- * Merges certain scope data. Undefined values will overwrite any existing values.
3504
- * Exported only for tests.
3505
- */
3506
- function mergeAndOverwriteScopeData
3507
-
3508
- (data, prop, mergeVal) {
3509
- data[prop] = merge(data[prop], mergeVal, 1);
3510
- }
3511
-
3512
- function applyDataToEvent(event, data) {
3513
- const { extra, tags, user, contexts, level, transactionName } = data;
3514
-
3515
- if (Object.keys(extra).length) {
3516
- event.extra = { ...extra, ...event.extra };
3517
- }
3518
-
3519
- if (Object.keys(tags).length) {
3520
- event.tags = { ...tags, ...event.tags };
3521
- }
3522
-
3523
- if (Object.keys(user).length) {
3524
- event.user = { ...user, ...event.user };
3525
- }
3526
-
3527
- if (Object.keys(contexts).length) {
3528
- event.contexts = { ...contexts, ...event.contexts };
3529
- }
3530
-
3531
- if (level) {
3532
- event.level = level;
3533
- }
3534
-
3535
- // transaction events get their `transaction` from the root span name
3536
- if (transactionName && event.type !== 'transaction') {
3537
- event.transaction = transactionName;
3538
- }
3539
- }
3540
-
3541
- function applyBreadcrumbsToEvent(event, breadcrumbs) {
3542
- const mergedBreadcrumbs = [...(event.breadcrumbs || []), ...breadcrumbs];
3543
- event.breadcrumbs = mergedBreadcrumbs.length ? mergedBreadcrumbs : undefined;
3544
- }
3545
-
3546
- function applySdkMetadataToEvent(event, sdkProcessingMetadata) {
3547
- event.sdkProcessingMetadata = {
3548
- ...event.sdkProcessingMetadata,
3549
- ...sdkProcessingMetadata,
3550
- };
3551
- }
3552
-
3553
- function applySpanToEvent(event, span) {
3554
- event.contexts = {
3555
- trace: spanToTraceContext(span),
3556
- ...event.contexts,
3557
- };
3558
-
3559
- event.sdkProcessingMetadata = {
3560
- dynamicSamplingContext: getDynamicSamplingContextFromSpan(span),
3561
- ...event.sdkProcessingMetadata,
3562
- };
3563
-
3564
- const rootSpan = getRootSpan(span);
3565
- const transactionName = spanToJSON(rootSpan).description;
3566
- if (transactionName && !event.transaction && event.type === 'transaction') {
3567
- event.transaction = transactionName;
3568
- }
3569
- }
3570
-
3571
- /**
3572
- * Applies fingerprint from the scope to the event if there's one,
3573
- * uses message if there's one instead or get rid of empty fingerprint
3574
- */
3575
- function applyFingerprintToEvent(event, fingerprint) {
3576
- // Make sure it's an array first and we actually have something in place
3577
- event.fingerprint = event.fingerprint
3578
- ? Array.isArray(event.fingerprint)
3579
- ? event.fingerprint
3580
- : [event.fingerprint]
3581
- : [];
3582
-
3583
- // If we have something on the scope, then merge it with event
3584
- if (fingerprint) {
3585
- event.fingerprint = event.fingerprint.concat(fingerprint);
3586
- }
3587
-
3588
- // If we have no data at all, remove empty array default
3589
- if (!event.fingerprint.length) {
3590
- delete event.fingerprint;
3591
- }
3592
- }
3593
-
3594
- let parsedStackResults;
3595
- let lastSentryKeysCount;
3596
- let lastNativeKeysCount;
3597
- let cachedFilenameDebugIds;
3598
-
3599
- /**
3600
- * Returns a map of filenames to debug identifiers.
3601
- * Supports both proprietary _sentryDebugIds and native _debugIds (e.g., from Vercel) formats.
3602
- */
3603
- function getFilenameToDebugIdMap(stackParser) {
3604
- const sentryDebugIdMap = GLOBAL_OBJ._sentryDebugIds;
3605
- const nativeDebugIdMap = GLOBAL_OBJ._debugIds;
3606
-
3607
- if (!sentryDebugIdMap && !nativeDebugIdMap) {
3608
- return {};
3609
- }
3610
-
3611
- const sentryDebugIdKeys = sentryDebugIdMap ? Object.keys(sentryDebugIdMap) : [];
3612
- const nativeDebugIdKeys = nativeDebugIdMap ? Object.keys(nativeDebugIdMap) : [];
3613
-
3614
- // If the count of registered globals hasn't changed since the last call, we
3615
- // can just return the cached result.
3616
- if (
3617
- cachedFilenameDebugIds &&
3618
- sentryDebugIdKeys.length === lastSentryKeysCount &&
3619
- nativeDebugIdKeys.length === lastNativeKeysCount
3620
- ) {
3621
- return cachedFilenameDebugIds;
3622
- }
3623
-
3624
- lastSentryKeysCount = sentryDebugIdKeys.length;
3625
- lastNativeKeysCount = nativeDebugIdKeys.length;
3626
-
3627
- // Build a map of filename -> debug_id from both sources
3628
- cachedFilenameDebugIds = {};
3629
-
3630
- if (!parsedStackResults) {
3631
- parsedStackResults = {};
3632
- }
3633
-
3634
- const processDebugIds = (debugIdKeys, debugIdMap) => {
3635
- for (const key of debugIdKeys) {
3636
- const debugId = debugIdMap[key];
3637
- const result = parsedStackResults?.[key];
3638
-
3639
- if (result && cachedFilenameDebugIds && debugId) {
3640
- // Use cached filename but update with current debug ID
3641
- cachedFilenameDebugIds[result[0]] = debugId;
3642
- // Update cached result with new debug ID
3643
- if (parsedStackResults) {
3644
- parsedStackResults[key] = [result[0], debugId];
3645
- }
3646
- } else if (debugId) {
3647
- const parsedStack = stackParser(key);
3648
-
3649
- for (let i = parsedStack.length - 1; i >= 0; i--) {
3650
- const stackFrame = parsedStack[i];
3651
- const filename = stackFrame?.filename;
3652
-
3653
- if (filename && cachedFilenameDebugIds && parsedStackResults) {
3654
- cachedFilenameDebugIds[filename] = debugId;
3655
- parsedStackResults[key] = [filename, debugId];
3656
- break;
3657
- }
3658
- }
3659
- }
3660
- }
3661
- };
3662
-
3663
- if (sentryDebugIdMap) {
3664
- processDebugIds(sentryDebugIdKeys, sentryDebugIdMap);
3665
- }
3666
-
3667
- // Native _debugIds will override _sentryDebugIds if same file
3668
- if (nativeDebugIdMap) {
3669
- processDebugIds(nativeDebugIdKeys, nativeDebugIdMap);
3670
- }
3671
-
3672
- return cachedFilenameDebugIds;
3673
- }
3674
-
3675
- /**
3676
- * This type makes sure that we get either a CaptureContext, OR an EventHint.
3677
- * It does not allow mixing them, which could lead to unexpected outcomes, e.g. this is disallowed:
3678
- * { user: { id: '123' }, mechanism: { handled: false } }
3679
- */
3680
-
3681
- /**
3682
- * Adds common information to events.
3683
- *
3684
- * The information includes release and environment from `options`,
3685
- * breadcrumbs and context (extra, tags and user) from the scope.
3686
- *
3687
- * Information that is already present in the event is never overwritten. For
3688
- * nested objects, such as the context, keys are merged.
3689
- *
3690
- * @param event The original event.
3691
- * @param hint May contain additional information about the original exception.
3692
- * @param scope A scope containing event metadata.
3693
- * @returns A new event with more information.
3694
- * @hidden
3695
- */
3696
- function prepareEvent(
3697
- options,
3698
- event,
3699
- hint,
3700
- scope,
3701
- client,
3702
- isolationScope,
3703
- ) {
3704
- const { normalizeDepth = 3, normalizeMaxBreadth = 1000 } = options;
3705
- const prepared = {
3706
- ...event,
3707
- event_id: event.event_id || hint.event_id || uuid4(),
3708
- timestamp: event.timestamp || dateTimestampInSeconds(),
3709
- };
3710
- const integrations = hint.integrations || options.integrations.map(i => i.name);
3711
-
3712
- applyClientOptions(prepared, options);
3713
- applyIntegrationsMetadata(prepared, integrations);
3714
-
3715
- if (client) {
3716
- client.emit('applyFrameMetadata', event);
3717
- }
3718
-
3719
- // Only put debug IDs onto frames for error events.
3720
- if (event.type === undefined) {
3721
- applyDebugIds(prepared, options.stackParser);
3722
- }
3723
-
3724
- // If we have scope given to us, use it as the base for further modifications.
3725
- // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.
3726
- const finalScope = getFinalScope(scope, hint.captureContext);
3727
-
3728
- if (hint.mechanism) {
3729
- addExceptionMechanism(prepared, hint.mechanism);
3730
- }
3731
-
3732
- const clientEventProcessors = client ? client.getEventProcessors() : [];
3733
-
3734
- // This should be the last thing called, since we want that
3735
- // {@link Scope.addEventProcessor} gets the finished prepared event.
3736
- // Merge scope data together
3737
- const data = getGlobalScope().getScopeData();
3738
-
3739
- if (isolationScope) {
3740
- const isolationData = isolationScope.getScopeData();
3741
- mergeScopeData(data, isolationData);
3742
- }
3743
-
3744
- if (finalScope) {
3745
- const finalScopeData = finalScope.getScopeData();
3746
- mergeScopeData(data, finalScopeData);
3747
- }
3748
-
3749
- const attachments = [...(hint.attachments || []), ...data.attachments];
3750
- if (attachments.length) {
3751
- hint.attachments = attachments;
3752
- }
3753
-
3754
- applyScopeDataToEvent(prepared, data);
3755
-
3756
- const eventProcessors = [
3757
- ...clientEventProcessors,
3758
- // Run scope event processors _after_ all other processors
3759
- ...data.eventProcessors,
3760
- ];
3761
-
3762
- const result = notifyEventProcessors(eventProcessors, prepared, hint);
3763
-
3764
- return result.then(evt => {
3765
- if (evt) {
3766
- // We apply the debug_meta field only after all event processors have ran, so that if any event processors modified
3767
- // file names (e.g.the RewriteFrames integration) the filename -> debug ID relationship isn't destroyed.
3768
- // This should not cause any PII issues, since we're only moving data that is already on the event and not adding
3769
- // any new data
3770
- applyDebugMeta(evt);
3771
- }
3772
-
3773
- if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
3774
- return normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth);
3775
- }
3776
- return evt;
3777
- });
3778
- }
3779
-
3780
- /**
3781
- * Enhances event using the client configuration.
3782
- * It takes care of all "static" values like environment, release and `dist`,
3783
- * as well as truncating overly long values.
3784
- *
3785
- * Only exported for tests.
3786
- *
3787
- * @param event event instance to be enhanced
3788
- */
3789
- function applyClientOptions(event, options) {
3790
- const { environment, release, dist, maxValueLength } = options;
3791
-
3792
- // empty strings do not make sense for environment, release, and dist
3793
- // so we handle them the same as if they were not provided
3794
- event.environment = event.environment || environment || DEFAULT_ENVIRONMENT;
3795
-
3796
- if (!event.release && release) {
3797
- event.release = release;
3798
- }
3799
-
3800
- if (!event.dist && dist) {
3801
- event.dist = dist;
3802
- }
3803
-
3804
- const request = event.request;
3805
- if (request?.url) {
3806
- request.url = maxValueLength ? truncate(request.url, maxValueLength) : request.url;
3807
- }
3808
- }
3809
-
3810
- /**
3811
- * Puts debug IDs into the stack frames of an error event.
3812
- */
3813
- function applyDebugIds(event, stackParser) {
3814
- // Build a map of filename -> debug_id
3815
- const filenameDebugIdMap = getFilenameToDebugIdMap(stackParser);
3816
-
3817
- event.exception?.values?.forEach(exception => {
3818
- exception.stacktrace?.frames?.forEach(frame => {
3819
- if (frame.filename) {
3820
- frame.debug_id = filenameDebugIdMap[frame.filename];
3821
- }
3822
- });
3823
- });
3824
- }
3825
-
3826
- /**
3827
- * Moves debug IDs from the stack frames of an error event into the debug_meta field.
3828
- */
3829
- function applyDebugMeta(event) {
3830
- // Extract debug IDs and filenames from the stack frames on the event.
3831
- const filenameDebugIdMap = {};
3832
- event.exception?.values?.forEach(exception => {
3833
- exception.stacktrace?.frames?.forEach(frame => {
3834
- if (frame.debug_id) {
3835
- if (frame.abs_path) {
3836
- filenameDebugIdMap[frame.abs_path] = frame.debug_id;
3837
- } else if (frame.filename) {
3838
- filenameDebugIdMap[frame.filename] = frame.debug_id;
3839
- }
3840
- delete frame.debug_id;
3841
- }
3842
- });
3843
- });
3844
-
3845
- if (Object.keys(filenameDebugIdMap).length === 0) {
3846
- return;
3847
- }
3848
-
3849
- // Fill debug_meta information
3850
- event.debug_meta = event.debug_meta || {};
3851
- event.debug_meta.images = event.debug_meta.images || [];
3852
- const images = event.debug_meta.images;
3853
- Object.entries(filenameDebugIdMap).forEach(([filename, debug_id]) => {
3854
- images.push({
3855
- type: 'sourcemap',
3856
- code_file: filename,
3857
- debug_id,
3858
- });
3859
- });
3860
- }
3861
-
3862
- /**
3863
- * This function adds all used integrations to the SDK info in the event.
3864
- * @param event The event that will be filled with all integrations.
3865
- */
3866
- function applyIntegrationsMetadata(event, integrationNames) {
3867
- if (integrationNames.length > 0) {
3868
- event.sdk = event.sdk || {};
3869
- event.sdk.integrations = [...(event.sdk.integrations || []), ...integrationNames];
3870
- }
3871
- }
3872
-
3873
- /**
3874
- * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.
3875
- * Normalized keys:
3876
- * - `breadcrumbs.data`
3877
- * - `user`
3878
- * - `contexts`
3879
- * - `extra`
3880
- * @param event Event
3881
- * @returns Normalized event
3882
- */
3883
- function normalizeEvent(event, depth, maxBreadth) {
3884
- if (!event) {
3885
- return null;
3886
- }
3887
-
3888
- const normalized = {
3889
- ...event,
3890
- ...(event.breadcrumbs && {
3891
- breadcrumbs: event.breadcrumbs.map(b => ({
3892
- ...b,
3893
- ...(b.data && {
3894
- data: normalize(b.data, depth, maxBreadth),
3895
- }),
3896
- })),
3897
- }),
3898
- ...(event.user && {
3899
- user: normalize(event.user, depth, maxBreadth),
3900
- }),
3901
- ...(event.contexts && {
3902
- contexts: normalize(event.contexts, depth, maxBreadth),
3903
- }),
3904
- ...(event.extra && {
3905
- extra: normalize(event.extra, depth, maxBreadth),
3906
- }),
3907
- };
3908
-
3909
- // event.contexts.trace stores information about a Transaction. Similarly,
3910
- // event.spans[] stores information about child Spans. Given that a
3911
- // Transaction is conceptually a Span, normalization should apply to both
3912
- // Transactions and Spans consistently.
3913
- // For now the decision is to skip normalization of Transactions and Spans,
3914
- // so this block overwrites the normalized event to add back the original
3915
- // Transaction information prior to normalization.
3916
- if (event.contexts?.trace && normalized.contexts) {
3917
- normalized.contexts.trace = event.contexts.trace;
3918
-
3919
- // event.contexts.trace.data may contain circular/dangerous data so we need to normalize it
3920
- if (event.contexts.trace.data) {
3921
- normalized.contexts.trace.data = normalize(event.contexts.trace.data, depth, maxBreadth);
3922
- }
3923
- }
3924
-
3925
- // event.spans[].data may contain circular/dangerous data so we need to normalize it
3926
- if (event.spans) {
3927
- normalized.spans = event.spans.map(span => {
3928
- return {
3929
- ...span,
3930
- ...(span.data && {
3931
- data: normalize(span.data, depth, maxBreadth),
3932
- }),
3933
- };
3934
- });
3935
- }
3936
-
3937
- // event.contexts.flags (FeatureFlagContext) stores context for our feature
3938
- // flag integrations. It has a greater nesting depth than our other typed
3939
- // Contexts, so we re-normalize with a fixed depth of 3 here. We do not want
3940
- // to skip this in case of conflicting, user-provided context.
3941
- if (event.contexts?.flags && normalized.contexts) {
3942
- normalized.contexts.flags = normalize(event.contexts.flags, 3, maxBreadth);
3943
- }
3944
-
3945
- return normalized;
3946
- }
3947
-
3948
- function getFinalScope(scope, captureContext) {
3949
- if (!captureContext) {
3950
- return scope;
3951
- }
3952
-
3953
- const finalScope = scope ? scope.clone() : new Scope();
3954
- finalScope.update(captureContext);
3955
- return finalScope;
3956
- }
3957
-
3958
- /**
3959
- * Parse either an `EventHint` directly, or convert a `CaptureContext` to an `EventHint`.
3960
- * This is used to allow to update method signatures that used to accept a `CaptureContext` but should now accept an `EventHint`.
3961
- */
3962
- function parseEventHintOrCaptureContext(
3963
- hint,
3964
- ) {
3965
- if (!hint) {
3966
- return undefined;
3967
- }
3968
-
3969
- // If you pass a Scope or `() => Scope` as CaptureContext, we just return this as captureContext
3970
- if (hintIsScopeOrFunction(hint)) {
3971
- return { captureContext: hint };
3972
- }
3973
-
3974
- if (hintIsScopeContext(hint)) {
3975
- return {
3976
- captureContext: hint,
3977
- };
3978
- }
3979
-
3980
- return hint;
3981
- }
3982
-
3983
- function hintIsScopeOrFunction(hint) {
3984
- return hint instanceof Scope || typeof hint === 'function';
3985
- }
3986
-
3987
- const captureContextKeys = [
3988
- 'user',
3989
- 'level',
3990
- 'extra',
3991
- 'contexts',
3992
- 'tags',
3993
- 'fingerprint',
3994
- 'propagationContext',
3995
- ] ;
3996
-
3997
- function hintIsScopeContext(hint) {
3998
- return Object.keys(hint).some(key => captureContextKeys.includes(key ));
3999
- }
4000
-
4001
- /**
4002
- * Captures an exception event and sends it to Sentry.
4003
- *
4004
- * @param exception The exception to capture.
4005
- * @param hint Optional additional data to attach to the Sentry event.
4006
- * @returns the id of the captured Sentry event.
4007
- */
4008
- function captureException(exception, hint) {
4009
- return getCurrentScope().captureException(exception, parseEventHintOrCaptureContext(hint));
4010
- }
4011
-
4012
- /**
4013
- * Captures a manually created event and sends it to Sentry.
4014
- *
4015
- * @param event The event to send to Sentry.
4016
- * @param hint Optional additional data to attach to the Sentry event.
4017
- * @returns the id of the captured event.
4018
- */
4019
- function captureEvent(event, hint) {
4020
- return getCurrentScope().captureEvent(event, hint);
4021
- }
4022
-
4023
- /**
4024
- * Start a session on the current isolation scope.
4025
- *
4026
- * @param context (optional) additional properties to be applied to the returned session object
4027
- *
4028
- * @returns the new active session
4029
- */
4030
- function startSession(context) {
4031
- const isolationScope = getIsolationScope();
4032
- const currentScope = getCurrentScope();
4033
-
4034
- // Will fetch userAgent if called from browser sdk
4035
- const { userAgent } = GLOBAL_OBJ.navigator || {};
4036
-
4037
- const session = makeSession({
4038
- user: currentScope.getUser() || isolationScope.getUser(),
4039
- ...(userAgent && { userAgent }),
4040
- ...context,
4041
- });
4042
-
4043
- // End existing session if there's one
4044
- const currentSession = isolationScope.getSession();
4045
- if (currentSession?.status === 'ok') {
4046
- updateSession(currentSession, { status: 'exited' });
4047
- }
4048
-
4049
- endSession();
4050
-
4051
- // Afterwards we set the new session on the scope
4052
- isolationScope.setSession(session);
4053
-
4054
- return session;
4055
- }
4056
-
4057
- /**
4058
- * End the session on the current isolation scope.
4059
- */
4060
- function endSession() {
4061
- const isolationScope = getIsolationScope();
4062
- const currentScope = getCurrentScope();
4063
-
4064
- const session = currentScope.getSession() || isolationScope.getSession();
4065
- if (session) {
4066
- closeSession(session);
4067
- }
4068
- _sendSessionUpdate();
4069
-
4070
- // the session is over; take it off of the scope
4071
- isolationScope.setSession();
4072
- }
4073
-
4074
- /**
4075
- * Sends the current Session on the scope
4076
- */
4077
- function _sendSessionUpdate() {
4078
- const isolationScope = getIsolationScope();
4079
- const client = getClient();
4080
- const session = isolationScope.getSession();
4081
- if (session && client) {
4082
- client.captureSession(session);
4083
- }
4084
- }
4085
-
4086
- /**
4087
- * Sends the current session on the scope to Sentry
4088
- *
4089
- * @param end If set the session will be marked as exited and removed from the scope.
4090
- * Defaults to `false`.
4091
- */
4092
- function captureSession(end = false) {
4093
- // both send the update and pull the session from the scope
4094
- if (end) {
4095
- endSession();
4096
- return;
4097
- }
4098
-
4099
- // only send the update
4100
- _sendSessionUpdate();
4101
- }
4102
-
4103
- export { isDOMException as $, consoleSandbox as A, resolvedSyncPromise as B, SDK_VERSION as C, DEBUG_BUILD as D, getClient as E, getOriginalFunction as F, GLOBAL_OBJ as G, getEventDescription as H, stringMatchesSomePattern as I, isInstanceOf as J, CONSOLE_LEVELS as K, fill as L, originalConsoleMethods as M, getFramesFromEvent as N, timestampInSeconds as O, isError as P, addNonEnumerableProperty as Q, isRequest as R, SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME as S, getLocationHref as T, markFunctionWrapped as U, withScope as V, addExceptionTypeValue as W, addExceptionMechanism as X, captureException as Y, isErrorEvent as Z, isDOMError as _, dsnToString as a, isEvent as a0, normalizeToSize as a1, extractExceptionKeysForMessage as a2, isString as a3, createStackParser as a4, UNKNOWN_FUNCTION as a5, htmlTreeAsString as a6, safeJoin as a7, getComponentName as a8, startSession as a9, captureSession as aa, captureEvent as ab, stackParserFromStackParserOptions as ac, getSentryCarrier as b, getGlobalSingleton as c, debug as d, dateTimestampInSeconds as e, SEMANTIC_ATTRIBUTE_PROFILE_ID as f, getFunctionName as g, checkOrSetAlreadyCaught as h, isMatchingPattern as i, isPrimitive as j, updateSession as k, DEFAULT_ENVIRONMENT as l, makeDsn as m, normalize as n, getTraceContextFromScope as o, prepareEvent as p, getDynamicSamplingContextFromScope as q, getCurrentScope as r, getIsolationScope as s, rejectedSyncPromise as t, uuid4 as u, isParameterizedString as v, showSpanDropWarning as w, merge as x, isThenable as y, isPlainObject as z };
4104
- //# sourceMappingURL=exports.js.map
4105
-
4106
- //# sourceMappingURL=exports.js.map