@swifty.js/sentry 0.0.5 → 0.0.6

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 (123) hide show
  1. package/README.md +108 -110
  2. package/dist/constants/index.cjs +1 -1
  3. package/dist/constants/index.js +1 -1
  4. package/dist/core/api.cjs +1 -1
  5. package/dist/core/api.d.ts +28 -9
  6. package/dist/core/api.js +1 -1
  7. package/dist/core/breadcrumb.cjs +1 -1
  8. package/dist/core/breadcrumb.js +1 -1
  9. package/dist/core/decorate-http.cjs +1 -1
  10. package/dist/core/decorate-http.js +1 -1
  11. package/dist/core/decorate-route.cjs +1 -1
  12. package/dist/core/decorate-route.js +1 -1
  13. package/dist/core/decorates.cjs +1 -1
  14. package/dist/core/decorates.js +1 -1
  15. package/dist/core/error-dedup.cjs +1 -0
  16. package/dist/core/error-dedup.js +1 -0
  17. package/dist/core/framework-error.cjs +1 -1
  18. package/dist/core/framework-error.js +1 -1
  19. package/dist/core/handle-code-error.cjs +1 -1
  20. package/dist/core/handle-code-error.js +1 -1
  21. package/dist/core/handle-error.cjs +1 -1
  22. package/dist/core/handle-error.js +1 -1
  23. package/dist/core/handle-events.cjs +1 -1
  24. package/dist/core/handle-events.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/options-schema.cjs +1 -1
  28. package/dist/core/options-schema.d.ts +42 -44
  29. package/dist/core/options-schema.js +1 -1
  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.js +1 -1
  34. package/dist/core/setup.cjs +1 -1
  35. package/dist/core/setup.js +1 -1
  36. package/dist/core/white-screen.cjs +1 -1
  37. package/dist/core/white-screen.js +1 -1
  38. package/dist/index.cjs +1 -1
  39. package/dist/index.d.ts +4 -5
  40. package/dist/index.js +1 -1
  41. package/dist/node/dev-endpoint.cjs +1 -0
  42. package/dist/node/dev-endpoint.js +1 -0
  43. package/dist/package.json.cjs +1 -1
  44. package/dist/package.json.js +1 -1
  45. package/dist/plugins/exposure/index.cjs +1 -1
  46. package/dist/plugins/exposure/index.d.ts +0 -1
  47. package/dist/plugins/exposure/index.js +1 -1
  48. package/dist/plugins/performance/first-screen-paint.cjs +1 -1
  49. package/dist/plugins/performance/first-screen-paint.js +1 -1
  50. package/dist/plugins/performance/index.cjs +1 -1
  51. package/dist/plugins/performance/index.d.ts +0 -1
  52. package/dist/plugins/performance/index.js +1 -1
  53. package/dist/plugins/performance/navigation-timing.cjs +1 -1
  54. package/dist/plugins/performance/navigation-timing.js +1 -1
  55. package/dist/plugins/performance/perf.cjs +1 -1
  56. package/dist/plugins/performance/perf.js +1 -1
  57. package/dist/plugins/performance/resource-element-fallback.cjs +1 -1
  58. package/dist/plugins/performance/resource-element-fallback.js +1 -1
  59. package/dist/plugins/performance/resource-timing.cjs +1 -1
  60. package/dist/plugins/performance/resource-timing.js +1 -1
  61. package/dist/plugins/screen-record/index.cjs +1 -1
  62. package/dist/plugins/screen-record/index.js +1 -1
  63. package/dist/plugins/screen-record/recorder.cjs +1 -1
  64. package/dist/plugins/screen-record/recorder.d.ts +1 -1
  65. package/dist/plugins/screen-record/recorder.js +1 -1
  66. package/dist/react.d.ts +6 -80
  67. package/dist/reporter/index.cjs +1 -1
  68. package/dist/reporter/index.js +1 -1
  69. package/dist/reporter/network-listener.cjs +1 -1
  70. package/dist/reporter/network-listener.js +1 -1
  71. package/dist/reporter/offline-cache.cjs +1 -1
  72. package/dist/reporter/offline-cache.js +1 -1
  73. package/dist/reporter/report-data-schema.cjs +1 -1
  74. package/dist/reporter/report-data-schema.js +1 -1
  75. package/dist/reporter/report-data.cjs +1 -1
  76. package/dist/reporter/report-data.js +1 -1
  77. package/dist/reporter/server-recovery.cjs +1 -1
  78. package/dist/reporter/server-recovery.js +1 -1
  79. package/dist/reporter/transports.cjs +1 -1
  80. package/dist/reporter/transports.js +1 -1
  81. package/dist/source-map/source-map.cjs +1 -1
  82. package/dist/source-map/source-map.js +1 -1
  83. package/dist/types/common.d.ts +9 -10
  84. package/dist/types/enums.cjs +1 -1
  85. package/dist/types/enums.d.ts +1 -43
  86. package/dist/types/enums.js +1 -1
  87. package/dist/types/options.d.ts +9 -13
  88. package/dist/types/plugin.cjs +1 -1
  89. package/dist/types/plugin.d.ts +0 -3
  90. package/dist/types/plugin.js +1 -1
  91. package/dist/utils/data-structures.cjs +1 -1
  92. package/dist/utils/data-structures.js +1 -1
  93. package/dist/utils/get-base-data.cjs +1 -1
  94. package/dist/utils/get-base-data.js +1 -1
  95. package/dist/utils/logger.cjs +1 -1
  96. package/dist/utils/logger.js +1 -1
  97. package/dist/utils/noop.cjs +1 -0
  98. package/dist/utils/noop.js +1 -0
  99. package/dist/utils/sentry.cjs +1 -1
  100. package/dist/utils/sentry.js +1 -1
  101. package/dist/utils/session.cjs +1 -1
  102. package/dist/utils/session.js +1 -1
  103. package/dist/utils/throttle.cjs +1 -1
  104. package/dist/utils/throttle.js +1 -1
  105. package/dist/utils/transform-http-data.cjs +1 -1
  106. package/dist/utils/transform-http-data.js +1 -1
  107. package/dist/utils/uuid.cjs +1 -0
  108. package/dist/utils/uuid.js +1 -0
  109. package/dist/vite.cjs +1 -1
  110. package/dist/vite.d.ts +2 -2
  111. package/dist/vite.js +1 -1
  112. package/dist/vue.cjs +1 -1
  113. package/dist/vue.js +1 -1
  114. package/dist/webpack.cjs +1 -1
  115. package/dist/webpack.js +1 -1
  116. package/package.json +2 -5
  117. package/dist/core/ip.cjs +0 -1
  118. package/dist/core/ip.d.ts +0 -24
  119. package/dist/core/ip.js +0 -1
  120. package/dist/reporter/batch.cjs +0 -1
  121. package/dist/reporter/batch.js +0 -1
  122. package/dist/utils/base64.cjs +0 -1
  123. package/dist/utils/base64.js +0 -1
