@uxbertlabs/reportly 1.0.24 → 1.0.25

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
@@ -9329,10 +9329,10 @@ class Screenshot {
9329
9329
  return Promise.resolve();
9330
9330
  }
9331
9331
  return new Promise(resolve => {
9332
- img.addEventListener('load', () => resolve(), {
9332
+ img.addEventListener("load", () => resolve(), {
9333
9333
  once: true
9334
9334
  });
9335
- img.addEventListener('error', () => resolve(), {
9335
+ img.addEventListener("error", () => resolve(), {
9336
9336
  once: true
9337
9337
  });
9338
9338
  // Timeout after 3 seconds for slow images
@@ -9345,13 +9345,13 @@ class Screenshot {
9345
9345
  * Wait for fonts to load
9346
9346
  */
9347
9347
  async waitForFonts() {
9348
- if ('fonts' in document) {
9348
+ if ("fonts" in document) {
9349
9349
  try {
9350
9350
  await Promise.race([document.fonts.ready, this.wait(1000) // Timeout after 1 second
9351
9351
  ]);
9352
9352
  } catch (e) {
9353
9353
  // Font loading failed, continue anyway
9354
- console.warn('Font loading check failed:', e);
9354
+ console.warn("Font loading check failed:", e);
9355
9355
  }
9356
9356
  }
9357
9357
  }
@@ -9373,7 +9373,6 @@ class Screenshot {
9373
9373
  this.hideUXbertElements();
9374
9374
  // Force a reflow to ensure all styles are computed
9375
9375
  this.forceReflow();
9376
- const originalScrollY = window.scrollY;
9377
9376
  let canvas;
9378
9377
  if (mode === "viewport") {
9379
9378
  // Capture only the current viewport
@@ -9396,30 +9395,30 @@ class Screenshot {
9396
9395
  // Ensure all styles are applied in the cloned document
9397
9396
  const clonedBody = clonedDoc.body;
9398
9397
  // Force all animations to their final state
9399
- const animatedElements = clonedBody.querySelectorAll('*');
9398
+ const animatedElements = clonedBody.querySelectorAll("*");
9400
9399
  animatedElements.forEach(el => {
9401
9400
  const element = el;
9402
9401
  // Pause all animations
9403
- element.style.animationPlayState = 'paused';
9404
- element.style.animationDelay = '-9999s';
9405
- element.style.animationIterationCount = '1';
9402
+ element.style.animationPlayState = "paused";
9403
+ element.style.animationDelay = "-9999s";
9404
+ element.style.animationIterationCount = "1";
9406
9405
  // Disable transitions
9407
- element.style.transition = 'none';
9406
+ element.style.transition = "none";
9408
9407
  });
9409
9408
  // Ensure lazy-loaded images are visible
9410
- const images = clonedBody.querySelectorAll('img');
9409
+ const images = clonedBody.querySelectorAll("img");
9411
9410
  images.forEach(img => {
9412
- img.style.opacity = '1';
9413
- img.style.visibility = 'visible';
9411
+ img.style.opacity = "1";
9412
+ img.style.visibility = "visible";
9414
9413
  });
9415
9414
  },
9416
9415
  ignoreElements: element => {
9417
9416
  // Ignore loading screen by ID
9418
- if (element.id === 'uxbert-screenshot-loading') {
9417
+ if (element.id === "uxbert-screenshot-loading") {
9419
9418
  return true;
9420
9419
  }
9421
9420
  // Ignore Uxbert elements
9422
- if (element.getAttribute('data-uxbert-reportly') !== null || element.className?.toString().includes('uxbert-') || element.id?.includes('uxbert-')) {
9421
+ if (element.getAttribute("data-uxbert-reportly") !== null || element.className?.toString().includes("uxbert-") || element.id?.includes("uxbert-")) {
9423
9422
  return true;
9424
9423
  }
9425
9424
  // Skip cross-origin images that might cause issues
@@ -9443,22 +9442,13 @@ class Screenshot {
9443
9442
  }
9444
9443
  });
9445
9444
  } else {
9446
- // Scroll to top to capture full page
9447
- window.scrollTo(0, 0);
9448
9445
  // Wait a bit for scroll to settle
9449
- await this.wait(100);
9450
- // Get full page dimensions
9451
- const fullPageHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);
9452
- const fullPageWidth = Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);
9446
+ await this.wait(1000);
9453
9447
  // Capture the full page
9454
9448
  canvas = await html2canvas(document.body, {
9455
9449
  useCORS: true,
9456
9450
  allowTaint: false,
9457
9451
  logging: false,
9458
- width: fullPageWidth,
9459
- height: fullPageHeight,
9460
- windowWidth: fullPageWidth,
9461
- windowHeight: fullPageHeight,
9462
9452
  // Improved rendering options
9463
9453
  backgroundColor: null,
9464
9454
  imageTimeout: 5000,
@@ -9468,30 +9458,30 @@ class Screenshot {
9468
9458
  // Ensure all styles are applied in the cloned document
9469
9459
  const clonedBody = clonedDoc.body;
9470
9460
  // Force all animations to their final state
9471
- const animatedElements = clonedBody.querySelectorAll('*');
9461
+ const animatedElements = clonedBody.querySelectorAll("*");
9472
9462
  animatedElements.forEach(el => {
9473
9463
  const element = el;
9474
9464
  // Pause all animations at their end state
9475
- element.style.animationPlayState = 'paused';
9476
- element.style.animationDelay = '-9999s';
9477
- element.style.animationIterationCount = '1';
9465
+ element.style.animationPlayState = "paused";
9466
+ element.style.animationDelay = "-9999s";
9467
+ element.style.animationIterationCount = "1";
9478
9468
  // Disable transitions
9479
- element.style.transition = 'none';
9469
+ element.style.transition = "none";
9480
9470
  });
9481
9471
  // Ensure lazy-loaded images are visible
9482
- const images = clonedBody.querySelectorAll('img');
9472
+ const images = clonedBody.querySelectorAll("img");
9483
9473
  images.forEach(img => {
9484
- img.style.opacity = '1';
9485
- img.style.visibility = 'visible';
9474
+ img.style.opacity = "1";
9475
+ img.style.visibility = "visible";
9486
9476
  });
9487
9477
  },
9488
9478
  ignoreElements: element => {
9489
9479
  // Ignore loading screen by ID
9490
- if (element.id === 'uxbert-screenshot-loading') {
9480
+ if (element.id === "uxbert-screenshot-loading") {
9491
9481
  return true;
9492
9482
  }
9493
9483
  // Ignore Uxbert elements
9494
- if (element.getAttribute('data-uxbert-reportly') !== null || element.className?.toString().includes('uxbert-') || element.id?.includes('uxbert-')) {
9484
+ if (element.getAttribute("data-uxbert-reportly") !== null || element.className?.toString().includes("uxbert-") || element.id?.includes("uxbert-")) {
9495
9485
  return true;
9496
9486
  }
9497
9487
  // Skip cross-origin images that might cause issues
@@ -9514,8 +9504,6 @@ class Screenshot {
9514
9504
  return false;
9515
9505
  }
9516
9506
  });
9517
- // Restore scroll position
9518
- window.scrollTo(0, originalScrollY);
9519
9507
  }
9520
9508
  // Show UXbert UI elements again
9521
9509
  this.showUXbertElements();