@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/dist/svelte.js
CHANGED
|
@@ -1190,7 +1190,10 @@ async function captureViewport(options = {}) {
|
|
|
1190
1190
|
allowTaint: false
|
|
1191
1191
|
});
|
|
1192
1192
|
return await canvasToBlob(canvas, opts.mimeType, opts.quality);
|
|
1193
|
-
} catch {
|
|
1193
|
+
} catch (err) {
|
|
1194
|
+
if (typeof console !== "undefined") {
|
|
1195
|
+
console.warn("[feedback-sdk] screenshot capture failed:", err);
|
|
1196
|
+
}
|
|
1194
1197
|
return null;
|
|
1195
1198
|
} finally {
|
|
1196
1199
|
if (host) host.style.visibility = previousVisibility;
|
|
@@ -1202,13 +1205,13 @@ async function loadHtml2Canvas() {
|
|
|
1202
1205
|
if (html2canvasPromise) return html2canvasPromise;
|
|
1203
1206
|
html2canvasPromise = (async () => {
|
|
1204
1207
|
try {
|
|
1205
|
-
const mod = await import('html2canvas');
|
|
1208
|
+
const mod = await import('html2canvas-pro');
|
|
1206
1209
|
return mod.default ?? mod ?? null;
|
|
1207
1210
|
} catch (err) {
|
|
1208
1211
|
if (!html2canvasMissingWarned && typeof console !== "undefined") {
|
|
1209
1212
|
html2canvasMissingWarned = true;
|
|
1210
1213
|
console.warn(
|
|
1211
|
-
"[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.",
|
|
1214
|
+
"[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.",
|
|
1212
1215
|
err
|
|
1213
1216
|
);
|
|
1214
1217
|
}
|
|
@@ -1564,7 +1567,8 @@ function initFeedback(options) {
|
|
|
1564
1567
|
}
|
|
1565
1568
|
async function refresh() {
|
|
1566
1569
|
try {
|
|
1567
|
-
const
|
|
1570
|
+
const pageUrl = getPageUrl();
|
|
1571
|
+
const result = await transport.list({ projectId: "", pageUrl });
|
|
1568
1572
|
state.feedbacks = result.items;
|
|
1569
1573
|
overlay.renderPins(state.feedbacks, openThread, onPinDragEnd);
|
|
1570
1574
|
} catch (err) {
|
|
@@ -1594,6 +1598,26 @@ function initFeedback(options) {
|
|
|
1594
1598
|
document.addEventListener("keydown", onKeyDown, true);
|
|
1595
1599
|
window.addEventListener("scroll", onWindowReposition, true);
|
|
1596
1600
|
window.addEventListener("resize", onWindowReposition);
|
|
1601
|
+
let lastSeenUrl = getPageUrl();
|
|
1602
|
+
function onMaybeNavigate() {
|
|
1603
|
+
const next = getPageUrl();
|
|
1604
|
+
if (next === lastSeenUrl) return;
|
|
1605
|
+
lastSeenUrl = next;
|
|
1606
|
+
void refresh();
|
|
1607
|
+
}
|
|
1608
|
+
const originalPushState = history.pushState.bind(history);
|
|
1609
|
+
const originalReplaceState = history.replaceState.bind(history);
|
|
1610
|
+
history.pushState = function patchedPushState(...args) {
|
|
1611
|
+
const result = originalPushState(...args);
|
|
1612
|
+
queueMicrotask(onMaybeNavigate);
|
|
1613
|
+
return result;
|
|
1614
|
+
};
|
|
1615
|
+
history.replaceState = function patchedReplaceState(...args) {
|
|
1616
|
+
const result = originalReplaceState(...args);
|
|
1617
|
+
queueMicrotask(onMaybeNavigate);
|
|
1618
|
+
return result;
|
|
1619
|
+
};
|
|
1620
|
+
window.addEventListener("popstate", onMaybeNavigate);
|
|
1597
1621
|
void refresh();
|
|
1598
1622
|
overlay.setEnabledStyles(state.enabled);
|
|
1599
1623
|
const wantsLauncher = options.showLauncher !== false;
|
|
@@ -1656,6 +1680,9 @@ function initFeedback(options) {
|
|
|
1656
1680
|
document.removeEventListener("keydown", onKeyDown, true);
|
|
1657
1681
|
window.removeEventListener("scroll", onWindowReposition, true);
|
|
1658
1682
|
window.removeEventListener("resize", onWindowReposition);
|
|
1683
|
+
window.removeEventListener("popstate", onMaybeNavigate);
|
|
1684
|
+
history.pushState = originalPushState;
|
|
1685
|
+
history.replaceState = originalReplaceState;
|
|
1659
1686
|
overlay.destroy();
|
|
1660
1687
|
}
|
|
1661
1688
|
};
|