@sentry/replay 10.65.0 → 10.67.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.
@@ -8290,12 +8290,24 @@ class Replay {
8290
8290
  /**
8291
8291
  * Currently, this needs to be manually called (e.g. for tests). Sentry SDK
8292
8292
  * does not support a teardown
8293
+ *
8294
+ * @param options.flush - Whether to flush the pending replay segment when stopping.
8295
+ * When recording in `session` mode, `stop()` flushes the buffered-but-unsent segment by
8296
+ * default (`flush: true`), matching the previous behavior. Pass `flush: false` to stop
8297
+ * recording without sending that pending segment — useful when a user withdraws consent
8298
+ * and no further data should leave the browser.
8299
+ *
8300
+ * Note: `flush: false` only prevents the *pending* (final) segment from being sent. It does
8301
+ * **not** retract segments that were already sent earlier during `session` recording.
8293
8302
  */
8294
- stop() {
8303
+ stop(options) {
8295
8304
  if (!this._replay) {
8296
8305
  return Promise.resolve();
8297
8306
  }
8298
- return this._replay.stop({ forceFlush: this._replay.recordingMode === "session", reason: "manual" });
8307
+ return this._replay.stop({
8308
+ forceFlush: options?.flush ?? this._replay.recordingMode === "session",
8309
+ reason: "manual"
8310
+ });
8299
8311
  }
8300
8312
  /**
8301
8313
  * If not in "session" recording mode, flush event buffer which will create a new replay.