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