fansunited-frontend-components 0.0.1-RC3 → 0.0.1-RC5
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/{dist/esm/components.js → classic-quiz-play.es.js} +1 -1
- package/classic-quiz-play.umd.js +174 -0
- package/index.d.ts +3 -0
- package/package.json +4 -26
- package/src/components/ClassicQuizNotFound.d.ts +4 -0
- package/src/components/ClassicQuizNotFound.d.ts.map +1 -0
- package/src/components/ClassicQuizNotFound.js +55 -0
- package/src/components/ClassicQuizPlay.d.ts +5 -0
- package/src/components/ClassicQuizPlay.d.ts.map +1 -0
- package/src/components/ClassicQuizPlay.js +321 -0
- package/src/components/Leads/CollectLead.d.ts +22 -0
- package/src/components/Leads/CollectLead.d.ts.map +1 -0
- package/src/components/Leads/CollectLead.js +20 -0
- package/src/components/Leads/LeadAgreementCheckbox.d.ts +10 -0
- package/src/components/Leads/LeadAgreementCheckbox.d.ts.map +1 -0
- package/src/components/Leads/LeadAgreementCheckbox.js +45 -0
- package/src/components/Leads/LeadForm.d.ts +20 -0
- package/src/components/Leads/LeadForm.d.ts.map +1 -0
- package/src/components/Leads/LeadForm.js +289 -0
- package/src/components/Shared/AlertMessage.d.ts +10 -0
- package/src/components/Shared/AlertMessage.d.ts.map +1 -0
- package/src/components/Shared/AlertMessage.js +37 -0
- package/src/components/Shared/Answers/Answers.d.ts +14 -0
- package/src/components/Shared/Answers/Answers.d.ts.map +1 -0
- package/src/components/Shared/Answers/Answers.js +31 -0
- package/src/components/Shared/Answers/Option.d.ts +13 -0
- package/src/components/Shared/Answers/Option.d.ts.map +1 -0
- package/src/components/Shared/Answers/Option.js +118 -0
- package/src/components/Shared/Button.d.ts +12 -0
- package/src/components/Shared/Button.d.ts.map +1 -0
- package/src/components/Shared/Button.js +43 -0
- package/src/components/Shared/MainCard.d.ts +10 -0
- package/src/components/Shared/MainCard.d.ts.map +1 -0
- package/src/components/Shared/MainCard.js +24 -0
- package/src/components/Shared/Pagination.d.ts +10 -0
- package/src/components/Shared/Pagination.d.ts.map +1 -0
- package/src/components/Shared/Pagination.js +118 -0
- package/src/components/Shared/PresentedBy.d.ts +8 -0
- package/src/components/Shared/PresentedBy.d.ts.map +1 -0
- package/src/components/Shared/PresentedBy.js +51 -0
- package/src/components/Shared/ScoreStateWrapper.d.ts +13 -0
- package/src/components/Shared/ScoreStateWrapper.d.ts.map +1 -0
- package/src/components/Shared/ScoreStateWrapper.js +254 -0
- package/src/components/Shared/Stepper.d.ts +11 -0
- package/src/components/Shared/Stepper.d.ts.map +1 -0
- package/src/components/Shared/Stepper.js +75 -0
- package/src/components/Shared/Stopwatch.d.ts +12 -0
- package/src/components/Shared/Stopwatch.d.ts.map +1 -0
- package/src/components/Shared/Stopwatch.js +103 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.d.ts +8 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.d.ts.map +1 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.js +68 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.d.ts +118 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.d.ts.map +1 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.js +103 -0
- package/src/components/Variants/Overlay/OverlayVariant.d.ts +5 -0
- package/src/components/Variants/Overlay/OverlayVariant.d.ts.map +1 -0
- package/src/components/Variants/Overlay/OverlayVariant.js +100 -0
- package/src/components/Variants/Overlay/OverlayVariant.styles.d.ts +286 -0
- package/src/components/Variants/Overlay/OverlayVariant.styles.d.ts.map +1 -0
- package/src/components/Variants/Overlay/OverlayVariant.styles.js +266 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.d.ts +16 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.d.ts.map +1 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.js +90 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.d.ts +364 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.d.ts.map +1 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.js +374 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.d.ts +8 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.d.ts.map +1 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.js +44 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.styles.d.ts +126 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.styles.d.ts.map +1 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.styles.js +95 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.d.ts +16 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.d.ts.map +1 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.js +84 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.d.ts +403 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.d.ts.map +1 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.js +400 -0
- package/src/components/Variants/Split/SplitVariant.d.ts +5 -0
- package/src/components/Variants/Split/SplitVariant.d.ts.map +1 -0
- package/src/components/Variants/Split/SplitVariant.js +79 -0
- package/src/components/Variants/Split/SplitVariant.styles.d.ts +252 -0
- package/src/components/Variants/Split/SplitVariant.styles.d.ts.map +1 -0
- package/src/components/Variants/Split/SplitVariant.styles.js +216 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.d.ts +9 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.d.ts.map +1 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.js +43 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.d.ts +231 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.d.ts.map +1 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.js +201 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.d.ts +17 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.d.ts.map +1 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.js +78 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.d.ts +350 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.d.ts.map +1 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.js +349 -0
- package/src/components/Variants/Standard/StandardVariant.d.ts +10 -0
- package/src/components/Variants/Standard/StandardVariant.d.ts.map +1 -0
- package/src/components/Variants/Standard/StandardVariant.js +82 -0
- package/src/components/Variants/Standard/StandardVariant.styles.d.ts +414 -0
- package/src/components/Variants/Standard/StandardVariant.styles.d.ts.map +1 -0
- package/src/components/Variants/Standard/StandardVariant.styles.js +373 -0
- package/src/constants/constants.d.ts +7 -0
- package/src/constants/constants.d.ts.map +1 -0
- package/src/constants/constants.js +446 -0
- package/src/hooks/useClassicQuizById.d.ts +3 -0
- package/src/hooks/useClassicQuizById.d.ts.map +1 -0
- package/src/hooks/useClassicQuizById.js +20 -0
- package/src/hooks/useEmbedCodeContainer.d.ts +2 -0
- package/src/hooks/useEmbedCodeContainer.d.ts.map +1 -0
- package/src/hooks/useEmbedCodeContainer.js +38 -0
- package/src/hooks/useMyParticipation.d.ts +3 -0
- package/src/hooks/useMyParticipation.d.ts.map +1 -0
- package/src/hooks/useMyParticipation.js +22 -0
- package/src/hooks/useScoreStateHelpers.d.ts +18 -0
- package/src/hooks/useScoreStateHelpers.d.ts.map +1 -0
- package/src/hooks/useScoreStateHelpers.js +156 -0
- package/src/index.d.ts +3 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +2 -0
- package/src/main.d.ts +5 -0
- package/src/main.d.ts.map +1 -0
- package/src/main.js +53 -0
- package/src/services/service.d.ts +1 -0
- package/src/services/service.d.ts.map +1 -0
- package/src/services/service.js +1 -0
- package/src/styles/form.styles.d.ts +19 -0
- package/src/styles/form.styles.d.ts.map +1 -0
- package/src/styles/form.styles.js +18 -0
- package/src/types/types.d.ts +28 -0
- package/src/types/types.d.ts.map +1 -0
- package/src/types/types.js +1 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/dist/esm/components.d.ts +0 -1
- package/dist/esm/src/index.d.ts +0 -4
- package/dist/esm/src/index.d.ts.map +0 -1
- package/dist/esm/src/indexUmd.d.ts +0 -2
- package/dist/esm/src/indexUmd.d.ts.map +0 -1
- package/dist/esm/vite.config.d.ts +0 -3
- package/dist/esm/vite.config.d.ts.map +0 -1
- package/dist/esm/vite.config.umd.d.ts +0 -3
- package/dist/esm/vite.config.umd.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -2
- package/dist/src/indexUmd.d.ts +0 -2
- package/dist/src/indexUmd.d.ts.map +0 -1
- package/dist/src/indexUmd.js +0 -4
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/vite.config.d.ts +0 -3
- package/dist/vite.config.d.ts.map +0 -1
- package/dist/vite.config.js +0 -38
- package/dist/vite.config.umd.d.ts +0 -3
- package/dist/vite.config.umd.d.ts.map +0 -1
- package/dist/vite.config.umd.js +0 -35
- package/src/index.ts +0 -3
- package/src/indexUmd.ts +0 -5
- package/tsconfig.json +0 -10
- package/vite.config.ts +0 -42
- package/vite.config.umd.ts +0 -39
- package/vite.config_2.ts +0 -30
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useColors, useCornerRadius, useFontFamily } from "@fansunited/common";
|
|
3
|
+
import { Box, Typography } from "@mui/joy";
|
|
4
|
+
import { useEffect, useCallback } from "react";
|
|
5
|
+
import TimerOutlinedIcon from "@mui/icons-material/TimerOutlined";
|
|
6
|
+
const Stopwatch = (props) => {
|
|
7
|
+
let intervalId;
|
|
8
|
+
const dangerSoftBg = useColors().palette.danger.softBg;
|
|
9
|
+
const dangerColor = useColors().palette.danger.plainColor;
|
|
10
|
+
const warningSoftBg = useColors().palette.warning.softBg;
|
|
11
|
+
const warningColor = useColors().palette.warning.plainColor;
|
|
12
|
+
const primaryColor = props.brandingPrimaryColor || useColors().palette.primary.plainColor;
|
|
13
|
+
const xlBorderRadius = useCornerRadius().xl;
|
|
14
|
+
const fontFamilySecondary = useFontFamily().secondary;
|
|
15
|
+
const onPrimaryColor = useColors().palette.primary.onPrimary;
|
|
16
|
+
const pulseAnimation = {
|
|
17
|
+
"@keyframes pulse": {
|
|
18
|
+
"0%": {
|
|
19
|
+
transform: "scale(1)",
|
|
20
|
+
},
|
|
21
|
+
"50%": {
|
|
22
|
+
transform: "scale(1.05)",
|
|
23
|
+
},
|
|
24
|
+
"100%": {
|
|
25
|
+
transform: "scale(1)",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
const updateTime = useCallback(() => {
|
|
30
|
+
const newTime = props.quizType === "countdown" ? props.timer - 1 : props.timer + 1;
|
|
31
|
+
props.onTimeUpdate(newTime);
|
|
32
|
+
}, [props.onTimeUpdate]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (props.isRunning) {
|
|
35
|
+
intervalId = setInterval(updateTime, 1000);
|
|
36
|
+
}
|
|
37
|
+
return () => {
|
|
38
|
+
if (intervalId) {
|
|
39
|
+
clearInterval(intervalId);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}, [props.isRunning, updateTime, props.timer]);
|
|
43
|
+
const formatTime = (seconds) => {
|
|
44
|
+
const minutes = Math.floor(seconds / 60);
|
|
45
|
+
const remainingSeconds = seconds % 60;
|
|
46
|
+
return `${minutes < 10 ? "0" : ""}${minutes}:${remainingSeconds < 10 ? "0" : ""}${remainingSeconds}${minutes > 0 ? "m" : "s"}`;
|
|
47
|
+
};
|
|
48
|
+
const getColor = () => {
|
|
49
|
+
if (props.quizType === "countdown") {
|
|
50
|
+
const timePercentage = (props.timer / props.initialTime) * 100;
|
|
51
|
+
if (timePercentage <= 30) {
|
|
52
|
+
return {
|
|
53
|
+
background: dangerSoftBg,
|
|
54
|
+
color: dangerColor,
|
|
55
|
+
iconColor: dangerColor,
|
|
56
|
+
animation: "pulse 1s infinite",
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
else if (timePercentage <= 50) {
|
|
60
|
+
return {
|
|
61
|
+
background: warningSoftBg,
|
|
62
|
+
color: warningColor,
|
|
63
|
+
iconColor: warningColor,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
background: primaryColor,
|
|
69
|
+
color: onPrimaryColor,
|
|
70
|
+
iconColor: "#FFFFFF",
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
return (_jsxs(Box, { sx: {
|
|
74
|
+
py: "8px",
|
|
75
|
+
pl: "12px",
|
|
76
|
+
pr: "16px",
|
|
77
|
+
display: "flex",
|
|
78
|
+
gap: "4px",
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
bgcolor: getColor().background,
|
|
81
|
+
borderRadius: xlBorderRadius,
|
|
82
|
+
maxWidth: "105px",
|
|
83
|
+
maxHeight: "40px",
|
|
84
|
+
transition: "all 0.3s ease",
|
|
85
|
+
animation: getColor().animation,
|
|
86
|
+
...pulseAnimation,
|
|
87
|
+
zIndex: 10,
|
|
88
|
+
}, children: [_jsx(TimerOutlinedIcon, { sx: {
|
|
89
|
+
width: "24px",
|
|
90
|
+
height: "24px",
|
|
91
|
+
color: getColor().iconColor,
|
|
92
|
+
transition: "color 0.3s ease",
|
|
93
|
+
} }), _jsx(Typography, { sx: {
|
|
94
|
+
fontFamily: fontFamilySecondary,
|
|
95
|
+
fontWeight: 400,
|
|
96
|
+
fontSize: "1rem",
|
|
97
|
+
lineHeight: "150%",
|
|
98
|
+
letterSpacing: "0.15px",
|
|
99
|
+
color: getColor().color,
|
|
100
|
+
transition: "color 0.3s ease",
|
|
101
|
+
}, children: formatTime(props.timer) })] }));
|
|
102
|
+
};
|
|
103
|
+
export default Stopwatch;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ClassicQuizFullModel } from "fansunited-sdk-esm";
|
|
3
|
+
type OverlayAuthErrorProps = {
|
|
4
|
+
classicQuiz: ClassicQuizFullModel;
|
|
5
|
+
};
|
|
6
|
+
declare const OverlayAuthError: React.FC<OverlayAuthErrorProps>;
|
|
7
|
+
export default OverlayAuthError;
|
|
8
|
+
//# sourceMappingURL=OverlayAuthError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayAuthError.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Variants/Overlay/AuthError/OverlayAuthError.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,oBAAoB,EAAuB,MAAM,oBAAoB,CAAC;AAyC/E,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,oBAAoB,CAAC;CACnC,CAAC;AAEF,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA6ErD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Typography } from "@mui/joy";
|
|
3
|
+
import { stripHtmlTags, isMobile, useInternalTheme, useSpacingScale, } from "@fansunited/common";
|
|
4
|
+
import bgImage from "../../../../assets/default-quiz-bg.png";
|
|
5
|
+
import mobileBgImage from "../../../../assets/default-quiz-bg-vertical.jpg";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
7
|
+
import PresentedBy from "../../../Shared/PresentedBy";
|
|
8
|
+
import AlertMessage from "../../../Shared/AlertMessage";
|
|
9
|
+
import { createStyles } from "./OverlayAuthError.styles";
|
|
10
|
+
const extractQuizBrandingProperties = (classicQuiz) => {
|
|
11
|
+
let brandingImage = classicQuiz.branding?.images?.backgroundImage || null;
|
|
12
|
+
let brandingLogo = classicQuiz.branding?.images?.mainLogo || null;
|
|
13
|
+
let brandingColors = null;
|
|
14
|
+
if (isMobile() && classicQuiz.branding?.images) {
|
|
15
|
+
brandingImage =
|
|
16
|
+
classicQuiz.branding.images.mobileBackgroundImage ||
|
|
17
|
+
classicQuiz.branding?.images?.backgroundImage ||
|
|
18
|
+
null;
|
|
19
|
+
brandingLogo =
|
|
20
|
+
classicQuiz.branding.images.mobileLogo ||
|
|
21
|
+
classicQuiz.branding.images.mainLogo ||
|
|
22
|
+
null;
|
|
23
|
+
}
|
|
24
|
+
if (classicQuiz.branding?.colors) {
|
|
25
|
+
brandingColors = classicQuiz.branding.colors;
|
|
26
|
+
}
|
|
27
|
+
return { brandingImage, brandingColors, brandingLogo };
|
|
28
|
+
};
|
|
29
|
+
const sanitizeBackgroundUrl = (url) => {
|
|
30
|
+
try {
|
|
31
|
+
return `url("${encodeURI(url)}")`;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return "none";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const OverlayAuthError = (props) => {
|
|
38
|
+
const spacingScale = useSpacingScale();
|
|
39
|
+
const internalTheme = useInternalTheme();
|
|
40
|
+
const quizImage = isMobile()
|
|
41
|
+
? props.classicQuiz.images?.mobile || ""
|
|
42
|
+
: props.classicQuiz.images?.cover || "";
|
|
43
|
+
const { t } = useTranslation();
|
|
44
|
+
const imagePlaceholder = isMobile() ? mobileBgImage : bgImage;
|
|
45
|
+
// Extract branding properties
|
|
46
|
+
const { brandingImage, brandingColors, brandingLogo } = extractQuizBrandingProperties(props.classicQuiz);
|
|
47
|
+
// Styling variables
|
|
48
|
+
const secondaryColor = brandingColors?.contentColor || internalTheme.colorSchemes.dark.textColor;
|
|
49
|
+
const fontFamilyPrimary = internalTheme.customFontFamily.dark.primary;
|
|
50
|
+
const fontFamilySecondary = internalTheme.customFontFamily.dark.secondary;
|
|
51
|
+
const mdBorderRadius = internalTheme.customRadius.dark.md;
|
|
52
|
+
const borderSize = internalTheme.border.dark.size;
|
|
53
|
+
const backgroundImage = sanitizeBackgroundUrl(brandingImage || quizImage || imagePlaceholder);
|
|
54
|
+
// Create styles with current props/theme values
|
|
55
|
+
const styles = createStyles({
|
|
56
|
+
spacingScale,
|
|
57
|
+
brandingColors,
|
|
58
|
+
secondaryColor,
|
|
59
|
+
fontFamilyPrimary,
|
|
60
|
+
fontFamilySecondary,
|
|
61
|
+
mdBorderRadius,
|
|
62
|
+
borderSize,
|
|
63
|
+
darkTextColor: internalTheme.colorSchemes.dark.textColor,
|
|
64
|
+
backgroundImage,
|
|
65
|
+
});
|
|
66
|
+
return (_jsxs(Box, { sx: styles.mainContainer, children: [_jsx(Box, { children: _jsx(Box, { sx: styles.headlineSection, children: _jsx(Box, { sx: styles.headlineContent, children: _jsxs(Box, { sx: styles.headlineContentInner, children: [_jsx(Typography, { level: "body-sm", sx: styles.quizHeadlineText, children: t("classicQuiz.headline") }), _jsxs(Box, { sx: styles.contentContainer, children: [_jsx(Typography, { level: "h4", sx: styles.quizTitleText, children: props.classicQuiz.title }), _jsx(Typography, { level: "body-lg", sx: styles.quizDescriptionText, children: stripHtmlTags(props.classicQuiz.description) })] })] }) }) }) }), _jsxs(Box, { sx: styles.bottomSection, children: [_jsx(AlertMessage, { variant: "error", title: t("common.authentication.accessRequired"), message: t("common.authentication.invalidOrMissingAuth") }), _jsx(Box, { sx: styles.footerContainer, children: _jsx(PresentedBy, { brandingLogo: brandingLogo, textColor: internalTheme.colorSchemes.dark.textColor }) })] })] }));
|
|
67
|
+
};
|
|
68
|
+
export default OverlayAuthError;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { CustomSpacingScale } from "@fansunited/common";
|
|
2
|
+
import { BrandingColorsModel } from "fansunited-sdk-esm";
|
|
3
|
+
interface StyleProps {
|
|
4
|
+
spacingScale: CustomSpacingScale;
|
|
5
|
+
brandingColors: BrandingColorsModel | null;
|
|
6
|
+
secondaryColor: string;
|
|
7
|
+
fontFamilyPrimary: string;
|
|
8
|
+
fontFamilySecondary: string;
|
|
9
|
+
mdBorderRadius: string;
|
|
10
|
+
borderSize: string;
|
|
11
|
+
darkTextColor: string;
|
|
12
|
+
backgroundImage: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const createStyles: (props: StyleProps) => {
|
|
15
|
+
mainContainer: {
|
|
16
|
+
display: string;
|
|
17
|
+
flexDirection: string;
|
|
18
|
+
justifyContent: string;
|
|
19
|
+
gap: string;
|
|
20
|
+
p: string;
|
|
21
|
+
boxShadow: string;
|
|
22
|
+
border: string;
|
|
23
|
+
overflow: string;
|
|
24
|
+
backgroundImage: string;
|
|
25
|
+
backgroundSize: string;
|
|
26
|
+
position: string;
|
|
27
|
+
borderRadius: string;
|
|
28
|
+
minHeight: string;
|
|
29
|
+
"&::before": {
|
|
30
|
+
content: string;
|
|
31
|
+
position: string;
|
|
32
|
+
background: string;
|
|
33
|
+
top: number;
|
|
34
|
+
left: number;
|
|
35
|
+
right: number;
|
|
36
|
+
bottom: number;
|
|
37
|
+
borderRadius: string;
|
|
38
|
+
zIndex: number;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
headlineSection: {
|
|
42
|
+
display: string;
|
|
43
|
+
justifyContent: string;
|
|
44
|
+
flex: string;
|
|
45
|
+
alignSelf: string;
|
|
46
|
+
};
|
|
47
|
+
headlineContent: {
|
|
48
|
+
display: string;
|
|
49
|
+
flexDirection: string;
|
|
50
|
+
alignItems: string;
|
|
51
|
+
flex: string;
|
|
52
|
+
gap: string;
|
|
53
|
+
};
|
|
54
|
+
headlineContentInner: {
|
|
55
|
+
zIndex: number;
|
|
56
|
+
};
|
|
57
|
+
quizHeadlineText: {
|
|
58
|
+
fontWeight: number;
|
|
59
|
+
lineHeight: string;
|
|
60
|
+
letterSpacing: string;
|
|
61
|
+
textAlign: {
|
|
62
|
+
xs: string;
|
|
63
|
+
md: string;
|
|
64
|
+
};
|
|
65
|
+
color: string;
|
|
66
|
+
opacity: string;
|
|
67
|
+
textTransform: string;
|
|
68
|
+
fontFamily: string;
|
|
69
|
+
fontSize: string;
|
|
70
|
+
};
|
|
71
|
+
contentContainer: {
|
|
72
|
+
display: string;
|
|
73
|
+
flexDirection: string;
|
|
74
|
+
gap: string;
|
|
75
|
+
};
|
|
76
|
+
quizTitleText: {
|
|
77
|
+
fontWeight: number;
|
|
78
|
+
lineHeight: string;
|
|
79
|
+
letterSpacing: string;
|
|
80
|
+
textAlign: {
|
|
81
|
+
xs: string;
|
|
82
|
+
md: string;
|
|
83
|
+
};
|
|
84
|
+
fontSize: string;
|
|
85
|
+
color: string;
|
|
86
|
+
fontFamily: string;
|
|
87
|
+
};
|
|
88
|
+
quizDescriptionText: {
|
|
89
|
+
fontWeight: number;
|
|
90
|
+
lineHeight: string;
|
|
91
|
+
letterSpacing: string;
|
|
92
|
+
fontSize: string;
|
|
93
|
+
textAlign: {
|
|
94
|
+
xs: string;
|
|
95
|
+
md: string;
|
|
96
|
+
};
|
|
97
|
+
color: string;
|
|
98
|
+
opacity: string;
|
|
99
|
+
fontFamily: string;
|
|
100
|
+
};
|
|
101
|
+
bottomSection: {
|
|
102
|
+
display: string;
|
|
103
|
+
flexDirection: string;
|
|
104
|
+
gap: string;
|
|
105
|
+
};
|
|
106
|
+
footerContainer: {
|
|
107
|
+
display: string;
|
|
108
|
+
alignItems: string;
|
|
109
|
+
justifyContent: string;
|
|
110
|
+
flexDirection: {
|
|
111
|
+
xs: string;
|
|
112
|
+
md: string;
|
|
113
|
+
};
|
|
114
|
+
gap: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
export {};
|
|
118
|
+
//# sourceMappingURL=OverlayAuthError.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayAuthError.styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,UAAU,UAAU;IAClB,YAAY,EAAE,kBAAkB,CAAC;IACjC,cAAc,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,YAAY,UAAW,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgH5C,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export const createStyles = (props) => ({
|
|
2
|
+
// Main container with background overlay
|
|
3
|
+
mainContainer: {
|
|
4
|
+
display: "flex",
|
|
5
|
+
flexDirection: "column",
|
|
6
|
+
justifyContent: "space-between",
|
|
7
|
+
gap: "40px",
|
|
8
|
+
p: props.spacingScale.xl,
|
|
9
|
+
boxShadow: "xl",
|
|
10
|
+
border: props.brandingColors?.borderColor
|
|
11
|
+
? `${props.borderSize} solid ${props.brandingColors.borderColor}`
|
|
12
|
+
: "none",
|
|
13
|
+
overflow: "hidden",
|
|
14
|
+
backgroundImage: props.backgroundImage,
|
|
15
|
+
backgroundSize: "cover",
|
|
16
|
+
position: "relative",
|
|
17
|
+
borderRadius: props.mdBorderRadius,
|
|
18
|
+
minHeight: "250px",
|
|
19
|
+
"&::before": {
|
|
20
|
+
content: '""',
|
|
21
|
+
position: "absolute",
|
|
22
|
+
background: "linear-gradient(0deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)",
|
|
23
|
+
top: 0,
|
|
24
|
+
left: 0,
|
|
25
|
+
right: 0,
|
|
26
|
+
bottom: 0,
|
|
27
|
+
borderRadius: "inherit",
|
|
28
|
+
zIndex: 0,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
// Headline section wrapper
|
|
32
|
+
headlineSection: {
|
|
33
|
+
display: "flex",
|
|
34
|
+
justifyContent: "space-between",
|
|
35
|
+
flex: "1 0 0",
|
|
36
|
+
alignSelf: "stretch",
|
|
37
|
+
},
|
|
38
|
+
// Headline content container
|
|
39
|
+
headlineContent: {
|
|
40
|
+
display: "flex",
|
|
41
|
+
flexDirection: "column",
|
|
42
|
+
alignItems: "flex-start",
|
|
43
|
+
flex: "1 0 0",
|
|
44
|
+
gap: "16px",
|
|
45
|
+
},
|
|
46
|
+
// Headline content with z-index
|
|
47
|
+
headlineContentInner: {
|
|
48
|
+
zIndex: 10,
|
|
49
|
+
},
|
|
50
|
+
// Quiz headline typography
|
|
51
|
+
quizHeadlineText: {
|
|
52
|
+
fontWeight: 500,
|
|
53
|
+
lineHeight: "166%",
|
|
54
|
+
letterSpacing: "1px",
|
|
55
|
+
textAlign: { xs: "center", md: "left" },
|
|
56
|
+
color: props.secondaryColor,
|
|
57
|
+
opacity: "70%",
|
|
58
|
+
textTransform: "uppercase",
|
|
59
|
+
fontFamily: props.fontFamilySecondary,
|
|
60
|
+
fontSize: "0.75rem",
|
|
61
|
+
},
|
|
62
|
+
// Content container
|
|
63
|
+
contentContainer: {
|
|
64
|
+
display: "flex",
|
|
65
|
+
flexDirection: "column",
|
|
66
|
+
gap: props.spacingScale["3xs"],
|
|
67
|
+
},
|
|
68
|
+
// Quiz title typography
|
|
69
|
+
quizTitleText: {
|
|
70
|
+
fontWeight: 700,
|
|
71
|
+
lineHeight: "133%",
|
|
72
|
+
letterSpacing: "0px",
|
|
73
|
+
textAlign: { xs: "center", md: "left" },
|
|
74
|
+
fontSize: "1.5rem",
|
|
75
|
+
color: props.darkTextColor,
|
|
76
|
+
fontFamily: props.fontFamilyPrimary,
|
|
77
|
+
},
|
|
78
|
+
// Quiz description typography
|
|
79
|
+
quizDescriptionText: {
|
|
80
|
+
fontWeight: 500,
|
|
81
|
+
lineHeight: "140%",
|
|
82
|
+
letterSpacing: "0.15px",
|
|
83
|
+
fontSize: "1.25rem",
|
|
84
|
+
textAlign: { xs: "center", md: "left" },
|
|
85
|
+
color: props.secondaryColor,
|
|
86
|
+
opacity: "70%",
|
|
87
|
+
fontFamily: props.fontFamilyPrimary,
|
|
88
|
+
},
|
|
89
|
+
// Bottom section container
|
|
90
|
+
bottomSection: {
|
|
91
|
+
display: "flex",
|
|
92
|
+
flexDirection: "column",
|
|
93
|
+
gap: "24px",
|
|
94
|
+
},
|
|
95
|
+
// Footer container
|
|
96
|
+
footerContainer: {
|
|
97
|
+
display: "flex",
|
|
98
|
+
alignItems: "center",
|
|
99
|
+
justifyContent: "space-between",
|
|
100
|
+
flexDirection: { xs: "column-reverse", md: "row" },
|
|
101
|
+
gap: props.spacingScale.md,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayVariant.d.ts","sourceRoot":"","sources":["../../../../../src/components/Variants/Overlay/OverlayVariant.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AA4CvD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgO7C,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { AspectRatio, Box, Button, Typography } from "@mui/joy";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import ArrowRightAltIcon from "@mui/icons-material/ArrowRightAlt";
|
|
5
|
+
import { stripHtmlTags, useImageUrl, isMobile, useInternalTheme, useSpacingScale, } from "@fansunited/common";
|
|
6
|
+
import Answers from "../../Shared/Answers/Answers";
|
|
7
|
+
import Stopwatch from "../../Shared/Stopwatch";
|
|
8
|
+
import bgImage from "../../../assets/default-quiz-bg.png";
|
|
9
|
+
import mobileBgImage from "../../../assets/default-quiz-bg-vertical.jpg";
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
11
|
+
import PresentedBy from "../../Shared/PresentedBy";
|
|
12
|
+
import CollectLead from "../../Leads/CollectLead";
|
|
13
|
+
import { quizTypes } from "../../../constants/constants";
|
|
14
|
+
import { useEmbedCode } from "../../../hooks/useEmbedCodeContainer";
|
|
15
|
+
import { createStyles } from "./OverlayVariant.styles";
|
|
16
|
+
const extractQuizBrandingProperties = (classicQuiz) => {
|
|
17
|
+
let brandingImage = classicQuiz.branding?.images?.backgroundImage || null;
|
|
18
|
+
let brandingLogo = classicQuiz.branding?.images?.mainLogo || null;
|
|
19
|
+
let brandingColors = null;
|
|
20
|
+
if (isMobile() && classicQuiz.branding?.images) {
|
|
21
|
+
brandingImage =
|
|
22
|
+
classicQuiz.branding.images.mobileBackgroundImage ||
|
|
23
|
+
classicQuiz.branding?.images?.backgroundImage ||
|
|
24
|
+
null;
|
|
25
|
+
brandingLogo =
|
|
26
|
+
classicQuiz.branding.images.mobileLogo ||
|
|
27
|
+
classicQuiz.branding.images.mainLogo ||
|
|
28
|
+
null;
|
|
29
|
+
}
|
|
30
|
+
if (classicQuiz.branding?.colors) {
|
|
31
|
+
brandingColors = classicQuiz.branding.colors;
|
|
32
|
+
}
|
|
33
|
+
return { brandingImage, brandingColors, brandingLogo };
|
|
34
|
+
};
|
|
35
|
+
const sanitizeBackgroundUrl = (url) => {
|
|
36
|
+
try {
|
|
37
|
+
return `url("${encodeURI(url)}")`;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return "none";
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const OverlayVariant = (props) => {
|
|
44
|
+
const [showLead, setShowLead] = React.useState(props.leads?.position === "before" &&
|
|
45
|
+
props.classicQuiz.authRequirement === "LEAD");
|
|
46
|
+
const spacingScale = useSpacingScale();
|
|
47
|
+
const internalTheme = useInternalTheme();
|
|
48
|
+
const quizImage = isMobile()
|
|
49
|
+
? props.classicQuiz.images?.mobile || ""
|
|
50
|
+
: props.classicQuiz.images?.cover || "";
|
|
51
|
+
const questionImage = useImageUrl(props.question.images);
|
|
52
|
+
const { t } = useTranslation();
|
|
53
|
+
const imagePlaceholder = isMobile() ? mobileBgImage : bgImage;
|
|
54
|
+
const embedContainerRef = useEmbedCode(props.question.embedCode, props.applyFilterScreen);
|
|
55
|
+
// Extract branding properties
|
|
56
|
+
const { brandingImage, brandingColors, brandingLogo } = extractQuizBrandingProperties(props.classicQuiz);
|
|
57
|
+
// Styling variables
|
|
58
|
+
const secondaryColor = brandingColors?.contentColor || internalTheme.colorSchemes.dark.textColor;
|
|
59
|
+
const fontFamilyPrimary = internalTheme.customFontFamily.dark.primary;
|
|
60
|
+
const fontFamilySecondary = internalTheme.customFontFamily.dark.secondary;
|
|
61
|
+
const mdBorderRadius = internalTheme.customRadius.dark.md;
|
|
62
|
+
const smBorderRadius = internalTheme.customRadius.dark.sm;
|
|
63
|
+
const borderSize = internalTheme.border?.dark.size;
|
|
64
|
+
const contentBgColor = brandingColors?.backgroundColor ||
|
|
65
|
+
internalTheme.colorSchemes?.dark?.surfaceVariant;
|
|
66
|
+
const buttonRadius = internalTheme.customRadius?.light?.xl;
|
|
67
|
+
const primaryColor = brandingColors?.primaryColor ||
|
|
68
|
+
internalTheme.colorSchemes?.light?.palette?.primary?.plainColor;
|
|
69
|
+
const onPrimaryColor = internalTheme.colorSchemes?.light?.palette?.primary?.onPrimary;
|
|
70
|
+
const backgroundImage = sanitizeBackgroundUrl(brandingImage || quizImage || imagePlaceholder);
|
|
71
|
+
// Create styles with current props/theme values
|
|
72
|
+
const styles = createStyles({
|
|
73
|
+
spacingScale,
|
|
74
|
+
brandingColors,
|
|
75
|
+
secondaryColor,
|
|
76
|
+
fontFamilyPrimary,
|
|
77
|
+
fontFamilySecondary,
|
|
78
|
+
mdBorderRadius,
|
|
79
|
+
smBorderRadius,
|
|
80
|
+
borderSize,
|
|
81
|
+
contentBgColor,
|
|
82
|
+
buttonRadius,
|
|
83
|
+
primaryColor,
|
|
84
|
+
onPrimaryColor,
|
|
85
|
+
backgroundImage,
|
|
86
|
+
darkTextColor: internalTheme.colorSchemes.dark.textColor,
|
|
87
|
+
});
|
|
88
|
+
const closeLeadForm = () => {
|
|
89
|
+
setShowLead(false);
|
|
90
|
+
};
|
|
91
|
+
const renderPresentedBy = () => (_jsx(PresentedBy, { brandingLogo: brandingLogo, textColor: internalTheme.colorSchemes.dark.textColor }));
|
|
92
|
+
return (_jsxs(Box, { sx: styles.mainContainer, children: [_jsx(Box, { children: _jsx(Box, { sx: styles.headlineSection, children: _jsx(Box, { sx: styles.headlineContent, children: _jsxs(Box, { sx: styles.headlineContentInner, children: [_jsx(Typography, { level: "body-sm", sx: styles.quizHeadlineText, children: t("classicQuiz.headline") }), _jsxs(Box, { sx: styles.contentContainer, children: [_jsx(Typography, { level: "h4", sx: styles.quizTitleText, children: props.classicQuiz.title }), _jsx(Typography, { level: "body-lg", sx: styles.quizDescriptionText, children: stripHtmlTags(props.classicQuiz.description) })] })] }) }) }) }), props.applyFilterScreen ? (_jsxs(Box, { sx: styles.filterScreenBottomContainer, children: [renderPresentedBy(), _jsx(Button, { variant: "soft", sx: {
|
|
93
|
+
...styles.startButton,
|
|
94
|
+
...styles.pulseAnimation,
|
|
95
|
+
}, endDecorator: _jsx(ArrowRightAltIcon, {}), onClick: props.startPlaying, children: _jsx(Typography, { sx: styles.startButtonText, children: t("classicQuiz.buttons.start") }) })] })) : (_jsxs(Box, { sx: styles.mainContentSection, children: [!showLead &&
|
|
96
|
+
quizTypes.includes(props.classicQuiz.type?.toLocaleLowerCase()) && (_jsx(Box, { sx: styles.stopwatchContainer, children: _jsx(Stopwatch, { brandingPrimaryColor: brandingColors?.primaryColor || null, isRunning: props.isStopwatchRunning, timer: props.stopwatchTime, quizType: props.classicQuiz.type, onTimeUpdate: props.onTimeUpdate, initialTime: props.classicQuiz.time || 10 }) })), _jsx(Box, { sx: styles.contentContainerWithBackdrop, children: showLead ? (_jsx(CollectLead, { sdk: props.sdk, contentType: "quiz", startGame: closeLeadForm, contentId: props.classicQuiz.id, contentName: props.classicQuiz.title, brandingColors: props.classicQuiz.branding?.colors, brandingUrls: props.classicQuiz.branding?.urls, campaignId: props.leads?.campaignId, campaignName: props.leads?.campaignName, fields: props.leads?.fields, leadTitle: props.classicQuiz.labels?.leadTitle, leadDescription: props.classicQuiz.labels?.leadDescription, leadCta: props.classicQuiz.labels?.leadCta, leadSuccessTitle: props.classicQuiz.labels?.leadSuccessTitle, leadSuccessDescription: props.classicQuiz.labels?.leadSuccessDescription })) : (_jsxs(_Fragment, { children: [props.question.embedCode && (_jsx(AspectRatio, { ratio: "16/9", sx: styles.aspectRatioContainer, children: _jsx(Box, { ref: embedContainerRef }) })), !props.question.embedCode && questionImage && (_jsx(AspectRatio, { ratio: "16/9", sx: styles.questionImageContainer, children: _jsx(Box, { sx: styles.questionImageBox, children: _jsx("img", { src: questionImage, alt: "Question illustration", style: styles.questionImage }) }) })), _jsxs(Box, { sx: styles.questionSection, children: [_jsxs(Typography, { level: "body-lg", sx: styles.questionStepsText, children: [props.currentQuestion, "/", props.classicQuiz.questionsCount] }), _jsx(Typography, { level: "body-lg", sx: styles.questionText, children: props.question.question })] }), _jsx(Answers, { options: props.question.options || [], answerQuestion: props.answerQuestion, selectedOption: props.selectedOption, showAnswer: props.showAnswer, twoByTwo: false, questionImage: questionImage, brandingColors: brandingColors })] })) }), _jsxs(Box, { sx: styles.bottomFooterContainer, children: [renderPresentedBy(), !showLead && (_jsx(Button, { variant: "soft", disabled: props.selectedOption === null || props.showAnswer, sx: styles.nextButton, endDecorator: _jsx(ArrowRightAltIcon, {}), onClick: props.handleNext, children: _jsx(Typography, { sx: styles.nextButtonText, children: props.currentQuestion === props.classicQuiz.questionsCount
|
|
97
|
+
? t("classicQuiz.buttons.finish")
|
|
98
|
+
: t("classicQuiz.buttons.next") }) }))] })] }))] }));
|
|
99
|
+
};
|
|
100
|
+
export default OverlayVariant;
|