frontAnswerer/lib/model/settingsData.ts
2024-05-10 13:15:53 +03:00

141 lines
2.8 KiB
TypeScript

import {AnyTypedQuizQuestion} from "./questionTypes/shared";
export type QuizStartpageType = "standard" | "expanded" | "centered" | null;
export type QuizStartpageAlignType = "left" | "right" | "center";
export type QuizType = "quiz" | "form" | null;
export type QuizResultsType = true | null;
export type QuizStep = "startpage" | "question" | "contactform";
export type QuizTheme =
| "StandardTheme"
| "StandardDarkTheme"
| "PinkTheme"
| "PinkDarkTheme"
| "BlackWhiteTheme"
| "OliveTheme"
| "YellowTheme"
| "GoldDarkTheme"
| "PurpleTheme"
| "BlueTheme"
| "BlueDarkTheme"
| "Design1"
| "Design2"
| "Design3"
| "Design4"
| "Design5"
| "Design6"
| "Design7"
| "Design8"
| "Design9"
| "Design10";
export type FCField = {
text: string;
innerText: string;
key: string;
required: boolean;
used: boolean;
};
export type QuizSettingsConfig = {
fp: boolean;
rep: boolean;
name: string;
lim: number;
due: number;
delay: number;
pausable: boolean;
cfg: QuizConfig;
}
export type QuizSettings = {
questions: AnyTypedQuizQuestion[];
settings: QuizSettingsConfig;
cnt: number;
recentlyCompleted: boolean;
show_badge: boolean;
};
export interface QuizConfig {
spec: undefined | true;
type: QuizType;
noStartPage: boolean;
startpageType: QuizStartpageType;
score?: boolean;
results: QuizResultsType;
haveRoot: string | null;
theme: QuizTheme;
design: boolean;
resultInfo: {
when: "email" | "";
share: boolean;
replay: boolean;
theme: string;
reply: string;
replname: string;
showResultForm: "before" | "after";
};
startpage: {
description: string;
button: string;
position: QuizStartpageAlignType;
favIcon: string | null;
logo: string | null;
originalLogo: string | null;
background: {
type: null | "image" | "video";
desktop: string | null;
originalDesktop: string | null;
mobile: string | null;
originalMobile: string | null;
video: string | null;
cycle: boolean;
};
};
formContact: {
title: string;
desc: string;
fields: Record<FormContactFieldName, FormContactFieldData>;
button: string;
};
info: {
phonenumber: string;
clickable: boolean;
orgname: string;
site: string;
law?: string;
};
meta: string;
yandexMetricsNumber: number | undefined;
vkMetricsNumber: number | undefined;
}
export type FormContactFieldName =
| "name"
| "email"
| "phone"
| "text"
| "address";
export type FormContactFieldData = {
text: string;
innerText: string;
key: string;
required: boolean;
used: boolean;
};
export interface QuizItems {
description: string;
id: number;
page: number;
required: boolean;
title: string;
type: string;
content: unknown;
}