@sensiblestats/widget-react 0.150.0 → 0.151.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/dist/index.js CHANGED
@@ -1347,7 +1347,7 @@ function parseCustomTotal(text2, format2) {
1347
1347
  }
1348
1348
 
1349
1349
  // src/version.generated.ts
1350
- var WIDGET_REACT_VERSION = "0.150.0";
1350
+ var WIDGET_REACT_VERSION = "0.151.0";
1351
1351
 
1352
1352
  // src/config.ts
1353
1353
  function hostTag(cfg) {
@@ -5731,6 +5731,7 @@ function sendGreetingOnce(log, owner, meta, surface) {
5731
5731
  name: "hook_view",
5732
5732
  entityType: "match",
5733
5733
  ...meta.matchId ? { entityId: meta.matchId } : {},
5734
+ sport: meta.sport,
5734
5735
  hook: meta.hook ?? "none",
5735
5736
  ...meta.hookFact ? { factKey: meta.hookFact } : {},
5736
5737
  outcome: surface
@@ -6160,7 +6161,7 @@ function AlternativeRows({ rows, market, marketLabel, ui, slotBase, add }) {
6160
6161
  {
6161
6162
  className: "ss-w-v8-card ss-w-v2-alt-row",
6162
6163
  "data-match-id": r.matchId,
6163
- "aria-label": ui.v2CardLabel(r.home, r.away, marketLabel),
6164
+ "aria-label": ui.v2CardLabel(r.home, r.away, r.marketLabel ?? marketLabel),
6164
6165
  onClickCapture: logRowTap(events, slotBase + i),
6165
6166
  children: [
6166
6167
  /* @__PURE__ */ jsxs9("header", { className: "ss-w-v8-card-head", children: [
@@ -6171,6 +6172,7 @@ function AlternativeRows({ rows, market, marketLabel, ui, slotBase, add }) {
6171
6172
  ] }),
6172
6173
  sub ? /* @__PURE__ */ jsx10("span", { className: "ss-w-v8-card-sub", children: sub }) : null
6173
6174
  ] }),
6175
+ r.marketLabel ? /* @__PURE__ */ jsx10("div", { className: "ss-w-v2-head", children: /* @__PURE__ */ jsx10("span", { className: "ss-w-v2-market", children: r.marketLabel }) }) : null,
6174
6176
  /* @__PURE__ */ jsx10(PriceButtons, { selections: r.selections, ui, onAdd: add ? (s) => add(r.matchId, market, s) : void 0 }),
6175
6177
  r.stat ? /* @__PURE__ */ jsx10("p", { className: "ss-w-v2-stat", children: r.stat }) : null
6176
6178
  ]
@@ -6372,7 +6374,7 @@ function oldestQuote(legs) {
6372
6374
 
6373
6375
  // src/components/dashboard/v2/useRepriceAdd.ts
6374
6376
  var NO_SLIP = {};
6375
- function useRepriceAdd({ conversation, locale, slip, ui }) {
6377
+ function useRepriceAdd({ conversation, locale, slip, ui, sport = "football" }) {
6376
6378
  const scope = useSportScope();
6377
6379
  const operatorUserId = scope?.operatorUserId;
6378
6380
  const anonymousUserId = scope?.anonymousUserId;
@@ -6391,7 +6393,7 @@ function useRepriceAdd({ conversation, locale, slip, ui }) {
6391
6393
  if (!conversation || !slip) return { outcome: "failed" };
6392
6394
  try {
6393
6395
  const grid = await conversation.getBuilderGrid(locale, {
6394
- sport: "football",
6396
+ sport,
6395
6397
  matchIds: [matchId],
6396
6398
  marketKey: market,
6397
6399
  legs: 1,
@@ -6402,8 +6404,8 @@ function useRepriceAdd({ conversation, locale, slip, ui }) {
6402
6404
  ...anonymousUserId ? { anonymousUserId } : {}
6403
6405
  });
6404
6406
  if (grid === null) return { outcome: "cool_off" };
6405
- if (grid.status !== "ok" || grid.legs.length !== 1) return { outcome: "gone" };
6406
- const leg = legsOf(grid, "football")?.[0];
6407
+ if (grid.status !== "ok" || grid.sport !== sport || grid.legs.length !== 1) return { outcome: "gone" };
6408
+ const leg = legsOf(grid, sport)?.[0];
6407
6409
  if (!leg) return { outcome: "gone" };
6408
6410
  kickoffs.current.set(leg.matchId, leg.kickoffUtc);
6409
6411
  const outcome = await addToSlip(comboLegToSlipSelection(leg, slip.conversationId), {
@@ -6417,7 +6419,7 @@ function useRepriceAdd({ conversation, locale, slip, ui }) {
6417
6419
  } catch {
6418
6420
  return { outcome: "failed" };
6419
6421
  }
6420
- }, [conversation, locale, slip, ui, addToSlip, operatorUserId, anonymousUserId]);
6422
+ }, [conversation, locale, slip, ui, sport, addToSlip, operatorUserId, anonymousUserId]);
6421
6423
  return canAdd2 ? add : void 0;
6422
6424
  }
6423
6425
 
@@ -6431,11 +6433,11 @@ var CHIP_LABEL = {
6431
6433
  build_combo: (ui) => ui.v2ChipBuildCombo
6432
6434
  };
6433
6435
  var chipsFor = (section2) => section2.chips.filter((c) => Object.prototype.hasOwnProperty.call(CHIP_LABEL, c) && (!section2.coolOff || c === "live_games"));
6434
- function MarketFirstGreeting({ section: section2, ui, slip, onAct }) {
6436
+ function MarketFirstGreeting({ section: section2, ui, slip, sport, onAct }) {
6435
6437
  const log = useEventLog();
6436
6438
  const personal = usePersonalGreeting();
6437
6439
  const openTab = personal?.openTab;
6438
- const add = useRepriceAdd({ conversation: personal?.conversation ?? null, locale: ui.hostTag, slip, ui });
6440
+ const add = useRepriceAdd({ conversation: personal?.conversation ?? null, locale: ui.hostTag, slip, ui, sport });
6439
6441
  const [chosen, setChosen] = useState20(null);
6440
6442
  const [open, setOpen] = useState20(false);
6441
6443
  const base = section2.coolOff ? void 0 : section2.featured;
@@ -7960,7 +7962,7 @@ function GreetingDashboard({ dashboard, dashboards, defaultSport, greeting, onTa
7960
7962
  /* @__PURE__ */ jsx33("span", { className: "ss-w-dash-title", children: shown2.title }),
7961
7963
  shown2.subtitle && !shown2.marketFirst ? /* @__PURE__ */ jsx33("span", { className: "ss-w-dash-subtitle", children: shown2.subtitle }) : null
7962
7964
  ] }),
7963
- shown2.marketFirst ? /* @__PURE__ */ jsx33(MarketFirstGreeting, { section: shown2.marketFirst, ui, slip, sport: active?.sport ?? (defaultSport || "football"), onAct }, active?.sport ?? "") : personal && slip ? /* @__PURE__ */ jsx33(PersonalGreeting, { personal, ui, slip, sport: active?.sport ?? (defaultSport || "football"), starsElsewhere, onAct }, active?.sport ?? "") : /* @__PURE__ */ jsx33("div", { className: "ss-w-dash-grid", children: shown2.tiles.map((t, i) => /* @__PURE__ */ jsx33(
7965
+ shown2.marketFirst ? /* @__PURE__ */ jsx33(MarketFirstGreeting, { section: shown2.marketFirst, ui, slip, sport: active?.sport ?? (defaultSport || greeting?.sport || "football"), onAct }, active?.sport ?? "") : personal && slip ? /* @__PURE__ */ jsx33(PersonalGreeting, { personal, ui, slip, sport: active?.sport ?? (defaultSport || greeting?.sport || "football"), starsElsewhere, onAct }, active?.sport ?? "") : /* @__PURE__ */ jsx33("div", { className: "ss-w-dash-grid", children: shown2.tiles.map((t, i) => /* @__PURE__ */ jsx33(
7964
7966
  DashboardTile,
7965
7967
  {
7966
7968
  tile: tileForFormat(t, oddsFormat),
@@ -8322,9 +8324,9 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
8322
8324
  // src/components/BubblePrice.tsx
8323
8325
  import { useMemo as useMemo11 } from "react";
8324
8326
  import { jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
8325
- function BubblePrice({ matchId, price, conversation, slip, ui, hook }) {
8327
+ function BubblePrice({ matchId, price, conversation, slip, ui, hook, sport }) {
8326
8328
  const selections = useMemo11(() => [price.selection], [price.selection]);
8327
- const add = useRepriceAdd({ conversation, locale: ui.hostTag, slip, ui });
8329
+ const add = useRepriceAdd({ conversation, locale: ui.hostTag, slip, ui, sport });
8328
8330
  return /* @__PURE__ */ jsxs33("div", { className: "ss-w-greeting-price", children: [
8329
8331
  /* @__PURE__ */ jsx37("span", { className: "ss-w-v2-market", children: price.marketLabel }),
8330
8332
  /* @__PURE__ */ jsx37(PriceButtons, { selections, ui, onAdd: add ? (s) => add(matchId, price.market, s, hook) : void 0 })
@@ -22461,7 +22463,8 @@ function StatsWidget(props) {
22461
22463
  conversation: built?.conversation ?? null,
22462
22464
  slip,
22463
22465
  ui,
22464
- hook: hookOf(greetingMeta)
22466
+ hook: hookOf(greetingMeta),
22467
+ sport: greetingBubble.sport
22465
22468
  }
22466
22469
  ) : void 0
22467
22470
  }