fansunited-frontend-components 0.0.4 → 0.0.6

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 (3) hide show
  1. package/README.md +56 -8
  2. package/components.js +7790 -6629
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -31,7 +31,7 @@ const App: React.FC = () => {
31
31
  entityId: "your-quiz-id",
32
32
  sdk,
33
33
  template: WidgetTemplate.STANDARD, // Also SPLIT and OVERLAY templates are available
34
- language: "en", // "bg" | "en" | "ro" | "pt" | "sr" | "fr" | "de" | "it" | "fr-be" | "fr" | "pl" | "pt" | "pt-br"
34
+ language: "en", // "bg" | "en" | "ro" | "pt" | "sr" | "fr" | "de" | "it" | "fr-be" | "fr" | "pl" | "pt" | "pt-br" | "sk
35
35
  };
36
36
 
37
37
  return (
@@ -62,13 +62,15 @@ Interactive quiz component with multiple templates and customization options.
62
62
 
63
63
  #### Optional Props
64
64
 
65
- | Prop | Type | Description |
66
- | ---------------------------- | -------------------- | --------------------------------------- |
67
- | `themeOptions` | `CustomThemeOptions` | Theme configuration |
68
- | `showAnswerExplanations` | `boolean` | Show explanations after quiz completion |
69
- | `leads` | `LeadsOptions` | Lead collection settings |
70
- | `imagePosition` | `"left" \| "right"` | Image position (STANDARD template only) |
71
- | `defaultImagePlaceholderUrl` | `string` | URL for default image placeholder |
65
+ | Prop | Type | Description |
66
+ | ---------------------------- | -------------------- | ------------------------------------------- |
67
+ | `themeOptions` | `CustomThemeOptions` | Theme configuration |
68
+ | `showAnswerExplanations` | `boolean` | Show explanations after quiz completion |
69
+ | `leads` | `LeadsOptions` | Lead collection settings |
70
+ | `imagePosition` | `"left" \| "right"` | Image position (STANDARD template only) |
71
+ | `defaultImagePlaceholderUrl` | `string` | URL for default image placeholder |
72
+ | `userIsLoggedIn` | `boolean` | Determine if the user is logged in |
73
+ | `signInCTA` | `SignInCTADetails` | Sign in call to action button configuration |
72
74
 
73
75
  #### Templates
74
76
 
@@ -272,6 +274,52 @@ const leads: LeadsOptions = {
272
274
  <ClassicQuizPlay {...otherProps} leads={leads} />;
273
275
  ```
274
276
 
277
+ #### Sign in Configuration
278
+
279
+ Control user authentication and sign-in behavior using the `userIsLoggedIn` and `signInCTA` props.
280
+
281
+ ```tsx
282
+ import { SignInCTADetails } from "fansunited-frontend-core";
283
+
284
+ // Basic sign-in with onClick handler
285
+ const signInCTA: SignInCTADetails = {
286
+ defaultLabel: "Sign In",
287
+ onClick: () => {
288
+ // Handle sign-in logic
289
+ console.log("Sign in clicked");
290
+ }
291
+ };
292
+
293
+ // Sign-in with URL navigation
294
+ const signInCTA: SignInCTADetails = {
295
+ defaultLabel: "Login",
296
+ url: "https://your-auth-provider.com/login",
297
+ target: "_blank" // or "_self"
298
+ };
299
+
300
+ // Custom sign-in component
301
+ const signInCTA: SignInCTADetails = {
302
+ component: <CustomSignInButton />
303
+ };
304
+
305
+ <ClassicQuizPlay
306
+ {...otherProps}
307
+ userIsLoggedIn={false}
308
+ signInCTA={signInCTA}
309
+ />
310
+ ```
311
+
312
+ **Sign-in Priority Order:**
313
+
314
+ 1. **Custom Component** - If `signInCTA.component` is provided, it will be rendered
315
+ 2. **Click Handler** - If `signInCTA.onClick` is provided, a button with the handler will be rendered
316
+ 3. **URL Navigation** - If `signInCTA.url` is provided, a button will be rendered and clicking will navigate to the URL
317
+ 4. **Disabled** - If no `signInCTA` is provided, a disabled button will be shown
318
+
319
+ **Behavior:**
320
+
321
+ - When `userIsLoggedIn` is `false` and the quiz requires authentication (`authRequirement: "REGISTERED"`), the sign-in screen will be displayed instead of the quiz
322
+
275
323
  #### TypeScript Support
276
324
 
277
325
  This package is built with TypeScript and provides full type definitions. Import types from `fansunited-frontend-core`: