@edpire/sdk 0.14.0 → 0.15.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 +23 -0
- package/README.md +2 -2
- package/dist/core.mjs +1 -1
- package/dist/index.d.mts +13 -0
- package/dist/index.mjs +14 -14
- package/dist/react.d.mts +14 -1
- package/dist/react.mjs +14 -14
- package/dist/umd/index.global.js +162 -162
- 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,29 @@ the package follows [semantic versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [0.15.0] - 2026-12-02
|
|
15
|
+
|
|
16
|
+
Bundles runtime 3.23.0 (maths answers round 2, edpire.com T189).
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- One maths keyboard for every maths field. On a phone it sits on top of the phone's keyboard (∑,
|
|
21
|
+
x², fractions, roots, brackets, fx to turn text into a formula) and the two never stack; ∑ opens
|
|
22
|
+
the full panel, abc goes back. On a computer the key row under the box stays and "More" opens
|
|
23
|
+
the panel at the bottom of the window.
|
|
24
|
+
- A maths result can sit inside its sentence ("S = ▢."), as on a paper: the field grows with the
|
|
25
|
+
answer and shows ✓ or ✗ and its points in place.
|
|
26
|
+
- A detailed answer graded by AI shows each line of the teacher's marking scheme with its points
|
|
27
|
+
and one sentence, then the next step (`NodeDetail` type `aiAnswer`, `AiFeedbackLine`).
|
|
28
|
+
- In the answer box, a tap after a formula that ends a line puts the caret after it, and function
|
|
29
|
+
notation (`det(A)`, `ln(x)`, `u_n`, `f'(x)`) becomes maths.
|
|
30
|
+
|
|
31
|
+
### Upgrade notes
|
|
32
|
+
|
|
33
|
+
- Nothing to change in your code. The maths keyboard is fixed at the bottom of the window, above
|
|
34
|
+
the page (z-index 9000): a page with its own fixed layer that must stay on top sets the CSS
|
|
35
|
+
variable `--edp-kb-z`.
|
|
36
|
+
|
|
14
37
|
## [0.14.0] - 2026-12-01
|
|
15
38
|
|
|
16
39
|
Bundles runtime 3.22.1 (maths for real papers, edpire.com T189).
|
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.15.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.15.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/core.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function y(n){let s=[],r=0;for(let e of n.exercises)for(let i of e.questions)s.push({exerciseId:e.id,questionId:i.id,content:i.content_ast,points:i.points,sequenceNumber:i.sequence_number,index:r++});return s}function w(n){let s=new Map;for(let r of n){let e=new Map;for(let i of r.questions){let a=new Map;for(let t of i.nodeResults){let o={state:t.status,showFeedback:!0,score:t.score,...t.feedback!==void 0?{message:t.feedback}:{},...t.displayAnswer!==void 0?{displayAnswer:t.displayAnswer}:{},...t.teacherFeedback!==void 0?{teacherFeedback:t.teacherFeedback}:{}};t.detail?.type==="choiceSet"?o.correctChoiceIds=t.detail.correctChoiceIds:t.detail?.type==="matchingSet"?(o.pairFeedback=t.detail.pairFeedback,o.correctPairings=t.detail.correctPairings):t.detail?.type==="aiAnswer"&&(o.lines=t.detail.lines,t.detail.next&&(o.next=t.detail.next)),a.set(t.nodeId,o)}e.set(i.questionId,a)}s.set(r.exerciseId,e)}return s}function b(n){return(n??[]).map(s=>({exerciseId:s.exercise_id,questions:s.questions.map(r=>({questionId:r.question_id,...r.explanation?{explanation:r.explanation}:{},nodeResults:r.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 A(n){let s=w(b(n.exercise_feedback)),r=new Map;for(let t of n.answers.exerciseAnswers)for(let o of t.questionAnswers)r.set(o.questionId,o.answers);let e=n.submission.score_hidden===!0,i=[],a=0;for(let t of n.assessment.exercises){let o=s.get(t.id);for(let d of t.questions){let p=o?.get(d.id),f=n.exercise_feedback.find(c=>c.exercise_id===t.id)?.questions.find(c=>c.question_id===d.id),m=f?.node_results??[],u=0,l=0,x=!1;for(let c of m)u+=c.score??0,l+=c.max_score??0,c.status==="awaiting_review"&&(x=!0);i.push({exerciseId:t.id,questionId:d.id,content:d.content,sharedContext:t.sharedContext??null,explanation:f?.explanation??null,answers:r.get(d.id)??[],feedback:p?Object.fromEntries(p):{},score:u,maxScore:l,scoreHidden:e,status:x?"awaiting_review":e?k(m.map(c=>c.status)):l===0?"unscored":u>=l?"correct":u>0?"partial":"incorrect",index:a++})}}return i}function k(n){return n.length===0?"unscored":n.every(s=>s==="correct")?"correct":n.every(s=>s==="incorrect")?"incorrect":"partial"}function I(n){let s=new Map;for(let r of n)s.has(r.exerciseId)||s.set(r.exerciseId,[]),s.get(r.exerciseId).push({questionId:r.questionId,answers:r.answers});return{exerciseAnswers:Array.from(s.entries()).map(([r,e])=>({exerciseId:r,questionAnswers:e}))}}var S=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),q=new Set(["blankPool","inlinePool"]);function g(n){switch(n.type){case"choiceSet":case"inlineChoiceSet":return n.answer.selectedIds.length>0;case"blank":return n.answer.mode==="choice"?n.answer.choiceId.length>0:n.answer.text.trim().length>0;case"matchingSet":return n.answer.connections.length>0;case"aiAnswer":return n.answer.text.trim().length>0;case"openResponse":{let s=n.answer;return s.recording||s.files&&s.files.length>0?!0:(s.text?.wordCount??0)>0}case"mathResponse":return n.answer.latex.trim().length>0;case"codingResponse":return n.answer.source.trim().length>0;default:{let s=n;return!0}}}function h(n){let s=0,r=e=>{if(Array.isArray(e)){for(let t of e)r(t);return}if(!e||typeof e!="object")return;let{type:i,content:a}=e;if(typeof i=="string"){if(S.has(i)){s+=1;return}if(q.has(i))return}a!==void 0&&r(a)};return r(n),s}function R(n,s){let r=new Map;for(let i of s?.exerciseAnswers??[])for(let a of i.questionAnswers){let t=r.get(a.questionId);t||(t=new Set,r.set(a.questionId,t));for(let o of a.answers)g(o)&&t.add(o.nodeId)}let e=[];return n.exercises.forEach((i,a)=>{i.questions.forEach((t,o)=>{let d=h(t.content);d!==0&&(r.get(t.id)?.size??0)<d&&e.push({questionId:t.id,exerciseIndex:a,...i.title?{exerciseTitle:i.title}:{},questionIndex:o,only:i.questions.length===1})})}),e}function F(n,s,r){let e=new Set(r);return e.size===0?[]:R(n,s).filter(i=>e.has(i.questionId))}export{I as buildSubmitPayload,h as countAnswerableNodes,y as flattenAssessment,A as flattenReview,g as isAnswered,F as missingRequired};
|
package/dist/index.d.mts
CHANGED
|
@@ -66,7 +66,20 @@ type NodeDetail = {
|
|
|
66
66
|
leftId: string;
|
|
67
67
|
rightId: string;
|
|
68
68
|
}>;
|
|
69
|
+
}
|
|
70
|
+
/** An AI-graded answer's barème lines, each with its sentence, then the next step (T189 D23). */
|
|
71
|
+
| {
|
|
72
|
+
type: "aiAnswer";
|
|
73
|
+
lines: AiFeedbackLine[];
|
|
74
|
+
next?: string;
|
|
69
75
|
};
|
|
76
|
+
/** One barème line of an AI-graded answer; no points when the score is hidden from learners. */
|
|
77
|
+
interface AiFeedbackLine {
|
|
78
|
+
label: string;
|
|
79
|
+
score?: number;
|
|
80
|
+
maxScore?: number;
|
|
81
|
+
feedback?: string;
|
|
82
|
+
}
|
|
70
83
|
interface NodeFeedback {
|
|
71
84
|
nodeId: string;
|
|
72
85
|
status: "correct" | "partial" | "incorrect" | "awaiting_review";
|