@uxbertlabs/reportly 1.0.7 → 1.0.9

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.
@@ -9447,18 +9447,19 @@ class Screenshot {
9447
9447
  constructor() {
9448
9448
  this.currentScreenshot = null;
9449
9449
  }
9450
- async capture(mode = 'fullpage') {
9450
+ async capture(mode = "fullpage") {
9451
9451
  try {
9452
9452
  // Hide UXbert UI elements before capturing
9453
9453
  this.hideUXbertElements();
9454
9454
  const originalScrollY = window.scrollY;
9455
9455
  let canvas;
9456
- if (mode === 'viewport') {
9456
+ if (mode === "viewport") {
9457
9457
  // Capture only the current viewport
9458
9458
  canvas = await html2canvas(document.body, {
9459
+ // foreignObjectRendering: true,
9459
9460
  useCORS: true,
9460
- allowTaint: false,
9461
- logging: false,
9461
+ allowTaint: true,
9462
+ logging: true,
9462
9463
  width: window.innerWidth,
9463
9464
  height: window.innerHeight,
9464
9465
  windowWidth: window.innerWidth,
@@ -9467,12 +9468,12 @@ class Screenshot {
9467
9468
  y: window.scrollY,
9468
9469
  ignoreElements: (element) => {
9469
9470
  // Skip cross-origin images that might cause issues
9470
- if (element.tagName === 'IMG') {
9471
+ if (element.tagName === "IMG") {
9471
9472
  const img = element;
9472
9473
  try {
9473
9474
  // Test if image is accessible
9474
- const canvas = document.createElement('canvas');
9475
- const ctx = canvas.getContext('2d');
9475
+ const canvas = document.createElement("canvas");
9476
+ const ctx = canvas.getContext("2d");
9476
9477
  canvas.width = 1;
9477
9478
  canvas.height = 1;
9478
9479
  ctx?.drawImage(img, 0, 0, 1, 1);
@@ -9481,7 +9482,7 @@ class Screenshot {
9481
9482
  }
9482
9483
  catch (e) {
9483
9484
  // Image is tainted, skip it
9484
- console.warn('Skipping cross-origin image:', img.src);
9485
+ console.warn("Skipping cross-origin image:", img.src);
9485
9486
  return true;
9486
9487
  }
9487
9488
  }
@@ -9504,12 +9505,12 @@ class Screenshot {
9504
9505
  height: fullPageHeight,
9505
9506
  ignoreElements: (element) => {
9506
9507
  // Skip cross-origin images that might cause issues
9507
- if (element.tagName === 'IMG') {
9508
+ if (element.tagName === "IMG") {
9508
9509
  const img = element;
9509
9510
  try {
9510
9511
  // Test if image is accessible
9511
- const canvas = document.createElement('canvas');
9512
- const ctx = canvas.getContext('2d');
9512
+ const canvas = document.createElement("canvas");
9513
+ const ctx = canvas.getContext("2d");
9513
9514
  canvas.width = 1;
9514
9515
  canvas.height = 1;
9515
9516
  ctx?.drawImage(img, 0, 0, 1, 1);
@@ -9518,7 +9519,7 @@ class Screenshot {
9518
9519
  }
9519
9520
  catch (e) {
9520
9521
  // Image is tainted, skip it
9521
- console.warn('Skipping cross-origin image:', img.src);
9522
+ console.warn("Skipping cross-origin image:", img.src);
9522
9523
  return true;
9523
9524
  }
9524
9525
  }
@@ -10200,7 +10201,7 @@ class Reportly {
10200
10201
  }
10201
10202
  init(userConfig = {}) {
10202
10203
  // Check if we're in a browser environment
10203
- if (typeof window === 'undefined' || typeof document === 'undefined') {
10204
+ if (typeof window === "undefined" || typeof document === "undefined") {
10204
10205
  console.warn("Uxbert Reportly can only be initialized in a browser environment");
10205
10206
  return;
10206
10207
  }
@@ -10267,7 +10268,7 @@ class Reportly {
10267
10268
  try {
10268
10269
  this.state?.setState(STATE.CAPTURING);
10269
10270
  // Get capture mode from modal
10270
- const captureMode = this.modal?.getCaptureMode() || 'viewport';
10271
+ const captureMode = this.modal?.getCaptureMode() || "viewport";
10271
10272
  // Save capture mode in state
10272
10273
  this.state?.setCaptureMode(captureMode);
10273
10274
  // Capture screenshot
@@ -10287,7 +10288,7 @@ class Reportly {
10287
10288
  this.state?.setState(STATE.ANNOTATING);
10288
10289
  this.modal?.close();
10289
10290
  this.button?.hide();
10290
- const captureMode = this.state?.getCaptureMode() || 'viewport';
10291
+ const captureMode = this.state?.getCaptureMode() || "viewport";
10291
10292
  this.annotation?.show(captureMode);
10292
10293
  this.toolbar?.show();
10293
10294
  }
@@ -10324,16 +10325,13 @@ class Reportly {
10324
10325
  }
10325
10326
  async retakeScreenshot() {
10326
10327
  try {
10327
- // Get the current capture mode from modal before closing
10328
- const captureMode = this.modal?.getCaptureMode() || 'viewport';
10329
10328
  this.modal?.close();
10330
10329
  this.state?.setState(STATE.CAPTURING);
10331
10330
  // Clear previous annotations
10332
10331
  this.annotation?.clear();
10333
- // Capture new screenshot with the same mode
10334
- const screenshot = await this.screenshot.capture(captureMode);
10332
+ // Capture new screenshot
10333
+ const screenshot = await this.screenshot.capture();
10335
10334
  this.state?.setScreenshot(screenshot);
10336
- this.state?.setCaptureMode(captureMode);
10337
10335
  // Show modal with new screenshot
10338
10336
  this.modal?.setScreenshot(screenshot);
10339
10337
  this.modal?.open();
@@ -10350,7 +10348,7 @@ class Reportly {
10350
10348
  // Create complete issue package
10351
10349
  const completeIssue = {
10352
10350
  ...issueData,
10353
- screenshot: this.state?.getScreenshot() || '',
10351
+ screenshot: this.state?.getScreenshot() || "",
10354
10352
  deviceInfo: this.deviceInfo.get(),
10355
10353
  createdAt: new Date().toISOString(),
10356
10354
  };