@edpire/sdk 0.11.1 → 0.12.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/CHANGELOG.md +47 -0
- package/README.md +2 -2
- package/dist/client.d.mts +42 -16
- package/dist/core.d.mts +61 -18
- package/dist/core.mjs +1 -1
- package/dist/index.d.mts +55 -18
- package/dist/index.mjs +24 -11
- package/dist/react.d.mts +52 -14
- package/dist/react.mjs +24 -11
- package/dist/umd/index.global.js +172 -157
- package/package.json +3 -3
- package/src/styles/runtime-utilities.css +1 -1
- package/src/styles/shell.css +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,53 @@ the package follows [semantic versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [0.12.0] - 2026-11-24
|
|
15
|
+
|
|
16
|
+
Runtime 3.20.0, schema 5.7.0.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **A score the teacher keeps from students.** On an assessment set to "Show the score: no" the
|
|
21
|
+
player shows what was right or wrong, the feedback and the correction, and no points anywhere:
|
|
22
|
+
not in the paper, not in the banner, not in a review. `EmbedResult`, `SubmissionReview` and the
|
|
23
|
+
shell's `SubmitResult` carry `score_hidden` / `scoreHidden`, with the score fields `null` (or
|
|
24
|
+
absent) from the server. `AssessmentShell` takes `scoreHidden`.
|
|
25
|
+
- **Required questions.** A question the teacher marks required gets a red `*`. Sending with one
|
|
26
|
+
unanswered opens no dialog: the page scrolls to the first one missing and each shows "This
|
|
27
|
+
question is required" until it is answered (every input filled, the rule of the unanswered
|
|
28
|
+
warning). From `meta.required_question_ids`; the shell takes `requiredQuestionIds`. The server's
|
|
29
|
+
`422 required_unanswered` is shown by the player and does not reach `onError`. `missingRequired`
|
|
30
|
+
is exported for hosts that draw their own player.
|
|
31
|
+
- **Forms.** A form's result (`isForm`) says "Send" instead of "Submit", plays no grading animation,
|
|
32
|
+
and ends on a thank-you in place of the paper. The shell takes `isForm`.
|
|
33
|
+
- **Exercise names.** An exercise the teacher named ("Dossier 1") shows its name in place of
|
|
34
|
+
"Exercise N", in the paper, the references and reviews.
|
|
35
|
+
- **Audio, from runtime 3.20.0.** One player for the paper, review and grading, with the teacher's
|
|
36
|
+
listening rules (plays, speed, skipping); the plays used travel as `mediaPlays` on the answers,
|
|
37
|
+
through `onAnswersChange` and the restore, so a reload doesn't give them back. A recorded answer
|
|
38
|
+
saves on stop and shows its upload's progress when your `mediaHandler.upload` reports it
|
|
39
|
+
(optional third argument, `onProgress` and `signal`).
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- **A submitted paper is read-only** in the shell, as on a review: the listening rules no longer
|
|
44
|
+
apply to it and nothing on it can be changed.
|
|
45
|
+
- A question with nothing to answer gets no "0 / 0" mark in a review.
|
|
46
|
+
- A long assessment title takes two lines at most in the top bar.
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- `GET /embed/assessments` no longer sends deleted questions (server side, every version).
|
|
51
|
+
|
|
52
|
+
### Upgrade notes
|
|
53
|
+
|
|
54
|
+
- TypeScript: `SubmitResult.score` and `maxScore` are optional, and the score fields of
|
|
55
|
+
`EmbedResult` and `SubmissionReview` are `number | null`. Handle `null` when `score_hidden` is
|
|
56
|
+
true and take the score from your server (`GET /submissions/{id}`). Nothing changes at runtime
|
|
57
|
+
until a teacher hides the score.
|
|
58
|
+
- Players before 0.12.0 show "null" for a hidden score and learn of a required question only from
|
|
59
|
+
the refused send: upgrade before you embed an assessment that uses either.
|
|
60
|
+
|
|
14
61
|
## [0.11.1] - 2026-11-19
|
|
15
62
|
|
|
16
63
|
### Fixed
|
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ embed.unmount()
|
|
|
92
92
|
**CDN (no bundler):**
|
|
93
93
|
|
|
94
94
|
```html
|
|
95
|
-
<script src="https://cdn.jsdelivr.net/npm/@edpire/sdk@0.
|
|
95
|
+
<script src="https://cdn.jsdelivr.net/npm/@edpire/sdk@0.12.0/dist/umd/index.global.js"></script>
|
|
96
96
|
<script>
|
|
97
97
|
EdpireSDK.EdpireAssessment.mount({ token, container: "#root", onComplete: handleDone })
|
|
98
98
|
</script>
|
|
@@ -330,7 +330,7 @@ The integration uses two parts:
|
|
|
330
330
|
</head>
|
|
331
331
|
<body>
|
|
332
332
|
<div id="root"></div>
|
|
333
|
-
<script src="https://cdn.jsdelivr.net/npm/@edpire/sdk@0.
|
|
333
|
+
<script src="https://cdn.jsdelivr.net/npm/@edpire/sdk@0.12.0/dist/umd/index.global.js"></script>
|
|
334
334
|
<script>
|
|
335
335
|
EdpireSDK.EdpireAssessment.mount({
|
|
336
336
|
token: "{{EMBED_TOKEN}}", // replace server-side before loading
|
package/dist/client.d.mts
CHANGED
|
@@ -47,11 +47,19 @@ interface TakeBranding {
|
|
|
47
47
|
type NodeFeedbackStatus = "correct" | "partial" | "incorrect" | "awaiting_review";
|
|
48
48
|
interface EmbedResult {
|
|
49
49
|
submission_id: string;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
/**
|
|
51
|
+
* `score`, `max_score`, `percentage`, `passed` and `passing_score_percent` are `null` when the
|
|
52
|
+
* assessment doesn't show the score to students (`score_hidden`): this result reaches the
|
|
53
|
+
* learner's browser. Your server still gets the score from `GET /submissions/{id}` and the
|
|
54
|
+
* `submission.created` webhook.
|
|
55
|
+
*/
|
|
56
|
+
score: number | null;
|
|
57
|
+
max_score: number | null;
|
|
58
|
+
percentage: number | null;
|
|
59
|
+
passed: boolean | null;
|
|
60
|
+
passing_score_percent: number | null;
|
|
61
|
+
/** True when the teacher chose not to show the score to students (SDK 0.12.0). */
|
|
62
|
+
score_hidden?: boolean;
|
|
55
63
|
attempt_number: number;
|
|
56
64
|
/** True when the submission contains open-response nodes still pending teacher review. */
|
|
57
65
|
awaiting_manual_grading?: boolean;
|
|
@@ -59,13 +67,15 @@ interface EmbedResult {
|
|
|
59
67
|
ai_pending?: boolean;
|
|
60
68
|
exercise_results: Array<{
|
|
61
69
|
exercise_id: string;
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
/** Null with `score_hidden`. */
|
|
71
|
+
total_score: number | null;
|
|
72
|
+
max_score: number | null;
|
|
64
73
|
question_results: Array<{
|
|
65
74
|
question_id: string;
|
|
66
|
-
|
|
75
|
+
/** Null with `score_hidden`. */
|
|
76
|
+
score: number | null;
|
|
67
77
|
correct: boolean;
|
|
68
|
-
points: number;
|
|
78
|
+
points: number | null;
|
|
69
79
|
}>;
|
|
70
80
|
}>;
|
|
71
81
|
exercise_feedback: Array<{
|
|
@@ -80,8 +90,9 @@ interface EmbedResult {
|
|
|
80
90
|
node_results: Array<{
|
|
81
91
|
node_id: string;
|
|
82
92
|
status: NodeFeedbackStatus;
|
|
83
|
-
|
|
84
|
-
|
|
93
|
+
/** Absent with `score_hidden`. */
|
|
94
|
+
score?: number;
|
|
95
|
+
max_score?: number;
|
|
85
96
|
feedback?: string;
|
|
86
97
|
display_answer?: string;
|
|
87
98
|
detail?: {
|
|
@@ -124,11 +135,18 @@ interface SubmissionReview {
|
|
|
124
135
|
attempt_number: number;
|
|
125
136
|
/** How many attempts this learner has made at this assessment, this one included. */
|
|
126
137
|
total_attempts: number;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
138
|
+
/**
|
|
139
|
+
* `score`, `max_score`, `percentage`, `passed` and `passing_score_percent` are `null` when the
|
|
140
|
+
* assessment doesn't show the score to students (`score_hidden`): a review is drawn for the
|
|
141
|
+
* learner. `GET /submissions/{id}` keeps the score for your own screens.
|
|
142
|
+
*/
|
|
143
|
+
score: number | null;
|
|
144
|
+
max_score: number | null;
|
|
145
|
+
percentage: number | null;
|
|
146
|
+
passed: boolean | null;
|
|
147
|
+
passing_score_percent: number | null;
|
|
148
|
+
/** True when the teacher chose not to show the score to students (SDK 0.12.0). */
|
|
149
|
+
score_hidden?: boolean;
|
|
132
150
|
is_fully_graded: boolean;
|
|
133
151
|
/**
|
|
134
152
|
* True while a teacher still has open responses to grade. `score`,
|
|
@@ -165,6 +183,8 @@ interface AssessmentLoaderResponse {
|
|
|
165
183
|
annex?: unknown | null;
|
|
166
184
|
exercises: Array<{
|
|
167
185
|
id: string;
|
|
186
|
+
/** The teacher's name for the exercise ("Dossier 1"); null shows as "Exercise N". */
|
|
187
|
+
title?: string | null;
|
|
168
188
|
sharedContext: unknown | null;
|
|
169
189
|
questions: Array<{
|
|
170
190
|
id: string;
|
|
@@ -189,6 +209,10 @@ interface AssessmentLoaderResponse {
|
|
|
189
209
|
* in a right-to-left product.
|
|
190
210
|
*/
|
|
191
211
|
language?: "en" | "fr" | "ar";
|
|
212
|
+
/** The teacher chose not to show the score to students: the player shows no points. */
|
|
213
|
+
score_hidden?: boolean;
|
|
214
|
+
/** Questions the learner must answer before sending; absent when none is. */
|
|
215
|
+
required_question_ids?: string[];
|
|
192
216
|
settings: {
|
|
193
217
|
time_limit_minutes: number | null;
|
|
194
218
|
passing_score_percent: number;
|
|
@@ -275,6 +299,8 @@ interface Assessment extends AssessmentSummary {
|
|
|
275
299
|
}
|
|
276
300
|
interface AssessmentExercise {
|
|
277
301
|
id: string;
|
|
302
|
+
/** The teacher's name for the exercise ("Dossier 1"); null shows as "Exercise N". */
|
|
303
|
+
title: string | null;
|
|
278
304
|
shared_context: unknown | null;
|
|
279
305
|
questions: AssessmentQuestion[];
|
|
280
306
|
}
|
package/dist/core.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RuntimeAnswer } from '@youssefalmia/edpire-runtime';
|
|
1
|
+
import { RuntimeAnswer, AssessmentContent, AssessmentAnswers } from '@youssefalmia/edpire-runtime';
|
|
2
2
|
import { ContentAST, RichContent } from '@youssefalmia/edpire-schema/authoring';
|
|
3
3
|
|
|
4
4
|
/** Flat per-question answer collected during a custom player session. */
|
|
@@ -81,11 +81,19 @@ interface TakeBranding {
|
|
|
81
81
|
type NodeFeedbackStatus = "correct" | "partial" | "incorrect" | "awaiting_review";
|
|
82
82
|
interface EmbedResult {
|
|
83
83
|
submission_id: string;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
/**
|
|
85
|
+
* `score`, `max_score`, `percentage`, `passed` and `passing_score_percent` are `null` when the
|
|
86
|
+
* assessment doesn't show the score to students (`score_hidden`): this result reaches the
|
|
87
|
+
* learner's browser. Your server still gets the score from `GET /submissions/{id}` and the
|
|
88
|
+
* `submission.created` webhook.
|
|
89
|
+
*/
|
|
90
|
+
score: number | null;
|
|
91
|
+
max_score: number | null;
|
|
92
|
+
percentage: number | null;
|
|
93
|
+
passed: boolean | null;
|
|
94
|
+
passing_score_percent: number | null;
|
|
95
|
+
/** True when the teacher chose not to show the score to students (SDK 0.12.0). */
|
|
96
|
+
score_hidden?: boolean;
|
|
89
97
|
attempt_number: number;
|
|
90
98
|
/** True when the submission contains open-response nodes still pending teacher review. */
|
|
91
99
|
awaiting_manual_grading?: boolean;
|
|
@@ -93,13 +101,15 @@ interface EmbedResult {
|
|
|
93
101
|
ai_pending?: boolean;
|
|
94
102
|
exercise_results: Array<{
|
|
95
103
|
exercise_id: string;
|
|
96
|
-
|
|
97
|
-
|
|
104
|
+
/** Null with `score_hidden`. */
|
|
105
|
+
total_score: number | null;
|
|
106
|
+
max_score: number | null;
|
|
98
107
|
question_results: Array<{
|
|
99
108
|
question_id: string;
|
|
100
|
-
|
|
109
|
+
/** Null with `score_hidden`. */
|
|
110
|
+
score: number | null;
|
|
101
111
|
correct: boolean;
|
|
102
|
-
points: number;
|
|
112
|
+
points: number | null;
|
|
103
113
|
}>;
|
|
104
114
|
}>;
|
|
105
115
|
exercise_feedback: Array<{
|
|
@@ -114,8 +124,9 @@ interface EmbedResult {
|
|
|
114
124
|
node_results: Array<{
|
|
115
125
|
node_id: string;
|
|
116
126
|
status: NodeFeedbackStatus;
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
/** Absent with `score_hidden`. */
|
|
128
|
+
score?: number;
|
|
129
|
+
max_score?: number;
|
|
119
130
|
feedback?: string;
|
|
120
131
|
display_answer?: string;
|
|
121
132
|
detail?: {
|
|
@@ -158,11 +169,18 @@ interface SubmissionReview {
|
|
|
158
169
|
attempt_number: number;
|
|
159
170
|
/** How many attempts this learner has made at this assessment, this one included. */
|
|
160
171
|
total_attempts: number;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
172
|
+
/**
|
|
173
|
+
* `score`, `max_score`, `percentage`, `passed` and `passing_score_percent` are `null` when the
|
|
174
|
+
* assessment doesn't show the score to students (`score_hidden`): a review is drawn for the
|
|
175
|
+
* learner. `GET /submissions/{id}` keeps the score for your own screens.
|
|
176
|
+
*/
|
|
177
|
+
score: number | null;
|
|
178
|
+
max_score: number | null;
|
|
179
|
+
percentage: number | null;
|
|
180
|
+
passed: boolean | null;
|
|
181
|
+
passing_score_percent: number | null;
|
|
182
|
+
/** True when the teacher chose not to show the score to students (SDK 0.12.0). */
|
|
183
|
+
score_hidden?: boolean;
|
|
166
184
|
is_fully_graded: boolean;
|
|
167
185
|
/**
|
|
168
186
|
* True while a teacher still has open responses to grade. `score`,
|
|
@@ -199,6 +217,8 @@ interface AssessmentLoaderResponse {
|
|
|
199
217
|
annex?: unknown | null;
|
|
200
218
|
exercises: Array<{
|
|
201
219
|
id: string;
|
|
220
|
+
/** The teacher's name for the exercise ("Dossier 1"); null shows as "Exercise N". */
|
|
221
|
+
title?: string | null;
|
|
202
222
|
sharedContext: unknown | null;
|
|
203
223
|
questions: Array<{
|
|
204
224
|
id: string;
|
|
@@ -223,6 +243,10 @@ interface AssessmentLoaderResponse {
|
|
|
223
243
|
* in a right-to-left product.
|
|
224
244
|
*/
|
|
225
245
|
language?: "en" | "fr" | "ar";
|
|
246
|
+
/** The teacher chose not to show the score to students: the player shows no points. */
|
|
247
|
+
score_hidden?: boolean;
|
|
248
|
+
/** Questions the learner must answer before sending; absent when none is. */
|
|
249
|
+
required_question_ids?: string[];
|
|
226
250
|
settings: {
|
|
227
251
|
time_limit_minutes: number | null;
|
|
228
252
|
passing_score_percent: number;
|
|
@@ -287,6 +311,8 @@ interface Assessment extends AssessmentSummary {
|
|
|
287
311
|
}
|
|
288
312
|
interface AssessmentExercise {
|
|
289
313
|
id: string;
|
|
314
|
+
/** The teacher's name for the exercise ("Dossier 1"); null shows as "Exercise N". */
|
|
315
|
+
title: string | null;
|
|
290
316
|
shared_context: unknown | null;
|
|
291
317
|
questions: AssessmentQuestion[];
|
|
292
318
|
}
|
|
@@ -441,5 +467,22 @@ declare function isAnswered(answer: RuntimeAnswer): boolean;
|
|
|
441
467
|
* paragraphs, and any node can sit inside a table cell or blockquote.
|
|
442
468
|
*/
|
|
443
469
|
declare function countAnswerableNodes(content: unknown): number;
|
|
470
|
+
/** Where an unfinished question sits: its exercise and its place in it, both from 0. */
|
|
471
|
+
interface IncompleteQuestion {
|
|
472
|
+
questionId: string;
|
|
473
|
+
exerciseIndex: number;
|
|
474
|
+
/** The exercise's name, when the teacher gave it one. */
|
|
475
|
+
exerciseTitle?: string;
|
|
476
|
+
questionIndex: number;
|
|
477
|
+
/** The exercise has one question, which then shows no "Question 1" label. */
|
|
478
|
+
only: boolean;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* The required questions the learner has not finished, in order (T168, D12). "Finished" is the
|
|
482
|
+
* warning's own rule, every input filled (D23), so a question is never required-and-answered
|
|
483
|
+
* here while the warning calls it unanswered. A required question with nothing to answer is
|
|
484
|
+
* never missing. The server asks the same question before it stores a send.
|
|
485
|
+
*/
|
|
486
|
+
declare function missingRequired(assessment: AssessmentContent, answers: AssessmentAnswers | null, requiredIds: Iterable<string>): IncompleteQuestion[];
|
|
444
487
|
|
|
445
|
-
export { type FlatStep, type ReviewStep, type StoredAnswer, type SubmissionReview, buildSubmitPayload, countAnswerableNodes, flattenAssessment, flattenReview, isAnswered };
|
|
488
|
+
export { type FlatStep, type IncompleteQuestion, type ReviewStep, type StoredAnswer, type SubmissionReview, buildSubmitPayload, countAnswerableNodes, flattenAssessment, flattenReview, isAnswered, missingRequired };
|
package/dist/core.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function h(t){let i=[],n=0;for(let e of t.exercises)for(let r of e.questions)i.push({exerciseId:e.id,questionId:r.id,content:r.content_ast,points:r.points,sequenceNumber:r.sequence_number,index:n++});return i}function m(t){let i=new Map;for(let n of t){let e=new Map;for(let r of n.questions){let o=new Map;for(let s of r.nodeResults){let a={state:s.status,showFeedback:!0,score:s.score,...s.feedback!==void 0?{message:s.feedback}:{},...s.displayAnswer!==void 0?{displayAnswer:s.displayAnswer}:{},...s.teacherFeedback!==void 0?{teacherFeedback:s.teacherFeedback}:{}};s.detail?.type==="choiceSet"?a.correctChoiceIds=s.detail.correctChoiceIds:s.detail?.type==="matchingSet"&&(a.pairFeedback=s.detail.pairFeedback,a.correctPairings=s.detail.correctPairings),o.set(s.nodeId,a)}e.set(r.questionId,o)}i.set(n.exerciseId,e)}return i}function w(t){return(t??[]).map(i=>({exerciseId:i.exercise_id,questions:i.questions.map(n=>({questionId:n.question_id,...n.explanation?{explanation:n.explanation}:{},nodeResults:n.node_results.map(e=>({nodeId:e.node_id,status:e.status,...e.score!==void 0?{score:e.score}:{},...e.max_score!==void 0?{maxScore:e.max_score}:{},...e.feedback!==void 0?{feedback:e.feedback}:{},...e.display_answer!==void 0?{displayAnswer:e.display_answer}:{},...e.detail!==void 0?{detail:e.detail}:{},...e.teacher_feedback!==void 0?{teacherFeedback:e.teacher_feedback}:{}}))}))}))}function k(t){let i=m(w(t.exercise_feedback)),n=new Map;for(let o of t.answers.exerciseAnswers)for(let s of o.questionAnswers)n.set(s.questionId,s.answers);let e=[],r=0;for(let o of t.assessment.exercises){let s=i.get(o.id);for(let a of o.questions){let d=s?.get(a.id),l=t.exercise_feedback.find(c=>c.exercise_id===o.id)?.questions.find(c=>c.question_id===a.id),g=l?.node_results??[],u=0,p=0,f=!1;for(let c of g)u+=c.score??0,p+=c.max_score??0,c.status==="awaiting_review"&&(f=!0);e.push({exerciseId:o.id,questionId:a.id,content:a.content,sharedContext:o.sharedContext??null,explanation:l?.explanation??null,answers:n.get(a.id)??[],feedback:d?Object.fromEntries(d):{},score:u,maxScore:p,status:f?"awaiting_review":p===0?"unscored":u>=p?"correct":u>0?"partial":"incorrect",index:r++})}}return e}function A(t){let i=new Map;for(let n of t)i.has(n.exerciseId)||i.set(n.exerciseId,[]),i.get(n.exerciseId).push({questionId:n.questionId,answers:n.answers});return{exerciseAnswers:Array.from(i.entries()).map(([n,e])=>({exerciseId:n,questionAnswers:e}))}}var y=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),I=new Set(["blankPool","inlinePool"]);function x(t){switch(t.type){case"choiceSet":case"inlineChoiceSet":return t.answer.selectedIds.length>0;case"blank":return t.answer.mode==="choice"?t.answer.choiceId.length>0:t.answer.text.trim().length>0;case"matchingSet":return t.answer.connections.length>0;case"aiAnswer":return t.answer.text.trim().length>0;case"openResponse":{let i=t.answer;return i.recording||i.files&&i.files.length>0?!0:(i.text?.wordCount??0)>0}case"mathResponse":return t.answer.latex.trim().length>0;case"codingResponse":return t.answer.source.trim().length>0;default:{let i=t;return!0}}}function b(t){let i=0,n=e=>{if(Array.isArray(e)){for(let s of e)n(s);return}if(!e||typeof e!="object")return;let{type:r,content:o}=e;if(typeof r=="string"){if(y.has(r)){i+=1;return}if(I.has(r))return}o!==void 0&&n(o)};return n(t),i}function S(t,i){let n=new Map;for(let r of i?.exerciseAnswers??[])for(let o of r.questionAnswers){let s=n.get(o.questionId);s||(s=new Set,n.set(o.questionId,s));for(let a of o.answers)x(a)&&s.add(a.nodeId)}let e=[];return t.exercises.forEach((r,o)=>{r.questions.forEach((s,a)=>{let d=b(s.content);d!==0&&(n.get(s.id)?.size??0)<d&&e.push({questionId:s.id,exerciseIndex:o,...r.title?{exerciseTitle:r.title}:{},questionIndex:a,only:r.questions.length===1})})}),e}function q(t,i,n){let e=new Set(n);return e.size===0?[]:S(t,i).filter(r=>e.has(r.questionId))}export{A as buildSubmitPayload,b as countAnswerableNodes,h as flattenAssessment,k as flattenReview,x as isAnswered,q as missingRequired};
|
package/dist/index.d.mts
CHANGED
|
@@ -70,8 +70,9 @@ type NodeDetail = {
|
|
|
70
70
|
interface NodeFeedback {
|
|
71
71
|
nodeId: string;
|
|
72
72
|
status: "correct" | "partial" | "incorrect" | "awaiting_review";
|
|
73
|
-
score
|
|
74
|
-
|
|
73
|
+
/** Absent when the assessment doesn't show the score to students (see `SubmitResult.scoreHidden`). */
|
|
74
|
+
score?: number;
|
|
75
|
+
maxScore?: number;
|
|
75
76
|
feedback?: string;
|
|
76
77
|
displayAnswer?: string;
|
|
77
78
|
detail?: NodeDetail;
|
|
@@ -101,6 +102,11 @@ interface SubmitResult {
|
|
|
101
102
|
/** If null/undefined, the shell hides the "View Full Report" button. */
|
|
102
103
|
returnUrl?: string | null;
|
|
103
104
|
exerciseFeedback: ExerciseFeedbackData[];
|
|
105
|
+
/**
|
|
106
|
+
* The assessment doesn't show the score to students: the server sent none (the numbers above
|
|
107
|
+
* are then 0 and meaningless). The shell shows the feedback and the correction, no points.
|
|
108
|
+
*/
|
|
109
|
+
scoreHidden?: boolean;
|
|
104
110
|
/** When true, score banners hide the score (still being reviewed). */
|
|
105
111
|
awaitingManualGrading?: boolean;
|
|
106
112
|
/**
|
|
@@ -109,6 +115,11 @@ interface SubmitResult {
|
|
|
109
115
|
* than that a teacher is reviewing open responses.
|
|
110
116
|
*/
|
|
111
117
|
aiPending?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* The assessment is a form: it collects answers and grades nothing. The banner thanks the
|
|
120
|
+
* respondent, with no report button. The score fields are 0, as with `scoreHidden`.
|
|
121
|
+
*/
|
|
122
|
+
isForm?: boolean;
|
|
112
123
|
}
|
|
113
124
|
|
|
114
125
|
type SpinnerTheme = "default" | "dots" | "pulse" | "bars";
|
|
@@ -144,11 +155,19 @@ type ShellLocale = "en" | "fr" | "ar";
|
|
|
144
155
|
type NodeFeedbackStatus = "correct" | "partial" | "incorrect" | "awaiting_review";
|
|
145
156
|
interface EmbedResult {
|
|
146
157
|
submission_id: string;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
158
|
+
/**
|
|
159
|
+
* `score`, `max_score`, `percentage`, `passed` and `passing_score_percent` are `null` when the
|
|
160
|
+
* assessment doesn't show the score to students (`score_hidden`): this result reaches the
|
|
161
|
+
* learner's browser. Your server still gets the score from `GET /submissions/{id}` and the
|
|
162
|
+
* `submission.created` webhook.
|
|
163
|
+
*/
|
|
164
|
+
score: number | null;
|
|
165
|
+
max_score: number | null;
|
|
166
|
+
percentage: number | null;
|
|
167
|
+
passed: boolean | null;
|
|
168
|
+
passing_score_percent: number | null;
|
|
169
|
+
/** True when the teacher chose not to show the score to students (SDK 0.12.0). */
|
|
170
|
+
score_hidden?: boolean;
|
|
152
171
|
attempt_number: number;
|
|
153
172
|
/** True when the submission contains open-response nodes still pending teacher review. */
|
|
154
173
|
awaiting_manual_grading?: boolean;
|
|
@@ -156,13 +175,15 @@ interface EmbedResult {
|
|
|
156
175
|
ai_pending?: boolean;
|
|
157
176
|
exercise_results: Array<{
|
|
158
177
|
exercise_id: string;
|
|
159
|
-
|
|
160
|
-
|
|
178
|
+
/** Null with `score_hidden`. */
|
|
179
|
+
total_score: number | null;
|
|
180
|
+
max_score: number | null;
|
|
161
181
|
question_results: Array<{
|
|
162
182
|
question_id: string;
|
|
163
|
-
|
|
183
|
+
/** Null with `score_hidden`. */
|
|
184
|
+
score: number | null;
|
|
164
185
|
correct: boolean;
|
|
165
|
-
points: number;
|
|
186
|
+
points: number | null;
|
|
166
187
|
}>;
|
|
167
188
|
}>;
|
|
168
189
|
exercise_feedback: Array<{
|
|
@@ -177,8 +198,9 @@ interface EmbedResult {
|
|
|
177
198
|
node_results: Array<{
|
|
178
199
|
node_id: string;
|
|
179
200
|
status: NodeFeedbackStatus;
|
|
180
|
-
|
|
181
|
-
|
|
201
|
+
/** Absent with `score_hidden`. */
|
|
202
|
+
score?: number;
|
|
203
|
+
max_score?: number;
|
|
182
204
|
feedback?: string;
|
|
183
205
|
display_answer?: string;
|
|
184
206
|
detail?: {
|
|
@@ -293,11 +315,18 @@ interface SubmissionReview {
|
|
|
293
315
|
attempt_number: number;
|
|
294
316
|
/** How many attempts this learner has made at this assessment, this one included. */
|
|
295
317
|
total_attempts: number;
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
318
|
+
/**
|
|
319
|
+
* `score`, `max_score`, `percentage`, `passed` and `passing_score_percent` are `null` when the
|
|
320
|
+
* assessment doesn't show the score to students (`score_hidden`): a review is drawn for the
|
|
321
|
+
* learner. `GET /submissions/{id}` keeps the score for your own screens.
|
|
322
|
+
*/
|
|
323
|
+
score: number | null;
|
|
324
|
+
max_score: number | null;
|
|
325
|
+
percentage: number | null;
|
|
326
|
+
passed: boolean | null;
|
|
327
|
+
passing_score_percent: number | null;
|
|
328
|
+
/** True when the teacher chose not to show the score to students (SDK 0.12.0). */
|
|
329
|
+
score_hidden?: boolean;
|
|
301
330
|
is_fully_graded: boolean;
|
|
302
331
|
/**
|
|
303
332
|
* True while a teacher still has open responses to grade. `score`,
|
|
@@ -401,6 +430,8 @@ interface AssessmentLoaderResponse {
|
|
|
401
430
|
annex?: unknown | null;
|
|
402
431
|
exercises: Array<{
|
|
403
432
|
id: string;
|
|
433
|
+
/** The teacher's name for the exercise ("Dossier 1"); null shows as "Exercise N". */
|
|
434
|
+
title?: string | null;
|
|
404
435
|
sharedContext: unknown | null;
|
|
405
436
|
questions: Array<{
|
|
406
437
|
id: string;
|
|
@@ -425,6 +456,10 @@ interface AssessmentLoaderResponse {
|
|
|
425
456
|
* in a right-to-left product.
|
|
426
457
|
*/
|
|
427
458
|
language?: "en" | "fr" | "ar";
|
|
459
|
+
/** The teacher chose not to show the score to students: the player shows no points. */
|
|
460
|
+
score_hidden?: boolean;
|
|
461
|
+
/** Questions the learner must answer before sending; absent when none is. */
|
|
462
|
+
required_question_ids?: string[];
|
|
428
463
|
settings: {
|
|
429
464
|
time_limit_minutes: number | null;
|
|
430
465
|
passing_score_percent: number;
|
|
@@ -533,6 +568,8 @@ interface Assessment extends AssessmentSummary {
|
|
|
533
568
|
}
|
|
534
569
|
interface AssessmentExercise {
|
|
535
570
|
id: string;
|
|
571
|
+
/** The teacher's name for the exercise ("Dossier 1"); null shows as "Exercise N". */
|
|
572
|
+
title: string | null;
|
|
536
573
|
shared_context: unknown | null;
|
|
537
574
|
questions: AssessmentQuestion[];
|
|
538
575
|
}
|