use showfc flag from quiz config

This commit is contained in:
nflnkr 2024-06-02 14:08:09 +03:00
parent dc0e15ebbb
commit b3dfe40563
3 changed files with 24 additions and 19 deletions

@ -229,19 +229,21 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
bottom: 0,
}}
>
{settings.cfg.resultInfo.showResultForm === "before" && !settings.cfg.score && (
<Button
onClick={() => setCurrentQuizStep("contactform")}
variant="contained"
sx={{
p: "10px 20px",
width: "auto",
height: "50px",
}}
>
{resultQuestion.content.hint.text || "Узнать подробнее"}
</Button>
)}
{settings.cfg.resultInfo.showResultForm === "before" &&
settings.cfg.showfc !== false &&
!settings.cfg.score && (
<Button
onClick={() => setCurrentQuizStep("contactform")}
variant="contained"
sx={{
p: "10px 20px",
width: "auto",
height: "50px",
}}
>
{resultQuestion.content.hint.text || "Узнать подробнее"}
</Button>
)}
{settings.cfg.resultInfo.showResultForm === "after" && resultQuestion.content.redirect && (
<Button
onClick={() => {

@ -110,10 +110,10 @@ export interface QuizConfig {
law?: string;
};
meta: string;
antifraud: boolean;
showfc: boolean;
yandexMetricsNumber: number | undefined;
vkMetricsNumber: number | undefined;
antifraud?: boolean;
showfc?: boolean;
yandexMetricsNumber?: number;
vkMetricsNumber?: number;
}
export type FormContactFieldName = "name" | "email" | "phone" | "text" | "address";

@ -130,9 +130,12 @@ export function useQuestionFlowControl() {
if (nextQuestion?.type !== "result") throw new Error("Current question is not result");
setCurrentQuestionId(nextQuestion.id);
if (settings.cfg.resultInfo.showResultForm === "after" || isResultQuestionEmpty(nextQuestion))
if (
settings.cfg.showfc !== false &&
(settings.cfg.resultInfo.showResultForm === "after" || isResultQuestionEmpty(nextQuestion))
)
setCurrentQuizStep("contactform");
}, [nextQuestion, setCurrentQuizStep, settings.cfg.resultInfo.showResultForm]);
}, [nextQuestion, setCurrentQuizStep, settings.cfg.resultInfo.showResultForm, settings.cfg.showfc]);
const showResultAfterContactForm = useCallback(() => {
if (currentQuestion?.type !== "result") throw new Error("Current question is not result");