@sentry/replay 0.6.9 → 0.6.10-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.
@@ -36,10 +36,21 @@ export declare class Replay implements Integration {
36
36
  */
37
37
  private newSessionCreated;
38
38
  private flushLock;
39
+ /**
40
+ * Timestamp of the last user activity. This lives across sessions.
41
+ */
42
+ private lastActivity;
39
43
  /**
40
44
  * Is the integration currently active?
41
45
  */
42
46
  private isEnabled;
47
+ /**
48
+ *
49
+ * Paused is a state where:
50
+ * - DOM Recording is not listening at all
51
+ * - Nothing will be added to event buffer (e.g. core SDK events)
52
+ */
53
+ private isPaused;
43
54
  /**
44
55
  * Have we attached listeners to the core SDK?
45
56
  * Note we have to track this as there is no way to remove instrumentation handlers.
@@ -73,18 +84,27 @@ export declare class Replay implements Integration {
73
84
  */
74
85
  start(): void;
75
86
  /**
76
- * We want to batch uploads of replay events. Save events only if
77
- * `<flushMinDelay>` milliseconds have elapsed since the last event
78
- * *OR* if `<flushMaxDelay>` milliseconds have elapsed.
87
+ * Start recording.
79
88
  *
80
- * Accepts a callback to perform side-effects and returns true to stop batch
81
- * processing and hand back control to caller.
89
+ * Note that this will cause a new DOM checkout
82
90
  */
83
- addUpdate(cb?: AddUpdateCallback): void;
91
+ startRecording(): void;
84
92
  /**
85
93
  * Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown
86
94
  */
87
95
  stop(): void;
96
+ /**
97
+ * Pause some replay functionality. See comments for `isPaused`.
98
+ * This differs from stop as this only stops DOM recording, it is
99
+ * not as thorough of a shutdown as `stop()`. */
100
+ pause(): void;
101
+ /**
102
+ * Resumes recording, see notes for `pause().
103
+ *
104
+ * Note that calling `startRecording()` here will cause a
105
+ * new DOM checkout.`
106
+ */
107
+ resume(): void;
88
108
  clearSession(): void;
89
109
  /**
90
110
  * Loads a session from storage, or creates a new one if it does not exist or
@@ -107,6 +127,15 @@ export declare class Replay implements Integration {
107
127
  * Cleans up listeners that were created in `addListeners`
108
128
  */
109
129
  removeListeners(): void;
130
+ /**
131
+ * We want to batch uploads of replay events. Save events only if
132
+ * `<flushMinDelay>` milliseconds have elapsed since the last event
133
+ * *OR* if `<flushMaxDelay>` milliseconds have elapsed.
134
+ *
135
+ * Accepts a callback to perform side-effects and returns true to stop batch
136
+ * processing and hand back control to caller.
137
+ */
138
+ addUpdate(cb?: AddUpdateCallback): void;
110
139
  /**
111
140
  * Core Sentry SDK global event handler. Attaches `replayId` to all [non-replay]
112
141
  * events as a tag. Also handles the case where we only want to capture a reply
@@ -168,10 +197,19 @@ export declare class Replay implements Integration {
168
197
  * Add an event to the event buffer
169
198
  */
170
199
  addEvent(event: RecordingEvent, isCheckout?: boolean): void;
200
+ /**
201
+ * Update user activity (across session lifespans)
202
+ */
203
+ updateUserActivity(lastActivity?: number): void;
171
204
  /**
172
205
  * Updates the session's last activity timestamp
173
206
  */
174
- updateLastActivity(lastActivity?: number): void;
207
+ updateSessionActivity(lastActivity?: number): void;
208
+ /**
209
+ * Updates the user activity timestamp and resumes recording. This should be called in an event handler for a user action that we consider as the user being "active" (e.g. a mouse click).
210
+ *
211
+ */
212
+ triggerUserActivity(): Promise<void>;
175
213
  /**
176
214
  * Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb
177
215
  */
@@ -191,11 +229,15 @@ export declare class Replay implements Integration {
191
229
  */
192
230
  addMemoryEntry(): Promise<void[]> | undefined;
193
231
  /**
194
- *
232
+ * Checks if recording should be stopped due to user inactivity. Otherwise
233
+ * check if session is expired and create a new session if so. Triggers a new
234
+ * full snapshot on new session.
195
235
  *
196
236
  * Returns true if session is not expired, false otherwise.
197
237
  */
198
- checkAndHandleExpiredSession(expiry?: number): boolean;
238
+ checkAndHandleExpiredSession({ expiry, }?: {
239
+ expiry?: number;
240
+ }): boolean | undefined;
199
241
  /**
200
242
  * Only flush if `captureOnlyOnError` is false.
201
243
  */
@@ -1,4 +1,4 @@
1
1
  import type { Breadcrumb } from '@sentry/types';
2
2
  declare type RequiredProperties = 'category' | 'message';
3
- export default function createBreadcrumb(breadcrumb: Pick<Breadcrumb, RequiredProperties> & Partial<Omit<Breadcrumb, RequiredProperties>>): Breadcrumb;
3
+ export declare function createBreadcrumb(breadcrumb: Pick<Breadcrumb, RequiredProperties> & Partial<Omit<Breadcrumb, RequiredProperties>>): Breadcrumb;
4
4
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/replay",
3
- "version": "0.6.9",
3
+ "version": "0.6.10-0",
4
4
  "description": "User replays for Sentry",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",