@sentry/replay 10.69.0 → 11.0.0-alpha.0

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 (94) hide show
  1. package/build/npm/cjs/index.js +5 -8
  2. package/build/npm/cjs/index.js.map +1 -1
  3. package/build/npm/esm/index.js +5 -8
  4. package/build/npm/esm/index.js.map +1 -1
  5. package/build/npm/esm/package.json +1 -1
  6. package/build/npm/types/coreHandlers/handleClick.d.ts.map +1 -1
  7. package/build/npm/types/coreHandlers/handleDom.d.ts.map +1 -1
  8. package/build/npm/types/coreHandlers/util/addFeedbackBreadcrumb.d.ts.map +1 -1
  9. package/build/npm/types/eventBuffer/EventBufferArray.d.ts.map +1 -1
  10. package/build/npm/types/eventBuffer/EventBufferCompressionWorker.d.ts.map +1 -1
  11. package/build/npm/types/eventBuffer/EventBufferProxy.d.ts.map +1 -1
  12. package/build/npm/types/eventBuffer/WorkerHandler.d.ts.map +1 -1
  13. package/build/npm/types/eventBuffer/error.d.ts.map +1 -1
  14. package/build/npm/types/integration.d.ts.map +1 -1
  15. package/build/npm/types/replay.d.ts.map +1 -1
  16. package/build/npm/types/util/createPerformanceEntries.d.ts.map +1 -1
  17. package/build/npm/types/util/sendReplayRequest.d.ts.map +1 -1
  18. package/package.json +8 -17
  19. package/build/npm/types-ts3.8/constants.d.ts +0 -28
  20. package/build/npm/types-ts3.8/coreHandlers/handleAfterSendEvent.d.ts +0 -9
  21. package/build/npm/types-ts3.8/coreHandlers/handleBeforeSendEvent.d.ts +0 -9
  22. package/build/npm/types-ts3.8/coreHandlers/handleBreadcrumbs.d.ts +0 -14
  23. package/build/npm/types-ts3.8/coreHandlers/handleClick.d.ts +0 -47
  24. package/build/npm/types-ts3.8/coreHandlers/handleDom.d.ts +0 -11
  25. package/build/npm/types-ts3.8/coreHandlers/handleGlobalEvent.d.ts +0 -7
  26. package/build/npm/types-ts3.8/coreHandlers/handleHistory.d.ts +0 -7
  27. package/build/npm/types-ts3.8/coreHandlers/handleKeyboardEvent.d.ts +0 -7
  28. package/build/npm/types-ts3.8/coreHandlers/handleNetworkBreadcrumbs.d.ts +0 -16
  29. package/build/npm/types-ts3.8/coreHandlers/handleProcessSegmentSpan.d.ts +0 -6
  30. package/build/npm/types-ts3.8/coreHandlers/performanceObserver.d.ts +0 -7
  31. package/build/npm/types-ts3.8/coreHandlers/util/addBreadcrumbEvent.d.ts +0 -7
  32. package/build/npm/types-ts3.8/coreHandlers/util/addFeedbackBreadcrumb.d.ts +0 -7
  33. package/build/npm/types-ts3.8/coreHandlers/util/addNetworkBreadcrumb.d.ts +0 -4
  34. package/build/npm/types-ts3.8/coreHandlers/util/addSegmentDetailsToContext.d.ts +0 -3
  35. package/build/npm/types-ts3.8/coreHandlers/util/domUtils.d.ts +0 -15
  36. package/build/npm/types-ts3.8/coreHandlers/util/fetchUtils.d.ts +0 -23
  37. package/build/npm/types-ts3.8/coreHandlers/util/getAttributesToRecord.d.ts +0 -5
  38. package/build/npm/types-ts3.8/coreHandlers/util/networkUtils.d.ts +0 -21
  39. package/build/npm/types-ts3.8/coreHandlers/util/onWindowOpen.d.ts +0 -8
  40. package/build/npm/types-ts3.8/coreHandlers/util/shouldSampleForBufferEvent.d.ts +0 -9
  41. package/build/npm/types-ts3.8/coreHandlers/util/xhrUtils.d.ts +0 -36
  42. package/build/npm/types-ts3.8/debug-build.d.ts +0 -7
  43. package/build/npm/types-ts3.8/eventBuffer/EventBufferArray.d.ts +0 -30
  44. package/build/npm/types-ts3.8/eventBuffer/EventBufferCompressionWorker.d.ts +0 -52
  45. package/build/npm/types-ts3.8/eventBuffer/EventBufferProxy.d.ts +0 -45
  46. package/build/npm/types-ts3.8/eventBuffer/WorkerHandler.d.ts +0 -29
  47. package/build/npm/types-ts3.8/eventBuffer/error.d.ts +0 -5
  48. package/build/npm/types-ts3.8/eventBuffer/index.d.ts +0 -11
  49. package/build/npm/types-ts3.8/index.d.ts +0 -4
  50. package/build/npm/types-ts3.8/integration.d.ts +0 -117
  51. package/build/npm/types-ts3.8/replay.d.ts +0 -320
  52. package/build/npm/types-ts3.8/session/Session.d.ts +0 -8
  53. package/build/npm/types-ts3.8/session/clearSession.d.ts +0 -6
  54. package/build/npm/types-ts3.8/session/createSession.d.ts +0 -14
  55. package/build/npm/types-ts3.8/session/fetchSession.d.ts +0 -6
  56. package/build/npm/types-ts3.8/session/loadOrCreateSession.d.ts +0 -11
  57. package/build/npm/types-ts3.8/session/saveSession.d.ts +0 -6
  58. package/build/npm/types-ts3.8/session/shouldRefreshSession.d.ts +0 -7
  59. package/build/npm/types-ts3.8/types/index.d.ts +0 -6
  60. package/build/npm/types-ts3.8/types/performance.d.ts +0 -136
  61. package/build/npm/types-ts3.8/types/replay.d.ts +0 -487
  62. package/build/npm/types-ts3.8/types/replayFrame.d.ts +0 -188
  63. package/build/npm/types-ts3.8/types/request.d.ts +0 -15
  64. package/build/npm/types-ts3.8/types/rrweb.d.ts +0 -64
  65. package/build/npm/types-ts3.8/util/addEvent.d.ts +0 -20
  66. package/build/npm/types-ts3.8/util/addGlobalListeners.d.ts +0 -6
  67. package/build/npm/types-ts3.8/util/addMemoryEntry.d.ts +0 -7
  68. package/build/npm/types-ts3.8/util/createBreadcrumb.d.ts +0 -6
  69. package/build/npm/types-ts3.8/util/createPerformanceEntries.d.ts +0 -52
  70. package/build/npm/types-ts3.8/util/createPerformanceSpans.d.ts +0 -6
  71. package/build/npm/types-ts3.8/util/createReplayEnvelope.d.ts +0 -7
  72. package/build/npm/types-ts3.8/util/debounce.d.ts +0 -30
  73. package/build/npm/types-ts3.8/util/eventUtils.d.ts +0 -10
  74. package/build/npm/types-ts3.8/util/getPrivacyOptions.d.ts +0 -17
  75. package/build/npm/types-ts3.8/util/getRecordingSamplingOptions.d.ts +0 -10
  76. package/build/npm/types-ts3.8/util/getReplay.d.ts +0 -6
  77. package/build/npm/types-ts3.8/util/handleRecordingEmit.d.ts +0 -15
  78. package/build/npm/types-ts3.8/util/hasSessionStorage.d.ts +0 -3
  79. package/build/npm/types-ts3.8/util/isExpired.d.ts +0 -6
  80. package/build/npm/types-ts3.8/util/isRrwebError.d.ts +0 -6
  81. package/build/npm/types-ts3.8/util/isSampled.d.ts +0 -8
  82. package/build/npm/types-ts3.8/util/isSessionExpired.d.ts +0 -10
  83. package/build/npm/types-ts3.8/util/logger.d.ts +0 -24
  84. package/build/npm/types-ts3.8/util/maskAttribute.d.ts +0 -17
  85. package/build/npm/types-ts3.8/util/prepareRecordingData.d.ts +0 -9
  86. package/build/npm/types-ts3.8/util/prepareReplayEvent.d.ts +0 -11
  87. package/build/npm/types-ts3.8/util/resetReplayIdOnDynamicSamplingContext.d.ts +0 -14
  88. package/build/npm/types-ts3.8/util/rrweb.d.ts +0 -7
  89. package/build/npm/types-ts3.8/util/sendReplay.d.ts +0 -9
  90. package/build/npm/types-ts3.8/util/sendReplayRequest.d.ts +0 -27
  91. package/build/npm/types-ts3.8/util/shouldFilterRequest.d.ts +0 -7
  92. package/build/npm/types-ts3.8/util/throttle.d.ts +0 -12
  93. package/build/npm/types-ts3.8/util/timestamp.d.ts +0 -9
  94. package/build/npm/types-ts3.8/worker-bundler.d.ts +0 -2
