@uxbertlabs/reportly 1.0.15 → 1.0.17

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.
@@ -9470,6 +9470,8 @@ class Screenshot {
9470
9470
  x: window.scrollX,
9471
9471
  y: window.scrollY,
9472
9472
  onclone: async () => {
9473
+ // Show loading screen after clone (won't appear in screenshot)
9474
+ this.showLoadingScreen();
9473
9475
  // Wait 1 second after cloning to let animations complete
9474
9476
  await this.wait(1000);
9475
9477
  },
@@ -9510,20 +9512,9 @@ 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);
9515
+ onclone: async () => {
9516
+ // Show loading screen after clone (won't appear in screenshot)
9517
+ this.showLoadingScreen();
9527
9518
  },
9528
9519
  ignoreElements: (element) => {
9529
9520
  // Skip cross-origin images that might cause issues
@@ -9553,6 +9544,8 @@ class Screenshot {
9553
9544
  }
9554
9545
  // Show UXbert UI elements again
9555
9546
  this.showUXbertElements();
9547
+ // Hide loading screen
9548
+ this.hideLoadingScreen();
9556
9549
  // Convert to base64
9557
9550
  this.currentScreenshot = canvas.toDataURL("image/png");
9558
9551
  return this.currentScreenshot;
@@ -9560,6 +9553,7 @@ class Screenshot {
9560
9553
  catch (error) {
9561
9554
  console.error("Screenshot capture failed:", error);
9562
9555
  this.showUXbertElements();
9556
+ this.hideLoadingScreen();
9563
9557
  throw error;
9564
9558
  }
9565
9559
  }
@@ -9582,6 +9576,67 @@ class Screenshot {
9582
9576
  }
9583
9577
  });
9584
9578
  }
9579
+ showLoadingScreen() {
9580
+ // Check if loading screen already exists
9581
+ if (document.getElementById("uxbert-screenshot-loading")) {
9582
+ return;
9583
+ }
9584
+ const loadingOverlay = document.createElement("div");
9585
+ loadingOverlay.id = "uxbert-screenshot-loading";
9586
+ loadingOverlay.style.cssText = `
9587
+ position: fixed;
9588
+ top: 0;
9589
+ left: 0;
9590
+ width: 100%;
9591
+ height: 100%;
9592
+ background: rgba(0, 0, 0, 0.7);
9593
+ display: flex;
9594
+ flex-direction: column;
9595
+ align-items: center;
9596
+ justify-content: center;
9597
+ z-index: 999999;
9598
+ backdrop-filter: blur(4px);
9599
+ `;
9600
+ const spinner = document.createElement("div");
9601
+ spinner.style.cssText = `
9602
+ width: 50px;
9603
+ height: 50px;
9604
+ border: 4px solid rgba(255, 255, 255, 0.3);
9605
+ border-top: 4px solid #ffffff;
9606
+ border-radius: 50%;
9607
+ animation: uxbert-spin 1s linear infinite;
9608
+ `;
9609
+ const loadingText = document.createElement("div");
9610
+ loadingText.textContent = "Capturing screenshot...";
9611
+ loadingText.style.cssText = `
9612
+ color: #ffffff;
9613
+ font-size: 16px;
9614
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
9615
+ margin-top: 20px;
9616
+ font-weight: 500;
9617
+ `;
9618
+ // Add keyframe animation if it doesn't exist
9619
+ if (!document.getElementById("uxbert-loading-styles")) {
9620
+ const style = document.createElement("style");
9621
+ style.id = "uxbert-loading-styles";
9622
+ style.textContent = `
9623
+ @keyframes uxbert-spin {
9624
+ 0% { transform: rotate(0deg); }
9625
+ 100% { transform: rotate(360deg); }
9626
+ }
9627
+ `;
9628
+ document.head.appendChild(style);
9629
+ }
9630
+ loadingOverlay.appendChild(spinner);
9631
+ loadingOverlay.appendChild(loadingText);
9632
+ document.body.appendChild(loadingOverlay);
9633
+ }
9634
+ hideLoadingScreen() {
9635
+ const loadingOverlay = document.getElementById("uxbert-screenshot-loading");
9636
+ if (loadingOverlay) {
9637
+ loadingOverlay.remove();
9638
+ }
9639
+ }
9585
9640
  getScreenshot() {
9586
9641
  return this.currentScreenshot;
9587
9642
  }