@schoolio/player 1.2.2 → 1.4.0

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.
package/dist/index.d.mts CHANGED
@@ -59,6 +59,10 @@ interface ExternalQuizAttempt {
59
59
  completedAt?: string;
60
60
  timeSpentSeconds?: number;
61
61
  }
62
+ interface GenerateMoreQuestionsResult {
63
+ extraQuestions: QuizQuestion[];
64
+ questionsGenerated: number;
65
+ }
62
66
  interface QuizPlayerProps {
63
67
  quizId: string;
64
68
  lessonId: string;
@@ -71,8 +75,10 @@ interface QuizPlayerProps {
71
75
  onComplete?: (result: QuizResult) => void;
72
76
  onError?: (error: Error) => void;
73
77
  onProgress?: (progress: QuizProgress) => void;
78
+ onGenerateMoreQuestions?: (attemptId: string, currentTotal: number) => Promise<GenerateMoreQuestionsResult>;
74
79
  className?: string;
75
80
  styles?: QuizPlayerStyles;
81
+ forceNewAttempt?: boolean;
76
82
  }
77
83
  interface QuizResult {
78
84
  attemptId: string;
@@ -103,11 +109,71 @@ interface AttemptViewerProps {
103
109
  showExplanations?: boolean;
104
110
  title?: string;
105
111
  }
112
+ type SkipReason = "question_issue" | "dont_know";
113
+ interface SkipQuestionPayload {
114
+ questionId: string;
115
+ questionContent: QuizQuestion;
116
+ skipReason: SkipReason;
117
+ skipComment?: string;
118
+ quizId?: string;
119
+ attemptId?: string;
120
+ childId: string;
121
+ parentId: string;
122
+ lessonId?: string;
123
+ courseId?: string;
124
+ assignLessonId?: string;
125
+ }
126
+ interface ReportQuestionPayload {
127
+ questionId: string;
128
+ questionContent: QuizQuestion;
129
+ reportComment: string;
130
+ quizId?: string;
131
+ attemptId?: string;
132
+ childId: string;
133
+ parentId: string;
134
+ lessonId?: string;
135
+ courseId?: string;
136
+ assignLessonId?: string;
137
+ }
138
+ interface ChatMessage {
139
+ role: 'user' | 'assistant';
140
+ content: string;
141
+ timestamp: string;
142
+ }
143
+ interface StarterPrompt {
144
+ id: string;
145
+ label: string;
146
+ message: string;
147
+ }
148
+ interface ChatSession {
149
+ chatId: string;
150
+ messages: ChatMessage[];
151
+ starterPrompts: StarterPrompt[];
152
+ }
153
+ interface ChatMessageResponse {
154
+ userMessage: ChatMessage;
155
+ assistantMessage: ChatMessage;
156
+ }
157
+ interface QuestionContextForChat {
158
+ id: string;
159
+ question: string;
160
+ type: string;
161
+ options?: string[];
162
+ correctAnswer?: string | string[];
163
+ explanation?: string;
164
+ }
106
165
 
107
- declare function QuizPlayer({ quizId, lessonId, assignLessonId, courseId, childId, parentId, apiBaseUrl, authToken, onComplete, onError, onProgress, className, }: QuizPlayerProps): react_jsx_runtime.JSX.Element;
166
+ declare function QuizPlayer({ quizId, lessonId, assignLessonId, courseId, childId, parentId, apiBaseUrl, authToken, onComplete, onError, onProgress, onGenerateMoreQuestions, className, forceNewAttempt, }: QuizPlayerProps): react_jsx_runtime.JSX.Element;
108
167
 
109
168
  declare function AttemptViewer({ attemptId, apiBaseUrl, authToken, onError, className, showExplanations, title, }: AttemptViewerProps): react_jsx_runtime.JSX.Element;
110
169
 
170
+ interface TextToSpeechProps {
171
+ text: string;
172
+ inline?: boolean;
173
+ size?: 'sm' | 'md';
174
+ }
175
+ declare function TextToSpeech({ text, inline, size }: TextToSpeechProps): react_jsx_runtime.JSX.Element;
176
+
111
177
  interface ApiClientConfig {
112
178
  baseUrl: string;
113
179
  authToken?: string;
@@ -125,12 +191,14 @@ declare class QuizApiClient {
125
191
  courseId: string;
126
192
  childId: string;
127
193
  parentId: string;
194
+ forceNew?: boolean;
128
195
  }): Promise<ExternalQuizAttempt>;
129
196
  updateAttempt(attemptId: string, data: {
130
197
  answers?: QuizAnswerDetail[];
131
198
  status?: 'in_progress' | 'completed' | 'abandoned';
132
199
  score?: number;
133
200
  correctAnswers?: number;
201
+ totalQuestions?: number;
134
202
  timeSpentSeconds?: number;
135
203
  }): Promise<ExternalQuizAttempt>;
136
204
  getAttempt(attemptId: string): Promise<ExternalQuizAttempt>;
@@ -139,6 +207,36 @@ declare class QuizApiClient {
139
207
  childId?: string;
140
208
  quizId?: string;
141
209
  }): Promise<ExternalQuizAttempt[]>;
210
+ skipQuestion(payload: SkipQuestionPayload): Promise<{
211
+ success: boolean;
212
+ id: string;
213
+ message: string;
214
+ }>;
215
+ reportQuestion(payload: ReportQuestionPayload): Promise<{
216
+ success: boolean;
217
+ id: string;
218
+ message: string;
219
+ }>;
220
+ getStarterPrompts(): Promise<StarterPrompt[]>;
221
+ getOrCreateChatSession(params: {
222
+ questionId: string;
223
+ questionContent: QuestionContextForChat;
224
+ quizId: string;
225
+ childId: string;
226
+ parentId: string;
227
+ lessonId?: string;
228
+ courseId?: string;
229
+ }): Promise<ChatSession>;
230
+ sendChatMessage(params: {
231
+ chatId: string;
232
+ message: string;
233
+ questionContext: QuestionContextForChat;
234
+ childId: string;
235
+ }): Promise<ChatMessageResponse>;
236
+ getChatHistory(questionId: string, childId: string): Promise<{
237
+ chatId: string | null;
238
+ messages: ChatMessage[];
239
+ }>;
142
240
  }