@@ -1 +1 @@
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,d 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{noop as o}from"../../utils/noop.js";import"../../utils/logger.js";import{supportsPerformanceEntryType as i}from"./performance-observer-support.js";const s=new Set(["fetch","xmlhttprequest","beacon"]);function a(e){return"resource"===e.entryType&&"initiatorType"in e}function u(e){return""!==n.options.dsn&&e.includes(n.options.dsn)}function c(e){return!s.has(e.initiatorType)&&!u(e.name)}function p(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 m(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.encodedBodySize}function d(){return"performance"in globalThis&&"function"==typeof globalThis.performance.getEntriesByType?globalThis.performance.getEntriesByType("resource").filter(a).filter(c).map(p):[]}function y(){return{...t(),name:"ResourceList",type:r.Performance,status:e.OK,resourceList:d()}}function l(e){if(!i("resource"))return o;const r=new globalThis.PerformanceObserver(r=>{r.getEntries().filter(a).filter(c).map(p).forEach(r=>{e(m(r))})});return r.observe({entryTypes:["resource"]}),()=>{r.disconnect()}}export{m as createResourceTimingData,y as getInitialResourceListData,d as getResourceList,u as isSdkReportUrl,l 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");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
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("../../types/enums.cjs");var e=require("../../types/plugin.cjs"),r=require("../../constants/index.cjs"),s=require("../../utils/sentry.cjs");require("../../utils/is-type.cjs"),require("../../utils/logger.cjs");var t=require("../../reporter/index.cjs"),n=require("./recorder.cjs");class i extends e.SentryPlugin{durationMs;eventTypes;cleanup=null;constructor(e={}){super(),this.durationMs=e.durationMs??r.DEFAULT_OPTIONS.screenRecordDurationMs,this.eventTypes=[...e.eventTypes??r.DEFAULT_OPTIONS.screenRecordEventTypes]}init(){s.default.setOptions({screenRecordEventTypes:[...this.eventTypes],screenRecordDurationMs:this.durationMs}),n.recorder(t.default).then(e=>{this.cleanup=e})}destroy(){this.cleanup?.(),this.cleanup=null}}exports.unzipScreenRecord=n.unzipScreenRecord,exports.default=i;
@@ -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 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
+ import"../../types/enums.js";import{SentryPlugin as e}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"../../utils/logger.js";import r from"../../reporter/index.js";import{recorder as n}from"./recorder.js";export{unzipScreenRecord}from"./recorder.js";class o extends e{durationMs;eventTypes;cleanup=null;constructor(e={}){super(),this.durationMs=e.durationMs??s.screenRecordDurationMs,this.eventTypes=[...e.eventTypes??s.screenRecordEventTypes]}init(){t.setOptions({screenRecordEventTypes:[...this.eventTypes],screenRecordDurationMs:this.durationMs}),n(r).then(e=>{this.cleanup=e})}destroy(){this.cleanup?.(),this.cleanup=null}}export{o 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");require("../../utils/is-type.cjs");var n=require("../../utils/logger.cjs"),o=require("zod");let s=null;const c=o.z.looseObject({timestamp:o.z.number()});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)};
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/noop.cjs"),o=require("../../utils/logger.cjs"),s=require("zod");let c=null;const i=s.z.looseObject({timestamp:s.z.number()});function u(e){if(!e||!c)return"";const r=JSON.stringify(e);return function(e){let r="";for(let t=0;t<e.length;t+=32768)r+=String.fromCharCode(...e.subarray(t,t+32768));return btoa(r)}(c.gzip(r))}exports.recorder=async function(s){o.sentryLogger.info("Initializing web recorder...");try{const[{record:a},d]=await Promise.all([import("@rrweb/record"),import("pako")]);c=d.default;const l=[],p=e=>{const r=e-t.default.options.screenRecordDurationMs;for(;l.length>0&&l[0].timestamp<r;)l.shift()},f=a({emit(n){const c=i.safeParse(n);if(c.success&&(l.push(c.data),p(c.data.timestamp),t.default.shouldScreenRecord&&l.length>0)){const n={...r.default(),name:"ScreenRecord",type:e.EventType.ScreenRecord,event:u(l),eventCount:l.length};o.sentryLogger.success("Screen record window packaged and sent",{eventCount:n.eventCount}),s.send(n),t.default.shouldScreenRecord=!1}},recordCanvas:!0,checkoutEveryNms:t.default.options.screenRecordDurationMs});return"function"==typeof f?f:n.noop}catch(e){return o.sentryLogger.error("Failed to load web recorder",e),n.noop}},exports.unzipScreenRecord=async function(e){if(!e)return null;const r=(c??(await(import("pako"))).default).ungzip(function(e){const r=atob(e);return Uint8Array.from(r,e=>e.charCodeAt(0))}(e),{to:"string"});return JSON.parse(r)};
@@ -20,6 +20,6 @@
20
20
  * SOFTWARE.
21
21
  */
22
22
 
23
- declare function unzipScreenRecord(data: string): unknown;
23
+ declare function unzipScreenRecord(data: string): Promise<unknown>;
24
24
 
25
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"../../utils/is-type.js";import{sentryLogger as n}from"../../utils/logger.js";import{z as o}from"zod";let s=null;const i=o.looseObject({timestamp:o.number()});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 f=[];const p=u({emit(s,c){const u=i.safeParse(s);if(u.success&&(f=a([...f,u.data],u.data.timestamp),c&&(f=a(f,u.data.timestamp)),r.shouldScreenRecord&&f.length>0)){const s={...e(),name:"ScreenRecord",type:t.ScreenRecord,event:m(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: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};
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{noop as o}from"../../utils/noop.js";import{sentryLogger as n}from"../../utils/logger.js";import{z as s}from"zod";let i=null;const c=s.looseObject({timestamp:s.number()});async function a(s){n.info("Initializing web recorder...");try{const[{record:a},m]=await Promise.all([import("@rrweb/record"),import("pako")]);i=m.default;const d=[],p=t=>{const e=t-r.options.screenRecordDurationMs;for(;d.length>0&&d[0].timestamp<e;)d.shift()},l=a({emit(o){const i=c.safeParse(o);if(i.success&&(d.push(i.data),p(i.data.timestamp),r.shouldScreenRecord&&d.length>0)){const o={...e(),name:"ScreenRecord",type:t.ScreenRecord,event:u(d),eventCount:d.length};n.success("Screen record window packaged and sent",{eventCount:o.eventCount}),s.send(o),r.shouldScreenRecord=!1}},recordCanvas:!0,checkoutEveryNms:r.options.screenRecordDurationMs});return"function"==typeof l?l:o}catch(t){return n.error("Failed to load web recorder",t),o}}function u(t){if(!t||!i)return"";const e=JSON.stringify(t);return function(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return btoa(e)}(i.gzip(e))}async function m(t){if(!t)return null;const e=(i??(await(import("pako"))).default).ungzip(function(t){const e=atob(t);return Uint8Array.from(e,t=>t.charCodeAt(0))}(t),{to:"string"});return JSON.parse(e)}export{a as recorder,m as unzipScreenRecord};
package/dist/react.d.ts CHANGED
@@ -22,102 +22,28 @@ import { Component, ReactNode, ErrorInfo } from 'react';
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- /**
26
- * Props for the {@link ReactErrorBoundary} 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
25
  interface ReactErrorBoundaryProps {
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
26
  readonly children?: ReactNode;
38
27
  /**
39
- * The UI to display when a descendant throws.
40
- *
41
- * Can be a static `ReactNode` (no access to the error) or a render function
42
- * that receives the caught error and React's component-stack info.
43
- *
44
- * @remarks
45
- * The render function may be invoked twice during an error cycle:
46
- * 1. First, right after `getDerivedStateFromError` runs in the render
47
- * phase — at this point `errorInfo` is still `undefined` because React
48
- * only delivers {@link ErrorInfo} in `componentDidCatch` (commit phase).
49
- * 2. Again after `componentDidCatch` merges `errorInfo` into state.
50
- *
51
- * Therefore `errorInfo` is typed as optional. Guard against `undefined` if
52
- * your fallback relies on `componentStack`.
53
- *
54
- * @param error - The Error thrown by the descendant component. Always
55
- * defined when the fallback is invoked, because the boundary only enters
56
- * the error state when an Error is present.
57
- * @param errorInfo - React's {@link ErrorInfo}, containing `componentStack`.
58
- * `undefined` on the first render after the error is caught.
59
- * @returns The fallback React subtree to render.
28
+ * Error UI. A render function may be called once with `errorInfo`
29
+ * undefined (the fallback renders from `getDerivedStateFromError` before
30
+ * React delivers `ErrorInfo` in `componentDidCatch`) and again once it is
31
+ * available.
60
32
  */
61
33
  readonly fallback?: ReactNode | ((error: Error, errorInfo?: ErrorInfo) => ReactNode);
62
34
  }
63
- /** Internal state tracking the caught error and React component-stack info. */
64
35
  interface ReactErrorBoundaryState {
65
36
  readonly error?: Error;
66
37
  readonly errorInfo?: ErrorInfo;
67
38
  }
68
39
  /**
69
- * A React Error Boundary that reports caught errors to the Sentry SDK.
70
- *
71
- * @example
72
- * ```tsx
73
- * <ReactErrorBoundary fallback={<div>Something went wrong</div>}>
74
- * <Page />
75
- * </ReactErrorBoundary>
76
- * ```
40
+ * React Error Boundary that renders `fallback` and reports the caught error
41
+ * to the SDK as an `EventType.React` event.
77
42
  */
78
43
  declare class ReactErrorBoundary extends Component<ReactErrorBoundaryProps, ReactErrorBoundaryState> {
79
44
  static displayName: string;
80
45
  state: ReactErrorBoundaryState;
81
- /**
82
- * Called by React during the **render phase** when a descendant throws.
83
- *
84
- * This is a pure static method — it must not access `this` or cause side
85
- * effects. Its sole responsibility is to return the next state so React can
86
- * immediately re-render the boundary and show the fallback UI without
87
- * waiting for the commit phase.
88
- *
89
- * Only `error` is available here; React does not deliver {@link ErrorInfo}
90
- * until {@link componentDidCatch} runs (commit phase), so `errorInfo` is
91
- * left `undefined` at this point.
92
- *
93
- * This method is **not redundant** with {@link componentDidCatch}. It
94
- * triggers the fallback render synchronously in the render phase; without
95
- * it the fallback would not appear until after commit.
96
- *
97
- * @param error - The Error thrown by the descendant component.
98
- * @returns The next state, setting `error` so the boundary renders the
99
- * fallback.
100
- */
101
46
  static getDerivedStateFromError(error: Error): ReactErrorBoundaryState;
102
- /**
103
- * Called by React during the **commit phase** (after the DOM has been
104
- * updated) when a descendant throws.
105
- *
106
- * This is where side effects belong. It performs two duties:
107
- * 1. Merges `errorInfo` (React's component-stack trace) into state so the
108
- * fallback render function can access it. `error` is also set again —
109
- * it is already present from
110
- * {@link getDerivedStateFromError | getDerivedStateFromError} but is
111
- * included for a single atomic state update.
112
- * 2. Reports the error to the Sentry SDK as a `React` event via
113
- * {@link reportFrameworkError}.
114
- *
115
- * @param error - The Error thrown by the descendant component.
116
- * @param errorInfo - React's {@link ErrorInfo}, containing `componentStack`:
117
- * a string describing the component tree from the throwing component up to
118
- * this boundary. Useful for locating where in the component hierarchy the
119
- * error originated.
120
- */
121
47
  componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
122
48
  render(): ReactNode;
123
49
  }
@@ -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");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
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/uuid.cjs"),t=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var s=require("../utils/logger.cjs"),i=require("./flush-scheduler.cjs"),r=require("./network-listener.cjs"),h=require("./offline-cache.cjs"),n=require("./promise.cjs"),u=require("./report-data.cjs"),o=require("./send-preflight.cjs"),l=require("./server-recovery.cjs"),a=require("./transports.cjs");class c{id=e.generateUUID();events=[];timeoutID;retryTimer;isOnline=!0;isFlushing=!1;hasPersistedCache=!1;removeNetworkListener;constructor(){this.removeNetworkListener=r.initNetworkListener({setOnline:e=>{this.isOnline=e},flush:()=>this.flush()}),this.loadOfflineCache()}dispose(){this.timeoutID&&clearTimeout(this.timeoutID),this.retryTimer&&clearTimeout(this.retryTimer),this.removeNetworkListener(),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),this.hasPersistedCache=!0}clearPersistedCache(){this.hasPersistedCache&&(h.clearOfflineCache(),this.hasPersistedCache=!1)}handleServerError(){this.retryTimer=l.scheduleServerRecovery(this.retryTimer,{setOnline:e=>{this.isOnline=e},setRetryTimer:e=>{this.retryTimer=e},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=n.isPromise(e)?await e:e;if(0===i.length)return void this.scheduleNextFlush();const r=performance.now(),h=this.sendBatch(i);if(!(n.isPromise(h)?await h:h))return this.events=[...i,...this.events].slice(-t.default.options.maxQueueLength),void this.saveOfflineCache();this.clearPersistedCache(),t.default.options.afterSend?.(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),u.applyBeforePushHook(s)}sendBatch(e){const t=JSON.stringify(e),s=a.getBodyByteLength(t)<=a.MAX_KEEPALIVE_BYTES;return!(!s||!a.sendBeacon(t))||a.reportByFetch(t,s,()=>this.handleServerError())}scheduleNextFlush(){0!==this.events.length&&(this.timeoutID=i.scheduleFlush(this.timeoutID,100,()=>this.flush()))}async flushOfflineCache(){this.loadOfflineCache(),await this.flush()}async send(e,r=!1){const h=t.default.options;if(!o.shouldQueuePayload(e))return;const l=u.runBeforeReportHook(this.id,e),a=n.isPromise(l)?await l:l;if(a){if(s.sentryLogger.info(`Type: ${e.type}`,a),this.events.push(a),!this.isOnline)return this.events=this.events.slice(-h.maxQueueLength),void this.saveOfflineCache();this.timeoutID&&clearTimeout(this.timeoutID),r||this.events.length>=h.cacheMaxLength?await this.flush():this.timeoutID=i.scheduleFlush(this.timeoutID,h.cacheWaitingTime,()=>this.flush())}}}let f=null;var d=new Proxy({},{get(e,t){f??=new c;const s=Reflect.get(f,t,f);return"function"==typeof s?s.bind(f):s}});exports.DataReporter=c,exports.default=d,exports.resetReporter=function(){f?.dispose(),f=null};
@@ -1 +1 @@
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
+ import"../constants/index.js";import"../types/enums.js";import{generateUUID as e}from"../utils/uuid.js";import t from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as s}from"../utils/logger.js";import{scheduleFlush as i}from"./flush-scheduler.js";import{initNetworkListener as h}from"./network-listener.js";import{loadOfflineCache as n,saveOfflineCache as r,clearOfflineCache as o}from"./offline-cache.js";import{isPromise as l}from"./promise.js";import{applyBeforePushHook as a,runBeforeReportHook as u}from"./report-data.js";import{shouldQueuePayload as c}from"./send-preflight.js";import{scheduleServerRecovery as f}from"./server-recovery.js";import{getBodyByteLength as m,MAX_KEEPALIVE_BYTES as p,sendBeacon as d,reportByFetch as v}from"./transports.js";class g{id=e();events=[];timeoutID;retryTimer;isOnline=!0;isFlushing=!1;hasPersistedCache=!1;removeNetworkListener;constructor(){this.removeNetworkListener=h({setOnline:e=>{this.isOnline=e},flush:()=>this.flush()}),this.loadOfflineCache()}dispose(){this.timeoutID&&clearTimeout(this.timeoutID),this.retryTimer&&clearTimeout(this.retryTimer),this.removeNetworkListener(),this.events=[],this.isFlushing=!1}loadOfflineCache(){this.events.unshift(...n()),this.events=this.events.slice(-t.options.maxQueueLength)}saveOfflineCache(){r(this.events),this.hasPersistedCache=!0}clearPersistedCache(){this.hasPersistedCache&&(o(),this.hasPersistedCache=!1)}handleServerError(){this.retryTimer=f(this.retryTimer,{setOnline:e=>{this.isOnline=e},setRetryTimer:e=>{this.retryTimer=e},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.options.maxQueueLength),void this.saveOfflineCache();const e=this.takeBatch(),i=l(e)?await e:e;if(0===i.length)return void this.scheduleNextFlush();const h=performance.now(),n=this.sendBatch(i);if(!(l(n)?await n:n))return this.events=[...i,...this.events].slice(-t.options.maxQueueLength),void this.saveOfflineCache();this.clearPersistedCache(),t.options.afterSend?.(i),s.success("Batch report queued or sent",{count:i.length},Math.round(performance.now()-h))}finally{this.isFlushing=!1}this.scheduleNextFlush()}}takeBatch(){const e=t.options.cacheMaxLength,s=this.events.slice(0,e);return this.events=this.events.slice(e),a(s)}sendBatch(e){const t=JSON.stringify(e),s=m(t)<=p;return!(!s||!d(t))||v(t,s,()=>this.handleServerError())}scheduleNextFlush(){0!==this.events.length&&(this.timeoutID=i(this.timeoutID,100,()=>this.flush()))}async flushOfflineCache(){this.loadOfflineCache(),await this.flush()}async send(e,h=!1){const n=t.options;if(!c(e))return;const r=u(this.id,e),o=l(r)?await r:r;if(o){if(s.info(`Type: ${e.type}`,o),this.events.push(o),!this.isOnline)return this.events=this.events.slice(-n.maxQueueLength),void this.saveOfflineCache();this.timeoutID&&clearTimeout(this.timeoutID),h||this.events.length>=n.cacheMaxLength?await this.flush():this.timeoutID=i(this.timeoutID,n.cacheWaitingTime,()=>this.flush())}}}let y=null;function O(){y?.dispose(),y=null}var j=new Proxy({},{get(e,t){y??=new g;const s=Reflect.get(y,t,y);return"function"==typeof s?s.bind(y):s}});export{g as DataReporter,j as default,O as resetReporter};
@@ -1 +1 @@
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
+ "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);const i=()=>{n.setOnline(!0),e.sentryLogger.info("Network is back online, flushing cache"),n.flush()},s=()=>{n.setOnline(!1),e.sentryLogger.info("Network is offline, caching events")};return globalThis.addEventListener("online",i),globalThis.addEventListener("offline",s),()=>{globalThis.removeEventListener("online",i),globalThis.removeEventListener("offline",s)}};
@@ -1 +1 @@
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
+ import"../constants/index.js";import"../types/enums.js";import"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as e}from"../utils/logger.js";function n(n){n.setOnline(!1!==navigator.onLine);const i=()=>{n.setOnline(!0),e.info("Network is back online, flushing cache"),n.flush()},t=()=>{n.setOnline(!1),e.info("Network is offline, caching events")};return globalThis.addEventListener("online",i),globalThis.addEventListener("offline",t),()=>{globalThis.removeEventListener("online",i),globalThis.removeEventListener("offline",t)}}export{n as initNetworkListener};
@@ -1 +1 @@
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
+ "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.clearOfflineCache=function(){try{localStorage.removeItem(e.default.options.offlineCacheKey)}catch{t.sentryLogger.error("Failed to clear offline cache")}},exports.loadOfflineCache=function(){try{const t=localStorage.getItem(e.default.options.offlineCacheKey);if(!t)return[];const a=JSON.parse(t),o=r.reportDataListSchema.safeParse(a);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(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"../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
+ import"../constants/index.js";import"../types/enums.js";import e from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as o}from"../utils/logger.js";import{reportDataListSchema as t}from"./report-data-schema.js";function r(){try{const o=localStorage.getItem(e.options.offlineCacheKey);if(!o)return[];const r=JSON.parse(o),s=t.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(t){try{localStorage.setItem(e.options.offlineCacheKey,JSON.stringify(t.slice(-e.options.maxQueueLength)))}catch{o.error("Failed to save offline cache")}}function a(){try{localStorage.removeItem(e.options.offlineCacheKey)}catch{o.error("Failed to clear offline cache")}}export{a as clearOfflineCache,r as loadOfflineCache,s 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.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(),breadcrumbs:e.z.array(e.z.custom(e=>"object"==typeof e&&null!==e,"Expected a breadcrumb item object")).optional(),deviceInfo:r,payload:e.z.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),n=e.z.array(s);exports.reportDataListSchema=n;
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(),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(),anonymousId:e.z.string(),visitorId:e.z.string(),projectId:e.z.string(),sdkVersion:e.z.string(),breadcrumbs:e.z.array(e.z.custom(e=>"object"==typeof e&&null!==e,"Expected a breadcrumb item object")).optional(),deviceInfo:r,payload:e.z.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),n=e.z.array(s);exports.reportDataListSchema=n;
@@ -1 +1 @@
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(),breadcrumbs:e.array(e.custom(e=>"object"==typeof e&&null!==e,"Expected a breadcrumb item object")).optional(),deviceInfo:s,payload:e.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),i=e.array(n);export{i as reportDataListSchema};
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(),language:e.string(),screenResolution:e.string()}),n=e.object({id:e.string(),type:e.enum(r),name:e.string(),time:e.string(),timestamp:e.number(),message:e.string(),status:e.enum(t),url:e.string(),userId:e.string(),anonymousId:e.string(),visitorId:e.string(),projectId:e.string(),sdkVersion:e.string(),breadcrumbs:e.array(e.custom(e=>"object"==typeof e&&null!==e,"Expected a breadcrumb item object")).optional(),deviceInfo:s,payload:e.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),o=e.array(n);export{o as reportDataListSchema};
@@ -1 +1 @@
1
- "use strict";var e=require("../constants/index.cjs"),t=require("../core/breadcrumb.cjs"),r=require("../types/enums.cjs"),s=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var n=require("./promise.cjs");const o=new Set([r.EventType.Error,r.EventType.UnhandledRejection,r.EventType.Resource,r.EventType.Vue,r.EventType.React,r.EventType.OtherFrameworks]);function u(e){return!1===e?null:e}exports.runBeforeReportHook=function(r,i){const a=function(r,n){const{type:u,name:i,time:a,timestamp:c,message:p,status:d}=n,m={type:u,name:i,time:a,timestamp:c,message:p,status:d,id:r,url:location.href,userId:s.default.options.userId,projectId:s.default.options.projectId,sdkVersion:e.SDK_VERSION,deviceInfo:s.default.deviceInfo,payload:n};return o.has(u)&&(m.breadcrumbs=t.default.dump()),m}(r,i);if(!s.default.options.onBeforeReportData)return a;const c=s.default.options.onBeforeReportData(a);return n.isPromise(c)?c.then(u):u(c)};
1
+ "use strict";var e=require("../constants/index.cjs"),t=require("../core/breadcrumb.cjs"),r=require("../types/enums.cjs"),o=require("../utils/sentry.cjs");require("../utils/is-type.cjs"),require("../utils/logger.cjs");var n=require("./promise.cjs");const s=new Set([r.EventType.Error,r.EventType.UnhandledRejection,r.EventType.Resource,r.EventType.Vue,r.EventType.React,r.EventType.OtherFrameworks]);function u(e){return!1===e?null:e}function i(e){return!1===e?[]:[...e]}exports.applyBeforePushHook=function(e){const t=o.default.options.beforeSendBatch?o.default.options.beforeSendBatch(e):e;return n.isPromise(t)?t.then(i):i(t)},exports.runBeforeReportHook=function(r,i){const a=function(r,n){const{type:u,name:i,time:a,timestamp:d,message:c,status:p}=n,f={type:u,name:i,time:a,timestamp:d,message:c,status:p,id:r,url:location.href,userId:o.default.options.userId,anonymousId:o.default.options.anonymousId,visitorId:o.default.options.visitorId,projectId:o.default.options.projectId,sdkVersion:e.SDK_VERSION,deviceInfo:o.default.deviceInfo,payload:n};return s.has(u)&&(f.breadcrumbs=t.default.dump()),f}(r,i);if(!o.default.options.beforeSend)return a;const d=o.default.options.beforeSend(a);return n.isPromise(d)?d.then(u):u(d)};
@@ -1 +1 @@
1
- import{SDK_VERSION as e}from"../constants/index.js";import t from"../core/breadcrumb.js";import{EventType as o}from"../types/enums.js";import r from"../utils/sentry.js";import"../utils/is-type.js";import{isPromise as s}from"./promise.js";const n=new Set([o.Error,o.UnhandledRejection,o.Resource,o.Vue,o.React,o.OtherFrameworks]);function i(o,i){const p=function(o,s){const{type:i,name:m,time:p,timestamp:a,message:u,status:c}=s,d={type:i,name:m,time:p,timestamp:a,message:u,status:c,id:o,url:location.href,userId:r.options.userId,projectId:r.options.projectId,sdkVersion:e,deviceInfo:r.deviceInfo,payload:s};return n.has(i)&&(d.breadcrumbs=t.dump()),d}(o,i);if(!r.options.onBeforeReportData)return p;const a=r.options.onBeforeReportData(p);return s(a)?a.then(m):m(a)}function m(e){return!1===e?null:e}export{i as runBeforeReportHook};
1
+ import{SDK_VERSION as o}from"../constants/index.js";import t from"../core/breadcrumb.js";import{EventType as e}from"../types/enums.js";import n from"../utils/sentry.js";import"../utils/is-type.js";import"../utils/logger.js";import{isPromise as r}from"./promise.js";const s=new Set([e.Error,e.UnhandledRejection,e.Resource,e.Vue,e.React,e.OtherFrameworks]);function i(e,i){const u=function(e,r){const{type:i,name:m,time:u,timestamp:p,message:c,status:d}=r,a={type:i,name:m,time:u,timestamp:p,message:c,status:d,id:e,url:location.href,userId:n.options.userId,anonymousId:n.options.anonymousId,visitorId:n.options.visitorId,projectId:n.options.projectId,sdkVersion:o,deviceInfo:n.deviceInfo,payload:r};return s.has(i)&&(a.breadcrumbs=t.dump()),a}(e,i);if(!n.options.beforeSend)return u;const p=n.options.beforeSend(u);return r(p)?p.then(m):m(p)}function m(o){return!1===o?null:o}function u(o){const t=n.options.beforeSendBatch?n.options.beforeSendBatch(o):o;return r(t)?t.then(p):p(t)}function p(o){return!1===o?[]:[...o]}export{u as applyBeforePushHook,i as runBeforeReportHook};
@@ -1 +1 @@
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
+ "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 u=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.flush()):s(void 0,t)}).catch(()=>{s(void 0,t)})}(n)},e.default.options.retryIntervalMilliseconds);return t.unrefTimer(u),n.setRetryTimer(u),u}exports.scheduleServerRecovery=s;
@@ -1 +1 @@
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
+ 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 s(o,n){n.setOnline(!1),o&&clearTimeout(o);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.flush()):s(void 0,i)}).catch(()=>{s(void 0,i)})}(n)},t.options.retryIntervalMilliseconds);return i(r),n.setRetryTimer(r),r}export{s as scheduleServerRecovery};
@@ -1 +1 @@
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
+ "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.MAX_KEEPALIVE_BYTES=61440,exports.getBodyByteLength=function(e){return(new TextEncoder).encode(e).byteLength},exports.reportByFetch=async function(n,r,o){try{const t=await fetch(e.default.options.dsn,{method:"POST",body:n,headers:{"Content-Type":"application/json"},keepalive:r});return t.ok||o(),t.ok}catch(e){return t.sentryLogger.error("Fetch report failed",e),o(),!1}},exports.sendBeacon=function(t){return!("undefined"==typeof navigator||!navigator.sendBeacon)&&navigator.sendBeacon(e.default.options.dsn,t)};
@@ -1 +1 @@
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};
1
+ import"../constants/index.js";import"../types/enums.js";import t from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as n}from"../utils/logger.js";const e=61440;function o(t){return(new TextEncoder).encode(t).byteLength}function r(n){return!("undefined"==typeof navigator||!navigator.sendBeacon)&&navigator.sendBeacon(t.options.dsn,n)}async function s(e,o,r){try{const n=await fetch(t.options.dsn,{method:"POST",body:e,headers:{"Content-Type":"application/json"},keepalive:o});return n.ok||r(),n.ok}catch(t){return n.error("Fetch report failed",t),r(),!1}}export{e as MAX_KEEPALIVE_BYTES,o as getBodyByteLength,s as reportByFetch,r as sendBeacon};
@@ -1 +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:""}}};
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()}),s=/^\s*at (?:(.+?)\s+)?\(?(\S+?):(\d+):(\d+)\)?\s*$/,o=/^\s*(?:(.*?)@)?(\S+?):(\d+):(\d+)\s*$/;function a(n){const t=[];for(const e of n.split("\n")){if(t.length>=30)break;const n=s.exec(e)??o.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 s={resolved:!1,...r};try{const o=await t(r.url);return e.safeParse(o).success?await n.SourceMapConsumer.with(JSON.stringify(o),null,n=>{const t=n.originalPositionFor({line:r.line,column:Math.max(0,r.column-1)});if(null===t.source||null===t.line)return s;const e=n.sourceContentFor(t.source,!0),o={...s,resolved:!0,source:t.source,originalLine:t.line};return null!==t.column&&(o.originalColumn=t.column),null!==t.name&&(o.name=t.name),e&&(o.snippet=function(n,t){const e=n.split("\n"),r=Math.max(1,t-3),s=Math.min(e.length,t+3),o=[];for(let n=r;n<=s;n++)o.push({line:n,code:e[n-1]??"",highlight:n===t});return o}(e,t.line)),o}):s}catch{return s}}async function i(n,t){const e=a(t),r=[];for(const t of e)r.push(await c(n,t));return r}const u=t.z.looseObject({stack:t.z.string().optional()});async function l(n,t){const e=r.safeParse(t);if(!e.success)return t;const s=e.data,o=s.payload;if(!o)return t;const a=[];if("Error"===s.type&&"string"==typeof s.name&&"number"==typeof o.line&&"number"==typeof o.column)a.push(await c(n,{url:s.name,line:o.line,column:o.column}));else if("string"==typeof o.extra&&(l=o.extra,/(^|\n)\s*at .+:\d+:\d+/.test(l)||/@.+:\d+:\d+/.test(l)))a.push(...await i(n,o.extra));else if("React"===s.type||"Vue"===s.type||"OtherFrameworks"===s.type){const t=function(n){if("string"==typeof n.stack)return n.stack;const t=u.safeParse(n.extra);return t.success&&"string"==typeof t.data.stack?t.data.stack:null}(o);t&&a.push(...await i(n,t))}var l;return 0===a.length?t:{...s,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 l(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:""}}};
@@ -1 +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};
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()}),r=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()}),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}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,r){const o={resolved:!1,...r};try{const s=await t(r.url);return e.safeParse(s).success?await n.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 u(n,t){const e=a(t),r=[];for(const t of e)r.push(await i(n,t));return r}const l=t.looseObject({stack:t.string().optional()});async function p(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=[];if("Error"===o.type&&"string"==typeof o.name&&"number"==typeof s.line&&"number"==typeof s.column)a.push(await i(n,{url:o.name,line:s.line,column:s.column}));else if("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));else if("React"===o.type||"Vue"===o.type||"OtherFrameworks"===o.type){const t=function(n){if("string"==typeof n.stack)return n.stack;const t=l.safeParse(n.extra);return t.success&&"string"==typeof t.data.stack?t.data.stack:null}(s);t&&a.push(...await u(n,t))}var c;return 0===a.length?t:{...o,sourcemap:{frames:a}}}async function f(n,t){if(!Array.isArray(t))return t;const e=[];for(const r of t)e.push(await p(n,r));return e}export{f as enrichReportData,a as parseStack,i as resolveFrame,u as resolveStack,c as splitScriptUrl};
@@ -1,4 +1,4 @@
1
- import { EventType, Status, HttpMethod, BreadcrumbType } from './enums.js';
1
+ import { EventType, Status, BreadcrumbType } from './enums.js';
2
2
  import { Metric } from 'web-vitals';
3
3
  import { IOptions } from './options.js';
4
4
 
@@ -29,7 +29,6 @@ interface ISentry {
29
29
  has(value: string): boolean;
30
30
  add(value: string): void;
31
31
  };
32
- whiteScreenTimer: ReturnType<typeof setInterval> | null;
33
32
  options: IOptions;
34
33
  shouldScreenRecord: boolean;
35
34
  deviceInfo: IDeviceInfo;
@@ -46,7 +45,6 @@ interface IDeviceInfo {
46
45
  userAgent: string;
47
46
  deviceType: string;
48
47
  deviceModel: string;
49
- fingerprint: string;
50
48
  language: string;
51
49
  screenResolution: string;
52
50
  }
@@ -62,7 +60,7 @@ interface IReportPayload {
62
60
  status: Status;
63
61
  }
64
62
  interface IHttpData extends IReportPayload {
65
- method: HttpMethod | string;
63
+ method: string;
66
64
  api: string;
67
65
  elapsedTime: number;
68
66
  statusCode: number;
@@ -106,10 +104,10 @@ type IPerformanceData = IPerformanceMetricData | IPerformanceResourceListData |
106
104
  interface ICodeError extends IReportPayload {
107
105
  line: number;
108
106
  column: number;
107
+ extra?: string;
109
108
  }
110
109
  interface IScreenRecordData extends IReportPayload {
111
110
  event: string;
112
- events?: string;
113
111
  eventCount?: number;
114
112
  }
115
113
  interface IExposureData extends IReportPayload {
@@ -127,7 +125,7 @@ interface IRouteData extends IReportPayload {
127
125
  to: string;
128
126
  }
129
127
  type IBaseDataWithEvent = IReportPayload & {
130
- extra: "WhiteScreen" | unknown;
128
+ extra: unknown;
131
129
  };
132
130
  type TReportPayload = IBaseDataWithEvent | IHttpData | IResourceError | IPerformanceData | ICodeError | IExposureData | IScreenRecordData | IRouteData | IBatchErrorData;
133
131
  interface IBatchErrorData extends IReportPayload {
@@ -135,11 +133,13 @@ interface IBatchErrorData extends IReportPayload {
135
133
  batchErrorLength: number;
136
134
  batchErrorLastHappenTime: number;
137
135
  }
138
- type TOnReportWhiteScreenData = (data: IReportPayload) => void;
136
+ type TOnReportWhiteScreenData = (data: IBaseDataWithEvent) => void;
139
137
  type TOnReportPerformanceData = (data: IPerformanceData) => void;
140
138
  interface IReportData<T extends TReportPayload = TReportPayload> extends IReportPayload {
141
139
  url: string;
142
140
  userId: string;
141
+ anonymousId: string;
142
+ visitorId: string;
143
143
  projectId: string;
144
144
  sdkVersion: string;
145
145
  breadcrumbs?: IBreadcrumbItem[] | undefined;
@@ -147,7 +147,7 @@ interface IReportData<T extends TReportPayload = TReportPayload> extends IReport
147
147
  payload: T;
148
148
  }
149
149
  interface IDataReporter {
150
- send(payload: TReportPayload): Promise<void>;
150
+ send(payload: TReportPayload, immediate?: boolean): Promise<void>;
151
151
  flushOfflineCache(): Promise<void>;
152
152
  }
153
153
  /**
@@ -163,6 +163,5 @@ interface IExtendedErrorEvent extends Event {
163
163
  localName: string;
164
164
  };
165
165
  }
166
- type TUnknownError = IExtendedErrorEvent | Error /** React */ | unknown;
167
166
 
168
- export type { IBaseDataWithEvent, IBatchErrorData, IBreadcrumbItem, ICodeError, IDataReporter, IDeviceInfo, IExposureData, IExtendedErrorEvent, IHttpData, IPerformanceData, IPerformanceResourceTiming, IReportData, IReportPayload, IResourceError, IRouteData, IScreenRecordData, ISentry, TOnReportPerformanceData, TOnReportWhiteScreenData, TReportPayload, TUnknownError };
167
+ export type { IBaseDataWithEvent, IBatchErrorData, IBreadcrumbItem, ICodeError, IDataReporter, IDeviceInfo, IExposureData, IExtendedErrorEvent, IHttpData, IPerformanceData, IPerformanceResourceTiming, IReportData, IReportPayload, IResourceError, IRouteData, IScreenRecordData, ISentry, TOnReportPerformanceData, TOnReportWhiteScreenData, TReportPayload };
@@ -1 +1 @@
1
- "use strict";var e,t,r,o,a;exports.BreadcrumbType=void 0,(e=exports.BreadcrumbType||(exports.BreadcrumbType={})).Http="Http",e.Click="Click",e.Route="Route",e.Resource="Resource",e.CodeError="Code Error",e.Custom="Custom",exports.Status=void 0,(t=exports.Status||(exports.Status={})).Error="Error",t.OK="OK",exports.EventType=void 0,(r=exports.EventType||(exports.EventType={})).Xhr="XMLHttpRequest",r.Fetch="fetch",r.Click="Click",r.HashChange="Event hashchange",r.History="History",r.Resource="Resource",r.UnhandledRejection="Event unhandledrejection",r.Error="Error",r.Vue="Vue",r.React="React",r.OtherFrameworks="OtherFrameworks",r.Performance="Performance",r.ScreenRecord="ScreenRecord",r.Exposure="Exposure",r.WhiteScreen="WhiteScreen",r.Custom="Custom",r.PV="PV",exports.HttpStatusCode=void 0,(o=exports.HttpStatusCode||(exports.HttpStatusCode={}))[o.OK=200]="OK",o[o.InternalServerError=500]="InternalServerError",o[o.BadRequest=400]="BadRequest",o[o.Unauthorized=401]="Unauthorized",o[o.Forbidden=403]="Forbidden",o[o.NotFound=404]="NotFound",o[o.Conflict=409]="Conflict",o[o.PayloadTooLarge=413]="PayloadTooLarge",o[o.TooManyRequests=429]="TooManyRequests",o[o.NotImplemented=501]="NotImplemented",o[o.ServiceUnavailable=503]="ServiceUnavailable",o[o.GatewayTimeout=504]="GatewayTimeout",exports.HttpMethod=void 0,(a=exports.HttpMethod||(exports.HttpMethod={})).Get="GET",a.Post="POST",a.Head="HEAD",a.Put="PUT",a.Delete="DELETE",a.Connect="CONNECT",a.Options="OPTIONS",a.Trace="TRACE",a.Patch="PATCH";
1
+ "use strict";var e,r,t;exports.BreadcrumbType=void 0,(e=exports.BreadcrumbType||(exports.BreadcrumbType={})).Http="Http",e.Click="Click",e.Route="Route",e.Resource="Resource",e.CodeError="Code Error",e.Custom="Custom",exports.Status=void 0,(r=exports.Status||(exports.Status={})).Error="Error",r.OK="OK",exports.EventType=void 0,(t=exports.EventType||(exports.EventType={})).Xhr="XMLHttpRequest",t.Fetch="fetch",t.Click="Click",t.HashChange="Event hashchange",t.History="History",t.Resource="Resource",t.UnhandledRejection="Event unhandledrejection",t.Error="Error",t.Vue="Vue",t.React="React",t.OtherFrameworks="OtherFrameworks",t.Performance="Performance",t.ScreenRecord="ScreenRecord",t.Exposure="Exposure",t.WhiteScreen="WhiteScreen",t.Custom="Custom",t.PV="PV";
@@ -50,47 +50,5 @@ declare enum EventType {
50
50
  Custom = "Custom",
51
51
  PV = "PV"
52
52
  }
53
- declare enum HttpStatusCode {
54
- OK = 200,
55
- InternalServerError = 500,
56
- /** @deprecated Unreferenced in the SDK; kept as public API. */
57
- BadRequest = 400,
58
- /** @deprecated Unreferenced in the SDK; kept as public API. */
59
- Unauthorized = 401,
60
- /** @deprecated Unreferenced in the SDK; kept as public API. */
61
- Forbidden = 403,
62
- /** @deprecated Unreferenced in the SDK; kept as public API. */
63
- NotFound = 404,
64
- /** @deprecated Unreferenced in the SDK; kept as public API. */
65
- Conflict = 409,
66
- /** @deprecated Unreferenced in the SDK; kept as public API. */
67
- PayloadTooLarge = 413,
68
- /** @deprecated Unreferenced in the SDK; kept as public API. */
69
- TooManyRequests = 429,
70
- /** @deprecated Unreferenced in the SDK; kept as public API. */
71
- NotImplemented = 501,
72
- /** @deprecated Unreferenced in the SDK; kept as public API. */
73
- ServiceUnavailable = 503,
74
- /** @deprecated Unreferenced in the SDK; kept as public API. */
75
- GatewayTimeout = 504
76
- }
77
- declare enum HttpMethod {
78
- Get = "GET",
79
- Post = "POST",
80
- /** @deprecated Unreferenced in the SDK; kept as public API. */
81
- Head = "HEAD",
82
- /** @deprecated Unreferenced in the SDK; kept as public API. */
83
- Put = "PUT",
84
- /** @deprecated Unreferenced in the SDK; kept as public API. */
85
- Delete = "DELETE",
86
- /** @deprecated Unreferenced in the SDK; kept as public API. */
87
- Connect = "CONNECT",
88
- /** @deprecated Unreferenced in the SDK; kept as public API. */
89
- Options = "OPTIONS",
90
- /** @deprecated Unreferenced in the SDK; kept as public API. */
91
- Trace = "TRACE",
92
- /** @deprecated Unreferenced in the SDK; kept as public API. */
93
- Patch = "PATCH"
94
- }
95
53
 
96
- export { BreadcrumbType, EventType, HttpMethod, HttpStatusCode, Status };
54
+ export { BreadcrumbType, EventType, Status };
@@ -1 +1 @@
1
- var e,r,o,t,n;!function(e){e.Http="Http",e.Click="Click",e.Route="Route",e.Resource="Resource",e.CodeError="Code Error",e.Custom="Custom"}(e||(e={})),function(e){e.Error="Error",e.OK="OK"}(r||(r={})),function(e){e.Xhr="XMLHttpRequest",e.Fetch="fetch",e.Click="Click",e.HashChange="Event hashchange",e.History="History",e.Resource="Resource",e.UnhandledRejection="Event unhandledrejection",e.Error="Error",e.Vue="Vue",e.React="React",e.OtherFrameworks="OtherFrameworks",e.Performance="Performance",e.ScreenRecord="ScreenRecord",e.Exposure="Exposure",e.WhiteScreen="WhiteScreen",e.Custom="Custom",e.PV="PV"}(o||(o={})),function(e){e[e.OK=200]="OK",e[e.InternalServerError=500]="InternalServerError",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.Conflict=409]="Conflict",e[e.PayloadTooLarge=413]="PayloadTooLarge",e[e.TooManyRequests=429]="TooManyRequests",e[e.NotImplemented=501]="NotImplemented",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout"}(t||(t={})),function(e){e.Get="GET",e.Post="POST",e.Head="HEAD",e.Put="PUT",e.Delete="DELETE",e.Connect="CONNECT",e.Options="OPTIONS",e.Trace="TRACE",e.Patch="PATCH"}(n||(n={}));export{e as BreadcrumbType,o as EventType,n as HttpMethod,t as HttpStatusCode,r as Status};
1
+ var e,r,o;!function(e){e.Http="Http",e.Click="Click",e.Route="Route",e.Resource="Resource",e.CodeError="Code Error",e.Custom="Custom"}(e||(e={})),function(e){e.Error="Error",e.OK="OK"}(r||(r={})),function(e){e.Xhr="XMLHttpRequest",e.Fetch="fetch",e.Click="Click",e.HashChange="Event hashchange",e.History="History",e.Resource="Resource",e.UnhandledRejection="Event unhandledrejection",e.Error="Error",e.Vue="Vue",e.React="React",e.OtherFrameworks="OtherFrameworks",e.Performance="Performance",e.ScreenRecord="ScreenRecord",e.Exposure="Exposure",e.WhiteScreen="WhiteScreen",e.Custom="Custom",e.PV="PV"}(o||(o={}));export{e as BreadcrumbType,o as EventType,r as Status};
@@ -23,9 +23,10 @@ import { EventType } from './enums.js';
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- type ReportDataHook = (data: IReportData) => Promise<IReportData | false> | IReportData | false;
27
- type ReportBatchHook = (data: readonly IReportData[]) => Promise<readonly IReportData[] | false> | readonly IReportData[] | false;
28
- type AfterSendDataHook = (data: readonly IReportData[]) => Promise<void> | void;
26
+ type BeforeSendHook = (data: IReportData) => Promise<IReportData | false> | IReportData | false;
27
+ type BeforeSendBatchHook = (data: readonly IReportData[]) => Promise<readonly IReportData[] | false> | readonly IReportData[] | false;
28
+ type AfterSendHook = (data: readonly IReportData[]) => Promise<void> | void;
29
+ type BeforeBreadcrumbHook = (data: IBreadcrumbItem) => IBreadcrumbItem;
29
30
  interface IOptions {
30
31
  dsn: string;
31
32
  projectId: string;
@@ -38,36 +39,31 @@ interface IOptions {
38
39
  enableUnhandledRejection: boolean;
39
40
  enableHashChange: boolean;
40
41
  enableHistory: boolean;
41
- enablePerformance: boolean;
42
- enableScreenRecord: boolean;
43
42
  enableWhiteScreen: boolean;
44
43
  enableFingerprint: boolean;
45
44
  anonymousId: string;
46
45
  visitorId: string;
47
- useImageReport: boolean;
48
46
  screenRecordDurationMs: number;
49
47
  screenRecordEventTypes: EventType[];
50
48
  hasSkeleton: boolean;
51
49
  rootCssSelectors: string[];
52
50
  clickThrottleDelay: number;
53
- requestTimeoutMilliseconds: number;
54
51
  maxBreadcrumbs: number;
55
52
  repeatCodeError: boolean;
56
53
  enableHttpPerformance: boolean;
57
54
  ignoreErrors: (string | RegExp)[];
58
55
  excludeApis: (string | RegExp)[];
59
- onBeforePushBreadcrumb?: ((data: IBreadcrumbItem) => IBreadcrumbItem) | undefined;
56
+ beforeBreadcrumb?: BeforeBreadcrumbHook | undefined;
60
57
  cacheMaxLength: number;
61
58
  cacheWaitingTime: number;
62
59
  maxQueueLength: number;
63
60
  retryIntervalMilliseconds: number;
64
- onBeforeReportData?: ReportDataHook | undefined;
65
- beforePushEventList?: ReportBatchHook | undefined;
66
- afterSendData?: AfterSendDataHook | undefined;
61
+ beforeSend?: BeforeSendHook | undefined;
62
+ beforeSendBatch?: BeforeSendBatchHook | undefined;
63
+ afterSend?: AfterSendHook | undefined;
67
64
  offlineCacheKey: string;
68
65
  tracesSampleRate: number;
69
- handleHttpError?: (<T>(data: T) => boolean) | undefined;
70
66
  debug: boolean;
71
67
  }
72
68
 
73
- export type { AfterSendDataHook, IOptions, ReportBatchHook, ReportDataHook };
69
+ export type { AfterSendHook, BeforeBreadcrumbHook, BeforeSendBatchHook, BeforeSendHook, IOptions };
@@ -1 +1 @@
1
- "use strict";exports.SentryPlugin=class{type;constructor(t){this.type=t}};
1
+ "use strict";exports.SentryPlugin=class{};
@@ -1,4 +1,3 @@
1
- import { EventType } from './enums.js';
2
1
  import { IReportPayload } from './common.js';
3
2
 
4
3
  /**
@@ -27,8 +26,6 @@ type WithSentry<T, S extends IReportPayload = IReportPayload> = T & {
27
26
  __sentry__: S;
28
27
  };
29
28
  declare abstract class SentryPlugin {
30
- type: EventType;
31
- constructor(type: EventType);
32
29
  abstract init(): void;
33
30
  destroy?(): void;
34
31
  }
@@ -1 +1 @@
1
- class t{type;constructor(t){this.type=t}}export{t as SentryPlugin};
1
+ class s{}export{s as SentryPlugin};