@sensiblestats/widget-react 0.124.0 → 0.124.2

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/dist/index.js CHANGED
@@ -823,7 +823,8 @@ var BUNDLED_EN_GB = {
823
823
  "widget.tennis.headToHead": "Head to head",
824
824
  "widget.tennis.movedSince": "Moved since {date}",
825
825
  "widget.tennis.unchangedSince": "Unchanged since {date}",
826
- "widget.tennis.updated": "updated {time}"
826
+ "widget.tennis.updated": "updated {time}",
827
+ "widget.tennis.vs": "vs"
827
828
  };
828
829
 
829
830
  // src/strings/fill.ts
@@ -1178,7 +1179,7 @@ function parseOddsFormat(value) {
1178
1179
  }
1179
1180
 
1180
1181
  // src/version.generated.ts
1181
- var WIDGET_REACT_VERSION = "0.124.0";
1182
+ var WIDGET_REACT_VERSION = "0.124.2";
1182
1183
 
1183
1184
  // src/config.ts
1184
1185
  function hostTag(cfg) {
@@ -5846,7 +5847,10 @@ function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip
5846
5847
  children: [
5847
5848
  settled ? /* @__PURE__ */ jsx6("span", { className: "ss-w-mol-tick", "aria-hidden": "true", children: "\u2713" }) : null,
5848
5849
  price.label ? /* @__PURE__ */ jsx6("span", { className: "ss-w-mol-lab", children: price.label }) : null,
5849
- /* @__PURE__ */ jsx6("span", { children: formatOdds(selection.forms, oddsFormat) })
5850
+ /* @__PURE__ */ jsxs5("span", { className: price.valueClass, children: [
5851
+ price.lead,
5852
+ formatOdds(selection.forms, oddsFormat)
5853
+ ] })
5850
5854
  ]
5851
5855
  }
