@sensiblestats/widget-react 0.162.0 → 0.164.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 +17 -0
- package/dist/index.cjs +13 -10
- 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 +13 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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.164.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
|
|
|
@@ -23721,8 +23724,10 @@ function StatsWidgetBody(props) {
|
|
|
23721
23724
|
}, [controller.state.messages]);
|
|
23722
23725
|
const requestTag = hostTag(cfg);
|
|
23723
23726
|
const clubFixturesResult = useClubFixtures(built?.conversation ?? null);
|
|
23727
|
+
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
23728
|
+
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
23724
23729
|
const monitor = useLiveMonitor({
|
|
23725
|
-
getLiveMonitor: (pins) => built ? built.conversation.getLiveMonitor(pins, requestTag) : Promise.resolve(null),
|
|
23730
|
+
getLiveMonitor: (pins) => built ? built.conversation.getLiveMonitor(pins, requestTag, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
23726
23731
|
getMarketOdds: (matchId, dev, sport) => built ? built.conversation.getMarketOdds(matchId, dev, sport) : Promise.resolve(null),
|
|
23727
23732
|
getPlayerProps: (matchId, sport) => built ? built.conversation.getPlayerProps(matchId, sport, requestTag) : Promise.resolve(null),
|
|
23728
23733
|
storageKey: `ss-w-pins:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}`,
|
|
@@ -23731,8 +23736,6 @@ function StatsWidgetBody(props) {
|
|
|
23731
23736
|
clubEnabled: clubFixturesResult.enabled,
|
|
23732
23737
|
record: record2
|
|
23733
23738
|
});
|
|
23734
|
-
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
23735
|
-
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
23736
23739
|
const getSchedule = useCallback32(
|
|
23737
23740
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
23738
23741
|
[built, operatorUserId, anonymousUserId]
|
|
@@ -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;
|