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