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.
- package/classic-quiz-play.es.js +4 -4
- package/classic-quiz-play.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/ClassicQuizNotFound.d.ts +2 -1
- package/src/components/ClassicQuizPlay.d.ts +3 -2
- package/src/components/Leads/CollectLead.d.ts +2 -1
- package/src/components/Leads/LeadAgreementCheckbox.d.ts +3 -2
- package/src/components/Leads/LeadForm.d.ts +2 -1
- package/src/components/Shared/Answers/Answers.d.ts +3 -2
- package/src/components/Shared/Answers/Option.d.ts +3 -2
- package/src/components/Shared/Button.d.ts +2 -1
- package/src/components/Shared/MainCard.d.ts +2 -1
- package/src/components/Shared/Pagination.d.ts +3 -2
- package/src/components/Shared/PresentedBy.d.ts +2 -1
- package/src/components/Shared/ScoreStateWrapper.d.ts +4 -3
- package/src/components/Shared/Stepper.d.ts +3 -2
- package/src/components/Shared/Stopwatch.d.ts +2 -1
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.d.ts +3 -2
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.d.ts +3 -2
- package/src/components/Variants/Overlay/OverlayVariant.d.ts +3 -2
- package/src/components/Variants/Overlay/OverlayVariant.styles.d.ts +4 -3
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.d.ts +4 -3
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.d.ts +4 -3
- package/src/components/Variants/Split/AuthError/SplitAuthError.d.ts +3 -2
- package/src/components/Variants/Split/AuthError/SplitAuthError.styles.d.ts +3 -2
- package/src/components/Variants/Split/ScoreState/SplitScoreState.d.ts +4 -3
- package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.d.ts +4 -3
- package/src/components/Variants/Split/SplitVariant.d.ts +3 -2
- package/src/components/Variants/Split/SplitVariant.styles.d.ts +4 -3
- package/src/components/Variants/Standard/AuthError/StandardAuthError.d.ts +3 -2
- package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.d.ts +4 -3
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.d.ts +4 -3
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.d.ts +4 -3
- package/src/components/Variants/Standard/StandardVariant.d.ts +4 -3
- package/src/components/Variants/Standard/StandardVariant.styles.d.ts +4 -3
- package/src/constants/constants.d.ts +2 -1
- package/src/hooks/useClassicQuizById.d.ts +2 -1
- package/src/hooks/useEmbedCodeContainer.d.ts +1 -1
- package/src/hooks/useMyParticipation.d.ts +2 -1
- package/src/hooks/useScoreStateHelpers.d.ts +3 -2
- package/src/index.d.ts +2 -1
- package/src/main.d.ts +3 -2
- package/src/main.d.ts.map +1 -1
- package/src/types/types.d.ts +3 -2
- package/src/components/ClassicQuizNotFound.js +0 -55
- package/src/components/ClassicQuizPlay.js +0 -321
- package/src/components/Leads/CollectLead.js +0 -20
- package/src/components/Leads/LeadAgreementCheckbox.js +0 -45
- package/src/components/Leads/LeadForm.js +0 -289
- package/src/components/Shared/AlertMessage.js +0 -37
- package/src/components/Shared/Answers/Answers.js +0 -31
- package/src/components/Shared/Answers/Option.js +0 -118
- package/src/components/Shared/Button.js +0 -43
- package/src/components/Shared/MainCard.js +0 -24
- package/src/components/Shared/Pagination.js +0 -118
- package/src/components/Shared/PresentedBy.js +0 -51
- package/src/components/Shared/ScoreStateWrapper.js +0 -254
- package/src/components/Shared/Stepper.js +0 -75
- package/src/components/Shared/Stopwatch.js +0 -103
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.js +0 -68
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.js +0 -103
- package/src/components/Variants/Overlay/OverlayVariant.js +0 -100
- package/src/components/Variants/Overlay/OverlayVariant.styles.js +0 -266
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.js +0 -90
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.js +0 -374
- package/src/components/Variants/Split/AuthError/SplitAuthError.js +0 -44
- package/src/components/Variants/Split/AuthError/SplitAuthError.styles.js +0 -95
- package/src/components/Variants/Split/ScoreState/SplitScoreState.js +0 -84
- package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.js +0 -400
- package/src/components/Variants/Split/SplitVariant.js +0 -79
- package/src/components/Variants/Split/SplitVariant.styles.js +0 -216
- package/src/components/Variants/Standard/AuthError/StandardAuthError.js +0 -43
- package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.js +0 -201
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.js +0 -78
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.js +0 -349
- package/src/components/Variants/Standard/StandardVariant.js +0 -82
- package/src/components/Variants/Standard/StandardVariant.styles.js +0 -373
- package/src/constants/constants.js +0 -446
- package/src/hooks/useClassicQuizById.js +0 -20
- package/src/hooks/useEmbedCodeContainer.js +0 -38
- package/src/hooks/useMyParticipation.js +0 -22
- package/src/hooks/useScoreStateHelpers.js +0 -156
- package/src/index.js +0 -2
- package/src/main.js +0 -53
- package/src/services/service.js +0 -1
- package/src/styles/form.styles.js +0 -18
- package/src/types/types.js +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { WidgetTemplate, initializeI18n, } from "@fansunited/common";
|
|
3
|
-
import { useEffect, useMemo, useState } from "react";
|
|
4
|
-
import { useClassicQuizById } from "../hooks/useClassicQuizById";
|
|
5
|
-
import { useMyParticipation } from "../hooks/useMyParticipation";
|
|
6
|
-
import { ClassicQuizUserParticipationModel, } from "fansunited-sdk-esm";
|
|
7
|
-
import Spinner from "@fansunited/common/components/Spinner";
|
|
8
|
-
import OverlayVariant from "./Variants/Overlay/OverlayVariant";
|
|
9
|
-
import StandardVariant from "./Variants/Standard/StandardVariant";
|
|
10
|
-
import SplitVariant from "./Variants/Split/SplitVariant";
|
|
11
|
-
import StandardScoreState from "./Variants/Standard/ScoreState/StandardScoreState";
|
|
12
|
-
import SplitScoreState from "./Variants/Split/ScoreState/SplitScoreState";
|
|
13
|
-
import OverlayScoreState from "./Variants/Overlay/ScoreState/OverlayScoreState";
|
|
14
|
-
import { quizTypes } from "../constants/constants";
|
|
15
|
-
import ClassicQuizNotFound from "./ClassicQuizNotFound";
|
|
16
|
-
import StandardAuthError from "./Variants/Standard/AuthError/StandardAuthError";
|
|
17
|
-
import SplitAuthError from "./Variants/Split/AuthError/SplitAuthError";
|
|
18
|
-
import OverlayAuthError from "./Variants/Overlay/AuthError/OverlayAuthError";
|
|
19
|
-
// Type guard to check if the props are for the STANDARD template
|
|
20
|
-
function isStandardTemplate(props) {
|
|
21
|
-
return props.template === WidgetTemplate.STANDARD;
|
|
22
|
-
}
|
|
23
|
-
const ClassicQuizPlay = (props) => {
|
|
24
|
-
const [currentQuestion, setCurrentQuestion] = useState(1);
|
|
25
|
-
const [selectedOption, setSelectedOption] = useState(null);
|
|
26
|
-
const [showAnswer, setShowAnswer] = useState(false);
|
|
27
|
-
const [questionsParticipation, setQuestionsParticipation] = useState([]);
|
|
28
|
-
const [summary, setSummary] = useState([]);
|
|
29
|
-
// Filters
|
|
30
|
-
const [applyFilterScreen, setApplyFilterScreen] = useState(false);
|
|
31
|
-
// stopwatch states
|
|
32
|
-
const [isStopwatchRunning, setIsStopwatchRunning] = useState(true);
|
|
33
|
-
const [stopwatchTime, setStopwatchTime] = useState(0);
|
|
34
|
-
// const [questionTimes, setQuestionTimes] = useState<number[]>([]);
|
|
35
|
-
// const [totalTime, setTotalTime] = useState<number>(0);
|
|
36
|
-
const classicQuiz = useClassicQuizById(props.entityId, props.sdk);
|
|
37
|
-
const myParticipation = useMyParticipation(props.entityId, props.sdk);
|
|
38
|
-
const maxAttemptsReached = useMemo(() => {
|
|
39
|
-
if (!classicQuiz || !myParticipation)
|
|
40
|
-
return false;
|
|
41
|
-
// Check if the quiz has max attempts set to 1 and if the user has any participation
|
|
42
|
-
return classicQuiz.maxAttempts === 1 && myParticipation.length > 0;
|
|
43
|
-
}, [classicQuiz, myParticipation]);
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
initializeI18n(props.language || "en");
|
|
46
|
-
}, [props.language]);
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
if (classicQuiz && classicQuiz.type) {
|
|
49
|
-
const isLeadBefore = classicQuiz.authRequirement === "LEAD" &&
|
|
50
|
-
props.leads?.position === "before";
|
|
51
|
-
if (!isLeadBefore &&
|
|
52
|
-
quizTypes.includes(classicQuiz.type.toLocaleLowerCase())) {
|
|
53
|
-
setApplyFilterScreen(true);
|
|
54
|
-
}
|
|
55
|
-
if (classicQuiz.type.toLowerCase() === "countdown") {
|
|
56
|
-
setStopwatchTime(classicQuiz.time || 10);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}, [classicQuiz]);
|
|
60
|
-
if (!classicQuiz || !myParticipation) {
|
|
61
|
-
return _jsx(Spinner, { my: 20 });
|
|
62
|
-
}
|
|
63
|
-
if (!classicQuiz.id) {
|
|
64
|
-
return _jsx(ClassicQuizNotFound, {});
|
|
65
|
-
}
|
|
66
|
-
if (myParticipation.length > 0 && !myParticipation[0].classicQuizId) {
|
|
67
|
-
if (isStandardTemplate(props)) {
|
|
68
|
-
return (_jsx(StandardAuthError, { classicQuiz: classicQuiz, imagePosition: props.imagePosition }));
|
|
69
|
-
}
|
|
70
|
-
if (props.template === WidgetTemplate.OVERLAY) {
|
|
71
|
-
return _jsx(OverlayAuthError, { classicQuiz: classicQuiz });
|
|
72
|
-
}
|
|
73
|
-
return _jsx(SplitAuthError, { classicQuiz: classicQuiz });
|
|
74
|
-
}
|
|
75
|
-
if (classicQuiz.authRequirement === "REGISTERED") {
|
|
76
|
-
//TODO: Show Login screen
|
|
77
|
-
}
|
|
78
|
-
const handleNext = async () => {
|
|
79
|
-
const currentQuestionData = classicQuiz.questions[currentQuestion - 1];
|
|
80
|
-
let optionId = null;
|
|
81
|
-
if (selectedOption) {
|
|
82
|
-
optionId = currentQuestionData.options[selectedOption - 1].optionId;
|
|
83
|
-
}
|
|
84
|
-
setShowAnswer(true);
|
|
85
|
-
setIsStopwatchRunning(false);
|
|
86
|
-
const participation = [
|
|
87
|
-
...questionsParticipation,
|
|
88
|
-
{
|
|
89
|
-
questionId: currentQuestionData.questionId,
|
|
90
|
-
optionId,
|
|
91
|
-
},
|
|
92
|
-
];
|
|
93
|
-
//@ts-ignore
|
|
94
|
-
setQuestionsParticipation(participation);
|
|
95
|
-
// Add delay before moving to next question
|
|
96
|
-
setTimeout(() => {
|
|
97
|
-
if (currentQuestion <= classicQuiz.questionsCount) {
|
|
98
|
-
setCurrentQuestion((prev) => prev + 1);
|
|
99
|
-
setSelectedOption(null);
|
|
100
|
-
setShowAnswer(false);
|
|
101
|
-
if (classicQuiz.type &&
|
|
102
|
-
classicQuiz.type.toLowerCase() === "countdown") {
|
|
103
|
-
setStopwatchTime(classicQuiz.time || 10);
|
|
104
|
-
}
|
|
105
|
-
setIsStopwatchRunning(true);
|
|
106
|
-
}
|
|
107
|
-
}, 1500);
|
|
108
|
-
if (currentQuestion === classicQuiz.questionsCount) {
|
|
109
|
-
try {
|
|
110
|
-
await props.sdk.miniGames.participateInClassicQuiz(props.entityId, participation);
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
console.error("Error participating in classic quiz:", error);
|
|
114
|
-
setSummary([new ClassicQuizUserParticipationModel()]);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const summary = await props.sdk.miniGames.getMyClassicQuizParticipations({
|
|
118
|
-
classicQuizIds: [props.entityId],
|
|
119
|
-
});
|
|
120
|
-
setSummary(summary);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
const answerQuestion = (optionId) => {
|
|
124
|
-
setSelectedOption(optionId);
|
|
125
|
-
};
|
|
126
|
-
// Handler for stopwatch updates
|
|
127
|
-
const handleTimeUpdate = (time) => {
|
|
128
|
-
setStopwatchTime(time);
|
|
129
|
-
if (classicQuiz.type &&
|
|
130
|
-
classicQuiz.type.toLocaleLowerCase() === "countdown" &&
|
|
131
|
-
time === 0 &&
|
|
132
|
-
!applyFilterScreen) {
|
|
133
|
-
handleNext();
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
const playAgain = () => {
|
|
137
|
-
setCurrentQuestion(1);
|
|
138
|
-
setSelectedOption(null);
|
|
139
|
-
setShowAnswer(false);
|
|
140
|
-
setQuestionsParticipation([]);
|
|
141
|
-
setSummary([]);
|
|
142
|
-
setIsStopwatchRunning(true);
|
|
143
|
-
if (classicQuiz.type && classicQuiz.type.toLowerCase() === "countdown") {
|
|
144
|
-
setStopwatchTime(classicQuiz.time || 10);
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
setStopwatchTime(0);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
const startPlaying = () => {
|
|
151
|
-
setApplyFilterScreen(false);
|
|
152
|
-
setStopwatchTime(0);
|
|
153
|
-
};
|
|
154
|
-
// Render the main content based on widget template
|
|
155
|
-
const renderContent = () => {
|
|
156
|
-
// const summary = {
|
|
157
|
-
// classicQuizId: "6xQle14gEsUWoSWb2K7v6N",
|
|
158
|
-
// classicQuizModel: {
|
|
159
|
-
// id: "6xQle14gEsUWoSWb2K7v6N",
|
|
160
|
-
// title: "Los Blancos: Champions League Glory",
|
|
161
|
-
// alternativeTitle: null,
|
|
162
|
-
// description:
|
|
163
|
-
// "<p>Test your knowledge of Real Madrid's legendary success in the Champions League! Discover the history, records and magical moments of Europe's most successful club.</p>",
|
|
164
|
-
// type: "timed",
|
|
165
|
-
// images: {
|
|
166
|
-
// main: "https://uploads.fansunitedassets.com/superliga_ro/8be82e6c35dc184f64ca05af79e81184.jpeg",
|
|
167
|
-
// cover: "",
|
|
168
|
-
// mobile: "",
|
|
169
|
-
// },
|
|
170
|
-
// participationCount: 1,
|
|
171
|
-
// questionsCount: 5,
|
|
172
|
-
// status: "ACTIVE",
|
|
173
|
-
// language: "en",
|
|
174
|
-
// authRequirement: "FREE",
|
|
175
|
-
// flags: [],
|
|
176
|
-
// customFields: null,
|
|
177
|
-
// labels: null,
|
|
178
|
-
// branding: {
|
|
179
|
-
// colors: {
|
|
180
|
-
// primaryColor: "#AF8A3B",
|
|
181
|
-
// secondaryColor: "",
|
|
182
|
-
// contentColor: "#AF8A3B",
|
|
183
|
-
// backgroundColor: "#000000",
|
|
184
|
-
// borderColor: "#333333",
|
|
185
|
-
// additionalColor: "",
|
|
186
|
-
// },
|
|
187
|
-
// urls: {
|
|
188
|
-
// primary_url: "",
|
|
189
|
-
// secondary_url: "",
|
|
190
|
-
// privacy_policy_url: "",
|
|
191
|
-
// terms_and_conditions_url: "",
|
|
192
|
-
// additional_url: "",
|
|
193
|
-
// },
|
|
194
|
-
// images: {
|
|
195
|
-
// mainLogo:
|
|
196
|
-
// "https://uploads.fansunitedassets.com/productiontesting1/a24cd1cf44c8839bfbb913fdd7fd9232.png",
|
|
197
|
-
// mobileLogo: "",
|
|
198
|
-
// backgroundImage:
|
|
199
|
-
// "https://uploads.fansunitedassets.com/productiontesting1/f4d3c45079057cfdec75df3aa0f6d93d.jpeg",
|
|
200
|
-
// mobileBackgroundImage:
|
|
201
|
-
// "https://uploads.fansunitedassets.com/productiontesting1/9df8318a99355909dc346198463e48f0.jpeg",
|
|
202
|
-
// additionalImage: "",
|
|
203
|
-
// },
|
|
204
|
-
// },
|
|
205
|
-
// related: [],
|
|
206
|
-
// time: 0,
|
|
207
|
-
// points: 10,
|
|
208
|
-
// scored: true,
|
|
209
|
-
// maxAttempts: 0,
|
|
210
|
-
// averageScore: 2,
|
|
211
|
-
// perfectScore: 0,
|
|
212
|
-
// adContent: null,
|
|
213
|
-
// context: {
|
|
214
|
-
// content: null,
|
|
215
|
-
// tags: [
|
|
216
|
-
// {
|
|
217
|
-
// id: "fb:t:8204",
|
|
218
|
-
// model: null,
|
|
219
|
-
// source: "football",
|
|
220
|
-
// type: "team",
|
|
221
|
-
// },
|
|
222
|
-
// ],
|
|
223
|
-
// campaign: null,
|
|
224
|
-
// },
|
|
225
|
-
// createdAt: "2025-05-29T06:42:40Z",
|
|
226
|
-
// updatedAt: "2025-06-02T11:49:14Z",
|
|
227
|
-
// },
|
|
228
|
-
// correct: 3,
|
|
229
|
-
// classicQuizQuestions: 5,
|
|
230
|
-
// personalBest: 4,
|
|
231
|
-
// points: 40,
|
|
232
|
-
// answers: [
|
|
233
|
-
// {
|
|
234
|
-
// questionId: 1,
|
|
235
|
-
// optionId: 3,
|
|
236
|
-
// correct: true,
|
|
237
|
-
// correctOptionId: null,
|
|
238
|
-
// },
|
|
239
|
-
// {
|
|
240
|
-
// questionId: 2,
|
|
241
|
-
// optionId: 3,
|
|
242
|
-
// correct: true,
|
|
243
|
-
// correctOptionId: null,
|
|
244
|
-
// },
|
|
245
|
-
// {
|
|
246
|
-
// questionId: 3,
|
|
247
|
-
// optionId: 3,
|
|
248
|
-
// correct: false,
|
|
249
|
-
// correctOptionId: null,
|
|
250
|
-
// },
|
|
251
|
-
// {
|
|
252
|
-
// questionId: 4,
|
|
253
|
-
// optionId: 3,
|
|
254
|
-
// correct: true,
|
|
255
|
-
// correctOptionId: null,
|
|
256
|
-
// },
|
|
257
|
-
// {
|
|
258
|
-
// questionId: 5,
|
|
259
|
-
// optionId: 3,
|
|
260
|
-
// correct: false,
|
|
261
|
-
// correctOptionId: null,
|
|
262
|
-
// },
|
|
263
|
-
// ],
|
|
264
|
-
// };
|
|
265
|
-
if (props.template === WidgetTemplate.OVERLAY) {
|
|
266
|
-
return (_jsx(OverlayVariant, { sdk: props.sdk, leads: props.leads, classicQuiz: classicQuiz, question: classicQuiz.questions[currentQuestion - 1], showAnswer: showAnswer, selectedOption: selectedOption, currentQuestion: currentQuestion, answerQuestion: answerQuestion, handleNext: handleNext, isStopwatchRunning: isStopwatchRunning, onTimeUpdate: handleTimeUpdate, stopwatchTime: stopwatchTime, applyFilterScreen: applyFilterScreen, startPlaying: startPlaying }));
|
|
267
|
-
// return (
|
|
268
|
-
// <OverlayScoreState
|
|
269
|
-
// //@ts-ignore
|
|
270
|
-
// summary={summary}
|
|
271
|
-
// totalTime={133}
|
|
272
|
-
// showAnswerExplanations={props.showAnswerExplanations}
|
|
273
|
-
// classicQuiz={classicQuiz}
|
|
274
|
-
// sdk={props.sdk}
|
|
275
|
-
// leads={props.leads}
|
|
276
|
-
// />
|
|
277
|
-
// );
|
|
278
|
-
}
|
|
279
|
-
if (isStandardTemplate(props)) {
|
|
280
|
-
return (_jsx(StandardVariant, { sdk: props.sdk, leads: props.leads, classicQuiz: classicQuiz, question: classicQuiz.questions[currentQuestion - 1], showAnswer: showAnswer, selectedOption: selectedOption, currentQuestion: currentQuestion, answerQuestion: answerQuestion, handleNext: handleNext, imagePosition: props.imagePosition, userParticipation: questionsParticipation, isStopwatchRunning: isStopwatchRunning, onTimeUpdate: handleTimeUpdate, stopwatchTime: stopwatchTime, applyFilterScreen: applyFilterScreen, startPlaying: startPlaying }));
|
|
281
|
-
// return (
|
|
282
|
-
// <StandardScoreState
|
|
283
|
-
// imagePosition={props.imagePosition || "left"}
|
|
284
|
-
// showAnswerExplanations={props.showAnswerExplanations || false}
|
|
285
|
-
// questions={classicQuiz.questions}
|
|
286
|
-
// classicQuiz={classicQuiz}
|
|
287
|
-
// //@ts-ignore
|
|
288
|
-
// summary={summary}
|
|
289
|
-
// totalTime={133}
|
|
290
|
-
// sdk={props.sdk}
|
|
291
|
-
// leads={props.leads}
|
|
292
|
-
// />
|
|
293
|
-
// );
|
|
294
|
-
}
|
|
295
|
-
return (_jsx(SplitVariant, { sdk: props.sdk, leads: props.leads, classicQuiz: classicQuiz, question: classicQuiz.questions[currentQuestion - 1], showAnswer: showAnswer, selectedOption: selectedOption, currentQuestion: currentQuestion, answerQuestion: answerQuestion, handleNext: handleNext, isStopwatchRunning: isStopwatchRunning, onTimeUpdate: handleTimeUpdate, stopwatchTime: stopwatchTime, applyFilterScreen: applyFilterScreen, startPlaying: startPlaying }));
|
|
296
|
-
// return (
|
|
297
|
-
// <SplitScoreState
|
|
298
|
-
// //@ts-ignore
|
|
299
|
-
// summary={summary}
|
|
300
|
-
// totalTime={133}
|
|
301
|
-
// showAnswerExplanations={props.showAnswerExplanations}
|
|
302
|
-
// classicQuiz={classicQuiz}
|
|
303
|
-
// sdk={props.sdk}
|
|
304
|
-
// leads={props.leads}
|
|
305
|
-
// />
|
|
306
|
-
// );
|
|
307
|
-
};
|
|
308
|
-
if ((currentQuestion > classicQuiz.questionsCount && summary.length) ||
|
|
309
|
-
maxAttemptsReached) {
|
|
310
|
-
const summaryInfo = maxAttemptsReached ? myParticipation[0] : summary[0];
|
|
311
|
-
if (props.template === WidgetTemplate.OVERLAY) {
|
|
312
|
-
return (_jsx(OverlayScoreState, { summary: summaryInfo, totalTime: stopwatchTime, showAnswerExplanations: props.showAnswerExplanations || false, classicQuiz: classicQuiz, maxAttemptsReached: maxAttemptsReached, playAgain: playAgain, sdk: props.sdk, leads: props.leads }));
|
|
313
|
-
}
|
|
314
|
-
if (isStandardTemplate(props)) {
|
|
315
|
-
return (_jsx(StandardScoreState, { imagePosition: props.imagePosition || "left", summary: summaryInfo, totalTime: stopwatchTime, showAnswerExplanations: props.showAnswerExplanations || false, classicQuiz: classicQuiz, maxAttemptsReached: maxAttemptsReached, sdk: props.sdk, leads: props.leads, playAgain: playAgain }));
|
|
316
|
-
}
|
|
317
|
-
return (_jsx(SplitScoreState, { summary: summaryInfo, totalTime: stopwatchTime, showAnswerExplanations: props.showAnswerExplanations || false, classicQuiz: classicQuiz, maxAttemptsReached: maxAttemptsReached, playAgain: playAgain, sdk: props.sdk, leads: props.leads }));
|
|
318
|
-
}
|
|
319
|
-
return renderContent();
|
|
320
|
-
};
|
|
321
|
-
export default ClassicQuizPlay;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Stack, Typography } from "@mui/joy";
|
|
3
|
-
import { t } from "i18next";
|
|
4
|
-
import { useColors, useFontFamily } from "@fansunited/common";
|
|
5
|
-
import LeadForm from "./LeadForm";
|
|
6
|
-
const CollectLead = ({ sdk, contentType, contentId, contentName, brandingColors, brandingUrls, campaignId, campaignName, startGame, fields = ["fullName", "email"], leadTitle, leadDescription, leadCta, leadSuccessTitle, leadSuccessDescription, }) => {
|
|
7
|
-
const titleLabel = leadTitle ?? t("leads.header.title");
|
|
8
|
-
const descriptionLabel = leadDescription ?? t("leads.header.description");
|
|
9
|
-
const submitLabel = leadCta ?? t("leads.buttons.submit");
|
|
10
|
-
const leadSuccessTitleLabel = leadSuccessTitle ?? t("leads.success.title");
|
|
11
|
-
const leadSuccessDescriptionLabel = leadSuccessDescription ?? t("leads.success.description");
|
|
12
|
-
const textColor = useColors().textColor;
|
|
13
|
-
const secondaryColor = brandingColors?.secondaryColor || useColors().textColor;
|
|
14
|
-
return (_jsxs(Stack, { spacing: 2, zIndex: 10, width: "100%", children: [_jsxs(Box, { children: [_jsx(Typography, { level: "h4", sx: { fontFamily: useFontFamily().primary, color: textColor }, children: titleLabel }), _jsx(Typography, { level: "body-sm", sx: {
|
|
15
|
-
fontFamily: useFontFamily().primary,
|
|
16
|
-
color: secondaryColor,
|
|
17
|
-
opacity: 0.6,
|
|
18
|
-
}, children: descriptionLabel })] }), _jsx(LeadForm, { sdk: sdk, brandingColors: brandingColors, brandingUrls: brandingUrls, campaignId: campaignId, campaignName: campaignName, contentName: contentName, contentType: contentType, contentId: contentId, startGame: startGame, fields: fields, submitButtonCta: submitLabel, leadSuccessTitle: leadSuccessTitleLabel, leadSuccessDescription: leadSuccessDescriptionLabel })] }));
|
|
19
|
-
};
|
|
20
|
-
export default CollectLead;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Checkbox, FormControl, Link, Typography } from "@mui/joy";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
const LeadAgreementCheckbox = (props) => {
|
|
5
|
-
const { t } = useTranslation();
|
|
6
|
-
const displayLabel = () => {
|
|
7
|
-
if (privacyPolicyUrl && !termsAndConditionsUrl) {
|
|
8
|
-
return (_jsxs(Typography, { children: [t("common.labels.iAgreeToThe"), " ", _jsx(Link, { href: privacyPolicyUrl, target: "_blank", rel: "noopener noreferrer", sx: {
|
|
9
|
-
color: props.primaryColor,
|
|
10
|
-
textDecorationColor: props.primaryColor,
|
|
11
|
-
}, children: t("leads.form.privacyPolicy") })] }));
|
|
12
|
-
}
|
|
13
|
-
if (!privacyPolicyUrl && termsAndConditionsUrl) {
|
|
14
|
-
return (_jsxs(Typography, { children: [t("common.labels.iAgreeToThe"), " ", _jsx(Link, { href: termsAndConditionsUrl, target: "_blank", rel: "noopener noreferrer", sx: {
|
|
15
|
-
color: props.primaryColor,
|
|
16
|
-
textDecorationColor: props.primaryColor,
|
|
17
|
-
}, children: t("leads.form.termsAndConditions") })] }));
|
|
18
|
-
}
|
|
19
|
-
return (_jsxs(Typography, { children: [t("common.labels.iAgreeToThe"), " ", _jsx(Link, { href: privacyPolicyUrl, target: "_blank", rel: "noopener noreferrer", sx: {
|
|
20
|
-
color: props.primaryColor,
|
|
21
|
-
textDecorationColor: props.primaryColor,
|
|
22
|
-
}, children: t("leads.form.privacyPolicy") }), " ", t("common.labels.andThe"), " ", _jsx(Link, { href: termsAndConditionsUrl, target: "_blank", rel: "noopener noreferrer", sx: {
|
|
23
|
-
color: props.primaryColor,
|
|
24
|
-
textDecorationColor: props.primaryColor,
|
|
25
|
-
}, children: t("leads.form.termsAndConditions") })] }));
|
|
26
|
-
};
|
|
27
|
-
if (!props.brandingUrls) {
|
|
28
|
-
return _jsx(_Fragment, {});
|
|
29
|
-
}
|
|
30
|
-
const { privacyPolicyUrl, termsAndConditionsUrl } = props.brandingUrls;
|
|
31
|
-
if (!privacyPolicyUrl && !termsAndConditionsUrl) {
|
|
32
|
-
return _jsx(_Fragment, {});
|
|
33
|
-
}
|
|
34
|
-
return (_jsx(FormControl, { required: true, disabled: props.isDisabled, size: "sm", children: _jsxs(Box, { sx: { display: "inline-flex", alignItems: "center", gap: "8px" }, children: [_jsx(Checkbox, { slotProps: {
|
|
35
|
-
checkbox: {
|
|
36
|
-
sx: {
|
|
37
|
-
"&.Mui-checked": {
|
|
38
|
-
bgcolor: props.primaryColor,
|
|
39
|
-
"--Icon-color": "#FFF",
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
} }), displayLabel()] }) }));
|
|
44
|
-
};
|
|
45
|
-
export default LeadAgreementCheckbox;
|