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.
Files changed (50) hide show
  1. package/functions/functions.d.ts +3 -3
  2. package/functions/helpers.d.ts +6 -5
  3. package/hooks/hooks.d.ts +8 -7
  4. package/hooks/hooks.d.ts.map +1 -1
  5. package/hooks/hooks.js +8 -0
  6. package/hooks/hooks.js.map +1 -0
  7. package/hooks/useEmbedCode.d.ts +2 -0
  8. package/hooks/useEmbedCode.d.ts.map +1 -0
  9. package/hooks/useEmbedCode.js +44 -0
  10. package/hooks/useEmbedCode.js.map +1 -0
  11. package/index.es.js +1554 -1289
  12. package/interfaces/interfaces.d.ts +4 -0
  13. package/interfaces/interfaces.d.ts.map +1 -1
  14. package/locales/bg.json +19 -2
  15. package/locales/bg.json.d.ts +19 -2
  16. package/locales/de.json +19 -2
  17. package/locales/de.json.d.ts +19 -2
  18. package/locales/el.json +19 -2
  19. package/locales/el.json.d.ts +19 -2
  20. package/locales/en.json +19 -2
  21. package/locales/en.json.d.ts +19 -2
  22. package/locales/es.json +19 -2
  23. package/locales/es.json.d.ts +19 -2
  24. package/locales/fr-be.json +19 -2
  25. package/locales/fr-be.json.d.ts +19 -2
  26. package/locales/fr.json +19 -2
  27. package/locales/fr.json.d.ts +19 -2
  28. package/locales/it.json +19 -2
  29. package/locales/it.json.d.ts +19 -2
  30. package/locales/pl.json +19 -2
  31. package/locales/pl.json.d.ts +19 -2
  32. package/locales/pt-br.json +19 -2
  33. package/locales/pt-br.json.d.ts +19 -2
  34. package/locales/pt.json +19 -2
  35. package/locales/pt.json.d.ts +19 -2
  36. package/locales/ro.json +19 -2
  37. package/locales/ro.json.d.ts +19 -2
  38. package/locales/sk.json +19 -2
  39. package/locales/sk.json.d.ts +19 -2
  40. package/locales/sr.json +19 -2
  41. package/locales/sr.json.d.ts +19 -2
  42. package/package.json +1 -1
  43. package/components/Notification.js +0 -36
  44. package/components/Notification.js.map +0 -1
  45. package/functions/functions.js +0 -4
  46. package/functions/functions.js.map +0 -1
  47. package/functions/helpers.js +0 -152
  48. package/functions/helpers.js.map +0 -1
  49. package/types/types.js +0 -2
  50. package/types/types.js.map +0 -1
@@ -1,4 +1,4 @@
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";
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
@@ -1,11 +1,12 @@
1
- import { BrandingColorsModel, BrandingModel, ConsentEntityType, FansUnitedSDKModel, RelatedEntityRelationship } from "fansunited-sdk-esm";
2
- import { Branding, BrandingColors, SdkError } from "../interfaces/interfaces";
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("..").CountryType | null;
7
- export declare const getDefaultCountryByLanguage: (language: string | null) => import("..").CountryType | null;
8
- export declare const getCountryByCode: (code: string) => import("..").CountryType | null;
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 { useImageUrl } from './useImageUrl';
2
- export { useThemeMode } from './useThemeMode';
3
- export { useConstantContext } from './useConstantContext';
4
- export { useImageVariant } from './useImageVariant';
5
- export { useLeadForm } from './useLeadForm';
6
- export { useInfoPage } from './useInfoPage';
7
- export type { UseLeadFormParams, UseLeadFormReturn, LeadFormData } from './useLeadForm';
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
@@ -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,2 @@
1
+ export declare const useEmbedCode: (embedCode: string, extraDep?: any) => import("react").RefObject<HTMLDivElement | null>;
2
+ //# sourceMappingURL=useEmbedCode.d.ts.map
@@ -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,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC1B,8EAA8E;YAC9E,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACrC,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;YAC5B,MAAM,CAAC,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