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