@sensiblestats/widget-react 0.162.0 → 0.163.0
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/CHANGELOG.md +6 -0
- package/dist/index.cjs +10 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1383,7 +1383,7 @@ function parseCustomTotal(text2, format2) {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
|
|
1385
1385
|
// src/version.generated.ts
|
|
1386
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1386
|
+
var WIDGET_REACT_VERSION = "0.163.0";
|
|
1387
1387
|
|
|
1388
1388
|
// src/config.ts
|
|
1389
1389
|
var COLOR_KEYS = ["accent", "cta", "surface", "ink"];
|
|
@@ -9076,7 +9076,7 @@ function safely(fn) {
|
|
|
9076
9076
|
}
|
|
9077
9077
|
}
|
|
9078
9078
|
function useLoadTelemetry(input) {
|
|
9079
|
-
const { client, stringsState, stringsAttempt, resolvedTag, language,
|
|
9079
|
+
const { client, stringsState, stringsAttempt, resolvedTag, language, scriptUrls } = input;
|
|
9080
9080
|
const signedIn = !!input.operatorUserId;
|
|
9081
9081
|
const inputRef = useRef29(input);
|
|
9082
9082
|
inputRef.current = input;
|
|
@@ -9157,15 +9157,18 @@ function useLoadTelemetry(input) {
|
|
|
9157
9157
|
if (failedLimit(`${endpoint}|${status2}`)) recordRef.current({ name: "request_failed", props: { endpoint, status: status2 } });
|
|
9158
9158
|
});
|
|
9159
9159
|
}, [client]);
|
|
9160
|
+
const urlsKey = scriptUrls?.join("\n") ?? "";
|
|
9160
9161
|
useEffect33(() => {
|
|
9161
|
-
|
|
9162
|
+
const urls = urlsKey.split("\n").filter((u) => u.length > 0);
|
|
9163
|
+
if (!hasClient || urls.length === 0) return;
|
|
9164
|
+
const fromWidget = (text2) => urls.some((u) => text2.includes(u));
|
|
9162
9165
|
const onError = (e) => {
|
|
9163
|
-
if (!e.filename || !e.filename
|
|
9166
|
+
if (!e.filename || !fromWidget(e.filename)) return;
|
|
9164
9167
|
reportError({ errorClass: e.error?.name || "Error", component: "window" });
|
|
9165
9168
|
};
|
|
9166
9169
|
const onRejection = (e) => {
|
|
9167
9170
|
const reason = e.reason;
|
|
9168
|
-
if (typeof reason?.stack !== "string" || !reason.stack
|
|
9171
|
+
if (typeof reason?.stack !== "string" || !fromWidget(reason.stack)) return;
|
|
9169
9172
|
reportError({ errorClass: typeof reason.name === "string" && reason.name ? reason.name : "Error", component: "promise" });
|
|
9170
9173
|
};
|
|
9171
9174
|
window.addEventListener("error", onError);
|
|
@@ -9174,7 +9177,7 @@ function useLoadTelemetry(input) {
|
|
|
9174
9177
|
window.removeEventListener("error", onError);
|
|
9175
9178
|
window.removeEventListener("unhandledrejection", onRejection);
|
|
9176
9179
|
};
|
|
9177
|
-
}, [hasClient,
|
|
9180
|
+
}, [hasClient, urlsKey, reportError]);
|
|
9178
9181
|
return { reportError };
|
|
9179
9182
|
}
|
|
9180
9183
|
|
|
@@ -24145,7 +24148,7 @@ function StatsWidgetBody(props) {
|
|
|
24145
24148
|
hasSlipHandler: !!props.config?.onAddToSlip,
|
|
24146
24149
|
panelOpen,
|
|
24147
24150
|
mobile: props.mobile !== void 0,
|
|
24148
|
-
|
|
24151
|
+
scriptUrls: props.scriptUrls,
|
|
24149
24152
|
loadStart: props.loadStart ?? props.mountStart
|
|
24150
24153
|
});
|
|
24151
24154
|
props.errorSink.current = reportError;
|