fansunited-frontend-components 0.0.85 → 0.0.86
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/Predictor.js +1 -1
- package/README.md +57 -5
- package/TopX.js +3683 -3679
- package/chunks/{Predictor-swx1IhLo.js → Predictor-C3Kr_dEA.js} +3766 -3745
- package/index.js +2 -2
- package/package.json +2 -2
package/Predictor.js
CHANGED
package/README.md
CHANGED
|
@@ -3722,6 +3722,7 @@ Football score predictor component with two templates: the default **multi-tab**
|
|
|
3722
3722
|
- Consent management with required/optional consent gates before predicting
|
|
3723
3723
|
- Customisable banners in 6 positions within the Play tab (`"standard"` only)
|
|
3724
3724
|
- Authentication-aware UI with configurable sign-in CTA
|
|
3725
|
+
- Opt-in betting odds on the match cards (`showOdds`), pinned to one operator with `operatorId` — see [Predictor Odds](#predictor-odds)
|
|
3725
3726
|
- Built-in Betslip integration — renders the Betslip widget automatically via the `betslip` prop with two trigger modes
|
|
3726
3727
|
- Custom theming and multi-language support
|
|
3727
3728
|
|
|
@@ -3748,6 +3749,8 @@ Football score predictor component with two templates: the default **multi-tab**
|
|
|
3748
3749
|
| `playTabBanners` | `PlayTabBanner[]` | Custom banners rendered in the Play tab. Ignored by `"embed"` |
|
|
3749
3750
|
| `consents` | `ConsentDef[]` | Consent definitions required before predicting |
|
|
3750
3751
|
| `matchCardBgImageUrl` | `string` | Background image URL for match prediction cards. Ignored by `"embed"` |
|
|
3752
|
+
| `showOdds` | `boolean` | Render betting odds on the match cards (default: false). While false the odds request is skipped, so an `"odds-only"` betslip needs this set |
|
|
3753
|
+
| `operatorId` | `string` | Operator config id to show odds from, e.g. `"betano-bg"`. Unset, each match shows the first operator listed. Falls back to `betslip.operatorId`, and the Betslip falls back to it |
|
|
3751
3754
|
| `betslip` | `PredictorBetslipConfig` | Betslip integration config. Omit to disable. See [Betslip Integration](#betslip-integration) |
|
|
3752
3755
|
| `callbacks` | `PredictorCallbacks` | `onEvent` — one observer for every journey event the component emits. See [Analytics](#analytics) |
|
|
3753
3756
|
|
|
@@ -3992,6 +3995,27 @@ const consents: ConsentDef[] = [
|
|
|
3992
3995
|
- Optional consents are shown in the same modal but do not block progression
|
|
3993
3996
|
- Once accepted, consents are stored and the modal does not reappear
|
|
3994
3997
|
|
|
3998
|
+
#### Predictor Odds
|
|
3999
|
+
|
|
4000
|
+
Odds are off by default. With `showOdds` set, each upcoming match card shows full-time 1X2 odds from one operator, refreshed while a match is live — in the Play tab, the `embed` card and a league member's predictions. Odds fail silently: when the odds API has no prices for a match, the card simply shows none.
|
|
4001
|
+
|
|
4002
|
+
- **`showOdds`** — while it is false (the default) the odds request is skipped altogether. A betslip with `trigger: "odds-only"` is fed by clicking those odds, so that trigger needs `showOdds` set.
|
|
4003
|
+
- **`operatorId`** pins the odds to one operator. It is sent to the odds request as the SDK's `operators` filter, so the response is narrowed server-side. Without it, each match shows whichever operator the response lists first, which is not guaranteed to stay the same. A match the chosen operator doesn't price shows no odds; it does not fall back to another operator.
|
|
4004
|
+
|
|
4005
|
+
```tsx
|
|
4006
|
+
<Predictor entityId="..." sdk={sdk} language="en" showOdds operatorId="betano-bg" />
|
|
4007
|
+
```
|
|
4008
|
+
|
|
4009
|
+
`operatorId` and `betslip.operatorId` resolve against each other, so the card and the betslip show the same operator unless you set both to different values:
|
|
4010
|
+
|
|
4011
|
+
| You set | Card odds | Betslip |
|
|
4012
|
+
| -------------------- | -------------------- | -------------------- |
|
|
4013
|
+
| `operatorId` | `operatorId` | `operatorId` |
|
|
4014
|
+
| `betslip.operatorId` | `betslip.operatorId` | `betslip.operatorId` |
|
|
4015
|
+
| Both | `operatorId` | `betslip.operatorId` |
|
|
4016
|
+
|
|
4017
|
+
See [Choosing a Bookmaker](#choosing-a-bookmaker) for the list of available operator ids.
|
|
4018
|
+
|
|
3995
4019
|
#### Betslip Integration
|
|
3996
4020
|
|
|
3997
4021
|
When the `betslip` prop is provided, the Predictor automatically renders a `Betslip` widget as a sibling alongside its own UI — you do not need to add a separate `<Betslip />` component to the page. The widget is configured entirely through `PredictorBetslipConfig`.
|
|
@@ -4023,7 +4047,7 @@ const betslipConfig: PredictorBetslipConfig = {
|
|
|
4023
4047
|
| `currency` | `string` | `"€"` | Currency symbol |
|
|
4024
4048
|
| `ctaUrlTemplate` | `string` | — | Bookmaker deep-link URL with `{placeholder}` substitution |
|
|
4025
4049
|
| `brandingLogoUrl` | `string` | — | Operator logo URL |
|
|
4026
|
-
| `operatorId` | `string` | — | Operator config id the Betslip requests odds for, e.g. `"betano-bg"`
|
|
4050
|
+
| `operatorId` | `string` | — | Operator config id the Betslip requests odds for, e.g. `"betano-bg"`. Falls back to the top-level `operatorId` |
|
|
4027
4051
|
| `affiliateId` | `string` | — | Affiliate id substituted into the operator's URLs |
|
|
4028
4052
|
| `labels` | `BetslipLabels` | — | UI text overrides |
|
|
4029
4053
|
| `themeOptions` | `CustomThemeOptions` | — | Theme for the Betslip widget. Falls back to the Predictor's `themeOptions` when omitted |
|
|
@@ -4039,7 +4063,7 @@ type PredictorBetslipTrigger =
|
|
|
4039
4063
|
| Mode | When selections are sent |
|
|
4040
4064
|
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
4041
4065
|
| `"predictions-only"` | Every time the user edits a score (home/away increment or decrement). If the user submits without editing (e.g. a default 0:0), the selection is sent at submit time as a fallback. Derived outcome: `"1"` (home win), `"X"` (draw), `"2"` (away win). |
|
|
4042
|
-
| `"odds-only"` | Only when the user clicks an odds button on the post-submit odds display. The odds button becomes a command-bus trigger instead of a direct bookmaker link.
|
|
4066
|
+
| `"odds-only"` | Only when the user clicks an odds button on the post-submit odds display. The odds button becomes a command-bus trigger instead of a direct bookmaker link. Requires `showOdds`. |
|
|
4043
4067
|
|
|
4044
4068
|
**Selection format sent by Predictor:**
|
|
4045
4069
|
|
|
@@ -4241,6 +4265,7 @@ Selections are sent only when the user explicitly clicks an odds button on the p
|
|
|
4241
4265
|
sdk={sdkInstance}
|
|
4242
4266
|
language="en"
|
|
4243
4267
|
userIsLoggedIn={true}
|
|
4268
|
+
showOdds={true}
|
|
4244
4269
|
betslip={{
|
|
4245
4270
|
trigger: "odds-only",
|
|
4246
4271
|
position: "bottom-right",
|
|
@@ -4294,6 +4319,7 @@ Full-featured competitive picks predictor component with a multi-tab interface f
|
|
|
4294
4319
|
- Consent management with required/optional consent gates before predicting
|
|
4295
4320
|
- Customisable banners in the Play tab
|
|
4296
4321
|
- Authentication-aware UI with configurable sign-in CTA
|
|
4322
|
+
- Opt-in betting odds on the match cards (`showOdds`), pinned to one operator with `operatorId` — see [TopX Odds](#topx-odds)
|
|
4297
4323
|
- Built-in Betslip integration via the `betslip` prop
|
|
4298
4324
|
- Custom theming and multi-language support
|
|
4299
4325
|
|
|
@@ -4317,6 +4343,8 @@ Full-featured competitive picks predictor component with a multi-tab interface f
|
|
|
4317
4343
|
| `playTabBanners` | `PlayTabBanner[]` | — | Custom banners rendered in the Play tab |
|
|
4318
4344
|
| `consents` | `ConsentDef[]` | — | Consent definitions required before predicting |
|
|
4319
4345
|
| `matchCardBgImageUrl` | `string` | — | Background image URL for match prediction cards |
|
|
4346
|
+
| `showOdds` | `boolean` | `false` | Render betting odds on the match cards. While false the odds request is skipped, so an `"odds-only"` betslip needs this set |
|
|
4347
|
+
| `operatorId` | `string` | — | Operator config id to show odds from, e.g. `"betano-bg"`. Unset, each match shows the first operator listed. Falls back to `betslip.operatorId`, and the Betslip falls back to it |
|
|
4320
4348
|
| `betslip` | `TopXBetslipConfig` | — | Betslip integration config. Omit to disable. |
|
|
4321
4349
|
| `showCountdown` | `boolean` | `true` | Show predictions-close countdown timer on open games |
|
|
4322
4350
|
| `gameNavLabel` | `TopXGameNavLabel` | `"gameWeek"` | Controls how each game is labelled in the navigation. See [Game Navigation Label](#game-navigation-label) |
|
|
@@ -4457,6 +4485,27 @@ const consents: ConsentDef[] = [
|
|
|
4457
4485
|
<TopX {...otherProps} consents={consents} />;
|
|
4458
4486
|
```
|
|
4459
4487
|
|
|
4488
|
+
#### TopX Odds
|
|
4489
|
+
|
|
4490
|
+
Odds are off by default. With `showOdds` set, each upcoming match card shows full-time 1X2 odds from one operator, refreshed while a match is live — in the Play tab and in a league member's predictions. Odds fail silently: when the odds API has no prices for a match, the card simply shows none.
|
|
4491
|
+
|
|
4492
|
+
- **`showOdds`** — while it is false (the default) the odds request is skipped altogether. A betslip with `trigger: "odds-only"` is fed by clicking those odds, so that trigger needs `showOdds` set.
|
|
4493
|
+
- **`operatorId`** pins the odds to one operator. It is sent to the odds request as the SDK's `operators` filter, so the response is narrowed server-side. Without it, each match shows whichever operator the response lists first, which is not guaranteed to stay the same. A match the chosen operator doesn't price shows no odds; it does not fall back to another operator.
|
|
4494
|
+
|
|
4495
|
+
```tsx
|
|
4496
|
+
<TopX entityId="..." sdk={sdk} language="en" showOdds operatorId="betano-bg" />
|
|
4497
|
+
```
|
|
4498
|
+
|
|
4499
|
+
`operatorId` and `betslip.operatorId` resolve against each other, so the card and the betslip show the same operator unless you set both to different values:
|
|
4500
|
+
|
|
4501
|
+
| You set | Card odds | Betslip |
|
|
4502
|
+
| -------------------- | -------------------- | -------------------- |
|
|
4503
|
+
| `operatorId` | `operatorId` | `operatorId` |
|
|
4504
|
+
| `betslip.operatorId` | `betslip.operatorId` | `betslip.operatorId` |
|
|
4505
|
+
| Both | `operatorId` | `betslip.operatorId` |
|
|
4506
|
+
|
|
4507
|
+
See [Choosing a Bookmaker](#choosing-a-bookmaker) for the list of available operator ids.
|
|
4508
|
+
|
|
4460
4509
|
#### Betslip Integration
|
|
4461
4510
|
|
|
4462
4511
|
When the `betslip` prop is provided, the TopX component renders a `Betslip` widget alongside its own UI — no separate `<Betslip />` component is needed.
|
|
@@ -4488,7 +4537,7 @@ const betslipConfig: TopXBetslipConfig = {
|
|
|
4488
4537
|
| `currency` | `string` | `"€"` | Currency symbol |
|
|
4489
4538
|
| `ctaUrlTemplate` | `string` | — | Bookmaker deep-link URL with `{placeholder}` substitution |
|
|
4490
4539
|
| `brandingLogoUrl` | `string` | — | Operator logo URL |
|
|
4491
|
-
| `operatorId` | `string` | — | Operator config id the Betslip requests odds for, e.g. `"betano-bg"`
|
|
4540
|
+
| `operatorId` | `string` | — | Operator config id the Betslip requests odds for, e.g. `"betano-bg"`. Falls back to the top-level `operatorId` |
|
|
4492
4541
|
| `affiliateId` | `string` | — | Affiliate id substituted into the operator's URLs |
|
|
4493
4542
|
| `labels` | `BetslipLabels` | — | UI text overrides |
|
|
4494
4543
|
| `themeOptions` | `CustomThemeOptions` | — | Theme for the Betslip widget. Falls back to the TopX `themeOptions` when omitted |
|
|
@@ -4803,7 +4852,7 @@ import { Predictor } from "fansunited-frontend-components";
|
|
|
4803
4852
|
| Mode | When selections are sent to Betslip |
|
|
4804
4853
|
| --------------------- | --------------------------------------------------------------------------------- |
|
|
4805
4854
|
| `"predictions-only"` | Each time the user changes a score prediction (before submitting) |
|
|
4806
|
-
| `"odds-only"` | When the user clicks an odds button on the post-submit odds view
|
|
4855
|
+
| `"odds-only"` | When the user clicks an odds button on the post-submit odds view (requires `showOdds`) |
|
|
4807
4856
|
|
|
4808
4857
|
#### The CTA Link
|
|
4809
4858
|
|
|
@@ -4855,6 +4904,8 @@ It is passed to the odds request as the SDK's `operators` filter, so the respons
|
|
|
4855
4904
|
|
|
4856
4905
|
Everything the Betslip derives from the bookmaker follows — the odds themselves, the accent color, the header and CTA logo, and the deep links. Markets the chosen bookmaker does not price are dropped from the Betslip (see the odds behavior notes below), and if it prices nothing in the betslip, the panel stays hidden.
|
|
4857
4906
|
|
|
4907
|
+
Inside `Predictor` or `TopX` you don't need to set it twice: the component's top-level `operatorId` also pins the Betslip, unless `betslip.operatorId` says otherwise. See [Predictor Odds](#predictor-odds).
|
|
4908
|
+
|
|
4858
4909
|
**Available operator ids:**
|
|
4859
4910
|
|
|
4860
4911
|
```
|
|
@@ -5284,7 +5335,8 @@ A single-event card — a competition header over the two competitors and their
|
|
|
5284
5335
|
| `showStandings` | `boolean` | `type="detailed"` only. Show the **Table** (standings) tab. Defaults to `true` |
|
|
5285
5336
|
| `showHeadToHead` | `boolean` | `type="detailed"` only. Show the **H2H** tab. Defaults to `true` |
|
|
5286
5337
|
| `defaultSection` | `"preview" \| "summary" \| "stats" \| "lineups" \| "table" \| "h2h"` | `type="detailed"` only. Which tab opens first. Defaults to the first tab of the event's status |
|
|
5287
|
-
| `showOdds` | `boolean` | Render betting odds. Defaults to `
|
|
5338
|
+
| `showOdds` | `boolean` | Render betting odds. Defaults to `false` — not yet backed by the API, so currently renders nothing |
|
|
5339
|
+
| `operatorId` | `string` | Operator config id to show odds from, e.g. `"betano-bg"`. Not yet backed by the API, like `showOdds` |
|
|
5288
5340
|
| `liveRefresh` | `boolean` | Poll while the event is `LIVE`. Defaults to `true` |
|
|
5289
5341
|
| `refreshInterval` | `number` | Live-refresh interval in ms. Defaults to `30000` (30s) |
|
|
5290
5342
|
| `userIsLoggedIn` | `boolean` | Whether the visitor is signed in. Required for predictions. Defaults to `false` |
|