@sentry/replay 0.6.9 → 0.6.10

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.
@@ -30,16 +30,22 @@ export declare class Replay implements Integration {
30
30
  private retryCount;
31
31
  private retryInterval;
32
32
  private debouncedFlush;
33
+ private flushLock;
33
34
  /**
34
- * Flag when a new session has been created. Captured replay events behave
35
- * slightly differently in this case: `replay_start_timestamp` is included.
35
+ * Timestamp of the last user activity. This lives across sessions.
36
36
  */
37
- private newSessionCreated;
38
- private flushLock;
37
+ private lastActivity;
39
38
  /**
40
39
  * Is the integration currently active?
41
40
  */
42
41
  private isEnabled;
42
+ /**
43
+ *
44
+ * Paused is a state where:
45
+ * - DOM Recording is not listening at all
46
+ * - Nothing will be added to event buffer (e.g. core SDK events)
47
+ */
48
+ private isPaused;
43
49
  /**
44
50
  * Have we attached listeners to the core SDK?
45
51
  * Note we have to track this as there is no way to remove instrumentation handlers.
@@ -73,18 +79,27 @@ export declare class Replay implements Integration {
73
79
  */
74
80
  start(): void;
75
81
  /**
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.
82
+ * Start recording.
79
83
  *
80
- * Accepts a callback to perform side-effects and returns true to stop batch
81
- * processing and hand back control to caller.
84
+ * Note that this will cause a new DOM checkout
82
85
  */
83
- addUpdate(cb?: AddUpdateCallback): void;
86
+ startRecording(): void;
84
87
  /**
85
88
  * Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown
86
89
  */
87
90
  stop(): void;
91
+ /**
92
+ * Pause some replay functionality. See comments for `isPaused`.
93
+ * This differs from stop as this only stops DOM recording, it is
94
+ * not as thorough of a shutdown as `stop()`. */
95
+ pause(): void;
96
+ /**
97
+ * Resumes recording, see notes for `pause().
98
+ *
99
+ * Note that calling `startRecording()` here will cause a
100
+ * new DOM checkout.`
101
+ */
102
+ resume(): void;
88
103
  clearSession(): void;
89
104
  /**
90
105
  * Loads a session from storage, or creates a new one if it does not exist or
@@ -107,6 +122,15 @@ export declare class Replay implements Integration {
107
122
  * Cleans up listeners that were created in `addListeners`
108
123
  */
109
124
  removeListeners(): void;
125
+ /**
126
+ * We want to batch uploads of replay events. Save events only if
127
+ * `<flushMinDelay>` milliseconds have elapsed since the last event
128
+ * *OR* if `<flushMaxDelay>` milliseconds have elapsed.
129
+ *
130
+ * Accepts a callback to perform side-effects and returns true to stop batch
131
+ * processing and hand back control to caller.
132
+ */
133
+ addUpdate(cb?: AddUpdateCallback): void;
110
134
  /**
111
135
  * Core Sentry SDK global event handler. Attaches `replayId` to all [non-replay]
112
136
  * events as a tag. Also handles the case where we only want to capture a reply
@@ -168,10 +192,19 @@ export declare class Replay implements Integration {
168
192
  * Add an event to the event buffer
169
193
  */
170
194
  addEvent(event: RecordingEvent, isCheckout?: boolean): void;
195
+ /**
196
+ * Update user activity (across session lifespans)
197
+ */
198
+ updateUserActivity(lastActivity?: number): void;
171
199
  /**
172
200
  * Updates the session's last activity timestamp
173
201
  */
174
- updateLastActivity(lastActivity?: number): void;
202
+ updateSessionActivity(lastActivity?: number): void;
203
+ /**
204
+ * 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).
205
+ *
206
+ */
207
+ triggerUserActivity(): Promise<void>;
175
208
  /**
176
209
  * Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb
177
210
  */
@@ -191,11 +224,15 @@ export declare class Replay implements Integration {
191
224
  */
192
225
  addMemoryEntry(): Promise<void[]> | undefined;
193
226
  /**
194
- *
227
+ * Checks if recording should be stopped due to user inactivity. Otherwise
228
+ * check if session is expired and create a new session if so. Triggers a new
229
+ * full snapshot on new session.
195
230
  *
196
231
  * Returns true if session is not expired, false otherwise.
197
232
  */
198
- checkAndHandleExpiredSession(expiry?: number): boolean;
233
+ checkAndHandleExpiredSession({ expiry, }?: {
234
+ expiry?: number;
235
+ }): boolean | undefined;
199
236
  /**
200
237
  * Only flush if `captureOnlyOnError` is false.
201
238
  */
@@ -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",
4
4
  "description": "User replays for Sentry",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",