mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-06 05:40:02 -06:00
* feat: add consent to questionTypes and types * feat: add default values to consent question * feat: add consent question form * feat: add consent question to preview / link survey * fix: clean consent question html * feat: add consent question to js package * feat: add consent to summary list * fix build errors * fix: remove skip button, add button label input * feat: add checked logic option * fix: add accepted option * update consent form to match new advanced settings layout * remove console.log * hide accepted condition if consent is required * fix build errors * update consent question return values * remove console.log * renamed submitted to clicked in CTA logic, removed submitted condition for consent questions * remove logs display from demo; * remove logs display from demo; --------- Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
74 lines
2.1 KiB
TypeScript
74 lines
2.1 KiB
TypeScript
import { QuestionType, type Question } from "@formbricks/types/questions";
|
|
import OpenTextQuestion from "./OpenTextQuestion";
|
|
import MultipleChoiceSingleQuestion from "./MultipleChoiceSingleQuestion";
|
|
import MultipleChoiceMultiQuestion from "./MultipleChoiceMultiQuestion";
|
|
import NPSQuestion from "./NPSQuestion";
|
|
import CTAQuestion from "./CTAQuestion";
|
|
import RatingQuestion from "./RatingQuestion";
|
|
import ConsentQuestion from "./ConsentQuestion";
|
|
|
|
interface QuestionConditionalProps {
|
|
question: Question;
|
|
onSubmit: (data: { [x: string]: any }) => void;
|
|
lastQuestion: boolean;
|
|
brandColor: string;
|
|
}
|
|
|
|
export default function QuestionConditional({
|
|
question,
|
|
onSubmit,
|
|
lastQuestion,
|
|
brandColor,
|
|
}: QuestionConditionalProps) {
|
|
return question.type === QuestionType.OpenText ? (
|
|
<OpenTextQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : question.type === QuestionType.MultipleChoiceSingle ? (
|
|
<MultipleChoiceSingleQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : question.type === QuestionType.MultipleChoiceMulti ? (
|
|
<MultipleChoiceMultiQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : question.type === QuestionType.NPS ? (
|
|
<NPSQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : question.type === QuestionType.CTA ? (
|
|
<CTAQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : question.type === QuestionType.Rating ? (
|
|
<RatingQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : question.type === "consent" ? (
|
|
<ConsentQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : null;
|
|
}
|