fansunited-frontend-components 1.1.0 → 1.2.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 +512 -469
- package/Betslip.js +1 -1
- 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 +1 -1
- package/ProfileStats.d.ts +4 -0
- package/ProfileStats.d.ts.map +1 -0
- package/ProfileStats.js +2781 -0
- package/README.md +65 -4
- package/Standings.js +1 -1
- package/TopX.js +1 -1
- 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-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-Cck3fT4t.js → withVersionStamp-C1gbpK3-.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;
|
|
@@ -5769,12 +5774,14 @@ A head-to-head fan vote between football teams or football players. While voting
|
|
|
5769
5774
|
|
|
5770
5775
|
- Team vs team or player vs player, from a `battle-of-fans` poll tagged with the entities
|
|
5771
5776
|
- Countdown to the end of voting, read from the poll's `voting_ends_at` custom field; switches to the result without a reload
|
|
5777
|
+
- Countdown to the start of voting for a poll that is inactive until its scheduled start (`voting_starts_at`); opens without a reload
|
|
5772
5778
|
- Each side in its own colours: a team's branding, a player's club branding, the theme otherwise
|
|
5773
5779
|
- Vote split as a progress bar or as the sides' own background (`progressDisplay`)
|
|
5774
5780
|
- Results visible before the vote, or only after it (`showResultsBeforeVote`)
|
|
5775
5781
|
- Winner reveal with a trophy badge on a corner of your choice, and a draw view for an even split
|
|
5776
5782
|
- Optional odds strip for a two-team battle
|
|
5777
|
-
- Optional sign-in gate for polls that require a registered user
|
|
5783
|
+
- Optional sign-in gate for polls that require a registered user, and a lead form for lead polls (`leads`)
|
|
5784
|
+
- Optional sponsor banner across the top of the card
|
|
5778
5785
|
|
|
5779
5786
|
#### Setting up the Poll
|
|
5780
5787
|
|
|
@@ -5783,8 +5790,10 @@ A head-to-head fan vote between football teams or football players. While voting
|
|
|
5783
5790
|
| `context.tags` | The competing football teams (`team`) or players (`player`) |
|
|
5784
5791
|
| `options` | One option per side, in the same order as the tags. The first is the home side |
|
|
5785
5792
|
| `custom_fields.voting_ends_at` | When voting closes, ISO 8601 UTC, e.g. `"2026-12-01T20:00:00Z"` |
|
|
5793
|
+
| `custom_fields.voting_starts_at` | Optional. When voting opens, ISO 8601 UTC, for a poll that is `INACTIVE` until it is activated |
|
|
5794
|
+
| `auth_requirement` | `FREE`, `REGISTERED` (sign-in gate) or `LEAD` (lead form). `PAID` is not supported |
|
|
5786
5795
|
|
|
5787
|
-
Voting also closes when the poll is no longer `ACTIVE`. Each user votes once.
|
|
5796
|
+
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`.
|
|
5788
5797
|
|
|
5789
5798
|
#### Required Props
|
|
5790
5799
|
|
|
@@ -5811,10 +5820,12 @@ Voting also closes when the poll is no longer `ACTIVE`. Each user votes once.
|
|
|
5811
5820
|
| `leads` | `LeadsOptions` | Lead form of a poll with `authRequirement: "LEAD"`, before voting or between the pick and the vote |
|
|
5812
5821
|
| `callbacks` | `BattleOfFansCallbacks` | `onFinish(vote)` after a vote is cast. Not called for a visitor who had already voted |
|
|
5813
5822
|
| `disableCache` | `boolean` | Bypass the CDN cache for every request |
|
|
5823
|
+
| `brandedAreaImage` | `string` | Image for an optional sponsor banner across the top of the card (860×150px slot). Hidden when unset |
|
|
5824
|
+
| `brandedAreaLink` | `string` | URL the sponsor banner opens, in a new tab |
|
|
5814
5825
|
|
|
5815
5826
|
#### Labels
|
|
5816
5827
|
|
|
5817
|
-
Keys: `title`, `subtitle`, `votingEndsIn`, `days`, `hours`, `minutes`, `seconds`, `vote`, `thankYou`, `voteToSeeResults`, `votingEnded`, `endedSubtitle`, `drawSubtitle`, `winner`, `ofTheVotes`, `finalResult`. `title` and `subtitle` default to the poll's own title and description. Every key falls back to the built-in translation; the default `subtitle` differs for teams and players.
|
|
5828
|
+
Keys: `title`, `subtitle`, `votingEndsIn`, `votingStartsIn`, `votingStartsSoon`, `days`, `hours`, `minutes`, `seconds`, `vote`, `thankYou`, `voteToSeeResults`, `votingEnded`, `endedSubtitle`, `drawSubtitle`, `winner`, `ofTheVotes`, `finalResult`. `title` and `subtitle` default to the poll's own title and description. Every key falls back to the built-in translation; the default `subtitle` differs for teams and players.
|
|
5818
5829
|
|
|
5819
5830
|
#### Examples
|
|
5820
5831
|
|
|
@@ -6263,6 +6274,55 @@ import { Odds, betslipApi } from "fansunited-frontend-components";
|
|
|
6263
6274
|
|
|
6264
6275
|
---
|
|
6265
6276
|
|
|
6277
|
+
### ProfileStats
|
|
6278
|
+
|
|
6279
|
+
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()`).
|
|
6280
|
+
|
|
6281
|
+
**Key Features:**
|
|
6282
|
+
|
|
6283
|
+
- `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
|
|
6284
|
+
- 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)
|
|
6285
|
+
- 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
|
|
6286
|
+
- 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)
|
|
6287
|
+
- 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
|
|
6288
|
+
- The accent, the theme's primary colour, colours the hero and the reached tiers
|
|
6289
|
+
|
|
6290
|
+
#### Required Props
|
|
6291
|
+
|
|
6292
|
+
| Prop | Type | Description |
|
|
6293
|
+
| ---------- | -------------------- | --------------------------------------------------- |
|
|
6294
|
+
| `sdk` | `FansUnitedSDKModel` | SDK instance; for own stats, with the signed-in user's auth provider |
|
|
6295
|
+
| `language` | `LanguageType` | Display language |
|
|
6296
|
+
|
|
6297
|
+
#### Optional Props
|
|
6298
|
+
|
|
6299
|
+
| Prop | Type | Description |
|
|
6300
|
+
| ----------------------- | --------------------------- | ----------- |
|
|
6301
|
+
| `themeOptions` | `CustomThemeOptions` | Theme configuration. The accent (`palette.primary.plainColor`) colours the hero and the reached tiers |
|
|
6302
|
+
| `profileId` | `string` | Show this profile's stats instead of the signed-in user's own, guests included |
|
|
6303
|
+
| `userIsLoggedIn` | `boolean` | Own stats only: `false` renders nothing without calling the API |
|
|
6304
|
+
| `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 |
|
|
6305
|
+
| `allowInterestEditing` | `boolean` | Own stats only: lets the fan add, remove and favourite interests. Defaults to `true`; `false` keeps the section read-only |
|
|
6306
|
+
| `showBreakdown` | `boolean` | The "Breakdown by entity" block inside Single predictions. Defaults to `true` |
|
|
6307
|
+
| `showPollBreakdown` | `boolean` | The "Polls breakdown by entity" block, collapsed at first. Defaults to `true` |
|
|
6308
|
+
| `badgeLayout` | `"cards" \| "medallions"` | Defaults to `"cards"` |
|
|
6309
|
+
| `labels` | `ProfileStatsLabels` | Overrides for any user-facing string |
|
|
6310
|
+
| `disableCache` | `boolean` | Bypass the SDK cache |
|
|
6311
|
+
|
|
6312
|
+
```tsx
|
|
6313
|
+
import { ProfileStats } from "fansunited-frontend-components";
|
|
6314
|
+
|
|
6315
|
+
<ProfileStats
|
|
6316
|
+
sdk={sdkInstance}
|
|
6317
|
+
language="en"
|
|
6318
|
+
badgeLayout="medallions"
|
|
6319
|
+
sections={["hero", "tier-progression", "badges", "prediction-games"]}
|
|
6320
|
+
themeOptions={{ mode: "dark" }}
|
|
6321
|
+
/>
|
|
6322
|
+
```
|
|
6323
|
+
|
|
6324
|
+
---
|
|
6325
|
+
|
|
6266
6326
|
## Available Components
|
|
6267
6327
|
|
|
6268
6328
|
This package exports the following components:
|
|
@@ -6283,10 +6343,11 @@ This package exports the following components:
|
|
|
6283
6343
|
- **`Standings`** - Sport-agnostic competition standings table with zone highlighting, rank movement, and team form
|
|
6284
6344
|
- **`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)
|
|
6285
6345
|
- **`PlayerOfTheMatch`** - Coverflow voting carousel with search, position filters, a roster rail, live voting status, and winner/tied-winners results
|
|
6286
|
-
- **`BattleOfFans`** - Head-to-head fan vote between
|
|
6346
|
+
- **`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
|
|
6287
6347
|
- **`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
|
|
6288
6348
|
- **`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
|
|
6289
6349
|
- **`Odds`** - One event's betting odds for one market from a preferred operator, with movement arrows, flash mode and a betslip callback
|
|
6350
|
+
- **`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
|
|
6290
6351
|
|
|
6291
6352
|
## Related Packages
|
|
6292
6353
|
|
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-C1gbpK3-.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()
|
package/TopX.js
CHANGED
|
@@ -10,7 +10,7 @@ import { css as n, keyframes as he } from "@emotion/react";
|
|
|
10
10
|
import { c as x, p as N, f as P, a as Ie, L as kr, b as Dn, m as Pn, d as Sr, G as wr, P as Cr, R as Tr, e as Ir } from "./chunks/predictionsHelpers-D8j0Y78z.js";
|
|
11
11
|
import { ShieldOutlinedIcon as Nn, PersonIcon as Er } from "fansunited-frontend-core/ui/icons";
|
|
12
12
|
import "fansunited-frontend-core/ui/icons/lucide";
|
|
13
|
-
import { w as Lr } from "./chunks/withVersionStamp-
|
|
13
|
+
import { w as Lr } from "./chunks/withVersionStamp-C1gbpK3-.js";
|
|
14
14
|
const On = gr(null), Rr = ({ children: e, ...o }) => /* @__PURE__ */ t(On.Provider, { value: o, children: e }), Ye = () => {
|
|
15
15
|
const e = hr(On);
|
|
16
16
|
if (!e)
|