@@ -1,136 +0,0 @@
1
- import { ReplayNetworkRequestOrResponse } from './request';
2
- export type AllPerformanceEntry = PerformancePaintTiming | PerformanceResourceTiming | PerformanceNavigationTiming;
3
- export type PerformancePaintTiming = PerformanceEntry;
4
- export type PerformanceNavigationTiming = PerformanceEntry & PerformanceResourceTiming & {
5
- type: string;
6
- transferSize: number;
7
- /**
8
- * A DOMHighResTimeStamp representing the time immediately before the user agent
9
- * sets the document's readyState to "interactive".
10
- */
11
- domInteractive: number;
12
- /**
13
- * A DOMHighResTimeStamp representing the time immediately before the current
14
- * document's DOMContentLoaded event handler starts.
15
- */
16
- domContentLoadedEventStart: number;
17
- /**
18
- * A DOMHighResTimeStamp representing the time immediately after the current
19
- * document's DOMContentLoaded event handler completes.
20
- */
21
- domContentLoadedEventEnd: number;
22
- /**
23
- * A DOMHighResTimeStamp representing the time immediately before the current
24
- * document's load event handler starts.
25
- */
26
- loadEventStart: number;
27
- /**
28
- * A DOMHighResTimeStamp representing the time immediately after the current
29
- * document's load event handler completes.
30
- */
31
- loadEventEnd: number;
32
- /**
33
- * A DOMHighResTimeStamp representing the time immediately before the user agent
34
- * sets the document's readyState to "complete".
35
- */
36
- domComplete: number;
37
- /**
38
- * A number representing the number of redirects since the last non-redirect
39
- * navigation in the current browsing context.
40
- */
41
- redirectCount: number;
42
- };
43
- export type ExperimentalPerformanceResourceTiming = PerformanceResourceTiming & {
44
- responseStatus?: number;
45
- };
46
- export type PaintData = undefined;
47
- /**
48
- * See https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming
49
- *
50
- * Note `navigation.push` will not have any data
51
- */
52
- export type NavigationData = Partial<Pick<PerformanceNavigationTiming, 'decodedBodySize' | 'encodedBodySize' | 'duration' | 'domInteractive' | 'domContentLoadedEventEnd' | 'domContentLoadedEventStart' | 'loadEventStart' | 'loadEventEnd' | 'domComplete' | 'redirectCount'>> & {
53
- /**
54
- * Transfer size of resource
55
- */
56
- size?: number;
57
- };
58
- export type ResourceData = Pick<PerformanceResourceTiming, 'decodedBodySize' | 'encodedBodySize'> & {
59
- /**
60
- * Transfer size of resource
61
- */
62
- size: number;
63
- /**
64
- * HTTP status code. Note this is experimental and not available on all browsers.
65
- */
66
- statusCode?: number;
67
- };
68
- export interface WebVitalData {
69
- /**
70
- * Render time (in ms) of the LCP
71
- */
72
- value: number;
73
- size: number;
74
- /**
75
- * The rating as to whether the metric value is within the "good",
76
- * "needs improvement", or "poor" thresholds of the metric.
77
- */
78
- rating: 'good' | 'needs-improvement' | 'poor';
79
- /**
80
- * The recording id of the web vital nodes. -1 if not found
81
- */
82
- nodeIds?: number[];
83
- /**
84
- * The layout shifts of a CLS metric
85
- */
86
- attributions?: {
87
- value: number;
88
- nodeIds: number[] | undefined;
89
- }[];
90
- }
91
- /**
92
- * Entries that come from window.performance
93
- */
94
- export type AllPerformanceEntryData = PaintData | NavigationData | ResourceData | WebVitalData;
95
- export interface MemoryData {
96
- memory: {
97
- jsHeapSizeLimit: number;
98
- totalJSHeapSize: number;
99
- usedJSHeapSize: number;
100
- };
101
- }
102
- export interface NetworkRequestData {
103
- method?: string;
104
- statusCode?: number;
105
- requestBodySize?: number;
106
- responseBodySize?: number;
107
- request?: ReplayNetworkRequestOrResponse;
108
- response?: ReplayNetworkRequestOrResponse;
109
- }
110
- export interface HistoryData {
111
- previous: string | undefined;
112
- }
113
- export type AllEntryData = AllPerformanceEntryData | MemoryData | NetworkRequestData | HistoryData;
114
- export interface ReplayPerformanceEntry<T> {
115
- /**
116
- * One of these types https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType
117
- */
118
- type: string;
119
- /**
120
- * A more specific description of the performance entry
121
- */
122
- name: string;
123
- /**
124
- * The start timestamp in seconds
125
- */
126
- start: number;
127
- /**
128
- * The end timestamp in seconds
129
- */
130
- end: number;
131
- /**
132
- * Additional unstructured data to be included
133
- */
134
- data: T;
135
- }
136
- //# sourceMappingURL=performance.d.ts.map
@@ -1,487 +0,0 @@
1
- import { Breadcrumb, ErrorEvent, ReplayRecordingData, ReplayRecordingMode, ReplayStopReason, Span } from '@sentry/core';
2
- import { SKIPPED, THROTTLED } from '../util/throttle';
3
- import { AllPerformanceEntry, AllPerformanceEntryData, ReplayPerformanceEntry } from './performance';
4
- import { ReplayFrameEvent } from './replayFrame';
5
- import { ReplayNetworkRequestOrResponse } from './request';
6
- import { CanvasManagerInterface, CanvasManagerOptions, ReplayEventWithTime, RrwebRecordOptions } from './rrweb';
7
- export type RecordingEvent = ReplayFrameEvent | ReplayEventWithTime;
8
- export type RecordingOptions = RrwebRecordOptions;
9
- export interface SendReplayData {
10
- recordingData: ReplayRecordingData;
11
- replayId: string;
12
- segmentId: number;
13
- eventContext: PopEventContext;
14
- timestamp: number;
15
- session: Session;
16
- onError?: (err: unknown) => void;
17
- }
18
- export interface Timeouts {
19
- sessionIdlePause: number;
20
- sessionIdleExpire: number;
21
- }
22
- /**
23
- * The request payload to worker
24
- */
25
- export interface WorkerRequest {
26
- id: number;
27
- method: 'clear' | 'addEvent' | 'finish';
28
- arg?: string;
29
- }
30
- /**
31
- * The response from the worker
32
- */
33
- export interface WorkerResponse {
34
- id: number;
35
- method: string;
36
- success: boolean;
37
- response: unknown;
38
- }
39
- export type AddEventResult = void;
40
- export interface BeforeAddRecordingEvent {
41
- (event: ReplayFrameEvent): ReplayFrameEvent | null | undefined;
42
- }
43
- export interface ReplayNetworkOptions {
44
- /**
45
- * Capture request/response details for XHR/Fetch requests that match the given URLs.
46
- * The URLs can be strings or regular expressions.
47
- * When provided a string, we will match any URL that contains the given string.
48
- * You can use a Regex to handle exact matches or more complex matching.
49
- *
50
- * Only URLs matching these patterns will have bodies & additional headers captured.
51
- */
52
- networkDetailAllowUrls: (string | RegExp)[];
53
- /**
54
- * Deny request/response details for XHR/Fetch requests that match the given URLs.
55
- * The URLs can be strings or regular expressions.
56
- * When provided a string, we will deny any URL that contains the given string.
57
- * You can use a Regex to handle exact matches or more complex matching.
58
- * URLs matching these patterns will not have bodies & additional headers captured.
59
- */
60
- networkDetailDenyUrls: (string | RegExp)[];
61
- /**
62
- * If request & response bodies should be captured.
63
- * Only applies to URLs matched by `networkDetailAllowUrls` and not matched by `networkDetailDenyUrls`.
64
- * Defaults to true.
65
- */
66
- networkCaptureBodies: boolean;
67
- /**
68
- * Capture the following request headers, in addition to the default ones.
69
- * Only applies to URLs matched by `networkDetailAllowUrls` and not matched by `networkDetailDenyUrls`.
70
- * Any headers defined here will be captured in addition to the default headers.
71
- */
72
- networkRequestHeaders: string[];
73
- /**
74
- * Capture the following response headers, in addition to the default ones.
75
- * Only applies to URLs matched by `networkDetailAllowUrls` and not matched by `networkDetailDenyUrls`.
76
- * Any headers defined here will be captured in addition to the default headers.
77
- */
78
- networkResponseHeaders: string[];
79
- }
80
- export type ReplayWorkerURL = string | URL;
81
- export interface ReplayPluginOptions extends ReplayNetworkOptions {
82
- /**
83
- * The sample rate for session-long replays. 1.0 will record all sessions and
84
- * 0 will record none.
85
- */
86
- sessionSampleRate: number;
87
- /**
88
- * The sample rate for sessions that has had an error occur. This is
89
- * independent of `sessionSampleRate`.
90
- */
91
- errorSampleRate: number;
92
- /**
93
- * If false, will create a new session per pageload. Otherwise, saves session
94
- * to Session Storage.
95
- */
96
- stickySession: boolean;
97
- /**
98
- * The amount of time to wait before sending a replay
99
- */
100
- flushMinDelay: number;
101
- /**
102
- * The max amount of time to wait before sending a replay
103
- */
104
- flushMaxDelay: number;
105
- /**
106
- * Attempt to use compression when web workers are available
107
- *
108
- * (default is true)
109
- */
110
- useCompression: boolean;
111
- /**
112
- * If defined, use this worker URL instead of the default included one for compression.
113
- * This will only be used if `useCompression` is not false.
114
- */
115
- workerUrl?: ReplayWorkerURL;
116
- /**
117
- * Block all media (e.g. images, svg, video) in recordings.
118
- */
119
- blockAllMedia: boolean;
120
- /**
121
- * Mask all inputs in recordings
122
- */
123
- maskAllInputs: boolean;
124
- /**
125
- * Mask all text in recordings
126
- */
127
- maskAllText: boolean;
128
- /**
129
- * A high number of DOM mutations (in a single event loop) can cause
130
- * performance regressions in end-users' browsers. This setting will create
131
- * a breadcrumb in the recording when the limit has been reached.
132
- */
133
- mutationBreadcrumbLimit: number;
134
- /**
135
- * A high number of DOM mutations (in a single event loop) can cause
136
- * performance regressions in end-users' browsers. This setting will cause
137
- * recording to stop when the limit has been reached.
138
- */
139
- mutationLimit: number;
140
- /**
141
- * The max. time in ms to wait for a slow click to finish.
142
- * After this amount of time we stop waiting for actions after a click happened.
143
- * Set this to 0 to disable slow click capture.
144
- *
145
- * Default: 7000ms
146
- */
147
- slowClickTimeout: number;
148
- /**
149
- * Ignore clicks on elements matching the given selectors for slow click detection.
150
- */
151
- slowClickIgnoreSelectors: string[];
152
- /**
153
- * The min. duration (in ms) a replay has to have before it is sent to Sentry.
154
- * Whenever attempting to flush a session that is shorter than this, it will not actually send it to Sentry.
155
- * Note that this is capped at max. 50s, so we don't unintentionally drop buffered replays that are longer than 60s
156
- *
157
- * Warning: Setting this to a higher value can result in unintended drops of onError-sampled replays.
158
- *
159
- */
160
- minReplayDuration: number;
161
- /**
162
- * The max. duration (in ms) a replay session may be.
163
- * This is capped at max. 60min.
164
- */
165
- maxReplayDuration: number;
166
- /**
167
- * Callback before adding a custom recording event
168
- *
169
- * Events added by the underlying DOM recording library can *not* be modified,
170
- * only custom recording events from the Replay integration will trigger the
171
- * callback listeners. This can be used to scrub certain fields in an event (e.g. URLs from navigation events).
172
- *
173
- * Returning a `null` will drop the event completely. Note, dropping a recording
174
- * event is not the same as dropping the replay, the replay will still exist and
175
- * continue to function.
176
- */
177
- beforeAddRecordingEvent?: BeforeAddRecordingEvent;
178
- /**
179
- * An optional callback to be called before we decide to sample based on an error.
180
- * If specified, this callback will receive an error that was captured by Sentry.
181
- * Return `true` to continue sampling for this error, or `false` to ignore this error for replay sampling.
182
- * Note that returning `true` means that the `replaysOnErrorSampleRate` will be checked,
183
- * not that it will definitely be sampled.
184
- * Use this to filter out groups of errors that should def. not be sampled.
185
- */
186
- beforeErrorSampling?: (event: ErrorEvent) => boolean;
187
- /**
188
- * Callback when an internal SDK error occurs. This can be used to debug SDK
189
- * issues.
190
- */
191
- onError?: (err: unknown) => void;
192
- /**
193
- * Patch the global Request() interface to store original request bodies.
194
- * This allows Replay to capture the original body from Request objects passed to fetch().
195
- *
196
- * When enabled, creates a copy of the original body before it's converted to a ReadableStream.
197
- * This is useful for capturing request bodies in network breadcrumbs.
198
- *
199
- * Note: This modifies the global Request constructor.
200
- *
201
- * @default false
202
- */
203
- attachRawBodyFromRequest?: boolean;
204
- /**
205
- * _experiments allows users to enable experimental or internal features.
206
- * We don't consider such features as part of the public API and hence we don't guarantee semver for them.
207
- * Experimental features can be added, changed or removed at any time.
208
- *
209
- * Default: undefined
210
- */
211
- _experiments: Partial<{
212
- captureExceptions: boolean;
213
- traceInternals: boolean;
214
- continuousCheckout: number;
215
- /**
216
- * Before enabling, please read the security considerations:
217
- * https://github.com/rrweb-io/rrweb/blob/master/docs/recipes/cross-origin-iframes.md#considerations
218
- */
219
- recordCrossOriginIframes: boolean;
220
- /**
221
- * Completely ignore mutations matching the given selectors.
222
- * This can be used if a specific type of mutation is causing (e.g. performance) problems.
223
- * NOTE: This can be dangerous to use, as mutations are applied as incremental patches.
224
- * Make sure to verify that the captured replays still work when using this option.
225
- */
226
- ignoreMutations: string[];
227
- }>;
228
- }
229
- /**
230
- * The options that can be set in the plugin options. `sessionSampleRate` and `errorSampleRate` are added
231
- * in the root level of the SDK options as `replaysSessionSampleRate` and `replaysOnErrorSampleRate`.
232
- */
233
- export type InitialReplayPluginOptions = Pick<ReplayPluginOptions, Exclude<keyof ReplayPluginOptions, 'sessionSampleRate' | 'errorSampleRate'>>;
234
- type OptionalReplayPluginOptions = Partial<InitialReplayPluginOptions> & {
235
- /**
236
- * Mask element attributes that are contained in list
237
- */
238
- maskAttributes?: string[];
239
- };
240
- /**
241
- * Session options that are configurable by the integration configuration
242
- */
243
- export interface SessionOptions extends Pick<ReplayPluginOptions, 'sessionSampleRate' | 'stickySession'> {
244
- /**
245
- * Should buffer recordings to be saved later either by error sampling, or by
246
- * manually calling `flush()`. This is only a factor if not sampled for a
247
- * session-based replay.
248
- */
249
- allowBuffering: boolean;
250
- }
251
- export interface ReplayIntegrationPrivacyOptions {
252
- /**
253
- * Mask text content for elements that match the CSS selectors in the list.
254
- */
255
- mask?: string[];
256
- /**
257
- * Unmask text content for elements that match the CSS selectors in the list.
258
- */
259
- unmask?: string[];
260
- /**
261
- * Block elements that match the CSS selectors in the list. Blocking replaces
262
- * the element with an empty placeholder with the same dimensions.
263
- */
264
- block?: string[];
265
- /**
266
- * Unblock elements that match the CSS selectors in the list. This is useful when using `blockAllMedia`.
267
- */
268
- unblock?: string[];
269
- /**
270
- * Ignore input events for elements that match the CSS selectors in the list.
271
- */
272
- ignore?: string[];
273
- /**
274
- * A callback function to customize how your text is masked.
275
- */
276
- maskFn?: (s: string) => string;
277
- }
278
- export interface ReplayConfiguration extends ReplayIntegrationPrivacyOptions, OptionalReplayPluginOptions, Pick<RecordingOptions, 'maskAllText' | 'maskAllInputs'> {
279
- }
280
- interface CommonEventContext {
281
- /**
282
- * The initial URL of the session
283
- */
284
- initialUrl: string;
285
- /**
286
- * The initial starting timestamp in ms of the session.
287
- */
288
- initialTimestamp: number;
289
- /**
290
- * Ordered list of URLs that have been visited during a replay segment
291
- */
292
- urls: string[];
293
- }
294
- export interface PopEventContext extends CommonEventContext {
295
- /**
296
- * List of Sentry error ids that have occurred during a replay segment
297
- */
298
- errorIds: Array<string>;
299
- /**
300
- * List of Sentry trace ids that have occurred during a replay segment
301
- */
302
- traceIds: Array<string>;
303
- /**
304
- * List of Sentry segment names that have occurred during a replay segment
305
- */
306
- segmentNames: Array<string>;
307
- }
308
- /**
309
- * Additional context that will be sent w/ `replay_event`
310
- */
311
- export interface InternalEventContext extends CommonEventContext {
312
- /**
313
- * Set of Sentry error ids that have occurred during a replay segment
314
- */
315
- errorIds: Set<string>;
316
- /**
317
- * Set of Sentry trace ids that have occurred during a replay segment
318
- */
319
- traceIds: Set<string>;
320
- /**
321
- * Set of Sentry segment names that have occurred during a replay segment
322
- */
323
- segmentNames: Set<string>;
324
- }
325
- export type Sampled = false | 'session' | 'buffer';
326
- export interface Session {
327
- id: string;
328
- /**
329
- * Start time of current session (in ms)
330
- */
331
- started: number;
332
- /**
333
- * Last known activity of the session (in ms)
334
- */
335
- lastActivity: number;
336
- /**
337
- * Segment ID for replay events
338
- */
339
- segmentId: number;
340
- /**
341
- * The ID of the previous session.
342
- * If this is empty, there was no previous session.
343
- */
344
- previousSessionId?: string;
345
- /**
346
- * Is the session sampled? `false` if not sampled, otherwise, `session` or `buffer`
347
- */
348
- sampled: Sampled;
349
- /**
350
- * Session is dirty when its id has been linked to an event (e.g. error event).
351
- * This is helpful when a session is mistakenly stuck in "buffer" mode (e.g. network issues preventing it from being converted to "session" mode).
352
- * The dirty flag is used to prevent updating the session start time to the earliest event in the buffer so that it can be refreshed if it's been expired.
353
- */
354
- dirty?: boolean;
355
- }
356
- export type EventBufferType = 'sync' | 'worker';
357
- export interface EventBuffer {
358
- /**
359
- * If any events have been added to the buffer.
360
- */
361
- readonly hasEvents: boolean;
362
- /**
363
- * The buffer type
364
- */
365
- readonly type: EventBufferType;
366
- /**
367
- * If the event buffer contains a checkout event.
368
- */
369
- hasCheckout: boolean;
370
- /**
371
- * If the event buffer needs to wait for a checkout event before it
372
- * starts buffering events.
373
- */
374
- waitForCheckout: boolean;
375
- /**
376
- * Destroy the event buffer.
377
- */
378
- destroy(): void;
379
- /**
380
- * Clear the event buffer.
381
- */
382
- clear(): void;
383
- /**
384
- * Add an event to the event buffer.
385
- *
386
- * Returns a promise that resolves if the event was successfully added, else rejects.
387
- */
388
- addEvent(event: RecordingEvent): Promise<AddEventResult>;
389
- /**
390
- * Clears and returns the contents of the buffer.
391
- */
392
- finish(): Promise<ReplayRecordingData>;
393
- /**
394
- * Get the earliest timestamp in ms of any event currently in the buffer.
395
- */
396
- getEarliestTimestamp(): number | null;
397
- }
398
- export type AddUpdateCallback = () => boolean | void;
399
- export interface SendBufferedReplayOptions {
400
- continueRecording?: boolean;
401
- }
402
- export interface ReplayClickDetector {
403
- addListeners(): void;
404
- removeListeners(): void;
405
- /** Handle a click breadcrumb. */
406
- handleClick(breadcrumb: Breadcrumb, node: HTMLElement): void;
407
- /** Register a mutation that happened at a given time. */
408
- registerMutation(timestamp?: number): void;
409
- /** Register a scroll that happened at a given time. */
410
- registerScroll(timestamp?: number): void;
411
- /** Register that a click on an element happened. */
412
- registerClick(element: HTMLElement): void;
413
- }
414
- export interface ReplayContainer {
415
- eventBuffer: EventBuffer | null;
416
- clickDetector: ReplayClickDetector | undefined;
417
- /**
418
- * List of PerformanceEntry from PerformanceObservers.
419
- */
420
- performanceEntries: AllPerformanceEntry[];
421
- /**
422
- * List of already processed performance data, ready to be added to replay.
423
- */
424
- replayPerformanceEntries: ReplayPerformanceEntry<AllPerformanceEntryData>[];
425
- session: Session | undefined;
426
- recordingMode: ReplayRecordingMode;
427
- timeouts: Timeouts;
428
- lastActiveSpan?: Span;
429
- throttledAddEvent: (event: RecordingEvent, isCheckout?: boolean) => typeof THROTTLED | typeof SKIPPED | Promise<AddEventResult | null>;
430
- isEnabled(): boolean;
431
- isPaused(): boolean;
432
- isRecordingCanvas(): boolean;
433
- getContext(): InternalEventContext;
434
- initializeSampling(): void;
435
- start(): void;
436
- stop(options?: {
437
- reason?: ReplayStopReason;
438
- forceFlush?: boolean;
439
- }): Promise<void>;
440
- pause(): void;
441
- resume(): void;
442
- startRecording(): void;
443
- stopRecording(): boolean;
444
- sendBufferedReplayOrFlush(options?: SendBufferedReplayOptions): Promise<void>;
445
- conditionalFlush(): Promise<void>;
446
- flush(): Promise<void>;
447
- flushImmediate(): Promise<void>;
448
- cancelFlush(): void;
449
- triggerUserActivity(): void;
450
- updateUserActivity(): void;
451
- addUpdate(cb: AddUpdateCallback): void;
452
- getOptions(): ReplayPluginOptions;
453
- getSessionId(): string | undefined;
454
- checkAndHandleExpiredSession(): boolean | void;
455
- setInitialState(): void;
456
- getCurrentRoute(): string | undefined;
457
- handleException(err: unknown): void;
458
- }
459
- export type ReplayNetworkRequestData = {
460
- startTimestamp: number;
461
- endTimestamp: number;
462
- url: string;
463
- method?: string;
464
- statusCode: number;
465
- request?: ReplayNetworkRequestOrResponse;
466
- response?: ReplayNetworkRequestOrResponse;
467
- };
468
- export interface SlowClickConfig {
469
- threshold: number;
470
- timeout: number;
471
- scrollTimeout: number;
472
- ignoreSelector: string;
473
- }
474
- export interface ReplayCanvasIntegrationOptions {
475
- enableManualSnapshot?: boolean;
476
- recordCanvas: true;
477
- getCanvasManager: (options: CanvasManagerOptions) => CanvasManagerInterface;
478
- sampling: {
479
- canvas: number;
480
- };
481
- dataURLOptions: {
482
- type: string;
483
- quality: number;
484
- };
485
- }
486
- export {};
487
- //# sourceMappingURL=replay.d.ts.map