@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/dist/index.js CHANGED
@@ -1427,7 +1427,7 @@ function isEnglishLocale(locale) {
1427
1427
  }
1428
1428
 
1429
1429
  // src/version.generated.ts
1430
- var WIDGET_REACT_VERSION = "0.109.0";
1430
+ var WIDGET_REACT_VERSION = "0.110.0";
1431
1431
 
1432
1432
  // src/config.ts
1433
1433
  function normalizeUi(cfg) {
@@ -3654,7 +3654,8 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
3654
3654
  try {
3655
3655
  for await (const event of handle) {
3656
3656
  dispatch({ kind: "EVENT", event });
3657
- if (CARD_EVENT_TYPES.has(event.type) && !cardTypes.includes(event.type)) cardTypes.push(event.type);
3657
+ const cardType = event.type === "entity_card" ? "team_player" : event.type;
3658
+ if (CARD_EVENT_TYPES.has(event.type) && !cardTypes.includes(cardType)) cardTypes.push(cardType);
3658
3659
  if (event.type === "turn_complete") {
3659
3660
  turn?.settle({ name: "answer_received", turnId: turn.id, conversationId: event.data.conversationId, latencyMs: Date.now() - turn.startedAt, cardTypes });
3660
3661
  } else if (event.type === "error" && !isLimitNotice(event.data)) {
@@ -6687,10 +6688,11 @@ import { useEffect as useEffect20, useLayoutEffect, useRef as useRef17, useState
6687
6688
  // src/components/AddAllToSlipButton.tsx
6688
6689
  import { useCallback as useCallback19, useState as useState24 } from "react";
6689
6690
  import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
6690
- function AddAllToSlipButton({ legs, slip, ui, labels, combo, sizeless, hold, onStartedGame }) {
6691
+ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
6691
6692
  const add = useSlipAdd(slip, ui);
6692
6693
  const slipState = useSlipState();
6693
6694
  const log = useEventLog();
6695
+ const track = useTrack();
6694
6696
  const [pending, setPending] = useState24(false);
6695
6697
  const [settledLocal, setSettledLocal] = useState24({});
6696
6698
  const [toast, setToast] = useState24(null);
@@ -6751,6 +6753,9 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, sizeless, hold, onS
6751
6753
  }
6752
6754
  });
6753
6755
  }
6756
+ if (chatCombo && tally.added === legs.length) {
6757
+ track({ name: "combo_add_click", surface: "chat", sport: legs[0].sport ?? "football", legs: legs.length, total: chatCombo.total });
6758
+ }
6754
6759
  if (!slipState) setSettledLocal((s) => ({ ...s, ...added }));
6755
6760
  setToast(addAllToast(tally, ui, sizeless));
6756
6761
  setPending(false);
@@ -6823,7 +6828,7 @@ function ComboCardView({ vm, ui, slip, monitor }) {
6823
6828
  /* @__PURE__ */ jsx24("ol", { className: "ss-w-combo-legs", role: "list", children: vm.legs.map((leg) => /* @__PURE__ */ jsx24(ComboLegRow, { leg, addToSlipEnabled: vm.addToSlipEnabled, ui, slip, monitor }, leg.key)) }),
6824
6829
  /* @__PURE__ */ jsx24("div", { className: "ss-w-combo-math", children: vm.multiplication }),
6825
6830
  vm.replacedNote ? /* @__PURE__ */ jsx24("p", { className: "ss-w-combo-note", children: vm.replacedNote }) : null,
6826
- vm.addToSlipEnabled ? /* @__PURE__ */ jsx24(AddAllToSlipButton, { legs: vm.legs, slip, ui }) : null,
6831
+ vm.addToSlipEnabled ? /* @__PURE__ */ jsx24(AddAllToSlipButton, { legs: vm.legs, slip, ui, chatCombo: { total: vm.target !== void 0 ? String(vm.target) : "" } }) : null,
6827
6832
  tools && target !== void 0 && legCount !== void 0 ? /* @__PURE__ */ jsx24("button", { type: "button", className: "ss-w-combo-change", onClick: () => tools.openBuilder(target, legCount), children: tools.changeLabel }) : null
6828
6833
  ] });
6829
6834
  }
@@ -7377,6 +7382,7 @@ var WIRE_TO_PUBLIC = {
7377
7382
  const e = entity(input);
7378
7383
  return {
7379
7384
  name: "combo_add_click",
7385
+ surface: "builder",
7380
7386
  sport: e.metadata?.sport ?? e.sport ?? "",
7381
7387
  legs: e.metadata?.legs ?? 0,
7382
7388
  total: e.metadata?.totalChosen ?? String(e.metadata?.totalActual ?? "")