fansunited-frontend-components 0.0.1-RC5 → 0.0.1-RC6

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 (88) hide show
  1. package/classic-quiz-play.es.js +4 -4
  2. package/classic-quiz-play.umd.js +1 -1
  3. package/package.json +1 -1
  4. package/src/components/ClassicQuizNotFound.d.ts +2 -1
  5. package/src/components/ClassicQuizPlay.d.ts +3 -2
  6. package/src/components/Leads/CollectLead.d.ts +2 -1
  7. package/src/components/Leads/LeadAgreementCheckbox.d.ts +3 -2
  8. package/src/components/Leads/LeadForm.d.ts +2 -1
  9. package/src/components/Shared/Answers/Answers.d.ts +3 -2
  10. package/src/components/Shared/Answers/Option.d.ts +3 -2
  11. package/src/components/Shared/Button.d.ts +2 -1
  12. package/src/components/Shared/MainCard.d.ts +2 -1
  13. package/src/components/Shared/Pagination.d.ts +3 -2
  14. package/src/components/Shared/PresentedBy.d.ts +2 -1
  15. package/src/components/Shared/ScoreStateWrapper.d.ts +4 -3
  16. package/src/components/Shared/Stepper.d.ts +3 -2
  17. package/src/components/Shared/Stopwatch.d.ts +2 -1
  18. package/src/components/Variants/Overlay/AuthError/OverlayAuthError.d.ts +3 -2
  19. package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.d.ts +3 -2
  20. package/src/components/Variants/Overlay/OverlayVariant.d.ts +3 -2
  21. package/src/components/Variants/Overlay/OverlayVariant.styles.d.ts +4 -3
  22. package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.d.ts +4 -3
  23. package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.d.ts +4 -3
  24. package/src/components/Variants/Split/AuthError/SplitAuthError.d.ts +3 -2
  25. package/src/components/Variants/Split/AuthError/SplitAuthError.styles.d.ts +3 -2
  26. package/src/components/Variants/Split/ScoreState/SplitScoreState.d.ts +4 -3
  27. package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.d.ts +4 -3
  28. package/src/components/Variants/Split/SplitVariant.d.ts +3 -2
  29. package/src/components/Variants/Split/SplitVariant.styles.d.ts +4 -3
  30. package/src/components/Variants/Standard/AuthError/StandardAuthError.d.ts +3 -2
  31. package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.d.ts +4 -3
  32. package/src/components/Variants/Standard/ScoreState/StandardScoreState.d.ts +4 -3
  33. package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.d.ts +4 -3
  34. package/src/components/Variants/Standard/StandardVariant.d.ts +4 -3
  35. package/src/components/Variants/Standard/StandardVariant.styles.d.ts +4 -3
  36. package/src/constants/constants.d.ts +2 -1
  37. package/src/hooks/useClassicQuizById.d.ts +2 -1
  38. package/src/hooks/useEmbedCodeContainer.d.ts +1 -1
  39. package/src/hooks/useMyParticipation.d.ts +2 -1
  40. package/src/hooks/useScoreStateHelpers.d.ts +3 -2
  41. package/src/index.d.ts +2 -1
  42. package/src/main.d.ts +3 -2
  43. package/src/main.d.ts.map +1 -1
  44. package/src/types/types.d.ts +3 -2
  45. package/src/components/ClassicQuizNotFound.js +0 -55
  46. package/src/components/ClassicQuizPlay.js +0 -321
  47. package/src/components/Leads/CollectLead.js +0 -20
  48. package/src/components/Leads/LeadAgreementCheckbox.js +0 -45
  49. package/src/components/Leads/LeadForm.js +0 -289
  50. package/src/components/Shared/AlertMessage.js +0 -37
  51. package/src/components/Shared/Answers/Answers.js +0 -31
  52. package/src/components/Shared/Answers/Option.js +0 -118
  53. package/src/components/Shared/Button.js +0 -43
  54. package/src/components/Shared/MainCard.js +0 -24
  55. package/src/components/Shared/Pagination.js +0 -118
  56. package/src/components/Shared/PresentedBy.js +0 -51
  57. package/src/components/Shared/ScoreStateWrapper.js +0 -254
  58. package/src/components/Shared/Stepper.js +0 -75
  59. package/src/components/Shared/Stopwatch.js +0 -103
  60. package/src/components/Variants/Overlay/AuthError/OverlayAuthError.js +0 -68
  61. package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.js +0 -103
  62. package/src/components/Variants/Overlay/OverlayVariant.js +0 -100
  63. package/src/components/Variants/Overlay/OverlayVariant.styles.js +0 -266
  64. package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.js +0 -90
  65. package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.js +0 -374
  66. package/src/components/Variants/Split/AuthError/SplitAuthError.js +0 -44
  67. package/src/components/Variants/Split/AuthError/SplitAuthError.styles.js +0 -95
  68. package/src/components/Variants/Split/ScoreState/SplitScoreState.js +0 -84
  69. package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.js +0 -400
  70. package/src/components/Variants/Split/SplitVariant.js +0 -79
  71. package/src/components/Variants/Split/SplitVariant.styles.js +0 -216
  72. package/src/components/Variants/Standard/AuthError/StandardAuthError.js +0 -43
  73. package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.js +0 -201
  74. package/src/components/Variants/Standard/ScoreState/StandardScoreState.js +0 -78
  75. package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.js +0 -349
  76. package/src/components/Variants/Standard/StandardVariant.js +0 -82
  77. package/src/components/Variants/Standard/StandardVariant.styles.js +0 -373
  78. package/src/constants/constants.js +0 -446
  79. package/src/hooks/useClassicQuizById.js +0 -20
  80. package/src/hooks/useEmbedCodeContainer.js +0 -38
  81. package/src/hooks/useMyParticipation.js +0 -22
  82. package/src/hooks/useScoreStateHelpers.js +0 -156
  83. package/src/index.js +0 -2
  84. package/src/main.js +0 -53
  85. package/src/services/service.js +0 -1
  86. package/src/styles/form.styles.js +0 -18
  87. package/src/types/types.js +0 -1
  88. package/tsconfig.tsbuildinfo +0 -1