5852
5856
  ) : /* @__PURE__ */ jsx6(
@@ -5962,6 +5966,9 @@ function useNextKickoffRender(kickoffs) {
5962
5966
 
5963
5967
  // src/components/OddsMovementBadge.tsx
5964
5968
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
5969
+ function oddsMovedLabel(previous, current, direction2, ui) {
5970
+ return ui.oddsMoved(previous, current, direction2 === "shortened" ? ui.oddsShortened : ui.oddsDrifted);
5971
+ }
5965
5972
  function OddsMovementBadge({
5966
5973
  previous,
5967
5974
  current,
@@ -11314,10 +11321,10 @@ function FixtureRow({ match, state, stale, ui, monitor, onOpen }) {
11314
11321
 
11315
11322
  // src/components/TennisFixtureRow.tsx
11316
11323
  import { Fragment as Fragment20, jsx as jsx84, jsxs as jsxs79 } from "react/jsx-runtime";
11317
- function TennisSidePrice({ matchId, tour, price, forms, value, oddsId, player, ui, slip }) {
11324
+ function TennisSidePrice({ matchId, tour, price, forms, value, oddsId, player, ui, slip, name, lead, movedLabel }) {
11318
11325
  const { oddsFormat } = useOddsSettings();
11319
11326
  const added = useSlipState()?.added;
11320
- const slipAllowed = !!slip && price.addToSlipEnabled && !price.isLive && slipOpenFor(slip, "tennis");
11327
+ const slipAllowed = !!slip && price.addToSlipEnabled && slipOpenFor(slip, "tennis");
11321
11328
  const label = formatOdds(forms, oddsFormat);
11322
11329
  const selection = slipAllowed && oddsId != null ? {
11323
11330
  matchOddsId: oddsId,
@@ -11330,17 +11337,32 @@ function TennisSidePrice({ matchId, tour, price, forms, value, oddsId, player, u
11330
11337
  ...slip.conversationId !== void 0 ? { conversationId: slip.conversationId } : {}
11331
11338
  } : null;
11332
11339
  const inSlip = oddsId != null && !!added?.[slipKey({ matchOddsId: oddsId, sport: "tennis" })];
11333
- return selection ? /* @__PURE__ */ jsx84(
11334
- SlipButton,
11335
- {
11336
- selection,
11337
- marketDeveloperName: "match_winner",
11338
- selectionLabel: player.slice(0, 64),
11339
- slip,
11340
- ui,
11341
- price: { ariaLabel: `${player} ${label}` }
11342
- }
11343
- ) : /* @__PURE__ */ jsxs79("span", { className: inSlip ? "ss-w-trow-price ss-w-trow-price--in" : "ss-w-trow-price", children: [
11340
+ const ariaLabel = `${player} ${label}${movedLabel ? `, ${movedLabel}` : ""}`;
11341
+ if (selection) {
11342
+ return /* @__PURE__ */ jsx84(
11343
+ SlipButton,
11344
+ {
11345
+ selection,
11346
+ marketDeveloperName: "match_winner",
11347
+ selectionLabel: player.slice(0, 64),
11348
+ slip,
11349
+ ui,
11350
+ price: name !== void 0 ? { ariaLabel, label: name, valueClass: "ss-w-tn-pv", lead } : { ariaLabel }
11351
+ }
11352
+ );
11353
+ }
11354
+ const cls = inSlip ? "ss-w-trow-price ss-w-trow-price--in" : "ss-w-trow-price";
11355
+ return name !== void 0 ? /* @__PURE__ */ jsxs79("span", { className: cls, children: [
11356
+ /* @__PURE__ */ jsxs79("span", { className: "ss-w-vh", children: [
11357
+ player,
11358
+ " "
11359
+ ] }),
11360
+ /* @__PURE__ */ jsx84("span", { className: "ss-w-mol-lab", "aria-hidden": "true", children: name }),
11361
+ /* @__PURE__ */ jsxs79("span", { className: "ss-w-tn-pv", children: [
11362
+ lead,
11363
+ label
11364
+ ] })
11365
+ ] }) : /* @__PURE__ */ jsxs79("span", { className: cls, children: [
11344
11366
  /* @__PURE__ */ jsxs79("span", { className: "ss-w-vh", children: [
11345
11367
  player,
11346
11368
  " "
@@ -11413,24 +11435,26 @@ function WinnerPrice({ match, t, price, ui, slip }) {
11413
11435
  ] : [];
11414
11436
  if (!price && match.phase === "fullTime") return /* @__PURE__ */ jsx85(Fragment21, {});
11415
11437
  return /* @__PURE__ */ jsxs80("section", { className: "ss-w-tn-sec", children: [
11416
- /* @__PURE__ */ jsxs80("h4", { className: "ss-w-tn-h", children: [
11417
- t.labels.matchWinner,
11418
- price ? ` \xB7 ${price.bookmaker}` : ""
11419
- ] }),
11438
+ /* @__PURE__ */ jsx85("h4", { className: "ss-w-tn-h", children: t.labels.matchWinner }),
11420
11439
  price && common ? /* @__PURE__ */ jsxs80(Fragment21, { children: [
11421
- /* @__PURE__ */ jsx85("div", { className: "ss-w-tn-prices", children: sides.map((s) => /* @__PURE__ */ jsxs80("div", { className: "ss-w-tn-pside", children: [
11422
- /* @__PURE__ */ jsx85("span", { className: "ss-w-tn-pname", children: s.player.shortName }),
11423
- /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-prices", children: /* @__PURE__ */ jsx85(TennisSidePrice, { ...common, forms: s.forms, value: s.value, oddsId: s.oddsId, player: s.player.name }) }),
11424
- /* @__PURE__ */ jsx85(
11425
- OddsMovementBadge,
11440
+ /* @__PURE__ */ jsx85("div", { className: "ss-w-tn-prices", children: sides.map((s) => {
11441
+ const previous = s.previous ? formatOdds(s.previous, oddsFormat) : void 0;
11442
+ const current = formatOdds(s.forms, oddsFormat);
11443
+ const hasMove = previous !== void 0 && s.dir !== void 0;
11444
+ return /* @__PURE__ */ jsx85("div", { className: "ss-w-tn-pside", children: /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-prices", children: /* @__PURE__ */ jsx85(
11445
+ TennisSidePrice,
11426
11446
  {
11427
- previous: s.previous ? formatOdds(s.previous, oddsFormat) : void 0,
11428
- current: formatOdds(s.forms, oddsFormat),
11429
- direction: s.dir,
11430
- ui
11447
+ ...common,
11448
+ forms: s.forms,
11449
+ value: s.value,
11450
+ oddsId: s.oddsId,
11451
+ player: s.player.name,
11452
+ name: s.player.shortName,
11453
+ lead: /* @__PURE__ */ jsx85(OddsMovementBadge, { previous, current, direction: s.dir, ui }),
11454
+ movedLabel: hasMove ? oddsMovedLabel(previous, current, s.dir, ui) : void 0
11431
11455
  }
11432
- )
11433
- ] }, s.player.playerId)) }),
11456
+ ) }) }, s.player.playerId);
11457
+ }) }),
11434
11458
  /* @__PURE__ */ jsxs80("p", { className: "ss-w-tn-note", children: [
11435
11459
  since ? `${moved ? ui.tennis.movedSince(since) : ui.tennis.unchangedSince(since)} \xB7 ` : "",
11436
11460
  ui.tennis.updated(ui.bettingKickoff(price.quotedAtUtc).time)
@@ -11467,18 +11491,39 @@ var SCORE = /(\d+[-–]\d+(?:\(\d+\))?)/;
11467
11491
  function wholeScores(text2) {
11468
11492
  return text2.split(SCORE).map((part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx85("span", { className: "ss-w-tn-set", children: part }, i) : part);
11469
11493
  }
11494
+ function Meeting({ m, t, ui }) {
11495
+ const where = [
11496
+ String(m.year),
11497
+ m.tournamentName,
11498
+ m.round ? ui.tennis.round[m.round] ?? m.round : null,
11499
+ m.surface ? surfaceLabel(ui, m.surface) : null
11500
+ ].filter(Boolean).join(" \xB7 ");
11501
+ const winner = m.winnerId === t.p1.playerId ? t.p1.shortName : m.winnerId === t.p2.playerId ? t.p2.shortName : null;
11502
+ return /* @__PURE__ */ jsxs80("li", { className: "ss-w-tn-meeting", children: [
11503
+ /* @__PURE__ */ jsx85("span", { className: "ss-w-tn-mwhere", children: where }),
11504
+ /* @__PURE__ */ jsxs80("span", { className: "ss-w-tn-mwho", children: [
11505
+ winner ? /* @__PURE__ */ jsx85("span", { className: "ss-w-tn-mname", children: winner }) : null,
11506
+ m.score ? /* @__PURE__ */ jsx85("span", { className: "ss-w-tn-set", children: m.score }) : null
11507
+ ] })
11508
+ ] });
11509
+ }
11470
11510
  function HeadToHead({ t, ui }) {
11471
11511
  if (!t.labels.headToHead) return null;
11512
+ const h = t.headToHead;
11513
+ const meetings = (h?.meetings?.length ? h.meetings : h?.last ? [h.last] : []).slice(0, 3);
11472
11514
  return /* @__PURE__ */ jsxs80("section", { className: "ss-w-tn-sec", children: [
11473
- /* @__PURE__ */ jsx85("h4", { className: "ss-w-tn-h", children: ui.tennis.headToHead }),
11474
- /* @__PURE__ */ jsx85("p", { className: "ss-w-tn-leader", children: wholeScores(t.labels.headToHead) }),
11475
- t.labels.lastMeeting && /* @__PURE__ */ jsx85("p", { className: "ss-w-tn-last", children: wholeScores(t.labels.lastMeeting) })
11515
+ /* @__PURE__ */ jsxs80("div", { className: "ss-w-tn-h2h-head", children: [
11516
+ /* @__PURE__ */ jsx85("h4", { className: "ss-w-tn-h", children: ui.tennis.headToHead }),
11517
+ /* @__PURE__ */ jsx85("span", { className: "ss-w-tn-leader", children: wholeScores(t.labels.headToHead) })
11518
+ ] }),
11519
+ meetings.length > 0 && /* @__PURE__ */ jsx85("ul", { className: "ss-w-tn-meetings", role: "list", children: meetings.map((m, i) => /* @__PURE__ */ jsx85(Meeting, { m, t, ui }, i)) })
11476
11520
  ] });
11477
11521
  }
11478
11522
  function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
11479
11523
  const t = match.tennis;
11480
11524
  if (!t) return /* @__PURE__ */ jsx85(UnavailableCard, { match, monitor, ui, sport: "tennis" });
11481
- const kickoff = !t.header.timeTba && t.header.startsAtUtc ? ui.bettingKickoff(t.header.startsAtUtc) : null;
11525
+ const preMatch = match.phase === "preMatch";
11526
+ const kickoff = preMatch && !t.header.timeTba && t.header.startsAtUtc ? ui.bettingKickoff(t.header.startsAtUtc) : null;
11482
11527
  const round = t.header.round ? ui.tennis.round[t.header.round] ?? t.header.round : null;
11483
11528
  const surface = t.header.surface ? surfaceLabel(ui, t.header.surface) : null;
11484
11529
  const ask = () => {
@@ -11491,12 +11536,15 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
11491
11536
  };
11492
11537
  onAsk(t.askPrompt, grounding, "match_sheet");
11493
11538
  };
11494
- return /* @__PURE__ */ jsx85("div", { className: "ss-w-mon-item", children: /* @__PURE__ */ jsxs80("div", { className: "ss-w-mon ss-w-tn-card", children: [
11539
+ return /* @__PURE__ */ jsx85("div", { className: "ss-w-mon-item", children: /* @__PURE__ */ jsxs80("div", { className: "ss-w-mon ss-w-tn-card", lang: ui.locale, children: [
11495
11540
  /* @__PURE__ */ jsxs80("div", { className: "ss-w-mon-top", children: [
11496
- match.phase === "live" && /* @__PURE__ */ jsx85("span", { className: "ss-w-fandash-live-pill", children: ui.liveLabel }),
11541
+ match.phase === "live" && /* @__PURE__ */ jsxs80("span", { className: "ss-w-fandash-live-pill", children: [
11542
+ /* @__PURE__ */ jsx85("span", { className: "ss-w-fandash-live-dot", "aria-hidden": "true" }),
11543
+ ui.liveLabel
11544
+ ] }),
11497
11545
  match.phase === "fullTime" && /* @__PURE__ */ jsx85("span", { className: "ss-w-mon-pill", children: ui.fullTimeLabel }),
11498
11546
  match.phase === "postponed" && /* @__PURE__ */ jsx85("span", { className: "ss-w-mon-pill", children: ui.postponedLabel }),
11499
- t.header.timeTba && /* @__PURE__ */ jsx85("span", { className: "ss-w-mon-pill", children: ui.tennis.timeTba }),
11547
+ preMatch && t.header.timeTba && /* @__PURE__ */ jsx85("span", { className: "ss-w-mon-pill", children: ui.tennis.timeTba }),
11500
11548
  kickoff && /* @__PURE__ */ jsxs80("span", { className: "ss-w-mon-pill", children: [
11501
11549
  kickoff.dayLabel,
11502
11550
  " \xB7 ",
@@ -11508,7 +11556,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
11508
11556
  (round || surface) && /* @__PURE__ */ jsx85("p", { className: "ss-w-tn-meta", children: [round, surface].filter(Boolean).join(" \xB7 ") }),
11509
11557
  /* @__PURE__ */ jsxs80("div", { className: "ss-w-tn-players", children: [
11510
11558
  /* @__PURE__ */ jsx85(Player2, { side: t.p1, rankRace: t.labels.p1RankRace }),
11511
- /* @__PURE__ */ jsx85("span", { className: "ss-w-mon-vs", children: ui.venue.home }),
11559
+ /* @__PURE__ */ jsx85("span", { className: "ss-w-mon-vs", children: ui.tennis.vs }),
11512
11560
  /* @__PURE__ */ jsx85(Player2, { side: t.p2, rankRace: t.labels.p2RankRace })
11513
11561
  ] }),
11514
11562
  /* @__PURE__ */ jsx85(WinnerPrice, { match, t, price: t.price, ui, slip }),
@@ -18377,6 +18425,10 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
18377
18425
  .ss-w-trow { display: grid; grid-template-columns: 56px minmax(0,1fr) 56px; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--ss-w-line); min-width: 0; }
18378
18426
  .ss-w-trow:last-child { border-bottom: none; }
18379
18427
  .ss-w-trow--noprice { grid-template-columns: 56px minmax(0,1fr); }
18428
+ .ss-w-trow--pin { grid-template-columns: 56px minmax(0,1fr) 56px 22px; }
18429
+ .ss-w-trow--pin.ss-w-trow--noprice { grid-template-columns: 56px minmax(0,1fr) 22px; }
18430
+ .ss-w-trow-open { padding: 0; font: inherit; color: inherit; text-align: left; background: none; border: none; cursor: pointer; }
18431
+ .ss-w-trow-open:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; border-radius: 6px; }
18380
18432
  .ss-w-trow-when { min-width: 0; font-size: 11px; font-weight: 700; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
18381
18433
  .ss-w-trow-when--tba { font-size: 10px; font-weight: 600; line-height: 1.15; }
18382
18434
  .ss-w-trow-live { color: var(--ss-w-neg); }
@@ -18404,12 +18456,18 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
18404
18456
  .ss-w-tn-rank { font-size: 10.5px; font-weight: 600; line-height: 1.25; color: var(--ss-w-faint); overflow-wrap: anywhere; }
18405
18457
  .ss-w-tn-sec { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--ss-w-line); min-width: 0; }
18406
18458
  .ss-w-tn-h { margin: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ss-w-faint); overflow-wrap: anywhere; }
18407
- .ss-w-tn-prices { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
18408
- .ss-w-tn-pside { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 0; }
18409
- .ss-w-tn-pname { font-size: 11px; font-weight: 650; color: var(--ss-w-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
18410
- .ss-w-tn-pside .ss-w-trow-prices { flex-direction: row; }
18411
- .ss-w-tn-pside .ss-w-trow-price, .ss-w-tn-pside .ss-w-trow-prices .ss-w-slip-btn.ss-w-slip-btn--price { padding: 7px 0; font-size: 14px; }
18412
- .ss-w-tn-pside .ss-w-move { justify-content: center; }
18459
+ .ss-w-tn-prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
18460
+ .ss-w-tn-pside { display: flex; min-width: 0; }
18461
+ .ss-w-tn-pside .ss-w-trow-prices { flex: 1; min-width: 0; }
18462
+ .ss-w-tn-pside .ss-w-trow-price, .ss-w-tn-pside .ss-w-trow-prices .ss-w-slip-btn.ss-w-slip-btn--price { box-sizing: border-box; display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; padding: 8px 10px; border-radius: 10px; font-size: 15px; font-weight: 700; line-height: 1.2; text-align: left; white-space: nowrap; overflow: hidden; }
18463
+ .ss-w-tn-pside .ss-w-trow-price { padding: 9px 11px; border: none; background: none; }
18464
+ .ss-w-tn-pside .ss-w-trow-prices .ss-w-slip { flex: 1; min-width: 0; }
18465
+ .ss-w-tn-pside .ss-w-trow-prices .ss-w-toast { top: calc(100% + 6px); right: 0; transform: none; }
18466
+ .ss-w-tn-pside .ss-w-mol-lab { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-size: 13px; font-weight: 600; color: var(--ss-w-ink); }
18467
+ .ss-w-tn-pside .ss-w-mol-tick { flex: none; margin-right: -2px; }
18468
+ .ss-w-tn-pside .ss-w-tn-pv { flex: none; display: inline-flex; align-items: baseline; gap: 6px; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
18469
+ .ss-w-tn-pside .ss-w-move { gap: 3px; font-weight: 600; }
18470
+ .ss-w-tn-pside .ss-w-move-prev { font-size: 11px; }
18413
18471
  .ss-w-tn-note { margin: 0; font-size: 10.5px; font-weight: 600; line-height: 1.35; color: var(--ss-w-faint); overflow-wrap: anywhere; }
18414
18472
  .ss-w-tn-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,auto) minmax(0,1fr); align-items: center; gap: 6px 8px; }
18415
18473
  .ss-w-tn-row { display: contents; }
@@ -18422,8 +18480,13 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
18422
18480
  .ss-w-tn-fchip { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 4px; font-size: 9px; font-weight: 800; color: #fff; background: var(--ss-w-faint); }
18423
18481
  .ss-w-tn-fchip--l { background: var(--ss-w-neg); }
18424
18482
  .ss-w-tn-fchip--w { background: var(--ss-w-pos); }
18425
- .ss-w-tn-leader { margin: 0; font-size: 15px; font-weight: 800; line-height: 1.25; color: var(--ss-w-ink); overflow-wrap: anywhere; }
18426
- .ss-w-tn-last { margin: 0; min-width: 0; font-size: 11.5px; line-height: 1.4; color: var(--ss-w-faint); overflow-wrap: anywhere; }
18483
+ .ss-w-tn-h2h-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
18484
+ .ss-w-tn-leader { min-width: 0; text-align: right; font-size: 13px; font-weight: 800; line-height: 1.25; color: var(--ss-w-ink); overflow-wrap: anywhere; }
18485
+ .ss-w-tn-meetings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
18486
+ .ss-w-tn-meeting { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
18487
+ .ss-w-tn-mwhere { min-width: 0; font-size: 11.5px; line-height: 1.35; color: var(--ss-w-faint); overflow-wrap: anywhere; }
18488
+ .ss-w-tn-mname { min-width: 0; overflow-wrap: anywhere; }
18489
+ .ss-w-tn-mwho { display: flex; flex-wrap: wrap; gap: 0 6px; font-size: 12px; font-weight: 700; line-height: 1.35; color: var(--ss-w-ink); }
18427
18490
  .ss-w-tn-set { white-space: nowrap; font-variant-numeric: tabular-nums; }
18428
18491
  .ss-w-tn-ask { align-self: stretch; min-height: 40px; border: 1px solid var(--ss-w-line); border-radius: 20px; background: var(--ss-w-bubble); font: inherit; font-size: 13px; font-weight: 650; color: var(--ss-w-ink); cursor: pointer; padding: 8px 14px; }
18429
18492
  .ss-w-tn-ask:hover { border-color: var(--ss-w-accent); }