export question types from package
This commit is contained in:
parent
6577b5a604
commit
9b6b89f6cb
@ -3,4 +3,6 @@ import QuizVideo from "./ui_kit/VideoIframe/VideoIframe";
|
||||
|
||||
export type { QuizSettings, QuizConfig } from "@model/settingsData";
|
||||
export type * from "./model/widget";
|
||||
export type * from "@model/questionTypes";
|
||||
|
||||
export { QuizAnswerer, QuizVideo };
|
||||
|
13
lib/model/questionTypes/index.ts
Normal file
13
lib/model/questionTypes/index.ts
Normal file
@ -0,0 +1,13 @@
|
||||
export * from "./date";
|
||||
export * from "./emoji";
|
||||
export * from "./file";
|
||||
export * from "./images";
|
||||
export * from "./number";
|
||||
export * from "./page";
|
||||
export * from "./rating";
|
||||
export * from "./result";
|
||||
export * from "./select";
|
||||
export * from "./shared";
|
||||
export * from "./text";
|
||||
export * from "./variant";
|
||||
export * from "./varimg";
|
@ -1,4 +1,3 @@
|
||||
import { nanoid } from "nanoid";
|
||||
import type { QuizQuestionDate } from "./date";
|
||||
import type { QuizQuestionEmoji } from "./emoji";
|
||||
import type { QuizQuestionFile } from "./file";
|
||||
@ -64,6 +63,7 @@ export type QuestionType =
|
||||
| "result";
|
||||
|
||||
export interface QuizQuestionBase {
|
||||
backendId: number;
|
||||
/** Stable id, generated on client */
|
||||
id: string;
|
||||
quizId: number;
|
||||
@ -109,25 +109,3 @@ type FilterQuestionsWithVariants<T> = T extends {
|
||||
: never;
|
||||
|
||||
export type QuizQuestionsWithVariants = FilterQuestionsWithVariants<AnyTypedQuizQuestion>;
|
||||
|
||||
export const createBranchingRuleMain: (targetId: string, parentId: string) => QuestionBranchingRuleMain = (
|
||||
targetId,
|
||||
parentId
|
||||
) => ({
|
||||
next: targetId,
|
||||
or: false,
|
||||
rules: [
|
||||
{
|
||||
question: parentId,
|
||||
answers: [] as string[],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const createQuestionVariant: () => QuestionVariant = () => ({
|
||||
id: nanoid(),
|
||||
answer: "",
|
||||
extendedText: "",
|
||||
hints: "",
|
||||
originalImageUrl: "",
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@frontend/squzanswerer",
|
||||
"version": "1.0.46",
|
||||
"version": "1.0.47",
|
||||
"type": "module",
|
||||
"main": "./dist-package/index.js",
|
||||
"module": "./dist-package/index.js",
|
||||
|
Loading…
Reference in New Issue
Block a user