@sensiblestats/widget-react 0.109.0 → 0.110.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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.110.0
4
+
5
+ ### Minor Changes
6
+
7
+ - `combo_add_click` now also fires when "Add all" adds every leg of a combo card in chat, and carries `surface` (`builder` or `chat`). `answer_received.cardTypes` reports a team or player card as `team_player` instead of `entity_card`.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @sensiblestats/widget-sdk@0.77.0
13
+
3
14
  ## 0.109.0
4
15
 
5
16
  ### Minor Changes
package/README.md CHANGED
@@ -190,7 +190,7 @@ Rules:
190
190
  code.
191
191
  - Greeting turns fire no `question_asked` or answer event.
192
192
  - `answer_received.cardTypes` lists the card events received for the answer. A dashboard answer
193
- reports `[]`. The supported values are `entity_card`, `betting_insight`, `nba_insight`,
193
+ reports `[]`. The supported values are `team_player`, `betting_insight`, `nba_insight`,
194
194
  `nfl_insight`, `market_odds`, `combo_card` and `odds_movement`.
195
195
  - `answer_failed.code` is the server's error code for a stream error, or one of `timeout`,
196
196
  `network_error` (the connection dropped, mid-answer included), `unauthorized`, `forbidden`,
@@ -225,7 +225,7 @@ Rules:
225
225
  | `pin_click` | `action` (`add`, `remove`), `target` (`match`, `market`), `matchId?`, `market?`, `sport?` | A pin is tapped |
226
226
  | `add_to_slip_click` | `matchOddsId`, `matchId`, `odds`, `market?`, `sport?` | "Add to slip" is tapped |
227
227
  | `add_to_slip_result` | as above, plus `outcome` | Your `onAddToSlip` has answered |
228
- | `combo_add_click` | `sport`, `legs`, `total` | The bet builder's "Add all" has added every leg. A combo card in chat, a partial add or a refused leg fires none. Each leg also fires its own `add_to_slip_click` and `add_to_slip_result` |
228
+ | `combo_add_click` | `surface`, `sport`, `legs`, `total` | "Add all" has added every leg of a combo: `surface` is `builder` for the bet builder and `chat` for a combo card in an answer. `total` is the total the visitor asked for. A partial add or a refused leg fires none. Each leg also fires its own `add_to_slip_click` and `add_to_slip_result` |
229
229
  | `all_markets_click` | `matchId`, `market?`, `surface` | "All markets" is tapped |
230
230
  | `dashboard_tile_click` | `entityType`, `entityId` | A dashboard tile is tapped |
231
231
  | `sport_switch` | `sport` | The visitor switches sport on the dashboard |
package/dist/index.cjs CHANGED
@@ -1465,7 +1465,7 @@ function isEnglishLocale(locale) {
1465
1465
  }
1466
1466
 
1467
1467
  // src/version.generated.ts
1468
- var WIDGET_REACT_VERSION = "0.109.0";
1468
+ var WIDGET_REACT_VERSION = "0.110.0";
1469
1469
 
1470
1470
  // src/config.ts
1471
1471
  function normalizeUi(cfg) {
@@ -3692,7 +3692,8 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
3692
3692
  try {
3693
3693
  for await (const event of handle) {
3694
3694
  dispatch({ kind: "EVENT", event });
3695
- if (CARD_EVENT_TYPES.has(event.type) && !cardTypes.includes(event.type)) cardTypes.push(event.type);
3695
+ const cardType = event.type === "entity_card" ? "team_player" : event.type;
3696
+ if (CARD_EVENT_TYPES.has(event.type) && !cardTypes.includes(cardType)) cardTypes.push(cardType);
3696
3697
  if (event.type === "turn_complete") {
3697
3698
  turn?.settle({ name: "answer_received", turnId: turn.id, conversationId: event.data.conversationId, latencyMs: Date.now() - turn.startedAt, cardTypes });
3698
3699
  } else if (event.type === "error" && !isLimitNotice(event.data)) {
@@ -6725,10 +6726,11 @@ var import_react37 = require("react");
6725
6726
  // src/components/AddAllToSlipButton.tsx
6726
6727
  var import_react35 = require("react");
6727
6728
  var import_jsx_runtime23 = require("react/jsx-runtime");
6728
- function AddAllToSlipButton({ legs, slip, ui, labels, combo, sizeless, hold, onStartedGame }) {
6729
+ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
6729
6730
  const add = useSlipAdd(slip, ui);
6730
6731
  const slipState = useSlipState();
6731
6732
  const log = useEventLog();
6733
+ const track = useTrack();
6732
6734
  const [pending, setPending] = (0, import_react35.useState)(false);
6733
6735
  const [settledLocal, setSettledLocal] = (0, import_react35.useState)({});
6734
6736
  const [toast, setToast] = (0, import_react35.useState)(null);
@@ -6789,6 +6791,9 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, sizeless, hold, onS
6789
6791
  }
6790
6792
  });
6791
6793
  }
6794
+ if (chatCombo && tally.added === legs.length) {
6795
+ track({ name: "combo_add_click", surface: "chat", sport: legs[0].sport ?? "football", legs: legs.length, total: chatCombo.total });
6796
+ }
6792
6797
  if (!slipState) setSettledLocal((s) => ({ ...s, ...added }));
6793
6798
  setToast(addAllToast(tally, ui, sizeless));
6794
6799
  setPending(false);
@@ -6861,7 +6866,7 @@ function ComboCardView({ vm, ui, slip, monitor }) {
6861
6866
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ol", { className: "ss-w-combo-legs", role: "list", children: vm.legs.map((leg) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ComboLegRow, { leg, addToSlipEnabled: vm.addToSlipEnabled, ui, slip, monitor }, leg.key)) }),
6862
6867
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "ss-w-combo-math", children: vm.multiplication }),
6863
6868
  vm.replacedNote ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "ss-w-combo-note", children: vm.replacedNote }) : null,
6864
- vm.addToSlipEnabled ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AddAllToSlipButton, { legs: vm.legs, slip, ui }) : null,
6869
+ vm.addToSlipEnabled ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AddAllToSlipButton, { legs: vm.legs, slip, ui, chatCombo: { total: vm.target !== void 0 ? String(vm.target) : "" } }) : null,
6865
6870
  tools && target !== void 0 && legCount !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: "ss-w-combo-change", onClick: () => tools.openBuilder(target, legCount), children: tools.changeLabel }) : null
6866
6871
  ] });
6867
6872
  }
@@ -7415,6 +7420,7 @@ var WIRE_TO_PUBLIC = {
7415
7420
  const e = entity(input);
7416
7421
  return {
7417
7422
  name: "combo_add_click",
7423
+ surface: "builder",
7418
7424
  sport: e.metadata?.sport ?? e.sport ?? "",
7419
7425
  legs: e.metadata?.legs ?? 0,
7420
7426
  total: e.metadata?.totalChosen ?? String(e.metadata?.totalActual ?? "")