@sensiblestats/widget-react 0.107.1 → 0.108.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 +19 -0
- package/README.md +22 -2
- package/dist/index.cjs +5258 -3353
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5190 -3285
- package/dist/index.js.map +1 -1
- package/dist/styles.css +207 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.108.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Personal greeting sections, a Favourites tab, and a combo_add event when a builder combo is added to the slip.
|
|
8
|
+
- A `locale` the host sets is now also sent as the conversation's server language (`userContext.defaultLanguage`), so the answers and the greeting follow the widget's language. Only `en` and `tr` are sent, reduced to the primary subtag (`tr-TR` and `tr_TR` send `tr`, `tr-TR` gets Turkish chrome and presets); any other locale sends nothing, so the operator's default stands and NBA and NFL stay. A `defaultLanguage` the host sets in `userContext` still wins, and a host that sets no `locale` sends none. When the language sent is `en` or `tr` (from `locale` or from `userContext.defaultLanguage` alone) the stored chat thread is keyed by it (`:lang=en` / `:lang=tr`, reduced and trimmed, so `'TR '` and `'tr'` are one thread), so changing `locale` (on a reload or a mounted widget) starts that language's thread and greets in it; any other language, or none, keeps the plain key. A visitor whose host already sets `en` or `tr` moves once to the `:lang=` thread on upgrade (threads expire after an hour). A language change while an answer streams drops that turn. A non-text `locale` no longer throws, `tr-` reads as Turkish everywhere, and the live monitor is asked in the reduced language. A slip click refused after kick-off by the widget's own check says the game has started instead of Try again; a `closed` refusal from the host with no `message` says "This selection can't be added." (`closed` is not defined as "game started"); "Add all" says the same when every leg is refused as `closed` and keeps "Try again" for a mix.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
- @sensiblestats/widget-sdk@0.75.0
|
|
14
|
+
|
|
15
|
+
## 0.107.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @sensiblestats/widget-sdk@0.74.1
|
|
21
|
+
|
|
3
22
|
## 0.107.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -33,9 +33,23 @@ Common `config` fields:
|
|
|
33
33
|
- `operatorId`, `publicKey` — your gateway credentials (both browser-safe; the
|
|
34
34
|
public key is origin-gated at the gateway).
|
|
35
35
|
- `baseUrl` — the widget gateway URL.
|
|
36
|
-
- `locale` — `'en'` or `'tr'` for the widget's own chrome text
|
|
36
|
+
- `locale` — `'en'` or `'tr'` for the widget's own chrome text; a region (`'tr-TR'`) or
|
|
37
|
+
an underscore (`'tr_TR'`) counts as its language. It is also sent as the server
|
|
38
|
+
language (`userContext.defaultLanguage`) when it is one of those two; any other
|
|
39
|
+
value, or none, sends nothing and the operator's own default language applies.
|
|
40
|
+
The chat thread is kept per language: when the language sent to the server is
|
|
41
|
+
`en` or `tr` (from `locale`, or from `userContext.defaultLanguage` alone), the thread
|
|
42
|
+
key carries `:lang=<language>`, so `'TR '` and `'tr'` are one thread and a change
|
|
43
|
+
of language starts that language's own thread. Any other value, or none, keeps the
|
|
44
|
+
plain key. A visitor of a host that already sets one of those two languages moves
|
|
45
|
+
once to the `:lang=` thread when the host upgrades (threads expire after an hour).
|
|
46
|
+
Changing the language while an answer is streaming drops that turn. With an injected `client`, `locale` sets the chrome only;
|
|
47
|
+
the client keeps its own conversation context.
|
|
37
48
|
- `userContext` — `{ operatorUserId, defaultLanguage }` to tie the conversation
|
|
38
|
-
and personalization to your signed-in user.
|
|
49
|
+
and personalization to your signed-in user. A `defaultLanguage` set here wins
|
|
50
|
+
over `locale`. `operatorUserId` travels from the browser, so make it a random,
|
|
51
|
+
non-guessable value you map to the user on your side (a UUID works): never an
|
|
52
|
+
account number, email, username or sequential id.
|
|
39
53
|
- White-label branding — `logoUrl`, `headerTitle`, `accent`, `cta`, `surface`,
|
|
40
54
|
`ink`. Absent → the default SensibleStats look.
|
|
41
55
|
- `page` — the page the widget sits on, `{ sport, kind?, matchId?, competitionId? }`, so the
|
|
@@ -95,6 +109,12 @@ What each one does:
|
|
|
95
109
|
`{ status: 'duplicate' }` or `{ status: 'rejected', reason }`. The widget shows "In slip" for an
|
|
96
110
|
added or duplicate selection. Answer within 10 seconds. Without a `host`, an "In slip" button
|
|
97
111
|
stays that way until the page reloads; with one, `slipRemoved` and `betPlaced` clear it.
|
|
112
|
+
- A `{ status: 'rejected', reason: 'closed' }` result is shown with your `message` when you send
|
|
113
|
+
one, and as "This selection can't be added." otherwise. `closed` is not defined as "game started",
|
|
114
|
+
so the widget says that only for its own kick-off check ("This game has started."). Send a
|
|
115
|
+
`message` for a market that is suspended or closed on your side. "Add all" follows the same rule
|
|
116
|
+
when every leg comes back `closed` (your first `message`, else the neutral line); a mix of `closed`
|
|
117
|
+
and any other refusal keeps "Couldn't add to slip. Try again." because a retry may help.
|
|
98
118
|
- `slipSports`. Sports your `onAddToSlip` understands beyond football. An NBA price is an "Add to
|
|
99
119
|
slip" button only when all three hold: the card arrives with the slip enabled for your operator
|
|
100
120
|
account (`addToSlipEnabled`), you set `onAddToSlip`, and `slipSports` includes `'basketball'`.
|