fansunited-frontend-core 0.0.20 → 0.0.22
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/functions/functions.d.ts +3 -3
- package/functions/functions.js +4 -0
- package/functions/functions.js.map +1 -0
- package/functions/helpers.d.ts +3 -4
- package/functions/helpers.js +74 -0
- package/functions/helpers.js.map +1 -0
- package/index.d.ts +9 -9
- package/index.es.js +4230 -4061
- package/index.js +10 -0
- package/index.js.map +1 -0
- package/interfaces/interfaces.d.ts +5 -6
- package/interfaces/interfaces.js +2 -0
- package/interfaces/interfaces.js.map +1 -0
- package/locales/bg.json.d.ts +16 -0
- package/locales/de.json.d.ts +16 -0
- package/locales/en.json +129 -0
- package/locales/en.json.d.ts +2 -25
- package/locales/es.json.d.ts +16 -0
- package/locales/fr-be.json.d.ts +16 -0
- package/locales/fr.json.d.ts +16 -0
- package/locales/it.json.d.ts +16 -0
- package/locales/pl.json.d.ts +16 -0
- package/locales/pt-br.json.d.ts +16 -0
- package/locales/pt.json.d.ts +16 -0
- package/locales/ro.json.d.ts +16 -0
- package/locales/sk.json.d.ts +16 -0
- package/locales/sr.json.d.ts +16 -0
- package/package.json +1 -1
package/functions/functions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useSpacingScale, getSpacing, isMobile, useFontFamily, useCornerRadius, useColors, useBorderSize, useInternalTheme, useImageBackgroundGradient, } from
|
|
2
|
-
export { stripHtmlTags, hexToRgb, isAndroid, getDefaultCountryByCode, getDefaultCountryByLanguage, extractBrandingProperties, sanitizeBackgroundUrl, mapContentTypeToConsentEntityType, } from
|
|
3
|
-
export { initializeI18n } from
|
|
1
|
+
export { useSpacingScale, getSpacing, isMobile, useFontFamily, useCornerRadius, useColors, useBorderSize, useInternalTheme, useImageBackgroundGradient, } from "./theme";
|
|
2
|
+
export { stripHtmlTags, hexToRgb, isAndroid, getDefaultCountryByCode, getDefaultCountryByLanguage, extractBrandingProperties, sanitizeBackgroundUrl, mapContentTypeToConsentEntityType, } from "./helpers";
|
|
3
|
+
export { initializeI18n } from "./i18n";
|
|
4
4
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -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, mapContentTypeToConsentEntityType, } 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,EACrB,iCAAiC,GAClC,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC"}
|
package/functions/helpers.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { BrandingColorsModel, BrandingModel, ConsentEntityType } from
|
|
2
|
-
|
|
1
|
+
import { BrandingColorsModel, BrandingModel, ConsentEntityType } from "fansunited-sdk-esm";
|
|
3
2
|
export declare const stripHtmlTags: (html: string | null) => string;
|
|
4
3
|
export declare const hexToRgb: (hex: string) => string;
|
|
5
4
|
export declare const isAndroid: () => boolean;
|
|
6
|
-
export declare const getDefaultCountryByCode: (phoneCountryCode: string | null) => import(
|
|
7
|
-
export declare const getDefaultCountryByLanguage: (language: string | null) => import(
|
|
5
|
+
export declare const getDefaultCountryByCode: (phoneCountryCode: string | null) => import("..").CountryType | null;
|
|
6
|
+
export declare const getDefaultCountryByLanguage: (language: string | null) => import("..").CountryType | null;
|
|
8
7
|
export declare const extractBrandingProperties: (branding: BrandingModel | null) => {
|
|
9
8
|
brandingImage: string | null;
|
|
10
9
|
brandingColors: BrandingColorsModel | null;
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
export const mapContentTypeToConsentEntityType = (type) => {
|
|
51
|
+
if (!type)
|
|
52
|
+
return undefined;
|
|
53
|
+
// Backward compatibility: map generic "quiz" to "classic_quiz"
|
|
54
|
+
if (type === "quiz")
|
|
55
|
+
return "classic_quiz";
|
|
56
|
+
// If already valid, pass through
|
|
57
|
+
const valid = [
|
|
58
|
+
"template",
|
|
59
|
+
"classic_quiz",
|
|
60
|
+
"personality_quiz",
|
|
61
|
+
"either_or",
|
|
62
|
+
"match_quiz",
|
|
63
|
+
"top_x",
|
|
64
|
+
"bracket",
|
|
65
|
+
"standing",
|
|
66
|
+
"poll",
|
|
67
|
+
];
|
|
68
|
+
if (valid.includes(type))
|
|
69
|
+
return type;
|
|
70
|
+
// Fallback: don't set entityType if unknown
|
|
71
|
+
console.warn(`[CollectLead] Unknown content type "${type}" for consents; omitting entityType.`);
|
|
72
|
+
return undefined;
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/functions/helpers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC1E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C,MAAM,iCAAiC,GAAG,CAC/C,IAA+B,EACA,EAAE;IACjC,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,+DAA+D;IAC/D,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,cAAc,CAAC;IAC3C,iCAAiC;IACjC,MAAM,KAAK,GAAwB;QACjC,UAAU;QACV,cAAc;QACd,kBAAkB;QAClB,WAAW;QACX,YAAY;QACZ,OAAO;QACP,SAAS;QACT,UAAU;QACV,MAAM;KACP,CAAC;IACF,IAAK,KAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAyB,CAAC;IACzE,4CAA4C;IAC5C,OAAO,CAAC,IAAI,CACV,uCAAuC,IAAI,sCAAsC,CAClF,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export { default as CollectLeadForm } from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
1
|
+
export * from "./constants/constants";
|
|
2
|
+
export * from "./functions/functions";
|
|
3
|
+
export * from "./interfaces/interfaces";
|
|
4
|
+
export * from "./types/types";
|
|
5
|
+
export * from "./enums/enums";
|
|
6
|
+
export * from "./components/Spinner";
|
|
7
|
+
export { default as CollectLeadForm } from "./components/Leads/CollectLeadForm";
|
|
8
|
+
export * from "./hooks/hooks";
|
|
9
|
+
export * from "./providers/providers";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|