@sensiblestats/widget-react 0.75.0 → 0.76.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
@@ -154,7 +154,8 @@ var STRINGS = {
154
154
  marketRow: "{market} picks today",
155
155
  marketName: "Market",
156
156
  marketShort: (dev, market, sel) => ({ BOTH_TEAMS_TO_SCORE: "BTTS", DOUBLE_CHANCE: "Double chance", FULLTIME_RESULT: "Match winner" })[dev] ?? (dev === "GOALS_OVER_UNDER" && sel ? sel : sel ? `${market} ${sel}` : market),
157
- marketMessage: (market, sel, count) => `Show me ${count} ${sel ? `${market} \u2013 ${sel}` : market} picks.`
157
+ marketMessage: (market, sel, count) => `Show me ${count} ${sel ? `${market} \u2013 ${sel}` : market} picks.`,
158
+ standoutAsk: "Standout matches today"
158
159
  },
159
160
  games: {
160
161
  lang: "en",
@@ -493,7 +494,8 @@ var STRINGS = {
493
494
  marketRow: "Bug\xFCnk\xFC {market} se\xE7imleri",
494
495
  marketName: "Bahis t\xFCr\xFC",
495
496
  marketShort: (dev, market, sel) => ({ BOTH_TEAMS_TO_SCORE: "KG Var", DOUBLE_CHANCE: "\xC7ifte \u015Fans", FULLTIME_RESULT: "Ma\xE7 sonucu" })[dev] ?? (dev === "GOALS_OVER_UNDER" && sel ? sel : sel ? `${market} ${sel}` : market),
496
- marketMessage: (market, sel, count) => `${count} ${sel ? `${market} \u2013 ${sel}` : market} se\xE7imi g\xF6ster.`
497
+ marketMessage: (market, sel, count) => `${count} ${sel ? `${market} \u2013 ${sel}` : market} se\xE7imi g\xF6ster.`,
498
+ standoutAsk: "Bug\xFCn\xFCn \xF6ne \xE7\u0131kan ma\xE7lar\u0131"
497
499
  },
498
500
  games: {
499
501
  lang: "tr",
@@ -1954,18 +1956,23 @@ function tileDisplayText(tile) {
1954
1956
  const subtitle = tile.subtitle?.trim();
1955
1957
  return isPriceTile(tile) && subtitle ? subtitle : tile.title;
1956
1958
  }
1957
- var MAX_BUBBLE_ASKS = 2;
1958
- function bubbleAsks(messages) {
1959
+ var MAX_PRICE_TILE_ID = "goal-preset-max-price";
1960
+ var STANDOUT_TILE_ID = "goal-standout-matches";
1961
+ function bubbleAsks(messages, standoutLabel) {
1959
1962
  for (let i = messages.length - 1; i >= 0; i--) {
1960
1963
  const m = messages[i];
1961
1964
  if (!m || m.role !== "assistant" || !m.isGreeting) continue;
1962
1965
  const dashboard = m.greetingDashboard;
1963
- if (!dashboard) return [];
1966
+ if (!dashboard || !dashboard.tiles.some(isPriceTile)) return [];
1964
1967
  const asks = [];
1965
- dashboard.tiles.forEach((tile, index) => {
1966
- const label = tile.subtitle?.trim();
1967
- if (asks.length < MAX_BUBBLE_ASKS && isPriceTile(tile) && label) asks.push({ tile, index, position: asks.length, layout: dashboard.layout, label });
1968
- });
1968
+ const add = (entityId, labelOf) => {
1969
+ const index = dashboard.tiles.findIndex((tile2) => tile2.signal?.entityId === entityId);
1970
+ const tile = dashboard.tiles[index];
1971
+ const label = tile ? labelOf(tile)?.trim() : void 0;
1972
+ if (tile && label) asks.push({ tile, index, position: asks.length, layout: dashboard.layout, label });
1973
+ };
1974
+ add(MAX_PRICE_TILE_ID, (tile) => tile.subtitle ?? void 0);
1975
+ add(STANDOUT_TILE_ID, () => standoutLabel);
1969
1976
  return asks;
1970
1977
  }
1971
1978
  return [];
@@ -1974,7 +1981,7 @@ function runBubbleAsk(ask, deps) {
1974
1981
  deps.log?.log({ name: "popup_ask_tap", outcome: String(ask.position) });
1975
1982
  deps.open();
1976
1983
  deps.setActiveTab("chat");
1977
- const displayText = tileDisplayText(ask.tile);
1984
+ const displayText = ask.label;
1978
1985
  deps.send(ask.tile.actionValue, ask.tile.actionRef ? { actionRef: ask.tile.actionRef, displayText } : { displayText });
1979
1986
  deps.onDashboardTap?.(ask.tile, ask.index, ask.layout);
1980
1987
  }
@@ -11130,7 +11137,7 @@ function StatsWidget(props) {
11130
11137
  [built, logger]
11131
11138
  );
11132
11139
  const dismissPopup = usePopupTelemetry(logger, controller.state.isOpen, controller.state.popupText, controller.dismissPopup);
11133
- const asks = bubbleAsks(controller.state.messages).map((ask) => ({
11140
+ const asks = bubbleAsks(controller.state.messages, ui.presets.standoutAsk).map((ask) => ({
11134
11141
  label: ask.label,
11135
11142
  onTap: () => runBubbleAsk(ask, {
11136
11143
  open: controller.open,