@swifty.js/sentry 0.0.1 → 0.0.3

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 (117) hide show
  1. package/README.md +27 -42
  2. package/dist/core/api.cjs +1 -1
  3. package/dist/core/api.js +1 -1
  4. package/dist/core/breadcrumb.cjs +1 -1
  5. package/dist/core/breadcrumb.js +1 -1
  6. package/dist/core/bus.cjs +1 -1
  7. package/dist/core/bus.js +1 -1
  8. package/dist/core/decorate-http.cjs +1 -0
  9. package/dist/core/decorate-http.js +1 -0
  10. package/dist/core/decorate-route.cjs +1 -0
  11. package/dist/core/decorate-route.js +1 -0
  12. package/dist/core/decorates.cjs +1 -0
  13. package/dist/core/decorates.js +1 -0
  14. package/dist/core/framework-error.cjs +1 -1
  15. package/dist/core/framework-error.d.ts +32 -0
  16. package/dist/core/framework-error.js +1 -1
  17. package/dist/core/handle-code-error.cjs +1 -1
  18. package/dist/core/handle-code-error.js +1 -1
  19. package/dist/core/handle-error.cjs +1 -1
  20. package/dist/core/handle-error.js +1 -1
  21. package/dist/core/handle-events.cjs +1 -1
  22. package/dist/core/handle-events.js +1 -1
  23. package/dist/core/handle-http.cjs +1 -1
  24. package/dist/core/handle-http.js +1 -1
  25. package/dist/core/handle-route.cjs +1 -1
  26. package/dist/core/handle-route.js +1 -1
  27. package/dist/core/identity.cjs +1 -1
  28. package/dist/core/identity.js +1 -1
  29. package/dist/core/ip.d.ts +21 -0
  30. package/dist/core/pv-lifecycle.cjs +1 -1
  31. package/dist/core/pv-lifecycle.js +1 -1
  32. package/dist/core/sdk-lifecycle.cjs +1 -1
  33. package/dist/core/sdk-lifecycle.d.ts +22 -0
  34. package/dist/core/sdk-lifecycle.js +1 -1
  35. package/dist/core/setup.cjs +1 -1
  36. package/dist/core/setup.js +1 -1
  37. package/dist/core/white-screen.cjs +1 -1
  38. package/dist/core/white-screen.js +1 -1
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.d.ts +2 -0
  41. package/dist/index.js +1 -1
  42. package/dist/package.json.cjs +1 -1
  43. package/dist/package.json.js +1 -1
  44. package/dist/plugins/exposure/index.cjs +1 -1
  45. package/dist/plugins/exposure/index.d.ts +22 -0
  46. package/dist/plugins/exposure/index.js +1 -1
  47. package/dist/plugins/performance/index.cjs +1 -1
  48. package/dist/plugins/performance/index.d.ts +22 -0
  49. package/dist/plugins/performance/index.js +1 -1
  50. package/dist/plugins/performance/navigation-timing.cjs +1 -1
  51. package/dist/plugins/performance/navigation-timing.js +1 -1
  52. package/dist/plugins/performance/perf.cjs +1 -1
  53. package/dist/plugins/performance/perf.js +1 -1
  54. package/dist/plugins/performance/resource-element-fallback.cjs +1 -1
  55. package/dist/plugins/performance/resource-element-fallback.js +1 -1
  56. package/dist/plugins/performance/resource-timing.cjs +1 -1
  57. package/dist/plugins/performance/resource-timing.js +1 -1
  58. package/dist/plugins/screen-record/index.cjs +1 -1
  59. package/dist/plugins/screen-record/index.d.ts +22 -0
  60. package/dist/plugins/screen-record/index.js +1 -1
  61. package/dist/plugins/screen-record/recorder.cjs +1 -1
  62. package/dist/plugins/screen-record/recorder.d.ts +22 -0
  63. package/dist/plugins/screen-record/recorder.js +1 -1
  64. package/dist/preact.cjs +1 -0
  65. package/dist/preact.d.ts +74 -0
  66. package/dist/preact.js +1 -0
  67. package/dist/react.d.ts +22 -0
  68. package/dist/reporter/batch.cjs +1 -1
  69. package/dist/reporter/batch.js +1 -1
  70. package/dist/reporter/index.cjs +1 -1
  71. package/dist/reporter/index.js +1 -1
  72. package/dist/reporter/network-listener.cjs +1 -1
  73. package/dist/reporter/network-listener.js +1 -1
  74. package/dist/reporter/offline-cache.cjs +1 -1
  75. package/dist/reporter/offline-cache.js +1 -1
  76. package/dist/reporter/report-data-schema.cjs +1 -1
  77. package/dist/reporter/report-data-schema.js +1 -1
  78. package/dist/reporter/report-data.cjs +1 -1
  79. package/dist/reporter/report-data.js +1 -1
  80. package/dist/reporter/send-preflight.cjs +1 -1
  81. package/dist/reporter/send-preflight.js +1 -1
  82. package/dist/reporter/server-recovery.cjs +1 -1
  83. package/dist/reporter/server-recovery.js +1 -1
  84. package/dist/reporter/transports.cjs +1 -1
  85. package/dist/reporter/transports.js +1 -1
  86. package/dist/sourcemap/sourcemap.cjs +1 -0
  87. package/dist/sourcemap/sourcemap.js +1 -0
  88. package/dist/sourcemap/vite.cjs +1 -0
  89. package/dist/sourcemap/vite.js +1 -0
  90. package/dist/sourcemap/webpack.cjs +1 -0
  91. package/dist/sourcemap/webpack.js +1 -0
  92. package/dist/types/common.d.ts +31 -3
  93. package/dist/types/enums.cjs +1 -1
  94. package/dist/types/enums.d.ts +22 -1
  95. package/dist/types/enums.js +1 -1
  96. package/dist/types/handlers.d.ts +22 -0
  97. package/dist/types/options.d.ts +22 -0
  98. package/dist/types/plugin.d.ts +22 -0
  99. package/dist/utils/click-data.cjs +1 -1
  100. package/dist/utils/click-data.js +1 -1
  101. package/dist/utils/decorate-prop.d.ts +21 -0
  102. package/dist/utils/is-type.cjs +1 -1
  103. package/dist/utils/is-type.js +1 -1
  104. package/dist/vite.cjs +1 -1
  105. package/dist/vite.d.ts +22 -0
  106. package/dist/vite.js +1 -1
  107. package/dist/vue.d.ts +22 -0
  108. package/dist/webpack.cjs +1 -1
  109. package/dist/webpack.d.ts +22 -0
  110. package/dist/webpack.js +1 -1
  111. package/package.json +23 -7
  112. package/dist/core/decorate-http-publish.cjs +0 -1
  113. package/dist/core/decorate-http-publish.js +0 -1
  114. package/dist/core/decorate-publish.cjs +0 -1
  115. package/dist/core/decorate-publish.js +0 -1
  116. package/dist/core/decorate-route-publish.cjs +0 -1
  117. package/dist/core/decorate-route-publish.js +0 -1
@@ -1,6 +1,28 @@
1
1
  import { SentryPlugin } from '../../types/plugin.js';
2
2
  import { z } from 'zod';
3
3
 
