@sensiblestats/widget-react 0.109.0 → 0.111.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 +24 -0
- package/README.md +12 -3
- package/dist/index.cjs +1265 -963
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1036 -734
- package/dist/index.js.map +1 -1
- package/dist/styles.css +14 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.111.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- - Odds formats. The visitor picks Decimal, Fractional or American in a new Settings sheet (chat menu, with a Light, Dark or Auto theme choice) and every price on a card, chip, ribbon and builder follows it; the choice is saved on the device. The operator sets the starting format with the new `oddsFormat` config key, or `data-odds-format` on the embed script. The Settings odds row is hidden when the operator does not offer odds, and the theme row when `surface` or `ink` is set. The sdk reads the new `widget-settings` route, and prices arrive as three forms (decimal, fractional, American) from the server.
|
|
8
|
+
|
|
9
|
+
Breaking: the `price_changed` slip result now carries `newOdds` in the operator's own format instead of `newOddsDecimal`, and a stored chat thread moves to schema v2 (older threads are dropped). Tracking events still carry decimal prices only, and add-to-slip sends the operator's format, never the visitor's.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @sensiblestats/widget-sdk@0.78.0
|
|
15
|
+
|
|
16
|
+
## 0.110.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- `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`.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
- @sensiblestats/widget-sdk@0.77.0
|
|
26
|
+
|
|
3
27
|
## 0.109.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -45,6 +45,11 @@ Common `config` fields:
|
|
|
45
45
|
once to the `:lang=` thread when the host upgrades (threads expire after an hour).
|
|
46
46
|
Changing the language while an answer is streaming drops that turn. With an injected `client`, `locale` sets the chrome only;
|
|
47
47
|
the client keeps its own conversation context.
|
|
48
|
+
- `oddsFormat` — `'decimal'`, `'american'` or `'fractional'`: how the widget shows every price
|
|
49
|
+
until the visitor picks their own in the widget's settings. Anything else, or none, is
|
|
50
|
+
decimal. The script embed reads it from `data-odds-format`. The built-in client sends the
|
|
51
|
+
format in effect with every chat request, so the server writes its sentences in it too. An
|
|
52
|
+
injected `client` sends only the visitor's own pick, and nothing until they make one.
|
|
48
53
|
- `userContext` — `{ operatorUserId, defaultLanguage }` to tie the conversation
|
|
49
54
|
and personalization to your signed-in user. A `defaultLanguage` set here wins
|
|
50
55
|
over `locale`. `operatorUserId` travels from the browser, so make it a random,
|
|
@@ -88,6 +93,7 @@ const SLIP_SPORTS = ['basketball'] as const
|
|
|
88
93
|
...config,
|
|
89
94
|
onAddToSlip: addToMySlip,
|
|
90
95
|
slipSports: SLIP_SPORTS,
|
|
96
|
+
oddsFormat: 'american', // 'decimal' (default) | 'american' | 'fractional'
|
|
91
97
|
}}
|
|
92
98
|
/>
|
|
93
99
|
```
|
|
@@ -104,7 +110,8 @@ widgetHost.betPlaced({ selections: [{ matchOddsId, sport: 'basketball' }] })
|
|
|
104
110
|
|
|
105
111
|
What each one does:
|
|
106
112
|
|
|
107
|
-
- `onAddToSlip`. Called when the user taps "Add to slip", with `{ matchOddsId, matchId, oddsDecimal, sport? }`, where `sport` is the optional `'basketball'`.
|
|
113
|
+
- `onAddToSlip`. Called when the user taps "Add to slip", with `{ matchOddsId, matchId, oddsDecimal, odds?, sport? }`, where `sport` is the optional `'basketball'`.
|
|
114
|
+
`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`.
|
|
108
115
|
Add that selection to your slip. Return nothing, or a result such as `{ status: 'added' }`,
|
|
109
116
|
`{ status: 'duplicate' }` or `{ status: 'rejected', reason }`. The widget shows "In slip" for an
|
|
110
117
|
added or duplicate selection. Answer within 10 seconds. Without a `host`, an "In slip" button
|
|
@@ -190,7 +197,7 @@ Rules:
|
|
|
190
197
|
code.
|
|
191
198
|
- Greeting turns fire no `question_asked` or answer event.
|
|
192
199
|
- `answer_received.cardTypes` lists the card events received for the answer. A dashboard answer
|
|
193
|
-
reports `[]`. The supported values are `
|
|
200
|
+
reports `[]`. The supported values are `team_player`, `betting_insight`, `nba_insight`,
|
|
194
201
|
`nfl_insight`, `market_odds`, `combo_card` and `odds_movement`.
|
|
195
202
|
- `answer_failed.code` is the server's error code for a stream error, or one of `timeout`,
|
|
196
203
|
`network_error` (the connection dropped, mid-answer included), `unauthorized`, `forbidden`,
|
|
@@ -205,6 +212,8 @@ Rules:
|
|
|
205
212
|
Tapping an individual game fires nothing.
|
|
206
213
|
- Slip events (`add_to_slip_click`, `add_to_slip_result`, `combo_add_click`) need `onAddToSlip`.
|
|
207
214
|
Without it the price is plain text and none fire.
|
|
215
|
+
- Prices in tracking events (`odds`, `total`) are always decimal numbers, whatever format the visitor sees or your
|
|
216
|
+
`oddsFormat` config sends to `onAddToSlip`.
|
|
208
217
|
- Tapping a question in the popup fires `bubble_ask_click` and also `dashboard_tile_click`. A static
|
|
209
218
|
`greeting` bubble fires `bubble_click` when tapped but never `bubble_shown`.
|
|
210
219
|
|
|
@@ -225,7 +234,7 @@ Rules:
|
|
|
225
234
|
| `pin_click` | `action` (`add`, `remove`), `target` (`match`, `market`), `matchId?`, `market?`, `sport?` | A pin is tapped |
|
|
226
235
|
| `add_to_slip_click` | `matchOddsId`, `matchId`, `odds`, `market?`, `sport?` | "Add to slip" is tapped |
|
|
227
236
|
| `add_to_slip_result` | as above, plus `outcome` | Your `onAddToSlip` has answered |
|
|
228
|
-
| `combo_add_click` | `sport`, `legs`, `total` |
|
|
237
|
+
| `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
238
|
| `all_markets_click` | `matchId`, `market?`, `surface` | "All markets" is tapped |
|
|
230
239
|
| `dashboard_tile_click` | `entityType`, `entityId` | A dashboard tile is tapped |
|
|
231
240
|
| `sport_switch` | `sport` | The visitor switches sport on the dashboard |
|