@sentry/replay 7.67.0-beta.0 → 7.68.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 (103) hide show
  1. package/cjs/index.js +1112 -2286
  2. package/cjs/index.js.map +1 -1
  3. package/esm/index.js +1112 -2286
  4. package/esm/index.js.map +1 -1
  5. package/package.json +8 -8
  6. package/types/constants.d.ts +2 -3
  7. package/types/constants.d.ts.map +1 -1
  8. package/types/coreHandlers/handleDom.d.ts +2 -1
  9. package/types/coreHandlers/handleDom.d.ts.map +1 -1
  10. package/types/integration.d.ts +1 -1
  11. package/types/integration.d.ts.map +1 -1
  12. package/types/replay.d.ts +1 -7
  13. package/types/replay.d.ts.map +1 -1
  14. package/types/session/Session.d.ts.map +1 -1
  15. package/types/session/loadOrCreateSession.d.ts +4 -4
  16. package/types/session/loadOrCreateSession.d.ts.map +1 -1
  17. package/types/session/maybeRefreshSession.d.ts +12 -0
  18. package/types/session/maybeRefreshSession.d.ts.map +1 -0
  19. package/types/types/replay.d.ts +11 -7
  20. package/types/types/replay.d.ts.map +1 -1
  21. package/types/util/getPrivacyOptions.d.ts +2 -0
  22. package/types/util/getPrivacyOptions.d.ts.map +1 -1
  23. package/types/util/isSessionExpired.d.ts +6 -2
  24. package/types/util/isSessionExpired.d.ts.map +1 -1
  25. package/types-ts3.8/constants.d.ts +25 -0
  26. package/types-ts3.8/coreHandlers/handleAfterSendEvent.d.ts +9 -0
  27. package/types-ts3.8/coreHandlers/handleClick.d.ts +39 -0
  28. package/types-ts3.8/coreHandlers/handleDom.d.ts +13 -0
  29. package/types-ts3.8/coreHandlers/handleFetch.d.ts +9 -0
  30. package/types-ts3.8/coreHandlers/handleGlobalEvent.d.ts +7 -0
  31. package/types-ts3.8/coreHandlers/handleHistory.d.ts +11 -0
  32. package/types-ts3.8/coreHandlers/handleKeyboardEvent.d.ts +7 -0
  33. package/types-ts3.8/coreHandlers/handleNetworkBreadcrumbs.d.ts +17 -0
  34. package/types-ts3.8/coreHandlers/handleScope.d.ts +13 -0
  35. package/types-ts3.8/coreHandlers/handleXhr.d.ts +9 -0
  36. package/types-ts3.8/coreHandlers/performanceObserver.d.ts +6 -0
  37. package/types-ts3.8/coreHandlers/util/addBreadcrumbEvent.d.ts +7 -0
  38. package/types-ts3.8/coreHandlers/util/addNetworkBreadcrumb.d.ts +4 -0
  39. package/types-ts3.8/coreHandlers/util/domUtils.d.ts +19 -0
  40. package/types-ts3.8/coreHandlers/util/fetchUtils.d.ts +23 -0
  41. package/types-ts3.8/coreHandlers/util/getAttributesToRecord.d.ts +5 -0
  42. package/types-ts3.8/coreHandlers/util/networkUtils.d.ts +23 -0
  43. package/types-ts3.8/coreHandlers/util/onWindowOpen.d.ts +8 -0
  44. package/types-ts3.8/coreHandlers/util/shouldSampleForBufferEvent.d.ts +9 -0
  45. package/types-ts3.8/coreHandlers/util/xhrUtils.d.ts +22 -0
  46. package/types-ts3.8/eventBuffer/EventBufferArray.d.ts +28 -0
  47. package/types-ts3.8/eventBuffer/EventBufferCompressionWorker.d.ts +50 -0
  48. package/types-ts3.8/eventBuffer/EventBufferProxy.d.ts +42 -0
  49. package/types-ts3.8/eventBuffer/WorkerHandler.d.ts +27 -0
  50. package/types-ts3.8/eventBuffer/error.d.ts +5 -0
  51. package/types-ts3.8/eventBuffer/index.d.ts +10 -0
  52. package/types-ts3.8/index.d.ts +4 -0
  53. package/types-ts3.8/integration.d.ts +73 -0
  54. package/types-ts3.8/replay.d.ts +308 -0
  55. package/types-ts3.8/session/Session.d.ts +8 -0
  56. package/types-ts3.8/session/clearSession.d.ts +6 -0
  57. package/types-ts3.8/session/createSession.d.ts +14 -0
  58. package/types-ts3.8/session/fetchSession.d.ts +6 -0
  59. package/types-ts3.8/session/index.d.ts +2 -0
  60. package/types-ts3.8/session/loadOrCreateSession.d.ts +11 -0
  61. package/types-ts3.8/session/maybeRefreshSession.d.ts +12 -0
  62. package/types-ts3.8/session/saveSession.d.ts +6 -0
  63. package/types-ts3.8/types/deprecated.d.ts +16 -0
  64. package/types-ts3.8/types/index.d.ts +6 -0
  65. package/types-ts3.8/types/performance.d.ts +124 -0
  66. package/types-ts3.8/types/replay.d.ts +422 -0
  67. package/types-ts3.8/types/replayFrame.d.ts +173 -0
  68. package/types-ts3.8/types/request.d.ts +15 -0
  69. package/types-ts3.8/types/rrweb.d.ts +37 -0
  70. package/types-ts3.8/util/addEvent.d.ts +7 -0
  71. package/types-ts3.8/util/addGlobalListeners.d.ts +6 -0
  72. package/types-ts3.8/util/addMemoryEntry.d.ts +7 -0
  73. package/types-ts3.8/util/createBreadcrumb.d.ts +6 -0
  74. package/types-ts3.8/util/createPerformanceEntries.d.ts +6 -0
  75. package/types-ts3.8/util/createPerformanceSpans.d.ts +6 -0
  76. package/types-ts3.8/util/createReplayEnvelope.d.ts +7 -0
  77. package/types-ts3.8/util/debounce.d.ts +30 -0
  78. package/types-ts3.8/util/dedupePerformanceEntries.d.ts +11 -0
  79. package/types-ts3.8/util/eventUtils.d.ts +8 -0
  80. package/types-ts3.8/util/getPrivacyOptions.d.ts +19 -0
  81. package/types-ts3.8/util/handleRecordingEmit.d.ts +14 -0
  82. package/types-ts3.8/util/hasSessionStorage.d.ts +3 -0
  83. package/types-ts3.8/util/isBrowser.d.ts +5 -0
  84. package/types-ts3.8/util/isExpired.d.ts +6 -0
  85. package/types-ts3.8/util/isRrwebError.d.ts +6 -0
  86. package/types-ts3.8/util/isSampled.d.ts +8 -0
  87. package/types-ts3.8/util/isSessionExpired.d.ts +10 -0
  88. package/types-ts3.8/util/log.d.ts +10 -0
  89. package/types-ts3.8/util/prepareRecordingData.d.ts +9 -0
  90. package/types-ts3.8/util/prepareReplayEvent.d.ts +15 -0
  91. package/types-ts3.8/util/sendReplay.d.ts +9 -0
  92. package/types-ts3.8/util/sendReplayRequest.d.ts +13 -0
  93. package/types-ts3.8/util/shouldFilterRequest.d.ts +7 -0
  94. package/types-ts3.8/util/throttle.d.ts +12 -0
  95. package/types-ts3.8/util/timestamp.d.ts +9 -0
  96. package/types-ts3.8/util/truncateJson/completeJson.d.ts +9 -0
  97. package/types-ts3.8/util/truncateJson/constants.d.ts +12 -0
  98. package/types-ts3.8/util/truncateJson/evaluateJson.d.ts +6 -0
  99. package/types-ts3.8/util/truncateJson/fixJson.d.ts +6 -0
  100. package/types/session/shouldRefreshSession.d.ts +0 -4
  101. package/types/session/shouldRefreshSession.d.ts.map +0 -1
  102. package/types/util/maskAttribute.d.ts +0 -15
  103. package/types/util/maskAttribute.d.ts.map +0 -1
