@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.163.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- `StatsWidget` takes `scriptUrls` (was `scriptUrl`): a window error or rejected promise counts as the widget's when its file or stack names any of them.
|
|
8
|
+
|
|
3
9
|
## 0.162.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1422,7 +1422,7 @@ function parseCustomTotal(text2, format2) {
|
|
|
1422
1422
|
}
|
|
1423
1423
|
|
|
1424
1424
|
// src/version.generated.ts
|
|
1425
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1425
|
+
var WIDGET_REACT_VERSION = "0.163.0";
|
|
1426
1426
|
|
|
1427
1427
|
// src/config.ts
|
|
1428
1428
|
var COLOR_KEYS = ["accent", "cta", "surface", "ink"];
|
|
@@ -9115,7 +9115,7 @@ function safely(fn) {
|
|
|
9115
9115
|
}
|
|
9116
9116
|
}
|
|
9117
9117
|
function useLoadTelemetry(input) {
|
|
9118
|
-
const { client, stringsState, stringsAttempt, resolvedTag, language,
|
|
9118
|
+
const { client, stringsState, stringsAttempt, resolvedTag, language, scriptUrls } = input;
|
|
9119
9119
|
const signedIn = !!input.operatorUserId;
|
|
9120
9120
|
const inputRef = (0, import_react62.useRef)(input);
|
|
9121
9121
|
inputRef.current = input;
|
|
@@ -9196,15 +9196,18 @@ function useLoadTelemetry(input) {
|
|
|
9196
9196
|
if (failedLimit(`${endpoint}|${status2}`)) recordRef.current({ name: "request_failed", props: { endpoint, status: status2 } });
|
|
9197
9197
|
});
|
|
9198
9198
|
}, [client]);
|
|
9199
|
+
const urlsKey = scriptUrls?.join("\n") ?? "";
|
|
9199
9200
|
(0, import_react62.useEffect)(() => {
|
|
9200
|
-
|
|
9201
|
+
const urls = urlsKey.split("\n").filter((u) => u.length > 0);
|
|
9202
|
+
if (!hasClient || urls.length === 0) return;
|
|
9203
|
+
const fromWidget = (text2) => urls.some((u) => text2.includes(u));
|
|
9201
9204
|
const onError = (e) => {
|
|
9202
|
-
if (!e.filename || !e.filename
|
|
9205
|
+
if (!e.filename || !fromWidget(e.filename)) return;
|
|
9203
9206
|
reportError({ errorClass: e.error?.name || "Error", component: "window" });
|
|
9204
9207
|
};
|
|
9205
9208
|
const onRejection = (e) => {
|
|
9206
9209
|
const reason = e.reason;
|
|
9207
|
-
if (typeof reason?.stack !== "string" || !reason.stack
|
|
9210
|
+
if (typeof reason?.stack !== "string" || !fromWidget(reason.stack)) return;
|
|
9208
9211
|
reportError({ errorClass: typeof reason.name === "string" && reason.name ? reason.name : "Error", component: "promise" });
|
|
9209
9212
|
};
|
|
9210
9213
|
window.addEventListener("error", onError);
|
|
@@ -9213,7 +9216,7 @@ function useLoadTelemetry(input) {
|
|
|
9213
9216
|
window.removeEventListener("error", onError);
|
|
9214
9217
|
window.removeEventListener("unhandledrejection", onRejection);
|
|
9215
9218
|
};
|
|
9216
|
-
}, [hasClient,
|
|
9219
|
+
}, [hasClient, urlsKey, reportError]);
|
|
9217
9220
|
return { reportError };
|
|
9218
9221
|
}
|
|
9219
9222
|
|
|
@@ -24184,7 +24187,7 @@ function StatsWidgetBody(props) {
|
|
|
24184
24187
|
hasSlipHandler: !!props.config?.onAddToSlip,
|
|
24185
24188
|
panelOpen,
|
|
24186
24189
|
mobile: props.mobile !== void 0,
|
|
24187
|
-
|
|
24190
|
+
scriptUrls: props.scriptUrls,
|
|
24188
24191
|
loadStart: props.loadStart ?? props.mountStart
|
|
24189
24192
|
});
|
|
24190
24193
|
props.errorSink.current = reportError;
|