@edpire/sdk 0.12.3 → 0.14.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 +41 -0
- package/README.md +2 -2
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +17 -12
- package/dist/react.d.mts +53 -2
- package/dist/react.mjs +16 -11
- package/dist/umd/index.global.js +178 -170
- package/package.json +6 -3
- package/src/styles/runtime-utilities.css +1 -1
- package/src/styles/shell.css +1 -1
package/dist/react.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import { RuntimeAnswer, AssessmentAnswers, QuestionRuntimeProps, AssessmentConte
|
|
|
3
3
|
export { RuntimeAnswer } from '@youssefalmia/edpire-runtime';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { RichContent, ContentAST } from '@youssefalmia/edpire-schema/authoring';
|
|
6
|
+
import { AnswerPhoto, RichContent as RichContent$1 } from '@youssefalmia/edpire-schema';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* EdpireQuestion — public React component for rendering a single question.
|
|
@@ -372,6 +373,12 @@ interface EdpireAssessmentPlayerProps {
|
|
|
372
373
|
* ```
|
|
373
374
|
*/
|
|
374
375
|
mediaHandler?: QuestionRuntimeProps["mediaHandler"];
|
|
376
|
+
/**
|
|
377
|
+
* Reads a photo of the learner's paper copy and a handwritten formula into the answer sheet
|
|
378
|
+
* (Rédaction and open answers with the sheet on, runtime 3.21.0+). Without it the sheet takes
|
|
379
|
+
* typed text and formulas only.
|
|
380
|
+
*/
|
|
381
|
+
answerSheetHandler?: QuestionRuntimeProps["answerSheetHandler"];
|
|
375
382
|
/** Called when the learner successfully submits the assessment. */
|
|
376
383
|
onComplete?: (result: EmbedResult) => void;
|
|
377
384
|
/**
|
|
@@ -508,6 +515,17 @@ interface AssessmentShellProps {
|
|
|
508
515
|
/** Media upload handler — required for file-upload and recording modes in
|
|
509
516
|
* OpenResponse questions. */
|
|
510
517
|
mediaHandler?: QuestionRuntimeProps["mediaHandler"];
|
|
518
|
+
/**
|
|
519
|
+
* Reads a photo of the learner's paper copy and a handwritten formula into the answer sheet
|
|
520
|
+
* (Rédaction and open answers with the sheet on, runtime 3.21.0+). Without it the sheet takes
|
|
521
|
+
* typed text and formulas only.
|
|
522
|
+
*/
|
|
523
|
+
answerSheetHandler?: QuestionRuntimeProps["answerSheetHandler"];
|
|
524
|
+
/**
|
|
525
|
+
* "Report a marking mistake" under each automatically marked question once the paper is
|
|
526
|
+
* submitted (T189): the host sends the learner's reason to the teacher. Without it, no button.
|
|
527
|
+
*/
|
|
528
|
+
onReportGrade?: (questionId: string, reason: string) => Promise<void>;
|
|
511
529
|
/**
|
|
512
530
|
* BUILDER PREVIEW ONLY. When the assessment has no annex and this callback
|
|
513
531
|
* is supplied, the shell renders a dashed "add reference" ghost slot where
|
|
@@ -524,6 +542,39 @@ interface AssessmentShellProps {
|
|
|
524
542
|
*/
|
|
525
543
|
fallbackLogoUrl?: string;
|
|
526
544
|
}
|
|
527
|
-
declare function AssessmentShell({ assessment, meta, scoreHidden: scoreHiddenProp, isForm: isFormProp, requiredQuestionIds, locale, branding, timeLimitMinutes, startedAt, initialAnswers, onAnswersChange, saveState, resumed, onSubmit, review, onViewReport, reportLabel, onBack, backLabel, allowReset, onReset, overlayConfig, contained, layout, onClose, mediaHandler, onAddAnnex, fallbackLogoUrl, }: AssessmentShellProps): react_jsx_runtime.JSX.Element;
|
|
545
|
+
declare function AssessmentShell({ assessment, meta, scoreHidden: scoreHiddenProp, isForm: isFormProp, requiredQuestionIds, locale, branding, timeLimitMinutes, startedAt, initialAnswers, onAnswersChange, saveState, resumed, onSubmit, review, onViewReport, reportLabel, onBack, backLabel, allowReset, onReset, overlayConfig, contained, layout, onClose, mediaHandler, answerSheetHandler, onReportGrade, onAddAnnex, fallbackLogoUrl, }: AssessmentShellProps): react_jsx_runtime.JSX.Element;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* The answer sheet's reader (T189), built from two calls a host makes to Edpire: read photos of
|
|
549
|
+
* the paper copy, read a handwritten formula. Used by the Edpire app (its own attempt routes) and
|
|
550
|
+
* by the embed (POST /api/v1/embed/read with the embed token); a host can pass its own instead.
|
|
551
|
+
*/
|
|
552
|
+
|
|
553
|
+
type AnswerSheetHandler = NonNullable<QuestionRuntimeProps["answerSheetHandler"]>;
|
|
554
|
+
interface AnswerSheetReader {
|
|
555
|
+
readPhotos(input: {
|
|
556
|
+
images: string[];
|
|
557
|
+
photos: AnswerPhoto[];
|
|
558
|
+
nodeId?: string;
|
|
559
|
+
}): Promise<{
|
|
560
|
+
content: RichContent$1[];
|
|
561
|
+
}>;
|
|
562
|
+
readHandwriting(image: string): Promise<{
|
|
563
|
+
latex: string;
|
|
564
|
+
}>;
|
|
565
|
+
/** The phone hand-off (optional): a link and its QR code for the phone, an id to poll with. */
|
|
566
|
+
startCapture?(nodeId: string): Promise<{
|
|
567
|
+
captureId: string;
|
|
568
|
+
url: string;
|
|
569
|
+
qrImage: string;
|
|
570
|
+
}>;
|
|
571
|
+
/** The photos once the phone sent them, null until then. */
|
|
572
|
+
captureStatus?(captureId: string): Promise<{
|
|
573
|
+
photos: AnswerPhoto[];
|
|
574
|
+
} | null>;
|
|
575
|
+
}
|
|
576
|
+
declare function createAnswerSheetHandler(reader: AnswerSheetReader): AnswerSheetHandler;
|
|
577
|
+
/** The embed's reader: the embed token authorises the reading, it is not consumed. */
|
|
578
|
+
declare function embedAnswerSheetHandler(baseUrl: string, token: string): AnswerSheetHandler;
|
|
528
579
|
|
|
529
|
-
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 ShellSaveState, type SpinnerTheme, type SubmitResult, type TakeBranding };
|
|
580
|
+
export { type AnswerSheetHandler, type AnswerSheetReader, 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 ShellSaveState, type SpinnerTheme, type SubmitResult, type TakeBranding, createAnswerSheetHandler, embedAnswerSheetHandler };
|