@schoolio/player 1.3.0 → 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 +95 -2
- package/dist/index.d.ts +95 -2
- package/dist/index.js +1365 -295
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1364 -295
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -78,6 +78,7 @@ interface QuizPlayerProps {
|
|
|
78
78
|
onGenerateMoreQuestions?: (attemptId: string, currentTotal: number) => Promise<GenerateMoreQuestionsResult>;
|
|
79
79
|
className?: string;
|
|
80
80
|
styles?: QuizPlayerStyles;
|
|
81
|
+
forceNewAttempt?: boolean;
|
|
81
82
|
}
|
|
82
83
|
interface QuizResult {
|
|
83
84
|
attemptId: string;
|
|
@@ -108,11 +109,71 @@ interface AttemptViewerProps {
|
|
|
108
109
|
showExplanations?: boolean;
|
|
109
110
|
title?: string;
|
|
110
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
|
+
}
|
|
111
165
|
|
|
112
|
-
declare function QuizPlayer({ quizId, lessonId, assignLessonId, courseId, childId, parentId, apiBaseUrl, authToken, onComplete, onError, onProgress, onGenerateMoreQuestions, 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;
|
|
113
167
|
|
|
114
168
|
declare function AttemptViewer({ attemptId, apiBaseUrl, authToken, onError, className, showExplanations, title, }: AttemptViewerProps): react_jsx_runtime.JSX.Element;
|
|
115
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
|
+
|
|
116
177
|
interface ApiClientConfig {
|
|
117
178
|
baseUrl: string;
|
|
118
179
|
authToken?: string;
|
|
@@ -130,12 +191,14 @@ declare class QuizApiClient {
|
|
|
130
191
|
courseId: string;
|
|
131
192
|
childId: string;
|
|
132
193
|
parentId: string;
|
|
194
|
+
forceNew?: boolean;
|
|
133
195
|
}): Promise<ExternalQuizAttempt>;
|
|
134
196
|
updateAttempt(attemptId: string, data: {
|
|
135
197
|
answers?: QuizAnswerDetail[];
|
|
136
198
|
status?: 'in_progress' | 'completed' | 'abandoned';
|
|
137
199
|
score?: number;
|
|
138
200
|
correctAnswers?: number;
|
|
201
|
+
totalQuestions?: number;
|
|
139
202
|
timeSpentSeconds?: number;
|
|
140
203
|
}): Promise<ExternalQuizAttempt>;
|
|
141
204
|
getAttempt(attemptId: string): Promise<ExternalQuizAttempt>;
|
|
@@ -144,6 +207,36 @@ declare class QuizApiClient {
|
|
|
144
207
|
childId?: string;
|
|
145
208
|
quizId?: string;
|
|
146
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
|
+
}>;
|
|
147
240
|
}
|
|
148
241
|
|
|
149
242
|
declare function checkAnswer(question: QuizQuestion, selectedAnswer: unknown): {
|
|
@@ -159,4 +252,4 @@ declare function calculateScore(answers: QuizAnswerDetail[]): {
|
|
|
159
252
|
};
|
|
160
253
|
declare function formatTime(seconds: number): string;
|
|
161
254
|
|
|
162
|
-
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, 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
|
@@ -78,6 +78,7 @@ interface QuizPlayerProps {
|
|
|
78
78
|
onGenerateMoreQuestions?: (attemptId: string, currentTotal: number) => Promise<GenerateMoreQuestionsResult>;
|
|
79
79
|
className?: string;
|
|
80
80
|
styles?: QuizPlayerStyles;
|
|
81
|
+
forceNewAttempt?: boolean;
|
|
81
82
|
}
|
|
82
83
|
interface QuizResult {
|
|
83
84
|
attemptId: string;
|
|
@@ -108,11 +109,71 @@ interface AttemptViewerProps {
|
|
|
108
109
|
showExplanations?: boolean;
|
|
109
110
|
title?: string;
|
|
110
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
|
+
}
|
|
111
165
|
|
|
112
|
-
declare function QuizPlayer({ quizId, lessonId, assignLessonId, courseId, childId, parentId, apiBaseUrl, authToken, onComplete, onError, onProgress, onGenerateMoreQuestions, 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;
|
|
113
167
|
|
|
114
168
|
declare function AttemptViewer({ attemptId, apiBaseUrl, authToken, onError, className, showExplanations, title, }: AttemptViewerProps): react_jsx_runtime.JSX.Element;
|
|
115
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
|
+
|
|
116
177
|
interface ApiClientConfig {
|
|
117
178
|
baseUrl: string;
|
|
118
179
|
authToken?: string;
|
|
@@ -130,12 +191,14 @@ declare class QuizApiClient {
|
|
|
130
191
|
courseId: string;
|
|
131
192
|
childId: string;
|
|
132
193
|
parentId: string;
|
|
194
|
+
forceNew?: boolean;
|
|
133
195
|
}): Promise<ExternalQuizAttempt>;
|
|
134
196
|
updateAttempt(attemptId: string, data: {
|
|
135
197
|
answers?: QuizAnswerDetail[];
|
|
136
198
|
status?: 'in_progress' | 'completed' | 'abandoned';
|
|
137
199
|
score?: number;
|
|
138
200
|
correctAnswers?: number;
|
|
201
|
+
totalQuestions?: number;
|
|
139
202
|
timeSpentSeconds?: number;
|
|
140
203
|
}): Promise<ExternalQuizAttempt>;
|
|
141
204
|
getAttempt(attemptId: string): Promise<ExternalQuizAttempt>;
|
|
@@ -144,6 +207,36 @@ declare class QuizApiClient {
|
|
|
144
207
|
childId?: string;
|
|
145
208
|
quizId?: string;
|
|
146
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
|
+
}>;
|
|
147
240
|
}
|
|
148
241
|
|
|
149
242
|
declare function checkAnswer(question: QuizQuestion, selectedAnswer: unknown): {
|
|
@@ -159,4 +252,4 @@ declare function calculateScore(answers: QuizAnswerDetail[]): {
|
|
|
159
252
|
};
|
|
160
253
|
declare function formatTime(seconds: number): string;
|
|
161
254
|
|
|
162
|
-
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, 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 };
|