fansunited-frontend-core 0.0.71 → 0.0.72

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 +63 -49
  2. package/index.es.js +1 -1
  3. package/package.json +4 -5
package/README.md CHANGED
@@ -12,6 +12,19 @@ npm install fansunited-frontend-core
12
12
  yarn add fansunited-frontend-core
13
13
  ```
14
14
 
15
+ ### Peer dependencies
16
+
17
+ ```json
18
+ {
19
+ "react": ">=16.8.0",
20
+ "react-dom": ">=16.8.0"
21
+ }
22
+ ```
23
+
24
+ Nothing else is needed at runtime. MUI Joy, Emotion and i18next are all bundled into
25
+ `index.es.js`, whose only bare imports are `react`, `react-dom` and `react/jsx-runtime` —
26
+ in particular **no `@mui/*` package has to be installed**.
27
+
15
28
  ## Features
16
29
 
17
30
  - Complete TypeScript definitions for all Fans United components
@@ -159,7 +172,7 @@ import {
159
172
  useColors,
160
173
  useBorderSize,
161
174
  useInternalTheme,
162
- useImageBackgroundGradient
175
+ useImageBackgroundGradient,
163
176
  } from "fansunited-frontend-core";
164
177
  ```
165
178
 
@@ -175,7 +188,7 @@ import {
175
188
  getDefaultCountryByLanguage,
176
189
  extractBrandingProperties,
177
190
  sanitizeBackgroundUrl,
178
- mapContentTypeToConsentEntityType
191
+ mapContentTypeToConsentEntityType,
179
192
  } from "fansunited-frontend-core";
180
193
  ```
181
194
 
@@ -187,7 +200,7 @@ import {
187
200
  useThemeMode,
188
201
  useConstantContext,
189
202
  useImageVariant,
190
- useLeadForm
203
+ useLeadForm,
191
204
  } from "fansunited-frontend-core";
192
205
 
193
206
  // Example: Lead form hook usage
@@ -197,7 +210,7 @@ const leadForm = useLeadForm({
197
210
  campaignId: "campaign-123",
198
211
  contentType: "quiz",
199
212
  contentId: "quiz-456",
200
- syncWithProfile: true // Optional: sync form data to user profile
213
+ syncWithProfile: true, // Optional: sync form data to user profile
201
214
  });
202
215
  ```
203
216
 
@@ -207,7 +220,7 @@ const leadForm = useLeadForm({
207
220
  import {
208
221
  ThemeProvider,
209
222
  ConstantsProvider,
210
- ConstantsContext
223
+ ConstantsContext,
211
224
  } from "fansunited-frontend-core";
212
225
 
213
226
  // Example: Theme provider setup
@@ -220,7 +233,7 @@ import {
220
233
  >
221
234
  <YourApp />
222
235
  </ConstantsProvider>
223
- </ThemeProvider>
236
+ </ThemeProvider>;
224
237
  ```
225
238
 
226
239
  ### Components
@@ -252,7 +265,7 @@ import {
252
265
  validWidgetTypes,
253
266
  validWidgetTemplates,
254
267
  countries,
255
- languageToCountryCode
268
+ languageToCountryCode,
256
269
  } from "fansunited-frontend-core";
257
270
 
258
271
  // Access predefined country list
@@ -316,8 +329,8 @@ unsubscribe();
316
329
  ```ts
317
330
  interface BetslipState {
318
331
  selections: BetslipSelectionInput[]; // current raw selections
319
- stake: number; // parsed numeric stake (0 when empty)
320
- totalOdds: number; // product of all selection decimal odds (0 when no selections)
332
+ stake: number; // parsed numeric stake (0 when empty)
333
+ totalOdds: number; // product of all selection decimal odds (0 when no selections)
321
334
  }
322
335
  ```
323
336
 
@@ -325,7 +338,7 @@ The typical integration pattern is:
325
338
 
326
339
  ```tsx
327
340
  // 1. Render the Betslip widget once at app root level
328
- <Betslip sdk={sdk} language="en" />
341
+ <Betslip sdk={sdk} language="en" />;
329
342
 
330
343
  // 2. From anywhere in your app — e.g. a match card — call betslipApi
331
344
  import { betslipApi } from "fansunited-frontend-components";
@@ -472,9 +485,9 @@ const customTheme: CustomThemeOptions = {
472
485
  light: {
473
486
  textPrimary: "#333333",
474
487
  textBody: "#555555",
475
- surface: "#ffffff"
476
- }
477
- }
488
+ surface: "#ffffff",
489
+ },
490
+ },
478
491
  };
479
492
 
480
493
  <ClassicQuizPlay
@@ -495,7 +508,7 @@ import {
495
508
  WidgetTemplate,
496
509
  LeadField,
497
510
  LeadCustomField,
498
- LeadConsent
511
+ LeadConsent,
499
512
  } from "fansunited-frontend-core";
500
513
 
501
514
  const leadFields: LeadField[] = ["fullName", "email", "phoneNumber"];
@@ -506,15 +519,15 @@ const customFields: LeadCustomField[] = [
506
519
  label: "Company Name",
507
520
  type: "input",
508
521
  required: true,
509
- placeholder: "Enter your company name"
510
- }
522
+ placeholder: "Enter your company name",
523
+ },
511
524
  ];
512
525
 
513
526
  const consents: LeadConsent[] = [
514
527
  {
515
528
  id: "marketing",
516
- label: "I agree to receive marketing communications"
517
- }
529
+ label: "I agree to receive marketing communications",
530
+ },
518
531
  ];
519
532
 
520
533
  <CollectLead
@@ -528,9 +541,9 @@ const consents: LeadConsent[] = [
528
541
  syncWithProfile={true} // Sync form data to user profile
529
542
  labels={{
530
543
  title: "Get Exclusive Updates",
531
- submitButtonLabel: "Subscribe Now"
544
+ submitButtonLabel: "Subscribe Now",
532
545
  }}
533
- />
546
+ />;
534
547
  ```
535
548
 
536
549
  ### Profile Consents
@@ -547,13 +560,13 @@ const items: ConsentDef[] = [
547
560
  // Tokens link to the entity's branding.urls.
548
561
  body: "I accept the {{privacyPolicyUrl}} and the {{termsAndConditionsUrl}}",
549
562
  required: true, // optional, defaults to false — blocks the gate's CTA
550
- position: "before" // ClassicQuizPlay only: "before" (start screen) | "after" (before submit)
563
+ position: "before", // ClassicQuizPlay only: "before" (start screen) | "after" (before submit)
551
564
  },
552
565
  {
553
566
  consentId: "marketing",
554
567
  body: "Send me news and offers by email",
555
- defaultChecked: true // optional, defaults to false
556
- }
568
+ defaultChecked: true, // optional, defaults to false
569
+ },
557
570
  ];
558
571
 
559
572
  // Predictor / TopX take the array directly
@@ -565,8 +578,8 @@ const consents: ConsentsConfig = {
565
578
  labels: {
566
579
  title: "Before we save your score",
567
580
  ctaLabel: "Continue",
568
- requiredError: "Please accept the required consents to continue."
569
- }
581
+ requiredError: "Please accept the required consents to continue.",
582
+ },
570
583
  };
571
584
 
572
585
  <ClassicQuizPlay {...otherProps} consents={consents} />;
@@ -578,14 +591,14 @@ const consents: ConsentsConfig = {
578
591
  import {
579
592
  ThemeProvider,
580
593
  CustomThemeOptions,
581
- FontConfig
594
+ FontConfig,
582
595
  } from "fansunited-frontend-core";
583
596
 
584
597
  const customFont: FontConfig = {
585
598
  family: "Inter",
586
599
  url: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap",
587
600
  weights: [400, 500, 600, 700],
588
- display: "swap"
601
+ display: "swap",
589
602
  };
590
603
 
591
604
  const themeOptions: CustomThemeOptions = {
@@ -593,18 +606,18 @@ const themeOptions: CustomThemeOptions = {
593
606
  customFontFamily: {
594
607
  light: {
595
608
  primary: customFont,
596
- secondary: "Arial, sans-serif"
609
+ secondary: "Arial, sans-serif",
597
610
  },
598
611
  dark: {
599
612
  primary: customFont,
600
- secondary: "Arial, sans-serif"
601
- }
613
+ secondary: "Arial, sans-serif",
614
+ },
602
615
  },
603
616
  spacingScale: {
604
617
  xs: "6px",
605
618
  sm: "12px",
606
619
  md: "18px",
607
- lg: "24px"
620
+ lg: "24px",
608
621
  },
609
622
  colorSchemes: {
610
623
  dark: {
@@ -613,16 +626,16 @@ const themeOptions: CustomThemeOptions = {
613
626
  palette: {
614
627
  primary: {
615
628
  plainColor: "#3b82f6",
616
- primaryContainer: "#1e40af"
617
- }
618
- }
619
- }
620
- }
629
+ primaryContainer: "#1e40af",
630
+ },
631
+ },
632
+ },
633
+ },
621
634
  };
622
635
 
623
636
  <ThemeProvider themeOptions={themeOptions}>
624
637
  <YourApp />
625
- </ThemeProvider>
638
+ </ThemeProvider>;
626
639
  ```
627
640
 
628
641
  ### Using Hooks
@@ -632,7 +645,7 @@ import {
632
645
  useLeadForm,
633
646
  useThemeMode,
634
647
  useColors,
635
- UseLeadFormParams
648
+ UseLeadFormParams,
636
649
  } from "fansunited-frontend-core";
637
650
 
638
651
  function MyComponent() {
@@ -646,17 +659,11 @@ function MyComponent() {
646
659
  fields: ["fullName", "email"],
647
660
  campaignId: "newsletter-2024",
648
661
  contentType: "quiz",
649
- contentId: "quiz-123"
662
+ contentId: "quiz-123",
650
663
  };
651
664
 
652
- const {
653
- formData,
654
- updateField,
655
- submitForm,
656
- isSubmitting,
657
- isSuccess,
658
- error
659
- } = useLeadForm(leadFormParams);
665
+ const { formData, updateField, submitForm, isSubmitting, isSuccess, error } =
666
+ useLeadForm(leadFormParams);
660
667
 
661
668
  return (
662
669
  <div style={{ backgroundColor: colors.surface }}>
@@ -676,14 +683,14 @@ import {
676
683
  countries,
677
684
  languageToCountryCode,
678
685
  getDefaultCountryByLanguage,
679
- getDefaultCountryByCode
686
+ getDefaultCountryByCode,
680
687
  } from "fansunited-frontend-core";
681
688
 
682
689
  // Get all available countries
683
690
  const allCountries = countries;
684
691
 
685
692
  // Get suggested countries only
686
- const suggestedCountries = countries.filter(country => country.suggested);
693
+ const suggestedCountries = countries.filter((country) => country.suggested);
687
694
 
688
695
  // Get default country by language
689
696
  const defaultCountry = getDefaultCountryByLanguage("fr"); // Returns France
@@ -704,6 +711,13 @@ The package supports three main widget templates:
704
711
 
705
712
  This package is built with TypeScript and provides comprehensive type definitions for all exports. The types ensure type safety when working with widget configurations, theme options, and component props.
706
713
 
714
+ The emitted declarations reference `@mui/joy` in three places: `CustomThemeOptions` and
715
+ `CustomColors` extend Joy's theme option types, and the theme factories return Joy's `Theme`.
716
+ `@mui/joy` still does not need to be installed — with `skipLibCheck: true` (the default in
717
+ Vite, Next.js and CRA templates) TypeScript ignores the unresolved import and those members
718
+ widen to `any`. Add `@mui/joy` as a dev-only dependency if you compile with
719
+ `skipLibCheck: false`, or if you want autocomplete on custom theme options.
720
+
707
721
  ## License
708
722
 
709
723
  © Fans United Media. All rights reserved.
package/index.es.js CHANGED
@@ -51506,7 +51506,7 @@ const II = typeof gr == "function" ? gr : gr.default, xm = (e, t) => t === "rtl"
51506
51506
  [t, d, n, i, r]
51507
51507
  );
51508
51508
  return { loading: c, pending: f, checked: d, setChecked: p, allRequiredChecked: m, submit: g };
51509
- }, aL = "0.0.71";
51509
+ }, aL = "0.0.72";
51510
51510
  export {
51511
51511
  DE as AdditionalCTA,
51512
51512
  jE as BidiIsolate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fansunited-frontend-core",
3
- "version": "0.0.71",
3
+ "version": "0.0.72",
4
4
  "description": "Core types, components, providers and constants for Fans United widgets",
5
5
  "main": "index.es.js",
6
6
  "types": "index.d.ts",
@@ -12,9 +12,8 @@
12
12
  "vite": "^5.0.0",
13
13
  "vite-plugin-dts": "^3.0.0"
14
14
  },
15
- "dependencies": {
16
- "i18next": "^25.2.1",
17
- "i18next-browser-languagedetector": "^8.1.0",
18
- "react-i18next": "^15.5.2"
15
+ "peerDependencies": {
16
+ "react": ">=16.8.0",
17
+ "react-dom": ">=16.8.0"
19
18
  }
20
19
  }