143
241
 
144
242
  declare function checkAnswer(question: QuizQuestion, selectedAnswer: unknown): {
@@ -154,4 +252,4 @@ declare function calculateScore(answers: QuizAnswerDetail[]): {
154
252
  };
155
253
  declare function formatTime(seconds: number): string;
156
254
 
157
- export { type ApiClientConfig, type AttemptStatus, AttemptViewer, type AttemptViewerProps, type ExternalQuizAttempt, type QuestionType, type Quiz, type QuizAnswerDetail, QuizApiClient, QuizPlayer, type QuizPlayerProps, type QuizPlayerStyles, type QuizProgress, type QuizQuestion, type QuizResult, calculateScore, checkAnswer, createAnswerDetail, formatTime };
255
+ export { type ApiClientConfig, type AttemptStatus, AttemptViewer, type AttemptViewerProps, type ExternalQuizAttempt, type GenerateMoreQuestionsResult, type QuestionType, type Quiz, type QuizAnswerDetail, QuizApiClient, QuizPlayer, type QuizPlayerProps, type QuizPlayerStyles, type QuizProgress, type QuizQuestion, type QuizResult, TextToSpeech, calculateScore, checkAnswer, createAnswerDetail, formatTime };
package/dist/index.d.ts CHANGED
@@ -59,6 +59,10 @@ interface ExternalQuizAttempt {
59
59
  completedAt?: string;
60
60
  timeSpentSeconds?: number;
61
61
  }
62
+ interface GenerateMoreQuestionsResult {
63
+ extraQuestions: QuizQuestion[];
64
+ questionsGenerated: number;
65
+ }
62
66
  interface QuizPlayerProps {
63
67
  quizId: string;
64
68
  lessonId: string;
@@ -71,8 +75,10 @@ interface QuizPlayerProps {
71
75
  onComplete?: (result: QuizResult) => void;
72
76
  onError?: (error: Error) => void;
73
77
  onProgress?: (progress: QuizProgress) => void;
78
+ onGenerateMoreQuestions?: (attemptId: string, currentTotal: number) => Promise<GenerateMoreQuestionsResult>;
74
79
  className?: string;
75
80
  styles?: QuizPlayerStyles;
81
+ forceNewAttempt?: boolean;
76
82
  }
77
83
  interface QuizResult {
78
84
  attemptId: string;
@@ -103,11 +109,71 @@ interface AttemptViewerProps {
103
109
  showExplanations?: boolean;
104
110
  title?: string;
105
111
  }
112
+ type SkipReason = "question_issue" | "dont_know";
113
+ interface SkipQuestionPayload {
114
+ questionId: string;
115
+ questionContent: QuizQuestion;
116
+ skipReason: SkipReason;
117
+ skipComment?: string;
118
+ quizId?: string;
119
+ attemptId?: string;
120
+ childId: string;
121
+ parentId: string;
122
+ lessonId?: string;
123
+ courseId?: string;
124
+ assignLessonId?: string;
125
+ }
126
+ interface ReportQuestionPayload {
127
+ questionId: string;
128
+ questionContent: QuizQuestion;
129
+ reportComment: string;
130
+ quizId?: string;
131
+ attemptId?: string;
132
+ childId: string;
133
+ parentId: string;
134
+ lessonId?: string;
135
+ courseId?: string;
136
+ assignLessonId?: string;
137
+ }
138
+ interface ChatMessage {
139
+ role: 'user' | 'assistant';
140
+ content: string;
141
+ timestamp: string;
142
+ }
143
+ interface StarterPrompt {
144
+ id: string;
145
+ label: string;
146
+ message: string;
147
+ }
148
+ interface ChatSession {
149
+ chatId: string;
150
+ messages: ChatMessage[];
151
+ starterPrompts: StarterPrompt[];
152
+ }
153
+ interface ChatMessageResponse {
154
+ userMessage: ChatMessage;
155
+ assistantMessage: ChatMessage;
156
+ }
157
+ interface QuestionContextForChat {
158
+ id: string;
159
+ question: string;
160
+ type: string;
161
+ options?: string[];
162
+ correctAnswer?: string | string[];
163
+ explanation?: string;
164
+ }
106
165
 
107
- declare function QuizPlayer({ quizId, lessonId, assignLessonId, courseId, childId, parentId, apiBaseUrl, authToken, onComplete, onError, onProgress, className, }: QuizPlayerProps): react_jsx_runtime.JSX.Element;
166
+ declare function QuizPlayer({ quizId, lessonId, assignLessonId, courseId, childId, parentId, apiBaseUrl, authToken, onComplete, onError, onProgress, onGenerateMoreQuestions, className, forceNewAttempt, }: QuizPlayerProps): react_jsx_runtime.JSX.Element;
108
167
 
109
168
  declare function AttemptViewer({ attemptId, apiBaseUrl, authToken, onError, className, showExplanations, title, }: AttemptViewerProps): react_jsx_runtime.JSX.Element;
110
169
 
170
+ interface TextToSpeechProps {
171
+ text: string;
172
+ inline?: boolean;
173
+ size?: 'sm' | 'md';
174
+ }
175
+ declare function TextToSpeech({ text, inline, size }: TextToSpeechProps): react_jsx_runtime.JSX.Element;
176
+
111
177
  interface ApiClientConfig {
112
178
  baseUrl: string;
113
179
  authToken?: string;
@@ -125,12 +191,14 @@ declare class QuizApiClient {
125
191
  courseId: string;
126
192
  childId: string;
127
193
  parentId: string;
194
+ forceNew?: boolean;
128
195
  }): Promise<ExternalQuizAttempt>;
129
196
  updateAttempt(attemptId: string, data: {
130
197
  answers?: QuizAnswerDetail[];
131
198
  status?: 'in_progress' | 'completed' | 'abandoned';
132
199
  score?: number;
133
200
  correctAnswers?: number;
201
+ totalQuestions?: number;
134
202
  timeSpentSeconds?: number;
135
203
  }): Promise<ExternalQuizAttempt>;
136
204
  getAttempt(attemptId: string): Promise<ExternalQuizAttempt>;
@@ -139,6 +207,36 @@ declare class QuizApiClient {
139
207
  childId?: string;
140
208
  quizId?: string;
141
209
  }): Promise<ExternalQuizAttempt[]>;
210
+ skipQuestion(payload: SkipQuestionPayload): Promise<{
211
+ success: boolean;
212
+ id: string;
213
+ message: string;
214
+ }>;
215
+ reportQuestion(payload: ReportQuestionPayload): Promise<{
216
+ success: boolean;
217
+ id: string;
218
+ message: string;
219
+ }>;
220
+ getStarterPrompts(): Promise<StarterPrompt[]>;
221
+ getOrCreateChatSession(params: {
222
+ questionId: string;
223
+ questionContent: QuestionContextForChat;
224
+ quizId: string;
225
+ childId: string;
226
+ parentId: string;
227
+ lessonId?: string;
228
+ courseId?: string;
229
+ }): Promise<ChatSession>;
230
+ sendChatMessage(params: {
231
+ chatId: string;
232
+ message: string;
233
+ questionContext: QuestionContextForChat;
234
+ childId: string;
235
+ }): Promise<ChatMessageResponse>;
236
+ getChatHistory(questionId: string, childId: string): Promise<{
237
+ chatId: string | null;
238
+ messages: ChatMessage[];
239
+ }>;
142
240
  }
143
241
 
144
242
  declare function checkAnswer(question: QuizQuestion, selectedAnswer: unknown): {
@@ -154,4 +252,4 @@ declare function calculateScore(answers: QuizAnswerDetail[]): {
154
252
  };
155
253
  declare function formatTime(seconds: number): string;
156
254
 
157
- export { type ApiClientConfig, type AttemptStatus, AttemptViewer, type AttemptViewerProps, type ExternalQuizAttempt, type QuestionType, type Quiz, type QuizAnswerDetail, QuizApiClient, QuizPlayer, type QuizPlayerProps, type QuizPlayerStyles, type QuizProgress, type QuizQuestion, type QuizResult, calculateScore, checkAnswer, createAnswerDetail, formatTime };
255
+ export { type ApiClientConfig, type AttemptStatus, AttemptViewer, type AttemptViewerProps, type ExternalQuizAttempt, type GenerateMoreQuestionsResult, type QuestionType, type Quiz, type QuizAnswerDetail, QuizApiClient, QuizPlayer, type QuizPlayerProps, type QuizPlayerStyles, type QuizProgress, type QuizQuestion, type QuizResult, TextToSpeech, calculateScore, checkAnswer, createAnswerDetail, formatTime };