@zaplier/sdk 1.3.4 → 1.3.5

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/dist/index.cjs CHANGED
@@ -19010,6 +19010,7 @@ var n;
19010
19010
  !function(t2) {
19011
19011
  t2[t2.NotStarted = 0] = "NotStarted", t2[t2.Running = 1] = "Running", t2[t2.Stopped = 2] = "Stopped";
19012
19012
  }(n || (n = {}));
19013
+ const { takeFullSnapshot } = record;
19013
19014
 
19014
19015
  /**
19015
19016
  * Session Replay Engine
@@ -19067,6 +19068,19 @@ class SessionReplayEngine {
19067
19068
  this.hasFullSnapshot = false;
19068
19069
  this.startTime = Date.now();
19069
19070
  this.startBatchTimer();
19071
+ // WORKAROUND: Force FullSnapshot creation to fix rrweb 2.0.0-alpha bug
19072
+ // where FullSnapshot is sometimes not created as the first event
19073
+ setTimeout(() => {
19074
+ if (!this.hasFullSnapshot) {
19075
+ console.warn("[Zaplier] ⚠️ FullSnapshot not created automatically, forcing manual capture...");
19076
+ try {
19077
+ takeFullSnapshot(true); // Force a new FullSnapshot
19078
+ }
19079
+ catch (error) {
19080
+ console.error("[Zaplier] Failed to force FullSnapshot:", error);
19081
+ }
19082
+ }
19083
+ }, 500); // Give rrweb a chance to create natural FullSnapshot first
19070
19084
  // Set timeout to check if FullSnapshot was captured
19071
19085
  this.snapshotTimeout = window.setTimeout(() => {
19072
19086
  if (!this.hasFullSnapshot) {
@@ -19074,11 +19088,17 @@ class SessionReplayEngine {
19074
19088
  eventsReceived: this.events.length,
19075
19089
  eventTypes: this.events.map((e) => e.type).slice(0, 10),
19076
19090
  });
19077
- // Don't send batches without FullSnapshot - replay won't work
19078
- // The issue is likely with rrweb errors preventing snapshot capture
19091
+ // Try one more forced snapshot as last resort
19092
+ try {
19093
+ console.warn("[Zaplier] Last resort: forcing FullSnapshot...");
19094
+ takeFullSnapshot(true);
19095
+ }
19096
+ catch (error) {
19097
+ console.error("[Zaplier] Failed to create emergency FullSnapshot:", error);
19098
+ }
19079
19099
  }
19080
19100
  else {
19081
- console.log("[Zaplier] FullSnapshot confirmed captured");
19101
+ console.log("[Zaplier] FullSnapshot confirmed captured");
19082
19102
  }
19083
19103
  }, 5000);
19084
19104
  console.log("[Zaplier] Session replay started with rrweb");
@@ -19319,7 +19339,7 @@ const DEFAULT_CONFIG = {
19319
19339
  */
19320
19340
  class ZaplierSDK {
19321
19341
  constructor(userConfig) {
19322
- this.version = "1.3.0";
19342
+ this.version = "1.3.5";
19323
19343
  this.isInitialized = false;
19324
19344
  this.eventQueue = [];
19325
19345
  /**