fansunited-frontend-components 0.0.59 → 0.0.60

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.
Files changed (4) hide show
  1. package/Predictor.js +4940 -4073
  2. package/README.md +102 -14
  3. package/index.js +1 -1
  4. package/package.json +2 -2
package/README.md CHANGED
@@ -3344,16 +3344,17 @@ import { Leaderboard } from "fansunited-frontend-components";
3344
3344
 
3345
3345
  ### Predictor
3346
3346
 
3347
- Full-featured football score predictor component with a multi-tab interface for match predictions, global leaderboard, private leagues, game rules, and prizes. Designed as a season-long engagement tool for sports platforms.
3347
+ Football score predictor component with two templates: the default **multi-tab** interface (match predictions, global leaderboard, private leagues, game rules, and prizes) for a season-long engagement tool, and **`embed`** — a compact single-match card designed to sit inside an article.
3348
3348
 
3349
3349
  **Key Features:**
3350
3350
 
3351
- - Multi-tab navigation: Play, Leaderboard, Private Leagues, Rules, and Prizes
3351
+ - Two templates: `"standard"` (multi-tab) and `"embed"` (single-match article card) see [Templates](#predictor-templates)
3352
+ - Multi-tab navigation: Play, Leaderboard, Private Leagues, Rules, and Prizes (`"standard"` only)
3352
3353
  - Match score prediction interface with grouped matchweeks
3353
3354
  - Global leaderboard with paginated standings and user rank highlighting
3354
3355
  - Private leagues — create and join custom competitive groups
3355
3356
  - Consent management with required/optional consent gates before predicting
3356
- - Customisable banners in 6 positions within the Play tab
3357
+ - Customisable banners in 6 positions within the Play tab (`"standard"` only)
3357
3358
  - Authentication-aware UI with configurable sign-in CTA
3358
3359
  - Built-in Betslip integration — renders the Betslip widget automatically via the `betslip` prop with two trigger modes
3359
3360
  - Custom theming and multi-language support
@@ -3368,20 +3369,77 @@ Full-featured football score predictor component with a multi-tab interface for
3368
3369
 
3369
3370
  #### Optional Props
3370
3371
 
3371
- | Prop | Type | Description |
3372
- | ---------------------------- | -------------------- | --------------------------------------------------- |
3373
- | `themeOptions` | `CustomThemeOptions` | Theme configuration |
3374
- | `userIsLoggedIn` | `boolean` | Determine if the user is logged in (default: false) |
3375
- | `signInCTA` | `SignInCTADetails` | Sign in call to action button configuration |
3376
- | `tabs` | `PredictorTab[]` | Tabs to enable (default: all tabs) |
3377
- | `defaultImagePlaceholderUrl` | `string` | Fallback image URL for the hero header |
3378
- | `playTabBanners` | `PlayTabBanner[]` | Custom banners rendered in the Play tab |
3379
- | `consents` | `ConsentDef[]` | Consent definitions required before predicting |
3380
- | `matchCardBgImageUrl` | `string` | Background image URL for match prediction cards |
3381
- | `betslip` | `PredictorBetslipConfig` | Betslip integration config. Omit to disable. See [Betslip Integration](#betslip-integration) |
3372
+ | Prop | Type | Description |
3373
+ | ----------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------ |
3374
+ | `template` | `PredictorTemplateType` | `"standard"` (default) or `"embed"`. See [Templates](#predictor-templates) |
3375
+ | `embed` | `PredictorEmbedConfig` | Only read when `template === "embed"`. See [Templates](#predictor-templates) |
3376
+ | `themeOptions` | `CustomThemeOptions` | Theme configuration |
3377
+ | `userIsLoggedIn` | `boolean` | Determine if the user is logged in (default: false) |
3378
+ | `signInCTA` | `SignInCTADetails` | Sign in call to action button configuration |
3379
+ | `tabs` | `PredictorTab[]` | Tabs to enable (default: all tabs). Ignored by `"embed"` |
3380
+ | `defaultImagePlaceholderUrl` | `string` | Fallback image shown when the template has no `image` configured. Used by both templates |
3381
+ | `playTabBanners` | `PlayTabBanner[]` | Custom banners rendered in the Play tab. Ignored by `"embed"` |
3382
+ | `consents` | `ConsentDef[]` | Consent definitions required before predicting |
3383
+ | `matchCardBgImageUrl` | `string` | Background image URL for match prediction cards. Ignored by `"embed"` |
3384
+ | `betslip` | `PredictorBetslipConfig` | Betslip integration config. Omit to disable. See [Betslip Integration](#betslip-integration) |
3385
+
3386
+ #### Predictor Templates
3387
+
3388
+ ```ts
3389
+ type PredictorTemplateType = "standard" | "embed";
3390
+ ```
3391
+
3392
+ | Template | Use case |
3393
+ | --- | --- |
3394
+ | `"standard"` (default) | The full multi-tab interface — Play, Leaderboard, Private Leagues, Rules, Prizes. |
3395
+ | `"embed"` | A single upcoming match rendered as a compact card, meant to be dropped inside an article. No tabs, no leaderboard. |
3396
+
3397
+ Unlike the shared `WidgetTemplate` enum used by most other components, Predictor's `template` is a plain string union — it isn't part of the standard/split/overlay family, and `"embed"` has its own config object:
3398
+
3399
+ ```ts
3400
+ interface PredictorEmbedConfig {
3401
+ imagePosition?: "left" | "right"; // default: "right" — description takes the other side
3402
+ matchId?: string; // pin a specific match; otherwise the soonest upcoming match across the whole template is used
3403
+ successMessage?: {
3404
+ title?: string;
3405
+ description?: string;
3406
+ cta: OnSuccessCTADetails; // required — priority is onClick → url (no `component` support here)
3407
+ };
3408
+ }
3409
+ ```
3410
+
3411
+ **Embed layout:** a gradient background (top to bottom, from the theme's primary color) wraps a branding/title/description block next to an optional image (position set by `imagePosition`), a white match card with team crests and centered score steppers showing the always-visible full 1X2 odds market, and a fixed-size submit button below the card. When `embed.successMessage` is configured, submitting a prediction swaps that button for the same-styled CTA button (using `successMessage.cta`) followed by a success alert with a pop-in animation; omit `successMessage` to show nothing extra after submission.
3412
+
3413
+ ```tsx
3414
+ import { Predictor } from "fansunited-frontend-components";
3415
+ import { PredictorProps } from "fansunited-frontend-core";
3416
+
3417
+ const embedProps: PredictorProps = {
3418
+ entityId: "predictor-template-123",
3419
+ sdk,
3420
+ language: "en",
3421
+ template: "embed",
3422
+ embed: {
3423
+ imagePosition: "left",
3424
+ successMessage: {
3425
+ title: "Prediction submitted!",
3426
+ description: "Keep playing for a chance to win amazing prizes.",
3427
+ cta: {
3428
+ defaultLabel: "Play Now",
3429
+ url: "https://your-site.com/predictor",
3430
+ target: "_blank",
3431
+ },
3432
+ },
3433
+ },
3434
+ };
3435
+
3436
+ <Predictor {...embedProps} />;
3437
+ ```
3382
3438
 
3383
3439
  #### Tabs
3384
3440
 
3441
+ > Applies to `template="standard"` only.
3442
+
3385
3443
  Configure which tabs are visible using the `tabs` prop. All tabs are enabled by default.
3386
3444
 
3387
3445
  ```tsx
@@ -3583,12 +3641,15 @@ Import types from `fansunited-frontend-core`:
3583
3641
  import {
3584
3642
  PredictorProps,
3585
3643
  PredictorTab,
3644
+ PredictorTemplateType,
3645
+ PredictorEmbedConfig,
3586
3646
  PredictorBetslipConfig,
3587
3647
  PredictorBetslipTrigger,
3588
3648
  PlayTabBanner,
3589
3649
  PlayTabBannerPosition,
3590
3650
  ConsentDef,
3591
3651
  SignInCTADetails,
3652
+ OnSuccessCTADetails,
3592
3653
  CustomThemeOptions,
3593
3654
  LanguageType,
3594
3655
  } from "fansunited-frontend-core";
@@ -3722,6 +3783,33 @@ Selections are sent only when the user explicitly clicks an odds button on the p
3722
3783
  />
3723
3784
  ```
3724
3785
 
3786
+ ##### Embed (Article)
3787
+
3788
+ A single-match card meant to sit inside an article, instead of the full multi-tab experience. See [Predictor Templates](#predictor-templates).
3789
+
3790
+ ```tsx
3791
+ <Predictor
3792
+ entityId="predictor-template-123"
3793
+ sdk={sdkInstance}
3794
+ language="en"
3795
+ userIsLoggedIn={true}
3796
+ template="embed"
3797
+ embed={{
3798
+ imagePosition: "right",
3799
+ successMessage: {
3800
+ title: "Prediction submitted!",
3801
+ description: "Keep playing for a chance to win amazing prizes.",
3802
+ cta: {
3803
+ defaultLabel: "Play Now",
3804
+ url: "https://your-site.com/predictor",
3805
+ target: "_blank",
3806
+ },
3807
+ },
3808
+ }}
3809
+ themeOptions={{ mode: "light" }}
3810
+ />
3811
+ ```
3812
+
3725
3813
  ---
3726
3814
 
3727
3815
  ### TopX
package/index.js CHANGED
@@ -19,7 +19,7 @@ import "./chunks/PrizeCard-C4uB4BtX.js";
19
19
  import "react/jsx-runtime";
20
20
  import "react-dom";
21
21
  typeof window < "u" && (window.fansUnitedComponentsVersions = {
22
- components: "0.0.59",
22
+ components: "0.0.60",
23
23
  core: o
24
24
  });
25
25
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fansunited-frontend-components",
3
- "version": "0.0.59",
3
+ "version": "0.0.60",
4
4
  "description": "Various user centric components for Fans United features",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -64,7 +64,7 @@
64
64
  }
65
65
  },
66
66
  "dependencies": {
67
- "fansunited-frontend-core": "0.0.59",
67
+ "fansunited-frontend-core": "0.0.60",
68
68
  "react": ">=16.8.0",
69
69
  "react-dom": ">=16.8.0"
70
70
  },