@edpire/sdk 0.7.0 → 0.8.1

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/react.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { RuntimeAnswer, QuestionRuntimeProps, AssessmentContent, AssessmentAnswers } from '@youssefalmia/edpire-runtime';
2
+ import { RuntimeAnswer, AssessmentAnswers, QuestionRuntimeProps, AssessmentContent } from '@youssefalmia/edpire-runtime';
3
3
  export { RuntimeAnswer } from '@youssefalmia/edpire-runtime';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { RichContent } from '@youssefalmia/edpire-schema/authoring';
@@ -40,6 +40,11 @@ interface EdpireQuestionProps {
40
40
  * Pre-fill answers — useful for restoring state when navigating back.
41
41
  */
42
42
  initialAnswers?: RuntimeAnswer[];
43
+ /**
44
+ * Lock the question: answers show but cannot be changed. For reviewing a
45
+ * finished attempt, with `initialAnswers` and `feedback` from `flattenReview()`.
46
+ */
47
+ readOnly?: boolean;
43
48
  /**
44
49
  * CSS class added to the question root div.
45
50
  */
@@ -135,6 +140,13 @@ interface ExerciseFeedbackData {
135
140
  exerciseId: string;
136
141
  questions: QuestionFeedback[];
137
142
  }
143
+ /** What the shell needs to open on a finished attempt. See `AssessmentShellProps.review`. */
144
+ interface ShellReview {
145
+ /** The answers given in the attempt, in the shape `onSubmit` receives them. */
146
+ answers: AssessmentAnswers;
147
+ /** The attempt's marking. Drives the score banner and every per-node mark. */
148
+ result: SubmitResult;
149
+ }
138
150
  interface SubmitResult {
139
151
  submissionId: string;
140
152
  totalScore: number;
@@ -146,6 +158,12 @@ interface SubmitResult {
146
158
  exerciseFeedback: ExerciseFeedbackData[];
147
159
  /** When true, score banners hide the score (still being reviewed). */
148
160
  awaitingManualGrading?: boolean;
161
+ /**
162
+ * When true, an AI-marked answer has no mark yet (it did not come back in
163
+ * time). The banner then says the answers are still being marked, rather
164
+ * than that a teacher is reviewing open responses.
165
+ */
166
+ aiPending?: boolean;
149
167
  }
150
168
 
151
169
  type SpinnerTheme = "default" | "dots" | "pulse" | "bars";
@@ -189,6 +207,8 @@ interface EmbedResult {
189
207
  attempt_number: number;
190
208
  /** True when the submission contains open-response nodes still pending teacher review. */
191
209
  awaiting_manual_grading?: boolean;
210
+ /** True when an AI-marked answer has no mark yet: it is being marked, not scored 0. */
211
+ ai_pending?: boolean;
192
212
  exercise_results: Array<{
193
213
  exercise_id: string;
194
214
  total_score: number;
@@ -226,6 +246,12 @@ interface EmbedResult {
226
246
  rightId: string;
227
247
  }>;
228
248
  };
249
+ /**
250
+ * The teacher's written feedback on an open response. Only ever present
251
+ * in a review (`GET /submissions/{id}/review`), since at submit time no
252
+ * teacher has graded anything yet.
253
+ */
254
+ teacher_feedback?: RichContent[];
229
255
  }>;
230
256
  }>;
231
257
  }>;
@@ -375,11 +401,17 @@ interface AssessmentShellProps {
375
401
  startedAt?: string;
376
402
  /** Called when the learner submits. Should throw on error. */
377
403
  onSubmit: (answers: AssessmentAnswers) => Promise<SubmitResult>;
404
+ /**
405
+ * Opens the shell on a finished attempt instead of a blank paper: already
406
+ * submitted, the learner's answers filled in and locked, marking shown. There
407
+ * is no way to submit from here, so `onSubmit` is never called.
408
+ */
409
+ review?: ShellReview;
378
410
  /** Called when the learner clicks "View Full Report". Omit to hide the button. */
379
411
  onViewReport?: (result: SubmitResult) => void;
380
412
  /** Custom label for the post-submit redirect button (overrides default). */
381
413
  reportLabel?: string;
382
- /** Called when the learner clicks the back button (shown only BEFORE submission). */
414
+ /** Called when the learner clicks the back button (shown before submission, and throughout a review). */
383
415
  onBack?: () => void;
384
416
  /** Custom label for the back button (default: localized "Back"). */
385
417
  backLabel?: string;
@@ -417,6 +449,6 @@ interface AssessmentShellProps {
417
449
  */
418
450
  fallbackLogoUrl?: string;
419
451
  }
420
- declare function AssessmentShell({ assessment, meta, locale, branding, timeLimitMinutes, startedAt, onSubmit, onViewReport, reportLabel, onBack, backLabel, allowReset, onReset, overlayConfig, contained, layout, onClose, mediaHandler, onAddAnnex, fallbackLogoUrl, }: AssessmentShellProps): react_jsx_runtime.JSX.Element;
452
+ declare function AssessmentShell({ assessment, meta, locale, branding, timeLimitMinutes, startedAt, onSubmit, review, onViewReport, reportLabel, onBack, backLabel, allowReset, onReset, overlayConfig, contained, layout, onClose, mediaHandler, onAddAnnex, fallbackLogoUrl, }: AssessmentShellProps): react_jsx_runtime.JSX.Element;
421
453
 
422
- export { AssessmentShell, type AssessmentShellProps, EdpireAssessmentPlayer, type EdpireAssessmentPlayerProps, EdpireQuestion, type EdpireQuestionProps, type ExerciseFeedbackData, type NodeDetail, type NodeFeedback, type OverlayConfig, type QuestionFeedback, type ShellLayout, type ShellLocale, type SpinnerTheme, type SubmitResult, type TakeBranding };
454
+ export { AssessmentShell, type AssessmentShellProps, EdpireAssessmentPlayer, type EdpireAssessmentPlayerProps, EdpireQuestion, type EdpireQuestionProps, type ExerciseFeedbackData, type NodeDetail, type NodeFeedback, type OverlayConfig, type QuestionFeedback, type ShellLayout, type ShellLocale, type ShellReview, type SpinnerTheme, type SubmitResult, type TakeBranding };