@edpire/sdk 0.7.0 → 0.8.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/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;
@@ -226,6 +238,12 @@ interface EmbedResult {
226
238
  rightId: string;
227
239
  }>;
228
240
  };
241
+ /**
242
+ * The teacher's written feedback on an open response. Only ever present
243
+ * in a review (`GET /submissions/{id}/review`), since at submit time no
244
+ * teacher has graded anything yet.
245
+ */
246
+ teacher_feedback?: RichContent[];
229
247
  }>;
230
248
  }>;
231
249
  }>;
@@ -375,11 +393,17 @@ interface AssessmentShellProps {
375
393
  startedAt?: string;
376
394
  /** Called when the learner submits. Should throw on error. */
377
395
  onSubmit: (answers: AssessmentAnswers) => Promise<SubmitResult>;
396
+ /**
397
+ * Opens the shell on a finished attempt instead of a blank paper: already
398
+ * submitted, the learner's answers filled in and locked, marking shown. There
399
+ * is no way to submit from here, so `onSubmit` is never called.
400
+ */
401
+ review?: ShellReview;
378
402
  /** Called when the learner clicks "View Full Report". Omit to hide the button. */
379
403
  onViewReport?: (result: SubmitResult) => void;
380
404
  /** Custom label for the post-submit redirect button (overrides default). */
381
405
  reportLabel?: string;
382
- /** Called when the learner clicks the back button (shown only BEFORE submission). */
406
+ /** Called when the learner clicks the back button (shown before submission, and throughout a review). */
383
407
  onBack?: () => void;
384
408
  /** Custom label for the back button (default: localized "Back"). */
385
409
  backLabel?: string;
@@ -417,6 +441,6 @@ interface AssessmentShellProps {
417
441
  */
418
442
  fallbackLogoUrl?: string;
419
443
  }
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;
444
+ 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
445
 
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 };
446
+ 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 };