fansunited-frontend-components 1.1.1 → 1.3.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/BattleOfFans.js +427 -404
- package/Betslip.js +2 -2
- package/ChanceGame.js +1 -1
- package/ClassicQuizPlay.js +2 -2
- package/CollectLead.js +1 -1
- package/CompetitionStatistics.js +1 -1
- package/CompetitorCard.js +1 -1
- package/Discussion.js +1 -1
- package/EitherOrPlay.js +2 -2
- package/EventCard.js +1 -1
- package/EventGamePlay.js +2 -2
- package/Leaderboard.js +1 -1
- package/List.js +4 -4
- package/MatchQuizPlay.js +2 -2
- package/Odds.js +1 -1
- package/PersonalityQuizPlay.js +2 -2
- package/PickThePair.js +1 -1
- package/PlayerOfTheMatch.js +805 -857
- package/PollVote.js +2 -2
- package/Predictor.js +1576 -1569
- package/ProfileStats.d.ts +4 -0
- package/ProfileStats.d.ts.map +1 -0
- package/ProfileStats.js +2781 -0
- package/README.md +101 -2
- package/Standings.js +1 -1
- package/TopX.js +722 -715
- package/chunks/index-CLJiQKNv.js +4 -0
- package/chunks/index-D6-V3WrE.js +4 -0
- package/chunks/index-Dt38wFLo.js +4 -0
- package/chunks/index-Ehvd1Qmz.js +4 -0
- package/chunks/index-QtarvzAb.js +4 -0
- package/chunks/index-kffkFNES.js +4 -0
- package/chunks/{main-P2WNvBZE.js → main-8Yt_jn04.js} +402 -392
- package/chunks/{main-DdL0UekL.js → main-BnuQygIM.js} +1853 -1783
- package/chunks/main-BpGmqCTf.js +2142 -0
- package/chunks/main-C0PSUCR_.js +3027 -0
- package/chunks/{main-LEE8n2cG.js → main-CfdOHNHz.js} +1268 -1203
- package/chunks/{main-D_QDfmAw.js → main-PpLP-LeG.js} +1797 -1753
- package/chunks/{main-C7X4dM_P.js → main-p1Qbq-Fw.js} +1532 -1483
- package/chunks/{withVersionStamp-CzdDF1rG.js → withVersionStamp-BOktiTgW.js} +1 -1
- package/components.d.ts +2 -1
- package/components.d.ts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +11 -9
- package/package.json +6 -2
- package/chunks/index-BNl8scz6.js +0 -4
- package/chunks/index-CSa2JU4m.js +0 -4
- package/chunks/index-Cd1dg0KI.js +0 -4
- package/chunks/index-Cei2fzi7.js +0 -4
- package/chunks/index-Cxb4wEJU.js +0 -4
- package/chunks/index-w1LGN5dz.js +0 -4
- package/chunks/main-07vzblS8.js +0 -2091
- package/chunks/main-DmBfwyb4.js +0 -2992
package/README.md
CHANGED
|
@@ -88,6 +88,11 @@ interface EitherOrPlayCallbacks {
|
|
|
88
88
|
onFinish?: (participation: EitherOrParticipationModel) => void;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
// BattleOfFans
|
|
92
|
+
interface BattleOfFansCallbacks {
|
|
93
|
+
onFinish?: (vote: SinglePollVoteModel) => void;
|
|
94
|
+
}
|
|
95
|
+
|
|
91
96
|
// CompetitionStatistics — not only observers: setting onBroadcastClick is what shows the TV icon
|
|
92
97
|
interface CompetitionStatisticsCallbacks {
|
|
93
98
|
onBroadcastClick?: (matchId: string) => void;
|
|
@@ -3809,6 +3814,8 @@ Football score predictor component with two templates: the default **multi-tab**
|
|
|
3809
3814
|
| `userIsLoggedIn` | `boolean` | Determine if the user is logged in (default: false) |
|
|
3810
3815
|
| `signInCTA` | `SignInCTADetails` | Sign in call to action button configuration |
|
|
3811
3816
|
| `tabs` | `PredictorTab[]` | Tabs to enable (default: all tabs). Ignored by `"embed"` |
|
|
3817
|
+
| `tab` | `PredictorTab` | Render only this tab — no tab bar, no URL hash handling. Wins over `tabs`. See [Page per tab](#predictor-page-per-tab). Ignored by `"embed"` |
|
|
3818
|
+
| `showHeader` | `boolean` | Show the hero header (default: true, or false when `tab` is set). Ignored by `"embed"` |
|
|
3812
3819
|
| `defaultImagePlaceholderUrl` | `string` | Fallback image shown when the template has no `image` configured. Used by both templates |
|
|
3813
3820
|
| `header` | `PredictorHeaderConfig` | Size and framing of the standard hero banner. See [Header Banner](#predictor-header-banner). Ignored by `"embed"` |
|
|
3814
3821
|
| `playTabBanners` | `PlayTabBanner[]` | Custom banners rendered in the Play tab. Ignored by `"embed"` |
|
|
@@ -3970,6 +3977,25 @@ type PredictorTab = "play" | "leaderboard" | "private-leagues" | "rules" | "priz
|
|
|
3970
3977
|
| `"rules"` | Searchable game rules and scoring system |
|
|
3971
3978
|
| `"prizes"` | Prize distribution and rewards information |
|
|
3972
3979
|
|
|
3980
|
+
#### Predictor Page per Tab
|
|
3981
|
+
|
|
3982
|
+
> Applies to `template="standard"` only.
|
|
3983
|
+
|
|
3984
|
+
When each tab lives on its own page of your site (`/play`, `/leaderboard`, `/private-leagues`, …), pass `tab` instead of `tabs`. The component renders only that tab: no tab bar, since your site's navigation takes its place, and no hero header unless you set `showHeader`. It neither reads nor writes the URL hash, so your routes stay clean.
|
|
3985
|
+
|
|
3986
|
+
```tsx
|
|
3987
|
+
// /play
|
|
3988
|
+
<Predictor {...otherProps} tab="play" />
|
|
3989
|
+
|
|
3990
|
+
// /leaderboard
|
|
3991
|
+
<Predictor {...otherProps} tab="leaderboard" />
|
|
3992
|
+
|
|
3993
|
+
// /private-leagues, with the template's banner on top
|
|
3994
|
+
<Predictor {...otherProps} tab="private-leagues" showHeader />
|
|
3995
|
+
```
|
|
3996
|
+
|
|
3997
|
+
Changing `tab` on a mounted component switches to that tab, so client-side routing can reuse one instance. Each page fetches the template on its own. Each page also sends its own `widget_view` and `tab_view` events. Point the embed template's `submitCTA.url` at your Play page — that is where the handoff is read.
|
|
3998
|
+
|
|
3973
3999
|
#### Sign in Configuration
|
|
3974
4000
|
|
|
3975
4001
|
Control user authentication using the `userIsLoggedIn` and `signInCTA` props.
|
|
@@ -4428,6 +4454,8 @@ Full-featured competitive picks predictor component with a multi-tab interface f
|
|
|
4428
4454
|
| `userIsLoggedIn` | `boolean` | `false` | Whether the current user is authenticated |
|
|
4429
4455
|
| `signInCTA` | `SignInCTADetails` | — | Sign in call to action button configuration |
|
|
4430
4456
|
| `tabs` | `TopXTab[]` | all tabs | Tabs to enable |
|
|
4457
|
+
| `tab` | `TopXTab` | — | Render only this tab — no tab bar, no URL hash handling. Wins over `tabs`. See [Page per tab](#topx-page-per-tab) |
|
|
4458
|
+
| `showHeader` | `boolean` | `true` (`false` with `tab`) | Show the hero header |
|
|
4431
4459
|
| `defaultImagePlaceholderUrl` | `string` | — | Fallback image URL for the hero header |
|
|
4432
4460
|
| `playTabBanners` | `PlayTabBanner[]` | — | Custom banners rendered in the Play tab |
|
|
4433
4461
|
| `consents` | `ConsentDef[]` | — | Consent definitions required before predicting |
|
|
@@ -4463,6 +4491,23 @@ type TopXTab = "play" | "leaderboard" | "private-leagues" | "rules" | "prizes";
|
|
|
4463
4491
|
| `"rules"` | Searchable game rules and scoring system |
|
|
4464
4492
|
| `"prizes"` | Prize distribution and rewards information |
|
|
4465
4493
|
|
|
4494
|
+
#### TopX Page per Tab
|
|
4495
|
+
|
|
4496
|
+
When each tab lives on its own page of your site (`/play`, `/leaderboard`, `/private-leagues`, …), pass `tab` instead of `tabs`. The component renders only that tab: no tab bar, since your site's navigation takes its place, and no hero header unless you set `showHeader`. It neither reads nor writes the URL hash, so your routes stay clean.
|
|
4497
|
+
|
|
4498
|
+
```tsx
|
|
4499
|
+
// /play
|
|
4500
|
+
<TopX {...otherProps} tab="play" />
|
|
4501
|
+
|
|
4502
|
+
// /leaderboard
|
|
4503
|
+
<TopX {...otherProps} tab="leaderboard" />
|
|
4504
|
+
|
|
4505
|
+
// /private-leagues, with the template's banner on top
|
|
4506
|
+
<TopX {...otherProps} tab="private-leagues" showHeader />
|
|
4507
|
+
```
|
|
4508
|
+
|
|
4509
|
+
Changing `tab` on a mounted component switches to that tab, so client-side routing can reuse one instance. Each page fetches the template on its own.
|
|
4510
|
+
|
|
4466
4511
|
#### Game Navigation Label
|
|
4467
4512
|
|
|
4468
4513
|
The `gameNavLabel` prop controls how each game is labelled in the Play tab's navigation header — the title shown between the previous/next arrow buttons.
|
|
@@ -5775,7 +5820,8 @@ A head-to-head fan vote between football teams or football players. While voting
|
|
|
5775
5820
|
- Results visible before the vote, or only after it (`showResultsBeforeVote`)
|
|
5776
5821
|
- Winner reveal with a trophy badge on a corner of your choice, and a draw view for an even split
|
|
5777
5822
|
- Optional odds strip for a two-team battle
|
|
5778
|
-
- Optional sign-in gate for polls that require a registered user
|
|
5823
|
+
- Optional sign-in gate for polls that require a registered user, and a lead form for lead polls (`leads`)
|
|
5824
|
+
- Optional sponsor banner across the top of the card
|
|
5779
5825
|
|
|
5780
5826
|
#### Setting up the Poll
|
|
5781
5827
|
|
|
@@ -5785,6 +5831,7 @@ A head-to-head fan vote between football teams or football players. While voting
|
|
|
5785
5831
|
| `options` | One option per side, in the same order as the tags. The first is the home side |
|
|
5786
5832
|
| `custom_fields.voting_ends_at` | When voting closes, ISO 8601 UTC, e.g. `"2026-12-01T20:00:00Z"` |
|
|
5787
5833
|
| `custom_fields.voting_starts_at` | Optional. When voting opens, ISO 8601 UTC, for a poll that is `INACTIVE` until it is activated |
|
|
5834
|
+
| `auth_requirement` | `FREE`, `REGISTERED` (sign-in gate) or `LEAD` (lead form). `PAID` is not supported |
|
|
5788
5835
|
|
|
5789
5836
|
Voting also closes when the poll is no longer `ACTIVE`. Each user votes once. An `INACTIVE` poll with `voting_starts_at` ahead counts down to the start with the Vote buttons disabled, and opens once the poll is `ACTIVE`.
|
|
5790
5837
|
|
|
@@ -5813,6 +5860,8 @@ Voting also closes when the poll is no longer `ACTIVE`. Each user votes once. An
|
|
|
5813
5860
|
| `leads` | `LeadsOptions` | Lead form of a poll with `authRequirement: "LEAD"`, before voting or between the pick and the vote |
|
|
5814
5861
|
| `callbacks` | `BattleOfFansCallbacks` | `onFinish(vote)` after a vote is cast. Not called for a visitor who had already voted |
|
|
5815
5862
|
| `disableCache` | `boolean` | Bypass the CDN cache for every request |
|
|
5863
|
+
| `brandedAreaImage` | `string` | Image for an optional sponsor banner across the top of the card (860×150px slot). Hidden when unset |
|
|
5864
|
+
| `brandedAreaLink` | `string` | URL the sponsor banner opens, in a new tab |
|
|
5816
5865
|
|
|
5817
5866
|
#### Labels
|
|
5818
5867
|
|
|
@@ -6265,6 +6314,55 @@ import { Odds, betslipApi } from "fansunited-frontend-components";
|
|
|
6265
6314
|
|
|
6266
6315
|
---
|
|
6267
6316
|
|
|
6317
|
+
### ProfileStats
|
|
6318
|
+
|
|
6319
|
+
A fan's stats on one card: current tier and points, the tier ladder, interests, success rates, single predictions with a per-entity breakdown, Top X and Match Quiz, badges, discussions, mini games and voting. Without `profileId` it shows the signed-in fan's own stats from `profile.getOwn().getStats()` and `profile.getOwn().showFullInterests()`, and nothing renders for a guest. With `profileId` it shows that profile's stats from `profile.getById(profileId)`, guests included. Every stats section, Voting included, reads `getStats()`; Voting needs `fansunited-sdk-esm` 1.136.0 or later, and stays hidden on older versions. Tier names, thresholds and badges come from the client's loyalty config (`loyalty.getConfigV2()`).
|
|
6320
|
+
|
|
6321
|
+
**Key Features:**
|
|
6322
|
+
|
|
6323
|
+
- `sections` picks which sections render and in what order; with only one of Top X / Match Quiz to show, its tile takes the full row
|
|
6324
|
+
- Sections, tabs and figures the API has no data for are left out (the breakdown's Matches and Players tabs stay hidden while the SDK returns no rows for them)
|
|
6325
|
+
- Interests: favourites first, then teams, players, competitions and sports, 8 per group before "+N more", and a sport filter for fans who follow more than one sport
|
|
6326
|
+
- On the fan's own profile, Edit in Interests adds teams, players and competitions (found with the Search API, `entities/search?query=`), removes interests and marks favourites; Save sends one profile update, Cancel drops the edits. A failed save shows the shared notification (a 401/403 asks the fan to sign in again)
|
|
6327
|
+
- Badges as cards or medallions, the most recently earned first and the locked ones after; a badge's configured image (`assets.mainImageUrl`) replaces the placeholder icon, greyed out until earned
|
|
6328
|
+
- The accent, the theme's primary colour, colours the hero and the reached tiers
|
|
6329
|
+
|
|
6330
|
+
#### Required Props
|
|
6331
|
+
|
|
6332
|
+
| Prop | Type | Description |
|
|
6333
|
+
| ---------- | -------------------- | --------------------------------------------------- |
|
|
6334
|
+
| `sdk` | `FansUnitedSDKModel` | SDK instance; for own stats, with the signed-in user's auth provider |
|
|
6335
|
+
| `language` | `LanguageType` | Display language |
|
|
6336
|
+
|
|
6337
|
+
#### Optional Props
|
|
6338
|
+
|
|
6339
|
+
| Prop | Type | Description |
|
|
6340
|
+
| ----------------------- | --------------------------- | ----------- |
|
|
6341
|
+
| `themeOptions` | `CustomThemeOptions` | Theme configuration. The accent (`palette.primary.plainColor`) colours the hero and the reached tiers |
|
|
6342
|
+
| `profileId` | `string` | Show this profile's stats instead of the signed-in user's own, guests included |
|
|
6343
|
+
| `userIsLoggedIn` | `boolean` | Own stats only: `false` renders nothing without calling the API |
|
|
6344
|
+
| `sections` | `ProfileStatsSection[]` | Which sections render, in the order given: `"hero"`, `"tier-progression"`, `"interests"`, `"success-rates"`, `"single-predictions"`, `"prediction-games"` (Top X and Match Quiz), `"badges"`, `"discussions"`, `"mini-games"`, `"voting"`. Defaults to all of them in that order; a repeated key renders once |
|
|
6345
|
+
| `allowInterestEditing` | `boolean` | Own stats only: lets the fan add, remove and favourite interests. Defaults to `true`; `false` keeps the section read-only |
|
|
6346
|
+
| `showBreakdown` | `boolean` | The "Breakdown by entity" block inside Single predictions. Defaults to `true` |
|
|
6347
|
+
| `showPollBreakdown` | `boolean` | The "Polls breakdown by entity" block, collapsed at first. Defaults to `true` |
|
|
6348
|
+
| `badgeLayout` | `"cards" \| "medallions"` | Defaults to `"cards"` |
|
|
6349
|
+
| `labels` | `ProfileStatsLabels` | Overrides for any user-facing string |
|
|
6350
|
+
| `disableCache` | `boolean` | Bypass the SDK cache |
|
|
6351
|
+
|
|
6352
|
+
```tsx
|
|
6353
|
+
import { ProfileStats } from "fansunited-frontend-components";
|
|
6354
|
+
|
|
6355
|
+
<ProfileStats
|
|
6356
|
+
sdk={sdkInstance}
|
|
6357
|
+
language="en"
|
|
6358
|
+
badgeLayout="medallions"
|
|
6359
|
+
sections={["hero", "tier-progression", "badges", "prediction-games"]}
|
|
6360
|
+
themeOptions={{ mode: "dark" }}
|
|
6361
|
+
/>
|
|
6362
|
+
```
|
|
6363
|
+
|
|
6364
|
+
---
|
|
6365
|
+
|
|
6268
6366
|
## Available Components
|
|
6269
6367
|
|
|
6270
6368
|
This package exports the following components:
|
|
@@ -6285,10 +6383,11 @@ This package exports the following components:
|
|
|
6285
6383
|
- **`Standings`** - Sport-agnostic competition standings table with zone highlighting, rank movement, and team form
|
|
6286
6384
|
- **`EventCard`** - Single-event card with compact/standard/hero templates, team + tennis scoring, sport-aware status labels, live auto-refresh, and optional detail tabs (form, timeline, stats, lineups, standings, head-to-head)
|
|
6287
6385
|
- **`PlayerOfTheMatch`** - Coverflow voting carousel with search, position filters, a roster rail, live voting status, and winner/tied-winners results
|
|
6288
|
-
- **`BattleOfFans`** - Head-to-head fan vote between
|
|
6386
|
+
- **`BattleOfFans`** - Head-to-head fan vote between teams or players, with a countdown to the start or end, the vote split, a winner reveal and optional odds
|
|
6289
6387
|
- **`CompetitorCard`** - Team or athlete profile card with four templates, season statistics and a competition switcher, recent form, next/last fixture with odds and a live badge, and inline Fixtures, Squad and Season stats panels
|
|
6290
6388
|
- **`CompetitionStatistics`** - A competition's season on one page: fixtures and results by stage and round with live scores and odds, expandable match detail, player rankings, and season statistics
|
|
6291
6389
|
- **`Odds`** - One event's betting odds for one market from a preferred operator, with movement arrows, flash mode and a betslip callback
|
|
6390
|
+
- **`ProfileStats`** - The signed-in fan's (or a given profile's) tier, points, interests, prediction record with a per-entity breakdown, badges, discussions, mini games and voting on one card
|
|
6292
6391
|
|
|
6293
6392
|
## Related Packages
|
|
6294
6393
|
|
package/Standings.js
CHANGED
|
@@ -7,7 +7,7 @@ import { hexToRgb as Ge, useDisableCache as je, extractSdkErrorMessage as it, us
|
|
|
7
7
|
import { MatchFilters as ke } from "fansunited-sdk-esm/models";
|
|
8
8
|
import { EmojiEventsIcon as dt } from "fansunited-frontend-core/ui/icons";
|
|
9
9
|
import { createPortal as ut } from "react-dom";
|
|
10
|
-
import { w as pt } from "./chunks/withVersionStamp-
|
|
10
|
+
import { w as pt } from "./chunks/withVersionStamp-BOktiTgW.js";
|
|
11
11
|
const ft = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().replace(
|
|
12
12
|
/\S+/g,
|
|
13
13
|
(n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()
|