@sentry/replay 10.70.0 → 11.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/build/npm/cjs/index.js +12 -12
  2. package/build/npm/cjs/index.js.map +1 -1
  3. package/build/npm/esm/index.js +12 -12
  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,52 +0,0 @@
1
- import { ReplayRecordingData } from '@sentry/core';
2
- import { AddEventResult, EventBuffer, EventBufferType, RecordingEvent } from '../types';
3
- /**
4
- * Event buffer that uses a web worker to compress events.
5
- * Exported only for testing.
6
- */
7
- export declare class EventBufferCompressionWorker implements EventBuffer {
8
- /** @inheritdoc */
9
- hasCheckout: boolean;
10
- /** @inheritdoc */
11
- waitForCheckout: boolean;
12
- private _worker;
13
- private _earliestTimestamp;
14
- private _totalSize;
15
- constructor(worker: Worker);
16
- /*@inheritdoc */
17
- readonly hasEvents: boolean;
18
- /*@inheritdoc */
19
- readonly type: EventBufferType;
20
- /**
21
- * Ensure the worker is ready (or not).
22
- * This will either resolve when the worker is ready, or reject if an error occurred.
23
- */
24
- ensureReady(): Promise<void>;
25
- /**
26
- * Destroy the event buffer.
27
- */
28
- destroy(): void;
29
- /**
30
- * Add an event to the event buffer.
31
- *
32
- * Returns true if event was successfully received and processed by worker.
33
- */
34
- addEvent(event: RecordingEvent): Promise<AddEventResult>;
35
- /**
36
- * Finish the event buffer and return the compressed data.
37
- */
38
- finish(): Promise<ReplayRecordingData>;
39
- /** @inheritdoc */
40
- clear(): void;
41
- /** @inheritdoc */
42
- getEarliestTimestamp(): number | null;
43
- /**
44
- * Send the event to the worker.
45
- */
46
- private _sendEventToWorker;
47
- /**
48
- * Finish the request and return the compressed data from the worker.
49
- */
50
- private _finishRequest;
51
- }
52
- //# sourceMappingURL=EventBufferCompressionWorker.d.ts.map
@@ -1,45 +0,0 @@
1
- import { ReplayRecordingData } from '@sentry/core';
2
- import { AddEventResult, EventBuffer, EventBufferType, RecordingEvent } from '../types';
3
- /**
4
- * This proxy will try to use the compression worker, and fall back to use the simple buffer if an error occurs there.
5
- * This can happen e.g. if the worker cannot be loaded.
6
- * Exported only for testing.
7
- */
8
- export declare class EventBufferProxy implements EventBuffer {
9
- private _fallback;
10
- private _compression;
11
- private _used;
12
- private _ensureWorkerIsLoadedPromise;
13
- constructor(worker: Worker);
14
- /*@inheritdoc
15
- @inheritdoc */
16
- waitForCheckout: boolean;
17
- /*@inheritdoc */
18
- readonly type: EventBufferType;
19
- /*@inheritDoc */
20
- readonly hasEvents: boolean;
21
- /*@inheritdoc
22
- @inheritdoc */
23
- hasCheckout: boolean;
24
- /** @inheritDoc */
25
- destroy(): void;
26
- /** @inheritdoc */
27
- clear(): void;
28
- /** @inheritdoc */
29
- getEarliestTimestamp(): number | null;
30
- /**
31
- * Add an event to the event buffer.
32
- *
33
- * Returns true if event was successfully added.
34
- */
35
- addEvent(event: RecordingEvent): Promise<AddEventResult>;
36
- /** @inheritDoc */
37
- finish(): Promise<ReplayRecordingData>;
38
- /** Ensure the worker has loaded. */
39
- ensureWorkerIsLoaded(): Promise<void>;
40
- /** Actually check if the worker has been loaded. */
41
- private _ensureWorkerIsLoaded;
42
- /** Switch the used buffer to the compression worker. */
43
- private _switchToCompressionWorker;
44
- }
45
- //# sourceMappingURL=EventBufferProxy.d.ts.map
@@ -1,29 +0,0 @@
1
- import { WorkerRequest } from '../types';
2
- /**
3
- * Event buffer that uses a web worker to compress events.
4
- * Exported only for testing.
5
- */
6
- export declare class WorkerHandler {
7
- private _worker;
8
- private _id;
9
- private _ensureReadyPromise?;
10
- private _pending;
11
- constructor(worker: Worker);
12
- /**
13
- * Ensure the worker is ready (or not).
14
- * This will either resolve when the worker is ready, or reject if an error occurred.
15
- */
16
- ensureReady(): Promise<void>;
17
- /**
18
- * Destroy the worker.
19
- */
20
- destroy(): void;
21
- /**
22
- * Post message to worker and wait for response before resolving promise.
23
- */
24
- postMessage<T>(method: WorkerRequest['method'], arg?: WorkerRequest['arg']): Promise<T>;
25
- private _onMessage;
26
- /** Get the current ID and increment it for the next call. */
27
- private _getAndIncrementId;
28
- }
29
- //# sourceMappingURL=WorkerHandler.d.ts.map
@@ -1,5 +0,0 @@
1
- /** This error indicates that the event buffer size exceeded the limit.. */
2
- export declare class EventBufferSizeExceededError extends Error {
3
- constructor();
4
- }
5
- //# sourceMappingURL=error.d.ts.map
@@ -1,11 +0,0 @@
1
- import { EventBuffer, ReplayWorkerURL } from '../types';
2
- interface CreateEventBufferParams {
3
- useCompression: boolean;
4
- workerUrl?: ReplayWorkerURL;
5
- }
6
- /**
7
- * Create an event buffer for replays.
8
- */
9
- export declare function createEventBuffer({ useCompression, workerUrl: customWorkerUrl, }: CreateEventBufferParams): EventBuffer;
10
- export {};
11
- //# sourceMappingURL=index.d.ts.map
@@ -1,4 +0,0 @@
1
- export { replayIntegration } from './integration';
2
- export { ReplayConfiguration, ReplayEventType, ReplayEventWithTime, ReplayBreadcrumbFrame, ReplayBreadcrumbFrameEvent, ReplayOptionFrameEvent, ReplayFrame, ReplayFrameEvent, ReplaySpanFrame, ReplaySpanFrameEvent, CanvasManagerInterface, CanvasManagerOptions, } from './types';
3
- export { getReplay } from './util/getReplay';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,117 +0,0 @@
1
- import { Client, Integration, ReplayRecordingMode, StreamedSpanJSON } from '@sentry/core';
2
- import { ReplayConfiguration, SendBufferedReplayOptions } from './types';
3
- /**
4
- * Instruments the global Request constructor to store the original body.
5
- * This allows us to retrieve the original body value later, since Request
6
- * converts string bodies to ReadableStreams.
7
- */
8
- export declare function _INTERNAL_instrumentRequestInterface(): void;
9
- /**
10
- * Sentry integration for [Session Replay](https://sentry.io/for/session-replay/).
11
- *
12
- * See the [Replay documentation](https://docs.sentry.io/platforms/javascript/guides/session-replay/) for more information.
13
- *
14
- * @example
15
- *
16
- * ```
17
- * Sentry.init({
18
- * dsn: '__DSN__',
19
- * integrations: [Sentry.replayIntegration()],
20
- * });
21
- * ```
22
- */
23
- export declare const replayIntegration: (options?: ReplayConfiguration) => Replay;
24
- /**
25
- * Replay integration
26
- */
27
- export declare class Replay implements Integration {
28
- /**
29
- * @inheritDoc
30
- */
31
- name: string;
32
- /**
33
- * Options to pass to `rrweb.record()`
34
- */
35
- private readonly _recordingOptions;
36
- /**
37
- * Initial options passed to the replay integration, merged with default values.
38
- * Note: `sessionSampleRate` and `errorSampleRate` are not required here, as they
39
- * can only be finally set when setupOnce() is called.
40
- *
41
- * @private
42
- */
43
- private readonly _initialOptions;
44
- private _replay?;
45
- constructor({ flushMinDelay, flushMaxDelay, minReplayDuration, maxReplayDuration, stickySession, useCompression, workerUrl, _experiments, maskAllText, maskAllInputs, blockAllMedia, mutationBreadcrumbLimit, mutationLimit, slowClickTimeout, slowClickIgnoreSelectors, networkDetailAllowUrls, networkDetailDenyUrls, networkCaptureBodies, networkRequestHeaders, networkResponseHeaders, mask, maskAttributes, unmask, block, unblock, ignore, maskFn, beforeAddRecordingEvent, beforeErrorSampling, onError, attachRawBodyFromRequest, }?: ReplayConfiguration);
46
- /*If replay has already been initialized
47
- Update _isInitialized */
48
- protected _isInitialized: boolean;
49
- /**
50
- * Setup and initialize replay container
51
- */
52
- afterAllSetup(client: Client): void;
53
- /**
54
- * Start a replay regardless of sampling rate. Calling this will always
55
- * create a new session. Will log a message if replay is already in progress.
56
- *
57
- * Creates or loads a session, attaches listeners to varying events (DOM,
58
- * PerformanceObserver, Recording, Sentry SDK, etc)
59
- */
60
- start(): void;
61
- /**
62
- * Start replay buffering. Buffers until `flush()` is called or, if
63
- * `replaysOnErrorSampleRate` > 0, until an error occurs.
64
- */
65
- startBuffering(): void;
66
- /**
67
- * Currently, this needs to be manually called (e.g. for tests). Sentry SDK
68
- * does not support a teardown
69
- *
70
- * @param options.flush - Whether to flush the pending replay segment when stopping.
71
- * When recording in `session` mode, `stop()` flushes the buffered-but-unsent segment by
72
- * default (`flush: true`), matching the previous behavior. Pass `flush: false` to stop
73
- * recording without sending that pending segment — useful when a user withdraws consent
74
- * and no further data should leave the browser.
75
- *
76
- * Note: `flush: false` only prevents the *pending* (final) segment from being sent. It does
77
- * **not** retract segments that were already sent earlier during `session` recording.
78
- */
79
- stop(options?: {
80
- flush?: boolean;
81
- }): Promise<void>;
82
- /**
83
- * If not in "session" recording mode, flush event buffer which will create a new replay.
84
- * If replay is not enabled, a new session replay is started.
85
- * Unless `continueRecording` is false, the replay will continue to record and
86
- * behave as a "session"-based replay.
87
- *
88
- * Otherwise, queue up a flush.
89
- */
90
- flush(options?: SendBufferedReplayOptions): Promise<void>;
91
- /**
92
- * Get the current session ID.
93
- *
94
- * @param onlyIfSampled - If true, will only return the session ID if the session is sampled.
95
- *
96
- */
97
- getReplayId(onlyIfSampled?: boolean): string | undefined;
98
- /**
99
- * Get the current recording mode. This can be either `session` or `buffer`.
100
- *
101
- * `session`: Recording the whole session, sending it continuously
102
- * `buffer`: Always keeping the last 60s of recording, requires:
103
- * - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs
104
- * - or calling `flush()` to send the replay
105
- */
106
- getRecordingMode(): ReplayRecordingMode | undefined;
107
- processSpan(span: StreamedSpanJSON): void;
108
- /**
109
- * Initializes replay.
110
- */
111
- protected _initialize(client: Client): void;
112
- /** Setup the integration. */
113
- private _setup;
114
- /** Get canvas options from ReplayCanvas integration, if it is also added. */
115
- private _maybeLoadFromReplayCanvasIntegration;
116
- }
117
- //# sourceMappingURL=integration.d.ts.map
@@ -1,320 +0,0 @@
1
- import { ReplayRecordingMode, ReplayStopReason, Span } from '@sentry/core';
2
- import { ClickDetector } from './coreHandlers/handleClick';
3
- import { AddEventResult, AddUpdateCallback, AllPerformanceEntry, AllPerformanceEntryData, EventBuffer, InternalEventContext, RecordingEvent, RecordingOptions, ReplayContainer as ReplayContainerInterface, ReplayPerformanceEntry, ReplayPluginOptions, SendBufferedReplayOptions, Session, Timeouts } from './types';
4
- import { SKIPPED } from './util/throttle';
5
- import { THROTTLED } from './util/throttle';
6
- /**
7
- * The main replay container class, which holds all the state and methods for recording and sending replays.
8
- */
9
- export declare class ReplayContainer implements ReplayContainerInterface {
10
- eventBuffer: EventBuffer | null;
11
- performanceEntries: AllPerformanceEntry[];
12
- replayPerformanceEntries: ReplayPerformanceEntry<AllPerformanceEntryData>[];
13
- session: Session | undefined;
14
- clickDetector: ClickDetector | undefined;
15
- /**
16
- * Recording can happen in one of two modes:
17
- * - session: Record the whole session, sending it continuously
18
- * - buffer: Always keep the last 60s of recording, requires:
19
- * - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs
20
- * - or calling `flush()` to send the replay
21
- */
22
- recordingMode: ReplayRecordingMode;
23
- /**
24
- * The current or last active span.
25
- * This is only available when performance is enabled.
26
- */
27
- lastActiveSpan?: Span;
28
- /**
29
- * These are here so we can overwrite them in tests etc.
30
- * @hidden
31
- */
32
- readonly timeouts: Timeouts;
33
- /** The replay has to be manually started, because no sample rate (neither session or error) was provided. */
34
- private _requiresManualStart;
35
- private _throttledAddEvent;
36
- /**
37
- * Options to pass to `rrweb.record()`
38
- */
39
- private readonly _recordingOptions;
40
- private readonly _options;
41
- private _performanceCleanupCallback?;
42
- private _debouncedFlush;
43
- private _flushLock;
44
- /**
45
- * Timestamp of the last user activity. This lives across sessions.
46
- */
47
- private _lastActivity;
48
- /**
49
- * Is the integration currently active?
50
- */
51
- private _isEnabled;
52
- /**
53
- * Paused is a state where:
54
- * - DOM Recording is not listening at all
55
- * - Nothing will be added to event buffer (e.g. core SDK events)
56
- */
57
- private _isPaused;
58
- /**
59
- * Have we attached listeners to the core SDK?
60
- * Note we have to track this as there is no way to remove instrumentation handlers.
61
- */
62
- private _hasInitializedCoreListeners;
63
- /**
64
- * Function to stop recording
65
- */
66
- private _stopRecording;
67
- private _context;
68
- /**
69
- * Internal use for canvas recording options
70
- */
71
- private _canvas;
72
- /**
73
- * Handle when visibility of the page content changes. Opening a new tab will
74
- * cause the state to change to hidden because of content of current page will
75
- * be hidden. Likewise, moving a different window to cover the contents of the
76
- * page will also trigger a change to a hidden state.
77
- */
78
- private _handleVisibilityChange;
79
- /**
80
- * Handle when page is blurred
81
- */
82
- private _handleWindowBlur;
83
- /**
84
- * Handle when page is focused
85
- */
86
- private _handleWindowFocus;
87
- /** Ensure page remains active when a key is pressed. */
88
- private _handleKeyboardEvent;
89
- constructor({ options, recordingOptions, }: {
90
- options: ReplayPluginOptions;
91
- recordingOptions: RecordingOptions;
92
- });
93
- /** Get the event context. */
94
- getContext(): InternalEventContext;
95
- /** If recording is currently enabled. */
96
- isEnabled(): boolean;
97
- /** If recording is currently paused. */
98
- isPaused(): boolean;
99
- /**
100
- * Determine if canvas recording is enabled
101
- */
102
- isRecordingCanvas(): boolean;
103
- /** Get the replay integration options. */
104
- getOptions(): ReplayPluginOptions;
105
- /** A wrapper to conditionally capture exceptions. */
106
- handleException(error: unknown): void;
107
- /**
108
- * Initializes the plugin based on sampling configuration. Should not be
109
- * called outside of constructor.
110
- */
111
- initializeSampling(previousSessionId?: string): void;
112
- /**
113
- * Start a replay regardless of sampling rate. Calling this will always
114
- * create a new session. Will log a message if replay is already in progress.
115
- *
116
- * Creates or loads a session, attaches listeners to varying events (DOM,
117
- * _performanceObserver, Recording, Sentry SDK, etc)
118
- */
119
- start(): void;
120
- /**
121
- * Start replay buffering. Buffers until `flush()` is called or, if
122
- * `replaysOnErrorSampleRate` > 0, an error occurs.
123
- */
124
- startBuffering(): void;
125
- /**
126
- * Start recording.
127
- *
128
- * Note that this will cause a new DOM checkout
129
- */
130
- startRecording(): void;
131
- /**
132
- * Stops the recording, if it was running.
133
- *
134
- * Returns true if it was previously stopped, or is now stopped,
135
- * otherwise false.
136
- */
137
- stopRecording(): boolean;
138
- /**
139
- * Currently, this needs to be manually called (e.g. for tests). Sentry SDK
140
- * does not support a teardown
141
- */
142
- stop({ forceFlush, reason, }?: {
143
- forceFlush?: boolean;
144
- reason?: ReplayStopReason;
145
- }): Promise<void>;
146
- /**
147
- * Pause some replay functionality. See comments for `_isPaused`.
148
- * This differs from stop as this only stops DOM recording, it is
149
- * not as thorough of a shutdown as `stop()`.
150
- */
151
- pause(): void;
152
- /**
153
- * Resumes recording, see notes for `pause().
154
- *
155
- * Note that calling `startRecording()` here will cause a
156
- * new DOM checkout.`
157
- */
158
- resume(): void;
159
- /**
160
- * If not in "session" recording mode, flush event buffer which will create a new replay.
161
- * Unless `continueRecording` is false, the replay will continue to record and
162
- * behave as a "session"-based replay.
163
- *
164
- * Otherwise, queue up a flush.
165
- */
166
- sendBufferedReplayOrFlush({ continueRecording }?: SendBufferedReplayOptions): Promise<void>;
167
- /**
168
- * We want to batch uploads of replay events. Save events only if
169
- * `<flushMinDelay>` milliseconds have elapsed since the last event
170
- * *OR* if `<flushMaxDelay>` milliseconds have elapsed.
171
- *
172
- * Accepts a callback to perform side-effects and returns true to stop batch
173
- * processing and hand back control to caller.
174
- */
175
- addUpdate(cb: AddUpdateCallback): void;
176
- /**
177
- * Updates the user activity timestamp and resumes recording. This should be
178
- * called in an event handler for a user action that we consider as the user
179
- * being "active" (e.g. a mouse click).
180
- */
181
- triggerUserActivity(): void;
182
- /**
183
- * Updates the user activity timestamp *without* resuming
184
- * recording. Some user events (e.g. keydown) can be create
185
- * low-value replays that only contain the keypress as a
186
- * breadcrumb. Instead this would require other events to
187
- * create a new replay after a session has expired.
188
- */
189
- updateUserActivity(): void;
190
- /**
191
- * Only flush if `this.recordingMode === 'session'`
192
- */
193
- conditionalFlush(): Promise<void>;
194
- /**
195
- * Flush using debounce flush
196
- */
197
- flush(): Promise<void>;
198
- /**
199
- * Always flush via `_debouncedFlush` so that we do not have flushes triggered
200
- * from calling both `flush` and `_debouncedFlush`. Otherwise, there could be
201
- * cases of multiple flushes happening closely together.
202
- */
203
- flushImmediate(): Promise<void>;
204
- /**
205
- * Cancels queued up flushes.
206
- */
207
- cancelFlush(): void;
208
- /** Get the current session (=replay) ID
209
- *
210
- * @param onlyIfSampled - If true, will only return the session ID if the session is sampled.
211
- */
212
- getSessionId(onlyIfSampled?: boolean): string | undefined;
213
- /**
214
- * Checks if recording should be stopped due to user inactivity. Otherwise
215
- * check if session is expired and create a new session if so. Triggers a new
216
- * full snapshot on new session.
217
- *
218
- * Returns true if session is not expired, false otherwise.
219
- * @hidden
220
- */
221
- checkAndHandleExpiredSession(): boolean | void;
222
- /**
223
- * Capture some initial state that can change throughout the lifespan of the
224
- * replay. This is required because otherwise they would be captured at the
225
- * first flush.
226
- */
227
- setInitialState(): void;
228
- /**
229
- * Add a breadcrumb event, that may be throttled.
230
- * If it was throttled, we add a custom breadcrumb to indicate that.
231
- */
232
- throttledAddEvent(event: RecordingEvent, isCheckout?: boolean): typeof THROTTLED | typeof SKIPPED | Promise<AddEventResult | null>;
233
- /**
234
- * This will get the parametrized route name of the current page.
235
- * This is only available if performance is enabled, and if an instrumented router is used.
236
- */
237
- getCurrentRoute(): string | undefined;
238
- /**
239
- * Initialize and start all listeners to varying events (DOM,
240
- * Performance Observer, Recording, Sentry SDK, etc)
241
- */
242
- private _initializeRecording;
243
- /**
244
- * Loads (or refreshes) the current session.
245
- */
246
- private _initializeSessionForSampling;
247
- /**
248
- * Checks and potentially refreshes the current session.
249
- * Returns false if session is not recorded.
250
- */
251
- private _checkSession;
252
- /**
253
- * Refresh a session with a new one.
254
- * This stops the current session (without forcing a flush, as that would never work since we are expired),
255
- * and then does a new sampling based on the refreshed session.
256
- */
257
- private _refreshSession;
258
- /**
259
- * Adds listeners to record events for the replay
260
- */
261
- private _addListeners;
262
- /**
263
- * Cleans up listeners that were created in `_addListeners`
264
- */
265
- private _removeListeners;
266
- /**
267
- * Tasks to run when we consider a page to be hidden (via blurring and/or visibility)
268
- */
269
- private _doChangeToBackgroundTasks;
270
- /**
271
- * Tasks to run when we consider a page to be visible (via focus and/or visibility)
272
- */
273
- private _doChangeToForegroundTasks;
274
- /**
275
- * Update user activity (across session lifespans)
276
- */
277
- private _updateUserActivity;
278
- /**
279
- * Updates the session's last activity timestamp
280
- */
281
- private _updateSessionActivity;
282
- /**
283
- * Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb
284
- */
285
- private _createCustomBreadcrumb;
286
- /**
287
- * Observed performance events are added to `this.performanceEntries`. These
288
- * are included in the replay event before it is finished and sent to Sentry.
289
- */
290
- private _addPerformanceEntries;
291
- /**
292
- * Clear _context
293
- */
294
- private _clearContext;
295
- /** Update the initial timestamp based on the buffer content. */
296
- private _updateInitialTimestampFromEventBuffer;
297
- /**
298
- * Return and clear _context
299
- */
300
- private _popEventContext;
301
- /**
302
- * Flushes replay event buffer to Sentry.
303
- *
304
- * Performance events are only added right before flushing - this is
305
- * due to the buffered performance observer events.
306
- *
307
- * Should never be called directly, only by `flush`
308
- */
309
- private _runFlush;
310
- /**
311
- * Flush recording data to Sentry. Creates a lock so that only a single flush
312
- * can be active at a time. Do not call this directly.
313
- */
314
- private _flush;
315
- /** Save the session, if it is sticky */
316
- private _maybeSaveSession;
317
- /** Handler for rrweb.record.onMutation */
318
- private _onMutationHandler;
319
- }
320
- //# sourceMappingURL=replay.d.ts.map
@@ -1,8 +0,0 @@
1
- import { Sampled, Session } from '../types';
2
- /**
3
- * Get a session with defaults & applied sampling.
4
- */
5
- export declare function makeSession(session: Partial<Session> & {
6
- sampled: Sampled;
7
- }): Session;
8
- //# sourceMappingURL=Session.d.ts.map
@@ -1,6 +0,0 @@
1
- import { ReplayContainer } from '../../src/types';
2
- /**
3
- * Removes the session from Session Storage and unsets session in replay instance
4
- */
5
- export declare function clearSession(replay: ReplayContainer): void;
6
- //# sourceMappingURL=clearSession.d.ts.map
@@ -1,14 +0,0 @@
1
- import { Sampled, Session, SessionOptions } from '../types';
2
- /**
3
- * Get the sampled status for a session based on sample rates & current sampled status.
4
- */
5
- export declare function getSessionSampleType(sessionSampleRate: number, allowBuffering: boolean): Sampled;
6
- /**
7
- * Create a new session, which in its current implementation is a Sentry event
8
- * that all replays will be saved to as attachments. Currently, we only expect
9
- * one of these Sentry events per "replay session".
10
- */
11
- export declare function createSession({ sessionSampleRate, allowBuffering, stickySession }: SessionOptions, { previousSessionId }?: {
12
- previousSessionId?: string;
13
- }): Session;
14
- //# sourceMappingURL=createSession.d.ts.map
@@ -1,6 +0,0 @@
1
- import { Session } from '../types';
2
- /**
3
- * Fetches a session from storage
4
- */
5
- export declare function fetchSession(): Session | null;
6
- //# sourceMappingURL=fetchSession.d.ts.map
@@ -1,11 +0,0 @@
1
- import { Session, SessionOptions } from '../types';
2
- /**
3
- * Get or create a session, when initializing the replay.
4
- * Returns a session that may be unsampled.
5
- */
6
- export declare function loadOrCreateSession({ sessionIdleExpire, maxReplayDuration, previousSessionId, }: {
7
- sessionIdleExpire: number;
8
- maxReplayDuration: number;
9
- previousSessionId?: string;
10
- }, sessionOptions: SessionOptions): Session;
11
- //# sourceMappingURL=loadOrCreateSession.d.ts.map
@@ -1,6 +0,0 @@
1
- import { Session } from '../types';
2
- /**
3
- * Save a session to session storage.
4
- */
5
- export declare function saveSession(session: Session): void;
6
- //# sourceMappingURL=saveSession.d.ts.map
@@ -1,7 +0,0 @@
1
- import { Session } from '../types';
2
- /** If the session should be refreshed or not. */
3
- export declare function shouldRefreshSession(session: Session, { sessionIdleExpire, maxReplayDuration }: {
4
- sessionIdleExpire: number;
5
- maxReplayDuration: number;
6
- }): boolean;
7
- //# sourceMappingURL=shouldRefreshSession.d.ts.map
@@ -1,6 +0,0 @@
1
- export * from './performance';
2
- export * from './replay';
3
- export * from './replayFrame';
4
- export * from './request';
5
- export * from './rrweb';
6
- //# sourceMappingURL=index.d.ts.map