@zaplier/sdk 1.3.4 → 1.3.6

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,18 @@ class SessionReplayEngine {
19063
19064
  this.hasFullSnapshot = false;
19064
19065
  this.startTime = Date.now();
19065
19066
  this.startBatchTimer();
19067
+ // WORKAROUND: Force FullSnapshot creation IMMEDIATELY to fix rrweb 2.0.0-alpha bug
19068
+ // where FullSnapshot is sometimes not created as the first event
19069
+ setTimeout(() => {
19070
+ console.log("[Zaplier] Forcing immediate FullSnapshot to ensure correct event order...");
19071
+ try {
19072
+ takeFullSnapshot(true); // Force a new FullSnapshot immediately
19073
+ console.log("[Zaplier] FullSnapshot manually triggered");
19074
+ }
19075
+ catch (error) {
19076
+ console.error("[Zaplier] Failed to force FullSnapshot:", error);
19077
+ }
19078
+ }, 100); // Very short delay to ensure it comes first
19066
19079
  // Set timeout to check if FullSnapshot was captured
19067
19080
  this.snapshotTimeout = window.setTimeout(() => {
19068
19081
  if (!this.hasFullSnapshot) {
@@ -19070,11 +19083,17 @@ class SessionReplayEngine {
19070
19083
  eventsReceived: this.events.length,
19071
19084
  eventTypes: this.events.map((e) => e.type).slice(0, 10),
19072
19085
  });
19073
- // Don't send batches without FullSnapshot - replay won't work
19074
- // The issue is likely with rrweb errors preventing snapshot capture
19086
+ // Try one more forced snapshot as last resort
19087
+ try {
19088
+ console.warn("[Zaplier] Last resort: forcing FullSnapshot...");
19089
+ takeFullSnapshot(true);
19090
+ }
19091
+ catch (error) {
19092
+ console.error("[Zaplier] Failed to create emergency FullSnapshot:", error);
19093
+ }
19075
19094
  }
19076
19095
  else {
19077
- console.log("[Zaplier] FullSnapshot confirmed captured");
19096
+ console.log("[Zaplier] FullSnapshot confirmed captured");
19078
19097
  }
19079
19098
  }, 5000);
19080
19099
  console.log("[Zaplier] Session replay started with rrweb");
@@ -19315,7 +19334,7 @@ const DEFAULT_CONFIG = {
19315
19334
  */
19316
19335
  class ZaplierSDK {
19317
19336
  constructor(userConfig) {
19318
- this.version = "1.3.0";
19337
+ this.version = "1.3.5";
19319
19338
  this.isInitialized = false;
19320
19339
  this.eventQueue = [];
19321
19340
  /**