@thanh01.pmt/interactive-quiz-kit 1.0.23 → 1.0.25

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.
@@ -0,0 +1,444 @@
1
+ import { f as QuizQuestion, r as QuizConfig, Q as QuestionTypeStrings, p as SCORMSettings } from './quiz-config-1gNNhljP.js';
2
+ export { B as BaseQuestion, d as BlocklyProgrammingQuestion, C as CodingQuestion, D as DragAndDropQuestion, k as DraggableItem, l as DropZone, F as FillInTheBlanksQuestion, m as HotspotArea, H as HotspotQuestion, j as MatchOptionItem, i as MatchPromptItem, c as MatchingQuestion, M as MultipleChoiceQuestion, a as MultipleResponseQuestion, N as NumericQuestion, g as QuestionOption, q as QuizSettings, R as RichContentString, e as ScratchProgrammingQuestion, h as SequenceItem, b as SequenceQuestion, S as ShortAnswerQuestion, o as SupportedCodingLanguage, n as TestCase, T as TrueFalseQuestion } from './quiz-config-1gNNhljP.js';
3
+ import { Q as QuizResultType, U as UserAnswerType, I as ImportError, y as Goal, n as PracticeSession, h as QuizReviewContent, p as PracticeSessionSummary, o as PracticeStats, j as AchievementDefinition, i as Achievement, K as KnowledgeCard } from './ai-ecosystem-BJ5RR5Ys.js';
4
+ export { r as ActivityCalendarData, u as AnalysisReport, A as AnswerDetail, x as ChatContext, C as ChatMessage, v as DashboardCardConfig, D as DashboardCardId, w as DashboardLayout, G as GoalType, t as ImageContextItem, L as LearningAnalysis, e as PerformanceByBloomLevel, b as PerformanceByCategory, d as PerformanceByDifficulty, P as PerformanceByLearningObjective, c as PerformanceByTopic, f as PerformanceMetric, s as PerformanceSummary, k as PracticeDifficulty, m as PracticeSuggestion, l as PracticeSuggestionTopic, q as PracticeTopicSummary, g as QuestionReview, R as RoadmapItem, T as TestCaseResult, a as UserAnswers, W as WeeklyRoadmap } from './ai-ecosystem-BJ5RR5Ys.js';
5
+ import { ClassValue } from 'clsx';
6
+
7
+ interface CodeNamedEntity {
8
+ id: string;
9
+ code: string;
10
+ name: string;
11
+ description?: string;
12
+ }
13
+ interface Subject extends CodeNamedEntity {
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ }
17
+ interface GradeLevel extends CodeNamedEntity {
18
+ }
19
+ interface BloomLevelType extends CodeNamedEntity {
20
+ }
21
+ interface QuestionTypeType extends CodeNamedEntity {
22
+ }
23
+ interface Category extends CodeNamedEntity {
24
+ }
25
+ interface Context extends CodeNamedEntity {
26
+ }
27
+ interface Topic extends CodeNamedEntity {
28
+ subjectCode: string;
29
+ }
30
+ type BloomLevelName = "Remembering" | "Understanding" | "Applying" | "Analyzing" | "Evaluating" | "Creating";
31
+ type StandardDifficulty = "easy" | "medium" | "hard";
32
+ type KnowledgeDimension = "Factual" | "Conceptual" | "Procedural";
33
+ type ApproachTableRawDifficulty = "E" | "M" | "H" | "E~M" | "M~H";
34
+ interface Approach extends CodeNamedEntity {
35
+ verbEn: string;
36
+ verbVi: string;
37
+ bloomLevelCode: string;
38
+ knowledgeDimension: KnowledgeDimension;
39
+ iSpringQuizType: string;
40
+ rawDifficulty: ApproachTableRawDifficulty;
41
+ difficulty: StandardDifficulty;
42
+ suggestContext?: string;
43
+ exampleEn?: string;
44
+ exampleVi?: string;
45
+ }
46
+ interface LearningObjectiveMetadata extends CodeNamedEntity {
47
+ subjectCode?: string;
48
+ }
49
+
50
+ /**
51
+ * Represents the structure of a question as stored within the Question Bank.
52
+ * It combines the rich, flexible configuration from IQ-Kit's QuizQuestion
53
+ * with the structured metadata needed for management and filtering, inspired by QMS.
54
+ */
55
+ interface QuestionInBank {
56
+ id: string;
57
+ code: string;
58
+ text: string;
59
+ lastModified: string;
60
+ questionTypeCode: string;
61
+ subjectCode: string;
62
+ topicCode: string;
63
+ gradeLevelCode: string;
64
+ bloomLevelCode: string;
65
+ difficulty?: StandardDifficulty;
66
+ approachCode?: string;
67
+ learningObjectiveCode?: string;
68
+ contextCode?: string;
69
+ categoryCode?: string;
70
+ gradeBand?: string;
71
+ course?: string;
72
+ createdAt?: string;
73
+ questionConfig: QuizQuestion;
74
+ }
75
+
76
+ interface LearningObjective {
77
+ loId: string;
78
+ loDescription: string;
79
+ subject: string;
80
+ category: string;
81
+ topic: string;
82
+ keywords: string[];
83
+ grade: string;
84
+ stemElements: string[];
85
+ bloomLevelsGuideline: string[];
86
+ }
87
+
88
+ interface QuizEngineCallbacks {
89
+ onQuizStart?: (initialData: {
90
+ initialQuestion: QuizQuestion | null;
91
+ currentQuestionNumber: number;
92
+ totalQuestions: number;
93
+ timeLimitInSeconds: number | null;
94
+ scormStatus?: QuizResultType['scormStatus'];
95
+ studentName?: string;
96
+ }) => void;
97
+ onQuestionChange?: (question: QuizQuestion | null, currentQuestionNumber: number, totalQuestions: number) => void;
98
+ onAnswerSubmit?: (question: QuizQuestion, userAnswer: UserAnswerType) => void;
99
+ onQuizFinish?: (results: QuizResultType) => void;
100
+ onTimeTick?: (timeLeftInSeconds: number) => void;
101
+ onQuizTimeUp?: () => void;
102
+ }
103
+ interface QuizEngineConstructorOptions {
104
+ config: QuizConfig;
105
+ callbacks?: QuizEngineCallbacks;
106
+ }
107
+
108
+ declare class QuizEngine {
109
+ private config;
110
+ private userAnswers;
111
+ private currentQuestionIndex;
112
+ questions: QuizQuestion[];
113
+ private callbacks;
114
+ private timerId;
115
+ private timeLeftInSeconds;
116
+ private scormService;
117
+ private quizResultState;
118
+ private overallStartTime;
119
+ private questionStartTime;
120
+ private questionTimings;
121
+ private evaluators;
122
+ constructor(options: QuizEngineConstructorOptions);
123
+ private registerEvaluators;
124
+ private _recordCurrentQuestionTime;
125
+ private startTimer;
126
+ private stopTimer;
127
+ private handleTick;
128
+ getTimeLeftInSeconds(): number | null;
129
+ getCurrentQuestion(): QuizQuestion | null;
130
+ getCurrentQuestionNumber(): number;
131
+ getTotalQuestions(): number;
132
+ getUserAnswer(questionId: string): UserAnswerType | undefined;
133
+ isQuizFinished(): boolean;
134
+ submitAnswer(questionId: string, answer: UserAnswerType): void;
135
+ nextQuestion(): QuizQuestion | null;
136
+ previousQuestion(): QuizQuestion | null;
137
+ goToQuestion(index: number): QuizQuestion | null;
138
+ getElapsedTime(): number;
139
+ destroy(): void;
140
+ calculateResults(): Promise<QuizResultType>;
141
+ private formatUserAnswerDetail;
142
+ private _calculateMetadataPerformance;
143
+ private _sendResultsToWebhook;
144
+ private _sendResultsToSCORM;
145
+ }
146
+
147
+ /**
148
+ * A service class to manage and manipulate a QuizConfig object in a headless way.
149
+ * This class operates on a deep copy of the initial quiz config to prevent side effects.
150
+ */
151
+ declare class QuizEditorService {
152
+ private quiz;
153
+ constructor(initialQuiz: QuizConfig);
154
+ getQuiz(): QuizConfig;
155
+ static createNewQuestionTemplate(type: QuestionTypeStrings): QuizQuestion;
156
+ addQuestion(question: QuizQuestion): QuizConfig;
157
+ updateQuestion(updatedQuestion: QuizQuestion): QuizConfig;
158
+ deleteQuestionByIndex(index: number): QuizConfig;
159
+ moveQuestion(fromIndex: number, toIndex: number): QuizConfig;
160
+ }
161
+
162
+ /**
163
+ * Provides static methods for importing questions from JSON and TSV formats.
164
+ */
165
+ declare class QuestionImportService {
166
+ static processJSON(jsonString: string): {
167
+ validQuestions: QuizQuestion[];
168
+ errors: ImportError[];
169
+ };
170
+ static processTSV(tsvString: string): {
171
+ validQuestions: QuizQuestion[];
172
+ errors: ImportError[];
173
+ };
174
+ private static processRawObjects;
175
+ private static transformTsvRowToRawObject;
176
+ private static createQuestionFromRawObject;
177
+ }
178
+
179
+ declare const GEMINI_API_KEY_SERVICE_NAME = "gemini";
180
+ declare class APIKeyService {
181
+ private static getStorageKey;
182
+ /**
183
+ * Saves an API key to localStorage. The key is mildly obfuscated using Base64.
184
+ * @param serviceName - The name of the service (e.g., 'gemini').
185
+ * @param apiKey - The API key to save.
186
+ */
187
+ static saveAPIKey(serviceName: string, apiKey: string): void;
188
+ /**
189
+ * Retrieves an API key from localStorage.
190
+ * @param serviceName - The name of the service.
191
+ * @returns The decoded API key, or null if not found or if localStorage is unavailable.
192
+ */
193
+ static getAPIKey(serviceName: string): string | null;
194
+ /**
195
+ * Removes an API key from localStorage.
196
+ * @param serviceName - The name of the service.
197
+ */
198
+ static removeAPIKey(serviceName: string): void;
199
+ /**
200
+ * Checks if an API key exists in localStorage for the given service.
201
+ * @param serviceName - The name of the service.
202
+ * @returns True if a key exists, false otherwise.
203
+ */
204
+ static hasAPIKey(serviceName: string): boolean;
205
+ }
206
+
207
+ /**
208
+ * A headless, static service for managing user-specific configurations
209
+ * stored in the browser's localStorage.
210
+ */
211
+ declare class UserConfigService {
212
+ private static getStorageKey;
213
+ static setConfig(key: string, value: any): void;
214
+ static getConfig<T>(key: string, defaultValue?: T | null): T | null;
215
+ static removeConfig(key: string): void;
216
+ static getFullName(): string | null;
217
+ static setFullName(name: string): void;
218
+ static getWeeklyGoal(): number | null;
219
+ static setWeeklyGoal(goal: number): void;
220
+ static getLanguage(): string;
221
+ static setLanguage(language: string): void;
222
+ static getGoals(): Goal[];
223
+ static saveGoals(goals: Goal[]): void;
224
+ /**
225
+ * Adds a new goal to the user's list. The goal object should not contain a description.
226
+ * @param newGoal A partial Goal object without id, description, isAchieved, or achievedAt.
227
+ */
228
+ static addGoal(newGoal: Omit<Goal, 'id' | 'isAchieved' | 'achievedAt'>): void;
229
+ static updateGoal(updatedGoal: Goal): void;
230
+ static deleteGoal(goalId: string): void;
231
+ }
232
+
233
+ declare class PracticeHistoryService {
234
+ static getPracticeHistory(): PracticeSession[];
235
+ private static saveHistory;
236
+ static saveCompletedPracticeSession(quizConfig: QuizConfig, result: QuizResultType, review?: QuizReviewContent | null): string;
237
+ static updatePracticeReview(sessionId: string, review: QuizReviewContent): void;
238
+ static getPracticeSessionById(sessionId: string): PracticeSession | null;
239
+ static getPracticeHistorySummary(): PracticeSessionSummary[];
240
+ static getPracticeStats(): PracticeStats;
241
+ static clearHistory(): void;
242
+ }
243
+
244
+ declare class AchievementService {
245
+ static getUnlockedAchievementsMap(): Record<string, number>;
246
+ private static saveUnlockedAchievementsMap;
247
+ static checkAndUnlockAchievements(history: PracticeSession[], stats: PracticeStats): AchievementDefinition[];
248
+ static getAllAchievementDefinitions(): AchievementDefinition[];
249
+ static getAllAchievementsWithStatus(): Achievement[];
250
+ }
251
+
252
+ interface Quote {
253
+ text: string;
254
+ author: string;
255
+ }
256
+ /**
257
+ * A headless, static service for providing motivational quotes.
258
+ */
259
+ declare class QuoteService {
260
+ /**
261
+ * Retrieves a random quote from the internal quote bank.
262
+ * @returns A quote object containing text and author.
263
+ */
264
+ static getRandomQuote(): Quote;
265
+ }
266
+
267
+ interface KnowledgeCardStore {
268
+ sourceHash: string | null;
269
+ conceptsPlan: string[];
270
+ generatedConcepts: Record<string, boolean>;
271
+ cards: KnowledgeCard[];
272
+ }
273
+ /**
274
+ * A headless, static service for managing Knowledge Cards (Cheatsheet/Flashcards)
275
+ * stored in the browser's localStorage, with support for a resumable generation queue.
276
+ */
277
+ declare class KnowledgeCardService {
278
+ static generateHash(str: string): string;
279
+ static getStore(): KnowledgeCardStore;
280
+ private static saveStore;
281
+ static getSourceHash(): string | null;
282
+ /**
283
+ * Saves a new card generation plan. This clears old cards and resets the generation progress.
284
+ * @param sourceHash The hash of the new source content.
285
+ * @param concepts An array of concept strings to be generated.
286
+ */
287
+ static saveCardPlan(sourceHash: string, concepts: string[]): void;
288
+ /**
289
+ * Saves a newly generated card to the store and marks its concept as completed.
290
+ * @param card The KnowledgeCard object to save.
291
+ */
292
+ static saveGeneratedCard(card: KnowledgeCard): void;
293
+ /**
294
+ * Gets the list of concepts that are in the plan but have not been generated yet.
295
+ * @returns An array of concept strings that are pending generation.
296
+ */
297
+ static getPendingConcepts(): string[];
298
+ /**
299
+ * Gets the current status of the card generation process.
300
+ * @returns An object with the total number of cards planned and the number completed.
301
+ */
302
+ static getGenerationStatus(): {
303
+ total: number;
304
+ completed: number;
305
+ };
306
+ /**
307
+ * Checks if a generation process is currently marked as running in this browser tab/session.
308
+ * Uses sessionStorage to prevent multiple tabs from running the same process.
309
+ * @returns True if a process is marked as running, false otherwise.
310
+ */
311
+ static isGenerationInProgress(): boolean;
312
+ /**
313
+ * Sets or clears the flag indicating that a generation process is active.
314
+ * @param status The status to set (true for running, false for stopped).
315
+ */
316
+ static setGenerationStatus(status: boolean): void;
317
+ static getCards(): KnowledgeCard[];
318
+ static getRandomCard(): KnowledgeCard | null;
319
+ static searchCards(query: string): KnowledgeCard[];
320
+ }
321
+
322
+ declare class MetadataService {
323
+ static getSubjects: () => Subject[];
324
+ static addSubject: (name: string, code: string) => Subject;
325
+ static updateSubject: (id: string, name: string, code: string) => Subject | null;
326
+ static deleteSubject: (code: string) => boolean;
327
+ static getGradeLevels: () => GradeLevel[];
328
+ static addGradeLevel: (name: string, code: string) => GradeLevel;
329
+ static updateGradeLevel: (id: string, name: string, code: string) => GradeLevel | null;
330
+ static deleteGradeLevel: (code: string) => boolean;
331
+ static getTopics: (subjectCode?: string) => Topic[];
332
+ static addTopic: (name: string, code: string, subjectCode: string) => Topic;
333
+ static updateTopic: (id: string, name: string, code: string, subjectCode: string) => Topic | null;
334
+ static deleteTopic: (code: string) => boolean;
335
+ static getBloomLevels: () => BloomLevelType[];
336
+ static addBloomLevel: (name: string, code: string, description?: string) => BloomLevelType;
337
+ static updateBloomLevel: (id: string, name: string, code: string, description?: string) => BloomLevelType | null;
338
+ static deleteBloomLevel: (code: string) => boolean;
339
+ static getQuestionTypes: () => QuestionTypeType[];
340
+ static addQuestionType: (name: string, code: string, description?: string) => QuestionTypeType;
341
+ static updateQuestionType: (id: string, name: string, code: string, description?: string) => QuestionTypeType | null;
342
+ static deleteQuestionType: (code: string) => boolean;
343
+ static getCategories: () => Category[];
344
+ static addCategory: (name: string, code: string, description?: string) => Category;
345
+ static updateCategory: (id: string, name: string, code: string, description?: string) => Category | null;
346
+ static deleteCategory: (code: string) => boolean;
347
+ static getContexts: () => Context[];
348
+ static addContext: (name: string, code: string, description?: string) => Context;
349
+ static updateContext: (id: string, name: string, code: string, description?: string) => Context | null;
350
+ static deleteContext: (code: string) => boolean;
351
+ static getApproaches: () => Approach[];
352
+ static addApproach: (approachData: Omit<Approach, "id" | "difficulty">) => Approach;
353
+ static updateApproach: (id: string, approachData: Partial<Omit<Approach, "id" | "difficulty">>) => Approach | null;
354
+ static deleteApproach: (code: string) => boolean;
355
+ static getLearningObjectives: (subjectCode?: string) => LearningObjectiveMetadata[];
356
+ static addLearningObjective: (name: string, code: string, subjectCode?: string, description?: string) => LearningObjectiveMetadata;
357
+ static updateLearningObjective: (id: string, name: string, code: string, subjectCode?: string, description?: string) => LearningObjectiveMetadata | null;
358
+ static deleteLearningObjective: (code: string) => boolean;
359
+ }
360
+
361
+ interface QuestionFilters {
362
+ subjectCode?: string;
363
+ topicCode?: string;
364
+ gradeLevelCode?: string;
365
+ bloomLevelCode?: string;
366
+ questionTypeCode?: string;
367
+ searchTerm?: string;
368
+ difficulty?: StandardDifficulty;
369
+ }
370
+ declare class QuestionBankService {
371
+ static getQuestions(filters?: QuestionFilters): QuestionInBank[];
372
+ static getQuestionByCode(code: string): QuestionInBank | undefined;
373
+ static addQuestion(questionData: Omit<QuestionInBank, 'id' | 'lastModified'>): QuestionInBank;
374
+ static updateQuestion(id: string, updates: Partial<Omit<QuestionInBank, 'id'>>): QuestionInBank | null;
375
+ static deleteQuestionByCode(code: string): boolean;
376
+ }
377
+
378
+ declare const generateLauncherHTML: (quizConfig: QuizConfig, libraryJSPath: string, quizDataPath: string, blocklyCSSPath: string, mainCSSPath: string, title?: string) => string;
379
+
380
+ declare const generateSCORMManifest: (quizConfig: QuizConfig, scormVersion: "1.2" | "2004", // Explicitly take version
381
+ launcherFile?: string, libraryJSPath?: string, quizDataPath?: string, blocklyCSSPath?: string, mainCSSPath?: string) => string;
382
+
383
+ interface SCORMExportOptions {
384
+ scormVersion: "1.2" | "2004";
385
+ }
386
+ declare const exportQuizAsSCORMZip: (quiz: QuizConfig, options: SCORMExportOptions) => Promise<{
387
+ success: boolean;
388
+ error?: string;
389
+ fileName?: string;
390
+ }>;
391
+
392
+ declare class SCORMService {
393
+ private scormAPI;
394
+ private scormVersionFound;
395
+ private settings;
396
+ private isInitialized;
397
+ private isTerminated;
398
+ studentName: string | null;
399
+ constructor(settings: SCORMSettings);
400
+ private _findAPIRecursive;
401
+ private _findAPI;
402
+ hasAPI(): boolean;
403
+ getSCORMVersion(): "1.2" | "2004" | null;
404
+ initialize(): {
405
+ success: boolean;
406
+ error?: string;
407
+ studentName?: string;
408
+ };
409
+ terminate(): {
410
+ success: boolean;
411
+ error?: string;
412
+ };
413
+ setValue(element: string, value: string | number | boolean): {
414
+ success: boolean;
415
+ error?: string;
416
+ };
417
+ getValue(element: string): string | null;
418
+ commit(): {
419
+ success: boolean;
420
+ error?: string;
421
+ };
422
+ setScore(rawScore: number, maxScore: number, minScore?: number): void;
423
+ setLessonStatus(status: 'passed' | 'failed' | 'completed' | 'incomplete' | 'browsed', passed?: boolean): void;
424
+ getLastError(): {
425
+ code: string;
426
+ message: string;
427
+ diagnostic?: string;
428
+ };
429
+ formatCMITime(totalSeconds: number): string;
430
+ }
431
+
432
+ declare const sampleQuiz: QuizConfig;
433
+ declare const emptyQuiz: QuizConfig;
434
+
435
+ /**
436
+ * Generates a simple unique ID.
437
+ * @param prefix Optional prefix for the ID.
438
+ * @returns A string representing the unique ID.
439
+ */
440
+ declare function generateUniqueId(prefix?: string): string;
441
+
442
+ declare function cn(...inputs: ClassValue[]): string;
443
+
444
+ export { APIKeyService, Achievement, AchievementDefinition, AchievementService, type Approach, type ApproachTableRawDifficulty, type BloomLevelName, type BloomLevelType, type Category, type CodeNamedEntity, type Context, GEMINI_API_KEY_SERVICE_NAME, Goal, type GradeLevel, ImportError, KnowledgeCard, KnowledgeCardService, type KnowledgeDimension, type LearningObjective, type LearningObjectiveMetadata, MetadataService, PracticeHistoryService, PracticeSession, PracticeSessionSummary, PracticeStats, QuestionBankService, type QuestionFilters, QuestionImportService, type QuestionInBank, QuestionTypeStrings, type QuestionTypeType, QuizConfig, QuizEditorService, QuizEngine, type QuizEngineCallbacks, type QuizEngineConstructorOptions, QuizQuestion, QuizResultType, QuizReviewContent, QuoteService, SCORMService, SCORMSettings, type StandardDifficulty, type Subject, type Topic, UserAnswerType, UserConfigService, cn, emptyQuiz, exportQuizAsSCORMZip, generateLauncherHTML, generateSCORMManifest, generateUniqueId, sampleQuiz };