4
+ /**
5
+ * Copyright (c) 2026 hangtiancheng
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
4
26
  declare const exposureTargetSchema: z.ZodObject<{
5
27
  target: z.ZodCustom<Element, Element>;
6
28
  threshold: z.ZodOptional<z.ZodNumber>;
@@ -1 +1 @@
1
- import{EventType as e,Status as t}from"../../types/enums.js";import{SentryPlugin as s}from"../../types/plugin.js";import r from"../../reporter/index.js";import"../../constants/index.js";import o from"../../utils/get-base-data.js";import"../../utils/sentry.js";import{sentryLogger as i}from"../../utils/logger.js";import{z as a}from"zod";const n=a.object({target:a.custom(e=>"Element"in globalThis&&e instanceof globalThis.Element),threshold:a.number().min(0).max(1).optional(),params:a.record(a.string(),a.unknown()).optional()});class p extends s{ioMap=new Map;targetMap=new Map;constructor(){super(e.Exposure)}init(){i.info("Exposure plugin initialized")}initObserver(e){return new IntersectionObserver(e=>{e.forEach(e=>{const t=this.targetMap.get(e.target);if(t)if(e.isIntersecting)t.showTime=Date.now();else{if(!t.showTime)return;const e=Date.now();this.sendEvent(t,e),delete t.showTime}})},{threshold:e})}sendEvent(s,i){s.showTime&&r.send({...o(),type:e.Exposure,name:"Exposure",message:"Element Exposure",status:t.OK,extra:{threshold:s.threshold,observeTime:s.observeTime,showTime:s.showTime,showEndTime:i,duration:i-s.showTime,params:s.params}})}observe(e){(Array.isArray(e)?e:[e]).map(e=>n.parse(e)).forEach(e=>{const t=e.threshold||.5,s=this.ioMap.get(t)??this.initObserver(t);this.ioMap.set(t,s),this.targetMap.has(e.target)||(s.observe(e.target),this.targetMap.set(e.target,{threshold:t,observeTime:Date.now(),params:e.params??{}}))})}unobserve(e){(Array.isArray(e)?e:[e]).forEach(e=>this.unobserveOne(e))}unobserveOne(e){const t=this.targetMap.get(e);if(!t)return;const s=this.ioMap.get(t.threshold);s&&s.unobserve(e),this.targetMap.delete(e)}destroy(){this.ioMap.forEach(e=>{e.disconnect()}),this.ioMap.clear(),this.targetMap.clear()}}export{p as default};
1
+ import{EventType as e,Status as t}from"../../types/enums.js";import{SentryPlugin as s}from"../../types/plugin.js";import r from"../../reporter/index.js";import"../../constants/index.js";import o from"../../utils/get-base-data.js";import"../../utils/sentry.js";import"../../utils/is-type.js";import{sentryLogger as i}from"../../utils/logger.js";import{z as a}from"zod";const n=a.object({target:a.custom(e=>"Element"in globalThis&&e instanceof globalThis.Element),threshold:a.number().min(0).max(1).optional(),params:a.record(a.string(),a.unknown()).optional()});class p extends s{ioMap=new Map;targetMap=new Map;constructor(){super(e.Exposure)}init(){i.info("Exposure plugin initialized")}initObserver(e){return new IntersectionObserver(e=>{e.forEach(e=>{const t=this.targetMap.get(e.target);if(t)if(e.isIntersecting)t.showTime=Date.now();else{if(!t.showTime)return;const e=Date.now();this.sendEvent(t,e),delete t.showTime}})},{threshold:e})}sendEvent(s,i){s.showTime&&r.send({...o(),type:e.Exposure,name:"Exposure",message:"Element Exposure",status:t.OK,extra:{threshold:s.threshold,observeTime:s.observeTime,showTime:s.showTime,showEndTime:i,duration:i-s.showTime,params:s.params}})}observe(e){(Array.isArray(e)?e:[e]).map(e=>n.parse(e)).forEach(e=>{const t=e.threshold||.5,s=this.ioMap.get(t)??this.initObserver(t);this.ioMap.set(t,s),this.targetMap.has(e.target)||(s.observe(e.target),this.targetMap.set(e.target,{threshold:t,observeTime:Date.now(),params:e.params??{}}))})}unobserve(e){(Array.isArray(e)?e:[e]).forEach(e=>this.unobserveOne(e))}unobserveOne(e){const t=this.targetMap.get(e);if(!t)return;const s=this.ioMap.get(t.threshold);s&&s.unobserve(e),this.targetMap.delete(e)}destroy(){this.ioMap.forEach(e=>{e.disconnect()}),this.ioMap.clear(),this.targetMap.clear()}}export{p as default};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../types/enums.cjs"),r=require("../../types/plugin.cjs"),s=require("../../reporter/index.cjs");require("../../constants/index.cjs");var t=require("../../utils/get-base-data.cjs");require("../../utils/sentry.cjs");var n=require("./navigation-timing.cjs"),o=require("./perf.cjs"),i=require("./performance-observer-support.cjs"),a=require("./resource-element-fallback.cjs"),c=require("./resource-timing.cjs");function u(){}class p extends r.SentryPlugin{cleanups=[];constructor(){super(e.EventType.Performance)}init(){this.startWebVitals(),this.cleanups.push(this.observeLongTasks()),this.cleanups.push(c.observeResourceTimings(e=>this.report(e))),this.cleanups.push(a.observeResourceElementFallback(e=>this.report(e))),this.cleanups.push(this.onPageReady(()=>{this.reportPageLoadTimings()})),this.reportMemory()}destroy(){this.cleanups.toReversed().forEach(e=>{e()}),this.cleanups=[]}report(e){s.default.send(e)}startWebVitals(){try{o.getWebVitals(e=>{this.report(e)})}catch{return}}observeLongTasks(){if(!i.supportsPerformanceEntryType("longtask"))return u;const r=new globalThis.PerformanceObserver(r=>{const s={...t.default(),name:"LongTask",type:e.EventType.Performance,longTasks:r.getEntries()};this.report(s)});return r.observe({entryTypes:["longtask"]}),()=>{r.disconnect()}}onPageReady(e){if("complete"===document.readyState)return queueMicrotask(e),u;const r=()=>{e()};return globalThis.addEventListener("load",r,{once:!0}),()=>{globalThis.removeEventListener("load",r)}}reportPageLoadTimings(){const e=n.getNavigationTimingData();e&&this.report(e);const r=c.getInitialResourceListData();r&&this.report(r)}async reportMemory(){if("performance"in globalThis&&"measureUserAgentSpecificMemory"in globalThis.performance&&"function"==typeof globalThis.performance.measureUserAgentSpecificMemory){const r={...t.default(),name:"Memory",type:e.EventType.Performance,message:"performance.measureUserAgentSpecificMemory",memory:await globalThis.performance.measureUserAgentSpecificMemory()};this.report(r)}}}exports.default=p;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../types/enums.cjs"),r=require("../../types/plugin.cjs"),s=require("../../reporter/index.cjs");require("../../constants/index.cjs");var t=require("../../utils/get-base-data.cjs");require("../../utils/sentry.cjs"),require("../../utils/is-type.cjs");var i=require("./navigation-timing.cjs"),n=require("./perf.cjs"),o=require("./performance-observer-support.cjs"),a=require("./resource-element-fallback.cjs"),c=require("./resource-timing.cjs");function u(){}class p extends r.SentryPlugin{cleanups=[];constructor(){super(e.EventType.Performance)}init(){this.startWebVitals(),this.cleanups.push(this.observeLongTasks()),this.cleanups.push(c.observeResourceTimings(e=>this.report(e))),this.cleanups.push(a.observeResourceElementFallback(e=>this.report(e))),this.cleanups.push(this.onPageReady(()=>{this.reportPageLoadTimings()})),this.reportMemory()}destroy(){this.cleanups.toReversed().forEach(e=>{e()}),this.cleanups=[]}report(e){s.default.send(e)}startWebVitals(){try{n.getWebVitals(e=>{this.report(e)})}catch{return}}observeLongTasks(){if(!o.supportsPerformanceEntryType("longtask"))return u;const r=new globalThis.PerformanceObserver(r=>{const s={...t.default(),name:"LongTask",type:e.EventType.Performance,longTasks:r.getEntries()};this.report(s)});return r.observe({entryTypes:["longtask"]}),()=>{r.disconnect()}}onPageReady(e){if("complete"===document.readyState)return queueMicrotask(e),u;const r=()=>{e()};return globalThis.addEventListener("load",r,{once:!0}),()=>{globalThis.removeEventListener("load",r)}}reportPageLoadTimings(){const e=i.getNavigationTimingData();e&&this.report(e);const r=c.getInitialResourceListData();r&&this.report(r)}async reportMemory(){if("performance"in globalThis&&"measureUserAgentSpecificMemory"in globalThis.performance&&"function"==typeof globalThis.performance.measureUserAgentSpecificMemory){const r={...t.default(),name:"Memory",type:e.EventType.Performance,message:"performance.measureUserAgentSpecificMemory",memory:await globalThis.performance.measureUserAgentSpecificMemory()};this.report(r)}}}exports.default=p;
@@ -1,5 +1,27 @@
1
1
  import { SentryPlugin } from '../../types/plugin.js';
2
2
 
3
+ /**
4
+ * Copyright (c) 2026 hangtiancheng
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
3
25
  declare class PerformancePlugin extends SentryPlugin {
4
26
  private cleanups;
5
27
  constructor();
@@ -1 +1 @@
1
- import{EventType as e}from"../../types/enums.js";import{SentryPlugin as r}from"../../types/plugin.js";import s from"../../reporter/index.js";import"../../constants/index.js";import t from"../../utils/get-base-data.js";import"../../utils/sentry.js";import{getNavigationTimingData as o}from"./navigation-timing.js";import{getWebVitals as n}from"./perf.js";import{supportsPerformanceEntryType as i}from"./performance-observer-support.js";import{observeResourceElementFallback as a}from"./resource-element-fallback.js";import{observeResourceTimings as p,getInitialResourceListData as m}from"./resource-timing.js";function c(){}class l extends r{cleanups=[];constructor(){super(e.Performance)}init(){this.startWebVitals(),this.cleanups.push(this.observeLongTasks()),this.cleanups.push(p(e=>this.report(e))),this.cleanups.push(a(e=>this.report(e))),this.cleanups.push(this.onPageReady(()=>{this.reportPageLoadTimings()})),this.reportMemory()}destroy(){this.cleanups.toReversed().forEach(e=>{e()}),this.cleanups=[]}report(e){s.send(e)}startWebVitals(){try{n(e=>{this.report(e)})}catch{return}}observeLongTasks(){if(!i("longtask"))return c;const r=new globalThis.PerformanceObserver(r=>{const s={...t(),name:"LongTask",type:e.Performance,longTasks:r.getEntries()};this.report(s)});return r.observe({entryTypes:["longtask"]}),()=>{r.disconnect()}}onPageReady(e){if("complete"===document.readyState)return queueMicrotask(e),c;const r=()=>{e()};return globalThis.addEventListener("load",r,{once:!0}),()=>{globalThis.removeEventListener("load",r)}}reportPageLoadTimings(){const e=o();e&&this.report(e);const r=m();r&&this.report(r)}async reportMemory(){if("performance"in globalThis&&"measureUserAgentSpecificMemory"in globalThis.performance&&"function"==typeof globalThis.performance.measureUserAgentSpecificMemory){const r={...t(),name:"Memory",type:e.Performance,message:"performance.measureUserAgentSpecificMemory",memory:await globalThis.performance.measureUserAgentSpecificMemory()};this.report(r)}}}export{l as default};
1
+ import{EventType as e}from"../../types/enums.js";import{SentryPlugin as r}from"../../types/plugin.js";import s from"../../reporter/index.js";import"../../constants/index.js";import t from"../../utils/get-base-data.js";import"../../utils/sentry.js";import"../../utils/is-type.js";import{getNavigationTimingData as o}from"./navigation-timing.js";import{getWebVitals as i}from"./perf.js";import{supportsPerformanceEntryType as n}from"./performance-observer-support.js";import{observeResourceElementFallback as a}from"./resource-element-fallback.js";import{observeResourceTimings as p,getInitialResourceListData as m}from"./resource-timing.js";function c(){}class l extends r{cleanups=[];constructor(){super(e.Performance)}init(){this.startWebVitals(),this.cleanups.push(this.observeLongTasks()),this.cleanups.push(p(e=>this.report(e))),this.cleanups.push(a(e=>this.report(e))),this.cleanups.push(this.onPageReady(()=>{this.reportPageLoadTimings()})),this.reportMemory()}destroy(){this.cleanups.toReversed().forEach(e=>{e()}),this.cleanups=[]}report(e){s.send(e)}startWebVitals(){try{i(e=>{this.report(e)})}catch{return}}observeLongTasks(){if(!n("longtask"))return c;const r=new globalThis.PerformanceObserver(r=>{const s={...t(),name:"LongTask",type:e.Performance,longTasks:r.getEntries()};this.report(s)});return r.observe({entryTypes:["longtask"]}),()=>{r.disconnect()}}onPageReady(e){if("complete"===document.readyState)return queueMicrotask(e),c;const r=()=>{e()};return globalThis.addEventListener("load",r,{once:!0}),()=>{globalThis.removeEventListener("load",r)}}reportPageLoadTimings(){const e=o();e&&this.report(e);const r=m();r&&this.report(r)}async reportMemory(){if("performance"in globalThis&&"measureUserAgentSpecificMemory"in globalThis.performance&&"function"==typeof globalThis.performance.measureUserAgentSpecificMemory){const r={...t(),name:"Memory",type:e.Performance,message:"performance.measureUserAgentSpecificMemory",memory:await globalThis.performance.measureUserAgentSpecificMemory()};this.report(r)}}}export{l as default};
@@ -1 +1 @@
1
- "use strict";var t=require("../../types/enums.cjs");require("../../constants/index.cjs");var e=require("../../utils/get-base-data.cjs");function n(t,e){return Math.max(0,Math.round(t-e))}function r(t,e){const r=t.fetchStart;return{paintTime:e>0?n(e,r):0,domInteractive:n(t.domInteractive,r),domContentLoaded:n(t.domContentLoadedEventEnd,r),loadEvent:n(t.loadEventStart,r),firstByte:n(t.responseStart,r),dnsLookup:n(t.domainLookupEnd,t.domainLookupStart),tcpConnection:n(t.connectEnd,t.connectStart),tlsHandshake:n(t.connectEnd,t.secureConnectionStart),timeToFirstByte:n(t.responseStart,t.requestStart),contentTransfer:n(t.responseEnd,t.responseStart),domProcessing:n(t.domInteractive,t.responseEnd),resourceLoad:n(t.loadEventStart,t.domContentLoadedEventEnd),redirect:n(t.redirectEnd,t.redirectStart),unloadTime:n(t.unloadEventEnd,t.unloadEventStart),triggerPageUrl:location.href}}require("../../utils/sentry.cjs"),exports.getNavigationTimingData=function(){if(!("performance"in globalThis)||"function"!=typeof globalThis.performance.getEntriesByType)return null;const n=function(){const t=globalThis.performance.getEntriesByType("navigation")[0];return t&&function(t){return"navigation"===t.entryType&&"fetchStart"in t}(t)?t:null}();return n?{...e.default(),type:t.EventType.Performance,name:"NavigationTiming",message:"Page navigation timing",status:t.Status.OK,extra:r(n,globalThis.performance.getEntriesByType("paint").at(-1)?.startTime??0)}:null};
1
+ "use strict";var t=require("../../types/enums.cjs");require("../../constants/index.cjs");var e=require("../../utils/get-base-data.cjs");function n(t,e){return Math.max(0,Math.round(t-e))}function r(t,e){const r=t.fetchStart;return{paintTime:e>0?n(e,r):0,domInteractive:n(t.domInteractive,r),domContentLoaded:n(t.domContentLoadedEventEnd,r),loadEvent:n(t.loadEventStart,r),firstByte:n(t.responseStart,r),dnsLookup:n(t.domainLookupEnd,t.domainLookupStart),tcpConnection:n(t.connectEnd,t.connectStart),tlsHandshake:n(t.connectEnd,t.secureConnectionStart),timeToFirstByte:n(t.responseStart,t.requestStart),contentTransfer:n(t.responseEnd,t.responseStart),domProcessing:n(t.domInteractive,t.responseEnd),resourceLoad:n(t.loadEventStart,t.domContentLoadedEventEnd),redirect:n(t.redirectEnd,t.redirectStart),unloadTime:n(t.unloadEventEnd,t.unloadEventStart),triggerPageUrl:location.href}}require("../../utils/sentry.cjs"),require("../../utils/is-type.cjs"),exports.getNavigationTimingData=function(){if(!("performance"in globalThis)||"function"!=typeof globalThis.performance.getEntriesByType)return null;const n=function(){const t=globalThis.performance.getEntriesByType("navigation")[0];return t&&function(t){return"navigation"===t.entryType&&"fetchStart"in t}(t)?t:null}();return n?{...e.default(),type:t.EventType.Performance,name:"NavigationTiming",message:"Page navigation timing",status:t.Status.OK,extra:r(n,globalThis.performance.getEntriesByType("paint").at(-1)?.startTime??0)}:null};
@@ -1 +1 @@
1
- import{Status as t,EventType as n}from"../../types/enums.js";import"../../constants/index.js";import e from"../../utils/get-base-data.js";import"../../utils/sentry.js";function o(t,n){return Math.max(0,Math.round(t-n))}function r(t,n){const e=t.fetchStart;return{paintTime:n>0?o(n,e):0,domInteractive:o(t.domInteractive,e),domContentLoaded:o(t.domContentLoadedEventEnd,e),loadEvent:o(t.loadEventStart,e),firstByte:o(t.responseStart,e),dnsLookup:o(t.domainLookupEnd,t.domainLookupStart),tcpConnection:o(t.connectEnd,t.connectStart),tlsHandshake:o(t.connectEnd,t.secureConnectionStart),timeToFirstByte:o(t.responseStart,t.requestStart),contentTransfer:o(t.responseEnd,t.responseStart),domProcessing:o(t.domInteractive,t.responseEnd),resourceLoad:o(t.loadEventStart,t.domContentLoadedEventEnd),redirect:o(t.redirectEnd,t.redirectStart),unloadTime:o(t.unloadEventEnd,t.unloadEventStart),triggerPageUrl:location.href}}function a(){if(!("performance"in globalThis)||"function"!=typeof globalThis.performance.getEntriesByType)return null;const o=function(){const t=globalThis.performance.getEntriesByType("navigation")[0];return t&&function(t){return"navigation"===t.entryType&&"fetchStart"in t}(t)?t:null}();return o?{...e(),type:n.Performance,name:"NavigationTiming",message:"Page navigation timing",status:t.OK,extra:r(o,globalThis.performance.getEntriesByType("paint").at(-1)?.startTime??0)}:null}export{a as getNavigationTimingData};
1
+ import{Status as t,EventType as n}from"../../types/enums.js";import"../../constants/index.js";import e from"../../utils/get-base-data.js";import"../../utils/sentry.js";import"../../utils/is-type.js";function o(t,n){return Math.max(0,Math.round(t-n))}function r(t,n){const e=t.fetchStart;return{paintTime:n>0?o(n,e):0,domInteractive:o(t.domInteractive,e),domContentLoaded:o(t.domContentLoadedEventEnd,e),loadEvent:o(t.loadEventStart,e),firstByte:o(t.responseStart,e),dnsLookup:o(t.domainLookupEnd,t.domainLookupStart),tcpConnection:o(t.connectEnd,t.connectStart),tlsHandshake:o(t.connectEnd,t.secureConnectionStart),timeToFirstByte:o(t.responseStart,t.requestStart),contentTransfer:o(t.responseEnd,t.responseStart),domProcessing:o(t.domInteractive,t.responseEnd),resourceLoad:o(t.loadEventStart,t.domContentLoadedEventEnd),redirect:o(t.redirectEnd,t.redirectStart),unloadTime:o(t.unloadEventEnd,t.unloadEventStart),triggerPageUrl:location.href}}function a(){if(!("performance"in globalThis)||"function"!=typeof globalThis.performance.getEntriesByType)return null;const o=function(){const t=globalThis.performance.getEntriesByType("navigation")[0];return t&&function(t){return"navigation"===t.entryType&&"fetchStart"in t}(t)?t:null}();return o?{...e(),type:n.Performance,name:"NavigationTiming",message:"Page navigation timing",status:t.OK,extra:r(o,globalThis.performance.getEntriesByType("paint").at(-1)?.startTime??0)}:null}export{a as getNavigationTimingData};
@@ -1 +1 @@
1
- "use strict";var e=require("../../types/enums.cjs"),t=require("web-vitals");require("../../constants/index.cjs");var r=require("../../utils/get-base-data.cjs");require("../../utils/sentry.cjs");var s=require("../../utils/metric2perf-data.cjs"),n=require("../../utils/logger.cjs"),i=require("./first-screen-paint.cjs");exports.getWebVitals=function(a){n.sentryLogger.info("Starting web vitals monitoring...");const u=e=>{n.sentryLogger.success(`Metric: ${e.name}`,e,function(e){if("value"in e&&"number"==typeof e.value)return Math.round(e.value)}(e)),a(e)};t.onLCP(e=>{u(s.default(e))}),t.onFCP(e=>{u(s.default(e))}),t.onCLS(e=>{u(s.default(e))}),t.onINP(e=>{u(s.default(e))}),t.onTTFB(e=>{u(s.default(e))}),i.getFirstScreenPaint(t=>{const s={...r.default(),name:"FSP",value:t,type:e.EventType.Performance,message:"First screen paint"};u(s)})};
1
+ "use strict";var e=require("../../types/enums.cjs"),t=require("web-vitals");require("../../constants/index.cjs");var r=require("../../utils/get-base-data.cjs");require("../../utils/sentry.cjs"),require("../../utils/is-type.cjs");var s=require("../../utils/metric2perf-data.cjs"),i=require("../../utils/logger.cjs"),n=require("./first-screen-paint.cjs");exports.getWebVitals=function(u){i.sentryLogger.info("Starting web vitals monitoring...");const a=e=>{i.sentryLogger.success(`Metric: ${e.name}`,e,function(e){if("value"in e&&"number"==typeof e.value)return Math.round(e.value)}(e)),u(e)};t.onLCP(e=>{a(s.default(e))}),t.onFCP(e=>{a(s.default(e))}),t.onCLS(e=>{a(s.default(e))}),t.onINP(e=>{a(s.default(e))}),t.onTTFB(e=>{a(s.default(e))}),n.getFirstScreenPaint(t=>{const s={...r.default(),name:"FSP",value:t,type:e.EventType.Performance,message:"First screen paint"};a(s)})};
@@ -1 +1 @@
1
- import{EventType as t}from"../../types/enums.js";import{onLCP as e,onFCP as r,onCLS as s,onINP as i,onTTFB as o}from"web-vitals";import"../../constants/index.js";import n from"../../utils/get-base-data.js";import"../../utils/sentry.js";import m from"../../utils/metric2perf-data.js";import{sentryLogger as a}from"../../utils/logger.js";import{getFirstScreenPaint as p}from"./first-screen-paint.js";function u(u){a.info("Starting web vitals monitoring...");const f=t=>{a.success(`Metric: ${t.name}`,t,function(t){if("value"in t&&"number"==typeof t.value)return Math.round(t.value)}(t)),u(t)};e(t=>{f(m(t))}),r(t=>{f(m(t))}),s(t=>{f(m(t))}),i(t=>{f(m(t))}),o(t=>{f(m(t))}),p(e=>{const r={...n(),name:"FSP",value:e,type:t.Performance,message:"First screen paint"};f(r)})}export{u as getWebVitals};
1
+ import{EventType as t}from"../../types/enums.js";import{onLCP as e,onFCP as r,onCLS as s,onINP as i,onTTFB as o}from"web-vitals";import"../../constants/index.js";import n from"../../utils/get-base-data.js";import"../../utils/sentry.js";import"../../utils/is-type.js";import m from"../../utils/metric2perf-data.js";import{sentryLogger as a}from"../../utils/logger.js";import{getFirstScreenPaint as p}from"./first-screen-paint.js";function u(u){a.info("Starting web vitals monitoring...");const f=t=>{a.success(`Metric: ${t.name}`,t,function(t){if("value"in t&&"number"==typeof t.value)return Math.round(t.value)}(t)),u(t)};e(t=>{f(m(t))}),r(t=>{f(m(t))}),s(t=>{f(m(t))}),i(t=>{f(m(t))}),o(t=>{f(m(t))}),p(e=>{const r={...n(),name:"FSP",value:e,type:t.Performance,message:"First screen paint"};f(r)})}export{u as getWebVitals};
@@ -1 +1 @@
1
- "use strict";require("../../constants/index.cjs"),require("../../types/enums.cjs");var e=require("../../utils/sentry.cjs"),n=require("./resource-timing.cjs"),r=require("./performance-observer-support.cjs");const t=new Set(["IMG","SCRIPT","LINK"]);exports.observeResourceElementFallback=function(o){if(r.supportsPerformanceEntryType("resource")||!("MutationObserver"in globalThis)||"function"!=typeof globalThis.MutationObserver)return()=>{};const s=[],i=new Set,a=r=>{const t=function(e){return e instanceof HTMLImageElement?e.currentSrc||e.src:e instanceof HTMLScriptElement?e.src:e.href}(r);if(!t||i.has(t)||t.includes(e.default.options.dsn))return;i.add(t);const s=function(e){return n.getResourceList().filter(n=>n.name===e).at(-1)??null}(t)??function(e,n){const r="performance"in globalThis?Math.round(globalThis.performance.now()):Date.now();return{name:e,initiatorType:n,startTime:r,responseEnd:r,duration:0,transferSize:0,encodedBodySize:0,decodedBodySize:0,fromCache:!1}}(t,r.tagName.toLowerCase());o(n.createResourceTimingData(s))},c=new globalThis.MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{(function(e){return e instanceof HTMLElement&&t.has(e.tagName)})(e)&&(e=>{const n=()=>{a(e)};e.addEventListener("load",n,{once:!0}),e.addEventListener("error",n,{once:!0}),s.push({element:e,eventName:"load",listener:n}),s.push({element:e,eventName:"error",listener:n})})(e)})})});return c.observe(document.documentElement,{childList:!0,subtree:!0}),()=>{c.disconnect(),s.forEach(({element:e,eventName:n,listener:r})=>{e.removeEventListener(n,r)})}};
1
+ "use strict";require("../../constants/index.cjs"),require("../../types/enums.cjs");var e=require("../../utils/sentry.cjs");require("../../utils/is-type.cjs");var r=require("./resource-timing.cjs"),n=require("./performance-observer-support.cjs");const t=new Set(["IMG","SCRIPT","LINK"]);exports.observeResourceElementFallback=function(s){if(n.supportsPerformanceEntryType("resource")||!("MutationObserver"in globalThis)||"function"!=typeof globalThis.MutationObserver)return()=>{};const o=[],i=new Set,a=n=>{const t=function(e){return e instanceof HTMLImageElement?e.currentSrc||e.src:e instanceof HTMLScriptElement?e.src:e.href}(n);if(!t||i.has(t)||t.includes(e.default.options.dsn))return;i.add(t);const o=function(e){return r.getResourceList().filter(r=>r.name===e).at(-1)??null}(t)??function(e,r){const n="performance"in globalThis?Math.round(globalThis.performance.now()):Date.now();return{name:e,initiatorType:r,startTime:n,responseEnd:n,duration:0,transferSize:0,encodedBodySize:0,decodedBodySize:0,fromCache:!1}}(t,n.tagName.toLowerCase());s(r.createResourceTimingData(o))},c=new globalThis.MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{(function(e){return e instanceof HTMLElement&&t.has(e.tagName)})(e)&&(e=>{const r=()=>{a(e)};e.addEventListener("load",r,{once:!0}),e.addEventListener("error",r,{once:!0}),o.push({element:e,eventName:"load",listener:r}),o.push({element:e,eventName:"error",listener:r})})(e)})})});return c.observe(document.documentElement,{childList:!0,subtree:!0}),()=>{c.disconnect(),o.forEach(({element:e,eventName:r,listener:n})=>{e.removeEventListener(r,n)})}};
@@ -1 +1 @@
1
- import"../../constants/index.js";import"../../types/enums.js";import e from"../../utils/sentry.js";import{createResourceTimingData as n,getResourceList as t}from"./resource-timing.js";import{supportsPerformanceEntryType as r}from"./performance-observer-support.js";const o=new Set(["IMG","SCRIPT","LINK"]);function s(s){if(r("resource")||!("MutationObserver"in globalThis)||"function"!=typeof globalThis.MutationObserver)return()=>{};const i=[],a=new Set,c=r=>{const o=function(e){return e instanceof HTMLImageElement?e.currentSrc||e.src:e instanceof HTMLScriptElement?e.src:e.href}(r);if(!o||a.has(o)||o.includes(e.options.dsn))return;a.add(o);const i=function(e){return t().filter(n=>n.name===e).at(-1)??null}(o)??function(e,n){const t="performance"in globalThis?Math.round(globalThis.performance.now()):Date.now();return{name:e,initiatorType:n,startTime:t,responseEnd:t,duration:0,transferSize:0,encodedBodySize:0,decodedBodySize:0,fromCache:!1}}(o,r.tagName.toLowerCase());s(n(i))},m=new globalThis.MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{(function(e){return e instanceof HTMLElement&&o.has(e.tagName)})(e)&&(e=>{const n=()=>{c(e)};e.addEventListener("load",n,{once:!0}),e.addEventListener("error",n,{once:!0}),i.push({element:e,eventName:"load",listener:n}),i.push({element:e,eventName:"error",listener:n})})(e)})})});return m.observe(document.documentElement,{childList:!0,subtree:!0}),()=>{m.disconnect(),i.forEach(({element:e,eventName:n,listener:t})=>{e.removeEventListener(n,t)})}}export{s as observeResourceElementFallback};
1
+ import"../../constants/index.js";import"../../types/enums.js";import e from"../../utils/sentry.js";import"../../utils/is-type.js";import{createResourceTimingData as n,getResourceList as t}from"./resource-timing.js";import{supportsPerformanceEntryType as r}from"./performance-observer-support.js";const o=new Set(["IMG","SCRIPT","LINK"]);function s(s){if(r("resource")||!("MutationObserver"in globalThis)||"function"!=typeof globalThis.MutationObserver)return()=>{};const i=[],a=new Set,c=r=>{const o=function(e){return e instanceof HTMLImageElement?e.currentSrc||e.src:e instanceof HTMLScriptElement?e.src:e.href}(r);if(!o||a.has(o)||o.includes(e.options.dsn))return;a.add(o);const i=function(e){return t().filter(n=>n.name===e).at(-1)??null}(o)??function(e,n){const t="performance"in globalThis?Math.round(globalThis.performance.now()):Date.now();return{name:e,initiatorType:n,startTime:t,responseEnd:t,duration:0,transferSize:0,encodedBodySize:0,decodedBodySize:0,fromCache:!1}}(o,r.tagName.toLowerCase());s(n(i))},m=new globalThis.MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{(function(e){return e instanceof HTMLElement&&o.has(e.tagName)})(e)&&(e=>{const n=()=>{c(e)};e.addEventListener("load",n,{once:!0}),e.addEventListener("error",n,{once:!0}),i.push({element:e,eventName:"load",listener:n}),i.push({element:e,eventName:"error",listener:n})})(e)})})});return m.observe(document.documentElement,{childList:!0,subtree:!0}),()=>{m.disconnect(),i.forEach(({element:e,eventName:n,listener:t})=>{e.removeEventListener(n,t)})}}export{s as observeResourceElementFallback};
@@ -1 +1 @@
1
- "use strict";var e=require("../../types/enums.cjs");require("../../constants/index.cjs");var r=require("../../utils/get-base-data.cjs"),t=require("../../utils/sentry.cjs"),n=require("./performance-observer-support.cjs");const s=new Set(["fetch","xmlhttprequest","beacon"]);function o(e){return"resource"===e.entryType&&"initiatorType"in e}function i(e){return!s.has(e.initiatorType)&&!function(e){return""!==t.default.options.dsn&&e.name.includes(t.default.options.dsn)}(e)}function a(e){return{name:e.name,initiatorType:e.initiatorType,startTime:Math.round(e.startTime),responseEnd:Math.round(e.responseEnd),duration:Math.round(e.duration),transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize,fromCache:c(e)}}function u(t){return{...r.default(),type:e.EventType.Performance,name:"ResourceTiming",message:t.name,status:e.Status.OK,value:t.duration,extra:{resource:t}}}function c(e){return 0===e.transferSize||0!==e.transferSize&&0===e.encodedBodySize}function d(){return"performance"in globalThis&&"function"==typeof globalThis.performance.getEntriesByType?globalThis.performance.getEntriesByType("resource").filter(o).filter(i).map(a):[]}exports.createResourceTimingData=u,exports.getInitialResourceListData=function(){return{...r.default(),name:"ResourceList",type:e.EventType.Performance,status:e.Status.OK,resourceList:d()}},exports.getResourceList=d,exports.isFromCache=c,exports.observeResourceTimings=function(e){if(!n.supportsPerformanceEntryType("resource"))return()=>{};const r=new globalThis.PerformanceObserver(r=>{r.getEntries().filter(o).filter(i).map(a).forEach(r=>{e(u(r))})});return r.observe({entryTypes:["resource"]}),()=>{r.disconnect()}};
1
+ "use strict";var e=require("../../types/enums.cjs");require("../../constants/index.cjs");var r=require("../../utils/get-base-data.cjs"),t=require("../../utils/sentry.cjs");require("../../utils/is-type.cjs");var n=require("./performance-observer-support.cjs");const s=new Set(["fetch","xmlhttprequest","beacon"]);function i(e){return"resource"===e.entryType&&"initiatorType"in e}function o(e){return!s.has(e.initiatorType)&&!function(e){return""!==t.default.options.dsn&&e.name.includes(t.default.options.dsn)}(e)}function a(e){return{name:e.name,initiatorType:e.initiatorType,startTime:Math.round(e.startTime),responseEnd:Math.round(e.responseEnd),duration:Math.round(e.duration),transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize,fromCache:c(e)}}function u(t){return{...r.default(),type:e.EventType.Performance,name:"ResourceTiming",message:t.name,status:e.Status.OK,value:t.duration,extra:{resource:t}}}function c(e){return 0===e.transferSize||0!==e.transferSize&&0===e.encodedBodySize}function p(){return"performance"in globalThis&&"function"==typeof globalThis.performance.getEntriesByType?globalThis.performance.getEntriesByType("resource").filter(i).filter(o).map(a):[]}exports.createResourceTimingData=u,exports.getInitialResourceListData=function(){return{...r.default(),name:"ResourceList",type:e.EventType.Performance,status:e.Status.OK,resourceList:p()}},exports.getResourceList=p,exports.isFromCache=c,exports.observeResourceTimings=function(e){if(!n.supportsPerformanceEntryType("resource"))return()=>{};const r=new globalThis.PerformanceObserver(r=>{r.getEntries().filter(i).filter(o).map(a).forEach(r=>{e(u(r))})});return r.observe({entryTypes:["resource"]}),()=>{r.disconnect()}};
@@ -1 +1 @@
1
- import{Status as e,EventType as r}from"../../types/enums.js";import"../../constants/index.js";import n from"../../utils/get-base-data.js";import t from"../../utils/sentry.js";import{supportsPerformanceEntryType as o}from"./performance-observer-support.js";const i=new Set(["fetch","xmlhttprequest","beacon"]);function s(e){return"resource"===e.entryType&&"initiatorType"in e}function a(e){return!i.has(e.initiatorType)&&!function(e){return""!==t.options.dsn&&e.name.includes(t.options.dsn)}(e)}function u(e){return{name:e.name,initiatorType:e.initiatorType,startTime:Math.round(e.startTime),responseEnd:Math.round(e.responseEnd),duration:Math.round(e.duration),transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize,fromCache:f(e)}}function c(t){return{...n(),type:r.Performance,name:"ResourceTiming",message:t.name,status:e.OK,value:t.duration,extra:{resource:t}}}function f(e){return 0===e.transferSize||0!==e.transferSize&&0===e.encodedBodySize}function d(){return"performance"in globalThis&&"function"==typeof globalThis.performance.getEntriesByType?globalThis.performance.getEntriesByType("resource").filter(s).filter(a).map(u):[]}function m(){return{...n(),name:"ResourceList",type:r.Performance,status:e.OK,resourceList:d()}}function p(e){if(!o("resource"))return()=>{};const r=new globalThis.PerformanceObserver(r=>{r.getEntries().filter(s).filter(a).map(u).forEach(r=>{e(c(r))})});return r.observe({entryTypes:["resource"]}),()=>{r.disconnect()}}export{c as createResourceTimingData,m as getInitialResourceListData,d as getResourceList,f as isFromCache,p as observeResourceTimings};
1
+ import{Status as e,EventType as r}from"../../types/enums.js";import"../../constants/index.js";import t from"../../utils/get-base-data.js";import n from"../../utils/sentry.js";import"../../utils/is-type.js";import{supportsPerformanceEntryType as o}from"./performance-observer-support.js";const i=new Set(["fetch","xmlhttprequest","beacon"]);function s(e){return"resource"===e.entryType&&"initiatorType"in e}function a(e){return!i.has(e.initiatorType)&&!function(e){return""!==n.options.dsn&&e.name.includes(n.options.dsn)}(e)}function u(e){return{name:e.name,initiatorType:e.initiatorType,startTime:Math.round(e.startTime),responseEnd:Math.round(e.responseEnd),duration:Math.round(e.duration),transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize,fromCache:f(e)}}function c(n){return{...t(),type:r.Performance,name:"ResourceTiming",message:n.name,status:e.OK,value:n.duration,extra:{resource:n}}}function f(e){return 0===e.transferSize||0!==e.transferSize&&0===e.encodedBodySize}function p(){return"performance"in globalThis&&"function"==typeof globalThis.performance.getEntriesByType?globalThis.performance.getEntriesByType("resource").filter(s).filter(a).map(u):[]}function m(){return{...t(),name:"ResourceList",type:r.Performance,status:e.OK,resourceList:p()}}function d(e){if(!o("resource"))return()=>{};const r=new globalThis.PerformanceObserver(r=>{r.getEntries().filter(s).filter(a).map(u).forEach(r=>{e(c(r))})});return r.observe({entryTypes:["resource"]}),()=>{r.disconnect()}}export{c as createResourceTimingData,m as getInitialResourceListData,p as getResourceList,f as isFromCache,d as observeResourceTimings};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../types/enums.cjs"),r=require("../../types/plugin.cjs"),s=require("../../constants/index.cjs"),n=require("../../utils/sentry.cjs"),t=require("../../reporter/index.cjs"),c=require("./recorder.cjs");class o extends r.SentryPlugin{durationMs=s.DEFAULT_OPTIONS.screenRecordDurationMs;eventTypes=s.DEFAULT_OPTIONS.screenRecordEventTypes;cleanup=null;constructor(r={durationMs:s.DEFAULT_OPTIONS.screenRecordDurationMs,eventTypes:s.DEFAULT_OPTIONS.screenRecordEventTypes}){super(e.EventType.ScreenRecord);const{durationMs:n=s.DEFAULT_OPTIONS.screenRecordDurationMs,eventTypes:t=s.DEFAULT_OPTIONS.screenRecordEventTypes}=r;this.durationMs=n,this.eventTypes=t}init(){n.default.options.enableScreenRecord=!0,n.default.options.screenRecordEventTypes=this.eventTypes,n.default.options.screenRecordDurationMs=this.durationMs,c.recorder(t.default).then(e=>{this.cleanup=e})}destroy(){this.cleanup?.(),this.cleanup=null}}exports.unzipScreenRecord=c.unzipScreenRecord,exports.default=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../types/enums.cjs"),r=require("../../types/plugin.cjs"),s=require("../../constants/index.cjs"),n=require("../../utils/sentry.cjs");require("../../utils/is-type.cjs");var t=require("../../reporter/index.cjs"),c=require("./recorder.cjs");class o extends r.SentryPlugin{durationMs=s.DEFAULT_OPTIONS.screenRecordDurationMs;eventTypes=s.DEFAULT_OPTIONS.screenRecordEventTypes;cleanup=null;constructor(r={durationMs:s.DEFAULT_OPTIONS.screenRecordDurationMs,eventTypes:s.DEFAULT_OPTIONS.screenRecordEventTypes}){super(e.EventType.ScreenRecord);const{durationMs:n=s.DEFAULT_OPTIONS.screenRecordDurationMs,eventTypes:t=s.DEFAULT_OPTIONS.screenRecordEventTypes}=r;this.durationMs=n,this.eventTypes=t}init(){n.default.options.enableScreenRecord=!0,n.default.options.screenRecordEventTypes=this.eventTypes,n.default.options.screenRecordDurationMs=this.durationMs,c.recorder(t.default).then(e=>{this.cleanup=e})}destroy(){this.cleanup?.(),this.cleanup=null}}exports.unzipScreenRecord=c.unzipScreenRecord,exports.default=o;
@@ -1,6 +1,28 @@
1
1
  import { EventType } from '../../types/enums.js';
2
2
  import { SentryPlugin } from '../../types/plugin.js';
3
3
 
4
+ /**
5
+ * Copyright (c) 2026 hangtiancheng
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
4
26
  interface ScreenRecordPluginOptions {
5
27
  durationMs?: number;
6
28
  eventTypes?: EventType[];
@@ -1 +1 @@
1
- import{EventType as e}from"../../types/enums.js";import{SentryPlugin as r}from"../../types/plugin.js";import{DEFAULT_OPTIONS as s}from"../../constants/index.js";import n from"../../utils/sentry.js";import t from"../../reporter/index.js";import{recorder as o}from"./recorder.js";export{unzipScreenRecord}from"./recorder.js";class c extends r{durationMs=s.screenRecordDurationMs;eventTypes=s.screenRecordEventTypes;cleanup=null;constructor(r={durationMs:s.screenRecordDurationMs,eventTypes:s.screenRecordEventTypes}){super(e.ScreenRecord);const{durationMs:n=s.screenRecordDurationMs,eventTypes:t=s.screenRecordEventTypes}=r;this.durationMs=n,this.eventTypes=t}init(){n.options.enableScreenRecord=!0,n.options.screenRecordEventTypes=this.eventTypes,n.options.screenRecordDurationMs=this.durationMs,o(t).then(e=>{this.cleanup=e})}destroy(){this.cleanup?.(),this.cleanup=null}}export{c as default};
1
+ import{EventType as e}from"../../types/enums.js";import{SentryPlugin as r}from"../../types/plugin.js";import{DEFAULT_OPTIONS as s}from"../../constants/index.js";import t from"../../utils/sentry.js";import"../../utils/is-type.js";import n from"../../reporter/index.js";import{recorder as o}from"./recorder.js";export{unzipScreenRecord}from"./recorder.js";class i extends r{durationMs=s.screenRecordDurationMs;eventTypes=s.screenRecordEventTypes;cleanup=null;constructor(r={durationMs:s.screenRecordDurationMs,eventTypes:s.screenRecordEventTypes}){super(e.ScreenRecord);const{durationMs:t=s.screenRecordDurationMs,eventTypes:n=s.screenRecordEventTypes}=r;this.durationMs=t,this.eventTypes=n}init(){t.options.enableScreenRecord=!0,t.options.screenRecordEventTypes=this.eventTypes,t.options.screenRecordDurationMs=this.durationMs,o(n).then(e=>{this.cleanup=e})}destroy(){this.cleanup?.(),this.cleanup=null}}export{i as default};
@@ -1 +1 @@
1
- "use strict";var e=require("../../types/enums.cjs");require("../../constants/index.cjs");var r=require("../../utils/get-base-data.cjs"),t=require("../../utils/sentry.cjs"),n=require("../../utils/logger.cjs"),o=require("zod");let s=null;const c=o.z.object({timestamp:o.z.number()}).passthrough();function i(){}function u(e,r){const n=r-t.default.options.screenRecordDurationMs;return e.filter(e=>e.timestamp>=n)}function a(e){if(!e||!s)return"";const r=JSON.stringify(e);return function(e){let r="";return e.forEach(e=>{r+=String.fromCharCode(e)}),btoa(r)}(s.gzip(r))}exports.recorder=async function(o){n.sentryLogger.info("Initializing web recorder...");try{const[{record:d},l]=await Promise.all([import("@rrweb/record"),import("pako")]);s=l.default;let f=[];const p=d({emit(s,i){const d=c.safeParse(s);if(d.success&&(f=u([...f,d.data],d.data.timestamp),i&&(f=u(f,d.data.timestamp)),t.default.shouldScreenRecord&&f.length>0)){const s={...r.default(),name:"ScreenRecord",type:e.EventType.ScreenRecord,event:a(f),eventCount:f.length};n.sentryLogger.success("Screen record window packaged and sent",{eventCount:s.eventCount}),o.send(s),t.default.shouldScreenRecord=!1}},recordCanvas:!0,checkoutEveryNms:t.default.options.screenRecordDurationMs});return"function"==typeof p?p:i}catch(e){return n.sentryLogger.error("Failed to load web recorder",e),i}},exports.unzipScreenRecord=function(e){if(!e||!s)return null;const r=s.ungzip(function(e){const r=atob(e);return Uint8Array.from(r,e=>e.charCodeAt(0))}(e),{to:"string"});return JSON.parse(r)},exports.zip=a;
1
+ "use strict";var e=require("../../types/enums.cjs");require("../../constants/index.cjs");var r=require("../../utils/get-base-data.cjs"),t=require("../../utils/sentry.cjs");require("../../utils/is-type.cjs");var n=require("../../utils/logger.cjs"),o=require("zod");let s=null;const c=o.z.object({timestamp:o.z.number()}).passthrough();function i(){}function u(e,r){const n=r-t.default.options.screenRecordDurationMs;return e.filter(e=>e.timestamp>=n)}function a(e){if(!e||!s)return"";const r=JSON.stringify(e);return function(e){let r="";return e.forEach(e=>{r+=String.fromCharCode(e)}),btoa(r)}(s.gzip(r))}exports.recorder=async function(o){n.sentryLogger.info("Initializing web recorder...");try{const[{record:d},l]=await Promise.all([import("@rrweb/record"),import("pako")]);s=l.default;let f=[];const p=d({emit(s,i){const d=c.safeParse(s);if(d.success&&(f=u([...f,d.data],d.data.timestamp),i&&(f=u(f,d.data.timestamp)),t.default.shouldScreenRecord&&f.length>0)){const s={...r.default(),name:"ScreenRecord",type:e.EventType.ScreenRecord,event:a(f),eventCount:f.length};n.sentryLogger.success("Screen record window packaged and sent",{eventCount:s.eventCount}),o.send(s),t.default.shouldScreenRecord=!1}},recordCanvas:!0,checkoutEveryNms:t.default.options.screenRecordDurationMs});return"function"==typeof p?p:i}catch(e){return n.sentryLogger.error("Failed to load web recorder",e),i}},exports.unzipScreenRecord=function(e){if(!e||!s)return null;const r=s.ungzip(function(e){const r=atob(e);return Uint8Array.from(r,e=>e.charCodeAt(0))}(e),{to:"string"});return JSON.parse(r)},exports.zip=a;
@@ -1,3 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2026 hangtiancheng
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
1
23
  declare function unzipScreenRecord(data: string): unknown;
2
24
 
3
25
  export { unzipScreenRecord };
@@ -1 +1 @@
1
- import{EventType as t}from"../../types/enums.js";import"../../constants/index.js";import e from"../../utils/get-base-data.js";import r from"../../utils/sentry.js";import{sentryLogger as n}from"../../utils/logger.js";import{z as o}from"zod";let s=null;const c=o.object({timestamp:o.number()}).passthrough();function i(){}function a(t,e){const n=e-r.options.screenRecordDurationMs;return t.filter(t=>t.timestamp>=n)}async function u(o){n.info("Initializing web recorder...");try{const[{record:u},m]=await Promise.all([import("@rrweb/record"),import("pako")]);s=m.default;let f=[];const p=u({emit(s,i){const u=c.safeParse(s);if(u.success&&(f=a([...f,u.data],u.data.timestamp),i&&(f=a(f,u.data.timestamp)),r.shouldScreenRecord&&f.length>0)){const s={...e(),name:"ScreenRecord",type:t.ScreenRecord,event:d(f),eventCount:f.length};n.success("Screen record window packaged and sent",{eventCount:s.eventCount}),o.send(s),r.shouldScreenRecord=!1}},recordCanvas:!0,checkoutEveryNms:r.options.screenRecordDurationMs});return"function"==typeof p?p:i}catch(t){return n.error("Failed to load web recorder",t),i}}function d(t){if(!t||!s)return"";const e=JSON.stringify(t);return function(t){let e="";return t.forEach(t=>{e+=String.fromCharCode(t)}),btoa(e)}(s.gzip(e))}function m(t){if(!t||!s)return null;const e=s.ungzip(function(t){const e=atob(t);return Uint8Array.from(e,t=>t.charCodeAt(0))}(t),{to:"string"});return JSON.parse(e)}export{u as recorder,m as unzipScreenRecord,d as zip};
1
+ import{EventType as t}from"../../types/enums.js";import"../../constants/index.js";import e from"../../utils/get-base-data.js";import r from"../../utils/sentry.js";import"../../utils/is-type.js";import{sentryLogger as n}from"../../utils/logger.js";import{z as o}from"zod";let s=null;const i=o.object({timestamp:o.number()}).passthrough();function c(){}function a(t,e){const n=e-r.options.screenRecordDurationMs;return t.filter(t=>t.timestamp>=n)}async function u(o){n.info("Initializing web recorder...");try{const[{record:u},d]=await Promise.all([import("@rrweb/record"),import("pako")]);s=d.default;let p=[];const f=u({emit(s,c){const u=i.safeParse(s);if(u.success&&(p=a([...p,u.data],u.data.timestamp),c&&(p=a(p,u.data.timestamp)),r.shouldScreenRecord&&p.length>0)){const s={...e(),name:"ScreenRecord",type:t.ScreenRecord,event:m(p),eventCount:p.length};n.success("Screen record window packaged and sent",{eventCount:s.eventCount}),o.send(s),r.shouldScreenRecord=!1}},recordCanvas:!0,checkoutEveryNms:r.options.screenRecordDurationMs});return"function"==typeof f?f:c}catch(t){return n.error("Failed to load web recorder",t),c}}function m(t){if(!t||!s)return"";const e=JSON.stringify(t);return function(t){let e="";return t.forEach(t=>{e+=String.fromCharCode(t)}),btoa(e)}(s.gzip(e))}function d(t){if(!t||!s)return null;const e=s.ungzip(function(t){const e=atob(t);return Uint8Array.from(e,t=>t.charCodeAt(0))}(t),{to:"string"});return JSON.parse(e)}export{u as recorder,d as unzipScreenRecord,m as zip};
@@ -0,0 +1 @@
1
+ "use strict";var r=require("preact"),e=require("./types/enums.cjs"),t=require("./core/framework-error.cjs");class o extends r.Component{state={};static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,o){this.setState({error:r,errorInfo:o}),t.reportFrameworkError({type:e.EventType.React,error:r,context:o})}render(){const{error:r,errorInfo:e}=this.state;if(r){const{fallback:t}=this.props;return"function"==typeof t?t(r,e):t??null}return this.props.children??null}}exports.PreactErrorBoundary=o;
@@ -0,0 +1,74 @@
1
+ import { Component, ComponentChildren, ErrorInfo } from 'preact';
2
+
3
+ /**
4
+ * Copyright (c) 2026 hangtiancheng
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * Props for the {@link PreactErrorBoundary} component.
27
+ *
28
+ * The boundary renders `children` normally. When a descendant throws during
29
+ * rendering, it switches to rendering {@link fallback} and reports the error
30
+ * to the Sentry SDK.
31
+ */
32
+ interface PreactErrorBoundaryProps {
33
+ /**
34
+ * The subtree to render when no error has occurred. When an error is
35
+ * caught, this is replaced by {@link fallback}.
36
+ */
37
+ readonly children?: ComponentChildren;
38
+ /**
39
+ * The UI to display when a descendant throws.
40
+ *
41
+ * Can be a static `ComponentChildren` (no access to the error) or a render
42
+ * function that receives the caught error and Preact's component-stack info.
43
+ *
44
+ * @param error - The Error thrown by the descendant component.
45
+ * @param errorInfo - Preact's {@link ErrorInfo}, containing `componentStack`.
46
+ * `undefined` on the first render after the error is caught.
47
+ * @returns The fallback Preact subtree to render.
48
+ */
49
+ readonly fallback?: ComponentChildren | ((error: Error, errorInfo?: ErrorInfo) => ComponentChildren);
50
+ }
51
+ /** Internal state tracking the caught error and component-stack info. */
52
+ interface PreactErrorBoundaryState {
53
+ readonly error?: Error;
54
+ readonly errorInfo?: ErrorInfo;
55
+ }
56
+ /**
57
+ * A Preact Error Boundary that reports caught errors to the Sentry SDK.
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * <PreactErrorBoundary fallback={<div>Something went wrong</div>}>
62
+ * <Page />
63
+ * </PreactErrorBoundary>
64
+ * ```
65
+ */
66
+ declare class PreactErrorBoundary extends Component<PreactErrorBoundaryProps, PreactErrorBoundaryState> {
67
+ state: PreactErrorBoundaryState;
68
+ static getDerivedStateFromError(error: Error): PreactErrorBoundaryState;
69
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
70
+ render(): ComponentChildren;
71
+ }
72
+
73
+ export { PreactErrorBoundary };
74
+ export type { PreactErrorBoundaryProps };
package/dist/preact.js ADDED
@@ -0,0 +1 @@
1
+ import{Component as r}from"preact";import{EventType as t}from"./types/enums.js";import{reportFrameworkError as e}from"./core/framework-error.js";class o extends r{state={};static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,o){this.setState({error:r,errorInfo:o}),e({type:t.React,error:r,context:o})}render(){const{error:r,errorInfo:t}=this.state;if(r){const{fallback:e}=this.props;return"function"==typeof e?e(r,t):e??null}return this.props.children??null}}export{o as PreactErrorBoundary};
package/dist/react.d.ts CHANGED
@@ -1,5 +1,27 @@
1
1
  import { Component, ReactNode, ErrorInfo } from 'react';
