fansunited-frontend-components 0.0.25 → 0.0.27
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/README.md +245 -0
- package/components.d.ts +2 -1
- package/components.d.ts.map +1 -1
- package/components.js +67559 -88378
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1604,6 +1604,250 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
1604
1604
|
/>
|
|
1605
1605
|
```
|
|
1606
1606
|
|
|
1607
|
+
### EventGamePlay
|
|
1608
|
+
|
|
1609
|
+
Interactive event prediction component for sports and entertainment events. Features flexible fixture types, real-time countdown timers, points system, and comprehensive result tracking with leaderboards.
|
|
1610
|
+
|
|
1611
|
+
**Key Features:**
|
|
1612
|
+
|
|
1613
|
+
- Multiple outcome types (Boolean, Number, Enum, Free Input)
|
|
1614
|
+
- Real-time countdown timer for prediction cutoff
|
|
1615
|
+
- Points system with loyalty integration
|
|
1616
|
+
- Leaderboard and ranking system
|
|
1617
|
+
- Prediction summary and editing capabilities
|
|
1618
|
+
- Three responsive templates (Standard, Split, Overlay)
|
|
1619
|
+
- Custom theming
|
|
1620
|
+
|
|
1621
|
+
#### Required Props
|
|
1622
|
+
|
|
1623
|
+
| Prop | Type | Description |
|
|
1624
|
+
| ---------- | -------------------- | --------------------- |
|
|
1625
|
+
| `entityId` | `string` | Event Game identifier |
|
|
1626
|
+
| `sdk` | `FansUnitedSDKModel` | SDK instance |
|
|
1627
|
+
| `template` | `WidgetTemplate` | Layout template |
|
|
1628
|
+
| `language` | `LanguageType` | Display language |
|
|
1629
|
+
|
|
1630
|
+
#### Optional Props
|
|
1631
|
+
|
|
1632
|
+
| Prop | Type | Description |
|
|
1633
|
+
| ---------------------------- | ----------------------- | ------------------------------------------------- |
|
|
1634
|
+
| `themeOptions` | `CustomThemeOptions` | Theme configuration |
|
|
1635
|
+
| `leads` | `LeadsOptions` | Lead collection settings |
|
|
1636
|
+
| `imagePosition` | `"left" \| "right"` | Image position (STANDARD template only) |
|
|
1637
|
+
| `defaultImagePlaceholderUrl` | `string` | URL for default image placeholder |
|
|
1638
|
+
| `userIsLoggedIn` | `boolean` | Determine if the user is logged in |
|
|
1639
|
+
| `signInCTA` | `SignInCTADetails` | Sign in call to action button configuration |
|
|
1640
|
+
| `additionalCTA` | `AdditionalCTADetails` | Additional call to action button configuration |
|
|
1641
|
+
| `showCountdown` | `boolean` | Show countdown timer when Event Game is open |
|
|
1642
|
+
| `showPoints` | `boolean` | Show points display for each fixture |
|
|
1643
|
+
| `showPredictionDetails` | `boolean` | Show detailed prediction results after completion |
|
|
1644
|
+
|
|
1645
|
+
#### Templates
|
|
1646
|
+
|
|
1647
|
+
```tsx
|
|
1648
|
+
import { WidgetTemplate, EventGamePlayProps } from "fansunited-frontend-core";
|
|
1649
|
+
|
|
1650
|
+
// Standard template with optional image positioning
|
|
1651
|
+
const standardProps: EventGamePlayProps = {
|
|
1652
|
+
template: WidgetTemplate.STANDARD,
|
|
1653
|
+
imagePosition: "left", // or 'right'
|
|
1654
|
+
// ... other props
|
|
1655
|
+
};
|
|
1656
|
+
|
|
1657
|
+
// Split template - side-by-side layout
|
|
1658
|
+
const splitProps: EventGamePlayProps = {
|
|
1659
|
+
template: WidgetTemplate.SPLIT,
|
|
1660
|
+
// imagePosition not available for non-standard templates
|
|
1661
|
+
// ... other props
|
|
1662
|
+
};
|
|
1663
|
+
|
|
1664
|
+
// Overlay template - full-screen immersive experience
|
|
1665
|
+
const overlayProps: EventGamePlayProps = {
|
|
1666
|
+
template: WidgetTemplate.OVERLAY,
|
|
1667
|
+
// ... other props
|
|
1668
|
+
};
|
|
1669
|
+
```
|
|
1670
|
+
|
|
1671
|
+
#### Supported Outcome Types
|
|
1672
|
+
|
|
1673
|
+
EventGamePlay supports flexible prediction types for various event scenarios:
|
|
1674
|
+
|
|
1675
|
+
**Boolean Outcomes:**
|
|
1676
|
+
|
|
1677
|
+
- `BOOLEAN` - Yes/No predictions (e.g., "Will the total points exceed 225?")
|
|
1678
|
+
|
|
1679
|
+
**Number Outcomes:**
|
|
1680
|
+
|
|
1681
|
+
- `NUMBER` - Numeric predictions with optional min/max validation (e.g., "How many total points will be scored?")
|
|
1682
|
+
|
|
1683
|
+
**Enum Outcomes:**
|
|
1684
|
+
|
|
1685
|
+
- `ENUM` - Multiple choice selection from predefined options (e.g., "Who will be the game's leading scorer?")
|
|
1686
|
+
|
|
1687
|
+
**Free Input Outcomes:**
|
|
1688
|
+
|
|
1689
|
+
- `FREE_INPUT` - Open text input for custom predictions (e.g., "What will be the exact final score?")
|
|
1690
|
+
|
|
1691
|
+
#### Game Status States
|
|
1692
|
+
|
|
1693
|
+
Event games have 5 distinct status states:
|
|
1694
|
+
|
|
1695
|
+
- **`PENDING`** - Not yet open for predictions
|
|
1696
|
+
- **`OPEN`** - Ready for predictions (default state)
|
|
1697
|
+
- **`LIVE`** - Event has started, no new predictions accepted
|
|
1698
|
+
- **`CLOSED`** - Event finished, backend resolving predictions
|
|
1699
|
+
- **`SETTLED`** - Predictions resolved, leaderboard available
|
|
1700
|
+
|
|
1701
|
+
#### Countdown Timer
|
|
1702
|
+
|
|
1703
|
+
Enable countdown timer to show time remaining for predictions:
|
|
1704
|
+
|
|
1705
|
+
```tsx
|
|
1706
|
+
<EventGamePlay {...otherProps} showCountdown={true} />
|
|
1707
|
+
```
|
|
1708
|
+
|
|
1709
|
+
The countdown timer:
|
|
1710
|
+
|
|
1711
|
+
- Displays when Event Game status is `OPEN`
|
|
1712
|
+
- Shows days, hours, minutes, and seconds remaining
|
|
1713
|
+
- Uses `predictionsCutoff` from the Event Game data
|
|
1714
|
+
- Automatically hides when cutoff time is reached
|
|
1715
|
+
|
|
1716
|
+
#### Points System
|
|
1717
|
+
|
|
1718
|
+
Enable points display to show potential rewards:
|
|
1719
|
+
|
|
1720
|
+
```tsx
|
|
1721
|
+
<EventGamePlay {...otherProps} showPoints={true} />
|
|
1722
|
+
```
|
|
1723
|
+
|
|
1724
|
+
Points system features:
|
|
1725
|
+
|
|
1726
|
+
- Shows potential points for each fixture
|
|
1727
|
+
- Mobile-friendly tooltip display
|
|
1728
|
+
|
|
1729
|
+
#### Prediction Details
|
|
1730
|
+
|
|
1731
|
+
Show detailed prediction results and explanations:
|
|
1732
|
+
|
|
1733
|
+
```tsx
|
|
1734
|
+
<EventGamePlay {...otherProps} showPredictionDetails={true} />
|
|
1735
|
+
```
|
|
1736
|
+
|
|
1737
|
+
When enabled, users see:
|
|
1738
|
+
|
|
1739
|
+
- Tabulated interface showing all predictions
|
|
1740
|
+
- Correct vs incorrect prediction highlighting
|
|
1741
|
+
- Comparison with correct outcomes
|
|
1742
|
+
|
|
1743
|
+
#### Additional CTA Configuration
|
|
1744
|
+
|
|
1745
|
+
Add an extra call-to-action button to the event game results screen using the `additionalCTA` prop.
|
|
1746
|
+
|
|
1747
|
+
```tsx
|
|
1748
|
+
import { AdditionalCTADetails } from "fansunited-frontend-core";
|
|
1749
|
+
|
|
1750
|
+
// Custom component
|
|
1751
|
+
const additionalCTA: AdditionalCTADetails = {
|
|
1752
|
+
component: <CustomCTAButton />,
|
|
1753
|
+
};
|
|
1754
|
+
|
|
1755
|
+
// Basic CTA with onClick handler
|
|
1756
|
+
const additionalCTA: AdditionalCTADetails = {
|
|
1757
|
+
defaultLabel: "View Leaderboard",
|
|
1758
|
+
onClick: () => {
|
|
1759
|
+
// Handle click logic
|
|
1760
|
+
console.log("Additional CTA clicked");
|
|
1761
|
+
},
|
|
1762
|
+
};
|
|
1763
|
+
|
|
1764
|
+
// CTA with URL navigation
|
|
1765
|
+
const additionalCTA: AdditionalCTADetails = {
|
|
1766
|
+
defaultLabel: "Event Details",
|
|
1767
|
+
url: "https://your-website.com/event-details",
|
|
1768
|
+
target: "_blank", // or "_self"
|
|
1769
|
+
};
|
|
1770
|
+
|
|
1771
|
+
<EventGamePlay
|
|
1772
|
+
{...otherProps}
|
|
1773
|
+
additionalCTA={additionalCTA}
|
|
1774
|
+
/>;
|
|
1775
|
+
```
|
|
1776
|
+
|
|
1777
|
+
**Priority Order:**
|
|
1778
|
+
|
|
1779
|
+
1. **Custom Component** - If `additionalCTA.component` is provided, it will be rendered
|
|
1780
|
+
2. **Click Handler** - If `additionalCTA.onClick` is provided, a button with the handler will be rendered
|
|
1781
|
+
3. **URL Navigation** - If `additionalCTA.url` is provided, a button will be rendered and clicking will navigate to the URL
|
|
1782
|
+
|
|
1783
|
+
**Placement:**
|
|
1784
|
+
|
|
1785
|
+
- **Standard variant**: Displayed after prediction summary
|
|
1786
|
+
- **Split variant**: Displayed after prediction summary
|
|
1787
|
+
- **Overlay variant**: Displayed after prediction summary
|
|
1788
|
+
|
|
1789
|
+
#### Examples
|
|
1790
|
+
|
|
1791
|
+
##### Basic Event Game
|
|
1792
|
+
|
|
1793
|
+
```tsx
|
|
1794
|
+
import { EventGamePlay } from "fansunited-frontend-components";
|
|
1795
|
+
import { WidgetTemplate } from "fansunited-frontend-core";
|
|
1796
|
+
|
|
1797
|
+
<EventGamePlay
|
|
1798
|
+
entityId="event-game-123"
|
|
1799
|
+
sdk={sdkInstance}
|
|
1800
|
+
template={WidgetTemplate.STANDARD}
|
|
1801
|
+
language="en"
|
|
1802
|
+
/>;
|
|
1803
|
+
```
|
|
1804
|
+
|
|
1805
|
+
##### Advanced Event Game
|
|
1806
|
+
|
|
1807
|
+
```tsx
|
|
1808
|
+
<EventGamePlay
|
|
1809
|
+
entityId="event-game-123"
|
|
1810
|
+
sdk={sdkInstance}
|
|
1811
|
+
template={WidgetTemplate.OVERLAY}
|
|
1812
|
+
language="en"
|
|
1813
|
+
showCountdown={true}
|
|
1814
|
+
showPoints={true}
|
|
1815
|
+
showPredictionDetails={true}
|
|
1816
|
+
themeOptions={{
|
|
1817
|
+
mode: "dark",
|
|
1818
|
+
colorSchemes: {
|
|
1819
|
+
dark: {
|
|
1820
|
+
textPrimary: "#ffffff",
|
|
1821
|
+
surface: "#1a1a1a",
|
|
1822
|
+
},
|
|
1823
|
+
},
|
|
1824
|
+
}}
|
|
1825
|
+
/>
|
|
1826
|
+
```
|
|
1827
|
+
|
|
1828
|
+
##### Customized Layout
|
|
1829
|
+
|
|
1830
|
+
```tsx
|
|
1831
|
+
<EventGamePlay
|
|
1832
|
+
entityId="event-game-123"
|
|
1833
|
+
sdk={sdkInstance}
|
|
1834
|
+
template={WidgetTemplate.STANDARD}
|
|
1835
|
+
imagePosition="right"
|
|
1836
|
+
language="en"
|
|
1837
|
+
showCountdown={true}
|
|
1838
|
+
showPoints={true}
|
|
1839
|
+
themeOptions={{
|
|
1840
|
+
mode: "light",
|
|
1841
|
+
customFontFamily: {
|
|
1842
|
+
light: {
|
|
1843
|
+
primary: "Inter, sans-serif",
|
|
1844
|
+
secondary: "Roboto, sans-serif",
|
|
1845
|
+
},
|
|
1846
|
+
},
|
|
1847
|
+
}}
|
|
1848
|
+
/>
|
|
1849
|
+
```
|
|
1850
|
+
|
|
1607
1851
|
## Available Components
|
|
1608
1852
|
|
|
1609
1853
|
This package exports the following components:
|
|
@@ -1613,6 +1857,7 @@ This package exports the following components:
|
|
|
1613
1857
|
- **`CollectLead`** - Lead collection forms with custom fields
|
|
1614
1858
|
- **`PersonalityQuizPlay`** - Personality assessment with persona matching
|
|
1615
1859
|
- **`MatchQuizPlay`** - Football match prediction quiz with multiple markets
|
|
1860
|
+
- **`EventGamePlay`** - Event prediction game with flexible outcome types
|
|
1616
1861
|
|
|
1617
1862
|
## Related Packages
|
|
1618
1863
|
|
package/components.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ClassicQuizPlayProps, PollVoteProps, CollectLeadProps, PersonalityQuizPlayProps, MatchQuizPlayProps } from 'fansunited-frontend-core';
|
|
1
|
+
import { ClassicQuizPlayProps, PollVoteProps, CollectLeadProps, PersonalityQuizPlayProps, MatchQuizPlayProps, EventGamePlayProps } from 'fansunited-frontend-core';
|
|
2
2
|
|
|
3
3
|
export declare const ClassicQuizPlay: React.FC<ClassicQuizPlayProps>;
|
|
4
4
|
export declare const PollVote: React.FC<PollVoteProps>;
|
|
5
5
|
export declare const CollectLead: React.FC<CollectLeadProps>;
|
|
6
6
|
export declare const PersonalityQuizPlay: React.FC<PersonalityQuizPlayProps>;
|
|
7
7
|
export declare const MatchQuizPlay: React.FC<MatchQuizPlayProps>;
|
|
8
|
+
export declare const EventGamePlay: React.FC<EventGamePlayProps>;
|
|
8
9
|
//# sourceMappingURL=components.d.ts.map
|
package/components.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/components.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/components.tsx"],"names":[],"mappings":"AAMA,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAIlC,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CACjC,CAAC;AAE3B,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAqB,CAAC;AAEnE,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAwB,CAAC;AAE5E,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CACrC,CAAC;AAE/B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAC/B,CAAC;AAEzB,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAC/B,CAAC"}
|