@uxbertlabs/reportly 1.0.15 → 1.0.16

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.
@@ -9452,6 +9452,8 @@ class Screenshot {
9452
9452
  }
9453
9453
  async capture(mode = "fullpage") {
9454
9454
  try {
9455
+ // Show loading screen
9456
+ this.showLoadingScreen();
9455
9457
  // Hide UXbert UI elements before capturing
9456
9458
  this.hideUXbertElements();
9457
9459
  const originalScrollY = window.scrollY;
@@ -9510,21 +9512,6 @@ class Screenshot {
9510
9512
  logging: false,
9511
9513
  width: fullPageWidth,
9512
9514
  height: fullPageHeight,
9513
- onclone: async (domDoc) => {
9514
- // Wait 1 second after cloning to let animations complete
9515
- await this.wait(1000);
9516
- // scroll over the dome from top to bottom
9517
- domDoc.defaultView?.scrollTo(0, 0);
9518
- await this.wait(500);
9519
- // Smooth scroll to bottom
9520
- const scrollStep = 100;
9521
- for (let scrollY = 0; scrollY < fullPageHeight; scrollY += scrollStep) {
9522
- domDoc.defaultView?.scrollTo(0, scrollY);
9523
- await this.wait(100);
9524
- }
9525
- domDoc.defaultView?.scrollTo(0, 0);
9526
- await this.wait(3000);
9527
- },
9528
9515
  ignoreElements: (element) => {
9529
9516
  // Skip cross-origin images that might cause issues
9530
9517
  if (element.tagName === "IMG") {
@@ -9553,6 +9540,8 @@ class Screenshot {
9553
9540
  }
9554
9541
  // Show UXbert UI elements again
9555
9542
  this.showUXbertElements();
9543
+ // Hide loading screen
9544
+ this.hideLoadingScreen();
9556
9545
  // Convert to base64
9557
9546
  this.currentScreenshot = canvas.toDataURL("image/png");
9558
9547
  return this.currentScreenshot;
@@ -9560,6 +9549,7 @@ class Screenshot {
9560
9549
  catch (error) {
9561
9550
  console.error("Screenshot capture failed:", error);
9562
9551
  this.showUXbertElements();
9552
+ this.hideLoadingScreen();
9563
9553
  throw error;
9564
9554
  }
9565
9555
  }
@@ -9582,6 +9572,67 @@ class Screenshot {
9582
9572
  }
9583
9573
  });
9584
9574
  }
9575
+ showLoadingScreen() {
9576
+ // Check if loading screen already exists
9577
+ if (document.getElementById("uxbert-screenshot-loading")) {
9578
+ return;
9579
+ }
9580
+ const loadingOverlay = document.createElement("div");
9581
+ loadingOverlay.id = "uxbert-screenshot-loading";
9582
+ loadingOverlay.style.cssText = `
9583
+ position: fixed;
9584
+ top: 0;
9585
+ left: 0;
9586
+ width: 100%;
9587
+ height: 100%;
9588
+ background: rgba(0, 0, 0, 0.7);
9589
+ display: flex;
9590
+ flex-direction: column;
9591
+ align-items: center;
9592
+ justify-content: center;
9593
+ z-index: 999999;
9594
+ backdrop-filter: blur(4px);
9595
+ `;
9596
+ const spinner = document.createElement("div");
9597
+ spinner.style.cssText = `
9598
+ width: 50px;
9599
+ height: 50px;
9600
+ border: 4px solid rgba(255, 255, 255, 0.3);
9601
+ border-top: 4px solid #ffffff;
9602
+ border-radius: 50%;
9603
+ animation: uxbert-spin 1s linear infinite;
9604
+ `;
9605
+ const loadingText = document.createElement("div");
9606
+ loadingText.textContent = "Capturing screenshot...";
9607
+ loadingText.style.cssText = `
9608
+ color: #ffffff;
9609
+ font-size: 16px;
9610
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
9611
+ margin-top: 20px;
9612
+ font-weight: 500;
9613
+ `;
9614
+ // Add keyframe animation if it doesn't exist
9615
+ if (!document.getElementById("uxbert-loading-styles")) {
9616
+ const style = document.createElement("style");
9617
+ style.id = "uxbert-loading-styles";
9618
+ style.textContent = `
9619
+ @keyframes uxbert-spin {
9620
+ 0% { transform: rotate(0deg); }
9621
+ 100% { transform: rotate(360deg); }
9622
+ }
9623
+ `;
9624
+ document.head.appendChild(style);
9625
+ }
9626
+ loadingOverlay.appendChild(spinner);
9627
+ loadingOverlay.appendChild(loadingText);
9628
+ document.body.appendChild(loadingOverlay);
9629
+ }
9630
+ hideLoadingScreen() {
9631
+ const loadingOverlay = document.getElementById("uxbert-screenshot-loading");
9632
+ if (loadingOverlay) {
9633
+ loadingOverlay.remove();
9634
+ }
9635
+ }
9585
9636
  getScreenshot() {
9586
9637
  return this.currentScreenshot;
9587
9638
  }