@@ -1,374 +0,0 @@
1
- export const createStyles = (props) => ({
2
- // Main container with background overlay (with explanations)
3
- mainContainerWithExplanations: {
4
- boxShadow: "xl",
5
- border: `${props.borderSize} solid ${props.borderColor}`,
6
- overflow: "hidden",
7
- backgroundImage: props.backgroundImage,
8
- backgroundSize: "cover",
9
- position: "relative",
10
- borderRadius: props.mdBorderRadius,
11
- minHeight: "250px",
12
- "&::before": {
13
- content: '""',
14
- position: "absolute",
15
- top: 0,
16
- left: 0,
17
- right: 0,
18
- bottom: 0,
19
- borderRadius: "inherit",
20
- zIndex: 0,
21
- background: "linear-gradient(0deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)",
22
- },
23
- },
24
- // Main container with background overlay (without explanations)
25
- mainContainer: {
26
- display: "flex",
27
- flexDirection: "column",
28
- gap: "40px",
29
- p: props.spacingScale.xl,
30
- boxShadow: "xl",
31
- border: `${props.borderSize} solid ${props.borderColor}`,
32
- overflow: "hidden",
33
- backgroundImage: props.backgroundImage,
34
- backgroundSize: "cover",
35
- position: "relative",
36
- borderRadius: props.mdBorderRadius,
37
- minHeight: "250px",
38
- "&::before": {
39
- content: '""',
40
- position: "absolute",
41
- top: 0,
42
- left: 0,
43
- right: 0,
44
- bottom: 0,
45
- borderRadius: "inherit",
46
- zIndex: 0,
47
- background: "linear-gradient(0deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)",
48
- },
49
- },
50
- // Score state wrapper content
51
- scoreStateWrapperContent: {
52
- display: "flex",
53
- flexDirection: "column",
54
- gap: "40px",
55
- p: props.spacingScale.xl,
56
- },
57
- // Main content wrapper
58
- mainContentWrapper: {
59
- display: "flex",
60
- flexDirection: "column",
61
- gap: "24px",
62
- zIndex: 10,
63
- },
64
- // Score container with backdrop
65
- scoreContainer: {
66
- borderRadius: props.mdBorderRadius,
67
- p: props.spacingScale.md,
68
- display: "flex",
69
- flexDirection: "column",
70
- alignItems: "center",
71
- alignSelf: "stretch",
72
- gap: props.spacingScale.md,
73
- backdropFilter: "blur(4px)",
74
- position: "relative",
75
- "&::before": {
76
- content: '""',
77
- position: "absolute",
78
- top: 0,
79
- left: 0,
80
- right: 0,
81
- bottom: 0,
82
- backgroundColor: props.contentBgColor,
83
- opacity: 0.5,
84
- borderRadius: "inherit",
85
- zIndex: 0,
86
- backdropFilter: "blur(4px)",
87
- },
88
- "& > *": {
89
- position: "relative",
90
- zIndex: 1,
91
- },
92
- },
93
- // Score content wrapper
94
- scoreContentWrapper: {
95
- display: "flex",
96
- flexDirection: { xs: "column", md: "row" },
97
- justifyContent: "center",
98
- alignItems: "center",
99
- alignSelf: "stretch",
100
- },
101
- // Score section
102
- scoreSection: {
103
- display: "flex",
104
- py: props.spacingScale.xs,
105
- gap: props.spacingScale.md,
106
- justifyContent: "center",
107
- alignItems: "center",
108
- flex: "1 0 0",
109
- },
110
- // Score section wrapper
111
- scoreSectionWrapper: {
112
- display: "flex",
113
- minWidth: "200px",
114
- p: props.spacingScale.xs,
115
- justifyContent: "center",
116
- alignItems: "center",
117
- gap: props.spacingScale.md,
118
- flex: "1 0 0",
119
- alignSelf: "stretch",
120
- flexDirection: { xs: "column", md: "row" },
121
- },
122
- // Achievement badge container
123
- achievementBadgeContainer: {
124
- display: "flex",
125
- width: { xs: "172px", md: "auto" },
126
- height: { xs: "160px", md: "auto" },
127
- flexDirection: "column",
128
- justifyContent: "center",
129
- alignItems: "center",
130
- position: "relative",
131
- },
132
- // Hexagon background
133
- hexagonBackground: {
134
- width: "160px",
135
- height: "160px",
136
- position: "absolute",
137
- top: "55%",
138
- left: "50%",
139
- transform: "translate(-50%, -50%)",
140
- },
141
- // Achievement emoji
142
- achievementEmoji: {
143
- maxWidth: "80px",
144
- maxHeight: "80px",
145
- position: "relative",
146
- },
147
- // Text section
148
- textSection: {
149
- display: "flex",
150
- flexDirection: "column",
151
- alignItems: "center",
152
- },
153
- // Congratulations text
154
- congratulationsText: {
155
- color: props.textPrimary,
156
- textAlign: "center",
157
- fontFamily: props.fontFamilyPrimary,
158
- fontSize: "1.5rem",
159
- fontStyle: "normal",
160
- fontWeight: 400,
161
- lineHeight: "133.4%",
162
- px: 2,
163
- },
164
- // Score numbers container
165
- scoreNumbersContainer: {
166
- display: "flex",
167
- alignItems: "center",
168
- gap: "4px",
169
- },
170
- // Score numbers wrapper
171
- scoreNumbersWrapper: {
172
- display: "flex",
173
- alignItems: "flex-end",
174
- gap: "4px",
175
- },
176
- // Correct score text
177
- correctScoreText: {
178
- textAlign: "center",
179
- color: props.scorePercentage > 30 ? props.successColor : props.dangerColor,
180
- fontFamily: props.fontFamilyPrimary,
181
- fontSize: "3.75rem",
182
- fontStyle: "normal",
183
- fontWeight: 500,
184
- lineHeight: "120%",
185
- letterSpacing: "-0.5px",
186
- },
187
- // Total score text
188
- totalScoreText: {
189
- textAlign: "center",
190
- color: props.scorePercentage > 30 ? props.successColor : props.dangerColor,
191
- fontFamily: props.fontFamilyPrimary,
192
- fontSize: "3.75rem",
193
- fontStyle: "normal",
194
- fontWeight: 500,
195
- lineHeight: "120%",
196
- letterSpacing: "-0.5px",
197
- },
198
- // Time text
199
- timeText: {
200
- textAlign: "center",
201
- color: props.textPrimary,
202
- fontFamily: props.fontFamilySecondary,
203
- fontSize: "0.875rem",
204
- fontStyle: "normal",
205
- fontWeight: 700,
206
- lineHeight: "143%",
207
- letterSpacing: "0.024px",
208
- },
209
- // Points text
210
- pointsText: {
211
- textAlign: "center",
212
- color: props.textPrimary,
213
- fontFamily: props.fontFamilyPrimary,
214
- fontSize: "1.25rem",
215
- fontStyle: "normal",
216
- fontWeight: 500,
217
- lineHeight: "120%",
218
- letterSpacing: "0.15px",
219
- },
220
- // CTA section
221
- ctaSection: {
222
- display: "flex",
223
- py: props.spacingScale.xs,
224
- justifyContent: "center",
225
- alignItems: "center",
226
- gap: "24px",
227
- flex: "1 0 0",
228
- },
229
- // CTA content wrapper
230
- ctaContentWrapper: {
231
- display: "flex",
232
- flexDirection: "column",
233
- justifyContent: "center",
234
- alignItems: "center",
235
- gap: "16px",
236
- flex: "1 0 0",
237
- },
238
- // Thanks text
239
- thanksText: {
240
- color: props.textPrimary,
241
- textAlign: "center",
242
- fontFamily: props.fontFamilyPrimary,
243
- fontSize: "1.25rem",
244
- fontStyle: "normal",
245
- fontWeight: 500,
246
- lineHeight: "120%",
247
- letterSpacing: "0.15px",
248
- },
249
- // Buttons container
250
- buttonsContainer: {
251
- display: "flex",
252
- flexDirection: { xs: "column", md: "row" },
253
- gap: "24px",
254
- },
255
- // Play again button
256
- playAgainButton: {
257
- display: "flex",
258
- minHeight: "48px",
259
- py: "12px",
260
- pr: "24px",
261
- pl: "16px",
262
- flexDirection: "column",
263
- justifyContent: "center",
264
- alignItems: "center",
265
- gap: "8px",
266
- borderRadius: props.xlBorderRadius,
267
- bgcolor: props.onSurfaceColor,
268
- "&:hover": {
269
- bgcolor: props.surfaceVariantColor,
270
- },
271
- },
272
- // Play again button content
273
- playAgainButtonContent: {
274
- display: "flex",
275
- justifyContent: "center",
276
- alignItems: "center",
277
- gap: "8px",
278
- alignSelf: "stretch",
279
- },
280
- // Play again icon
281
- playAgainIcon: {
282
- display: "flex",
283
- width: "24px",
284
- height: "24px",
285
- justifyContent: "center",
286
- alignItems: "center",
287
- color: props.textPrimary,
288
- },
289
- // Play again text
290
- playAgainText: {
291
- color: props.textPrimary,
292
- textAlign: "center",
293
- fontFamily: props.fontFamilyPrimary,
294
- fontSize: "0.9375rem",
295
- fontStyle: "normal",
296
- fontWeight: 500,
297
- lineHeight: "24px",
298
- letterSpacing: "0.46px",
299
- textTransform: "uppercase",
300
- },
301
- // Share button
302
- shareButton: {
303
- display: "flex",
304
- minHeight: "48px",
305
- py: "12px",
306
- pr: "24px",
307
- pl: "16px",
308
- flexDirection: "column",
309
- justifyContent: "center",
310
- alignItems: "center",
311
- gap: "8px",
312
- borderRadius: props.xlBorderRadius,
313
- bgcolor: props.primaryColor,
314
- "&:hover": {
315
- bgcolor: props.primaryColor,
316
- },
317
- },
318
- // Share button content
319
- shareButtonContent: {
320
- display: "flex",
321
- justifyContent: "center",
322
- alignItems: "center",
323
- gap: "8px",
324
- alignSelf: "stretch",
325
- },
326
- // Share icon
327
- shareIcon: {
328
- display: "flex",
329
- width: "24px",
330
- height: "24px",
331
- justifyContent: "center",
332
- alignItems: "center",
333
- },
334
- // Share text
335
- shareText: {
336
- color: props.textPrimary,
337
- textAlign: "center",
338
- fontFamily: props.fontFamilyPrimary,
339
- fontSize: "0.9375rem",
340
- fontStyle: "normal",
341
- fontWeight: 500,
342
- lineHeight: "24px",
343
- letterSpacing: "0.40px",
344
- textTransform: "uppercase",
345
- },
346
- // Lead collection container
347
- leadCollectionContainer: {
348
- borderRadius: props.mdBorderRadius,
349
- p: props.spacingScale.md,
350
- display: "flex",
351
- flexDirection: "column",
352
- alignSelf: "stretch",
353
- gap: props.spacingScale.md,
354
- backdropFilter: "blur(4px)",
355
- position: "relative",
356
- "&::before": {
357
- content: '""',
358
- position: "absolute",
359
- top: 0,
360
- left: 0,
361
- right: 0,
362
- bottom: 0,
363
- backgroundColor: props.contentBgColor,
364
- opacity: 0.5,
365
- borderRadius: "inherit",
366
- zIndex: 0,
367
- backdropFilter: "blur(4px)",
368
- },
369
- "& > *": {
370
- position: "relative",
371
- zIndex: 1,
372
- },
373
- },
374
- });
@@ -1,44 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Typography } from "@mui/joy";
3
- import { stripHtmlTags, useImageUrl, isMobile, useColors, useCornerRadius, useFontFamily, useInternalTheme, useSpacingScale, } from "@fansunited/common";
4
- import MainCard from "../../../Shared/MainCard";
5
- import bgImage from "../../../../assets/default-quiz-bg.png";
6
- import mobileBgImage from "../../../../assets/default-quiz-bg-vertical.jpg";
7
- import { useTranslation } from "react-i18next";
8
- import PresentedBy from "../../../Shared/PresentedBy";
9
- import AlertMessage from "../../../Shared/AlertMessage";
10
- import { createStyles } from "./SplitAuthError.styles";
11
- const SplitAuthError = (props) => {
12
- const internalTheme = useInternalTheme();
13
- const quizImage = useImageUrl(props.classicQuiz.images);
14
- const { t } = useTranslation();
15
- const brandingColors = props.classicQuiz.branding?.colors || null;
16
- const brandingLogo = isMobile()
17
- ? props.classicQuiz.branding?.images.mobileLogo ||
18
- props.classicQuiz.branding?.images.mainLogo ||
19
- ""
20
- : props.classicQuiz.branding?.images.mainLogo || "";
21
- const imagePlaceholder = isMobile() ? mobileBgImage : bgImage;
22
- // Styling variables
23
- const fontFamilySecondary = useFontFamily().secondary;
24
- const fontFamilyPrimary = useFontFamily().primary;
25
- const mdBorderRadius = useCornerRadius().md;
26
- const textColor = useColors().textColor;
27
- const spacingScale = useSpacingScale();
28
- // Create styles with current props/theme values
29
- const styles = createStyles({
30
- quizImage,
31
- imagePlaceholder,
32
- spacingScale,
33
- borderRadius: useCornerRadius(),
34
- fontFamilyPrimary,
35
- fontFamilySecondary,
36
- mdBorderRadius,
37
- textColor,
38
- brandingColors,
39
- darkTextColor: internalTheme.colorSchemes.dark.textColor,
40
- });
41
- return (_jsxs(MainCard, { brandingBorderColor: brandingColors?.borderColor || null, children: [_jsx(Box, { sx: styles.headlineSection, children: _jsxs(Box, { sx: styles.headlineContent, children: [_jsxs(Box, { children: [_jsx(Typography, { level: "body-sm", sx: styles.quizHeadlineText, children: t("classicQuiz.headline") }), _jsxs(Box, { sx: styles.contentContainer, children: [_jsx(Typography, { level: "body-lg", sx: styles.quizTitleText, children: props.classicQuiz.title }), _jsx(Typography, { level: "body-md", sx: styles.quizDescriptionText, children: stripHtmlTags(props.classicQuiz.description) })] })] }), _jsx(Box, { sx: styles.presentedByDesktop, children: _jsx(PresentedBy, { brandingLogo: brandingLogo, textColor: brandingColors?.contentColor ||
42
- internalTheme.colorSchemes.dark.textColor }) })] }) }), _jsxs(Box, { sx: styles.questionArea, children: [_jsx(AlertMessage, { variant: "error", title: t("common.authentication.accessRequired"), message: t("common.authentication.invalidOrMissingAuth") }), _jsx(Box, { sx: styles.presentedByMobile, children: _jsx(PresentedBy, { brandingLogo: brandingLogo, textColor: brandingColors?.contentColor || textColor }) })] })] }));
43
- };
44
- export default SplitAuthError;
@@ -1,95 +0,0 @@
1
- export const createStyles = (props) => ({
2
- // Main headline section with background image
3
- headlineSection: {
4
- display: "flex",
5
- flexDirection: "column",
6
- justifyContent: "space-between",
7
- gap: "10px",
8
- flex: "0.5",
9
- backgroundImage: `url(${props.quizImage || props.imagePlaceholder})`,
10
- backgroundSize: "cover",
11
- backgroundPosition: "center",
12
- borderTopLeftRadius: props.mdBorderRadius,
13
- borderTopRightRadius: { xs: props.mdBorderRadius, md: "0" },
14
- borderBottomLeftRadius: { xs: 0, md: props.mdBorderRadius },
15
- overflow: "hidden",
16
- height: "auto",
17
- position: "relative",
18
- minHeight: { xs: "210px", md: "430px" },
19
- "&::before": {
20
- content: '""',
21
- position: "absolute",
22
- width: "100%",
23
- height: "100%",
24
- background: "linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)",
25
- borderTopLeftRadius: "5px",
26
- borderTopRightRadius: "5px",
27
- },
28
- },
29
- // Headline content wrapper
30
- headlineContent: {
31
- zIndex: 1,
32
- height: "100%",
33
- p: props.spacingScale.xl,
34
- gap: props.spacingScale.xl,
35
- display: "flex",
36
- flexDirection: "column",
37
- justifyContent: "space-between",
38
- },
39
- // Quiz headline typography
40
- quizHeadlineText: {
41
- fontWeight: 500,
42
- lineHeight: "166%",
43
- letterSpacing: "1px",
44
- fontSize: "0.75rem",
45
- color: props.brandingColors?.secondaryColor || props.darkTextColor,
46
- opacity: "70%",
47
- textTransform: "uppercase",
48
- fontFamily: props.fontFamilySecondary,
49
- textAlign: { xs: "center", md: "left" },
50
- },
51
- // Content container
52
- contentContainer: {
53
- display: "flex",
54
- flexDirection: "column",
55
- gap: props.spacingScale["3xs"],
56
- },
57
- // Quiz title typography
58
- quizTitleText: {
59
- fontWeight: 700,
60
- lineHeight: "133%",
61
- fontSize: "1.5rem",
62
- letterSpacing: "0.15px",
63
- color: props.brandingColors?.contentColor || props.darkTextColor,
64
- fontFamily: props.fontFamilyPrimary,
65
- textAlign: { xs: "center", md: "left" },
66
- },
67
- // Quiz description typography
68
- quizDescriptionText: {
69
- fontWeight: 500,
70
- lineHeight: "140%",
71
- fontSize: "1.25rem",
72
- letterSpacing: "0.15px",
73
- color: props.brandingColors?.secondaryColor || props.darkTextColor,
74
- opacity: "70%",
75
- fontFamily: props.fontFamilyPrimary,
76
- textAlign: { xs: "center", md: "left" },
77
- },
78
- // Presented by desktop container
79
- presentedByDesktop: {
80
- display: { xs: "none", md: "block" },
81
- },
82
- // Question area (error section)
83
- questionArea: {
84
- flex: "0.5",
85
- display: "flex",
86
- flexDirection: "column",
87
- justifyContent: "center",
88
- gap: props.spacingScale.md,
89
- p: props.spacingScale.lg,
90
- },
91
- // Presented by mobile container
92
- presentedByMobile: {
93
- display: { xs: "block", md: "none" },
94
- },
95
- });
@@ -1,84 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Box, Button, Typography } from "@mui/joy";
3
- import { stripHtmlTags, useImageUrl, hexToRgb, WidgetTemplate, isMobile, useColors, useCornerRadius, useFontFamily, useSpacingScale, useInternalTheme, } from "@fansunited/common";
4
- import ReplayIcon from "@mui/icons-material/Replay";
5
- import share from "../../../../assets/share.svg";
6
- import MainCard from "../../../Shared/MainCard";
7
- import ScoreStateWrapper from "../../../Shared/ScoreStateWrapper";
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 { createStyles } from "./SplitScoreState.styles";
14
- import AlertMessage from "../../../Shared/AlertMessage";
15
- import { useScoreStateHelpers } from "../../../../hooks/useScoreStateHelpers";
16
- const SplitScoreState = (props) => {
17
- const internalTheme = useInternalTheme();
18
- const quizImage = useImageUrl(props.classicQuiz.images);
19
- const { t } = useTranslation();
20
- const isMobileScreen = isMobile();
21
- const { getHexagonBackground, formatTime, displayCongratulations, getRandomEmoji, shareResult, } = useScoreStateHelpers({
22
- summary: props.summary,
23
- totalTime: props.totalTime,
24
- classicQuiz: props.classicQuiz,
25
- variant: WidgetTemplate.SPLIT,
26
- });
27
- // Styling variables
28
- const brandingColors = props.classicQuiz.branding?.colors || null;
29
- const textPrimary = useColors().textPrimary;
30
- const primaryColor = brandingColors?.primaryColor || useColors().palette?.primary?.plainColor;
31
- const onPrimaryColor = useColors().palette?.primary?.onPrimary;
32
- const fontFamilySecondary = useFontFamily().secondary;
33
- const fontFamilyPrimary = useFontFamily().primary;
34
- const bgcolor = brandingColors?.backgroundColor || useColors().surfaceVariant;
35
- const surfaceColor = useColors().surface;
36
- const onSurfaceColor = useColors().onSurface;
37
- const borderRadius = useCornerRadius();
38
- const textColor = useColors().textColor;
39
- const spacingScale = useSpacingScale();
40
- const brandingLogo = isMobileScreen
41
- ? props.classicQuiz.branding?.images.mobileLogo ||
42
- props.classicQuiz.branding?.images.mainLogo ||
43
- ""
44
- : props.classicQuiz.branding?.images.mainLogo || "";
45
- // Constants
46
- const imagePlaceholder = isMobileScreen ? mobileBgImage : bgImage;
47
- const showLead = props.leads?.position === "after" &&
48
- props.classicQuiz.authRequirement === "LEAD";
49
- // Create styles with current props/theme values
50
- const styles = createStyles({
51
- quizImage,
52
- imagePlaceholder,
53
- spacingScale,
54
- borderRadius,
55
- fontFamilyPrimary,
56
- fontFamilySecondary,
57
- textPrimary,
58
- primaryColor,
59
- onPrimaryColor,
60
- bgcolor: hexToRgb(bgcolor || ""),
61
- surfaceColor,
62
- onSurfaceColor,
63
- textColor,
64
- brandingColors,
65
- successColor: useColors().palette?.success?.plainColor,
66
- dangerColor: useColors().palette?.danger?.plainColor,
67
- darkTextColor: internalTheme.colorSchemes.dark.textColor,
68
- isMobileScreen,
69
- });
70
- const renderMainContent = (isTabulated) => {
71
- return (_jsxs(_Fragment, { children: [_jsx(Box, { sx: styles.desktopImageSection(isTabulated), children: _jsxs(Box, { sx: styles.imageSectionContent, children: [_jsxs(Box, { children: [_jsx(Typography, { level: "body-sm", sx: styles.quizHeadlineText, children: "Quiz" }), _jsxs(Box, { sx: styles.contentContainer, children: [_jsx(Typography, { level: "body-lg", sx: styles.quizTitleText, children: props.classicQuiz.title }), _jsx(Typography, { level: "body-md", sx: styles.quizDescriptionText, children: stripHtmlTags(props.classicQuiz.description) })] })] }), _jsx(Box, { sx: styles.presentedByDesktop, children: _jsx(PresentedBy, { brandingLogo: brandingLogo, textColor: brandingColors?.contentColor ||
72
- internalTheme.colorSchemes.dark.textColor }) })] }) }), props.summary.classicQuizId ? (_jsx(Box, { sx: styles.questionArea, children: _jsxs(Box, { sx: styles.questionAreaContent, children: [_jsx(Box, { sx: styles.scoreContainer, children: _jsx(Box, { sx: styles.scoreContentWrapper, children: _jsxs(Box, { sx: styles.scoreContentContainer, children: [_jsx(Box, { sx: styles.scoreSection, children: _jsxs(Box, { sx: styles.scoreSectionWrapper, children: [_jsxs(Box, { sx: styles.achievementBadgeContainer, children: [_jsx("img", { style: styles.hexagonBackground, src: getHexagonBackground(), alt: "achievement-badge-background" }), _jsx("img", { style: styles.achievementEmoji, src: getRandomEmoji("light"), alt: "achievement-badge" })] }), _jsxs(Box, { sx: styles.textSection, children: [_jsx(Typography, { level: "body-lg", sx: styles.congratulationsText, children: props.maxAttemptsReached
73
- ? t("classicQuiz.maxAttemptsReached")
74
- : displayCongratulations() }), _jsx(Box, { sx: styles.scoreNumbersContainer, children: _jsxs(Box, { sx: styles.scoreNumbersWrapper, children: [_jsx(Typography, { level: "h2", sx: styles.correctScoreText(props.summary.correct), children: props.summary.correct }), _jsxs(Typography, { level: "h2", sx: styles.totalScoreText(props.summary.correct), children: ["/", props.summary.classicQuizQuestions] })] }) }), props.totalTime ? (_jsxs(Typography, { level: "body-md", sx: styles.timeText, children: [t("classicQuiz.youDidItFor"), " ", formatTime()] })) : null, props.classicQuiz.scored ? (_jsxs(Typography, { level: "body-lg", sx: styles.pointsText, children: [t("classicQuiz.youWon"), " ", props.summary.correct * props.classicQuiz.points, " ", t("common.labels.points")] })) : null] })] }) }), !(isMobileScreen && showLead) && (_jsxs(_Fragment, { children: [_jsx(Box, { sx: styles.ctaContainer, children: _jsxs(Box, { sx: styles.ctaContentWrapper, children: [_jsx(Typography, { level: "body-lg", sx: styles.thanksText, children: t("classicQuiz.thanksForPlaying") }), _jsxs(Box, { sx: styles.buttonsContainer, children: [!props.maxAttemptsReached && (_jsx(Button, { sx: styles.playAgainButton, onClick: props.playAgain, children: _jsxs(Box, { sx: styles.playAgainButtonContent, children: [_jsx(ReplayIcon, { sx: styles.playAgainIcon }), _jsx(Typography, { sx: styles.playAgainText, children: t("classicQuiz.buttons.playAgain") })] }) })), _jsx(Button, { sx: styles.shareButton, onClick: shareResult, children: _jsxs(Box, { sx: styles.shareButtonContent, children: [_jsx("img", { style: styles.shareIcon, src: share, alt: "share-icon" }), _jsx(Typography, { sx: styles.shareText, children: t("classicQuiz.buttons.share") })] }) })] })] }) }), _jsx(Box, { sx: styles.presentedByMobile, children: _jsx(PresentedBy, { brandingLogo: brandingLogo, textColor: brandingColors?.contentColor || textColor }) })] }))] }) }) }), !props.maxAttemptsReached && showLead && (_jsx(Box, { sx: styles.leadCollectionContainer, children: _jsx(Box, { sx: styles.leadContentWrapper, children: _jsx(CollectLead, { sdk: props.sdk, contentType: "quiz", 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 }) }) }))] }) })) : (_jsx(Box, { sx: styles.alertMessageArea, children: _jsx(Box, { sx: styles.alertMessageWrapper, children: _jsx(AlertMessage, { variant: "error", title: t("common.authentication.accessRequired"), message: t("common.authentication.invalidOrMissingAuth") }) }) }))] }));
75
- };
76
- return (_jsx(MainCard, { brandingBorderColor: brandingColors?.borderColor || null, children: props.showAnswerExplanations ? (_jsx(ScoreStateWrapper, { questions: props.classicQuiz.questions, userParticipation: props.summary.answers, brandingColors: props.classicQuiz.branding?.colors, resultsTabPanelSxProps: {
77
- display: "flex",
78
- flexDirection: { xs: "column", md: "row" },
79
- px: 0,
80
- pb: 0,
81
- pt: 0,
82
- }, children: renderMainContent(true) })) : (renderMainContent(false)) }));
83
- };
84
- export default SplitScoreState;