@@ -0,0 +1,22 @@
1
+ import { Breadcrumb, TextEncoderInternal, XhrBreadcrumbData } from '@sentry/types';
2
+ import { ReplayContainer, ReplayNetworkOptions, XhrHint } from '../../types';
3
+ /**
4
+ * Capture an XHR breadcrumb to a replay.
5
+ * This adds additional data (where approriate).
6
+ */
7
+ export declare function captureXhrBreadcrumbToReplay(breadcrumb: Breadcrumb & {
8
+ data: XhrBreadcrumbData;
9
+ }, hint: XhrHint, options: ReplayNetworkOptions & {
10
+ replay: ReplayContainer;
11
+ }): Promise<void>;
12
+ /**
13
+ * Enrich a breadcrumb with additional data.
14
+ * This has to be sync & mutate the given breadcrumb,
15
+ * as the breadcrumb is afterwards consumed by other handlers.
16
+ */
17
+ export declare function enrichXhrBreadcrumb(breadcrumb: Breadcrumb & {
18
+ data: XhrBreadcrumbData;
19
+ }, hint: XhrHint, options: {
20
+ textEncoder: TextEncoderInternal;
21
+ }): void;
22
+ //# sourceMappingURL=xhrUtils.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { AddEventResult, EventBuffer, EventBufferType, RecordingEvent } from '../types';
2
+ /**
3
+ * A basic event buffer that does not do any compression.
4
+ * Used as fallback if the compression worker cannot be loaded or is disabled.
5
+ */
6
+ export declare class EventBufferArray implements EventBuffer {
7
+ /** All the events that are buffered to be sent. */
8
+ events: RecordingEvent[];
9
+ /** @inheritdoc */
10
+ hasCheckout: boolean;
11
+ private _totalSize;
12
+ constructor();
13
+ /*@inheritdoc */
14
+ readonly hasEvents: boolean;
15
+ /*@inheritdoc */
16
+ readonly type: EventBufferType;
17
+ /** @inheritdoc */
18
+ destroy(): void;
19
+ /** @inheritdoc */
20
+ addEvent(event: RecordingEvent): Promise<AddEventResult>;
21
+ /** @inheritdoc */
22
+ finish(): Promise<string>;
23
+ /** @inheritdoc */
24
+ clear(): void;
25
+ /** @inheritdoc */
26
+ getEarliestTimestamp(): number | null;
27
+ }
28
+ //# sourceMappingURL=EventBufferArray.d.ts.map
@@ -0,0 +1,50 @@
1
+ import { ReplayRecordingData } from '@sentry/types';
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
+ private _worker;
11
+ private _earliestTimestamp;
12
+ private _totalSize;
13
+ constructor(worker: Worker);
14
+ /*@inheritdoc */
15
+ readonly hasEvents: boolean;
16
+ /*@inheritdoc */
17
+ readonly type: EventBufferType;
18
+ /**
19
+ * Ensure the worker is ready (or not).
20
+ * This will either resolve when the worker is ready, or reject if an error occured.
21
+ */
22
+ ensureReady(): Promise<void>;
23
+ /**
24
+ * Destroy the event buffer.
25
+ */
26
+ destroy(): void;
27
+ /**
28
+ * Add an event to the event buffer.
29
+ *
30
+ * Returns true if event was successfuly received and processed by worker.
31
+ */
32
+ addEvent(event: RecordingEvent): Promise<AddEventResult>;
33
+ /**
34
+ * Finish the event buffer and return the compressed data.
35
+ */
36
+ finish(): Promise<ReplayRecordingData>;
37
+ /** @inheritdoc */
38
+ clear(): void;
39
+ /** @inheritdoc */
40
+ getEarliestTimestamp(): number | null;
41
+ /**
42
+ * Send the event to the worker.
43
+ */
44
+ private _sendEventToWorker;
45
+ /**
46
+ * Finish the request and return the compressed data from the worker.
47
+ */
48
+ private _finishRequest;
49
+ }
50
+ //# sourceMappingURL=EventBufferCompressionWorker.d.ts.map
@@ -0,0 +1,42 @@
1
+ import { ReplayRecordingData } from '@sentry/types';
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
+ readonly type: EventBufferType;
16
+ /*@inheritDoc */
17
+ readonly hasEvents: boolean;
18
+ /*@inheritdoc
19
+ @inheritdoc */
20
+ hasCheckout: boolean;
21
+ /** @inheritDoc */
22
+ destroy(): void;
23
+ /** @inheritdoc */
24
+ clear(): void;
25
+ /** @inheritdoc */
26
+ getEarliestTimestamp(): number | null;
27
+ /**
28
+ * Add an event to the event buffer.
29
+ *
30
+ * Returns true if event was successfully added.
31
+ */
32
+ addEvent(event: RecordingEvent): Promise<AddEventResult>;
33
+ /** @inheritDoc */
34
+ finish(): Promise<ReplayRecordingData>;
35
+ /** Ensure the worker has loaded. */
36
+ ensureWorkerIsLoaded(): Promise<void>;
37
+ /** Actually check if the worker has been loaded. */
38
+ private _ensureWorkerIsLoaded;
39
+ /** Switch the used buffer to the compression worker. */
40
+ private _switchToCompressionWorker;
41
+ }
42
+ //# sourceMappingURL=EventBufferProxy.d.ts.map
@@ -0,0 +1,27 @@
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
+ constructor(worker: Worker);
11
+ /**
12
+ * Ensure the worker is ready (or not).
13
+ * This will either resolve when the worker is ready, or reject if an error occured.
14
+ */
15
+ ensureReady(): Promise<void>;
16
+ /**
17
+ * Destroy the worker.
18
+ */
19
+ destroy(): void;
20
+ /**
21
+ * Post message to worker and wait for response before resolving promise.
22
+ */
23
+ postMessage<T>(method: WorkerRequest['method'], arg?: WorkerRequest['arg']): Promise<T>;
24
+ /** Get the current ID and increment it for the next call. */
25
+ private _getAndIncrementId;
26
+ }
27
+ //# sourceMappingURL=WorkerHandler.d.ts.map
@@ -0,0 +1,5 @@
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
@@ -0,0 +1,10 @@
1
+ import { EventBuffer } from '../types';
2
+ interface CreateEventBufferParams {
3
+ useCompression: boolean;
4
+ }
5
+ /**
6
+ * Create an event buffer for replays.
7
+ */
8
+ export declare function createEventBuffer({ useCompression }: CreateEventBufferParams): EventBuffer;
9
+ export {};
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ export { Replay } from './integration';
2
+ export { ReplayEventType, ReplayEventWithTime, ReplayBreadcrumbFrame, ReplayBreadcrumbFrameEvent, ReplayOptionFrameEvent, ReplayFrame, ReplayFrameEvent, ReplaySpanFrame, ReplaySpanFrameEvent, } from './types';
3
+ export * from './types/deprecated';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,73 @@
1
+ import { Integration } from '@sentry/types';
2
+ import { ReplayConfiguration, SendBufferedReplayOptions } from './types';
3
+ /**
4
+ * The main replay integration class, to be passed to `init({ integrations: [] })`.
5
+ */
6
+ export declare class Replay implements Integration {
7
+ /**
8
+ * @inheritDoc
9
+ */
10
+ static id: string;
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ name: string;
15
+ /**
16
+ * Options to pass to `rrweb.record()`
17
+ */
18
+ private readonly _recordingOptions;
19
+ /**
20
+ * Initial options passed to the replay integration, merged with default values.
21
+ * Note: `sessionSampleRate` and `errorSampleRate` are not required here, as they
22
+ * can only be finally set when setupOnce() is called.
23
+ *
24
+ * @private
25
+ */
26
+ private readonly _initialOptions;
27
+ private _replay?;
28
+ constructor({ flushMinDelay, flushMaxDelay, minReplayDuration, maxReplayDuration, stickySession, useCompression, _experiments, sessionSampleRate, errorSampleRate, maskAllText, maskAllInputs, blockAllMedia, mutationBreadcrumbLimit, mutationLimit, slowClickTimeout, slowClickIgnoreSelectors, networkDetailAllowUrls, networkDetailDenyUrls, networkCaptureBodies, networkRequestHeaders, networkResponseHeaders, mask, unmask, block, unblock, ignore, maskFn, beforeAddRecordingEvent, blockClass, blockSelector, maskInputOptions, maskTextClass, maskTextSelector, ignoreClass, }?: ReplayConfiguration);
29
+ /*If replay has already been initialized
30
+ Update _isInitialized */
31
+ protected _isInitialized: boolean;
32
+ /**
33
+ * Setup and initialize replay container
34
+ */
35
+ setupOnce(): void;
36
+ /**
37
+ * Start a replay regardless of sampling rate. Calling this will always
38
+ * create a new session. Will throw an error if replay is already in progress.
39
+ *
40
+ * Creates or loads a session, attaches listeners to varying events (DOM,
41
+ * PerformanceObserver, Recording, Sentry SDK, etc)
42
+ */
43
+ start(): void;
44
+ /**
45
+ * Start replay buffering. Buffers until `flush()` is called or, if
46
+ * `replaysOnErrorSampleRate` > 0, until an error occurs.
47
+ */
48
+ startBuffering(): void;
49
+ /**
50
+ * Currently, this needs to be manually called (e.g. for tests). Sentry SDK
51
+ * does not support a teardown
52
+ */
53
+ stop(): Promise<void>;
54
+ /**
55
+ * If not in "session" recording mode, flush event buffer which will create a new replay.
56
+ * Unless `continueRecording` is false, the replay will continue to record and
57
+ * behave as a "session"-based replay.
58
+ *
59
+ * Otherwise, queue up a flush.
60
+ */
61
+ flush(options?: SendBufferedReplayOptions): Promise<void>;
62
+ /**
63
+ * Get the current session ID.
64
+ */
65
+ getReplayId(): string | undefined;
66
+ /**
67
+ * Initializes replay.
68
+ */
69
+ protected _initialize(): void;
70
+ /** Setup the integration. */
71
+ private _setup;
72
+ }
73
+ //# sourceMappingURL=integration.d.ts.map
@@ -0,0 +1,308 @@
1
+ import { ReplayRecordingMode, Transaction } from '@sentry/types';
2
+ import { ClickDetector } from './coreHandlers/handleClick';
3
+ import { AddEventResult, AddUpdateCallback, AllPerformanceEntry, EventBuffer, InternalEventContext, RecordingEvent, RecordingOptions, ReplayContainer as ReplayContainerInterface, 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
+ /**
12
+ * List of PerformanceEntry from PerformanceObserver
13
+ */
14
+ performanceEvents: AllPerformanceEntry[];
15
+ session: Session | undefined;
16
+ clickDetector: ClickDetector | undefined;
17
+ /**
18
+ * Recording can happen in one of three modes:
19
+ * - session: Record the whole session, sending it continuously
20
+ * - buffer: Always keep the last 60s of recording, requires:
21
+ * - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs
22
+ * - or calling `flush()` to send the replay
23
+ */
24
+ recordingMode: ReplayRecordingMode;
25
+ /**
26
+ * The current or last active transcation.
27
+ * This is only available when performance is enabled.
28
+ */
29
+ lastTransaction?: Transaction;
30
+ /**
31
+ * These are here so we can overwrite them in tests etc.
32
+ * @hidden
33
+ */
34
+ readonly timeouts: Timeouts;
35
+ private _throttledAddEvent;
36
+ /**
37
+ * Options to pass to `rrweb.record()`
38
+ */
39
+ private readonly _recordingOptions;
40
+ private readonly _options;
41
+ private _performanceObserver;
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
+ constructor({ options, recordingOptions, }: {
69
+ options: ReplayPluginOptions;
70
+ recordingOptions: RecordingOptions;
71
+ });
72
+ /** Get the event context. */
73
+ getContext(): InternalEventContext;
74
+ /** If recording is currently enabled. */
75
+ isEnabled(): boolean;
76
+ /** If recording is currently paused. */
77
+ isPaused(): boolean;
78
+ /** Get the replay integration options. */
79
+ getOptions(): ReplayPluginOptions;
80
+ /**
81
+ * Initializes the plugin based on sampling configuration. Should not be
82
+ * called outside of constructor.
83
+ */
84
+ initializeSampling(): void;
85
+ /**
86
+ * Start a replay regardless of sampling rate. Calling this will always
87
+ * create a new session. Will throw an error if replay is already in progress.
88
+ *
89
+ * Creates or loads a session, attaches listeners to varying events (DOM,
90
+ * _performanceObserver, Recording, Sentry SDK, etc)
91
+ */
92
+ start(): void;
93
+ /**
94
+ * Start replay buffering. Buffers until `flush()` is called or, if
95
+ * `replaysOnErrorSampleRate` > 0, an error occurs.
96
+ */
97
+ startBuffering(): void;
98
+ /**
99
+ * Start recording.
100
+ *
101
+ * Note that this will cause a new DOM checkout
102
+ */
103
+ startRecording(): void;
104
+ /**
105
+ * Stops the recording, if it was running.
106
+ *
107
+ * Returns true if it was previously stopped, or is now stopped,
108
+ * otherwise false.
109
+ */
110
+ stopRecording(): boolean;
111
+ /**
112
+ * Currently, this needs to be manually called (e.g. for tests). Sentry SDK
113
+ * does not support a teardown
114
+ */
115
+ stop({ forceFlush, reason }?: {
116
+ forceFlush?: boolean;
117
+ reason?: string;
118
+ }): Promise<void>;
119
+ /**
120
+ * Pause some replay functionality. See comments for `_isPaused`.
121
+ * This differs from stop as this only stops DOM recording, it is
122
+ * not as thorough of a shutdown as `stop()`.
123
+ */
124
+ pause(): void;
125
+ /**
126
+ * Resumes recording, see notes for `pause().
127
+ *
128
+ * Note that calling `startRecording()` here will cause a
129
+ * new DOM checkout.`
130
+ */
131
+ resume(): void;
132
+ /**
133
+ * If not in "session" recording mode, flush event buffer which will create a new replay.
134
+ * Unless `continueRecording` is false, the replay will continue to record and
135
+ * behave as a "session"-based replay.
136
+ *
137
+ * Otherwise, queue up a flush.
138
+ */
139
+ sendBufferedReplayOrFlush({ continueRecording }?: SendBufferedReplayOptions): Promise<void>;
140
+ /**
141
+ * We want to batch uploads of replay events. Save events only if
142
+ * `<flushMinDelay>` milliseconds have elapsed since the last event
143
+ * *OR* if `<flushMaxDelay>` milliseconds have elapsed.
144
+ *
145
+ * Accepts a callback to perform side-effects and returns true to stop batch
146
+ * processing and hand back control to caller.
147
+ */
148
+ addUpdate(cb: AddUpdateCallback): void;
149
+ /**
150
+ * Updates the user activity timestamp and resumes recording. This should be
151
+ * called in an event handler for a user action that we consider as the user
152
+ * being "active" (e.g. a mouse click).
153
+ */
154
+ triggerUserActivity(): void;
155
+ /**
156
+ * Updates the user activity timestamp *without* resuming
157
+ * recording. Some user events (e.g. keydown) can be create
158
+ * low-value replays that only contain the keypress as a
159
+ * breadcrumb. Instead this would require other events to
160
+ * create a new replay after a session has expired.
161
+ */
162
+ updateUserActivity(): void;
163
+ /**
164
+ * Only flush if `this.recordingMode === 'session'`
165
+ */
166
+ conditionalFlush(): Promise<void>;
167
+ /**
168
+ * Flush using debounce flush
169
+ */
170
+ flush(): Promise<void>;
171
+ /**
172
+ * Always flush via `_debouncedFlush` so that we do not have flushes triggered
173
+ * from calling both `flush` and `_debouncedFlush`. Otherwise, there could be
174
+ * cases of mulitple flushes happening closely together.
175
+ */
176
+ flushImmediate(): Promise<void>;
177
+ /**
178
+ * Cancels queued up flushes.
179
+ */
180
+ cancelFlush(): void;
181
+ /** Get the current sesion (=replay) ID */
182
+ getSessionId(): string | undefined;
183
+ /**
184
+ * Checks if recording should be stopped due to user inactivity. Otherwise
185
+ * check if session is expired and create a new session if so. Triggers a new
186
+ * full snapshot on new session.
187
+ *
188
+ * Returns true if session is not expired, false otherwise.
189
+ * @hidden
190
+ */
191
+ checkAndHandleExpiredSession(): boolean | void;
192
+ /**
193
+ * Capture some initial state that can change throughout the lifespan of the
194
+ * replay. This is required because otherwise they would be captured at the
195
+ * first flush.
196
+ */
197
+ setInitialState(): void;
198
+ /**
199
+ * Add a breadcrumb event, that may be throttled.
200
+ * If it was throttled, we add a custom breadcrumb to indicate that.
201
+ */
202
+ throttledAddEvent(event: RecordingEvent, isCheckout?: boolean): typeof THROTTLED | typeof SKIPPED | Promise<AddEventResult | null>;
203
+ /**
204
+ * This will get the parametrized route name of the current page.
205
+ * This is only available if performance is enabled, and if an instrumented router is used.
206
+ */
207
+ getCurrentRoute(): string | undefined;
208
+ /**
209
+ * Initialize and start all listeners to varying events (DOM,
210
+ * Performance Observer, Recording, Sentry SDK, etc)
211
+ */
212
+ private _initializeRecording;
213
+ /** A wrapper to conditionally capture exceptions. */
214
+ private _handleException;
215
+ /**
216
+ * Loads (or refreshes) the current session.
217
+ */
218
+ private _initializeSessionForSampling;
219
+ /**
220
+ * Checks and potentially refreshes the current session.
221
+ * Returns false if session is not recorded.
222
+ */
223
+ private _checkSession;
224
+ /**
225
+ * Adds listeners to record events for the replay
226
+ */
227
+ private _addListeners;
228
+ /**
229
+ * Cleans up listeners that were created in `_addListeners`
230
+ */
231
+ private _removeListeners;
232
+ /**
233
+ * Handle when visibility of the page content changes. Opening a new tab will
234
+ * cause the state to change to hidden because of content of current page will
235
+ * be hidden. Likewise, moving a different window to cover the contents of the
236
+ * page will also trigger a change to a hidden state.
237
+ */
238
+ private _handleVisibilityChange;
239
+ /**
240
+ * Handle when page is blurred
241
+ */
242
+ private _handleWindowBlur;
243
+ /**
244
+ * Handle when page is focused
245
+ */
246
+ private _handleWindowFocus;
247
+ /** Ensure page remains active when a key is pressed. */
248
+ private _handleKeyboardEvent;
249
+ /**
250
+ * Tasks to run when we consider a page to be hidden (via blurring and/or visibility)
251
+ */
252
+ private _doChangeToBackgroundTasks;
253
+ /**
254
+ * Tasks to run when we consider a page to be visible (via focus and/or visibility)
255
+ */
256
+ private _doChangeToForegroundTasks;
257
+ /**
258
+ * Trigger rrweb to take a full snapshot which will cause this plugin to
259
+ * create a new Replay event.
260
+ */
261
+ private _triggerFullSnapshot;
262
+ /**
263
+ * Update user activity (across session lifespans)
264
+ */
265
+ private _updateUserActivity;
266
+ /**
267
+ * Updates the session's last activity timestamp
268
+ */
269
+ private _updateSessionActivity;
270
+ /**
271
+ * Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb
272
+ */
273
+ private _createCustomBreadcrumb;
274
+ /**
275
+ * Observed performance events are added to `this.performanceEvents`. These
276
+ * are included in the replay event before it is finished and sent to Sentry.
277
+ */
278
+ private _addPerformanceEntries;
279
+ /**
280
+ * Clear _context
281
+ */
282
+ private _clearContext;
283
+ /** Update the initial timestamp based on the buffer content. */
284
+ private _updateInitialTimestampFromEventBuffer;
285
+ /**
286
+ * Return and clear _context
287
+ */
288
+ private _popEventContext;
289
+ /**
290
+ * Flushes replay event buffer to Sentry.
291
+ *
292
+ * Performance events are only added right before flushing - this is
293
+ * due to the buffered performance observer events.
294
+ *
295
+ * Should never be called directly, only by `flush`
296
+ */
297
+ private _runFlush;
298
+ /**
299
+ * Flush recording data to Sentry. Creates a lock so that only a single flush
300
+ * can be active at a time. Do not call this directly.
301
+ */
302
+ private _flush;
303
+ /** Save the session, if it is sticky */
304
+ private _maybeSaveSession;
305
+ /** Handler for rrweb.record.onMutation */
306
+ private _onMutationHandler;
307
+ }
308
+ //# sourceMappingURL=replay.d.ts.map
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,6 @@
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
@@ -0,0 +1,14 @@
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
@@ -0,0 +1,6 @@
1
+ import { Session } from '../types';
2
+ /**
3
+ * Fetches a session from storage
4
+ */
5
+ export declare function fetchSession(traceInternals?: boolean): Session | null;
6
+ //# sourceMappingURL=fetchSession.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './createSession';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
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(currentSession: Session | undefined, { traceInternals, sessionIdleExpire, maxReplayDuration, }: {
7
+ sessionIdleExpire: number;
8
+ maxReplayDuration: number;
9
+ traceInternals?: boolean;
10
+ }, sessionOptions: SessionOptions): Session;
11
+ //# sourceMappingURL=loadOrCreateSession.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { Session, SessionOptions } from '../types';
2
+ /**
3
+ * Check a session, and either return it or a refreshed version of it.
4
+ * The refreshed version may be unsampled.
5
+ * You can check if the session has changed by comparing the session IDs.
6
+ */
7
+ export declare function maybeRefreshSession(session: Session, { traceInternals, maxReplayDuration, sessionIdleExpire, }: {
8
+ sessionIdleExpire: number;
9
+ maxReplayDuration: number;
10
+ traceInternals?: boolean;
11
+ }, sessionOptions: SessionOptions): Session;
12
+ //# sourceMappingURL=maybeRefreshSession.d.ts.map
@@ -0,0 +1,6 @@
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
@@ -0,0 +1,16 @@
1
+ import { ReplayBreadcrumbFrame, ReplayBreadcrumbFrameEvent, ReplayEventType, ReplayEventWithTime, ReplayOptionFrameEvent, ReplaySpanFrame, ReplaySpanFrameEvent } from '.';
2
+ /** @deprecated use ReplayEventType instead */
3
+ export type EventType = ReplayEventType;
4
+ /** @deprecated use ReplayEventWithTime instead */
5
+ export type eventWithTime = ReplayEventWithTime;
6
+ /** @deprecated use ReplayBreadcrumbFrame instead */
7
+ export type BreadcrumbFrame = ReplayBreadcrumbFrame;
8
+ /** @deprecated use ReplayBreadcrumbFrameEvent instead */
9
+ export type BreadcrumbFrameEvent = ReplayBreadcrumbFrameEvent;
10
+ /** @deprecated use ReplayOptionFrameEvent instead */
11
+ export type OptionFrameEvent = ReplayOptionFrameEvent;
12
+ /** @deprecated use ReplaySpanFrame instead */
13
+ export type SpanFrame = ReplaySpanFrame;
14
+ /** @deprecated use ReplaySpanFrameEvent instead */
15
+ export type SpanFrameEvent = ReplaySpanFrameEvent;
16
+ //# sourceMappingURL=deprecated.d.ts.map