fansunited-frontend-components 0.0.22 → 0.0.23-RC2
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 +381 -79
- package/components.d.ts +2 -1
- package/components.d.ts.map +1 -1
- package/components.js +64914 -22390
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,6 +108,7 @@ const themeOptions: CustomThemeOptions = {
|
|
|
108
108
|
success: {
|
|
109
109
|
plainColor: "#4CAF50",
|
|
110
110
|
outlinedBorder: "#4CAF50",
|
|
111
|
+
softBg: "#E3FBE3",
|
|
111
112
|
},
|
|
112
113
|
danger: {
|
|
113
114
|
softBg: "#FEE4E2",
|
|
@@ -148,6 +149,7 @@ const themeOptions: CustomThemeOptions = {
|
|
|
148
149
|
success: {
|
|
149
150
|
plainColor: "#4CAF50",
|
|
150
151
|
outlinedBorder: "#4CAF50",
|
|
152
|
+
softBg: "#042F04",
|
|
151
153
|
},
|
|
152
154
|
danger: {
|
|
153
155
|
softBg: "#FEE4E2",
|
|
@@ -287,26 +289,26 @@ const signInCTA: SignInCTADetails = {
|
|
|
287
289
|
onClick: () => {
|
|
288
290
|
// Handle sign-in logic
|
|
289
291
|
console.log("Sign in clicked");
|
|
290
|
-
}
|
|
292
|
+
},
|
|
291
293
|
};
|
|
292
294
|
|
|
293
295
|
// Sign-in with URL navigation
|
|
294
296
|
const signInCTA: SignInCTADetails = {
|
|
295
297
|
defaultLabel: "Login",
|
|
296
298
|
url: "https://your-auth-provider.com/login",
|
|
297
|
-
target: "_blank" // or "_self"
|
|
299
|
+
target: "_blank", // or "_self"
|
|
298
300
|
};
|
|
299
301
|
|
|
300
302
|
// Custom sign-in component
|
|
301
303
|
const signInCTA: SignInCTADetails = {
|
|
302
|
-
component: <CustomSignInButton
|
|
304
|
+
component: <CustomSignInButton />,
|
|
303
305
|
};
|
|
304
306
|
|
|
305
307
|
<ClassicQuizPlay
|
|
306
308
|
{...otherProps}
|
|
307
309
|
userIsLoggedIn={false}
|
|
308
310
|
signInCTA={signInCTA}
|
|
309
|
-
|
|
311
|
+
/>;
|
|
310
312
|
```
|
|
311
313
|
|
|
312
314
|
**Sign-in Priority Order:**
|
|
@@ -388,6 +390,7 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
388
390
|
Interactive poll voting component with real-time results, multiple choice support, and customizable templates. Perfect for engaging audiences with opinion polls, surveys, and voting campaigns.
|
|
389
391
|
|
|
390
392
|
**Key Features:**
|
|
393
|
+
|
|
391
394
|
- Single and multiple choice voting
|
|
392
395
|
- Real-time vote results and percentages
|
|
393
396
|
- Three responsive templates (Standard, Split, Overlay)
|
|
@@ -451,7 +454,7 @@ import { SignInCTADetails } from "fansunited-frontend-core";
|
|
|
451
454
|
|
|
452
455
|
// Custom sign-in component
|
|
453
456
|
const signInCTA: SignInCTADetails = {
|
|
454
|
-
component: <CustomSignInButton
|
|
457
|
+
component: <CustomSignInButton />,
|
|
455
458
|
};
|
|
456
459
|
|
|
457
460
|
// Basic sign-in with onClick handler
|
|
@@ -460,21 +463,17 @@ const signInCTA: SignInCTADetails = {
|
|
|
460
463
|
onClick: () => {
|
|
461
464
|
// Handle sign-in logic
|
|
462
465
|
console.log("Sign in clicked");
|
|
463
|
-
}
|
|
466
|
+
},
|
|
464
467
|
};
|
|
465
468
|
|
|
466
469
|
// Sign-in with URL navigation
|
|
467
470
|
const signInCTA: SignInCTADetails = {
|
|
468
471
|
defaultLabel: "Login to participate",
|
|
469
472
|
url: "https://your-auth-provider.com/login",
|
|
470
|
-
target: "_blank"
|
|
473
|
+
target: "_blank",
|
|
471
474
|
};
|
|
472
475
|
|
|
473
|
-
<PollVote
|
|
474
|
-
{...otherProps}
|
|
475
|
-
userIsLoggedIn={false}
|
|
476
|
-
signInCTA={signInCTA}
|
|
477
|
-
/>
|
|
476
|
+
<PollVote {...otherProps} userIsLoggedIn={false} signInCTA={signInCTA} />;
|
|
478
477
|
```
|
|
479
478
|
|
|
480
479
|
**Sign-in Priority Order:**
|
|
@@ -553,6 +552,7 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
553
552
|
Lead collection component for capturing user information with customizable forms, branding, and success actions. Perfect for newsletter signups, contact forms, and user registration flows.
|
|
554
553
|
|
|
555
554
|
**Key Features:**
|
|
555
|
+
|
|
556
556
|
- Customizable form fields (name, email, phone, country, gender, custom fields)
|
|
557
557
|
- Consent management and privacy policy integration
|
|
558
558
|
- Custom branding and theming support
|
|
@@ -563,30 +563,30 @@ Lead collection component for capturing user information with customizable forms
|
|
|
563
563
|
|
|
564
564
|
#### Required Props
|
|
565
565
|
|
|
566
|
-
| Prop | Type | Description
|
|
567
|
-
| ---------- | -------------------- |
|
|
566
|
+
| Prop | Type | Description |
|
|
567
|
+
| ---------- | -------------------- | ------------------------------- |
|
|
568
568
|
| `entityId` | `string` | Lead collection form identifier |
|
|
569
|
-
| `sdk` | `FansUnitedSDKModel` | SDK instance
|
|
570
|
-
| `template` | `WidgetTemplate` | Layout template
|
|
571
|
-
| `language` | `LanguageType` | Display language
|
|
569
|
+
| `sdk` | `FansUnitedSDKModel` | SDK instance |
|
|
570
|
+
| `template` | `WidgetTemplate` | Layout template |
|
|
571
|
+
| `language` | `LanguageType` | Display language |
|
|
572
572
|
|
|
573
573
|
#### Optional Props
|
|
574
574
|
|
|
575
|
-
| Prop | Type
|
|
576
|
-
| ---------------------------- |
|
|
577
|
-
| `themeOptions` | `CustomThemeOptions`
|
|
578
|
-
| `fields` | `LeadField[]`
|
|
579
|
-
| `labels` | `LeadLabels`
|
|
580
|
-
| `imagePosition` | `"left" \| "right"`
|
|
581
|
-
| `defaultImagePlaceholderUrl` | `string`
|
|
582
|
-
| `phoneCountryCode` | `string`
|
|
583
|
-
| `onSuccessCTA` | `OnSuccessCTADetails`
|
|
584
|
-
| `customFields` | `LeadCustomField[]`
|
|
585
|
-
| `consents` | `LeadConsent[]`
|
|
586
|
-
| `content` | `ContentInfo`
|
|
587
|
-
| `campaign` | `CampaignInfo`
|
|
588
|
-
| `branding` | `BrandingInfo`
|
|
589
|
-
| `images` | `ImagesModel`
|
|
575
|
+
| Prop | Type | Description |
|
|
576
|
+
| ---------------------------- | --------------------- | ----------------------------------------- |
|
|
577
|
+
| `themeOptions` | `CustomThemeOptions` | Theme configuration |
|
|
578
|
+
| `fields` | `LeadField[]` | Form fields to display |
|
|
579
|
+
| `labels` | `LeadLabels` | Custom labels for form elements |
|
|
580
|
+
| `imagePosition` | `"left" \| "right"` | Image position (STANDARD template only) |
|
|
581
|
+
| `defaultImagePlaceholderUrl` | `string` | URL for default image placeholder |
|
|
582
|
+
| `phoneCountryCode` | `string` | Default country code for phone fields |
|
|
583
|
+
| `onSuccessCTA` | `OnSuccessCTADetails` | Success page call to action configuration |
|
|
584
|
+
| `customFields` | `LeadCustomField[]` | Additional custom form fields |
|
|
585
|
+
| `consents` | `LeadConsent[]` | Consent checkboxes for privacy compliance |
|
|
586
|
+
| `content` | `ContentInfo` | Content metadata |
|
|
587
|
+
| `campaign` | `CampaignInfo` | Campaign information |
|
|
588
|
+
| `branding` | `BrandingInfo` | Branding configuration |
|
|
589
|
+
| `images` | `ImagesModel` | Image assets |
|
|
590
590
|
|
|
591
591
|
#### Templates
|
|
592
592
|
|
|
@@ -619,7 +619,11 @@ const overlayProps: CollectLeadProps = {
|
|
|
619
619
|
Configure which fields to display and their behavior:
|
|
620
620
|
|
|
621
621
|
```tsx
|
|
622
|
-
import {
|
|
622
|
+
import {
|
|
623
|
+
LeadField,
|
|
624
|
+
LeadCustomField,
|
|
625
|
+
LeadConsent,
|
|
626
|
+
} from "fansunited-frontend-core";
|
|
623
627
|
|
|
624
628
|
// Standard form fields
|
|
625
629
|
const fields: LeadField[] = [
|
|
@@ -627,7 +631,7 @@ const fields: LeadField[] = [
|
|
|
627
631
|
"email",
|
|
628
632
|
"phoneNumber",
|
|
629
633
|
"country",
|
|
630
|
-
"gender"
|
|
634
|
+
"gender",
|
|
631
635
|
];
|
|
632
636
|
|
|
633
637
|
// Custom fields for additional data collection
|
|
@@ -637,27 +641,27 @@ const customFields: LeadCustomField[] = [
|
|
|
637
641
|
label: "Company Name",
|
|
638
642
|
type: "input",
|
|
639
643
|
required: true,
|
|
640
|
-
placeholder: "Enter your company name"
|
|
644
|
+
placeholder: "Enter your company name",
|
|
641
645
|
},
|
|
642
646
|
{
|
|
643
647
|
key: "message",
|
|
644
648
|
label: "Message",
|
|
645
649
|
type: "textarea",
|
|
646
650
|
required: false,
|
|
647
|
-
placeholder: "Tell us about your needs..."
|
|
648
|
-
}
|
|
651
|
+
placeholder: "Tell us about your needs...",
|
|
652
|
+
},
|
|
649
653
|
];
|
|
650
654
|
|
|
651
655
|
// Consent checkboxes for privacy compliance
|
|
652
656
|
const consents: LeadConsent[] = [
|
|
653
657
|
{
|
|
654
658
|
id: "marketing",
|
|
655
|
-
label: "I agree to receive marketing communications"
|
|
659
|
+
label: "I agree to receive marketing communications",
|
|
656
660
|
},
|
|
657
661
|
{
|
|
658
662
|
id: "newsletter",
|
|
659
|
-
label: "Subscribe to our newsletter"
|
|
660
|
-
}
|
|
663
|
+
label: "Subscribe to our newsletter",
|
|
664
|
+
},
|
|
661
665
|
];
|
|
662
666
|
|
|
663
667
|
<CollectLead
|
|
@@ -665,7 +669,7 @@ const consents: LeadConsent[] = [
|
|
|
665
669
|
fields={fields}
|
|
666
670
|
customFields={customFields}
|
|
667
671
|
consents={consents}
|
|
668
|
-
|
|
672
|
+
/>;
|
|
669
673
|
```
|
|
670
674
|
|
|
671
675
|
#### Custom Labels
|
|
@@ -691,13 +695,14 @@ const labels: LeadLabels = {
|
|
|
691
695
|
formPhoneNumberPlaceholder: "Enter your phone number",
|
|
692
696
|
submitButtonLabel: "Subscribe Now",
|
|
693
697
|
successTitle: "Welcome Aboard!",
|
|
694
|
-
successDescription:
|
|
698
|
+
successDescription:
|
|
699
|
+
"Thank you for joining our community. Check your email for next steps.",
|
|
695
700
|
privacyPolicyUrlLabel: "Privacy Policy",
|
|
696
701
|
termsAndConditionsUrlLabel: "Terms & Conditions",
|
|
697
|
-
presentedByLabel: "Powered by"
|
|
702
|
+
presentedByLabel: "Powered by",
|
|
698
703
|
};
|
|
699
704
|
|
|
700
|
-
<CollectLead {...otherProps} labels={labels}
|
|
705
|
+
<CollectLead {...otherProps} labels={labels} />;
|
|
701
706
|
```
|
|
702
707
|
|
|
703
708
|
#### Success Actions
|
|
@@ -713,22 +718,22 @@ const onSuccessCTA: OnSuccessCTADetails = {
|
|
|
713
718
|
onClick: () => {
|
|
714
719
|
// Handle post-submission logic
|
|
715
720
|
window.location.href = "/dashboard";
|
|
716
|
-
}
|
|
721
|
+
},
|
|
717
722
|
};
|
|
718
723
|
|
|
719
724
|
// Success action with URL navigation
|
|
720
725
|
const onSuccessCTA: OnSuccessCTADetails = {
|
|
721
726
|
defaultLabel: "Visit Our Website",
|
|
722
727
|
url: "https://your-website.com",
|
|
723
|
-
target: "_blank"
|
|
728
|
+
target: "_blank",
|
|
724
729
|
};
|
|
725
730
|
|
|
726
731
|
// Custom success component
|
|
727
732
|
const onSuccessCTA: OnSuccessCTADetails = {
|
|
728
|
-
component: <CustomSuccessButton
|
|
733
|
+
component: <CustomSuccessButton />,
|
|
729
734
|
};
|
|
730
735
|
|
|
731
|
-
<CollectLead {...otherProps} onSuccessCTA={onSuccessCTA}
|
|
736
|
+
<CollectLead {...otherProps} onSuccessCTA={onSuccessCTA} />;
|
|
732
737
|
```
|
|
733
738
|
|
|
734
739
|
#### Examples
|
|
@@ -745,7 +750,7 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
745
750
|
template={WidgetTemplate.STANDARD}
|
|
746
751
|
language="en"
|
|
747
752
|
fields={["fullName", "email"]}
|
|
748
|
-
|
|
753
|
+
/>;
|
|
749
754
|
```
|
|
750
755
|
|
|
751
756
|
##### Advanced Lead Form
|
|
@@ -763,28 +768,28 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
763
768
|
key: "company",
|
|
764
769
|
label: "Company",
|
|
765
770
|
type: "input",
|
|
766
|
-
required: true
|
|
767
|
-
}
|
|
771
|
+
required: true,
|
|
772
|
+
},
|
|
768
773
|
]}
|
|
769
774
|
consents={[
|
|
770
775
|
{
|
|
771
776
|
id: "marketing",
|
|
772
|
-
label: "I agree to receive marketing emails"
|
|
773
|
-
}
|
|
777
|
+
label: "I agree to receive marketing emails",
|
|
778
|
+
},
|
|
774
779
|
]}
|
|
775
780
|
labels={{
|
|
776
781
|
title: "Get Early Access",
|
|
777
782
|
submitButtonLabel: "Join Waitlist",
|
|
778
783
|
successTitle: "You're In!",
|
|
779
|
-
successDescription: "We'll notify you when we launch."
|
|
784
|
+
successDescription: "We'll notify you when we launch.",
|
|
780
785
|
}}
|
|
781
786
|
onSuccessCTA={{
|
|
782
787
|
defaultLabel: "Learn More",
|
|
783
788
|
url: "https://example.com/learn-more",
|
|
784
|
-
target: "_blank"
|
|
789
|
+
target: "_blank",
|
|
785
790
|
}}
|
|
786
791
|
themeOptions={{
|
|
787
|
-
mode: "dark"
|
|
792
|
+
mode: "dark",
|
|
788
793
|
}}
|
|
789
794
|
/>
|
|
790
795
|
```
|
|
@@ -794,6 +799,7 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
794
799
|
Interactive personality quiz component that matches users with personas based on their answers. Features comprehensive result displays with persona matching, detailed explanations, and customizable templates.
|
|
795
800
|
|
|
796
801
|
**Key Features:**
|
|
802
|
+
|
|
797
803
|
- Personality matching algorithm with percentage scores
|
|
798
804
|
- Multiple persona results with detailed descriptions
|
|
799
805
|
- Tabbed result interface with top match highlighting
|
|
@@ -806,12 +812,12 @@ Interactive personality quiz component that matches users with personas based on
|
|
|
806
812
|
|
|
807
813
|
#### Required Props
|
|
808
814
|
|
|
809
|
-
| Prop | Type | Description
|
|
810
|
-
| ---------- | -------------------- |
|
|
811
|
-
| `entityId` | `string` | Personality Quiz identifier
|
|
812
|
-
| `sdk` | `FansUnitedSDKModel` | SDK instance
|
|
813
|
-
| `template` | `WidgetTemplate` | Layout template
|
|
814
|
-
| `language` | `LanguageType` | Display language
|
|
815
|
+
| Prop | Type | Description |
|
|
816
|
+
| ---------- | -------------------- | --------------------------- |
|
|
817
|
+
| `entityId` | `string` | Personality Quiz identifier |
|
|
818
|
+
| `sdk` | `FansUnitedSDKModel` | SDK instance |
|
|
819
|
+
| `template` | `WidgetTemplate` | Layout template |
|
|
820
|
+
| `language` | `LanguageType` | Display language |
|
|
815
821
|
|
|
816
822
|
#### Optional Props
|
|
817
823
|
|
|
@@ -829,7 +835,10 @@ Interactive personality quiz component that matches users with personas based on
|
|
|
829
835
|
#### Templates
|
|
830
836
|
|
|
831
837
|
```tsx
|
|
832
|
-
import {
|
|
838
|
+
import {
|
|
839
|
+
WidgetTemplate,
|
|
840
|
+
PersonalityQuizPlayProps,
|
|
841
|
+
} from "fansunited-frontend-core";
|
|
833
842
|
|
|
834
843
|
// Standard template with optional image positioning
|
|
835
844
|
const standardProps: PersonalityQuizPlayProps = {
|
|
@@ -887,7 +896,7 @@ import { SignInCTADetails } from "fansunited-frontend-core";
|
|
|
887
896
|
|
|
888
897
|
// Custom sign-in component
|
|
889
898
|
const signInCTA: SignInCTADetails = {
|
|
890
|
-
component: <CustomSignInButton
|
|
899
|
+
component: <CustomSignInButton />,
|
|
891
900
|
};
|
|
892
901
|
|
|
893
902
|
// Basic sign-in with onClick handler
|
|
@@ -896,21 +905,21 @@ const signInCTA: SignInCTADetails = {
|
|
|
896
905
|
onClick: () => {
|
|
897
906
|
// Handle sign-in logic
|
|
898
907
|
console.log("Sign in clicked");
|
|
899
|
-
}
|
|
908
|
+
},
|
|
900
909
|
};
|
|
901
910
|
|
|
902
911
|
// Sign-in with URL navigation
|
|
903
912
|
const signInCTA: SignInCTADetails = {
|
|
904
913
|
defaultLabel: "Login to discover your personality",
|
|
905
914
|
url: "https://your-auth-provider.com/login",
|
|
906
|
-
target: "_blank"
|
|
915
|
+
target: "_blank",
|
|
907
916
|
};
|
|
908
917
|
|
|
909
918
|
<PersonalityQuizPlay
|
|
910
919
|
{...otherProps}
|
|
911
920
|
userIsLoggedIn={false}
|
|
912
921
|
signInCTA={signInCTA}
|
|
913
|
-
|
|
922
|
+
/>;
|
|
914
923
|
```
|
|
915
924
|
|
|
916
925
|
**Sign-in Priority Order:**
|
|
@@ -939,7 +948,7 @@ const leads: LeadsOptions = {
|
|
|
939
948
|
phoneCountryCode: "1", // Default country code for phone fields
|
|
940
949
|
};
|
|
941
950
|
|
|
942
|
-
<PersonalityQuizPlay {...otherProps} leads={leads}
|
|
951
|
+
<PersonalityQuizPlay {...otherProps} leads={leads} />;
|
|
943
952
|
```
|
|
944
953
|
|
|
945
954
|
#### Answer Explanations
|
|
@@ -947,13 +956,11 @@ const leads: LeadsOptions = {
|
|
|
947
956
|
Enable detailed explanations for quiz answers and persona matching:
|
|
948
957
|
|
|
949
958
|
```tsx
|
|
950
|
-
<PersonalityQuizPlay
|
|
951
|
-
{...otherProps}
|
|
952
|
-
showAnswerExplanations={true}
|
|
953
|
-
/>
|
|
959
|
+
<PersonalityQuizPlay {...otherProps} showAnswerExplanations={true} />
|
|
954
960
|
```
|
|
955
961
|
|
|
956
962
|
When enabled, users will see:
|
|
963
|
+
|
|
957
964
|
- Explanations for each answer choice
|
|
958
965
|
- Detailed persona descriptions
|
|
959
966
|
- Matching algorithm insights
|
|
@@ -972,7 +979,7 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
972
979
|
sdk={sdkInstance}
|
|
973
980
|
template={WidgetTemplate.STANDARD}
|
|
974
981
|
language="en"
|
|
975
|
-
|
|
982
|
+
/>;
|
|
976
983
|
```
|
|
977
984
|
|
|
978
985
|
##### Advanced Personality Quiz
|
|
@@ -1002,9 +1009,9 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
1002
1009
|
colorSchemes: {
|
|
1003
1010
|
dark: {
|
|
1004
1011
|
textPrimary: "#ffffff",
|
|
1005
|
-
surface: "#1a1a1a"
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1012
|
+
surface: "#1a1a1a",
|
|
1013
|
+
},
|
|
1014
|
+
},
|
|
1008
1015
|
}}
|
|
1009
1016
|
/>
|
|
1010
1017
|
```
|
|
@@ -1025,9 +1032,303 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
1025
1032
|
customFontFamily: {
|
|
1026
1033
|
light: {
|
|
1027
1034
|
primary: "Inter, sans-serif",
|
|
1028
|
-
secondary: "Roboto, sans-serif"
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1035
|
+
secondary: "Roboto, sans-serif",
|
|
1036
|
+
},
|
|
1037
|
+
},
|
|
1038
|
+
}}
|
|
1039
|
+
/>
|
|
1040
|
+
```
|
|
1041
|
+
|
|
1042
|
+
### MatchQuizPlay
|
|
1043
|
+
|
|
1044
|
+
Interactive match prediction quiz component that allows users to make predictions on various football match markets. Features multiple fixture types, real-time countdown timers, points system, and comprehensive result tracking with leaderboards.
|
|
1045
|
+
|
|
1046
|
+
**Key Features:**
|
|
1047
|
+
|
|
1048
|
+
- Multiple prediction markets (1X2, Correct Score, Player Markets, Over/Under Goals, Corners, etc.)
|
|
1049
|
+
- Real-time countdown timer for prediction cutoff
|
|
1050
|
+
- Points system with loyalty integration
|
|
1051
|
+
- Leaderboard and ranking system
|
|
1052
|
+
- Prediction summary and editing capabilities
|
|
1053
|
+
- Three responsive templates (Standard, Split, Overlay)
|
|
1054
|
+
- Lead collection integration
|
|
1055
|
+
- Authentication support
|
|
1056
|
+
- Custom theming and branding
|
|
1057
|
+
- Detailed prediction results and explanations
|
|
1058
|
+
|
|
1059
|
+
#### Required Props
|
|
1060
|
+
|
|
1061
|
+
| Prop | Type | Description |
|
|
1062
|
+
| ---------- | -------------------- | --------------------- |
|
|
1063
|
+
| `entityId` | `string` | Match Quiz identifier |
|
|
1064
|
+
| `sdk` | `FansUnitedSDKModel` | SDK instance |
|
|
1065
|
+
| `template` | `WidgetTemplate` | Layout template |
|
|
1066
|
+
| `language` | `LanguageType` | Display language |
|
|
1067
|
+
|
|
1068
|
+
#### Optional Props
|
|
1069
|
+
|
|
1070
|
+
| Prop | Type | Description |
|
|
1071
|
+
| ---------------------------- | -------------------- | ------------------------------------------------- |
|
|
1072
|
+
| `themeOptions` | `CustomThemeOptions` | Theme configuration |
|
|
1073
|
+
| `leads` | `LeadsOptions` | Lead collection settings |
|
|
1074
|
+
| `imagePosition` | `"left" \| "right"` | Image position (STANDARD template only) |
|
|
1075
|
+
| `defaultImagePlaceholderUrl` | `string` | URL for default image placeholder |
|
|
1076
|
+
| `userIsLoggedIn` | `boolean` | Determine if the user is logged in |
|
|
1077
|
+
| `signInCTA` | `SignInCTADetails` | Sign in call to action button configuration |
|
|
1078
|
+
| `showCountdown` | `boolean` | Show countdown timer when Match Quiz is open |
|
|
1079
|
+
| `showTeamLabels` | `boolean` | Show team name labels in fixture components |
|
|
1080
|
+
| `showPoints` | `boolean` | Show points display for each fixture |
|
|
1081
|
+
| `showPredictionDetails` | `boolean` | Show detailed prediction results after completion |
|
|
1082
|
+
|
|
1083
|
+
#### Templates
|
|
1084
|
+
|
|
1085
|
+
```tsx
|
|
1086
|
+
import { WidgetTemplate, MatchQuizPlayProps } from "fansunited-frontend-core";
|
|
1087
|
+
|
|
1088
|
+
// Standard template with optional image positioning
|
|
1089
|
+
const standardProps: MatchQuizPlayProps = {
|
|
1090
|
+
template: WidgetTemplate.STANDARD,
|
|
1091
|
+
imagePosition: "left", // or 'right'
|
|
1092
|
+
// ... other props
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
// Split template - side-by-side layout
|
|
1096
|
+
const splitProps: MatchQuizPlayProps = {
|
|
1097
|
+
template: WidgetTemplate.SPLIT,
|
|
1098
|
+
// imagePosition not available for non-standard templates
|
|
1099
|
+
// ... other props
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
// Overlay template - full-screen immersive experience
|
|
1103
|
+
const overlayProps: MatchQuizPlayProps = {
|
|
1104
|
+
template: WidgetTemplate.OVERLAY,
|
|
1105
|
+
// ... other props
|
|
1106
|
+
};
|
|
1107
|
+
```
|
|
1108
|
+
|
|
1109
|
+
#### Supported Markets
|
|
1110
|
+
|
|
1111
|
+
MatchQuizPlay supports a wide variety of football prediction markets:
|
|
1112
|
+
|
|
1113
|
+
**Match Result Markets:**
|
|
1114
|
+
|
|
1115
|
+
- `FT_1X2` - Full Time 1X2 (Home Win, Draw, Away Win)
|
|
1116
|
+
- `HT_1X2` - Half Time 1X2
|
|
1117
|
+
|
|
1118
|
+
**Score Markets:**
|
|
1119
|
+
|
|
1120
|
+
- `CORRECT_SCORE` - Exact final score prediction
|
|
1121
|
+
- `CORRECT_SCORE_HT` - Exact half-time score prediction
|
|
1122
|
+
- `CORRECT_SCORE_ADVANCED` - Advanced correct score with alternative points
|
|
1123
|
+
|
|
1124
|
+
**Player Markets:**
|
|
1125
|
+
|
|
1126
|
+
- `PLAYER_SCORE_FIRST_GOAL` - First goalscorer prediction
|
|
1127
|
+
- `PLAYER_SCORE` - Anytime goalscorer
|
|
1128
|
+
- `PLAYER_YELLOW_CARD` - Player to receive yellow card
|
|
1129
|
+
- `PLAYER_RED_CARD` - Player to receive red card
|
|
1130
|
+
- `PLAYER_SCORE_HATTRICK` - Player to score hat-trick
|
|
1131
|
+
- `PLAYER_SCORE_TWICE` - Player to score twice
|
|
1132
|
+
|
|
1133
|
+
**Over/Under Markets:**
|
|
1134
|
+
|
|
1135
|
+
- `OVER_GOALS_0_5` to `OVER_GOALS_6_5` - Total goals over/under
|
|
1136
|
+
- `OVER_CORNERS_6_5` to `OVER_CORNERS_13_5` - Total corners over/under
|
|
1137
|
+
|
|
1138
|
+
**Special Markets:**
|
|
1139
|
+
|
|
1140
|
+
- `CORNERS_MATCH` - Total corners in the match
|
|
1141
|
+
- `PENALTY_MATCH` - Penalty awarded in the match
|
|
1142
|
+
- `RED_CARD_MATCH` - Red card shown in the match
|
|
1143
|
+
|
|
1144
|
+
#### Game Status States
|
|
1145
|
+
|
|
1146
|
+
Match quizzes have 5 distinct status states:
|
|
1147
|
+
|
|
1148
|
+
- **`PENDING`** - Not yet open for predictions
|
|
1149
|
+
- **`OPEN`** - Ready for predictions (default state)
|
|
1150
|
+
- **`LIVE`** - Match has started, no new predictions accepted
|
|
1151
|
+
- **`CLOSED`** - Match finished, backend resolving predictions
|
|
1152
|
+
- **`SETTLED`** - Predictions resolved, leaderboard available
|
|
1153
|
+
|
|
1154
|
+
#### Countdown Timer
|
|
1155
|
+
|
|
1156
|
+
Enable countdown timer to show time remaining for predictions:
|
|
1157
|
+
|
|
1158
|
+
```tsx
|
|
1159
|
+
<MatchQuizPlay {...otherProps} showCountdown={true} />
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
The countdown timer:
|
|
1163
|
+
|
|
1164
|
+
- Displays when Match Quiz status is `OPEN`
|
|
1165
|
+
- Shows days, hours, minutes, and seconds remaining
|
|
1166
|
+
- Uses `predictionsCutoffTime` from the Match Quiz data
|
|
1167
|
+
- Automatically hides when cutoff time is reached
|
|
1168
|
+
|
|
1169
|
+
#### Points System
|
|
1170
|
+
|
|
1171
|
+
Enable points display to show potential rewards:
|
|
1172
|
+
|
|
1173
|
+
```tsx
|
|
1174
|
+
<MatchQuizPlay {...otherProps} showPoints={true} />
|
|
1175
|
+
```
|
|
1176
|
+
|
|
1177
|
+
Points system features:
|
|
1178
|
+
|
|
1179
|
+
- Shows potential points for each fixture
|
|
1180
|
+
- Displays earned vs possible points
|
|
1181
|
+
- Integrates with loyalty system configuration
|
|
1182
|
+
- Supports alternative point structures for advanced markets
|
|
1183
|
+
- Mobile-friendly tooltip display
|
|
1184
|
+
|
|
1185
|
+
#### Prediction Details
|
|
1186
|
+
|
|
1187
|
+
Show detailed prediction results and explanations:
|
|
1188
|
+
|
|
1189
|
+
```tsx
|
|
1190
|
+
<MatchQuizPlay {...otherProps} showPredictionDetails={true} />
|
|
1191
|
+
```
|
|
1192
|
+
|
|
1193
|
+
When enabled, users see:
|
|
1194
|
+
|
|
1195
|
+
- Tabulated interface
|
|
1196
|
+
- Correct vs incorrect prediction highlighting
|
|
1197
|
+
- Detailed market results
|
|
1198
|
+
- Points breakdown per fixture
|
|
1199
|
+
|
|
1200
|
+
#### Sign in Configuration
|
|
1201
|
+
|
|
1202
|
+
Control user authentication and quiz access using the `userIsLoggedIn` and `signInCTA` props.
|
|
1203
|
+
|
|
1204
|
+
```tsx
|
|
1205
|
+
import { SignInCTADetails } from "fansunited-frontend-core";
|
|
1206
|
+
|
|
1207
|
+
// Custom sign-in component
|
|
1208
|
+
const signInCTA: SignInCTADetails = {
|
|
1209
|
+
component: <CustomSignInButton />,
|
|
1210
|
+
};
|
|
1211
|
+
|
|
1212
|
+
// Basic sign-in with onClick handler
|
|
1213
|
+
const signInCTA: SignInCTADetails = {
|
|
1214
|
+
defaultLabel: "Sign in to predict",
|
|
1215
|
+
onClick: () => {
|
|
1216
|
+
// Handle sign-in logic
|
|
1217
|
+
console.log("Sign in clicked");
|
|
1218
|
+
},
|
|
1219
|
+
};
|
|
1220
|
+
|
|
1221
|
+
// Sign-in with URL navigation
|
|
1222
|
+
const signInCTA: SignInCTADetails = {
|
|
1223
|
+
defaultLabel: "Login to join the competition",
|
|
1224
|
+
url: "https://your-auth-provider.com/login",
|
|
1225
|
+
target: "_blank",
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
<MatchQuizPlay {...otherProps} userIsLoggedIn={false} signInCTA={signInCTA} />;
|
|
1229
|
+
```
|
|
1230
|
+
|
|
1231
|
+
**Sign-in Priority Order:**
|
|
1232
|
+
|
|
1233
|
+
1. **Custom Component** - If `signInCTA.component` is provided, it will be rendered
|
|
1234
|
+
2. **Click Handler** - If `signInCTA.onClick` is provided, a button with the handler will be rendered
|
|
1235
|
+
3. **URL Navigation** - If `signInCTA.url` is provided, a button will be rendered and clicking will navigate to the URL
|
|
1236
|
+
4. **Disabled** - If no `signInCTA` is provided, a disabled button will be shown
|
|
1237
|
+
|
|
1238
|
+
**Behavior:**
|
|
1239
|
+
|
|
1240
|
+
- When `userIsLoggedIn` is `false` and the quiz requires authentication (`authRequirement: "REGISTERED"`), the sign-in screen will be displayed instead of the quiz
|
|
1241
|
+
|
|
1242
|
+
#### Lead Collection
|
|
1243
|
+
|
|
1244
|
+
Capture user information before or after making predictions:
|
|
1245
|
+
|
|
1246
|
+
```tsx
|
|
1247
|
+
import { LeadsOptions } from "fansunited-frontend-core";
|
|
1248
|
+
|
|
1249
|
+
const leads: LeadsOptions = {
|
|
1250
|
+
position: "before", // "before" | "after"
|
|
1251
|
+
fields: ["fullName", "email"], // Available: "fullName" | "firstName" | "lastName" | "email" | "gender" | "country" | "phoneCountryCode" | "phoneNumber"
|
|
1252
|
+
campaignId: "match-quiz-2024",
|
|
1253
|
+
campaignName: "Football Prediction Campaign",
|
|
1254
|
+
phoneCountryCode: "44", // Default country code for phone fields
|
|
1255
|
+
};
|
|
1256
|
+
|
|
1257
|
+
<MatchQuizPlay {...otherProps} leads={leads} />;
|
|
1258
|
+
```
|
|
1259
|
+
|
|
1260
|
+
#### Examples
|
|
1261
|
+
|
|
1262
|
+
##### Basic Match Quiz
|
|
1263
|
+
|
|
1264
|
+
```tsx
|
|
1265
|
+
import { MatchQuizPlay } from "fansunited-frontend-components";
|
|
1266
|
+
import { WidgetTemplate } from "fansunited-frontend-core";
|
|
1267
|
+
|
|
1268
|
+
<MatchQuizPlay
|
|
1269
|
+
entityId="match-quiz-123"
|
|
1270
|
+
sdk={sdkInstance}
|
|
1271
|
+
template={WidgetTemplate.STANDARD}
|
|
1272
|
+
language="en"
|
|
1273
|
+
/>;
|
|
1274
|
+
```
|
|
1275
|
+
|
|
1276
|
+
##### Advanced Match Quiz
|
|
1277
|
+
|
|
1278
|
+
```tsx
|
|
1279
|
+
<MatchQuizPlay
|
|
1280
|
+
entityId="match-quiz-123"
|
|
1281
|
+
sdk={sdkInstance}
|
|
1282
|
+
template={WidgetTemplate.OVERLAY}
|
|
1283
|
+
language="en"
|
|
1284
|
+
showCountdown={true}
|
|
1285
|
+
showTeamLabels={true}
|
|
1286
|
+
showPoints={true}
|
|
1287
|
+
showPredictionDetails={true}
|
|
1288
|
+
userIsLoggedIn={false}
|
|
1289
|
+
signInCTA={{
|
|
1290
|
+
defaultLabel: "Sign in to compete",
|
|
1291
|
+
onClick: () => handleSignIn(),
|
|
1292
|
+
}}
|
|
1293
|
+
leads={{
|
|
1294
|
+
position: "after",
|
|
1295
|
+
fields: ["fullName", "email"],
|
|
1296
|
+
campaignId: "match-prediction-campaign",
|
|
1297
|
+
campaignName: "Football Predictions 2024",
|
|
1298
|
+
phoneCountryCode: "44",
|
|
1299
|
+
}}
|
|
1300
|
+
themeOptions={{
|
|
1301
|
+
mode: "dark",
|
|
1302
|
+
colorSchemes: {
|
|
1303
|
+
dark: {
|
|
1304
|
+
textPrimary: "#ffffff",
|
|
1305
|
+
surface: "#1a1a1a",
|
|
1306
|
+
},
|
|
1307
|
+
},
|
|
1308
|
+
}}
|
|
1309
|
+
/>
|
|
1310
|
+
```
|
|
1311
|
+
|
|
1312
|
+
##### Customized Layout
|
|
1313
|
+
|
|
1314
|
+
```tsx
|
|
1315
|
+
<MatchQuizPlay
|
|
1316
|
+
entityId="match-quiz-123"
|
|
1317
|
+
sdk={sdkInstance}
|
|
1318
|
+
template={WidgetTemplate.STANDARD}
|
|
1319
|
+
imagePosition="right"
|
|
1320
|
+
language="en"
|
|
1321
|
+
showCountdown={true}
|
|
1322
|
+
showTeamLabels={false}
|
|
1323
|
+
showPoints={true}
|
|
1324
|
+
themeOptions={{
|
|
1325
|
+
mode: "light",
|
|
1326
|
+
customFontFamily: {
|
|
1327
|
+
light: {
|
|
1328
|
+
primary: "Inter, sans-serif",
|
|
1329
|
+
secondary: "Roboto, sans-serif",
|
|
1330
|
+
},
|
|
1331
|
+
},
|
|
1031
1332
|
}}
|
|
1032
1333
|
/>
|
|
1033
1334
|
```
|
|
@@ -1040,6 +1341,7 @@ This package exports the following components:
|
|
|
1040
1341
|
- **`PollVote`** - Interactive polling with real-time results
|
|
1041
1342
|
- **`CollectLead`** - Lead collection forms with custom fields
|
|
1042
1343
|
- **`PersonalityQuizPlay`** - Personality assessment with persona matching
|
|
1344
|
+
- **`MatchQuizPlay`** - Football match prediction quiz with multiple markets
|
|
1043
1345
|
|
|
1044
1346
|
## Related Packages
|
|
1045
1347
|
|