@sensiblestats/widget-react 0.165.0 → 0.165.1

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,11 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.165.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 6d6939e: Live facts: a second live moment with a market leads under the first one instead of sitting in Earlier.
8
+
3
9
  ## 0.165.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -89,7 +89,7 @@ export const widgetHost = createWidgetHost()
89
89
  ```tsx
90
90
  // Module scope too: a new function or array on every render makes the widget rebuild its slip handling.
91
91
  const addToMySlip = (selection: SlipSelection) => mySlip.add(selection)
92
- const SLIP_SPORTS = ['basketball'] as const
92
+ const SLIP_SPORTS = ['basketball', 'americanfootball', 'tennis'] as const
93
93
 
94
94
  <StatsWidget
95
95
  host={widgetHost}
@@ -107,14 +107,15 @@ widgetHost.slipRemoved({ matchOddsId }) // a leg left your slip
107
107
  widgetHost.betPlaced({ selections: [{ matchOddsId }] }) // the bet was placed
108
108
  widgetHost.matchOpened({ matchId }) // your match page opened
109
109
 
110
- // an NBA leg also carries sport; the type is { matchOddsId: number; sport?: 'basketball' }
110
+ // a non-football leg also carries sport; the type is { matchOddsId: number; sport?: SlipSport }
111
111
  widgetHost.slipRemoved({ matchOddsId, sport: 'basketball' })
112
112
  widgetHost.betPlaced({ selections: [{ matchOddsId, sport: 'basketball' }] })
113
113
  ```
114
114
 
115
115
  What each one does:
116
116
 
117
- - `onAddToSlip`. Called when the user taps "Add to slip", with `{ matchOddsId, matchId, oddsDecimal, odds?, sport? }`, where `sport` is the optional `'basketball'`.
117
+ - `onAddToSlip`. Called when the user taps "Add to slip", with `{ matchOddsId, matchId, oddsDecimal, odds?, sport? }`, where `sport` is the optional `SlipSport` (`'basketball'`, `'americanfootball'` or `'tennis'`).
118
+ Besides `added`, `duplicate` and `rejected`, a result can be `{ status: 'price_changed', newOdds, accepted }`, where `newOdds` is a string.
118
119
  `oddsDecimal` is always set. `odds`, when present, is `{ format, text }` in your configured `oddsFormat`, never the visitor's own pick; it is left out when the widget has no text in that format, so if `odds` is absent, use `oddsDecimal`.
119
120
  Add that selection to your slip. Return nothing, or a result such as `{ status: 'added' }`,
120
121
  `{ status: 'duplicate' }` or `{ status: 'rejected', reason }`. The widget shows "In slip" for an
@@ -126,11 +127,11 @@ What each one does:
126
127
  `message` for a market that is suspended or closed on your side. "Add all" follows the same rule
127
128
  when every leg comes back `closed` (your first `message`, else the neutral line); a mix of `closed`
128
129
  and any other refusal keeps "Couldn't add to slip. Try again." because a retry may help.
129
- - `slipSports`. Sports your `onAddToSlip` understands beyond football. An NBA price is an "Add to
130
+ - `slipSports`. Sports your `onAddToSlip` understands beyond football: `'basketball'`, `'americanfootball'` and `'tennis'`. A price for one of them is an "Add to
130
131
  slip" button only when all three hold: the card arrives with the slip enabled for your operator
131
- account (`addToSlipEnabled`), you set `onAddToSlip`, and `slipSports` includes `'basketball'`.
132
- Otherwise the price is plain text. The selection then carries `sport: 'basketball'`, so branch on
133
- it: a basketball id can equal a football id. Keep `onAddToSlip` and `slipSports` referentially
132
+ account (`addToSlipEnabled`), you set `onAddToSlip`, and `slipSports` includes that sport.
133
+ Otherwise the price is plain text. The selection then carries that sport in `sport`, so branch on
134
+ it: a basketball id can equal a football id. NFL odds-card and insight-card selections close at kickoff: once the game has started, the widget refuses the add itself. Live fact prices on the NFL monitor card are in-play prices and still add. Keep `onAddToSlip` and `slipSports` referentially
134
135
  stable, a module-level constant or a memoised value. The widget rebuilds its slip handling
135
136
  whenever either changes identity, and an inline function or array literal changes it every render.
136
137
  - `onOpenMatch` (deprecated). Ignored since 0.72.1: the widget no longer opens matches from any
@@ -140,7 +141,7 @@ What each one does:
140
141
  leaves your slip for any reason, a "clear all" included. A leg the widget still believes is in
141
142
  the slip can be reported as bet later.
142
143
  - `betPlaced`. Pass every leg of the bet, with the leg's `sport` when you got one. The widget reports the legs it added itself, at most 25
143
- per call, and ignores the rest, so you do not filter.
144
+ per call, and ignores the rest, so you do not filter. `stake`, `currency`, `betId`, `betType` and `totalOdds` are optional, and a field of the wrong type is dropped.
144
145
  - `matchOpened`. Call it from your match page. A view counts only for a visitor who has opened the
145
146
  widget in that tab, and at most once per match every 30 minutes.
146
147
 
@@ -148,8 +149,8 @@ Rules for the three host methods:
148
149
 
149
150
  - `matchOddsId` and `matchId` are the numbers `onAddToSlip` gave you. Anything that is not a
150
151
  positive integer is ignored, a numeric string included.
151
- - `sport` is optional and only ever `'basketball'`. A football selection omits it, so existing
152
- integrations are unchanged. Echo it back on `slipRemoved` and `betPlaced` for an NBA leg: a basketball
152
+ - `sport` is optional and is a `SlipSport`: `'basketball'`, `'americanfootball'` or `'tennis'`. A football selection omits it, so existing
153
+ integrations are unchanged. Echo it back on `slipRemoved` and `betPlaced` for a non-football leg: a basketball
153
154
  id and a football id can be equal, and `sport` tells the widget which row to clear.
154
155
  - No method throws, and each is safe to call twice.
155
156
  - A call made while no widget is mounted is queued, the last 20, and replayed when one mounts. The
@@ -218,6 +219,7 @@ Rules:
218
219
  Without it the price is plain text and none fire.
219
220
  - Prices in tracking events (`odds`, `total`) are always decimal numbers, whatever format the visitor sees or your
220
221
  `oddsFormat` config sends to `onAddToSlip`.
222
+ - Before the panel opens, the launcher bubble shows a greeting line and, for the dynamic popup, one price.
221
223
  - Tapping a question in the popup fires `bubble_ask_click` and also `dashboard_tile_click`. A static
222
224
  `greeting` bubble fires `bubble_click` when tapped but never `bubble_shown`.
223
225
 
package/dist/index.cjs CHANGED
@@ -1422,7 +1422,7 @@ function parseCustomTotal(text2, format2) {
1422
1422
  }
1423
1423
 
1424
1424
  // src/version.generated.ts
1425
- var WIDGET_REACT_VERSION = "0.165.0";
1425
+ var WIDGET_REACT_VERSION = "0.165.1";
1426
1426
 
1427
1427
  // src/config.ts
1428
1428
  var COLOR_KEYS = ["accent", "cta", "surface", "ink"];