fansunited-frontend-core 0.0.45 → 0.0.47
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/helpers.d.ts +6 -5
- package/hooks/hooks.d.ts +8 -7
- package/hooks/hooks.d.ts.map +1 -1
- package/hooks/hooks.js +8 -0
- package/hooks/hooks.js.map +1 -0
- package/hooks/useEmbedCode.d.ts +2 -0
- package/hooks/useEmbedCode.d.ts.map +1 -0
- package/hooks/useEmbedCode.js +44 -0
- package/hooks/useEmbedCode.js.map +1 -0
- package/index.es.js +1554 -1289
- package/interfaces/interfaces.d.ts +4 -0
- package/interfaces/interfaces.d.ts.map +1 -1
- package/locales/bg.json +19 -2
- package/locales/bg.json.d.ts +19 -2
- package/locales/de.json +19 -2
- package/locales/de.json.d.ts +19 -2
- package/locales/el.json +19 -2
- package/locales/el.json.d.ts +19 -2
- package/locales/en.json +19 -2
- package/locales/en.json.d.ts +19 -2
- package/locales/es.json +19 -2
- package/locales/es.json.d.ts +19 -2
- package/locales/fr-be.json +19 -2
- package/locales/fr-be.json.d.ts +19 -2
- package/locales/fr.json +19 -2
- package/locales/fr.json.d.ts +19 -2
- package/locales/it.json +19 -2
- package/locales/it.json.d.ts +19 -2
- package/locales/pl.json +19 -2
- package/locales/pl.json.d.ts +19 -2
- package/locales/pt-br.json +19 -2
- package/locales/pt-br.json.d.ts +19 -2
- package/locales/pt.json +19 -2
- package/locales/pt.json.d.ts +19 -2
- package/locales/ro.json +19 -2
- package/locales/ro.json.d.ts +19 -2
- package/locales/sk.json +19 -2
- package/locales/sk.json.d.ts +19 -2
- package/locales/sr.json +19 -2
- package/locales/sr.json.d.ts +19 -2
- package/package.json +1 -1
- package/components/Notification.js +0 -36
- package/components/Notification.js.map +0 -1
- package/functions/functions.js +0 -4
- package/functions/functions.js.map +0 -1
- package/functions/helpers.js +0 -152
- package/functions/helpers.js.map +0 -1
- package/types/types.js +0 -2
- package/types/types.js.map +0 -1
package/functions/functions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useSpacingScale, getSpacing, isMobile, isExtraSmall, isTablet, isDesktop, useFontFamily, useCornerRadius, useColors, useBorderSize, useInternalTheme, useImageBackgroundGradient, isLarge, useCurrentThemeMode, } from
|
|
2
|
-
export { stripHtmlTags, hexToRgb, isAndroid, getDefaultCountryByCode, getDefaultCountryByLanguage, extractBrandingModelProperties, extractBrandingProperties, sanitizeBackgroundUrl, mapContentTypeToConsentEntityType, getBrandingClickUrl, getRelatedInfoPageId, isWithPrize, extractSdkError, extractSdkErrorMessage, } from
|
|
3
|
-
export { initializeI18n } from
|
|
1
|
+
export { useSpacingScale, getSpacing, isMobile, isExtraSmall, isTablet, isDesktop, useFontFamily, useCornerRadius, useColors, useBorderSize, useInternalTheme, useImageBackgroundGradient, isLarge, useCurrentThemeMode, } from './theme';
|
|
2
|
+
export { stripHtmlTags, hexToRgb, isAndroid, getDefaultCountryByCode, getDefaultCountryByLanguage, extractBrandingModelProperties, extractBrandingProperties, sanitizeBackgroundUrl, mapContentTypeToConsentEntityType, getBrandingClickUrl, getRelatedInfoPageId, isWithPrize, extractSdkError, extractSdkErrorMessage, } from './helpers';
|
|
3
|
+
export { initializeI18n } from './i18n';
|
|
4
4
|
//# sourceMappingURL=functions.d.ts.map
|
package/functions/helpers.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { BrandingColorsModel, BrandingModel, ConsentEntityType, FansUnitedSDKModel, RelatedEntityRelationship } from
|
|
2
|
-
import { Branding, BrandingColors, SdkError } from
|
|
1
|
+
import { BrandingColorsModel, BrandingModel, ConsentEntityType, FansUnitedSDKModel, RelatedEntityRelationship } from 'fansunited-sdk-esm';
|
|
2
|
+
import { Branding, BrandingColors, SdkError } from '../interfaces/interfaces';
|
|
3
|
+
|
|
3
4
|
export declare const stripHtmlTags: (html: string | null) => string;
|
|
4
5
|
export declare const hexToRgb: (hex: string) => string;
|
|
5
6
|
export declare const isAndroid: () => boolean;
|
|
6
|
-
export declare const getDefaultCountryByCode: (phoneCountryCode: string | null) => import(
|
|
7
|
-
export declare const getDefaultCountryByLanguage: (language: string | null) => import(
|
|
8
|
-
export declare const getCountryByCode: (code: string) => import(
|
|
7
|
+
export declare const getDefaultCountryByCode: (phoneCountryCode: string | null) => import('..').CountryType | null;
|
|
8
|
+
export declare const getDefaultCountryByLanguage: (language: string | null) => import('..').CountryType | null;
|
|
9
|
+
export declare const getCountryByCode: (code: string) => import('..').CountryType | null;
|
|
9
10
|
export declare const extractBrandingModelProperties: (branding: BrandingModel | null) => {
|
|
10
11
|
brandingImage: string | null;
|
|
11
12
|
brandingColors: BrandingColorsModel | null;
|
package/hooks/hooks.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
1
|
+
export { useEmbedCode } from "./useEmbedCode";
|
|
2
|
+
export { useImageUrl } from "./useImageUrl";
|
|
3
|
+
export { useThemeMode } from "./useThemeMode";
|
|
4
|
+
export { useConstantContext } from "./useConstantContext";
|
|
5
|
+
export { useImageVariant } from "./useImageVariant";
|
|
6
|
+
export { useLeadForm } from "./useLeadForm";
|
|
7
|
+
export { useInfoPage } from "./useInfoPage";
|
|
8
|
+
export type { UseLeadFormParams, UseLeadFormReturn, LeadFormData } from "./useLeadForm";
|
|
8
9
|
//# sourceMappingURL=hooks.d.ts.map
|
package/hooks/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
|
package/hooks/hooks.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { useEmbedCode } from "./useEmbedCode";
|
|
2
|
+
export { useImageUrl } from "./useImageUrl";
|
|
3
|
+
export { useThemeMode } from "./useThemeMode";
|
|
4
|
+
export { useConstantContext } from "./useConstantContext";
|
|
5
|
+
export { useImageVariant } from "./useImageVariant";
|
|
6
|
+
export { useLeadForm } from "./useLeadForm";
|
|
7
|
+
export { useInfoPage } from "./useInfoPage";
|
|
8
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/hooks/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEmbedCode.d.ts","sourceRoot":"","sources":["../../src/hooks/useEmbedCode.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,cAAe,MAAM,aAAa,GAAG,qDA8C7D,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
export const useEmbedCode = (embedCode, extraDep) => {
|
|
3
|
+
const embedContainerRef = useRef(null);
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
if (!embedCode || !embedContainerRef.current)
|
|
6
|
+
return;
|
|
7
|
+
// Clear before setting new content
|
|
8
|
+
embedContainerRef.current.innerHTML = "";
|
|
9
|
+
embedContainerRef.current.innerHTML = embedCode;
|
|
10
|
+
const iframes = embedContainerRef.current.getElementsByTagName("iframe");
|
|
11
|
+
for (let i = 0; i < iframes.length; i++) {
|
|
12
|
+
const iframe = iframes[i];
|
|
13
|
+
// Override hardcoded dimensions so the iframe fills its AspectRatio container
|
|
14
|
+
iframe.setAttribute("width", "100%");
|
|
15
|
+
iframe.setAttribute("height", "100%");
|
|
16
|
+
iframe.style.width = "100%";
|
|
17
|
+
iframe.style.height = "100%";
|
|
18
|
+
// Force iframe to reload
|
|
19
|
+
const src = iframe.src;
|
|
20
|
+
iframe.src = "";
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
iframe.src = src;
|
|
23
|
+
}, 100);
|
|
24
|
+
}
|
|
25
|
+
const scripts = embedContainerRef.current.getElementsByTagName("script");
|
|
26
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
27
|
+
const script = scripts[i];
|
|
28
|
+
const newScript = document.createElement("script");
|
|
29
|
+
Array.from(script.attributes).forEach((attr) => {
|
|
30
|
+
newScript.setAttribute(attr.name, attr.value);
|
|
31
|
+
});
|
|
32
|
+
newScript.innerHTML = script.innerHTML;
|
|
33
|
+
script.parentNode?.replaceChild(newScript, script);
|
|
34
|
+
}
|
|
35
|
+
return () => {
|
|
36
|
+
if (embedContainerRef.current) {
|
|
37
|
+
embedContainerRef.current.innerHTML = "";
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
|
+
}, [embedCode, extraDep]);
|
|
42
|
+
return embedContainerRef;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=useEmbedCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEmbedCode.js","sourceRoot":"","sources":["../../src/hooks/useEmbedCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAE,QAAc,EAAE,EAAE;IAChE,MAAM,iBAAiB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,SAAS,IAAI,CAAC,iBAAiB,CAAC,OAAO;YAAE,OAAO;QAErD,mCAAmC;QACnC,iBAAiB,CAAC,OAAO,CAAC,SAAS,GAAG,EAAE,CAAC;QACzC,iBAAiB,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;QAEhD,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QACzE,KAAK,IAAI,C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