fansunited-frontend-core 0.0.6 → 0.0.8

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 (42) hide show
  1. package/constants/constants.d.ts +3 -1
  2. package/constants/constants.d.ts.map +1 -1
  3. package/functions/functions.d.ts +3 -3
  4. package/functions/functions.d.ts.map +1 -1
  5. package/functions/functions.js +4 -0
  6. package/functions/functions.js.map +1 -0
  7. package/functions/helpers.d.ts +9 -0
  8. package/functions/helpers.d.ts.map +1 -1
  9. package/functions/helpers.js +50 -0
  10. package/functions/helpers.js.map +1 -0
  11. package/index.es.js +3111 -2470
  12. package/interfaces/interfaces.d.ts +9 -2
  13. package/interfaces/interfaces.d.ts.map +1 -1
  14. package/locales/bg.json +108 -0
  15. package/locales/bg.json.d.ts +13 -0
  16. package/locales/de.json +108 -0
  17. package/locales/de.json.d.ts +13 -0
  18. package/locales/en.json +108 -0
  19. package/locales/en.json.d.ts +13 -0
  20. package/locales/es.json +108 -0
  21. package/locales/es.json.d.ts +15 -1
  22. package/locales/fr-be.json +108 -0
  23. package/locales/fr-be.json.d.ts +13 -0
  24. package/locales/fr.json +108 -0
  25. package/locales/fr.json.d.ts +13 -0
  26. package/locales/it.json +108 -0
  27. package/locales/it.json.d.ts +13 -0
  28. package/locales/pl.json +108 -0
  29. package/locales/pl.json.d.ts +13 -0
  30. package/locales/pt-br.json +108 -0
  31. package/locales/pt-br.json.d.ts +13 -0
  32. package/locales/pt.json +108 -0
  33. package/locales/pt.json.d.ts +13 -0
  34. package/locales/ro.json +108 -0
  35. package/locales/ro.json.d.ts +13 -0
  36. package/locales/sk.json +108 -0
  37. package/locales/sk.json.d.ts +15 -1
  38. package/locales/sr.json +108 -0
  39. package/locales/sr.json.d.ts +13 -0
  40. package/package.json +1 -1
  41. package/types/types.d.ts +6 -0
  42. package/types/types.d.ts.map +1 -1
@@ -1,5 +1,7 @@
1
- import { StagesType } from '../types/types';
1
+ import { CountryType, StagesType } from '../types/types';
2
2
 
3
3
  export declare const validWidgetTypes: StagesType[];
4
4
  export declare const validWidgetTemplates: string[];
5
+ export declare const countries: CountryType[];
6
+ export declare const languageToCountryCode: Record<string, string>;
5
7
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,eAAO,MAAM,gBAAgB,EAAE,UAAU,EAUxC,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAAyC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEzD,eAAO,MAAM,gBAAgB,EAAE,UAAU,EAUxC,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAAyC,CAAC;AAE3E,eAAO,MAAM,SAAS,EAAE,WAAW,EAualC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAcxD,CAAC"}
@@ -1,4 +1,4 @@
1
- export { useSpacingScale, getSpacing, isMobile, useFontFamily, useCornerRadius, useColors, useBorderSize, useInternalTheme, useImageBackgroundGradient, } from './theme';
2
- export { stripHtmlTags, hexToRgb, isAndroid } from './helpers';
3
- export { initializeI18n } from './i18n';
1
+ export { useSpacingScale, getSpacing, isMobile, useFontFamily, useCornerRadius, useColors, useBorderSize, useInternalTheme, useImageBackgroundGradient, } from "./theme";
2
+ export { stripHtmlTags, hexToRgb, isAndroid, getDefaultCountryByCode, getDefaultCountryByLanguage, extractBrandingProperties, sanitizeBackgroundUrl, } from "./helpers";
3
+ export { initializeI18n } from "./i18n";
4
4
  //# sourceMappingURL=functions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/functions/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACV,QAAQ,EACR,aAAa,EACb,eAAe,EACf,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/functions/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACV,QAAQ,EACR,aAAa,EACb,eAAe,EACf,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,aAAa,EACb,QAAQ,EACR,SAAS,EACT,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { useSpacingScale, getSpacing, isMobile, useFontFamily, useCornerRadius, useColors, useBorderSize, useInternalTheme, useImageBackgroundGradient, } from "./theme";
