@sensiblestats/widget-react 0.110.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 +13 -0
- package/README.md +10 -1
- package/dist/index.cjs +1256 -960
- 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 +1027 -731
- 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,18 @@
|
|
|
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
|
+
|
|
3
16
|
## 0.110.0
|
|
4
17
|
|
|
5
18
|
### 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
|
|
@@ -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
|
|