@mahmulp/feedback-sdk 0.0.1 → 0.0.3

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/README.md CHANGED
@@ -11,7 +11,7 @@ Designed for **self-hosted** setups: pair this SDK with a backend (we ship one i
11
11
  - Floating launcher widget built in (toggle feedback mode, hide pins, hide launcher)
12
12
  - Stable DOM selectors that survive layout changes
13
13
  - Drag-to-move pins with optimistic update
14
- - Optional screenshot capture (via dynamically loaded `html2canvas`)
14
+ - Screenshot capture via dynamically loaded `html2canvas-pro` (bundled as a direct dependency)
15
15
  - Svelte adapter for ergonomic SvelteKit integration
16
16
  - Works in React, Vue, and plain HTML via the same core API
17
17
 
package/dist/index.cjs CHANGED
@@ -236,6 +236,7 @@ var LauncherManager = class {
236
236
  /** True when an event originated from the launcher's own UI. */
237
237
  ownsNode(node) {
238
238
  if (!node) return false;
239
+ if (typeof Node === "undefined" || !(node instanceof Node)) return false;
239
240
  return this.launcherEl.contains(node) || this.revealEl.contains(node);
240
241
  }
241
242
  destroy() {
@@ -1191,20 +1192,31 @@ async function captureViewport(options = {}) {
1191
1192
  allowTaint: false
1192
1193
  });
1193
1194
  return await canvasToBlob(canvas, opts.mimeType, opts.quality);
1194
- } catch {
1195
+ } catch (err) {
1196
+ if (typeof console !== "undefined") {
1197
+ console.warn("[feedback-sdk] screenshot capture failed:", err);
1198
+ }
1195
1199
  return null;
1196
1200
  } finally {
1197
1201
  if (host) host.style.visibility = previousVisibility;
1198
1202
  }
1199
1203
  }
1200
1204
  var html2canvasPromise = null;
1205
+ var html2canvasMissingWarned = false;
1201
1206
  async function loadHtml2Canvas() {
1202
1207
  if (html2canvasPromise) return html2canvasPromise;
1203
1208
  html2canvasPromise = (async () => {
1204
1209
  try {
1205
- const mod = await import('html2canvas');
1210
+ const mod = await import('html2canvas-pro');
1206
1211
  return mod.default ?? mod ?? null;
1207
- } catch {
1212
+ } catch (err) {
1213
+ if (!html2canvasMissingWarned && typeof console !== "undefined") {
1214
+ html2canvasMissingWarned = true;
1215
+ console.warn(
1216
+ "[feedback-sdk] screenshot capture disabled: failed to load `html2canvas-pro`. This shouldn't normally happen \u2014 html2canvas-pro is a direct dependency of the SDK. Pass `captureScreenshots: false` to silence this warning if intended.",
1217
+ err
1218
+ );
1219
+ }
1208
1220
  return null;
1209
1221
  }
1210
1222
  })();