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