@sentry/replay 7.67.0 → 7.69.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.
- package/cjs/index.js +144 -153
- package/cjs/index.js.map +1 -1
- package/esm/index.js +144 -153
- package/esm/index.js.map +1 -1
- package/package.json +6 -6
- package/types/replay.d.ts +7 -1
- package/types/replay.d.ts.map +1 -1
- package/types/session/Session.d.ts.map +1 -1
- package/types/session/loadOrCreateSession.d.ts +2 -1
- package/types/session/loadOrCreateSession.d.ts.map +1 -1
- package/types/session/shouldRefreshSession.d.ts +7 -0
- package/types/session/shouldRefreshSession.d.ts.map +1 -0
- package/types/types/replay.d.ts +0 -5
- package/types/types/replay.d.ts.map +1 -1
- package/types/util/addEvent.d.ts +13 -0
- package/types/util/addEvent.d.ts.map +1 -1
- package/types/util/addGlobalListeners.d.ts.map +1 -1
- package/types/util/createPerformanceEntries.d.ts.map +1 -1
- package/types/util/handleRecordingEmit.d.ts.map +1 -1
- package/types-ts3.8/constants.d.ts +25 -0
- package/types-ts3.8/coreHandlers/handleAfterSendEvent.d.ts +9 -0
- package/types-ts3.8/coreHandlers/handleClick.d.ts +39 -0
- package/types-ts3.8/coreHandlers/handleDom.d.ts +13 -0
- package/types-ts3.8/coreHandlers/handleFetch.d.ts +9 -0
- package/types-ts3.8/coreHandlers/handleGlobalEvent.d.ts +7 -0
- package/types-ts3.8/coreHandlers/handleHistory.d.ts +11 -0
- package/types-ts3.8/coreHandlers/handleKeyboardEvent.d.ts +7 -0
- package/types-ts3.8/coreHandlers/handleNetworkBreadcrumbs.d.ts +17 -0
- package/types-ts3.8/coreHandlers/handleScope.d.ts +13 -0
- package/types-ts3.8/coreHandlers/handleXhr.d.ts +9 -0
- package/types-ts3.8/coreHandlers/performanceObserver.d.ts +6 -0
- package/types-ts3.8/coreHandlers/util/addBreadcrumbEvent.d.ts +7 -0
- package/types-ts3.8/coreHandlers/util/addNetworkBreadcrumb.d.ts +4 -0
- package/types-ts3.8/coreHandlers/util/domUtils.d.ts +19 -0
- package/types-ts3.8/coreHandlers/util/fetchUtils.d.ts +23 -0
- package/types-ts3.8/coreHandlers/util/getAttributesToRecord.d.ts +5 -0
- package/types-ts3.8/coreHandlers/util/networkUtils.d.ts +23 -0
- package/types-ts3.8/coreHandlers/util/onWindowOpen.d.ts +8 -0
- package/types-ts3.8/coreHandlers/util/shouldSampleForBufferEvent.d.ts +9 -0
- package/types-ts3.8/coreHandlers/util/xhrUtils.d.ts +22 -0
- package/types-ts3.8/eventBuffer/EventBufferArray.d.ts +28 -0
- package/types-ts3.8/eventBuffer/EventBufferCompressionWorker.d.ts +50 -0
- package/types-ts3.8/eventBuffer/EventBufferProxy.d.ts +42 -0
- package/types-ts3.8/eventBuffer/WorkerHandler.d.ts +27 -0
- package/types-ts3.8/eventBuffer/error.d.ts +5 -0
- package/types-ts3.8/eventBuffer/index.d.ts +10 -0
- package/types-ts3.8/index.d.ts +4 -0
- package/types-ts3.8/integration.d.ts +73 -0
- package/types-ts3.8/replay.d.ts +314 -0
- package/types-ts3.8/session/Session.d.ts +8 -0
- package/types-ts3.8/session/clearSession.d.ts +6 -0
- package/types-ts3.8/session/createSession.d.ts +14 -0
- package/types-ts3.8/session/fetchSession.d.ts +6 -0
- package/types-ts3.8/session/index.d.ts +2 -0
- package/types-ts3.8/session/loadOrCreateSession.d.ts +12 -0
- package/types-ts3.8/session/saveSession.d.ts +6 -0
- package/types-ts3.8/session/shouldRefreshSession.d.ts +7 -0
- package/types-ts3.8/types/deprecated.d.ts +16 -0
- package/types-ts3.8/types/index.d.ts +6 -0
- package/types-ts3.8/types/performance.d.ts +124 -0
- package/types-ts3.8/types/replay.d.ts +417 -0
- package/types-ts3.8/types/replayFrame.d.ts +173 -0
- package/types-ts3.8/types/request.d.ts +15 -0
- package/types-ts3.8/types/rrweb.d.ts +37 -0
- package/types-ts3.8/util/addEvent.d.ts +20 -0
- package/types-ts3.8/util/addGlobalListeners.d.ts +6 -0
- package/types-ts3.8/util/addMemoryEntry.d.ts +7 -0
- package/types-ts3.8/util/createBreadcrumb.d.ts +6 -0
- package/types-ts3.8/util/createPerformanceEntries.d.ts +6 -0
- package/types-ts3.8/util/createPerformanceSpans.d.ts +6 -0
- package/types-ts3.8/util/createReplayEnvelope.d.ts +7 -0
- package/types-ts3.8/util/debounce.d.ts +30 -0
- package/types-ts3.8/util/dedupePerformanceEntries.d.ts +11 -0
- package/types-ts3.8/util/eventUtils.d.ts +8 -0
- package/types-ts3.8/util/getPrivacyOptions.d.ts +19 -0
- package/types-ts3.8/util/handleRecordingEmit.d.ts +14 -0
- package/types-ts3.8/util/hasSessionStorage.d.ts +3 -0
- package/types-ts3.8/util/isBrowser.d.ts +5 -0
- package/types-ts3.8/util/isExpired.d.ts +6 -0
- package/types-ts3.8/util/isRrwebError.d.ts +6 -0
- package/types-ts3.8/util/isSampled.d.ts +8 -0
- package/types-ts3.8/util/isSessionExpired.d.ts +10 -0
- package/types-ts3.8/util/log.d.ts +10 -0
- package/types-ts3.8/util/prepareRecordingData.d.ts +9 -0
- package/types-ts3.8/util/prepareReplayEvent.d.ts +15 -0
- package/types-ts3.8/util/sendReplay.d.ts +9 -0
- package/types-ts3.8/util/sendReplayRequest.d.ts +13 -0
- package/types-ts3.8/util/shouldFilterRequest.d.ts +7 -0
- package/types-ts3.8/util/throttle.d.ts +12 -0
- package/types-ts3.8/util/timestamp.d.ts +9 -0
- package/types-ts3.8/util/truncateJson/completeJson.d.ts +9 -0
- package/types-ts3.8/util/truncateJson/constants.d.ts +12 -0
- package/types-ts3.8/util/truncateJson/evaluateJson.d.ts +6 -0
- package/types-ts3.8/util/truncateJson/fixJson.d.ts +6 -0
- package/types/session/maybeRefreshSession.d.ts +0 -12
- package/types/session/maybeRefreshSession.d.ts.map +0 -1
|
@@ -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,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,314 @@
|
|
|
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(previousSessionId?: string): 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
|
+
* Refresh a session with a new one.
|
|
226
|
+
* This stops the current session (without forcing a flush, as that would never work since we are expired),
|
|
227
|
+
* and then does a new sampling based on the refreshed session.
|
|
228
|
+
*/
|
|
229
|
+
private _refreshSession;
|
|
230
|
+
/**
|
|
231
|
+
* Adds listeners to record events for the replay
|
|
232
|
+
*/
|
|
233
|
+
private _addListeners;
|
|
234
|
+
/**
|
|
235
|
+
* Cleans up listeners that were created in `_addListeners`
|
|
236
|
+
*/
|
|
237
|
+
private _removeListeners;
|
|
238
|
+
/**
|
|
239
|
+
* Handle when visibility of the page content changes. Opening a new tab will
|
|
240
|
+
* cause the state to change to hidden because of content of current page will
|
|
241
|
+
* be hidden. Likewise, moving a different window to cover the contents of the
|
|
242
|
+
* page will also trigger a change to a hidden state.
|
|
243
|
+
*/
|
|
244
|
+
private _handleVisibilityChange;
|
|
245
|
+
/**
|
|
246
|
+
* Handle when page is blurred
|
|
247
|
+
*/
|
|
248
|
+
private _handleWindowBlur;
|
|
249
|
+
/**
|
|
250
|
+
* Handle when page is focused
|
|
251
|
+
*/
|
|
252
|
+
private _handleWindowFocus;
|
|
253
|
+
/** Ensure page remains active when a key is pressed. */
|
|
254
|
+
private _handleKeyboardEvent;
|
|
255
|
+
/**
|
|
256
|
+
* Tasks to run when we consider a page to be hidden (via blurring and/or visibility)
|
|
257
|
+
*/
|
|
258
|
+
private _doChangeToBackgroundTasks;
|
|
259
|
+
/**
|
|
260
|
+
* Tasks to run when we consider a page to be visible (via focus and/or visibility)
|
|
261
|
+
*/
|
|
262
|
+
private _doChangeToForegroundTasks;
|
|
263
|
+
/**
|
|
264
|
+
* Trigger rrweb to take a full snapshot which will cause this plugin to
|
|
265
|
+
* create a new Replay event.
|
|
266
|
+
*/
|
|
267
|
+
private _triggerFullSnapshot;
|
|
268
|
+
/**
|
|
269
|
+
* Update user activity (across session lifespans)
|
|
270
|
+
*/
|
|
271
|
+
private _updateUserActivity;
|
|
272
|
+
/**
|
|
273
|
+
* Updates the session's last activity timestamp
|
|
274
|
+
*/
|
|
275
|
+
private _updateSessionActivity;
|
|
276
|
+
/**
|
|
277
|
+
* Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb
|
|
278
|
+
*/
|
|
279
|
+
private _createCustomBreadcrumb;
|
|
280
|
+
/**
|
|
281
|
+
* Observed performance events are added to `this.performanceEvents`. These
|
|
282
|
+
* are included in the replay event before it is finished and sent to Sentry.
|
|
283
|
+
*/
|
|
284
|
+
private _addPerformanceEntries;
|
|
285
|
+
/**
|
|
286
|
+
* Clear _context
|
|
287
|
+
*/
|
|
288
|
+
private _clearContext;
|
|
289
|
+
/** Update the initial timestamp based on the buffer content. */
|
|
290
|
+
private _updateInitialTimestampFromEventBuffer;
|
|
291
|
+
/**
|
|
292
|
+
* Return and clear _context
|
|
293
|
+
*/
|
|
294
|
+
private _popEventContext;
|
|
295
|
+
/**
|
|
296
|
+
* Flushes replay event buffer to Sentry.
|
|
297
|
+
*
|
|
298
|
+
* Performance events are only added right before flushing - this is
|
|
299
|
+
* due to the buffered performance observer events.
|
|
300
|
+
*
|
|
301
|
+
* Should never be called directly, only by `flush`
|
|
302
|
+
*/
|
|
303
|
+
private _runFlush;
|
|
304
|
+
/**
|
|
305
|
+
* Flush recording data to Sentry. Creates a lock so that only a single flush
|
|
306
|
+
* can be active at a time. Do not call this directly.
|
|
307
|
+
*/
|
|
308
|
+
private _flush;
|
|
309
|
+
/** Save the session, if it is sticky */
|
|
310
|
+
private _maybeSaveSession;
|
|
311
|
+
/** Handler for rrweb.record.onMutation */
|
|
312
|
+
private _onMutationHandler;
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=replay.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,12 @@
|
|
|
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({ traceInternals, sessionIdleExpire, maxReplayDuration, previousSessionId, }: {
|
|
7
|
+
sessionIdleExpire: number;
|
|
8
|
+
maxReplayDuration: number;
|
|
9
|
+
traceInternals?: boolean;
|
|
10
|
+
previousSessionId?: string;
|
|
11
|
+
}, sessionOptions: SessionOptions): Session;
|
|
12
|
+
//# sourceMappingURL=loadOrCreateSession.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
|
@@ -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
|