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