@sensiblestats/widget-react 0.105.0 → 0.106.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 +11 -0
- package/dist/index.cjs +13 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1170,7 +1170,7 @@ function isEnglishLocale(locale) {
|
|
|
1170
1170
|
}
|
|
1171
1171
|
|
|
1172
1172
|
// src/version.generated.ts
|
|
1173
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1173
|
+
var WIDGET_REACT_VERSION = "0.106.0";
|
|
1174
1174
|
|
|
1175
1175
|
// src/config.ts
|
|
1176
1176
|
function normalizeUi(cfg) {
|
|
@@ -2985,7 +2985,7 @@ import { matchKey as matchKey2 } from "@sensiblestats/widget-sdk";
|
|
|
2985
2985
|
|
|
2986
2986
|
// src/scheduleCache.ts
|
|
2987
2987
|
var PREFIX2 = "ss-w-schedule:";
|
|
2988
|
-
var SCHEMA_VERSION =
|
|
2988
|
+
var SCHEMA_VERSION = 4;
|
|
2989
2989
|
var TTL_MS3 = 6 * 36e5;
|
|
2990
2990
|
function scheduleCacheKey(operatorId, encodedUserKey2, localDate) {
|
|
2991
2991
|
return `${PREFIX2}${operatorId}:${encodedUserKey2}:${localDate}`;
|
|
@@ -3063,6 +3063,7 @@ var TERMINAL_PHASES = /* @__PURE__ */ new Set(["fullTime", "postponed"]);
|
|
|
3063
3063
|
function dueMatchIds(groups, states, nowMs) {
|
|
3064
3064
|
const football = /* @__PURE__ */ new Set();
|
|
3065
3065
|
const nba = /* @__PURE__ */ new Set();
|
|
3066
|
+
const nfl = /* @__PURE__ */ new Set();
|
|
3066
3067
|
for (const group of groups) {
|
|
3067
3068
|
for (const match of group.matches) {
|
|
3068
3069
|
if (nowMs - match.kickoffUnix * 1e3 < 0) continue;
|
|
@@ -3071,9 +3072,10 @@ function dueMatchIds(groups, states, nowMs) {
|
|
|
3071
3072
|
const sport = sportKeyOf(match.sport);
|
|
3072
3073
|
if (sport === "football") football.add(match.matchId);
|
|
3073
3074
|
else if (sport === "basketball") nba.add(match.matchId);
|
|
3075
|
+
else if (sport === "americanfootball") nfl.add(match.matchId);
|
|
3074
3076
|
}
|
|
3075
3077
|
}
|
|
3076
|
-
return { football: [...football], nba: [...nba] };
|
|
3078
|
+
return { football: [...football], nba: [...nba], nfl: [...nfl] };
|
|
3077
3079
|
}
|
|
3078
3080
|
|
|
3079
3081
|
// src/useMatchDiscovery.ts
|
|
@@ -3135,9 +3137,9 @@ function useMatchDiscovery(opts) {
|
|
|
3135
3137
|
}, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate]);
|
|
3136
3138
|
const tick = useCallback2(async () => {
|
|
3137
3139
|
const ids = dueMatchIds(groupsRef.current, statesRef.current, Date.now());
|
|
3138
|
-
if (ids.football.length === 0 && ids.nba.length === 0) return;
|
|
3140
|
+
if (ids.football.length === 0 && ids.nba.length === 0 && ids.nfl.length === 0) return;
|
|
3139
3141
|
try {
|
|
3140
|
-
const payload = await getStatesRef.current(ids.football, ids.nba);
|
|
3142
|
+
const payload = await getStatesRef.current(ids.football, ids.nba, ids.nfl);
|
|
3141
3143
|
if (!payload) return;
|
|
3142
3144
|
setStates((prev) => {
|
|
3143
3145
|
const next = new Map(prev);
|
|
@@ -9005,11 +9007,11 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
9005
9007
|
const score = hasScore ? `${state.homeScore}\u2013${state.awayScore}` : void 0;
|
|
9006
9008
|
const ticked = state?.phase === "live" ? state.minuteLabel ?? null : null;
|
|
9007
9009
|
const when = state?.isHalfTime && !stale ? ui.halfTime : isLive ? ticked ?? "\u2014" : state?.phase === "live" ? "\u2014" : kickoffLabel(match.kickoffUnix);
|
|
9008
|
-
const
|
|
9010
|
+
const isUsSport = sportKeyOf(match.sport) !== "football";
|
|
9009
9011
|
const pinSport = slipSportOf8(match.sport);
|
|
9010
9012
|
const liveTone = isLive || state?.isHalfTime;
|
|
9011
|
-
const clockParts =
|
|
9012
|
-
const dayMarker =
|
|
9013
|
+
const clockParts = isUsSport && isLive && ticked !== null && !state?.isHalfTime ? splitAtFirstSpace(ticked) : null;
|
|
9014
|
+
const dayMarker = isUsSport && !liveTone && state?.phase !== "live" && isOtherLocalDay(match.kickoffUnix, /* @__PURE__ */ new Date()) ? new Intl.DateTimeFormat(ui.locale === "tr" ? "tr-TR" : "en-GB", { weekday: "short" }).format(new Date(match.kickoffUnix * 1e3)) : null;
|
|
9013
9015
|
const twoLines = clockParts ?? (dayMarker !== null ? [when, dayMarker] : null);
|
|
9014
9016
|
const whenClass = [
|
|
9015
9017
|
"ss-w-drow-when",
|
|
@@ -9019,9 +9021,9 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
9019
9021
|
return /* @__PURE__ */ jsxs60("div", { className: liveTone ? "ss-w-drow ss-w-drow--live" : "ss-w-drow", children: [
|
|
9020
9022
|
/* @__PURE__ */ jsx65("span", { className: whenClass, children: twoLines ? twoLines.map((line, i) => /* @__PURE__ */ jsx65("span", { children: line }, i)) : when }),
|
|
9021
9023
|
/* @__PURE__ */ jsxs60("span", { className: "ss-w-drow-fx", children: [
|
|
9022
|
-
/* @__PURE__ */ jsx65(Side2, { name: match.homeTeamName, crest: match.homeTeamImagePath, abbr:
|
|
9024
|
+
/* @__PURE__ */ jsx65(Side2, { name: match.homeTeamName, crest: match.homeTeamImagePath, abbr: isUsSport ? match.homeTeamAbbr ?? void 0 : void 0 }),
|
|
9023
9025
|
/* @__PURE__ */ jsx65("span", { className: hasScore ? "ss-w-drow-sc" : "ss-w-drow-sc ss-w-drow-sc--idle", children: score ?? "\u2013" }),
|
|
9024
|
-
/* @__PURE__ */ jsx65(Side2, { name: match.awayTeamName, crest: match.awayTeamImagePath, abbr:
|
|
9026
|
+
/* @__PURE__ */ jsx65(Side2, { name: match.awayTeamName, crest: match.awayTeamImagePath, abbr: isUsSport ? match.awayTeamAbbr ?? void 0 : void 0, away: true })
|
|
9025
9027
|
] }),
|
|
9026
9028
|
/* @__PURE__ */ jsx65(
|
|
9027
9029
|
PinToggle,
|
|
@@ -15927,7 +15929,7 @@ function StatsWidget(props) {
|
|
|
15927
15929
|
[built, operatorUserId, anonymousUserId]
|
|
15928
15930
|
);
|
|
15929
15931
|
const getStates = useCallback24(
|
|
15930
|
-
(matchIds, nbaGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds) : Promise.resolve(null),
|
|
15932
|
+
(matchIds, nbaGameIds, nflGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds) : Promise.resolve(null),
|
|
15931
15933
|
[built]
|
|
15932
15934
|
);
|
|
15933
15935
|
const pinnedMatchIds = useMemo7(
|