@sensiblestats/widget-react 0.89.0 → 0.91.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,30 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.91.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2392632: Today tab lists NBA games alongside football for operators offered NBA
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [2392632]
12
+ - @sensiblestats/widget-sdk@0.61.0
13
+
14
+ ## 0.90.0
15
+
16
+ ### Minor Changes
17
+
18
+ - NBA bettor cards: renders the `nba_insight` event (prop reason, ladder, teammate out, co-hit, line move) in EN and
19
+ TR, and advertises the `nba_insight` client capability. An NBA price is an "Add to slip" button only when the new
20
+ `slipSports` config includes `'basketball'`. The slip is keyed by sport plus id, and `host.slipRemoved` /
21
+ `host.betPlaced` accept `sport`.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+ - @sensiblestats/widget-sdk@0.60.0
27
+
3
28
  ## 0.89.0
4
29
 
5
30
  ### Minor Changes
package/README.md CHANGED
@@ -53,11 +53,16 @@ export const widgetHost = createWidgetHost()
53
53
  ```
54
54
 
55
55
  ```tsx
56
+ // Module scope too: a new function or array on every render makes the widget rebuild its slip handling.
57
+ const addToMySlip = (selection: SlipSelection) => mySlip.add(selection)
58
+ const SLIP_SPORTS = ['basketball'] as const
59
+
56
60
  <StatsWidget
57
61
  host={widgetHost}
58
62
  config={{
59
63
  ...config,
60
- onAddToSlip: (selection) => addToMySlip(selection),
64
+ onAddToSlip: addToMySlip,
65
+ slipSports: SLIP_SPORTS,
61
66
  }}
62
67
  />
63
68
  ```
@@ -66,22 +71,33 @@ export const widgetHost = createWidgetHost()
66
71
  widgetHost.slipRemoved({ matchOddsId }) // a leg left your slip
67
72
  widgetHost.betPlaced({ selections: [{ matchOddsId }] }) // the bet was placed
68
73
  widgetHost.matchOpened({ matchId }) // your match page opened
74
+
75
+ // an NBA leg also carries sport; the type is { matchOddsId: number; sport?: 'basketball' }
76
+ widgetHost.slipRemoved({ matchOddsId, sport: 'basketball' })
77
+ widgetHost.betPlaced({ selections: [{ matchOddsId, sport: 'basketball' }] })
69
78
  ```
70
79
 
71
80
  What each one does:
72
81
 
73
- - `onAddToSlip`. Called when the user taps "Add to slip", with `{ matchOddsId, matchId, oddsDecimal }`.
82
+ - `onAddToSlip`. Called when the user taps "Add to slip", with `{ matchOddsId, matchId, oddsDecimal, sport? }`, where `sport` is the optional `'basketball'`.
74
83
  Add that selection to your slip. Return nothing, or a result such as `{ status: 'added' }`,
75
84
  `{ status: 'duplicate' }` or `{ status: 'rejected', reason }`. The widget shows "In slip" for an
76
85
  added or duplicate selection. Answer within 10 seconds. Without a `host`, an "In slip" button
77
86
  stays that way until the page reloads; with one, `slipRemoved` and `betPlaced` clear it.
87
+ - `slipSports`. Sports your `onAddToSlip` understands beyond football. An NBA price is an "Add to
88
+ slip" button only when all three hold: the card arrives with the slip enabled for your operator
89
+ account (`addToSlipEnabled`), you set `onAddToSlip`, and `slipSports` includes `'basketball'`.
90
+ Otherwise the price is plain text. The selection then carries `sport: 'basketball'`, so branch on
91
+ it: a basketball id can equal a football id. Keep `onAddToSlip` and `slipSports` referentially
92
+ stable, a module-level constant or a memoised value. The widget rebuilds its slip handling
93
+ whenever either changes identity, and an inline function or array literal changes it every render.
78
94
  - `onOpenMatch` (deprecated). Ignored since 0.72.1: the widget no longer opens matches from any
79
95
  surface, so team names are plain text and this is never called. It stays in the config type so
80
96
  existing hosts still compile.
81
97
  - `slipRemoved`. Clears the widget's "In slip" mark for that selection. Call it whenever a leg
82
98
  leaves your slip for any reason, a "clear all" included. A leg the widget still believes is in
83
99
  the slip can be reported as bet later.
84
- - `betPlaced`. Pass every leg of the bet. The widget reports the legs it added itself, at most 25
100
+ - `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
85
101
  per call, and ignores the rest, so you do not filter.
86
102
  - `matchOpened`. Call it from your match page. A view counts only for a visitor who has opened the
87
103
  widget in that tab, and at most once per match every 30 minutes.
@@ -90,6 +106,9 @@ Rules for the three host methods:
90
106
 
91
107
  - `matchOddsId` and `matchId` are the numbers `onAddToSlip` gave you. Anything that is not a
92
108
  positive integer is ignored, a numeric string included.
109
+ - `sport` is optional and only ever `'basketball'`. A football selection omits it, so existing
110
+ integrations are unchanged. Echo it back on `slipRemoved` and `betPlaced` for an NBA leg: a basketball
111
+ id and a football id can be equal, and `sport` tells the widget which row to clear.
93
112
  - No method throws, and each is safe to call twice.
94
113
  - A call made while no widget is mounted is queued, the last 20, and replayed when one mounts. The
95
114
  queue lives in the page, so it does not survive a full page load.