@diegotsi/flint-react 0.3.3 → 0.3.5
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/index.cjs +31 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7897,6 +7897,11 @@ function ScreenAnnotator({ zIndex: zIndex2, onCapture, onCancel }) {
|
|
|
7897
7897
|
return;
|
|
7898
7898
|
}
|
|
7899
7899
|
setPhase("capturing");
|
|
7900
|
+
const sx = window.scrollX ?? window.pageXOffset ?? 0;
|
|
7901
|
+
const sy = window.scrollY ?? window.pageYOffset ?? 0;
|
|
7902
|
+
const dpr = window.devicePixelRatio ?? 1;
|
|
7903
|
+
const vw = window.innerWidth;
|
|
7904
|
+
const vh = window.innerHeight;
|
|
7900
7905
|
await new Promise(
|
|
7901
7906
|
(resolve) => requestAnimationFrame(() => requestAnimationFrame(() => resolve()))
|
|
7902
7907
|
);
|
|
@@ -7906,18 +7911,24 @@ function ScreenAnnotator({ zIndex: zIndex2, onCapture, onCancel }) {
|
|
|
7906
7911
|
useCORS: true,
|
|
7907
7912
|
logging: false,
|
|
7908
7913
|
allowTaint: true,
|
|
7914
|
+
scale: dpr,
|
|
7915
|
+
x: sx,
|
|
7916
|
+
y: sy,
|
|
7917
|
+
width: vw,
|
|
7918
|
+
height: vh,
|
|
7919
|
+
windowWidth: vw,
|
|
7920
|
+
windowHeight: vh,
|
|
7921
|
+
scrollX: -sx,
|
|
7922
|
+
scrollY: -sy,
|
|
7909
7923
|
ignoreElements: (el) => el === overlayRef.current
|
|
7910
7924
|
});
|
|
7911
7925
|
unpatch();
|
|
7912
|
-
const dpr = window.devicePixelRatio ?? 1;
|
|
7913
|
-
const sx = window.scrollX ?? window.pageXOffset ?? 0;
|
|
7914
|
-
const sy = window.scrollY ?? window.pageYOffset ?? 0;
|
|
7915
7926
|
const ctx = canvas.getContext("2d");
|
|
7916
7927
|
ctx.fillStyle = "rgba(255,200,0,0.25)";
|
|
7917
|
-
ctx.fillRect(
|
|
7928
|
+
ctx.fillRect(finalRect.x * dpr, finalRect.y * dpr, finalRect.w * dpr, finalRect.h * dpr);
|
|
7918
7929
|
ctx.strokeStyle = "#f97316";
|
|
7919
7930
|
ctx.lineWidth = 3 * dpr;
|
|
7920
|
-
ctx.strokeRect(
|
|
7931
|
+
ctx.strokeRect(finalRect.x * dpr, finalRect.y * dpr, finalRect.w * dpr, finalRect.h * dpr);
|
|
7921
7932
|
canvas.toBlob((blob) => {
|
|
7922
7933
|
if (blob) {
|
|
7923
7934
|
onCapture(new File([blob], "annotation.png", { type: "image/png" }));
|
|
@@ -8942,10 +8953,11 @@ var BLOCKED_HOSTS = /* @__PURE__ */ new Set([
|
|
|
8942
8953
|
"logs.browser-intake-datadoghq.com",
|
|
8943
8954
|
"session-replay.browser-intake-datadoghq.com"
|
|
8944
8955
|
]);
|
|
8945
|
-
function isBlockedUrl(url) {
|
|
8956
|
+
function isBlockedUrl(url, extra) {
|
|
8946
8957
|
try {
|
|
8947
8958
|
const host = new URL(url, location.href).hostname;
|
|
8948
|
-
|
|
8959
|
+
const all = [...BLOCKED_HOSTS, ...extra];
|
|
8960
|
+
return all.some((b) => host === b || host.endsWith("." + b));
|
|
8949
8961
|
} catch {
|
|
8950
8962
|
return false;
|
|
8951
8963
|
}
|
|
@@ -8959,8 +8971,9 @@ function truncateUrl(url) {
|
|
|
8959
8971
|
return url.length > 200 ? url.slice(0, 200) + "\u2026" : url;
|
|
8960
8972
|
}
|
|
8961
8973
|
}
|
|
8962
|
-
function createNetworkCollector() {
|
|
8974
|
+
function createNetworkCollector(extraBlockedHosts = []) {
|
|
8963
8975
|
const entries = [];
|
|
8976
|
+
const blocked = new Set(extraBlockedHosts);
|
|
8964
8977
|
let origFetch = null;
|
|
8965
8978
|
let origXHROpen = null;
|
|
8966
8979
|
let active = false;
|
|
@@ -8978,7 +8991,7 @@ function createNetworkCollector() {
|
|
|
8978
8991
|
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
8979
8992
|
const startTime = Date.now();
|
|
8980
8993
|
const res = await origFetch.call(window, input, init);
|
|
8981
|
-
if (!isBlockedUrl(url)) {
|
|
8994
|
+
if (!isBlockedUrl(url, blocked)) {
|
|
8982
8995
|
push({
|
|
8983
8996
|
method,
|
|
8984
8997
|
url: truncateUrl(url),
|
|
@@ -8994,7 +9007,7 @@ function createNetworkCollector() {
|
|
|
8994
9007
|
const startTime = Date.now();
|
|
8995
9008
|
const urlStr = typeof url === "string" ? url : url.href;
|
|
8996
9009
|
this.addEventListener("load", () => {
|
|
8997
|
-
if (!isBlockedUrl(urlStr)) {
|
|
9010
|
+
if (!isBlockedUrl(urlStr, blocked)) {
|
|
8998
9011
|
push({
|
|
8999
9012
|
method: method.toUpperCase(),
|
|
9000
9013
|
url: truncateUrl(urlStr),
|
|
@@ -9094,7 +9107,14 @@ function WidgetContent({
|
|
|
9094
9107
|
consoleCollector.current.start();
|
|
9095
9108
|
}
|
|
9096
9109
|
if (!networkCollector.current) {
|
|
9097
|
-
|
|
9110
|
+
const flintHost = (() => {
|
|
9111
|
+
try {
|
|
9112
|
+
return new URL(serverUrl).hostname;
|
|
9113
|
+
} catch {
|
|
9114
|
+
return "";
|
|
9115
|
+
}
|
|
9116
|
+
})();
|
|
9117
|
+
networkCollector.current = createNetworkCollector(flintHost ? [flintHost] : []);
|
|
9098
9118
|
networkCollector.current.start();
|
|
9099
9119
|
}
|
|
9100
9120
|
(0, import_react4.useEffect)(() => {
|