@mahmulp/feedback-sdk 0.0.2 → 0.0.4
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 +1 -1
- package/dist/index.cjs +31 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.global.js +14 -28
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +31 -4
- package/dist/index.js.map +1 -1
- package/dist/svelte.js +31 -4
- package/dist/svelte.js.map +1 -1
- package/package.json +2 -2
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
|
-
- Screenshot capture via dynamically loaded `html2canvas` (bundled as a direct dependency)
|
|
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
|
@@ -1192,7 +1192,10 @@ async function captureViewport(options = {}) {
|
|
|
1192
1192
|
allowTaint: false
|
|
1193
1193
|
});
|
|
1194
1194
|
return await canvasToBlob(canvas, opts.mimeType, opts.quality);
|
|
1195
|
-
} catch {
|
|
1195
|
+
} catch (err) {
|
|
1196
|
+
if (typeof console !== "undefined") {
|
|
1197
|
+
console.warn("[feedback-sdk] screenshot capture failed:", err);
|
|
1198
|
+
}
|
|
1196
1199
|
return null;
|
|
1197
1200
|
} finally {
|
|
1198
1201
|
if (host) host.style.visibility = previousVisibility;
|
|
@@ -1204,13 +1207,13 @@ async function loadHtml2Canvas() {
|
|
|
1204
1207
|
if (html2canvasPromise) return html2canvasPromise;
|
|
1205
1208
|
html2canvasPromise = (async () => {
|
|
1206
1209
|
try {
|
|
1207
|
-
const mod = await import('html2canvas');
|
|
1210
|
+
const mod = await import('html2canvas-pro');
|
|
1208
1211
|
return mod.default ?? mod ?? null;
|
|
1209
1212
|
} catch (err) {
|
|
1210
1213
|
if (!html2canvasMissingWarned && typeof console !== "undefined") {
|
|
1211
1214
|
html2canvasMissingWarned = true;
|
|
1212
1215
|
console.warn(
|
|
1213
|
-
"[feedback-sdk] screenshot capture disabled: failed to load `html2canvas`. This shouldn't normally happen \u2014 html2canvas is a direct dependency of the SDK. Pass `captureScreenshots: false` to silence this warning if intended.",
|
|
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.",
|
|
1214
1217
|
err
|
|
1215
1218
|
);
|
|
1216
1219
|
}
|
|
@@ -1566,7 +1569,8 @@ function initFeedback(options) {
|
|
|
1566
1569
|
}
|
|
1567
1570
|
async function refresh() {
|
|
1568
1571
|
try {
|
|
1569
|
-
const
|
|
1572
|
+
const pageUrl = getPageUrl();
|
|
1573
|
+
const result = await transport.list({ projectId: "", pageUrl });
|
|
1570
1574
|
state.feedbacks = result.items;
|
|
1571
1575
|
overlay.renderPins(state.feedbacks, openThread, onPinDragEnd);
|
|
1572
1576
|
} catch (err) {
|
|
@@ -1596,6 +1600,26 @@ function initFeedback(options) {
|
|
|
1596
1600
|
document.addEventListener("keydown", onKeyDown, true);
|
|
1597
1601
|
window.addEventListener("scroll", onWindowReposition, true);
|
|
1598
1602
|
window.addEventListener("resize", onWindowReposition);
|
|
1603
|
+
let lastSeenUrl = getPageUrl();
|
|
1604
|
+
function onMaybeNavigate() {
|
|
1605
|
+
const next = getPageUrl();
|
|
1606
|
+
if (next === lastSeenUrl) return;
|
|
1607
|
+
lastSeenUrl = next;
|
|
1608
|
+
void refresh();
|
|
1609
|
+
}
|
|
1610
|
+
const originalPushState = history.pushState.bind(history);
|
|
1611
|
+
const originalReplaceState = history.replaceState.bind(history);
|
|
1612
|
+
history.pushState = function patchedPushState(...args) {
|
|
1613
|
+
const result = originalPushState(...args);
|
|
1614
|
+
queueMicrotask(onMaybeNavigate);
|
|
1615
|
+
return result;
|
|
1616
|
+
};
|
|
1617
|
+
history.replaceState = function patchedReplaceState(...args) {
|
|
1618
|
+
const result = originalReplaceState(...args);
|
|
1619
|
+
queueMicrotask(onMaybeNavigate);
|
|
1620
|
+
return result;
|
|
1621
|
+
};
|
|
1622
|
+
window.addEventListener("popstate", onMaybeNavigate);
|
|
1599
1623
|
void refresh();
|
|
1600
1624
|
overlay.setEnabledStyles(state.enabled);
|
|
1601
1625
|
const wantsLauncher = options.showLauncher !== false;
|
|
@@ -1658,6 +1682,9 @@ function initFeedback(options) {
|
|
|
1658
1682
|
document.removeEventListener("keydown", onKeyDown, true);
|
|
1659
1683
|
window.removeEventListener("scroll", onWindowReposition, true);
|
|
1660
1684
|
window.removeEventListener("resize", onWindowReposition);
|
|
1685
|
+
window.removeEventListener("popstate", onMaybeNavigate);
|
|
1686
|
+
history.pushState = originalPushState;
|
|
1687
|
+
history.replaceState = originalReplaceState;
|
|
1661
1688
|
overlay.destroy();
|
|
1662
1689
|
}
|
|
1663
1690
|
};
|