@edpire/sdk 0.14.0 → 0.16.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 +55 -0
- package/README.md +2 -2
- package/dist/core.mjs +1 -1
- package/dist/index.d.mts +13 -0
- package/dist/index.mjs +15 -13
- package/dist/react.d.mts +87 -13
- package/dist/react.mjs +15 -13
- package/dist/umd/index.global.js +175 -171
- package/package.json +3 -3
- package/src/styles/runtime-utilities.css +1 -1
- package/src/styles/shell.css +1 -1
package/dist/react.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RuntimeAnswer, AssessmentAnswers, QuestionRuntimeProps, AssessmentContent } from '@youssefalmia/edpire-runtime';
|
|
3
|
-
export { RuntimeAnswer } from '@youssefalmia/edpire-runtime';
|
|
2
|
+
import { RuntimeAnswer, AssessmentAnswers, QuestionRuntimeProps, AssessmentContent, RuntimeAnswerSheetHandler } from '@youssefalmia/edpire-runtime';
|
|
3
|
+
export { PageTurn, ReadingErrorCode, 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
|
+
import { AnswerPhoto, RichContent as RichContent$1, ReadingLine } from '@youssefalmia/edpire-schema';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* EdpireQuestion — public React component for rendering a single question.
|
|
@@ -122,7 +122,20 @@ type NodeDetail = {
|
|
|
122
122
|
leftId: string;
|
|
123
123
|
rightId: string;
|
|
124
124
|
}>;
|
|
125
|
+
}
|
|
126
|
+
/** An AI-graded answer's barème lines, each with its sentence, then the next step (T189 D23). */
|
|
127
|
+
| {
|
|
128
|
+
type: "aiAnswer";
|
|
129
|
+
lines: AiFeedbackLine[];
|
|
130
|
+
next?: string;
|
|
125
131
|
};
|
|
132
|
+
/** One barème line of an AI-graded answer; no points when the score is hidden from learners. */
|
|
133
|
+
interface AiFeedbackLine {
|
|
134
|
+
label: string;
|
|
135
|
+
score?: number;
|
|
136
|
+
maxScore?: number;
|
|
137
|
+
feedback?: string;
|
|
138
|
+
}
|
|
126
139
|
interface NodeFeedback {
|
|
127
140
|
nodeId: string;
|
|
128
141
|
status: "correct" | "partial" | "incorrect" | "awaiting_review";
|
|
@@ -521,6 +534,13 @@ interface AssessmentShellProps {
|
|
|
521
534
|
* typed text and formulas only.
|
|
522
535
|
*/
|
|
523
536
|
answerSheetHandler?: QuestionRuntimeProps["answerSheetHandler"];
|
|
537
|
+
/**
|
|
538
|
+
* "Photograph my copy" beside Submit (0.16.0+): the learner photographs every page of a paper
|
|
539
|
+
* copy once and each part goes into its question. Needs an `answerSheetHandler` that stores
|
|
540
|
+
* photos first and an answer that takes photos. Off by default (Edpire turns it on per
|
|
541
|
+
* workspace while it is tried).
|
|
542
|
+
*/
|
|
543
|
+
wholeCopy?: boolean;
|
|
524
544
|
/**
|
|
525
545
|
* "Report a marking mistake" under each automatically marked question once the paper is
|
|
526
546
|
* submitted (T189): the host sends the learner's reason to the teacher. Without it, no button.
|
|
@@ -542,28 +562,78 @@ interface AssessmentShellProps {
|
|
|
542
562
|
*/
|
|
543
563
|
fallbackLogoUrl?: string;
|
|
544
564
|
}
|
|
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;
|
|
565
|
+
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, wholeCopy, onReportGrade, onAddAnnex, fallbackLogoUrl, }: AssessmentShellProps): react_jsx_runtime.JSX.Element;
|
|
546
566
|
|
|
547
567
|
/**
|
|
548
|
-
* The answer sheet's reader (T189), built from
|
|
549
|
-
* the paper copy, read a handwritten formula. Used by the Edpire app (its own
|
|
550
|
-
* by the embed (POST /api/v1/embed/read with the embed token); a host can pass
|
|
568
|
+
* The answer sheet's reader (T189), built from the calls a host makes to Edpire: store a photo of
|
|
569
|
+
* the paper copy, read stored photos, read a handwritten formula. Used by the Edpire app (its own
|
|
570
|
+
* attempt routes) and by the embed (POST /api/v1/embed/read with the embed token); a host can pass
|
|
571
|
+
* its own instead.
|
|
572
|
+
*
|
|
573
|
+
* Stored first (step 43, D28): with `signPhoto`, every photo is uploaded to storage before it is
|
|
574
|
+
* read, and the readers get stored photos only. The pad's small PNG is the one image sent inline.
|
|
575
|
+
* Streamed (step 44): with `streamPhotos`, lines reach the sheet as they are read, and a sideways
|
|
576
|
+
* page comes back as `turns` for the panel to turn and read again.
|
|
551
577
|
*/
|
|
552
578
|
|
|
553
|
-
|
|
579
|
+
/**
|
|
580
|
+
* The runtime's answer sheet handler (3.24.0): `uploadPhoto` and `readPages` when photos are
|
|
581
|
+
* stored first; `readPages` throws an `Error` whose message is a `ReadingErrorCode`.
|
|
582
|
+
*/
|
|
583
|
+
type AnswerSheetHandler = RuntimeAnswerSheetHandler;
|
|
554
584
|
interface AnswerSheetReader {
|
|
585
|
+
/**
|
|
586
|
+
* Reads photos of the copy into the sheet's content. With `signPhoto` (0.16.0+), every photo is
|
|
587
|
+
* stored first: `images` is then always empty, `photos` are the stored photos, and the result
|
|
588
|
+
* carries `lines` (what was read, line by line). Without it, `images` are the photos as JPEG
|
|
589
|
+
* data URLs, as before.
|
|
590
|
+
*/
|
|
555
591
|
readPhotos(input: {
|
|
556
592
|
images: string[];
|
|
557
593
|
photos: AnswerPhoto[];
|
|
558
594
|
nodeId?: string;
|
|
595
|
+
/** `copy`: the whole copy, each line placed in its question (0.16.0+). Absent = one answer. */
|
|
596
|
+
purpose?: "answer" | "copy";
|
|
559
597
|
}): Promise<{
|
|
560
598
|
content: RichContent$1[];
|
|
599
|
+
lines?: ReadingLine[];
|
|
561
600
|
}>;
|
|
562
|
-
|
|
601
|
+
/**
|
|
602
|
+
* A handwritten formula (a PNG data URL of the pad's ink, cropped) as LaTeX. `signal` aborts
|
|
603
|
+
* when a new stroke starts (0.16.0+): pass it to the request (a reader that ignores it still
|
|
604
|
+
* works; its answer is simply not shown).
|
|
605
|
+
*/
|
|
606
|
+
readHandwriting(image: string, options?: {
|
|
607
|
+
signal?: AbortSignal;
|
|
608
|
+
}): Promise<{
|
|
563
609
|
latex: string;
|
|
564
610
|
}>;
|
|
565
|
-
/**
|
|
566
|
-
|
|
611
|
+
/**
|
|
612
|
+
* Stored photos read line by line (0.16.0+): the host posts them to its streamed reading route
|
|
613
|
+
* and hands back the response, NDJSON `ReadingEvent`s; the handler reads it. Errors before the
|
|
614
|
+
* stream are a JSON `{ error }` with a status (429 `limit`, 503 `ai_busy`...). Without it,
|
|
615
|
+
* `readPhotos` answers whole.
|
|
616
|
+
*/
|
|
617
|
+
streamPhotos?(input: {
|
|
618
|
+
photos: AnswerPhoto[];
|
|
619
|
+
nodeId?: string;
|
|
620
|
+
purpose: "answer" | "copy";
|
|
621
|
+
upright?: boolean;
|
|
622
|
+
}, signal: AbortSignal): Promise<Response>;
|
|
623
|
+
/** A signed upload for one photo (0.16.0+): PUT it to `uploadUrl`, then read it by `url`. */
|
|
624
|
+
signPhoto?(input: {
|
|
625
|
+
mime: string;
|
|
626
|
+
sizeBytes: number;
|
|
627
|
+
}): Promise<{
|
|
628
|
+
uploadUrl: string;
|
|
629
|
+
contentType: string;
|
|
630
|
+
url: string;
|
|
631
|
+
}>;
|
|
632
|
+
/**
|
|
633
|
+
* The phone hand-off (optional): a link and its QR code for the phone, an id to poll with. No
|
|
634
|
+
* `nodeId`: the whole copy (0.16.0+), up to 12 photos.
|
|
635
|
+
*/
|
|
636
|
+
startCapture?(nodeId?: string): Promise<{
|
|
567
637
|
captureId: string;
|
|
568
638
|
url: string;
|
|
569
639
|
qrImage: string;
|
|
@@ -574,7 +644,11 @@ interface AnswerSheetReader {
|
|
|
574
644
|
} | null>;
|
|
575
645
|
}
|
|
576
646
|
declare function createAnswerSheetHandler(reader: AnswerSheetReader): AnswerSheetHandler;
|
|
577
|
-
/**
|
|
647
|
+
/**
|
|
648
|
+
* The embed's reader: the embed token authorises the reading, it is not consumed. Photos are
|
|
649
|
+
* stored under the embed session first, read line by line (0.16.0+), and on a computer the QR
|
|
650
|
+
* code opens Edpire's phone page, whose photos come back to the embed (0.16.0+).
|
|
651
|
+
*/
|
|
578
652
|
declare function embedAnswerSheetHandler(baseUrl: string, token: string): AnswerSheetHandler;
|
|
579
653
|
|
|
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 };
|
|
654
|
+
export { type AiFeedbackLine, 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 };
|