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