2
2
 
3
+ /**
4
+ * Copyright (c) 2026 hangtiancheng
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
3
25
  /**
4
26
  * Props for the {@link ReactErrorBoundary} component.
5
27
  *
@@ -1 +1 @@
1
- "use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs"),s=require("./promise.cjs");function t(e){return!1===e?[]:[...e]}exports.applyBeforePushHook=function(r){const n=e.default.options.beforePushEventList?e.default.options.beforePushEventList(r):r;return s.isPromise(n)?n.then(t):t(n)};
1
+ "use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var s=require("./promise.cjs");function r(e){return!1===e?[]:[...e]}exports.applyBeforePushHook=function(t){const i=e.default.options.beforePushEventList?e.default.options.beforePushEventList(t):t;return s.isPromise(i)?i.then(r):r(i)};
@@ -1 +1 @@
1
- import"../constants/index.js";import"../types/enums.js";import t from"../utils/sentry.js";import{isPromise as o}from"./promise.js";function s(s){const e=t.options.beforePushEventList?t.options.beforePushEventList(s):s;return o(e)?e.then(n):n(e)}function n(t){return!1===t?[]:[...t]}export{s as applyBeforePushHook};
1
+ import"../constants/index.js";import"../types/enums.js";import t from"../utils/sentry.js";import"../utils/is-type.js";import{isPromise as s}from"./promise.js";function o(o){const e=t.options.beforePushEventList?t.options.beforePushEventList(o):o;return s(e)?e.then(n):n(e)}function n(t){return!1===t?[]:[...t]}export{o as applyBeforePushHook};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../utils/data-structures.cjs");require("../types/enums.cjs");var t=require("../utils/sentry.cjs"),s=require("../utils/logger.cjs"),i=require("./batch.cjs"),n=require("./flush-scheduler.cjs"),r=require("./network-listener.cjs"),h=require("./offline-cache.cjs"),u=require("./promise.cjs"),a=require("./report-data.cjs"),l=require("./send-preflight.cjs"),c=require("./server-recovery.cjs"),o=require("./transports.cjs");class f{cbQueue=new e.CallbackQueue;id=crypto.randomUUID();events=[];timeoutID;retryTimer;isOnline=!0;isFlushing=!1;static#e=null;constructor(){r.initNetworkListener({setOnline:e=>{this.isOnline=e},loadOfflineCache:()=>this.loadOfflineCache(),flush:()=>this.flush()})}static get instance(){return this.#e||(this.#e=new f),this.#e}static reset(){this.#e&&this.#e.dispose(),this.#e=null}dispose(){this.timeoutID&&clearTimeout(this.timeoutID),this.retryTimer&&clearTimeout(this.retryTimer),this.events=[],this.isFlushing=!1}loadOfflineCache(){this.events.unshift(...h.loadOfflineCache()),this.events=this.events.slice(-t.default.options.maxQueueLength)}saveOfflineCache(){h.saveOfflineCache(this.events)}handleServerError(){this.retryTimer=c.scheduleServerRecovery(this.retryTimer,{setOnline:e=>{this.isOnline=e},setRetryTimer:e=>{this.retryTimer=e},loadOfflineCache:()=>this.loadOfflineCache(),flush:()=>this.flush()})}async flush(){if(0!==this.events.length&&!this.isFlushing){this.isFlushing=!0;try{if(!this.isOnline)return this.events=this.events.slice(-t.default.options.maxQueueLength),void this.saveOfflineCache();const e=this.takeBatch(),i=u.isPromise(e)?await e:e;if(0===i.length)return void this.scheduleNextFlush();const n=performance.now(),r=this.sendBatch(i);if(!(u.isPromise(r)?await r:r))return this.events=[...i,...this.events].slice(-t.default.options.maxQueueLength),void this.saveOfflineCache();t.default.options.afterSendData?.(i),s.sentryLogger.success("Batch report queued or sent",{count:i.length},Math.round(performance.now()-n))}finally{this.isFlushing=!1}this.scheduleNextFlush()}}takeBatch(){const e=t.default.options.cacheMaxLength,s=this.events.slice(0,e);return this.events=this.events.slice(e),i.applyBeforePushHook(s)}sendBatch(e){return!(o.isObjectOverSizeLimit(e,60)||!o.sendBeacon(e))||(t.default.options.useImageReport&&!o.isObjectOverSizeLimit(e,2)?(o.reportByImage(e,this.cbQueue),!0):o.reportByFetch(e,()=>this.handleServerError()))}scheduleNextFlush(){0!==this.events.length&&(this.timeoutID=n.scheduleFlush(this.timeoutID,100,()=>this.flush()))}async flushOfflineCache(){this.loadOfflineCache(),await this.flush()}async send(e,i=!1){const r=t.default.options;if(!l.shouldQueuePayload(e))return;const h=a.runBeforeReportHook(this.id,e),c=u.isPromise(h)?await h:h;if(c){if(s.sentryLogger.info(`Type: ${e.type}`,c),this.events.push(c),!this.isOnline)return this.events=this.events.slice(-r.maxQueueLength),void this.saveOfflineCache();this.timeoutID&&clearTimeout(this.timeoutID),i||this.events.length>=r.cacheMaxLength?await this.flush():this.timeoutID=n.scheduleFlush(this.timeoutID,r.cacheWaitingTime,()=>this.flush())}}}let d=null;var v=new Proxy({},{get(e,t){const s=(d||(d=f.instance),d),i=Reflect.get(s,t,s);return"function"==typeof i?i.bind(s):i}});exports.DataReporter=f,exports.default=v,exports.resetReporter=function(){d&&(f.reset(),d=null)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../utils/data-structures.cjs");require("../types/enums.cjs");var t=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var s=require("../utils/logger.cjs"),i=require("./batch.cjs"),r=require("./flush-scheduler.cjs"),n=require("./network-listener.cjs"),h=require("./offline-cache.cjs"),u=require("./promise.cjs"),a=require("./report-data.cjs"),l=require("./send-preflight.cjs"),c=require("./server-recovery.cjs"),o=require("./transports.cjs");class f{cbQueue=new e.CallbackQueue;id=crypto.randomUUID();events=[];timeoutID;retryTimer;isOnline=!0;isFlushing=!1;static#e=null;constructor(){n.initNetworkListener({setOnline:e=>{this.isOnline=e},loadOfflineCache:()=>this.loadOfflineCache(),flush:()=>this.flush()})}static get instance(){return this.#e||(this.#e=new f),this.#e}static reset(){this.#e&&this.#e.dispose(),this.#e=null}dispose(){this.timeoutID&&clearTimeout(this.timeoutID),this.retryTimer&&clearTimeout(this.retryTimer),this.events=[],this.isFlushing=!1}loadOfflineCache(){this.events.unshift(...h.loadOfflineCache()),this.events=this.events.slice(-t.default.options.maxQueueLength)}saveOfflineCache(){h.saveOfflineCache(this.events)}handleServerError(){this.retryTimer=c.scheduleServerRecovery(this.retryTimer,{setOnline:e=>{this.isOnline=e},setRetryTimer:e=>{this.retryTimer=e},loadOfflineCache:()=>this.loadOfflineCache(),flush:()=>this.flush()})}async flush(){if(0!==this.events.length&&!this.isFlushing){this.isFlushing=!0;try{if(!this.isOnline)return this.events=this.events.slice(-t.default.options.maxQueueLength),void this.saveOfflineCache();const e=this.takeBatch(),i=u.isPromise(e)?await e:e;if(0===i.length)return void this.scheduleNextFlush();const r=performance.now(),n=this.sendBatch(i);if(!(u.isPromise(n)?await n:n))return this.events=[...i,...this.events].slice(-t.default.options.maxQueueLength),void this.saveOfflineCache();t.default.options.afterSendData?.(i),s.sentryLogger.success("Batch report queued or sent",{count:i.length},Math.round(performance.now()-r))}finally{this.isFlushing=!1}this.scheduleNextFlush()}}takeBatch(){const e=t.default.options.cacheMaxLength,s=this.events.slice(0,e);return this.events=this.events.slice(e),i.applyBeforePushHook(s)}sendBatch(e){return!(o.isObjectOverSizeLimit(e,60)||!o.sendBeacon(e))||(t.default.options.useImageReport&&!o.isObjectOverSizeLimit(e,2)?(o.reportByImage(e,this.cbQueue),!0):o.reportByFetch(e,()=>this.handleServerError()))}scheduleNextFlush(){0!==this.events.length&&(this.timeoutID=r.scheduleFlush(this.timeoutID,100,()=>this.flush()))}async flushOfflineCache(){this.loadOfflineCache(),await this.flush()}async send(e,i=!1){const n=t.default.options;if(!l.shouldQueuePayload(e))return;const h=a.runBeforeReportHook(this.id,e),c=u.isPromise(h)?await h:h;if(c){if(s.sentryLogger.info(`Type: ${e.type}`,c),this.events.push(c),!this.isOnline)return this.events=this.events.slice(-n.maxQueueLength),void this.saveOfflineCache();this.timeoutID&&clearTimeout(this.timeoutID),i||this.events.length>=n.cacheMaxLength?await this.flush():this.timeoutID=r.scheduleFlush(this.timeoutID,n.cacheWaitingTime,()=>this.flush())}}}let d=null;var v=new Proxy({},{get(e,t){const s=(d||(d=f.instance),d),i=Reflect.get(s,t,s);return"function"==typeof i?i.bind(s):i}});exports.DataReporter=f,exports.default=v,exports.resetReporter=function(){d&&(f.reset(),d=null)};
@@ -1 +1 @@
1
- import{CallbackQueue as t}from"../utils/data-structures.js";import"../types/enums.js";import e from"../utils/sentry.js";import{sentryLogger as s}from"../utils/logger.js";import{applyBeforePushHook as i}from"./batch.js";import{scheduleFlush as n}from"./flush-scheduler.js";import{initNetworkListener as h}from"./network-listener.js";import{loadOfflineCache as r,saveOfflineCache as o}from"./offline-cache.js";import{isPromise as a}from"./promise.js";import{runBeforeReportHook as l}from"./report-data.js";import{shouldQueuePayload as u}from"./send-preflight.js";import{scheduleServerRecovery as c}from"./server-recovery.js";import{isObjectOverSizeLimit as f,sendBeacon as m,reportByImage as p,reportByFetch as d}from"./transports.js";class v{cbQueue=new t;id=crypto.randomUUID();events=[];timeoutID;retryTimer;isOnline=!0;isFlushing=!1;static#t=null;constructor(){h({setOnline:t=>{this.isOnline=t},loadOfflineCache:()=>this.loadOfflineCache(),flush:()=>this.flush()})}static get instance(){return this.#t||(this.#t=new v),this.#t}static reset(){this.#t&&this.#t.dispose(),this.#t=null}dispose(){this.timeoutID&&clearTimeout(this.timeoutID),this.retryTimer&&clearTimeout(this.retryTimer),this.events=[],this.isFlushing=!1}loadOfflineCache(){this.events.unshift(...r()),this.events=this.events.slice(-e.options.maxQueueLength)}saveOfflineCache(){o(this.events)}handleServerError(){this.retryTimer=c(this.retryTimer,{setOnline:t=>{this.isOnline=t},setRetryTimer:t=>{this.retryTimer=t},loadOfflineCache:()=>this.loadOfflineCache(),flush:()=>this.flush()})}async flush(){if(0!==this.events.length&&!this.isFlushing){this.isFlushing=!0;try{if(!this.isOnline)return this.events=this.events.slice(-e.options.maxQueueLength),void this.saveOfflineCache();const t=this.takeBatch(),i=a(t)?await t:t;if(0===i.length)return void this.scheduleNextFlush();const n=performance.now(),h=this.sendBatch(i);if(!(a(h)?await h:h))return this.events=[...i,...this.events].slice(-e.options.maxQueueLength),void this.saveOfflineCache();e.options.afterSendData?.(i),s.success("Batch report queued or sent",{count:i.length},Math.round(performance.now()-n))}finally{this.isFlushing=!1}this.scheduleNextFlush()}}takeBatch(){const t=e.options.cacheMaxLength,s=this.events.slice(0,t);return this.events=this.events.slice(t),i(s)}sendBatch(t){return!(f(t,60)||!m(t))||(e.options.useImageReport&&!f(t,2)?(p(t,this.cbQueue),!0):d(t,()=>this.handleServerError()))}scheduleNextFlush(){0!==this.events.length&&(this.timeoutID=n(this.timeoutID,100,()=>this.flush()))}async flushOfflineCache(){this.loadOfflineCache(),await this.flush()}async send(t,i=!1){const h=e.options;if(!u(t))return;const r=l(this.id,t),o=a(r)?await r:r;if(o){if(s.info(`Type: ${t.type}`,o),this.events.push(o),!this.isOnline)return this.events=this.events.slice(-h.maxQueueLength),void this.saveOfflineCache();this.timeoutID&&clearTimeout(this.timeoutID),i||this.events.length>=h.cacheMaxLength?await this.flush():this.timeoutID=n(this.timeoutID,h.cacheWaitingTime,()=>this.flush())}}}let g=null;function y(){g&&(v.reset(),g=null)}var O=new Proxy({},{get(t,e){const s=(g||(g=v.instance),g),i=Reflect.get(s,e,s);return"function"==typeof i?i.bind(s):i}});export{v as DataReporter,O as default,y as resetReporter};
1
+ import{CallbackQueue as t}from"../utils/data-structures.js";import"../types/enums.js";import e from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as s}from"../utils/logger.js";import{applyBeforePushHook as i}from"./batch.js";import{scheduleFlush as n}from"./flush-scheduler.js";import{initNetworkListener as h}from"./network-listener.js";import{loadOfflineCache as r,saveOfflineCache as o}from"./offline-cache.js";import{isPromise as a}from"./promise.js";import{runBeforeReportHook as l}from"./report-data.js";import{shouldQueuePayload as u}from"./send-preflight.js";import{scheduleServerRecovery as c}from"./server-recovery.js";import{isObjectOverSizeLimit as f,sendBeacon as m,reportByImage as p,reportByFetch as d}from"./transports.js";class v{cbQueue=new t;id=crypto.randomUUID();events=[];timeoutID;retryTimer;isOnline=!0;isFlushing=!1;static#t=null;constructor(){h({setOnline:t=>{this.isOnline=t},loadOfflineCache:()=>this.loadOfflineCache(),flush:()=>this.flush()})}static get instance(){return this.#t||(this.#t=new v),this.#t}static reset(){this.#t&&this.#t.dispose(),this.#t=null}dispose(){this.timeoutID&&clearTimeout(this.timeoutID),this.retryTimer&&clearTimeout(this.retryTimer),this.events=[],this.isFlushing=!1}loadOfflineCache(){this.events.unshift(...r()),this.events=this.events.slice(-e.options.maxQueueLength)}saveOfflineCache(){o(this.events)}handleServerError(){this.retryTimer=c(this.retryTimer,{setOnline:t=>{this.isOnline=t},setRetryTimer:t=>{this.retryTimer=t},loadOfflineCache:()=>this.loadOfflineCache(),flush:()=>this.flush()})}async flush(){if(0!==this.events.length&&!this.isFlushing){this.isFlushing=!0;try{if(!this.isOnline)return this.events=this.events.slice(-e.options.maxQueueLength),void this.saveOfflineCache();const t=this.takeBatch(),i=a(t)?await t:t;if(0===i.length)return void this.scheduleNextFlush();const n=performance.now(),h=this.sendBatch(i);if(!(a(h)?await h:h))return this.events=[...i,...this.events].slice(-e.options.maxQueueLength),void this.saveOfflineCache();e.options.afterSendData?.(i),s.success("Batch report queued or sent",{count:i.length},Math.round(performance.now()-n))}finally{this.isFlushing=!1}this.scheduleNextFlush()}}takeBatch(){const t=e.options.cacheMaxLength,s=this.events.slice(0,t);return this.events=this.events.slice(t),i(s)}sendBatch(t){return!(f(t,60)||!m(t))||(e.options.useImageReport&&!f(t,2)?(p(t,this.cbQueue),!0):d(t,()=>this.handleServerError()))}scheduleNextFlush(){0!==this.events.length&&(this.timeoutID=n(this.timeoutID,100,()=>this.flush()))}async flushOfflineCache(){this.loadOfflineCache(),await this.flush()}async send(t,i=!1){const h=e.options;if(!u(t))return;const r=l(this.id,t),o=a(r)?await r:r;if(o){if(s.info(`Type: ${t.type}`,o),this.events.push(o),!this.isOnline)return this.events=this.events.slice(-h.maxQueueLength),void this.saveOfflineCache();this.timeoutID&&clearTimeout(this.timeoutID),i||this.events.length>=h.cacheMaxLength?await this.flush():this.timeoutID=n(this.timeoutID,h.cacheWaitingTime,()=>this.flush())}}}let g=null;function y(){g&&(v.reset(),g=null)}var O=new Proxy({},{get(t,e){const s=(g||(g=v.instance),g),i=Reflect.get(s,e,s);return"function"==typeof i?i.bind(s):i}});export{v as DataReporter,O as default,y as resetReporter};
@@ -1 +1 @@
1
- "use strict";require("../constants/index.cjs"),require("../types/enums.cjs"),require("../utils/sentry.cjs");var e=require("../utils/logger.cjs");exports.initNetworkListener=function(n){n.setOnline(!1!==navigator.onLine),globalThis.addEventListener("online",()=>{n.setOnline(!0),e.sentryLogger.info("Network is back online, flushing cache"),n.loadOfflineCache(),n.flush()}),globalThis.addEventListener("offline",()=>{n.setOnline(!1),e.sentryLogger.info("Network is offline, caching events")})};
1
+ "use strict";require("../constants/index.cjs"),require("../types/enums.cjs"),require("../utils/sentry.cjs"),require("../utils/is-type.cjs");var e=require("../utils/logger.cjs");exports.initNetworkListener=function(n){n.setOnline(!1!==navigator.onLine),globalThis.addEventListener("online",()=>{n.setOnline(!0),e.sentryLogger.info("Network is back online, flushing cache"),n.loadOfflineCache(),n.flush()}),globalThis.addEventListener("offline",()=>{n.setOnline(!1),e.sentryLogger.info("Network is offline, caching events")})};
@@ -1 +1 @@
1
- import"../constants/index.js";import"../types/enums.js";import"../utils/sentry.js";import{sentryLogger as n}from"../utils/logger.js";function e(e){e.setOnline(!1!==navigator.onLine),globalThis.addEventListener("online",()=>{e.setOnline(!0),n.info("Network is back online, flushing cache"),e.loadOfflineCache(),e.flush()}),globalThis.addEventListener("offline",()=>{e.setOnline(!1),n.info("Network is offline, caching events")})}export{e as initNetworkListener};
1
+ import"../constants/index.js";import"../types/enums.js";import"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as n}from"../utils/logger.js";function e(e){e.setOnline(!1!==navigator.onLine),globalThis.addEventListener("online",()=>{e.setOnline(!0),n.info("Network is back online, flushing cache"),e.loadOfflineCache(),e.flush()}),globalThis.addEventListener("offline",()=>{e.setOnline(!1),n.info("Network is offline, caching events")})}export{e as initNetworkListener};
@@ -1 +1 @@
1
- "use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs"),t=require("../utils/logger.cjs"),a=require("./report-data-schema.cjs");exports.loadOfflineCache=function(){try{const t=localStorage.getItem(e.default.options.offlineCacheKey);if(!t)return[];const r=JSON.parse(t),o=a.reportDataListSchema.safeParse(r);return o.success?(localStorage.removeItem(e.default.options.offlineCacheKey),o.data.slice(-e.default.options.maxQueueLength)):[]}catch{return localStorage.removeItem(e.default.options.offlineCacheKey),[]}},exports.saveOfflineCache=function(a){try{localStorage.setItem(e.default.options.offlineCacheKey,JSON.stringify(a.slice(-e.default.options.maxQueueLength)))}catch{t.sentryLogger.error("Failed to save offline cache")}};
1
+ "use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var t=require("../utils/logger.cjs"),r=require("./report-data-schema.cjs");exports.loadOfflineCache=function(){try{const t=localStorage.getItem(e.default.options.offlineCacheKey);if(!t)return[];const a=JSON.parse(t),s=r.reportDataListSchema.safeParse(a);return s.success?(localStorage.removeItem(e.default.options.offlineCacheKey),s.data.slice(-e.default.options.maxQueueLength)):[]}catch{return localStorage.removeItem(e.default.options.offlineCacheKey),[]}},exports.saveOfflineCache=function(r){try{localStorage.setItem(e.default.options.offlineCacheKey,JSON.stringify(r.slice(-e.default.options.maxQueueLength)))}catch{t.sentryLogger.error("Failed to save offline cache")}};
@@ -1 +1 @@
1
- import"../constants/index.js";import"../types/enums.js";import e from"../utils/sentry.js";import{sentryLogger as t}from"../utils/logger.js";import{reportDataListSchema as o}from"./report-data-schema.js";function r(){try{const t=localStorage.getItem(e.options.offlineCacheKey);if(!t)return[];const r=JSON.parse(t),s=o.safeParse(r);return s.success?(localStorage.removeItem(e.options.offlineCacheKey),s.data.slice(-e.options.maxQueueLength)):[]}catch{return localStorage.removeItem(e.options.offlineCacheKey),[]}}function s(o){try{localStorage.setItem(e.options.offlineCacheKey,JSON.stringify(o.slice(-e.options.maxQueueLength)))}catch{t.error("Failed to save offline cache")}}export{r as loadOfflineCache,s as saveOfflineCache};
1
+ import"../constants/index.js";import"../types/enums.js";import e from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as t}from"../utils/logger.js";import{reportDataListSchema as o}from"./report-data-schema.js";function s(){try{const t=localStorage.getItem(e.options.offlineCacheKey);if(!t)return[];const s=JSON.parse(t),r=o.safeParse(s);return r.success?(localStorage.removeItem(e.options.offlineCacheKey),r.data.slice(-e.options.maxQueueLength)):[]}catch{return localStorage.removeItem(e.options.offlineCacheKey),[]}}function r(o){try{localStorage.setItem(e.options.offlineCacheKey,JSON.stringify(o.slice(-e.options.maxQueueLength)))}catch{t.error("Failed to save offline cache")}}export{s as loadOfflineCache,r as saveOfflineCache};
@@ -1 +1 @@
1
- "use strict";var e=require("zod"),t=require("../types/enums.cjs");const r=e.z.object({browserName:e.z.string(),browserVersion:e.z.string(),osName:e.z.string(),osVersion:e.z.string(),userAgent:e.z.string(),deviceType:e.z.string(),deviceModel:e.z.string(),fingerprint:e.z.string(),language:e.z.string(),screenResolution:e.z.string()}),s=e.z.object({id:e.z.string(),type:e.z.nativeEnum(t.EventType),name:e.z.string(),time:e.z.string(),timestamp:e.z.number(),message:e.z.string(),status:e.z.nativeEnum(t.Status),url:e.z.string(),userId:e.z.string(),projectId:e.z.string(),sdkVersion:e.z.string(),deviceInfo:r,payload:e.z.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),n=e.z.array(s);exports.deviceInfoSchema=r,exports.reportDataListSchema=n,exports.reportDataSchema=s;
1
+ "use strict";var e=require("zod"),t=require("../types/enums.cjs");const r=e.z.object({browserName:e.z.string(),browserVersion:e.z.string(),osName:e.z.string(),osVersion:e.z.string(),userAgent:e.z.string(),deviceType:e.z.string(),deviceModel:e.z.string(),fingerprint:e.z.string(),language:e.z.string(),screenResolution:e.z.string()}),s=e.z.object({id:e.z.string(),type:e.z.enum(t.EventType),name:e.z.string(),time:e.z.string(),timestamp:e.z.number(),message:e.z.string(),status:e.z.enum(t.Status),url:e.z.string(),userId:e.z.string(),projectId:e.z.string(),sdkVersion:e.z.string(),deviceInfo:r,payload:e.z.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),n=e.z.array(s);exports.deviceInfoSchema=r,exports.reportDataListSchema=n,exports.reportDataSchema=s;
@@ -1 +1 @@
1
- import{z as e}from"zod";import{Status as t,EventType as r}from"../types/enums.js";const s=e.object({browserName:e.string(),browserVersion:e.string(),osName:e.string(),osVersion:e.string(),userAgent:e.string(),deviceType:e.string(),deviceModel:e.string(),fingerprint:e.string(),language:e.string(),screenResolution:e.string()}),n=e.object({id:e.string(),type:e.nativeEnum(r),name:e.string(),time:e.string(),timestamp:e.number(),message:e.string(),status:e.nativeEnum(t),url:e.string(),userId:e.string(),projectId:e.string(),sdkVersion:e.string(),deviceInfo:s,payload:e.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),i=e.array(n);export{s as deviceInfoSchema,i as reportDataListSchema,n as reportDataSchema};
1
+ import{z as e}from"zod";import{Status as r,EventType as t}from"../types/enums.js";const s=e.object({browserName:e.string(),browserVersion:e.string(),osName:e.string(),osVersion:e.string(),userAgent:e.string(),deviceType:e.string(),deviceModel:e.string(),fingerprint:e.string(),language:e.string(),screenResolution:e.string()}),n=e.object({id:e.string(),type:e.enum(t),name:e.string(),time:e.string(),timestamp:e.number(),message:e.string(),status:e.enum(r),url:e.string(),userId:e.string(),projectId:e.string(),sdkVersion:e.string(),deviceInfo:s,payload:e.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),i=e.array(n);export{s as deviceInfoSchema,i as reportDataListSchema,n as reportDataSchema};
@@ -1 +1 @@
1
- "use strict";var e=require("../constants/index.cjs");require("../types/enums.cjs");var t=require("../utils/sentry.cjs"),o=require("./promise.cjs");function r(o,r){const{type:s,name:n,time:a,timestamp:i,message:u,status:p}=r;return{type:s,name:n,time:a,timestamp:i,message:u,status:p,id:o,url:location.href,userId:t.default.options.userId,projectId:t.default.options.projectId,sdkVersion:e.SDK_VERSION,deviceInfo:t.default.deviceInfo,payload:r}}function s(e){return!1===e?null:e}exports.payloadToReportData=r,exports.runBeforeReportHook=function(e,n){const a=r(e,n);if(!t.default.options.onBeforeReportData)return a;const i=t.default.options.onBeforeReportData(a);return o.isPromise(i)?i.then(s):s(i)};
1
+ "use strict";var e=require("../constants/index.cjs");require("../types/enums.cjs");var t=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var r=require("./promise.cjs");function s(r,s){const{type:o,name:n,time:i,timestamp:a,message:u,status:p}=s;return{type:o,name:n,time:i,timestamp:a,message:u,status:p,id:r,url:location.href,userId:t.default.options.userId,projectId:t.default.options.projectId,sdkVersion:e.SDK_VERSION,deviceInfo:t.default.deviceInfo,payload:s}}function o(e){return!1===e?null:e}exports.payloadToReportData=s,exports.runBeforeReportHook=function(e,n){const i=s(e,n);if(!t.default.options.onBeforeReportData)return i;const a=t.default.options.onBeforeReportData(i);return r.isPromise(a)?a.then(o):o(a)};
@@ -1 +1 @@
1
- import{SDK_VERSION as t}from"../constants/index.js";import"../types/enums.js";import e from"../utils/sentry.js";import{isPromise as o}from"./promise.js";function n(o,n){const{type:s,name:r,time:i,timestamp:p,message:m,status:a}=n;return{type:s,name:r,time:i,timestamp:p,message:m,status:a,id:o,url:location.href,userId:e.options.userId,projectId:e.options.projectId,sdkVersion:t,deviceInfo:e.deviceInfo,payload:n}}function s(t,s){const i=n(t,s);if(!e.options.onBeforeReportData)return i;const p=e.options.onBeforeReportData(i);return o(p)?p.then(r):r(p)}function r(t){return!1===t?null:t}export{n as payloadToReportData,s as runBeforeReportHook};
1
+ import{SDK_VERSION as t}from"../constants/index.js";import"../types/enums.js";import e from"../utils/sentry.js";import"../utils/is-type.js";import{isPromise as o}from"./promise.js";function s(o,s){const{type:n,name:r,time:i,timestamp:p,message:m,status:a}=s;return{type:n,name:r,time:i,timestamp:p,message:m,status:a,id:o,url:location.href,userId:e.options.userId,projectId:e.options.projectId,sdkVersion:t,deviceInfo:e.deviceInfo,payload:s}}function n(t,n){const i=s(t,n);if(!e.options.onBeforeReportData)return i;const p=e.options.onBeforeReportData(i);return o(p)?p.then(r):r(p)}function r(t){return!1===t?null:t}export{s as payloadToReportData,n as runBeforeReportHook};
@@ -1 +1 @@
1
- "use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs"),r=require("../utils/logger.cjs");exports.shouldQueuePayload=function(s){const t=e.default.options;return""===t.dsn?(r.sentryLogger.error("DSN is empty, report cancelled",s),!1):Math.random()>t.tracesSampleRate?(r.sentryLogger.info(`Dropped by sample rate: ${s.type}`),!1):(t.screenRecordEventTypes.includes(s.type)&&(e.default.shouldScreenRecord=!0),!0)};
1
+ "use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var r=require("../utils/logger.cjs");exports.shouldQueuePayload=function(s){const t=e.default.options;return""===t.dsn?(r.sentryLogger.error("DSN is empty, report cancelled",s),!1):Math.random()>t.tracesSampleRate?(r.sentryLogger.info(`Dropped by sample rate: ${s.type}`),!1):(t.screenRecordEventTypes.includes(s.type)&&(e.default.shouldScreenRecord=!0),!0)};
@@ -1 +1 @@
1
- import"../constants/index.js";import"../types/enums.js";import e from"../utils/sentry.js";import{sentryLogger as r}from"../utils/logger.js";function t(t){const o=e.options;return""===o.dsn?(r.error("DSN is empty, report cancelled",t),!1):Math.random()>o.tracesSampleRate?(r.info(`Dropped by sample rate: ${t.type}`),!1):(o.screenRecordEventTypes.includes(t.type)&&(e.shouldScreenRecord=!0),!0)}export{t as shouldQueuePayload};
1
+ import"../constants/index.js";import"../types/enums.js";import e from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as t}from"../utils/logger.js";function r(r){const s=e.options;return""===s.dsn?(t.error("DSN is empty, report cancelled",r),!1):Math.random()>s.tracesSampleRate?(t.info(`Dropped by sample rate: ${r.type}`),!1):(s.screenRecordEventTypes.includes(r.type)&&(e.shouldScreenRecord=!0),!0)}export{r as shouldQueuePayload};
@@ -1 +1 @@
1
- "use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs"),r=require("../utils/logger.cjs"),t=require("./timer.cjs");function s(i,n){n.setOnline(!1),i&&clearTimeout(i);const c=setTimeout(()=>{!function(t){fetch(e.default.options.dsn,{method:"HEAD"}).then(e=>{e.ok?(t.setOnline(!0),r.sentryLogger.info("Server is back available, flushing cache"),t.loadOfflineCache(),t.flush()):s(void 0,t)}).catch(()=>{s(void 0,t)})}(n)},e.default.options.retryIntervalMilliseconds);return t.unrefTimer(c),n.setRetryTimer(c),c}exports.scheduleServerRecovery=s;
1
+ "use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var r=require("../utils/logger.cjs"),t=require("./timer.cjs");function s(i,n){n.setOnline(!1),i&&clearTimeout(i);const c=setTimeout(()=>{!function(t){fetch(e.default.options.dsn,{method:"HEAD"}).then(e=>{e.ok?(t.setOnline(!0),r.sentryLogger.info("Server is back available, flushing cache"),t.loadOfflineCache(),t.flush()):s(void 0,t)}).catch(()=>{s(void 0,t)})}(n)},e.default.options.retryIntervalMilliseconds);return t.unrefTimer(c),n.setRetryTimer(c),c}exports.scheduleServerRecovery=s;
@@ -1 +1 @@
1
- import"../constants/index.js";import"../types/enums.js";import t from"../utils/sentry.js";import{sentryLogger as e}from"../utils/logger.js";import{unrefTimer as i}from"./timer.js";function o(s,n){n.setOnline(!1),s&&clearTimeout(s);const r=setTimeout(()=>{!function(i){fetch(t.options.dsn,{method:"HEAD"}).then(t=>{t.ok?(i.setOnline(!0),e.info("Server is back available, flushing cache"),i.loadOfflineCache(),i.flush()):o(void 0,i)}).catch(()=>{o(void 0,i)})}(n)},t.options.retryIntervalMilliseconds);return i(r),n.setRetryTimer(r),r}export{o as scheduleServerRecovery};
1
+ import"../constants/index.js";import"../types/enums.js";import t from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as e}from"../utils/logger.js";import{unrefTimer as i}from"./timer.js";function o(s,n){n.setOnline(!1),s&&clearTimeout(s);const r=setTimeout(()=>{!function(i){fetch(t.options.dsn,{method:"HEAD"}).then(t=>{t.ok?(i.setOnline(!0),e.info("Server is back available, flushing cache"),i.loadOfflineCache(),i.flush()):o(void 0,i)}).catch(()=>{o(void 0,i)})}(n)},t.options.retryIntervalMilliseconds);return i(r),n.setRetryTimer(r),r}export{o as scheduleServerRecovery};
@@ -1 +1 @@
1
- "use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs"),t=require("../utils/logger.cjs");exports.isObjectOverSizeLimit=function(e,t){const n=JSON.stringify(e);return(new TextEncoder).encode(n).byteLength>1024*t},exports.reportByFetch=async function(n,r){try{const t=await fetch(e.default.options.dsn,{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json"},keepalive:!0});return t.ok||r(),t.ok}catch(e){return t.sentryLogger.error("Fetch report failed",e),r(),!1}},exports.reportByImage=function(t,n){const{dsn:r}=e.default.options;n.push(()=>{const e=new Image,n=r.includes("?")?"&":"?";e.src=`${r}${n}data=${encodeURIComponent(JSON.stringify(t))}`})},exports.sendBeacon=function(t){return!("undefined"==typeof navigator||!navigator.sendBeacon)&&navigator.sendBeacon(e.default.options.dsn,JSON.stringify(t))};
1
+ "use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var t=require("../utils/logger.cjs");exports.isObjectOverSizeLimit=function(e,t){const n=JSON.stringify(e);return(new TextEncoder).encode(n).byteLength>1024*t},exports.reportByFetch=async function(n,r){try{const t=await fetch(e.default.options.dsn,{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json"},keepalive:!0});return t.ok||r(),t.ok}catch(e){return t.sentryLogger.error("Fetch report failed",e),r(),!1}},exports.reportByImage=function(t,n){const{dsn:r}=e.default.options;n.push(()=>{const e=new Image,n=r.includes("?")?"&":"?";e.src=`${r}${n}data=${encodeURIComponent(JSON.stringify(t))}`})},exports.sendBeacon=function(t){return!("undefined"==typeof navigator||!navigator.sendBeacon)&&navigator.sendBeacon(e.default.options.dsn,JSON.stringify(t))};
@@ -1 +1 @@
1
- import"../constants/index.js";import"../types/enums.js";import n from"../utils/sentry.js";import{sentryLogger as t}from"../utils/logger.js";function e(n,t){const e=JSON.stringify(n);return(new TextEncoder).encode(e).byteLength>1024*t}function o(t){return!("undefined"==typeof navigator||!navigator.sendBeacon)&&navigator.sendBeacon(n.options.dsn,JSON.stringify(t))}async function r(e,o){try{const t=await fetch(n.options.dsn,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"},keepalive:!0});return t.ok||o(),t.ok}catch(n){return t.error("Fetch report failed",n),o(),!1}}function s(t,e){const{dsn:o}=n.options;e.push(()=>{const n=new Image,e=o.includes("?")?"&":"?";n.src=`${o}${e}data=${encodeURIComponent(JSON.stringify(t))}`})}export{e as isObjectOverSizeLimit,r as reportByFetch,s as reportByImage,o as sendBeacon};
1
+ import"../constants/index.js";import"../types/enums.js";import n from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as t}from"../utils/logger.js";function e(n,t){const e=JSON.stringify(n);return(new TextEncoder).encode(e).byteLength>1024*t}function o(t){return!("undefined"==typeof navigator||!navigator.sendBeacon)&&navigator.sendBeacon(n.options.dsn,JSON.stringify(t))}async function s(e,o){try{const t=await fetch(n.options.dsn,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"},keepalive:!0});return t.ok||o(),t.ok}catch(n){return t.error("Fetch report failed",n),o(),!1}}function i(t,e){const{dsn:o}=n.options;e.push(()=>{const n=new Image,e=o.includes("?")?"&":"?";n.src=`${o}${e}data=${encodeURIComponent(JSON.stringify(t))}`})}export{e as isObjectOverSizeLimit,s as reportByFetch,i as reportByImage,o as sendBeacon};
@@ -0,0 +1 @@
1
+ "use strict";var n=require("source-map"),t=require("zod");const e=t.z.object({version:t.z.union([t.z.number(),t.z.string()]),sources:t.z.array(t.z.string().nullable()),names:t.z.array(t.z.string()),mappings:t.z.string()}),r=t.z.looseObject({type:t.z.string().optional(),name:t.z.string().optional(),payload:t.z.looseObject({line:t.z.number().optional(),column:t.z.number().optional(),extra:t.z.unknown().optional(),stack:t.z.unknown().optional()}).optional()}),o=/^\s*at (?:(.+?)\s+)?\(?(\S+?):(\d+):(\d+)\)?\s*$/,s=/^\s*(?:(.*?)@)?(\S+?):(\d+):(\d+)\s*$/;function a(n){const t=[];for(const e of n.split("\n")){if(t.length>=30)break;const n=o.exec(e)??s.exec(e);if(!n)continue;const[,r,a,c,i]=n;if(!a||!c||!i)continue;const u={url:a,line:Number.parseInt(c,10),column:Number.parseInt(i,10)};r&&(u.func=r),t.push(u)}return t}async function c(t,r){const o={resolved:!1,...r};try{const s=await t(r.url);return e.safeParse(s).success?await n.SourceMapConsumer.with(JSON.stringify(s),null,n=>{const t=n.originalPositionFor({line:r.line,column:Math.max(0,r.column-1)});if(null===t.source||null===t.line)return o;const e=n.sourceContentFor(t.source,!0),s={...o,resolved:!0,source:t.source,originalLine:t.line};return null!==t.column&&(s.originalColumn=t.column),null!==t.name&&(s.name=t.name),e&&(s.snippet=function(n,t){const e=n.split("\n"),r=Math.max(1,t-3),o=Math.min(e.length,t+3),s=[];for(let n=r;n<=o;n++)s.push({line:n,code:e[n-1]??"",highlight:n===t});return s}(e,t.line)),s}):o}catch{return o}}async function i(n,t){const e=a(t),r=[];for(const t of e)r.push(await c(n,t));return r}async function u(n,t){const e=r.safeParse(t);if(!e.success)return t;const o=e.data,s=o.payload;if(!s)return t;const a=[];var u;return"Error"===o.type&&"string"==typeof o.name&&"number"==typeof s.line&&"number"==typeof s.column?a.push(await c(n,{url:o.name,line:s.line,column:s.column})):"string"==typeof s.extra&&(u=s.extra,/(^|\n)\s*at .+:\d+:\d+/.test(u)||/@.+:\d+:\d+/.test(u))?a.push(...await i(n,s.extra)):"React"!==o.type&&"Vue"!==o.type||"string"!=typeof s.stack||a.push(...await i(n,s.stack)),0===a.length?t:{...o,sourcemap:{frames:a}}}exports.enrichReportData=async function(n,t){if(!Array.isArray(t))return t;const e=[];for(const r of t)e.push(await u(n,r));return e},exports.parseStack=a,exports.resolveFrame=c,exports.resolveStack=i,exports.splitScriptUrl=function(n){try{const t=new URL(n);return{pathname:t.pathname,search:t.search}}catch{const t=n.search(/[?#]/);return-1!==t?{pathname:n.slice(0,t),search:n.slice(t)}:{pathname:n,search:""}}};
@@ -0,0 +1 @@
1
+ import{SourceMapConsumer as n}from"source-map";import{z as t}from"zod";const e=t.object({version:t.union([t.number(),t.string()]),sources:t.array(t.string().nullable()),names:t.array(t.string()),mappings:t.string()}),o=t.looseObject({type:t.string().optional(),name:t.string().optional(),payload:t.looseObject({line:t.number().optional(),column:t.number().optional(),extra:t.unknown().optional(),stack:t.unknown().optional()}).optional()}),r=/^\s*at (?:(.+?)\s+)?\(?(\S+?):(\d+):(\d+)\)?\s*$/,s=/^\s*(?:(.*?)@)?(\S+?):(\d+):(\d+)\s*$/;function a(n){const t=[];for(const e of n.split("\n")){if(t.length>=30)break;const n=r.exec(e)??s.exec(e);if(!n)continue;const[,o,a,c,i]=n;if(!a||!c||!i)continue;const u={url:a,line:Number.parseInt(c,10),column:Number.parseInt(i,10)};o&&(u.func=o),t.push(u)}return t}function c(n){try{const t=new URL(n);return{pathname:t.pathname,search:t.search}}catch{const t=n.search(/[?#]/);return-1!==t?{pathname:n.slice(0,t),search:n.slice(t)}:{pathname:n,search:""}}}async function i(t,o){const r={resolved:!1,...o};try{const s=await t(o.url);return e.safeParse(s).success?await n.with(JSON.stringify(s),null,n=>{const t=n.originalPositionFor({line:o.line,column:Math.max(0,o.column-1)});if(null===t.source||null===t.line)return r;const e=n.sourceContentFor(t.source,!0),s={...r,resolved:!0,source:t.source,originalLine:t.line};return null!==t.column&&(s.originalColumn=t.column),null!==t.name&&(s.name=t.name),e&&(s.snippet=function(n,t){const e=n.split("\n"),o=Math.max(1,t-3),r=Math.min(e.length,t+3),s=[];for(let n=o;n<=r;n++)s.push({line:n,code:e[n-1]??"",highlight:n===t});return s}(e,t.line)),s}):r}catch{return r}}async function u(n,t){const e=a(t),o=[];for(const t of e)o.push(await i(n,t));return o}async function l(n,t){const e=o.safeParse(t);if(!e.success)return t;const r=e.data,s=r.payload;if(!s)return t;const a=[];var c;return"Error"===r.type&&"string"==typeof r.name&&"number"==typeof s.line&&"number"==typeof s.column?a.push(await i(n,{url:r.name,line:s.line,column:s.column})):"string"==typeof s.extra&&(c=s.extra,/(^|\n)\s*at .+:\d+:\d+/.test(c)||/@.+:\d+:\d+/.test(c))?a.push(...await u(n,s.extra)):"React"!==r.type&&"Vue"!==r.type||"string"!=typeof s.stack||a.push(...await u(n,s.stack)),0===a.length?t:{...r,sourcemap:{frames:a}}}async function p(n,t){if(!Array.isArray(t))return t;const e=[];for(const o of t)e.push(await l(n,o));return e}export{p as enrichReportData,a as parseStack,i as resolveFrame,u as resolveStack,c as splitScriptUrl};
@@ -0,0 +1 @@
1
+ "use strict";var r=require("./sourcemap.cjs");exports.parseStack=r.parseStack,exports.enrichReportData=async function(t,e){return r.enrichReportData(function(t){return async e=>{const{pathname:a,search:n}=r.splitScriptUrl(e),s=await t.moduleGraph.getModuleByUrl(a+n)??await t.moduleGraph.getModuleByUrl(a);return s?.transformResult?.map??null}}(t),e)};
@@ -0,0 +1 @@
1
+ import{enrichReportData as r,splitScriptUrl as a}from"./sourcemap.js";export{parseStack}from"./sourcemap.js";async function e(e,t){return r(function(r){return async e=>{const{pathname:t,search:o}=a(e),n=await r.moduleGraph.getModuleByUrl(t+o)??await r.moduleGraph.getModuleByUrl(t);return n?.transformResult?.map??null}}(e),t)}export{e as enrichReportData};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("./sourcemap.cjs");function r(e){return e.replace(/\\/g,"/").replace(/^\/+/,"")}exports.enrichReportData=e.enrichReportData,exports.parseStack=e.parseStack,exports.resolveFrame=e.resolveFrame,exports.resolveStack=e.resolveStack,exports.createAssetMapStore=function(){const t=new Map;return{put:(e,a)=>{const s=r(e);s.endsWith(".map")&&t.set(s,a)},loadMap:async a=>{const{pathname:s}=e.splitScriptUrl(a),o=r(s);if(!o)return null;let p=t.get(`${o}.map`);if(void 0===p){const e=`${o.split("/").pop()}.map`;for(const[r,a]of t)if(r===e||r.endsWith(`/${e}`)){p=a;break}}if(void 0===p)return null;try{return JSON.parse(p)}catch{return null}}}};