@schoolio/player 1.4.4 → 1.4.6

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
@@ -83,6 +83,7 @@ interface QuizPlayerProps {
83
83
  className?: string;
84
84
  styles?: QuizPlayerStyles;
85
85
  forceNewAttempt?: boolean;
86
+ hideScore?: boolean;
86
87
  }
87
88
  interface QuizResult {
88
89
  attemptId: string;
@@ -168,7 +169,7 @@ interface QuestionContextForChat {
168
169
  explanation?: string;
169
170
  }
170
171
 
171
- 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;
172
173
 
173
174
  declare function AttemptViewer({ attemptId, apiBaseUrl, authToken, onError, className, showExplanations, showConversation, title, }: AttemptViewerProps): react_jsx_runtime.JSX.Element;
174
175
 
@@ -179,6 +180,47 @@ interface TextToSpeechProps {
179
180
  }
180
181
  declare function TextToSpeech({ text, inline, size }: TextToSpeechProps): react_jsx_runtime.JSX.Element;
181
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
+
182
224
  interface ApiClientConfig {
183
225
  baseUrl: string;
184
226
  authToken?: string;
@@ -247,6 +289,13 @@ declare class QuizApiClient {
247
289
  messages: ChatMessage[];
248
290
  }>>;
249
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>;
250
299
  }
251
300
 
252
301
  declare function checkAnswer(question: QuizQuestion, selectedAnswer: unknown): {
@@ -262,4 +311,4 @@ declare function calculateScore(answers: QuizAnswerDetail[]): {
262
311
  };
263
312
  declare function formatTime(seconds: number): string;
264
313
 
265
- 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
@@ -83,6 +83,7 @@ interface QuizPlayerProps {
83
83
  className?: string;
84
84
  styles?: QuizPlayerStyles;
85
85
  forceNewAttempt?: boolean;
86
+ hideScore?: boolean;
86
87
  }
87
88
  interface QuizResult {
88
89
  attemptId: string;
@@ -168,7 +169,7 @@ interface QuestionContextForChat {
168
169
  explanation?: string;
169
170
  }
170
171
 
171
- 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;
172
173
 
173
174
  declare function AttemptViewer({ attemptId, apiBaseUrl, authToken, onError, className, showExplanations, showConversation, title, }: AttemptViewerProps): react_jsx_runtime.JSX.Element;
174
175
 
@@ -179,6 +180,47 @@ interface TextToSpeechProps {
179
180
  }
180
181
  declare function TextToSpeech({ text, inline, size }: TextToSpeechProps): react_jsx_runtime.JSX.Element;
181
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
+
182
224
  interface ApiClientConfig {
183
225
  baseUrl: string;
184
226
  authToken?: string;
@@ -247,6 +289,13 @@ declare class QuizApiClient {
247
289
  messages: ChatMessage[];
248
290
  }>>;
249
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>;
250
299
  }
251
300
 
252
301
  declare function checkAnswer(question: QuizQuestion, selectedAnswer: unknown): {
@@ -262,4 +311,4 @@ declare function calculateScore(answers: QuizAnswerDetail[]): {
262
311
  };
263
312
  declare function formatTime(seconds: number): string;
264
313
 
265
- 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 };