@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.106.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 532bdc6: Today tab lists NFL games after the NBA group. The schedule request now opts into `americanfootball`, and the states poll sends `nflGameIds` (only when non-empty) alongside `nbaGameIds`; `Conversation.getStates` takes the NFL ids as a third argument. NFL rows show team abbreviations, kickoff time, and the live quarter, clock and score, and pin as `americanfootball`. Cached Today schedules from before this release are discarded once. Deploy the server first: an older server ignores the extra sport, so a widget released before it caches a day with no NFL group for up to six hours.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [532bdc6]
|
|
12
|
+
- @sensiblestats/widget-sdk@0.73.0
|
|
13
|
+
|
|
3
14
|
## 0.105.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1208,7 +1208,7 @@ function isEnglishLocale(locale) {
|
|
|
1208
1208
|
}
|
|
1209
1209
|
|
|
1210
1210
|
// src/version.generated.ts
|
|
1211
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1211
|
+
var WIDGET_REACT_VERSION = "0.106.0";
|
|
1212
1212
|
|
|
1213
1213
|
// src/config.ts
|
|
1214
1214
|
function normalizeUi(cfg) {
|
|
@@ -3023,7 +3023,7 @@ var import_widget_sdk12 = require("@sensiblestats/widget-sdk");
|
|
|
3023
3023
|
|
|
3024
3024
|
// src/scheduleCache.ts
|
|
3025
3025
|
var PREFIX2 = "ss-w-schedule:";
|
|
3026
|
-
var SCHEMA_VERSION =
|
|
3026
|
+
var SCHEMA_VERSION = 4;
|
|
3027
3027
|
var TTL_MS3 = 6 * 36e5;
|
|
3028
3028
|
function scheduleCacheKey(operatorId, encodedUserKey2, localDate) {
|
|
3029
3029
|
return `${PREFIX2}${operatorId}:${encodedUserKey2}:${localDate}`;
|
|
@@ -3101,6 +3101,7 @@ var TERMINAL_PHASES = /* @__PURE__ */ new Set(["fullTime", "postponed"]);
|
|
|
3101
3101
|
function dueMatchIds(groups, states, nowMs) {
|
|
3102
3102
|
const football = /* @__PURE__ */ new Set();
|
|
3103
3103
|
const nba = /* @__PURE__ */ new Set();
|
|
3104
|
+
const nfl = /* @__PURE__ */ new Set();
|
|
3104
3105
|
for (const group of groups) {
|
|
3105
3106
|
for (const match of group.matches) {
|
|
3106
3107
|
if (nowMs - match.kickoffUnix * 1e3 < 0) continue;
|
|
@@ -3109,9 +3110,10 @@ function dueMatchIds(groups, states, nowMs) {
|
|
|
3109
3110
|
const sport = sportKeyOf(match.sport);
|
|
3110
3111
|
if (sport === "football") football.add(match.matchId);
|
|
3111
3112
|
else if (sport === "basketball") nba.add(match.matchId);
|
|
3113
|
+
else if (sport === "americanfootball") nfl.add(match.matchId);
|
|
3112
3114
|
}
|
|
3113
3115
|
}
|
|
3114
|
-
return { football: [...football], nba: [...nba] };
|
|
3116
|
+
return { football: [...football], nba: [...nba], nfl: [...nfl] };
|
|
3115
3117
|
}
|
|
3116
3118
|
|
|
3117
3119
|
// src/useMatchDiscovery.ts
|
|
@@ -3173,9 +3175,9 @@ function useMatchDiscovery(opts) {
|
|
|
3173
3175
|
}, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate]);
|
|
3174
3176
|
const tick = (0, import_react3.useCallback)(async () => {
|
|
3175
3177
|
const ids = dueMatchIds(groupsRef.current, statesRef.current, Date.now());
|
|
3176
|
-
if (ids.football.length === 0 && ids.nba.length === 0) return;
|
|
3178
|
+
if (ids.football.length === 0 && ids.nba.length === 0 && ids.nfl.length === 0) return;
|
|
3177
3179
|
try {
|
|
3178
|
-
const payload = await getStatesRef.current(ids.football, ids.nba);
|
|
3180
|
+
const payload = await getStatesRef.current(ids.football, ids.nba, ids.nfl);
|
|
3179
3181
|
if (!payload) return;
|
|
3180
3182
|
setStates((prev) => {
|
|
3181
3183
|
const next = new Map(prev);
|
|
@@ -9043,11 +9045,11 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
9043
9045
|
const score = hasScore ? `${state.homeScore}\u2013${state.awayScore}` : void 0;
|
|
9044
9046
|
const ticked = state?.phase === "live" ? state.minuteLabel ?? null : null;
|
|
9045
9047
|
const when = state?.isHalfTime && !stale ? ui.halfTime : isLive ? ticked ?? "\u2014" : state?.phase === "live" ? "\u2014" : kickoffLabel(match.kickoffUnix);
|
|
9046
|
-
const
|
|
9048
|
+
const isUsSport = sportKeyOf(match.sport) !== "football";
|
|
9047
9049
|
const pinSport = (0, import_widget_sdk26.slipSportOf)(match.sport);
|
|
9048
9050
|
const liveTone = isLive || state?.isHalfTime;
|
|
9049
|
-
const clockParts =
|
|
9050
|
-
const dayMarker =
|
|
9051
|
+
const clockParts = isUsSport && isLive && ticked !== null && !state?.isHalfTime ? splitAtFirstSpace(ticked) : null;
|
|
9052
|
+
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;
|
|
9051
9053
|
const twoLines = clockParts ?? (dayMarker !== null ? [when, dayMarker] : null);
|
|
9052
9054
|
const whenClass = [
|
|
9053
9055
|
"ss-w-drow-when",
|
|
@@ -9057,9 +9059,9 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
9057
9059
|
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: liveTone ? "ss-w-drow ss-w-drow--live" : "ss-w-drow", children: [
|
|
9058
9060
|
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: whenClass, children: twoLines ? twoLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { children: line }, i)) : when }),
|
|
9059
9061
|
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { className: "ss-w-drow-fx", children: [
|
|
9060
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Side2, { name: match.homeTeamName, crest: match.homeTeamImagePath, abbr:
|
|
9062
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Side2, { name: match.homeTeamName, crest: match.homeTeamImagePath, abbr: isUsSport ? match.homeTeamAbbr ?? void 0 : void 0 }),
|
|
9061
9063
|
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: hasScore ? "ss-w-drow-sc" : "ss-w-drow-sc ss-w-drow-sc--idle", children: score ?? "\u2013" }),
|
|
9062
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Side2, { name: match.awayTeamName, crest: match.awayTeamImagePath, abbr:
|
|
9064
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Side2, { name: match.awayTeamName, crest: match.awayTeamImagePath, abbr: isUsSport ? match.awayTeamAbbr ?? void 0 : void 0, away: true })
|
|
9063
9065
|
] }),
|
|
9064
9066
|
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
9065
9067
|
PinToggle,
|
|
@@ -15965,7 +15967,7 @@ function StatsWidget(props) {
|
|
|
15965
15967
|
[built, operatorUserId, anonymousUserId]
|
|
15966
15968
|
);
|
|
15967
15969
|
const getStates = (0, import_react79.useCallback)(
|
|
15968
|
-
(matchIds, nbaGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds) : Promise.resolve(null),
|
|
15970
|
+
(matchIds, nbaGameIds, nflGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds) : Promise.resolve(null),
|
|
15969
15971
|
[built]
|
|
15970
15972
|
);
|
|
15971
15973
|
const pinnedMatchIds = (0, import_react79.useMemo)(
|