2
+ export { stripHtmlTags, hexToRgb, isAndroid, getDefaultCountryByCode, getDefaultCountryByLanguage, extractBrandingProperties, sanitizeBackgroundUrl, } from "./helpers";
3
+ export { initializeI18n } from "./i18n";
4
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/functions/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACV,QAAQ,EACR,aAAa,EACb,eAAe,EACf,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,aAAa,EACb,QAAQ,EACR,SAAS,EACT,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC"}
@@ -1,4 +1,13 @@
1
+ import { BrandingColorsModel, BrandingModel } from "fansunited-sdk-esm";
1
2
  export declare const stripHtmlTags: (html: string) => string;
2
3
  export declare const hexToRgb: (hex: string) => string;
3
4
  export declare const isAndroid: () => boolean;
5
+ export declare const getDefaultCountryByCode: (phoneCountryCode: string | null) => import("..").CountryType | null;
6
+ export declare const getDefaultCountryByLanguage: (language: string | null) => import("..").CountryType | null;
7
+ export declare const extractBrandingProperties: (branding: BrandingModel) => {
8
+ brandingImage: string | null;
9
+ brandingColors: BrandingColorsModel | null;
10
+ brandingLogo: string | null;
11
+ };
12
+ export declare const sanitizeBackgroundUrl: (url: string) => string;
4
13
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/functions/helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,SAAU,MAAM,KAAG,MAK5C,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAS,MAAM,KAAG,MAUtC,CAAC;AAGF,eAAO,MAAM,SAAS,QAAO,OAE5B,CAAC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/functions/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxE,eAAO,MAAM,aAAa,SAAU,MAAM,KAAG,MAK5C,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAS,MAAM,KAAG,MAUtC,CAAC;AAGF,eAAO,MAAM,SAAS,QAAO,OAE5B,CAAC;AAEF,eAAO,MAAM,uBAAuB,qBAAsB,MAAM,GAAG,IAAI,oCAItE,CAAC;AAEF,eAAO,MAAM,2BAA2B,aAAc,MAAM,GAAG,IAAI,oCAIlE,CAAC;AAEF,eAAO,MAAM,yBAAyB,aAAc,aAAa;;;;CAehE,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAS,MAAM,WAMhD,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { countries, languageToCountryCode } from "../constants/constants";
2
+ import { isMobile } from "./theme";
3
+ export const stripHtmlTags = (html) => {
4
+ const tmp = document.createElement("div");
5
+ tmp.innerHTML = html;
6
+ return tmp.textContent || tmp.innerText || "";
7
+ };
8
+ export const hexToRgb = (hex) => {
9
+ // Remove the hash if present
10
+ hex = hex.replace(/^#/, "");
11
+ // Parse the hex values
12
+ const r = parseInt(hex.substring(0, 2), 16);
13
+ const g = parseInt(hex.substring(2, 4), 16);
14
+ const b = parseInt(hex.substring(4, 6), 16);
15
+ return `${r}, ${g}, ${b}`;
16
+ };
17
+ // Helper function to check if running on Android
18
+ export const isAndroid = () => {
19
+ return /Android/i.test(navigator.userAgent);
20
+ };
21
+ export const getDefaultCountryByCode = (phoneCountryCode) => {
22
+ const code = phoneCountryCode || "44";
23
+ return countries.find((country) => country.phone === code) || null;
24
+ };
25
+ export const getDefaultCountryByLanguage = (language) => {
26
+ const code = language ? languageToCountryCode[language] : "GB";
27
+ return countries.find((country) => country.code === code) || null;
28
+ };
29
+ export const extractBrandingProperties = (branding) => {
30
+ let brandingImage = branding?.images?.backgroundImage || null;
31
+ let brandingLogo = branding?.images?.mainLogo || null;
32
+ let brandingColors = null;
33
+ if (isMobile() && branding?.images) {
34
+ brandingImage = branding.images.mobileBackgroundImage;
35
+ brandingLogo = branding.images.mobileLogo;
36
+ }
37
+ if (branding?.colors) {
38
+ brandingColors = branding.colors;
39
+ }
40
+ return { brandingImage, brandingColors, brandingLogo };
41
+ };
42
+ export const sanitizeBackgroundUrl = (url) => {
43
+ try {
44
+ return `url("${encodeURI(url)}")`;
45
+ }
46
+ catch {
47
+ return "none";
48
+ }
49
+ };
50
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
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