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