@schoolio/player 1.4.3 → 1.4.5

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
@@ -39,6 +39,10 @@ interface QuizAnswerDetail {
39
39
  isCorrect: boolean;
40
40
  explanation?: string;
41
41
  hint?: string;
42
+ items?: string[];
43
+ correctOrder?: number[];
44
+ leftItems?: string[];
45
+ rightItems?: string[];
42
46
  }
43
47
  type AttemptStatus = "in_progress" | "completed" | "abandoned";
44
48
  interface ExternalQuizAttempt {
@@ -79,6 +83,7 @@ interface QuizPlayerProps {
79
83
  className?: string;
80
84
  styles?: QuizPlayerStyles;
81
85
  forceNewAttempt?: boolean;
86
+ hideScore?: boolean;
82
87
  }
83
88
  interface QuizResult {
84
89
  attemptId: string;
@@ -164,7 +169,7 @@ interface QuestionContextForChat {
164
169
  explanation?: string;
165
170
  }
166
171
 
167
- declare function QuizPlayer({ quizId, lessonId, assignLessonId, courseId, childId, parentId, apiBaseUrl, authToken, onComplete, onError, onProgress, onGenerateMoreQuestions, className, forceNewAttempt, }: QuizPlayerProps): react_jsx_runtime.JSX.Element;
172
+ declare function QuizPlayer({ quizId, lessonId, assignLessonId, courseId, childId, parentId, apiBaseUrl, authToken, onComplete, onError, onProgress, onGenerateMoreQuestions, className, forceNewAttempt, hideScore, }: QuizPlayerProps): react_jsx_runtime.JSX.Element;
168
173
 
169
174
  declare function AttemptViewer({ attemptId, apiBaseUrl, authToken, onError, className, showExplanations, showConversation, title, }: AttemptViewerProps): react_jsx_runtime.JSX.Element;
170
175
 
@@ -175,6 +180,47 @@ interface TextToSpeechProps {
175
180
  }
176
181
  declare function TextToSpeech({ text, inline, size }: TextToSpeechProps): react_jsx_runtime.JSX.Element;
177
182
 
183
+ type ErrorCode = 'QUIZ_NOT_FOUND' | 'ATTEMPT_NOT_FOUND' | 'QUIZ_EXPIRED' | 'QUIZ_NOT_STARTED' | 'NETWORK_ERROR' | 'SERVER_ERROR' | 'UNAUTHORIZED' | 'FORBIDDEN' | 'TTS_FAILED' | 'CHAT_FAILED' | 'SUBMISSION_FAILED' | 'UNKNOWN_ERROR';
184
+ interface ErrorDefinition {
185
+ code: ErrorCode;
186
+ userMessage: string;
187
+ subMessage: string;
188
+ cause: string;
189
+ isBlocking: boolean;
190
+ }
191
+ declare const ERROR_DEFINITIONS: Record<ErrorCode, ErrorDefinition>;
192
+ declare function getErrorFromHttpStatus(status: number, context?: 'quiz' | 'attempt'): ErrorCode;
193
+ declare function getErrorFromMessage(message: string, context?: 'quiz' | 'attempt'): ErrorCode;
194
+
195
+ interface MaintenanceScreenProps {
196
+ errorCode?: ErrorCode;
197
+ }
198
+ declare function MaintenanceScreen({ errorCode }: MaintenanceScreenProps): react_jsx_runtime.JSX.Element;
199
+
200
+ interface ErrorTypesPanelProps {
201
+ className?: string;
202
+ }
203
+ declare function ErrorTypesPanel({ className }: ErrorTypesPanelProps): react_jsx_runtime.JSX.Element;
204
+
205
+ interface ErrorLog {
206
+ id: string;
207
+ errorCode: string;
208
+ context: 'quiz' | 'attempt';
209
+ resourceId: string | null;
210
+ component: 'QuizPlayer' | 'AttemptViewer';
211
+ count: number;
212
+ dismissed: number;
213
+ lastMessage: string | null;
214
+ firstSeenAt: string;
215
+ lastSeenAt: string;
216
+ }
217
+ interface ErrorLogsPanelProps {
218
+ apiBaseUrl: string;
219
+ authToken?: string;
220
+ onResourceClick?: (resourceId: string, context: 'quiz' | 'attempt') => void;
221
+ }
222
+ declare function ErrorLogsPanel({ apiBaseUrl, authToken, onResourceClick }: ErrorLogsPanelProps): react_jsx_runtime.JSX.Element;
223
+
178
224
  interface ApiClientConfig {
179
225
  baseUrl: string;
180
226
  authToken?: string;
@@ -243,6 +289,13 @@ declare class QuizApiClient {
243
289
  messages: ChatMessage[];
244
290
  }>>;
245
291
  getTextToSpeech(text: string, voice?: string): Promise<Blob>;
292
+ logError(params: {
293
+ errorCode: string;
294
+ context: 'quiz' | 'attempt';
295
+ resourceId?: string;
296
+ component: 'QuizPlayer' | 'AttemptViewer';
297
+ message?: string;
298
+ }): Promise<void>;
246
299
  }
247
300
 
248
301
  declare function checkAnswer(question: QuizQuestion, selectedAnswer: unknown): {
@@ -258,4 +311,4 @@ declare function calculateScore(answers: QuizAnswerDetail[]): {
258
311
  };
259
312
  declare function formatTime(seconds: number): string;
260
313
 
261
- 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 };
314
+ export { type ApiClientConfig, type AttemptStatus, AttemptViewer, type AttemptViewerProps, ERROR_DEFINITIONS, type ErrorCode, type ErrorDefinition, type ErrorLog, ErrorLogsPanel, type ErrorLogsPanelProps, ErrorTypesPanel, type ExternalQuizAttempt, type GenerateMoreQuestionsResult, MaintenanceScreen, type QuestionType, type Quiz, type QuizAnswerDetail, QuizApiClient, QuizPlayer, type QuizPlayerProps, type QuizPlayerStyles, type QuizProgress, type QuizQuestion, type QuizResult, TextToSpeech, calculateScore, checkAnswer, createAnswerDetail, formatTime, getErrorFromHttpStatus, getErrorFromMessage };
package/dist/index.d.ts CHANGED
@@ -39,6 +39,10 @@ interface QuizAnswerDetail {
39
39
  isCorrect: boolean;
40
40
  explanation?: string;
41
41
  hint?: string;
42
+ items?: string[];
43
+ correctOrder?: number[];
44
+ leftItems?: string[];
45
+ rightItems?: string[];
42
46
  }
43
47
  type AttemptStatus = "in_progress" | "completed" | "abandoned";
44
48
  interface ExternalQuizAttempt {
@@ -79,6 +83,7 @@ interface QuizPlayerProps {
79
83
  className?: string;
80
84
  styles?: QuizPlayerStyles;
81
85
  forceNewAttempt?: boolean;
86
+ hideScore?: boolean;
82
87
  }
83
88
  interface QuizResult {
84
89
  attemptId: string;
@@ -164,7 +169,7 @@ interface QuestionContextForChat {
164
169
  explanation?: string;
165
170
  }
166
171
 
167
- declare function QuizPlayer({ quizId, lessonId, assignLessonId, courseId, childId, parentId, apiBaseUrl, authToken, onComplete, onError, onProgress, onGenerateMoreQuestions, className, forceNewAttempt, }: QuizPlayerProps): react_jsx_runtime.JSX.Element;
172
+ declare function QuizPlayer({ quizId, lessonId, assignLessonId, courseId, childId, parentId, apiBaseUrl, authToken, onComplete, onError, onProgress, onGenerateMoreQuestions, className, forceNewAttempt, hideScore, }: QuizPlayerProps): react_jsx_runtime.JSX.Element;
168
173
 
169
174
  declare function AttemptViewer({ attemptId, apiBaseUrl, authToken, onError, className, showExplanations, showConversation, title, }: AttemptViewerProps): react_jsx_runtime.JSX.Element;
170
175
 
@@ -175,6 +180,47 @@ interface TextToSpeechProps {
175
180
  }
176
181
  declare function TextToSpeech({ text, inline, size }: TextToSpeechProps): react_jsx_runtime.JSX.Element;
177
182
 
183
+ type ErrorCode = 'QUIZ_NOT_FOUND' | 'ATTEMPT_NOT_FOUND' | 'QUIZ_EXPIRED' | 'QUIZ_NOT_STARTED' | 'NETWORK_ERROR' | 'SERVER_ERROR' | 'UNAUTHORIZED' | 'FORBIDDEN' | 'TTS_FAILED' | 'CHAT_FAILED' | 'SUBMISSION_FAILED' | 'UNKNOWN_ERROR';
184
+ interface ErrorDefinition {
185
+ code: ErrorCode;
186
+ userMessage: string;
187
+ subMessage: string;
188
+ cause: string;
189
+ isBlocking: boolean;
190
+ }
191
+ declare const ERROR_DEFINITIONS: Record<ErrorCode, ErrorDefinition>;
192
+ declare function getErrorFromHttpStatus(status: number, context?: 'quiz' | 'attempt'): ErrorCode;
193
+ declare function getErrorFromMessage(message: string, context?: 'quiz' | 'attempt'): ErrorCode;
194
+
195
+ interface MaintenanceScreenProps {
196
+ errorCode?: ErrorCode;
197
+ }
198
+ declare function MaintenanceScreen({ errorCode }: MaintenanceScreenProps): react_jsx_runtime.JSX.Element;
199
+
200
+ interface ErrorTypesPanelProps {
201
+ className?: string;
202
+ }
203
+ declare function ErrorTypesPanel({ className }: ErrorTypesPanelProps): react_jsx_runtime.JSX.Element;
204
+
205
+ interface ErrorLog {
206
+ id: string;
207
+ errorCode: string;
208
+ context: 'quiz' | 'attempt';
209
+ resourceId: string | null;
210
+ component: 'QuizPlayer' | 'AttemptViewer';
211
+ count: number;
212
+ dismissed: number;
213
+ lastMessage: string | null;
214
+ firstSeenAt: string;
215
+ lastSeenAt: string;
216
+ }
217
+ interface ErrorLogsPanelProps {
218
+ apiBaseUrl: string;
219
+ authToken?: string;
220
+ onResourceClick?: (resourceId: string, context: 'quiz' | 'attempt') => void;
221
+ }
222
+ declare function ErrorLogsPanel({ apiBaseUrl, authToken, onResourceClick }: ErrorLogsPanelProps): react_jsx_runtime.JSX.Element;
223
+
178
224
  interface ApiClientConfig {
179
225
  baseUrl: string;
180
226
  authToken?: string;
@@ -243,6 +289,13 @@ declare class QuizApiClient {
243
289
  messages: ChatMessage[];
244
290
  }>>;
245
291
  getTextToSpeech(text: string, voice?: string): Promise<Blob>;
292
+ logError(params: {
293
+ errorCode: string;
294
+ context: 'quiz' | 'attempt';
295
+ resourceId?: string;
296
+ component: 'QuizPlayer' | 'AttemptViewer';
297
+ message?: string;
298
+ }): Promise<void>;
246
299
  }
247
300
 
248
301
  declare function checkAnswer(question: QuizQuestion, selectedAnswer: unknown): {
@@ -258,4 +311,4 @@ declare function calculateScore(answers: QuizAnswerDetail[]): {
258
311
  };
259
312
  declare function formatTime(seconds: number): string;
260
313
 
261
- 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 };
314
+ export { type ApiClientConfig, type AttemptStatus, AttemptViewer, type AttemptViewerProps, ERROR_DEFINITIONS, type ErrorCode, type ErrorDefinition, type ErrorLog, ErrorLogsPanel, type ErrorLogsPanelProps, ErrorTypesPanel, type ExternalQuizAttempt, type GenerateMoreQuestionsResult, MaintenanceScreen, type QuestionType, type Quiz, type QuizAnswerDetail, QuizApiClient, QuizPlayer, type QuizPlayerProps, type QuizPlayerStyles, type QuizProgress, type QuizQuestion, type QuizResult, TextToSpeech, calculateScore, checkAnswer, createAnswerDetail, formatTime, getErrorFromHttpStatus, getErrorFromMessage };