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