fansunited-frontend-components 0.0.23-RC2 → 0.0.23
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 +85 -2
- package/components.js +35367 -30735
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -152,7 +152,7 @@ const themeOptions: CustomThemeOptions = {
|
|
|
152
152
|
softBg: "#042F04",
|
|
153
153
|
},
|
|
154
154
|
danger: {
|
|
155
|
-
softBg: "#
|
|
155
|
+
softBg: "#430A0A",
|
|
156
156
|
plainColor: "#F44336",
|
|
157
157
|
outlinedBorder: "#F44336",
|
|
158
158
|
},
|
|
@@ -267,10 +267,11 @@ import { LeadsOptions } from "fansunited-frontend-core";
|
|
|
267
267
|
|
|
268
268
|
const leads: LeadsOptions = {
|
|
269
269
|
position: "before", // "before" | "after"
|
|
270
|
-
fields: ["fullName"], //
|
|
270
|
+
fields: ["fullName"], // Available: "fullName" | "firstName" | "lastName" | "email" | "gender" | "country" | "phoneCountryCode" | "phoneNumber"
|
|
271
271
|
campaignId: "test-quizzes",
|
|
272
272
|
campaignName: "Test Quizzes",
|
|
273
273
|
phoneCountryCode: "359", // When not provided will set the phone country code from component language prop. So for example if the language is "bg" and phoneCountryCode is not provided, it will fallback to "359"
|
|
274
|
+
syncWithProfile: true, // Optional: sync form data to user profile after successful submission
|
|
274
275
|
};
|
|
275
276
|
|
|
276
277
|
<ClassicQuizPlay {...otherProps} leads={leads} />;
|
|
@@ -381,6 +382,7 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
381
382
|
}}
|
|
382
383
|
leads={{
|
|
383
384
|
phoneCountryCode: "44",
|
|
385
|
+
syncWithProfile: true,
|
|
384
386
|
}}
|
|
385
387
|
/>
|
|
386
388
|
```
|
|
@@ -500,11 +502,44 @@ const leads: LeadsOptions = {
|
|
|
500
502
|
campaignId: "poll-campaign-2024",
|
|
501
503
|
campaignName: "User Opinion Poll",
|
|
502
504
|
phoneCountryCode: "44", // Default country code for phone fields
|
|
505
|
+
syncWithProfile: true, // Optional: sync form data to user profile after successful submission
|
|
503
506
|
};
|
|
504
507
|
|
|
505
508
|
<PollVote {...otherProps} leads={leads} />;
|
|
506
509
|
```
|
|
507
510
|
|
|
511
|
+
#### Profile Sync
|
|
512
|
+
|
|
513
|
+
When `syncWithProfile` is enabled in the leads configuration, form data will be automatically synced to the user's profile after successful submission:
|
|
514
|
+
|
|
515
|
+
```tsx
|
|
516
|
+
import { LeadsOptions } from "fansunited-frontend-core";
|
|
517
|
+
|
|
518
|
+
const leads: LeadsOptions = {
|
|
519
|
+
position: "after",
|
|
520
|
+
fields: ["firstName", "lastName", "email", "phoneNumber", "country"],
|
|
521
|
+
campaignId: "user-profile-sync",
|
|
522
|
+
campaignName: "Profile Sync Campaign",
|
|
523
|
+
syncWithProfile: true, // Enable profile synchronization
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
<PollVote {...otherProps} leads={leads} />
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
**How it works:**
|
|
530
|
+
|
|
531
|
+
- Only fields that are both **included in the form configuration** AND **have non-empty values** will be synced
|
|
532
|
+
- Supported fields: `fullName`, `firstName`, `lastName`, `email`, `phoneNumber`, `phoneCountryCode`, `country`, `gender`
|
|
533
|
+
- Uses the SDK profile namespace: `sdk.profile.getOwn().setName().setEmail()...update()`
|
|
534
|
+
- Profile sync failures are logged but don't break the lead collection flow
|
|
535
|
+
- Sync happens automatically after successful lead form submission
|
|
536
|
+
|
|
537
|
+
**Name Field Priority:**
|
|
538
|
+
- If `fullName` is configured and has a value, it takes priority for the profile name
|
|
539
|
+
- If both `firstName` and `lastName` are configured and have values, they are combined: `"firstName lastName"`
|
|
540
|
+
- If only `firstName` is configured and has a value, it becomes the profile name
|
|
541
|
+
- If only `lastName` is configured and has a value, it becomes the profile name
|
|
542
|
+
|
|
508
543
|
#### Examples
|
|
509
544
|
|
|
510
545
|
##### Basic Poll
|
|
@@ -540,6 +575,7 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
540
575
|
campaignId: "poll-campaign",
|
|
541
576
|
campaignName: "User Survey 2024",
|
|
542
577
|
phoneCountryCode: "44",
|
|
578
|
+
syncWithProfile: true,
|
|
543
579
|
}}
|
|
544
580
|
themeOptions={{
|
|
545
581
|
mode: "dark",
|
|
@@ -580,6 +616,7 @@ Lead collection component for capturing user information with customizable forms
|
|
|
580
616
|
| `imagePosition` | `"left" \| "right"` | Image position (STANDARD template only) |
|
|
581
617
|
| `defaultImagePlaceholderUrl` | `string` | URL for default image placeholder |
|
|
582
618
|
| `phoneCountryCode` | `string` | Default country code for phone fields |
|
|
619
|
+
| `syncWithProfile` | `boolean` | Sync form data to user profile after successful submission |
|
|
583
620
|
| `onSuccessCTA` | `OnSuccessCTADetails` | Success page call to action configuration |
|
|
584
621
|
| `customFields` | `LeadCustomField[]` | Additional custom form fields |
|
|
585
622
|
| `consents` | `LeadConsent[]` | Consent checkboxes for privacy compliance |
|
|
@@ -736,6 +773,47 @@ const onSuccessCTA: OnSuccessCTADetails = {
|
|
|
736
773
|
<CollectLead {...otherProps} onSuccessCTA={onSuccessCTA} />;
|
|
737
774
|
```
|
|
738
775
|
|
|
776
|
+
#### Profile Sync
|
|
777
|
+
|
|
778
|
+
Enable automatic profile synchronization to update user profiles with form data:
|
|
779
|
+
|
|
780
|
+
```tsx
|
|
781
|
+
<CollectLead
|
|
782
|
+
entityId="lead-form-123"
|
|
783
|
+
sdk={sdkInstance}
|
|
784
|
+
template={WidgetTemplate.STANDARD}
|
|
785
|
+
language="en"
|
|
786
|
+
fields={["firstName", "lastName", "email", "phoneNumber", "country", "gender"]}
|
|
787
|
+
syncWithProfile={true} // Enable profile synchronization
|
|
788
|
+
labels={{
|
|
789
|
+
title: "Update Your Profile",
|
|
790
|
+
submitButtonLabel: "Save & Update Profile",
|
|
791
|
+
}}
|
|
792
|
+
/>
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
**Profile Sync Features:**
|
|
796
|
+
|
|
797
|
+
- **Automatic Sync**: Form data is automatically synced to the user's profile after successful submission
|
|
798
|
+
- **Field Mapping**: Only configured fields with non-empty values are synced to the profile
|
|
799
|
+
- **Supported Fields**: `fullName`, `firstName`, `lastName`, `email`, `phoneNumber`, `phoneCountryCode`, `country`, `gender`
|
|
800
|
+
- **SDK Integration**: Uses the profile builder pattern: `sdk.profile.getOwn().setName().setEmail()...update()`
|
|
801
|
+
- **Error Handling**: Profile sync failures are logged but don't prevent lead collection
|
|
802
|
+
- **Optional**: Defaults to `false`, completely opt-in behavior
|
|
803
|
+
|
|
804
|
+
**Name Field Handling:**
|
|
805
|
+
- **Priority 1**: `fullName` (if configured and has value) → sets profile name directly
|
|
806
|
+
- **Priority 2**: `firstName` + `lastName` (if both configured and have values) → combined as `"firstName lastName"`
|
|
807
|
+
- **Priority 3**: `firstName` only (if configured and has value) → sets profile name
|
|
808
|
+
- **Priority 4**: `lastName` only (if configured and has value) → sets profile name
|
|
809
|
+
|
|
810
|
+
**Use Cases:**
|
|
811
|
+
|
|
812
|
+
- User registration forms that also update profiles
|
|
813
|
+
- Newsletter signups that capture additional profile information
|
|
814
|
+
- Contact forms that enhance user profiles with new data
|
|
815
|
+
- Profile update forms with lead tracking
|
|
816
|
+
|
|
739
817
|
#### Examples
|
|
740
818
|
|
|
741
819
|
##### Basic Lead Form
|
|
@@ -763,6 +841,7 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
763
841
|
language="en"
|
|
764
842
|
fields={["fullName", "email", "phoneNumber", "country"]}
|
|
765
843
|
phoneCountryCode="44"
|
|
844
|
+
syncWithProfile={true}
|
|
766
845
|
customFields={[
|
|
767
846
|
{
|
|
768
847
|
key: "company",
|
|
@@ -946,6 +1025,7 @@ const leads: LeadsOptions = {
|
|
|
946
1025
|
campaignId: "personality-quiz-2024",
|
|
947
1026
|
campaignName: "Personality Assessment Campaign",
|
|
948
1027
|
phoneCountryCode: "1", // Default country code for phone fields
|
|
1028
|
+
syncWithProfile: true, // Optional: sync form data to user profile after successful submission
|
|
949
1029
|
};
|
|
950
1030
|
|
|
951
1031
|
<PersonalityQuizPlay {...otherProps} leads={leads} />;
|
|
@@ -1003,6 +1083,7 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
1003
1083
|
campaignId: "personality-campaign",
|
|
1004
1084
|
campaignName: "Personality Assessment 2024",
|
|
1005
1085
|
phoneCountryCode: "44",
|
|
1086
|
+
syncWithProfile: true,
|
|
1006
1087
|
}}
|
|
1007
1088
|
themeOptions={{
|
|
1008
1089
|
mode: "dark",
|
|
@@ -1252,6 +1333,7 @@ const leads: LeadsOptions = {
|
|
|
1252
1333
|
campaignId: "match-quiz-2024",
|
|
1253
1334
|
campaignName: "Football Prediction Campaign",
|
|
1254
1335
|
phoneCountryCode: "44", // Default country code for phone fields
|
|
1336
|
+
syncWithProfile: true, // Optional: sync form data to user profile after successful submission
|
|
1255
1337
|
};
|
|
1256
1338
|
|
|
1257
1339
|
<MatchQuizPlay {...otherProps} leads={leads} />;
|
|
@@ -1296,6 +1378,7 @@ import { WidgetTemplate } from "fansunited-frontend-core";
|
|
|
1296
1378
|
campaignId: "match-prediction-campaign",
|
|
1297
1379
|
campaignName: "Football Predictions 2024",
|
|
1298
1380
|
phoneCountryCode: "44",
|
|
1381
|
+
syncWithProfile: true,
|
|
1299
1382
|
}}
|
|
1300
1383
|
themeOptions={{
|
|
1301
1384
|
mode: "dark",
|